configcat-vue 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,26 @@
1
1
  import { User } from '@configcat/sdk';
2
- declare function __VLS_template(): {
3
- default?(_: {}): any;
4
- else?(_: {}): any;
5
- loading?(_: {}): any;
6
- };
7
- declare const __VLS_component: import('vue').DefineComponent<{
2
+ type __VLS_Props = {
8
3
  featureKey: string;
9
4
  userObject?: User;
10
- }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
5
+ };
6
+ declare function __VLS_template(): {
7
+ attrs: Partial<{}>;
8
+ slots: {
9
+ default?(_: {}): any;
10
+ else?(_: {}): any;
11
+ loading?(_: {}): any;
12
+ };
13
+ refs: {};
14
+ rootEl: any;
15
+ };
16
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
17
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
11
18
  flagValueChanged: (newValue: boolean) => any;
12
- }, string, import('vue').PublicProps, Readonly<{
13
- featureKey: string;
14
- userObject?: User;
15
- }> & Readonly<{
19
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
16
20
  onFlagValueChanged?: ((newValue: boolean) => any) | undefined;
17
21
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
22
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
19
23
  export default _default;
20
-
21
24
  type __VLS_WithTemplateSlots<T, S> = T & {
22
25
  new (): {
23
26
  $slots: S;
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as bt, ref as Ct, inject as Nt, onBeforeMount as Rt, onUnmounted as Ft, renderSlot as ue } from "vue";
2
- var pe;
2
+ var ve;
3
3
  (function(i) {
4
4
  i[i.No = 0] = "No", i[i.Should = 1] = "Should", i[i.Force = 2] = "Force";
5
- })(pe || (pe = {}));
5
+ })(ve || (ve = {}));
6
6
  var te;
