@statsig/js-on-device-eval-client 0.0.1-beta.24 → 0.0.1-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StatsigOnDeviceEval=e():t.StatsigOnDeviceEval=e()}(this,()=>(()=>{"use strict";var n={496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},r=null!=(r=null!=(r=null!=(r=e.__STATSIG__)?r:n.__STATSIG__)?r:i.__STATSIG__)?r:{};e.__STATSIG__=r,n.__STATSIG__=r,i.__STATSIG__=r},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},320:function(t,e,n){var s=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),r=n(780),o=n(104),u=n(283),a=n(296),l=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,o.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.p(t))?(this.m(t,e),this.h[t]):null)}getDataAsync(n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.O(null!=(r=null==t?void 0:t.data)?r:null,i),e=this._(i);return t&&this.m(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.j(e,t)),t})}prefetchData(n){return s(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.m(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.m(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}O(n,i){return s(this,void 0,void 0,function*(){var t,e=yield this.S(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(r.Log.debug("No response returned for latest value"),null)})}N(){return null!=this.l?this.l:(r.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,a.getUserStorageKey)(this.N(),t);return`${u.DataAdapterCachePrefix}.${this.o}.`+t}m(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}p(t){var e=null==(e=l.Storage.getItemSync)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}j(t,e){return s(this,void 0,void 0,function*(){yield l.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.getObjectFromStorage)(this.v))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.removeItem(e[0])),yield(0,l.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),r="undefined"!=typeof performance&&void 0!==performance.mark;let s=[];e.captureDiagnostics=function(t,e){o.mark(t+":start"),e=e();const n=()=>{o.mark(t+":end"),(t+":end").startsWith("initialize:")&&o.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class o{static mark(t,e){r&&(t=performance.mark(t,{detail:e}),s.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:s,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),s=[]}}e.Diagnostics=o},512:function(t,u,e){var n=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t){this.l=t,this.M=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.T(e,t,n)):i}catch(t){return this.T(e,t,n),null}}logError(t,e){this.T(t,e)}T(r,s,o){try{i.Log.warn("Caught error in "+r,{error:s});n(this,void 0,void 0,function*(){var t,e=null!=s?s:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.M.has(i)||(this.M.add(i),t=a.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:r,exception:i,info:n},t)),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=o&&o({name:"error",error:s}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},728:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const r=n(832),s=n(780),o=n(876),u=n(972),a=n(444),l=n(412),c=n(84),d=n(408),h="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.D=e,this.A=n,this.P=i,this.C=[],this.qt={},this.Kt={},this.F=!1,this.L=Date.now(),this.V=!0===(null==i?void 0:i.disableLogging),this.R=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.K=setInterval(()=>this.q(),n),this.Ft=(0,c.Lt)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",h),this.Vt=(0,c.Lt)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",h),d.VisibilityChangeObserver.add(this),this.J()}setLoggingDisabled(t){this.V=t}enqueue(t){this.U(t)&&(this.Jt(t),this.B(),this.C.length>this.R)&&this.q()}incrementNonExposureCount(t){var e=null!=(e=this.Kt[t])?e:0;this.Kt[t]=e+1}reset(){this.qt={}}onVisibilityChanged(t){"background"===t&&this.q()}shutdown(){return i(this,void 0,void 0,function*(){this.K&&(clearInterval(this.K),this.K=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.zt(),0!==this.C.length&&(t=this.C,this.C=[],yield this.W(t))})}B(){this.F||(this.F=!0,200<Date.now()-this.L)||setTimeout(()=>this.q(),200)}U(t){if((0,o.isExposureEvent)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.qt[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.qt).length&&(this.qt={}),this.qt[t]=n}return!0}q(){this.flush().catch(()=>{})}W(t){return i(this,void 0,void 0,function*(){if(this.V)this.Y(t);else try{(!d.VisibilityChangeObserver.isCurrentlyVisible()&&this.A.isBeaconSupported()?yield this.H(t):yield this.X(t)).success?this.D({name:"logs_flushed",events:t}):this.Y(t)}catch(t){s.Log.warn("Failed to flush events.")}})}X(e){return i(this,void 0,void 0,function*(){var t=yield this.A.post({sdkKey:this.l,data:{events:e},url:this.Ft,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,l.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}H(t){return i(this,void 0,void 0,function*(){return{success:yield this.A.beacon({sdkKey:this.l,data:{events:t},url:this.Vt})}})}Y(t){for(;500<t.length;)t.shift();var e=this.Z();(0,a.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}J(){const e=this.Z();i(this,void 0,void 0,function*(){var t=yield(0,a.getObjectFromStorage)(e);t&&(yield a.Storage.removeItem(e),yield this.W(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}Z(){return"statsig.failed_logs."+(0,r.DJB2)(this.l)}Jt(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var{sdkType:e,sdkVersion:n}=u.StatsigMetadataProvider.get();this.C.push(Object.assign(Object.assign({},t),{statsigMetadata:{sdkType:e,sdkVersion:n}}))}zt(){0!==Object.keys(this.Kt).length&&(this.Jt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.Kt)}}),this.Kt={})}}},832:(t,e)=>{function n(e){let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const r={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),r[t]=e});return r}(t)))}},664:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const s=n(280),o=n(688);function c(t,e,n,i){var r=i instanceof o.StatsigClientBase?i.tt.bind(i):void 0;return t.capture(e,()=>(0,s.captureDiagnostics)(e,()=>n.apply(i)),r)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var r;const s=i;for(const o of function(t){const e=new Set;let n=d(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(s))if("constructor"!==o){const u=s[o];s[o]=function(...t){return c(n,o,()=>u.apply(this,t),i)}}for(const a of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(s)){const l=null==(r=null===s||void 0===s?void 0:s.constructor)?void 0:r[a];(null===s||void 0===s?void 0:s.constructor)[a]=function(...t){return c(n,s.constructor.name+"."+a,()=>l.apply(s.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188:function(t,e,n){var r=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const h=n(280),v=n(780),s=n(612),o=n(604),u=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.D=e,this.et=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return r(this,void 0,void 0,function*(){var t=yield this.nt(e);return this.it(Object.assign({method:"POST",body:t},e))})}get(t){return r(this,void 0,void 0,function*(){return this.it(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return r(this,void 0,void 0,function*(){var t=yield this.rt(n),e=yield this.nt(n);return navigator.sendBeacon(t,e)})}it(c){var d;return r(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const r=new AbortController;var t,s,o,u=setTimeout(()=>r.abort(`Timeout of ${this.et}ms expired.`),this.et),a=yield this.rt(c);let l=null;try{if(l=yield fetch(a,{method:e,body:n,headers:Object.assign({},c.headers),signal:r.signal}),clearTimeout(u),l.ok)return o=yield l.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:l.status,contentLength:l.headers.get("content-length")}),{body:o,code:l.status};throw t=yield l.text().catch(()=>"No Text"),(s=new Error(`Failed to fetch: ${a} `+t)).name="NetworkError",s}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(r,t);return h.Diagnostics.mark("_sendRequest:error",{error:n,status:null===l||void 0===l?void 0:l.status,contentLength:null===l||void 0===l?void 0:l.headers.get("content-length")}),!i||i<=0?(null!=(d=this.D)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${a}.`,n,t),null):this.it(Object.assign(Object.assign({},c),{retries:i-1}))}})}rt(e){return r(this,void 0,void 0,function*(){var t=u.StatsigMetadataProvider.get(),t=Object.assign({k:e.sdkKey,st:t.sdkType,sv:t.sdkVersion,t:String(Date.now()),sid:yield s.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}nt(i){return r(this,void 0,void 0,function*(){var t=i["data"],e=yield o.StableID.get(i.sdkKey),n=yield s.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},u.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.ot(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.ot(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}ot(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},612:function(t,e,n){var r=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.SessionID=void 0;const i=n(832),s=n(780),o=n(444),u=n(556),a={};function l(t){return"statsig.session_id."+(0,i.DJB2)(t)}e.SessionID={get:i=>r(void 0,void 0,void 0,function*(){let t=a[i];null==t&&(t=null!=(e=yield function(t){t=l(t);return(0,o.getObjectFromStorage)(t)}(i))?e:{sessionID:(0,u.getUUID)(),startTime:Date.now(),lastUpdate:Date.now()},a[i]=t),(144e5<Date.now()-t.startTime||6e5<Date.now()-t.lastUpdate)&&(t.sessionID=(0,u.getUUID)(),t.startTime=Date.now()),t.lastUpdate=Date.now();var e=t,n=i;return n=l(i),(0,o.setObjectInStorage)(n,e).catch(()=>{s.Log.warn("Failed to save SessionID")}),(a[i]=t).sessionID})}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=void 0;const r=n(832),s=n(780),o=n(444),u=n(556),a={};function l(t){return"statsig.stable_id."+(0,r.DJB2)(t)}function c(t,e){e=l(e);(0,o.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==a[e]&&(a[e]=function(t){t=l(t);return(0,o.getObjectFromStorage)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),a[e]}),setOverride:(t,e)=>{a[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const s=n(512),o=n(728),u=n(780),a=n(604),l=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.ut={},this.l=t,this.P=null!=i?i:{},null!=i&&i.disableStorage&&l.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(r=null==i?void 0:i.logLevel)?r:u.LogLevel.Warn,this.Pt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.lt=new o.EventLogger(t,this.tt.bind(this),n,i),this.u=new s.ErrorBoundary(t);var r,n=null!=(r=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?r:{};n[t]=this,__STATSIG__.instances=n,(__STATSIG__.lastInstance=this).dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.P.disableLogging=t.disableLogging,this.lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.P.disableStorage=t.disableStorage,l.Storage.setDisabled(t.disableStorage))}flush(){return this.lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.tt({name:"pre_shutdown"}),yield this.lt.shutdown()})}on(t,e){this.ut[t]||(this.ut[t]=[]),this.ut[t].push(e)}off(t,e){this.ut[t]&&-1!==(e=this.ut[t].indexOf(e))&&this.ut[t].splice(e,1)}tt(e){var t;const n=t=>{try{t(e)}catch(t){u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this.ut[e.name]&&this.ut[e.name].forEach(t=>n(t)),null!=(t=this.ut["*"])&&t.forEach(n)}ct(t,e){this.loadingStatus=t,this.tt({name:"values_updated",status:t,values:e})}dt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.lt.incrementNonExposureCount(t):this.lt.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function a(t,e,n,i,r){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:r,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(t,e){return a(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createConfigExposure=function(t,e){return a(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createLayerParameterExposure=function(t,e,n){var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),a("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=void 0;let n={sdkVersion:"0.0.1-beta.24",sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.makeLayer=e.makeDynamicConfig=e.makeFeatureGate=void 0;const r="default";e.makeFeatureGate=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.makeDynamicConfig=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,value:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}},e.makeLayer=function(t,e,n,i){return{name:t,details:e,getValue:null!=i?i:()=>{},ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,Et:null!=(e=null==n?void 0:n.value)?e:{},__evaluation:n}}},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const r={},s={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=r[t])?t:null},getItem(t){return Promise.resolve(null!=(t=r[t])?t:null)},setItem(t,e){return r[t]=e,Promise.resolve()},removeItem(t){return delete r[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(r))}};let o=null;try{"undefined"!=typeof window&&"localStorage"in window&&(o={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:s,a=u;e.Storage={getProviderName:()=>a.getProviderName(),getItem:t=>a.getItem(t),setItem:(t,e)=>a.setItem(t,e),removeItem:t=>a.removeItem(t),getAllKeys:()=>a.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=a.getItemSync)?void 0:e.call(a,t))?e:null},setProvider:t=>{u=t,a=t},setDisabled:t=>{a=t?s:u}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield a.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield a.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.typedJsonParse=void 0;const r=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error(n),null}},556:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lt=void 0,e.Lt=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.ht}static add(t){this.ut.push(t)}static remove(t){t=this.ut.indexOf(t);-1!==t&&this.ut.splice(t,1)}static notify(e){e!==this.ht&&(this.ht=e,this.ut.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).ut=[],n.ht="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),o=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780)),u=(Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return o.Log}}),n(444));Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return u.Storage}}),r(n(496),e),r(n(856),e),r(n(320),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(664),e),r(n(780),e),r(n(104),e),r(n(188),e),r(n(264),e),r(n(612),e),r(n(604),e),r(n(688),e),r(n(808),e),r(n(283),e),r(n(876),e),r(n(972),e),r(n(384),e),r(n(136),e),r(n(296),e),r(n(444),e),r(n(412),e),r(n(84),e),r(n(539),e),r(n(556),e),r(n(408),e),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:o.Log,Storage:u.Storage})},532:(t,e)=>{function u(t){return t.setUTCHours(0,0,0,0),t.getTime()}Object.defineProperty(e,"__esModule",{value:!0}),e.default={compareNumbers(t,e,n){if(null==t||null==e)return!1;var i=Number(t),r=Number(e);if(isNaN(i)||isNaN(r))return!1;switch(n){case"gt":return e<t;case"gte":return e<=t;case"lt":return t<e;case"lte":return t<=e;default:return!1}},compareVersions(t,e,n){if(null==t||null==e)return!1;var t=String(t),e=String(e),i=t=>{var e=t.indexOf("-");return-1!==e?t.substring(0,e):t},r=((t,e)=>{var n=t.split(".").map(t=>parseInt(t)),i=e.split(".").map(t=>parseInt(t));let r=0;for(;r<Math.max(n.length,i.length);){var s=r<n.length?n[r]:0,o=r<i.length?i[r]:0;if(s<o)return-1;if(o<s)return 1;r++}return 0})(i(t),i(e));switch(n){case"version_gt":return 0<r;case"version_gte":return 0<=r;case"version_lt":return r<0;case"version_lte":return r<=0;case"version_eq":return 0===r;case"version_neq":return 0!==r;default:return!1}},compareStringInArray(r,t,s){if(!Array.isArray(t))return!1;const o="any_case_sensitive"!==s&&"none_case_sensitive"!==s;var e=-1!==t.findIndex(t=>{var e=String(r),t=String(t),n=o?e.toLowerCase():e,i=o?t.toLowerCase():t;switch(s){case"any":case"none":case"any_case_sensitive":case"none_case_sensitive":return n===i;case"str_starts_with_any":return n.startsWith(i);case"str_ends_with_any":return n.endsWith(i);case"str_contains_any":case"str_contains_none":return n.includes(i);default:return!1}});switch(s){case"none":case"none_case_sensitive":case"str_contains_none":return!e;default:return e}},compareStringWithRegEx(t,e){try{var n=String(t);if(n.length<1e3)return new RegExp(String(e)).test(n)}catch(t){}return!1},compareTime(n,i,r){if(null==n||null==i)return!1;try{let t=new Date(String(n)),e=(isNaN(t.getTime())&&(t=new Date(Number(n))),new Date(String(i)));isNaN(e.getTime())&&(e=new Date(Number(i)));var s=t.getTime(),o=e.getTime();if(isNaN(s)||isNaN(o))return!1;switch(r){case"before":return s<o;case"after":return o<s;case"on":return u(t)===u(e);default:return!1}}catch(t){return!1}}}},947:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resultToLayerEval=e.resultToConfigEval=e.resultToGateEval=e.makeEvalResult=void 0,e.makeEvalResult=function(t){return Object.assign(Object.assign({},{unsupported:!1,bool_value:!1,rule_id:"",secondary_exposures:[],json_value:{},explicit_parameters:null,allocated_experiment_name:null,is_experiment_group:!1,group_name:null,undelegated_secondary_exposures:void 0}),t)},e.resultToGateEval=function(t,e){return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.bool_value,secondary_exposures:e.secondary_exposures}},e.resultToConfigEval=function(t,e){var n;return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.json_value,secondary_exposures:e.secondary_exposures,group:null!=(n=e.group_name)?n:"",group_name:null!=(n=e.group_name)?n:void 0,is_device_based:!1,is_experiment_active:t.isActive,is_user_in_experiment:e.is_experiment_group}},e.resultToLayerEval=function(t,e,n){return{name:t.name,rule_id:n.rule_id,value:n.json_value,secondary_exposures:n.secondary_exposures,undelegated_secondary_exposures:n.undelegated_secondary_exposures,allocated_experiment_name:null!=(t=n.allocated_experiment_name)?t:"",explicit_parameters:null!=(t=n.explicit_parameters)?t:[],group:null!=(t=n.group_name)?t:"",group_name:null!=(t=n.group_name)?t:void 0,is_device_based:!1,is_experiment_active:null==e?void 0:e.isActive,is_user_in_experiment:n.is_experiment_group}}},931:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const c=n(464),i=n(452),d=n(532),h=n(947);function v(t){return(0,i.SHA256)(t).dataView().getBigUint64(0,!1)}function u(t){return null!=t&&"object"==typeof t}e.default=class{constructor(t){this.vt=t}evaluateGate(t,e){var{spec:t,details:n}=this.Ct("gate",t);return t?{evaluation:(0,h.resultToGateEval)(t,this.ft(t,e)),details:n}:{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.Ct("config",t);return t?{evaluation:(0,h.resultToConfigEval)(t,this.ft(t,e)),details:n}:{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.Ct("layer",t);return t?(n=null!=(n=null==(e=this.ft(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.vt.getSpecAndSourceInfo("config",n).spec,{evaluation:(0,h.resultToLayerEval)(t,n,e),details:i}):{evaluation:null,details:i}}Ct(t,e){t=this.vt.getSpecAndSourceInfo(t,e);return{details:this.Gt(t),spec:t.spec}}Gt(t){var{source:t,spec:e,lcut:n,receivedAt:i}=t;return"Uninitialized"===t||"NoValues"===t?{reason:t}:{reason:t+":"+(null==e?"Unrecognized":"Recognized"),lcut:n,receivedAt:i}}ft(t,e){var n=u(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,h.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[];for(const o of t.rules){var r,s=this.gt(o,e);if(s.unsupported)return s;if(i.push(...s.secondary_exposures),s.bool_value)return this.bt(o.configDelegate,e,i)||(r=function(t,e,n){if(100===t.passPercentage)return!0;if(0===t.passPercentage)return!1;e=v(n.salt+"."+(null!=(n=t.salt)?n:t.id)+"."+(null!=(n=(0,c.getUnitIDFromUser)(e,t.idType))?n:""));return Number(e%BigInt(1e4))<100*t.passPercentage}(o,e,t),(0,h.makeEvalResult)({rule_id:s.rule_id,bool_value:r,json_value:r?s.json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,is_experiment_group:s.is_experiment_group,group_name:s.group_name}))}return(0,h.makeEvalResult)({json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,rule_id:"default"})}gt(t,e){var n=[];let i=!0;for(const s of t.conditions){var r=this.yt(s,e);if(r.unsupported)return r;n.push(...r.secondary_exposures),r.bool_value||(i=!1)}return(0,h.makeEvalResult)({rule_id:t.id,bool_value:i,json_value:u(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}yt(t,e){let n=null,i=!1;var r=t.field,s=t.targetValue,o=t.idType,u=t.type;switch(u){case"public":return(0,h.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var a=String(s),a=this.Ot(a,e);return(0,h.makeEvalResult)({bool_value:"fail_gate"===u?!a.bool_value:a.bool_value,secondary_exposures:a.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.jt(s,u,e);case"user_field":case"ip_based":case"ua_based":n=function(t,e){var n;if(null==e||"object"!=typeof t||null==t)return null;var i=t;return null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=i[e])?n:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e.toLowerCase()]}(e,r);break;case"environment_field":n=function(t,e){if(null==e)return null;t=t.statsigEnvironment;if(null!=t){const n=e.toLowerCase(),i=Object.keys(t).find(t=>t.toLowerCase()===n);return void 0!==i?t[i]:void 0}}(e,r);break;case"current_time":n=Date.now();break;case"user_bucket":a=v(null!==(a=String(null!=(a=null==(a=t.additionalValues)?void 0:a.salt)?a:"")+"."+(0,c.getUnitIDFromUser)(e,o))?a:"");n=Number(a%BigInt(1e3));break;case"unit_id":n=(0,c.getUnitIDFromUser)(e,o);break;default:return(0,h.makeEvalResult)({unsupported:!0})}var l=t.operator;switch(l){case"gt":case"gte":case"lt":case"lte":i=d.default.compareNumbers(n,s,l);break;case"version_gt":case"version_gte":case"version_lt":case"version_lte":case"version_eq":case"version_neq":i=d.default.compareVersions(n,s,l);break;case"any":case"none":case"str_starts_with_any":case"str_ends_with_any":case"str_contains_any":case"str_contains_none":case"any_case_sensitive":case"none_case_sensitive":i=d.default.compareStringInArray(n,s,l);break;case"str_matches":i=d.default.compareStringWithRegEx(n,s);break;case"before":case"after":case"on":i=d.default.compareTime(n,s,l);break;case"eq":i=n==s;break;case"neq":i=n!=s;break;case"in_segment_list":case"not_in_segment_list":return(0,h.makeEvalResult)({unsupported:!0})}return(0,h.makeEvalResult)({bool_value:i})}bt(t,e,n){var i;return t&&(i=this.vt.getSpecAndSourceInfo("config",t).spec,i)?(e=this.ft(i,e),(0,h.makeEvalResult)(Object.assign(Object.assign({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:n.concat(e.secondary_exposures),undelegated_secondary_exposures:n}))):null}Ot(t,e){var n=[];let i=!1;var r=this.vt.getSpecAndSourceInfo("gate",t)["spec"];if(r){r=this.ft(r,e);if(r.unsupported)return r;i=r.bool_value,n.push(...r.secondary_exposures),n.push({gate:t,gateValue:String(i),ruleID:r.rule_id})}return(0,h.makeEvalResult)({bool_value:i,secondary_exposures:n})}jt(t,e,n){if(!Array.isArray(t))return(0,h.makeEvalResult)({unsupported:!0});var i="multi_pass_gate"===e,r=[];let s=!1;for(const u of t){if("string"!=typeof u)return(0,h.makeEvalResult)({unsupported:!0});var o=this.Ot(u,n);if(o.unsupported)return o;if(r.push(...o.secondary_exposures),i?!0===o.bool_value:!1===o.bool_value){s=!0;break}}return(0,h.makeEvalResult)({bool_value:s,secondary_exposures:r})}}},160:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const r=n(464);class s extends r.NetworkCore{constructor(t=null){super(t),this.Rt=(0,r.Lt)(null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,"/download_config_specs","https://api.statsigcdn.com/v1")}fetchConfigSpecs(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,url:this.Rt});return null!=(n=null==t?void 0:t.body)?n:null})}}e.default=s},480:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.wt=null,this.xt="Uninitialized",this.Nt=0,this.It=0}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse DownloadConfigSpecsResponse"))?void 0:e.has_updates)&&(this.Nt=e.time,this.It=t.receivedAt,this.xt=t.source,this.wt=e)}reset(){this.wt=null,this.xt="Loading"}finalize(){this.wt||(this.xt="NoValues")}getSpecAndSourceInfo(t,e){var t=this.Mt(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.xt,lcut:this.Nt,receivedAt:this.It}}Mt(t){var e;switch(t){case"gate":return null==(e=this.wt)?void 0:e.feature_gates;case"config":return null==(e=this.wt)?void 0:e.dynamic_configs;case"layer":return null==(e=this.wt)?void 0:e.layer_configs}}}},348:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});n(464).StatsigMetadataProvider.add({sdkType:"js-on-device-eval-client"})},368:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const u=n(464),r=n(931),s=n(160),o=n(480),a=n(4);class l extends u.StatsigClientBase{constructor(t,e=null){var n=new s.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new a.StatsigSpecsDataAdapter,n,e),(0,u.monitorClass)(this.u,this),(0,u.monitorClass)(this.u,n),this.vt=new o.default,this.Tt=new r.default(this.vt)}initializeSync(){this.vt.reset();var t=this.dataAdapter.getDataSync();this.vt.setValuesFromDataAdapter(t),this.vt.finalize(),this.ct("Ready",t),this.Dt(t)}initializeAsync(){return i(this,void 0,void 0,function*(){this.vt.reset(),this.ct("Loading",null);var t=this.dataAdapter.getDataSync();this.vt.setValuesFromDataAdapter(t),t=yield this.dataAdapter.getDataAsync(t),this.vt.setValuesFromDataAdapter(t),this.vt.finalize(),this.ct("Ready",t)})}static instance(t){var e;return __STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},null==t?__STATSIG__.lastInstance:null==(e=__STATSIG__.instances)?void 0:e[t]}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){e=(0,u.normalizeUser)(e,this.P.environment);var{evaluation:i,details:r}=this.Tt.evaluateGate(t,e),r=(0,u.makeFeatureGate)(t,r,i);return this.dt(t,(0,u.createGateExposure)(e,r),n),this.tt({name:"gate_evaluation",gate:r}),r}getDynamicConfig(t,e,n){t=this.kt("dynamic_config",t,e,n);return this.tt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e,n){t=this.kt("experiment",t,e,n);return this.tt({name:"experiment_evaluation",experiment:t}),t}getLayer(n,i,r){i=(0,u.normalizeUser)(i,this.P.environment);const{evaluation:s,details:t}=this.Tt.evaluateLayer(n,i),o=(0,u.makeLayer)(n,t,s,t=>{var e;return s&&t in s.value&&this.dt(n,(0,u.createLayerParameterExposure)(i,o,t),r),null!=(e=null==(e=null===s||void 0===s?void 0:s.value)?void 0:e[t])?e:null});return this.tt({name:"layer_evaluation",layer:o}),o}logEvent(t,e){this.lt.enqueue(Object.assign(Object.assign({},t),{user:e,time:Date.now()}))}Dt(t){this.dataAdapter.getDataAsync(t).catch(t=>{u.Log.error("An error occurred after update.",t)})}kt(t,e,n,i){n=(0,u.normalizeUser)(n,this.P.environment);var{evaluation:r,details:s}=this.Tt.evaluateConfig(e,n),s=(0,u.makeDynamicConfig)(e,s,r),r="experiment"===t?null==(t=null==(r=this.Pt)?void 0:r.getExperimentOverride)?void 0:t.call(r,s,n,i):null==(r=null==(t=this.Pt)?void 0:t.getDynamicConfigOverride)?void 0:r.call(t,s,n,i),t=null!=r?r:s;return this.dt(e,(0,u.createConfigExposure)(n,t),i),t}}e.default=l},4:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,a){return new(u=u||Promise)(function(n,e){function i(t){try{s(a.next(t))}catch(t){e(t)}}function r(t){try{s(a.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((a=a.apply(t,o||[])).next())})},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigSpecsDataAdapter=void 0,n(464));const s=n(160);class o extends r.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.A=null}attach(t,e){super.attach(t,e),this.A=new s.default(null!=e?e:{})}S(t,e){var n;return i(this,void 0,void 0,function*(){return null!=(n=yield null==(n=this.A)?void 0:n.fetchConfigSpecs(this.N()))?n:null})}}e.StatsigSpecsDataAdapter=o},452:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0;const i=n(891);Object.defineProperty(e,"SHA256",{enumerable:!0,get:function(){return i.SHA256}})},891:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0,e.SHA256=function(t){return(new i).update(t)};const n=[-2147483648,8388608,32768,128],o=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];class i{constructor(){this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.lastByteIndex=-1}update(n){if(!this.finalized){if("string"!=typeof n)throw new Error('Must be of type "string"');var i;let t=0,e;for(var r=n.length,s=this.blocks;t<r;){for(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e=this.start;t<r&&e<64;++t)(i=n.charCodeAt(t))<128?s[e>>2]|=i<<o[3&e++]:(i<2048?s[e>>2]|=(192|i>>6)<<o[3&e++]:(i<55296||57344<=i?s[e>>2]|=(224|i>>12)<<o[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),s[e>>2]|=(240|i>>18)<<o[3&e++],s[e>>2]|=(128|i>>12&63)<<o[3&e++]),s[e>>2]|=(128|i>>6&63)<<o[3&e++]),s[e>>2]|=(128|63&i)<<o[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=s[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296)}return this}finalize(){var t,e;this.finalized||(this.finalized=!0,t=this.blocks,e=this.lastByteIndex,t[16]=this.block,t[e>>2]|=n[3&e],this.block=t[16],56<=e&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash())}hash(){var t=this.blocks;let e=this.h0,n=this.h1,i=this.h2,r=this.h3,s=this.h4,o=this.h5,u=this.h6,a=this.h7,l,c,d,h,v,_,f,g,p,y,b;for(l=16;l<64;++l)v=t[l-15],c=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3,v=t[l-2],d=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,t[l]=t[l-16]+c+t[l-7]+d<<0;for(b=n&i,l=0;l<64;l+=4)this.first?(g=704751109,v=t[0]-210244248,a=v-1521486534<<0,r=v+143694565<<0,this.first=!1):(c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),g=e&n,h=g^e&i^b,f=s&o^~s&u,v=a+d+f+m[l]+t[l],_=c+h,a=r+v<<0,r=v+_<<0),c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),p=r&e,h=p^r&n^g,f=a&s^~a&o,v=u+d+f+m[l+1]+t[l+1],_=c+h,u=i+v<<0,i=v+_<<0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),d=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7),y=i&r,h=y^i&e^p,f=u&a^~u&s,v=o+d+f+m[l+2]+t[l+2],_=c+h,o=n+v<<0,n=v+_<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),b=n&i,h=b^n&r^y,f=o&u^~o&a,v=s+d+f+m[l+3]+t[l+3],_=c+h,s=e+v<<0,e=v+_<<0;this.h0=this.h0+e<<0,this.h1=this.h1+n<<0,this.h2=this.h2+i<<0,this.h3=this.h3+r<<0,this.h4=this.h4+s<<0,this.h5=this.h5+o<<0,this.h6=this.h6+u<<0,this.h7=this.h7+a<<0}arrayBuffer(){return this.At().buffer}dataView(){return this.At().dataView}At(){this.finalize();var t=new ArrayBuffer(32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),e.setUint32(28,this.h7),{dataView:e,buffer:t}}}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t,s=(r(348),r(368));s.default;const o=r(4);__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigSpecsDataAdapter:o.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:s.default}),e.default=__STATSIG__}return t.default})());
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var n={496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},r=null!=(r=null!=(r=null!=(r=e.__STATSIG__)?r:n.__STATSIG__)?r:i.__STATSIG__)?r:{};e.__STATSIG__=r,n.__STATSIG__=r,i.__STATSIG__=r},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},320:function(t,e,n){var s=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),r=n(780),o=n(104),u=n(283),l=n(296),a=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,o.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.m(t))?(this.p(t,e),this.h[t]):null)}getDataAsync(n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.S(null!=(r=null==t?void 0:t.data)?r:null,i),e=this._(i);return t&&this.p(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.O(e,t)),t})}prefetchData(n){return s(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.p(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.p(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}S(n,i){return s(this,void 0,void 0,function*(){var t,e=yield this.j(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(r.Log.debug("No response returned for latest value"),null)})}T(){return null!=this.l?this.l:(r.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,l.getUserStorageKey)(this.T(),t);return`${u.DataAdapterCachePrefix}.${this.o}.`+t}p(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}m(t){var e=null==(e=a.Storage.getItemSync)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}O(t,e){return s(this,void 0,void 0,function*(){yield a.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.getObjectFromStorage)(this.v))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield a.Storage.removeItem(e[0])),yield(0,a.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),r="undefined"!=typeof performance&&void 0!==performance.mark;let s=[];e.captureDiagnostics=function(t,e){o.mark(t+":start"),e=e();const n=()=>{o.mark(t+":end"),(t+":end").startsWith("initialize:")&&o.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class o{static mark(t,e){r&&(t=performance.mark(t,{detail:e}),s.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:s,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),s=[]}}e.Diagnostics=o},512:function(t,u,e){var n=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t){this.l=t,this.A=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.D(e,t,n)):i}catch(t){return this.D(e,t,n),null}}logError(t,e){this.D(t,e)}D(r,s,o){try{i.Log.warn("Caught error in "+r,{error:s});n(this,void 0,void 0,function*(){var t,e=null!=s?s:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.A.has(i)||(this.A.add(i),t=l.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:r,exception:i,info:n},t)),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=o&&o({name:"error",error:s}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},728:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const r=n(832),s=n(780),o=n(876),u=n(444),l=n(412),a=n(84),c=n(408),d="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.M=e,this.N=n,this.P=i,this.G=[],this.C={},this.F={},this.R=!1,this.L=Date.now(),this.U=!0===(null==i?void 0:i.disableLogging),this.J=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.K=setInterval(()=>this.V(),n),this.q=(0,a.$)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",d),this.B=(0,a.$)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",d),c.VisibilityChangeObserver.add(this),this.H()}setLoggingDisabled(t){this.U=t}enqueue(t){this.W(t)&&(this.Y(t),this.X(),this.G.length>this.J)&&this.V()}incrementNonExposureCount(t){var e=null!=(e=this.F[t])?e:0;this.F[t]=e+1}reset(){this.C={}}onVisibilityChanged(t){"background"===t&&this.V()}shutdown(){return i(this,void 0,void 0,function*(){this.K&&(clearInterval(this.K),this.K=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.Z(),0!==this.G.length&&(t=this.G,this.G=[],yield this.tt(t))})}X(){this.R||(this.R=!0,200<Date.now()-this.L)||setTimeout(()=>this.V(),200)}W(t){if((0,o.isExposureEvent)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.C[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.C).length&&(this.C={}),this.C[t]=n}return!0}V(){this.flush().catch(()=>{})}tt(t){return i(this,void 0,void 0,function*(){if(this.U)this.et(t);else try{(!c.VisibilityChangeObserver.isCurrentlyVisible()&&this.N.isBeaconSupported()?yield this.nt(t):yield this.it(t)).success?this.M({name:"logs_flushed",events:t}):this.et(t)}catch(t){s.Log.warn("Failed to flush events.")}})}it(e){return i(this,void 0,void 0,function*(){var t=yield this.N.post({sdkKey:this.l,data:{events:e},url:this.q,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,l.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}nt(t){return i(this,void 0,void 0,function*(){return{success:yield this.N.beacon({sdkKey:this.l,data:{events:t},url:this.B})}})}et(t){for(;500<t.length;)t.shift();var e=this.ot();(0,u.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}H(){const e=this.ot();i(this,void 0,void 0,function*(){var t=yield(0,u.getObjectFromStorage)(e);t&&(yield u.Storage.removeItem(e),yield this.tt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}ot(){return"statsig.failed_logs."+(0,r.DJB2)(this.l)}Y(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var e={},n=this.rt();n&&(e.statsigMetadata={currentPage:n}),this.G.push(Object.assign(Object.assign({},t),e))}Z(){0!==Object.keys(this.F).length&&(this.Y({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.F)}}),this.F={})}rt(){var t;if(!1!==(null==(t=this.P)?void 0:t.includeCurrentPageUrlWithEvents)&&"undefined"!=typeof window&&"object"==typeof window.location)try{return window.location.href.split(/[?#]/)[0]}catch(t){}}}},832:(t,e)=>{function n(e){let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const r={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),r[t]=e});return r}(t)))}},664:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const s=n(280),o=n(688);function c(t,e,n,i){var r=i instanceof o.StatsigClientBase?i.ut.bind(i):void 0;return t.capture(e,()=>(0,s.captureDiagnostics)(e,()=>n.apply(i)),r)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var r;const s=i;for(const o of function(t){const e=new Set;let n=d(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(s))if("constructor"!==o){const u=s[o];s[o]=function(...t){return c(n,o,()=>u.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(s)){const a=null==(r=null===s||void 0===s?void 0:s.constructor)?void 0:r[l];(null===s||void 0===s?void 0:s.constructor)[l]=function(...t){return c(n,s.constructor.name+"."+l,()=>a.apply(s.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188:function(t,e,n){var r=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const h=n(280),v=n(780),s=n(612),o=n(604),u=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.M=e,this.lt=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return r(this,void 0,void 0,function*(){var t=yield this.ct(e);return this.dt(Object.assign({method:"POST",body:t},e))})}get(t){return r(this,void 0,void 0,function*(){return this.dt(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return r(this,void 0,void 0,function*(){var t=yield this.ht(n),e=yield this.ct(n);return navigator.sendBeacon(t,e)})}dt(c){var d;return r(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const r=new AbortController;var t,s,o,u=setTimeout(()=>r.abort(`Timeout of ${this.lt}ms expired.`),this.lt),l=yield this.ht(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:Object.assign({},c.headers),signal:r.signal}),clearTimeout(u),a.ok)return o=yield a.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:a.status,contentLength:a.headers.get("content-length")}),{body:o,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(s=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",s}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(r,t);return h.Diagnostics.mark("_sendRequest:error",{error:n,status:null===a||void 0===a?void 0:a.status,contentLength:null===a||void 0===a?void 0:a.headers.get("content-length")}),!i||i<=0?(null!=(d=this.M)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.dt(Object.assign(Object.assign({},c),{retries:i-1}))}})}ht(e){return r(this,void 0,void 0,function*(){var t=u.StatsigMetadataProvider.get(),t=Object.assign({k:e.sdkKey,st:t.sdkType,sv:t.sdkVersion,t:String(Date.now()),sid:yield s.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}ct(i){return r(this,void 0,void 0,function*(){var t=i["data"],e=yield o.StableID.get(i.sdkKey),n=yield s.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},u.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.vt(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.vt(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}vt(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},612:function(t,o,e){var n=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(o,"__esModule",{value:!0}),o.SessionID=void 0;const i=e(832),u=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,i.DJB2)(t)}o.SessionID={get:t=>n(void 0,void 0,void 0,function*(){return null!=h[t]?h[t]:h[t]=o.SessionID.ft(t)}),ft:s=>n(void 0,void 0,void 0,function*(){let e=c[s];var n=Date.now();let i=!1;if(null==e){let t=yield function(t){t=v(t);return(0,l.getObjectFromStorage)(t)}(s);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n},i=!0),e=t,c[s]=e}var t=null!=(t=d[s])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},n=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n,i=!0),e.lastUpdate=n,e),r=s;return r=v(s),(0,l.setObjectInStorage)(r,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=o.SessionID._t(t,t.idleTimeoutID,18e5),i&&(t.ageTimeoutID=o.SessionID._t(t,t.ageTimeoutID,144e5)),c[s]=e,d[s]=t,h[s]=null,e.sessionID}),gt:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},_t:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=void 0;const r=n(832),s=n(780),o=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,r.DJB2)(t)}function c(t,e){e=a(e);(0,o.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,o.getObjectFromStorage)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const s=n(512),o=n(728),u=n(780),l=n(612),a=n(604),c=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.yt={},this.l=t,this.P=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(r=null==i?void 0:i.logLevel)?r:u.LogLevel.Warn,this.bt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.wt=new o.EventLogger(t,this.ut.bind(this),n,i),l.SessionID.gt(()=>{this.ut({name:"session_expired"})},t),this.u=new s.ErrorBoundary(t);var r,n=null!=(r=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?r:{};n[t]=this,__STATSIG__.instances=n,(__STATSIG__.lastInstance=this).dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.P.disableLogging=t.disableLogging,this.wt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.P.disableStorage=t.disableStorage,c.Storage.setDisabled(t.disableStorage))}flush(){return this.wt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.ut({name:"pre_shutdown"}),yield this.wt.shutdown()})}on(t,e){this.yt[t]||(this.yt[t]=[]),this.yt[t].push(e)}off(t,e){this.yt[t]&&-1!==(e=this.yt[t].indexOf(e))&&this.yt[t].splice(e,1)}ut(e){var t;const n=t=>{try{t(e)}catch(t){u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",e)}};this.yt[e.name]&&this.yt[e.name].forEach(t=>n(t)),null!=(t=this.yt["*"])&&t.forEach(n)}St(t,e){this.loadingStatus=t,this.ut({name:"values_updated",status:t,values:e})}Ot(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.wt.incrementNonExposureCount(t):this.wt.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function l(t,e,n,i,r){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:r,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(t,e){return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createConfigExposure=function(t,e){return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.createLayerParameterExposure=function(t,e,n){var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=void 0;let n={sdkVersion:"0.0.1-beta.26",sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},396:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.jt=e.Tt=e.It=e.At=void 0;const r="default";function s(s,o){return(t,e)=>{var n,i,r=null!=(r=null==s?void 0:s[t])?r:null;return null==r||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(r)!==i(n))?null!=e?e:null:(null!=o&&o(t),r)}}e.At=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.It=function(t,e,n){return{name:t,details:e,value:null!=(t=null==n?void 0:n.value)?t:{},ruleID:null!=(e=null==n?void 0:n.rule_id)?e:r,groupName:null,get:s(null==n?void 0:n.value),__evaluation:n}},e.Tt=function(t,e,n,i){return{name:t,details:e,get:s(null==n?void 0:n.value,i),ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,groupName:null!=(e=null==n?void 0:n.group_name)?e:null,__value:null!=(i=null==n?void 0:n.value)?i:{},__evaluation:n}},e.jt=function(t,e,n,i){return Object.assign(Object.assign(Object.assign({},t),e),{get:s(n,i)})}},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const r={},s={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=r[t])?t:null},getItem(t){return Promise.resolve(null!=(t=r[t])?t:null)},setItem(t,e){return r[t]=e,Promise.resolve()},removeItem(t){return delete r[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(r))}};let o=null;try{"undefined"!=typeof window&&"localStorage"in window&&(o={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==o&&void 0!==o?o:s,l=u;e.Storage={getProviderName:()=>l.getProviderName(),getItem:t=>l.getItem(t),setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=l.getItemSync)?void 0:e.call(l,t))?e:null},setProvider:t=>{u=t,l=t},setDisabled:t=>{l=t?s:u}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield l.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield l.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.typedJsonParse=void 0;const r=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return r.Log.error(n),null}},556:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.$=void 0,e.$=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.xt}static add(t){this.yt.push(t)}static remove(t){t=this.yt.indexOf(t);-1!==t&&this.yt.splice(t,1)}static notify(e){e!==this.xt&&(this.xt=e,this.yt.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).yt=[],n.xt="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),o=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780)),u=(Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return o.Log}}),n(444));Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return u.Storage}});var l=n(556);r(n(496),e),r(n(856),e),r(n(320),e),r(n(512),e),r(n(500),e),r(n(788),e),r(n(832),e),r(n(664),e),r(n(780),e),r(n(104),e),r(n(188),e),r(n(264),e),r(n(612),e),r(n(604),e),r(n(688),e),r(n(808),e),r(n(283),e),r(n(876),e),r(n(972),e),r(n(384),e),r(n(396),e),r(n(136),e),r(n(296),e),r(n(444),e),r(n(412),e),r(n(84),e),r(n(539),e),r(n(556),e),r(n(408),e),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:o.Log,getUUID:l.getUUID,Storage:u.Storage})},448:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&("get"in r?e.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(n(376),e),e.default=__STATSIG__},532:(t,e)=>{function u(t){return t.setUTCHours(0,0,0,0),t.getTime()}Object.defineProperty(e,"__esModule",{value:!0}),e.default={compareNumbers(t,e,n){if(null==t||null==e)return!1;var i=Number(t),r=Number(e);if(isNaN(i)||isNaN(r))return!1;switch(n){case"gt":return e<t;case"gte":return e<=t;case"lt":return t<e;case"lte":return t<=e;default:return!1}},compareVersions(t,e,n){if(null==t||null==e)return!1;var t=String(t),e=String(e),i=t=>{var e=t.indexOf("-");return-1!==e?t.substring(0,e):t},r=((t,e)=>{var n=t.split(".").map(t=>parseInt(t)),i=e.split(".").map(t=>parseInt(t));let r=0;for(;r<Math.max(n.length,i.length);){var s=r<n.length?n[r]:0,o=r<i.length?i[r]:0;if(s<o)return-1;if(o<s)return 1;r++}return 0})(i(t),i(e));switch(n){case"version_gt":return 0<r;case"version_gte":return 0<=r;case"version_lt":return r<0;case"version_lte":return r<=0;case"version_eq":return 0===r;case"version_neq":return 0!==r;default:return!1}},compareStringInArray(r,t,s){if(!Array.isArray(t))return!1;const o="any_case_sensitive"!==s&&"none_case_sensitive"!==s;var e=-1!==t.findIndex(t=>{var e=String(r),t=String(t),n=o?e.toLowerCase():e,i=o?t.toLowerCase():t;switch(s){case"any":case"none":case"any_case_sensitive":case"none_case_sensitive":return n===i;case"str_starts_with_any":return n.startsWith(i);case"str_ends_with_any":return n.endsWith(i);case"str_contains_any":case"str_contains_none":return n.includes(i);default:return!1}});switch(s){case"none":case"none_case_sensitive":case"str_contains_none":return!e;default:return e}},compareStringWithRegEx(t,e){try{var n=String(t);if(n.length<1e3)return new RegExp(String(e)).test(n)}catch(t){}return!1},compareTime(n,i,r){if(null==n||null==i)return!1;try{let t=new Date(String(n)),e=(isNaN(t.getTime())&&(t=new Date(Number(n))),new Date(String(i)));isNaN(e.getTime())&&(e=new Date(Number(i)));var s=t.getTime(),o=e.getTime();if(isNaN(s)||isNaN(o))return!1;switch(r){case"before":return s<o;case"after":return o<s;case"on":return u(t)===u(e);default:return!1}}catch(t){return!1}}}},947:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resultToLayerEval=e.resultToConfigEval=e.resultToGateEval=e.makeEvalResult=void 0,e.makeEvalResult=function(t){return Object.assign(Object.assign({},{unsupported:!1,bool_value:!1,rule_id:"",secondary_exposures:[],json_value:{},explicit_parameters:null,allocated_experiment_name:null,is_experiment_group:!1,group_name:null,undelegated_secondary_exposures:void 0}),t)},e.resultToGateEval=function(t,e){return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.bool_value,secondary_exposures:e.secondary_exposures}},e.resultToConfigEval=function(t,e){var n;return{name:t.name,id_type:t.idType,rule_id:e.rule_id,value:e.json_value,secondary_exposures:e.secondary_exposures,group:null!=(n=e.group_name)?n:"",group_name:null!=(n=e.group_name)?n:void 0,is_device_based:!1,is_experiment_active:t.isActive,is_user_in_experiment:e.is_experiment_group}},e.resultToLayerEval=function(t,e,n){return{name:t.name,rule_id:n.rule_id,value:n.json_value,secondary_exposures:n.secondary_exposures,undelegated_secondary_exposures:n.undelegated_secondary_exposures,allocated_experiment_name:null!=(t=n.allocated_experiment_name)?t:"",explicit_parameters:null!=(t=n.explicit_parameters)?t:[],group:null!=(t=n.group_name)?t:"",group_name:null!=(t=n.group_name)?t:void 0,is_device_based:!1,is_experiment_active:null==e?void 0:e.isActive,is_user_in_experiment:n.is_experiment_group}}},931:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const c=n(464),i=n(452),d=n(532),h=n(947);function v(t){return(0,i.SHA256)(t).dataView().getBigUint64(0,!1)}function u(t){return null!=t&&"object"==typeof t}e.default=class{constructor(t){this.Rt=t}evaluateGate(t,e){var{spec:t,details:n}=this.ne("gate",t);return t?{evaluation:(0,h.resultToGateEval)(t,this.ie(t,e)),details:n}:{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.ne("config",t);return t?{evaluation:(0,h.resultToConfigEval)(t,this.ie(t,e)),details:n}:{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.ne("layer",t);return t?(n=null!=(n=null==(e=this.ie(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.Rt.getSpecAndSourceInfo("config",n).spec,{evaluation:(0,h.resultToLayerEval)(t,n,e),details:i}):{evaluation:null,details:i}}ne(t,e){t=this.Rt.getSpecAndSourceInfo(t,e);return{details:this.re(t),spec:t.spec}}re(t){var{source:t,spec:e,lcut:n,receivedAt:i}=t;return"Uninitialized"===t||"NoValues"===t?{reason:t}:{reason:t+":"+(null==e?"Unrecognized":"Recognized"),lcut:n,receivedAt:i}}ie(t,e){var n=u(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,h.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[];for(const o of t.rules){var r,s=this.se(o,e);if(s.unsupported)return s;if(i.push(...s.secondary_exposures),s.bool_value)return this.oe(o.configDelegate,e,i)||(r=function(t,e,n){if(100===t.passPercentage)return!0;if(0===t.passPercentage)return!1;e=v(n.salt+"."+(null!=(n=t.salt)?n:t.id)+"."+(null!=(n=(0,c.getUnitIDFromUser)(e,t.idType))?n:""));return Number(e%BigInt(1e4))<100*t.passPercentage}(o,e,t),(0,h.makeEvalResult)({rule_id:s.rule_id,bool_value:r,json_value:r?s.json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,is_experiment_group:s.is_experiment_group,group_name:s.group_name}))}return(0,h.makeEvalResult)({json_value:n,secondary_exposures:i,undelegated_secondary_exposures:i,rule_id:"default"})}se(t,e){var n=[];let i=!0;for(const s of t.conditions){var r=this.ue(s,e);if(r.unsupported)return r;n.push(...r.secondary_exposures),r.bool_value||(i=!1)}return(0,h.makeEvalResult)({rule_id:t.id,bool_value:i,json_value:u(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}ue(t,e){let n=null,i=!1;var r=t.field,s=t.targetValue,o=t.idType,u=t.type;switch(u){case"public":return(0,h.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var l=String(s),l=this.le(l,e);return(0,h.makeEvalResult)({bool_value:"fail_gate"===u?!l.bool_value:l.bool_value,secondary_exposures:l.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.ae(s,u,e);case"user_field":case"ip_based":case"ua_based":n=function(t,e){var n;if(null==e||"object"!=typeof t||null==t)return null;var i=t;return null!=(n=null!=(n=null!=(n=null!=(n=null!=(n=i[e])?n:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e])?n:null==(i=null==t?void 0:t.custom)?void 0:i[e.toLowerCase()])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e])?n:null==(i=null==t?void 0:t.privateAttributes)?void 0:i[e.toLowerCase()]}(e,r);break;case"environment_field":n=function(t,e){if(null==e)return null;t=t.statsigEnvironment;if(null!=t){const n=e.toLowerCase(),i=Object.keys(t).find(t=>t.toLowerCase()===n);return void 0!==i?t[i]:void 0}}(e,r);break;case"current_time":n=Date.now();break;case"user_bucket":l=v(null!==(l=String(null!=(l=null==(l=t.additionalValues)?void 0:l.salt)?l:"")+"."+(0,c.getUnitIDFromUser)(e,o))?l:"");n=Number(l%BigInt(1e3));break;case"unit_id":n=(0,c.getUnitIDFromUser)(e,o);break;default:return(0,h.makeEvalResult)({unsupported:!0})}var a=t.operator;switch(a){case"gt":case"gte":case"lt":case"lte":i=d.default.compareNumbers(n,s,a);break;case"version_gt":case"version_gte":case"version_lt":case"version_lte":case"version_eq":case"version_neq":i=d.default.compareVersions(n,s,a);break;case"any":case"none":case"str_starts_with_any":case"str_ends_with_any":case"str_contains_any":case"str_contains_none":case"any_case_sensitive":case"none_case_sensitive":i=d.default.compareStringInArray(n,s,a);break;case"str_matches":i=d.default.compareStringWithRegEx(n,s);break;case"before":case"after":case"on":i=d.default.compareTime(n,s,a);break;case"eq":i=n==s;break;case"neq":i=n!=s;break;case"in_segment_list":case"not_in_segment_list":return(0,h.makeEvalResult)({unsupported:!0})}return(0,h.makeEvalResult)({bool_value:i})}oe(t,e,n){var i;return t&&(i=this.Rt.getSpecAndSourceInfo("config",t).spec,i)?(e=this.ie(i,e),(0,h.makeEvalResult)(Object.assign(Object.assign({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:n.concat(e.secondary_exposures),undelegated_secondary_exposures:n}))):null}le(t,e){var n=[];let i=!1;var r=this.Rt.getSpecAndSourceInfo("gate",t)["spec"];if(r){r=this.ie(r,e);if(r.unsupported)return r;i=r.bool_value,n.push(...r.secondary_exposures),n.push({gate:t,gateValue:String(i),ruleID:r.rule_id})}return(0,h.makeEvalResult)({bool_value:i,secondary_exposures:n})}ae(t,e,n){if(!Array.isArray(t))return(0,h.makeEvalResult)({unsupported:!0});var i="multi_pass_gate"===e,r=[];let s=!1;for(const u of t){if("string"!=typeof u)return(0,h.makeEvalResult)({unsupported:!0});var o=this.le(u,n);if(o.unsupported)return o;if(r.push(...o.secondary_exposures),i?!0===o.bool_value:!1===o.bool_value){s=!0;break}}return(0,h.makeEvalResult)({bool_value:s,secondary_exposures:r})}}},160:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const r=n(464);class s extends r.NetworkCore{constructor(t=null){super(t),this.ce=(0,r.$)(null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,"/download_config_specs","https://api.statsigcdn.com/v1")}fetchConfigSpecs(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,url:this.ce});return null!=(n=null==t?void 0:t.body)?n:null})}}e.default=s},480:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.Mt=null,this.Et="Uninitialized",this.Nt=0,this.Pt=0}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse DownloadConfigSpecsResponse"))?void 0:e.has_updates)&&(this.Nt=e.time,this.Pt=t.receivedAt,this.Et=t.source,this.Mt=e)}reset(){this.Mt=null,this.Et="Loading"}finalize(){this.Mt||(this.Et="NoValues")}getSpecAndSourceInfo(t,e){var t=this.de(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.Et,lcut:this.Nt,receivedAt:this.Pt}}de(t){var e;switch(t){case"gate":return null==(e=this.Mt)?void 0:e.feature_gates;case"config":return null==(e=this.Mt)?void 0:e.dynamic_configs;case"layer":return null==(e=this.Mt)?void 0:e.layer_configs}}}},348:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});n(464).StatsigMetadataProvider.add({sdkType:"js-on-device-eval-client"})},368:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const o=n(464),r=n(931),s=n(160),u=n(480),l=n(4);class a extends o.StatsigClientBase{constructor(t,e=null){var n=new s.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new l.StatsigSpecsDataAdapter,n,e),(0,o.monitorClass)(this.u,this),(0,o.monitorClass)(this.u,n),this.Rt=new u.default,this.he=new r.default(this.Rt)}initializeSync(){this.Rt.reset();var t=this.dataAdapter.getDataSync();this.Rt.setValuesFromDataAdapter(t),this.Rt.finalize(),this.St("Ready",t),this.Jt(t)}initializeAsync(){return i(this,void 0,void 0,function*(){this.Rt.reset(),this.St("Loading",null);var t=this.dataAdapter.getDataSync();this.Rt.setValuesFromDataAdapter(t),t=yield this.dataAdapter.getDataAsync(t),this.Rt.setValuesFromDataAdapter(t),this.Rt.finalize(),this.St("Ready",t)})}static instance(t){var e;return __STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},null==t?__STATSIG__.lastInstance:null==(e=__STATSIG__.instances)?void 0:e[t]}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){e=(0,o.normalizeUser)(e,this.P.environment);var{evaluation:i,details:r}=this.he.evaluateGate(t,e),r=(0,o.At)(t,r,i);return this.Ot(t,(0,o.createGateExposure)(e,r),n),this.ut({name:"gate_evaluation",gate:r}),r}getDynamicConfig(t,e,n){t=this.Kt("dynamic_config",t,e,n);return this.ut({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e,n){t=this.Kt("experiment",t,e,n);return this.ut({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n,i){n=(0,o.normalizeUser)(n,this.P.environment);var{evaluation:t,details:r}=this.he.evaluateLayer(e,n);const s=(0,o.Tt)(e,r,t,t=>{this.Ot(e,(0,o.createLayerParameterExposure)(n,s,t),i)});return this.ut({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n,i){this.wt.enqueue(Object.assign(Object.assign({},"string"==typeof t?{eventName:t,value:n,metadata:i}:t),{user:e,time:Date.now()}))}Jt(t){this.dataAdapter.getDataAsync(t).catch(t=>{o.Log.error("An error occurred after update.",t)})}Kt(t,e,n,i){n=(0,o.normalizeUser)(n,this.P.environment);var{evaluation:r,details:s}=this.he.evaluateConfig(e,n),s=(0,o.It)(e,s,r),r="experiment"===t?null==(t=null==(r=this.bt)?void 0:r.getExperimentOverride)?void 0:t.call(r,s,n,i):null==(r=null==(t=this.bt)?void 0:t.getDynamicConfigOverride)?void 0:r.call(t,s,n,i),t=null!=r?r:s;return this.Ot(e,(0,o.createConfigExposure)(n,t),i),t}}e.default=a},4:function(t,e,n){var i=this&&this.__awaiter||function(t,o,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function r(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,r)}s((l=l.apply(t,o||[])).next())})},r=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigSpecsDataAdapter=void 0,n(464));const s=n(160);class o extends r.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.N=null}attach(t,e){super.attach(t,e),this.N=new s.default(null!=e?e:{})}j(t,e){var n;return i(this,void 0,void 0,function*(){return null!=(n=yield null==(n=this.N)?void 0:n.fetchConfigSpecs(this.T()))?n:null})}}e.StatsigSpecsDataAdapter=o},376:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigSpecsDataAdapter=e.StatsigOnDeviceEvalClient=void 0,n(348);var i=n(368);e.StatsigOnDeviceEvalClient=i.default;const r=n(4);Object.defineProperty(e,"StatsigSpecsDataAdapter",{enumerable:!0,get:function(){return r.StatsigSpecsDataAdapter}}),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigSpecsDataAdapter:r.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:i.default}),e.default=__STATSIG__},452:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0;const i=n(891);Object.defineProperty(e,"SHA256",{enumerable:!0,get:function(){return i.SHA256}})},891:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0,e.SHA256=function(t){return(new i).update(t)};const n=[-2147483648,8388608,32768,128],o=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];class i{constructor(){this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.lastByteIndex=-1}update(n){if(!this.finalized){if("string"!=typeof n)throw new Error('Must be of type "string"');var i;let t=0,e;for(var r=n.length,s=this.blocks;t<r;){for(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e=this.start;t<r&&e<64;++t)(i=n.charCodeAt(t))<128?s[e>>2]|=i<<o[3&e++]:(i<2048?s[e>>2]|=(192|i>>6)<<o[3&e++]:(i<55296||57344<=i?s[e>>2]|=(224|i>>12)<<o[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),s[e>>2]|=(240|i>>18)<<o[3&e++],s[e>>2]|=(128|i>>12&63)<<o[3&e++]),s[e>>2]|=(128|i>>6&63)<<o[3&e++]),s[e>>2]|=(128|63&i)<<o[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=s[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296)}return this}finalize(){var t,e;this.finalized||(this.finalized=!0,t=this.blocks,e=this.lastByteIndex,t[16]=this.block,t[e>>2]|=n[3&e],this.block=t[16],56<=e&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash())}hash(){var t=this.blocks;let e=this.h0,n=this.h1,i=this.h2,r=this.h3,s=this.h4,o=this.h5,u=this.h6,l=this.h7,a,c,d,h,v,_,f,g,p,b,y;for(a=16;a<64;++a)v=t[a-15],c=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3,v=t[a-2],d=(v>>>17|v<<15)^(v>>>19|v<<13)^v>>>10,t[a]=t[a-16]+c+t[a-7]+d<<0;for(y=n&i,a=0;a<64;a+=4)this.first?(g=704751109,v=t[0]-210244248,l=v-1521486534<<0,r=v+143694565<<0,this.first=!1):(c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),g=e&n,h=g^e&i^y,f=s&o^~s&u,v=l+d+f+m[a]+t[a],_=c+h,l=r+v<<0,r=v+_<<0),c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7),p=r&e,h=p^r&n^g,f=l&s^~l&o,v=u+d+f+m[a+1]+t[a+1],_=c+h,u=i+v<<0,i=v+_<<0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),d=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7),b=i&r,h=b^i&e^p,f=u&l^~u&s,v=o+d+f+m[a+2]+t[a+2],_=c+h,o=n+v<<0,n=v+_<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),y=n&i,h=y^n&r^b,f=o&u^~o&l,v=s+d+f+m[a+3]+t[a+3],_=c+h,s=e+v<<0,e=v+_<<0;this.h0=this.h0+e<<0,this.h1=this.h1+n<<0,this.h2=this.h2+i<<0,this.h3=this.h3+r<<0,this.h4=this.h4+s<<0,this.h5=this.h5+o<<0,this.h6=this.h6+u<<0,this.h7=this.h7+l<<0}arrayBuffer(){return this.ve().buffer}dataView(){return this.ve().dataView}ve(){this.finalize();var t=new ArrayBuffer(32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),e.setUint32(28,this.h7),{dataView:e,buffer:t}}}}},i={};function r(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,r)),e.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r(448).default})());
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@statsig/js-on-device-eval-client",
3
- "version": "0.0.1-beta.24",
3
+ "version": "0.0.1-beta.26",
4
4
  "dependencies": {
5
- "@statsig/client-core": "0.0.1-beta.24",
6
- "@statsig/sha256": "0.0.1-beta.24"
5
+ "@statsig/client-core": "0.0.1-beta.26",
6
+ "@statsig/sha256": "0.0.1-beta.26"
7
7
  },
8
8
  "jsdelivr": "./build/statsig-js-on-device-eval-client.min.js",
9
9
  "type": "commonjs",
@@ -18,7 +18,7 @@ export default class StatsigOnDeviceEvalClient extends StatsigClientBase<SpecsDa
18
18
  getDynamicConfig(name: string, user: StatsigUser, options?: DynamicConfigEvaluationOptions): DynamicConfig;
19
19
  getExperiment(name: string, user: StatsigUser, options?: ExperimentEvaluationOptions): Experiment;
20
20
  getLayer(name: string, user: StatsigUser, options?: LayerEvaluationOptions): Layer;
21
- logEvent(event: StatsigEvent, user: StatsigUser): void;
21
+ logEvent(eventOrName: StatsigEvent | string, user: StatsigUser, value?: string | number, metadata?: Record<string, string>): void;
22
22
  private _runPostUpdate;
23
23
  private _getConfigImpl;
24
24
  }
@@ -58,7 +58,7 @@ class StatsigOnDeviceEvalClient extends client_core_1.StatsigClientBase {
58
58
  getFeatureGate(name, user, options) {
59
59
  user = (0, client_core_1.normalizeUser)(user, this._options.environment);
60
60
  const { evaluation, details } = this._evaluator.evaluateGate(name, user);
61
- const gate = (0, client_core_1.makeFeatureGate)(name, details, evaluation);
61
+ const gate = (0, client_core_1._makeFeatureGate)(name, details, evaluation);
62
62
  this._enqueueExposure(name, (0, client_core_1.createGateExposure)(user, gate), options);
63
63
  this._emit({ name: 'gate_evaluation', gate });
64
64
  return gate;
@@ -76,17 +76,20 @@ class StatsigOnDeviceEvalClient extends client_core_1.StatsigClientBase {
76
76
  getLayer(name, user, options) {
77
77
  user = (0, client_core_1.normalizeUser)(user, this._options.environment);
78
78
  const { evaluation, details } = this._evaluator.evaluateLayer(name, user);
79
- const layer = (0, client_core_1.makeLayer)(name, details, evaluation, (param) => {
80
- var _a, _b;
81
- if (evaluation && param in evaluation.value) {
82
- this._enqueueExposure(name, (0, client_core_1.createLayerParameterExposure)(user, layer, param), options);
83
- }
84
- return (_b = (_a = evaluation === null || evaluation === void 0 ? void 0 : evaluation.value) === null || _a === void 0 ? void 0 : _a[param]) !== null && _b !== void 0 ? _b : null;
79
+ const layer = (0, client_core_1._makeLayer)(name, details, evaluation, (param) => {
80
+ this._enqueueExposure(name, (0, client_core_1.createLayerParameterExposure)(user, layer, param), options);
85
81
  });
86
82
  this._emit({ name: 'layer_evaluation', layer });
87
83
  return layer;
88
84
  }
89
- logEvent(event, user) {
85
+ logEvent(eventOrName, user, value, metadata) {
86
+ const event = typeof eventOrName === 'string'
87
+ ? {
88
+ eventName: eventOrName,
89
+ value,
90
+ metadata,
91
+ }
92
+ : eventOrName;
90
93
  this._logger.enqueue(Object.assign(Object.assign({}, event), { user, time: Date.now() }));
91
94
  }
92
95
  _runPostUpdate(current) {
@@ -94,16 +97,16 @@ class StatsigOnDeviceEvalClient extends client_core_1.StatsigClientBase {
94
97
  client_core_1.Log.error('An error occurred after update.', err);
95
98
  });
96
99
  }
97
- _getConfigImpl(kind, name, user, options) {
100
+ _getConfigImpl(kind, name, user, opts) {
98
101
  var _a, _b, _c, _d;
99
102
  user = (0, client_core_1.normalizeUser)(user, this._options.environment);
100
103
  const { evaluation, details } = this._evaluator.evaluateConfig(name, user);
101
- const config = (0, client_core_1.makeDynamicConfig)(name, details, evaluation);
104
+ const config = (0, client_core_1._makeDynamicConfig)(name, details, evaluation);
102
105
  const overridden = kind === 'experiment'
103
- ? (_b = (_a = this._overrideAdapter) === null || _a === void 0 ? void 0 : _a.getExperimentOverride) === null || _b === void 0 ? void 0 : _b.call(_a, config, user, options)
104
- : (_d = (_c = this._overrideAdapter) === null || _c === void 0 ? void 0 : _c.getDynamicConfigOverride) === null || _d === void 0 ? void 0 : _d.call(_c, config, user, options);
106
+ ? (_b = (_a = this._overrideAdapter) === null || _a === void 0 ? void 0 : _a.getExperimentOverride) === null || _b === void 0 ? void 0 : _b.call(_a, config, user, opts)
107
+ : (_d = (_c = this._overrideAdapter) === null || _c === void 0 ? void 0 : _c.getDynamicConfigOverride) === null || _d === void 0 ? void 0 : _d.call(_c, config, user, opts);
105
108
  const result = overridden !== null && overridden !== void 0 ? overridden : config;
106
- this._enqueueExposure(name, (0, client_core_1.createConfigExposure)(user, result), options);
109
+ this._enqueueExposure(name, (0, client_core_1.createConfigExposure)(user, result), opts);
107
110
  return result;
108
111
  }
109
112
  }
@@ -1,9 +0,0 @@
1
- export declare class MockLocalStorage {
2
- data: Record<string, string>;
3
- static enabledMockStorage(): MockLocalStorage;
4
- static disableMockStorage(): void;
5
- clear(): void;
6
- getItem(key: string): string | null;
7
- setItem(key: string, value: string): void;
8
- removeItem(key: string): void;
9
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MockLocalStorage = void 0;
4
- const actualLocalStorage = window.localStorage;
5
- // todo: move to test-helpers (break circular dep)
6
- class MockLocalStorage {
7
- constructor() {
8
- this.data = {};
9
- }
10
- static enabledMockStorage() {
11
- const value = new MockLocalStorage();
12
- Object.defineProperty(window, 'localStorage', {
13
- value,
14
- });
15
- return value;
16
- }
17
- static disableMockStorage() {
18
- Object.defineProperty(window, 'localStorage', {
19
- value: actualLocalStorage,
20
- });
21
- }
22
- // LocalStorage Functions
23
- clear() {
24
- this.data = {};
25
- }
26
- getItem(key) {
27
- return this.data[key] ? this.data[key] : null;
28
- }
29
- setItem(key, value) {
30
- this.data[key] = String(value);
31
- }
32
- removeItem(key) {
33
- delete this.data[key];
34
- }
35
- }
36
- exports.MockLocalStorage = MockLocalStorage;