UNPKG

@atlassian/aui

Version:

Atlassian User Interface library

15 lines 162 kB
/*!! * @atlassian/aui - Atlassian User Interface library * @version v9.13.2 * @link https://aui.atlassian.com * @license Apache-2.0 * @author Atlassian Pty Ltd. */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("@atlassian/aui",[],t):"object"==typeof exports?exports["@atlassian/aui"]=t():(e.AJS=e.AJS||{},e.AJS.DesignTokens=t())}(window,(()=>(()=>{var e,t,r={853:(e,t,r)=>{var n; /*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. */!function(o){var a=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(){this._events={},this._conf&&s.call(this,this._conf)}function s(e){e?(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),this._maxListeners=e.maxListeners!==o?e.maxListeners:10,e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this.newListener=e.newListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),this.wildcard&&(this.listenerTree={})):this._maxListeners=10}function c(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}function l(e){this._events={},this.newListener=!1,this.verboseMemoryLeak=!1,s.call(this,e)}function u(e,t,r,n){if(!r)return[];var o,a,i,s,c,l,d,h=[],p=t.length,f=t[n],g=t[n+1];if(n===p&&r._listeners){if("function"==typeof r._listeners)return e&&e.push(r._listeners),[r];for(o=0,a=r._listeners.length;o<a;o++)e&&e.push(r._listeners[o]);return[r]}if("*"===f||"**"===f||r[f]){if("*"===f){for(i in r)"_listeners"!==i&&r.hasOwnProperty(i)&&(h=h.concat(u(e,t,r[i],n+1)));return h}if("**"===f){for(i in(d=n+1===p||n+2===p&&"*"===g)&&r._listeners&&(h=h.concat(u(e,t,r,p))),r)"_listeners"!==i&&r.hasOwnProperty(i)&&("*"===i||"**"===i?(r[i]._listeners&&!d&&(h=h.concat(u(e,t,r[i],p))),h=h.concat(u(e,t,r[i],n))):h=i===g?h.concat(u(e,t,r[i],n+2)):h.concat(u(e,t,r[i],n)));return h}h=h.concat(u(e,t,r[f],n+1))}if((s=r["*"])&&u(e,t,s,n+1),c=r["**"])if(n<p)for(i in c._listeners&&u(e,t,c,p),c)"_listeners"!==i&&c.hasOwnProperty(i)&&(i===g?u(e,t,c[i],n+2):i===f?u(e,t,c[i],n+1):((l={})[i]=c[i],u(e,t,{"**":l},n+1)));else c._listeners?u(e,t,c,p):c["*"]&&c["*"]._listeners&&u(e,t,c["*"],p);return h}function d(e,t){for(var r=0,n=(e="string"==typeof e?e.split(this.delimiter):e.slice()).length;r+1<n;r++)if("**"===e[r]&&"**"===e[r+1])return;for(var a=this.listenerTree,i=e.shift();i!==o;){if(a[i]||(a[i]={}),a=a[i],0===e.length)return a._listeners?("function"==typeof a._listeners&&(a._listeners=[a._listeners]),a._listeners.push(t),!a._listeners.warned&&this._maxListeners>0&&a._listeners.length>this._maxListeners&&(a._listeners.warned=!0,c.call(this,a._listeners.length,i))):a._listeners=t,!0;i=e.shift()}return!0}l.EventEmitter2=l,l.prototype.delimiter=".",l.prototype.setMaxListeners=function(e){e!==o&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},l.prototype.event="",l.prototype.once=function(e,t){return this._once(e,t,!1)},l.prototype.prependOnceListener=function(e,t){return this._once(e,t,!0)},l.prototype._once=function(e,t,r){return this._many(e,1,t,r),this},l.prototype.many=function(e,t,r){return this._many(e,t,r,!1)},l.prototype.prependMany=function(e,t,r){return this._many(e,t,r,!0)},l.prototype._many=function(e,t,r,n){var o=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),r.apply(this,arguments)}return a._origin=r,this._on(e,a,n),o},l.prototype.emit=function(){this._events||i.call(this);var e=arguments[0];if("newListener"===e&&!this.newListener&&!this._events.newListener)return!1;var t,r,n,o,a,s=arguments.length;if(this._all&&this._all.length){if(a=this._all.slice(),s>3)for(t=new Array(s),o=0;o<s;o++)t[o]=arguments[o];for(n=0,r=a.length;n<r;n++)switch(this.event=e,s){case 1:a[n].call(this,e);break;case 2:a[n].call(this,e,arguments[1]);break;case 3:a[n].call(this,e,arguments[1],arguments[2]);break;default:a[n].apply(this,t)}}if(this.wildcard){a=[];var c="string"==typeof e?e.split(this.delimiter):e.slice();u.call(this,a,c,this.listenerTree,0)}else{if("function"==typeof(a=this._events[e])){switch(this.event=e,s){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(s-1),o=1;o<s;o++)t[o-1]=arguments[o];a.apply(this,t)}return!0}a&&(a=a.slice())}if(a&&a.length){if(s>3)for(t=new Array(s-1),o=1;o<s;o++)t[o-1]=arguments[o];for(n=0,r=a.length;n<r;n++)switch(this.event=e,s){case 1:a[n].call(this);break;case 2:a[n].call(this,arguments[1]);break;case 3:a[n].call(this,arguments[1],arguments[2]);break;default:a[n].apply(this,t)}return!0}if(!this._all&&"error"===e)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},l.prototype.emitAsync=function(){this._events||i.call(this);var e=arguments[0];if("newListener"===e&&!this.newListener&&!this._events.newListener)return Promise.resolve([!1]);var t,r,n,o,a,s=[],c=arguments.length;if(this._all){if(c>3)for(t=new Array(c),o=1;o<c;o++)t[o]=arguments[o];for(n=0,r=this._all.length;n<r;n++)switch(this.event=e,c){case 1:s.push(this._all[n].call(this,e));break;case 2:s.push(this._all[n].call(this,e,arguments[1]));break;case 3:s.push(this._all[n].call(this,e,arguments[1],arguments[2]));break;default:s.push(this._all[n].apply(this,t))}}if(this.wildcard){a=[];var l="string"==typeof e?e.split(this.delimiter):e.slice();u.call(this,a,l,this.listenerTree,0)}else a=this._events[e];if("function"==typeof a)switch(this.event=e,c){case 1:s.push(a.call(this));break;case 2:s.push(a.call(this,arguments[1]));break;case 3:s.push(a.call(this,arguments[1],arguments[2]));break;default:for(t=new Array(c-1),o=1;o<c;o++)t[o-1]=arguments[o];s.push(a.apply(this,t))}else if(a&&a.length){if(a=a.slice(),c>3)for(t=new Array(c-1),o=1;o<c;o++)t[o-1]=arguments[o];for(n=0,r=a.length;n<r;n++)switch(this.event=e,c){case 1:s.push(a[n].call(this));break;case 2:s.push(a[n].call(this,arguments[1]));break;case 3:s.push(a[n].call(this,arguments[1],arguments[2]));break;default:s.push(a[n].apply(this,t))}}else if(!this._all&&"error"===e)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(s)},l.prototype.on=function(e,t){return this._on(e,t,!1)},l.prototype.prependListener=function(e,t){return this._on(e,t,!0)},l.prototype.onAny=function(e){return this._onAny(e,!1)},l.prototype.prependAny=function(e){return this._onAny(e,!0)},l.prototype.addListener=l.prototype.on,l.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},l.prototype._on=function(e,t,r){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");return this._events||i.call(this),this.emit("newListener",e,t),this.wildcard?(d.call(this,e,t),this):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,c.call(this,this._events[e].length,e))):this._events[e]=t,this)},l.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();n=u.call(this,null,i,this.listenerTree,0)}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var s=0;s<n.length;s++){var c=n[s];if(r=c._listeners,a(r)){for(var l=-1,d=0,h=r.length;d<h;d++)if(r[d]===t||r[d].listener&&r[d].listener===t||r[d]._origin&&r[d]._origin===t){l=d;break}if(l<0)continue;return this.wildcard?c._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete c._listeners:delete this._events[e]),this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete c._listeners:delete this._events[e],this.emit("removeListener",e,t))}return function e(t){if(t!==o){var r=Object.keys(t);for(var n in r){var a=r[n],i=t[a];i instanceof Function||"object"!=typeof i||null===i||(Object.keys(i).length>0&&e(t[a]),0===Object.keys(i).length&&delete t[a])}}}(this.listenerTree),this},l.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this.emit("removeListenerAny",e),this}else{for(r=0,n=(t=this._all).length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},l.prototype.removeListener=l.prototype.off,l.prototype.removeAllListeners=function(e){if(0===arguments.length)return!this._events||i.call(this),this;if(this.wildcard)for(var t="string"==typeof e?e.split(this.delimiter):e.slice(),r=u.call(this,null,t,this.listenerTree,0),n=0;n<r.length;n++){r[n]._listeners=null}else this._events&&(this._events[e]=null);return this},l.prototype.listeners=function(e){if(this.wildcard){var t=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return u.call(this,t,r,this.listenerTree,0),t}return this._events||i.call(this),this._events[e]||(this._events[e]=[]),a(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},l.prototype.eventNames=function(){return Object.keys(this._events)},l.prototype.listenerCount=function(e){return this.listeners(e).length},l.prototype.listenersAny=function(){return this._all?this._all:[]},(n=function(){return l}.call(t,r,t,e))===o||(e.exports=n)}()},572:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=void 0;var o=r(634);function a(e){if(void 0!==e)return"boolean"==typeof e?{capture:e}:e}t.bindAll=function(e,t,r){var i=t.map((function(t){var i=function(e,t){return null==t?e:n(n({},e),{options:n(n({},a(t)),a(e.options))})}(t,r);return(0,o.bind)(e,i)}));return function(){i.forEach((function(e){return e()}))}}},634:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0,t.bind=function(e,t){var r=t.type,n=t.listener,o=t.options;return e.addEventListener(r,n,o),function(){e.removeEventListener(r,n,o)}}},833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=t.bind=void 0;var n=r(634);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return n.bind}});var o=r(572);Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return o.bindAll}})},913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,r,n,o,a,i){void 0===o&&(o=[]),void 0===a&&(a=""),void 0===i&&(i=null),this._onDefaultValueFallback=null,this.value=JSON.parse(JSON.stringify(null!=t?t:{})),this._name=e,this._ruleID=null!=r?r:"",this._secondaryExposures=o,this._allocatedExperimentName=a,this._evaluationDetails=n,this._onDefaultValueFallback=i}return e.prototype.get=function(e,t,r){var n,o,a=this.getValue(e,t);if(null==a)return t;var i=Array.isArray(t)?"array":typeof t,s=Array.isArray(a)?"array":typeof a;return r?r(a)?a:(null===(n=this._onDefaultValueFallback)||void 0===n||n.call(this,this,e,i,s),t):null==t||i===s?a:(null===(o=this._onDefaultValueFallback)||void 0===o||o.call(this,this,e,i,s),t)},e.prototype.getValue=function(e,t){return null==e?this.value:(null==t&&(t=null),null==this.value[e]?t:this.value[e])},e}();t.default=r},718:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ExceptionEndpoint=void 0;var a=r(95);t.ExceptionEndpoint="https://statsigapi.net/v1/sdk_exception";var i=function(){function e(e,t){this._seen=new Set,this._sdkKey=e,this._options=t}return e.prototype._setStatsigMetadata=function(e){this._statsigMetadata=e},e.prototype._swallow=function(e,t){this._capture(e,t,(function(){}))},e.prototype._capture=function(e,t,r,n){var o=this;try{var a=t();return a instanceof Promise?a.catch((function(t){return o._onCaught(e,t,r,n)})):a}catch(t){return this._onCaught(e,t,r,n)}},e.prototype._logError=function(e,r,a){var i=this;if(!this._options.disableAllLogging)try{n(i,void 0,void 0,(function(){var n,i,s,c,l,u,d,h,p;return o(this,(function(o){switch(o.label){case 0:return"function"!=typeof a?[3,2]:[4,a()];case 1:return i=o.sent(),[3,3];case 2:i=null,o.label=3;case 3:return n=i,s=null!=r?r:Error("[Statsig] Error was empty"),c=s instanceof Error,l=c?s.name:"No Name",this._seen.has(l)?[2]:(this._seen.add(l),u=c?s.stack:this._getDescription(s),d=null!==(p=this._statsigMetadata)&&void 0!==p?p:{},h=JSON.stringify({tag:e,exception:l,info:u,statsigMetadata:d,extra:null!=n?n:{}}),[2,fetch(t.ExceptionEndpoint,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(d.sdkType),"STATSIG-SDK-VERSION":String(d.sdkVersion),"Content-Type":"application/json","Content-Length":"".concat(h.length)},body:h})])}}))})).then((function(){})).catch((function(){}))}catch(e){}},e.prototype._onCaught=function(e,t,r,n){if(t instanceof a.StatsigUninitializedError||t instanceof a.StatsigInvalidArgumentError)throw t;return console.error("[Statsig] An unexpected exception occurred.",t),this._logError(e,t,n),r()},e.prototype._getDescription=function(e){try{return JSON.stringify(e)}catch(e){return"[Statsig] Failed to get string for error."}},e}();t.default=i},95:function(e,t){"use strict";var r,n,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigSDKKeyMismatchError=t.StatsigInvalidArgumentError=t.StatsigUninitializedError=t.StatsigErrorMessage=void 0,function(e){e.REQUIRE_ASYNC_INITIALIZE="Call initialize() first.",e.REQUIRE_SYNC_INITIALIZE="Call and wait for initialize() to finish first.",e.REQUIRE_INITIALIZE_FOR_LOG_EVENT="Must initialize() before logging events."}(n=t.StatsigErrorMessage||(t.StatsigErrorMessage={}));var a=function(e){function t(r){var o=e.call(this,null!=r?r:n.REQUIRE_SYNC_INITIALIZE)||this;return Object.setPrototypeOf(o,t.prototype),o}return o(t,e),t}(Error);t.StatsigUninitializedError=a;var i=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return o(t,e),t}(Error);t.StatsigInvalidArgumentError=i;var s=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return o(t,e),t}(Error);t.StatsigSDKKeyMismatchError=s},755:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,r,n,o,a,i,s,c){void 0===o&&(o=null),void 0===a&&(a=[]),void 0===i&&(i=[]),void 0===s&&(s=""),void 0===c&&(c=[]),this._logParameterFunction=o,this._name=e,this._value=JSON.parse(JSON.stringify(null!=t?t:{})),this._ruleID=null!=r?r:"",this._evaluationDetails=n,this._secondaryExposures=a,this._undelegatedSecondaryExposures=i,this._allocatedExperimentName=s,this._explicitParameters=c}return e._create=function(t,r,n,o,a,i,s,c,l){return void 0===a&&(a=null),void 0===i&&(i=[]),void 0===s&&(s=[]),void 0===c&&(c=""),void 0===l&&(l=[]),new e(t,r,n,o,a,i,s,c,l)},e.prototype.get=function(e,t,r){var n=this,o=this._value[e];if(null==o)return t;var a=function(){return n._logLayerParameterExposure(e),o};return r?r(o)?a():t:null==t||typeof o==typeof t&&Array.isArray(t)===Array.isArray(o)?a():t},e.prototype.getValue=function(e,t){null==t&&(t=null);var r=this._value[e];return null!=r&&this._logLayerParameterExposure(e),null!=r?r:t},e.prototype._logLayerParameterExposure=function(e){var t;null===(t=this._logParameterFunction)||void 0===t||t.call(this,this,e)},e}();t.default=r},424:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.saveOverridesToLocalStorage=t.loadOverridesFromLocalStorage=t.makeEmptyOverrides=t.STORAGE_KEY=void 0;var o=n(r(139));function a(){return{gates:{},configs:{},layers:{}}}t.STORAGE_KEY="STATSIG_JS_LITE_LOCAL_OVERRIDES",t.makeEmptyOverrides=a,t.loadOverridesFromLocalStorage=function(){var e=o.default.getItem(t.STORAGE_KEY);if(e)try{return JSON.parse(e)}catch(e){}return{gates:{},configs:{},layers:{}}},t.saveOverridesToLocalStorage=function(e){o.default.setItem(t.STORAGE_KEY,JSON.stringify(e))}},226:function(e,t){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,o,a,i){void 0===o&&(o=null),void 0===a&&(a=null);var s=t;return(null==s?void 0:s.privateAttributes)&&delete(s=r({},t)).privateAttributes,{time:Date.now(),eventName:e,statsigMetadata:n,user:s,value:o,metadata:a,secondaryExposures:i}}},628:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="1.6.0"},966:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return a(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=l(r(913)),d=l(r(718)),h=r(95),p=l(r(755)),f=l(r(27)),g=l(r(261)),b=l(r(763)),v=l(r(951)),y=i(r(812)),m=r(182),_=l(r(139)),k=r(944),w=l(r(226)),E=r(424),x=function(){function e(e,t,r){var n=this;if(this._initCalled=!1,this._pendingInitPromise=null,this._sdkKey=null,this._logLayerParameterExposureForLayer=function(e,t,r){void 0===r&&(r=!1);var o="",a=e._undelegatedSecondaryExposures,i=e._explicitParameters.includes(t);i&&(o=e._allocatedExperimentName,a=e._secondaryExposures),n._logger.logLayerExposure(n._identity._user,e._name,e._ruleID,a,o,t,i,e._evaluationDetails,r,n._store.getBootstrapMetadata())},!0!==(null==r?void 0:r.localMode)&&("string"!=typeof e||!e.startsWith("client-")))throw new h.StatsigInvalidArgumentError("Invalid key provided. You must use a Client SDK Key from the Statsig console to initialize the sdk");this._sdkKey=e,this._startTime=(0,k.now)(),this._options=new v.default(r),this._errorBoundary=new d.default(e,this._options),this._ready=!1,_.default.disabled=this._options.disableLocalStorage,this._overrides=(0,E.loadOverridesFromLocalStorage)(),this._identity=new f.default(e,this._normalizeUser(null!=t?t:null),this._options.overrideStableID),this._network=new b.default(this._options,this._identity,this._errorBoundary),this._logger=new g.default(this._options,this._identity,this._network,this._errorBoundary),this._store=new y.default(this._identity,this._logger.logConfigDefaultValueFallback,this._options.initializeValues),this._errorBoundary._setStatsigMetadata(this._identity._statsigMetadata),null!=this._options.initializeValues&&(this._ready=!0,this._initCalled=!0,setTimeout((function(){return n._delayedSetup()}),20))}return e.prototype.setInitializeValues=function(e){var t=this;this._errorBoundary._capture("setInitializeValues",(function(){t._store.bootstrap(e),t._ready||(t._ready=!0,t._initCalled=!0),t._logger.sendSavedRequests()}),(function(){t._ready=!0,t._initCalled=!0}))},e.prototype.initializeAsync=function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return[2,this._errorBoundary._capture("initializeAsync",(function(){return s(e,void 0,void 0,(function(){var e,t=this;return c(this,(function(r){return null!=this._pendingInitPromise?[2,this._pendingInitPromise]:this._ready?[2,Promise.resolve()]:(this._initCalled=!0,this._options.localMode?[2,Promise.resolve()]:(e=this._identity._user,this._pendingInitPromise=this._fetchAndSaveValues(e,this._options.initTimeoutMs).then((function(){})).catch((function(e){return t._errorBoundary._logError("initializeAsync:fetchAndSaveValues",e),{success:!1,message:e.message}})).then((function(){})).finally((function(){return s(t,void 0,void 0,(function(){return c(this,(function(e){return this._pendingInitPromise=null,this._ready=!0,this._delayedSetup(),[2]}))}))})),[2,this._pendingInitPromise]))}))}))}),(function(){return e._ready=!0,e._initCalled=!0,Promise.resolve()}))]}))}))},e.prototype.getEvaluationDetails=function(){var e=this;return this._errorBoundary._capture("getEvaluationDetails",(function(){return e._store.getGlobalEvaluationDetails()}),(function(){return{time:Date.now(),reason:y.EvaluationReason.Error}}))},e.prototype.checkGate=function(e){return this._checkGateImpl(e,"checkGate")},e.prototype.checkGateWithExposureLoggingDisabled=function(e){return this._checkGateImpl(e,"checkGateWithExposureLoggingDisabled")},e.prototype.logGateExposure=function(e){var t=this;this._errorBoundary._swallow("logGateExposure",(function(){t._logGateExposureImpl(e)}))},e.prototype.getConfig=function(e){return this._getConfigImpl(e,"getConfig")},e.prototype.getConfigWithExposureLoggingDisabled=function(e){return this._getConfigImpl(e,"getConfigWithExposureLoggingDisabled")},e.prototype.logConfigExposure=function(e){var t=this;this._errorBoundary._swallow("logConfigExposure",(function(){t._logConfigExposureImpl(e)}))},e.prototype.getExperiment=function(e){return this.getConfig(e)},e.prototype.getExperimentWithExposureLoggingDisabled=function(e){return this.getConfigWithExposureLoggingDisabled(e)},e.prototype.logExperimentExposure=function(e){this.logConfigExposure(e)},e.prototype.getLayer=function(e){return this._getLayerImpl(e,"getLayer")},e.prototype.getLayerWithExposureLoggingDisabled=function(e){return this._getLayerImpl(e,"getLayerWithExposureLoggingDisabled")},e.prototype.logLayerParameterExposure=function(e,t){var r=this;this._errorBoundary._swallow("logLayerParameterExposure",(function(){var n=r._getLayerFromStore(null,e);r._logLayerParameterExposureForLayer(n,t,!0)}))},e.prototype.logEvent=function(e,t,r){var n=this;void 0===t&&(t=null),void 0===r&&(r=null),this._errorBoundary._swallow("logEvent",(function(){if(!n._logger||!n._identity._sdkKey)throw new h.StatsigUninitializedError(h.StatsigErrorMessage.REQUIRE_INITIALIZE_FOR_LOG_EVENT);if("string"==typeof e&&0!==e.length){var o=(0,w.default)(e,n._identity._user,n._identity._statsigMetadata,t,r);n._logger.log(o)}}))},e.prototype.updateUserWithValues=function(e,t){var r,n=this,o=Date.now();return this._errorBoundary._capture("updateUserWithValues",(function(){if(!n.initializeCalled())throw new h.StatsigUninitializedError(h.StatsigErrorMessage.REQUIRE_ASYNC_INITIALIZE);return r=function(e,t){var r=n._options.updateUserCompletionCallback;null==r||r(Date.now()-o,e,t)},n._identity._user=n._normalizeUser(e),n._store.bootstrap(t),n._logger.resetDedupeKeys(),r(!0,null),!0}),(function(){return null==r||r(!1,"Failed to update user. An unexpected error occured."),!1}))},e.prototype.updateUser=function(e){return s(this,void 0,void 0,(function(){var t,r,n=this;return c(this,(function(o){return t=Date.now(),[2,this._errorBoundary._capture("updateUser",(function(){return s(n,void 0,void 0,(function(){var n,o=this;return c(this,(function(a){switch(a.label){case 0:if(!this.initializeCalled())throw new h.StatsigUninitializedError(h.StatsigErrorMessage.REQUIRE_ASYNC_INITIALIZE);return r=function(e,r){var n=o._options.updateUserCompletionCallback;null==n||n(Date.now()-t,e,r)},this._identity._user=this._normalizeUser(e),this._store.updateUser(),this._logger.resetDedupeKeys(),null==this._pendingInitPromise?[3,2]:[4,this._pendingInitPromise];case 1:a.sent(),a.label=2;case 2:return this._options.localMode?(r(!0,null),[2,Promise.resolve(!0)]):(n=this._identity._user,this._pendingInitPromise=this._fetchAndSaveValues(n).finally((function(){o._pendingInitPromise=null})),[2,this._pendingInitPromise.then((function(){return r(!0,null),Promise.resolve(!0)})).catch((function(e){return r(!1,"Failed to update user: ".concat(e)),Promise.resolve(!1)}))])}}))}))}),(function(){return r(!1,"Failed to update user. An unexpected error occured."),Promise.resolve(!1)}))]}))}))},e.prototype.shutdown=function(){var e=this;this._errorBoundary._swallow("shutdown",(function(){e._logger.shutdown()}))},e.prototype.getStableID=function(){var e=this;return this._errorBoundary._capture("getStableID",(function(){return e._identity._statsigMetadata.stableID}),(function(){return""}))},e.prototype.initializeCalled=function(){return this._initCalled},e.prototype.overrideGate=function(e,t){this._setOverride("gates",e,t)},e.prototype.overrideConfig=function(e,t){this._setOverride("configs",e,t)},e.prototype.overrideLayer=function(e,t){this._setOverride("layers",e,t)},e.prototype.setOverrides=function(e){var t=this;this._errorBoundary._swallow("setOverrides",(function(){t._overrides=null!=e?e:(0,E.makeEmptyOverrides)(),(0,E.saveOverridesToLocalStorage)(t._overrides)}))},e.prototype.getOverrides=function(){var e=this;return this._errorBoundary._capture("getOverrides",(function(){return e._overrides}),(function(){return(0,E.makeEmptyOverrides)()}))},e.prototype._delayedSetup=function(){var e=this;this._errorBoundary._swallow("delayedSetup",(function(){e._identity.saveStableID(),e._logger.sendSavedRequests().then((function(){}))}))},e.prototype._normalizeUser=function(e){var t={};try{t=JSON.parse(JSON.stringify(e))}catch(e){throw new h.StatsigInvalidArgumentError("User object must be convertable to JSON string.")}return null!=this._options.environment&&(t=n(n({},t),{statsigEnvironment:this._options.environment})),t},e.prototype._ensureStoreLoaded=function(){if(!this._store.isLoaded())throw new h.StatsigUninitializedError},e.prototype._getEvaluationDetailsForError=function(){return{time:Date.now(),reason:y.EvaluationReason.Error}},e.prototype._fetchAndSaveValues=function(e,t){return void 0===t&&(t=this._options.initTimeoutMs),s(this,void 0,void 0,(function(){var r,n,o=this;return c(this,(function(a){return null,r=this._store.getLastUpdateTime(e),n=this._store.getPreviousDerivedFields(e),[2,this._network.fetchValues(e,r,t,n).eventually((function(t){var r;(0,m.verifySDKKeyUsed)(t,null!==(r=o._sdkKey)&&void 0!==r?r:"",o._errorBoundary)&&(null==t?void 0:t.has_updates)&&o._store.save(e,t,!1)})).then((function(t){return s(o,void 0,void 0,(function(){var r=this;return c(this,(function(n){return[2,this._errorBoundary._swallow("fetchAndSaveValues",(function(){return s(r,void 0,void 0,(function(){var r;return c(this,(function(n){switch(n.label){case 0:return(0,m.verifySDKKeyUsed)(t,null!==(r=this._sdkKey)&&void 0!==r?r:"",this._errorBoundary)?(null==t?void 0:t.has_updates)?[4,this._store.save(e,t)]:[3,2]:[2];case 1:return n.sent(),[3,3];case 2:(null==t?void 0:t.is_no_content)&&this._store.setEvaluationReason(y.EvaluationReason.NetworkNotModified),n.label=3;case 3:return[2]}}))}))}))]}))}))}))]}))}))},e.prototype._checkGateImpl=function(e,t){var r=this;return this._errorBoundary._capture(t,(function(){if("boolean"==typeof r._overrides.gates[e])return r._overrides.gates[e];var n=r._getGateFromStore(e);return"checkGate"===t&&r._logGateExposureImpl(e,n),!0===n.gate.value}),(function(){return!1}))},e.prototype._getGateFromStore=function(e){if(this._ensureStoreLoaded(),"string"!=typeof e||0===e.length)throw new h.StatsigInvalidArgumentError("Must pass a valid string as the gateName.");return this._store.checkGate(e)},e.prototype._logGateExposureImpl=function(e,t){var r,n=!t,o=null!=t?t:this._getGateFromStore(e),a=o.gate;this._logger.logGateExposure(this._identity._user,e,a.value,a.rule_id,this._store.mapExposures(null!==(r=a.secondary_exposures)&&void 0!==r?r:[]),o.evaluationDetails,n,this._store.getBootstrapMetadata())},e.prototype._getConfigImpl=function(e,t){var r=this;return this._errorBoundary._capture(t,(function(){if(r._overrides.configs[e])return new u.default(e,r._overrides.configs[e],"local_override",{reason:y.EvaluationReason.LocalOverride,time:Date.now()});var n=r._getConfigFromStore(e);return"getConfig"===t&&r._logConfigExposureImpl(e,n),n}),(function(){return r._getEmptyConfig(e)}))},e.prototype._getConfigFromStore=function(e){if(this._ensureStoreLoaded(),"string"!=typeof e||0===e.length)throw new h.StatsigInvalidArgumentError("Must pass a valid string as the configName.");return this._store.getConfig(e)},e.prototype._logConfigExposureImpl=function(e,t){var r=!t,n=null!=t?t:this._getConfigFromStore(e);this._logger.logConfigExposure(this._identity._user,e,n._ruleID,n._secondaryExposures,n._evaluationDetails,r,this._store.getBootstrapMetadata())},e.prototype._getLayerImpl=function(e,t){var r=this;return this._errorBoundary._capture(t,(function(){if(r._overrides.layers[e])return p.default._create(e,r._overrides.layers[e],"local_override",{reason:y.EvaluationReason.LocalOverride,time:Date.now()});var n="getLayer"===t?r._logLayerParameterExposureForLayer:null;return r._getLayerFromStore(n,e)}),(function(){return p.default._create(e,{},"",r._getEvaluationDetailsForError())}))},e.prototype._getLayerFromStore=function(e,t){if(this._ensureStoreLoaded(),"string"!=typeof t||0===t.length)throw new h.StatsigInvalidArgumentError("Must pass a valid string as the layerName.");return this._store.getLayer(e,t)},e.prototype._getEmptyConfig=function(e){return new u.default(e,{},"",this._getEvaluationDetailsForError())},e.prototype._setOverride=function(e,t,r){null==r?delete this._overrides[e][t]:this._overrides[e][t]=r,this.setOverrides(this._overrides)},e}();t.default=x},27:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(193),a=r(816),i=n(r(139)),s=r(628),c=function(){function e(e,t,r){var n;this._sdkType="js-lite",this._sdkKey=e,this._user=t,this._sdkVersion=s.version;var a=r;a=null!==(n=null!=a?a:i.default.getItem(o.STATSIG_STABLE_ID_KEY))&&void 0!==n?n:this._getUUID(),this._statsigMetadata={stableID:a,sdkType:this._sdkType,sdkVersion:this._sdkVersion}}return e.prototype.saveStableID=function(){null!=this._statsigMetadata.stableID&&i.default.setItem(o.STATSIG_STABLE_ID_KEY,this._statsigMetadata.stableID)},e.prototype.getUserCacheKey=function(){return(0,a.getUserCacheKey)(this._user)},e.prototype._getUUID=function(){for(var e="",t=0;t<32;t++){8!==t&&12!==t&&16!==t&&20!==t||(e+="-");var r=16*Math.random()|0;e+=12===t?"4":16===t?(3&r|8).toString(16):r.toString(16)}return e},e}();t.default=c},261:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=a(r(226)),s=r(763),c=r(193),l=a(r(139)),u="statsig::",d=u+"config_exposure",h=u+"layer_exposure",p=u+"gate_exposure",f=u+"log_event_failed",g=u+"default_value_type_mismatch",b=1024e3,v=function(){function e(e,t,r,n){var o=this;this._failedLogEventCount=0,this.logConfigDefaultValueFallback=function(e,t,r){var n=(0,i.default)(g,e,o._identity._statsigMetadata,t,r);o.log(n),o._loggedErrors.add(t)},this._options=e,this._identity=t,this._network=r,this._errorBoundary=n,this._queue=[],this._flushInterval=null,this._loggedErrors=new Set,this._failedLogEvents=[],this._exposureDedupeKeys={},this._failedLogEventCount=0,this._init()}return e.prototype.log=function(e){if(!this._options.disableAllLogging){try{if(!this._options.disableCurrentPageLogging&&"undefined"!=typeof window&&null!=window&&"object"==typeof window.location&&"string"==typeof window.location.href){var t=window.location.href.split(/[?#]/);(null==t?void 0:t.length)>0&&(e.statsigMetadata.currentPage=t[0])}}catch(e){}this._queue.push(e),this._queue.length>=this._options.loggingBufferMaxSize&&this.flush()}},e.prototype.resetDedupeKeys=function(){this._exposureDedupeKeys={}},e.prototype.logGateExposure=function(e,t,r,n,o,a,s,c){var l=t+String(r)+n+a.reason;if(this._shouldLogExposure(l)){var u={gate:t,gateValue:String(r),ruleID:n,reason:a.reason,time:a.time};s&&(u.isManualExposure="true"),null!=c&&(u.bootstrapMetadata=c);var d=(0,i.default)(p,e,this._identity._statsigMetadata,null,u,o);this.log(d)}},e.prototype.logConfigExposure=function(e,t,r,n,o,a,s){var c=t+r+o.reason;if(this._shouldLogExposure(c)){var l={config:t,ruleID:r,reason:o.reason,time:o.time};a&&(l.isManualExposure="true"),null!=s&&(l.bootstrapMetadata=s);var u=(0,i.default)(d,e,this._identity._statsigMetadata,null,l,n);this.log(u)}},e.prototype.logLayerExposure=function(e,t,r,n,o,a,s,c,l,u){var d=[t,r,o,a,String(s),c.reason].join("|");if(this._shouldLogExposure(d)){var p={config:t,ruleID:r,allocatedExperiment:o,parameterName:a,isExplicitParameter:String(s),reason:c.reason,time:c.time};l&&(p.isManualExposure="true"),null!=u&&(p.bootstrapMetadata=u);var f=(0,i.default)(h,e,this._identity._statsigMetadata,null,p,n);this.log(f)}},e.prototype.shutdown=function(){this._flushInterval&&(clearInterval(this._flushInterval),this._flushInterval=null),this.flush(!0)},e.prototype.flush=function(e){var t=this;if(void 0===e&&(e=!1),0!==this._queue.length){var r=this._identity._statsigMetadata,a=this._queue;if(this._queue=[],e&&!this._network.supportsKeepalive()&&"undefined"!=typeof navigator&&null!=navigator&&navigator.sendBeacon){this._network.sendLogBeacon({events:a,statsigMetadata:r})||(this._queue=a.concat(this._queue),this._queue.length>0&&(this._addFailedRequest({events:this._queue,statsigMetadata:r,time:Date.now()}),this._queue=[]),this._saveFailedRequests())}else{var i=this;this._network.postToEndpoint(s.StatsigEndpoint.Rgstr,{events:a,statsigMetadata:r},3,1e3,0,e).then((function(e){if(!e.ok)throw e})).catch((function(e){"function"==typeof e.text?e.text().then((function(r){t._errorBoundary._logError(f,e,(function(){return n(t,void 0,void 0,(function(){return o(this,(function(e){return[2,{eventCount:a.length,error:r}]}))}))}))})):t._errorBoundary._logError(f,e,(function(){return n(t,void 0,void 0,(function(){return o(this,(function(t){return[2,{eventCount:a.length,error:e.message}]}))}))})),i._newFailedRequest(f,a)})).finally((function(){return n(t,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return e?(this._queue.length>0&&(this._addFailedRequest({events:this._queue,statsigMetadata:r,time:Date.now()}),this._queue=[]),[4,i._saveFailedRequests()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}))}}},e.prototype.sendSavedRequests=function(){return n(this,void 0,void 0,(function(){var e,t,r,n,a,i,u,d,h=this;return o(this,(function(o){if(t=!1,null==(e=l.default.getItem(c.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY)))return this._clearLocalStorageRequests(),[2];e.length>b&&(t=!0),r=[];try{for(r=JSON.parse(e),n=function(e){null!=e&&e.events&&Array.isArray(e.events)&&a._network.postToEndpoint(s.StatsigEndpoint.Rgstr,e).then((function(e){if(!e.ok)throw Error(e.status+"")})).catch((function(r){t||h._addFailedRequest(e)}))},a=this,i=0,u=r;i<u.length;i++)d=u[i],n(d)}catch(e){}finally{this._clearLocalStorageRequests()}return[2]}))}))},e.prototype._init=function(){var e=this;if("undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("blur",(function(){return e.flush(!0)})),window.addEventListener("beforeunload",(function(){return e.flush(!0)})),window.addEventListener("load",(function(){setTimeout((function(){return e.flush()}),100),setTimeout((function(){return e.flush()}),1e3)}))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",(function(){e.flush("visible"!==document.visibilityState)})),(this._options.ignoreWindowUndefined||"undefined"!=typeof window&&null!=window)&&!this._options.localMode){var t=this;this._flushInterval=setInterval((function(){t.flush()}),this._options.loggingIntervalMillis),setTimeout((function(){return e.flush()}),100),setTimeout((function(){return e.flush()}),1e3)}},e.prototype._shouldLogExposure=function(e){var t=this._exposureDedupeKeys[e],r=Date.now();return!(null!=t&&t>=r-6e5||(this._exposureDedupeKeys[e]=r,0))},e.prototype._saveFailedRequests=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){if(this._failedLogEvents.length>0){if((e=JSON.stringify(this._failedLogEvents)).length>b)return this._clearLocalStorageRequests(),[2];l.default.setItem(c.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY,e)}return[2]}))}))},e.prototype._addFailedRequest=function(e){if(!(e.time<Date.now()-432e6||this._failedLogEvents.length>100)){var t=e.events.length;this._failedLogEventCount+t>1e3||(this._failedLogEvents.push(e),this._failedLogEventCount+=t)}},e.prototype._clearLocalStorageRequests=function(){l.default.removeItem(c.STATSIG_LOCAL_STORAGE_LOGGING_REQUEST_KEY)},e.prototype._newFailedRequest=function(e,t){this._loggedErrors.has(e)||(this._loggedErrors.add(e),this._failedLogEvents.push({events:t,statsigMetadata:this._identity._statsigMetadata,time:Date.now()}),this._saveFailedRequests().then((function(){})))},e}();t.default=v},763:function(e,t){"use strict";var r,n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.StatsigEndpoint=void 0,function(e){e.Initialize="initialize",e.Rgstr="rgstr",e.LogEventBeacon="log_event_beacon"}(r=t.StatsigEndpoint||(t.StatsigEndpoint={}));var a=function(){function e(e,t,r){this.retryCodes={408:!0,500:!0,502:!0,503:!0,504:!0,522:!0,524:!0,599:!0},this.canUseKeepalive=!1,this._options=e,this._identity=t,this._errorBoundary=r,this.leakyBucket={},this._init()}return e.prototype.fetchValues=function(e,t,n,o){var a={user:e,statsigMetadata:this._identity._statsigMetadata,sinceTime:null!=t?t:void 0,hash:"djb2",previousDerivedFields:o};return this._postWithTimeout(r.Initialize,a,n,3)},e.prototype.sendLogBeacon=function(e){if(this._options.localMode)return!0;var t=new URL(this._options.eventLoggingApi+r.LogEventBeacon);t.searchParams.append("k",this._identity._sdkKey),e.clientTime=Date.now()+"";var n=null;try{n=JSON.stringify(e)}catch(e){return!1}return navigator.sendBeacon(t.toString(),n)},e.prototype.postToEndpoint=function(e,t,a,i,s,c){return void 0===a&&(a=0),void 0===i&&(i=1e3),void 0===s&&(s=0),void 0===c&&(c=!1),n(this,void 0,void 0,(function(){var l,u,d,h,p,f,g=this;return o(this,(function(b){return this._options.localMode?[2,Promise.reject("no network requests in localMode")]:"function"!=typeof fetch?[2,Promise.reject("fetch is not defined")]:"undefined"!=typeof window||this._options.ignoreWindowUndefined?(l=[r.Initialize].includes(e)?this._options.api:s>0?this._options.eventLoggingApiForRetries:this._options.eventLoggingApi,u=l+e,null!=(d=this.leakyBucket[u])&&d>=30?[2,Promise.reject(new Error("Request failed because you are making the same request too frequently."))]:(this.leakyBucket[u]=null==d?1:d+1,h=JSON.stringify(t),p=this._identity._statsigMetadata,f={method:"POST",body:h,headers:{"Content-type":"application/json; charset=UTF-8","STATSIG-API-KEY":this._identity._sdkKey,"STATSIG-CLIENT-TIME":Date.now()+"","STATSIG-SDK-TYPE":p.sdkType,"STATSIG-SDK-VERSION":p.sdkVersion}},this.canUseKeepalive&&c&&(f.keepalive=!0),[2,fetch(u,f).then((function(e){return n(g,void 0,void 0,(function(){var t,r,n;return o(this,(function(o){switch(o.label){case 0:return e.ok?(t=e,204!==e.status?[3,1]:(t.data={has_updates:!1,is_no_content:!0},[3,3])):[3,4];case 1:return[4,e.text()];case 2:r=o.sent(),t.data=JSON.parse(r),o.label=3;case 3:return[2,Promise.resolve(t)];case 4:return this.retryCodes[e.status]||(a=0),[4,e.text()];case 5:return n=o.sent(),[2,Promise.reject(new Error("".concat(e.status,": ").concat(n)))]}}))}))})).catch((function(r){return a>0?new Promise((function(r,n){setTimeout((function(){g.leakyBucket[u]=Math.max(g.leakyBucket[u]-1,0),g.postToEndpoint(e,t,a-1,2*i,s+1,c).then(r).catch(n)}),i)})):Promise.reject(r)})).finally((function(){g.leakyBucket[u]=Math.max(g.leakyBucket[u]-1,0)}))])):[2,Promise.reject("window is not defined")]}))}))},e.prototype.supportsKeepalive=function(){return this.canUseKeepalive},e.prototype._init=function(){if(!this._options.disableNetworkKeepalive)try{this.canUseKeepalive="keepalive"in new Request("")}catch(e){}},e.prototype._postWithTimeout=function(e,t,r,a,i){var s=this;void 0===r&&(r=0),void 0===a&&(a=0),void 0===i&&(i=1e3);var c=!1,l=null,u=null,d=[];0!=r&&(l=new Promise((function(e,t){setTimeout((function(){c=!0,t(new Error("The initialization timeout of ".concat(r,"ms has been hit before the network request has completed.")))}),r)})));var h,p=this.postToEndpoint(e,t,a,i).then((function(r){if(!r.ok)return Promise.reject(new Error("Request to ".concat(e," failed with status ").concat(r.status)));if("object"!=typeof r.data){var l=new Error("Request to ".concat(e," received invalid response type. Expected 'object' but got '").concat(typeof r.data,"'"));return s._errorBoundary._logError("postWithTimeoutInvalidRes",l,(function(){return n(s,void 0,void 0,(function(){return o(this,(function(n){return[2,this._getErrorData(e,t,a,i,r)]}))}))})),Promise.reject(l)}var h=r.data;return s._errorBoundary._capture("postWithTimeout",(function(){return n(s,void 0,void 0,(function(){return o(this,(function(e){return u=h,c&&(d.forEach((function(e){return e(h)})),d=[]),[2,Promise.resolve(h)]}))}))}),(function(){return Promise.resolve({})}),(function(){return n(s,void 0,void 0,(function(){return o(this,(function(n){return[2,this._getErrorData(e,t,a,i,r)]}))}))}))})).catch((function(e){return Promise.reject(e)})),f=l?Promise.race([p,l]):p;return f.eventually=(h=f,function(e){return c&&u?e(u):d.push(e),h}),f},e.prototype._getErrorData=function(e,t,r,a,i){var s;return n(this,void 0,void 0,(function(){var n;return o(this,(function(o){try{return n={},(null!==(s=i.headers)&&void 0!==s?s:[]).forEach((function(e,t){n[t]=e})),[2,{responseInfo:{headers:n,status:i.status,statusText:i.statusText,type:i.type,url:i.url,redirected:i.redirected,bodySnippet:i.data?JSON.stringify(i.data).slice(0,500):null},requestInfo:{endpointName:e,bodySnippet:JSON.stringify(t).slice(0,500),retries:r,backoff:a}}]}catch(e){return[2,{statusText:"statsig::failed to extract extra data"}]}return[2]}))}))},e}();t.default=a},951:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.INIT_TIMEOUT_DEFAULT_MS=void 0;t.INIT_TIMEOUT_DEFAULT_MS=3e3;var r=function(){function e(e){var r,n,o,a,i,s,c,l,u,d,h,p,f,g,b,v;null==e&&(e={});var y=null!==(r=e.api)&&void 0!==r?r:"https://featuregates.org/v1/";this.api=y.endsWith("/")?y:y+"/",this.disableCurrentPageLogging=null!==(n=e.disableCurrentPageLogging)&&void 0!==n&&n,this.environment=null!==(o=e.environment)&&void 0!==o?o:null,this.loggingIntervalMillis=this.normalizeNumberInput(e.loggingIntervalMillis,{default:1e4,min:1e3,max: