UNPKG

ibm-appconfiguration-js-client-sdk

Version:
1 lines 76.4 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AppConfiguration=t():e.AppConfiguration=t()}(self,()=>{return e={228(e){"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var u,l,c=this._events[a],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,o),!0;case 6:return c.fn.call(c.context,t,n,i,o,s),!0}for(l=1,u=new Array(h-1);l<h;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var f,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),h){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,i);break;default:if(!u)for(f=1,u=new Array(h-1);f<h;f++)u[f-1]=arguments[f];c[l].fn.apply(c[l].context,u)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var u=0,l=[],c=a.length;u<c;u++)(a[u].fn!==t||i&&!a[u].once||n&&a[u].context!==n)&&l.push(a[u]);l.length?this._events[o]=1===l.length?l[0]:l:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},5(e){!function(){const t=e=>(new TextEncoder).encode(e);function r(e,r){let n,i,o,s,a,u,l,c;for("string"==typeof e&&(e=t(e)),n=3&e.length,i=e.length-n,o=r,a=3432918353,u=461845907,c=0;c<i;)l=255&e[c]|(255&e[++c])<<8|(255&e[++c])<<16|(255&e[++c])<<24,++c,l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,o^=l,o=o<<13|o>>>19,s=5*(65535&o)+((5*(o>>>16)&65535)<<16)&4294967295,o=27492+(65535&s)+(((s>>>16)+58964&65535)<<16);switch(l=0,n){case 3:l^=(255&e[c+2])<<16;case 2:l^=(255&e[c+1])<<8;case 1:l^=255&e[c],l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,o^=l}return o^=e.length,o^=o>>>16,o=2246822507*(65535&o)+((2246822507*(o>>>16)&65535)<<16)&4294967295,o^=o>>>13,o=3266489909*(65535&o)+((3266489909*(o>>>16)&65535)<<16)&4294967295,o^=o>>>16,o>>>0}const n=r;n.v2=function(e,r){"string"==typeof e&&(e=t(e));let n,i=e.length,o=r^i,s=0;for(;i>=4;)n=255&e[s]|(255&e[++s])<<8|(255&e[++s])<<16|(255&e[++s])<<24,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),n^=n>>>24,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^n,i-=4,++s;switch(i){case 3:o^=(255&e[s+2])<<16;case 2:o^=(255&e[s+1])<<8;case 1:o^=255&e[s],o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)}return o^=o>>>13,o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),o^=o>>>15,o>>>0},n.v3=r,e.exports=n}()},636(e,t){"use strict";var r,n=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)});function i(e,t){if(Number.isFinite(e)&&Number.isFinite(t))return e-t;var r=typeof e,n=typeof t;if(r!==n)return r<n?-1:1;if("object"===r){if(null===e)return null===t?0:-1;if(null===t)return 1;if((r=typeof(e=e.valueOf()))!=(n=typeof(t=t.valueOf())))return r<n?-1:1}return e<t?-1:e>t?1:e===t?0:Number.isNaN(e)?Number.isNaN(t)?0:-1:Number.isNaN(t)?1:Array.isArray(e)?0:Number.NaN}function o(e){return e>=4?Math.min(0|e,256):32}Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyBTree=t.check=t.areOverlapping=t.sumChildSizes=t.BNodeInternal=t.BNode=t.asSet=t.fixMaxSize=t.simpleComparator=t.defaultComparator=void 0,t.defaultComparator=i,t.simpleComparator=function(e,t){return e>t?1:e<t?-1:0},t.fixMaxSize=o;var s=function(){function e(e,t,r){this._root=_,this._maxNodeSize=o(r),this._compare=t||i,e&&this.setPairs(e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this._root.size()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._root.size()},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this._root=_},e.prototype.forEach=function(e,t){var r=this;return void 0!==t&&(e=e.bind(t)),this.forEachPair(function(t,n){return e(n,t,r)})},e.prototype.forEachPair=function(e,t){var r=this.minKey(),n=this.maxKey();return this.forRange(r,n,!0,e,t)},e.prototype.get=function(e,t){return this._root.get(e,t,this)},e.prototype.set=function(e,t,r){this._root.isShared&&(this._root=this._root.clone());var n=this._root.set(e,t,r,this);if(!0===n||!1===n)return n;var i=[this._root,n];return this._root=new l(i,h(i)),!0},e.prototype.has=function(e){return 0!==this.forRange(e,e,!0,void 0)},e.prototype.delete=function(e){return 0!==this.editRange(e,e,!0,y)},e.prototype.with=function(e,t,r){var n=this.clone();return n.set(e,t,r)||r?n:this},e.prototype.withPairs=function(e,t){var r=this.clone();return 0!==r.setPairs(e,t)||t?r:this},e.prototype.withKeys=function(e,t){for(var r=this.clone(),n=!1,i=0;i<e.length;i++)n=r.set(e[i],void 0,!1)||n;return t&&!n?this:r},e.prototype.without=function(e,t){return this.withoutRange(e,e,!0,t)},e.prototype.withoutKeys=function(e,t){var r=this.clone();return r.deleteKeys(e)||!t?r:this},e.prototype.withoutRange=function(e,t,r,n){var i=this.clone();return 0===i.deleteRange(e,t,r)&&n?this:i},e.prototype.filter=function(e,t){var r,n=this.greedyClone();return n.editAll(function(t,n,i){if(!e(t,n,i))return r=v}),!r&&t?this:n},e.prototype.mapValues=function(e){var t={},r=this.greedyClone();return r.editAll(function(r,n,i){return t.value=e(n,r,i),t}),r},e.prototype.reduce=function(e,t){for(var r,n=0,i=t,o=this.entries(this.minKey(),b);!(r=o.next()).done;)i=e(i,r.value,n++,this);return i},e.prototype.entries=function(e,t){var r=this.findPath(e);if(void 0===r)return a();var n=r.nodequeue,i=r.nodeindex,o=r.leaf,s=void 0!==t?1:0,u=void 0===e?-1:o.indexOf(e,0,this._compare)-1;return a(function(){e:for(;;)switch(s){case 0:if(++u<o.keys.length)return{done:!1,value:[o.keys[u],o.values[u]]};s=2;continue;case 1:if(++u<o.keys.length)return t[0]=o.keys[u],t[1]=o.values[u],{done:!1,value:t};s=2;case 2:for(var e=-1;;){if(++e>=n.length){s=3;continue e}if(++i[e]<n[e].length)break}for(;e>0;e--)n[e-1]=n[e][i[e]].children,i[e-1]=0;o=n[0][i[0]],u=-1,s=void 0!==t?1:0;continue;case 3:return{done:!0,value:void 0}}})},e.prototype.entriesReversed=function(e,t,r){if(void 0===e&&(r=void 0,void 0===(e=this.maxKey())))return a();var n=this.findPath(e)||this.findPath(this.maxKey()),i=n.nodequeue,o=n.nodeindex,s=n.leaf;O(!i[0]||s===i[0][o[0]],"wat!");var u=s.indexOf(e,0,this._compare);!r&&u<s.keys.length&&this._compare(s.keys[u],e)<=0&&u++;var l=void 0!==t?1:0;return a(function(){e:for(;;)switch(l){case 0:if(--u>=0)return{done:!1,value:[s.keys[u],s.values[u]]};l=2;continue;case 1:if(--u>=0)return t[0]=s.keys[u],t[1]=s.values[u],{done:!1,value:t};l=2;case 2:for(var e=-1;;){if(++e>=i.length){l=3;continue e}if(--o[e]>=0)break}for(;e>0;e--)i[e-1]=i[e][o[e]].children,o[e-1]=i[e-1].length-1;s=i[0][o[0]],u=s.keys.length,l=void 0!==t?1:0;continue;case 3:return{done:!0,value:void 0}}})},e.prototype.findPath=function(e){var t,r,n=this._root;if(n.isLeaf)t=m,r=m;else{t=[],r=[];for(var i=0;!n.isLeaf;i++){if(t[i]=n.children,r[i]=void 0===e?0:n.indexOf(e,0,this._compare),r[i]>=t[i].length)return;n=t[i][r[i]]}t.reverse(),r.reverse()}return{nodequeue:t,nodeindex:r,leaf:n}},e.prototype.keys=function(e){var t=this.entries(e,b);return a(function(){var e=t.next();return e.value&&(e.value=e.value[0]),e})},e.prototype.values=function(e){var t=this.entries(e,b);return a(function(){var e=t.next();return e.value&&(e.value=e.value[1]),e})},Object.defineProperty(e.prototype,"maxNodeSize",{get:function(){return this._maxNodeSize},enumerable:!1,configurable:!0}),e.prototype.minKey=function(){return this._root.minKey()},e.prototype.maxKey=function(){return this._root.maxKey()},e.prototype.clone=function(){this._root.isShared=!0;var t=new e(void 0,this._compare,this._maxNodeSize);return t._root=this._root,t},e.prototype.greedyClone=function(t){var r=new e(void 0,this._compare,this._maxNodeSize);return r._root=this._root.greedyClone(t),r},e.prototype.toArray=function(e){void 0===e&&(e=2147483647);var t=this.minKey(),r=this.maxKey();return void 0!==t?this.getRange(t,r,!0,e):[]},e.prototype.keysArray=function(){var e=[];return this._root.forRange(this.minKey(),this.maxKey(),!0,!1,this,0,function(t,r){e.push(t)}),e},e.prototype.valuesArray=function(){var e=[];return this._root.forRange(this.minKey(),this.maxKey(),!0,!1,this,0,function(t,r){e.push(r)}),e},e.prototype.toString=function(){return this.toArray().toString()},e.prototype.setIfNotPresent=function(e,t){return this.set(e,t,!1)},e.prototype.nextHigherPair=function(e,t){return t=t||[],void 0===e?this._root.minPair(t):this._root.getPairOrNextHigher(e,this._compare,!1,t)},e.prototype.nextHigherKey=function(e){var t=this.nextHigherPair(e,b);return t&&t[0]},e.prototype.nextLowerPair=function(e,t){return t=t||[],void 0===e?this._root.maxPair(t):this._root.getPairOrNextLower(e,this._compare,!1,t)},e.prototype.nextLowerKey=function(e){var t=this.nextLowerPair(e,b);return t&&t[0]},e.prototype.getPairOrNextLower=function(e,t){return this._root.getPairOrNextLower(e,this._compare,!0,t||[])},e.prototype.getPairOrNextHigher=function(e,t){return this._root.getPairOrNextHigher(e,this._compare,!0,t||[])},e.prototype.changeIfPresent=function(e,t){return 0!==this.editRange(e,e,!0,function(e,r){return{value:t}})},e.prototype.getRange=function(e,t,r,n){void 0===n&&(n=67108863);var i=[];return this._root.forRange(e,t,r,!1,this,0,function(e,t){return i.push([e,t]),i.length>n?g:void 0}),i},e.prototype.setPairs=function(e,t){for(var r=0,n=0;n<e.length;n++)this.set(e[n][0],e[n][1],t)&&r++;return r},e.prototype.forRange=function(e,t,r,n,i){var o=this._root.forRange(e,t,r,!1,this,i||0,n);return"number"==typeof o?o:o.break},e.prototype.editRange=function(e,t,r,n,i){var o=this._root;o.isShared&&(this._root=o=o.clone());try{var s=o.forRange(e,t,r,!0,this,i||0,n);return"number"==typeof s?s:s.break}finally{for(var a=void 0;o.keys.length<=1&&!o.isLeaf;)a||(a=o.isShared),this._root=o=0===o.keys.length?_:o.children[0];a&&(o.isShared=!0)}},e.prototype.editAll=function(e,t){return this.editRange(this.minKey(),this.maxKey(),!0,e,t)},e.prototype.deleteRange=function(e,t,r){return this.editRange(e,t,r,y)},e.prototype.deleteKeys=function(e){for(var t=0,r=0;t<e.length;t++)this.delete(e[t])&&r++;return r},Object.defineProperty(e.prototype,"height",{get:function(){for(var e=this._root,t=-1;e;)t++,e=e.isLeaf?void 0:e.children[0];return t},enumerable:!1,configurable:!0}),e.prototype.freeze=function(){var e=this;e.clear=e.set=e.editRange=function(){throw new Error("Attempted to modify a frozen BTree")}},e.prototype.unfreeze=function(){delete this.clear,delete this.set,delete this.editRange},Object.defineProperty(e.prototype,"isFrozen",{get:function(){return this.hasOwnProperty("editRange")},enumerable:!1,configurable:!0}),e.prototype.checkValid=function(e){void 0===e&&(e=!1);var t=this._root.checkValid(0,this,0,e)[0];O(t===this.size,"size mismatch: counted ",t,"but stored",this.size)},e}();function a(e){void 0===e&&(e=function(){return{done:!0,value:void 0}});var t={next:e};return Symbol&&Symbol.iterator&&(t[Symbol.iterator]=function(){return this}),t}t.default=s,t.asSet=function(e){return e},Symbol&&Symbol.iterator&&(s.prototype[Symbol.iterator]=s.prototype.entries),s.prototype.where=s.prototype.filter,s.prototype.setRange=s.prototype.setPairs,s.prototype.add=s.prototype.set;var u=function(){function e(e,t){void 0===e&&(e=[]),this.keys=e,this.values=t||c,this.isShared=void 0}return Object.defineProperty(e.prototype,"isLeaf",{get:function(){return void 0===this.children},enumerable:!1,configurable:!0}),e.prototype.size=function(){return this.keys.length},e.prototype.maxKey=function(){return this.keys[this.keys.length-1]},e.prototype.indexOf=function(e,t,r){for(var n=this.keys,i=0,o=n.length,s=o>>1;i<o;){var a=r(n[s],e);if(a<0)i=s+1;else{if(!(a>0)){if(0===a)return s;if(e==e)return n.length;throw new Error("BTree: NaN was used as a key")}o=s}s=i+o>>1}return s^t},e.prototype.minKey=function(){return this.keys[0]},e.prototype.minPair=function(e){if(0!==this.keys.length)return e[0]=this.keys[0],e[1]=this.values[0],e},e.prototype.maxPair=function(e){if(0!==this.keys.length){var t=this.keys.length-1;return e[0]=this.keys[t],e[1]=this.values[t],e}},e.prototype.clone=function(){var t=this.values;return new e(this.keys.slice(0),t===c?t:t.slice(0))},e.prototype.greedyClone=function(e){return this.isShared&&!e?this:this.clone()},e.prototype.get=function(e,t,r){var n=this.indexOf(e,-1,r._compare);return n<0?t:this.values[n]},e.prototype.getPairOrNextLower=function(e,t,r,n){var i=this.indexOf(e,-1,t),o=i<0?~i-1:r?i:i-1;if(o>=0)return n[0]=this.keys[o],n[1]=this.values[o],n},e.prototype.getPairOrNextHigher=function(e,t,r,n){var i=this.indexOf(e,-1,t),o=i<0?~i:r?i:i+1,s=this.keys;if(o<s.length)return n[0]=s[o],n[1]=this.values[o],n},e.prototype.checkValid=function(e,t,r,n){var i=this.keys.length,o=this.values.length;if(O(this.values===c?i<=o:i===o,"keys/values length mismatch: depth",e,"with lengths",i,o,"and baseIndex",r),O(0==e||i>0,"empty leaf at depth",e,"and baseIndex",r),!0===n)for(var s=1;s<i;s++)O(t._compare(this.keys[s-1],this.keys[s])<0,"keys out of order at depth",e,"and baseIndex",r+s-1,": ",this.keys[s-1]," !< ",this.keys[s]);return[i,this.keys[0],this.keys[i-1]]},e.prototype.set=function(e,t,r,n){var i=this.indexOf(e,-1,n._compare);if(i<0){if(i=~i,this.keys.length<n._maxNodeSize)return this.insertInLeaf(i,e,t,n);var o=this.splitOffRightSide(),s=this;return i>this.keys.length&&(i-=this.keys.length,s=o),s.insertInLeaf(i,e,t,n),o}return!1!==r&&(void 0!==t&&this.reifyValues(),this.keys[i]=e,this.values[i]=t),!1},e.prototype.reifyValues=function(){return this.values===c?this.values=this.values.slice(0,this.keys.length):this.values},e.prototype.insertInLeaf=function(e,t,r,n){if(this.keys.splice(e,0,t),this.values===c){for(;c.length<n._maxNodeSize;)c.push(void 0);if(void 0===r)return!0;this.values=c.slice(0,this.keys.length-1)}return this.values.splice(e,0,r),!0},e.prototype.takeFromRight=function(e){var t=this.values;e.values===c?t!==c&&t.push(void 0):(t=this.reifyValues()).push(e.values.shift()),this.keys.push(e.keys.shift())},e.prototype.takeFromLeft=function(e){var t=this.values;e.values===c?t!==c&&t.unshift(void 0):(t=this.reifyValues()).unshift(e.values.pop()),this.keys.unshift(e.keys.pop())},e.prototype.splitOffRightSide=function(){var t=this.keys.length>>1;return new e(this.keys.splice(t),this.values===c?c:this.values.splice(t))},e.prototype.forRange=function(e,t,r,n,i,o,s){var a,u,l=i._compare;if(t===e){if(!r)return o;if(u=(a=this.indexOf(e,-1,l))+1,a<0)return o}else a=this.indexOf(e,0,l),(u=this.indexOf(t,-1,l))<0?u=~u:!0===r&&u++;var h=this.keys,f=this.values;if(void 0!==s)for(var p=a;p<u;p++){var d=h[p],v=s(d,f[p],o++);if(void 0!==v){if(!0===n){if(d!==h[p]||!0===this.isShared)throw new Error("BTree illegally changed or cloned in editRange");v.delete?(this.keys.splice(p,1),this.values!==c&&this.values.splice(p,1),p--,u--):v.hasOwnProperty("value")&&(f[p]=v.value)}if(void 0!==v.break)return v}}else o+=u-a;return o},e.prototype.mergeSibling=function(e,t){if(this.keys.push.apply(this.keys,e.keys),this.values===c){if(e.values===c)return;this.values=this.values.slice(0,this.keys.length)}this.values.push.apply(this.values,e.reifyValues())},e}();t.BNode=u;var l=function(e){function t(t,r,n){var i=this;if(!n){n=[];for(var o=0;o<t.length;o++)n[o]=t[o].maxKey()}return(i=e.call(this,n)||this).children=t,i._size=r,i}return n(t,e),t.prototype.clone=function(){for(var e=this.children.slice(0),r=0;r<e.length;r++)e[r].isShared=!0;return new t(e,this._size,this.keys.slice(0))},t.prototype.size=function(){return this._size},t.prototype.greedyClone=function(e){if(this.isShared&&!e)return this;for(var r=new t(this.children.slice(0),this._size,this.keys.slice(0)),n=0;n<r.children.length;n++)r.children[n]=r.children[n].greedyClone(e);return r},t.prototype.minKey=function(){return this.children[0].minKey()},t.prototype.minPair=function(e){return this.children[0].minPair(e)},t.prototype.maxPair=function(e){return this.children[this.children.length-1].maxPair(e)},t.prototype.get=function(e,t,r){var n=this.indexOf(e,0,r._compare),i=this.children;return n<i.length?i[n].get(e,t,r):void 0},t.prototype.getPairOrNextLower=function(e,t,r,n){var i=this.indexOf(e,0,t),o=this.children;if(i>=o.length)return this.maxPair(n);var s=o[i].getPairOrNextLower(e,t,r,n);return void 0===s&&i>0?o[i-1].maxPair(n):s},t.prototype.getPairOrNextHigher=function(e,t,r,n){var i=this.indexOf(e,0,t),o=this.children,s=o.length;if(!(i>=s)){var a=o[i].getPairOrNextHigher(e,t,r,n);return void 0===a&&i<s-1?o[i+1].minPair(n):a}},t.prototype.checkValid=function(e,t,r,n){var i=this.keys.length,o=this.children.length;O(i===o,"keys/children length mismatch: depth",e,"lengths",i,o,"baseIndex",r),O(i>1||e>0,"internal node has length",i,"at depth",e,"baseIndex",r);for(var s=0,a=this.children,u=this.keys,l=0,c=void 0,h=void 0,p=0;p<o;p++){var d=a[p],v=d.checkValid(e+1,t,r+s,n),y=v[0],g=v[1],_=v[2];O(y===d.size(),"cached size mismatch at depth",e,"index",p,"baseIndex",r),O(1===y||t._compare(g,_)<0,"child node keys not sorted at depth",e,"index",p,"baseIndex",r),void 0!==c&&void 0!==h&&n&&(O(!f(c,h,g,_,t._compare),"children keys not sorted at depth",e,"index",p,"baseIndex",r,": ",h," !< ",g),O(t._compare(h,g)<0,"children keys not sorted at depth",e,"index",p,"baseIndex",r,": ",h," !< ",g)),c=g,h=_,O((s+=y)>=(l+=d.keys.length),"wtf",r),O(0===p||a[p-1].constructor===d.constructor,"type mismatch, baseIndex:",r),d.maxKey()!=u[p]&&O(!1,"keys[",p,"] =",u[p],"is wrong, should be ",d.maxKey(),"at depth",e,"baseIndex",r),0===p||t._compare(u[p-1],u[p])<0||O(!1,"sort violation at depth",e,"index",p,"keys",u[p-1],u[p])}O(this._size===s,"internal node cached size mismatch at depth",e,"baseIndex",r,"cached",this._size,"actual",s);var m=0===l;return(m||l>t.maxNodeSize*o)&&O(!1,m?"too few":"too many","children (",l,s,") at depth",e,"maxNodeSize:",t.maxNodeSize,"children.length:",o,"baseIndex:",r),[s,this.minKey(),this.maxKey()]},t.prototype.set=function(e,t,r,n){var i,o=this.children,s=n._maxNodeSize,a=n._compare,u=Math.min(this.indexOf(e,0,a),o.length-1),l=o[u];l.isShared&&(o[u]=l=l.clone()),l.keys.length>=s&&(u>0&&(i=o[u-1]).keys.length<s&&a(l.keys[0],e)<0?(i.isShared&&(o[u-1]=i=i.clone()),i.takeFromRight(l),this.keys[u-1]=i.maxKey()):void 0!==(i=o[u+1])&&i.keys.length<s&&a(l.maxKey(),e)<0&&(i.isShared&&(o[u+1]=i=i.clone()),i.takeFromLeft(l),this.keys[u]=o[u].maxKey()));var c=l.size(),h=l.set(e,t,r,n);if(this._size+=l.size()-c,!1===h)return!1;if(this.keys[u]=l.maxKey(),!0===h)return!0;if(this.keys.length<s)return this.insert(u+1,h),!0;var f=this.splitOffRightSide(),p=this;return a(h.maxKey(),this.maxKey())>0&&(p=f,u-=this.keys.length),p.insert(u+1,h),f},t.prototype.insert=function(e,t){this.children.splice(e,0,t),this.keys.splice(e,0,t.maxKey()),this._size+=t.size()},t.prototype.splitOffRightSide=function(){var e=this.children.length>>1,r=this.children.splice(e),n=this.keys.splice(e),i=this._size;return this._size=h(this.children),new t(r,i-this._size,n)},t.prototype.splitOffLeftSide=function(){var e=this.children.length>>1,r=this.children.splice(0,e),n=this.keys.splice(0,e),i=this._size;return this._size=h(this.children),new t(r,i-this._size,n)},t.prototype.takeFromRight=function(e){var t=e;this.keys.push(e.keys.shift());var r=t.children.shift();this.children.push(r);var n=r.size();t._size-=n,this._size+=n},t.prototype.takeFromLeft=function(e){var t=e,r=t.children.pop();this.keys.unshift(e.keys.pop()),this.children.unshift(r);var n=r.size();t._size-=n,this._size+=n},t.prototype.forRange=function(e,t,r,n,i,o,s){var a=i._compare,u=this.keys,l=this.children,c=this.indexOf(e,0,a),h=c,f=Math.min(t===e?c:this.indexOf(t,0,a),u.length-1);if(n){if(h<=f)try{for(;h<=f;h++){var p=l[h];p.isShared&&(l[h]=p=p.clone());var d=p.size(),v=p.forRange(e,t,r,n,i,o,s);if(u[h]=p.maxKey(),this._size+=p.size()-d,"number"!=typeof v)return v;o=v}}finally{var y=i._maxNodeSize>>1;for(c>0&&c--,h=f;h>=c;h--)l[h].keys.length<=y&&(0!==l[h].keys.length?this.tryMerge(h,i._maxNodeSize):(u.splice(h,1),O(0===l.splice(h,1)[0].size(),"emptiness cleanup")));0!==l.length&&0===l[0].keys.length&&O(!1,"emptiness bug")}}else for(;h<=f;h++){var g=l[h].forRange(e,t,r,n,i,o,s);if("number"!=typeof g)return g;o=g}return o},t.prototype.tryMerge=function(e,t){var r=this.children;return e>=0&&e+1<r.length&&r[e].keys.length+r[e+1].keys.length<=t&&(r[e].isShared&&(r[e]=r[e].clone()),r[e].mergeSibling(r[e+1],t),r.splice(e+1,1),this.keys.splice(e+1,1),this.keys[e]=r[e].maxKey(),!0)},t.prototype.mergeSibling=function(e,t){var r=this.keys.length;this.keys.push.apply(this.keys,e.keys);var n=e.children;if(this.children.push.apply(this.children,n),this._size+=e.size(),e.isShared&&!this.isShared)for(var i=0;i<n.length;i++)n[i].isShared=!0;this.tryMerge(r-1,t)},t}(u);t.BNodeInternal=l;var c=[];function h(e){for(var t=0,r=0;r<e.length;r++)t+=e[r].size();return t}function f(e,t,r,n,i){return i(e,n)<=0&&i(t,r)>=0}t.sumChildSizes=h,t.areOverlapping=f;var p,d,v={delete:!0},y=function(){return v},g={break:!0},_=((p=new u).isShared=!0,p),m=[],b=[];function O(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(!e)throw t.unshift("B+ tree"),new Error(t.join(" "))}t.check=O,t.EmptyBTree=((d=new s).freeze(),d)},184(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=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)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var l=r(501),c=u(r(521)),h=u(r(922)),f=u(r(846)),p=r(623),d=o(r(139)),v=u(r(876)),y=u(r(103)),g=u(r(392)),_=r(628),m=r(539),b=r(439),O=g.default.getInstance(),E=y.default.getInstance(),w=new _.Logger(d.APP_CONFIGURATION),I=function(){function e(){this.isRestrictedNetwork=!1,this.setContextConfigFetched=!1}return e.prototype.init=function(e,t,r,n,i){var o;this.region=e,this.guid=t,this.apikey=r,this.overrideServiceUrl=n,this.isRestrictedNetwork=i,(null===(o=null===window||void 0===window?void 0:window.IBM_CLOUD_APP_CONFIG)||void 0===o?void 0:o.isClientInRestrictedNetwork)&&(this.isRestrictedNetwork=!0)},e.prototype.setContext=function(e,t){return s(this,void 0,void 0,function(){var r;return a(this,function(n){switch(n.label){case 0:return O.init({region:this.region,guid:this.guid,apikey:this.apikey,collectionId:e,environmentId:t,overrideServiceUrl:this.overrideServiceUrl,isRestrictedNetwork:this.isRestrictedNetwork}),E.init(e,t),m.PhaseScheduler.onPhaseCallback=function(){v.default.emit(d.CONFIGURATION_UPDATE_EVENT)},this.isRestrictedNetwork?[4,(0,b.retryableGetConfig)()]:[3,2];case 1:return r=n.sent(),this.saveInCache(r),this.setContextConfigFetched=!0,this.connectEventSource().catch(function(e){return Promise.reject(e)}),[3,4];case 2:return[4,this.connectEventSource()];case 3:n.sent(),n.label=4;case 4:return[2]}})})},e.prototype.saveInCache=function(e){m.PhaseScheduler.reset();var t={},r={};Object.keys(e.environments[0].features).length&&e.environments[0].features.forEach(function(e){if(t[e.feature_id]=new c.default(e),e.rollout_configuration&&((o=(0,m.parseRolloutConfigurationPhases)(e.rollout_configuration))?r[e.feature_id]=o:w.log("Error parsing feature rollout configuration")),e.segment_rules&&e.segment_rules.length>0)for(var n=0,i=e.segment_rules;n<i.length;n++){var o,s=i[n];if(s.rollout_configuration)if(o=(0,m.parseRolloutConfigurationPhases)(s.rollout_configuration)){var a=e.feature_id+d.DELIMITER+(s.rule_id||"");r[a]=o}else w.log("Error parsing segment rule rollout configuration")}});var n={};Object.keys(e.environments[0].properties).length&&e.environments[0].properties.forEach(function(e){n[e.property_id]=new h.default(e)});var i={};Object.keys(e.segments).length&&e.segments.forEach(function(e){i[e.segment_id]=new f.default(e)}),(0,l.setCache)(t,n,i,r)},e.prototype.connectEventSource=function(){var e=this,t=O.getEventSourceUrl(),r=O.getEventSourceHeaders(),n=new p.EventSourcePolyfill(t,r);return this.isRestrictedNetwork?n.addEventListener("SSEEvent_update",function(t){w.log("Update event received. Fetching data from server..."),(0,b.retryableGetConfig)().then(function(t){e.saveInCache(t),v.default.emit(d.CONFIGURATION_UPDATE_EVENT)})}):n.addEventListener("SSEConfig_payload",function(t){var r=JSON.parse(t.data);w.log("Update event received."),e.saveInCache(r),v.default.emit(d.CONFIGURATION_UPDATE_EVENT)}),new Promise(function(t,r){n.addEventListener("error",function(e){r(e)}),n.addEventListener("Registration",function(r){if(e.isRestrictedNetwork)e.setContextConfigFetched?(e.setContextConfigFetched=!1,v.default.emit(d.REGISTRATION_EVENT),w.log("Client registration complete."),t()):(0,b.retryableGetConfig)().then(function(r){e.saveInCache(r),v.default.emit(d.REGISTRATION_EVENT),w.log("Client registration complete."),t()});else{var n=JSON.parse(r.data);e.saveInCache(n),v.default.emit(d.REGISTRATION_EVENT),w.log("Client registration complete."),t()}})})},e.prototype.getFeature=function(e){if(Object.prototype.hasOwnProperty.call((0,l.getCacheInstance)().features,e))return(0,l.getCacheInstance)().features[e];throw new Error("".concat(d.APP_CONFIGURATION,"Invalid feature flag id: ",e))},e.prototype.getFeatures=function(){return(0,l.getCacheInstance)().features},e.prototype.getProperty=function(e){if(Object.prototype.hasOwnProperty.call((0,l.getCacheInstance)().properties,e))return(0,l.getCacheInstance)().properties[e];throw new Error("".concat(d.APP_CONFIGURATION,"Invalid property id: ",e))},e.prototype.getProperties=function(){return(0,l.getCacheInstance)().properties},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e}();t.default=I},156(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=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)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var l,c=u(r(184)),h=r(439),f=o(r(139)),p=u(r(876)),d=u(r(103)),v=c.default.getInstance(),y=d.default.getInstance(),g=!1,_=function(){function e(){if(this.isInitialized=!1,this.isInitializedContext=!1,this.emitter=p.default,!(0,h.fetchAvailable)())throw new Error("".concat(f.APP_CONFIGURATION,'Either provide your own "fetch" implementation or run in an environment where "fetch" is available.'));window.addEventListener("beforeunload",function(){y.sendMetering(!0)})}return e.prototype.init=function(e,t,r){if(!e||!t||!r)throw e?t?new Error("".concat(f.APP_CONFIGURATION,"apikey is required")):new Error("".concat(f.APP_CONFIGURATION,"guid is required")):new Error("".concat(f.APP_CONFIGURATION,"region is required"));v.init(e,t,r,l,g),this.isInitialized=!0},e.prototype.setContext=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(r){switch(r.label){case 0:if(!this.isInitialized)throw new Error("".concat(f.APP_CONFIGURATION,"init should be called first"));if(!e)throw new Error("".concat(f.APP_CONFIGURATION,"collectionId is required"));if(!t)throw new Error("".concat(f.APP_CONFIGURATION,"environmentId is required"));return this.isInitializedContext=!0,[4,v.setContext(e,t)];case 1:return r.sent(),[2]}})})},e.prototype.getFeature=function(e){if(this.isInitialized&&this.isInitializedContext)return v.getFeature(e);throw new Error("".concat(f.APP_CONFIGURATION,"getFeature: SDK not initialised."))},e.prototype.getFeatures=function(){if(this.isInitialized&&this.isInitializedContext)return v.getFeatures();throw new Error("".concat(f.APP_CONFIGURATION,"getFeatures: SDK not initialised."))},e.prototype.getProperty=function(e){if(this.isInitialized&&this.isInitializedContext)return v.getProperty(e);throw new Error("".concat(f.APP_CONFIGURATION,"getProperty: SDK not initialised."))},e.prototype.getProperties=function(){if(this.isInitialized&&this.isInitializedContext)return v.getProperties();throw new Error("".concat(f.APP_CONFIGURATION,"getProperties: SDK not initialised."))},e.overrideServiceUrl=function(e){if(!e)throw new Error("".concat(f.APP_CONFIGURATION,"Unexpected url passed to overrideServiceUrl()"));l=e},e.prototype.setClientInRestrictedNetwork=function(){g=!0},e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.REGION_US_SOUTH="us-south",e.REGION_EU_GB="eu-gb",e.REGION_AU_SYD="au-syd",e.REGION_US_EAST="us-east",e.REGION_EU_DE="eu-de",e.REGION_CA_TOR="ca-tor",e.REGION_JP_TOK="jp-tok",e.REGION_JP_OSA="jp-osa",e}();t.default=_},501(e,t){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.getCacheInstance=t.setCache=void 0,t.setCache=function(e,t,n,i){var o={features:{},properties:{},segments:{},rolloutConfigMap:{}};o.features=e,o.properties=t,o.segments=n,o.rolloutConfigMap=i,r=o},t.getCacheInstance=function(){return r}},521(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=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)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=o(r(139)),u=r(54),l=s(r(103)),c=r(501),h=s(r(302)),f=new(r(628).Logger)(a.APP_CONFIGURATION),p=r(539),d=r(139),v=function(){function e(e){var t=e.name,r=e.feature_id,n=e.type,i=e.format,o=void 0===i?void 0:i,s=e.enabled_value,u=e.disabled_value,l=e.segment_rules,c=e.enabled,f=e.rollout_percentage,p=void 0===f?100:f,d=e.rollout_type,v=void 0===d?a.MANUAL:d,y=e.rollout_configuration,g=void 0===y?void 0:y;this.name=t,this.feature_id=r,this.type=n,this.format=o,this.enabled_value=s,this.disabled_value=u,this.enabled=c,this.rollout_percentage=p,this.segment_rules=[];for(var _=0,m=l;_<m.length;_++){var b=m[_];this.segment_rules.push(new h.default(b))}this.rollout_type=v,this.rollout_configuration=g}return e.prototype.getFeatureName=function(){return this.name},e.prototype.getFeatureId=function(){return this.feature_id},e.prototype.getFeatureDataType=function(){return this.type},e.prototype.getFeatureDataFormat=function(){return this.format||"STRING"!==this.type||(this.format="TEXT"),this.format},e.prototype.isEnabled=function(){return this.enabled},e.prototype.getCurrentValue=function(e,t){return void 0===t&&(t={}),e?this.featureEvaluation(e,t).current_value:(f.log("".concat("Feature flag evaluation: ",a.INVALID_ENTITY_ID," getCurrentValue")),null)},e.prototype.featureEvaluation=function(e,t){var r,n={evaluated_segment_id:a.DEFAULT_SEGMENT_ID,value:void 0,is_enabled:!1};try{if(this.enabled){if(this.segment_rules.length>0&&Object.keys(t).length>0){var i=this.parseRules(this.segment_rules);return{current_value:(n=this.evaluateRules(i,e,t)).value,is_enabled:n.is_enabled}}var o=void 0;if(this.rollout_configuration||this.rollout_type===d.PROGRESSIVE){var s=(0,c.getCacheInstance)().rolloutConfigMap[this.feature_id];s?(e+=null===(r=this.rollout_configuration)||void 0===r?void 0:r.start_at,o=(0,p.getCurrentRolloutPercentage)(s)):o=0}else o=this.rollout_percentage;return 100===o||(0,u.getNormalizedValue)("".concat(e,":",this.feature_id))<o?{current_value:this.enabled_value,is_enabled:!0}:{current_value:this.disabled_value,is_enabled:!1}}return{current_value:this.disabled_value,is_enabled:!1}}finally{l.default.getInstance().addMetering(e,n.evaluated_segment_id,this.feature_id,null)}},e.prototype.parseRules=function(e){var t={};return e.forEach(function(e){t[e.order]=e}),t},e.prototype.evaluateRules=function(e,t,r){var n,i,o,s,l={evaluated_segment_id:a.DEFAULT_SEGMENT_ID,value:void 0,is_enabled:!1};try{for(var f=1;f<=Object.keys(e).length;f+=1){var v=e[f];if(v.rules.length>0)for(var y=0,g=v.rules;y<g.length;y++){var _=g[y].segments;if(_.length>0)for(var m=0,b=_;m<b.length;m++){var O=b[m];if(this.evaluateSegment(O,r)){l.evaluated_segment_id=O;var E=void 0,w=new h.default(v);if(void 0!==w.getRolloutConfiguration()||w.getRolloutType()===d.PROGRESSIVE){var I=void 0;if(v.rollout_percentage===a.DEFAULT_ROLLOUT_PERCENTAGE)I=(0,c.getCacheInstance)().rolloutConfigMap[this.feature_id];else{var P=this.feature_id+a.DELIMITER+(null===(n=w.getRuleId())||void 0===n?void 0:n.toString());I=(0,c.getCacheInstance)().rolloutConfigMap[P]}I?(t+=null===(i=w.getRolloutConfiguration())||void 0===i?void 0:i.start_at,E=(0,p.getCurrentRolloutPercentage)(I)):E=0}else E=v.rollout_percentage===a.DEFAULT_ROLLOUT_PERCENTAGE?this.rollout_percentage:v.rollout_percentage;return 100===E||(0,u.getNormalizedValue)("".concat(t,":",this.feature_id))<E?(v.value===a.DEFAULT_FEATURE_VALUE?l.value=this.enabled_value:l.value=v.value,l.is_enabled=!0):(l.value=this.disabled_value,l.is_enabled=!1),l}}}}}catch(e){console.error("".concat(a.APP_CONFIGURATION,"FeatureFlagRuleEvaluation",e.message))}return this.rollout_configuration||this.rollout_type===d.PROGRESSIVE?(I=(0,c.getCacheInstance)().rolloutConfigMap[this.feature_id])?(t+=null===(o=this.rollout_configuration)||void 0===o?void 0:o.start_at,s=(0,p.getCurrentRolloutPercentage)(I)):s=0:s=this.rollout_percentage,100===s||(0,u.getNormalizedValue)("".concat(t,":",this.feature_id))<s?(l.value=this.enabled_value,l.is_enabled=!0):(l.value=this.disabled_value,l.is_enabled=!1),l},e.prototype.evaluateSegment=function(e,t){var r=(0,c.getCacheInstance)().segments;return!!Object.prototype.hasOwnProperty.call(r,e)&&r[e].evaluateRule(t)},e}();t.default=v},302(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=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)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});var s=o(r(139)),a=function(){function e(e){var t=e.rules,r=e.value,n=e.order,i=e.rollout_percentage,o=void 0===i?100:i,a=e.rule_id,u=void 0===a?void 0:a,l=e.rollout_type,c=void 0===l?s.MANUAL:l,h=e.rollout_configuration,f=void 0===h?void 0:h;this.rules=t,this.value=r,this.order=n,this.rollout_percentage=o,this.rule_id=u,this.rollout_type=c,this.rollout_configuration=f}return e.prototype.getRules=function(){return this.rules},e.prototype.getValue=function(){return this.value},e.prototype.getOrder=function(){return this.order},e.prototype.getRolloutPercentage=function(){return this.rollout_percentage},e.prototype.getRuleId=function(){return this.rule_id},e.prototype.getRolloutType=function(){return this.rollout_type||s.MANUAL},e.prototype.getRolloutConfiguration=function(){return this.rollout_configuration},e}();t.default=a},922(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=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)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=o(r(139)),u=s(r(103)),l=r(501),c=s(r(427)),h=new(r(628).Logger)(a.APP_CONFIGURATION),f=function(){function e(e){var t=e.name,r=e.property_id,n=e.type,i=e.format,o=void 0===i?void 0:i,s=e.value,a=e.segment_rules;this.name=t,this.property_id=r,this.type=n,this.format=o,this.value=s,this.segment_rules=[];for(var u=0,l=a;u<l.length;u++){var h=l[u];this.segment_rules.push(new c.default(h))}}return e.prototype.getPropertyName=function(){return this.name},e.prototype.getPropertyId=function(){return this.property_id},e.prototype.getPropertyDataType=function(){return this.type},e.prototype.getPropertyDataFormat=function(){return this.format||"STRING"!==this.type||(this.format="TEXT"),this.format},e.prototype.getCurrentValue=function(e,t){return void 0===t&&(t={}),e?this.propertyEvaluation(e,t):(h.log("".concat("Property evaluation: ",a.INVALID_ENTITY_ID," getCurrentValue")),null)},e.prototype.propertyEvaluation=function(e,t){var r={evaluated_segment_id:a.DEFAULT_SEGMENT_ID,value:null};try{if(this.segment_rules.length>0&&Object.keys(t).length>0){var n=this.parseRules(this.segment_rules);return(r=this.evaluateRules(n,e,t)).value}return this.value}finally{u.default.getInstance().addMetering(e,r.evaluated_segment_id,null,this.property_id)}},e.prototype.parseRules=function(e){var t={};return e.forEach(function(e){t[e.order]=e}),t},e.prototype.evaluateRules=function(e,t,r){var n={evaluated_segment_id:a.DEFAULT_SEGMENT_ID,value:null};try{for(var i=1;i<=Object.keys(e).length;i+=1){var o=e[i];if(o.rules.length>0)for(var s=0,u=o.rules;s<u.length;s++){var l=u[s].segments;if(l.length>0)for(var c=0,h=l;c<h.length;c++){var f=h[c];if(this.evaluateSegment(f,r))return n.evaluated_segment_id=f,o.value===a.DEFAULT_PROPERTY_VALUE?n.value=this.value:n.value=o.value,n}}}}catch(e){console.error("".concat(a.APP_CONFIGURATION,"PropertyRuleEvaluation",e.message))}return n.value=this.value,n},e.prototype.evaluateSegment=function(e,t){var r=(0,l.getCacheInstance)().segments;return!!Object.prototype.hasOwnProperty.call(r,e)&&r[e].evaluateRule(t)},e}();t.default=f},427(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){var t=e.rules,r=e.value,n=e.order;this.rules=t,this.value=r,this.order=n}return e.prototype.getRules=function(){return this.rules},e.prototype.getValue=function(){return this.value},e.prototype.getOrder=function(){return this.order},e}();t.default=r},9(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){var t=e.attribute_name,r=e.operator,n=e.values;this.attribute_name=t,this.operator=r,this.values=n}return e.prototype.operatorCheck=function(e,t){var r=!1;if(null==e||""===t)return r;switch(this.operator){case"endsWith":r=new RegExp("".concat(t,"$"),"i").test(e);break;case"notEndsWith":r=!new RegExp("".concat(t,"$"),"i").test(e);break;case"startsWith":r=new RegExp("^".concat(t),"i").test(e);break;case"notStartsWith":r=!new RegExp("^".concat(t),"i").test(e);break;case"contains":r=e.includes(t);break;case"notContains":r=!e.includes(t);break;case"is":r="number"==typeof e?e===parseFloat(t):e.toString()===t.toString();break;case"isNot":r="number"==typeof e?e!==parseFloat(t):e.toString()!==t.toString();break;case"greaterThan":r=parseFloat(e)>parseFloat(t);break;case"lesserThan":r=parseFloat(e)<parseFloat(t);break;case"greaterThanEquals":r=parseFloat(e)>=parseFloat(t);break;case"lesserThanEquals":r=parseFloat(e)<=parseFloat(t);break;default:r=!1}return r},e.prototype.evaluateRule=function(e){var t,r=!1;if(!Object.prototype.hasOwnProperty.call(e,this.attribute_name))return r;if(t=e[this.attribute_name],["isNot","notContains","notStartsWith","notEndsWith"].includes(this.operator)){r=!0;for(var n=0;n<this.values.length;n+=1){var i=this.values[n];this.operatorCheck(t,i)||(r=!1)}}else for(n=0;n<this.values.length;n+=1)i=this.values[n],this.operatorCheck(t,i)&&(r=!0);return r},e}();t.default=r},846(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 i=n(r(9)),o=function(){function e(e){var t=e.name,r=e.segment_id,n=e.rules;this.name=t,this.segment_id=r,this.rules=n}return e.prototype.evaluateRule=function(e){for(var t=0,r=this.rules;t<r.length;t++){var n=r[t];if(!new i.default(n).evaluateRule(e))return!1}return!0},e}();t.default=o},439(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=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)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.retryablePostMetering=t.fetchAvailable=t.retryableGetConfig=void 0;var l=o(r(139)),c=r(908),h=u(r(392)).default.getInstance();t.retryableGetConfig=function e(t){return void 0===t&&(t=l.NUMBER_OF_RETRIES),s(this,void 0,void 0,function(){var r,n,i=this;return a(this,function(o){return r=h.getConfigUrl(),n={method:"GET",headers:h.getAPICallHeaders()},[2,fetch(r,n).then(function(r){return s(i,void 0,void 0,function(){var n;return a(this,function(i){switch(i.label){case 0:return r.ok?[4,r.json()]:[3,2];case 1:return[2,i.sent()];case 2:return(r.status>=500&&r.status<=599||429===r.status)&&t>1?[2,e(t-1)]:(n=c.APIError.bind,[4,r.text()]);case 3:throw new(n.apply(c.APIError,[void 0,i.sent(),r.status]))}})})})]})})},t.fetchAvailable=function(){return"fetch"in window},t.retryablePostMetering=function e(t,r,n){return void 0===n&&(n=l.NUMBER_OF_RETRIES),s(this,void 0,void 0,function(){var i,o,u=this;return a(this,function(l){return i=h.getMeteringUrl(),o={method:"POST",headers:h.getAPICallHeaders(!