try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="263fa693-b219-4c98-a4ac-bbeb1094a21d",e._sentryDebugIdIdentifier="sentry-dbid-263fa693-b219-4c98-a4ac-bbeb1094a21d")}catch(e){}{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=Object.assign({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:anthropic-apps":!0})}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[53396],{0xd54b912:(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"}},0x14aef1aa:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getFullUserHash=t._normalizeUser=void 0;let i=r(0x248385392),n=r(0x9248bd08);t._normalizeUser=function(e,t,r){try{let i=JSON.parse(JSON.stringify(e));return null!=t&&null!=t.environment?i.statsigEnvironment=t.environment:null!=r&&(i.statsigEnvironment={tier:r}),i}catch(e){return n.Log.error("Failed to JSON.stringify user"),{statsigEnvironment:void 0}}},t._getFullUserHash=function(e){return e?(0,i._DJB2Object)(e):null}},0x159940a2:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});let n=r(0x24cedbcc6),s=r(0x1a52fdfae);class a extends n.NetworkCore{constructor(e,t){super(e,t);let r=null==e?void 0:e.networkConfig;this._initializeUrlConfig=new n.UrlConfiguration(n.Endpoint._initialize,null==r?void 0:r.initializeUrl,null==r?void 0:r.api,null==r?void 0:r.initializeFallbackUrls)}fetchEvaluations(e,t,r,s,a){return i(this,void 0,void 0,function*(){let i=t?(0,n._typedJsonParse)(t,"has_updates","InitializeResponse"):null,o={user:s,hash:"djb2",deltasResponseRequested:!1,full_checksum:null};return(null==i?void 0:i.has_updates)&&(o=Object.assign(Object.assign({},o),{sinceTime:a?i.time:0,previousDerivedFields:"derived_fields"in i&&a?i.derived_fields:{},deltasResponseRequested:!0,full_checksum:i.full_checksum})),this._fetchEvaluations(e,i,o,r)})}_fetchEvaluations(e,t,r,n){var a,o;return i(this,void 0,void 0,function*(){let i=yield this.post({sdkKey:e,urlConfig:this._initializeUrlConfig,data:r,retries:2,isStatsigEncodable:!0,priority:n});if((null==i?void 0:i.code)===204)return'{"has_updates": false}';if((null==i?void 0:i.code)!==200)return null!=(a=null==i?void 0:i.body)?a:null;if((null==t?void 0:t.has_updates)!==!0||(null==(o=i.body)?void 0:o.includes('"is_delta":true'))!==!0||!0!==r.deltasResponseRequested)return i.body;let l=(0,s._resolveDeltasResponse)(t,i.body);return"string"==typeof l?l:this._fetchEvaluations(e,t,Object.assign(Object.assign(Object.assign({},r),l),{deltasResponseRequested:!1}),n)})}}t.default=a},0x176bbf92:(e,t,r)=>{r.d(t,{G:()=>a,WI:()=>s,eq:()=>n});var i=r(0x24d73e0bd);let n=i.ZS.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),s=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},i=e=>{for(let n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(i);else if("invalid_return_type"===n.code)i(n.returnTypeError);else if("invalid_arguments"===n.code)i(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,i=0;for(;ie.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let r=i.path[0];t[r]=t[r]||[],t[r].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}a.create=e=>new a(e)},0x2320d314:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x2f083b9f:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createMemoKey=t.MemoPrefix=void 0,t.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_layer:"l",_paramStore:"p"};let r=new Set([]),i=new Set(["userPersistedValues"]);t.createMemoKey=function(e,t,n){let s=`${e}|${t}`;if(!n)return s;for(let e of Object.keys(n)){if(i.has(e))return;r.has(e)?s+=`|${e}=true`:s+=`|${e}=${n[e]}`}return s}},0x5c99e3d4:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(0x176bbf92),n=r(0x24d73e0bd);let s=(e,t)=>{let r;switch(e.code){case i.eq.invalid_type:r=e.received===n.Zp.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case i.eq.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,n.ZS.jsonStringifyReplacer)}`;break;case i.eq.unrecognized_keys:r=`Unrecognized key(s) in object: ${n.ZS.joinValues(e.keys,", ")}`;break;case i.eq.invalid_union:r="Invalid input";break;case i.eq.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${n.ZS.joinValues(e.options)}`;break;case i.eq.invalid_enum_value:r=`Invalid enum value. Expected ${n.ZS.joinValues(e.options)}, received '${e.received}'`;break;case i.eq.invalid_arguments:r="Invalid function arguments";break;case i.eq.invalid_return_type:r="Invalid function return type";break;case i.eq.invalid_date:r="Invalid date";break;case i.eq.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:n.ZS.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case i.eq.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case i.eq.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case i.eq.custom:r="Invalid input";break;case i.eq.invalid_intersection_types:r="Intersection results could not be merged";break;case i.eq.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case i.eq.not_finite:r="Number must be finite";break;default:r=t.defaultError,n.ZS.assertNever(e)}return{message:r}}},0x5cae0f4f:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClientBase=void 0,r(0x1dacc47cd);let n=r(0x1dacc47cd),s=r(0x5fd7800e),a=r(0x1ba4e8e1e),o=r(0x9248bd08),l=r(0x2f083b9f),u=r(0xea3899c8),d=r(0xc64daf27),c=r(0xe8a28702);class h{constructor(e,t,r,i){var l;this.loadingStatus="Uninitialized",this._initializePromise=null,this._listeners={};let h=this.$emt.bind(this);(null==i?void 0:i.logLevel)!=null&&(o.Log.level=i.logLevel),(null==i?void 0:i.disableStorage)&&c.Storage._setDisabled(!0),(null==i?void 0:i.initialSessionID)&&d.StatsigSession.overrideInitialSessionID(i.initialSessionID,e),(null==i?void 0:i.storageProvider)&&c.Storage._setProvider(i.storageProvider),this._sdkKey=e,this._options=null!=i?i:{},this._memoCache={},this.overrideAdapter=null!=(l=null==i?void 0:i.overrideAdapter)?l:null,this._logger=new a.EventLogger(e,h,r,i),this._errorBoundary=new s.ErrorBoundary(e,i,h),this._errorBoundary.wrap(this),this._errorBoundary.wrap(t),this._errorBoundary.wrap(this._logger),r.setErrorBoundary(this._errorBoundary),this.dataAdapter=t,this.dataAdapter.attach(e,i),this.storageProvider=c.Storage,this._primeReadyRipcord(),function(e,t){var r;if((0,u._isServerEnv)())return;let i=(0,n._getStatsigGlobal)(),s=null!=(r=i.instances)?r:{};null!=s[e]&&o.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),s[e]=t,i.firstInstance||(i.firstInstance=t),i.instances=s,__STATSIG__=i}(e,this)}updateRuntimeOptions(e){null!=e.disableLogging&&(this._options.disableLogging=e.disableLogging,this._logger.setLoggingDisabled(e.disableLogging)),null!=e.disableStorage&&(this._options.disableStorage=e.disableStorage,c.Storage._setDisabled(e.disableStorage))}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]){let r=this._listeners[e].indexOf(t);-1!==r&&this._listeners[e].splice(r,1)}}$on(e,t){t.__isInternal=!0,this.on(e,t)}$emt(e){var t;let r=t=>{try{t(e)}catch(r){if(!0===t.__isInternal)return void this._errorBoundary.logError(`__emit:${e.name}`,r);o.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=>r(e)),null==(t=this._listeners["*"])||t.forEach(r)}_setStatus(e,t){this.loadingStatus=e,this._memoCache={},this.$emt({name:"values_updated",status:e,values:t})}_enqueueExposure(e,t,r){if((null==r?void 0:r.disableExposureLog)===!0)return void this._logger.incrementNonExposureCount(e);this._logger.enqueue(t)}_memoize(e,t){return(r,i)=>{if(this._options.disableEvaluationMemoization)return t(r,i);let n=(0,l.createMemoKey)(e,r,i);return n?(n in this._memoCache||(Object.keys(this._memoCache).length>=3e3&&(this._memoCache={}),this._memoCache[n]=t(r,i)),this._memoCache[n]):t(r,i)}}}t.StatsigClientBase=h},0x5fd7800e:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.EXCEPTION_ENDPOINT=void 0;let n=r(0x9248bd08),s=r(0x139d91e26),a=r(0x7ce6115c);t.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";let o="[Statsig] UnknownError";class l{constructor(e,t,r,i){this._sdkKey=e,this._options=t,this._emitter=r,this._lastSeenError=i,this._seen=new Set}wrap(e){try{(function(e){let t=new Set,r=Object.getPrototypeOf(e);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).filter(e=>"function"==typeof(null==r?void 0:r[e])).forEach(e=>t.add(e)),r=Object.getPrototypeOf(r);return Array.from(t)})(e).forEach(t=>{let r=e[t];"$EB"in r||(e[t]=(...i)=>this._capture(t,()=>r.apply(e,i)),e[t].$EB=!0)})}catch(e){this._onError("eb:wrap",e)}}logError(e,t){this._onError(e,t)}getLastSeenErrorAndReset(){let e=this._lastSeenError;return this._lastSeenError=void 0,null!=e?e:null}attachErrorIfNoneExists(e){this._lastSeenError||(this._lastSeenError=u(e))}_capture(e,t){try{let r=t();if(r&&r instanceof Promise)return r.catch(t=>this._onError(e,t));return r}catch(t){return this._onError(e,t),null}}_onError(e,r){try{n.Log.warn(`Caught error in ${e}`,{error:r}),i(this,void 0,void 0,function*(){var i,n,l,d,c,h,f;let p=r||Error(o),g=p instanceof Error,_=g?p.name:"No Name",m=u(p);if(this._lastSeenError=m,this._seen.has(_))return;if(this._seen.add(_),null==(n=null==(i=this._options)?void 0:i.networkConfig)?void 0:n.preventAllNetworkTraffic){null==(l=this._emitter)||l.call(this,{name:"error",error:r,tag:e});return}let y=s.SDKType._get(this._sdkKey),v=a.StatsigMetadataProvider.get(),b=g?p.stack:function(e){try{return JSON.stringify(e)}catch(e){return o}}(p),k=JSON.stringify(Object.assign({tag:e,exception:_,info:b},Object.assign(Object.assign({},v),{sdkType:y}))),x=null!=(h=null==(c=null==(d=this._options)?void 0:d.networkConfig)?void 0:c.networkOverrideFunc)?h:fetch;yield x(t.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(y),"STATSIG-SDK-VERSION":String(v.sdkVersion),"Content-Type":"application/json"},body:k}),null==(f=this._emitter)||f.call(this,{name:"error",error:r,tag:e})}).then(()=>{}).catch(()=>{})}catch(e){}}}function u(e){return e instanceof Error?e:"string"==typeof e?Error(e):Error("An unknown error occurred.")}t.ErrorBoundary=l},0x620e1be7:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0x24cedbcc6);class n{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 r;if(!e)return!1;let n=(0,i._typedJsonParse)(e.data,"has_updates","EvaluationResponse");return null!=n&&(this._source=e.source,(null==n?void 0:n.has_updates)!==!0||(this._rawValues=e.data,this._lcut=n.time,this._receivedAt=e.receivedAt,this._values=n,this._bootstrapMetadata=this._extractBootstrapMetadata(e.source,n),e.source&&n.user&&this._setWarningState(t,n),i.SDKFlags.setFlags(this._sdkKey,null!=(r=n.sdk_flags)?r:{}),!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.feature_gates,e)}getConfig(e){var t;return this._getDetailedStoreResult(null==(t=this._values)?void 0:t.dynamic_configs,e)}getLayer(e){var t;return this._getDetailedStoreResult(null==(t=this._values)?void 0:t.layer_configs,e)}getParamStore(e){var t;return this._getDetailedStoreResult(null==(t=this._values)?void 0:t.param_stores,e)}getSource(){return this._source}getExposureMapping(){var e;return null==(e=this._values)?void 0:e.exposures}_extractBootstrapMetadata(e,t){if("Bootstrap"!==e)return null;let r={};return t.user&&(r.user=t.user),t.sdkInfo&&(r.generatorSDKInfo=t.sdkInfo),r.lcut=t.time,r}_getDetailedStoreResult(e,t){let r=null;return e&&(r=e[t]?e[t]:e[(0,i._DJB2)(t)]),{result:r,details:this._getDetails(null==r)}}_setWarningState(e,t){var r;let n=i.StableID.get(this._sdkKey);if((null==(r=e.customIDs)?void 0:r.stableID)!==n)return void this._warnings.add("StableIDMismatch");if("user"in t){let r=t.user;(0,i._getFullUserHash)(e)!==(0,i._getFullUserHash)(r)&&this._warnings.add("PartialUserMatch")}}getCurrentSourceDetails(){if("Uninitialized"===this._source||"NoValues"===this._source)return{reason:this._source};let 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,r;let i=this.getCurrentSourceDetails(),n=i.reason,s=null!=(t=i.warnings)?t:[];"Bootstrap"===this._source&&s.length>0&&(n+=s[0]),"Uninitialized"!==n&&"NoValues"!==n&&(n=`${n}:${e?"Unrecognized":"Recognized"}`);let a="Bootstrap"===this._source&&null!=(r=this._bootstrapMetadata)?r:void 0;return a&&(i.bootstrapMetadata=a),Object.assign(Object.assign({},i),{reason:n})}}t.default=n},0x78b33fbd:function(e,t,r){var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.useStatsigUser=t.useStatsigInternalClientFactoryBootstrap=t.useStatsigInternalClientFactoryAsync=t.useStatsigClient=t.useParameterStore=t.useLayer=t.useGateValue=t.useFeatureGate=t.useExperiment=t.useDynamicConfig=t.useClientBootstrapInit=t.useClientAsyncInit=t.StatsigProvider=t.StatsigContext=void 0;let s=r(0x16d97559d);t.StatsigContext=s.default;let a=r(0xfd0f87a3);Object.defineProperty(t,"StatsigProvider",{enumerable:!0,get:function(){return a.StatsigProvider}});let o=r(0x8429651d);Object.defineProperty(t,"useClientAsyncInit",{enumerable:!0,get:function(){return o.useClientAsyncInit}});let l=r(0x197e2f5df);Object.defineProperty(t,"useClientBootstrapInit",{enumerable:!0,get:function(){return l.useClientBootstrapInit}});let u=r(0x245daa5b9);t.useDynamicConfig=u.default;let d=r(0x15497a2f1);t.useExperiment=d.default;let c=r(0xc7b2149b);t.useFeatureGate=c.default;let h=r(0x1d59d9842);t.useGateValue=h.default;let f=r(0x8682b1c7);t.useLayer=f.default;let p=r(0x14ab7f896);t.useParameterStore=p.default;let g=r(0x144061902);Object.defineProperty(t,"useStatsigClient",{enumerable:!0,get:function(){return g.useStatsigClient}});let _=r(0x1c3862191);Object.defineProperty(t,"useStatsigInternalClientFactoryAsync",{enumerable:!0,get:function(){return _.useStatsigInternalClientFactoryAsync}});let m=r(0x1e496a27f);Object.defineProperty(t,"useStatsigInternalClientFactoryBootstrap",{enumerable:!0,get:function(){return m.useStatsigInternalClientFactoryBootstrap}});let y=r(0x253cac196);Object.defineProperty(t,"useStatsigUser",{enumerable:!0,get:function(){return y.useStatsigUser}}),n(r(0x2053ed714),t),__STATSIG__=Object.assign(Object.assign({},null!=__STATSIG__?__STATSIG__:{}),{StatsigContext:s.default,StatsigProvider:a.StatsigProvider,useClientAsyncInit:o.useClientAsyncInit,useClientBootstrapInit:l.useClientBootstrapInit,useDynamicConfig:u.default,useExperiment:d.default,useFeatureGate:c.default,useGateValue:h.default,useLayer:f.default,useParameterStore:p.default,useStatsigClient:g.useStatsigClient,useStatsigInternalClientFactoryAsync:_.useStatsigInternalClientFactoryAsync,useStatsigInternalClientFactoryBootstrap:m.useStatsigInternalClientFactoryBootstrap,useStatsigUser:y.useStatsigUser})},0x7ce6115c:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigMetadataProvider=t.SDK_VERSION=void 0,t.SDK_VERSION="3.12.1";let r={sdkVersion:t.SDK_VERSION,sdkType:"js-mono"};t.StatsigMetadataProvider={get:()=>r,add:e=>{r=Object.assign(Object.assign({},r),e)}}},0x8429651d:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useClientAsyncInit=void 0;let i=r(0x2053ed714),n=r(0x1c3862191);t.useClientAsyncInit=function(e,t,r=null){return(0,n.useStatsigInternalClientFactoryAsync)(e=>new i.StatsigClient(e.sdkKey,e.initialUser,e.statsigOptions),{sdkKey:e,initialUser:t,statsigOptions:r})}},0x8682b1c7:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0xfc89b4a4),n=r(0x24cedbcc6),s=r(0x183840035),a=r(0x16d97559d);t.default=function(e,t){let{client:r,renderVersion:o}=(0,i.useContext)(a.default);return(0,i.useMemo)(()=>(0,s.isNoopClient)(r)?(n.Log.warn(`useLayer hook failed to find a valid Statsig client for layer '${e}'.`),s.NoopEvaluationsClient.getLayer(e,t)):r.getLayer(e,t),[e,r,o,...t?Object.values(t):[]])}},0x8c60c6b2:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x92211ac1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x9248bd08:(e,t)=>{function r(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 ",...r(e))}static debug(...e){i.level>=t.LogLevel.Debug&&console.debug(" DEBUG ",...r(e))}static warn(...e){i.level>=t.LogLevel.Warn&&console.warn(" WARN ",...r(e))}static error(...e){i.level>=t.LogLevel.Error&&console.error(" ERROR ",...r(e))}}t.Log=i,i.level=t.LogLevel.Warn},0xb2309e3e:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._makeDataAdapterResult=t.DataAdapterCore=void 0;let n=r(0x9248bd08),s=r(0x1fe8a09fc),a=r(0x14aef1aa),o=r(0xe8a28702),l=r(0x22b42d2c7);class u{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 c}attach(e,t){this._sdkKey=e,this._options=t}getDataSync(e){let t=e&&(0,a._normalizeUser)(e,this._options),r=this._getCacheKey(t),i=this._inMemoryCache.get(r,t);if(i)return i;let n=this._loadFromCache(r);return n?(this._inMemoryCache.add(r,n),this._inMemoryCache.get(r,t)):null}setData(e,t){let r=t&&(0,a._normalizeUser)(t,this._options),i=this._getCacheKey(r);this._inMemoryCache.add(i,d("Bootstrap",e,null,r))}_getDataAsyncImpl(e,t,r){return i(this,void 0,void 0,function*(){o.Storage.isReady()||(yield o.Storage.isReadyResolver());let i=null!=e?e:this.getDataSync(t),s=[this._fetchAndPrepFromNetwork(i,t,r)];return(null==r?void 0:r.timeoutMs)&&s.push(new Promise(e=>setTimeout(e,r.timeoutMs)).then(()=>(n.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(s)})}_prefetchDataImpl(e,t){return i(this,void 0,void 0,function*(){let r=e&&(0,a._normalizeUser)(e,this._options),i=this._getCacheKey(r),n=yield this._getDataAsyncImpl(null,r,t);n&&this._inMemoryCache.add(i,Object.assign(Object.assign({},n),{source:"Prefetch"}))})}_fetchAndPrepFromNetwork(e,t,r){var a;return i(this,void 0,void 0,function*(){let i=null!=(a=null==e?void 0:e.data)?a:null,o=null!=e&&this._isCachedResultValidFor204(e,t),u=yield this._fetchFromNetwork(i,t,r,o);if(!u)return n.Log.debug("No response returned for latest value"),null;let c=(0,l._typedJsonParse)(u,"has_updates","Response"),h=this._getSdkKey(),f=s.StableID.get(h),p=null;if((null==c?void 0:c.has_updates)===!0)p=d("Network",u,f,t);else{if(!i||(null==c?void 0:c.has_updates)!==!1)return null;p=d("NetworkNotModified",i,f,t)}let g=this._getCacheKey(t);return this._inMemoryCache.add(g,p),this._writeToCache(g,p),p})}_getSdkKey(){return null!=this._sdkKey?this._sdkKey:(n.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(e){var t;let r=null==(t=o.Storage.getItem)?void 0:t.call(o.Storage,e);if(null==r)return null;let i=(0,l._typedJsonParse)(r,"source","Cached Result");return i?Object.assign(Object.assign({},i),{source:"Cache"}):null}_writeToCache(e,t){o.Storage.setItem(e,JSON.stringify(t)),this._runLocalStorageCacheEviction(e)}_runLocalStorageCacheEviction(e){var t;let r=null!=(t=(0,o._getObjectFromStorage)(this._lastModifiedStoreKey))?t:{};r[e]=Date.now();let i=h(r,10);i&&(delete r[i],o.Storage.removeItem(i)),(0,o._setObjectInStorage)(this._lastModifiedStoreKey,r)}}function d(e,t,r,i){return{source:e,data:t,receivedAt:Date.now(),stableID:r,fullUserHash:(0,a._getFullUserHash)(i)}}t.DataAdapterCore=u,t._makeDataAdapterResult=d;class c{constructor(){this._data={}}get(e,t){var r;let i=this._data[e],s=null==i?void 0:i.stableID,a=null==(r=null==t?void 0:t.customIDs)?void 0:r.stableID;return a&&s&&a!==s?(n.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):i}add(e,t){let r=h(this._data,9);r&&delete this._data[r],this._data[e]=t}merge(e){this._data=Object.assign(Object.assign({},this._data),e)}}function h(e,t){let r=Object.keys(e);return r.length<=t?null:r.reduce((t,r)=>{let i=e[t],n=e[r];return"object"==typeof i&&"object"==typeof n?n.receivedAt{var i=function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});let n=r(0x24cedbcc6),s=r(0x620e1be7),a=r(0x159940a2),o=r(0x21a1d9ec9),l=r(0x128166dc5);class u extends n.StatsigClientBase{static instance(e){let t=(0,n._getStatsigGlobal)().instance(e);return t instanceof u?t:(n.Log.warn((0,n._isServerEnv)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new u(null!=e?e:"",{}))}initializeSync(e){var t;return"Uninitialized"!==this.loadingStatus?(0,n.createUpdateDetails)(!0,this._store.getSource(),-1,null,null,["MultipleInitializations",...null!=(t=this._store.getWarnings())?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){var r;let i=performance.now(),s=[...null!=(r=this._store.getWarnings())?r:[]];this._resetForUser(e);let a=this.dataAdapter.getDataSync(this._user);null==a&&s.push("NoCachedValues"),this._store.setValues(a,this._user),this._finalizeUpdate(a);let o=null==t?void 0:t.disableBackgroundCacheRefresh;return!0===o||null==o&&(null==a?void 0:a.source)==="Bootstrap"||this._runPostUpdate(null!=a?a:null,this._user),(0,n.createUpdateDetails)(!0,this._store.getSource(),performance.now()-i,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),s)}updateUserAsync(e,t){return i(this,void 0,void 0,function*(){this._resetForUser(e);let r=this._user;n.Diagnostics._markInitOverallStart(this._sdkKey);let i=this.dataAdapter.getDataSync(r);if(this._store.setValues(i,this._user),this._setStatus("Loading",i),i=yield this.dataAdapter.getDataAsync(i,r,t),r!==this._user)return(0,n.createUpdateDetails)(!1,this._store.getSource(),-1,Error("User changed during update"),this._network.getLastUsedInitUrlAndReset());let s=!1;null!=i&&(n.Diagnostics._markInitProcessStart(this._sdkKey),s=this._store.setValues(i,this._user),n.Diagnostics._markInitProcessEnd(this._sdkKey,{success:s})),this._finalizeUpdate(i),s||(this._errorBoundary.attachErrorIfNoneExists(n.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),n.Diagnostics._markInitOverallEnd(this._sdkKey,s,this._store.getCurrentSourceDetails());let a=n.Diagnostics._enqueueDiagnosticsEvent(this._user,this._logger,this._sdkKey,this._options);return(0,n.createUpdateDetails)(s,this._store.getSource(),a,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:n.StatsigSession.get(this._sdkKey),stableID:n.StableID.get(this._sdkKey)}}checkGate(e,t){return this.getFeatureGate(e,t).value}logEvent(e,t,r){this._logger.enqueue(Object.assign(Object.assign({},"string"==typeof e?{eventName:e,value:t,metadata:r}:e),{user:this._user,time:Date.now()}))}_primeReadyRipcord(){this.$on("error",()=>{"Loading"===this.loadingStatus&&this._finalizeUpdate(null)})}_initializeAsyncImpl(e){return i(this,void 0,void 0,function*(){return n.Storage.isReady()||(yield n.Storage.isReadyResolver()),this._logger.start(),this.updateUserAsync(this._user,e)})}_finalizeUpdate(e){this._store.finalize(),this._setStatus("Ready",e)}_runPostUpdate(e,t){this.dataAdapter.getDataAsync(e,t,{priority:"low"}).catch(e=>{n.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 r;let i=(0,n._normalizeUser)(e,t),s=null==(r=i.customIDs)?void 0:r.stableID;return s&&n.StableID.setOverride(s,this._sdkKey),i}_getFeatureGateImpl(e,t){var r,i;let{result:s,details:a}=this._store.getGate(e),o=(0,n._makeFeatureGate)(e,a,s),l=null==(i=null==(r=this.overrideAdapter)?void 0:r.getGateOverride)?void 0:i.call(r,o,this._user,t),u=null!=l?l:o;return this._enqueueExposure(e,(0,n._createGateExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"gate_evaluation",gate:u}),u}_getDynamicConfigImpl(e,t){var r,i;let{result:s,details:a}=this._store.getConfig(e),o=(0,n._makeDynamicConfig)(e,a,s),l=null==(i=null==(r=this.overrideAdapter)?void 0:r.getDynamicConfigOverride)?void 0:i.call(r,o,this._user,t),u=null!=l?l:o;return this._enqueueExposure(e,(0,n._createConfigExposure)(this._user,u,this._store.getExposureMapping()),t),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:u}),u}_getExperimentImpl(e,t){var r,i,s,a;let{result:o,details:l}=this._store.getConfig(e),u=(0,n._makeExperiment)(e,l,o);null!=u.__evaluation&&(u.__evaluation.secondary_exposures=(0,n._mapExposures)(null!=(i=null==(r=u.__evaluation)?void 0:r.secondary_exposures)?i:[],this._store.getExposureMapping()));let d=null==(a=null==(s=this.overrideAdapter)?void 0:s.getExperimentOverride)?void 0:a.call(s,u,this._user,t),c=null!=d?d:u;return this._enqueueExposure(e,(0,n._createConfigExposure)(this._user,c,this._store.getExposureMapping()),t),this.$emt({name:"experiment_evaluation",experiment:c}),c}_getLayerImpl(e,t){var r,i,s;let{result:a,details:o}=this._store.getLayer(e),l=(0,n._makeLayer)(e,o,a),u=null==(i=null==(r=this.overrideAdapter)?void 0:r.getLayerOverride)?void 0:i.call(r,l,this._user,t);(null==t?void 0:t.disableExposureLog)&&this._logger.incrementNonExposureCount(e);let d=(0,n._mergeOverride)(l,u,null!=(s=null==u?void 0:u.__value)?s:l.__value,r=>{null!=t&&t.disableExposureLog||this._enqueueExposure(e,(0,n._createLayerParameterExposure)(this._user,d,r,this._store.getExposureMapping()),t)});return this.$emt({name:"layer_evaluation",layer:d}),d}_getParameterStoreImpl(e,t){var r,i;let{result:n,details:s}=this._store.getParamStore(e);this._logger.incrementNonExposureCount(e);let a={name:e,details:s,__configuration:n,get:(0,o._makeParamStoreGetter)(this,n,t)},l=null==(i=null==(r=this.overrideAdapter)?void 0:r.getParamStoreOverride)?void 0:i.call(r,a,t);return null!=l&&(a.__configuration=l.config,a.details=l.details,a.get=(0,o._makeParamStoreGetter)(this,l.config,t)),a}constructor(e,t,r=null){var i,o;n.SDKType._setClientType(e,"javascript-client");let u=new a.default(r,e=>{this.$emt(e)});for(let a of(super(e,null!=(i=null==r?void 0:r.dataAdapter)?i:new l.StatsigEvaluationsDataAdapter,u,r),this.getFeatureGate=this._memoize(n.MemoPrefix._gate,this._getFeatureGateImpl.bind(this)),this.getDynamicConfig=this._memoize(n.MemoPrefix._dynamicConfig,this._getDynamicConfigImpl.bind(this)),this.getExperiment=this._memoize(n.MemoPrefix._experiment,this._getExperimentImpl.bind(this)),this.getLayer=this._memoize(n.MemoPrefix._layer,this._getLayerImpl.bind(this)),this.getParameterStore=this._memoize(n.MemoPrefix._paramStore,this._getParameterStoreImpl.bind(this)),this._store=new s.default(e),this._network=u,this._user=this._configureUser(t,r),null!=(o=null==r?void 0:r.plugins)?o:[]))a.bind(this)}}t.default=u},0xc64daf27:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSession=t.SessionID=void 0;let i=r(0x1333ff6ef),n=r(0x9248bd08),s=r(0xe8a28702),a=r(0x1cb673ad5),o={};function l(e,t){return setTimeout(()=>{let t=null==__STATSIG__?void 0:__STATSIG__.instance(e);t&&t.$emt({name:"session_expired"})},t)}function u(e){return`statsig.session_id.${(0,i._getStorageKey)(e)}`}t.SessionID={get:e=>t.StatsigSession.get(e).data.sessionID},t.StatsigSession={get:e=>(null==o[e]&&(o[e]=function(e){let t=function(e){let t=u(e);return(0,s._getObjectFromStorage)(t)}(e),r=Date.now();return t||(t={sessionID:(0,a.getUUID)(),startTime:r,lastUpdate:r}),{data:t,sdkKey:e}}(e)),function(e){let t=Date.now(),r=e.data;((function({lastUpdate:e}){return Date.now()-e>18e5})(r)||function({startTime:e}){return Date.now()-e>144e5}(r))&&(r.sessionID=(0,a.getUUID)(),r.startTime=t),r.lastUpdate=t,function(e,t){let r=u(t);try{(0,s._setObjectInStorage)(r,e)}catch(e){n.Log.warn("Failed to save SessionID")}}(r,e.sdkKey),clearTimeout(e.idleTimeoutID),clearTimeout(e.ageTimeoutID);let i=t-r.startTime,o=e.sdkKey;return e.idleTimeoutID=l(o,18e5),e.ageTimeoutID=l(o,144e5-i),e}(o[e])),overrideInitialSessionID:(e,t)=>{o[t]=function(e,t){let r=Date.now();return{data:{sessionID:e,startTime:r,lastUpdate:r},sdkKey:t}}(e,t)}}},0xc7b2149b:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0xfc89b4a4),n=r(0x24cedbcc6),s=r(0x183840035),a=r(0x16d97559d);t.default=function(e,t){let{client:r,renderVersion:o}=(0,i.useContext)(a.default);return(0,i.useMemo)(()=>(0,s.isNoopClient)(r)?(n.Log.warn(`useFeatureGate hook failed to find a valid StatsigClient for gate '${e}'.`),s.NoopEvaluationsClient.getFeatureGate(e,t)):r.getFeatureGate(e,t),[e,r,o,...t?Object.values(t):[]])}},0xcf7c6767:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.NetworkCore=void 0,r(0x1dacc47cd);let n=r(0x1dacc47cd),s=r(0x1de8a70de),a=r(0x9248bd08),o=r(0xd54b912),l=r(0x10d3dfcec),u=r(0x1c75adc79),d=r(0x139d91e26),c=r(0xea3899c8),h=r(0xc64daf27),f=r(0x1fe8a09fc),p=r(0xe427a868),g=r(0x7ce6115c),_=r(0x22b22c0ed),m=new Set([408,500,502,503,504,522,524,599]);class y{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)}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(){let e=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,e}beacon(e){return i(this,void 0,void 0,function*(){if(!v(e))return!1;let t=this._getInternalRequestArgs("POST",e);yield this._tryToCompressBody(t);let r=yield this._getPopulatedURL(t),i=navigator;return i.sendBeacon.bind(i)(r,t.body)})}post(e){return i(this,void 0,void 0,function*(){let t=this._getInternalRequestArgs("POST",e);return this._tryEncodeBody(t),yield this._tryToCompressBody(t),this._sendRequest(t)})}get(e){let t=this._getInternalRequestArgs("GET",e);return this._sendRequest(t)}_sendRequest(e){var t,r,n,l;return i(this,void 0,void 0,function*(){var u,d,c,h,f;if(!v(e)||this._netConfig.preventAllNetworkTraffic)return null;let{method:g,body:y,retries:b,attempt:x}=e,S=e.urlConfig.endpoint;if(this._isRateLimited(S))return a.Log.warn(`Request to ${S} was blocked because you are making requests too frequently.`),null;let w=null!=x?x:1,E="undefined"!=typeof AbortController?new AbortController:null,C=setTimeout(()=>{null==E||E.abort(`Timeout of ${this._timeout}ms expired.`)},this._timeout),A=yield this._getPopulatedURL(e),O=null,I=(0,_._isUnloading)();try{let r={method:g,body:y,headers:Object.assign({},e.headers),signal:null==E?void 0:E.signal,priority:e.priority,keepalive:I};u=e,d=w,u.urlConfig.endpoint===o.Endpoint._initialize&&s.Diagnostics._markInitNetworkReqStart(u.sdkKey,{attempt:d});let i=this._leakyBucket[S];i&&(i.lastRequestTime=Date.now(),this._leakyBucket[S]=i);let n=null!=(t=this._netConfig.networkOverrideFunc)?t:fetch;if(O=yield n(A,r),clearTimeout(C),!O.ok){let e=yield O.text().catch(()=>"No Text"),t=Error(`NetworkError: ${A} ${e}`);throw t.name="NetworkError",t}let a=yield O.text();return k(e,O,w,a),this._fallbackResolver.tryBumpExpiryTime(e.sdkKey,e.urlConfig),{body:a,code:O.status}}catch(o){let t=(c=E,h=o,(null==c?void 0:c.signal.aborted)&&"string"==typeof c.signal.reason?c.signal.reason:"string"==typeof h?h:h instanceof Error?`${h.name}: ${h.message}`:"Unknown Error"),s=(null==(f=E)?void 0:f.signal.aborted)&&"string"==typeof f.signal.reason&&f.signal.reason.includes("Timeout")||!1;if(k(e,O,w,"",o),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(e.sdkKey,e.urlConfig,t,s))&&(e.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(e.sdkKey,e.urlConfig)),!b||w>b||!m.has(null!=(r=null==O?void 0:O.status)?r:500)){null==(n=this._emitter)||n.call(this,{name:"error",error:o,tag:p.ErrorTag.NetworkError,requestArgs:e});let r=`A networking error occurred during ${g} request to ${A}.`;return a.Log.error(r,t,o),null==(l=this._errorBoundary)||l.attachErrorIfNoneExists(r),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)))})}(w),this._sendRequest(Object.assign(Object.assign({},e),{retries:b,attempt:w+1}))}})}_isRateLimited(e){var t;let r=Date.now(),i=null!=(t=this._leakyBucket[e])?t:{count:0,lastRequestTime:r},n=Math.floor((r-i.lastRequestTime)*.05);return i.count=Math.max(0,i.count-n),i.count>=50||(i.count+=1,i.lastRequestTime=r,this._leakyBucket[e]=i,!1)}_getPopulatedURL(e){var t;return i(this,void 0,void 0,function*(){let r=null!=(t=e.fallbackUrl)?t:e.urlConfig.getUrl();(e.urlConfig.endpoint===o.Endpoint._initialize||e.urlConfig.endpoint===o.Endpoint._download_config_specs)&&(this._lastUsedInitUrl=r);let i=Object.assign({[o.NetworkParam.SdkKey]:e.sdkKey,[o.NetworkParam.SdkType]:d.SDKType._get(e.sdkKey),[o.NetworkParam.SdkVersion]:g.SDK_VERSION,[o.NetworkParam.Time]:String(Date.now()),[o.NetworkParam.SessionID]:h.SessionID.get(e.sdkKey)},e.params),n=Object.keys(i).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`).join("&");return`${r}${n?`?${n}`:""}`})}_tryEncodeBody(e){var t;let r=(0,c._getWindowSafe)(),i=e.body;if(e.isStatsigEncodable&&!this._options.disableStatsigEncoding&&"string"==typeof i&&null==(0,n._getStatsigGlobalFlag)("no-encode")&&(null==r?void 0:r.btoa))try{e.body=r.btoa(i).split("").reverse().join(""),e.params=Object.assign(Object.assign({},null!=(t=e.params)?t:{}),{[o.NetworkParam.StatsigEncoded]:"1"})}catch(t){a.Log.warn(`Request encoding failed for ${e.urlConfig.getUrl()}`,t)}}_tryToCompressBody(e){var t;return i(this,void 0,void 0,function*(){let r=e.body;if(e.isCompressable&&!this._options.disableCompression&&"string"==typeof r&&!0===u.SDKFlags.get(e.sdkKey,"enable_log_event_compression")&&null==(0,n._getStatsigGlobalFlag)("no-compress")&&"undefined"!=typeof CompressionStream&&"undefined"!=typeof TextEncoder)try{let i,n=new TextEncoder().encode(r),s=new CompressionStream("gzip"),l=s.writable.getWriter();l.write(n).catch(a.Log.error),l.close().catch(a.Log.error);let u=s.readable.getReader(),d=[];for(;!(i=yield u.read()).done;)d.push(i.value);let c=d.reduce((e,t)=>e+t.length,0),h=new Uint8Array(c),f=0;for(let e of d)h.set(e,f),f+=e.length;e.body=h,e.params=Object.assign(Object.assign({},null!=(t=e.params)?t:{}),{[o.NetworkParam.IsGzipped]:"1"})}catch(t){a.Log.warn(`Request compression failed for ${e.urlConfig.getUrl()}`,t)}})}_getInternalRequestArgs(e,t){let r=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig),i=Object.assign(Object.assign({},t),{method:e,fallbackUrl:r});return"data"in t&&b(i,t.data),i}}t.NetworkCore=y;let v=e=>!!e.sdkKey||(a.Log.warn("Unable to make request without an SDK key"),!1),b=(e,t)=>{let{sdkKey:r,fallbackUrl:i}=e,n=f.StableID.get(r),s=h.SessionID.get(r),a=d.SDKType._get(r);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},g.StatsigMetadataProvider.get()),{stableID:n,sessionID:s,sdkType:a,fallbackUrl:i})}))};function k(e,t,r,i,n){e.urlConfig.endpoint===o.Endpoint._initialize&&s.Diagnostics._markInitNetworkReqEnd(e.sdkKey,s.Diagnostics._getDiagnosticsData(t,r,i,n))}},0xe13daa1d:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0xe427a868:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTag=void 0,t.ErrorTag={NetworkError:"NetworkError"}},0xe8a28702:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._setObjectInStorage=t._getObjectFromStorage=t.Storage=void 0;let i=r(0x9248bd08),n=r(0xea3899c8),s={},a={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>s[e]?s[e]:null,setItem:(e,t)=>{s[e]=t},removeItem:e=>{delete s[e]},getAllKeys:()=>Object.keys(s)},o=null;try{let e=(0,n._getWindowSafe)();e&&e.localStorage&&"function"==typeof e.localStorage.getItem&&(o={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,r)=>e.localStorage.setItem(t,r),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch(e){i.Log.warn("Failed to setup localStorageProvider.")}let l=null!=o?o:a,u=l;t.Storage={isReady:()=>u.isReady(),isReadyResolver:()=>u.isReadyResolver(),getProviderName:()=>u.getProviderName(),getItem:e=>(function(e){try{return e()}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return t.Storage._setProvider(a),null;throw e}})(()=>u.getItem(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?a:l}},t._getObjectFromStorage=function(e){let r=t.Storage.getItem(e);return JSON.parse(null!=r?r:"null")},t._setObjectInStorage=function(e,r){t.Storage.setItem(e,JSON.stringify(r))}},0xea3899c8:(e,t,r)=>{var i=r(0xc6857cab);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;let r=(0,t._getWindowSafe)();return null!=(e=null==r?void 0:r.document)?e:null},t._isServerEnv=()=>{if(null!==(0,t._getDocumentSafe)())return!1;let e=void 0!==i&&null!=i.versions&&null!=i.versions.node;return"string"==typeof EdgeRuntime||e},t._addWindowEventListenerSafe=(e,r)=>{let i=(0,t._getWindowSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,r)},t._addDocumentEventListenerSafe=(e,r)=>{let i=(0,t._getDocumentSafe)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(e,r)},t._getCurrentPageUrlSafe=()=>{var e;try{return null==(e=(0,t._getWindowSafe)())?void 0:e.location.href.split(/[?#]/)[0]}catch(e){return}}},0xea407aac:(e,t,r)=>{r.d(t,{DM:()=>f,G4:()=>h,I3:()=>a,MY:()=>l,OK:()=>c,fn:()=>p,jm:()=>d,uY:()=>u,xP:()=>g,y7:()=>s,zn:()=>o});var i=r(0x10f612574),n=r(0x5c99e3d4);let s=e=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,s=[...r,...n.path||[]],a={...n,path:s};if(void 0!==n.message)return{...n,path:s,message:n.message};let o="";for(let e of i.filter(e=>!!e).slice().reverse())o=e(a,{data:t,defaultError:o}).message;return{...n,path:s,message:o}},a=[];function o(e,t){let r=(0,i.$W)(),a=s({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===n.A?void 0:n.A].filter(e=>!!e)});e.common.issues.push(a)}class l{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if("aborted"===i.status)return u;"dirty"===i.status&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,i=await e.value;r.push({key:t,value:i})}return l.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:t,value:n}=i;if("aborted"===t.status||"aborted"===n.status)return u;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==n.value||i.alwaysSet)&&(r[t.value]=n.value)}return{status:e.value,value:r}}}let u=Object.freeze({status:"aborted"}),d=e=>({status:"dirty",value:e}),c=e=>({status:"valid",value:e}),h=e=>"aborted"===e.status,f=e=>"dirty"===e.status,p=e=>"valid"===e.status,g=e=>"undefined"!=typeof Promise&&e instanceof Promise},0xfd0f87a3:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigProvider=void 0;let i=r(0x22102fd88),n=r(0xfc89b4a4),s=r(0x24cedbcc6),a=r(0x16d97559d),o=r(0x8429651d);t.StatsigProvider=function(e){var t;let[r,l]=(0,n.useState)(0),u="client"in e?e.client:(0,o.useClientAsyncInit)(e.sdkKey,e.user,e.options).client;(0,n.useEffect)(()=>{let e=()=>{l(e=>e+1)};return s.SDKType._setBindingType("react"),u.$on("values_updated",e),()=>{u.flush().catch(e=>s.Log.error("An error occured during flush",e)),u.off("values_updated",e)}},[u]);let d=(0,n.useMemo)(()=>({renderVersion:r,client:u}),[r,u]);return(0,i.jsx)(a.default.Provider,{value:d,children:null==e.loadingComponent||"isNoop"in(t=u)||"Ready"===t.loadingStatus?e.children:e.loadingComponent})}},0x10d3dfcec:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._isDomainFailure=t.NetworkFallbackResolver=void 0;let n=r(0x1cbe4d5dd),s=r(0x248385392),a=r(0x9248bd08),o=r(0xe8a28702);class l{constructor(e){var t;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=null==(t=e.networkConfig)?void 0:t.networkOverrideFunc}setErrorBoundary(e){this._errorBoundary=e}tryBumpExpiryTime(e,t){var r;let i=null==(r=this._fallbackInfo)?void 0:r[t.endpoint];i&&(i.expiryTime=Date.now()+6048e5,c(e,Object.assign(Object.assign({},this._fallbackInfo),{[t.endpoint]:i})))}getActiveFallbackUrl(e,t){var r,i;let n=this._fallbackInfo;null==n&&(n=null!=(r=function(e){let t=d(e),r=o.Storage.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return a.Log.error("Failed to parse FallbackInfo"),null}}(e))?r:{},this._fallbackInfo=n);let s=n[t.endpoint];return!s||Date.now()>(null!=(i=s.expiryTime)?i:0)?(delete n[t.endpoint],this._fallbackInfo=n,c(e,this._fallbackInfo),null):s.url?s.url:null}getFallbackFromProvided(e){let t=h(e);return t?e.replace(t,""):null}tryFetchUpdatedFallbackInfo(e,t,r,n){var s,a;return i(this,void 0,void 0,function*(){try{if(!u(r,n))return!1;let i=null==t.customUrl&&null==t.fallbackUrls?yield this._tryFetchFallbackUrlsFromNetwork(t):t.fallbackUrls,a=this._pickNewFallbackUrl(null==(s=this._fallbackInfo)?void 0:s[t.endpoint],i);if(!a)return!1;return this._updateFallbackInfoWithNewUrl(e,t.endpoint,a),!0}catch(e){return null==(a=this._errorBoundary)||a.logError("tryFetchUpdatedFallbackInfo",e),!1}})}_updateFallbackInfoWithNewUrl(e,t,r){var i,n,s;let a={url:r,expiryTime:Date.now()+6048e5,previous:[]},o=null==(i=this._fallbackInfo)?void 0:i[t];o&&a.previous.push(...o.previous),a.previous.length>10&&(a.previous=[]);let l=null==(s=null==(n=this._fallbackInfo)?void 0:n[t])?void 0:s.url;null!=l&&a.previous.push(l),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[t]:a}),c(e,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(e){var t;return i(this,void 0,void 0,function*(){let r=this._dnsQueryCooldowns[e.endpoint];if(r&&Date.now()1){let e=r[1];e.endsWith("/")&&(e=e.slice(0,-1)),i.push(`https://${e}${a}`)}}return i})}_pickNewFallbackUrl(e,t){var r;if(null==t)return null;let i=new Set(null!=(r=null==e?void 0:e.previous)?r:[]),n=null==e?void 0:e.url,s=null;for(let e of t){let t=e.endsWith("/")?e.slice(0,-1):e;if(!i.has(e)&&t!==n){s=t;break}}return s}}function u(e,t){var r;let i=null!=(r=null==e?void 0:e.toLowerCase())?r:"";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,s._DJB2)(e)}`}function c(e,t){let r=d(e);if(!t||0===Object.keys(t).length)return void o.Storage.removeItem(r);o.Storage.setItem(r,JSON.stringify(t))}function h(e){try{return new URL(e).pathname}catch(e){return null}}t.NetworkFallbackResolver=l,t._isDomainFailure=u},0x10f612574:(e,t,r)=>{r.d(t,{$W:()=>a,pJ:()=>s,su:()=>i.A});var i=r(0x5c99e3d4);let n=i.A;function s(e){n=e}function a(){return n}},0x1170c7483:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UrlConfiguration=void 0;let i=r(0xd54b912),n={[i.Endpoint._initialize]:"i",[i.Endpoint._rgstr]:"e",[i.Endpoint._download_config_specs]:"d"};class s{constructor(e,t,r,s){this.customUrl=null,this.fallbackUrls=null,this.endpoint=e,this.endpointDnsKey=n[e],t&&(this.customUrl=t),!t&&r&&(this.customUrl=r.endsWith("/")?`${r}${e}`:`${r}/${e}`),s&&(this.fallbackUrls=s);let a=i.NetworkDefault[e];this.defaultUrl=`${a}/${e}`}getUrl(){var e;return null!=(e=this.customUrl)?e:this.defaultUrl}}t.UrlConfiguration=s},0x128166dc5:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigEvaluationsDataAdapter=void 0;let n=r(0x24cedbcc6),s=r(0x159940a2);class a extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this._network=null,this._options=null}attach(e,t){super.attach(e,t),this._network=new s.default(null!=t?t:{})}getDataAsync(e,t,r){return this._getDataAsyncImpl(e,(0,n._normalizeUser)(t,this._options),r)}prefetchData(e,t){return this._prefetchDataImpl(e,t)}setData(e){let t=(0,n._typedJsonParse)(e,"has_updates","data");t&&"user"in t?super.setData(e,t.user):n.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,r,n){var s;return i(this,void 0,void 0,function*(){let i=yield null==(s=this._network)?void 0:s.fetchEvaluations(this._getSdkKey(),e,null==r?void 0:r.priority,t,n);return null!=i?i:null})}_getCacheKey(e){var t;let r=(0,n._getStorageKey)(this._getSdkKey(),e,null==(t=this._options)?void 0:t.customUserCacheKeyFunc);return`${n.DataAdapterCachePrefix}.${this._cacheSuffix}.${r}`}_isCachedResultValidFor204(e,t){return null!=e.fullUserHash&&e.fullUserHash===(0,n._getFullUserHash)(t)}}t.StatsigEvaluationsDataAdapter=a},0x1333ff6ef:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getStorageKey=t._getUserStorageKey=void 0;let i=r(0x248385392);function n(e,t,r){var n;if(r)return r(e,t);let s=t&&t.customIDs?t.customIDs:{},a=[`uid:${null!=(n=null==t?void 0:t.userID)?n:""}`,`cids:${Object.keys(s).sort((e,t)=>e.localeCompare(t)).map(e=>`${e}-${s[e]}`).join(",")}`,`k:${e}`];return(0,i._DJB2)(a.join("|"))}t._getUserStorageKey=n,t._getStorageKey=function(e,t,r){return t?n(e,t,r):(0,i._DJB2)(`k:${e}`)}},0x139d91e26:(e,t)=>{let r;Object.defineProperty(t,"__esModule",{value:!0}),t.SDKType=void 0;let i={};t.SDKType={_get:e=>{var t;return(null!=(t=i[e])?t:"js-mono")+(null!=r?r:"")},_setClientType(e,t){i[e]=t},_setBindingType(e){r&&"-react"!==r||(r="-"+e)}}},0x144061902:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useStatsigClient=void 0;let i=r(0xfc89b4a4),n=r(0x24cedbcc6),s=r(0x183840035),a=r(0x16d97559d);t.useStatsigClient=function(){let{client:e,renderVersion:t}=(0,i.useContext)(a.default),r=(0,i.useMemo)(()=>(0,s.isNoopClient)(e)?(n.Log.warn("Attempting to retrieve a StatsigClient but none was set."),s.NoopEvaluationsClient):e,[e,t]),o=[r,t],l=(0,i.useCallback)((e,t)=>r.checkGate(e,t),o),u=(0,i.useCallback)((e,t)=>r.getFeatureGate(e,t),o),d=(0,i.useCallback)((e,t)=>r.getDynamicConfig(e,t),o),c=(0,i.useCallback)((e,t)=>r.getExperiment(e,t),o),h=(0,i.useCallback)((e,t)=>r.getLayer(e,t),o),f=(0,i.useCallback)((e,t,i)=>"string"==typeof e?r.logEvent(e,t,i):r.logEvent(e),o);return(0,i.useMemo)(()=>({client:r,checkGate:l,getFeatureGate:u,getDynamicConfig:d,getExperiment:c,getLayer:h,logEvent:f}),[r,l,u,d,c,h,f])}},0x14ab7f896:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0xfc89b4a4),n=r(0x24cedbcc6),s=r(0x183840035),a=r(0x16d97559d);t.default=function(e,t){let{client:r,renderVersion:o}=(0,i.useContext)(a.default);return(0,i.useMemo)(()=>(0,s.isNoopClient)(r)?(n.Log.warn(`useParameterStore hook failed to find a valid StatsigClient for parameter store '${e}'.`),s.NoopEvaluationsClient.getParameterStore(e,t)):r.getParameterStore(e,t),[e,r,o,...t?Object.values(t):[]])}},0x15497a2f1:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0xfc89b4a4),n=r(0x24cedbcc6),s=r(0x183840035),a=r(0x16d97559d);t.default=function(e,t){let{client:r,renderVersion:o}=(0,i.useContext)(a.default);return(0,i.useMemo)(()=>(0,s.isNoopClient)(r)?(n.Log.warn(`useExperiment hook failed to find a valid Statsig client for experiment '${e}'.`),s.NoopEvaluationsClient.getExperiment(e,t)):r.getExperiment(e,t),[e,r,o,...t?Object.values(t):[]])}},0x156c4e43b:(e,t,r)=>{let i;r.d(t,{qt:()=>ep,tm:()=>e5,Sj:()=>p,Ml:()=>$,n:()=>q,Lr:()=>M,WF:()=>R,eN:()=>eg,hw:()=>eh,aP:()=>F,Xi:()=>ec,jv:()=>J,k1:()=>el,Vb:()=>es,kY:()=>s,CZ:()=>et,Jv:()=>W,Ih:()=>er,DN:()=>ei,Ut:()=>X,Tq:()=>ef,WM:()=>ea,iS:()=>B,PQ:()=>Z,l1:()=>ed,rS:()=>N,bv:()=>V,Ii:()=>eu,_c:()=>e_,$i:()=>eo,EV:()=>em,b8:()=>Q,lK:()=>p,Kz:()=>ee,ND:()=>P,K5:()=>L,BG:()=>el,y0:()=>H,aR:()=>p,_Z:()=>U,fZ:()=>G,_:()=>z,a0:()=>K,bz:()=>eT,YO:()=>eM,o:()=>eE,zM:()=>eC,au:()=>e8,Ie:()=>ev,p6:()=>eA,fm:()=>j,gM:()=>eU,QZ:()=>eH,k5:()=>eY,fH:()=>eq,Nl:()=>ek,E$:()=>eZ,fn:()=>eb,RZ:()=>eV,eu:()=>eG,Tj:()=>eB,oi:()=>ew,fc:()=>eJ,Zm:()=>eP,ch:()=>eD,me:()=>eX,ai:()=>eS,Ik:()=>eR,yN:()=>e9,p7:()=>e2,lq:()=>eQ,Di:()=>e4,Tk:()=>e1,vk:()=>e0,iv:()=>eW,g1:()=>ez,hZ:()=>eK,re:()=>eF,Yj:()=>ex,HR:()=>eO,Gu:()=>eH,PV:()=>e$,Vx:()=>eI,KC:()=>eL,L5:()=>ej,rI:()=>eN});var n,s,a=r(0x176bbf92),o=r(0x10f612574),l=r(0x5c99e3d4);!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(n||(n={}));var u=r(0xea407aac),d=r(0x24d73e0bd);class c{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let h=(e,t)=>{if((0,u.fn)(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new a.G(e.common.issues);return this._error=t,this._error}}};function f(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{let{message:s}=e;return"invalid_enum_value"===t.code?{message:s??n.defaultError}:void 0===n.data?{message:s??i??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:s??r??n.defaultError}},description:n}}class p{get description(){return this._def.description}_getType(e){return(0,d.CR)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,d.CR)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u.MY,ctx:{common:e.parent.common,data:e.data,parsedType:(0,d.CR)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,u.xP)(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,d.CR)(e)},i=this._parseSync({data:e,path:r.path,parent:r});return h(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,d.CR)(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return(0,u.fn)(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>(0,u.fn)(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,d.CR)(e)},i=this._parse({data:e,path:r.path,parent:r});return h(r,await ((0,u.xP)(i)?i:Promise.resolve(i)))}refine(e,t){return this._refinement((r,i)=>{let n=e(r),s=()=>i.addIssue({code:a.eq.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(s(),!1)):!!n||(s(),!1)})}refinement(e,t){return this._refinement((r,i)=>!!e(r)||(i.addIssue("function"==typeof t?t(r,i):t),!1))}_refinement(e){return new el({schema:this,typeName:s.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return eu.create(this,this._def)}nullable(){return ed.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return q.create(this)}promise(){return eo.create(this,this._def)}or(e){return G.create([this,e],this._def)}and(e){return W.create(this,e,this._def)}transform(e){return new el({...f(this._def),schema:this,typeName:s.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ec({...f(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:s.ZodDefault})}brand(){return new eg({typeName:s.ZodBranded,type:this,...f(this._def)})}catch(e){return new eh({...f(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:s.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return e_.create(this,e)}readonly(){return em.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let g=/^c[^\s-]{8,}$/i,_=/^[0-9a-z]+$/,m=/^[0-9A-HJKMNP-TV-Z]{26}$/i,y=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,v=/^[a-z0-9_-]{21}$/i,b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,k=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,x=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,S=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,w=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,E=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,C=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,A=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,I="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",D=RegExp(`^${I}$`);function T(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function j(e){let t=`${I}T${T(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class P extends p{_parse(e){var t,r,n,s;let o;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==d.Zp.string){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.string,received:t.parsedType}),u.uY}let l=new u.MY;for(let c of this._def.checks)if("min"===c.kind)e.data.lengthc.value&&(o=this._getOrReturnCtx(e,o),(0,u.zn)(o,{code:a.eq.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),l.dirty());else if("length"===c.kind){let t=e.data.length>c.value,r=e.data.lengthe.test(t),{validation:t,code:a.eq.invalid_string,...n.errToObj(r)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...n.errToObj(e)})}url(e){return this._addCheck({kind:"url",...n.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...n.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...n.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...n.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...n.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...n.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...n.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...n.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...n.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...n.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...n.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...n.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...n.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...n.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...n.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...n.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...n.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...n.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...n.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...n.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...n.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...n.errToObj(t)})}nonempty(e){return this.min(1,n.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew P({checks:[],typeName:s.ZodString,coerce:e?.coerce??!1,...f(e)});class N extends p{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==d.Zp.number){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.number,received:t.parsedType}),u.uY}let r=new u.MY;for(let i of this._def.checks)"int"===i.kind?d.ZS.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),(0,u.zn)(t,{code:a.eq.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):"min"===i.kind?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),(0,u.zn)(t,{code:a.eq.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"multipleOf"===i.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}(e.data,i.value)&&(t=this._getOrReturnCtx(e,t),(0,u.zn)(t,{code:a.eq.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):"finite"===i.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),(0,u.zn)(t,{code:a.eq.not_finite,message:i.message}),r.dirty()):d.ZS.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,n.toString(t))}gt(e,t){return this.setLimit("min",e,!1,n.toString(t))}lte(e,t){return this.setLimit("max",e,!0,n.toString(t))}lt(e,t){return this.setLimit("max",e,!1,n.toString(t))}setLimit(e,t,r,i){return new N({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.toString(i)}]})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:n.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:n.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:n.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:n.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:n.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:n.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:n.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:n.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&d.ZS.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.valuenew N({checks:[],typeName:s.ZodNumber,coerce:e?.coerce||!1,...f(e)});class M extends p{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==d.Zp.bigint)return this._getInvalidInput(e);let r=new u.MY;for(let i of this._def.checks)"min"===i.kind?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),(0,u.zn)(t,{code:a.eq.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"multipleOf"===i.kind?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),(0,u.zn)(t,{code:a.eq.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):d.ZS.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.bigint,received:t.parsedType}),u.uY}gte(e,t){return this.setLimit("min",e,!0,n.toString(t))}gt(e,t){return this.setLimit("min",e,!1,n.toString(t))}lte(e,t){return this.setLimit("max",e,!0,n.toString(t))}lt(e,t){return this.setLimit("max",e,!1,n.toString(t))}setLimit(e,t,r,i){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.toString(i)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:n.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:n.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:n.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:n.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew M({checks:[],typeName:s.ZodBigInt,coerce:e?.coerce??!1,...f(e)});class R extends p{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==d.Zp.boolean){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.boolean,received:t.parsedType}),u.uY}return(0,u.OK)(e.data)}}R.create=e=>new R({typeName:s.ZodBoolean,coerce:e?.coerce||!1,...f(e)});class F extends p{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==d.Zp.date){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.date,received:t.parsedType}),u.uY}if(Number.isNaN(e.data.getTime())){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_date}),u.uY}let r=new u.MY;for(let i of this._def.checks)"min"===i.kind?e.data.getTime()i.value&&(t=this._getOrReturnCtx(e,t),(0,u.zn)(t,{code:a.eq.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):d.ZS.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:n.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:n.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew F({checks:[],coerce:e?.coerce||!1,typeName:s.ZodDate,...f(e)});class L extends p{_parse(e){if(this._getType(e)!==d.Zp.symbol){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.symbol,received:t.parsedType}),u.uY}return(0,u.OK)(e.data)}}L.create=e=>new L({typeName:s.ZodSymbol,...f(e)});class U extends p{_parse(e){if(this._getType(e)!==d.Zp.undefined){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.undefined,received:t.parsedType}),u.uY}return(0,u.OK)(e.data)}}U.create=e=>new U({typeName:s.ZodUndefined,...f(e)});class Z extends p{_parse(e){if(this._getType(e)!==d.Zp.null){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.null,received:t.parsedType}),u.uY}return(0,u.OK)(e.data)}}Z.create=e=>new Z({typeName:s.ZodNull,...f(e)});class $ extends p{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}}$.create=e=>new $({typeName:s.ZodAny,...f(e)});class z extends p{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}}z.create=e=>new z({typeName:s.ZodUnknown,...f(e)});class B extends p{_parse(e){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.never,received:t.parsedType}),u.uY}}B.create=e=>new B({typeName:s.ZodNever,...f(e)});class K extends p{_parse(e){if(this._getType(e)!==d.Zp.undefined){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.void,received:t.parsedType}),u.uY}return(0,u.OK)(e.data)}}K.create=e=>new K({typeName:s.ZodVoid,...f(e)});class q extends p{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==d.Zp.array)return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.array,received:t.parsedType}),u.uY;if(null!==i.exactLength){let e=t.data.length>i.exactLength.value,n=t.data.lengthi.maxLength.value&&((0,u.zn)(t,{code:a.eq.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>i.type._parseAsync(new c(t,e,t.path,r)))).then(e=>u.MY.mergeArray(r,e));let n=[...t.data].map((e,r)=>i.type._parseSync(new c(t,e,t.path,r)));return u.MY.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new q({...this._def,minLength:{value:e,message:n.toString(t)}})}max(e,t){return new q({...this._def,maxLength:{value:e,message:n.toString(t)}})}length(e,t){return new q({...this._def,exactLength:{value:e,message:n.toString(t)}})}nonempty(e){return this.min(1,e)}}q.create=(e,t)=>new q({type:e,minLength:null,maxLength:null,exactLength:null,typeName:s.ZodArray,...f(t)});class V extends p{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=d.ZS.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==d.Zp.object){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.object,received:t.parsedType}),u.uY}let{status:t,ctx:r}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),s=[];if(!(this._def.catchall instanceof B&&"strip"===this._def.unknownKeys))for(let e in r.data)n.includes(e)||s.push(e);let o=[];for(let e of n){let t=i[e],n=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new c(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof B){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&((0,u.zn)(r,{code:a.eq.unrecognized_keys,keys:s}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let i=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new c(r,i,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,i=await t.value;e.push({key:r,value:i,alwaysSet:t.alwaysSet})}return e}).then(e=>u.MY.mergeObjectSync(t,e)):u.MY.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return n.errToObj,new V({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:n.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new V({...this._def,unknownKeys:"strip"})}passthrough(){return new V({...this._def,unknownKeys:"passthrough"})}extend(e){return new V({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new V({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:s.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new V({...this._def,catchall:e})}pick(e){let t={};for(let r of d.ZS.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new V({...this._def,shape:()=>t})}omit(e){let t={};for(let r of d.ZS.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new V({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof V){let r={};for(let i in t.shape){let n=t.shape[i];r[i]=eu.create(e(n))}return new V({...t._def,shape:()=>r})}if(t instanceof q)return new q({...t._def,type:e(t.element)});if(t instanceof eu)return eu.create(e(t.unwrap()));if(t instanceof ed)return ed.create(e(t.unwrap()));if(t instanceof H)return H.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of d.ZS.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}return new V({...this._def,shape:()=>t})}required(e){let t={};for(let r of d.ZS.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eu;)e=e._def.innerType;t[r]=e}return new V({...this._def,shape:()=>t})}keyof(){return en(d.ZS.objectKeys(this.shape))}}V.create=(e,t)=>new V({shape:()=>e,unknownKeys:"strip",catchall:B.create(),typeName:s.ZodObject,...f(t)}),V.strictCreate=(e,t)=>new V({shape:()=>e,unknownKeys:"strict",catchall:B.create(),typeName:s.ZodObject,...f(t)}),V.lazycreate=(e,t)=>new V({shape:e,unknownKeys:"strip",catchall:B.create(),typeName:s.ZodObject,...f(t)});class G extends p{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new a.G(e.ctx.common.issues));return(0,u.zn)(t,{code:a.eq.invalid_union,unionErrors:r}),u.uY});{let e,i=[];for(let n of r){let r={...t,common:{...t.common,issues:[]},parent:null},s=n._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&i.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let n=i.map(e=>new a.G(e));return(0,u.zn)(t,{code:a.eq.invalid_union,unionErrors:n}),u.uY}}get options(){return this._def.options}}G.create=(e,t)=>new G({options:e,typeName:s.ZodUnion,...f(t)});let Y=e=>{if(e instanceof er)return Y(e.schema);if(e instanceof el)return Y(e.innerType());if(e instanceof ei)return[e.value];if(e instanceof es)return e.options;if(e instanceof ea)return d.ZS.objectValues(e.enum);else if(e instanceof ec)return Y(e._def.innerType);else if(e instanceof U)return[void 0];else if(e instanceof Z)return[null];else if(e instanceof eu)return[void 0,...Y(e.unwrap())];else if(e instanceof ed)return[null,...Y(e.unwrap())];else if(e instanceof eg)return Y(e.unwrap());else if(e instanceof em)return Y(e.unwrap());else if(e instanceof eh)return Y(e._def.innerType);else return[]};class J extends p{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.Zp.object)return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.object,received:t.parsedType}),u.uY;let r=this.discriminator,i=t.data[r],n=this.optionsMap.get(i);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):((0,u.zn)(t,{code:a.eq.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),u.uY)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let r of t){let t=Y(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let n of t){if(i.has(n))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,r)}}return new J({typeName:s.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...f(r)})}}class W extends p{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(e,i)=>{if((0,u.G4)(e)||(0,u.G4)(i))return u.uY;let n=function e(t,r){let i=(0,d.CR)(t),n=(0,d.CR)(r);if(t===r)return{valid:!0,data:t};if(i===d.Zp.object&&n===d.Zp.object){let i=d.ZS.objectKeys(r),n=d.ZS.objectKeys(t).filter(e=>-1!==i.indexOf(e)),s={...t,...r};for(let i of n){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};s[i]=n.data}return{valid:!0,data:s}}if(i===d.Zp.array&&n===d.Zp.array){if(t.length!==r.length)return{valid:!1};let i=[];for(let n=0;ni(e,t)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}W.create=(e,t,r)=>new W({left:e,right:t,typeName:s.ZodIntersection,...f(r)});class H extends p{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d.Zp.array)return(0,u.zn)(r,{code:a.eq.invalid_type,expected:d.Zp.array,received:r.parsedType}),u.uY;if(r.data.lengththis._def.items.length&&((0,u.zn)(r,{code:a.eq.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...r.data].map((e,t)=>{let i=this._def.items[t]||this._def.rest;return i?i._parse(new c(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(i).then(e=>u.MY.mergeArray(t,e)):u.MY.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new H({...this._def,rest:e})}}H.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new H({items:e,typeName:s.ZodTuple,rest:null,...f(t)})};class Q extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d.Zp.object)return(0,u.zn)(r,{code:a.eq.invalid_type,expected:d.Zp.object,received:r.parsedType}),u.uY;let i=[],n=this._def.keyType,s=this._def.valueType;for(let e in r.data)i.push({key:n._parse(new c(r,e,r.path,e)),value:s._parse(new c(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?u.MY.mergeObjectAsync(t,i):u.MY.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return new Q(t instanceof p?{keyType:e,valueType:t,typeName:s.ZodRecord,...f(r)}:{keyType:P.create(),valueType:e,typeName:s.ZodRecord,...f(t)})}}class X extends p{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d.Zp.map)return(0,u.zn)(r,{code:a.eq.invalid_type,expected:d.Zp.map,received:r.parsedType}),u.uY;let i=this._def.keyType,n=this._def.valueType,s=[...r.data.entries()].map(([e,t],s)=>({key:i._parse(new c(r,e,r.path,[s,"key"])),value:n._parse(new c(r,t,r.path,[s,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of s){let i=await r.key,n=await r.value;if("aborted"===i.status||"aborted"===n.status)return u.uY;("dirty"===i.status||"dirty"===n.status)&&t.dirty(),e.set(i.value,n.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of s){let i=r.key,n=r.value;if("aborted"===i.status||"aborted"===n.status)return u.uY;("dirty"===i.status||"dirty"===n.status)&&t.dirty(),e.set(i.value,n.value)}return{status:t.value,value:e}}}}X.create=(e,t,r)=>new X({valueType:t,keyType:e,typeName:s.ZodMap,...f(r)});class ee extends p{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==d.Zp.set)return(0,u.zn)(r,{code:a.eq.invalid_type,expected:d.Zp.set,received:r.parsedType}),u.uY;let i=this._def;null!==i.minSize&&r.data.sizei.maxSize.value&&((0,u.zn)(r,{code:a.eq.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let n=this._def.valueType;function s(e){let r=new Set;for(let i of e){if("aborted"===i.status)return u.uY;"dirty"===i.status&&t.dirty(),r.add(i.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>n._parse(new c(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>s(e)):s(o)}min(e,t){return new ee({...this._def,minSize:{value:e,message:n.toString(t)}})}max(e,t){return new ee({...this._def,maxSize:{value:e,message:n.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ee.create=(e,t)=>new ee({valueType:e,minSize:null,maxSize:null,typeName:s.ZodSet,...f(t)});class et extends p{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.Zp.function)return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.function,received:t.parsedType}),u.uY;function r(e,r){return(0,u.y7)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,o.$W)(),l.A].filter(e=>!!e),issueData:{code:a.eq.invalid_arguments,argumentsError:r}})}function i(e,r){return(0,u.y7)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,o.$W)(),l.A].filter(e=>!!e),issueData:{code:a.eq.invalid_return_type,returnTypeError:r}})}let n={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof eo){let e=this;return(0,u.OK)(async function(...t){let o=new a.G([]),l=await e._def.args.parseAsync(t,n).catch(e=>{throw o.addIssue(r(t,e)),o}),u=await Reflect.apply(s,this,l);return await e._def.returns._def.type.parseAsync(u,n).catch(e=>{throw o.addIssue(i(u,e)),o})})}{let e=this;return(0,u.OK)(function(...t){let o=e._def.args.safeParse(t,n);if(!o.success)throw new a.G([r(t,o.error)]);let l=Reflect.apply(s,this,o.data),u=e._def.returns.safeParse(l,n);if(!u.success)throw new a.G([i(l,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new et({...this._def,args:H.create(e).rest(z.create())})}returns(e){return new et({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new et({args:e||H.create([]).rest(z.create()),returns:t||z.create(),typeName:s.ZodFunction,...f(r)})}}class er extends p{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}er.create=(e,t)=>new er({getter:e,typeName:s.ZodLazy,...f(t)});class ei extends p{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{received:t.data,code:a.eq.invalid_literal,expected:this._def.value}),u.uY}return{status:"valid",value:e.data}}get value(){return this._def.value}}function en(e,t){return new es({values:e,typeName:s.ZodEnum,...f(t)})}ei.create=(e,t)=>new ei({value:e,typeName:s.ZodLiteral,...f(t)});class es extends p{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return(0,u.zn)(t,{expected:d.ZS.joinValues(r),received:t.parsedType,code:a.eq.invalid_type}),u.uY}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return(0,u.zn)(t,{received:t.data,code:a.eq.invalid_enum_value,options:r}),u.uY}return(0,u.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return es.create(e,{...this._def,...t})}exclude(e,t=this._def){return es.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}es.create=en;class ea extends p{_parse(e){let t=d.ZS.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==d.Zp.string&&r.parsedType!==d.Zp.number){let e=d.ZS.objectValues(t);return(0,u.zn)(r,{expected:d.ZS.joinValues(e),received:r.parsedType,code:a.eq.invalid_type}),u.uY}if(this._cache||(this._cache=new Set(d.ZS.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=d.ZS.objectValues(t);return(0,u.zn)(r,{received:r.data,code:a.eq.invalid_enum_value,options:e}),u.uY}return(0,u.OK)(e.data)}get enum(){return this._def.values}}ea.create=(e,t)=>new ea({values:e,typeName:s.ZodNativeEnum,...f(t)});class eo extends p{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.Zp.promise&&!1===t.common.async)return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.promise,received:t.parsedType}),u.uY;let r=t.parsedType===d.Zp.promise?t.data:Promise.resolve(t.data);return(0,u.OK)(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eo.create=(e,t)=>new eo({type:e,typeName:s.ZodPromise,...f(t)});class el extends p{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===s.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:e=>{(0,u.zn)(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===i.type){let e=i.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return u.uY;let i=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===i.status?u.uY:"dirty"===i.status||"dirty"===t.value?(0,u.jm)(i.value):i});{if("aborted"===t.value)return u.uY;let i=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===i.status?u.uY:"dirty"===i.status||"dirty"===t.value?(0,u.jm)(i.value):i}}if("refinement"===i.type){let e=e=>{let t=i.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?u.uY:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===i.status?u.uY:("dirty"===i.status&&t.dirty(),e(i.value),{status:t.value,value:i.value})}}if("transform"===i.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>(0,u.fn)(e)?Promise.resolve(i.transform(e.value,n)).then(e=>({status:t.value,value:e})):u.uY);else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!(0,u.fn)(e))return u.uY;let s=i.transform(e.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}d.ZS.assertNever(i)}}el.create=(e,t,r)=>new el({schema:e,typeName:s.ZodEffects,effect:t,...f(r)}),el.createWithPreprocess=(e,t,r)=>new el({schema:t,effect:{type:"preprocess",transform:e},typeName:s.ZodEffects,...f(r)});class eu extends p{_parse(e){return this._getType(e)===d.Zp.undefined?(0,u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eu.create=(e,t)=>new eu({innerType:e,typeName:s.ZodOptional,...f(t)});class ed extends p{_parse(e){return this._getType(e)===d.Zp.null?(0,u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ed.create=(e,t)=>new ed({innerType:e,typeName:s.ZodNullable,...f(t)});class ec extends p{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===d.Zp.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ec.create=(e,t)=>new ec({innerType:e,typeName:s.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...f(t)});class eh extends p{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return(0,u.xP)(i)?i.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new a.G(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new a.G(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eh.create=(e,t)=>new eh({innerType:e,typeName:s.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...f(t)});class ef extends p{_parse(e){if(this._getType(e)!==d.Zp.nan){let t=this._getOrReturnCtx(e);return(0,u.zn)(t,{code:a.eq.invalid_type,expected:d.Zp.nan,received:t.parsedType}),u.uY}return{status:"valid",value:e.data}}}ef.create=e=>new ef({typeName:s.ZodNaN,...f(e)});let ep=Symbol("zod_brand");class eg extends p{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class e_ extends p{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?u.uY:"dirty"===e.status?(t.dirty(),(0,u.jm)(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?u.uY:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new e_({in:e,out:t,typeName:s.ZodPipeline})}}class em extends p{_parse(e){let t=this._def.innerType._parse(e),r=e=>((0,u.fn)(e)&&(e.value=Object.freeze(e.value)),e);return(0,u.xP)(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function ey(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function ev(e,t={},r){return e?$.create().superRefine((i,n)=>{let s=e(i);if(s instanceof Promise)return s.then(e=>{if(!e){let e=ey(t,i),s=e.fatal??r??!0;n.addIssue({code:"custom",...e,fatal:s})}});if(!s){let e=ey(t,i),s=e.fatal??r??!0;n.addIssue({code:"custom",...e,fatal:s})}}):$.create()}em.create=(e,t)=>new em({innerType:e,typeName:s.ZodReadonly,...f(t)});let eb={object:V.lazycreate};!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(s||(s={}));let ek=(e,t={message:`Input not instance of ${e.name}`})=>ev(t=>t instanceof e,t),ex=P.create,eS=N.create,ew=ef.create,eE=M.create,eC=R.create,eA=F.create,eO=L.create,eI=U.create,eD=Z.create,eT=$.create,ej=z.create,eP=B.create,eN=K.create,eM=q.create,eR=V.create,eF=V.strictCreate,eL=G.create,eU=J.create,eZ=W.create,e$=H.create,ez=Q.create,eB=X.create,eK=ee.create,eq=et.create,eV=er.create,eG=ei.create,eY=es.create,eJ=ea.create,eW=eo.create,eH=el.create,eQ=eu.create,eX=ed.create,e0=el.createWithPreprocess,e1=e_.create,e4=()=>ex().optional(),e2=()=>eS().optional(),e9=()=>eC().optional(),e8={string:e=>P.create({...e,coerce:!0}),number:e=>N.create({...e,coerce:!0}),boolean:e=>R.create({...e,coerce:!0}),bigint:e=>M.create({...e,coerce:!0}),date:e=>F.create({...e,coerce:!0})},e5=u.uY},0x164a3fc77:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x16d97559d:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0xfc89b4a4),n=r(0x183840035);t.default=(0,i.createContext)({renderVersion:0,client:n.NoopEvaluationsClient})},0x17e7d6080:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataAdapterCachePrefix=void 0,t.DataAdapterCachePrefix="statsig.cached"},0x183840035:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNoopClient=t.NoopEvaluationsClient=void 0;let i=r(0x24cedbcc6),n={success:!1,error:Error("NoClient"),duration:0,source:"Uninitialized",sourceUrl:null},s=()=>{},a=()=>n,o=()=>Promise.resolve(),l=()=>Promise.resolve(n),u={reason:"Error:NoClient"},d=e=>(...t)=>{let r="string"==typeof t[0]?t[0]:t[1];switch(e){case"gate":return(0,i._makeFeatureGate)(r,u,null);case"config":return(0,i._makeDynamicConfig)(r,u,null);case"layer":return(0,i._makeLayer)(r,u,null);case"param_store":return{name:r}}},c={sdkKey:"",options:{},values:null,user:{userID:""},errorBoundary:{},session:{data:{sessionID:"",startTime:0,lastUpdate:0},sdkKey:""},stableID:"",storageProvider:i.Storage};t.NoopEvaluationsClient={isNoop:!0,loadingStatus:"Uninitialized",initializeSync:a,initializeAsync:l,shutdown:o,flush:o,updateRuntimeOptions:s,updateUserSync:a,updateUserAsync:l,getContext:()=>Object.assign({},c),checkGate:()=>!1,getFeatureGate:d("gate"),getDynamicConfig:d("config"),getExperiment:d("config"),getLayer:d("layer"),getParameterStore:d("param_store"),logEvent:s,on:s,off:s,$on:s,$emt:s,dataAdapter:{attach:s,getDataSync:()=>null,getDataAsync:()=>Promise.resolve(null),setData:s,setDataLegacy:s,prefetchData:o}},t.isNoopClient=function(e){return"isNoop"in e}},0x1841815e2:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_DETAIL_ERROR_MESSAGES=t.createUpdateDetails=void 0,t.createUpdateDetails=(e,t,r,i,n,s)=>({duration:r,source:t,success:e,error:i,sourceUrl:n,warnings:s}),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."}},0x197e2f5df:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useClientBootstrapInit=void 0;let i=r(0x2053ed714),n=r(0x1e496a27f);t.useClientBootstrapInit=function(e,t,r,s=null){return(0,n.useStatsigInternalClientFactoryBootstrap)(e=>new i.StatsigClient(e.sdkKey,e.initialUser,e.statsigOptions),{sdkKey:e,initialUser:t,initialValues:r,statsigOptions:s})}},0x1a52fdfae:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._resolveDeltasResponse=void 0;let i=r(0x24cedbcc6);function n(e,t){null==e||e.forEach(e=>{delete t[e]})}t._resolveDeltasResponse=function(e,t){var r,s,a;let o=(0,i._typedJsonParse)(t,"checksum","DeltasEvaluationResponse");if(!o)return{hadBadDeltaChecksum:!0};let l=(n((a=(r=e,s=o,Object.assign(Object.assign(Object.assign({},r),s),{feature_gates:Object.assign(Object.assign({},r.feature_gates),s.feature_gates),layer_configs:Object.assign(Object.assign({},r.layer_configs),s.layer_configs),dynamic_configs:Object.assign(Object.assign({},r.dynamic_configs),s.dynamic_configs)}))).deleted_gates,a.feature_gates),delete a.deleted_gates,n(a.deleted_configs,a.dynamic_configs),delete a.deleted_configs,n(a.deleted_layers,a.layer_configs),delete a.deleted_layers,a),u=(0,i._DJB2Object)({feature_gates:l.feature_gates,dynamic_configs:l.dynamic_configs,layer_configs:l.layer_configs},2);return u!==o.checksumV2?{hadBadDeltaChecksum:!0,badChecksum:u,badMergedConfigs:l,badFullResponse:o.deltas_full_response}:JSON.stringify(l)}},0x1abf6447a:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x1ba4e8e1e:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.EventLogger=void 0;let n=r(0x1333ff6ef),s=r(0x248385392),a=r(0x9248bd08),o=r(0xd54b912),l=r(0xea3899c8),u=r(0x1dac54e47),d=r(0xe8a28702),c=r(0x1170c7483),h=r(0x22b22c0ed),f={},p="startup",g="gained_focus";class _{static _safeFlushAndForget(e){var t;null==(t=f[e])||t.flush().catch(()=>{})}static _safeRetryFailedLogs(e){var t;null==(t=f[e])||t._retryFailedLogs(g)}constructor(e,t,r,i){var n;this._sdkKey=e,this._emitter=t,this._network=r,this._options=i,this._queue=[],this._lastExposureTimeMap={},this._nonExposedChecks={},this._hasRunQuickFlush=!1,this._creationTime=Date.now(),this._isLoggingDisabled=(null==i?void 0:i.disableLogging)===!0,this._maxQueueSize=null!=(n=null==i?void 0:i.loggingBufferMaxSize)?n:100;let s=null==i?void 0:i.networkConfig;this._logEventUrlConfig=new c.UrlConfiguration(o.Endpoint._rgstr,null==s?void 0:s.logEventUrl,null==s?void 0:s.api,null==s?void 0:s.logEventFallbackUrls)}setLoggingDisabled(e){this._isLoggingDisabled=e}enqueue(e){this._shouldLogEvent(e)&&(this._normalizeAndAppendEvent(e),this._quickFlushIfNeeded(),this._queue.length>this._maxQueueSize&&_._safeFlushAndForget(this._sdkKey))}incrementNonExposureCount(e){var t;let r=null!=(t=this._nonExposedChecks[e])?t:0;this._nonExposedChecks[e]=r+1}reset(){this._lastExposureTimeMap={}}start(){(0,l._isServerEnv)()||(f[this._sdkKey]=this,(0,h._subscribeToVisiblityChanged)(e=>{"background"===e?_._safeFlushAndForget(this._sdkKey):"foreground"===e&&_._safeRetryFailedLogs(this._sdkKey)}),this._retryFailedLogs(p),this._startBackgroundFlushInterval())}stop(){return i(this,void 0,void 0,function*(){this._flushIntervalId&&(clearInterval(this._flushIntervalId),this._flushIntervalId=null),delete f[this._sdkKey],yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){if(this._appendAndResetNonExposedChecks(),0===this._queue.length)return;let e=this._queue;this._queue=[],yield this._sendEvents(e)})}_quickFlushIfNeeded(){!this._hasRunQuickFlush&&(this._hasRunQuickFlush=!0,Date.now()-this._creationTime>200||setTimeout(()=>_._safeFlushAndForget(this._sdkKey),200))}_shouldLogEvent(e){if((0,l._isServerEnv)())return!1;if(!(0,u._isExposureEvent)(e))return!0;let t=e.user?e.user:{statsigEnvironment:void 0},r=(0,n._getUserStorageKey)(this._sdkKey,t),i=e.metadata?e.metadata:{},s=[e.eventName,r,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),a=this._lastExposureTimeMap[s],o=Date.now();return(!a||!(o-a<6e5))&&(Object.keys(this._lastExposureTimeMap).length>1e3&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[s]=o,!0)}_sendEvents(e){var t,r;return i(this,void 0,void 0,function*(){if(this._isLoggingDisabled)return this._saveFailedLogsToStorage(e),!1;try{let i=(0,h._isUnloading)()&&this._network.isBeaconSupported()&&(null==(r=null==(t=this._options)?void 0:t.networkConfig)?void 0:r.networkOverrideFunc)==null;if(this._emitter({name:"pre_logs_flushed",events:e}),(i?yield this._sendEventsViaBeacon(e):yield this._sendEventsViaPost(e)).success)return this._emitter({name:"logs_flushed",events:e}),!0;return a.Log.warn("Failed to flush events."),this._saveFailedLogsToStorage(e),!1}catch(e){return a.Log.warn("Failed to flush events."),!1}})}_sendEventsViaPost(e){var t;return i(this,void 0,void 0,function*(){let r=yield this._network.post(this._getRequestData(e)),i=null!=(t=null==r?void 0:r.code)?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},urlConfig:this._logEventUrlConfig,retries:3,isCompressable:!0,params:{[o.NetworkParam.EventCount]:String(e.length)}}}_saveFailedLogsToStorage(e){for(;e.length>500;)e.shift();let t=this._getStorageKey();try{(0,d._setObjectInStorage)(t,e)}catch(e){a.Log.warn("Unable to save failed logs to storage")}}_retryFailedLogs(e){let t=this._getStorageKey();i(this,void 0,void 0,function*(){d.Storage.isReady()||(yield d.Storage.isReadyResolver());let r=(0,d._getObjectFromStorage)(t);r&&(e===p&&d.Storage.removeItem(t),(yield this._sendEvents(r))&&e===g&&d.Storage.removeItem(t))}).catch(()=>{a.Log.warn("Failed to flush stored logs")})}_getStorageKey(){return`statsig.failed_logs.${(0,s._DJB2)(this._sdkKey)}`}_normalizeAndAppendEvent(e){e.user&&(e.user=Object.assign({},e.user),delete e.user.privateAttributes);let t={},r=this._getCurrentPageUrl();r&&(t.statsigMetadata={currentPage:r});let i=Object.assign(Object.assign({},e),t);a.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((null==(e=this._options)?void 0:e.includeCurrentPageUrlWithEvents)!==!1)return(0,l._getCurrentPageUrlSafe)()}_startBackgroundFlushInterval(){var e,t;let r=setInterval(()=>{let e=f[this._sdkKey];e&&e._flushIntervalId===r?_._safeFlushAndForget(this._sdkKey):clearInterval(r)},null!=(t=null==(e=this._options)?void 0:e.loggingIntervalMs)?t:1e4);this._flushIntervalId=r}}t.EventLogger=_},0x1c3862191:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useStatsigInternalClientFactoryAsync=void 0;let i=r(0xfc89b4a4),n=r(0x24cedbcc6);t.useStatsigInternalClientFactoryAsync=function(e,t){let[r,s]=(0,i.useState)(!0),a=(0,i.useRef)((0,n._getInstance)(t.sdkKey));return{client:(0,i.useMemo)(()=>{if(a.current)return a.current.initializeAsync().catch(n.Log.error).finally(()=>s(!1)),a.current;let r=e(t);return a.current=r,r.initializeAsync().catch(n.Log.error).finally(()=>s(!1)),r},[]),isLoading:r}}},0x1c75adc79:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SDKFlags=void 0;let r={};t.SDKFlags={setFlags:(e,t)=>{r[e]=t},get:(e,t)=>{var i,n;return null!=(n=null==(i=r[e])?void 0:i[t])&&n}}},0x1cb673ad5:(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,r="89ab"[Math.floor(4*Math.random())];return`xxxxxxxx-xxxx-4xxx-${r}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,r=>{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"===r?i:7&i|8).toString(16)})}},0x1cbe4d5dd:function(e,t){var r=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t._fetchTxtRecords=void 0;let 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]),n=["i","e","d"];t._fetchTxtRecords=function(e){return r(this,void 0,void 0,function*(){let 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){let e=Error("Failed to fetch TXT records from DNS");throw e.name="DnsTxtFetchError",e}return function(e){let t=e.findIndex((t,r)=>r<200&&"="===String.fromCharCode(t)&&n.includes(String.fromCharCode(e[r-1])));if(-1===t){let e=Error("Failed to parse TXT records from DNS");throw e.name="DnsTxtParseError",e}let r="";for(let i=t-1;i{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){let r=e=>Array.isArray(e)?"array":typeof e;return r(e)===r(t)}},0x1d59d9842:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0xfc89b4a4),n=r(0x24cedbcc6),s=r(0x183840035),a=r(0x16d97559d);t.default=function(e,t){let{client:r,renderVersion:o}=(0,i.useContext)(a.default);return(0,i.useMemo)(()=>(0,s.isNoopClient)(r)?(n.Log.warn(`useGateValue hook failed to find a valid StatsigClient for gate '${e}'.`),s.NoopEvaluationsClient.checkGate(e,t)):r.checkGate(e,t),[e,r,o,...t?Object.values(t):[]])}},0x1dac54e47:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._createLayerParameterExposure=t._createConfigExposure=t._mapExposures=t._createGateExposure=t._isExposureEvent=void 0;let r="statsig::config_exposure",i="statsig::gate_exposure",n="statsig::layer_exposure",s=(e,t,r,i,n)=>(r.bootstrapMetadata&&(i.bootstrapMetadata=r.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:o(r,i),secondaryExposures:n,time:Date.now()});function a(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===r||e===n,t._createGateExposure=(e,t,r)=>{var n,o,l;let u={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return(null==(n=t.__evaluation)?void 0:n.version)!=null&&(u.configVersion=t.__evaluation.version),s(i,e,t.details,u,a(null!=(l=null==(o=t.__evaluation)?void 0:o.secondary_exposures)?l:[],r))},t._mapExposures=a,t._createConfigExposure=(e,t,i)=>{var n,o,l,u;let d={config:t.name,ruleID:t.ruleID};return(null==(n=t.__evaluation)?void 0:n.version)!=null&&(d.configVersion=t.__evaluation.version),(null==(o=t.__evaluation)?void 0:o.passed)!=null&&(d.rulePassed=String(t.__evaluation.passed)),s(r,e,t.details,d,a(null!=(u=null==(l=t.__evaluation)?void 0:l.secondary_exposures)?u:[],i))},t._createLayerParameterExposure=(e,t,r,i)=>{var o,l,u,d;let c=t.__evaluation,h=(null==(o=null==c?void 0:c.explicit_parameters)?void 0:o.includes(r))===!0,f="",p=null!=(l=null==c?void 0:c.undelegated_secondary_exposures)?l:[];h&&(f=null!=(u=c.allocated_experiment_name)?u:"",p=c.secondary_exposures);let g={config:t.name,parameterName:r,ruleID:t.ruleID,allocatedExperiment:f,isExplicitParameter:String(h)};return(null==(d=t.__evaluation)?void 0:d.version)!=null&&(g.configVersion=t.__evaluation.version),s(n,e,t.details,g,a(p,i))};let o=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)},0x1dacc47cd:(e,t,r)=>{var i,n,s;Object.defineProperty(t,"__esModule",{value:!0}),t._getInstance=t._getStatsigGlobalFlag=t._getStatsigGlobal=void 0;let a=r(0x9248bd08);t._getStatsigGlobal=()=>__STATSIG__||c,t._getStatsigGlobalFlag=e=>(0,t._getStatsigGlobal)()[e],t._getInstance=e=>{let r=(0,t._getStatsigGlobal)();return e?r.instances&&r.instances[e]:(r.instances&&Object.keys(r.instances).length>1&&a.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."),r.firstInstance)};let o="__STATSIG__",l="undefined"!=typeof window?window:{},u=void 0!==r.g?r.g:{},d="undefined"!=typeof globalThis?globalThis:{},c=null!=(s=null!=(n=null!=(i=l[o])?i:u[o])?n:d[o])?s:{instance:t._getInstance};l[o]=c,u[o]=c,d[o]=c},0x1de8a70de:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Diagnostics=void 0;let r=new Map,i="start";function n(e,t,r,i){return Object.assign({key:r,action:t,step:i,timestamp:Date.now()},e)}function s(e,t){var i;let n=null!=(i=r.get(e))?i:[];n.push(t),r.set(e,n)}function a(e,t){if(t in e)return e[t]}t.Diagnostics={_getMarkers:e=>r.get(e),_markInitOverallStart:e=>{s(e,n({},i,"overall"))},_markInitOverallEnd:(e,t,r)=>{s(e,n({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:r},"end","overall"))},_markInitNetworkReqStart:(e,t)=>{s(e,n(t,i,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{s(e,n(t,"end","initialize","network_request"))},_markInitProcessStart:e=>{s(e,n({},i,"initialize","process"))},_markInitProcessEnd:(e,t)=>{s(e,n(t,"end","initialize","process"))},_clearMarkers:e=>{r.delete(e)},_formatError(e){if(e&&"object"==typeof e)return{code:a(e,"code"),name:a(e,"name"),message:a(e,"message")}},_getDiagnosticsData(e,r,i,n){var s;return{success:(null==e?void 0:e.ok)===!0,statusCode:null==e?void 0:e.status,sdkRegion:null==(s=null==e?void 0:e.headers)?void 0:s.get("x-statsig-region"),isDelta:!0===i.includes('"is_delta":true')||void 0,attempt:r,error:t.Diagnostics._formatError(n)}},_enqueueDiagnosticsEvent(e,r,i,n){let s=t.Diagnostics._getMarkers(i);if(null==s||s.length<=0)return -1;let a=s[s.length-1].timestamp-s[0].timestamp;t.Diagnostics._clearMarkers(i);let o={eventName:"statsig::diagnostics",user:e,value:null,metadata:{context:"initialize",markers:s.slice(),statsigOptions:n},time:Date.now()};return r.enqueue(o),a}}},0x1e496a27f:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useStatsigInternalClientFactoryBootstrap=void 0;let i=r(0xfc89b4a4),n=r(0x24cedbcc6);t.useStatsigInternalClientFactoryBootstrap=function(e,t){let r=(0,i.useRef)((0,n._getInstance)(t.sdkKey));return(0,i.useMemo)(()=>{if(r.current)return r.current;let i=e(t);return r.current=i,i.dataAdapter.setData(t.initialValues),i.initializeSync(),i},[])}},0x1fd9cf36a:(e,t,r)=>{r.d(t,{NN:()=>eK,iX:()=>eY,iT:()=>eG});var i,n,s=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,a={revert:function(){}},o=new Map,l=new Set;function u(e){var t=o.get(e);return t||(t={element:e,attributes:{}},o.set(e,t)),t}function d(e,t,r,i,n){var s=r(e),a={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if("position"!==t||!a._positionTimeout){"position"===t&&(a._positionTimeout=setTimeout(function(){a._positionTimeout=null},1e3));var i=r(e);("position"!==t||i.parentNode!==a.virtualValue.parentNode||i.insertBeforeNode!==a.virtualValue.insertBeforeNode)&&i!==a.virtualValue&&(a.originalValue=i,n(a))}}),mutationRunner:n,setValue:i,getCurrentValue:r};return"position"===t&&e.parentNode?a.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):a.observer.observe(e,"html"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}),a}function c(e,t){var r=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?r&&e.parentNode===r.parentNode&&e.insertBeforeNode===r.insertBeforeNode||(t.isDirty=!0,O()):e!==r&&(t.isDirty=!0,O())}function h(e){var t,r=e.originalValue;e.mutations.forEach(function(e){return r=e.mutate(r)}),c((t=r,i||(i=document.createElement("div")),i.innerHTML=t,i.innerHTML),e)}function f(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),c(Array.from(t).filter(Boolean).join(" "),e)}function p(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),c(t,e)}function g(e){var t=e.originalValue;e.mutations.forEach(function(e){t=function(e){var t=e.parentSelector,r=e.insertBeforeSelector,i=document.querySelector(t);if(!i)return null;var n=r?document.querySelector(r):null;return r&&!n?null:{parentNode:i,insertBeforeNode:n}}(e.mutate())||t}),c(t,e)}var _=function(e){return e.innerHTML},m=function(e,t){return e.innerHTML=t};function y(e){var t=u(e);return t.html||(t.html=d(e,"html",_,m,h)),t.html}var v=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},b=function(e,t){(!t.insertBeforeNode||t.parentNode.contains(t.insertBeforeNode))&&t.parentNode.insertBefore(e,t.insertBeforeNode)};function k(e){var t=u(e);return t.position||(t.position=d(e,"position",v,b,g)),t.position}var x=function(e,t){return t?e.className=t:e.removeAttribute("class")},S=function(e){return e.className};function w(e){var t=u(e);return t.classes||(t.classes=d(e,"class",S,x,f)),t.classes}function E(e,t){var r=u(e);return r.attributes[t]||(r.attributes[t]=d(e,t,function(e){var r;return null!=(r=e.getAttribute(t))?r:null},function(e,r){return null!==r?e.setAttribute(t,r):e.removeAttribute(t)},p)),r.attributes[t]}function C(e,t,r){if(r.isDirty){r.isDirty=!1;var i,n,s,a,l,u,d,c,h,f,p=r.virtualValue;!r.mutations.length&&(f=o.get(e))&&("html"===t?(null==(i=f.html)||null==(n=i.observer)||n.disconnect(),delete f.html):"class"===t?(null==(s=f.classes)||null==(a=s.observer)||a.disconnect(),delete f.classes):"position"===t?(null==(l=f.position)||null==(u=l.observer)||u.disconnect(),delete f.position):(null==(d=f.attributes)||null==(c=d[t])||null==(h=c.observer)||h.disconnect(),delete f.attributes[t])),r.setValue(e,p)}}function A(e,t){e.html&&C(t,"html",e.html),e.classes&&C(t,"class",e.classes),e.position&&C(t,"position",e.position),Object.keys(e.attributes).forEach(function(r){C(t,r,e.attributes[r])})}function O(){o.forEach(A)}function I(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach(function(r){if(!t.has(r)){var i;e.elements.add(r),i=null,"html"===e.kind?i=y(r):"class"===e.kind?i=w(r):"attribute"===e.kind?i=E(r,e.attribute):"position"===e.kind&&(i=k(r)),i&&(i.mutations.push(e),i.mutationRunner(i))}})}}function D(){l.forEach(I)}function T(e){return"undefined"==typeof document?a:(l.add(e),I(e),{revert:function(){e.elements.forEach(function(t){var r=null;if("html"===e.kind?r=y(t):"class"===e.kind?r=w(t):"attribute"===e.kind?r=E(t,e.attribute):"position"===e.kind&&(r=k(t)),r){var i=r.mutations.indexOf(e);-1!==i&&r.mutations.splice(i,1),r.mutationRunner(r)}}),e.elements.clear(),l.delete(e)}})}function j(e,t){return T({kind:"html",elements:new Set,mutate:t,selector:e})}function P(e,t){return T({kind:"class",elements:new Set,mutate:t,selector:e})}function N(e,t,r){return s.test(t)?"class"===t||"className"===t?P(e,function(e){var t=r(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})}):T({kind:"attribute",attribute:t,elements:new Set,mutate:r,selector:e}):a}"undefined"!=typeof document&&(n||(n=new MutationObserver(function(){D()})),D(),n.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));let M={declarative:function(e){var t,r,i=e.selector,n=e.action,s=e.value,o=e.attribute,l=e.parentSelector,u=e.insertBeforeSelector;if("html"===o){if("append"===n)return j(i,function(e){return e+(null!=s?s:"")});else if("set"===n)return j(i,function(){return null!=s?s:""})}else if("class"===o){if("append"===n)return P(i,function(e){s&&e.add(s)});else if("remove"===n)return P(i,function(e){s&&e.delete(s)});else if("set"===n)return P(i,function(e){e.clear(),s&&e.add(s)})}else if("position"===o){if("set"===n&&l){return t=i,r=function(){return{insertBeforeSelector:u,parentSelector:l}},T({kind:"position",elements:new Set,mutate:r,selector:t})}}else if("append"===n)return N(i,o,function(e){return null!==e?e+(null!=s?s:""):null!=s?s:""});else if("set"===n)return N(i,o,function(){return null!=s?s:""});else if("remove"===n)return N(i,o,function(){return null});return a}},R={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function F(e){let t=0x811c9dc5,r=e.length;for(let i=0;i>>0}function L(e,t,r){return 2===r?F(F(e+t)+"")%1e4/1e4:1===r?F(t+e)%1e3/1e3:null}function U(e,t){return e>=t[0]&&e{t.push([i.searchParams.get(r)||"",e,!1])}),!t.some(e=>!function(e,t,r){try{let i=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return r&&(i="\\/?"+i.replace(/(^\/|\/$)/g,"")+"\\/?"),RegExp("^"+i+"$","i").test(e)}catch(e){return!1}}(e[0],e[1],e[2]))}catch(e){}return!1}catch(e){return!1}}(e,t[n].type,t[n].pattern);if(!1===t[n].include){if(s)return!1}else r=!0,s&&(i=!0)}return i||!r}let z=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0));async function B(e,t,r){if(t=t||"",!(r=r||globalThis.crypto&&globalThis.crypto.subtle||R.SubtleCrypto))throw Error("No SubtleCrypto implementation found");try{let i=await r.importKey("raw",z(t),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[n,s]=e.split("."),a=await r.decrypt({name:"AES-CBC",iv:z(n)},i,z(s));return new TextDecoder().decode(a)}catch(e){throw Error("Failed to decrypt")}}function K(e){return"string"==typeof e?e:JSON.stringify(e)}function q(e){"number"==typeof e&&(e+=""),e&&"string"==typeof e||(e="0");let t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return 3===t.length&&t.push("~"),t.map(e=>e.match(/^[0-9]+$/)?e.padStart(5," "):e).join("-")}function V(e){return"object"==typeof e&&null!==e}function G(e){return e.urlPatterns&&e.variations.some(e=>V(e)&&"urlRedirect"in e)?"redirect":e.variations.some(e=>V(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function Y(e,t){return new Promise(r=>{let i,n=!1,s=e=>{n||(n=!0,i&&clearTimeout(i),r(e||null))};t&&(i=setTimeout(()=>s(),t)),e.then(e=>s(e)).catch(()=>s())})}let J={staleTTL:6e4,maxAge:144e5,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},W={fetchFeaturesCall:e=>{let{host:t,clientKey:r,headers:i}=e;return R.fetch(`${t}/api/features/${r}`,{headers:i})},fetchRemoteEvalCall:e=>{let{host:t,clientKey:r,payload:i,headers:n}=e,s={method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(i)};return R.fetch(`${t}/api/eval/${r}`,s)},eventSourceCall:e=>{let{host:t,clientKey:r,headers:i}=e;return i?new R.EventSource(`${t}/sub/${r}`,{headers:i}):new R.EventSource(`${t}/sub/${r}`)},startIdleListener:()=>{let e;if("undefined"==typeof window||"undefined"==typeof document)return;let t=()=>{"visible"===document.visibilityState?(window.clearTimeout(e),et.forEach(e=>{e&&"idle"===e.state&&em(e)})):"hidden"===document.visibilityState&&(e=window.setTimeout(en,J.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(R.localStorage=globalThis.localStorage)}catch(e){}let H=new Map,Q=!1,X=new Map,ee=new Map,et=new Map,er=new Set;async function ei(e){let{instance:t,timeout:r,skipCache:i,allowStale:n,backgroundSync:s}=e;return s||(J.backgroundSync=!1),ea({instance:t,allowStale:n,timeout:r,skipCache:i})}function en(){et.forEach(e=>{e&&(e.state="idle",e_(e))})}async function es(){try{if(!R.localStorage)return;await R.localStorage.setItem(J.cacheKey,JSON.stringify(Array.from(X.entries())))}catch(e){}}async function ea(e){let{instance:t,allowStale:r,timeout:i,skipCache:n}=e,s=eo(t),a=el(t),o=new Date,l=new Date(o.getTime()-J.maxAge+J.staleTTL);await eu();let u=J.disableCache||n?void 0:X.get(a);return u&&(r||u.staleAt>o)&&u.staleAt>l?(u.sse&&er.add(s),u.staleAt{n[e]=r[e]});let s=e.getForcedVariations(),a=e.getUrl();return`${t}||${JSON.stringify({ca:n,fv:s,url:a})}`}async function eu(){if(!Q){Q=!0;try{if(R.localStorage){let e=await R.localStorage.getItem(J.cacheKey);if(!J.disableCache&&e){let t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(e=>{let[t,r]=e;X.set(t,{...r,staleAt:new Date(r.staleAt)})}),ed()}}}catch(e){}if(!J.disableIdleStreams){let e=W.startIdleListener();e&&(W.stopIdleListener=e)}}}function ed(){let e=Array.from(X.entries()).map(e=>{let[t,r]=e;return{key:t,staleAt:r.staleAt.getTime()}}).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,X.size-J.maxEntries),X.size);for(let r=0;reh(e,r))}async function eh(e,t){await e.setPayload(t||e.getPayload())}async function ef(e){let{apiHost:t,apiRequestHeaders:r}=e.getApiHosts(),i=e.getClientKey(),n="isRemoteEval"in e&&e.isRemoteEval(),s=eo(e),a=el(e),o=ee.get(a);return o||(o=(n?W.fetchRemoteEvalCall({host:t,clientKey:i,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:r}):W.fetchFeaturesCall({host:t,clientKey:i,headers:r})).then(e=>{if(!e.ok)throw Error(`HTTP error: ${e.status}`);return"enabled"===e.headers.get("x-sse-support")&&er.add(s),e.json()}).then(t=>(ec(s,a,t),ep(e),ee.delete(a),{data:t,success:!0,source:"network"})).catch(e=>(ee.delete(a),{data:null,source:"error",success:!1,error:e})),ee.set(a,o)),o}function ep(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=eo(e),i=el(e),{streamingHost:n,streamingHostRequestHeaders:s}=e.getApiHosts(),a=e.getClientKey();if(t&&er.add(r),J.backgroundSync&&er.has(r)&&R.EventSource){if(et.has(r))return;let e={src:null,host:n,clientKey:a,headers:s,cb:t=>{try{if("features-updated"===t.type){let e=H.get(r);e&&e.forEach(e=>{ef(e)})}else if("features"===t.type){let e=JSON.parse(t.data);ec(r,i,e)}e.errors=0}catch(t){eg(e)}},errors:0,state:"active"};et.set(r,e),em(e)}}function eg(e){if("idle"!==e.state&&(e.errors++,e.errors>3||e.src&&2===e.src.readyState)){let t=Math.pow(3,e.errors-3)*(1e3+1e3*Math.random());e_(e),setTimeout(()=>{["idle","active"].includes(e.state)||em(e)},Math.min(t,3e5))}}function e_(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,"active"===e.state&&(e.state="disabled"))}function em(e){e.src=W.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state="active",e.src.addEventListener("features",e.cb),e.src.addEventListener("features-updated",e.cb),e.src.onerror=()=>eg(e),e.src.onopen=()=>{e.errors=0}}function ey(e,t){e_(e),et.delete(t)}function ev(){er.clear(),et.forEach(ey),H.clear(),W.stopIdleListener()}function eb(e,t){if(t.streaming){if(!e.getClientKey())throw Error("Must specify clientKey to enable streaming");t.payload&&ep(e,!0);let r=eo(e),i=H.get(r)||new Set;i.add(e),H.set(r,i)}}let ek={};function ex(e,t,r){for(let[i,n]of(r=r||{},Object.entries(t)))switch(i){case"$or":if(!eE(e,n,r))return!1;break;case"$nor":if(eE(e,n,r))return!1;break;case"$and":if(!function(e,t,r){for(let i=0;iq(i);case"$vgte":return q(r)>=q(i);case"$vlt":return q(r)i;case"$gte":return r>=i;case"$exists":return i?null!=r:null==r;case"$in":if(!Array.isArray(i))return!1;return ew(r,i);case"$inGroup":return ew(r,n[i]||[]);case"$notInGroup":return!ew(r,n[i]||[]);case"$nin":if(!Array.isArray(i))return!1;return!ew(r,i);case"$not":return!e(i,r,n);case"$size":if(!Array.isArray(r))return!1;return e(i,r.length,n);case"$elemMatch":if(!Array.isArray(r))return!1;let s=eS(i)?t=>e(i,t,n):e=>ex(e,i,n);for(let e=0;e0&&t.filter(e=>"$"===e[0]).length===t.length}function ew(e,t){return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)}function eE(e,t,r){if(!t.length)return!0;for(let i=0;in(t,r,e.user)))}if(e.user.trackingCallback){let n=e.user.trackingCallback;i.push(eC(()=>n(t,r)))}if(e.global.eventLogger){let n=e.global.eventLogger;i.push(eC(()=>n("Experiment Viewed",{experimentId:t.key,variationId:r.key,hashAttribute:r.hashAttribute,hashValue:r.hashValue},e.user)))}return i}function eO(e,t){if(t.stack.evaluatedFeatures.has(e))return eD(t,e,null,"cyclicPrerequisite");t.stack.evaluatedFeatures.add(e),t.stack.id=e;let r=function(e){let t=new Map;return e.global.forcedFeatureValues&&e.global.forcedFeatureValues.forEach((e,r)=>t.set(r,e)),e.user.forcedFeatureValues&&e.user.forcedFeatureValues.forEach((e,r)=>t.set(r,e)),t}(t);if(r.has(e))return eD(t,e,r.get(e),"override");if(!t.global.features||!t.global.features[e])return eD(t,e,null,"unknownFeature");let i=t.global.features[e];if(i.rules){let r=new Set(t.stack.evaluatedFeatures);e:for(let n of i.rules){if(n.parentConditions)for(let i of n.parentConditions){t.stack.evaluatedFeatures=new Set(r);let n=eO(i.id,t);if("cyclicPrerequisite"===n.source)return eD(t,e,null,"cyclicPrerequisite");if(!ex({value:n.value},i.condition||{})){if(i.gate)return eD(t,e,null,"prerequisite");continue e}}if(n.filters&&eP(n.filters,t))continue;if("force"in n){if(n.condition&&!ej(n.condition,t)||!function(e,t,r,i,n,s,a){if(!n&&void 0===s)return!0;if(!n&&0===s)return!1;let{hashValue:o}=eM(e,r,i);if(!o)return!1;let l=L(t,o,a||1);return null!==l&&(n?U(l,n):void 0===s||l<=s)}(t,n.seed||e,n.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!n.disableStickyBucketing?n.fallbackAttribute:void 0,n.range,n.coverage,n.hashVersion))continue;return n.tracks&&n.tracks.forEach(e=>{!eA(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),eD(t,e,n.force,"force",n.id)}if(!n.variations)continue;let i={variations:n.variations,key:n.key||e};"coverage"in n&&(i.coverage=n.coverage),n.weights&&(i.weights=n.weights),n.hashAttribute&&(i.hashAttribute=n.hashAttribute),n.fallbackAttribute&&(i.fallbackAttribute=n.fallbackAttribute),n.disableStickyBucketing&&(i.disableStickyBucketing=n.disableStickyBucketing),void 0!==n.bucketVersion&&(i.bucketVersion=n.bucketVersion),void 0!==n.minBucketVersion&&(i.minBucketVersion=n.minBucketVersion),n.namespace&&(i.namespace=n.namespace),n.meta&&(i.meta=n.meta),n.ranges&&(i.ranges=n.ranges),n.name&&(i.name=n.name),n.phase&&(i.phase=n.phase),n.seed&&(i.seed=n.seed),n.hashVersion&&(i.hashVersion=n.hashVersion),n.filters&&(i.filters=n.filters),n.condition&&(i.condition=n.condition);let{result:s}=eI(i,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(i,s),s.inExperiment&&!s.passthrough)return eD(t,e,s.value,"experiment",n.id,i,s)}}return eD(t,e,void 0===i.defaultValue?null:i.defaultValue,"defaultValue")}function eI(e,t,r){var i;let n=e.key,s=e.variations.length;if(s<2||!1===r.global.enabled||!1===r.user.enabled||(e=function(e,t){let r=e.key,i=t.global.overrides;return i&&i[r]&&"string"==typeof(e=Object.assign({},e,i[r])).url&&(e.url=Z(e.url)),e}(e,r)).urlPatterns&&!$(r.user.url||"",e.urlPatterns))return{result:eN(r,e,-1,!1,t)};let a=function(e,t,r){if(!t)return null;let i=t.split("?")[1];if(!i)return null;let n=i.replace(/#.*/,"").split("&").map(e=>e.split("=",2)).filter(t=>{let[r]=t;return r===e}).map(e=>{let[,t]=e;return parseInt(t)});return n.length>0&&n[0]>=0&&n[0]0){for(let e=0;ee.key===d);return c<0?{variation:-1}:{variation:c}}({ctx:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});c=t>=0,d=t,h=!!i}if(!c){if(e.filters){if(eP(e.filters,r))return{result:eN(r,e,-1,!1,t)}}else if(e.namespace&&!function(e,t){let r=L("__"+t[0],e,1);return null!==r&&r>=t[1]&&r1&&(t=1);let i=e<=0?[]:Array(e).fill(1/e);(r=r||i).length!==e&&(r=i);let n=r.reduce((e,t)=>t+e,0);(n<.99||n>1.01)&&(r=i);let s=0;return r.map(e=>{let r=s;return s+=e,[r,r+t*e]})}(s,void 0===e.coverage?1:e.coverage,e.weights))),h)return{result:eN(r,e,-1,!1,t,void 0,!0)};if(d<0)return{result:eN(r,e,-1,!1,t)};if("force"in e)return{result:eN(r,e,void 0===e.force?-1:e.force,!1,t)};if(r.global.qaMode||r.user.qaMode||"stopped"===e.status)return{result:eN(r,e,-1,!1,t)};let p=eN(r,e,d,!0,t,f,c);if(r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:t,key:i,doc:n}=function(e,t,r,i){let n=eF(t,r),s=e.user.stickyBucketAssignmentDocs&&e.user.stickyBucketAssignmentDocs[n]&&e.user.stickyBucketAssignmentDocs[n].assignments||{},a={...s,...i},o=JSON.stringify(s)!==JSON.stringify(a);return{key:n,doc:{attributeName:t,attributeValue:r,assignments:a},changed:o}}(r,l,K(u),{[eR(e.key,e.bucketVersion)]:p.key});t&&(r.user.stickyBucketAssignmentDocs=r.user.stickyBucketAssignmentDocs||{},r.user.stickyBucketAssignmentDocs[i]=n,r.user.saveStickyBucketAssignmentDoc(n))}let g=eA(r,e,p);0===g.length&&r.global.saveDeferredTrack&&r.global.saveDeferredTrack({experiment:e,result:p});let _=g.length?1===g.length?g[0]:Promise.all(g).then(()=>{}):void 0;return"changeId"in e&&e.changeId&&r.global.recordChangeId&&r.global.recordChangeId(e.changeId),{result:p,trackingCall:_}}function eD(e,t,r,i,n,s,a){let o={value:r,on:!!r,off:!r,source:i,ruleId:n||""};return s&&(o.experiment=s),a&&(o.experimentResult=a),"override"!==i&&function(e,t,r){if(e.user.trackedFeatureUsage){let i=JSON.stringify(r.value);if(e.user.trackedFeatureUsage[t]===i)return;e.user.trackedFeatureUsage[t]=i,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:r,timestamp:Date.now().toString(),logType:"feature"})}if(e.global.onFeatureUsage){let i=e.global.onFeatureUsage;eC(()=>i(t,r,e.user))}if(e.user.onFeatureUsage){let i=e.user.onFeatureUsage;eC(()=>i(t,r))}if(e.global.eventLogger){let i=e.global.eventLogger;eC(()=>i("Feature Evaluated",{feature:t,source:r.source,value:r.value,ruleId:"defaultValue"===r.source?"$default":r.ruleId||"",variationId:r.experimentResult?r.experimentResult.key:""},e.user))}}(e,t,o),o}function eT(e){return{...e.user.attributes,...e.user.attributeOverrides}}function ej(e,t){return ex(eT(t),e,t.global.savedGroups||{})}function eP(e,t){return e.some(e=>{let{hashValue:r}=eM(t,e.attribute);if(!r)return!0;let i=L(e.seed,r,e.hashVersion||2);return null===i||!e.ranges.some(e=>U(i,e))})}function eN(e,t,r,i,n,s,a){let o=!0;(r<0||r>=t.variations.length)&&(r=0,o=!1);let{hashAttribute:l,hashValue:u}=eM(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),d=t.meta?t.meta[r]:{},c={key:d.key||""+r,featureId:n,inExperiment:o,hashUsed:i,variationId:r,value:t.variations[r],hashAttribute:l,hashValue:u,stickyBucketUsed:!!a};return d.name&&(c.name=d.name),void 0!==s&&(c.bucket=s),d.passthrough&&(c.passthrough=d.passthrough),c}function eM(e,t,r){let i=t||"id",n="",s=eT(e);return s[i]&&(n=s[i]),!n&&r&&(s[r]&&(n=s[r]),n&&(i=r)),{hashAttribute:i,hashValue:n}}function eR(e,t){return t=t||0,`${e}__${t}`}function eF(e,t){return`${e}||${t}`}async function eL(e,t,r){let i=eU(e,r);return t.getAllAssignments(i)}function eU(e,t){let r={};return(function(e,t){let r=new Set,i=t&&t.features?t.features:e.global.features||{},n=t&&t.experiments?t.experiments:e.global.experiments||[];return Object.keys(i).forEach(e=>{let t=i[e];if(t.rules)for(let e of t.rules)e.variations&&(r.add(e.hashAttribute||"id"),e.fallbackAttribute&&r.add(e.fallbackAttribute))}),n.map(e=>{r.add(e.hashAttribute||"id"),e.fallbackAttribute&&r.add(e.fallbackAttribute)}),Array.from(r)})(e,t).forEach(t=>{let{hashValue:i}=eM(e,t);r[t]=K(i)}),r}async function eZ(e,t,r){if((e={...e}).encryptedFeatures){try{e.features=JSON.parse(await B(e.encryptedFeatures,t,r))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await B(e.encryptedExperiments,t,r))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await B(e.encryptedSavedGroups,t,r))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e}function e$(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}let ez="undefined"!=typeof window&&"undefined"!=typeof document,eB=function(){let e;try{e="1.6.2"}catch(t){e=""}return e}();class eK{constructor(e){if(e=e||{},this.version=eB,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw Error("Encryption is not available for remoteEval");if(!e.clientKey)throw Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch(e){}if(t)throw Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw Error("cacheKeyAttributes are only used for remoteEval");if(e.stickyBucketService){let t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=e=>t.saveAssignments(e)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),ez&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let e in this._options.stickyBucketAssignmentDocs){let t=this._options.stickyBucketAssignmentDocs[e];t&&this._options.stickyBucketService.saveAssignments(t).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await eZ(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,eb(this,e),this}async init(e){if(this._initialized=!0,(e=e||{}).cacheSettings&&(Object.assign(J,e.cacheSettings),J.backgroundSync||ev()),e.payload)return await this.setPayload(e.payload),eb(this,e),{success:!0,source:"init"};{let{data:t,...r}=await this._refresh({...e,allowStale:!0});return eb(this,e),await this.setPayload(t||{}),r}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){var e=this._options;let t=e.apiHost||"https://cdn.growthbook.io";return{apiHost:t.replace(/\/*$/,""),streamingHost:(e.streamingHost||t).replace(/\/*$/,""),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh(e){let{timeout:t,skipCache:r,allowStale:i,streaming:n}=e;if(!this._options.clientKey)throw Error("Missing clientKey");return ei({instance:this,timeout:t,skipCache:r||this._options.disableCache,allowStale:i,backgroundSync:n??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,r){let i=await B(e,t||this._options.decryptionKey,r);this.setFeatures(JSON.parse(i))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,r){let i=await B(e,t||this._options.decryptionKey,r);this.setExperiments(JSON.parse(i))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval)return void await this._refreshForRemoteEval();this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval)return void await this._refreshForRemoteEval();this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval)return void await this._refreshForRemoteEval();this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl="",this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){var t;e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(e=>{try{e()}catch(e){console.error(e)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,t=this,H.forEach(e=>e.delete(t)),e.destroyAllStreams&&ev(),this.logs=[],ez&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval)return void this._refreshForRemoteEval();this._updateAllAutoExperiments(),this._render()}run(e){let{result:t}=eI(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return(this._triggeredExpKeys.add(e),this._options.experiments)?this._options.experiments.filter(t=>t.key===e).map(e=>this._runAutoExperiment(e)).filter(e=>null!==e):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){let r,i,n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;this._isAutoExperimentBlockedByContext(e)?r=eN(this._getEvalContext(),e,-1,!1,""):({result:r,trackingCall:i}=eI(e,null,this._getEvalContext()),this._onExperimentEval(e,r));let s=JSON.stringify(r.value);if(!t&&r.inExperiment&&n&&n.valueHash===s)return r;if(n&&this._undoActiveAutoExperiment(e),r.inExperiment){let t=G(e);if("redirect"===t&&r.value.urlRedirect&&e.urlPatterns){let t=e.persistQueryString?function(e,t){let r,i;try{r=new URL(e),i=new URL(t)}catch(e){return console.error(`Unable to merge query strings: ${e}`),t}return r.searchParams.forEach((e,t)=>{i.searchParams.has(t)||i.searchParams.set(t,e)}),i.toString()}(this._getContextUrl(),r.value.urlRedirect):r.value.urlRedirect;if($(t,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),r;this._redirectedUrl=t;let{navigate:n,delay:s}=this._getNavigateFunction();if(n)if(ez)Promise.all([...i?[Y(i,this._options.maxNavigateDelay??1e3)]:[],new Promise(e=>window.setTimeout(e,this._options.navigateDelay??s))]).then(()=>{try{n(t)}catch(e){console.error(e)}});else try{n(t)}catch(e){console.error(e)}}else if("visual"===t){let t=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(r.value):this._applyDOMChanges(r.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:s})}}return r}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],r=new Set(t);for(let i of(this._activeAutoExperiments.forEach((e,t)=>{r.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))}),t)){let t=this._runAutoExperiment(i,e);if(t&&t.inExperiment&&"redirect"===G(i))break}}_onExperimentEval(e,t){let r=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,r)}_fireSubscriptions(e,t,r){r&&r.result.inExperiment===t.inExperiment&&r.result.variationId===t.variationId||this._subscriptions.forEach(r=>{try{r(e,t)}catch(e){console.error(e)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let r=this.evalFeature(e).value;return null===r?t:r}feature(e){return this.evalFeature(e)}evalFeature(e){return eO(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(e=>e&&e.experiment&&e.result).map(e=>[e$(e.experiment,e.result),e]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{t&&t.experiment&&t.result?e.push(this._options.trackingCallback(t.experiment,t.result)):console.error("Invalid deferred tracking call",{call:t})}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed)return void console.error("Cannot log event to destroyed GrowthBook instance");if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(e){console.error(e)}else console.error("No event logger configured")}_saveDeferredTrack(e){this._deferredTrackingCalls.set(e$(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(ez?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=G(e);if("visual"===t){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(e=>e.js))return!0}else{if("redirect"!==t||this._options.disableUrlRedirectExperiments)return!0;try{let t=new URL(this._getContextUrl());for(let r of e.variations){if(!r||!r.urlRedirect)continue;let e=new URL(r.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(e.protocol!==t.protocol||e.host!==t.host))return!0}}catch(t){return this.log("Error parsing current or redirect URL",{id:e.key,error:t}),!0}}return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:ez?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!ez)return;let t=[];if(e.css){let r=document.createElement("style");r.innerHTML=e.css,document.head.appendChild(r),t.push(()=>r.remove())}if(e.js){let r=document.createElement("script");r.innerHTML=e.js,this._options.jsInjectionNonce&&(r.nonce=this._options.jsInjectionNonce),document.head.appendChild(r),t.push(()=>r.remove())}return e.domMutations&&e.domMutations.forEach(e=>{t.push(M.declarative(e).revert)}),()=>{t.forEach(e=>e())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),r=await eL(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=r}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e))return void console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");let r=eU(this._getEvalContext(),t);return e.getAllAssignmentsSync(r)}inDevMode(){return!!this._options.enableDevMode}}var eq=r(0xfc89b4a4);let eV=eq.createContext({});function eG(e){return(function(){let{growthbook:e}=eq.useContext(eV);if(!e)throw Error("Missing or invalid GrowthBookProvider");return e})().evalFeature(e)}let eY=({children:e,growthbook:t})=>{let[r,i]=eq.useState(0);return eq.useEffect(()=>{if(t&&t.setRenderer)return t.setRenderer(()=>{i(e=>e+1)}),()=>{t.setRenderer(()=>{})}},[t]),eq.createElement(eV.Provider,{value:{growthbook:t}},e)}},0x1fe8a09fc:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StableID=void 0;let i=r(0x1333ff6ef),n=r(0x9248bd08),s=r(0xe8a28702),a=r(0x1cb673ad5),o={};function l(e){return`statsig.stable_id.${(0,i._getStorageKey)(e)}`}function u(e,t){let r=l(t);try{(0,s._setObjectInStorage)(r,e)}catch(e){n.Log.warn("Failed to save StableID")}}t.StableID={get:e=>{if(null==o[e]){let t=function(e){let t=l(e);return(0,s._getObjectFromStorage)(t)}(e);null==t&&u(t=(0,a.getUUID)(),e),o[e]=t}return o[e]},setOverride:(e,t)=>{o[t]=e,u(e,t)}}},0x2053ed714:function(e,t,r){var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigClient=void 0;let s=r(0xb5c89a64);t.StatsigClient=s.default,n(r(0x24cedbcc6),t),t.default=__STATSIG__=Object.assign(Object.assign({},null!=__STATSIG__?__STATSIG__:{}),{StatsigClient:s.default})},0x21a1d9ec9:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeParamStoreGetter=void 0;let i=r(0x24cedbcc6),n={disableExposureLog:!0};function s(e){return null==e||!1===e.disableExposureLog}function a(e,t){return null!=t&&!(0,i._isTypeMatch)(e,t)}t._makeParamStoreGetter=function(e,t,r){return(o,l)=>{if(null==t)return l;let u=t[o];if(null==u||null!=l&&(0,i._typeOf)(l)!==u.param_type)return l;switch(u.ref_type){case"static":return u.value;case"gate":return e.getFeatureGate(u.gate_name,s(r)?void 0:n).value?u.pass_value:u.fail_value;case"dynamic_config":let d=e.getDynamicConfig(u.config_name,n).get(u.param_name);return a(d,l)?l:(s(r)&&e.getDynamicConfig(u.config_name),d);case"experiment":let c=e.getExperiment(u.experiment_name,n).get(u.param_name);return a(c,l)?l:(s(r)&&e.getExperiment(u.experiment_name),c);case"layer":let h=e.getLayer(u.layer_name,n).get(u.param_name);return a(h,l)?l:(s(r)&&e.getLayer(u.layer_name).get(u.param_name),h);default:return l}}}},0x22054f1cd:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x22b22c0ed:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._notifyVisibilityChanged=t._subscribeToVisiblityChanged=t._isUnloading=t._isCurrentlyVisible=void 0;let i=r(0xea3899c8),n="foreground",s="background",a=[],o=n,l=!1;t._isCurrentlyVisible=()=>o===n,t._isUnloading=()=>l,t._subscribeToVisiblityChanged=e=>{a.unshift(e)},t._notifyVisibilityChanged=e=>{e!==o&&(o=e,a.forEach(t=>t(e)))},(0,i._addWindowEventListenerSafe)("focus",()=>{l=!1,(0,t._notifyVisibilityChanged)(n)}),(0,i._addWindowEventListenerSafe)("blur",()=>(0,t._notifyVisibilityChanged)(s)),(0,i._addWindowEventListenerSafe)("beforeunload",()=>{l=!0,(0,t._notifyVisibilityChanged)(s)}),(0,i._addDocumentEventListenerSafe)("visibilitychange",()=>{(0,t._notifyVisibilityChanged)("visible"===document.visibilityState?n:s)})},0x22b42d2c7:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._typedJsonParse=void 0;let i=r(0x9248bd08);t._typedJsonParse=function(e,t,r){try{let r=JSON.parse(e);if(r&&"object"==typeof r&&t in r)return r}catch(e){}return i.Log.error(`Failed to parse ${r}`),null}},0x22ba37007:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x241289771:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x245daa5b9:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let i=r(0xfc89b4a4),n=r(0x24cedbcc6),s=r(0x183840035),a=r(0x16d97559d);t.default=function(e,t){let{client:r,renderVersion:o}=(0,i.useContext)(a.default);return(0,i.useMemo)(()=>(0,s.isNoopClient)(r)?(n.Log.warn(`useDynamicConfig hook failed to find a valid StatsigClient for dynamic config '${e}'.`),s.NoopEvaluationsClient.getDynamicConfig(e,t)):r.getDynamicConfig(e,t),[e,r,o,...t?Object.values(t):[]])}},0x247a7c4c6:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},0x248385392:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._getSortedObject=t._DJB2Object=t._DJB2=void 0;let i=r(0x1cd146d1e);t._DJB2=e=>{let t=0;for(let r=0;r>>0)},t._DJB2Object=(e,r)=>(0,t._DJB2)(JSON.stringify((0,t._getSortedObject)(e,r))),t._getSortedObject=(e,r)=>{if(null==e)return null;let n=Object.keys(e).sort(),s={};return n.forEach(n=>{let a=e[n];if(0===r||"object"!==(0,i._typeOf)(a)){s[n]=a;return}s[n]=(0,t._getSortedObject)(a,null!=r?r-1:r)}),s}},0x249757161:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._makeTypedGet=t._mergeOverride=t._makeLayer=t._makeExperiment=t._makeDynamicConfig=t._makeFeatureGate=void 0;let i=r(0x9248bd08),n=r(0x1cd146d1e);function s(e,t,r,i){var n;return{name:e,details:t,ruleID:null!=(n=null==r?void 0:r.rule_id)?n:"default",__evaluation:r,value:i}}function a(e,t,r){var i;let n=null!=(i=null==r?void 0:r.value)?i:{};return Object.assign(Object.assign({},s(e,t,r,n)),{get:o(e,null==r?void 0:r.value)})}function o(e,t,r){return(s,a)=>{var o;let l=null!=(o=null==t?void 0:t[s])?o:null;return null==l?null!=a?a:null:null==a||(0,n._isTypeMatch)(l,a)?(null==r||r(s),l):(i.Log.warn(`Parameter type mismatch. '${e}.${s}' was found to be type '${typeof l}' but fallback/return type is '${typeof a}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),null!=a?a:null)}}t._makeFeatureGate=function(e,t,r){return s(e,t,r,(null==r?void 0:r.value)===!0)},t._makeDynamicConfig=a,t._makeExperiment=function(e,t,r){var i;return Object.assign(Object.assign({},a(e,t,r)),{groupName:null!=(i=null==r?void 0:r.group_name)?i:null})},t._makeLayer=function(e,t,r,i){var n,a;return Object.assign(Object.assign({},s(e,t,r,void 0)),{get:o(e,null==r?void 0:r.value,i),groupName:null!=(n=null==r?void 0:r.group_name)?n:null,__value:null!=(a=null==r?void 0:r.value)?a:{}})},t._mergeOverride=function(e,t,r,i){return Object.assign(Object.assign(Object.assign({},e),t),{get:o(e.name,r,i)})},t._makeTypedGet=o},0x24cedbcc6:function(e,t,r){var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Storage=t.Log=t.EventLogger=t.Diagnostics=void 0,r(0x1dacc47cd);let s=r(0x1de8a70de);Object.defineProperty(t,"Diagnostics",{enumerable:!0,get:function(){return s.Diagnostics}});let a=r(0x1ba4e8e1e);Object.defineProperty(t,"EventLogger",{enumerable:!0,get:function(){return a.EventLogger}});let o=r(0x9248bd08);Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return o.Log}});let l=r(0x7ce6115c),u=r(0xe8a28702);Object.defineProperty(t,"Storage",{enumerable:!0,get:function(){return u.Storage}}),n(r(0x1dacc47cd),t),n(r(0x1333ff6ef),t),n(r(0x92211ac1),t),n(r(0xb2309e3e),t),n(r(0x1de8a70de),t),n(r(0x164a3fc77),t),n(r(0x5fd7800e),t),n(r(0x247a7c4c6),t),n(r(0x22054f1cd),t),n(r(0x248385392),t),n(r(0x22ba37007),t),n(r(0x9248bd08),t),n(r(0x2f083b9f),t),n(r(0xd54b912),t),n(r(0xcf7c6767),t),n(r(0x241289771),t),n(r(0xe13daa1d),t),n(r(0xea3899c8),t),n(r(0x139d91e26),t),n(r(0xc64daf27),t),n(r(0x1fe8a09fc),t),n(r(0x5cae0f4f),t),n(r(0xe427a868),t),n(r(0x17e7d6080),t),n(r(0x1dac54e47),t),n(r(0x7ce6115c),t),n(r(0x2320d314),t),n(r(0x8c60c6b2),t),n(r(0x249757161),t),n(r(0x1abf6447a),t),n(r(0x14aef1aa),t),n(r(0xe8a28702),t),n(r(0x22b42d2c7),t),n(r(0x1cd146d1e),t),n(r(0x1170c7483),t),n(r(0x1cb673ad5),t),n(r(0x22b22c0ed),t),n(r(0x1841815e2),t),n(r(0x1c75adc79),t),__STATSIG__=Object.assign(Object.assign({},null!=__STATSIG__?__STATSIG__:{}),{Log:o.Log,SDK_VERSION:l.SDK_VERSION})},0x24d73e0bd:(e,t,r)=>{var i,n;r.d(t,{CR:()=>a,ZS:()=>i,Zp:()=>s,o6:()=>n}),function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw Error()},e.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},e.getValidEnumValues=t=>{let r=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),i={};for(let e of r)i[e]=t[e];return e.objectValues(i)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(let r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(i||(i={})),(n||(n={})).mergeShapes=(e,t)=>({...e,...t});let s=i.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return Number.isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":if(Array.isArray(e))return s.array;if(null===e)return s.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return s.promise;if("undefined"!=typeof Map&&e instanceof Map)return s.map;if("undefined"!=typeof Set&&e instanceof Set)return s.set;if("undefined"!=typeof Date&&e instanceof Date)return s.date;return s.object;default:return s.unknown}}},0x253cac196:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useStatsigUser=void 0;let i=r(0xfc89b4a4),n=r(0x16d97559d),s=r(0x144061902);t.useStatsigUser=function(){let{client:e}=(0,s.useStatsigClient)(),{renderVersion:t}=(0,i.useContext)(n.default),r=[e,t],a=(0,i.useMemo)(()=>e.getContext().user,r);return{user:a,updateUserSync:(0,i.useCallback)(t=>("function"==typeof t&&(t=t(a)),e.updateUserSync(t)),r),updateUserAsync:(0,i.useCallback)(t=>("function"==typeof t&&(t=t(a)),e.updateUserAsync(t)),r)}}}}]);