7
7
  (function(i) {
8
8
  i[i.Boolean = 0] = "Boolean", i[i.String = 1] = "String", i[i.Int = 2] = "Int", i[i.Double = 3] = "Double";
@@ -25,7 +25,7 @@ const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
25
25
  return me;
26
26
  },
27
27
  get RedirectMode() {
28
- return pe;
28
+ return ve;
29
29
  },
30
30
  get SegmentComparator() {
31
31
  return Ee;
@@ -79,21 +79,21 @@ class O {
79
79
  const a = r.length > 0 ? r : void 0;
80
80
  n = s + 1, r = e.substring(n);
81
81
  let l, c;
82
- return r.length > 0 && (l = M.deserialize(r), c = r), new O(c, l, o, a);
82
+ return r.length > 0 && (l = U.deserialize(r), c = r), new O(c, l, o, a);
83
83
  }
84
84
  }
85
85
  O.serializationFormatVersion = "v2";
86
86
  O.empty = new O(void 0, void 0, 0, void 0);
87
- class M {
87
+ class U {
88
88
  static deserialize(e) {
89
89
  const t = JSON.parse(e);
90
90
  if (typeof t != "object" || !t)
91
91
  throw new Error("Invalid config JSON content:" + e);
92
- return new M(t);
92
+ return new U(t);
93
93
  }
94
94
  constructor(e) {
95
95
  var t, n;
96
- this.preferences = e.p != null ? new Lt(e.p) : void 0, this.segments = (n = (t = e.s) === null || t === void 0 ? void 0 : t.map((s) => new kt(s))) !== null && n !== void 0 ? n : [], this.settings = e.f != null ? Object.entries(e.f).reduce((s, [r, o]) => (s[r] = new U(o, this), s), {}) : {};
96
+ this.preferences = e.p != null ? new Lt(e.p) : void 0, this.segments = (n = (t = e.s) === null || t === void 0 ? void 0 : t.map((s) => new kt(s))) !== null && n !== void 0 ? n : [], this.settings = e.f != null ? Object.entries(e.f).reduce((s, [r, o]) => (s[r] = new $(o, this), s), {}) : {};
97
97
  }
98
98
  get salt() {
99
99
  var e;
@@ -116,15 +116,13 @@ class Fe {
116
116
  this.value = t ? e.v : at(e.v), this.variationId = e.i;
117
117
  }
118
118
  }
119
- class U extends Fe {
119
+ class $ extends Fe {
120
120
  constructor(e, t) {
121
121
  var n, s, r, o, a, l;
122
- super(e, e.t < 0), this.type = e.t;
123
- const c = "Identifier";
124
- this.percentageOptionsAttribute = (n = e.a) !== null && n !== void 0 ? n : c, this.targetingRules = (r = (s = e.r) === null || s === void 0 ? void 0 : s.map((u) => new Dt(u, t))) !== null && r !== void 0 ? r : [], this.percentageOptions = (a = (o = e.p) === null || o === void 0 ? void 0 : o.map((u) => new rt(u))) !== null && a !== void 0 ? a : [], this.configJsonSalt = (l = t == null ? void 0 : t.salt) !== null && l !== void 0 ? l : "";
122
+ super(e, e.t < 0), this.type = e.t, this.percentageOptionsAttribute = (n = e.a) !== null && n !== void 0 ? n : "Identifier", this.targetingRules = (r = (s = e.r) === null || s === void 0 ? void 0 : s.map((c) => new Dt(c, t))) !== null && r !== void 0 ? r : [], this.percentageOptions = (a = (o = e.p) === null || o === void 0 ? void 0 : o.map((c) => new rt(c))) !== null && a !== void 0 ? a : [], this.configJsonSalt = (l = t == null ? void 0 : t.salt) !== null && l !== void 0 ? l : "";
125
123
  }
126
124
  static fromValue(e) {
127
- return new U({
125
+ return new $({
128
126
  t: -1,
129
127
  v: e
130
128
  });
@@ -257,7 +255,7 @@ class Le {
257
255
  }
258
256
  onConfigChanged(e) {
259
257
  var t;
260
- this.options.logger.debug("config changed"), this.options.hooks.emit("configChanged", (t = e.config) !== null && t !== void 0 ? t : new M({}));
258
+ this.options.logger.debug("config changed"), this.options.hooks.emit("configChanged", (t = e.config) !== null && t !== void 0 ? t : new U({}));
261
259
  }
262
260
  fetchAsync(e) {
263
261
  var t;
@@ -278,9 +276,9 @@ class Le {
278
276
  const [r, o] = await this.fetchRequestAsync((t = e.httpETag) !== null && t !== void 0 ? t : null);
279
277
  switch (r.statusCode) {
280
278
  case 200:
281
- return o instanceof M ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."), I.success(new O(r.body, o, O.generateTimestamp(), r.eTag))) : (s = n.logger.fetchReceived200WithInvalidBody(o).toString(), n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received but the HTTP response content was invalid. Returning null.`), I.error(e, s, o));
279
+ return o instanceof U ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."), I.success(new O(r.body, o, O.generateTimestamp(), r.eTag))) : (s = n.logger.fetchReceived200WithInvalidBody(o).toString(), n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received but the HTTP response content was invalid. Returning null.`), I.error(e, s, o));
282
280
  case 304:
283
- return e ? (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."), I.notModified(e.with(O.generateTimestamp()))) : (s = n.logger.fetchReceived304WhenLocalCacheIsEmpty(r.statusCode, r.reasonPhrase).toString(), n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received when no config is cached locally. Returning null.`), I.error(e, s));
281
+ return e.isEmpty ? (s = n.logger.fetchReceived304WhenLocalCacheIsEmpty(r.statusCode, r.reasonPhrase).toString(), n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received when no config is cached locally. Returning null.`), I.error(e, s)) : (n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."), I.notModified(e.with(O.generateTimestamp())));
284
282
  case 403:
285
283
  case 404:
286
284
  return s = n.logger.fetchFailedDueToInvalidSdkKey().toString(), n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning last config (if any) with updated timestamp."), I.error(e.with(O.generateTimestamp()), s);
@@ -303,7 +301,7 @@ class Le {
303
301
  return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): no response body."), [r, new Error("No response body.")];
304
302
  let o;
305
303
  try {
306
- o = M.deserialize(r.body);
304
+ o = U.deserialize(r.body);
307
305
  } catch (u) {
308
306
  return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): invalid response body."), [r, u];
309
307
  }
@@ -748,7 +746,7 @@ function ut(i) {
748
746
  var J = F << L | F >>> 32 - L;
749
747
  return J;
750
748
  }
751
- var t, n, s, r = new Array(80), o = 1732584193, a = 4023233417, l = 2562383102, c = 271733878, u = 3285377520, h, g, f, v, m, A;
749
+ var t, n, s, r = new Array(80), o = 1732584193, a = 4023233417, l = 2562383102, c = 271733878, u = 3285377520, h, g, f, p, m, A;
752
750
  i = K(i);
753
751
  var E = i.length, w = new Array();
754
752
  for (n = 0; n < E - 3; n += 4)
@@ -774,15 +772,15 @@ function ut(i) {
774
772
  r[n] = w[t + n];
775
773
  for (n = 16; n <= 79; n++)
776
774
  r[n] = e(r[n - 3] ^ r[n - 8] ^ r[n - 14] ^ r[n - 16], 1);
777
- for (h = o, g = a, f = l, v = c, m = u, n = 0; n <= 19; n++)
778
- A = e(h, 5) + (g & f | ~g & v) + m + r[n] + 1518500249 & 4294967295, m = v, v = f, f = e(g, 30), g = h, h = A;
775
+ for (h = o, g = a, f = l, p = c, m = u, n = 0; n <= 19; n++)
776
+ A = e(h, 5) + (g & f | ~g & p) + m + r[n] + 1518500249 & 4294967295, m = p, p = f, f = e(g, 30), g = h, h = A;
779
777
  for (n = 20; n <= 39; n++)
780
- A = e(h, 5) + (g ^ f ^ v) + m + r[n] + 1859775393 & 4294967295, m = v, v = f, f = e(g, 30), g = h, h = A;
778
+ A = e(h, 5) + (g ^ f ^ p) + m + r[n] + 1859775393 & 4294967295, m = p, p = f, f = e(g, 30), g = h, h = A;
781
779
  for (n = 40; n <= 59; n++)
782
- A = e(h, 5) + (g & f | g & v | f & v) + m + r[n] + 2400959708 & 4294967295, m = v, v = f, f = e(g, 30), g = h, h = A;
780
+ A = e(h, 5) + (g & f | g & p | f & p) + m + r[n] + 2400959708 & 4294967295, m = p, p = f, f = e(g, 30), g = h, h = A;
783
781
  for (n = 60; n <= 79; n++)
784
- A = e(h, 5) + (g ^ f ^ v) + m + r[n] + 3395469782 & 4294967295, m = v, v = f, f = e(g, 30), g = h, h = A;
785
- o = o + h & 4294967295, a = a + g & 4294967295, l = l + f & 4294967295, c = c + v & 4294967295, u = u + m & 4294967295;
782
+ A = e(h, 5) + (g ^ f ^ p) + m + r[n] + 3395469782 & 4294967295, m = p, p = f, f = e(g, 30), g = h, h = A;
783
+ o = o + h & 4294967295, a = a + g & 4294967295, l = l + f & 4294967295, c = c + p & 4294967295, u = u + m & 4294967295;
786
784
  }
787
785
  return gt([o, a, l, c, u]);
788
786
  }
@@ -804,12 +802,12 @@ function ht(i) {
804
802
  }
805
803
  var f = i[t] * 8;
806
804
  i += "€";
807
- for (var v = []; i[t] % 64 - 56; )
805
+ for (var p = []; i[t] % 64 - 56; )
808
806
  i += "\0";
809
807
  for (r = 0; r < i[t]; r++)
810
- o = i.charCodeAt(r), v[r >> 2] |= o << (3 - r) % 4 * 8;
811
- for (v[v[t]] = f / s | 0, v[v[t]] = f, o = 0; o < v[t]; ) {
812
- var m = v.slice(o, o += 16), A = l;
808
+ o = i.charCodeAt(r), p[r >> 2] |= o << (3 - r) % 4 * 8;
809
+ for (p[p[t]] = f / s | 0, p[p[t]] = f, o = 0; o < p[t]; ) {
810
+ var m = p.slice(o, o += 16), A = l;
813
811
  for (l = l.slice(0, 8), r = 0; r < 64; r++) {
814
812
  var E = m[r - 15], w = m[r - 2], F = l[0], L = l[4], J = l[7] + (e(L, 6) ^ e(L, 11) ^ e(L, 25)) + (L & l[5] ^ ~L & l[6]) + c[r] + (m[r] = r < 16 ? m[r] : m[r - 16] + (e(E, 7) ^ e(E, 18) ^ E >>> 3) + m[r - 7] + (e(w, 17) ^ e(w, 19) ^ w >>> 10) | 0), It = (e(F, 2) ^ e(F, 13) ^ e(F, 22)) + (F & l[1] ^ F & l[2] ^ l[1] & l[2]);
815
813
  l = [J + It | 0].concat(l), l[4] = l[4] + J | 0;
@@ -881,7 +879,7 @@ var He;
881
879
  (function(i) {
882
880
  i[i.Global = 0] = "Global", i[i.EuOnly = 1] = "EuOnly";
883
881
  })(He || (He = {}));
884
- class $ {
882
+ class P {
885
883
  constructor(e, t, n, s, r) {
886
884
  var o, a, l;
887
885
  if (this.requestTimeoutMs = 3e4, this.baseUrlOverriden = !1, this.offline = !1, !e)
@@ -898,9 +896,9 @@ class $ {
898
896
  this.hooks = {
899
897
  hooks: u,
900
898
  hooksWeakRef: h,
901
- emit(v, ...m) {
899
+ emit(p, ...m) {
902
900
  var A, E;
903
- return (E = (A = this.hooksWeakRef.deref()) === null || A === void 0 ? void 0 : A.emit(v, ...m)) !== null && E !== void 0 ? E : !1;
901
+ return (E = (A = this.hooksWeakRef.deref()) === null || A === void 0 ? void 0 : A.emit(p, ...m)) !== null && E !== void 0 ? E : !1;
904
902
  }
905
903
  };
906
904
  let g, f;
@@ -919,14 +917,14 @@ class $ {
919
917
  return delete e.hooks, t ?? new Ke(new we());
920
918
  }
921
919
  getUrl() {
922
- return this.baseUrl + "/configuration-files/" + this.sdkKey + "/" + $.configFileName + "?sdk=" + this.clientVersion;
920
+ return this.baseUrl + "/configuration-files/" + this.sdkKey + "/" + P.configFileName + "?sdk=" + this.clientVersion;
923
921
  }
924
922
  getCacheKey() {
925
- return ut(`${this.sdkKey}_${$.configFileName}_${O.serializationFormatVersion}`);
923
+ return ut(`${this.sdkKey}_${P.configFileName}_${O.serializationFormatVersion}`);
926
924
  }
927
925
  }
928
- $.configFileName = "config_v6.json";
929
- class ze extends $ {
926
+ P.configFileName = "config_v6.json";
927
+ class ze extends P {
930
928
  constructor(e, t, n, s, r, o) {
931
929
  super(e, t + "/a-" + n, s, r, o), this.pollIntervalSeconds = 60, this.maxInitWaitTimeSeconds = 5, s && (s.pollIntervalSeconds != null && (this.pollIntervalSeconds = s.pollIntervalSeconds), s.maxInitWaitTimeSeconds != null && (this.maxInitWaitTimeSeconds = s.maxInitWaitTimeSeconds));
932
930
  const a = 2147483;
@@ -936,12 +934,12 @@ class ze extends $ {
936
934
  throw new Error("Invalid 'maxInitWaitTimeSeconds' value");
937
935
  }
938
936
  }
939
- class je extends $ {
937
+ class je extends P {
940
938
  constructor(e, t, n, s, r, o) {
941
939
  super(e, t + "/m-" + n, s, r, o);
942
940
  }
943
941
  }
944
- class Je extends $ {
942
+ class Je extends P {
945
943
  constructor(e, t, n, s, r, o) {
946
944
  if (super(e, t + "/l-" + n, s, r, o), this.cacheTimeToLiveSeconds = 60, s && s.cacheTimeToLiveSeconds != null && (this.cacheTimeToLiveSeconds = s.cacheTimeToLiveSeconds), !(typeof this.cacheTimeToLiveSeconds == "number" && 1 <= this.cacheTimeToLiveSeconds && this.cacheTimeToLiveSeconds <= 2147483647))
947
945
  throw new Error("Invalid 'cacheTimeToLiveSeconds' value");
@@ -968,14 +966,14 @@ class Wt {
968
966
  function Ge(i) {
969
967
  const e = {};
970
968
  for (const t in i)
971
- Object.prototype.hasOwnProperty.call(i, t) && (e[t] = U.fromValue(i[t]));
969
+ Object.prototype.hasOwnProperty.call(i, t) && (e[t] = $.fromValue(i[t]));
972
970
  return e;
973
971
  }
974
972
  const Kt = "cc-", G = ";str";
975
973
  class Ht {
976
974
  get currentValue() {
977
975
  if (!(typeof location > "u"))
978
- return location == null ? void 0 : location.search;
976
+ return location.search;
979
977
  }
980
978
  }
981
979
  let Y;
@@ -1034,7 +1032,7 @@ function jt(i, e, t) {
1034
1032
  r = s[0], o = s.length;
1035
1033
  else
1036
1034
  continue;
1037
- for (let a = 0; vt(n, r, e, t), !(++a >= o); )
1035
+ for (let a = 0; pt(n, r, e, t), !(++a >= o); )
1038
1036
  r = s[a];
1039
1037
  }
1040
1038
  }
@@ -1045,13 +1043,13 @@ function Jt(i, e, t) {
1045
1043
  for (let s of n) {
1046
1044
  s = s.replace(/\+/g, " ");
1047
1045
  const r = s.indexOf("="), o = decodeURIComponent(r >= 0 ? s.substring(0, r) : s), a = r >= 0 ? decodeURIComponent(s.substring(r + 1)) : "";
1048
- vt(o, a, e, t);
1046
+ pt(o, a, e, t);
1049
1047
  }
1050
1048
  }
1051
- function vt(i, e, t, n) {
1049
+ function pt(i, e, t, n) {
1052
1050
  if (!i || i.length <= t.length || i.lastIndexOf(t, 0) < 0)
1053
1051
  return;
1054
- i = i.substring(t.length), i.length > G.length && i.indexOf(G, i.length - G.length) >= 0 ? i = i.substring(0, i.length - G.length) : e = Gt(e), n[i] = U.fromValue(e);
1052
+ i = i.substring(t.length), i.length > G.length && i.indexOf(G, i.length - G.length) >= 0 ? i = i.substring(0, i.length - G.length) : e = Gt(e), n[i] = $.fromValue(e);
1055
1053
  }
1056
1054
  function Gt(i) {
1057
1055
  switch (i.toLowerCase()) {
@@ -1101,7 +1099,7 @@ class Qt extends Le {
1101
1099
  return this.options.logger.debug("ManualPollService.refreshConfigAsync() called."), super.refreshConfigAsync();
1102
1100
  }
1103
1101
  }
1104
- const pt = "<invalid value>", ge = "<invalid name>", Pe = "<invalid operator>", Xe = "<invalid reference>", Xt = 10;
1102
+ const vt = "<invalid value>", ge = "<invalid name>", Pe = "<invalid operator>", Xe = "<invalid reference>", Xt = 10;
1105
1103
  class yt {
1106
1104
  constructor(e) {
1107
1105
  this.eol = e, this.log = "", this.indent = "";
@@ -1125,7 +1123,7 @@ class yt {
1125
1123
  return this.log;
1126
1124
  }
1127
1125
  appendUserConditionCore(e, t, n) {
1128
- return this.append(`User.${e} ${fe(t)} '${n ?? pt}'`);
1126
+ return this.append(`User.${e} ${fe(t)} '${n ?? vt}'`);
1129
1127
  }
1130
1128
  appendUserConditionString(e, t, n, s) {
1131
1129
  return typeof n != "string" ? this.appendUserConditionCore(e, t) : this.appendUserConditionCore(e, t, s ? "<hashed value>" : n);
@@ -1306,32 +1304,32 @@ function mt(i) {
1306
1304
  }
1307
1305
  }
1308
1306
  function ie(i) {
1309
- return z(i) ? i.toString() : pt;
1307
+ return z(i) ? i.toString() : vt;
1310
1308
  }
1311
1309
  const Ze = /^[0-9]+$/, _ = (i, e) => {
1312
1310
  const t = Ze.test(i), n = Ze.test(e);
1313
1311
  return t && n && (i = +i, e = +e), i === e ? 0 : t && !n ? -1 : n && !t ? 1 : i < e ? -1 : 1;
1314
- }, be = 256, Q = Number.MAX_SAFE_INTEGER || 9007199254740991, H = [], p = [], d = {};
1312
+ }, be = 256, Q = Number.MAX_SAFE_INTEGER || 9007199254740991, H = [], v = [], d = {};
1315
1313
  let en = 0;
1316
1314
  const S = (i, e) => {
1317
1315
  const t = en++;
1318
- d[i] = t, p[t] = e, H[t] = new RegExp(e);
1316
+ d[i] = t, v[t] = e, H[t] = new RegExp(e);
1319
1317
  };
1320
1318
  S("NUMERICIDENTIFIER", "0|[1-9]\\d*");
1321
1319
  S("NUMERICIDENTIFIERLOOSE", "[0-9]+");
1322
1320
  S("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
1323
- S("MAINVERSION", `(${p[d.NUMERICIDENTIFIER]})\\.(${p[d.NUMERICIDENTIFIER]})\\.(${p[d.NUMERICIDENTIFIER]})`);
1324
- S("MAINVERSIONLOOSE", `(${p[d.NUMERICIDENTIFIERLOOSE]})\\.(${p[d.NUMERICIDENTIFIERLOOSE]})\\.(${p[d.NUMERICIDENTIFIERLOOSE]})`);
1325
- S("PRERELEASEIDENTIFIER", `(?:${p[d.NUMERICIDENTIFIER]}|${p[d.NONNUMERICIDENTIFIER]})`);
1326
- S("PRERELEASEIDENTIFIERLOOSE", `(?:${p[d.NUMERICIDENTIFIERLOOSE]}|${p[d.NONNUMERICIDENTIFIER]})`);
1327
- S("PRERELEASE", `(?:-(${p[d.PRERELEASEIDENTIFIER]}(?:\\.${p[d.PRERELEASEIDENTIFIER]})*))`);
1328
- S("PRERELEASELOOSE", `(?:-?(${p[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${p[d.PRERELEASEIDENTIFIERLOOSE]})*))`);
1321
+ S("MAINVERSION", `(${v[d.NUMERICIDENTIFIER]})\\.(${v[d.NUMERICIDENTIFIER]})\\.(${v[d.NUMERICIDENTIFIER]})`);
1322
+ S("MAINVERSIONLOOSE", `(${v[d.NUMERICIDENTIFIERLOOSE]})\\.(${v[d.NUMERICIDENTIFIERLOOSE]})\\.(${v[d.NUMERICIDENTIFIERLOOSE]})`);
1323
+ S("PRERELEASEIDENTIFIER", `(?:${v[d.NUMERICIDENTIFIER]}|${v[d.NONNUMERICIDENTIFIER]})`);
1324
+ S("PRERELEASEIDENTIFIERLOOSE", `(?:${v[d.NUMERICIDENTIFIERLOOSE]}|${v[d.NONNUMERICIDENTIFIER]})`);
1325
+ S("PRERELEASE", `(?:-(${v[d.PRERELEASEIDENTIFIER]}(?:\\.${v[d.PRERELEASEIDENTIFIER]})*))`);
1326
+ S("PRERELEASELOOSE", `(?:-?(${v[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${v[d.PRERELEASEIDENTIFIERLOOSE]})*))`);
1329
1327
  S("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
1330
- S("BUILD", `(?:\\+(${p[d.BUILDIDENTIFIER]}(?:\\.${p[d.BUILDIDENTIFIER]})*))`);
1331
- S("FULLPLAIN", `v?${p[d.MAINVERSION]}${p[d.PRERELEASE]}?${p[d.BUILD]}?`);
1332
- S("FULL", `^${p[d.FULLPLAIN]}$`);
1333
- S("LOOSEPLAIN", `[v=\\s]*${p[d.MAINVERSIONLOOSE]}${p[d.PRERELEASELOOSE]}?${p[d.BUILD]}?`);
1334
- S("LOOSE", `^${p[d.LOOSEPLAIN]}$`);
1328
+ S("BUILD", `(?:\\+(${v[d.BUILDIDENTIFIER]}(?:\\.${v[d.BUILDIDENTIFIER]})*))`);
1329
+ S("FULLPLAIN", `v?${v[d.MAINVERSION]}${v[d.PRERELEASE]}?${v[d.BUILD]}?`);
1330
+ S("FULL", `^${v[d.FULLPLAIN]}$`);
1331
+ S("LOOSEPLAIN", `[v=\\s]*${v[d.MAINVERSIONLOOSE]}${v[d.PRERELEASELOOSE]}?${v[d.BUILD]}?`);
1332
+ S("LOOSE", `^${v[d.LOOSEPLAIN]}$`);
1335
1333
  class T {
1336
1334
  constructor(e, t) {
1337
1335
  if ((!t || typeof t != "object") && (t = {
@@ -1569,25 +1567,24 @@ class rn {
1569
1567
  }
1570
1568
  }
1571
1569
  evaluatePercentageOptions(e, t, n) {
1572
- var s;
1573
- const r = n.logBuilder;
1570
+ const s = n.logBuilder;
1574
1571
  if (!n.user) {
1575
- r == null || r.newLine("Skipping % options because the User Object is missing."), n.isMissingUserObjectLogged || (this.logger.userObjectIsMissing(n.key), n.isMissingUserObjectLogged = !0);
1572
+ s == null || s.newLine("Skipping % options because the User Object is missing."), n.isMissingUserObjectLogged || (this.logger.userObjectIsMissing(n.key), n.isMissingUserObjectLogged = !0);
1576
1573
  return;
1577
1574
  }
1578
- let o = n.setting.percentageOptionsAttribute, a;
1579
- if (o == null ? (o = "Identifier", a = (s = n.user.identifier) !== null && s !== void 0 ? s : "") : a = et(n.user, o), a == null) {
1580
- r == null || r.newLine(`Skipping % options because the User.${o} attribute is missing.`), n.isMissingUserObjectAttributeLogged || (this.logger.userObjectAttributeIsMissingPercentage(n.key, o), n.isMissingUserObjectAttributeLogged = !0);
1575
+ const r = n.setting.percentageOptionsAttribute, o = et(n.user, r);
1576
+ if (o == null) {
1577
+ s == null || s.newLine(`Skipping % options because the User.${r} attribute is missing.`), n.isMissingUserObjectAttributeLogged || (this.logger.userObjectAttributeIsMissingPercentage(n.key, r), n.isMissingUserObjectAttributeLogged = !0);
1581
1578
  return;
1582
1579
  }
1583
- r == null || r.newLine(`Evaluating % options based on the User.${o} attribute:`);
1584
- const l = ut(n.key + Ot(a)), c = parseInt(l.substring(0, 7), 16) % 100;
1585
- r == null || r.newLine(`- Computing hash in the [0..99] range from User.${o} => ${c} (this value is sticky and consistent across all SDKs)`);
1586
- let u = 0;
1587
- for (let h = 0; h < e.length; h++) {
1588
- const g = e[h];
1589
- if (u += g.percentage, !(c >= u))
1590
- return r == null || r.newLine(`- Hash value ${c} selects % option ${h + 1} (${g.percentage}%), '${ie(g.value)}'.`), { selectedValue: g, matchedTargetingRule: t, matchedPercentageOption: g };
1580
+ s == null || s.newLine(`Evaluating % options based on the User.${r} attribute:`);
1581
+ const a = ut(n.key + Ot(o)), l = parseInt(a.substring(0, 7), 16) % 100;
1582
+ s == null || s.newLine(`- Computing hash in the [0..99] range from User.${r} => ${l} (this value is sticky and consistent across all SDKs)`);
1583
+ let c = 0;
1584
+ for (let u = 0; u < e.length; u++) {
1585
+ const h = e[u];
1586
+ if (c += h.percentage, !(l >= c))
1587
+ return s == null || s.newLine(`- Hash value ${l} selects % option ${u + 1} (${h.percentage}%), '${ie(h.value)}'.`), { selectedValue: h, matchedTargetingRule: t, matchedPercentageOption: h };
1591
1588
  }
1592
1589
  throw new Error("Sum of percentage option percentages is less than 100.");
1593
1590
  }
@@ -1685,13 +1682,13 @@ class rn {
1685
1682
  return e === t !== n;
1686
1683
  }
1687
1684
  evaluateSensitiveTextEquals(e, t, n, s, r) {
1688
- return ve(e, n, s) === t !== r;
1685
+ return pe(e, n, s) === t !== r;
1689
1686
  }
1690
1687
  evaluateTextIsOneOf(e, t, n) {
1691
1688
  return t.indexOf(e) >= 0 !== n;
1692
1689
  }
1693
1690
  evaluateSensitiveTextIsOneOf(e, t, n, s, r) {
1694
- const o = ve(e, n, s);
1691
+ const o = pe(e, n, s);
1695
1692
  return t.indexOf(o) >= 0 !== r;
1696
1693
  }
1697
1694
  evaluateTextSliceEqualsAnyOf(e, t, n, s) {
@@ -1778,7 +1775,7 @@ class rn {
1778
1775
  }
1779
1776
  evaluateSensitiveArrayContainsAnyOf(e, t, n, s, r) {
1780
1777
  for (let o = 0; o < e.length; o++) {
1781
- const a = ve(e[o], n, s);
1778
+ const a = pe(e[o], n, s);
1782
1779
  if (t.indexOf(a) >= 0)
1783
1780
  return !r;
1784
1781
  }
@@ -1840,7 +1837,7 @@ class rn {
1840
1837
  function V(i) {
1841
1838
  return typeof i == "string";
1842
1839
  }
1843
- function ve(i, e, t) {
1840
+ function pe(i, e, t) {
1844
1841
  return Et(K(i), e, t);
1845
1842
  }
1846
1843
  function Et(i, e, t) {
@@ -1894,7 +1891,7 @@ function St(i, e, t, n) {
1894
1891
  matchedPercentageOption: e.matchedPercentageOption
1895
1892
  };
1896
1893
  }
1897
- function P(i, e, t, n, s, r) {
1894
+ function M(i, e, t, n, s, r) {
1898
1895
  return {
1899
1896
  key: i,
1900
1897
  value: e,
@@ -1908,10 +1905,10 @@ function P(i, e, t, n, s, r) {
1908
1905
  function se(i, e, t, n, s, r, o) {
1909
1906
  let a;
1910
1907
  if (!e)
1911
- return a = o.configJsonIsNotPresentSingle(t, "defaultValue", n).toString(), P(t, n, R(r), s, a);
1908
+ return a = o.configJsonIsNotPresentSingle(t, "defaultValue", n).toString(), M(t, n, R(r), s, a);
1912
1909
  const l = e[t];
1913
1910
  if (!l)
1914
- return a = o.settingEvaluationFailedDueToMissingKey(t, "defaultValue", n, De(Object.keys(e))).toString(), P(t, n, R(r), s, a);
1911
+ return a = o.settingEvaluationFailedDueToMissingKey(t, "defaultValue", n, De(Object.keys(e))).toString(), M(t, n, R(r), s, a);
1915
1912
  const c = i.evaluate(n, new j(t, l, s, e));
1916
1913
  return St(t, c, R(r), s);
1917
1914
  }
@@ -1926,7 +1923,7 @@ function st(i, e, t, n, s, r) {
1926
1923
  const h = i.evaluate(null, new j(l, c, t, e));
1927
1924
  u = St(l, h, R(n), t);
1928
1925
  } catch (h) {
1929
- o ?? (o = []), o.push(h), u = P(l, null, R(n), t, D(h), h);
1926
+ o ?? (o = []), o.push(h), u = M(l, null, R(n), t, D(h), h);
1930
1927
  }
1931
1928
  a.push(u);
1932
1929
  }
@@ -2049,7 +2046,7 @@ class k {
2049
2046
  let a;
2050
2047
  [a, o] = await this.getSettingsAsync(), r = se(this.evaluator, a, e, t, n, o, this.options.logger), s = r.value;
2051
2048
  } catch (a) {
2052
- this.options.logger.settingEvaluationErrorSingle("getValueAsync", e, "defaultValue", t, a), r = P(e, t, R(o), n, D(a), a), s = t;
2049
+ this.options.logger.settingEvaluationErrorSingle("getValueAsync", e, "defaultValue", t, a), r = M(e, t, R(o), n, D(a), a), s = t;
2053
2050
  }
2054
2051
  return this.hooks.emit("flagEvaluated", r), s;
2055
2052
  }
@@ -2061,7 +2058,7 @@ class k {
2061
2058
  let o;
2062
2059
  [o, r] = await this.getSettingsAsync(), s = se(this.evaluator, o, e, t, n, r, this.options.logger);
2063
2060
  } catch (o) {
2064
- this.options.logger.settingEvaluationErrorSingle("getValueDetailsAsync", e, "defaultValue", t, o), s = P(e, t, R(r), n, D(o), o);
2061
+ this.options.logger.settingEvaluationErrorSingle("getValueDetailsAsync", e, "defaultValue", t, o), s = M(e, t, R(r), n, D(o), o);
2065
2062
  }
2066
2063
  return this.hooks.emit("flagEvaluated", s), s;
2067
2064
  }
@@ -2117,8 +2114,8 @@ class k {
2117
2114
  for (const [s, r] of Object.entries(n)) {
2118
2115
  if (e === r.variationId)
2119
2116
  return { settingKey: s, settingValue: Z(r.value) };
2120
- const o = n[s].targetingRules;
2121
- if (o && o.length > 0)
2117
+ const { targetingRules: o } = r;
2118
+ if (o.length > 0)
2122
2119
  for (let l = 0; l < o.length; l++) {
2123
2120
  const c = o[l].then;
2124
2121
  if (x(c))
@@ -2130,8 +2127,8 @@ class k {
2130
2127
  else if (e === c.variationId)
2131
2128
  return { settingKey: s, settingValue: Z(c.value) };
2132
2129
  }
2133
- const a = n[s].percentageOptions;
2134
- if (a && a.length > 0)
2130
+ const { percentageOptions: a } = r;
2131
+ if (a.length > 0)
2135
2132
  for (let l = 0; l < a.length; l++) {
2136
2133
  const c = a[l];
2137
2134
  if (e === c.variationId)
@@ -2177,46 +2174,44 @@ class k {
2177
2174
  return e ? e.readyPromise : Promise.resolve(1);
2178
2175
  }
2179
2176
  snapshot() {
2180
- var e;
2181
- const t = () => {
2182
- const o = this.options.cache.getInMemory();
2183
- return [o.isEmpty ? null : o.config.settings, o];
2177
+ const e = () => {
2178
+ const r = this.options.cache.getInMemory();
2179
+ return [r.isEmpty ? null : r.config.settings, r];
2184
2180
  };
2185
- let n, s;
2186
- const r = (e = this.options) === null || e === void 0 ? void 0 : e.flagOverrides;
2187
- if (r) {
2188
- const o = r.dataSource.getOverridesSync();
2189
- switch (r.behaviour) {
2181
+ let t, n;
2182
+ const { flagOverrides: s } = this.options;
2183
+ if (s) {
2184
+ const r = s.dataSource.getOverridesSync();
2185
+ switch (s.behaviour) {
2190
2186
  case 0:
2191
- return new X(o, null, this);
2187
+ return new X(r, null, this);
2192
2188
  case 1:
2193
- return [n, s] = t(), new X(Object.assign(Object.assign({}, n ?? {}), o), s, this);
2189
+ return [t, n] = e(), new X(Object.assign(Object.assign({}, t ?? {}), r), n, this);
2194
2190
  case 2:
2195
- return [n, s] = t(), new X(Object.assign(Object.assign({}, o), n ?? {}), s, this);
2191
+ return [t, n] = e(), new X(Object.assign(Object.assign({}, r), t ?? {}), n, this);
2196
2192
  }
2197
2193
  }
2198
- return [n, s] = t(), new X(n, s, this);
2194
+ return [t, n] = e(), new X(t, n, this);
2199
2195
  }
2200
2196
  async getSettingsAsync() {
2201
- var e;
2202
2197
  this.options.logger.debug("getSettingsAsync() called.");
2203
- const t = async () => {
2204
- const s = await this.configService.getConfig();
2205
- return [s.isEmpty ? null : s.config.settings, s];
2206
- }, n = (e = this.options) === null || e === void 0 ? void 0 : e.flagOverrides;
2207
- if (n) {
2208
- let s, r;
2209
- const o = await n.dataSource.getOverrides();
2210
- switch (n.behaviour) {
2198
+ const e = async () => {
2199
+ const n = await this.configService.getConfig();
2200
+ return [n.isEmpty ? null : n.config.settings, n];
2201
+ }, { flagOverrides: t } = this.options;
2202
+ if (t) {
2203
+ let n, s;
2204
+ const r = await t.dataSource.getOverrides();
2205
+ switch (t.behaviour) {
2211
2206
  case 0:
2212
- return [o, null];
2207
+ return [r, null];
2213
2208
  case 1:
2214
- return [s, r] = await t(), [Object.assign(Object.assign({}, s ?? {}), o), r];
2209
+ return [n, s] = await e(), [Object.assign(Object.assign({}, n ?? {}), r), s];
2215
2210
  case 2:
2216
- return [s, r] = await t(), [Object.assign(Object.assign({}, o), s ?? {}), r];
2211
+ return [n, s] = await e(), [Object.assign(Object.assign({}, r), n ?? {}), s];
2217
2212
  }
2218
2213
  }
2219
- return await t();
2214
+ return await e();
2220
2215
  }
2221
2216
  on(e, t) {
2222
2217
  return this.hooks.on(e, t), this;
@@ -2258,7 +2253,7 @@ class X {
2258
2253
  try {
2259
2254
  r = se(this.evaluator, this.mergedSettings, e, t, n, this.remoteConfig, this.options.logger), s = r.value;
2260
2255
  } catch (o) {
2261
- this.options.logger.settingEvaluationErrorSingle("Snapshot.getValue", e, "defaultValue", t, o), r = P(e, t, R(this.remoteConfig), n, D(o), o), s = t;
2256
+ this.options.logger.settingEvaluationErrorSingle("Snapshot.getValue", e, "defaultValue", t, o), r = M(e, t, R(this.remoteConfig), n, D(o), o), s = t;
2262
2257
  }
2263
2258
  return this.options.hooks.emit("flagEvaluated", r), s;
2264
2259
  }
@@ -2269,7 +2264,7 @@ class X {
2269
2264
  try {
2270
2265
  s = se(this.evaluator, this.mergedSettings, e, t, n, this.remoteConfig, this.options.logger);
2271
2266
  } catch (r) {
2272
- this.options.logger.settingEvaluationErrorSingle("Snapshot.getValueDetails", e, "defaultValue", t, r), s = P(e, t, R(this.remoteConfig), n, D(r), r);
2267
+ this.options.logger.settingEvaluationErrorSingle("Snapshot.getValueDetails", e, "defaultValue", t, r), s = M(e, t, R(this.remoteConfig), n, D(r), r);
2273
2268
  }
2274
2269
  return this.options.hooks.emit("flagEvaluated", s), s;
2275
2270
  }
@@ -2433,7 +2428,7 @@ class wt {
2433
2428
  }
2434
2429
  class ce {
2435
2430
  static tryGetFactory() {
2436
- const e = vn();
2431
+ const e = pn();
2437
2432
  if (e)
2438
2433
  return (t) => new ae(new ce(e), t.logger);
2439
2434
  }
@@ -2441,7 +2436,7 @@ class ce {
2441
2436
  this.storage = e;
2442
2437
  }
2443
2438
  set(e, t) {
2444
- this.storage.setItem(e, pn(t));
2439
+ this.storage.setItem(e, vn(t));
2445
2440
  }
2446
2441
  get(e) {
2447
2442
  const t = this.storage.getItem(e);
@@ -2449,7 +2444,7 @@ class ce {
2449
2444
  return yn(t);
2450
2445
  }
2451
2446
  }
2452
- function vn() {
2447
+ function pn() {
2453
2448
  if (typeof localStorage < "u") {
2454
2449
  const i = "__configcat_localStorage_test";
2455
2450
  try {
@@ -2467,7 +2462,7 @@ function vn() {
2467
2462
  }
2468
2463
  }
2469
2464
  }
2470
- function pn(i) {
2465
+ function vn(i) {
2471
2466
  return i = encodeURIComponent(i), i = i.replace(/%([0-9A-F]{2})/g, (e, t) => String.fromCharCode(parseInt(t, 16))), btoa(i);
2472
2467
  }
2473
2468
  function yn(i) {
@@ -2552,32 +2547,32 @@ class Tt {
2552
2547
  }
2553
2548
  class En {
2554
2549
  async fetchLogic(e, t) {
2555
- var n, s, r;
2556
- const o = { method: "GET" };
2557
- let a;
2550
+ var n, s;
2551
+ const r = { method: "GET" };
2552
+ let o;
2558
2553
  if (typeof AbortController < "u") {
2559
- const l = new AbortController(), c = setTimeout(() => l.abort(), e.requestTimeoutMs);
2560
- o.signal = l.signal, a = () => clearTimeout(c);
2554
+ const a = new AbortController(), l = setTimeout(() => a.abort(), e.requestTimeoutMs);
2555
+ r.signal = a.signal, o = () => clearTimeout(l);
2561
2556
  } else
2562
- a = () => {
2557
+ o = () => {
2563
2558
  };
2564
2559
  try {
2565
- let l = e.getUrl();
2566
- t && (l += "&ccetag=" + encodeURIComponent(t));
2567
- const c = await fetch(l, o), { status: u, statusText: h } = c;
2568
- if (u === 200) {
2569
- const g = await c.text(), f = (s = (n = c.headers) === null || n === void 0 ? void 0 : n.get("Etag")) !== null && s !== void 0 ? s : void 0;
2570
- return { statusCode: u, reasonPhrase: h, eTag: f, body: g };
2560
+ let a = e.getUrl();
2561
+ t && (a += "&ccetag=" + encodeURIComponent(t));
2562
+ const l = await fetch(a, r), { status: c, statusText: u } = l;
2563
+ if (c === 200) {
2564
+ const h = await l.text(), g = (n = l.headers.get("ETag")) !== null && n !== void 0 ? n : void 0;
2565
+ return { statusCode: c, reasonPhrase: u, eTag: g, body: h };
2571
2566
  } else
2572
- return { statusCode: u, reasonPhrase: h };
2573
- } catch (l) {
2574
- throw l instanceof DOMException && l.name === "AbortError" ? !((r = o.signal) === null || r === void 0) && r.aborted ? new b("timeout", e.requestTimeoutMs) : new b("abort") : new b("failure", l);
2567
+ return { statusCode: c, reasonPhrase: u };
2568
+ } catch (a) {
2569
+ throw a instanceof DOMException && a.name === "AbortError" ? !((s = r.signal) === null || s === void 0) && s.aborted ? new b("timeout", e.requestTimeoutMs) : new b("abort") : new b("failure", a);
2575
2570
  } finally {
2576
- a();
2571
+ o();
2577
2572
  }
2578
2573
  }
2579
2574
  }
2580
- const On = U.fromValue, Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2575
+ const On = $.fromValue.bind($), Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2581
2576
  __proto__: null,
2582
2577
  DefaultEventEmitter: wt,
2583
2578
  ExternalConfigCache: ae,
@@ -2597,7 +2592,7 @@ const On = U.fromValue, Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Objec
2597
2592
  disposeAllClients: hn,
2598
2593
  getClient: At,
2599
2594
  settingFromValue: On
2600
- }, Symbol.toStringTag, { value: "Module" })), An = "2.4.2", bn = {
2595
+ }, Symbol.toStringTag, { value: "Module" })), An = "2.5.0", bn = {
2601
2596
  // Vue's `App.prototype.use` does not play nicely with generic `install` functions, so we resort to using a discriminated union.
2602
2597
  install: (i, e) => {
2603
2598
  const { sdkKey: t, pollingMode: n, clientOptions: s } = e, r = {
@@ -1,6 +1,6 @@
1
1
  (function(h,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],T):(h=typeof globalThis<"u"?globalThis:h||self,T(h["configcat-vue"]={},h.Vue))})(this,function(h,T){"use strict";var ue;(function(i){i[i.No=0]="No",i[i.Should=1]="Should",i[i.Force=2]="Force"})(ue||(ue={})),h.SettingType=void 0,function(i){i[i.Boolean=0]="Boolean",i[i.String=1]="String",i[i.Int=2]="Int",i[i.Double=3]="Double"}(h.SettingType||(h.SettingType={})),h.UserComparator=void 0,function(i){i[i.TextIsOneOf=0]="TextIsOneOf",i[i.TextIsNotOneOf=1]="TextIsNotOneOf",i[i.TextContainsAnyOf=2]="TextContainsAnyOf",i[i.TextNotContainsAnyOf=3]="TextNotContainsAnyOf",i[i.SemVerIsOneOf=4]="SemVerIsOneOf",i[i.SemVerIsNotOneOf=5]="SemVerIsNotOneOf",i[i.SemVerLess=6]="SemVerLess",i[i.SemVerLessOrEquals=7]="SemVerLessOrEquals",i[i.SemVerGreater=8]="SemVerGreater",i[i.SemVerGreaterOrEquals=9]="SemVerGreaterOrEquals",i[i.NumberEquals=10]="NumberEquals",i[i.NumberNotEquals=11]="NumberNotEquals",i[i.NumberLess=12]="NumberLess",i[i.NumberLessOrEquals=13]="NumberLessOrEquals",i[i.NumberGreater=14]="NumberGreater",i[i.NumberGreaterOrEquals=15]="NumberGreaterOrEquals",i[i.SensitiveTextIsOneOf=16]="SensitiveTextIsOneOf",i[i.SensitiveTextIsNotOneOf=17]="SensitiveTextIsNotOneOf",i[i.DateTimeBefore=18]="DateTimeBefore",i[i.DateTimeAfter=19]="DateTimeAfter",i[i.SensitiveTextEquals=20]="SensitiveTextEquals",i[i.SensitiveTextNotEquals=21]="SensitiveTextNotEquals",i[i.SensitiveTextStartsWithAnyOf=22]="SensitiveTextStartsWithAnyOf",i[i.SensitiveTextNotStartsWithAnyOf=23]="SensitiveTextNotStartsWithAnyOf",i[i.SensitiveTextEndsWithAnyOf=24]="SensitiveTextEndsWithAnyOf",i[i.SensitiveTextNotEndsWithAnyOf=25]="SensitiveTextNotEndsWithAnyOf",i[i.SensitiveArrayContainsAnyOf=26]="SensitiveArrayContainsAnyOf",i[i.SensitiveArrayNotContainsAnyOf=27]="SensitiveArrayNotContainsAnyOf",i[i.TextEquals=28]="TextEquals",i[i.TextNotEquals=29]="TextNotEquals",i[i.TextStartsWithAnyOf=30]="TextStartsWithAnyOf",i[i.TextNotStartsWithAnyOf=31]="TextNotStartsWithAnyOf",i[i.TextEndsWithAnyOf=32]="TextEndsWithAnyOf",i[i.TextNotEndsWithAnyOf=33]="TextNotEndsWithAnyOf",i[i.ArrayContainsAnyOf=34]="ArrayContainsAnyOf",i[i.ArrayNotContainsAnyOf=35]="ArrayNotContainsAnyOf"}(h.UserComparator||(h.UserComparator={})),h.PrerequisiteFlagComparator=void 0,function(i){i[i.Equals=0]="Equals",i[i.NotEquals=1]="NotEquals"}(h.PrerequisiteFlagComparator||(h.PrerequisiteFlagComparator={})),h.SegmentComparator=void 0,function(i){i[i.IsIn=0]="IsIn",i[i.IsNotIn=1]="IsNotIn"}(h.SegmentComparator||(h.SegmentComparator={}));const yt=Object.freeze(Object.defineProperty({__proto__:null,get PrerequisiteFlagComparator(){return h.PrerequisiteFlagComparator},get RedirectMode(){return ue},get SegmentComparator(){return h.SegmentComparator},get SettingType(){return h.SettingType},get UserComparator(){return h.UserComparator}},Symbol.toStringTag,{value:"Module"}));class S{static equals(e,t){return e.httpETag&&t.httpETag?e.httpETag===t.httpETag:e.configJson===t.configJson}constructor(e,t,n,s){this.configJson=e,this.config=t,this.timestamp=n,this.httpETag=s}with(e){return new S(this.configJson,this.config,e,this.httpETag)}get isEmpty(){return!this.config}isExpired(e){return this===S.empty||this.timestamp+e<S.generateTimestamp()}static generateTimestamp(){return new Date().getTime()}static serialize(e){var t,n;return e.timestamp+`
2
2
  `+((t=e.httpETag)!==null&&t!==void 0?t:"")+`
3
3
  `+((n=e.configJson)!==null&&n!==void 0?n:"")}static deserialize(e){const t=Array(2);let n=0;for(let u=0;u<t.length;u++){if(n=e.indexOf(`
4
- `,n),n<0)throw new Error("Number of values is fewer than expected.");t[u]=n++}let s=t[0],r=e.substring(0,s);const o=parseInt(r);if(isNaN(o))throw new Error("Invalid fetch time: "+r);n=s+1,s=t[1],r=e.substring(n,s);const a=r.length>0?r:void 0;n=s+1,r=e.substring(n);let l,c;return r.length>0&&(l=_.deserialize(r),c=r),new S(c,l,o,a)}}S.serializationFormatVersion="v2",S.empty=new S(void 0,void 0,0,void 0);class _{static deserialize(e){const t=JSON.parse(e);if(typeof t!="object"||!t)throw new Error("Invalid config JSON content:"+e);return new _(t)}constructor(e){var t,n;this.preferences=e.p!=null?new mt(e.p):void 0,this.segments=(n=(t=e.s)===null||t===void 0?void 0:t.map(s=>new Et(s)))!==null&&n!==void 0?n:[],this.settings=e.f!=null?Object.entries(e.f).reduce((s,[r,o])=>(s[r]=new V(o,this),s),{}):{}}get salt(){var e;return(e=this.preferences)===null||e===void 0?void 0:e.salt}}class mt{constructor(e){this.baseUrl=e.u,this.redirectMode=e.r,this.salt=e.s}}class Et{constructor(e){var t,n;this.name=e.n,this.conditions=(n=(t=e.r)===null||t===void 0?void 0:t.map(s=>new ke(s)))!==null&&n!==void 0?n:[]}}class he{constructor(e,t=!1){this.value=t?e.v:De(e.v),this.variationId=e.i}}class V extends he{constructor(e,t){var n,s,r,o,a,l;super(e,e.t<0),this.type=e.t;const c="Identifier";this.percentageOptionsAttribute=(n=e.a)!==null&&n!==void 0?n:c,this.targetingRules=(r=(s=e.r)===null||s===void 0?void 0:s.map(u=>new St(u,t)))!==null&&r!==void 0?r:[],this.percentageOptions=(a=(o=e.p)===null||o===void 0?void 0:o.map(u=>new Le(u)))!==null&&a!==void 0?a:[],this.configJsonSalt=(l=t==null?void 0:t.salt)!==null&&l!==void 0?l:""}static fromValue(e){return new V({t:-1,v:e})}}class St{constructor(e,t){var n,s;this.conditions=(s=(n=e.c)===null||n===void 0?void 0:n.map(r=>r.u!=null?new ke(r.u):r.p!=null?new Ot(r.p):r.s!=null?new At(r.s,t):void 0))!==null&&s!==void 0?s:[],this.then=e.p!=null?e.p.map(r=>new Le(r)):new he(e.s)}}class Le extends he{constructor(e){super(e),this.percentage=e.p}}class ke{constructor(e){var t,n;this.type="UserCondition",this.comparisonAttribute=e.a,this.comparator=e.c,this.comparisonValue=(n=(t=e.s)!==null&&t!==void 0?t:e.d)!==null&&n!==void 0?n:e.l}}class Ot{constructor(e){this.type="PrerequisiteFlagCondition",this.prerequisiteFlagKey=e.f,this.comparator=e.c,this.comparisonValue=De(e.v)}}class At{constructor(e,t){this.type="SegmentCondition",this.segment=t.segments[e.s],this.comparator=e.c}}function De(i){var e,t,n;return(n=(t=(e=i.b)!==null&&e!==void 0?e:i.s)!==null&&t!==void 0?t:i.i)!==null&&n!==void 0?n:i.d}function wt(i){return h.SettingType[i]}var ge;(function(i){i[i.Fetched=0]="Fetched",i[i.NotModified=1]="NotModified",i[i.Errored=2]="Errored"})(ge||(ge={}));class b{constructor(e,t,n,s){this.status=e,this.config=t,this.errorMessage=n,this.errorException=s}static success(e){return new b(0,e)}static notModified(e){return new b(1,e)}static error(e,t,n){return new b(2,e,t??"Unknown error.",n)}}class R extends Error{constructor(e,...t){super(((n,s)=>{switch(n){case"abort":return"Request was aborted.";case"timeout":const[r]=s;return`Request timed out. Timeout value: ${r}ms`;case"failure":const[o]=s,a="Request failed due to a network or protocol error.";return o?a+" "+(o instanceof Error?o.message:o+""):a}})(e,t)),this.cause=e,this instanceof R||(Object.setPrototypeOf||((n,s)=>n.__proto__=s))(this,R.prototype),this.args=t}}class N{constructor(e,t){this.errorMessage=e,this.errorException=t}get isSuccess(){return this.errorMessage===null}static from(e){return e.status!==2?N.success():N.failure(e.errorMessage,e.errorException)}static success(){return new N(null)}static failure(e,t){return new N(e,t)}}h.ClientCacheState=void 0,function(i){i[i.NoFlagData=0]="NoFlagData",i[i.HasLocalOverrideFlagDataOnly=1]="HasLocalOverrideFlagDataOnly",i[i.HasCachedFlagDataOnly=2]="HasCachedFlagDataOnly",i[i.HasUpToDateFlagData=3]="HasUpToDateFlagData"}(h.ClientCacheState||(h.ClientCacheState={}));var fe;(function(i){i[i.Online=0]="Online",i[i.Offline=1]="Offline",i[i.Disposed=2]="Disposed"})(fe||(fe={}));function $e(i){return fe[i]}class de{constructor(e,t){this.configFetcher=e,this.options=t,this.pendingFetch=null,this.cacheKey=t.getCacheKey(),this.configFetcher=e,this.options=t,this.status=t.offline?1:0}dispose(){this.status=2}get disposed(){return this.status===2}async refreshConfigAsync(){const e=await this.options.cache.get(this.cacheKey);if(this.isOffline){const t=this.options.logger.configServiceCannotInitiateHttpCalls().toString();return[N.failure(t),e]}else{const[t,n]=await this.refreshConfigCoreAsync(e);return[N.from(t),n]}}async refreshConfigCoreAsync(e){const t=await this.fetchAsync(e);let n=!1;const s=t.status===0;return(s||t.config.timestamp>e.timestamp&&(!t.config.isEmpty||e.isEmpty))&&(await this.options.cache.set(this.cacheKey,t.config),n=s&&!S.equals(t.config,e),e=t.config),this.onConfigFetched(t.config),n&&this.onConfigChanged(t.config),[t,e]}onConfigFetched(e){this.options.logger.debug("config fetched")}onConfigChanged(e){var t;this.options.logger.debug("config changed"),this.options.hooks.emit("configChanged",(t=e.config)!==null&&t!==void 0?t:new _({}))}fetchAsync(e){var t;return(t=this.pendingFetch)!==null&&t!==void 0?t:this.pendingFetch=(async()=>{try{return await this.fetchLogicAsync(e)}finally{this.pendingFetch=null}})()}async fetchLogicAsync(e){var t;const n=this.options;n.logger.debug("ConfigServiceBase.fetchLogicAsync() - called.");let s;try{const[r,o]=await this.fetchRequestAsync((t=e.httpETag)!==null&&t!==void 0?t:null);switch(r.statusCode){case 200:return o instanceof _?(n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."),b.success(new S(r.body,o,S.generateTimestamp(),r.eTag))):(s=n.logger.fetchReceived200WithInvalidBody(o).toString(),n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received but the HTTP response content was invalid. Returning null.`),b.error(e,s,o));case 304:return e?(n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."),b.notModified(e.with(S.generateTimestamp()))):(s=n.logger.fetchReceived304WhenLocalCacheIsEmpty(r.statusCode,r.reasonPhrase).toString(),n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received when no config is cached locally. Returning null.`),b.error(e,s));case 403:case 404:return s=n.logger.fetchFailedDueToInvalidSdkKey().toString(),n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning last config (if any) with updated timestamp."),b.error(e.with(S.generateTimestamp()),s);default:return s=n.logger.fetchFailedDueToUnexpectedHttpResponse(r.statusCode,r.reasonPhrase).toString(),n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."),b.error(e,s)}}catch(r){return s=(r instanceof R&&r.cause==="timeout"?n.logger.fetchFailedDueToRequestTimeout(r.args[0],r):n.logger.fetchFailedDueToUnexpectedError(r)).toString(),n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."),b.error(e,s,r)}}async fetchRequestAsync(e,t=2){const n=this.options;n.logger.debug("ConfigServiceBase.fetchRequestAsync() - called.");for(let s=0;;s++){n.logger.debug(`ConfigServiceBase.fetchRequestAsync(): calling fetchLogic()${s>0?`, retry ${s}/${t}`:""}`);const r=await this.configFetcher.fetchLogic(n,e);if(r.statusCode!==200)return[r];if(!r.body)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): no response body."),[r,new Error("No response body.")];let o;try{o=_.deserialize(r.body)}catch(u){return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): invalid response body."),[r,u]}const a=o.preferences;if(!a)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): preferences is empty."),[r,o];const l=a.baseUrl;if(!l||l===n.baseUrl)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): baseUrl OK."),[r,o];const c=a.redirectMode;if(n.baseUrlOverriden&&c!==2)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): options.baseUrlOverriden && redirect !== 2."),[r,o];if(n.baseUrl=l,c===0)return[r,o];if(c===1&&n.logger.dataGovernanceIsOutOfSync(),s>=t)return n.logger.fetchFailedDueToRedirectLoop(),[r,o]}}get isOfflineExactly(){return this.status===1}get isOffline(){return this.status!==0}setOnlineCore(){}setOnline(){this.status===1?(this.setOnlineCore(),this.status=0,this.options.logger.configServiceStatusChanged($e(this.status))):this.disposed&&this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOnline")}setOfflineCore(){}setOffline(){this.status===0?(this.setOfflineCore(),this.status=1,this.options.logger.configServiceStatusChanged($e(this.status))):this.disposed&&this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOffline")}syncUpWithCache(){return this.options.cache.get(this.cacheKey)}async getReadyPromise(e,t){const n=await t(e);return this.options.hooks.emit("clientReady",n),n}}class ve{constructor(){this.callbacks=[]}get aborted(){return!this.callbacks}abort(){if(!this.aborted){const e=this.callbacks;this.callbacks=null;for(const t of e)t()}}registerCallback(e){return this.aborted?(e(),()=>{}):(this.callbacks.push(e),()=>{const t=this.callbacks;let n;t&&(n=t.indexOf(e))>=0&&t.splice(n,1)})}}function Pe(i,e){let t;return new Promise(n=>{const s=e==null?void 0:e.registerCallback(()=>{clearTimeout(t),n(!1)});t=setTimeout(()=>{s==null||s(),n(!0)},i)})}function P(i,e=!1){return i instanceof Error?e&&i.stack?i.stack:i.toString():i+""}function Me(i){throw i}function q(i){return Array.isArray(i)}function pe(i){return q(i)&&!i.some(e=>typeof e!="string")}function ye(i,e=0,t,n=", "){const s=i.length;if(!s)return"";let r="";return e>0&&s>e&&(i=i.slice(0,e),t&&(r=t(s-e))),"'"+i.join("'"+n+"'")+"'"+r}function Tt(i){return typeof(i==null?void 0:i.then)=="function"}function B(i){function e(o,a){const l=o.charCodeAt(a);if(55296<=l&&l<56320){const c=o.charCodeAt(a+1);if(56320<=c&&c<=57343)return(l<<10)+c-56613888}return l}let t="",n=0;const s=String.fromCharCode;let r;for(r=0;r<i.length;r++){const o=e(i,r);o<=127||(t+=i.slice(n,r),o<=2047?(t+=s(192|o>>6),t+=s(128|o&63)):o<=65535?(t+=s(224|o>>12),t+=s(128|o>>6&63),t+=s(128|o&63)):(t+=s(240|o>>18),t+=s(128|o>>12&63),t+=s(128|o>>6&63),t+=s(128|o&63),++r),n=r+1)}return t+=i.slice(n,r)}function me(i){return typeof i=="number"?i:typeof i!="string"||!i.length||/^\s*$|^\s*0[^\d.e]/.test(i)?NaN:+i}const bt=500;class Ct extends de{constructor(e,t){super(e,t),this.signalInitialization=()=>{},this.stopToken=new ve,this.pollIntervalMs=t.pollIntervalSeconds*1e3,this.pollExpirationMs=this.pollIntervalMs-bt;const n=this.syncUpWithCache();if(t.maxInitWaitTimeSeconds!==0){this.initialized=!1;const s=new Promise(r=>this.signalInitialization=r);this.initializationPromise=this.waitForInitializationAsync(s).then(r=>(this.initialized=!0,r))}else this.initialized=!0,this.initializationPromise=Promise.resolve(!1);this.readyPromise=this.getReadyPromise(this.initializationPromise,async s=>(await s,this.getCacheState(this.options.cache.getInMemory()))),t.offline||this.startRefreshWorker(n,this.stopToken)}async waitForInitializationAsync(e){if(this.options.maxInitWaitTimeSeconds<0)return await e,!0;const t=new ve,n=await Promise.race([e.then(()=>!0),Pe(this.options.maxInitWaitTimeSeconds*1e3,t).then(()=>!1)]);return t.abort(),n}async getConfig(){this.options.logger.debug("AutoPollConfigService.getConfig() called.");function e(n){n.debug("AutoPollConfigService.getConfig() - returning value from cache.")}let t;if(!this.isOffline&&!this.initialized){if(t=await this.options.cache.get(this.cacheKey),!t.isExpired(this.pollIntervalMs))return e(this.options.logger),t;this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired, waiting for initialization."),await this.initializationPromise}return t=await this.options.cache.get(this.cacheKey),t.isExpired(this.pollIntervalMs)?this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired."):e(this.options.logger),t}refreshConfigAsync(){return this.options.logger.debug("AutoPollConfigService.refreshConfigAsync() called."),super.refreshConfigAsync()}dispose(){this.options.logger.debug("AutoPollConfigService.dispose() called."),super.dispose(),this.stopToken.aborted||this.stopRefreshWorker()}onConfigFetched(e){this.signalInitialization(),super.onConfigFetched(e)}setOnlineCore(){this.startRefreshWorker(null,this.stopToken)}setOfflineCore(){this.stopRefreshWorker(),this.stopToken=new ve}async startRefreshWorker(e,t){this.options.logger.debug("AutoPollConfigService.startRefreshWorker() called.");let n=!0;for(;!t.aborted;){try{const s=new Date().getTime()+this.pollIntervalMs;try{await this.refreshWorkerLogic(n,e)}catch(o){this.options.logger.autoPollConfigServiceErrorDuringPolling(o)}const r=s-new Date().getTime();r>0&&await Pe(r,t)}catch(s){this.options.logger.autoPollConfigServiceErrorDuringPolling(s)}n=!1,e=null}}stopRefreshWorker(){this.options.logger.debug("AutoPollConfigService.stopRefreshWorker() called."),this.stopToken.abort()}async refreshWorkerLogic(e,t){this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called.");const n=await(t??this.options.cache.get(this.cacheKey));n.isExpired(this.pollExpirationMs)?(e?!this.isOfflineExactly:!this.isOffline)&&await this.refreshConfigCoreAsync(n):e&&this.signalInitialization()}getCacheState(e){return e.isEmpty?0:e.isExpired(this.pollIntervalMs)?2:3}}class Ue{constructor(){this.cachedConfig=S.empty}set(e,t){this.cachedConfig=t}get(e){return this.cachedConfig}getInMemory(){return this.cachedConfig}}class Y{constructor(e,t){this.cache=e,this.logger=t,this.cachedConfig=S.empty}async set(e,t){try{if(!t.isEmpty)this.cachedSerializedConfig=S.serialize(t),this.cachedConfig=t;else{this.cachedSerializedConfig=void 0,this.cachedConfig=t;return}await this.cache.set(e,this.cachedSerializedConfig)}catch(n){this.logger.configServiceCacheWriteError(n)}}updateCachedConfig(e){e==null||e===this.cachedSerializedConfig||(this.cachedConfig=S.deserialize(e),this.cachedSerializedConfig=e)}get(e){try{const t=this.cache.get(e);if(Tt(t))return(async n=>{try{this.updateCachedConfig(await n)}catch(s){this.logger.configServiceCacheReadError(s)}return this.cachedConfig})(t);this.updateCachedConfig(t)}catch(t){this.logger.configServiceCacheReadError(t)}return Promise.resolve(this.cachedConfig)}getInMemory(){return this.cachedConfig}}h.LogLevel=void 0,function(i){i[i.Debug=4]="Debug",i[i.Info=3]="Info",i[i.Warn=2]="Warn",i[i.Error=1]="Error",i[i.Off=-1]="Off"}(h.LogLevel||(h.LogLevel={}));function It(i){return h.LogLevel[i]}class m{static from(...e){return(t,...n)=>new m(t,e,n)}constructor(e,t,n){this.strings=e,this.argNames=t,this.argValues=n}get defaultFormattedMessage(){let e=this.cachedDefaultFormattedMessage;if(e===void 0){e="";const{strings:t,argValues:n}=this;let s=0;for(;s<t.length-1;s++)e+=t[s],e+=n[s];e+=t[s],this.cachedDefaultFormattedMessage=e}return e}toString(){return this.defaultFormattedMessage}}class Rt{get level(){var e;return(e=this.logger.level)!==null&&e!==void 0?e:2}get eol(){var e;return(e=this.logger.eol)!==null&&e!==void 0?e:`
4
+ `,n),n<0)throw new Error("Number of values is fewer than expected.");t[u]=n++}let s=t[0],r=e.substring(0,s);const o=parseInt(r);if(isNaN(o))throw new Error("Invalid fetch time: "+r);n=s+1,s=t[1],r=e.substring(n,s);const a=r.length>0?r:void 0;n=s+1,r=e.substring(n);let l,c;return r.length>0&&(l=V.deserialize(r),c=r),new S(c,l,o,a)}}S.serializationFormatVersion="v2",S.empty=new S(void 0,void 0,0,void 0);class V{static deserialize(e){const t=JSON.parse(e);if(typeof t!="object"||!t)throw new Error("Invalid config JSON content:"+e);return new V(t)}constructor(e){var t,n;this.preferences=e.p!=null?new mt(e.p):void 0,this.segments=(n=(t=e.s)===null||t===void 0?void 0:t.map(s=>new Et(s)))!==null&&n!==void 0?n:[],this.settings=e.f!=null?Object.entries(e.f).reduce((s,[r,o])=>(s[r]=new P(o,this),s),{}):{}}get salt(){var e;return(e=this.preferences)===null||e===void 0?void 0:e.salt}}class mt{constructor(e){this.baseUrl=e.u,this.redirectMode=e.r,this.salt=e.s}}class Et{constructor(e){var t,n;this.name=e.n,this.conditions=(n=(t=e.r)===null||t===void 0?void 0:t.map(s=>new ke(s)))!==null&&n!==void 0?n:[]}}class he{constructor(e,t=!1){this.value=t?e.v:De(e.v),this.variationId=e.i}}class P extends he{constructor(e,t){var n,s,r,o,a,l;super(e,e.t<0),this.type=e.t,this.percentageOptionsAttribute=(n=e.a)!==null&&n!==void 0?n:"Identifier",this.targetingRules=(r=(s=e.r)===null||s===void 0?void 0:s.map(c=>new St(c,t)))!==null&&r!==void 0?r:[],this.percentageOptions=(a=(o=e.p)===null||o===void 0?void 0:o.map(c=>new Le(c)))!==null&&a!==void 0?a:[],this.configJsonSalt=(l=t==null?void 0:t.salt)!==null&&l!==void 0?l:""}static fromValue(e){return new P({t:-1,v:e})}}class St{constructor(e,t){var n,s;this.conditions=(s=(n=e.c)===null||n===void 0?void 0:n.map(r=>r.u!=null?new ke(r.u):r.p!=null?new Ot(r.p):r.s!=null?new At(r.s,t):void 0))!==null&&s!==void 0?s:[],this.then=e.p!=null?e.p.map(r=>new Le(r)):new he(e.s)}}class Le extends he{constructor(e){super(e),this.percentage=e.p}}class ke{constructor(e){var t,n;this.type="UserCondition",this.comparisonAttribute=e.a,this.comparator=e.c,this.comparisonValue=(n=(t=e.s)!==null&&t!==void 0?t:e.d)!==null&&n!==void 0?n:e.l}}class Ot{constructor(e){this.type="PrerequisiteFlagCondition",this.prerequisiteFlagKey=e.f,this.comparator=e.c,this.comparisonValue=De(e.v)}}class At{constructor(e,t){this.type="SegmentCondition",this.segment=t.segments[e.s],this.comparator=e.c}}function De(i){var e,t,n;return(n=(t=(e=i.b)!==null&&e!==void 0?e:i.s)!==null&&t!==void 0?t:i.i)!==null&&n!==void 0?n:i.d}function wt(i){return h.SettingType[i]}var ge;(function(i){i[i.Fetched=0]="Fetched",i[i.NotModified=1]="NotModified",i[i.Errored=2]="Errored"})(ge||(ge={}));class b{constructor(e,t,n,s){this.status=e,this.config=t,this.errorMessage=n,this.errorException=s}static success(e){return new b(0,e)}static notModified(e){return new b(1,e)}static error(e,t,n){return new b(2,e,t??"Unknown error.",n)}}class R extends Error{constructor(e,...t){super(((n,s)=>{switch(n){case"abort":return"Request was aborted.";case"timeout":const[r]=s;return`Request timed out. Timeout value: ${r}ms`;case"failure":const[o]=s,a="Request failed due to a network or protocol error.";return o?a+" "+(o instanceof Error?o.message:o+""):a}})(e,t)),this.cause=e,this instanceof R||(Object.setPrototypeOf||((n,s)=>n.__proto__=s))(this,R.prototype),this.args=t}}class N{constructor(e,t){this.errorMessage=e,this.errorException=t}get isSuccess(){return this.errorMessage===null}static from(e){return e.status!==2?N.success():N.failure(e.errorMessage,e.errorException)}static success(){return new N(null)}static failure(e,t){return new N(e,t)}}h.ClientCacheState=void 0,function(i){i[i.NoFlagData=0]="NoFlagData",i[i.HasLocalOverrideFlagDataOnly=1]="HasLocalOverrideFlagDataOnly",i[i.HasCachedFlagDataOnly=2]="HasCachedFlagDataOnly",i[i.HasUpToDateFlagData=3]="HasUpToDateFlagData"}(h.ClientCacheState||(h.ClientCacheState={}));var fe;(function(i){i[i.Online=0]="Online",i[i.Offline=1]="Offline",i[i.Disposed=2]="Disposed"})(fe||(fe={}));function $e(i){return fe[i]}class de{constructor(e,t){this.configFetcher=e,this.options=t,this.pendingFetch=null,this.cacheKey=t.getCacheKey(),this.configFetcher=e,this.options=t,this.status=t.offline?1:0}dispose(){this.status=2}get disposed(){return this.status===2}async refreshConfigAsync(){const e=await this.options.cache.get(this.cacheKey);if(this.isOffline){const t=this.options.logger.configServiceCannotInitiateHttpCalls().toString();return[N.failure(t),e]}else{const[t,n]=await this.refreshConfigCoreAsync(e);return[N.from(t),n]}}async refreshConfigCoreAsync(e){const t=await this.fetchAsync(e);let n=!1;const s=t.status===0;return(s||t.config.timestamp>e.timestamp&&(!t.config.isEmpty||e.isEmpty))&&(await this.options.cache.set(this.cacheKey,t.config),n=s&&!S.equals(t.config,e),e=t.config),this.onConfigFetched(t.config),n&&this.onConfigChanged(t.config),[t,e]}onConfigFetched(e){this.options.logger.debug("config fetched")}onConfigChanged(e){var t;this.options.logger.debug("config changed"),this.options.hooks.emit("configChanged",(t=e.config)!==null&&t!==void 0?t:new V({}))}fetchAsync(e){var t;return(t=this.pendingFetch)!==null&&t!==void 0?t:this.pendingFetch=(async()=>{try{return await this.fetchLogicAsync(e)}finally{this.pendingFetch=null}})()}async fetchLogicAsync(e){var t;const n=this.options;n.logger.debug("ConfigServiceBase.fetchLogicAsync() - called.");let s;try{const[r,o]=await this.fetchRequestAsync((t=e.httpETag)!==null&&t!==void 0?t:null);switch(r.statusCode){case 200:return o instanceof V?(n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was successful. Returning new config."),b.success(new S(r.body,o,S.generateTimestamp(),r.eTag))):(s=n.logger.fetchReceived200WithInvalidBody(o).toString(),n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received but the HTTP response content was invalid. Returning null.`),b.error(e,s,o));case 304:return e.isEmpty?(s=n.logger.fetchReceived304WhenLocalCacheIsEmpty(r.statusCode,r.reasonPhrase).toString(),n.logger.debug(`ConfigServiceBase.fetchLogicAsync(): ${r.statusCode} ${r.reasonPhrase} was received when no config is cached locally. Returning null.`),b.error(e,s)):(n.logger.debug("ConfigServiceBase.fetchLogicAsync(): content was not modified. Returning last config with updated timestamp."),b.notModified(e.with(S.generateTimestamp())));case 403:case 404:return s=n.logger.fetchFailedDueToInvalidSdkKey().toString(),n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning last config (if any) with updated timestamp."),b.error(e.with(S.generateTimestamp()),s);default:return s=n.logger.fetchFailedDueToUnexpectedHttpResponse(r.statusCode,r.reasonPhrase).toString(),n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."),b.error(e,s)}}catch(r){return s=(r instanceof R&&r.cause==="timeout"?n.logger.fetchFailedDueToRequestTimeout(r.args[0],r):n.logger.fetchFailedDueToUnexpectedError(r)).toString(),n.logger.debug("ConfigServiceBase.fetchLogicAsync(): fetch was unsuccessful. Returning null."),b.error(e,s,r)}}async fetchRequestAsync(e,t=2){const n=this.options;n.logger.debug("ConfigServiceBase.fetchRequestAsync() - called.");for(let s=0;;s++){n.logger.debug(`ConfigServiceBase.fetchRequestAsync(): calling fetchLogic()${s>0?`, retry ${s}/${t}`:""}`);const r=await this.configFetcher.fetchLogic(n,e);if(r.statusCode!==200)return[r];if(!r.body)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): no response body."),[r,new Error("No response body.")];let o;try{o=V.deserialize(r.body)}catch(u){return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): invalid response body."),[r,u]}const a=o.preferences;if(!a)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): preferences is empty."),[r,o];const l=a.baseUrl;if(!l||l===n.baseUrl)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): baseUrl OK."),[r,o];const c=a.redirectMode;if(n.baseUrlOverriden&&c!==2)return n.logger.debug("ConfigServiceBase.fetchRequestAsync(): options.baseUrlOverriden && redirect !== 2."),[r,o];if(n.baseUrl=l,c===0)return[r,o];if(c===1&&n.logger.dataGovernanceIsOutOfSync(),s>=t)return n.logger.fetchFailedDueToRedirectLoop(),[r,o]}}get isOfflineExactly(){return this.status===1}get isOffline(){return this.status!==0}setOnlineCore(){}setOnline(){this.status===1?(this.setOnlineCore(),this.status=0,this.options.logger.configServiceStatusChanged($e(this.status))):this.disposed&&this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOnline")}setOfflineCore(){}setOffline(){this.status===0?(this.setOfflineCore(),this.status=1,this.options.logger.configServiceStatusChanged($e(this.status))):this.disposed&&this.options.logger.configServiceMethodHasNoEffectDueToDisposedClient("setOffline")}syncUpWithCache(){return this.options.cache.get(this.cacheKey)}async getReadyPromise(e,t){const n=await t(e);return this.options.hooks.emit("clientReady",n),n}}class ve{constructor(){this.callbacks=[]}get aborted(){return!this.callbacks}abort(){if(!this.aborted){const e=this.callbacks;this.callbacks=null;for(const t of e)t()}}registerCallback(e){return this.aborted?(e(),()=>{}):(this.callbacks.push(e),()=>{const t=this.callbacks;let n;t&&(n=t.indexOf(e))>=0&&t.splice(n,1)})}}function Pe(i,e){let t;return new Promise(n=>{const s=e==null?void 0:e.registerCallback(()=>{clearTimeout(t),n(!1)});t=setTimeout(()=>{s==null||s(),n(!0)},i)})}function M(i,e=!1){return i instanceof Error?e&&i.stack?i.stack:i.toString():i+""}function Me(i){throw i}function q(i){return Array.isArray(i)}function pe(i){return q(i)&&!i.some(e=>typeof e!="string")}function ye(i,e=0,t,n=", "){const s=i.length;if(!s)return"";let r="";return e>0&&s>e&&(i=i.slice(0,e),t&&(r=t(s-e))),"'"+i.join("'"+n+"'")+"'"+r}function Tt(i){return typeof(i==null?void 0:i.then)=="function"}function B(i){function e(o,a){const l=o.charCodeAt(a);if(55296<=l&&l<56320){const c=o.charCodeAt(a+1);if(56320<=c&&c<=57343)return(l<<10)+c-56613888}return l}let t="",n=0;const s=String.fromCharCode;let r;for(r=0;r<i.length;r++){const o=e(i,r);o<=127||(t+=i.slice(n,r),o<=2047?(t+=s(192|o>>6),t+=s(128|o&63)):o<=65535?(t+=s(224|o>>12),t+=s(128|o>>6&63),t+=s(128|o&63)):(t+=s(240|o>>18),t+=s(128|o>>12&63),t+=s(128|o>>6&63),t+=s(128|o&63),++r),n=r+1)}return t+=i.slice(n,r)}function me(i){return typeof i=="number"?i:typeof i!="string"||!i.length||/^\s*$|^\s*0[^\d.e]/.test(i)?NaN:+i}const bt=500;class Ct extends de{constructor(e,t){super(e,t),this.signalInitialization=()=>{},this.stopToken=new ve,this.pollIntervalMs=t.pollIntervalSeconds*1e3,this.pollExpirationMs=this.pollIntervalMs-bt;const n=this.syncUpWithCache();if(t.maxInitWaitTimeSeconds!==0){this.initialized=!1;const s=new Promise(r=>this.signalInitialization=r);this.initializationPromise=this.waitForInitializationAsync(s).then(r=>(this.initialized=!0,r))}else this.initialized=!0,this.initializationPromise=Promise.resolve(!1);this.readyPromise=this.getReadyPromise(this.initializationPromise,async s=>(await s,this.getCacheState(this.options.cache.getInMemory()))),t.offline||this.startRefreshWorker(n,this.stopToken)}async waitForInitializationAsync(e){if(this.options.maxInitWaitTimeSeconds<0)return await e,!0;const t=new ve,n=await Promise.race([e.then(()=>!0),Pe(this.options.maxInitWaitTimeSeconds*1e3,t).then(()=>!1)]);return t.abort(),n}async getConfig(){this.options.logger.debug("AutoPollConfigService.getConfig() called.");function e(n){n.debug("AutoPollConfigService.getConfig() - returning value from cache.")}let t;if(!this.isOffline&&!this.initialized){if(t=await this.options.cache.get(this.cacheKey),!t.isExpired(this.pollIntervalMs))return e(this.options.logger),t;this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired, waiting for initialization."),await this.initializationPromise}return t=await this.options.cache.get(this.cacheKey),t.isExpired(this.pollIntervalMs)?this.options.logger.debug("AutoPollConfigService.getConfig() - cache is empty or expired."):e(this.options.logger),t}refreshConfigAsync(){return this.options.logger.debug("AutoPollConfigService.refreshConfigAsync() called."),super.refreshConfigAsync()}dispose(){this.options.logger.debug("AutoPollConfigService.dispose() called."),super.dispose(),this.stopToken.aborted||this.stopRefreshWorker()}onConfigFetched(e){this.signalInitialization(),super.onConfigFetched(e)}setOnlineCore(){this.startRefreshWorker(null,this.stopToken)}setOfflineCore(){this.stopRefreshWorker(),this.stopToken=new ve}async startRefreshWorker(e,t){this.options.logger.debug("AutoPollConfigService.startRefreshWorker() called.");let n=!0;for(;!t.aborted;){try{const s=new Date().getTime()+this.pollIntervalMs;try{await this.refreshWorkerLogic(n,e)}catch(o){this.options.logger.autoPollConfigServiceErrorDuringPolling(o)}const r=s-new Date().getTime();r>0&&await Pe(r,t)}catch(s){this.options.logger.autoPollConfigServiceErrorDuringPolling(s)}n=!1,e=null}}stopRefreshWorker(){this.options.logger.debug("AutoPollConfigService.stopRefreshWorker() called."),this.stopToken.abort()}async refreshWorkerLogic(e,t){this.options.logger.debug("AutoPollConfigService.refreshWorkerLogic() - called.");const n=await(t??this.options.cache.get(this.cacheKey));n.isExpired(this.pollExpirationMs)?(e?!this.isOfflineExactly:!this.isOffline)&&await this.refreshConfigCoreAsync(n):e&&this.signalInitialization()}getCacheState(e){return e.isEmpty?0:e.isExpired(this.pollIntervalMs)?2:3}}class Ue{constructor(){this.cachedConfig=S.empty}set(e,t){this.cachedConfig=t}get(e){return this.cachedConfig}getInMemory(){return this.cachedConfig}}class Y{constructor(e,t){this.cache=e,this.logger=t,this.cachedConfig=S.empty}async set(e,t){try{if(!t.isEmpty)this.cachedSerializedConfig=S.serialize(t),this.cachedConfig=t;else{this.cachedSerializedConfig=void 0,this.cachedConfig=t;return}await this.cache.set(e,this.cachedSerializedConfig)}catch(n){this.logger.configServiceCacheWriteError(n)}}updateCachedConfig(e){e==null||e===this.cachedSerializedConfig||(this.cachedConfig=S.deserialize(e),this.cachedSerializedConfig=e)}get(e){try{const t=this.cache.get(e);if(Tt(t))return(async n=>{try{this.updateCachedConfig(await n)}catch(s){this.logger.configServiceCacheReadError(s)}return this.cachedConfig})(t);this.updateCachedConfig(t)}catch(t){this.logger.configServiceCacheReadError(t)}return Promise.resolve(this.cachedConfig)}getInMemory(){return this.cachedConfig}}h.LogLevel=void 0,function(i){i[i.Debug=4]="Debug",i[i.Info=3]="Info",i[i.Warn=2]="Warn",i[i.Error=1]="Error",i[i.Off=-1]="Off"}(h.LogLevel||(h.LogLevel={}));function It(i){return h.LogLevel[i]}class m{static from(...e){return(t,...n)=>new m(t,e,n)}constructor(e,t,n){this.strings=e,this.argNames=t,this.argValues=n}get defaultFormattedMessage(){let e=this.cachedDefaultFormattedMessage;if(e===void 0){e="";const{strings:t,argValues:n}=this;let s=0;for(;s<t.length-1;s++)e+=t[s],e+=n[s];e+=t[s],this.cachedDefaultFormattedMessage=e}return e}toString(){return this.defaultFormattedMessage}}class Rt{get level(){var e;return(e=this.logger.level)!==null&&e!==void 0?e:2}get eol(){var e;return(e=this.logger.eol)!==null&&e!==void 0?e:`
5
5
  `}constructor(e,t){this.logger=e,this.hooks=t}isEnabled(e){return this.level>=e}log(e,t,n,s){var r;return this.isEnabled(e)&&this.logger.log(e,t,n,s),e===1&&((r=this.hooks)===null||r===void 0||r.emit("clientError",n.toString(),s)),n}debug(e){this.log(4,0,e)}configJsonIsNotPresent(e){return this.log(1,1e3,m.from("DEFAULT_RETURN_VALUE")`Config JSON is not present. Returning ${e}.`)}configJsonIsNotPresentSingle(e,t,n){return this.log(1,1e3,m.from("KEY","DEFAULT_PARAM_NAME","DEFAULT_PARAM_VALUE")`Config JSON is not present when evaluating setting '${e}'. Returning the \`${t}\` parameter that you specified in your application: '${n}'.`)}settingEvaluationFailedDueToMissingKey(e,t,n,s){return this.log(1,1001,m.from("KEY","DEFAULT_PARAM_NAME","DEFAULT_PARAM_VALUE","AVAILABLE_KEYS")`Failed to evaluate setting '${e}' (the key was not found in config JSON). Returning the \`${t}\` parameter that you specified in your application: '${n}'. Available keys: [${s}].`)}settingEvaluationError(e,t,n){return this.log(1,1002,m.from("METHOD_NAME","DEFAULT_RETURN_VALUE")`Error occurred in the \`${e}\` method. Returning ${t}.`,n)}settingEvaluationErrorSingle(e,t,n,s,r){return this.log(1,1002,m.from("METHOD_NAME","KEY","DEFAULT_PARAM_NAME","DEFAULT_PARAM_VALUE")`Error occurred in the \`${e}\` method while evaluating setting '${t}'. Returning the \`${n}\` parameter that you specified in your application: '${s}'.`,r)}forceRefreshError(e,t){return this.log(1,1003,m.from("METHOD_NAME")`Error occurred in the \`${e}\` method.`,t)}fetchFailedDueToInvalidSdkKey(){return this.log(1,1100,"Your SDK Key seems to be wrong. You can find the valid SDK Key at https://app.configcat.com/sdkkey")}fetchFailedDueToUnexpectedHttpResponse(e,t){return this.log(1,1101,m.from("STATUS_CODE","REASON_PHRASE")`Unexpected HTTP response was received while trying to fetch config JSON: ${e} ${t}`)}fetchFailedDueToRequestTimeout(e,t){return this.log(1,1102,m.from("TIMEOUT")`Request timed out while trying to fetch config JSON. Timeout value: ${e}ms`,t)}fetchFailedDueToUnexpectedError(e){return this.log(1,1103,"Unexpected error occurred while trying to fetch config JSON. It is most likely due to a local network issue. Please make sure your application can reach the ConfigCat CDN servers (or your proxy server) over HTTP.",e)}fetchFailedDueToRedirectLoop(){return this.log(1,1104,"Redirection loop encountered while trying to fetch config JSON. Please contact us at https://configcat.com/support/")}fetchReceived200WithInvalidBody(e){return this.log(1,1105,"Fetching config JSON was successful but the HTTP response content was invalid.",e)}fetchReceived304WhenLocalCacheIsEmpty(e,t){return this.log(1,1106,m.from("STATUS_CODE","REASON_PHRASE")`Unexpected HTTP response was received when no config JSON is cached locally: ${e} ${t}`)}autoPollConfigServiceErrorDuringPolling(e){return this.log(1,1200,"Error occurred during auto polling.",e)}settingForVariationIdIsNotPresent(e){return this.log(1,2011,m.from("VARIATION_ID")`Could not find the setting for the specified variation ID: '${e}'.`)}configServiceCacheReadError(e){return this.log(1,2200,"Error occurred while reading the cache.",e)}configServiceCacheWriteError(e){return this.log(1,2201,"Error occurred while writing the cache.",e)}clientIsAlreadyCreated(e){return this.log(2,3e3,m.from("SDK_KEY")`There is an existing client instance for the specified SDK Key. No new client instance will be created and the specified options are ignored. Returning the existing client instance. SDK Key: '${e}'.`)}userObjectIsMissing(e){return this.log(2,3001,m.from("KEY")`Cannot evaluate targeting rules and % options for setting '${e}' (User Object is missing). You should pass a User Object to the evaluation methods like \`getValueAsync()\` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/`)}dataGovernanceIsOutOfSync(){return this.log(2,3002,"The `dataGovernance` parameter specified at the client initialization is not in sync with the preferences on the ConfigCat Dashboard. Read more: https://configcat.com/docs/advanced/data-governance/")}userObjectAttributeIsMissingPercentage(e,t){return this.log(2,3003,m.from("KEY","ATTRIBUTE_NAME","ATTRIBUTE_NAME")`Cannot evaluate % options for setting '${e}' (the User.${t} attribute is missing). You should set the User.${t} attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/`)}userObjectAttributeIsMissingCondition(e,t,n){return this.log(2,3003,m.from("CONDITION","KEY","ATTRIBUTE_NAME","ATTRIBUTE_NAME")`Cannot evaluate condition (${e}) for setting '${t}' (the User.${n} attribute is missing). You should set the User.${n} attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/`)}userObjectAttributeIsInvalid(e,t,n,s){return this.log(2,3004,m.from("CONDITION","KEY","REASON","ATTRIBUTE_NAME")`Cannot evaluate condition (${e}) for setting '${t}' (${n}). Please check the User.${s} attribute and make sure that its value corresponds to the comparison operator.`)}userObjectAttributeIsAutoConverted(e,t,n,s){return this.log(2,3005,m.from("CONDITION","KEY","ATTRIBUTE_NAME","ATTRIBUTE_VALUE")`Evaluation of condition (${e}) for setting '${t}' may not produce the expected result (the User.${n} attribute is not a string value, thus it was automatically converted to the string value '${s}'). Please make sure that using a non-string value was intended.`)}configServiceCannotInitiateHttpCalls(){return this.log(2,3200,"Client is in offline mode, it cannot initiate HTTP calls.")}configServiceMethodHasNoEffectDueToDisposedClient(e){return this.log(2,3201,m.from("METHOD_NAME")`The client object is already disposed, thus \`${e}()\` has no effect.`)}configServiceMethodHasNoEffectDueToOverrideBehavior(e,t){return this.log(2,3202,m.from("OVERRIDE_BEHAVIOR","METHOD_NAME")`Client is configured to use the \`${e}\` override behavior, thus \`${t}()\` has no effect.`)}settingEvaluated(e){return this.log(3,5e3,m.from("EVALUATE_LOG")`${e}`)}configServiceStatusChanged(e){return this.log(3,5200,m.from("MODE")`Switched to ${e.toUpperCase()} mode.`)}}class _e{constructor(e=2,t=`
6
- `){this.level=e,this.eol=t,this.SOURCE="ConfigCat"}log(e,t,n,s){const[r,o]=e===4?[console.info,"DEBUG"]:e===3?[console.info,"INFO"]:e===2?[console.warn,"WARN"]:e===1?[console.error,"ERROR"]:[console.log,It(e).toUpperCase()],a=s!==void 0?this.eol+P(s,!0):"";r(`${this.SOURCE} - ${o} - [${t}] ${n}${a}`)}}class Ee{constructor(){this.addListener=this.on,this.off=this.removeListener}on(){return this}once(){return this}removeListener(){return this}removeAllListeners(){return this}listeners(){return[]}listenerCount(){return 0}eventNames(){return[]}emit(){return!1}}function Ve(i){function e(D,$){var ce=D<<$|D>>>32-$;return ce}var t,n,s,r=new Array(80),o=1732584193,a=4023233417,l=2562383102,c=271733878,u=3285377520,g,f,d,p,E,w;i=B(i);var O=i.length,I=new Array;for(n=0;n<O-3;n+=4)s=i.charCodeAt(n)<<24|i.charCodeAt(n+1)<<16|i.charCodeAt(n+2)<<8|i.charCodeAt(n+3),I.push(s);switch(O%4){case 0:n=2147483648;break;case 1:n=i.charCodeAt(O-1)<<24|8388608;break;case 2:n=i.charCodeAt(O-2)<<24|i.charCodeAt(O-1)<<16|32768;break;case 3:n=i.charCodeAt(O-3)<<24|i.charCodeAt(O-2)<<16|i.charCodeAt(O-1)<<8|128;break}for(I.push(n);I.length%16!=14;)I.push(0);for(I.push(O>>>29),I.push(O<<3&4294967295),t=0;t<I.length;t+=16){for(n=0;n<16;n++)r[n]=I[t+n];for(n=16;n<=79;n++)r[n]=e(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);for(g=o,f=a,d=l,p=c,E=u,n=0;n<=19;n++)w=e(g,5)+(f&d|~f&p)+E+r[n]+1518500249&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;for(n=20;n<=39;n++)w=e(g,5)+(f^d^p)+E+r[n]+1859775393&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;for(n=40;n<=59;n++)w=e(g,5)+(f&d|f&p|d&p)+E+r[n]+2400959708&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;for(n=60;n<=79;n++)w=e(g,5)+(f^d^p)+E+r[n]+3395469782&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;o=o+g&4294967295,a=a+f&4294967295,l=l+d&4294967295,c=c+p&4294967295,u=u+E&4294967295}return Be([o,a,l,c,u])}function qe(i){function e(vt,pt){return vt>>>pt|vt<<32-pt}const t="length";var n=Math.pow,s=n(2,32),r,o,a=qe,l=a.h,c=a.k;if(!c){l=[],c=[];for(var u={},g=2,f=0;f<64;g++)if(!u[g]){for(r=0;r<313;r+=g)u[r]=g;l[f]=n(g,.5)*s|0,c[f++]=n(g,1/3)*s|0}a.h=l=l.slice(0,8),a.k=c}var d=i[t]*8;i+="€";for(var p=[];i[t]%64-56;)i+="\0";for(r=0;r<i[t];r++)o=i.charCodeAt(r),p[r>>2]|=o<<(3-r)%4*8;for(p[p[t]]=d/s|0,p[p[t]]=d,o=0;o<p[t];){var E=p.slice(o,o+=16),w=l;for(l=l.slice(0,8),r=0;r<64;r++){var O=E[r-15],I=E[r-2],D=l[0],$=l[4],ce=l[7]+(e($,6)^e($,11)^e($,25))+($&l[5]^~$&l[6])+c[r]+(E[r]=r<16?E[r]:E[r-16]+(e(O,7)^e(O,18)^O>>>3)+E[r-7]+(e(I,17)^e(I,19)^I>>>10)|0),pn=(e(D,2)^e(D,13)^e(D,22))+(D&l[1]^D&l[2]^l[1]&l[2]);l=[ce+pn|0].concat(l),l[4]=l[4]+ce|0}for(r=0;r<8;r++)l[r]=l[r]+w[r]|0}return Be(l,8)}function Be(i,e){const t="0123456789abcdef";var n="";e??(e=i.length);for(let s=0;s<e;s++)for(let r=3;r>=0;r--){const o=i[s]>>(r<<3)&255;n+=t[o>>4],n+=t[o&15]}return n}const xe=new Ee;class We{constructor(e){this.addListener=this.on,this.off=this.removeListener,this.eventEmitter=e}tryDisconnect(){const e=this.eventEmitter;return this.eventEmitter=xe,e!==xe}on(e,t){return this.eventEmitter.on(e,t),this}once(e,t){return this.eventEmitter.once(e,t),this}removeListener(e,t){return this.eventEmitter.removeListener(e,t),this}removeAllListeners(e){return this.eventEmitter.removeAllListeners(e),this}listeners(e){return this.eventEmitter.listeners(e)}listenerCount(e){return this.eventEmitter.listenerCount(e)}eventNames(){return this.eventEmitter.eventNames()}emit(e,...t){return this.eventEmitter.emit(e,...t)}}function Ke(){const i=function(e){this.target=e};return i.prototype.deref=function(){return this.target},i.isFallback=!0,i}const He=()=>typeof WeakRef=="function";h.PollingMode=void 0,function(i){i[i.AutoPoll=0]="AutoPoll",i[i.LazyLoad=1]="LazyLoad",i[i.ManualPoll=2]="ManualPoll"}(h.PollingMode||(h.PollingMode={})),h.DataGovernance=void 0,function(i){i[i.Global=0]="Global",i[i.EuOnly=1]="EuOnly"}(h.DataGovernance||(h.DataGovernance={}));class M{constructor(e,t,n,s,r){var o,a,l;if(this.requestTimeoutMs=3e4,this.baseUrlOverriden=!1,this.offline=!1,!e)throw new Error("Invalid 'sdkKey' value");switch(this.sdkKey=e,this.clientVersion=t,this.dataGovernance=(o=n==null?void 0:n.dataGovernance)!==null&&o!==void 0?o:0,this.dataGovernance){case 1:this.baseUrl="https://cdn-eu.configcat.com";break;default:this.baseUrl="https://cdn-global.configcat.com";break}const c=(a=r==null?void 0:r())!==null&&a!==void 0?a:new Ee,u=new We(c),g=new(He()?WeakRef:Ke())(u);this.hooks={hooks:u,hooksWeakRef:g,emit(p,...E){var w,O;return(O=(w=this.hooksWeakRef.deref())===null||w===void 0?void 0:w.emit(p,...E))!==null&&O!==void 0?O:!1}};let f,d;if(n){if(f=n.logger,d=n.cache,n.requestTimeoutMs){if(n.requestTimeoutMs<0)throw new Error("Invalid 'requestTimeoutMs' value");this.requestTimeoutMs=n.requestTimeoutMs}n.baseUrl&&(this.baseUrl=n.baseUrl,this.baseUrlOverriden=!0),n.flagOverrides&&(this.flagOverrides=n.flagOverrides),n.defaultUser&&(this.defaultUser=n.defaultUser),n.offline&&(this.offline=n.offline),(l=n.setupHooks)===null||l===void 0||l.call(n,u)}this.logger=new Rt(f??new _e,this.hooks),this.cache=d?new Y(d,this.logger):s?s(this):new Ue}yieldHooks(){const e=this.hooks,t=e.hooks;return delete e.hooks,t??new We(new Ee)}getUrl(){return this.baseUrl+"/configuration-files/"+this.sdkKey+"/"+M.configFileName+"?sdk="+this.clientVersion}getCacheKey(){return Ve(`${this.sdkKey}_${M.configFileName}_${S.serializationFormatVersion}`)}}M.configFileName="config_v6.json";class ze extends M{constructor(e,t,n,s,r,o){super(e,t+"/a-"+n,s,r,o),this.pollIntervalSeconds=60,this.maxInitWaitTimeSeconds=5,s&&(s.pollIntervalSeconds!=null&&(this.pollIntervalSeconds=s.pollIntervalSeconds),s.maxInitWaitTimeSeconds!=null&&(this.maxInitWaitTimeSeconds=s.maxInitWaitTimeSeconds));const a=2147483;if(!(typeof this.pollIntervalSeconds=="number"&&1<=this.pollIntervalSeconds&&this.pollIntervalSeconds<=a))throw new Error("Invalid 'pollIntervalSeconds' value");if(!(typeof this.maxInitWaitTimeSeconds=="number"&&this.maxInitWaitTimeSeconds<=a))throw new Error("Invalid 'maxInitWaitTimeSeconds' value")}}class je extends M{constructor(e,t,n,s,r,o){super(e,t+"/m-"+n,s,r,o)}}class Je extends M{constructor(e,t,n,s,r,o){if(super(e,t+"/l-"+n,s,r,o),this.cacheTimeToLiveSeconds=60,s&&s.cacheTimeToLiveSeconds!=null&&(this.cacheTimeToLiveSeconds=s.cacheTimeToLiveSeconds),!(typeof this.cacheTimeToLiveSeconds=="number"&&1<=this.cacheTimeToLiveSeconds&&this.cacheTimeToLiveSeconds<=2147483647))throw new Error("Invalid 'cacheTimeToLiveSeconds' value")}}h.OverrideBehaviour=void 0,function(i){i[i.LocalOnly=0]="LocalOnly",i[i.LocalOverRemote=1]="LocalOverRemote",i[i.RemoteOverLocal=2]="RemoteOverLocal"}(h.OverrideBehaviour||(h.OverrideBehaviour={}));function Nt(i){return h.OverrideBehaviour[i]}class Ft{constructor(e,t){this.initialSettings=Ge(e),t&&(this.map=e)}getOverrides(){return Promise.resolve(this.getOverridesSync())}getOverridesSync(){return this.map?Ge(this.map):this.initialSettings}}function Ge(i){const e={};for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=V.fromValue(i[t]));return e}const Lt="cc-",Q=";str";class kt{get currentValue(){if(!(typeof location>"u"))return location==null?void 0:location.search}}let X;class Dt{constructor(e,t,n){this.watchChanges=e,this.paramPrefix=t??Lt,n??(n=X??(X=new kt)),this.queryStringProvider=n;const s=n.currentValue;this.settings=Qe(s,this.paramPrefix),this.queryString=Ye(s)}getOverrides(){return Promise.resolve(this.getOverridesSync())}getOverridesSync(){if(this.watchChanges){const e=this.queryStringProvider.currentValue,t=Ye(e);this.queryString!==t&&(this.settings=Qe(e,this.paramPrefix),this.queryString=t)}return this.settings}}function Ye(i){if(i==null)return"";if(typeof i=="string")return i;let e="",t="?";for(const n in i){if(!Object.prototype.hasOwnProperty.call(i,n))continue;const s=i[n];let r,o;if(!q(s))r=s,o=1;else if(s.length)r=s[0],o=s.length;else continue;for(let a=0;e+=t+encodeURIComponent(n)+"="+encodeURIComponent(r),!(++a>=o);)t="&",r=s[a]}return e}function Qe(i,e){const t={};return typeof i=="string"?Pt(i,e,t):i!=null&&$t(i,e,t),t}function $t(i,e,t){for(const n in i){if(!Object.prototype.hasOwnProperty.call(i,n))continue;const s=i[n];let r,o;if(!q(s))r=s,o=1;else if(s.length)r=s[0],o=s.length;else continue;for(let a=0;Xe(n,r,e,t),!(++a>=o);)r=s[a]}}function Pt(i,e,t){if(!i||i.lastIndexOf("?",0)<0)return;const n=i.substring(1).split("&");for(let s of n){s=s.replace(/\+/g," ");const r=s.indexOf("="),o=decodeURIComponent(r>=0?s.substring(0,r):s),a=r>=0?decodeURIComponent(s.substring(r+1)):"";Xe(o,a,e,t)}}function Xe(i,e,t,n){if(!i||i.length<=t.length||i.lastIndexOf(t,0)<0)return;i=i.substring(t.length),i.length>Q.length&&i.indexOf(Q,i.length-Q.length)>=0?i=i.substring(0,i.length-Q.length):e=Mt(e),n[i]=V.fromValue(e)}function Mt(i){switch(i.toLowerCase()){case"false":return!1;case"true":return!0;default:const e=me(i);return isNaN(e)?i:e}}class Ut extends de{constructor(e,t){super(e,t),this.cacheTimeToLiveMs=t.cacheTimeToLiveSeconds*1e3;const n=this.syncUpWithCache();this.readyPromise=this.getReadyPromise(n,async s=>this.getCacheState(await s))}async getConfig(){this.options.logger.debug("LazyLoadConfigService.getConfig() called.");function e(n,s=""){n.debug(`LazyLoadConfigService.getConfig(): cache is empty or expired${s}.`)}let t=await this.options.cache.get(this.cacheKey);return t.isExpired(this.cacheTimeToLiveMs)?(this.isOffline?e(this.options.logger):(e(this.options.logger,", calling refreshConfigCoreAsync()"),[,t]=await this.refreshConfigCoreAsync(t)),t):(this.options.logger.debug("LazyLoadConfigService.getConfig(): cache is valid, returning from cache."),t)}refreshConfigAsync(){return this.options.logger.debug("LazyLoadConfigService.refreshConfigAsync() called."),super.refreshConfigAsync()}getCacheState(e){return e.isEmpty?0:e.isExpired(this.cacheTimeToLiveMs)?2:3}}class _t extends de{constructor(e,t){super(e,t);const n=this.syncUpWithCache();this.readyPromise=this.getReadyPromise(n,async s=>this.getCacheState(await s))}getCacheState(e){return e.isEmpty?0:2}async getConfig(){return this.options.logger.debug("ManualPollService.getConfig() called."),await this.options.cache.get(this.cacheKey)}refreshConfigAsync(){return this.options.logger.debug("ManualPollService.refreshConfigAsync() called."),super.refreshConfigAsync()}}const Ze="<invalid value>",Se="<invalid name>",Oe="<invalid operator>",et="<invalid reference>",Vt=10;class tt{constructor(e){this.eol=e,this.log="",this.indent=""}resetIndent(){return this.indent="",this}increaseIndent(){return this.indent+=" ",this}decreaseIndent(){return this.indent=this.indent.slice(0,-2),this}newLine(e){return this.log+=this.eol+this.indent+(e??""),this}append(e){return this.log+=e,this}toString(){return this.log}appendUserConditionCore(e,t,n){return this.append(`User.${e} ${Ae(t)} '${n??Ze}'`)}appendUserConditionString(e,t,n,s){return typeof n!="string"?this.appendUserConditionCore(e,t):this.appendUserConditionCore(e,t,s?"<hashed value>":n)}appendUserConditionStringList(e,t,n,s){if(!pe(n))return this.appendUserConditionCore(e,t);const r="value",o="values",a=Ae(t);if(s)return this.append(`User.${e} ${a} [<${n.length} hashed ${n.length===1?r:o}>]`);{const l=ye(n,Vt,c=>`, ... <${c} more ${c===1?r:o}>`);return this.append(`User.${e} ${a} [${l}]`)}}appendUserConditionNumber(e,t,n,s){if(typeof n!="number")return this.appendUserConditionCore(e,t);const r=Ae(t);let o;return s&&!isNaN(o=new Date(n*1e3))?this.append(`User.${e} ${r} '${n}' (${o.toISOString()} UTC)`):this.append(`User.${e} ${r} '${n}'`)}appendUserCondition(e){const t=typeof e.comparisonAttribute=="string"?e.comparisonAttribute:Se,n=e.comparator;switch(e.comparator){case 0:case 1:case 2:case 3:case 4:case 5:case 30:case 31:case 32:case 33:case 34:case 35:return this.appendUserConditionStringList(t,n,e.comparisonValue,!1);case 6:case 7:case 8:case 9:case 28:case 29:return this.appendUserConditionString(t,n,e.comparisonValue,!1);case 10:case 11:case 12:case 13:case 14:case 15:return this.appendUserConditionNumber(t,n,e.comparisonValue);case 16:case 17:case 22:case 23:case 24:case 25:case 26:case 27:return this.appendUserConditionStringList(t,n,e.comparisonValue,!0);case 18:case 19:return this.appendUserConditionNumber(t,n,e.comparisonValue,!0);case 20:case 21:return this.appendUserConditionString(t,n,e.comparisonValue,!0);default:return this.appendUserConditionCore(t,n,e.comparisonValue)}}appendPrerequisiteFlagCondition(e,t){const n=typeof e.prerequisiteFlagKey!="string"?Se:e.prerequisiteFlagKey in t?e.prerequisiteFlagKey:et,s=e.comparator,r=e.comparisonValue;return this.append(`Flag '${n}' ${qt(s)} '${Z(r)}'`)}appendSegmentCondition(e){const t=e.segment,n=e.comparator,s=t==null?et:typeof t.name!="string"||!t.name?Se:t.name;return this.append(`User ${nt(n)} '${s}'`)}appendConditionResult(e){return this.append(`${e}`)}appendConditionConsequence(e){return this.append(" => ").appendConditionResult(e),e?this:this.append(", skipping the remaining AND conditions")}appendTargetingRuleThenPart(e,t){(t?this.newLine():this.append(" ")).append("THEN");const n=e.then;return this.append(q(n)?" % options":` '${Z(n.value)}'`)}appendTargetingRuleConsequence(e,t,n){return this.increaseIndent(),this.appendTargetingRuleThenPart(e,n).append(" => ").append(t===!0?"MATCH, applying rule":t===!1?"no match":t),this.decreaseIndent()}}function Ae(i){switch(i){case 0:case 16:case 4:return"IS ONE OF";case 1:case 17:case 5:return"IS NOT ONE OF";case 2:return"CONTAINS ANY OF";case 3:return"NOT CONTAINS ANY OF";case 6:case 12:return"<";case 7:case 13:return"<=";case 8:case 14:return">";case 9:case 15:return">=";case 10:return"=";case 11:return"!=";case 18:return"BEFORE";case 19:return"AFTER";case 28:case 20:return"EQUALS";case 29:case 21:return"NOT EQUALS";case 30:case 22:return"STARTS WITH ANY OF";case 31:case 23:return"NOT STARTS WITH ANY OF";case 32:case 24:return"ENDS WITH ANY OF";case 33:case 25:return"NOT ENDS WITH ANY OF";case 34:case 26:return"ARRAY CONTAINS ANY OF";case 35:case 27:return"ARRAY NOT CONTAINS ANY OF";default:return Oe}}function we(i){return new tt("").appendUserCondition(i).toString()}function qt(i){switch(i){case 0:return"EQUALS";case 1:return"NOT EQUALS";default:return Oe}}function nt(i){switch(i){case 0:return"IS IN SEGMENT";case 1:return"IS NOT IN SEGMENT";default:return Oe}}function Z(i){return z(i)?i.toString():Ze}const it=/^[0-9]+$/,x=(i,e)=>{const t=it.test(i),n=it.test(e);return t&&n&&(i=+i,e=+e),i===e?0:t&&!n?-1:n&&!t?1:i<e?-1:1},Te=256,ee=Number.MAX_SAFE_INTEGER||9007199254740991,W=[],y=[],v={};let Bt=0;const A=(i,e)=>{const t=Bt++;v[i]=t,y[t]=e,W[t]=new RegExp(e)};A("NUMERICIDENTIFIER","0|[1-9]\\d*"),A("NUMERICIDENTIFIERLOOSE","[0-9]+"),A("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),A("MAINVERSION",`(${y[v.NUMERICIDENTIFIER]})\\.(${y[v.NUMERICIDENTIFIER]})\\.(${y[v.NUMERICIDENTIFIER]})`),A("MAINVERSIONLOOSE",`(${y[v.NUMERICIDENTIFIERLOOSE]})\\.(${y[v.NUMERICIDENTIFIERLOOSE]})\\.(${y[v.NUMERICIDENTIFIERLOOSE]})`),A("PRERELEASEIDENTIFIER",`(?:${y[v.NUMERICIDENTIFIER]}|${y[v.NONNUMERICIDENTIFIER]})`),A("PRERELEASEIDENTIFIERLOOSE",`(?:${y[v.NUMERICIDENTIFIERLOOSE]}|${y[v.NONNUMERICIDENTIFIER]})`),A("PRERELEASE",`(?:-(${y[v.PRERELEASEIDENTIFIER]}(?:\\.${y[v.PRERELEASEIDENTIFIER]})*))`),A("PRERELEASELOOSE",`(?:-?(${y[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${y[v.PRERELEASEIDENTIFIERLOOSE]})*))`),A("BUILDIDENTIFIER","[0-9A-Za-z-]+"),A("BUILD",`(?:\\+(${y[v.BUILDIDENTIFIER]}(?:\\.${y[v.BUILDIDENTIFIER]})*))`),A("FULLPLAIN",`v?${y[v.MAINVERSION]}${y[v.PRERELEASE]}?${y[v.BUILD]}?`),A("FULL",`^${y[v.FULLPLAIN]}$`),A("LOOSEPLAIN",`[v=\\s]*${y[v.MAINVERSIONLOOSE]}${y[v.PRERELEASELOOSE]}?${y[v.BUILD]}?`),A("LOOSE",`^${y[v.LOOSEPLAIN]}$`);class C{constructor(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof C){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>Te)throw new TypeError(`version is longer than ${Te} characters`);this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?W[v.LOOSE]:W[v.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>ee||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ee||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ee||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const r=+s;if(r>=0&&r<ee)return r}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(!(e instanceof C)){if(typeof e=="string"&&e===this.version)return 0;e=new C(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof C||(e=new C(e,this.options)),x(this.major,e.major)||x(this.minor,e.minor)||x(this.patch,e.patch)}comparePre(e){if(e instanceof C||(e=new C(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],s=e.prerelease[t];if(n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return x(n,s)}while(++t)}compareBuild(e){e instanceof C||(e=new C(e,this.options));let t=0;do{const n=this.build[t],s=e.build[t];if(n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return x(n,s)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);n===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}const be=(i,e)=>{if((!e||typeof e!="object")&&(e={loose:!!e,includePrerelease:!1}),i instanceof C)return i;if(typeof i!="string"||i.length>Te||!(e.loose?W[v.LOOSE]:W[v.FULL]).test(i))return null;try{return new C(i,e)}catch{return null}};class xt{constructor(e,t,n,s={}){this.identifier=e,this.email=t,this.country=n,this.custom=s}}function st(i,e){var t,n;switch(e){case"Identifier":return(t=i.identifier)!==null&&t!==void 0?t:"";case"Email":return i.email;case"Country":return i.country;default:return(n=i.custom)===null||n===void 0?void 0:n[e]}}function Wt(i){var e;const t={},n="Identifier",s="Email",r="Country";if(t[n]=(e=i.identifier)!==null&&e!==void 0?e:"",i.email!=null&&(t[s]=i.email),i.country!=null&&(t[r]=i.country),i.custom!=null){const o=[n,s,r];for(const[a,l]of Object.entries(i.custom))l!=null&&o.indexOf(a)<0&&(t[a]=l)}return t}class K{get visitedFlags(){var e;return(e=this.$visitedFlags)!==null&&e!==void 0?e:this.$visitedFlags=[]}constructor(e,t,n,s){this.key=e,this.setting=t,this.user=n,this.settings=s}static forPrerequisiteFlag(e,t,n){const s=new K(e,t,n.user,n.settings);return s.$visitedFlags=n.visitedFlags,s.logBuilder=n.logBuilder,s}}const rt="The current targeting rule is ignored and the evaluation continues with the next rule.",Ce="cannot evaluate, User Object is missing",Kt=i=>`cannot evaluate, the User.${i} attribute is missing`,Ht=(i,e)=>`cannot evaluate, the User.${i} attribute is invalid (${e})`;class zt{constructor(e){this.logger=e}evaluate(e,t){this.logger.debug("RolloutEvaluator.evaluate() called.");let n=t.logBuilder;this.logger.isEnabled(3)&&(t.logBuilder=n=new tt(this.logger.eol),n.append(`Evaluating '${t.key}'`),t.user&&n.append(` for User '${JSON.stringify(Wt(t.user))}'`),n.increaseIndent());let s;try{let r,o;if(e!=null){const a=t.setting.type;if(a>=0&&!Gt(e,a)){const l=wt(a);throw new TypeError(`The type of a setting must match the type of the specified default value. Setting's type was ${l} but the default value's type was ${typeof e}. Please use a default value which corresponds to the setting type ${l}. Learn more: https://configcat.com/docs/sdk-reference/js/#setting-type-mapping`)}r=this.evaluateSetting(t),s=r.selectedValue.value,o=typeof s==typeof e}else r=this.evaluateSetting(t),s=r.selectedValue.value,o=z(s);return o||Ne(s),r}catch(r){throw n==null||n.resetIndent().increaseIndent(),s=e,r}finally{n&&(n.newLine(`Returning '${s}'.`).decreaseIndent(),this.logger.settingEvaluated(n.toString()))}}evaluateSetting(e){let t;const n=e.setting.targetingRules;if(n.length>0&&(t=this.evaluateTargetingRules(n,e)))return t;const s=e.setting.percentageOptions;return s.length>0&&(t=this.evaluatePercentageOptions(s,void 0,e))?t:{selectedValue:e.setting}}evaluateTargetingRules(e,t){const n=t.logBuilder;n==null||n.newLine("Evaluating targeting rules and applying the first match if any:");for(let s=0;s<e.length;s++){const r=e[s],o=r.conditions,a=this.evaluateConditions(o,r,t.key,t);if(a!==!0){H(a)&&(n==null||n.increaseIndent().newLine(rt).decreaseIndent());continue}if(!q(r.then))return{selectedValue:r.then,matchedTargetingRule:r};const l=r.then;n==null||n.increaseIndent();const c=this.evaluatePercentageOptions(l,r,t);if(c)return n==null||n.decreaseIndent(),c;n==null||n.newLine(rt).decreaseIndent()}}evaluatePercentageOptions(e,t,n){var s;const r=n.logBuilder;if(!n.user){r==null||r.newLine("Skipping % options because the User Object is missing."),n.isMissingUserObjectLogged||(this.logger.userObjectIsMissing(n.key),n.isMissingUserObjectLogged=!0);return}let o=n.setting.percentageOptionsAttribute,a;if(o==null?(o="Identifier",a=(s=n.user.identifier)!==null&&s!==void 0?s:""):a=st(n.user,o),a==null){r==null||r.newLine(`Skipping % options because the User.${o} attribute is missing.`),n.isMissingUserObjectAttributeLogged||(this.logger.userObjectAttributeIsMissingPercentage(n.key,o),n.isMissingUserObjectAttributeLogged=!0);return}r==null||r.newLine(`Evaluating % options based on the User.${o} attribute:`);const l=Ve(n.key+at(a)),c=parseInt(l.substring(0,7),16)%100;r==null||r.newLine(`- Computing hash in the [0..99] range from User.${o} => ${c} (this value is sticky and consistent across all SDKs)`);let u=0;for(let g=0;g<e.length;g++){const f=e[g];if(u+=f.percentage,!(c>=u))return r==null||r.newLine(`- Hash value ${c} selects % option ${g+1} (${f.percentage}%), '${Z(f.value)}'.`),{selectedValue:f,matchedTargetingRule:t,matchedPercentageOption:f}}throw new Error("Sum of percentage option percentages is less than 100.")}evaluateConditions(e,t,n,s){let r=!0;const o=s.logBuilder;let a=!1;o==null||o.newLine("- ");for(let l=0;l<e.length;l++){const c=e[l];switch(o&&(l?o.increaseIndent().newLine("AND "):o.append("IF ").increaseIndent()),c.type){case"UserCondition":r=this.evaluateUserCondition(c,n,s),a=e.length>1;break;case"PrerequisiteFlagCondition":r=this.evaluatePrerequisiteFlagCondition(c,s),a=!0;break;case"SegmentCondition":r=this.evaluateSegmentCondition(c,s),a=!H(r)||r!==Ce||e.length>1;break;default:throw new Error}const u=r===!0;if(o&&((!t||e.length>1)&&o.appendConditionConsequence(u),o.decreaseIndent()),!u)break}return t&&(o==null||o.appendTargetingRuleConsequence(t,r,a)),r}evaluateUserCondition(e,t,n){const s=n.logBuilder;if(s==null||s.appendUserCondition(e),!n.user)return n.isMissingUserObjectLogged||(this.logger.userObjectIsMissing(n.key),n.isMissingUserObjectLogged=!0),Ce;const r=e.comparisonAttribute,o=st(n.user,r);if(o==null||o==="")return this.logger.userObjectAttributeIsMissingCondition(we(e),n.key,r),Kt(r);let a,l,c,u;switch(e.comparator){case 28:case 29:return a=F(r,o,e,n.key,this.logger),this.evaluateTextEquals(a,e.comparisonValue,e.comparator===29);case 20:case 21:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextEquals(a,e.comparisonValue,n.setting.configJsonSalt,t,e.comparator===21);case 0:case 1:return a=F(r,o,e,n.key,this.logger),this.evaluateTextIsOneOf(a,e.comparisonValue,e.comparator===1);case 16:case 17:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextIsOneOf(a,e.comparisonValue,n.setting.configJsonSalt,t,e.comparator===17);case 30:case 31:return a=F(r,o,e,n.key,this.logger),this.evaluateTextSliceEqualsAnyOf(a,e.comparisonValue,!0,e.comparator===31);case 22:case 23:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextSliceEqualsAnyOf(a,e.comparisonValue,n.setting.configJsonSalt,t,!0,e.comparator===23);case 32:case 33:return a=F(r,o,e,n.key,this.logger),this.evaluateTextSliceEqualsAnyOf(a,e.comparisonValue,!1,e.comparator===33);case 24:case 25:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextSliceEqualsAnyOf(a,e.comparisonValue,n.setting.configJsonSalt,t,!1,e.comparator===25);case 2:case 3:return a=F(r,o,e,n.key,this.logger),this.evaluateTextContainsAnyOf(a,e.comparisonValue,e.comparator===3);case 4:case 5:return l=lt(r,o,e,n.key,this.logger),typeof l!="string"?this.evaluateSemVerIsOneOf(l,e.comparisonValue,e.comparator===5):l;case 6:case 7:case 8:case 9:return l=lt(r,o,e,n.key,this.logger),typeof l!="string"?this.evaluateSemVerRelation(l,e.comparator,e.comparisonValue):l;case 10:case 11:case 12:case 13:case 14:case 15:return c=jt(r,o,e,n.key,this.logger),typeof c!="string"?this.evaluateNumberRelation(c,e.comparator,e.comparisonValue):c;case 18:case 19:return c=Jt(r,o,e,n.key,this.logger),typeof c!="string"?this.evaluateDateTimeRelation(c,e.comparisonValue,e.comparator===18):c;case 34:case 35:return u=ct(r,o,e,n.key,this.logger),typeof u!="string"?this.evaluateArrayContainsAnyOf(u,e.comparisonValue,e.comparator===35):u;case 26:case 27:return u=ct(r,o,e,n.key,this.logger),typeof u!="string"?this.evaluateSensitiveArrayContainsAnyOf(u,e.comparisonValue,n.setting.configJsonSalt,t,e.comparator===27):u;default:throw new Error}}evaluateTextEquals(e,t,n){return e===t!==n}evaluateSensitiveTextEquals(e,t,n,s,r){return Ie(e,n,s)===t!==r}evaluateTextIsOneOf(e,t,n){return t.indexOf(e)>=0!==n}evaluateSensitiveTextIsOneOf(e,t,n,s,r){const o=Ie(e,n,s);return t.indexOf(o)>=0!==r}evaluateTextSliceEqualsAnyOf(e,t,n,s){for(let r=0;r<t.length;r++){const o=t[r];if(e.length<o.length)continue;if((n?e.lastIndexOf(o,0):e.indexOf(o,e.length-o.length))>=0)return!s}return s}evaluateSensitiveTextSliceEqualsAnyOf(e,t,n,s,r,o){const a=B(e);for(let l=0;l<t.length;l++){const c=t[l],u=c.indexOf("_"),g=parseInt(c.slice(0,u));if(a.length<g)continue;const f=r?a.slice(0,g):a.slice(a.length-g);if(ot(f,n,s)===c.slice(u+1))return!o}return o}evaluateTextContainsAnyOf(e,t,n){for(let s=0;s<t.length;s++)if(e.indexOf(t[s])>=0)return!n;return n}evaluateSemVerIsOneOf(e,t,n){let s=!1;for(let r=0;r<t.length;r++){const o=t[r];if(!o.length)continue;const a=be(o.trim());if(!a)return!1;!s&&e.compare(a)===0&&(s=!0)}return s!==n}evaluateSemVerRelation(e,t,n){const s=be(n.trim());if(!s)return!1;const r=e.compare(s);switch(t){case 6:return r<0;case 7:return r<=0;case 8:return r>0;case 9:return r>=0}}evaluateNumberRelation(e,t,n){switch(t){case 10:return e===n;case 11:return e!==n;case 12:return e<n;case 13:return e<=n;case 14:return e>n;case 15:return e>=n}}evaluateDateTimeRelation(e,t,n){return n?e<t:e>t}evaluateArrayContainsAnyOf(e,t,n){for(let s=0;s<e.length;s++)if(t.indexOf(e[s])>=0)return!n;return n}evaluateSensitiveArrayContainsAnyOf(e,t,n,s,r){for(let o=0;o<e.length;o++){const a=Ie(e[o],n,s);if(t.indexOf(a)>=0)return!r}return r}evaluatePrerequisiteFlagCondition(e,t){const n=t.logBuilder;n==null||n.appendPrerequisiteFlagCondition(e,t.settings);const s=e.prerequisiteFlagKey,r=t.settings[s];if(t.visitedFlags.push(t.key),t.visitedFlags.indexOf(s)>=0){t.visitedFlags.push(s);const u=ye(t.visitedFlags,void 0,void 0," -> ");throw new Error(`Circular dependency detected between the following depending flags: ${u}.`)}const o=K.forPrerequisiteFlag(s,r,t);n==null||n.newLine("(").increaseIndent().newLine(`Evaluating prerequisite flag '${s}':`);const a=this.evaluateSetting(o);t.visitedFlags.pop();const l=a.selectedValue.value;if(typeof l!=typeof e.comparisonValue){if(z(l))throw new Error(`Type mismatch between comparison value '${e.comparisonValue}' and prerequisite flag '${s}'.`);Ne(l)}let c;switch(e.comparator){case 0:c=l===e.comparisonValue;break;case 1:c=l!==e.comparisonValue;break;default:throw new Error}return n==null||n.newLine(`Prerequisite flag evaluation result: '${Z(l)}'.`).newLine("Condition (").appendPrerequisiteFlagCondition(e,t.settings).append(") evaluates to ").appendConditionResult(c).append(".").decreaseIndent().newLine(")"),c}evaluateSegmentCondition(e,t){const n=t.logBuilder;if(n==null||n.appendSegmentCondition(e),!t.user)return t.isMissingUserObjectLogged||(this.logger.userObjectIsMissing(t.key),t.isMissingUserObjectLogged=!0),Ce;const s=e.segment;n==null||n.newLine("(").increaseIndent().newLine(`Evaluating segment '${s.name}':`);const r=this.evaluateConditions(s.conditions,void 0,s.name,t);let o=r;if(!H(o))switch(e.comparator){case 0:break;case 1:o=!o;break;default:throw new Error}return n&&(n.newLine("Segment evaluation result: "),(H(o)?n.append(o):n.append(`User ${nt(r?0:1)}`)).append("."),n.newLine("Condition (").appendSegmentCondition(e).append(")"),(H(o)?n.append(" failed to evaluate"):n.append(" evaluates to ").appendConditionResult(o)).append("."),n.decreaseIndent().newLine(")")),o}}function H(i){return typeof i=="string"}function Ie(i,e,t){return ot(B(i),e,t)}function ot(i,e,t){return qe(i+B(e)+B(t))}function at(i){return typeof i=="string"?i:i instanceof Date?i.getTime()/1e3+"":pe(i)?JSON.stringify(i):i+""}function F(i,e,t,n,s){return typeof e=="string"||(e=at(e),s.userObjectAttributeIsAutoConverted(we(t),n,i,e)),e}function lt(i,e,t,n,s){let r;return typeof e=="string"&&(r=be(e.trim()))?r:te(s,t,n,i,`'${e}' is not a valid semantic version`)}function jt(i,e,t,n,s){if(typeof e=="number")return e;let r;return typeof e=="string"&&(!isNaN(r=me(e.replace(",",".")))||e.trim()==="NaN")?r:te(s,t,n,i,`'${e}' is not a valid decimal number`)}function Jt(i,e,t,n,s){if(e instanceof Date)return e.getTime()/1e3;if(typeof e=="number")return e;let r;return typeof e=="string"&&(!isNaN(r=me(e.replace(",",".")))||e.trim()==="NaN")?r:te(s,t,n,i,`'${e}' is not a valid Unix timestamp (number of seconds elapsed since Unix epoch)`)}function ct(i,e,t,n,s){let r=e;if(typeof r=="string")try{r=JSON.parse(r)}catch{}return pe(r)?r:te(s,t,n,i,`'${e}' is not a valid string array`)}function te(i,e,t,n,s){return i.userObjectAttributeIsInvalid(we(e),t,s,n),Ht(n,s)}function ut(i,e,t,n){return{key:i,value:e.selectedValue.value,variationId:e.selectedValue.variationId,fetchTime:t,user:n,isDefaultValue:!1,matchedTargetingRule:e.matchedTargetingRule,matchedPercentageOption:e.matchedPercentageOption}}function U(i,e,t,n,s,r){return{key:i,value:e,fetchTime:t,user:n,isDefaultValue:!0,errorMessage:s,errorException:r}}function ne(i,e,t,n,s,r,o){let a;if(!e)return a=o.configJsonIsNotPresentSingle(t,"defaultValue",n).toString(),U(t,n,L(r),s,a);const l=e[t];if(!l)return a=o.settingEvaluationFailedDueToMissingKey(t,"defaultValue",n,ye(Object.keys(e))).toString(),U(t,n,L(r),s,a);const c=i.evaluate(n,new K(t,l,s,e));return ut(t,c,L(r),s)}function ht(i,e,t,n,s,r){let o;if(!Re(e,s,r))return[[],o];const a=[];for(const[l,c]of Object.entries(e)){let u;try{const g=i.evaluate(null,new K(l,c,t,e));u=ut(l,g,L(n),t)}catch(g){o??(o=[]),o.push(g),u=U(l,null,L(n),t,P(g),g)}a.push(u)}return[a,o]}function Re(i,e,t){return i?!0:(e.configJsonIsNotPresent(t),!1)}function z(i){return typeof i=="boolean"||typeof i=="string"||typeof i=="number"}function Gt(i,e){switch(e){case 0:return typeof i=="boolean";case 1:return typeof i=="string";case 2:case 3:return typeof i=="number";default:return!1}}function Ne(i){throw new TypeError(i===null?"Setting value is null.":i===void 0?"Setting value is undefined.":`Setting value '${i}' is of an unsupported type (${typeof i}).`)}function L(i){return i?new Date(i.timestamp):void 0}class Yt{constructor(){this.instances={}}getOrCreate(e,t){let n;const s=this.instances[e.sdkKey];if(s){const[a]=s;if(n=a.deref(),n)return[n,!0]}const r={};n=new k(e,t,r);const o=He()?WeakRef:Ke();return this.instances[e.sdkKey]=[new o(n),r],[n,!1]}remove(e,t){const n=this.instances[e];if(n){const[s,r]=n,o=!!s.deref();if(!o||r===t)return delete this.instances[e],o}return!1}clear(){const e=[];for(const[t,[n]]of Object.entries(this.instances)){const s=n.deref();s&&e.push(s),delete this.instances[t]}return e}}const j=new Yt;class k{static get instanceCache(){return j}static get(e,t,n,s){var r;const o="Invalid 'sdkKey' value";if(!e)throw new Error(o);const a=t===0?ze:t===2?je:t===1?Je:Me(new Error("Invalid 'pollingMode' value")),l=new a(e,s.sdkType,s.sdkVersion,n,s.defaultCacheFactory,s.eventEmitterFactory);if(((r=l.flagOverrides)===null||r===void 0?void 0:r.behaviour)!==0&&!Qt(e,l.baseUrlOverriden))throw new Error(o);const[c,u]=j.getOrCreate(l,s);return u&&n&&l.logger.clientIsAlreadyCreated(e),c}constructor(e,t,n){var s;if(this.cacheToken=n,this.addListener=this.on,this.off=this.removeListener,!e)throw new Error("Invalid 'options' value");if(this.options=e,this.options.logger.debug("Initializing ConfigCatClient. Options: "+JSON.stringify(this.options)),!t)throw new Error("Invalid 'configCatKernel' value");if(!t.configFetcher)throw new Error("Invalid 'configCatKernel.configFetcher' value");this.hooks=e.yieldHooks(),e.defaultUser&&this.setDefaultUser(e.defaultUser),this.evaluator=new zt(e.logger),((s=e.flagOverrides)===null||s===void 0?void 0:s.behaviour)!==0?this.configService=e instanceof ze?new Ct(t.configFetcher,e):e instanceof je?new _t(t.configFetcher,e):e instanceof Je?new Ut(t.configFetcher,e):Me(new Error("Invalid 'options' value")):this.hooks.emit("clientReady",1),this.suppressFinalize=ae(this,{sdkKey:e.sdkKey,cacheToken:n,configService:this.configService,logger:e.logger})}static finalize(e){var t;(t=e.logger)===null||t===void 0||t.debug("finalize() called"),e.cacheToken&&j.remove(e.sdkKey,e.cacheToken),k.close(e.configService,e.logger)}static close(e,t,n){t==null||t.debug("close() called"),n==null||n.tryDisconnect(),e==null||e.dispose()}dispose(){const e=this.options;e.logger.debug("dispose() called"),this.cacheToken&&j.remove(e.sdkKey,this.cacheToken),k.close(this.configService,e.logger,this.hooks),this.suppressFinalize()}static disposeAll(){const e=j.clear();let t;for(const n of e)try{k.close(n.configService,n.options.logger,n.hooks),n.suppressFinalize()}catch(s){t??(t=[]),t.push(s)}if(t)throw typeof AggregateError<"u"?new AggregateError(t):t.pop()}async getValueAsync(e,t,n){this.options.logger.debug("getValueAsync() called."),se(e),re(t);let s,r,o=null;n??(n=this.defaultUser);try{let a;[a,o]=await this.getSettingsAsync(),r=ne(this.evaluator,a,e,t,n,o,this.options.logger),s=r.value}catch(a){this.options.logger.settingEvaluationErrorSingle("getValueAsync",e,"defaultValue",t,a),r=U(e,t,L(o),n,P(a),a),s=t}return this.hooks.emit("flagEvaluated",r),s}async getValueDetailsAsync(e,t,n){this.options.logger.debug("getValueDetailsAsync() called."),se(e),re(t);let s,r=null;n??(n=this.defaultUser);try{let o;[o,r]=await this.getSettingsAsync(),s=ne(this.evaluator,o,e,t,n,r,this.options.logger)}catch(o){this.options.logger.settingEvaluationErrorSingle("getValueDetailsAsync",e,"defaultValue",t,o),s=U(e,t,L(r),n,P(o),o)}return this.hooks.emit("flagEvaluated",s),s}async getAllKeysAsync(){this.options.logger.debug("getAllKeysAsync() called.");const e="empty array";try{const[t]=await this.getSettingsAsync();return Re(t,this.options.logger,e)?Object.keys(t):[]}catch(t){return this.options.logger.settingEvaluationError("getAllKeysAsync",e,t),[]}}async getAllValuesAsync(e){this.options.logger.debug("getAllValuesAsync() called.");const t="empty array";let n,s,r;e??(e=this.defaultUser);try{const[o,a]=await this.getSettingsAsync();[s,r]=ht(this.evaluator,o,e,a,this.options.logger,t),n=s.map(l=>({settingKey:l.key,settingValue:l.value}))}catch(o){return this.options.logger.settingEvaluationError("getAllValuesAsync",t,o),[]}r!=null&&r.length&&this.options.logger.settingEvaluationError("getAllValuesAsync","evaluation result",typeof AggregateError<"u"?new AggregateError(r):r.pop());for(const o of s)this.hooks.emit("flagEvaluated",o);return n}async getAllValueDetailsAsync(e){this.options.logger.debug("getAllValueDetailsAsync() called.");const t="empty array";let n,s;e??(e=this.defaultUser);try{const[r,o]=await this.getSettingsAsync();[n,s]=ht(this.evaluator,r,e,o,this.options.logger,t)}catch(r){return this.options.logger.settingEvaluationError("getAllValueDetailsAsync",t,r),[]}s!=null&&s.length&&this.options.logger.settingEvaluationError("getAllValueDetailsAsync","evaluation result",typeof AggregateError<"u"?new AggregateError(s):s.pop());for(const r of n)this.hooks.emit("flagEvaluated",r);return n}async getKeyAndValueAsync(e){this.options.logger.debug("getKeyAndValueAsync() called.");const t="null";try{const[n]=await this.getSettingsAsync();if(!Re(n,this.options.logger,t))return null;for(const[s,r]of Object.entries(n)){if(e===r.variationId)return{settingKey:s,settingValue:oe(r.value)};const o=n[s].targetingRules;if(o&&o.length>0)for(let l=0;l<o.length;l++){const c=o[l].then;if(q(c))for(let u=0;u<c.length;u++){const g=c[u];if(e===g.variationId)return{settingKey:s,settingValue:oe(g.value)}}else if(e===c.variationId)return{settingKey:s,settingValue:oe(c.value)}}const a=n[s].percentageOptions;if(a&&a.length>0)for(let l=0;l<a.length;l++){const c=a[l];if(e===c.variationId)return{settingKey:s,settingValue:oe(c.value)}}}this.options.logger.settingForVariationIdIsNotPresent(e)}catch(n){this.options.logger.settingEvaluationError("getKeyAndValueAsync",t,n)}return null}async forceRefreshAsync(){if(this.options.logger.debug("forceRefreshAsync() called."),this.configService)try{const[e]=await this.configService.refreshConfigAsync();return e}catch(e){return this.options.logger.forceRefreshError("forceRefreshAsync",e),N.failure(P(e),e)}else return N.failure("Client is configured to use the LocalOnly override behavior, which prevents making HTTP requests.")}setDefaultUser(e){this.defaultUser=e}clearDefaultUser(){this.defaultUser=void 0}get isOffline(){var e,t;return(t=(e=this.configService)===null||e===void 0?void 0:e.isOffline)!==null&&t!==void 0?t:!0}setOnline(){this.configService?this.configService.setOnline():this.options.logger.configServiceMethodHasNoEffectDueToOverrideBehavior(Nt(0),"setOnline")}setOffline(){var e;(e=this.configService)===null||e===void 0||e.setOffline()}waitForReady(){const e=this.configService;return e?e.readyPromise:Promise.resolve(1)}snapshot(){var e;const t=()=>{const o=this.options.cache.getInMemory();return[o.isEmpty?null:o.config.settings,o]};let n,s;const r=(e=this.options)===null||e===void 0?void 0:e.flagOverrides;if(r){const o=r.dataSource.getOverridesSync();switch(r.behaviour){case 0:return new ie(o,null,this);case 1:return[n,s]=t(),new ie(Object.assign(Object.assign({},n??{}),o),s,this);case 2:return[n,s]=t(),new ie(Object.assign(Object.assign({},o),n??{}),s,this)}}return[n,s]=t(),new ie(n,s,this)}async getSettingsAsync(){var e;this.options.logger.debug("getSettingsAsync() called.");const t=async()=>{const s=await this.configService.getConfig();return[s.isEmpty?null:s.config.settings,s]},n=(e=this.options)===null||e===void 0?void 0:e.flagOverrides;if(n){let s,r;const o=await n.dataSource.getOverrides();switch(n.behaviour){case 0:return[o,null];case 1:return[s,r]=await t(),[Object.assign(Object.assign({},s??{}),o),r];case 2:return[s,r]=await t(),[Object.assign(Object.assign({},o),s??{}),r]}}return await t()}on(e,t){return this.hooks.on(e,t),this}once(e,t){return this.hooks.once(e,t),this}removeListener(e,t){return this.hooks.removeListener(e,t),this}removeAllListeners(e){return this.hooks.removeAllListeners(e),this}listeners(e){return this.hooks.listeners(e)}listenerCount(e){return this.hooks.listenerCount(e)}eventNames(){return this.hooks.eventNames()}}class ie{constructor(e,t,n){this.mergedSettings=e,this.remoteConfig=t,this.defaultUser=n.defaultUser,this.evaluator=n.evaluator,this.options=n.options,this.cacheState=t?n.configService.getCacheState(t):1}get fetchedConfig(){const e=this.remoteConfig;return e&&!e.isEmpty?e.config:null}getAllKeys(){return this.mergedSettings?Object.keys(this.mergedSettings):[]}getValue(e,t,n){this.options.logger.debug("Snapshot.getValue() called."),se(e),re(t);let s,r;n??(n=this.defaultUser);try{r=ne(this.evaluator,this.mergedSettings,e,t,n,this.remoteConfig,this.options.logger),s=r.value}catch(o){this.options.logger.settingEvaluationErrorSingle("Snapshot.getValue",e,"defaultValue",t,o),r=U(e,t,L(this.remoteConfig),n,P(o),o),s=t}return this.options.hooks.emit("flagEvaluated",r),s}getValueDetails(e,t,n){this.options.logger.debug("Snapshot.getValueDetails() called."),se(e),re(t);let s;n??(n=this.defaultUser);try{s=ne(this.evaluator,this.mergedSettings,e,t,n,this.remoteConfig,this.options.logger)}catch(r){this.options.logger.settingEvaluationErrorSingle("Snapshot.getValueDetails",e,"defaultValue",t,r),s=U(e,t,L(this.remoteConfig),n,P(r),r)}return this.options.hooks.emit("flagEvaluated",s),s}}function Qt(i,e){const t="configcat-proxy/";if(e&&i.length>t.length&&i.lastIndexOf(t,0)===0)return!0;const n=i.split("/"),s=22;switch(n.length){case 2:return n[0].length===s&&n[1].length===s;case 3:return n[0]==="configcat-sdk-1"&&n[1].length===s&&n[2].length===s;default:return!1}}function se(i){if(!i)throw new Error("Invalid 'key' value")}function re(i){if(i!=null&&!z(i))throw new TypeError("The default value must be boolean, number, string, null or undefined.")}function oe(i){return z(i)?i:Ne(i)}let ae=function(i,e){if(typeof FinalizationRegistry<"u"){const t=new FinalizationRegistry(n=>k.finalize(n));ae=(n,s)=>{const r={};return t.register(n,s,r),()=>t.unregister(r)}}else ae=()=>()=>{};return ae(i,e)};function gt(i,e,t,n){return k.get(i,e,t,n)}function Xt(){k.disposeAll()}function Zt(i,e){return new _e(i,e)}function en(i,e,t){return{dataSource:new Ft(i,t),behaviour:e}}function tn(i,e,t,n){return{dataSource:new Dt(e,t,n),behaviour:i}}function J(i){return!!i.fn}class ft{constructor(){this.events={},this.eventCount=0,this.addListener=this.on,this.off=this.removeListener}addListenerCore(e,t,n){if(typeof t!="function")throw new TypeError("Listener must be a function");const s=this.events[e],r={fn:t,once:n};return s?J(s)?this.events[e]=[s,r]:s.push(r):(this.events[e]=r,this.eventCount++),this}removeListenerCore(e,t,n){const s=this.events[e];if(!s)return this;if(J(s))n(s,t)&&this.removeEvent(e);else for(let r=s.length-1;r>=0;r--)if(n(s[r],t)){s.splice(r,1),s.length?s.length===1&&(this.events[e]=s[0]):this.removeEvent(e);break}return this}removeEvent(e){--this.eventCount===0?this.events={}:delete this.events[e]}on(e,t){return this.addListenerCore(e,t,!1)}once(e,t){return this.addListenerCore(e,t,!0)}removeListener(e,t){if(typeof t!="function")throw new TypeError("Listener must be a function");return this.removeListenerCore(e,t,(n,s)=>n.fn===s)}removeAllListeners(e){return e?this.events[e]&&this.removeEvent(e):(this.events={},this.eventCount=0),this}listeners(e){const t=this.events[e];if(!t)return[];if(J(t))return[t.fn];const n=t.length,s=new Array(n);for(let r=0;r<n;r++)s[r]=t[r].fn;return s}listenerCount(e){const t=this.events[e];return t?J(t)?1:t.length:0}eventNames(){const e=[];if(this.eventCount===0)return e;const t=this.events;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e}emit(e,t,n,s,r,...o){let a=this.events[e];if(!a)return!1;let l,c;J(a)?[l,c]=[a,1]:(a=a.slice(),[l,c]=[a[0],a.length]);const u=arguments.length-1;for(let g=0;;){switch(l.once&&this.removeListenerCore(e,l,(f,d)=>f===d),u){case 0:l.fn.call(this);break;case 1:l.fn.call(this,t);break;case 2:l.fn.call(this,t,n);break;case 3:l.fn.call(this,t,n,s);break;case 4:l.fn.call(this,t,n,s,r);break;default:const f=new Array(u);for(let d=0;d<u;d++)f[d]=arguments[d+1];l.fn.apply(this,f);break}if(++g>=c)break;l=a[g]}return!0}}class le{static tryGetFactory(){const e=nn();if(e)return t=>new Y(new le(e),t.logger)}constructor(e){this.storage=e}set(e,t){this.storage.setItem(e,sn(t))}get(e){const t=this.storage.getItem(e);if(t)return rn(t)}}function nn(){if(typeof localStorage<"u"){const i="__configcat_localStorage_test";try{const e=localStorage;e.setItem(i,i);let t;try{t=e.getItem(i)}finally{e.removeItem(i)}if(t===i)return e}catch{}}}function sn(i){return i=encodeURIComponent(i),i=i.replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))),btoa(i)}function rn(i){return i=atob(i),i=i.replace(/[%\x80-\xFF]/g,e=>"%"+e.charCodeAt(0).toString(16)),decodeURIComponent(i)}const G="configCache";class Fe{static tryGetFactory(){const e=on();if(e)return t=>new Y(new Fe(e),t.logger)}constructor(e){this.dbConnectionFactory=e}async set(e,t){const n=await this.dbConnectionFactory();try{await new Promise((s,r)=>{const o=n.transaction(G,"readwrite");o.oncomplete=()=>s(),o.onerror=l=>r(l.target.error),o.objectStore(G).put(t,e)})}finally{n.close()}}async get(e){const t=await this.dbConnectionFactory();try{return await new Promise((n,s)=>{const r=t.transaction(G,"readonly");let o;r.oncomplete=()=>n(o),r.onerror=c=>s(c.target.error);const l=r.objectStore(G).get(e);l.onsuccess=c=>o=c.target.result})}finally{t.close()}}}function on(){if(typeof indexedDB<"u")try{const i=()=>new Promise((e,t)=>{const n=indexedDB.open("@configcat/sdk");n.onupgradeneeded=s=>s.target.result.createObjectStore(G),n.onsuccess=s=>e(s.target.result),n.onerror=s=>t(s.target.error)});return i().then(e=>e.close()).catch(()=>{}),i}catch{}}class dt{handleStateChange(e,t,n){var s;try{if(e.readyState===4){const{status:r,statusText:o}=e;if(r===200){const a=(s=e.getResponseHeader("ETag"))!==null&&s!==void 0?s:void 0;t({statusCode:r,reasonPhrase:o,eTag:a,body:e.responseText})}else r&&t({statusCode:r,reasonPhrase:o})}}catch(r){n(r)}}fetchLogic(e,t){return new Promise((n,s)=>{try{e.logger.debug("HttpConfigFetcher.fetchLogic() called.");const r=new XMLHttpRequest;r.onreadystatechange=()=>this.handleStateChange(r,n,s),r.ontimeout=()=>s(new R("timeout",e.requestTimeoutMs)),r.onabort=()=>s(new R("abort")),r.onerror=()=>s(new R("failure"));let o=e.getUrl();t&&(o+="&ccetag="+encodeURIComponent(t)),r.open("GET",o,!0),r.timeout=e.requestTimeoutMs,r.send(null)}catch(r){s(r)}})}}class an{async fetchLogic(e,t){var n,s,r;const o={method:"GET"};let a;if(typeof AbortController<"u"){const l=new AbortController,c=setTimeout(()=>l.abort(),e.requestTimeoutMs);o.signal=l.signal,a=()=>clearTimeout(c)}else a=()=>{};try{let l=e.getUrl();t&&(l+="&ccetag="+encodeURIComponent(t));const c=await fetch(l,o),{status:u,statusText:g}=c;if(u===200){const f=await c.text(),d=(s=(n=c.headers)===null||n===void 0?void 0:n.get("Etag"))!==null&&s!==void 0?s:void 0;return{statusCode:u,reasonPhrase:g,eTag:d,body:f}}else return{statusCode:u,reasonPhrase:g}}catch(l){throw l instanceof DOMException&&l.name==="AbortError"?!((r=o.signal)===null||r===void 0)&&r.aborted?new R("timeout",e.requestTimeoutMs):new R("abort"):new R("failure",l)}finally{a()}}}const ln=V.fromValue,cn=Object.freeze(Object.defineProperty({__proto__:null,DefaultEventEmitter:ft,ExternalConfigCache:Y,FetchApiConfigFetcher:an,FetchError:R,FetchResult:b,get FetchStatus(){return ge},InMemoryConfigCache:Ue,IndexedDBConfigCache:Fe,LocalStorageConfigCache:le,XmlHttpRequestConfigFetcher:dt,createConsoleLogger:Zt,createFlagOverridesFromMap:en,createFlagOverridesFromQueryParams:tn,disposeAllClients:Xt,getClient:gt,settingFromValue:ln},Symbol.toStringTag,{value:"Module"})),un="2.4.2",hn={install:(i,e)=>{const{sdkKey:t,pollingMode:n,clientOptions:s}=e,r={sdkType:"ConfigCat-Vue",sdkVersion:un,configFetcher:new dt,eventEmitterFactory:()=>new ft,defaultCacheFactory:le.tryGetFactory()},o=gt(t,n??h.PollingMode.AutoPoll,s,r);i.provide("configCatClient",o);const a=i.unmount;i.unmount=function(){a.apply(arguments),o.dispose()}}},gn=T.defineComponent({__name:"FeatureWrapper",props:{featureKey:{},userObject:{}},emits:["flagValueChanged"],setup(i,{emit:e}){const t=e,n=i,s=T.ref(null),r=T.inject("configCatClient")??(()=>{throw new Error("ConfigCatPlugin was not installed.")})(),o=()=>{const l=r.snapshot().getValue(n.featureKey,!1,n.userObject);s.value!==l&&(s.value=l,t("flagValueChanged",l))};return T.onBeforeMount(()=>{const a=r.snapshot(),l=a.cacheState;l==h.ClientCacheState.HasUpToDateFlagData||l==h.ClientCacheState.HasLocalOverrideFlagDataOnly?(s.value=a.getValue(n.featureKey,!1,n.userObject),r.on("configChanged",o)):r.getValueAsync(n.featureKey,!1,n.userObject).then(c=>{const u=o;u&&(s.value=c,r.on("configChanged",u))})}),T.onUnmounted(()=>{r.off("configChanged",o)}),(a,l)=>s.value===!0?T.renderSlot(a.$slots,"default",{key:0}):s.value===!1?T.renderSlot(a.$slots,"else",{key:1}):T.renderSlot(a.$slots,"loading",{key:2})}}),{createConsoleLogger:fn,createFlagOverridesFromMap:dn,createFlagOverridesFromQueryParams:vn}=cn;h.ConfigCatPlugin=hn,h.ConfigJson=yt,h.FeatureWrapper=gn,h.FormattableLogMessage=m,h.RefreshResult=N,h.User=xt,h.createConsoleLogger=fn,h.createFlagOverridesFromMap=dn,h.createFlagOverridesFromQueryParams=vn,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
6
+ `){this.level=e,this.eol=t,this.SOURCE="ConfigCat"}log(e,t,n,s){const[r,o]=e===4?[console.info,"DEBUG"]:e===3?[console.info,"INFO"]:e===2?[console.warn,"WARN"]:e===1?[console.error,"ERROR"]:[console.log,It(e).toUpperCase()],a=s!==void 0?this.eol+M(s,!0):"";r(`${this.SOURCE} - ${o} - [${t}] ${n}${a}`)}}class Ee{constructor(){this.addListener=this.on,this.off=this.removeListener}on(){return this}once(){return this}removeListener(){return this}removeAllListeners(){return this}listeners(){return[]}listenerCount(){return 0}eventNames(){return[]}emit(){return!1}}function Ve(i){function e(D,$){var ce=D<<$|D>>>32-$;return ce}var t,n,s,r=new Array(80),o=1732584193,a=4023233417,l=2562383102,c=271733878,u=3285377520,g,f,d,p,E,w;i=B(i);var O=i.length,I=new Array;for(n=0;n<O-3;n+=4)s=i.charCodeAt(n)<<24|i.charCodeAt(n+1)<<16|i.charCodeAt(n+2)<<8|i.charCodeAt(n+3),I.push(s);switch(O%4){case 0:n=2147483648;break;case 1:n=i.charCodeAt(O-1)<<24|8388608;break;case 2:n=i.charCodeAt(O-2)<<24|i.charCodeAt(O-1)<<16|32768;break;case 3:n=i.charCodeAt(O-3)<<24|i.charCodeAt(O-2)<<16|i.charCodeAt(O-1)<<8|128;break}for(I.push(n);I.length%16!=14;)I.push(0);for(I.push(O>>>29),I.push(O<<3&4294967295),t=0;t<I.length;t+=16){for(n=0;n<16;n++)r[n]=I[t+n];for(n=16;n<=79;n++)r[n]=e(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);for(g=o,f=a,d=l,p=c,E=u,n=0;n<=19;n++)w=e(g,5)+(f&d|~f&p)+E+r[n]+1518500249&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;for(n=20;n<=39;n++)w=e(g,5)+(f^d^p)+E+r[n]+1859775393&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;for(n=40;n<=59;n++)w=e(g,5)+(f&d|f&p|d&p)+E+r[n]+2400959708&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;for(n=60;n<=79;n++)w=e(g,5)+(f^d^p)+E+r[n]+3395469782&4294967295,E=p,p=d,d=e(f,30),f=g,g=w;o=o+g&4294967295,a=a+f&4294967295,l=l+d&4294967295,c=c+p&4294967295,u=u+E&4294967295}return Be([o,a,l,c,u])}function qe(i){function e(vt,pt){return vt>>>pt|vt<<32-pt}const t="length";var n=Math.pow,s=n(2,32),r,o,a=qe,l=a.h,c=a.k;if(!c){l=[],c=[];for(var u={},g=2,f=0;f<64;g++)if(!u[g]){for(r=0;r<313;r+=g)u[r]=g;l[f]=n(g,.5)*s|0,c[f++]=n(g,1/3)*s|0}a.h=l=l.slice(0,8),a.k=c}var d=i[t]*8;i+="€";for(var p=[];i[t]%64-56;)i+="\0";for(r=0;r<i[t];r++)o=i.charCodeAt(r),p[r>>2]|=o<<(3-r)%4*8;for(p[p[t]]=d/s|0,p[p[t]]=d,o=0;o<p[t];){var E=p.slice(o,o+=16),w=l;for(l=l.slice(0,8),r=0;r<64;r++){var O=E[r-15],I=E[r-2],D=l[0],$=l[4],ce=l[7]+(e($,6)^e($,11)^e($,25))+($&l[5]^~$&l[6])+c[r]+(E[r]=r<16?E[r]:E[r-16]+(e(O,7)^e(O,18)^O>>>3)+E[r-7]+(e(I,17)^e(I,19)^I>>>10)|0),pn=(e(D,2)^e(D,13)^e(D,22))+(D&l[1]^D&l[2]^l[1]&l[2]);l=[ce+pn|0].concat(l),l[4]=l[4]+ce|0}for(r=0;r<8;r++)l[r]=l[r]+w[r]|0}return Be(l,8)}function Be(i,e){const t="0123456789abcdef";var n="";e??(e=i.length);for(let s=0;s<e;s++)for(let r=3;r>=0;r--){const o=i[s]>>(r<<3)&255;n+=t[o>>4],n+=t[o&15]}return n}const xe=new Ee;class We{constructor(e){this.addListener=this.on,this.off=this.removeListener,this.eventEmitter=e}tryDisconnect(){const e=this.eventEmitter;return this.eventEmitter=xe,e!==xe}on(e,t){return this.eventEmitter.on(e,t),this}once(e,t){return this.eventEmitter.once(e,t),this}removeListener(e,t){return this.eventEmitter.removeListener(e,t),this}removeAllListeners(e){return this.eventEmitter.removeAllListeners(e),this}listeners(e){return this.eventEmitter.listeners(e)}listenerCount(e){return this.eventEmitter.listenerCount(e)}eventNames(){return this.eventEmitter.eventNames()}emit(e,...t){return this.eventEmitter.emit(e,...t)}}function Ke(){const i=function(e){this.target=e};return i.prototype.deref=function(){return this.target},i.isFallback=!0,i}const He=()=>typeof WeakRef=="function";h.PollingMode=void 0,function(i){i[i.AutoPoll=0]="AutoPoll",i[i.LazyLoad=1]="LazyLoad",i[i.ManualPoll=2]="ManualPoll"}(h.PollingMode||(h.PollingMode={})),h.DataGovernance=void 0,function(i){i[i.Global=0]="Global",i[i.EuOnly=1]="EuOnly"}(h.DataGovernance||(h.DataGovernance={}));class U{constructor(e,t,n,s,r){var o,a,l;if(this.requestTimeoutMs=3e4,this.baseUrlOverriden=!1,this.offline=!1,!e)throw new Error("Invalid 'sdkKey' value");switch(this.sdkKey=e,this.clientVersion=t,this.dataGovernance=(o=n==null?void 0:n.dataGovernance)!==null&&o!==void 0?o:0,this.dataGovernance){case 1:this.baseUrl="https://cdn-eu.configcat.com";break;default:this.baseUrl="https://cdn-global.configcat.com";break}const c=(a=r==null?void 0:r())!==null&&a!==void 0?a:new Ee,u=new We(c),g=new(He()?WeakRef:Ke())(u);this.hooks={hooks:u,hooksWeakRef:g,emit(p,...E){var w,O;return(O=(w=this.hooksWeakRef.deref())===null||w===void 0?void 0:w.emit(p,...E))!==null&&O!==void 0?O:!1}};let f,d;if(n){if(f=n.logger,d=n.cache,n.requestTimeoutMs){if(n.requestTimeoutMs<0)throw new Error("Invalid 'requestTimeoutMs' value");this.requestTimeoutMs=n.requestTimeoutMs}n.baseUrl&&(this.baseUrl=n.baseUrl,this.baseUrlOverriden=!0),n.flagOverrides&&(this.flagOverrides=n.flagOverrides),n.defaultUser&&(this.defaultUser=n.defaultUser),n.offline&&(this.offline=n.offline),(l=n.setupHooks)===null||l===void 0||l.call(n,u)}this.logger=new Rt(f??new _e,this.hooks),this.cache=d?new Y(d,this.logger):s?s(this):new Ue}yieldHooks(){const e=this.hooks,t=e.hooks;return delete e.hooks,t??new We(new Ee)}getUrl(){return this.baseUrl+"/configuration-files/"+this.sdkKey+"/"+U.configFileName+"?sdk="+this.clientVersion}getCacheKey(){return Ve(`${this.sdkKey}_${U.configFileName}_${S.serializationFormatVersion}`)}}U.configFileName="config_v6.json";class ze extends U{constructor(e,t,n,s,r,o){super(e,t+"/a-"+n,s,r,o),this.pollIntervalSeconds=60,this.maxInitWaitTimeSeconds=5,s&&(s.pollIntervalSeconds!=null&&(this.pollIntervalSeconds=s.pollIntervalSeconds),s.maxInitWaitTimeSeconds!=null&&(this.maxInitWaitTimeSeconds=s.maxInitWaitTimeSeconds));const a=2147483;if(!(typeof this.pollIntervalSeconds=="number"&&1<=this.pollIntervalSeconds&&this.pollIntervalSeconds<=a))throw new Error("Invalid 'pollIntervalSeconds' value");if(!(typeof this.maxInitWaitTimeSeconds=="number"&&this.maxInitWaitTimeSeconds<=a))throw new Error("Invalid 'maxInitWaitTimeSeconds' value")}}class je extends U{constructor(e,t,n,s,r,o){super(e,t+"/m-"+n,s,r,o)}}class Je extends U{constructor(e,t,n,s,r,o){if(super(e,t+"/l-"+n,s,r,o),this.cacheTimeToLiveSeconds=60,s&&s.cacheTimeToLiveSeconds!=null&&(this.cacheTimeToLiveSeconds=s.cacheTimeToLiveSeconds),!(typeof this.cacheTimeToLiveSeconds=="number"&&1<=this.cacheTimeToLiveSeconds&&this.cacheTimeToLiveSeconds<=2147483647))throw new Error("Invalid 'cacheTimeToLiveSeconds' value")}}h.OverrideBehaviour=void 0,function(i){i[i.LocalOnly=0]="LocalOnly",i[i.LocalOverRemote=1]="LocalOverRemote",i[i.RemoteOverLocal=2]="RemoteOverLocal"}(h.OverrideBehaviour||(h.OverrideBehaviour={}));function Nt(i){return h.OverrideBehaviour[i]}class Ft{constructor(e,t){this.initialSettings=Ge(e),t&&(this.map=e)}getOverrides(){return Promise.resolve(this.getOverridesSync())}getOverridesSync(){return this.map?Ge(this.map):this.initialSettings}}function Ge(i){const e={};for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=P.fromValue(i[t]));return e}const Lt="cc-",Q=";str";class kt{get currentValue(){if(!(typeof location>"u"))return location.search}}let X;class Dt{constructor(e,t,n){this.watchChanges=e,this.paramPrefix=t??Lt,n??(n=X??(X=new kt)),this.queryStringProvider=n;const s=n.currentValue;this.settings=Qe(s,this.paramPrefix),this.queryString=Ye(s)}getOverrides(){return Promise.resolve(this.getOverridesSync())}getOverridesSync(){if(this.watchChanges){const e=this.queryStringProvider.currentValue,t=Ye(e);this.queryString!==t&&(this.settings=Qe(e,this.paramPrefix),this.queryString=t)}return this.settings}}function Ye(i){if(i==null)return"";if(typeof i=="string")return i;let e="",t="?";for(const n in i){if(!Object.prototype.hasOwnProperty.call(i,n))continue;const s=i[n];let r,o;if(!q(s))r=s,o=1;else if(s.length)r=s[0],o=s.length;else continue;for(let a=0;e+=t+encodeURIComponent(n)+"="+encodeURIComponent(r),!(++a>=o);)t="&",r=s[a]}return e}function Qe(i,e){const t={};return typeof i=="string"?Pt(i,e,t):i!=null&&$t(i,e,t),t}function $t(i,e,t){for(const n in i){if(!Object.prototype.hasOwnProperty.call(i,n))continue;const s=i[n];let r,o;if(!q(s))r=s,o=1;else if(s.length)r=s[0],o=s.length;else continue;for(let a=0;Xe(n,r,e,t),!(++a>=o);)r=s[a]}}function Pt(i,e,t){if(!i||i.lastIndexOf("?",0)<0)return;const n=i.substring(1).split("&");for(let s of n){s=s.replace(/\+/g," ");const r=s.indexOf("="),o=decodeURIComponent(r>=0?s.substring(0,r):s),a=r>=0?decodeURIComponent(s.substring(r+1)):"";Xe(o,a,e,t)}}function Xe(i,e,t,n){if(!i||i.length<=t.length||i.lastIndexOf(t,0)<0)return;i=i.substring(t.length),i.length>Q.length&&i.indexOf(Q,i.length-Q.length)>=0?i=i.substring(0,i.length-Q.length):e=Mt(e),n[i]=P.fromValue(e)}function Mt(i){switch(i.toLowerCase()){case"false":return!1;case"true":return!0;default:const e=me(i);return isNaN(e)?i:e}}class Ut extends de{constructor(e,t){super(e,t),this.cacheTimeToLiveMs=t.cacheTimeToLiveSeconds*1e3;const n=this.syncUpWithCache();this.readyPromise=this.getReadyPromise(n,async s=>this.getCacheState(await s))}async getConfig(){this.options.logger.debug("LazyLoadConfigService.getConfig() called.");function e(n,s=""){n.debug(`LazyLoadConfigService.getConfig(): cache is empty or expired${s}.`)}let t=await this.options.cache.get(this.cacheKey);return t.isExpired(this.cacheTimeToLiveMs)?(this.isOffline?e(this.options.logger):(e(this.options.logger,", calling refreshConfigCoreAsync()"),[,t]=await this.refreshConfigCoreAsync(t)),t):(this.options.logger.debug("LazyLoadConfigService.getConfig(): cache is valid, returning from cache."),t)}refreshConfigAsync(){return this.options.logger.debug("LazyLoadConfigService.refreshConfigAsync() called."),super.refreshConfigAsync()}getCacheState(e){return e.isEmpty?0:e.isExpired(this.cacheTimeToLiveMs)?2:3}}class _t extends de{constructor(e,t){super(e,t);const n=this.syncUpWithCache();this.readyPromise=this.getReadyPromise(n,async s=>this.getCacheState(await s))}getCacheState(e){return e.isEmpty?0:2}async getConfig(){return this.options.logger.debug("ManualPollService.getConfig() called."),await this.options.cache.get(this.cacheKey)}refreshConfigAsync(){return this.options.logger.debug("ManualPollService.refreshConfigAsync() called."),super.refreshConfigAsync()}}const Ze="<invalid value>",Se="<invalid name>",Oe="<invalid operator>",et="<invalid reference>",Vt=10;class tt{constructor(e){this.eol=e,this.log="",this.indent=""}resetIndent(){return this.indent="",this}increaseIndent(){return this.indent+=" ",this}decreaseIndent(){return this.indent=this.indent.slice(0,-2),this}newLine(e){return this.log+=this.eol+this.indent+(e??""),this}append(e){return this.log+=e,this}toString(){return this.log}appendUserConditionCore(e,t,n){return this.append(`User.${e} ${Ae(t)} '${n??Ze}'`)}appendUserConditionString(e,t,n,s){return typeof n!="string"?this.appendUserConditionCore(e,t):this.appendUserConditionCore(e,t,s?"<hashed value>":n)}appendUserConditionStringList(e,t,n,s){if(!pe(n))return this.appendUserConditionCore(e,t);const r="value",o="values",a=Ae(t);if(s)return this.append(`User.${e} ${a} [<${n.length} hashed ${n.length===1?r:o}>]`);{const l=ye(n,Vt,c=>`, ... <${c} more ${c===1?r:o}>`);return this.append(`User.${e} ${a} [${l}]`)}}appendUserConditionNumber(e,t,n,s){if(typeof n!="number")return this.appendUserConditionCore(e,t);const r=Ae(t);let o;return s&&!isNaN(o=new Date(n*1e3))?this.append(`User.${e} ${r} '${n}' (${o.toISOString()} UTC)`):this.append(`User.${e} ${r} '${n}'`)}appendUserCondition(e){const t=typeof e.comparisonAttribute=="string"?e.comparisonAttribute:Se,n=e.comparator;switch(e.comparator){case 0:case 1:case 2:case 3:case 4:case 5:case 30:case 31:case 32:case 33:case 34:case 35:return this.appendUserConditionStringList(t,n,e.comparisonValue,!1);case 6:case 7:case 8:case 9:case 28:case 29:return this.appendUserConditionString(t,n,e.comparisonValue,!1);case 10:case 11:case 12:case 13:case 14:case 15:return this.appendUserConditionNumber(t,n,e.comparisonValue);case 16:case 17:case 22:case 23:case 24:case 25:case 26:case 27:return this.appendUserConditionStringList(t,n,e.comparisonValue,!0);case 18:case 19:return this.appendUserConditionNumber(t,n,e.comparisonValue,!0);case 20:case 21:return this.appendUserConditionString(t,n,e.comparisonValue,!0);default:return this.appendUserConditionCore(t,n,e.comparisonValue)}}appendPrerequisiteFlagCondition(e,t){const n=typeof e.prerequisiteFlagKey!="string"?Se:e.prerequisiteFlagKey in t?e.prerequisiteFlagKey:et,s=e.comparator,r=e.comparisonValue;return this.append(`Flag '${n}' ${qt(s)} '${Z(r)}'`)}appendSegmentCondition(e){const t=e.segment,n=e.comparator,s=t==null?et:typeof t.name!="string"||!t.name?Se:t.name;return this.append(`User ${nt(n)} '${s}'`)}appendConditionResult(e){return this.append(`${e}`)}appendConditionConsequence(e){return this.append(" => ").appendConditionResult(e),e?this:this.append(", skipping the remaining AND conditions")}appendTargetingRuleThenPart(e,t){(t?this.newLine():this.append(" ")).append("THEN");const n=e.then;return this.append(q(n)?" % options":` '${Z(n.value)}'`)}appendTargetingRuleConsequence(e,t,n){return this.increaseIndent(),this.appendTargetingRuleThenPart(e,n).append(" => ").append(t===!0?"MATCH, applying rule":t===!1?"no match":t),this.decreaseIndent()}}function Ae(i){switch(i){case 0:case 16:case 4:return"IS ONE OF";case 1:case 17:case 5:return"IS NOT ONE OF";case 2:return"CONTAINS ANY OF";case 3:return"NOT CONTAINS ANY OF";case 6:case 12:return"<";case 7:case 13:return"<=";case 8:case 14:return">";case 9:case 15:return">=";case 10:return"=";case 11:return"!=";case 18:return"BEFORE";case 19:return"AFTER";case 28:case 20:return"EQUALS";case 29:case 21:return"NOT EQUALS";case 30:case 22:return"STARTS WITH ANY OF";case 31:case 23:return"NOT STARTS WITH ANY OF";case 32:case 24:return"ENDS WITH ANY OF";case 33:case 25:return"NOT ENDS WITH ANY OF";case 34:case 26:return"ARRAY CONTAINS ANY OF";case 35:case 27:return"ARRAY NOT CONTAINS ANY OF";default:return Oe}}function we(i){return new tt("").appendUserCondition(i).toString()}function qt(i){switch(i){case 0:return"EQUALS";case 1:return"NOT EQUALS";default:return Oe}}function nt(i){switch(i){case 0:return"IS IN SEGMENT";case 1:return"IS NOT IN SEGMENT";default:return Oe}}function Z(i){return z(i)?i.toString():Ze}const it=/^[0-9]+$/,x=(i,e)=>{const t=it.test(i),n=it.test(e);return t&&n&&(i=+i,e=+e),i===e?0:t&&!n?-1:n&&!t?1:i<e?-1:1},Te=256,ee=Number.MAX_SAFE_INTEGER||9007199254740991,W=[],y=[],v={};let Bt=0;const A=(i,e)=>{const t=Bt++;v[i]=t,y[t]=e,W[t]=new RegExp(e)};A("NUMERICIDENTIFIER","0|[1-9]\\d*"),A("NUMERICIDENTIFIERLOOSE","[0-9]+"),A("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),A("MAINVERSION",`(${y[v.NUMERICIDENTIFIER]})\\.(${y[v.NUMERICIDENTIFIER]})\\.(${y[v.NUMERICIDENTIFIER]})`),A("MAINVERSIONLOOSE",`(${y[v.NUMERICIDENTIFIERLOOSE]})\\.(${y[v.NUMERICIDENTIFIERLOOSE]})\\.(${y[v.NUMERICIDENTIFIERLOOSE]})`),A("PRERELEASEIDENTIFIER",`(?:${y[v.NUMERICIDENTIFIER]}|${y[v.NONNUMERICIDENTIFIER]})`),A("PRERELEASEIDENTIFIERLOOSE",`(?:${y[v.NUMERICIDENTIFIERLOOSE]}|${y[v.NONNUMERICIDENTIFIER]})`),A("PRERELEASE",`(?:-(${y[v.PRERELEASEIDENTIFIER]}(?:\\.${y[v.PRERELEASEIDENTIFIER]})*))`),A("PRERELEASELOOSE",`(?:-?(${y[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${y[v.PRERELEASEIDENTIFIERLOOSE]})*))`),A("BUILDIDENTIFIER","[0-9A-Za-z-]+"),A("BUILD",`(?:\\+(${y[v.BUILDIDENTIFIER]}(?:\\.${y[v.BUILDIDENTIFIER]})*))`),A("FULLPLAIN",`v?${y[v.MAINVERSION]}${y[v.PRERELEASE]}?${y[v.BUILD]}?`),A("FULL",`^${y[v.FULLPLAIN]}$`),A("LOOSEPLAIN",`[v=\\s]*${y[v.MAINVERSIONLOOSE]}${y[v.PRERELEASELOOSE]}?${y[v.BUILD]}?`),A("LOOSE",`^${y[v.LOOSEPLAIN]}$`);class C{constructor(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof C){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>Te)throw new TypeError(`version is longer than ${Te} characters`);this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?W[v.LOOSE]:W[v.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>ee||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ee||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ee||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const r=+s;if(r>=0&&r<ee)return r}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(!(e instanceof C)){if(typeof e=="string"&&e===this.version)return 0;e=new C(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof C||(e=new C(e,this.options)),x(this.major,e.major)||x(this.minor,e.minor)||x(this.patch,e.patch)}comparePre(e){if(e instanceof C||(e=new C(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],s=e.prerelease[t];if(n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return x(n,s)}while(++t)}compareBuild(e){e instanceof C||(e=new C(e,this.options));let t=0;do{const n=this.build[t],s=e.build[t];if(n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return x(n,s)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);n===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}const be=(i,e)=>{if((!e||typeof e!="object")&&(e={loose:!!e,includePrerelease:!1}),i instanceof C)return i;if(typeof i!="string"||i.length>Te||!(e.loose?W[v.LOOSE]:W[v.FULL]).test(i))return null;try{return new C(i,e)}catch{return null}};class xt{constructor(e,t,n,s={}){this.identifier=e,this.email=t,this.country=n,this.custom=s}}function st(i,e){var t,n;switch(e){case"Identifier":return(t=i.identifier)!==null&&t!==void 0?t:"";case"Email":return i.email;case"Country":return i.country;default:return(n=i.custom)===null||n===void 0?void 0:n[e]}}function Wt(i){var e;const t={},n="Identifier",s="Email",r="Country";if(t[n]=(e=i.identifier)!==null&&e!==void 0?e:"",i.email!=null&&(t[s]=i.email),i.country!=null&&(t[r]=i.country),i.custom!=null){const o=[n,s,r];for(const[a,l]of Object.entries(i.custom))l!=null&&o.indexOf(a)<0&&(t[a]=l)}return t}class K{get visitedFlags(){var e;return(e=this.$visitedFlags)!==null&&e!==void 0?e:this.$visitedFlags=[]}constructor(e,t,n,s){this.key=e,this.setting=t,this.user=n,this.settings=s}static forPrerequisiteFlag(e,t,n){const s=new K(e,t,n.user,n.settings);return s.$visitedFlags=n.visitedFlags,s.logBuilder=n.logBuilder,s}}const rt="The current targeting rule is ignored and the evaluation continues with the next rule.",Ce="cannot evaluate, User Object is missing",Kt=i=>`cannot evaluate, the User.${i} attribute is missing`,Ht=(i,e)=>`cannot evaluate, the User.${i} attribute is invalid (${e})`;class zt{constructor(e){this.logger=e}evaluate(e,t){this.logger.debug("RolloutEvaluator.evaluate() called.");let n=t.logBuilder;this.logger.isEnabled(3)&&(t.logBuilder=n=new tt(this.logger.eol),n.append(`Evaluating '${t.key}'`),t.user&&n.append(` for User '${JSON.stringify(Wt(t.user))}'`),n.increaseIndent());let s;try{let r,o;if(e!=null){const a=t.setting.type;if(a>=0&&!Gt(e,a)){const l=wt(a);throw new TypeError(`The type of a setting must match the type of the specified default value. Setting's type was ${l} but the default value's type was ${typeof e}. Please use a default value which corresponds to the setting type ${l}. Learn more: https://configcat.com/docs/sdk-reference/js/#setting-type-mapping`)}r=this.evaluateSetting(t),s=r.selectedValue.value,o=typeof s==typeof e}else r=this.evaluateSetting(t),s=r.selectedValue.value,o=z(s);return o||Ne(s),r}catch(r){throw n==null||n.resetIndent().increaseIndent(),s=e,r}finally{n&&(n.newLine(`Returning '${s}'.`).decreaseIndent(),this.logger.settingEvaluated(n.toString()))}}evaluateSetting(e){let t;const n=e.setting.targetingRules;if(n.length>0&&(t=this.evaluateTargetingRules(n,e)))return t;const s=e.setting.percentageOptions;return s.length>0&&(t=this.evaluatePercentageOptions(s,void 0,e))?t:{selectedValue:e.setting}}evaluateTargetingRules(e,t){const n=t.logBuilder;n==null||n.newLine("Evaluating targeting rules and applying the first match if any:");for(let s=0;s<e.length;s++){const r=e[s],o=r.conditions,a=this.evaluateConditions(o,r,t.key,t);if(a!==!0){H(a)&&(n==null||n.increaseIndent().newLine(rt).decreaseIndent());continue}if(!q(r.then))return{selectedValue:r.then,matchedTargetingRule:r};const l=r.then;n==null||n.increaseIndent();const c=this.evaluatePercentageOptions(l,r,t);if(c)return n==null||n.decreaseIndent(),c;n==null||n.newLine(rt).decreaseIndent()}}evaluatePercentageOptions(e,t,n){const s=n.logBuilder;if(!n.user){s==null||s.newLine("Skipping % options because the User Object is missing."),n.isMissingUserObjectLogged||(this.logger.userObjectIsMissing(n.key),n.isMissingUserObjectLogged=!0);return}const r=n.setting.percentageOptionsAttribute,o=st(n.user,r);if(o==null){s==null||s.newLine(`Skipping % options because the User.${r} attribute is missing.`),n.isMissingUserObjectAttributeLogged||(this.logger.userObjectAttributeIsMissingPercentage(n.key,r),n.isMissingUserObjectAttributeLogged=!0);return}s==null||s.newLine(`Evaluating % options based on the User.${r} attribute:`);const a=Ve(n.key+at(o)),l=parseInt(a.substring(0,7),16)%100;s==null||s.newLine(`- Computing hash in the [0..99] range from User.${r} => ${l} (this value is sticky and consistent across all SDKs)`);let c=0;for(let u=0;u<e.length;u++){const g=e[u];if(c+=g.percentage,!(l>=c))return s==null||s.newLine(`- Hash value ${l} selects % option ${u+1} (${g.percentage}%), '${Z(g.value)}'.`),{selectedValue:g,matchedTargetingRule:t,matchedPercentageOption:g}}throw new Error("Sum of percentage option percentages is less than 100.")}evaluateConditions(e,t,n,s){let r=!0;const o=s.logBuilder;let a=!1;o==null||o.newLine("- ");for(let l=0;l<e.length;l++){const c=e[l];switch(o&&(l?o.increaseIndent().newLine("AND "):o.append("IF ").increaseIndent()),c.type){case"UserCondition":r=this.evaluateUserCondition(c,n,s),a=e.length>1;break;case"PrerequisiteFlagCondition":r=this.evaluatePrerequisiteFlagCondition(c,s),a=!0;break;case"SegmentCondition":r=this.evaluateSegmentCondition(c,s),a=!H(r)||r!==Ce||e.length>1;break;default:throw new Error}const u=r===!0;if(o&&((!t||e.length>1)&&o.appendConditionConsequence(u),o.decreaseIndent()),!u)break}return t&&(o==null||o.appendTargetingRuleConsequence(t,r,a)),r}evaluateUserCondition(e,t,n){const s=n.logBuilder;if(s==null||s.appendUserCondition(e),!n.user)return n.isMissingUserObjectLogged||(this.logger.userObjectIsMissing(n.key),n.isMissingUserObjectLogged=!0),Ce;const r=e.comparisonAttribute,o=st(n.user,r);if(o==null||o==="")return this.logger.userObjectAttributeIsMissingCondition(we(e),n.key,r),Kt(r);let a,l,c,u;switch(e.comparator){case 28:case 29:return a=F(r,o,e,n.key,this.logger),this.evaluateTextEquals(a,e.comparisonValue,e.comparator===29);case 20:case 21:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextEquals(a,e.comparisonValue,n.setting.configJsonSalt,t,e.comparator===21);case 0:case 1:return a=F(r,o,e,n.key,this.logger),this.evaluateTextIsOneOf(a,e.comparisonValue,e.comparator===1);case 16:case 17:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextIsOneOf(a,e.comparisonValue,n.setting.configJsonSalt,t,e.comparator===17);case 30:case 31:return a=F(r,o,e,n.key,this.logger),this.evaluateTextSliceEqualsAnyOf(a,e.comparisonValue,!0,e.comparator===31);case 22:case 23:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextSliceEqualsAnyOf(a,e.comparisonValue,n.setting.configJsonSalt,t,!0,e.comparator===23);case 32:case 33:return a=F(r,o,e,n.key,this.logger),this.evaluateTextSliceEqualsAnyOf(a,e.comparisonValue,!1,e.comparator===33);case 24:case 25:return a=F(r,o,e,n.key,this.logger),this.evaluateSensitiveTextSliceEqualsAnyOf(a,e.comparisonValue,n.setting.configJsonSalt,t,!1,e.comparator===25);case 2:case 3:return a=F(r,o,e,n.key,this.logger),this.evaluateTextContainsAnyOf(a,e.comparisonValue,e.comparator===3);case 4:case 5:return l=lt(r,o,e,n.key,this.logger),typeof l!="string"?this.evaluateSemVerIsOneOf(l,e.comparisonValue,e.comparator===5):l;case 6:case 7:case 8:case 9:return l=lt(r,o,e,n.key,this.logger),typeof l!="string"?this.evaluateSemVerRelation(l,e.comparator,e.comparisonValue):l;case 10:case 11:case 12:case 13:case 14:case 15:return c=jt(r,o,e,n.key,this.logger),typeof c!="string"?this.evaluateNumberRelation(c,e.comparator,e.comparisonValue):c;case 18:case 19:return c=Jt(r,o,e,n.key,this.logger),typeof c!="string"?this.evaluateDateTimeRelation(c,e.comparisonValue,e.comparator===18):c;case 34:case 35:return u=ct(r,o,e,n.key,this.logger),typeof u!="string"?this.evaluateArrayContainsAnyOf(u,e.comparisonValue,e.comparator===35):u;case 26:case 27:return u=ct(r,o,e,n.key,this.logger),typeof u!="string"?this.evaluateSensitiveArrayContainsAnyOf(u,e.comparisonValue,n.setting.configJsonSalt,t,e.comparator===27):u;default:throw new Error}}evaluateTextEquals(e,t,n){return e===t!==n}evaluateSensitiveTextEquals(e,t,n,s,r){return Ie(e,n,s)===t!==r}evaluateTextIsOneOf(e,t,n){return t.indexOf(e)>=0!==n}evaluateSensitiveTextIsOneOf(e,t,n,s,r){const o=Ie(e,n,s);return t.indexOf(o)>=0!==r}evaluateTextSliceEqualsAnyOf(e,t,n,s){for(let r=0;r<t.length;r++){const o=t[r];if(e.length<o.length)continue;if((n?e.lastIndexOf(o,0):e.indexOf(o,e.length-o.length))>=0)return!s}return s}evaluateSensitiveTextSliceEqualsAnyOf(e,t,n,s,r,o){const a=B(e);for(let l=0;l<t.length;l++){const c=t[l],u=c.indexOf("_"),g=parseInt(c.slice(0,u));if(a.length<g)continue;const f=r?a.slice(0,g):a.slice(a.length-g);if(ot(f,n,s)===c.slice(u+1))return!o}return o}evaluateTextContainsAnyOf(e,t,n){for(let s=0;s<t.length;s++)if(e.indexOf(t[s])>=0)return!n;return n}evaluateSemVerIsOneOf(e,t,n){let s=!1;for(let r=0;r<t.length;r++){const o=t[r];if(!o.length)continue;const a=be(o.trim());if(!a)return!1;!s&&e.compare(a)===0&&(s=!0)}return s!==n}evaluateSemVerRelation(e,t,n){const s=be(n.trim());if(!s)return!1;const r=e.compare(s);switch(t){case 6:return r<0;case 7:return r<=0;case 8:return r>0;case 9:return r>=0}}evaluateNumberRelation(e,t,n){switch(t){case 10:return e===n;case 11:return e!==n;case 12:return e<n;case 13:return e<=n;case 14:return e>n;case 15:return e>=n}}evaluateDateTimeRelation(e,t,n){return n?e<t:e>t}evaluateArrayContainsAnyOf(e,t,n){for(let s=0;s<e.length;s++)if(t.indexOf(e[s])>=0)return!n;return n}evaluateSensitiveArrayContainsAnyOf(e,t,n,s,r){for(let o=0;o<e.length;o++){const a=Ie(e[o],n,s);if(t.indexOf(a)>=0)return!r}return r}evaluatePrerequisiteFlagCondition(e,t){const n=t.logBuilder;n==null||n.appendPrerequisiteFlagCondition(e,t.settings);const s=e.prerequisiteFlagKey,r=t.settings[s];if(t.visitedFlags.push(t.key),t.visitedFlags.indexOf(s)>=0){t.visitedFlags.push(s);const u=ye(t.visitedFlags,void 0,void 0," -> ");throw new Error(`Circular dependency detected between the following depending flags: ${u}.`)}const o=K.forPrerequisiteFlag(s,r,t);n==null||n.newLine("(").increaseIndent().newLine(`Evaluating prerequisite flag '${s}':`);const a=this.evaluateSetting(o);t.visitedFlags.pop();const l=a.selectedValue.value;if(typeof l!=typeof e.comparisonValue){if(z(l))throw new Error(`Type mismatch between comparison value '${e.comparisonValue}' and prerequisite flag '${s}'.`);Ne(l)}let c;switch(e.comparator){case 0:c=l===e.comparisonValue;break;case 1:c=l!==e.comparisonValue;break;default:throw new Error}return n==null||n.newLine(`Prerequisite flag evaluation result: '${Z(l)}'.`).newLine("Condition (").appendPrerequisiteFlagCondition(e,t.settings).append(") evaluates to ").appendConditionResult(c).append(".").decreaseIndent().newLine(")"),c}evaluateSegmentCondition(e,t){const n=t.logBuilder;if(n==null||n.appendSegmentCondition(e),!t.user)return t.isMissingUserObjectLogged||(this.logger.userObjectIsMissing(t.key),t.isMissingUserObjectLogged=!0),Ce;const s=e.segment;n==null||n.newLine("(").increaseIndent().newLine(`Evaluating segment '${s.name}':`);const r=this.evaluateConditions(s.conditions,void 0,s.name,t);let o=r;if(!H(o))switch(e.comparator){case 0:break;case 1:o=!o;break;default:throw new Error}return n&&(n.newLine("Segment evaluation result: "),(H(o)?n.append(o):n.append(`User ${nt(r?0:1)}`)).append("."),n.newLine("Condition (").appendSegmentCondition(e).append(")"),(H(o)?n.append(" failed to evaluate"):n.append(" evaluates to ").appendConditionResult(o)).append("."),n.decreaseIndent().newLine(")")),o}}function H(i){return typeof i=="string"}function Ie(i,e,t){return ot(B(i),e,t)}function ot(i,e,t){return qe(i+B(e)+B(t))}function at(i){return typeof i=="string"?i:i instanceof Date?i.getTime()/1e3+"":pe(i)?JSON.stringify(i):i+""}function F(i,e,t,n,s){return typeof e=="string"||(e=at(e),s.userObjectAttributeIsAutoConverted(we(t),n,i,e)),e}function lt(i,e,t,n,s){let r;return typeof e=="string"&&(r=be(e.trim()))?r:te(s,t,n,i,`'${e}' is not a valid semantic version`)}function jt(i,e,t,n,s){if(typeof e=="number")return e;let r;return typeof e=="string"&&(!isNaN(r=me(e.replace(",",".")))||e.trim()==="NaN")?r:te(s,t,n,i,`'${e}' is not a valid decimal number`)}function Jt(i,e,t,n,s){if(e instanceof Date)return e.getTime()/1e3;if(typeof e=="number")return e;let r;return typeof e=="string"&&(!isNaN(r=me(e.replace(",",".")))||e.trim()==="NaN")?r:te(s,t,n,i,`'${e}' is not a valid Unix timestamp (number of seconds elapsed since Unix epoch)`)}function ct(i,e,t,n,s){let r=e;if(typeof r=="string")try{r=JSON.parse(r)}catch{}return pe(r)?r:te(s,t,n,i,`'${e}' is not a valid string array`)}function te(i,e,t,n,s){return i.userObjectAttributeIsInvalid(we(e),t,s,n),Ht(n,s)}function ut(i,e,t,n){return{key:i,value:e.selectedValue.value,variationId:e.selectedValue.variationId,fetchTime:t,user:n,isDefaultValue:!1,matchedTargetingRule:e.matchedTargetingRule,matchedPercentageOption:e.matchedPercentageOption}}function _(i,e,t,n,s,r){return{key:i,value:e,fetchTime:t,user:n,isDefaultValue:!0,errorMessage:s,errorException:r}}function ne(i,e,t,n,s,r,o){let a;if(!e)return a=o.configJsonIsNotPresentSingle(t,"defaultValue",n).toString(),_(t,n,L(r),s,a);const l=e[t];if(!l)return a=o.settingEvaluationFailedDueToMissingKey(t,"defaultValue",n,ye(Object.keys(e))).toString(),_(t,n,L(r),s,a);const c=i.evaluate(n,new K(t,l,s,e));return ut(t,c,L(r),s)}function ht(i,e,t,n,s,r){let o;if(!Re(e,s,r))return[[],o];const a=[];for(const[l,c]of Object.entries(e)){let u;try{const g=i.evaluate(null,new K(l,c,t,e));u=ut(l,g,L(n),t)}catch(g){o??(o=[]),o.push(g),u=_(l,null,L(n),t,M(g),g)}a.push(u)}return[a,o]}function Re(i,e,t){return i?!0:(e.configJsonIsNotPresent(t),!1)}function z(i){return typeof i=="boolean"||typeof i=="string"||typeof i=="number"}function Gt(i,e){switch(e){case 0:return typeof i=="boolean";case 1:return typeof i=="string";case 2:case 3:return typeof i=="number";default:return!1}}function Ne(i){throw new TypeError(i===null?"Setting value is null.":i===void 0?"Setting value is undefined.":`Setting value '${i}' is of an unsupported type (${typeof i}).`)}function L(i){return i?new Date(i.timestamp):void 0}class Yt{constructor(){this.instances={}}getOrCreate(e,t){let n;const s=this.instances[e.sdkKey];if(s){const[a]=s;if(n=a.deref(),n)return[n,!0]}const r={};n=new k(e,t,r);const o=He()?WeakRef:Ke();return this.instances[e.sdkKey]=[new o(n),r],[n,!1]}remove(e,t){const n=this.instances[e];if(n){const[s,r]=n,o=!!s.deref();if(!o||r===t)return delete this.instances[e],o}return!1}clear(){const e=[];for(const[t,[n]]of Object.entries(this.instances)){const s=n.deref();s&&e.push(s),delete this.instances[t]}return e}}const j=new Yt;class k{static get instanceCache(){return j}static get(e,t,n,s){var r;const o="Invalid 'sdkKey' value";if(!e)throw new Error(o);const a=t===0?ze:t===2?je:t===1?Je:Me(new Error("Invalid 'pollingMode' value")),l=new a(e,s.sdkType,s.sdkVersion,n,s.defaultCacheFactory,s.eventEmitterFactory);if(((r=l.flagOverrides)===null||r===void 0?void 0:r.behaviour)!==0&&!Qt(e,l.baseUrlOverriden))throw new Error(o);const[c,u]=j.getOrCreate(l,s);return u&&n&&l.logger.clientIsAlreadyCreated(e),c}constructor(e,t,n){var s;if(this.cacheToken=n,this.addListener=this.on,this.off=this.removeListener,!e)throw new Error("Invalid 'options' value");if(this.options=e,this.options.logger.debug("Initializing ConfigCatClient. Options: "+JSON.stringify(this.options)),!t)throw new Error("Invalid 'configCatKernel' value");if(!t.configFetcher)throw new Error("Invalid 'configCatKernel.configFetcher' value");this.hooks=e.yieldHooks(),e.defaultUser&&this.setDefaultUser(e.defaultUser),this.evaluator=new zt(e.logger),((s=e.flagOverrides)===null||s===void 0?void 0:s.behaviour)!==0?this.configService=e instanceof ze?new Ct(t.configFetcher,e):e instanceof je?new _t(t.configFetcher,e):e instanceof Je?new Ut(t.configFetcher,e):Me(new Error("Invalid 'options' value")):this.hooks.emit("clientReady",1),this.suppressFinalize=ae(this,{sdkKey:e.sdkKey,cacheToken:n,configService:this.configService,logger:e.logger})}static finalize(e){var t;(t=e.logger)===null||t===void 0||t.debug("finalize() called"),e.cacheToken&&j.remove(e.sdkKey,e.cacheToken),k.close(e.configService,e.logger)}static close(e,t,n){t==null||t.debug("close() called"),n==null||n.tryDisconnect(),e==null||e.dispose()}dispose(){const e=this.options;e.logger.debug("dispose() called"),this.cacheToken&&j.remove(e.sdkKey,this.cacheToken),k.close(this.configService,e.logger,this.hooks),this.suppressFinalize()}static disposeAll(){const e=j.clear();let t;for(const n of e)try{k.close(n.configService,n.options.logger,n.hooks),n.suppressFinalize()}catch(s){t??(t=[]),t.push(s)}if(t)throw typeof AggregateError<"u"?new AggregateError(t):t.pop()}async getValueAsync(e,t,n){this.options.logger.debug("getValueAsync() called."),se(e),re(t);let s,r,o=null;n??(n=this.defaultUser);try{let a;[a,o]=await this.getSettingsAsync(),r=ne(this.evaluator,a,e,t,n,o,this.options.logger),s=r.value}catch(a){this.options.logger.settingEvaluationErrorSingle("getValueAsync",e,"defaultValue",t,a),r=_(e,t,L(o),n,M(a),a),s=t}return this.hooks.emit("flagEvaluated",r),s}async getValueDetailsAsync(e,t,n){this.options.logger.debug("getValueDetailsAsync() called."),se(e),re(t);let s,r=null;n??(n=this.defaultUser);try{let o;[o,r]=await this.getSettingsAsync(),s=ne(this.evaluator,o,e,t,n,r,this.options.logger)}catch(o){this.options.logger.settingEvaluationErrorSingle("getValueDetailsAsync",e,"defaultValue",t,o),s=_(e,t,L(r),n,M(o),o)}return this.hooks.emit("flagEvaluated",s),s}async getAllKeysAsync(){this.options.logger.debug("getAllKeysAsync() called.");const e="empty array";try{const[t]=await this.getSettingsAsync();return Re(t,this.options.logger,e)?Object.keys(t):[]}catch(t){return this.options.logger.settingEvaluationError("getAllKeysAsync",e,t),[]}}async getAllValuesAsync(e){this.options.logger.debug("getAllValuesAsync() called.");const t="empty array";let n,s,r;e??(e=this.defaultUser);try{const[o,a]=await this.getSettingsAsync();[s,r]=ht(this.evaluator,o,e,a,this.options.logger,t),n=s.map(l=>({settingKey:l.key,settingValue:l.value}))}catch(o){return this.options.logger.settingEvaluationError("getAllValuesAsync",t,o),[]}r!=null&&r.length&&this.options.logger.settingEvaluationError("getAllValuesAsync","evaluation result",typeof AggregateError<"u"?new AggregateError(r):r.pop());for(const o of s)this.hooks.emit("flagEvaluated",o);return n}async getAllValueDetailsAsync(e){this.options.logger.debug("getAllValueDetailsAsync() called.");const t="empty array";let n,s;e??(e=this.defaultUser);try{const[r,o]=await this.getSettingsAsync();[n,s]=ht(this.evaluator,r,e,o,this.options.logger,t)}catch(r){return this.options.logger.settingEvaluationError("getAllValueDetailsAsync",t,r),[]}s!=null&&s.length&&this.options.logger.settingEvaluationError("getAllValueDetailsAsync","evaluation result",typeof AggregateError<"u"?new AggregateError(s):s.pop());for(const r of n)this.hooks.emit("flagEvaluated",r);return n}async getKeyAndValueAsync(e){this.options.logger.debug("getKeyAndValueAsync() called.");const t="null";try{const[n]=await this.getSettingsAsync();if(!Re(n,this.options.logger,t))return null;for(const[s,r]of Object.entries(n)){if(e===r.variationId)return{settingKey:s,settingValue:oe(r.value)};const{targetingRules:o}=r;if(o.length>0)for(let l=0;l<o.length;l++){const c=o[l].then;if(q(c))for(let u=0;u<c.length;u++){const g=c[u];if(e===g.variationId)return{settingKey:s,settingValue:oe(g.value)}}else if(e===c.variationId)return{settingKey:s,settingValue:oe(c.value)}}const{percentageOptions:a}=r;if(a.length>0)for(let l=0;l<a.length;l++){const c=a[l];if(e===c.variationId)return{settingKey:s,settingValue:oe(c.value)}}}this.options.logger.settingForVariationIdIsNotPresent(e)}catch(n){this.options.logger.settingEvaluationError("getKeyAndValueAsync",t,n)}return null}async forceRefreshAsync(){if(this.options.logger.debug("forceRefreshAsync() called."),this.configService)try{const[e]=await this.configService.refreshConfigAsync();return e}catch(e){return this.options.logger.forceRefreshError("forceRefreshAsync",e),N.failure(M(e),e)}else return N.failure("Client is configured to use the LocalOnly override behavior, which prevents making HTTP requests.")}setDefaultUser(e){this.defaultUser=e}clearDefaultUser(){this.defaultUser=void 0}get isOffline(){var e,t;return(t=(e=this.configService)===null||e===void 0?void 0:e.isOffline)!==null&&t!==void 0?t:!0}setOnline(){this.configService?this.configService.setOnline():this.options.logger.configServiceMethodHasNoEffectDueToOverrideBehavior(Nt(0),"setOnline")}setOffline(){var e;(e=this.configService)===null||e===void 0||e.setOffline()}waitForReady(){const e=this.configService;return e?e.readyPromise:Promise.resolve(1)}snapshot(){const e=()=>{const r=this.options.cache.getInMemory();return[r.isEmpty?null:r.config.settings,r]};let t,n;const{flagOverrides:s}=this.options;if(s){const r=s.dataSource.getOverridesSync();switch(s.behaviour){case 0:return new ie(r,null,this);case 1:return[t,n]=e(),new ie(Object.assign(Object.assign({},t??{}),r),n,this);case 2:return[t,n]=e(),new ie(Object.assign(Object.assign({},r),t??{}),n,this)}}return[t,n]=e(),new ie(t,n,this)}async getSettingsAsync(){this.options.logger.debug("getSettingsAsync() called.");const e=async()=>{const n=await this.configService.getConfig();return[n.isEmpty?null:n.config.settings,n]},{flagOverrides:t}=this.options;if(t){let n,s;const r=await t.dataSource.getOverrides();switch(t.behaviour){case 0:return[r,null];case 1:return[n,s]=await e(),[Object.assign(Object.assign({},n??{}),r),s];case 2:return[n,s]=await e(),[Object.assign(Object.assign({},r),n??{}),s]}}return await e()}on(e,t){return this.hooks.on(e,t),this}once(e,t){return this.hooks.once(e,t),this}removeListener(e,t){return this.hooks.removeListener(e,t),this}removeAllListeners(e){return this.hooks.removeAllListeners(e),this}listeners(e){return this.hooks.listeners(e)}listenerCount(e){return this.hooks.listenerCount(e)}eventNames(){return this.hooks.eventNames()}}class ie{constructor(e,t,n){this.mergedSettings=e,this.remoteConfig=t,this.defaultUser=n.defaultUser,this.evaluator=n.evaluator,this.options=n.options,this.cacheState=t?n.configService.getCacheState(t):1}get fetchedConfig(){const e=this.remoteConfig;return e&&!e.isEmpty?e.config:null}getAllKeys(){return this.mergedSettings?Object.keys(this.mergedSettings):[]}getValue(e,t,n){this.options.logger.debug("Snapshot.getValue() called."),se(e),re(t);let s,r;n??(n=this.defaultUser);try{r=ne(this.evaluator,this.mergedSettings,e,t,n,this.remoteConfig,this.options.logger),s=r.value}catch(o){this.options.logger.settingEvaluationErrorSingle("Snapshot.getValue",e,"defaultValue",t,o),r=_(e,t,L(this.remoteConfig),n,M(o),o),s=t}return this.options.hooks.emit("flagEvaluated",r),s}getValueDetails(e,t,n){this.options.logger.debug("Snapshot.getValueDetails() called."),se(e),re(t);let s;n??(n=this.defaultUser);try{s=ne(this.evaluator,this.mergedSettings,e,t,n,this.remoteConfig,this.options.logger)}catch(r){this.options.logger.settingEvaluationErrorSingle("Snapshot.getValueDetails",e,"defaultValue",t,r),s=_(e,t,L(this.remoteConfig),n,M(r),r)}return this.options.hooks.emit("flagEvaluated",s),s}}function Qt(i,e){const t="configcat-proxy/";if(e&&i.length>t.length&&i.lastIndexOf(t,0)===0)return!0;const n=i.split("/"),s=22;switch(n.length){case 2:return n[0].length===s&&n[1].length===s;case 3:return n[0]==="configcat-sdk-1"&&n[1].length===s&&n[2].length===s;default:return!1}}function se(i){if(!i)throw new Error("Invalid 'key' value")}function re(i){if(i!=null&&!z(i))throw new TypeError("The default value must be boolean, number, string, null or undefined.")}function oe(i){return z(i)?i:Ne(i)}let ae=function(i,e){if(typeof FinalizationRegistry<"u"){const t=new FinalizationRegistry(n=>k.finalize(n));ae=(n,s)=>{const r={};return t.register(n,s,r),()=>t.unregister(r)}}else ae=()=>()=>{};return ae(i,e)};function gt(i,e,t,n){return k.get(i,e,t,n)}function Xt(){k.disposeAll()}function Zt(i,e){return new _e(i,e)}function en(i,e,t){return{dataSource:new Ft(i,t),behaviour:e}}function tn(i,e,t,n){return{dataSource:new Dt(e,t,n),behaviour:i}}function J(i){return!!i.fn}class ft{constructor(){this.events={},this.eventCount=0,this.addListener=this.on,this.off=this.removeListener}addListenerCore(e,t,n){if(typeof t!="function")throw new TypeError("Listener must be a function");const s=this.events[e],r={fn:t,once:n};return s?J(s)?this.events[e]=[s,r]:s.push(r):(this.events[e]=r,this.eventCount++),this}removeListenerCore(e,t,n){const s=this.events[e];if(!s)return this;if(J(s))n(s,t)&&this.removeEvent(e);else for(let r=s.length-1;r>=0;r--)if(n(s[r],t)){s.splice(r,1),s.length?s.length===1&&(this.events[e]=s[0]):this.removeEvent(e);break}return this}removeEvent(e){--this.eventCount===0?this.events={}:delete this.events[e]}on(e,t){return this.addListenerCore(e,t,!1)}once(e,t){return this.addListenerCore(e,t,!0)}removeListener(e,t){if(typeof t!="function")throw new TypeError("Listener must be a function");return this.removeListenerCore(e,t,(n,s)=>n.fn===s)}removeAllListeners(e){return e?this.events[e]&&this.removeEvent(e):(this.events={},this.eventCount=0),this}listeners(e){const t=this.events[e];if(!t)return[];if(J(t))return[t.fn];const n=t.length,s=new Array(n);for(let r=0;r<n;r++)s[r]=t[r].fn;return s}listenerCount(e){const t=this.events[e];return t?J(t)?1:t.length:0}eventNames(){const e=[];if(this.eventCount===0)return e;const t=this.events;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e}emit(e,t,n,s,r,...o){let a=this.events[e];if(!a)return!1;let l,c;J(a)?[l,c]=[a,1]:(a=a.slice(),[l,c]=[a[0],a.length]);const u=arguments.length-1;for(let g=0;;){switch(l.once&&this.removeListenerCore(e,l,(f,d)=>f===d),u){case 0:l.fn.call(this);break;case 1:l.fn.call(this,t);break;case 2:l.fn.call(this,t,n);break;case 3:l.fn.call(this,t,n,s);break;case 4:l.fn.call(this,t,n,s,r);break;default:const f=new Array(u);for(let d=0;d<u;d++)f[d]=arguments[d+1];l.fn.apply(this,f);break}if(++g>=c)break;l=a[g]}return!0}}class le{static tryGetFactory(){const e=nn();if(e)return t=>new Y(new le(e),t.logger)}constructor(e){this.storage=e}set(e,t){this.storage.setItem(e,sn(t))}get(e){const t=this.storage.getItem(e);if(t)return rn(t)}}function nn(){if(typeof localStorage<"u"){const i="__configcat_localStorage_test";try{const e=localStorage;e.setItem(i,i);let t;try{t=e.getItem(i)}finally{e.removeItem(i)}if(t===i)return e}catch{}}}function sn(i){return i=encodeURIComponent(i),i=i.replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))),btoa(i)}function rn(i){return i=atob(i),i=i.replace(/[%\x80-\xFF]/g,e=>"%"+e.charCodeAt(0).toString(16)),decodeURIComponent(i)}const G="configCache";class Fe{static tryGetFactory(){const e=on();if(e)return t=>new Y(new Fe(e),t.logger)}constructor(e){this.dbConnectionFactory=e}async set(e,t){const n=await this.dbConnectionFactory();try{await new Promise((s,r)=>{const o=n.transaction(G,"readwrite");o.oncomplete=()=>s(),o.onerror=l=>r(l.target.error),o.objectStore(G).put(t,e)})}finally{n.close()}}async get(e){const t=await this.dbConnectionFactory();try{return await new Promise((n,s)=>{const r=t.transaction(G,"readonly");let o;r.oncomplete=()=>n(o),r.onerror=c=>s(c.target.error);const l=r.objectStore(G).get(e);l.onsuccess=c=>o=c.target.result})}finally{t.close()}}}function on(){if(typeof indexedDB<"u")try{const i=()=>new Promise((e,t)=>{const n=indexedDB.open("@configcat/sdk");n.onupgradeneeded=s=>s.target.result.createObjectStore(G),n.onsuccess=s=>e(s.target.result),n.onerror=s=>t(s.target.error)});return i().then(e=>e.close()).catch(()=>{}),i}catch{}}class dt{handleStateChange(e,t,n){var s;try{if(e.readyState===4){const{status:r,statusText:o}=e;if(r===200){const a=(s=e.getResponseHeader("ETag"))!==null&&s!==void 0?s:void 0;t({statusCode:r,reasonPhrase:o,eTag:a,body:e.responseText})}else r&&t({statusCode:r,reasonPhrase:o})}}catch(r){n(r)}}fetchLogic(e,t){return new Promise((n,s)=>{try{e.logger.debug("HttpConfigFetcher.fetchLogic() called.");const r=new XMLHttpRequest;r.onreadystatechange=()=>this.handleStateChange(r,n,s),r.ontimeout=()=>s(new R("timeout",e.requestTimeoutMs)),r.onabort=()=>s(new R("abort")),r.onerror=()=>s(new R("failure"));let o=e.getUrl();t&&(o+="&ccetag="+encodeURIComponent(t)),r.open("GET",o,!0),r.timeout=e.requestTimeoutMs,r.send(null)}catch(r){s(r)}})}}class an{async fetchLogic(e,t){var n,s;const r={method:"GET"};let o;if(typeof AbortController<"u"){const a=new AbortController,l=setTimeout(()=>a.abort(),e.requestTimeoutMs);r.signal=a.signal,o=()=>clearTimeout(l)}else o=()=>{};try{let a=e.getUrl();t&&(a+="&ccetag="+encodeURIComponent(t));const l=await fetch(a,r),{status:c,statusText:u}=l;if(c===200){const g=await l.text(),f=(n=l.headers.get("ETag"))!==null&&n!==void 0?n:void 0;return{statusCode:c,reasonPhrase:u,eTag:f,body:g}}else return{statusCode:c,reasonPhrase:u}}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?!((s=r.signal)===null||s===void 0)&&s.aborted?new R("timeout",e.requestTimeoutMs):new R("abort"):new R("failure",a)}finally{o()}}}const ln=P.fromValue.bind(P),cn=Object.freeze(Object.defineProperty({__proto__:null,DefaultEventEmitter:ft,ExternalConfigCache:Y,FetchApiConfigFetcher:an,FetchError:R,FetchResult:b,get FetchStatus(){return ge},InMemoryConfigCache:Ue,IndexedDBConfigCache:Fe,LocalStorageConfigCache:le,XmlHttpRequestConfigFetcher:dt,createConsoleLogger:Zt,createFlagOverridesFromMap:en,createFlagOverridesFromQueryParams:tn,disposeAllClients:Xt,getClient:gt,settingFromValue:ln},Symbol.toStringTag,{value:"Module"})),un="2.5.0",hn={install:(i,e)=>{const{sdkKey:t,pollingMode:n,clientOptions:s}=e,r={sdkType:"ConfigCat-Vue",sdkVersion:un,configFetcher:new dt,eventEmitterFactory:()=>new ft,defaultCacheFactory:le.tryGetFactory()},o=gt(t,n??h.PollingMode.AutoPoll,s,r);i.provide("configCatClient",o);const a=i.unmount;i.unmount=function(){a.apply(arguments),o.dispose()}}},gn=T.defineComponent({__name:"FeatureWrapper",props:{featureKey:{},userObject:{}},emits:["flagValueChanged"],setup(i,{emit:e}){const t=e,n=i,s=T.ref(null),r=T.inject("configCatClient")??(()=>{throw new Error("ConfigCatPlugin was not installed.")})(),o=()=>{const l=r.snapshot().getValue(n.featureKey,!1,n.userObject);s.value!==l&&(s.value=l,t("flagValueChanged",l))};return T.onBeforeMount(()=>{const a=r.snapshot(),l=a.cacheState;l==h.ClientCacheState.HasUpToDateFlagData||l==h.ClientCacheState.HasLocalOverrideFlagDataOnly?(s.value=a.getValue(n.featureKey,!1,n.userObject),r.on("configChanged",o)):r.getValueAsync(n.featureKey,!1,n.userObject).then(c=>{const u=o;u&&(s.value=c,r.on("configChanged",u))})}),T.onUnmounted(()=>{r.off("configChanged",o)}),(a,l)=>s.value===!0?T.renderSlot(a.$slots,"default",{key:0}):s.value===!1?T.renderSlot(a.$slots,"else",{key:1}):T.renderSlot(a.$slots,"loading",{key:2})}}),{createConsoleLogger:fn,createFlagOverridesFromMap:dn,createFlagOverridesFromQueryParams:vn}=cn;h.ConfigCatPlugin=hn,h.ConfigJson=yt,h.FeatureWrapper=gn,h.FormattableLogMessage=m,h.RefreshResult=N,h.User=xt,h.createConsoleLogger=fn,h.createFlagOverridesFromMap=dn,h.createFlagOverridesFromQueryParams=vn,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -10,16 +10,16 @@
10
10
  "exports": {
11
11
  ".": {
12
12
  "import": {
13
- "default": "./dist/configcat-vue.js",
14
- "types": "./dist/index.d.ts"
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/configcat-vue.js"
15
15
  },
16
16
  "require": {
17
- "default": "./dist/configcat-vue.umd.cjs",
18
- "types": "./dist/index.d.ts"
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/configcat-vue.umd.cjs"
19
19
  }
20
20
  }
21
21
  },
22
- "version": "2.5.0",
22
+ "version": "2.5.1",
23
23
  "keywords": [
24
24
  "configcat",
25
25
  "ConfigCat",
@@ -47,20 +47,20 @@
47
47
  "test": "vitest"
48
48
  },
49
49
  "peerDependencies": {
50
- "vue": "^3.4.38"
50
+ "vue": "^3.5.13"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/node": "^22.4.1",
54
- "@vitejs/plugin-vue": "^5.1.2",
53
+ "@types/node": "^22.13.17",
54
+ "@vitejs/plugin-vue": "^5.2.3",
55
55
  "@vue/test-utils": "^2.4.6",
56
- "happy-dom": "^15.11.0",
57
- "typescript": "^5.5.4",
58
- "vite": "^5.4.1",
59
- "vite-plugin-dts": "^4.0.3",
60
- "vitest": "^2.0.5",
61
- "vue-tsc": "^2.0.29"
56
+ "happy-dom": "^17.4.4",
57
+ "typescript": "^5.8.2",
58
+ "vite": "^6.2.4",
59
+ "vite-plugin-dts": "^4.5.3",
60
+ "vitest": "^3.1.1",
61
+ "vue-tsc": "^2.2.8"
62
62
  },
63
63
  "dependencies": {
64
- "@configcat/sdk": "^0.1.0"
64
+ "@configcat/sdk": "^0.1.1"
65
65
  }
66
66
  }