Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sigstat/on-device-evaluations

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sigstat/on-device-evaluations - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

src/StatsigMetadataAdditions.d.ts

2

build/on-device-evaluations.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("@react-native-async-storage/async-storage")}catch(t){}}()):"function"==typeof define&&define.amd?define(["@react-native-async-storage/async-storage"],e):"object"==typeof exports?exports.statsig=e(function(){try{return require("@react-native-async-storage/async-storage")}catch(t){}}()):t.statsig=e(t["@react-native-async-storage/async-storage"])}(this,(t=>(()=>{"use strict";var e={878:e=>{if(void 0===t){var n=new Error("Cannot find module '@react-native-async-storage/async-storage'");throw n.code="MODULE_NOT_FOUND",n}e.exports=t},557:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var n={};"undefined"!=typeof window&&(window.__STATSIG__=n),"undefined"!=typeof __STATSIG__&&(__STATSIG__=n)},566:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},770:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.captureDiagnostics=void 0,e.captureDiagnostics=function(t){return t()}},706:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.errorBoundary=e.configureErrorBoundary=e.EXCEPTION_ENDPOINT=void 0;var a=n(998);e.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";var u=new Set,s=null;function l(t,n){try{!0!==(null==s?void 0:s.isSilent)&&a.Log.warn("Caught error in ".concat(t),n),o(this,void 0,void 0,(function(){var o,a,l,c,f,h,p;return i(this,(function(i){return o=null!=n?n:Error("[Statsig] Error was empty"),a=o instanceof Error,l=a?o.name:"No Name",u.has(l)||!(null==s?void 0:s.sdkKey)?[2]:(u.add(l),c=a?o.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(o),f=JSON.stringify(r({tag:t,exception:l,info:c},s.metadata)),[2,fetch(e.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":s.sdkKey,"STATSIG-SDK-TYPE":String(null===(h=s.metadata)||void 0===h?void 0:h.sdkType),"STATSIG-SDK-VERSION":String(null===(p=s.metadata)||void 0===p?void 0:p.sdkVersion),"Content-Type":"application/json"},body:f})])}))})).then((function(){})).catch((function(){}))}catch(t){}}e.configureErrorBoundary=function(t){s=t},e.errorBoundary=function(t,e){try{var n=e();return n&&n instanceof Promise?n.catch((function(e){return l(t,e)})):n}catch(e){return l(t,e),null}}},422:function(t,e){var n=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;var o=function(){function t(t){var e=this;this._network=t,this._queue=[],this._flushTimer=setInterval((function(){return e._flushAndForget()}),1e4)}return t.prototype.enqueue=function(t){this._queue.push(t),this._queue.length>10&&this._flushAndForget()},t.prototype.shutdown=function(){return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return this._flushTimer&&(clearInterval(this._flushTimer),this._flushTimer=null),[4,this._flush()];case 1:return t.sent(),[2]}}))}))},t.prototype._flushAndForget=function(){this._flush().catch((function(){}))},t.prototype._flush=function(){return n(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:if(0===this._queue.length)return[2];t=this._queue,this._queue=[],e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._network.sendEvents(t)];case 2:case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},t}();e.EventLogger=o},980:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2=void 0,e.DJB2=function(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return String(e>>>0)}},955:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0;var i=n(998),a={},u={getItem:function(t){var e;return Promise.resolve(null!==(e=a[t])&&void 0!==e?e:null)},setItem:function(t,e){return a[t]=e,Promise.resolve()},removeItem:function(t){return delete a[t],Promise.resolve()}};try{if("undefined"!=typeof window&&"localStorage"in window)u={getItem:function(t){return Promise.resolve(localStorage.getItem(t))},setItem:function(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem:function(t){return localStorage.removeItem(t),Promise.resolve()}};else{var s=n(878);u=s.default?s.default:s}}catch(t){i.Log.warn("[Statsig] Failed to get storage provider. Failling back to in memory store.")}var l=u;e.Storage=l,e.getObjectFromStorage=function(t){return r(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return[4,l.getItem(t)];case 1:return e=n.sent(),[2,JSON.parse(null!=e?e:"null")]}}))}))},e.setObjectInStorage=function(t,e){return r(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,l.setItem(t,JSON.stringify(e))];case 1:return n.sent(),[2]}}))}))}},998:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Log=void 0;var n=function(){function t(){}return t.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.info.apply(console,t)},t.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.debug.apply(console,t)},t.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.warn.apply(console,t)},t.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.error.apply(console,t)},t}();e.Log=n},938:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Monitored=void 0;var r=n(770),o=n(706);function i(t,e){var n=e.value;return e.value=function(){for(var e=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return(0,o.errorBoundary)(t,(function(){return(0,r.captureDiagnostics)((function(){return n.apply(e,i)}))}))},e}e.Monitored=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,o=Object.getOwnPropertyNames(t.prototype);r<o.length;r++){var a=o[r],u=Object.getOwnPropertyDescriptor(t.prototype,a),s=u&&u.value instanceof Function;"constructor"!==a&&s&&Object.defineProperty(t.prototype,a,i(a,u))}return t}},898:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;var a=n(638),u=n(114),s=n(985),l=function(){function t(t,e){this._sdkKey=t,this._api=e,this._sessionID=(0,s.getUUID)()}return t.prototype.sendEvents=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this._sendPostRequest("".concat(this._api,"/rgstr"),{events:t})]}))}))},t.prototype._sendPostRequest=function(t,e,n){return void 0===n&&(n=1e4),o(this,void 0,void 0,(function(){var o,s,l;return i(this,(function(i){switch(i.label){case 0:return o=u.StatsigMetadata.get(),[4,a.StableID.get()];case 1:return s=i.sent(),l=JSON.stringify(r(r({},e),{statsigMetadata:r(r({},o),{stableID:s,sessionID:this._sessionID})})),[2,this._sendRequest("POST",t,n,l)]}}))}))},t.prototype._sendGetRequest=function(t,e){return void 0===e&&(e=1e4),o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,this._sendRequest("GET",t,e)]}))}))},t.prototype._sendRequest=function(t,e,n,r){return void 0===n&&(n=1e4),o(this,void 0,void 0,(function(){var o,a,s,l,c;return i(this,(function(i){switch(i.label){case 0:return o=new AbortController,a=setTimeout((function(){return o.abort()}),n),s=u.StatsigMetadata.get(),[4,fetch(e,{method:t,body:r,headers:{"Content-Type":"application/json","STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":s.sdkType,"STATSIG-SDK-VERSION":s.sdkVersion},signal:o.signal})];case 1:return l=i.sent(),clearTimeout(a),[4,l.text()];case 2:return c=i.sent(),[2,JSON.parse(c)]}}))}))},t}();e.NetworkCore=l},638:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=e.STATSIG_STABLE_ID_KEY=void 0;var i=n(955),a=n(998),u=n(985);e.STATSIG_STABLE_ID_KEY="STATSIG_STABLE_ID";var s=null;function l(t){(0,i.setObjectInStorage)(e.STATSIG_STABLE_ID_KEY,t).catch((function(){a.Log.warn("Failed to save StableID")}))}e.StableID={get:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return null==s&&(s=(0,i.getObjectFromStorage)(e.STATSIG_STABLE_ID_KEY).then((function(t){if(null!=t)return t;var e=(0,u.getUUID)();return l(e),e}))),[2,s]}))}))},setOverride:function(t){s=Promise.resolve(t),l(t)}}},540:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0;var r=n(422),o=function(){function t(t,e){var n;this.loadingStatus="Uninitialized",this._listeners={},this._logger=new r.EventLogger(e),this._sdkKey=t,__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{};var o=null!==(n=__STATSIG__.instances)&&void 0!==n?n:new Set;o.add(this),__STATSIG__.instances=o}return t.prototype.toString=function(){return"foo"},t.prototype.on=function(t,e){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e)},t.prototype.off=function(t,e){if(this._listeners[t]){var n=this._listeners[t].indexOf(e);-1!==n&&this._listeners[t].splice(n,1)}},t.prototype.emit=function(t){this._listeners[t.event]&&this._listeners[t.event].forEach((function(e){return e(t)}))},t.prototype.setStatus=function(t){this.loadingStatus=t,this.emit({event:"status_change",loadingStatus:t})},t}();e.StatsigClientBase=o},847:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},141:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=void 0;var n="statsig::config_exposure";function r(t,e,n,r){return{eventName:t,user:e,value:null,metadata:n,secondaryExposures:r,time:Date.now()}}e.createGateExposure=function(t,e,n,o,i){return r("statsig::gate_exposure",t,{gate:e,gateValue:String(n),ruleID:o},i)},e.createConfigExposure=function(t,e,o,i){return r(n,t,{config:e,ruleID:o},i)},e.createLayerParameterExposure=function(t,e,o,i){var a,u=i.explicit_parameters.includes(o),s="",l=null!==(a=i.undelegated_secondary_exposures)&&void 0!==a?a:[];return u&&(s=i.allocated_experiment_name,l=i.secondary_exposures),r(n,t,{config:e,parameterName:o,ruleID:i.rule_id,allocatedExperiment:s},l)}},114:function(t,e){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadata=void 0;var r={appVersion:"",deviceModel:"",deviceModelName:"",locale:"",sdkType:"",sdkVersion:"0.0.6",stableID:"",systemName:"",systemVersion:""};e.StatsigMetadata={get:function(){return r},add:function(t){r=n(n({},r),t)}}},639:function(t,e){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.emptyLayer=e.emptyDynamicConfig=e.emptyFeatureGate=void 0;function r(t){return{name:t,ruleID:"default"}}e.emptyFeatureGate=function(t){return n(n({},r(t)),{value:!1})},e.emptyDynamicConfig=function(t){return n(n({},r(t)),{value:{}})},e.emptyLayer=function(t){return n(n({},r(t)),{getValue:function(){}})}},229:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.normalizeUser=void 0,e.normalizeUser=function(t,e){var n={};try{n=JSON.parse(JSON.stringify(t))}catch(t){throw new Error("User object must be convertable to JSON string.")}return null!=e&&(n.statsigEnvironment=e),n}},985:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getUUID=void 0,e.getUUID=function(){var t=(new Date).getTime(),e="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0,n="89ab"[Math.floor(4*Math.random())];return"xxxxxxxx-xxxx-4xxx-".concat(n,"xxx-xxxxxxxxxxxx").replace(/[xy]/g,(function(n){var r=16*Math.random();return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),("x"===n?r:7&r|8).toString(16)}))}},996:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||o(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0,n(557);var a=n(422);Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return a.EventLogger}}),i(n(557),e),i(n(566),e),i(n(706),e),i(n(980),e),i(n(955),e),i(n(998),e),i(n(938),e),i(n(898),e),i(n(638),e),i(n(540),e),i(n(847),e),i(n(141),e),i(n(114),e),i(n(639),e),i(n(229),e),i(n(985),e),__STATSIG__=r(r({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:a.EventLogger})},242:function(t,e){var n,r=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigUnsupportedEvaluationError=void 0;var o=function(t){function e(n){var r=t.call(this,"Unsupported condition or operator: ".concat(n))||this;return Object.setPrototypeOf(r,e.prototype),r}return r(e,t),e}(Error);e.StatsigUnsupportedEvaluationError=o},204:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(299),i=n(242);function a(t){return r(r({},{value:!1,rule_id:"",secondary_exposures:[],json_value:{},explicit_parameters:null,config_delegate:null,is_experiment_group:!1,group_name:null,undelegated_secondary_exposures:void 0,evaluation_details:void 0}),t)}var u=function(){function t(t){this._store=t}return t.prototype.checkGate=function(t,e){var n,r=null===(n=this._store.values)||void 0===n?void 0:n.feature_gates.find((function(t){return t.name===e}));return this._evalConfigSpec(t,r)},t.prototype.getConfig=function(t,e){var n,r=null===(n=this._store.values)||void 0===n?void 0:n.dynamic_configs.find((function(t){return t.name===e}));return this._evalConfigSpec(t,r)},t.prototype.getLayer=function(t,e){var n,r=null===(n=this._store.values)||void 0===n?void 0:n.dynamic_configs.find((function(t){return t.name===e}));return this._evalConfigSpec(t,r)},t.prototype._evalConfigSpec=function(t,e){if(!e)return a({evaluation_details:{time:Date.now(),reason:"Unrecognized"}});var n=this._eval(t,e);return r(r({},n),{evaluation_details:{time:Date.now(),reason:"Network"}})},t.prototype._eval=function(t,e){var n=v(e.defaultValue)?e.defaultValue:void 0;if(!e.enabled)return a({rule_id:"disabled",json_value:n});var r=[];try{for(var o=0;o<e.rules.length;o++){var u=e.rules[o],s=this._evalRule(t,u);if(r=r.concat(s.secondary_exposures),!0===s.value){var l=this._evalDelegate(t,u,r);if(l)return l;var c=this._evalPassPercent(t,u,e);return a({value:c,rule_id:s.rule_id,secondary_exposures:r,json_value:c?s.json_value:n,explicit_parameters:e.explicitParameters,config_delegate:s.config_delegate,is_experiment_group:s.is_experiment_group})}}}catch(t){if(t instanceof i.StatsigUnsupportedEvaluationError)return a({rule_id:"default",secondary_exposures:r,json_value:n,explicit_parameters:e.explicitParameters,evaluation_details:{reason:"Unsupported",time:Date.now()}});throw t}return a({rule_id:"default",secondary_exposures:r,json_value:n,explicit_parameters:e.explicitParameters})},t.prototype._evalDelegate=function(t,e,n){var o;if(null==e.configDelegate)return null;var i=null===(o=this._store.values)||void 0===o?void 0:o.dynamic_configs.find((function(t){return t.name===e.configDelegate}));if(!i)return null;var a=this._eval(t,i);return r(r({},a),{conifg_delegate:e.configDelegate,undelegated_secondary_exposures:n})},t.prototype._evalPassPercent=function(t,e,n){var r,o;if(100===e.passPercentage)return!0;if(0===e.passPercentage)return!1;var i=s(n.salt+"."+(null!==(r=e.salt)&&void 0!==r?r:e.id)+"."+(null!==(o=this._getUnitID(t,e.idType))&&void 0!==o?o:""));return Number(i%BigInt(1e4))<100*e.passPercentage},t.prototype._getUnitID=function(t,e){var n,r,o;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!==(r=null===(n=null==t?void 0:t.customIDs)||void 0===n?void 0:n[e])&&void 0!==r?r:null===(o=null==t?void 0:t.customIDs)||void 0===o?void 0:o[e.toLowerCase()]:null==t?void 0:t.userID},t.prototype._evalRule=function(t,e){for(var n,r=[],o=!0,i=0,u=e.conditions;i<u.length;i++){var s=u[i],l=this._evalCondition(t,s);l.passes||(o=!1),l.exposures&&(r=r.concat(l.exposures))}return a({value:o,rule_id:e.id,secondary_exposures:r,json_value:v(e.returnValue)?e.returnValue:void 0,group_name:e.groupName,is_experiment_group:null!==(n=e.isExperimentGroup)&&void 0!==n&&n})},t.prototype._evalCondition=function(t,e){var n,r,o,a,u,f,v,_=null,y=e.field,g=e.targetValue,b=e.idType;switch(e.type.toLowerCase()){case"public":return{passes:!0};case"fail_gate":case"pass_gate":var w=this._evalConfigSpec(t,null===(n=this._store.values)||void 0===n?void 0:n.feature_gates.find((function(t){return t.name===String(g)})));_=null==w?void 0:w.value;var m=null!==(r=null==w?void 0:w.secondary_exposures)&&void 0!==r?r:[];return m.push({gate:String(g),gateValue:String(_),ruleID:null!==(o=null==w?void 0:w.rule_id)&&void 0!==o?o:""}),{passes:"fail_gate"===e.type.toLowerCase()?!_:!!_,exposures:m};case"ip_based":case"ua_based":default:throw new i.StatsigUnsupportedEvaluationError(e.type);case"user_field":_=function(t,e){var n,r,o,i,a,u,s,l,c;if(null==e||"object"!=typeof t||null==t)return null;var f=t;return null!==(l=null!==(u=null!==(i=null!==(r=null!==(n=f[e])&&void 0!==n?n:f[e.toLowerCase()])&&void 0!==r?r:null===(o=null==t?void 0:t.custom)||void 0===o?void 0:o[e])&&void 0!==i?i:null===(a=null==t?void 0:t.custom)||void 0===a?void 0:a[e.toLowerCase()])&&void 0!==u?u:null===(s=null==t?void 0:t.privateAttributes)||void 0===s?void 0:s[e])&&void 0!==l?l:null===(c=null==t?void 0:t.privateAttributes)||void 0===c?void 0:c[e.toLowerCase()]}(t,y);break;case"environment_field":_=function(t,e){return null==e?null:function(t,e){if(null!=t){var n=e.toLowerCase(),r=Object.keys(t).find((function(t){return t.toLowerCase()===n}));if(void 0!==r)return t[r]}}(t.statsigEnvironment,e)}(t,y);break;case"current_time":_=Date.now();break;case"user_bucket":var S=s(null!==(f=String(null!==(u=null===(a=e.additionalValues)||void 0===a?void 0:a.salt)&&void 0!==u?u:"")+"."+this._getUnitID(t,b))&&void 0!==f?f:"");_=Number(S%BigInt(1e3));break;case"unit_id":_=this._getUnitID(t,b)}var x=null===(v=e.operator)||void 0===v?void 0:v.toLowerCase(),O=!1;switch(x){case"gt":O=l((function(t,e){return t>e}))(_,g);break;case"gte":O=l((function(t,e){return t>=e}))(_,g);break;case"lt":O=l((function(t,e){return t<e}))(_,g);break;case"lte":O=l((function(t,e){return t<=e}))(_,g);break;case"version_gt":O=c((function(t){return t>0}))(_,g);break;case"version_gte":O=c((function(t){return t>=0}))(_,g);break;case"version_lt":O=c((function(t){return t<0}))(_,g);break;case"version_lte":O=c((function(t){return t<=0}))(_,g);break;case"version_eq":O=c((function(t){return 0===t}))(_,g);break;case"version_neq":O=c((function(t){return 0!==t}))(_,g);break;case"any":O=d(_,g,h(!0,(function(t,e){return t===e})));break;case"none":O=!d(_,g,h(!0,(function(t,e){return t===e})));break;case"any_case_sensitive":O=d(_,g,h(!1,(function(t,e){return t===e})));break;case"none_case_sensitive":O=!d(_,g,h(!1,(function(t,e){return t===e})));break;case"str_starts_with_any":O=d(_,g,h(!0,(function(t,e){return t.startsWith(e)})));break;case"str_ends_with_any":O=d(_,g,h(!0,(function(t,e){return t.endsWith(e)})));break;case"str_contains_any":O=d(_,g,h(!0,(function(t,e){return t.includes(e)})));break;case"str_contains_none":O=!d(_,g,h(!0,(function(t,e){return t.includes(e)})));break;case"str_matches":try{O=String(_).length<1e3&&new RegExp(g).test(String(_))}catch(t){O=!1}break;case"eq":O=_==g;break;case"neq":O=_!=g;break;case"before":O=p((function(t,e){return t<e}))(_,g);break;case"after":O=p((function(t,e){return t>e}))(_,g);break;case"on":O=p((function(t,e){return null==t||t.setHours(0,0,0,0),null==e||e.setHours(0,0,0,0),(null==t?void 0:t.getTime())===(null==e?void 0:e.getTime())}))(_,g);break;default:throw new i.StatsigUnsupportedEvaluationError(x)}return{passes:O}},t}();function s(t){return(0,o.SHA256)(t).dataView().getBigUint64(0,!1)}function l(t){return function(e,n){if(null==e||null==n)return!1;var r=Number(e),o=Number(n);return!isNaN(r)&&!isNaN(o)&&t(r,o)}}function c(t){return function(e,n){var r=function(t,e){if(null==t||null==e||"string"!=typeof t||"string"!=typeof e)return null;var n=f(t),r=f(e);if(0===n.length||0===r.length)return null;for(var o=n.split("."),i=r.split("."),a=0;a<Math.max(o.length,i.length);a++){void 0===o[a]&&(o[a]="0"),void 0===i[a]&&(i[a]="0");var u=Number(o[a]),s=Number(i[a]);if("number"!=typeof u||"number"!=typeof s||isNaN(u)||isNaN(s))return null;if(u<s)return-1;if(u>s)return 1}return 0}(e,n);return null!=r&&t(r)}}function f(t){var e=t.indexOf("-");return e>=0?t.substr(0,e):t}function h(t,e){return function(n,r){return null!=n&&null!=r&&(t?e(String(n).toLowerCase(),String(r).toLowerCase()):e(String(n),String(r)))}}function p(t){return function(e,n){if(null==e||null==n)return!1;try{var r=new Date(e);isNaN(r.getTime())&&(r=new Date(Number(e)));var o=new Date(n);return isNaN(o.getTime())&&(o=new Date(Number(n))),!isNaN(r.getTime())&&!isNaN(o.getTime())&&t(r,o)}catch(t){return!1}}}function d(t,e,n){if(!Array.isArray(e))return!1;for(var r=0;r<e.length;r++)if(n(t,e[r]))return!0;return!1}function v(t){return null!=t&&"object"==typeof t}e.default=u},630:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(e,n){var r;void 0===n&&(n=null);var o=t.call(this,e,null!==(r=null==n?void 0:n.api)&&void 0!==r?r:"https://api.statsig.com/v1")||this;return o._downloadConfigSpecsUrl="https://api.statsigcdn.com/v1/download_config_specs/".concat(e,".json"),o}return o(e,t),e.prototype.fetchConfigSpecs=function(){return this._sendGetRequest(this._downloadConfigSpecsUrl,2e3)},e}(n(996).NetworkCore);e.default=i},53:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}catch(t){u=[6,t],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(996),s=n(204),l=n(630),c=n(720),f=function(t){function e(e,n){var r=this;void 0===n&&(n=null);var o=new l.default(e,n);return(r=t.call(this,e,o)||this)._options=null!=n?n:{},r._network=o,r._logger=new u.EventLogger(r._network),r._store=new c.default,r._evaluator=new s.default(r._store),r}return o(e,t),e.prototype.initialize=function(){return i(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return window.statsigConfigSpecs?(this._store.setValues(window.statsigConfigSpecs),this.setStatus("Bootstrap"),[2]):(this.setStatus("Loading"),[4,this._network.fetchConfigSpecs()]);case 1:return(t=e.sent()).has_updates?(this._store.setValues(t),this.setStatus("Network")):this.setStatus("Error"),[2]}}))}))},e.prototype.shutdown=function(){return i(this,void 0,void 0,(function(){return a(this,(function(t){return[2,Promise.resolve()]}))}))},e.prototype.checkGate=function(t,e){return this.getFeatureGate(t,e).value},e.prototype.getFeatureGate=function(t,e){var n=this._evaluator.checkGate(t,e);return{name:e,ruleID:n.rule_id,value:n.value}},e.prototype.getDynamicConfig=function(t,e){var n=this._evaluator.getConfig(t,e);return{name:e,ruleID:n.rule_id,value:n.json_value}},e.prototype.getExperiment=function(t,e){return this.getDynamicConfig(t,e)},e.prototype.getLayer=function(t,e){var n=this._evaluator.getLayer(t,e),r=n.json_value;return{name:e,ruleID:n.rule_id,getValue:function(t){var e;return null!==(e=r[t])&&void 0!==e?e:null}}},e.prototype.logEvent=function(t,e){throw new Error("Method not implemented.")},e}(u.StatsigClientBase);e.default=f},720:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){this.values=null}return t.prototype.setValues=function(t){this.values=t},t}();e.default=n},355:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.OnDeviceEvaluationsClient=void 0;var o=n(53);e.OnDeviceEvaluationsClient=o.default,__STATSIG__=r(r({},__STATSIG__),{OnDeviceEvaluationsClient:o.default})},299:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0;var r=n(908);Object.defineProperty(e,"SHA256",{enumerable:!0,get:function(){return r.SHA256}})},908:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SHA256=void 0,e.SHA256=function(t){return(new i).update(t)};var n=[-2147483648,8388608,32768,128],r=[24,16,8,0],o=[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],i=function(){function t(){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}return t.prototype.update=function(t){if(this.finalized)return this;if("string"!=typeof t)throw new Error('Must be of type "string"');for(var e,n,o=0,i=t.length,a=this.blocks;o<i;){for(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),n=this.start;o<i&&n<64;++o)(e=t.charCodeAt(o))<128?a[n>>2]|=e<<r[3&n++]:e<2048?(a[n>>2]|=(192|e>>6)<<r[3&n++],a[n>>2]|=(128|63&e)<<r[3&n++]):e<55296||e>=57344?(a[n>>2]|=(224|e>>12)<<r[3&n++],a[n>>2]|=(128|e>>6&63)<<r[3&n++],a[n>>2]|=(128|63&e)<<r[3&n++]):(e=65536+((1023&e)<<10|1023&t.charCodeAt(++o)),a[n>>2]|=(240|e>>18)<<r[3&n++],a[n>>2]|=(128|e>>12&63)<<r[3&n++],a[n>>2]|=(128|e>>6&63)<<r[3&n++],a[n>>2]|=(128|63&e)<<r[3&n++]);this.lastByteIndex=n,this.bytes+=n-this.start,n>=64?(this.block=a[16],this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=n[3&e],this.block=t[16],e>=56&&(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()}},t.prototype.hash=function(){var t,e,n,r,i,a,u,s,l,c=this.blocks,f=this.h0,h=this.h1,p=this.h2,d=this.h3,v=this.h4,_=this.h5,y=this.h6,g=this.h7;for(t=16;t<64;++t)e=((i=c[t-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,n=((i=c[t-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,c[t]=c[t-16]+e+c[t-7]+n<<0;for(l=h&p,t=0;t<64;t+=4)this.first?(a=704751109,g=(i=c[0]-210244248)-1521486534<<0,d=i+143694565<<0,this.first=!1):(e=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),r=(a=f&h)^f&p^l,g=d+(i=g+(n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&_^~v&y)+o[t]+c[t])<<0,d=i+(e+r)<<0),e=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),r=(u=d&f)^d&h^a,y=p+(i=y+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&v^~g&_)+o[t+1]+c[t+1])<<0,e=((p=i+(e+r)<<0)>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),r=(s=p&d)^p&f^u,_=h+(i=_+(n=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&g^~y&v)+o[t+2]+c[t+2])<<0,e=((h=i+(e+r)<<0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),r=(l=h&p)^h&d^s,v=f+(i=v+(n=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&y^~_&g)+o[t+3]+c[t+3])<<0,f=i+(e+r)<<0;this.h0=this.h0+f<<0,this.h1=this.h1+h<<0,this.h2=this.h2+p<<0,this.h3=this.h3+d<<0,this.h4=this.h4+v<<0,this.h5=this.h5+_<<0,this.h6=this.h6+y<<0,this.h7=this.h7+g<<0},t.prototype.arrayBuffer=function(){return this._getOutputs().buffer},t.prototype.dataView=function(){return this._getOutputs().dataView},t.prototype._getOutputs=function(){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}},t}()}},n={},r=function t(r){var o=n[r];if(void 0!==o)return o.exports;var i=n[r]={exports:{}};return e[r].call(i.exports,i,i.exports,t),i.exports}(355);return r.default})()));
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.statsig=n():t.statsig=n()}(this,()=>(()=>{"use strict";var e={557:(t,n,e)=>{Object.defineProperty(n,"__esModule",{value:!0});n={};"undefined"!=typeof window&&(window.__STATSIG__=n),void 0!==e.g&&(e.g.__STATSIG__=n),"undefined"!=typeof globalThis&&(globalThis.__STATSIG__=n)},566:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0})},770:(t,n,e)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Diagnostics=n.captureDiagnostics=void 0;var r=e(998),i="undefined"!=typeof performance&&void 0!==performance.mark,u=[];n.captureDiagnostics=function(t,n){function e(){o.mark("".concat(t,":end")),"".concat(t,":end").startsWith("initialize:")&&o.flush()}return o.mark("".concat(t,":start")),(n=n())&&n instanceof Promise?n.finally(e):(e(),n)};s.mark=function(t,n){i&&(t=performance.mark(t,{detail:n}),u.push(t))},s.flush=function(){var t=performance.getEntriesByType("resource").filter(function(t){return t.name.startsWith("https://api.statsig.com")}),t={markers:u,resources:t};r.Log.debug("Diagnostics",t,JSON.stringify(t)),u=[]};var o=s;function s(){}n.Diagnostics=o},706:function(t,o,n){var s=this&&this.__assign||function(){return(s=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},e=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(e,n){function r(t){try{u(c.next(t))}catch(t){n(t)}}function i(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(r,i)}u((c=c.apply(t,o||[])).next())})},c=this&&this.__generator||function(r,i){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function t(e){return function(t){var n=[e,t];if(u)throw new TypeError("Generator is already executing.");for(;c=a&&n[a=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=i.call(r,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},r=(Object.defineProperty(o,"__esModule",{value:!0}),o.errorBoundary=o.configureErrorBoundary=o.EXCEPTION_ENDPOINT=void 0,n(998)),a=(o.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception",new Set),f=null;function i(i,u){var t=this;try{!0!==(null==f?void 0:f.isSilent)&&r.Log.warn("Caught error in ".concat(i),{error:u,foo:1});e(t,void 0,void 0,function(){var n,e,r;return c(this,function(t){return n=null!=u?u:Error("[Statsig] Error was empty"),r=n instanceof Error,e=r?n.name:"No Name",a.has(e)||null==f||!f.sdkKey?[2]:(a.add(e),r=r?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify(s({tag:i,exception:e,info:r},f.metadata)),[2,fetch(o.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":f.sdkKey,"STATSIG-SDK-TYPE":String(null==(e=f.metadata)?void 0:e.sdkType),"STATSIG-SDK-VERSION":String(null==(r=f.metadata)?void 0:r.sdkVersion),"Content-Type":"application/json"},body:n})])})}).then(function(){}).catch(function(){})}catch(t){}}o.configureErrorBoundary=function(t){f=t},o.errorBoundary=function(n,t){try{var e=t();return e&&e instanceof Promise?e.catch(function(t){return i(n,t)}):e}catch(t){return i(n,t),null}}},422:function(t,n,e){var i=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(e,n){function r(t){try{u(c.next(t))}catch(t){n(t)}}function i(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(r,i)}u((c=c.apply(t,o||[])).next())})},u=this&&this.__generator||function(r,i){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function t(e){return function(t){var n=[e,t];if(u)throw new TypeError("Generator is already executing.");for(;c=a&&n[a=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=i.call(r,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},r=(Object.defineProperty(n,"__esModule",{value:!0}),n.EventLogger=void 0,e(998)),o=e(141);function s(t,n){var e=this;this.u=t,this.o=n,this.l=[],this.h={},this.v=50,this._=setInterval(function(){return e.p()},1e4)}s.prototype.enqueue=function(t){this.m(t)&&(this.l.push(t),this.l.length>this.v)&&this.p()},s.prototype.reset=function(){this.h={}},s.prototype.shutdown=function(){return i(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return this._&&(clearInterval(this._),this._=null),[4,this.S()];case 1:return t.sent(),[2]}})})},s.prototype.m=function(t){if((0,o.isExposureEvent)(t)){var t=[t.eventName,null==(n=t.user)?void 0:n.userID,null==(n=t.metadata)?void 0:n.gate,null==(n=t.metadata)?void 0:n.config,null==(n=t.metadata)?void 0:n.ruleID].join("|"),n=this.h[t],e=Date.now();if(n&&e-n<6e4)return!1;1e3<Object.keys(this.h).length&&(this.h={}),this.h[t]=e}return!0},s.prototype.p=function(){this.S().catch(function(){})},s.prototype.S=function(){return i(this,void 0,void 0,function(){var n;return u(this,function(t){switch(t.label){case 0:if(0===this.l.length)return[2];n=this.l,this.l=[],this.v=Math.min(this.v+50,700),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.j(n)];case 2:return t.sent(),[3,4];case 3:return t.sent(),r.Log.warn("Failed to flush events."),[3,4];case 4:return this.v=Math.max(this.v-50,50),[2]}})})},s.prototype.j=function(e){var r;return i(this,void 0,void 0,function(){var n;return u(this,function(t){switch(t.label){case 0:return n=null!=(r=null==(r=this.o)?void 0:r.api)?r:"https://api.statsig.com/v1",[4,this.u.post({url:"".concat(n,"/rgstr"),data:{events:e},retries:3})];case 1:return[2,null!=(n=t.sent())?n:{success:!1}]}})})},n.EventLogger=s},980:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DJB2=void 0,n.DJB2=function(t){for(var n=0,e=0;e<t.length;e++){n=(n<<5)-n+t.charCodeAt(e);n&=n}return String(n>>>0)}},955:function(t,n,e){var r=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(e,n){function r(t){try{u(c.next(t))}catch(t){n(t)}}function i(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(r,i)}u((c=c.apply(t,o||[])).next())})},i=this&&this.__generator||function(r,i){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function t(e){return function(t){var n=[e,t];if(u)throw new TypeError("Generator is already executing.");for(;c=a&&n[a=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=i.call(r,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},e=(Object.defineProperty(n,"__esModule",{value:!0}),n.setObjectInStorage=n.getObjectFromStorage=n.Storage=void 0,e(998)),u={},o={getItem:function(t){return Promise.resolve(null!=(t=u[t])?t:null)},setItem:function(t,n){return u[t]=n,Promise.resolve()},removeItem:function(t){return delete u[t],Promise.resolve()}};try{"undefined"!=typeof window&&"localStorage"in window&&(o={getItem:function(t){return Promise.resolve(localStorage.getItem(t))},setItem:function(t,n){return localStorage.setItem(t,n),Promise.resolve()},removeItem:function(t){return localStorage.removeItem(t),Promise.resolve()}})}catch(t){e.Log.warn("Failed to get storage provider. Failling back to in memory store.")}var s=o;n.Storage=s,n.getObjectFromStorage=function(e){return r(this,void 0,void 0,function(){var n;return i(this,function(t){switch(t.label){case 0:return[4,s.getItem(e)];case 1:return n=t.sent(),[2,JSON.parse(null!=n?n:"null")]}})})},n.setObjectInStorage=function(n,e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,s.setItem(n,JSON.stringify(e))];case 1:return t.sent(),[2]}})})}},998:(t,n)=>{function e(t){return t.unshift("[Statsig]"),t}function r(){}Object.defineProperty(n,"__esModule",{value:!0}),n.Log=void 0,r.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];"none"!==this.level&&console.info.apply(console,e(t))},r.debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];"none"!==this.level&&console.debug.apply(console,e(t))},r.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];"none"!==this.level&&console.warn.apply(console,e(t))},r.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];"none"!==this.level&&console.error.apply(console,e(t))},r.level="verbose",n.Log=r},938:(t,n,e)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.MonitoredClass=n.MonitoredFunction=void 0;var u=e(770),o=e(706);function s(r,t){var i=t.value;return t.value=function(){for(var t=this,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return(0,o.errorBoundary)(r,function(){return(0,u.captureDiagnostics)(r,function(){return i.apply(t,n)})})},t}n.MonitoredFunction=function(){return function(t,n,e){e&&"function"==typeof e.value&&"string"==typeof n&&s(n,e)}},n.MonitoredClass=function(t){for(var n=1;n<arguments.length;n++)n-1,0;for(var e=0,r=Object.getOwnPropertyNames(t.prototype);e<r.length;e++){var i=r[e],u=Object.getOwnPropertyDescriptor(t.prototype,i),o=u&&u.value instanceof Function;"constructor"!==i&&o&&Object.defineProperty(t.prototype,i,s(i,u))}return t}},898:function(t,n,e){var r,i,u=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}))(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),h=this&&this.__assign||function(){return(h=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},o=this&&this.__decorate||function(t,n,e,r){var i,u=arguments.length,o=u<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,n,e,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(o=(u<3?i(o):3<u?i(n,e,o):i(n,e))||o);return 3<u&&o&&Object.defineProperty(n,e,o),o},s=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(e,n){function r(t){try{u(c.next(t))}catch(t){n(t)}}function i(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(r,i)}u((c=c.apply(t,o||[])).next())})},v=this&&this.__generator||function(r,i){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function t(e){return function(t){var n=[e,t];if(u)throw new TypeError("Generator is already executing.");for(;c=a&&n[a=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=i.call(r,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},d=(Object.defineProperty(n,"__esModule",{value:!0}),n.NetworkCore=void 0,e(770)),_=e(998),c=e(938),a=e(638),f=e(114),l=e(985),b=(i=Error,u(p,i),p);function p(t,n){t=i.call(this,t)||this;return t.errorDescription=n,t}function y(t){this.O=t,this.T=(0,l.getUUID)()}y.prototype.post=function(r){return s(this,void 0,void 0,function(){var n,e;return v(this,function(t){switch(t.label){case 0:return n=r.data,[4,a.StableID.get()];case 1:return e=t.sent(),e=JSON.stringify(h(h({},n),{statsigMetadata:h(h({},f.StatsigMetadataProvider.get()),{stableID:e,sessionID:this.T})})),[2,this.I(h({method:"POST",body:e},r))]}})})},y.prototype.get=function(n){return s(this,void 0,void 0,function(){return v(this,function(t){return[2,this.I(h({method:"GET"},n))]})})},y.prototype.I=function(l){return s(this,void 0,void 0,function(){var n,e,r,i,u,o,s,c,a,f;return v(this,function(t){switch(t.label){case 0:n=l.method,e=l.url,r=l.headers,i=l.body,u=l.retries,o=new AbortController,s=setTimeout(function(){return o.abort("Timeout of ".concat(1e4,"ms expired."))},100),c=null,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(e,{method:n,body:i,headers:this.k(r),signal:o.signal})];case 2:return c=t.sent(),clearTimeout(s),[4,c.text()];case 3:if(a=t.sent(),c.ok)return d.Diagnostics.mark("_sendRequest:response-received",{status:c.status,contentLength:c.headers.get("content-length")}),[2,JSON.parse(a)];throw new b("Fetch Failure",a);case 4:return a=t.sent(),f=function(t,n){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof n)return n;if(n instanceof Error)return"".concat(n.name,": ").concat(n.message);return null}(o,a),d.Diagnostics.mark("_sendRequest:error",{error:f,status:null==c?void 0:c.status,contentLength:null==c?void 0:c.headers.get("content-length")}),!u||u<=0?(_.Log.error("A networking error occured.",f),[2,null]):[2,this.I(h(h({},l),{retries:u-1}))];case 5:return[2]}})})},y.prototype.k=function(t){var n=f.StatsigMetadataProvider.get();return h(h({},t),{"Content-Type":"application/json","STATSIG-API-KEY":this.O,"STATSIG-SDK-TYPE":n.sdkType,"STATSIG-SDK-VERSION":n.sdkVersion,"STATSIG-CLIENT-TIME":String(Date.now())})},o([(0,c.MonitoredFunction)()],y.prototype,"_sendRequest",null),n.NetworkCore=y},638:function(t,n,e){var r=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(e,n){function r(t){try{u(c.next(t))}catch(t){n(t)}}function i(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(r,i)}u((c=c.apply(t,o||[])).next())})},i=this&&this.__generator||function(r,i){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function t(e){return function(t){var n=[e,t];if(u)throw new TypeError("Generator is already executing.");for(;c=a&&n[a=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=i.call(r,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},u=(Object.defineProperty(n,"__esModule",{value:!0}),n.StableID=n.STATSIG_STABLE_ID_KEY=void 0,e(955)),o=e(998),s=e(985),c=(n.STATSIG_STABLE_ID_KEY="STATSIG_STABLE_ID",null);function a(t){(0,u.setObjectInStorage)(n.STATSIG_STABLE_ID_KEY,t).catch(function(){o.Log.warn("Failed to save StableID")})}n.StableID={get:function(){return r(void 0,void 0,void 0,function(){return i(this,function(t){return[2,c=null==c?(0,u.getObjectFromStorage)(n.STATSIG_STABLE_ID_KEY).then(function(t){return null!=t||a(t=(0,s.getUUID)()),t}):c]})})},setOverride:function(t){c=Promise.resolve(t),a(t)}}},540:(t,n,e)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.StatsigClientBase=void 0;var r=e(422),i=e(998);function u(t,n,e){this.loadingStatus="Uninitialized",this.N={},this.M=new r.EventLogger(n,e),this.O=t;t=null!=(n=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?n:new Set;t.add(this),__STATSIG__.instances=t,i.Log.level=null!=(n=null==e?void 0:e.logLevel)?n:"none"}u.prototype.on=function(t,n){this.N[t]||(this.N[t]=[]),this.N[t].push(n)},u.prototype.off=function(t,n){this.N[t]&&-1!==(n=this.N[t].indexOf(n))&&this.N[t].splice(n,1)},u.prototype.emit=function(n){this.N[n.event]&&this.N[n.event].forEach(function(t){return t(n)})},u.prototype.setStatus=function(t){this.loadingStatus=t,this.emit({event:"status_change",loadingStatus:t})},n.StatsigClientBase=u},847:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0})},141:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createLayerParameterExposure=n.createConfigExposure=n.createGateExposure=n.isExposureEvent=void 0;var i="statsig::config_exposure",u="statsig::gate_exposure";function s(t,n,e,r){return{eventName:t,user:n,value:null,metadata:e,secondaryExposures:r,time:Date.now()}}n.isExposureEvent=function(t){return(t=t.eventName)===u||t===i},n.createGateExposure=function(t,n,e,r,i){return s(u,t,{gate:n,gateValue:String(e),ruleID:r},i)},n.createConfigExposure=function(t,n,e,r){return s(i,t,{config:n,ruleID:e},r)},n.createLayerParameterExposure=function(t,n,e,r){var i=r.explicit_parameters.includes(e),u="",o=null!=(o=r.undelegated_secondary_exposures)?o:[];return i&&(u=r.allocated_experiment_name,o=r.secondary_exposures),s("statsig::layer_exposure",t,{config:n,parameterName:e,ruleID:r.rule_id,allocatedExperiment:u,isExplicitParameter:String(i)},o)}},114:function(t,n){var e=this&&this.__assign||function(){return(e=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},r=(Object.defineProperty(n,"__esModule",{value:!0}),n.StatsigMetadataProvider=void 0,{appVersion:"",deviceModel:"",deviceModelName:"",locale:"",sdkType:"",sdkVersion:"0.0.7",stableID:"",systemName:"",systemVersion:""});n.StatsigMetadataProvider={get:function(){return r},add:function(t){r=e(e({},r),t)}}},639:function(t,n){var e=this&&this.__assign||function(){return(e=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},r=(Object.defineProperty(n,"__esModule",{value:!0}),n.emptyLayer=n.emptyDynamicConfig=n.emptyFeatureGate=void 0,"default");function i(t){return{name:t,ruleID:r}}n.emptyFeatureGate=function(t){return e(e({},i(t)),{value:!1})},n.emptyDynamicConfig=function(t){return e(e({},i(t)),{value:{}})},n.emptyLayer=function(t){return e(e({},i(t)),{getValue:function(){}})}},229:(t,n,e)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getUserStorageKey=n.normalizeUser=void 0;var r=e(980);n.normalizeUser=function(t,n){try{var e=JSON.parse(JSON.stringify(t));return null!=n&&(e.statsigEnvironment=n),e}catch(t){throw new Error("User object must be convertable to JSON string.")}},n.getUserStorageKey=function(t,n){var e,t=["uid:".concat(null!=(e=t.userID)?e:""),"cids:".concat(Object.entries(null!=(e=t.customIDs)?e:{}).sort(function(t,n){t=t[0],n=n[0];return t.localeCompare(n)}).map(function(t){var n=t[0],t=t[1];return"".concat(n,"-").concat(t)}).join(",")),"k:".concat(n)];return(0,r.DJB2)(t.join("|"))}},985:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getUUID=void 0,n.getUUID=function(){var e=(new Date).getTime(),r="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0,t="89ab"[Math.floor(4*Math.random())];return"xxxxxxxx-xxxx-4xxx-".concat(t,"xxx-xxxxxxxxxxxx").replace(/[xy]/g,function(t){var n=16*Math.random();return 0<e?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(r+n)%16|0,r=Math.floor(r/16)),("x"===t?n:7&n|8).toString(16)})}},996:function(t,n,e){var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,n,e,r){void 0===r&&(r=e);var i=Object.getOwnPropertyDescriptor(n,e);i&&("get"in i?n.__esModule:!i.writable&&!i.configurable)||(i={enumerable:!0,get:function(){return n[e]}}),Object.defineProperty(t,r,i)}:function(t,n,e,r){t[r=void 0===r?e:r]=n[e]}),u=this&&this.__exportStar||function(t,n){for(var e in t)"default"===e||Object.prototype.hasOwnProperty.call(n,e)||i(n,t,e)},o=(Object.defineProperty(n,"__esModule",{value:!0}),n.EventLogger=n.StatsigMetadataProvider=void 0,e(557),e(422)),s=(Object.defineProperty(n,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),u(e(557),n),u(e(566),n),u(e(706),n),u(e(980),n),u(e(955),n),u(e(998),n),u(e(938),n),u(e(898),n),u(e(638),n),u(e(540),n),u(e(847),n),u(e(141),n),e(114));Object.defineProperty(n,"StatsigMetadataProvider",{enumerable:!0,get:function(){return s.StatsigMetadataProvider}}),u(e(639),n),u(e(229),n),u(e(985),n),__STATSIG__=r(r({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger})},242:function(t,n){var r,e,i=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}))(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),i=(Object.defineProperty(n,"__esModule",{value:!0}),n.StatsigUnsupportedEvaluationError=void 0,e=Error,i(u,e),u);function u(t){t=e.call(this,"Unsupported condition or operator: ".concat(t))||this;return Object.setPrototypeOf(t,u.prototype),t}n.StatsigUnsupportedEvaluationError=i},204:function(t,n,e){var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},r=(Object.defineProperty(n,"__esModule",{value:!0}),e(299)),v=e(242);function c(t){return i(i({},{value:!1,rule_id:"",secondary_exposures:[],json_value:{},explicit_parameters:null,config_delegate:null,is_experiment_group:!1,group_name:null,undelegated_secondary_exposures:void 0,evaluation_details:void 0}),t)}function u(t){this.D=t}function d(t){return(0,r.SHA256)(t).dataView().getBigUint64(0,!1)}function _(e){return function(t,n){return null!=t&&null!=n&&(t=Number(t),n=Number(n),!isNaN(t))&&!isNaN(n)&&e(t,n)}}function b(e){return function(t,n){t=function(t,n){if(null==t||null==n||"string"!=typeof t||"string"!=typeof n)return null;t=s(t),n=s(n);if(0===t.length||0===n.length)return null;for(var e=t.split("."),r=n.split("."),i=0;i<Math.max(e.length,r.length);i++){void 0===e[i]&&(e[i]="0"),void 0===r[i]&&(r[i]="0");var u=Number(e[i]),o=Number(r[i]);if("number"!=typeof u||"number"!=typeof o||isNaN(u)||isNaN(o))return null;if(u<o)return-1;if(o<u)return 1}return 0}(t,n);return null!=t&&e(t)}}function s(t){var n=t.indexOf("-");return 0<=n?t.substr(0,n):t}function p(e,r){return function(t,n){return null!=t&&null!=n&&(e?r(String(t).toLowerCase(),String(n).toLowerCase()):r(String(t),String(n)))}}function y(i){return function(t,n){if(null==t||null==n)return!1;try{var e=new Date(t),r=(isNaN(e.getTime())&&(e=new Date(Number(t))),new Date(n));return isNaN(r.getTime())&&(r=new Date(Number(n))),!isNaN(e.getTime())&&!isNaN(r.getTime())&&i(e,r)}catch(t){return!1}}}function w(t,n,e){if(Array.isArray(n))for(var r=0;r<n.length;r++)if(e(t,n[r]))return!0;return!1}function a(t){return null!=t&&"object"==typeof t}u.prototype.checkGate=function(t,n){var e=null==(e=this.D.values)?void 0:e.feature_gates.find(function(t){return t.name===n});return this.A(t,e)},u.prototype.getConfig=function(t,n){var e=null==(e=this.D.values)?void 0:e.dynamic_configs.find(function(t){return t.name===n});return this.A(t,e)},u.prototype.getLayer=function(t,n){var e=null==(e=this.D.values)?void 0:e.layer_configs.find(function(t){return t.name===n});return this.A(t,e)},u.prototype.A=function(t,n){return n?(t=this.G(t,n),i(i({},t),{evaluation_details:{time:Date.now(),reason:"Network"}})):c({evaluation_details:{time:Date.now(),reason:"Unrecognized"}})},u.prototype.G=function(t,n){var e=a(n.defaultValue)?n.defaultValue:void 0;if(!n.enabled)return c({rule_id:"disabled",json_value:e});var r=[];try{for(var i=0;i<n.rules.length;i++){var u,o=n.rules[i],s=this.P(t,o),r=r.concat(s.secondary_exposures);if(!0===s.value)return this.C(t,o,r)||c({value:u=this.V(t,o,n),rule_id:s.rule_id,secondary_exposures:r,json_value:u?s.json_value:e,explicit_parameters:n.explicitParameters,config_delegate:s.config_delegate,is_experiment_group:s.is_experiment_group})}}catch(t){if(t instanceof v.StatsigUnsupportedEvaluationError)return c({rule_id:"default",secondary_exposures:r,json_value:e,explicit_parameters:n.explicitParameters,evaluation_details:{reason:"Unsupported",time:Date.now()}});throw t}return c({rule_id:"default",secondary_exposures:r,json_value:e,explicit_parameters:n.explicitParameters})},u.prototype.C=function(t,n,e){var r;return null!=n.configDelegate&&(r=null==(r=this.D.values)?void 0:r.dynamic_configs.find(function(t){return t.name===n.configDelegate}))?(t=this.G(t,r),i(i({},t),{conifg_delegate:n.configDelegate,undelegated_secondary_exposures:e})):null},u.prototype.V=function(t,n,e){return 100===n.passPercentage||0!==n.passPercentage&&(t=d(e.salt+"."+(null!=(e=n.salt)?e:n.id)+"."+(null!=(e=this.F(t,n.idType))?e:"")),Number(t%BigInt(1e4))<100*n.passPercentage)},u.prototype.F=function(t,n){var e;return"string"==typeof n&&"userid"!==n.toLowerCase()?null!=(e=null==(e=null==t?void 0:t.customIDs)?void 0:e[n])?e:null==(e=null==t?void 0:t.customIDs)?void 0:e[n.toLowerCase()]:null==t?void 0:t.userID},u.prototype.P=function(t,n){for(var e=[],r=!0,i=0,u=n.conditions;i<u.length;i++){var o=u[i],o=this.J(t,o);o.passes||(r=!1),o.exposures&&(e=e.concat(o.exposures))}return c({value:r,rule_id:n.id,secondary_exposures:e,json_value:a(n.returnValue)?n.returnValue:void 0,group_name:n.groupName,is_experiment_group:null!=(n=n.isExperimentGroup)&&n})},u.prototype.J=function(t,n){var e,r,i=null,u=n.field,o=n.targetValue,s=n.idType;switch(n.type.toLowerCase()){case"public":return{passes:!0};case"fail_gate":case"pass_gate":var c=this.A(t,null==(c=this.D.values)?void 0:c.feature_gates.find(function(t){return t.name===String(o)})),i=null==c?void 0:c.value,a=null!=(a=null==c?void 0:c.secondary_exposures)?a:[];return a.push({gate:String(o),gateValue:String(i),ruleID:null!=(c=null==c?void 0:c.rule_id)?c:""}),{passes:"fail_gate"===n.type.toLowerCase()?!i:!!i,exposures:a};case"ip_based":case"ua_based":throw new v.StatsigUnsupportedEvaluationError(n.type);case"user_field":i=function(t,n){var e;if(null==n||"object"!=typeof t||null==t)return null;var r=t;return null!=(e=null!=(e=null!=(e=null!=(e=null!=(e=r[n])?e:r[n.toLowerCase()])?e:null==(r=null==t?void 0:t.custom)?void 0:r[n])?e:null==(r=null==t?void 0:t.custom)?void 0:r[n.toLowerCase()])?e:null==(r=null==t?void 0:t.privateAttributes)?void 0:r[n])?e:null==(r=null==t?void 0:t.privateAttributes)?void 0:r[n.toLowerCase()]}(t,u);break;case"environment_field":c=t,i=null==(a=u)?null:(c=c.statsigEnvironment,a=a,null!=c&&(r=a.toLowerCase(),void 0!==(a=Object.keys(c).find(function(t){return t.toLowerCase()===r})))?c[a]:void 0);break;case"current_time":i=Date.now();break;case"user_bucket":var f=d(null!==(f=String(null!=(f=null==(f=n.additionalValues)?void 0:f.salt)?f:"")+"."+this.F(t,s))?f:"");i=Number(f%BigInt(1e3));break;case"unit_id":i=this.F(t,s);break;default:throw new v.StatsigUnsupportedEvaluationError(n.type)}var l=null==(e=n.operator)?void 0:e.toLowerCase(),h=!1;switch(l){case"gt":h=_(function(t,n){return n<t})(i,o);break;case"gte":h=_(function(t,n){return n<=t})(i,o);break;case"lt":h=_(function(t,n){return t<n})(i,o);break;case"lte":h=_(function(t,n){return t<=n})(i,o);break;case"version_gt":h=b(function(t){return 0<t})(i,o);break;case"version_gte":h=b(function(t){return 0<=t})(i,o);break;case"version_lt":h=b(function(t){return t<0})(i,o);break;case"version_lte":h=b(function(t){return t<=0})(i,o);break;case"version_eq":h=b(function(t){return 0===t})(i,o);break;case"version_neq":h=b(function(t){return 0!==t})(i,o);break;case"any":h=w(i,o,p(!0,function(t,n){return t===n}));break;case"none":h=!w(i,o,p(!0,function(t,n){return t===n}));break;case"any_case_sensitive":h=w(i,o,p(!1,function(t,n){return t===n}));break;case"none_case_sensitive":h=!w(i,o,p(!1,function(t,n){return t===n}));break;case"str_starts_with_any":h=w(i,o,p(!0,function(t,n){return t.startsWith(n)}));break;case"str_ends_with_any":h=w(i,o,p(!0,function(t,n){return t.endsWith(n)}));break;case"str_contains_any":h=w(i,o,p(!0,function(t,n){return t.includes(n)}));break;case"str_contains_none":h=!w(i,o,p(!0,function(t,n){return t.includes(n)}));break;case"str_matches":try{h=String(i).length<1e3&&new RegExp(o).test(String(i))}catch(t){h=!1}break;case"eq":h=i==o;break;case"neq":h=i!=o;break;case"before":h=y(function(t,n){return t<n})(i,o);break;case"after":h=y(function(t,n){return n<t})(i,o);break;case"on":h=y(function(t,n){return null!=t&&t.setHours(0,0,0,0),null!=n&&n.setHours(0,0,0,0),(null==t?void 0:t.getTime())===(null==n?void 0:n.getTime())})(i,o);break;default:throw new v.StatsigUnsupportedEvaluationError(l)}return{passes:h}},n.default=u},630:function(t,n,e){var r,i,u=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}))(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),e=(Object.defineProperty(n,"__esModule",{value:!0}),e(996)),e=(i=e.NetworkCore,u(o,i),o.prototype.fetchConfigSpecs=function(){return this.get({url:this.K,timeoutMs:2e3})},o);function o(t,n){void 0===n&&(n=null);var e=i.call(this,t)||this,r=null!=(r=null==n?void 0:n.baseDownloadConfigSpecsUrl)?r:"https://api.statsigcdn.com/v1/download_config_specs";return e.B=null!=(n=null==n?void 0:n.api)?n:"https://api.statsig.com/v1",e.K="".concat(r,"/").concat(t,".json"),e}n.default=e},53:function(t,n,e){var r,s=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}))(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),c=this&&this.__assign||function(){return(c=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},a=this&&this.__esDecorate||function(t,n,e,r,i,u){function o(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var s,c=r.kind,a="getter"===c?"get":"setter"===c?"set":"value",t=!n&&t?r.static?t:t.prototype:null,f=n||(t?Object.getOwnPropertyDescriptor(t,r.name):{}),l=!1,h=e.length-1;0<=h;h--){var v,d={};for(v in r)d[v]="access"===v?{}:r[v];for(v in r.access)d.access[v]=r.access[v];d.addInitializer=function(t){if(l)throw new TypeError("Cannot add initializers after decoration has completed");u.push(o(t||null))};var _=(0,e[h])("accessor"===c?{get:f.get,set:f.set}:f[a],d);if("accessor"===c){if(void 0!==_){if(null===_||"object"!=typeof _)throw new TypeError("Object expected");(s=o(_.get))&&(f.get=s),(s=o(_.set))&&(f.set=s),(s=o(_.init))&&i.unshift(s)}}else(s=o(_))&&("field"===c?i.unshift(s):f[a]=s)}t&&Object.defineProperty(t,r.name,f),l=!0},f=this&&this.__runInitializers||function(t,n,e){for(var r=2<arguments.length,i=0;i<n.length;i++)e=r?n[i].call(t,e):n[i].call(t);return r?e:void 0},l=this&&this.__awaiter||function(t,o,s,c){return new(s=s||Promise)(function(e,n){function r(t){try{u(c.next(t))}catch(t){n(t)}}function i(t){try{u(c.throw(t))}catch(t){n(t)}}function u(t){var n;t.done?e(t.value):((n=t.value)instanceof s?n:new s(function(t){t(n)})).then(r,i)}u((c=c.apply(t,o||[])).next())})},h=this&&this.__generator||function(r,i){var u,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function t(e){return function(t){var n=[e,t];if(u)throw new TypeError("Generator is already executing.");for(;c=a&&n[a=0]?0:c;)try{if(u=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,o=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3]))c.label=n[1];else if(6===n[0]&&c.label<s[1])c.label=s[1],s=n;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(n)}}n=i.call(r,c)}catch(t){n=[6,t],o=0}finally{u=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}},v=this&&this.__setFunctionName||function(t,n,e){return"symbol"==typeof n&&(n=n.description?"[".concat(n.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:e?"".concat(e," ",n):n})},d=(Object.defineProperty(n,"__esModule",{value:!0}),e(996)),_=e(204),b=e(630),p=e(720),e=function(){var t,i,n,e=[d.MonitoredClass],r=[],u=d.StatsigClientBase;s(o,i=u),o.prototype.initialize=function(){return l(this,void 0,void 0,function(){var n;return h(this,function(t){switch(t.label){case 0:return window.statsigConfigSpecs?(this.D.setValues(window.statsigConfigSpecs),this.setStatus("Provided"),[2]):(this.setStatus("Loading"),[4,this.u.fetchConfigSpecs()]);case 1:return(n=t.sent())?(n.has_updates&&this.D.setValues(n),this.setStatus("Network")):this.setStatus("Error"),[2]}})})},o.prototype.shutdown=function(){return l(this,void 0,void 0,function(){return h(this,function(t){return[2,Promise.resolve()]})})},o.prototype.checkGate=function(t,n){return this.getFeatureGate(t,n).value},o.prototype.getFeatureGate=function(t,n){t=this.L.checkGate(t,n);return{name:n,ruleID:t.rule_id,value:t.value}},o.prototype.getDynamicConfig=function(t,n){t=this.L.getConfig(t,n);return{name:n,ruleID:t.rule_id,value:t.json_value}},o.prototype.getExperiment=function(t,n){return this.getDynamicConfig(t,n)},o.prototype.getLayer=function(t,n){var t=this.L.getLayer(t,n),e=t.json_value;return{name:n,ruleID:t.rule_id,getValue:function(t){return null!=(t=e[t])?t:null}}},o.prototype.logEvent=function(t,n){this.M.enqueue(c(c({},n),{user:t,time:Date.now()}))},t=o;function o(t,n){var e=this,r=new b.default(t,n=void 0===n?null:n);return(e=i.call(this,t,r,n)||this).o=null!=n?n:{},e.u=r,e.M=new d.EventLogger(e.u,n),e.D=new p.default,e.L=new _.default(e.D),e}return v(t,"OnDeviceEvaluationsClient"),n="function"==typeof Symbol&&Symbol.metadata?Object.create(null!=(n=u[Symbol.metadata])?n:null):void 0,a(null,u={value:t},e,{kind:"class",name:t.name,metadata:n},null,r),t=u.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),f(t,r),t}();n.default=e},720:(t,n)=>{function e(){this.values=null}Object.defineProperty(n,"__esModule",{value:!0}),e.prototype.setValues=function(t){this.values=t},n.default=e},596:(t,n,e)=>{Object.defineProperty(n,"__esModule",{value:!0});e(996).StatsigMetadataProvider.add({sdkType:"js-on-device-evaluations-client"})},355:function(t,n,e){var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},i=(Object.defineProperty(n,"__esModule",{value:!0}),n.OnDeviceEvaluationsClient=void 0,e(53));n.OnDeviceEvaluationsClient=i.default,e(596),__STATSIG__=r(r({},__STATSIG__),{OnDeviceEvaluationsClient:i.default})},299:(t,n,e)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SHA256=void 0;var r=e(908);Object.defineProperty(n,"SHA256",{enumerable:!0,get:function(){return r.SHA256}})},908:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SHA256=void 0,n.SHA256=function(t){return(new r).update(t)};var e=[-2147483648,8388608,32768,128],o=[24,16,8,0],b=[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],r=(i.prototype.update=function(t){if(!this.finalized){if("string"!=typeof t)throw new Error('Must be of type "string"');for(var n,e,r=0,i=t.length,u=this.blocks;r<i;){for(this.hashed&&(this.hashed=!1,u[0]=this.block,u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),e=this.start;r<i&&e<64;++r)(n=t.charCodeAt(r))<128?u[e>>2]|=n<<o[3&e++]:(n<2048?u[e>>2]|=(192|n>>6)<<o[3&e++]:(n<55296||57344<=n?u[e>>2]|=(224|n>>12)<<o[3&e++]:(n=65536+((1023&n)<<10|1023&t.charCodeAt(++r)),u[e>>2]|=(240|n>>18)<<o[3&e++],u[e>>2]|=(128|n>>12&63)<<o[3&e++]),u[e>>2]|=(128|n>>6&63)<<o[3&e++]),u[e>>2]|=(128|63&n)<<o[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.block=u[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},i.prototype.finalize=function(){var t,n;this.finalized||(this.finalized=!0,t=this.blocks,n=this.lastByteIndex,t[16]=this.block,t[n>>2]|=e[3&n],this.block=t[16],56<=n&&(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())},i.prototype.hash=function(){for(var t,n,e,r,i,u,o=this.blocks,s=this.h0,c=this.h1,a=this.h2,f=this.h3,l=this.h4,h=this.h5,v=this.h6,d=this.h7,_=16;_<64;++_)t=((n=o[_-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,n=o[_-2],o[_]=o[_-16]+t+o[_-7]+((n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10)<<0;for(u=c&a,_=0;_<64;_+=4)this.first?(d=(n=o[0]-210244248)-1521486534<<0,f=n+143694565<<0,this.first=!(e=704751109)):(d=f+(n=d+((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&h^~l&v)+b[_]+o[_])<<0,f=n+((t=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+((e=s&c)^s&a^u))<<0),v=a+(n=v+((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&l^~d&h)+b[_+1]+o[_+1])<<0,a=n+((t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+((r=f&s)^f&c^e))<<0,h=c+(n=h+((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&d^~v&l)+b[_+2]+o[_+2])<<0,c=n+((t=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+((i=a&f)^a&s^r))<<0,l=s+(n=l+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&v^~h&d)+b[_+3]+o[_+3])<<0,s=n+((t=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+((u=c&a)^c&f^i))<<0;this.h0=this.h0+s<<0,this.h1=this.h1+c<<0,this.h2=this.h2+a<<0,this.h3=this.h3+f<<0,this.h4=this.h4+l<<0,this.h5=this.h5+h<<0,this.h6=this.h6+v<<0,this.h7=this.h7+d<<0},i.prototype.arrayBuffer=function(){return this.U().buffer},i.prototype.dataView=function(){return this.U().dataView},i.prototype.U=function(){this.finalize();var t=new ArrayBuffer(32),n=new DataView(t);return n.setUint32(0,this.h0),n.setUint32(4,this.h1),n.setUint32(8,this.h2),n.setUint32(12,this.h3),n.setUint32(16,this.h4),n.setUint32(20,this.h5),n.setUint32(24,this.h6),n.setUint32(28,this.h7),{dataView:n,buffer:t}},i);function i(){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}}},r={};function i(t){var n=r[t];return void 0!==n||(n=r[t]={exports:{}},e[t].call(n.exports,n,n.exports,i)),n.exports}return i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i(355).default})());
{
"name": "@sigstat/on-device-evaluations",
"version": "0.0.6",
"version": "0.0.7",
"dependencies": {

@@ -5,0 +5,0 @@ "@sigstat/core": "*",

@@ -1,2 +0,2 @@

import { StatsigUser } from '@sigstat/core';
import { StatsigUserInternal } from '@sigstat/core';
import SpecStore from './SpecStore';

@@ -23,5 +23,5 @@ export type EvaluationReason = 'Network' | 'LocalOverride' | 'Unrecognized' | 'Uninitialized' | 'Bootstrap' | 'DataAdapter' | 'Unsupported';

constructor(_store: SpecStore);
checkGate(user: StatsigUser, gateName: string): ConfigEvaluation;
getConfig(user: StatsigUser, configName: string): ConfigEvaluation;
getLayer(user: StatsigUser, layerName: string): ConfigEvaluation;
checkGate(user: StatsigUserInternal, gateName: string): ConfigEvaluation;
getConfig(user: StatsigUserInternal, configName: string): ConfigEvaluation;
getLayer(user: StatsigUserInternal, layerName: string): ConfigEvaluation;
private _evalConfigSpec;

@@ -28,0 +28,0 @@ private _eval;

@@ -49,3 +49,3 @@ "use strict";

var _a;
var layerDef = (_a = this._store.values) === null || _a === void 0 ? void 0 : _a.dynamic_configs.find(function (layer) { return layer.name === layerName; });
var layerDef = (_a = this._store.values) === null || _a === void 0 ? void 0 : _a.layer_configs.find(function (layer) { return layer.name === layerName; });
return this._evalConfigSpec(user, layerDef);

@@ -69,3 +69,3 @@ };

Evaluator.prototype._eval = function (user, config) {
var defaultValue = isRecord(config.defaultValue)
var defaultValue = _isRecord(config.defaultValue)
? config.defaultValue

@@ -146,3 +146,3 @@ : undefined;

}
var hash = computeUserHash(config.salt +
var hash = _computeUserHash(config.salt +
'.' +

@@ -179,3 +179,3 @@ ((_a = rule.salt) !== null && _a !== void 0 ? _a : rule.id) +

secondary_exposures: secondaryExposures,
json_value: isRecord(rule.returnValue) ? rule.returnValue : undefined,
json_value: _isRecord(rule.returnValue) ? rule.returnValue : undefined,
group_name: rule.groupName,

@@ -216,6 +216,6 @@ is_experiment_group: (_a = rule.isExperimentGroup) !== null && _a !== void 0 ? _a : false,

case 'user_field':
value = getFromUser(user, field);
value = _getFromUser(user, field);
break;
case 'environment_field':
value = getFromEnvironment(user, field);
value = _getFromEnvironment(user, field);
break;

@@ -227,3 +227,3 @@ case 'current_time':

var salt = String((_e = (_d = condition.additionalValues) === null || _d === void 0 ? void 0 : _d['salt']) !== null && _e !== void 0 ? _e : '');
var userHash = computeUserHash((_f = salt + '.' + this._getUnitID(user, idType)) !== null && _f !== void 0 ? _f : '');
var userHash = _computeUserHash((_f = salt + '.' + this._getUnitID(user, idType)) !== null && _f !== void 0 ? _f : '');
value = Number(userHash % BigInt(USER_BUCKET_COUNT));

@@ -243,57 +243,57 @@ break;

case 'gt':
evalResult = numberCompare(function (a, b) { return a > b; })(value, target);
evalResult = _numberCompare(function (a, b) { return a > b; })(value, target);
break;
case 'gte':
evalResult = numberCompare(function (a, b) { return a >= b; })(value, target);
evalResult = _numberCompare(function (a, b) { return a >= b; })(value, target);
break;
case 'lt':
evalResult = numberCompare(function (a, b) { return a < b; })(value, target);
evalResult = _numberCompare(function (a, b) { return a < b; })(value, target);
break;
case 'lte':
evalResult = numberCompare(function (a, b) { return a <= b; })(value, target);
evalResult = _numberCompare(function (a, b) { return a <= b; })(value, target);
break;
// version
case 'version_gt':
evalResult = versionCompareHelper(function (result) { return result > 0; })(value, target);
evalResult = _versionCompareHelper(function (result) { return result > 0; })(value, target);
break;
case 'version_gte':
evalResult = versionCompareHelper(function (result) { return result >= 0; })(value, target);
evalResult = _versionCompareHelper(function (result) { return result >= 0; })(value, target);
break;
case 'version_lt':
evalResult = versionCompareHelper(function (result) { return result < 0; })(value, target);
evalResult = _versionCompareHelper(function (result) { return result < 0; })(value, target);
break;
case 'version_lte':
evalResult = versionCompareHelper(function (result) { return result <= 0; })(value, target);
evalResult = _versionCompareHelper(function (result) { return result <= 0; })(value, target);
break;
case 'version_eq':
evalResult = versionCompareHelper(function (result) { return result === 0; })(value, target);
evalResult = _versionCompareHelper(function (result) { return result === 0; })(value, target);
break;
case 'version_neq':
evalResult = versionCompareHelper(function (result) { return result !== 0; })(value, target);
evalResult = _versionCompareHelper(function (result) { return result !== 0; })(value, target);
break;
// array
case 'any':
evalResult = arrayAny(value, target, stringCompare(true, function (a, b) { return a === b; }));
evalResult = _arrayAny(value, target, _stringCompare(true, function (a, b) { return a === b; }));
break;
case 'none':
evalResult = !arrayAny(value, target, stringCompare(true, function (a, b) { return a === b; }));
evalResult = !_arrayAny(value, target, _stringCompare(true, function (a, b) { return a === b; }));
break;
case 'any_case_sensitive':
evalResult = arrayAny(value, target, stringCompare(false, function (a, b) { return a === b; }));
evalResult = _arrayAny(value, target, _stringCompare(false, function (a, b) { return a === b; }));
break;
case 'none_case_sensitive':
evalResult = !arrayAny(value, target, stringCompare(false, function (a, b) { return a === b; }));
evalResult = !_arrayAny(value, target, _stringCompare(false, function (a, b) { return a === b; }));
break;
// string
case 'str_starts_with_any':
evalResult = arrayAny(value, target, stringCompare(true, function (a, b) { return a.startsWith(b); }));
evalResult = _arrayAny(value, target, _stringCompare(true, function (a, b) { return a.startsWith(b); }));
break;
case 'str_ends_with_any':
evalResult = arrayAny(value, target, stringCompare(true, function (a, b) { return a.endsWith(b); }));
evalResult = _arrayAny(value, target, _stringCompare(true, function (a, b) { return a.endsWith(b); }));
break;
case 'str_contains_any':
evalResult = arrayAny(value, target, stringCompare(true, function (a, b) { return a.includes(b); }));
evalResult = _arrayAny(value, target, _stringCompare(true, function (a, b) { return a.includes(b); }));
break;
case 'str_contains_none':
evalResult = !arrayAny(value, target, stringCompare(true, function (a, b) { return a.includes(b); }));
evalResult = !_arrayAny(value, target, _stringCompare(true, function (a, b) { return a.includes(b); }));
break;

@@ -324,9 +324,9 @@ case 'str_matches':

case 'before':
evalResult = dateCompare(function (a, b) { return a < b; })(value, target);
evalResult = _dateCompare(function (a, b) { return a < b; })(value, target);
break;
case 'after':
evalResult = dateCompare(function (a, b) { return a > b; })(value, target);
evalResult = _dateCompare(function (a, b) { return a > b; })(value, target);
break;
case 'on':
evalResult = dateCompare(function (a, b) {
evalResult = _dateCompare(function (a, b) {
a === null || a === void 0 ? void 0 : a.setHours(0, 0, 0, 0);

@@ -348,13 +348,13 @@ b === null || b === void 0 ? void 0 : b.setHours(0, 0, 0, 0);

exports.default = Evaluator;
function computeUserHash(userHash) {
function _computeUserHash(userHash) {
var sha256 = (0, sha256_1.SHA256)(userHash);
return sha256.dataView().getBigUint64(0, false);
}
function getFromEnvironment(user, field) {
function _getFromEnvironment(user, field) {
if (field == null) {
return null;
}
return getParameterCaseInsensitive(user.statsigEnvironment, field);
return _getParameterCaseInsensitive(user.statsigEnvironment, field);
}
function getParameterCaseInsensitive(object, key) {
function _getParameterCaseInsensitive(object, key) {
if (object == null) {

@@ -370,3 +370,3 @@ return undefined;

}
function getFromUser(user, field) {
function _getFromUser(user, field) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;

@@ -379,3 +379,3 @@ if (field == null || typeof user !== 'object' || user == null) {

}
function numberCompare(fn) {
function _numberCompare(fn) {
return function (a, b) {

@@ -393,5 +393,5 @@ if (a == null || b == null) {

}
function versionCompareHelper(fn) {
function _versionCompareHelper(fn) {
return function (a, b) {
var comparison = versionCompare(a, b);
var comparison = _versionCompare(a, b);
if (comparison == null) {

@@ -406,3 +406,3 @@ return false;

// returns false if any of the version strings is not valid.
function versionCompare(first, second) {
function _versionCompare(first, second) {
if (first == null ||

@@ -414,4 +414,4 @@ second == null ||

}
var version1 = removeVersionExtension(first);
var version2 = removeVersionExtension(second);
var version1 = _removeVersionExtension(first);
var version2 = _removeVersionExtension(second);
if (version1.length === 0 || version2.length === 0) {

@@ -446,3 +446,3 @@ return null;

}
function removeVersionExtension(version) {
function _removeVersionExtension(version) {
var hyphenIndex = version.indexOf('-');

@@ -454,3 +454,3 @@ if (hyphenIndex >= 0) {

}
function stringCompare(ignoreCase, fn) {
function _stringCompare(ignoreCase, fn) {
return function (a, b) {

@@ -465,3 +465,3 @@ if (a == null || b == null) {

}
function dateCompare(fn) {
function _dateCompare(fn) {
return function (a, b) {

@@ -489,3 +489,3 @@ if (a == null || b == null) {

}
function arrayAny(value, array, fn) {
function _arrayAny(value, array, fn) {
if (!Array.isArray(array)) {

@@ -501,5 +501,5 @@ return false;

}
function isRecord(obj) {
function _isRecord(obj) {
return obj != null && typeof obj === 'object';
}
//# sourceMappingURL=Evaluator.js.map
import OnDeviceEvaluationsClient from './OnDeviceEvaluationsClient';
import './StatsigMetadataAdditions';
export { OnDeviceEvaluationsClient };

@@ -17,3 +17,4 @@ "use strict";

exports.OnDeviceEvaluationsClient = OnDeviceEvaluationsClient_1.default;
require("./StatsigMetadataAdditions");
__STATSIG__ = __assign(__assign({}, __STATSIG__), { OnDeviceEvaluationsClient: OnDeviceEvaluationsClient_1.default });
//# sourceMappingURL=index.js.map

@@ -6,4 +6,5 @@ import { NetworkCore } from '@sigstat/core';

private _downloadConfigSpecsUrl;
private _mainApi;
constructor(sdkKey: string, options?: StatsigOptions | null);
fetchConfigSpecs(): Promise<DownloadConfigSpecsResponse>;
fetchConfigSpecs(): Promise<DownloadConfigSpecsResponse | null>;
}

@@ -19,2 +19,3 @@ "use strict";

var core_1 = require("@sigstat/core");
var DEFAULT_SPECS_URL = 'https://api.statsigcdn.com/v1/download_config_specs';
var StatsigNetwork = /** @class */ (function (_super) {

@@ -24,11 +25,14 @@ __extends(StatsigNetwork, _super);

if (options === void 0) { options = null; }
var _a;
var _this = _super.call(this, sdkKey, (_a = options === null || options === void 0 ? void 0 : options.api) !== null && _a !== void 0 ? _a : 'https://api.statsig.com/v1') || this;
_this._downloadConfigSpecsUrl =
// options.baseDownloadConfigSpecsUrl ??
"https://api.statsigcdn.com/v1/download_config_specs/".concat(sdkKey, ".json");
var _a, _b;
var _this = _super.call(this, sdkKey) || this;
var base = (_a = options === null || options === void 0 ? void 0 : options.baseDownloadConfigSpecsUrl) !== null && _a !== void 0 ? _a : DEFAULT_SPECS_URL;
_this._mainApi = (_b = options === null || options === void 0 ? void 0 : options.api) !== null && _b !== void 0 ? _b : 'https://api.statsig.com/v1';
_this._downloadConfigSpecsUrl = "".concat(base, "/").concat(sdkKey, ".json");
return _this;
}
StatsigNetwork.prototype.fetchConfigSpecs = function () {
return this._sendGetRequest(this._downloadConfigSpecsUrl, 2000);
return this.get({
url: this._downloadConfigSpecsUrl,
timeoutMs: 2000,
});
};

@@ -35,0 +39,0 @@ return StatsigNetwork;

@@ -22,3 +22,3 @@ import { DynamicConfig, Experiment, FeatureGate, Layer, OnDeviceEvaluationsInterface, StatsigClientBase, StatsigEvent, StatsigUser } from '@sigstat/core';

getLayer(user: StatsigUser, name: string): Layer;
logEvent(_user: StatsigUser, _event: StatsigEvent): void;
logEvent(user: StatsigUser, event: StatsigEvent): void;
}

@@ -17,2 +17,47 @@ "use strict";

})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -54,2 +99,6 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -60,87 +109,105 @@ var core_1 = require("@sigstat/core");

var SpecStore_1 = require("./SpecStore");
var OnDeviceEvaluationsClient = /** @class */ (function (_super) {
__extends(OnDeviceEvaluationsClient, _super);
function OnDeviceEvaluationsClient(sdkKey, options) {
var _this = this;
if (options === void 0) { options = null; }
var network = new Network_1.default(sdkKey, options);
_this = _super.call(this, sdkKey, network) || this;
_this._options = options !== null && options !== void 0 ? options : {};
_this._network = network;
_this._logger = new core_1.EventLogger(_this._network);
_this._store = new SpecStore_1.default();
_this._evaluator = new Evaluator_1.default(_this._store);
return _this;
}
OnDeviceEvaluationsClient.prototype.initialize = function () {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (window.statsigConfigSpecs) {
this._store.setValues(window.statsigConfigSpecs);
this.setStatus('Bootstrap');
var OnDeviceEvaluationsClient = function () {
var _classDecorators = [core_1.MonitoredClass];
var _classDescriptor;
var _classExtraInitializers = [];
var _classThis;
var _classSuper = core_1.StatsigClientBase;
var OnDeviceEvaluationsClient = _classThis = /** @class */ (function (_super) {
__extends(OnDeviceEvaluationsClient_1, _super);
function OnDeviceEvaluationsClient_1(sdkKey, options) {
if (options === void 0) { options = null; }
var _this = this;
var network = new Network_1.default(sdkKey, options);
_this = _super.call(this, sdkKey, network, options) || this;
_this._options = options !== null && options !== void 0 ? options : {};
_this._network = network;
_this._logger = new core_1.EventLogger(_this._network, options);
_this._store = new SpecStore_1.default();
_this._evaluator = new Evaluator_1.default(_this._store);
return _this;
}
OnDeviceEvaluationsClient_1.prototype.initialize = function () {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (window.statsigConfigSpecs) {
this._store.setValues(window.statsigConfigSpecs);
this.setStatus('Provided');
return [2 /*return*/];
}
this.setStatus('Loading');
return [4 /*yield*/, this._network.fetchConfigSpecs()];
case 1:
response = _a.sent();
if (!response) {
this.setStatus('Error');
return [2 /*return*/];
}
if (response.has_updates) {
this._store.setValues(response);
}
this.setStatus('Network');
return [2 /*return*/];
}
this.setStatus('Loading');
return [4 /*yield*/, this._network.fetchConfigSpecs()];
case 1:
response = _a.sent();
if (response.has_updates) {
this._store.setValues(response);
this.setStatus('Network');
}
else {
this.setStatus('Error');
}
return [2 /*return*/];
}
}
});
});
});
};
OnDeviceEvaluationsClient.prototype.shutdown = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, Promise.resolve()];
};
OnDeviceEvaluationsClient_1.prototype.shutdown = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, Promise.resolve()];
});
});
});
};
OnDeviceEvaluationsClient.prototype.checkGate = function (user, name) {
return this.getFeatureGate(user, name).value;
};
OnDeviceEvaluationsClient.prototype.getFeatureGate = function (user, name) {
var result = this._evaluator.checkGate(user, name);
return {
name: name,
ruleID: result.rule_id,
value: result.value,
};
};
OnDeviceEvaluationsClient.prototype.getDynamicConfig = function (user, name) {
var result = this._evaluator.getConfig(user, name);
return {
name: name,
ruleID: result.rule_id,
value: result.json_value,
OnDeviceEvaluationsClient_1.prototype.checkGate = function (user, name) {
return this.getFeatureGate(user, name).value;
};
};
OnDeviceEvaluationsClient.prototype.getExperiment = function (user, name) {
return this.getDynamicConfig(user, name);
};
OnDeviceEvaluationsClient.prototype.getLayer = function (user, name) {
var result = this._evaluator.getLayer(user, name);
var values = result.json_value;
return {
name: name,
ruleID: result.rule_id,
getValue: function (param) { var _a; return (_a = values[param]) !== null && _a !== void 0 ? _a : null; },
OnDeviceEvaluationsClient_1.prototype.getFeatureGate = function (user, name) {
var result = this._evaluator.checkGate(user, name);
return {
name: name,
ruleID: result.rule_id,
value: result.value,
};
};
};
OnDeviceEvaluationsClient.prototype.logEvent = function (_user, _event) {
throw new Error('Method not implemented.');
};
return OnDeviceEvaluationsClient;
}(core_1.StatsigClientBase));
OnDeviceEvaluationsClient_1.prototype.getDynamicConfig = function (user, name) {
var result = this._evaluator.getConfig(user, name);
return {
name: name,
ruleID: result.rule_id,
value: result.json_value,
};
};
OnDeviceEvaluationsClient_1.prototype.getExperiment = function (user, name) {
return this.getDynamicConfig(user, name);
};
OnDeviceEvaluationsClient_1.prototype.getLayer = function (user, name) {
var result = this._evaluator.getLayer(user, name);
var values = result.json_value;
return {
name: name,
ruleID: result.rule_id,
getValue: function (param) { var _a; return (_a = values[param]) !== null && _a !== void 0 ? _a : null; },
};
};
OnDeviceEvaluationsClient_1.prototype.logEvent = function (user, event) {
this._logger.enqueue(__assign(__assign({}, event), { user: user, time: Date.now() }));
};
return OnDeviceEvaluationsClient_1;
}(_classSuper));
__setFunctionName(_classThis, "OnDeviceEvaluationsClient");
(function () {
var _a;
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
OnDeviceEvaluationsClient = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return OnDeviceEvaluationsClient = _classThis;
}();
exports.default = OnDeviceEvaluationsClient;
//# sourceMappingURL=OnDeviceEvaluationsClient.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc