@statsig/js-on-device-eval-client 0.0.1-beta.32 → 0.0.1-beta.34
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.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},o="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=s[r])?i:n[r])?i:o[r])?i:{instance:e.t};s[r]=u,n[r]=u,o[r]=u},856:(t,e)=>{$Q(e)},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())})};$Q(e),e.DataAdapterCore=void 0;const i=n(512),o=n(780),r=n(104),u=n(283),l=n(296),a=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.l=e,this.u=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.u=new i.ErrorBoundary(t),(0,r.monitorClass)(this.u,this)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.j(null!=(r=null==t?void 0:t.data)?r:null,n)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(o.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(i,r){return s(this,void 0,void 0,function*(){var t=yield this.I(i,r);if(!t)return o.Log.debug("No response returned for latest value"),null;var e=(0,c.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(r),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(o.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,l.getUserStorageKey)(this.M(),t);return`${u.DataAdapterCachePrefix}.${this.l}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=a.Storage.D)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return s(this,void 0,void 0,function*(){yield a.Storage.k(t,JSON.stringify(e)),yield this.N(t)})}N(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.P)(this._))?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.C(e[0])),yield(0,a.G)(this._,t)})}}},280:(t,e,n)=>{$Q(e),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),r=n(256),s="undefined"!=typeof performance&&void 0!==performance.mark;let o=[];e.captureDiagnostics=function(t,e){u.mark(t+":start"),e=e();const n=()=>{u.mark(t+":end"),(t+":end").startsWith("initialize:")&&u.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class u{static mark(t,e){s&&(t=performance.mark(t,{detail:e}),o.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith(r.NetworkDefault.initializeApi)||t.name.startsWith(r.NetworkDefault.specsApi)||t.name.startsWith(r.NetworkDefault.eventsApi)),t={markers:o,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),o=[]}}e.Diagnostics=u},184:(t,e)=>{$Q(e)},512:function(t,l,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(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const i=e(780),a=e(360),c=e(972);l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";l.ErrorBoundary=class{constructor(t){this.h=t,this.R=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.F(e,t,n)):i}catch(t){return this.F(e,t,n),null}}logError(t,e){this.F(t,e)}F(s,o,u){try{i.Log.warn("Caught error in "+s,{error:o});n(this,void 0,void 0,function*(){var t,e,n=null!=o?o:Error("[Statsig] Error was empty"),i=n instanceof Error,r=i?n.name:"No Name";this.R.has(r)||(this.R.add(r),t=a.SDKType.L(this.h),e=c.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield fetch(l.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=u&&u({name:"error",error:o}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},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())})};$Q(e),e.EventLogger=void 0;const r=n(832),s=n(780),o=n(256),u=n(452),l=n(48),a=n(876),c=n(444),d=n(412),h=n(84),v=n(100);e.EventLogger=class{constructor(t,e,n,i){this.h=t,this.U=e,this.K=n,this.J=i,this.q=[],this.V={},this.B={},this.$=!1,this.H=Date.now(),this.W=!0===(null==i?void 0:i.disableLogging),this.Y=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4,this.X=setInterval(()=>this.Z(),n),t=null==i?void 0:i.networkConfig;this.tt=(0,h.et)(null==t?void 0:t.logEventUrl,null==t?void 0:t.api,"/rgstr",o.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==t?void 0:t.logEventBeaconUrl,null==t?void 0:t.api,"/log_event_beacon",o.NetworkDefault.eventsApi),(0,v.it)(this.st.bind(this)),this.ot()}setLoggingDisabled(t){this.W=t}enqueue(t){this.rt(t)&&(this.lt(t),this.ut(),this.q.length>this.Y)&&this.Z()}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.V={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.q.length&&(t=this.q,this.q=[],yield this.dt(t))})}st(t){"background"===t&&this.Z()}ut(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>this.Z(),200)}rt(t){if((0,a.ht)(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.V[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.V).length&&(this.V={}),this.V[t]=n}return!0}Z(){this.flush().catch(()=>{})}dt(t){return i(this,void 0,void 0,function*(){if(this.W)this.vt(t);else try{(!(0,v._t)()&&this.K.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.U({name:"logs_flushed",events:t}):this.vt(t)}catch(t){s.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.K.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.K.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}ot(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,c.P)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,r.DJB2)(this.h)}lt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.q.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.lt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.ln)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=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)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(r(t)));const r=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=r(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},104:(t,e,n)=>{$Q(e),e.monitorClass=void 0;const s=n(280),o=n(688);function c(t,e,n,i){var r=i instanceof o.StatsigClientBase?i.St.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 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())})};$Q(e),e.NetworkCore=void 0,n(496);const h=n(280),v=n(780),r=n(452),s=n(360),o=n(612),u=n(604),l=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.U=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!_(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(c){var d;return i(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:n,retries:i}=c;const r=new AbortController;var t,s,o,u=setTimeout(()=>r.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),l=yield this.It(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:$P({},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.U)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[r.NetworkParam.SdkKey]:e.sdkKey,[r.NetworkParam.SdkType]:s.SDKType.L(e.sdkKey),[r.NetworkParam.SdkVersion]:l.SDK_VERSION,[r.NetworkParam.Time]:String(Date.now()),[r.NetworkParam.SessionID]:yield o.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(r){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield u.StableID.get(e),i=yield o.SessionID.get(e),e=s.SDKType.L(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(n=t.params)?n:{}),{[r.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={L:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ln=i.xt=i.Dt=i.an=i.Et=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Et=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.an=()=>null!=(0,i.Et)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.Et)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.ln=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},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=>null!=h[t]?h[t]:h[t]=o.SessionID.Nt(t),Nt:s=>n(void 0,void 0,void 0,function*(){let e=c[s];var n=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.P)(t)}(s);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),e=t,c[s]=e}var t=null!=(t=d[s])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},i=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n),e.lastUpdate=n,e),r=s;return r=v(s),(0,l.G)(r,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=o.SessionID.Pt(t,t.idleTimeoutID,18e5),t.ageTimeoutID=o.SessionID.Pt(t,t.ageTimeoutID,144e5-(n-e.startTime)),c[s]=e,d[s]=t,h[s]=null,e.sessionID}),Ct:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},Pt:(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())})};$Q(e),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.G)(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.P)(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())})};$Q(e),e.StatsigClientBase=void 0,n(496);const s=n(496),o=n(512),u=n(728),l=n(780),a=n(48),c=n(612),d=n(604),h=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={},this.h=t,this.J=null!=i?i:{},null!=i&&i.disableStorage&&h.Storage.Rt(!0),null!=i&&i.overrideStableID&&d.StableID.setOverride(i.overrideStableID,t),l.Log.level=null!=(r=null==i?void 0:i.logLevel)?r:l.LogLevel.Warn,this.Ft=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Lt=new u.EventLogger(t,this.St.bind(this),n,i),c.SessionID.Ct(()=>{this.St({name:"session_expired"})},t),this.u=new o.ErrorBoundary(t);var r=(0,s.i)(),n=null!=(n=r.instances)?n:{};null!=n[t]&&(0,a.an)()&&l.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys.");n[t]=this,r.lastInstance=this,r.instances=n,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,h.Storage.Rt(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.St({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}St(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.u.logError("_emit:"+n.name,t):l.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.St({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Jt=e.qt=e.Vt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Vt=(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.qt=(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.Jt=(t,e,n)=>{var i,r=e.__evaluation,s=!0===(null==(s=null==r?void 0:r.explicit_parameters)?void 0:s.includes(n));let o="",u=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(o=null!=(i=r.allocated_experiment_name)?i:"",u=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:o,isExplicitParameter:String(s)},u)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.32";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.zt=e.Bt=e.$t=e.Ht=void 0;const r="default";function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function o(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.Ht=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.$t=function(t,e,n){return $P($P({},s(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:o(null==n?void 0:n.value)})},e.Bt=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:o(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.zt=function(t,e,n,i){return $P($P($P({},t),e),{get:o(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),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=($Q(e),e.G=e.P=e.Storage=void 0,n(780));const r={},s={Wt:()=>"InMemory",D(t){return null!=(t=r[t])?t:null},Yt(t){return Promise.resolve(null!=(t=r[t])?t:null)},k(t,e){return r[t]=e,Promise.resolve()},C(t){return delete r[t],Promise.resolve()},Qt(){return Promise.resolve(Object.keys(r))}};let o=null;try{"undefined"!=typeof window&&"localStorage"in window&&(o={Wt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Yt(t){return Promise.resolve(localStorage.getItem(t))},k(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Qt(){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={Wt:()=>l.Wt(),Yt:t=>l.Yt(t),k:(t,e)=>l.k(t,e),C:t=>l.C(t),Qt:()=>l.Qt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},Xt:t=>{u=t,l=t},Rt:t=>{l=t?s:u}},e.P=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Yt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield l.k(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),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)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Zt=e.it=e._t=void 0;n=n(48);const i="foreground",r="background",s=[];let o=i;e._t=()=>o===i,e.it=t=>{s.unshift(t)};e.Zt=e=>{e!==o&&(o=e,s.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.Zt)(i)),(0,n.Dt)("blur",()=>(0,e.Zt)(r)),(0,n.Dt)("beforeunload",()=>(0,e.Zt)(r)),(0,n.xt)("visibilitychange",()=>{(0,e.Zt)("visible"===document.visibilityState?i:r)})},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)};$Q(e),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));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return o.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);r(n(496),e),r(n(856),e),r(n(320),e),r(n(184),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(452),e),r(n(188),e),r(n(256),e),r(n(264),e),r(n(48),e),r(n(360),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(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:o.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},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)};$Q(e),r(n(376),e),e.default=__STATSIG__},532:(t,e)=>{function u(t){return t.setUTCHours(0,0,0,0),t.getTime()}$Q(e),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)=>{$Q(e),e.resultToLayerEval=e.resultToConfigEval=e.resultToGateEval=e.makeEvalResult=void 0,e.makeEvalResult=function(t){return $P($P({},{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)=>{$Q(e);const c=n(464),i=n(72),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.ae=t}evaluateGate(t,e){var{spec:t,details:n}=this.We("gate",t);return t?{evaluation:(0,h.resultToGateEval)(t,this.Ye(t,e)),details:n}:{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.We("config",t);return t?{evaluation:(0,h.resultToConfigEval)(t,this.Ye(t,e)),details:n}:{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.We("layer",t);return t?(n=null!=(n=null==(e=this.Ye(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.ae.getSpecAndSourceInfo("config",n).spec,{evaluation:(0,h.resultToLayerEval)(t,n,e),details:i}):{evaluation:null,details:i}}We(t,e){t=this.ae.getSpecAndSourceInfo(t,e);return{details:this.He(t),spec:t.spec}}He(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}}Ye(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.Qe(o,e);if(s.unsupported)return s;if(i.push(...s.secondary_exposures),s.bool_value)return this.Xe(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"})}Qe(t,e){var n=[];let i=!0;for(const s of t.conditions){var r=this.Ze(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})}Ze(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.tn(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.en(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})}Xe(t,e,n){var i;return t&&(i=this.ae.getSpecAndSourceInfo("config",t).spec,i)?(e=this.Ye(i,e),(0,h.makeEvalResult)($P($P({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:n.concat(e.secondary_exposures),undelegated_secondary_exposures:n}))):null}tn(t,e){var n=[];let i=!1;var r=this.ae.getSpecAndSourceInfo("gate",t)["spec"];if(r){r=this.Ye(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})}en(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.tn(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())})};$Q(e);const r=n(464);class s extends r.NetworkCore{constructor(t=null){super(t);t=null==t?void 0:t.networkConfig;this.nn=(0,r.et)(null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,"/download_config_specs",r.NetworkDefault.specsApi)}fetchConfigSpecs(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,url:this.nn});return null!=(n=null==t?void 0:t.body)?n:null})}}e.default=s},480:(t,e,n)=>{$Q(e);const i=n(464);function r(t){return(0,i.typedJsonParse)(t,"has_updates","Failed to parse DownloadConfigSpecsResponse")}e.default=class{constructor(){this.te=null,this.ee=null,this.ne="Uninitialized",this.ie=0,this.se=0}getValues(){return this.te?r(this.te):null}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=r(t.data))?void 0:e.has_updates)&&(this.ie=e.time,this.se=t.receivedAt,this.ne=t.source,this.ee=e,this.te=t.data)}reset(){this.ee=null,this.te=null,this.ne="Loading"}finalize(){this.ee||(this.ne="NoValues")}getSpecAndSourceInfo(t,e){var t=this.rn(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.ne,lcut:this.ie,receivedAt:this.se}}rn(t){var e;switch(t){case"gate":return null==(e=this.ee)?void 0:e.feature_gates;case"config":return null==(e=this.ee)?void 0:e.dynamic_configs;case"layer":return null==(e=this.ee)?void 0:e.layer_configs}}}},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())})};$Q(e);const o=n(464),r=n(931),s=n(160),u=n(480),l=n(4);class a extends o.StatsigClientBase{static instance(t){var e=(0,o.i)().instance(t);return e instanceof a?e:(o.Log.warn("Unable to find StatsigOnDeviceEvalClient instance"),new a(null!=t?t:""))}constructor(t,e=null){o.SDKType.At(t,"js-on-device-eval-client");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.ae=new u.default,this.sn=new r.default(this.ae)}initializeSync(){this.updateSync()}initializeAsync(t){return i(this,void 0,void 0,function*(){return this.updateAsync(t)})}updateSync(){this.ae.reset();var t=this.dataAdapter.getDataSync();this.ae.setValuesFromDataAdapter(t),this.ae.finalize(),this.Ut("Ready",t),this.he(t)}updateAsync(e){return i(this,void 0,void 0,function*(){this.ae.reset(),this.Ut("Loading",null);var t=this.dataAdapter.getDataSync();this.ae.setValuesFromDataAdapter(t),t=yield this.dataAdapter.getDataAsync(t,e),this.ae.setValuesFromDataAdapter(t),this.ae.finalize(),this.Ut("Ready",t)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.ae.getValues()}}getAsyncContext(){return i(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield o.SessionID.get(this.h),stableID:yield o.StableID.get(this.h)})})}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){e=(0,o.normalizeUser)(e,this.J.environment);var{evaluation:i,details:r}=this.sn.evaluateGate(t,e),r=(0,o.Ht)(t,r,i);return this.Kt(t,(0,o.Vt)(e,r),n),this.St({name:"gate_evaluation",gate:r}),r}getDynamicConfig(t,e,n){t=this.ve("dynamic_config",t,e,n);return this.St({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e,n){t=this.ve("experiment",t,e,n);return this.St({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n,i){n=(0,o.normalizeUser)(n,this.J.environment);var{evaluation:t,details:r}=this.sn.evaluateLayer(e,n);const s=(0,o.Bt)(e,r,t,t=>{this.Kt(e,(0,o.Jt)(n,s,t),i)});return this.St({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n,i){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:n,metadata:i}:t),{user:e,time:Date.now()}))}he(t){this.dataAdapter.getDataAsync(t).catch(t=>{o.Log.error("An error occurred after update.",t)})}ve(t,e,n,i){n=(0,o.normalizeUser)(n,this.J.environment);var{evaluation:r,details:s}=this.sn.evaluateConfig(e,n),s=(0,o.$t)(e,s,r),r="experiment"===t?null==(t=null==(r=this.Ft)?void 0:r.getExperimentOverride)?void 0:t.call(r,s,n,i):null==(r=null==(t=this.Ft)?void 0:t.getDynamicConfigOverride)?void 0:r.call(t,s,n,i),t=null!=r?r:s;return this.Kt(e,(0,o.qt)(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=($Q(e),e.StatsigSpecsDataAdapter=void 0,n(464));const s=n(160);class o extends r.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.K=null}attach(t,e){super.attach(t,e),this.K=new s.default(null!=e?e:{})}getDataAsync(t,e){return this.O(t,void 0,e)}prefetchData(t){return this.T(void 0,t)}I(t,e){var n;return i(this,void 0,void 0,function*(){return null!=(n=yield null==(n=this.K)?void 0:n.fetchConfigSpecs(this.M()))?n:null})}}e.StatsigSpecsDataAdapter=o},376:(t,e,n)=>{$Q(e),e.StatsigSpecsDataAdapter=e.StatsigOnDeviceEvalClient=void 0;var i=n(368);e.StatsigOnDeviceEvalClient=i.default;const r=n(4);Object.defineProperty(e,"StatsigSpecsDataAdapter",{enumerable:!0,get:function(){return r.StatsigSpecsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigSpecsDataAdapter:r.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:i.default}),e.default=__STATSIG__},72:(t,e,n)=>{$Q(e),e.SHA256=void 0;const i=n(891);Object.defineProperty(e,"SHA256",{enumerable:!0,get:function(){return i.SHA256}})},891:(t,e)=>{$Q(e),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.un().buffer}dataView(){return this.un().dataView}un(){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})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:o;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,r="__STATSIG__",s="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},u="undefined"!=typeof globalThis?globalThis:{};const o=null!=(i=null!=(i=null!=(i=s[r])?i:n[r])?i:u[r])?i:{instance:e.t};s[r]=o,n[r]=o,u[r]=o},856:(t,e)=>{$Q(e)},320:function(t,e,n){var s=this&&this.__awaiter||function(t,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const i=n(512),u=n(780),r=n(283),o=n(296),l=n(444),a=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.l=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.l=new i.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var r;return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.j(null!=(r=null==t?void 0:t.data)?r:null,n)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(u.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(i,r){return s(this,void 0,void 0,function*(){var t=yield this.I(i,r);if(!t)return u.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(r),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(u.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,o.getUserStorageKey)(this.M(),t);return`${r.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return s(this,void 0,void 0,function*(){yield l.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.N)(this._))?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.C(e[0])),yield(0,l.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,o,e){var n=this&&this.__awaiter||function(t,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};Object.defineProperty(o,"__esModule",{value:!0}),o.ErrorBoundary=o.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";o.ErrorBoundary=class{constructor(t,e){this.h=t,this.F=e,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.U(e,t)):n}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(s,u){try{i.Log.warn("Caught error in "+s,{error:u});n(this,void 0,void 0,function*(){var t,e,n=null!=u?u:Error("[Statsig] Error was empty"),i=n instanceof Error,r=i?n.name:"No Name";this.R.has(r)||(this.R.add(r),t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:s,exception:r,info:i},$P($P({},e),{sdkType:t}))),yield fetch(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(r=this.F)&&r.call(this,{name:"error",error:u}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||function(t,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};$Q(e),e.EventLogger=void 0;const r=n(832),s=n(780),u=n(256),o=n(452),l=n(48),a=n(876),c=n(444),d=n(412),h=n(84),v=n(100),_={},f=t=>{null!=(t=_[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.h=e,this.F=t,this.L=n,this.J=i,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(_[e]=this).Y=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const r=setInterval(()=>{_[e]?f(e):clearInterval(r)},t);this.X=r;n=null==i?void 0:i.networkConfig;this.tt=(0,h.et)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",u.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",u.NetworkDefault.eventsApi),(0,v.it)(t=>{"background"===t&&f(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&f(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>f(this.h),200)}rt(t){if((0,a.ht)(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.q[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=n}return!0}dt(t){return i(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,v._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){s.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[o.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,c.N)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,r.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.St)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=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)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(r(t)));const r=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=r(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,r;$Q(e),e.Log=e.LogLevel=void 0,(r=i||(e.LogLevel=i={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Info=3]="Info",r[r.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},188:function(t,e,n){var i=this&&this.__awaiter||function(t,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};$Q(e),e.NetworkCore=void 0,n(496);const h=n(280),v=n(780),r=n(452),s=n(360),u=n(612),o=n(604),l=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!_(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(c){var d;return i(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:n,retries:i}=c;const r=new AbortController;var t=setTimeout(()=>r.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),s=yield this.It(c),u=null;try{var o,l,a,u=yield fetch(s,{method:e,body:n,headers:$P({},c.headers),signal:r.signal});if(clearTimeout(t),u.ok)return a=yield u.text(),h.Diagnostics.mark(),{body:a,code:u.status};throw o=yield u.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${s} `+o)).name="NetworkError",l}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(),!i||i<=0?(null!=(d=this.F)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${s}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[r.NetworkParam.SdkKey]:e.sdkKey,[r.NetworkParam.SdkType]:s.SDKType.K(e.sdkKey),[r.NetworkParam.SdkVersion]:l.SDK_VERSION,[r.NetworkParam.Time]:String(Date.now()),[r.NetworkParam.SessionID]:yield u.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(r){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=r,n=yield o.StableID.get(e),i=yield u.SessionID.get(e),e=s.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(n=t.params)?n:{}),{[r.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={K:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},xt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.St=i.Mt=i.Dt=i.Et=i.Pt=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Pt=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.Pt)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Mt=(t,e)=>{var n=(0,i.Pt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.St=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,u,e){var n=this&&this.__awaiter||function(t,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.SessionID=void 0;const i=e(832),o=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,i.DJB2)(t)}u.SessionID={get:t=>null!=h[t]?h[t]:h[t]=u.SessionID.Nt(t),Nt:s=>n(void 0,void 0,void 0,function*(){let e=c[s];var n=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.N)(t)}(s);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),e=t,c[s]=e}var t=null!=(t=d[s])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},i=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n),e.lastUpdate=n,e),r=s;return r=v(s),(0,l.G)(r,i).catch(()=>{o.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=u.SessionID.Ct(t,t.idleTimeoutID,18e5),t.ageTimeoutID=u.SessionID.Ct(t,t.ageTimeoutID,144e5-(n-e.startTime)),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},Ct:(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,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};$Q(e),e.StableID=void 0;const r=n(832),s=n(780),u=n(444),o=n(556),l={};function a(t){return"statsig.stable_id."+(0,r.DJB2)(t)}function c(t,e){e=a(e);(0,u.G)(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,u.N)(t)}(e).then(t=>{return null!=t||c(t=(0,o.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,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(612),_=n(604),f=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Ft={};var r,s=this.Rt.bind(this),u=(0,l.i)(),o=null!=(o=u.instances)?o:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&f.Storage.Ut(!0),null!=i&&i.overrideStableID&&_.StableID.setOverride(i.overrideStableID,t),this.l=new a.ErrorBoundary(t,s),this.l.wrap(this),this.l.wrap(n),this.l.wrap(e),this.h=t,this.J=null!=i?i:{},this.Kt=null!=(r=null==i?void 0:i.overrideAdapter)?r:null,this.Lt=new c.EventLogger(t,s,n,i),v.SessionID.Gt(()=>{this.Rt({name:"session_expired"})},t),null!=o[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),o[t]=this,u.lastInstance=this,u.instances=o,__STATSIG__=u,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,f.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.Rt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}Rt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.l.logError("_emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Ft[n.name]&&this.Ft[n.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.Rt({name:"values_updated",status:t,values:e})}Vt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,r)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:r,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Bt=(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.zt=(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.qt=(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 u="",o=null!=(i=null==r?void 0:r.undelegated_secondary_exposures)?i:[];return s&&(u=null!=(i=r.allocated_experiment_name)?i:"",o=r.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:u,isExplicitParameter:String(s)},o)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.34";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const r="default";function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:r,__evaluation:n,value:i}}function u(s,u){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!=u&&u(t),r)}}e.Wt=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.Yt=function(t,e,n){return $P($P({},s(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:u(null==n?void 0:n.value)})},e.Ht=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:u(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.$t=function(t,e,n,i){return $P($P($P({},t),e),{get:u(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),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,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})},n=($Q(e),e.G=e.N=e.Storage=void 0,n(780));const r={},s={Qt:()=>"InMemory",D(t){return null!=(t=r[t])?t:null},Xt(t){return Promise.resolve(null!=(t=r[t])?t:null)},P(t,e){return r[t]=e,Promise.resolve()},C(t){return delete r[t],Promise.resolve()},Zt(){return Promise.resolve(Object.keys(r))}};let u=null;try{"undefined"!=typeof window&&"localStorage"in window&&(u={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return Promise.resolve(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Zt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let o=null!==u&&void 0!==u?u:s,l=o;e.Storage={Qt:()=>l.Qt(),Xt:t=>l.Xt(t),P:(t,e)=>l.P(t,e),C:t=>l.C(t),Zt:()=>l.Zt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},te:t=>{o=t,l=t},Ut:t=>{l=t?s:o}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield l.P(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),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)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.ee=e.it=e._t=void 0;n=n(48);const i="foreground",r="background",s=[];let u=i;e._t=()=>u===i,e.it=t=>{s.unshift(t)};e.ee=e=>{e!==u&&(u=e,s.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.ee)(i)),(0,n.Dt)("blur",()=>(0,e.ee)(r)),(0,n.Dt)("beforeunload",()=>(0,e.ee)(r)),(0,n.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?i:r)})},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)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),u=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return u.Log}});var o=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);r(n(496),e),r(n(856),e),r(n(320),e),r(n(184),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(452),e),r(n(188),e),r(n(256),e),r(n(264),e),r(n(48),e),r(n(360),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(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:u.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:o.SDK_VERSION})},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)};$Q(e),r(n(376),e),e.default=__STATSIG__},532:(t,e)=>{function o(t){return t.setUTCHours(0,0,0,0),t.getTime()}$Q(e),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,u=r<i.length?i[r]:0;if(s<u)return-1;if(u<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 u="any_case_sensitive"!==s&&"none_case_sensitive"!==s;var e=-1!==t.findIndex(t=>{var e=String(r),t=String(t),n=u?e.toLowerCase():e,i=u?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(),u=e.getTime();if(isNaN(s)||isNaN(u))return!1;switch(r){case"before":return s<u;case"after":return u<s;case"on":return o(t)===o(e);default:return!1}}catch(t){return!1}}}},947:(t,e)=>{$Q(e),e.resultToLayerEval=e.resultToConfigEval=e.resultToGateEval=e.makeEvalResult=void 0,e.makeEvalResult=function(t){return $P($P({},{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)=>{$Q(e);const c=n(464),i=n(72),d=n(532),h=n(947);function v(t){return(0,i.SHA256)(t).dataView().getBigUint64(0,!1)}function o(t){return null!=t&&"object"==typeof t}e.default=class{constructor(t){this.de=t}evaluateGate(t,e){var{spec:t,details:n}=this.Ge("gate",t);return t?{evaluation:(0,h.resultToGateEval)(t,this.Ce(t,e)),details:n}:{evaluation:null,details:n}}evaluateConfig(t,e){var{spec:t,details:n}=this.Ge("config",t);return t?{evaluation:(0,h.resultToConfigEval)(t,this.Ce(t,e)),details:n}:{evaluation:null,details:n}}evaluateLayer(t,e){var n,{spec:t,details:i}=this.Ge("layer",t);return t?(n=null!=(n=null==(e=this.Ce(t,e))?void 0:e.allocated_experiment_name)?n:"",n=this.de.getSpecAndSourceInfo("config",n).spec,{evaluation:(0,h.resultToLayerEval)(t,n,e),details:i}):{evaluation:null,details:i}}Ge(t,e){t=this.de.getSpecAndSourceInfo(t,e);return{details:this.Fe(t),spec:t.spec}}Fe(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}}Ce(t,e){var n=o(t.defaultValue)?t.defaultValue:void 0;if(!t.enabled)return(0,h.makeEvalResult)({json_value:n,rule_id:"disabled"});var i=[];for(const u of t.rules){var r,s=this.Ke(u,e);if(s.unsupported)return s;if(i.push(...s.secondary_exposures),s.bool_value)return this.Ve(u.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}(u,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"})}Ke(t,e){var n=[];let i=!0;for(const s of t.conditions){var r=this.Le(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:o(t.returnValue)?t.returnValue:void 0,secondary_exposures:n,is_experiment_group:!0===t.isExperimentGroup,group_name:t.groupName})}Le(t,e){let n=null,i=!1;var r=t.field,s=t.targetValue,u=t.idType,o=t.type;switch(o){case"public":return(0,h.makeEvalResult)({bool_value:!0});case"pass_gate":case"fail_gate":var l=String(s),l=this.Re(l,e);return(0,h.makeEvalResult)({bool_value:"fail_gate"===o?!l.bool_value:l.bool_value,secondary_exposures:l.secondary_exposures});case"multi_pass_gate":case"multi_fail_gate":return this.Ue(s,o,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,u))?l:"");n=Number(l%BigInt(1e3));break;case"unit_id":n=(0,c.getUnitIDFromUser)(e,u);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})}Ve(t,e,n){var i;return t&&(i=this.de.getSpecAndSourceInfo("config",t).spec,i)?(e=this.Ce(i,e),(0,h.makeEvalResult)($P($P({},e),{allocated_experiment_name:t,explicit_parameters:i.explicitParameters,secondary_exposures:n.concat(e.secondary_exposures),undelegated_secondary_exposures:n}))):null}Re(t,e){var n=[];let i=!1;var r=this.de.getSpecAndSourceInfo("gate",t)["spec"];if(r){r=this.Ce(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})}Ue(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 o of t){if("string"!=typeof o)return(0,h.makeEvalResult)({unsupported:!0});var u=this.Re(o,n);if(u.unsupported)return u;if(r.push(...u.secondary_exposures),i?!0===u.bool_value:!1===u.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,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};$Q(e);const r=n(464);class s extends r.NetworkCore{constructor(t=null){super(t);t=null==t?void 0:t.networkConfig;this.qe=(0,r.et)(null==t?void 0:t.downloadConfigSpecsUrl,null==t?void 0:t.api,"/download_config_specs",r.NetworkDefault.specsApi)}fetchConfigSpecs(e){var n;return i(this,void 0,void 0,function*(){var t=yield this.get({sdkKey:e,url:this.qe});return null!=(n=null==t?void 0:t.body)?n:null})}}e.default=s},480:(t,e,n)=>{$Q(e);const i=n(464);function r(t){return(0,i.typedJsonParse)(t,"has_updates","Failed to parse DownloadConfigSpecsResponse")}e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?r(this.ne):null}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=r(t.data))?void 0:e.has_updates)&&(this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e,this.ne=t.data)}reset(){this.ie=null,this.ne=null,this.oe="Loading"}finalize(){this.ie||(this.oe="NoValues")}getSpecAndSourceInfo(t,e){var t=this.ze(t);return{spec:null!=(t=null==t?void 0:t.find(t=>t.name===e))?t:null,source:this.oe,lcut:this.se,receivedAt:this.re}}ze(t){var e;switch(t){case"gate":return null==(e=this.ie)?void 0:e.feature_gates;case"config":return null==(e=this.ie)?void 0:e.dynamic_configs;case"layer":return null==(e=this.ie)?void 0:e.layer_configs}}}},368:function(t,e,n){var i=this&&this.__awaiter||function(t,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})};$Q(e);const u=n(464),r=n(931),s=n(160),o=n(480),l=n(4);class a extends u.StatsigClientBase{static instance(t){var e=(0,u.i)().instance(t);return e instanceof a?e:(u.Log.warn("Unable to find StatsigOnDeviceEvalClient instance"),new a(null!=t?t:""))}constructor(t,e=null){u.SDKType.At(t,"js-on-device-eval-client");var n=new s.default(e);super(t,null!=(t=null==e?void 0:e.dataAdapter)?t:new l.StatsigSpecsDataAdapter,n,e),this.de=new o.default,this.Be=new r.default(this.de)}initializeSync(){this.updateSync()}initializeAsync(t){return i(this,void 0,void 0,function*(){return this.updateAsync(t)})}updateSync(){this.de.reset();var t=this.dataAdapter.getDataSync();this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(t)}updateAsync(e){return i(this,void 0,void 0,function*(){this.de.reset(),this.Jt("Loading",null);var t=this.dataAdapter.getDataSync();this.de.setValuesFromDataAdapter(t),t=yield this.dataAdapter.getDataAsync(t,e),this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),errorBoundary:this.l}}getAsyncContext(){return i(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield u.SessionID.get(this.h),stableID:yield u.StableID.get(this.h)})})}checkGate(t,e,n){return this.getFeatureGate(t,e,n).value}getFeatureGate(t,e,n){e=(0,u.normalizeUser)(e,this.J.environment);var{evaluation:i,details:r}=this.Be.evaluateGate(t,e),r=(0,u.Wt)(t,r,i);return this.Vt(t,(0,u.Bt)(e,r),n),this.Rt({name:"gate_evaluation",gate:r}),r}getDynamicConfig(t,e,n){t=this.fe("dynamic_config",t,e,n);return this.Rt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e,n){t=this.fe("experiment",t,e,n);return this.Rt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n,i){n=(0,u.normalizeUser)(n,this.J.environment);var{evaluation:t,details:r}=this.Be.evaluateLayer(e,n);const s=(0,u.Ht)(e,r,t,t=>{this.Vt(e,(0,u.qt)(n,s,t),i)});return this.Rt({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n,i){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:n,metadata:i}:t),{user:e,time:Date.now()}))}_e(t){this.dataAdapter.getDataAsync(t).catch(t=>{u.Log.error("An error occurred after update.",t)})}fe(t,e,n,i){n=(0,u.normalizeUser)(n,this.J.environment);var{evaluation:r,details:s}=this.Be.evaluateConfig(e,n),s=(0,u.Yt)(e,s,r),r="experiment"===t?null==(t=null==(r=this.Kt)?void 0:r.getExperimentOverride)?void 0:t.call(r,s,n,i):null==(r=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:r.call(t,s,n,i),t=null!=r?r:s;return this.Vt(e,(0,u.zt)(n,t),i),t}}e.default=a},4:function(t,e,n){var i=this&&this.__awaiter||function(t,u,o,l){return new(o=o||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 o?e:new o(function(t){t(e)})).then(i,r)}s((l=l.apply(t,u||[])).next())})},r=($Q(e),e.StatsigSpecsDataAdapter=void 0,n(464));const s=n(160);class u extends r.DataAdapterCore{constructor(){super("SpecsDataAdapter","specs"),this.L=null}attach(t,e){super.attach(t,e),this.L=new s.default(null!=e?e:{})}getDataAsync(t,e){return this.O(t,void 0,e)}prefetchData(t){return this.T(void 0,t)}I(t,e){var n;return i(this,void 0,void 0,function*(){return null!=(n=yield null==(n=this.L)?void 0:n.fetchConfigSpecs(this.M()))?n:null})}}e.StatsigSpecsDataAdapter=u},376:(t,e,n)=>{$Q(e),e.StatsigSpecsDataAdapter=e.StatsigOnDeviceEvalClient=void 0;var i=n(368);e.StatsigOnDeviceEvalClient=i.default;const r=n(4);Object.defineProperty(e,"StatsigSpecsDataAdapter",{enumerable:!0,get:function(){return r.StatsigSpecsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigSpecsDataAdapter:r.StatsigSpecsDataAdapter,StatsigOnDeviceEvalClient:i.default}),e.default=__STATSIG__},72:(t,e,n)=>{$Q(e),e.SHA256=void 0;const i=n(891);Object.defineProperty(e,"SHA256",{enumerable:!0,get:function(){return i.SHA256}})},891:(t,e)=>{$Q(e),e.SHA256=void 0,e.SHA256=function(t){return(new i).update(t)};const n=[-2147483648,8388608,32768,128],u=[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<<u[3&e++]:(i<2048?s[e>>2]|=(192|i>>6)<<u[3&e++]:(i<55296||57344<=i?s[e>>2]|=(224|i>>12)<<u[3&e++]:(i=65536+((1023&i)<<10|1023&n.charCodeAt(++t)),s[e>>2]|=(240|i>>18)<<u[3&e++],s[e>>2]|=(128|i>>12&63)<<u[3&e++]),s[e>>2]|=(128|i>>6&63)<<u[3&e++]),s[e>>2]|=(128|63&i)<<u[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,u=this.h5,o=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&u^~s&o,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&u,v=o+d+f+m[a+1]+t[a+1],_=c+h,o=i+v<<0,i=v+_<<0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),b=i&r,h=b^i&e^p,f=o&l^~o&s,v=u+d+f+m[a+2]+t[a+2],_=c+h,u=n+v<<0,n=v+_<<0,c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7),y=n&i,h=y^n&r^b,f=u&o^~u&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+u<<0,this.h6=this.h6+o<<0,this.h7=this.h7+l<<0}arrayBuffer(){return this.Je().buffer}dataView(){return this.Je().dataView}Je(){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.
|
|
3
|
+
"version": "0.0.1-beta.34",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@statsig/client-core": "0.0.1-beta.
|
|
6
|
-
"@statsig/sha256": "0.0.1-beta.
|
|
5
|
+
"@statsig/client-core": "0.0.1-beta.34",
|
|
6
|
+
"@statsig/sha256": "0.0.1-beta.34"
|
|
7
7
|
},
|
|
8
8
|
"jsdelivr": "./build/statsig-js-on-device-eval-client.min.js",
|
|
9
9
|
"type": "commonjs",
|
|
@@ -28,8 +28,6 @@ class StatsigOnDeviceEvalClient extends client_core_1.StatsigClientBase {
|
|
|
28
28
|
client_core_1.SDKType._setClientType(sdkKey, 'js-on-device-eval-client');
|
|
29
29
|
const network = new Network_1.default(options);
|
|
30
30
|
super(sdkKey, (_a = options === null || options === void 0 ? void 0 : options.dataAdapter) !== null && _a !== void 0 ? _a : new StatsigSpecsDataAdapter_1.StatsigSpecsDataAdapter(), network, options);
|
|
31
|
-
(0, client_core_1.monitorClass)(this._errorBoundary, this);
|
|
32
|
-
(0, client_core_1.monitorClass)(this._errorBoundary, network);
|
|
33
31
|
this._store = new SpecStore_1.default();
|
|
34
32
|
this._evaluator = new Evaluator_1.default(this._store);
|
|
35
33
|
}
|
|
@@ -66,6 +64,7 @@ class StatsigOnDeviceEvalClient extends client_core_1.StatsigClientBase {
|
|
|
66
64
|
sdkKey: this._sdkKey,
|
|
67
65
|
options: this._options,
|
|
68
66
|
values: this._store.getValues(),
|
|
67
|
+
errorBoundary: this._errorBoundary,
|
|
69
68
|
};
|
|
70
69
|
}
|
|
71
70
|
getAsyncContext() {
|