@ninetailed/experience.js 3.0.0-beta.18 → 3.0.0-beta.20

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.
Files changed (2) hide show
  1. package/index.cjs +4258 -0
  2. package/package.json +3 -3
package/index.cjs ADDED
@@ -0,0 +1,4258 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var unionBy = require('lodash/unionBy');
6
+ var experience_jsShared = require('@ninetailed/experience.js-shared');
7
+ var Analytics = require('analytics');
8
+ var flatten = require('lodash/flatten');
9
+ var find = require('lodash/find');
10
+ var includes = require('lodash/includes');
11
+ var pickBy = require('lodash/pickBy');
12
+ var murmurhashJs = require('murmurhash-js');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var unionBy__default = /*#__PURE__*/_interopDefaultLegacy(unionBy);
17
+ var Analytics__default = /*#__PURE__*/_interopDefaultLegacy(Analytics);
18
+ var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
19
+ var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
20
+ var includes__default = /*#__PURE__*/_interopDefaultLegacy(includes);
21
+ var pickBy__default = /*#__PURE__*/_interopDefaultLegacy(pickBy);
22
+
23
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
24
+
25
+ var check = function (it) {
26
+ return it && it.Math == Math && it;
27
+ };
28
+
29
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
30
+ var global$n =
31
+ // eslint-disable-next-line es/no-global-this -- safe
32
+ check(typeof globalThis == 'object' && globalThis) ||
33
+ check(typeof window == 'object' && window) ||
34
+ // eslint-disable-next-line no-restricted-globals -- safe
35
+ check(typeof self == 'object' && self) ||
36
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
37
+ // eslint-disable-next-line no-new-func -- fallback
38
+ (function () { return this; })() || Function('return this')();
39
+
40
+ var objectGetOwnPropertyDescriptor = {};
41
+
42
+ var fails$l = function (exec) {
43
+ try {
44
+ return !!exec();
45
+ } catch (error) {
46
+ return true;
47
+ }
48
+ };
49
+
50
+ var fails$k = fails$l;
51
+
52
+ // Detect IE8's incomplete defineProperty implementation
53
+ var descriptors = !fails$k(function () {
54
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
55
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
56
+ });
57
+
58
+ var fails$j = fails$l;
59
+
60
+ var functionBindNative = !fails$j(function () {
61
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
62
+ var test = (function () { /* empty */ }).bind();
63
+ // eslint-disable-next-line no-prototype-builtins -- safe
64
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
65
+ });
66
+
67
+ var NATIVE_BIND$3 = functionBindNative;
68
+
69
+ var call$h = Function.prototype.call;
70
+
71
+ var functionCall = NATIVE_BIND$3 ? call$h.bind(call$h) : function () {
72
+ return call$h.apply(call$h, arguments);
73
+ };
74
+
75
+ var objectPropertyIsEnumerable = {};
76
+
77
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
78
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
79
+ var getOwnPropertyDescriptor$3 = Object.getOwnPropertyDescriptor;
80
+
81
+ // Nashorn ~ JDK8 bug
82
+ var NASHORN_BUG = getOwnPropertyDescriptor$3 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
83
+
84
+ // `Object.prototype.propertyIsEnumerable` method implementation
85
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
86
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
87
+ var descriptor = getOwnPropertyDescriptor$3(this, V);
88
+ return !!descriptor && descriptor.enumerable;
89
+ } : $propertyIsEnumerable;
90
+
91
+ var createPropertyDescriptor$3 = function (bitmap, value) {
92
+ return {
93
+ enumerable: !(bitmap & 1),
94
+ configurable: !(bitmap & 2),
95
+ writable: !(bitmap & 4),
96
+ value: value
97
+ };
98
+ };
99
+
100
+ var NATIVE_BIND$2 = functionBindNative;
101
+
102
+ var FunctionPrototype$2 = Function.prototype;
103
+ var call$g = FunctionPrototype$2.call;
104
+ var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$g, call$g);
105
+
106
+ var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
107
+ return function () {
108
+ return call$g.apply(fn, arguments);
109
+ };
110
+ };
111
+
112
+ var uncurryThis$m = functionUncurryThis;
113
+
114
+ var toString$9 = uncurryThis$m({}.toString);
115
+ var stringSlice$5 = uncurryThis$m(''.slice);
116
+
117
+ var classofRaw$2 = function (it) {
118
+ return stringSlice$5(toString$9(it), 8, -1);
119
+ };
120
+
121
+ var uncurryThis$l = functionUncurryThis;
122
+ var fails$i = fails$l;
123
+ var classof$7 = classofRaw$2;
124
+
125
+ var $Object$4 = Object;
126
+ var split = uncurryThis$l(''.split);
127
+
128
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
129
+ var indexedObject = fails$i(function () {
130
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
131
+ // eslint-disable-next-line no-prototype-builtins -- safe
132
+ return !$Object$4('z').propertyIsEnumerable(0);
133
+ }) ? function (it) {
134
+ return classof$7(it) == 'String' ? split(it, '') : $Object$4(it);
135
+ } : $Object$4;
136
+
137
+ // we can't use just `it == null` since of `document.all` special case
138
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
139
+ var isNullOrUndefined$5 = function (it) {
140
+ return it === null || it === undefined;
141
+ };
142
+
143
+ var isNullOrUndefined$4 = isNullOrUndefined$5;
144
+
145
+ var $TypeError$f = TypeError;
146
+
147
+ // `RequireObjectCoercible` abstract operation
148
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
149
+ var requireObjectCoercible$7 = function (it) {
150
+ if (isNullOrUndefined$4(it)) throw $TypeError$f("Can't call method on " + it);
151
+ return it;
152
+ };
153
+
154
+ // toObject with fallback for non-array-like ES3 strings
155
+ var IndexedObject$2 = indexedObject;
156
+ var requireObjectCoercible$6 = requireObjectCoercible$7;
157
+
158
+ var toIndexedObject$5 = function (it) {
159
+ return IndexedObject$2(requireObjectCoercible$6(it));
160
+ };
161
+
162
+ var documentAll$2 = typeof document == 'object' && document.all;
163
+
164
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
165
+ var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
166
+
167
+ var documentAll_1 = {
168
+ all: documentAll$2,
169
+ IS_HTMLDDA: IS_HTMLDDA
170
+ };
171
+
172
+ var $documentAll$1 = documentAll_1;
173
+
174
+ var documentAll$1 = $documentAll$1.all;
175
+
176
+ // `IsCallable` abstract operation
177
+ // https://tc39.es/ecma262/#sec-iscallable
178
+ var isCallable$m = $documentAll$1.IS_HTMLDDA ? function (argument) {
179
+ return typeof argument == 'function' || argument === documentAll$1;
180
+ } : function (argument) {
181
+ return typeof argument == 'function';
182
+ };
183
+
184
+ var isCallable$l = isCallable$m;
185
+ var $documentAll = documentAll_1;
186
+
187
+ var documentAll = $documentAll.all;
188
+
189
+ var isObject$9 = $documentAll.IS_HTMLDDA ? function (it) {
190
+ return typeof it == 'object' ? it !== null : isCallable$l(it) || it === documentAll;
191
+ } : function (it) {
192
+ return typeof it == 'object' ? it !== null : isCallable$l(it);
193
+ };
194
+
195
+ var global$m = global$n;
196
+ var isCallable$k = isCallable$m;
197
+
198
+ var aFunction = function (argument) {
199
+ return isCallable$k(argument) ? argument : undefined;
200
+ };
201
+
202
+ var getBuiltIn$8 = function (namespace, method) {
203
+ return arguments.length < 2 ? aFunction(global$m[namespace]) : global$m[namespace] && global$m[namespace][method];
204
+ };
205
+
206
+ var uncurryThis$k = functionUncurryThis;
207
+
208
+ var objectIsPrototypeOf = uncurryThis$k({}.isPrototypeOf);
209
+
210
+ var getBuiltIn$7 = getBuiltIn$8;
211
+
212
+ var engineUserAgent = getBuiltIn$7('navigator', 'userAgent') || '';
213
+
214
+ var global$l = global$n;
215
+ var userAgent$3 = engineUserAgent;
216
+
217
+ var process$3 = global$l.process;
218
+ var Deno$1 = global$l.Deno;
219
+ var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
220
+ var v8 = versions && versions.v8;
221
+ var match, version;
222
+
223
+ if (v8) {
224
+ match = v8.split('.');
225
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
226
+ // but their correct versions are not interesting for us
227
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
228
+ }
229
+
230
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
231
+ // so check `userAgent` even if `.v8` exists, but 0
232
+ if (!version && userAgent$3) {
233
+ match = userAgent$3.match(/Edge\/(\d+)/);
234
+ if (!match || match[1] >= 74) {
235
+ match = userAgent$3.match(/Chrome\/(\d+)/);
236
+ if (match) version = +match[1];
237
+ }
238
+ }
239
+
240
+ var engineV8Version = version;
241
+
242
+ /* eslint-disable es/no-symbol -- required for testing */
243
+
244
+ var V8_VERSION$1 = engineV8Version;
245
+ var fails$h = fails$l;
246
+
247
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
248
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$h(function () {
249
+ var symbol = Symbol();
250
+ // Chrome 38 Symbol has incorrect toString conversion
251
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
252
+ return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
253
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
254
+ !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
255
+ });
256
+
257
+ /* eslint-disable es/no-symbol -- required for testing */
258
+
259
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
260
+
261
+ var useSymbolAsUid = NATIVE_SYMBOL$1
262
+ && !Symbol.sham
263
+ && typeof Symbol.iterator == 'symbol';
264
+
265
+ var getBuiltIn$6 = getBuiltIn$8;
266
+ var isCallable$j = isCallable$m;
267
+ var isPrototypeOf$2 = objectIsPrototypeOf;
268
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
269
+
270
+ var $Object$3 = Object;
271
+
272
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
273
+ return typeof it == 'symbol';
274
+ } : function (it) {
275
+ var $Symbol = getBuiltIn$6('Symbol');
276
+ return isCallable$j($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$3(it));
277
+ };
278
+
279
+ var $String$3 = String;
280
+
281
+ var tryToString$4 = function (argument) {
282
+ try {
283
+ return $String$3(argument);
284
+ } catch (error) {
285
+ return 'Object';
286
+ }
287
+ };
288
+
289
+ var isCallable$i = isCallable$m;
290
+ var tryToString$3 = tryToString$4;
291
+
292
+ var $TypeError$e = TypeError;
293
+
294
+ // `Assert: IsCallable(argument) is true`
295
+ var aCallable$8 = function (argument) {
296
+ if (isCallable$i(argument)) return argument;
297
+ throw $TypeError$e(tryToString$3(argument) + ' is not a function');
298
+ };
299
+
300
+ var aCallable$7 = aCallable$8;
301
+ var isNullOrUndefined$3 = isNullOrUndefined$5;
302
+
303
+ // `GetMethod` abstract operation
304
+ // https://tc39.es/ecma262/#sec-getmethod
305
+ var getMethod$4 = function (V, P) {
306
+ var func = V[P];
307
+ return isNullOrUndefined$3(func) ? undefined : aCallable$7(func);
308
+ };
309
+
310
+ var call$f = functionCall;
311
+ var isCallable$h = isCallable$m;
312
+ var isObject$8 = isObject$9;
313
+
314
+ var $TypeError$d = TypeError;
315
+
316
+ // `OrdinaryToPrimitive` abstract operation
317
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
318
+ var ordinaryToPrimitive$1 = function (input, pref) {
319
+ var fn, val;
320
+ if (pref === 'string' && isCallable$h(fn = input.toString) && !isObject$8(val = call$f(fn, input))) return val;
321
+ if (isCallable$h(fn = input.valueOf) && !isObject$8(val = call$f(fn, input))) return val;
322
+ if (pref !== 'string' && isCallable$h(fn = input.toString) && !isObject$8(val = call$f(fn, input))) return val;
323
+ throw $TypeError$d("Can't convert object to primitive value");
324
+ };
325
+
326
+ var shared$4 = {exports: {}};
327
+
328
+ var global$k = global$n;
329
+
330
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
331
+ var defineProperty$5 = Object.defineProperty;
332
+
333
+ var defineGlobalProperty$3 = function (key, value) {
334
+ try {
335
+ defineProperty$5(global$k, key, { value: value, configurable: true, writable: true });
336
+ } catch (error) {
337
+ global$k[key] = value;
338
+ } return value;
339
+ };
340
+
341
+ var global$j = global$n;
342
+ var defineGlobalProperty$2 = defineGlobalProperty$3;
343
+
344
+ var SHARED = '__core-js_shared__';
345
+ var store$3 = global$j[SHARED] || defineGlobalProperty$2(SHARED, {});
346
+
347
+ var sharedStore = store$3;
348
+
349
+ var store$2 = sharedStore;
350
+
351
+ (shared$4.exports = function (key, value) {
352
+ return store$2[key] || (store$2[key] = value !== undefined ? value : {});
353
+ })('versions', []).push({
354
+ version: '3.26.1',
355
+ mode: 'global',
356
+ copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
357
+ license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
358
+ source: 'https://github.com/zloirock/core-js'
359
+ });
360
+
361
+ var requireObjectCoercible$5 = requireObjectCoercible$7;
362
+
363
+ var $Object$2 = Object;
364
+
365
+ // `ToObject` abstract operation
366
+ // https://tc39.es/ecma262/#sec-toobject
367
+ var toObject$5 = function (argument) {
368
+ return $Object$2(requireObjectCoercible$5(argument));
369
+ };
370
+
371
+ var uncurryThis$j = functionUncurryThis;
372
+ var toObject$4 = toObject$5;
373
+
374
+ var hasOwnProperty = uncurryThis$j({}.hasOwnProperty);
375
+
376
+ // `HasOwnProperty` abstract operation
377
+ // https://tc39.es/ecma262/#sec-hasownproperty
378
+ // eslint-disable-next-line es/no-object-hasown -- safe
379
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
380
+ return hasOwnProperty(toObject$4(it), key);
381
+ };
382
+
383
+ var uncurryThis$i = functionUncurryThis;
384
+
385
+ var id = 0;
386
+ var postfix = Math.random();
387
+ var toString$8 = uncurryThis$i(1.0.toString);
388
+
389
+ var uid$2 = function (key) {
390
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$8(++id + postfix, 36);
391
+ };
392
+
393
+ var global$i = global$n;
394
+ var shared$3 = shared$4.exports;
395
+ var hasOwn$9 = hasOwnProperty_1;
396
+ var uid$1 = uid$2;
397
+ var NATIVE_SYMBOL = symbolConstructorDetection;
398
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
399
+
400
+ var WellKnownSymbolsStore = shared$3('wks');
401
+ var Symbol$2 = global$i.Symbol;
402
+ var symbolFor = Symbol$2 && Symbol$2['for'];
403
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$2 : Symbol$2 && Symbol$2.withoutSetter || uid$1;
404
+
405
+ var wellKnownSymbol$i = function (name) {
406
+ if (!hasOwn$9(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
407
+ var description = 'Symbol.' + name;
408
+ if (NATIVE_SYMBOL && hasOwn$9(Symbol$2, name)) {
409
+ WellKnownSymbolsStore[name] = Symbol$2[name];
410
+ } else if (USE_SYMBOL_AS_UID && symbolFor) {
411
+ WellKnownSymbolsStore[name] = symbolFor(description);
412
+ } else {
413
+ WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
414
+ }
415
+ } return WellKnownSymbolsStore[name];
416
+ };
417
+
418
+ var call$e = functionCall;
419
+ var isObject$7 = isObject$9;
420
+ var isSymbol$1 = isSymbol$2;
421
+ var getMethod$3 = getMethod$4;
422
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
423
+ var wellKnownSymbol$h = wellKnownSymbol$i;
424
+
425
+ var $TypeError$c = TypeError;
426
+ var TO_PRIMITIVE = wellKnownSymbol$h('toPrimitive');
427
+
428
+ // `ToPrimitive` abstract operation
429
+ // https://tc39.es/ecma262/#sec-toprimitive
430
+ var toPrimitive$1 = function (input, pref) {
431
+ if (!isObject$7(input) || isSymbol$1(input)) return input;
432
+ var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
433
+ var result;
434
+ if (exoticToPrim) {
435
+ if (pref === undefined) pref = 'default';
436
+ result = call$e(exoticToPrim, input, pref);
437
+ if (!isObject$7(result) || isSymbol$1(result)) return result;
438
+ throw $TypeError$c("Can't convert object to primitive value");
439
+ }
440
+ if (pref === undefined) pref = 'number';
441
+ return ordinaryToPrimitive(input, pref);
442
+ };
443
+
444
+ var toPrimitive = toPrimitive$1;
445
+ var isSymbol = isSymbol$2;
446
+
447
+ // `ToPropertyKey` abstract operation
448
+ // https://tc39.es/ecma262/#sec-topropertykey
449
+ var toPropertyKey$2 = function (argument) {
450
+ var key = toPrimitive(argument, 'string');
451
+ return isSymbol(key) ? key : key + '';
452
+ };
453
+
454
+ var global$h = global$n;
455
+ var isObject$6 = isObject$9;
456
+
457
+ var document$3 = global$h.document;
458
+ // typeof document.createElement is 'object' in old IE
459
+ var EXISTS$1 = isObject$6(document$3) && isObject$6(document$3.createElement);
460
+
461
+ var documentCreateElement$2 = function (it) {
462
+ return EXISTS$1 ? document$3.createElement(it) : {};
463
+ };
464
+
465
+ var DESCRIPTORS$a = descriptors;
466
+ var fails$g = fails$l;
467
+ var createElement$1 = documentCreateElement$2;
468
+
469
+ // Thanks to IE8 for its funny defineProperty
470
+ var ie8DomDefine = !DESCRIPTORS$a && !fails$g(function () {
471
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
472
+ return Object.defineProperty(createElement$1('div'), 'a', {
473
+ get: function () { return 7; }
474
+ }).a != 7;
475
+ });
476
+
477
+ var DESCRIPTORS$9 = descriptors;
478
+ var call$d = functionCall;
479
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
480
+ var createPropertyDescriptor$2 = createPropertyDescriptor$3;
481
+ var toIndexedObject$4 = toIndexedObject$5;
482
+ var toPropertyKey$1 = toPropertyKey$2;
483
+ var hasOwn$8 = hasOwnProperty_1;
484
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
485
+
486
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
487
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
488
+
489
+ // `Object.getOwnPropertyDescriptor` method
490
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
491
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$9 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
492
+ O = toIndexedObject$4(O);
493
+ P = toPropertyKey$1(P);
494
+ if (IE8_DOM_DEFINE$1) try {
495
+ return $getOwnPropertyDescriptor$1(O, P);
496
+ } catch (error) { /* empty */ }
497
+ if (hasOwn$8(O, P)) return createPropertyDescriptor$2(!call$d(propertyIsEnumerableModule$1.f, O, P), O[P]);
498
+ };
499
+
500
+ var objectDefineProperty = {};
501
+
502
+ var DESCRIPTORS$8 = descriptors;
503
+ var fails$f = fails$l;
504
+
505
+ // V8 ~ Chrome 36-
506
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
507
+ var v8PrototypeDefineBug = DESCRIPTORS$8 && fails$f(function () {
508
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
509
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
510
+ value: 42,
511
+ writable: false
512
+ }).prototype != 42;
513
+ });
514
+
515
+ var isObject$5 = isObject$9;
516
+
517
+ var $String$2 = String;
518
+ var $TypeError$b = TypeError;
519
+
520
+ // `Assert: Type(argument) is Object`
521
+ var anObject$d = function (argument) {
522
+ if (isObject$5(argument)) return argument;
523
+ throw $TypeError$b($String$2(argument) + ' is not an object');
524
+ };
525
+
526
+ var DESCRIPTORS$7 = descriptors;
527
+ var IE8_DOM_DEFINE = ie8DomDefine;
528
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
529
+ var anObject$c = anObject$d;
530
+ var toPropertyKey = toPropertyKey$2;
531
+
532
+ var $TypeError$a = TypeError;
533
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
534
+ var $defineProperty = Object.defineProperty;
535
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
536
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
537
+ var ENUMERABLE = 'enumerable';
538
+ var CONFIGURABLE$1 = 'configurable';
539
+ var WRITABLE = 'writable';
540
+
541
+ // `Object.defineProperty` method
542
+ // https://tc39.es/ecma262/#sec-object.defineproperty
543
+ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
544
+ anObject$c(O);
545
+ P = toPropertyKey(P);
546
+ anObject$c(Attributes);
547
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
548
+ var current = $getOwnPropertyDescriptor(O, P);
549
+ if (current && current[WRITABLE]) {
550
+ O[P] = Attributes.value;
551
+ Attributes = {
552
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
553
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
554
+ writable: false
555
+ };
556
+ }
557
+ } return $defineProperty(O, P, Attributes);
558
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
559
+ anObject$c(O);
560
+ P = toPropertyKey(P);
561
+ anObject$c(Attributes);
562
+ if (IE8_DOM_DEFINE) try {
563
+ return $defineProperty(O, P, Attributes);
564
+ } catch (error) { /* empty */ }
565
+ if ('get' in Attributes || 'set' in Attributes) throw $TypeError$a('Accessors not supported');
566
+ if ('value' in Attributes) O[P] = Attributes.value;
567
+ return O;
568
+ };
569
+
570
+ var DESCRIPTORS$6 = descriptors;
571
+ var definePropertyModule$4 = objectDefineProperty;
572
+ var createPropertyDescriptor$1 = createPropertyDescriptor$3;
573
+
574
+ var createNonEnumerableProperty$5 = DESCRIPTORS$6 ? function (object, key, value) {
575
+ return definePropertyModule$4.f(object, key, createPropertyDescriptor$1(1, value));
576
+ } : function (object, key, value) {
577
+ object[key] = value;
578
+ return object;
579
+ };
580
+
581
+ var makeBuiltIn$2 = {exports: {}};
582
+
583
+ var DESCRIPTORS$5 = descriptors;
584
+ var hasOwn$7 = hasOwnProperty_1;
585
+
586
+ var FunctionPrototype$1 = Function.prototype;
587
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
588
+ var getDescriptor = DESCRIPTORS$5 && Object.getOwnPropertyDescriptor;
589
+
590
+ var EXISTS = hasOwn$7(FunctionPrototype$1, 'name');
591
+ // additional protection from minified / mangled / dropped function names
592
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
593
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$5 || (DESCRIPTORS$5 && getDescriptor(FunctionPrototype$1, 'name').configurable));
594
+
595
+ var functionName = {
596
+ EXISTS: EXISTS,
597
+ PROPER: PROPER,
598
+ CONFIGURABLE: CONFIGURABLE
599
+ };
600
+
601
+ var uncurryThis$h = functionUncurryThis;
602
+ var isCallable$g = isCallable$m;
603
+ var store$1 = sharedStore;
604
+
605
+ var functionToString = uncurryThis$h(Function.toString);
606
+
607
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
608
+ if (!isCallable$g(store$1.inspectSource)) {
609
+ store$1.inspectSource = function (it) {
610
+ return functionToString(it);
611
+ };
612
+ }
613
+
614
+ var inspectSource$3 = store$1.inspectSource;
615
+
616
+ var global$g = global$n;
617
+ var isCallable$f = isCallable$m;
618
+
619
+ var WeakMap$1 = global$g.WeakMap;
620
+
621
+ var weakMapBasicDetection = isCallable$f(WeakMap$1) && /native code/.test(String(WeakMap$1));
622
+
623
+ var shared$2 = shared$4.exports;
624
+ var uid = uid$2;
625
+
626
+ var keys = shared$2('keys');
627
+
628
+ var sharedKey$3 = function (key) {
629
+ return keys[key] || (keys[key] = uid(key));
630
+ };
631
+
632
+ var hiddenKeys$4 = {};
633
+
634
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
635
+ var global$f = global$n;
636
+ var isObject$4 = isObject$9;
637
+ var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
638
+ var hasOwn$6 = hasOwnProperty_1;
639
+ var shared$1 = sharedStore;
640
+ var sharedKey$2 = sharedKey$3;
641
+ var hiddenKeys$3 = hiddenKeys$4;
642
+
643
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
644
+ var TypeError$2 = global$f.TypeError;
645
+ var WeakMap = global$f.WeakMap;
646
+ var set$1, get, has;
647
+
648
+ var enforce = function (it) {
649
+ return has(it) ? get(it) : set$1(it, {});
650
+ };
651
+
652
+ var getterFor = function (TYPE) {
653
+ return function (it) {
654
+ var state;
655
+ if (!isObject$4(it) || (state = get(it)).type !== TYPE) {
656
+ throw TypeError$2('Incompatible receiver, ' + TYPE + ' required');
657
+ } return state;
658
+ };
659
+ };
660
+
661
+ if (NATIVE_WEAK_MAP || shared$1.state) {
662
+ var store = shared$1.state || (shared$1.state = new WeakMap());
663
+ /* eslint-disable no-self-assign -- prototype methods protection */
664
+ store.get = store.get;
665
+ store.has = store.has;
666
+ store.set = store.set;
667
+ /* eslint-enable no-self-assign -- prototype methods protection */
668
+ set$1 = function (it, metadata) {
669
+ if (store.has(it)) throw TypeError$2(OBJECT_ALREADY_INITIALIZED);
670
+ metadata.facade = it;
671
+ store.set(it, metadata);
672
+ return metadata;
673
+ };
674
+ get = function (it) {
675
+ return store.get(it) || {};
676
+ };
677
+ has = function (it) {
678
+ return store.has(it);
679
+ };
680
+ } else {
681
+ var STATE = sharedKey$2('state');
682
+ hiddenKeys$3[STATE] = true;
683
+ set$1 = function (it, metadata) {
684
+ if (hasOwn$6(it, STATE)) throw TypeError$2(OBJECT_ALREADY_INITIALIZED);
685
+ metadata.facade = it;
686
+ createNonEnumerableProperty$4(it, STATE, metadata);
687
+ return metadata;
688
+ };
689
+ get = function (it) {
690
+ return hasOwn$6(it, STATE) ? it[STATE] : {};
691
+ };
692
+ has = function (it) {
693
+ return hasOwn$6(it, STATE);
694
+ };
695
+ }
696
+
697
+ var internalState = {
698
+ set: set$1,
699
+ get: get,
700
+ has: has,
701
+ enforce: enforce,
702
+ getterFor: getterFor
703
+ };
704
+
705
+ var fails$e = fails$l;
706
+ var isCallable$e = isCallable$m;
707
+ var hasOwn$5 = hasOwnProperty_1;
708
+ var DESCRIPTORS$4 = descriptors;
709
+ var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
710
+ var inspectSource$2 = inspectSource$3;
711
+ var InternalStateModule$2 = internalState;
712
+
713
+ var enforceInternalState = InternalStateModule$2.enforce;
714
+ var getInternalState$2 = InternalStateModule$2.get;
715
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
716
+ var defineProperty$4 = Object.defineProperty;
717
+
718
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$4 && !fails$e(function () {
719
+ return defineProperty$4(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
720
+ });
721
+
722
+ var TEMPLATE = String(String).split('String');
723
+
724
+ var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
725
+ if (String(name).slice(0, 7) === 'Symbol(') {
726
+ name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
727
+ }
728
+ if (options && options.getter) name = 'get ' + name;
729
+ if (options && options.setter) name = 'set ' + name;
730
+ if (!hasOwn$5(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
731
+ if (DESCRIPTORS$4) defineProperty$4(value, 'name', { value: name, configurable: true });
732
+ else value.name = name;
733
+ }
734
+ if (CONFIGURABLE_LENGTH && options && hasOwn$5(options, 'arity') && value.length !== options.arity) {
735
+ defineProperty$4(value, 'length', { value: options.arity });
736
+ }
737
+ try {
738
+ if (options && hasOwn$5(options, 'constructor') && options.constructor) {
739
+ if (DESCRIPTORS$4) defineProperty$4(value, 'prototype', { writable: false });
740
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
741
+ } else if (value.prototype) value.prototype = undefined;
742
+ } catch (error) { /* empty */ }
743
+ var state = enforceInternalState(value);
744
+ if (!hasOwn$5(state, 'source')) {
745
+ state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
746
+ } return value;
747
+ };
748
+
749
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
750
+ // eslint-disable-next-line no-extend-native -- required
751
+ Function.prototype.toString = makeBuiltIn$1(function toString() {
752
+ return isCallable$e(this) && getInternalState$2(this).source || inspectSource$2(this);
753
+ }, 'toString');
754
+
755
+ var isCallable$d = isCallable$m;
756
+ var definePropertyModule$3 = objectDefineProperty;
757
+ var makeBuiltIn = makeBuiltIn$2.exports;
758
+ var defineGlobalProperty$1 = defineGlobalProperty$3;
759
+
760
+ var defineBuiltIn$6 = function (O, key, value, options) {
761
+ if (!options) options = {};
762
+ var simple = options.enumerable;
763
+ var name = options.name !== undefined ? options.name : key;
764
+ if (isCallable$d(value)) makeBuiltIn(value, name, options);
765
+ if (options.global) {
766
+ if (simple) O[key] = value;
767
+ else defineGlobalProperty$1(key, value);
768
+ } else {
769
+ try {
770
+ if (!options.unsafe) delete O[key];
771
+ else if (O[key]) simple = true;
772
+ } catch (error) { /* empty */ }
773
+ if (simple) O[key] = value;
774
+ else definePropertyModule$3.f(O, key, {
775
+ value: value,
776
+ enumerable: false,
777
+ configurable: !options.nonConfigurable,
778
+ writable: !options.nonWritable
779
+ });
780
+ } return O;
781
+ };
782
+
783
+ var objectGetOwnPropertyNames = {};
784
+
785
+ var ceil = Math.ceil;
786
+ var floor$1 = Math.floor;
787
+
788
+ // `Math.trunc` method
789
+ // https://tc39.es/ecma262/#sec-math.trunc
790
+ // eslint-disable-next-line es/no-math-trunc -- safe
791
+ var mathTrunc = Math.trunc || function trunc(x) {
792
+ var n = +x;
793
+ return (n > 0 ? floor$1 : ceil)(n);
794
+ };
795
+
796
+ var trunc = mathTrunc;
797
+
798
+ // `ToIntegerOrInfinity` abstract operation
799
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
800
+ var toIntegerOrInfinity$4 = function (argument) {
801
+ var number = +argument;
802
+ // eslint-disable-next-line no-self-compare -- NaN check
803
+ return number !== number || number === 0 ? 0 : trunc(number);
804
+ };
805
+
806
+ var toIntegerOrInfinity$3 = toIntegerOrInfinity$4;
807
+
808
+ var max$1 = Math.max;
809
+ var min$3 = Math.min;
810
+
811
+ // Helper for a popular repeating case of the spec:
812
+ // Let integer be ? ToInteger(index).
813
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
814
+ var toAbsoluteIndex$1 = function (index, length) {
815
+ var integer = toIntegerOrInfinity$3(index);
816
+ return integer < 0 ? max$1(integer + length, 0) : min$3(integer, length);
817
+ };
818
+
819
+ var toIntegerOrInfinity$2 = toIntegerOrInfinity$4;
820
+
821
+ var min$2 = Math.min;
822
+
823
+ // `ToLength` abstract operation
824
+ // https://tc39.es/ecma262/#sec-tolength
825
+ var toLength$3 = function (argument) {
826
+ return argument > 0 ? min$2(toIntegerOrInfinity$2(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
827
+ };
828
+
829
+ var toLength$2 = toLength$3;
830
+
831
+ // `LengthOfArrayLike` abstract operation
832
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
833
+ var lengthOfArrayLike$3 = function (obj) {
834
+ return toLength$2(obj.length);
835
+ };
836
+
837
+ var toIndexedObject$3 = toIndexedObject$5;
838
+ var toAbsoluteIndex = toAbsoluteIndex$1;
839
+ var lengthOfArrayLike$2 = lengthOfArrayLike$3;
840
+
841
+ // `Array.prototype.{ indexOf, includes }` methods implementation
842
+ var createMethod$3 = function (IS_INCLUDES) {
843
+ return function ($this, el, fromIndex) {
844
+ var O = toIndexedObject$3($this);
845
+ var length = lengthOfArrayLike$2(O);
846
+ var index = toAbsoluteIndex(fromIndex, length);
847
+ var value;
848
+ // Array#includes uses SameValueZero equality algorithm
849
+ // eslint-disable-next-line no-self-compare -- NaN check
850
+ if (IS_INCLUDES && el != el) while (length > index) {
851
+ value = O[index++];
852
+ // eslint-disable-next-line no-self-compare -- NaN check
853
+ if (value != value) return true;
854
+ // Array#indexOf ignores holes, Array#includes - not
855
+ } else for (;length > index; index++) {
856
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
857
+ } return !IS_INCLUDES && -1;
858
+ };
859
+ };
860
+
861
+ var arrayIncludes = {
862
+ // `Array.prototype.includes` method
863
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
864
+ includes: createMethod$3(true),
865
+ // `Array.prototype.indexOf` method
866
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
867
+ indexOf: createMethod$3(false)
868
+ };
869
+
870
+ var uncurryThis$g = functionUncurryThis;
871
+ var hasOwn$4 = hasOwnProperty_1;
872
+ var toIndexedObject$2 = toIndexedObject$5;
873
+ var indexOf$1 = arrayIncludes.indexOf;
874
+ var hiddenKeys$2 = hiddenKeys$4;
875
+
876
+ var push$1 = uncurryThis$g([].push);
877
+
878
+ var objectKeysInternal = function (object, names) {
879
+ var O = toIndexedObject$2(object);
880
+ var i = 0;
881
+ var result = [];
882
+ var key;
883
+ for (key in O) !hasOwn$4(hiddenKeys$2, key) && hasOwn$4(O, key) && push$1(result, key);
884
+ // Don't enum bug & hidden keys
885
+ while (names.length > i) if (hasOwn$4(O, key = names[i++])) {
886
+ ~indexOf$1(result, key) || push$1(result, key);
887
+ }
888
+ return result;
889
+ };
890
+
891
+ // IE8- don't enum bug keys
892
+ var enumBugKeys$3 = [
893
+ 'constructor',
894
+ 'hasOwnProperty',
895
+ 'isPrototypeOf',
896
+ 'propertyIsEnumerable',
897
+ 'toLocaleString',
898
+ 'toString',
899
+ 'valueOf'
900
+ ];
901
+
902
+ var internalObjectKeys$1 = objectKeysInternal;
903
+ var enumBugKeys$2 = enumBugKeys$3;
904
+
905
+ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
906
+
907
+ // `Object.getOwnPropertyNames` method
908
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
909
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
910
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
911
+ return internalObjectKeys$1(O, hiddenKeys$1);
912
+ };
913
+
914
+ var objectGetOwnPropertySymbols = {};
915
+
916
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
917
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
918
+
919
+ var getBuiltIn$5 = getBuiltIn$8;
920
+ var uncurryThis$f = functionUncurryThis;
921
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
922
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
923
+ var anObject$b = anObject$d;
924
+
925
+ var concat$2 = uncurryThis$f([].concat);
926
+
927
+ // all object keys, includes non-enumerable and symbols
928
+ var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
929
+ var keys = getOwnPropertyNamesModule.f(anObject$b(it));
930
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
931
+ return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
932
+ };
933
+
934
+ var hasOwn$3 = hasOwnProperty_1;
935
+ var ownKeys = ownKeys$1;
936
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
937
+ var definePropertyModule$2 = objectDefineProperty;
938
+
939
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
940
+ var keys = ownKeys(source);
941
+ var defineProperty = definePropertyModule$2.f;
942
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
943
+ for (var i = 0; i < keys.length; i++) {
944
+ var key = keys[i];
945
+ if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
946
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
947
+ }
948
+ }
949
+ };
950
+
951
+ var fails$d = fails$l;
952
+ var isCallable$c = isCallable$m;
953
+
954
+ var replacement = /#|\.prototype\./;
955
+
956
+ var isForced$2 = function (feature, detection) {
957
+ var value = data[normalize$1(feature)];
958
+ return value == POLYFILL ? true
959
+ : value == NATIVE ? false
960
+ : isCallable$c(detection) ? fails$d(detection)
961
+ : !!detection;
962
+ };
963
+
964
+ var normalize$1 = isForced$2.normalize = function (string) {
965
+ return String(string).replace(replacement, '.').toLowerCase();
966
+ };
967
+
968
+ var data = isForced$2.data = {};
969
+ var NATIVE = isForced$2.NATIVE = 'N';
970
+ var POLYFILL = isForced$2.POLYFILL = 'P';
971
+
972
+ var isForced_1 = isForced$2;
973
+
974
+ var global$e = global$n;
975
+ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
976
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
977
+ var defineBuiltIn$5 = defineBuiltIn$6;
978
+ var defineGlobalProperty = defineGlobalProperty$3;
979
+ var copyConstructorProperties = copyConstructorProperties$1;
980
+ var isForced$1 = isForced_1;
981
+
982
+ /*
983
+ options.target - name of the target object
984
+ options.global - target is the global object
985
+ options.stat - export as static methods of target
986
+ options.proto - export as prototype methods of target
987
+ options.real - real prototype method for the `pure` version
988
+ options.forced - export even if the native feature is available
989
+ options.bind - bind methods to the target, required for the `pure` version
990
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
991
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
992
+ options.sham - add a flag to not completely full polyfills
993
+ options.enumerable - export as enumerable property
994
+ options.dontCallGetSet - prevent calling a getter on target
995
+ options.name - the .name of the function if it does not match the key
996
+ */
997
+ var _export = function (options, source) {
998
+ var TARGET = options.target;
999
+ var GLOBAL = options.global;
1000
+ var STATIC = options.stat;
1001
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1002
+ if (GLOBAL) {
1003
+ target = global$e;
1004
+ } else if (STATIC) {
1005
+ target = global$e[TARGET] || defineGlobalProperty(TARGET, {});
1006
+ } else {
1007
+ target = (global$e[TARGET] || {}).prototype;
1008
+ }
1009
+ if (target) for (key in source) {
1010
+ sourceProperty = source[key];
1011
+ if (options.dontCallGetSet) {
1012
+ descriptor = getOwnPropertyDescriptor$2(target, key);
1013
+ targetProperty = descriptor && descriptor.value;
1014
+ } else targetProperty = target[key];
1015
+ FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1016
+ // contained in target
1017
+ if (!FORCED && targetProperty !== undefined) {
1018
+ if (typeof sourceProperty == typeof targetProperty) continue;
1019
+ copyConstructorProperties(sourceProperty, targetProperty);
1020
+ }
1021
+ // add a flag to not completely full polyfills
1022
+ if (options.sham || (targetProperty && targetProperty.sham)) {
1023
+ createNonEnumerableProperty$3(sourceProperty, 'sham', true);
1024
+ }
1025
+ defineBuiltIn$5(target, key, sourceProperty, options);
1026
+ }
1027
+ };
1028
+
1029
+ var classof$6 = classofRaw$2;
1030
+ var global$d = global$n;
1031
+
1032
+ var engineIsNode = classof$6(global$d.process) == 'process';
1033
+
1034
+ var isCallable$b = isCallable$m;
1035
+
1036
+ var $String$1 = String;
1037
+ var $TypeError$9 = TypeError;
1038
+
1039
+ var aPossiblePrototype$1 = function (argument) {
1040
+ if (typeof argument == 'object' || isCallable$b(argument)) return argument;
1041
+ throw $TypeError$9("Can't set " + $String$1(argument) + ' as a prototype');
1042
+ };
1043
+
1044
+ /* eslint-disable no-proto -- safe */
1045
+
1046
+ var uncurryThis$e = functionUncurryThis;
1047
+ var anObject$a = anObject$d;
1048
+ var aPossiblePrototype = aPossiblePrototype$1;
1049
+
1050
+ // `Object.setPrototypeOf` method
1051
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1052
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1053
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1054
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1055
+ var CORRECT_SETTER = false;
1056
+ var test = {};
1057
+ var setter;
1058
+ try {
1059
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1060
+ setter = uncurryThis$e(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1061
+ setter(test, []);
1062
+ CORRECT_SETTER = test instanceof Array;
1063
+ } catch (error) { /* empty */ }
1064
+ return function setPrototypeOf(O, proto) {
1065
+ anObject$a(O);
1066
+ aPossiblePrototype(proto);
1067
+ if (CORRECT_SETTER) setter(O, proto);
1068
+ else O.__proto__ = proto;
1069
+ return O;
1070
+ };
1071
+ }() : undefined);
1072
+
1073
+ var defineProperty$3 = objectDefineProperty.f;
1074
+ var hasOwn$2 = hasOwnProperty_1;
1075
+ var wellKnownSymbol$g = wellKnownSymbol$i;
1076
+
1077
+ var TO_STRING_TAG$3 = wellKnownSymbol$g('toStringTag');
1078
+
1079
+ var setToStringTag$3 = function (target, TAG, STATIC) {
1080
+ if (target && !STATIC) target = target.prototype;
1081
+ if (target && !hasOwn$2(target, TO_STRING_TAG$3)) {
1082
+ defineProperty$3(target, TO_STRING_TAG$3, { configurable: true, value: TAG });
1083
+ }
1084
+ };
1085
+
1086
+ var getBuiltIn$4 = getBuiltIn$8;
1087
+ var definePropertyModule$1 = objectDefineProperty;
1088
+ var wellKnownSymbol$f = wellKnownSymbol$i;
1089
+ var DESCRIPTORS$3 = descriptors;
1090
+
1091
+ var SPECIES$3 = wellKnownSymbol$f('species');
1092
+
1093
+ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
1094
+ var Constructor = getBuiltIn$4(CONSTRUCTOR_NAME);
1095
+ var defineProperty = definePropertyModule$1.f;
1096
+
1097
+ if (DESCRIPTORS$3 && Constructor && !Constructor[SPECIES$3]) {
1098
+ defineProperty(Constructor, SPECIES$3, {
1099
+ configurable: true,
1100
+ get: function () { return this; }
1101
+ });
1102
+ }
1103
+ };
1104
+
1105
+ var isPrototypeOf$1 = objectIsPrototypeOf;
1106
+
1107
+ var $TypeError$8 = TypeError;
1108
+
1109
+ var anInstance$1 = function (it, Prototype) {
1110
+ if (isPrototypeOf$1(Prototype, it)) return it;
1111
+ throw $TypeError$8('Incorrect invocation');
1112
+ };
1113
+
1114
+ var wellKnownSymbol$e = wellKnownSymbol$i;
1115
+
1116
+ var TO_STRING_TAG$2 = wellKnownSymbol$e('toStringTag');
1117
+ var test = {};
1118
+
1119
+ test[TO_STRING_TAG$2] = 'z';
1120
+
1121
+ var toStringTagSupport = String(test) === '[object z]';
1122
+
1123
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1124
+ var isCallable$a = isCallable$m;
1125
+ var classofRaw$1 = classofRaw$2;
1126
+ var wellKnownSymbol$d = wellKnownSymbol$i;
1127
+
1128
+ var TO_STRING_TAG$1 = wellKnownSymbol$d('toStringTag');
1129
+ var $Object$1 = Object;
1130
+
1131
+ // ES3 wrong here
1132
+ var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
1133
+
1134
+ // fallback for IE11 Script Access Denied error
1135
+ var tryGet = function (it, key) {
1136
+ try {
1137
+ return it[key];
1138
+ } catch (error) { /* empty */ }
1139
+ };
1140
+
1141
+ // getting tag from ES6+ `Object.prototype.toString`
1142
+ var classof$5 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
1143
+ var O, tag, result;
1144
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1145
+ // @@toStringTag case
1146
+ : typeof (tag = tryGet(O = $Object$1(it), TO_STRING_TAG$1)) == 'string' ? tag
1147
+ // builtinTag case
1148
+ : CORRECT_ARGUMENTS ? classofRaw$1(O)
1149
+ // ES3 arguments fallback
1150
+ : (result = classofRaw$1(O)) == 'Object' && isCallable$a(O.callee) ? 'Arguments' : result;
1151
+ };
1152
+
1153
+ var uncurryThis$d = functionUncurryThis;
1154
+ var fails$c = fails$l;
1155
+ var isCallable$9 = isCallable$m;
1156
+ var classof$4 = classof$5;
1157
+ var getBuiltIn$3 = getBuiltIn$8;
1158
+ var inspectSource$1 = inspectSource$3;
1159
+
1160
+ var noop = function () { /* empty */ };
1161
+ var empty = [];
1162
+ var construct = getBuiltIn$3('Reflect', 'construct');
1163
+ var constructorRegExp = /^\s*(?:class|function)\b/;
1164
+ var exec$2 = uncurryThis$d(constructorRegExp.exec);
1165
+ var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1166
+
1167
+ var isConstructorModern = function isConstructor(argument) {
1168
+ if (!isCallable$9(argument)) return false;
1169
+ try {
1170
+ construct(noop, empty, argument);
1171
+ return true;
1172
+ } catch (error) {
1173
+ return false;
1174
+ }
1175
+ };
1176
+
1177
+ var isConstructorLegacy = function isConstructor(argument) {
1178
+ if (!isCallable$9(argument)) return false;
1179
+ switch (classof$4(argument)) {
1180
+ case 'AsyncFunction':
1181
+ case 'GeneratorFunction':
1182
+ case 'AsyncGeneratorFunction': return false;
1183
+ }
1184
+ try {
1185
+ // we can't check .prototype since constructors produced by .bind haven't it
1186
+ // `Function#toString` throws on some built-it function in some legacy engines
1187
+ // (for example, `DOMQuad` and similar in FF41-)
1188
+ return INCORRECT_TO_STRING || !!exec$2(constructorRegExp, inspectSource$1(argument));
1189
+ } catch (error) {
1190
+ return true;
1191
+ }
1192
+ };
1193
+
1194
+ isConstructorLegacy.sham = true;
1195
+
1196
+ // `IsConstructor` abstract operation
1197
+ // https://tc39.es/ecma262/#sec-isconstructor
1198
+ var isConstructor$1 = !construct || fails$c(function () {
1199
+ var called;
1200
+ return isConstructorModern(isConstructorModern.call)
1201
+ || !isConstructorModern(Object)
1202
+ || !isConstructorModern(function () { called = true; })
1203
+ || called;
1204
+ }) ? isConstructorLegacy : isConstructorModern;
1205
+
1206
+ var isConstructor = isConstructor$1;
1207
+ var tryToString$2 = tryToString$4;
1208
+
1209
+ var $TypeError$7 = TypeError;
1210
+
1211
+ // `Assert: IsConstructor(argument) is true`
1212
+ var aConstructor$1 = function (argument) {
1213
+ if (isConstructor(argument)) return argument;
1214
+ throw $TypeError$7(tryToString$2(argument) + ' is not a constructor');
1215
+ };
1216
+
1217
+ var anObject$9 = anObject$d;
1218
+ var aConstructor = aConstructor$1;
1219
+ var isNullOrUndefined$2 = isNullOrUndefined$5;
1220
+ var wellKnownSymbol$c = wellKnownSymbol$i;
1221
+
1222
+ var SPECIES$2 = wellKnownSymbol$c('species');
1223
+
1224
+ // `SpeciesConstructor` abstract operation
1225
+ // https://tc39.es/ecma262/#sec-speciesconstructor
1226
+ var speciesConstructor$1 = function (O, defaultConstructor) {
1227
+ var C = anObject$9(O).constructor;
1228
+ var S;
1229
+ return C === undefined || isNullOrUndefined$2(S = anObject$9(C)[SPECIES$2]) ? defaultConstructor : aConstructor(S);
1230
+ };
1231
+
1232
+ var NATIVE_BIND$1 = functionBindNative;
1233
+
1234
+ var FunctionPrototype = Function.prototype;
1235
+ var apply$2 = FunctionPrototype.apply;
1236
+ var call$c = FunctionPrototype.call;
1237
+
1238
+ // eslint-disable-next-line es/no-reflect -- safe
1239
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$c.bind(apply$2) : function () {
1240
+ return call$c.apply(apply$2, arguments);
1241
+ });
1242
+
1243
+ var classofRaw = classofRaw$2;
1244
+ var uncurryThis$c = functionUncurryThis;
1245
+
1246
+ var functionUncurryThisClause = function (fn) {
1247
+ // Nashorn bug:
1248
+ // https://github.com/zloirock/core-js/issues/1128
1249
+ // https://github.com/zloirock/core-js/issues/1130
1250
+ if (classofRaw(fn) === 'Function') return uncurryThis$c(fn);
1251
+ };
1252
+
1253
+ var uncurryThis$b = functionUncurryThisClause;
1254
+ var aCallable$6 = aCallable$8;
1255
+ var NATIVE_BIND = functionBindNative;
1256
+
1257
+ var bind$4 = uncurryThis$b(uncurryThis$b.bind);
1258
+
1259
+ // optional / simple context binding
1260
+ var functionBindContext = function (fn, that) {
1261
+ aCallable$6(fn);
1262
+ return that === undefined ? fn : NATIVE_BIND ? bind$4(fn, that) : function (/* ...args */) {
1263
+ return fn.apply(that, arguments);
1264
+ };
1265
+ };
1266
+
1267
+ var getBuiltIn$2 = getBuiltIn$8;
1268
+
1269
+ var html$2 = getBuiltIn$2('document', 'documentElement');
1270
+
1271
+ var uncurryThis$a = functionUncurryThis;
1272
+
1273
+ var arraySlice$1 = uncurryThis$a([].slice);
1274
+
1275
+ var $TypeError$6 = TypeError;
1276
+
1277
+ var validateArgumentsLength$1 = function (passed, required) {
1278
+ if (passed < required) throw $TypeError$6('Not enough arguments');
1279
+ return passed;
1280
+ };
1281
+
1282
+ var userAgent$2 = engineUserAgent;
1283
+
1284
+ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
1285
+
1286
+ var global$c = global$n;
1287
+ var apply$1 = functionApply;
1288
+ var bind$3 = functionBindContext;
1289
+ var isCallable$8 = isCallable$m;
1290
+ var hasOwn$1 = hasOwnProperty_1;
1291
+ var fails$b = fails$l;
1292
+ var html$1 = html$2;
1293
+ var arraySlice = arraySlice$1;
1294
+ var createElement = documentCreateElement$2;
1295
+ var validateArgumentsLength = validateArgumentsLength$1;
1296
+ var IS_IOS$1 = engineIsIos;
1297
+ var IS_NODE$4 = engineIsNode;
1298
+
1299
+ var set = global$c.setImmediate;
1300
+ var clear = global$c.clearImmediate;
1301
+ var process$2 = global$c.process;
1302
+ var Dispatch = global$c.Dispatch;
1303
+ var Function$1 = global$c.Function;
1304
+ var MessageChannel = global$c.MessageChannel;
1305
+ var String$1 = global$c.String;
1306
+ var counter = 0;
1307
+ var queue$1 = {};
1308
+ var ONREADYSTATECHANGE = 'onreadystatechange';
1309
+ var $location, defer, channel, port;
1310
+
1311
+ try {
1312
+ // Deno throws a ReferenceError on `location` access without `--location` flag
1313
+ $location = global$c.location;
1314
+ } catch (error) { /* empty */ }
1315
+
1316
+ var run = function (id) {
1317
+ if (hasOwn$1(queue$1, id)) {
1318
+ var fn = queue$1[id];
1319
+ delete queue$1[id];
1320
+ fn();
1321
+ }
1322
+ };
1323
+
1324
+ var runner = function (id) {
1325
+ return function () {
1326
+ run(id);
1327
+ };
1328
+ };
1329
+
1330
+ var listener = function (event) {
1331
+ run(event.data);
1332
+ };
1333
+
1334
+ var post = function (id) {
1335
+ // old engines have not location.origin
1336
+ global$c.postMessage(String$1(id), $location.protocol + '//' + $location.host);
1337
+ };
1338
+
1339
+ // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
1340
+ if (!set || !clear) {
1341
+ set = function setImmediate(handler) {
1342
+ validateArgumentsLength(arguments.length, 1);
1343
+ var fn = isCallable$8(handler) ? handler : Function$1(handler);
1344
+ var args = arraySlice(arguments, 1);
1345
+ queue$1[++counter] = function () {
1346
+ apply$1(fn, undefined, args);
1347
+ };
1348
+ defer(counter);
1349
+ return counter;
1350
+ };
1351
+ clear = function clearImmediate(id) {
1352
+ delete queue$1[id];
1353
+ };
1354
+ // Node.js 0.8-
1355
+ if (IS_NODE$4) {
1356
+ defer = function (id) {
1357
+ process$2.nextTick(runner(id));
1358
+ };
1359
+ // Sphere (JS game engine) Dispatch API
1360
+ } else if (Dispatch && Dispatch.now) {
1361
+ defer = function (id) {
1362
+ Dispatch.now(runner(id));
1363
+ };
1364
+ // Browsers with MessageChannel, includes WebWorkers
1365
+ // except iOS - https://github.com/zloirock/core-js/issues/624
1366
+ } else if (MessageChannel && !IS_IOS$1) {
1367
+ channel = new MessageChannel();
1368
+ port = channel.port2;
1369
+ channel.port1.onmessage = listener;
1370
+ defer = bind$3(port.postMessage, port);
1371
+ // Browsers with postMessage, skip WebWorkers
1372
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
1373
+ } else if (
1374
+ global$c.addEventListener &&
1375
+ isCallable$8(global$c.postMessage) &&
1376
+ !global$c.importScripts &&
1377
+ $location && $location.protocol !== 'file:' &&
1378
+ !fails$b(post)
1379
+ ) {
1380
+ defer = post;
1381
+ global$c.addEventListener('message', listener, false);
1382
+ // IE8-
1383
+ } else if (ONREADYSTATECHANGE in createElement('script')) {
1384
+ defer = function (id) {
1385
+ html$1.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
1386
+ html$1.removeChild(this);
1387
+ run(id);
1388
+ };
1389
+ };
1390
+ // Rest old browsers
1391
+ } else {
1392
+ defer = function (id) {
1393
+ setTimeout(runner(id), 0);
1394
+ };
1395
+ }
1396
+ }
1397
+
1398
+ var task$1 = {
1399
+ set: set,
1400
+ clear: clear
1401
+ };
1402
+
1403
+ var userAgent$1 = engineUserAgent;
1404
+ var global$b = global$n;
1405
+
1406
+ var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && global$b.Pebble !== undefined;
1407
+
1408
+ var userAgent = engineUserAgent;
1409
+
1410
+ var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
1411
+
1412
+ var global$a = global$n;
1413
+ var bind$2 = functionBindContext;
1414
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1415
+ var macrotask = task$1.set;
1416
+ var IS_IOS = engineIsIos;
1417
+ var IS_IOS_PEBBLE = engineIsIosPebble;
1418
+ var IS_WEBOS_WEBKIT = engineIsWebosWebkit;
1419
+ var IS_NODE$3 = engineIsNode;
1420
+
1421
+ var MutationObserver = global$a.MutationObserver || global$a.WebKitMutationObserver;
1422
+ var document$2 = global$a.document;
1423
+ var process$1 = global$a.process;
1424
+ var Promise$1 = global$a.Promise;
1425
+ // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
1426
+ var queueMicrotaskDescriptor = getOwnPropertyDescriptor$1(global$a, 'queueMicrotask');
1427
+ var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
1428
+
1429
+ var flush, head, last, notify$1, toggle, node, promise, then;
1430
+
1431
+ // modern engines have queueMicrotask method
1432
+ if (!queueMicrotask) {
1433
+ flush = function () {
1434
+ var parent, fn;
1435
+ if (IS_NODE$3 && (parent = process$1.domain)) parent.exit();
1436
+ while (head) {
1437
+ fn = head.fn;
1438
+ head = head.next;
1439
+ try {
1440
+ fn();
1441
+ } catch (error) {
1442
+ if (head) notify$1();
1443
+ else last = undefined;
1444
+ throw error;
1445
+ }
1446
+ } last = undefined;
1447
+ if (parent) parent.enter();
1448
+ };
1449
+
1450
+ // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
1451
+ // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
1452
+ if (!IS_IOS && !IS_NODE$3 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
1453
+ toggle = true;
1454
+ node = document$2.createTextNode('');
1455
+ new MutationObserver(flush).observe(node, { characterData: true });
1456
+ notify$1 = function () {
1457
+ node.data = toggle = !toggle;
1458
+ };
1459
+ // environments with maybe non-completely correct, but existent Promise
1460
+ } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
1461
+ // Promise.resolve without an argument throws an error in LG WebOS 2
1462
+ promise = Promise$1.resolve(undefined);
1463
+ // workaround of WebKit ~ iOS Safari 10.1 bug
1464
+ promise.constructor = Promise$1;
1465
+ then = bind$2(promise.then, promise);
1466
+ notify$1 = function () {
1467
+ then(flush);
1468
+ };
1469
+ // Node.js without promises
1470
+ } else if (IS_NODE$3) {
1471
+ notify$1 = function () {
1472
+ process$1.nextTick(flush);
1473
+ };
1474
+ // for other environments - macrotask based on:
1475
+ // - setImmediate
1476
+ // - MessageChannel
1477
+ // - window.postMessage
1478
+ // - onreadystatechange
1479
+ // - setTimeout
1480
+ } else {
1481
+ // strange IE + webpack dev server bug - use .bind(global)
1482
+ macrotask = bind$2(macrotask, global$a);
1483
+ notify$1 = function () {
1484
+ macrotask(flush);
1485
+ };
1486
+ }
1487
+ }
1488
+
1489
+ var microtask$1 = queueMicrotask || function (fn) {
1490
+ var task = { fn: fn, next: undefined };
1491
+ if (last) last.next = task;
1492
+ if (!head) {
1493
+ head = task;
1494
+ notify$1();
1495
+ } last = task;
1496
+ };
1497
+
1498
+ var global$9 = global$n;
1499
+
1500
+ var hostReportErrors$1 = function (a, b) {
1501
+ var console = global$9.console;
1502
+ if (console && console.error) {
1503
+ arguments.length == 1 ? console.error(a) : console.error(a, b);
1504
+ }
1505
+ };
1506
+
1507
+ var perform$3 = function (exec) {
1508
+ try {
1509
+ return { error: false, value: exec() };
1510
+ } catch (error) {
1511
+ return { error: true, value: error };
1512
+ }
1513
+ };
1514
+
1515
+ var Queue$1 = function () {
1516
+ this.head = null;
1517
+ this.tail = null;
1518
+ };
1519
+
1520
+ Queue$1.prototype = {
1521
+ add: function (item) {
1522
+ var entry = { item: item, next: null };
1523
+ if (this.head) this.tail.next = entry;
1524
+ else this.head = entry;
1525
+ this.tail = entry;
1526
+ },
1527
+ get: function () {
1528
+ var entry = this.head;
1529
+ if (entry) {
1530
+ this.head = entry.next;
1531
+ if (this.tail === entry) this.tail = null;
1532
+ return entry.item;
1533
+ }
1534
+ }
1535
+ };
1536
+
1537
+ var queue = Queue$1;
1538
+
1539
+ var global$8 = global$n;
1540
+
1541
+ var promiseNativeConstructor = global$8.Promise;
1542
+
1543
+ /* global Deno -- Deno case */
1544
+
1545
+ var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
1546
+
1547
+ var IS_DENO$1 = engineIsDeno;
1548
+ var IS_NODE$2 = engineIsNode;
1549
+
1550
+ var engineIsBrowser = !IS_DENO$1 && !IS_NODE$2
1551
+ && typeof window == 'object'
1552
+ && typeof document == 'object';
1553
+
1554
+ var global$7 = global$n;
1555
+ var NativePromiseConstructor$3 = promiseNativeConstructor;
1556
+ var isCallable$7 = isCallable$m;
1557
+ var isForced = isForced_1;
1558
+ var inspectSource = inspectSource$3;
1559
+ var wellKnownSymbol$b = wellKnownSymbol$i;
1560
+ var IS_BROWSER = engineIsBrowser;
1561
+ var IS_DENO = engineIsDeno;
1562
+ var V8_VERSION = engineV8Version;
1563
+
1564
+ NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
1565
+ var SPECIES$1 = wellKnownSymbol$b('species');
1566
+ var SUBCLASSING = false;
1567
+ var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$7(global$7.PromiseRejectionEvent);
1568
+
1569
+ var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
1570
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
1571
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$3);
1572
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
1573
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
1574
+ // We can't detect it synchronously, so just check versions
1575
+ if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
1576
+ // We can't use @@species feature detection in V8 since it causes
1577
+ // deoptimization and performance degradation
1578
+ // https://github.com/zloirock/core-js/issues/679
1579
+ if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
1580
+ // Detect correctness of subclassing with @@species support
1581
+ var promise = new NativePromiseConstructor$3(function (resolve) { resolve(1); });
1582
+ var FakePromise = function (exec) {
1583
+ exec(function () { /* empty */ }, function () { /* empty */ });
1584
+ };
1585
+ var constructor = promise.constructor = {};
1586
+ constructor[SPECIES$1] = FakePromise;
1587
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
1588
+ if (!SUBCLASSING) return true;
1589
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
1590
+ } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT$1;
1591
+ });
1592
+
1593
+ var promiseConstructorDetection = {
1594
+ CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
1595
+ REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
1596
+ SUBCLASSING: SUBCLASSING
1597
+ };
1598
+
1599
+ var newPromiseCapability$2 = {};
1600
+
1601
+ var aCallable$5 = aCallable$8;
1602
+
1603
+ var $TypeError$5 = TypeError;
1604
+
1605
+ var PromiseCapability = function (C) {
1606
+ var resolve, reject;
1607
+ this.promise = new C(function ($$resolve, $$reject) {
1608
+ if (resolve !== undefined || reject !== undefined) throw $TypeError$5('Bad Promise constructor');
1609
+ resolve = $$resolve;
1610
+ reject = $$reject;
1611
+ });
1612
+ this.resolve = aCallable$5(resolve);
1613
+ this.reject = aCallable$5(reject);
1614
+ };
1615
+
1616
+ // `NewPromiseCapability` abstract operation
1617
+ // https://tc39.es/ecma262/#sec-newpromisecapability
1618
+ newPromiseCapability$2.f = function (C) {
1619
+ return new PromiseCapability(C);
1620
+ };
1621
+
1622
+ var $$d = _export;
1623
+ var IS_NODE$1 = engineIsNode;
1624
+ var global$6 = global$n;
1625
+ var call$b = functionCall;
1626
+ var defineBuiltIn$4 = defineBuiltIn$6;
1627
+ var setPrototypeOf$1 = objectSetPrototypeOf;
1628
+ var setToStringTag$2 = setToStringTag$3;
1629
+ var setSpecies = setSpecies$1;
1630
+ var aCallable$4 = aCallable$8;
1631
+ var isCallable$6 = isCallable$m;
1632
+ var isObject$3 = isObject$9;
1633
+ var anInstance = anInstance$1;
1634
+ var speciesConstructor = speciesConstructor$1;
1635
+ var task = task$1.set;
1636
+ var microtask = microtask$1;
1637
+ var hostReportErrors = hostReportErrors$1;
1638
+ var perform$2 = perform$3;
1639
+ var Queue = queue;
1640
+ var InternalStateModule$1 = internalState;
1641
+ var NativePromiseConstructor$2 = promiseNativeConstructor;
1642
+ var PromiseConstructorDetection = promiseConstructorDetection;
1643
+ var newPromiseCapabilityModule$3 = newPromiseCapability$2;
1644
+
1645
+ var PROMISE = 'Promise';
1646
+ var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR;
1647
+ var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
1648
+ var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
1649
+ var getInternalPromiseState = InternalStateModule$1.getterFor(PROMISE);
1650
+ var setInternalState$1 = InternalStateModule$1.set;
1651
+ var NativePromisePrototype$1 = NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype;
1652
+ var PromiseConstructor = NativePromiseConstructor$2;
1653
+ var PromisePrototype = NativePromisePrototype$1;
1654
+ var TypeError$1 = global$6.TypeError;
1655
+ var document$1 = global$6.document;
1656
+ var process = global$6.process;
1657
+ var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
1658
+ var newGenericPromiseCapability = newPromiseCapability$1;
1659
+
1660
+ var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$6.dispatchEvent);
1661
+ var UNHANDLED_REJECTION = 'unhandledrejection';
1662
+ var REJECTION_HANDLED = 'rejectionhandled';
1663
+ var PENDING = 0;
1664
+ var FULFILLED = 1;
1665
+ var REJECTED = 2;
1666
+ var HANDLED = 1;
1667
+ var UNHANDLED = 2;
1668
+
1669
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
1670
+
1671
+ // helpers
1672
+ var isThenable = function (it) {
1673
+ var then;
1674
+ return isObject$3(it) && isCallable$6(then = it.then) ? then : false;
1675
+ };
1676
+
1677
+ var callReaction = function (reaction, state) {
1678
+ var value = state.value;
1679
+ var ok = state.state == FULFILLED;
1680
+ var handler = ok ? reaction.ok : reaction.fail;
1681
+ var resolve = reaction.resolve;
1682
+ var reject = reaction.reject;
1683
+ var domain = reaction.domain;
1684
+ var result, then, exited;
1685
+ try {
1686
+ if (handler) {
1687
+ if (!ok) {
1688
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
1689
+ state.rejection = HANDLED;
1690
+ }
1691
+ if (handler === true) result = value;
1692
+ else {
1693
+ if (domain) domain.enter();
1694
+ result = handler(value); // can throw
1695
+ if (domain) {
1696
+ domain.exit();
1697
+ exited = true;
1698
+ }
1699
+ }
1700
+ if (result === reaction.promise) {
1701
+ reject(TypeError$1('Promise-chain cycle'));
1702
+ } else if (then = isThenable(result)) {
1703
+ call$b(then, result, resolve, reject);
1704
+ } else resolve(result);
1705
+ } else reject(value);
1706
+ } catch (error) {
1707
+ if (domain && !exited) domain.exit();
1708
+ reject(error);
1709
+ }
1710
+ };
1711
+
1712
+ var notify = function (state, isReject) {
1713
+ if (state.notified) return;
1714
+ state.notified = true;
1715
+ microtask(function () {
1716
+ var reactions = state.reactions;
1717
+ var reaction;
1718
+ while (reaction = reactions.get()) {
1719
+ callReaction(reaction, state);
1720
+ }
1721
+ state.notified = false;
1722
+ if (isReject && !state.rejection) onUnhandled(state);
1723
+ });
1724
+ };
1725
+
1726
+ var dispatchEvent = function (name, promise, reason) {
1727
+ var event, handler;
1728
+ if (DISPATCH_EVENT) {
1729
+ event = document$1.createEvent('Event');
1730
+ event.promise = promise;
1731
+ event.reason = reason;
1732
+ event.initEvent(name, false, true);
1733
+ global$6.dispatchEvent(event);
1734
+ } else event = { promise: promise, reason: reason };
1735
+ if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global$6['on' + name])) handler(event);
1736
+ else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
1737
+ };
1738
+
1739
+ var onUnhandled = function (state) {
1740
+ call$b(task, global$6, function () {
1741
+ var promise = state.facade;
1742
+ var value = state.value;
1743
+ var IS_UNHANDLED = isUnhandled(state);
1744
+ var result;
1745
+ if (IS_UNHANDLED) {
1746
+ result = perform$2(function () {
1747
+ if (IS_NODE$1) {
1748
+ process.emit('unhandledRejection', value, promise);
1749
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
1750
+ });
1751
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
1752
+ state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
1753
+ if (result.error) throw result.value;
1754
+ }
1755
+ });
1756
+ };
1757
+
1758
+ var isUnhandled = function (state) {
1759
+ return state.rejection !== HANDLED && !state.parent;
1760
+ };
1761
+
1762
+ var onHandleUnhandled = function (state) {
1763
+ call$b(task, global$6, function () {
1764
+ var promise = state.facade;
1765
+ if (IS_NODE$1) {
1766
+ process.emit('rejectionHandled', promise);
1767
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
1768
+ });
1769
+ };
1770
+
1771
+ var bind$1 = function (fn, state, unwrap) {
1772
+ return function (value) {
1773
+ fn(state, value, unwrap);
1774
+ };
1775
+ };
1776
+
1777
+ var internalReject = function (state, value, unwrap) {
1778
+ if (state.done) return;
1779
+ state.done = true;
1780
+ if (unwrap) state = unwrap;
1781
+ state.value = value;
1782
+ state.state = REJECTED;
1783
+ notify(state, true);
1784
+ };
1785
+
1786
+ var internalResolve = function (state, value, unwrap) {
1787
+ if (state.done) return;
1788
+ state.done = true;
1789
+ if (unwrap) state = unwrap;
1790
+ try {
1791
+ if (state.facade === value) throw TypeError$1("Promise can't be resolved itself");
1792
+ var then = isThenable(value);
1793
+ if (then) {
1794
+ microtask(function () {
1795
+ var wrapper = { done: false };
1796
+ try {
1797
+ call$b(then, value,
1798
+ bind$1(internalResolve, wrapper, state),
1799
+ bind$1(internalReject, wrapper, state)
1800
+ );
1801
+ } catch (error) {
1802
+ internalReject(wrapper, error, state);
1803
+ }
1804
+ });
1805
+ } else {
1806
+ state.value = value;
1807
+ state.state = FULFILLED;
1808
+ notify(state, false);
1809
+ }
1810
+ } catch (error) {
1811
+ internalReject({ done: false }, error, state);
1812
+ }
1813
+ };
1814
+
1815
+ // constructor polyfill
1816
+ if (FORCED_PROMISE_CONSTRUCTOR$4) {
1817
+ // 25.4.3.1 Promise(executor)
1818
+ PromiseConstructor = function Promise(executor) {
1819
+ anInstance(this, PromisePrototype);
1820
+ aCallable$4(executor);
1821
+ call$b(Internal, this);
1822
+ var state = getInternalPromiseState(this);
1823
+ try {
1824
+ executor(bind$1(internalResolve, state), bind$1(internalReject, state));
1825
+ } catch (error) {
1826
+ internalReject(state, error);
1827
+ }
1828
+ };
1829
+
1830
+ PromisePrototype = PromiseConstructor.prototype;
1831
+
1832
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
1833
+ Internal = function Promise(executor) {
1834
+ setInternalState$1(this, {
1835
+ type: PROMISE,
1836
+ done: false,
1837
+ notified: false,
1838
+ parent: false,
1839
+ reactions: new Queue(),
1840
+ rejection: false,
1841
+ state: PENDING,
1842
+ value: undefined
1843
+ });
1844
+ };
1845
+
1846
+ // `Promise.prototype.then` method
1847
+ // https://tc39.es/ecma262/#sec-promise.prototype.then
1848
+ Internal.prototype = defineBuiltIn$4(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
1849
+ var state = getInternalPromiseState(this);
1850
+ var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
1851
+ state.parent = true;
1852
+ reaction.ok = isCallable$6(onFulfilled) ? onFulfilled : true;
1853
+ reaction.fail = isCallable$6(onRejected) && onRejected;
1854
+ reaction.domain = IS_NODE$1 ? process.domain : undefined;
1855
+ if (state.state == PENDING) state.reactions.add(reaction);
1856
+ else microtask(function () {
1857
+ callReaction(reaction, state);
1858
+ });
1859
+ return reaction.promise;
1860
+ });
1861
+
1862
+ OwnPromiseCapability = function () {
1863
+ var promise = new Internal();
1864
+ var state = getInternalPromiseState(promise);
1865
+ this.promise = promise;
1866
+ this.resolve = bind$1(internalResolve, state);
1867
+ this.reject = bind$1(internalReject, state);
1868
+ };
1869
+
1870
+ newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
1871
+ return C === PromiseConstructor || C === PromiseWrapper
1872
+ ? new OwnPromiseCapability(C)
1873
+ : newGenericPromiseCapability(C);
1874
+ };
1875
+
1876
+ if (isCallable$6(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
1877
+ nativeThen = NativePromisePrototype$1.then;
1878
+
1879
+ if (!NATIVE_PROMISE_SUBCLASSING) {
1880
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
1881
+ defineBuiltIn$4(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
1882
+ var that = this;
1883
+ return new PromiseConstructor(function (resolve, reject) {
1884
+ call$b(nativeThen, that, resolve, reject);
1885
+ }).then(onFulfilled, onRejected);
1886
+ // https://github.com/zloirock/core-js/issues/640
1887
+ }, { unsafe: true });
1888
+ }
1889
+
1890
+ // make `.constructor === Promise` work for native promise-based APIs
1891
+ try {
1892
+ delete NativePromisePrototype$1.constructor;
1893
+ } catch (error) { /* empty */ }
1894
+
1895
+ // make `instanceof Promise` work for native promise-based APIs
1896
+ if (setPrototypeOf$1) {
1897
+ setPrototypeOf$1(NativePromisePrototype$1, PromisePrototype);
1898
+ }
1899
+ }
1900
+ }
1901
+
1902
+ $$d({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
1903
+ Promise: PromiseConstructor
1904
+ });
1905
+
1906
+ setToStringTag$2(PromiseConstructor, PROMISE, false);
1907
+ setSpecies(PROMISE);
1908
+
1909
+ var iterators = {};
1910
+
1911
+ var wellKnownSymbol$a = wellKnownSymbol$i;
1912
+ var Iterators$4 = iterators;
1913
+
1914
+ var ITERATOR$6 = wellKnownSymbol$a('iterator');
1915
+ var ArrayPrototype$1 = Array.prototype;
1916
+
1917
+ // check on default Array iterator
1918
+ var isArrayIteratorMethod$1 = function (it) {
1919
+ return it !== undefined && (Iterators$4.Array === it || ArrayPrototype$1[ITERATOR$6] === it);
1920
+ };
1921
+
1922
+ var classof$3 = classof$5;
1923
+ var getMethod$2 = getMethod$4;
1924
+ var isNullOrUndefined$1 = isNullOrUndefined$5;
1925
+ var Iterators$3 = iterators;
1926
+ var wellKnownSymbol$9 = wellKnownSymbol$i;
1927
+
1928
+ var ITERATOR$5 = wellKnownSymbol$9('iterator');
1929
+
1930
+ var getIteratorMethod$2 = function (it) {
1931
+ if (!isNullOrUndefined$1(it)) return getMethod$2(it, ITERATOR$5)
1932
+ || getMethod$2(it, '@@iterator')
1933
+ || Iterators$3[classof$3(it)];
1934
+ };
1935
+
1936
+ var call$a = functionCall;
1937
+ var aCallable$3 = aCallable$8;
1938
+ var anObject$8 = anObject$d;
1939
+ var tryToString$1 = tryToString$4;
1940
+ var getIteratorMethod$1 = getIteratorMethod$2;
1941
+
1942
+ var $TypeError$4 = TypeError;
1943
+
1944
+ var getIterator$1 = function (argument, usingIterator) {
1945
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
1946
+ if (aCallable$3(iteratorMethod)) return anObject$8(call$a(iteratorMethod, argument));
1947
+ throw $TypeError$4(tryToString$1(argument) + ' is not iterable');
1948
+ };
1949
+
1950
+ var call$9 = functionCall;
1951
+ var anObject$7 = anObject$d;
1952
+ var getMethod$1 = getMethod$4;
1953
+
1954
+ var iteratorClose$1 = function (iterator, kind, value) {
1955
+ var innerResult, innerError;
1956
+ anObject$7(iterator);
1957
+ try {
1958
+ innerResult = getMethod$1(iterator, 'return');
1959
+ if (!innerResult) {
1960
+ if (kind === 'throw') throw value;
1961
+ return value;
1962
+ }
1963
+ innerResult = call$9(innerResult, iterator);
1964
+ } catch (error) {
1965
+ innerError = true;
1966
+ innerResult = error;
1967
+ }
1968
+ if (kind === 'throw') throw value;
1969
+ if (innerError) throw innerResult;
1970
+ anObject$7(innerResult);
1971
+ return value;
1972
+ };
1973
+
1974
+ var bind = functionBindContext;
1975
+ var call$8 = functionCall;
1976
+ var anObject$6 = anObject$d;
1977
+ var tryToString = tryToString$4;
1978
+ var isArrayIteratorMethod = isArrayIteratorMethod$1;
1979
+ var lengthOfArrayLike$1 = lengthOfArrayLike$3;
1980
+ var isPrototypeOf = objectIsPrototypeOf;
1981
+ var getIterator = getIterator$1;
1982
+ var getIteratorMethod = getIteratorMethod$2;
1983
+ var iteratorClose = iteratorClose$1;
1984
+
1985
+ var $TypeError$3 = TypeError;
1986
+
1987
+ var Result = function (stopped, result) {
1988
+ this.stopped = stopped;
1989
+ this.result = result;
1990
+ };
1991
+
1992
+ var ResultPrototype = Result.prototype;
1993
+
1994
+ var iterate$2 = function (iterable, unboundFunction, options) {
1995
+ var that = options && options.that;
1996
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1997
+ var IS_RECORD = !!(options && options.IS_RECORD);
1998
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1999
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
2000
+ var fn = bind(unboundFunction, that);
2001
+ var iterator, iterFn, index, length, result, next, step;
2002
+
2003
+ var stop = function (condition) {
2004
+ if (iterator) iteratorClose(iterator, 'normal', condition);
2005
+ return new Result(true, condition);
2006
+ };
2007
+
2008
+ var callFn = function (value) {
2009
+ if (AS_ENTRIES) {
2010
+ anObject$6(value);
2011
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2012
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
2013
+ };
2014
+
2015
+ if (IS_RECORD) {
2016
+ iterator = iterable.iterator;
2017
+ } else if (IS_ITERATOR) {
2018
+ iterator = iterable;
2019
+ } else {
2020
+ iterFn = getIteratorMethod(iterable);
2021
+ if (!iterFn) throw $TypeError$3(tryToString(iterable) + ' is not iterable');
2022
+ // optimisation for array iterators
2023
+ if (isArrayIteratorMethod(iterFn)) {
2024
+ for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
2025
+ result = callFn(iterable[index]);
2026
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
2027
+ } return new Result(false);
2028
+ }
2029
+ iterator = getIterator(iterable, iterFn);
2030
+ }
2031
+
2032
+ next = IS_RECORD ? iterable.next : iterator.next;
2033
+ while (!(step = call$8(next, iterator)).done) {
2034
+ try {
2035
+ result = callFn(step.value);
2036
+ } catch (error) {
2037
+ iteratorClose(iterator, 'throw', error);
2038
+ }
2039
+ if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
2040
+ } return new Result(false);
2041
+ };
2042
+
2043
+ var wellKnownSymbol$8 = wellKnownSymbol$i;
2044
+
2045
+ var ITERATOR$4 = wellKnownSymbol$8('iterator');
2046
+ var SAFE_CLOSING = false;
2047
+
2048
+ try {
2049
+ var called = 0;
2050
+ var iteratorWithReturn = {
2051
+ next: function () {
2052
+ return { done: !!called++ };
2053
+ },
2054
+ 'return': function () {
2055
+ SAFE_CLOSING = true;
2056
+ }
2057
+ };
2058
+ iteratorWithReturn[ITERATOR$4] = function () {
2059
+ return this;
2060
+ };
2061
+ // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
2062
+ Array.from(iteratorWithReturn, function () { throw 2; });
2063
+ } catch (error) { /* empty */ }
2064
+
2065
+ var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
2066
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
2067
+ var ITERATION_SUPPORT = false;
2068
+ try {
2069
+ var object = {};
2070
+ object[ITERATOR$4] = function () {
2071
+ return {
2072
+ next: function () {
2073
+ return { done: ITERATION_SUPPORT = true };
2074
+ }
2075
+ };
2076
+ };
2077
+ exec(object);
2078
+ } catch (error) { /* empty */ }
2079
+ return ITERATION_SUPPORT;
2080
+ };
2081
+
2082
+ var NativePromiseConstructor$1 = promiseNativeConstructor;
2083
+ var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
2084
+ var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
2085
+
2086
+ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
2087
+ NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
2088
+ });
2089
+
2090
+ var $$c = _export;
2091
+ var call$7 = functionCall;
2092
+ var aCallable$2 = aCallable$8;
2093
+ var newPromiseCapabilityModule$2 = newPromiseCapability$2;
2094
+ var perform$1 = perform$3;
2095
+ var iterate$1 = iterate$2;
2096
+ var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
2097
+
2098
+ // `Promise.all` method
2099
+ // https://tc39.es/ecma262/#sec-promise.all
2100
+ $$c({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
2101
+ all: function all(iterable) {
2102
+ var C = this;
2103
+ var capability = newPromiseCapabilityModule$2.f(C);
2104
+ var resolve = capability.resolve;
2105
+ var reject = capability.reject;
2106
+ var result = perform$1(function () {
2107
+ var $promiseResolve = aCallable$2(C.resolve);
2108
+ var values = [];
2109
+ var counter = 0;
2110
+ var remaining = 1;
2111
+ iterate$1(iterable, function (promise) {
2112
+ var index = counter++;
2113
+ var alreadyCalled = false;
2114
+ remaining++;
2115
+ call$7($promiseResolve, C, promise).then(function (value) {
2116
+ if (alreadyCalled) return;
2117
+ alreadyCalled = true;
2118
+ values[index] = value;
2119
+ --remaining || resolve(values);
2120
+ }, reject);
2121
+ });
2122
+ --remaining || resolve(values);
2123
+ });
2124
+ if (result.error) reject(result.value);
2125
+ return capability.promise;
2126
+ }
2127
+ });
2128
+
2129
+ var $$b = _export;
2130
+ var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
2131
+ var NativePromiseConstructor = promiseNativeConstructor;
2132
+ var getBuiltIn$1 = getBuiltIn$8;
2133
+ var isCallable$5 = isCallable$m;
2134
+ var defineBuiltIn$3 = defineBuiltIn$6;
2135
+
2136
+ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
2137
+
2138
+ // `Promise.prototype.catch` method
2139
+ // https://tc39.es/ecma262/#sec-promise.prototype.catch
2140
+ $$b({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
2141
+ 'catch': function (onRejected) {
2142
+ return this.then(undefined, onRejected);
2143
+ }
2144
+ });
2145
+
2146
+ // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2147
+ if (isCallable$5(NativePromiseConstructor)) {
2148
+ var method = getBuiltIn$1('Promise').prototype['catch'];
2149
+ if (NativePromisePrototype['catch'] !== method) {
2150
+ defineBuiltIn$3(NativePromisePrototype, 'catch', method, { unsafe: true });
2151
+ }
2152
+ }
2153
+
2154
+ var $$a = _export;
2155
+ var call$6 = functionCall;
2156
+ var aCallable$1 = aCallable$8;
2157
+ var newPromiseCapabilityModule$1 = newPromiseCapability$2;
2158
+ var perform = perform$3;
2159
+ var iterate = iterate$2;
2160
+ var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
2161
+
2162
+ // `Promise.race` method
2163
+ // https://tc39.es/ecma262/#sec-promise.race
2164
+ $$a({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
2165
+ race: function race(iterable) {
2166
+ var C = this;
2167
+ var capability = newPromiseCapabilityModule$1.f(C);
2168
+ var reject = capability.reject;
2169
+ var result = perform(function () {
2170
+ var $promiseResolve = aCallable$1(C.resolve);
2171
+ iterate(iterable, function (promise) {
2172
+ call$6($promiseResolve, C, promise).then(capability.resolve, reject);
2173
+ });
2174
+ });
2175
+ if (result.error) reject(result.value);
2176
+ return capability.promise;
2177
+ }
2178
+ });
2179
+
2180
+ var $$9 = _export;
2181
+ var call$5 = functionCall;
2182
+ var newPromiseCapabilityModule = newPromiseCapability$2;
2183
+ var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
2184
+
2185
+ // `Promise.reject` method
2186
+ // https://tc39.es/ecma262/#sec-promise.reject
2187
+ $$9({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2188
+ reject: function reject(r) {
2189
+ var capability = newPromiseCapabilityModule.f(this);
2190
+ call$5(capability.reject, undefined, r);
2191
+ return capability.promise;
2192
+ }
2193
+ });
2194
+
2195
+ var anObject$5 = anObject$d;
2196
+ var isObject$2 = isObject$9;
2197
+ var newPromiseCapability = newPromiseCapability$2;
2198
+
2199
+ var promiseResolve$1 = function (C, x) {
2200
+ anObject$5(C);
2201
+ if (isObject$2(x) && x.constructor === C) return x;
2202
+ var promiseCapability = newPromiseCapability.f(C);
2203
+ var resolve = promiseCapability.resolve;
2204
+ resolve(x);
2205
+ return promiseCapability.promise;
2206
+ };
2207
+
2208
+ var $$8 = _export;
2209
+ var getBuiltIn = getBuiltIn$8;
2210
+ var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
2211
+ var promiseResolve = promiseResolve$1;
2212
+
2213
+ getBuiltIn('Promise');
2214
+
2215
+ // `Promise.resolve` method
2216
+ // https://tc39.es/ecma262/#sec-promise.resolve
2217
+ $$8({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2218
+ resolve: function resolve(x) {
2219
+ return promiseResolve(this, x);
2220
+ }
2221
+ });
2222
+
2223
+ var internalObjectKeys = objectKeysInternal;
2224
+ var enumBugKeys$1 = enumBugKeys$3;
2225
+
2226
+ // `Object.keys` method
2227
+ // https://tc39.es/ecma262/#sec-object.keys
2228
+ // eslint-disable-next-line es/no-object-keys -- safe
2229
+ var objectKeys$2 = Object.keys || function keys(O) {
2230
+ return internalObjectKeys(O, enumBugKeys$1);
2231
+ };
2232
+
2233
+ var DESCRIPTORS$2 = descriptors;
2234
+ var uncurryThis$9 = functionUncurryThis;
2235
+ var call$4 = functionCall;
2236
+ var fails$a = fails$l;
2237
+ var objectKeys$1 = objectKeys$2;
2238
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
2239
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
2240
+ var toObject$3 = toObject$5;
2241
+ var IndexedObject$1 = indexedObject;
2242
+
2243
+ // eslint-disable-next-line es/no-object-assign -- safe
2244
+ var $assign = Object.assign;
2245
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
2246
+ var defineProperty$2 = Object.defineProperty;
2247
+ var concat$1 = uncurryThis$9([].concat);
2248
+
2249
+ // `Object.assign` method
2250
+ // https://tc39.es/ecma262/#sec-object.assign
2251
+ var objectAssign = !$assign || fails$a(function () {
2252
+ // should have correct order of operations (Edge bug)
2253
+ if (DESCRIPTORS$2 && $assign({ b: 1 }, $assign(defineProperty$2({}, 'a', {
2254
+ enumerable: true,
2255
+ get: function () {
2256
+ defineProperty$2(this, 'b', {
2257
+ value: 3,
2258
+ enumerable: false
2259
+ });
2260
+ }
2261
+ }), { b: 2 })).b !== 1) return true;
2262
+ // should work with symbols and should have deterministic property order (V8 bug)
2263
+ var A = {};
2264
+ var B = {};
2265
+ // eslint-disable-next-line es/no-symbol -- safe
2266
+ var symbol = Symbol();
2267
+ var alphabet = 'abcdefghijklmnopqrst';
2268
+ A[symbol] = 7;
2269
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
2270
+ return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet;
2271
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
2272
+ var T = toObject$3(target);
2273
+ var argumentsLength = arguments.length;
2274
+ var index = 1;
2275
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
2276
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
2277
+ while (argumentsLength > index) {
2278
+ var S = IndexedObject$1(arguments[index++]);
2279
+ var keys = getOwnPropertySymbols ? concat$1(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S);
2280
+ var length = keys.length;
2281
+ var j = 0;
2282
+ var key;
2283
+ while (length > j) {
2284
+ key = keys[j++];
2285
+ if (!DESCRIPTORS$2 || call$4(propertyIsEnumerable, S, key)) T[key] = S[key];
2286
+ }
2287
+ } return T;
2288
+ } : $assign;
2289
+
2290
+ var $$7 = _export;
2291
+ var assign = objectAssign;
2292
+
2293
+ // `Object.assign` method
2294
+ // https://tc39.es/ecma262/#sec-object.assign
2295
+ // eslint-disable-next-line es/no-object-assign -- required for testing
2296
+ $$7({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
2297
+ assign: assign
2298
+ });
2299
+
2300
+ var objectDefineProperties = {};
2301
+
2302
+ var DESCRIPTORS$1 = descriptors;
2303
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
2304
+ var definePropertyModule = objectDefineProperty;
2305
+ var anObject$4 = anObject$d;
2306
+ var toIndexedObject$1 = toIndexedObject$5;
2307
+ var objectKeys = objectKeys$2;
2308
+
2309
+ // `Object.defineProperties` method
2310
+ // https://tc39.es/ecma262/#sec-object.defineproperties
2311
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
2312
+ objectDefineProperties.f = DESCRIPTORS$1 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
2313
+ anObject$4(O);
2314
+ var props = toIndexedObject$1(Properties);
2315
+ var keys = objectKeys(Properties);
2316
+ var length = keys.length;
2317
+ var index = 0;
2318
+ var key;
2319
+ while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
2320
+ return O;
2321
+ };
2322
+
2323
+ /* global ActiveXObject -- old IE, WSH */
2324
+
2325
+ var anObject$3 = anObject$d;
2326
+ var definePropertiesModule = objectDefineProperties;
2327
+ var enumBugKeys = enumBugKeys$3;
2328
+ var hiddenKeys = hiddenKeys$4;
2329
+ var html = html$2;
2330
+ var documentCreateElement$1 = documentCreateElement$2;
2331
+ var sharedKey$1 = sharedKey$3;
2332
+
2333
+ var GT = '>';
2334
+ var LT = '<';
2335
+ var PROTOTYPE = 'prototype';
2336
+ var SCRIPT = 'script';
2337
+ var IE_PROTO$1 = sharedKey$1('IE_PROTO');
2338
+
2339
+ var EmptyConstructor = function () { /* empty */ };
2340
+
2341
+ var scriptTag = function (content) {
2342
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2343
+ };
2344
+
2345
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2346
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
2347
+ activeXDocument.write(scriptTag(''));
2348
+ activeXDocument.close();
2349
+ var temp = activeXDocument.parentWindow.Object;
2350
+ activeXDocument = null; // avoid memory leak
2351
+ return temp;
2352
+ };
2353
+
2354
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
2355
+ var NullProtoObjectViaIFrame = function () {
2356
+ // Thrash, waste and sodomy: IE GC bug
2357
+ var iframe = documentCreateElement$1('iframe');
2358
+ var JS = 'java' + SCRIPT + ':';
2359
+ var iframeDocument;
2360
+ iframe.style.display = 'none';
2361
+ html.appendChild(iframe);
2362
+ // https://github.com/zloirock/core-js/issues/475
2363
+ iframe.src = String(JS);
2364
+ iframeDocument = iframe.contentWindow.document;
2365
+ iframeDocument.open();
2366
+ iframeDocument.write(scriptTag('document.F=Object'));
2367
+ iframeDocument.close();
2368
+ return iframeDocument.F;
2369
+ };
2370
+
2371
+ // Check for document.domain and active x support
2372
+ // No need to use active x approach when document.domain is not set
2373
+ // see https://github.com/es-shims/es5-shim/issues/150
2374
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2375
+ // avoid IE GC bug
2376
+ var activeXDocument;
2377
+ var NullProtoObject = function () {
2378
+ try {
2379
+ activeXDocument = new ActiveXObject('htmlfile');
2380
+ } catch (error) { /* ignore */ }
2381
+ NullProtoObject = typeof document != 'undefined'
2382
+ ? document.domain && activeXDocument
2383
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2384
+ : NullProtoObjectViaIFrame()
2385
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
2386
+ var length = enumBugKeys.length;
2387
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2388
+ return NullProtoObject();
2389
+ };
2390
+
2391
+ hiddenKeys[IE_PROTO$1] = true;
2392
+
2393
+ // `Object.create` method
2394
+ // https://tc39.es/ecma262/#sec-object.create
2395
+ // eslint-disable-next-line es/no-object-create -- safe
2396
+ var objectCreate = Object.create || function create(O, Properties) {
2397
+ var result;
2398
+ if (O !== null) {
2399
+ EmptyConstructor[PROTOTYPE] = anObject$3(O);
2400
+ result = new EmptyConstructor();
2401
+ EmptyConstructor[PROTOTYPE] = null;
2402
+ // add "__proto__" for Object.getPrototypeOf polyfill
2403
+ result[IE_PROTO$1] = O;
2404
+ } else result = NullProtoObject();
2405
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2406
+ };
2407
+
2408
+ var wellKnownSymbol$7 = wellKnownSymbol$i;
2409
+ var create$2 = objectCreate;
2410
+ var defineProperty$1 = objectDefineProperty.f;
2411
+
2412
+ var UNSCOPABLES = wellKnownSymbol$7('unscopables');
2413
+ var ArrayPrototype = Array.prototype;
2414
+
2415
+ // Array.prototype[@@unscopables]
2416
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2417
+ if (ArrayPrototype[UNSCOPABLES] == undefined) {
2418
+ defineProperty$1(ArrayPrototype, UNSCOPABLES, {
2419
+ configurable: true,
2420
+ value: create$2(null)
2421
+ });
2422
+ }
2423
+
2424
+ // add a key to Array.prototype[@@unscopables]
2425
+ var addToUnscopables$2 = function (key) {
2426
+ ArrayPrototype[UNSCOPABLES][key] = true;
2427
+ };
2428
+
2429
+ var $$6 = _export;
2430
+ var $includes = arrayIncludes.includes;
2431
+ var fails$9 = fails$l;
2432
+ var addToUnscopables$1 = addToUnscopables$2;
2433
+
2434
+ // FF99+ bug
2435
+ var BROKEN_ON_SPARSE = fails$9(function () {
2436
+ return !Array(1).includes();
2437
+ });
2438
+
2439
+ // `Array.prototype.includes` method
2440
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
2441
+ $$6({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
2442
+ includes: function includes(el /* , fromIndex = 0 */) {
2443
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
2444
+ }
2445
+ });
2446
+
2447
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2448
+ addToUnscopables$1('includes');
2449
+
2450
+ var isObject$1 = isObject$9;
2451
+ var classof$2 = classofRaw$2;
2452
+ var wellKnownSymbol$6 = wellKnownSymbol$i;
2453
+
2454
+ var MATCH$1 = wellKnownSymbol$6('match');
2455
+
2456
+ // `IsRegExp` abstract operation
2457
+ // https://tc39.es/ecma262/#sec-isregexp
2458
+ var isRegexp = function (it) {
2459
+ var isRegExp;
2460
+ return isObject$1(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$2(it) == 'RegExp');
2461
+ };
2462
+
2463
+ var isRegExp = isRegexp;
2464
+
2465
+ var $TypeError$2 = TypeError;
2466
+
2467
+ var notARegexp = function (it) {
2468
+ if (isRegExp(it)) {
2469
+ throw $TypeError$2("The method doesn't accept regular expressions");
2470
+ } return it;
2471
+ };
2472
+
2473
+ var classof$1 = classof$5;
2474
+
2475
+ var $String = String;
2476
+
2477
+ var toString$7 = function (argument) {
2478
+ if (classof$1(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
2479
+ return $String(argument);
2480
+ };
2481
+
2482
+ var wellKnownSymbol$5 = wellKnownSymbol$i;
2483
+
2484
+ var MATCH = wellKnownSymbol$5('match');
2485
+
2486
+ var correctIsRegexpLogic = function (METHOD_NAME) {
2487
+ var regexp = /./;
2488
+ try {
2489
+ '/./'[METHOD_NAME](regexp);
2490
+ } catch (error1) {
2491
+ try {
2492
+ regexp[MATCH] = false;
2493
+ return '/./'[METHOD_NAME](regexp);
2494
+ } catch (error2) { /* empty */ }
2495
+ } return false;
2496
+ };
2497
+
2498
+ var $$5 = _export;
2499
+ var uncurryThis$8 = functionUncurryThis;
2500
+ var notARegExp$1 = notARegexp;
2501
+ var requireObjectCoercible$4 = requireObjectCoercible$7;
2502
+ var toString$6 = toString$7;
2503
+ var correctIsRegExpLogic$1 = correctIsRegexpLogic;
2504
+
2505
+ var stringIndexOf$1 = uncurryThis$8(''.indexOf);
2506
+
2507
+ // `String.prototype.includes` method
2508
+ // https://tc39.es/ecma262/#sec-string.prototype.includes
2509
+ $$5({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
2510
+ includes: function includes(searchString /* , position = 0 */) {
2511
+ return !!~stringIndexOf$1(
2512
+ toString$6(requireObjectCoercible$4(this)),
2513
+ toString$6(notARegExp$1(searchString)),
2514
+ arguments.length > 1 ? arguments[1] : undefined
2515
+ );
2516
+ }
2517
+ });
2518
+
2519
+ /******************************************************************************
2520
+ Copyright (c) Microsoft Corporation.
2521
+
2522
+ Permission to use, copy, modify, and/or distribute this software for any
2523
+ purpose with or without fee is hereby granted.
2524
+
2525
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2526
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2527
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2528
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2529
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2530
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2531
+ PERFORMANCE OF THIS SOFTWARE.
2532
+ ***************************************************************************** */
2533
+
2534
+ function __awaiter(thisArg, _arguments, P, generator) {
2535
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2536
+ return new (P || (P = Promise))(function (resolve, reject) {
2537
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2538
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2539
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2540
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2541
+ });
2542
+ }
2543
+
2544
+ const buildClientLocale = () => navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
2545
+
2546
+ const buildClientNinetailedRequestContext = () => ({
2547
+ url: window.location.href,
2548
+ referrer: document.referrer,
2549
+ locale: buildClientLocale(),
2550
+ userAgent: navigator.userAgent,
2551
+ document: {
2552
+ title: document.title
2553
+ }
2554
+ });
2555
+
2556
+ /**
2557
+ * Similar to _.throttle but waits for the promise to resolve. There is no
2558
+ * wait time because you can simply await `Promise.timeout` inside `fn`
2559
+ * to wait some time before the next call.
2560
+ */
2561
+ function asyncThrottle(fn) {
2562
+ let runningPromise;
2563
+ let queuedPromise;
2564
+ let nextArgs;
2565
+ return args => __awaiter(this, void 0, void 0, function* () {
2566
+ if (runningPromise) {
2567
+ nextArgs = args;
2568
+ if (queuedPromise) {
2569
+ return queuedPromise;
2570
+ } else {
2571
+ queuedPromise = runningPromise.then(() => {
2572
+ queuedPromise = undefined;
2573
+ runningPromise = fn(nextArgs);
2574
+ return runningPromise;
2575
+ });
2576
+ return queuedPromise;
2577
+ }
2578
+ } else {
2579
+ runningPromise = fn(args);
2580
+ return runningPromise;
2581
+ }
2582
+ });
2583
+ }
2584
+
2585
+ const LEGACY_ANONYMOUS_ID = '__anon_id';
2586
+ const ANONYMOUS_ID = '__nt_anonymous_id__';
2587
+ const DEBUG_FLAG = '__nt_debug__';
2588
+ const PROFILE_FALLBACK_CACHE = '__nt_profile__';
2589
+
2590
+ const NINETAILED_TRACKER_EVENTS = {
2591
+ /**
2592
+ * `profile` - Fires when the profile is returned by the cdp API.
2593
+ */
2594
+ profile: 'profile',
2595
+ /**
2596
+ * `reset` - gets fired when the profile gets reset, so other plugins can react.
2597
+ */
2598
+ reset: 'reset-profile'
2599
+ };
2600
+ const PLUGIN_NAME = 'ninetailed';
2601
+ const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
2602
+ const ninetailedPlugin = ({
2603
+ clientId,
2604
+ environment,
2605
+ preview: _preview = false,
2606
+ url,
2607
+ profile,
2608
+ locale
2609
+ }) => {
2610
+ const apiClient = new experience_jsShared.NinetailedApiClient({
2611
+ clientId,
2612
+ environment,
2613
+ url
2614
+ });
2615
+ let queue = [];
2616
+ const flush = instance => __awaiter(void 0, void 0, void 0, function* () {
2617
+ const events = Object.assign([], queue);
2618
+ experience_jsShared.logger.info('Start flushing events.');
2619
+ queue = [];
2620
+ if (!events.length) {
2621
+ return;
2622
+ }
2623
+ try {
2624
+ const anonymousId = instance.storage.getItem(ANONYMOUS_ID);
2625
+ const profile = yield apiClient.upsertProfile({
2626
+ profileId: anonymousId,
2627
+ events
2628
+ }, {
2629
+ locale
2630
+ });
2631
+ instance.storage.setItem(ANONYMOUS_ID, profile.id);
2632
+ instance.storage.setItem(PROFILE_FALLBACK_CACHE, profile);
2633
+ experience_jsShared.logger.debug('Profile from api: ', profile);
2634
+ instance.dispatch({
2635
+ type: NINETAILED_TRACKER_EVENTS.profile,
2636
+ profile
2637
+ });
2638
+ } catch (error) {
2639
+ experience_jsShared.logger.debug('An error occurred during flushing the events: ', error);
2640
+ const fallbackProfile = instance.storage.getItem(PROFILE_FALLBACK_CACHE);
2641
+ if (fallbackProfile) {
2642
+ experience_jsShared.logger.debug('Found a fallback profile - will use this.');
2643
+ instance.dispatch({
2644
+ type: NINETAILED_TRACKER_EVENTS.profile,
2645
+ profile: fallbackProfile
2646
+ });
2647
+ } else {
2648
+ experience_jsShared.logger.debug('No fallback profile found - setting profile to null.');
2649
+ instance.dispatch({
2650
+ type: NINETAILED_TRACKER_EVENTS.profile,
2651
+ profile: null,
2652
+ error
2653
+ });
2654
+ }
2655
+ }
2656
+ // This is necessary to make sure that the cache is updated before the next flush is performed
2657
+ yield delay(20);
2658
+ });
2659
+ const throttledFlush = asyncThrottle(flush);
2660
+ const enqueueEvent = (event, instance) => __awaiter(void 0, void 0, void 0, function* () {
2661
+ queue = unionBy__default["default"]([event], queue, 'messageId');
2662
+ throttledFlush(instance);
2663
+ });
2664
+ const abortNonClientEvents = ({
2665
+ abort,
2666
+ payload
2667
+ }) => {
2668
+ if (typeof window !== 'object') {
2669
+ return abort();
2670
+ }
2671
+ return payload;
2672
+ };
2673
+ return {
2674
+ name: 'ninetailed',
2675
+ config: {},
2676
+ initialize: ({
2677
+ instance
2678
+ }) => {
2679
+ if (instance.storage.getItem(DEBUG_FLAG)) {
2680
+ experience_jsShared.logger.addSink(new experience_jsShared.ConsoleLogSink());
2681
+ experience_jsShared.logger.info('Ninetailed Debug Mode is enabled.');
2682
+ }
2683
+ // legacy support for the old anonymousId
2684
+ const legacyAnonymousId = instance.storage.getItem(LEGACY_ANONYMOUS_ID);
2685
+ if (legacyAnonymousId) {
2686
+ experience_jsShared.logger.debug('Found legacy anonymousId, migrating to new one.', legacyAnonymousId);
2687
+ instance.storage.setItem(ANONYMOUS_ID, legacyAnonymousId);
2688
+ instance.storage.removeItem(LEGACY_ANONYMOUS_ID);
2689
+ }
2690
+ if (profile) {
2691
+ instance.storage.setItem(ANONYMOUS_ID, profile.id);
2692
+ }
2693
+ experience_jsShared.logger.debug('Ninetailed Core plugin initialized.');
2694
+ },
2695
+ pageStart: params => {
2696
+ return abortNonClientEvents(params);
2697
+ },
2698
+ page: ({
2699
+ payload,
2700
+ instance
2701
+ }) => __awaiter(void 0, void 0, void 0, function* () {
2702
+ experience_jsShared.logger.info('Sending Page event.');
2703
+ const ctx = buildClientNinetailedRequestContext();
2704
+ yield enqueueEvent(experience_jsShared.buildPageEvent({
2705
+ messageId: payload.meta.rid,
2706
+ timestamp: payload.meta.ts,
2707
+ properties: payload.properties,
2708
+ ctx
2709
+ }), instance);
2710
+ }),
2711
+ trackStart: params => {
2712
+ return abortNonClientEvents(params);
2713
+ },
2714
+ track: ({
2715
+ payload,
2716
+ instance
2717
+ }) => __awaiter(void 0, void 0, void 0, function* () {
2718
+ experience_jsShared.logger.info('Sending Track event.');
2719
+ const ctx = buildClientNinetailedRequestContext();
2720
+ yield enqueueEvent(experience_jsShared.buildTrackEvent({
2721
+ messageId: payload.meta.rid,
2722
+ timestamp: payload.meta.ts,
2723
+ event: payload.event,
2724
+ properties: payload.properties,
2725
+ ctx
2726
+ }), instance);
2727
+ }),
2728
+ identifyStart: params => {
2729
+ return abortNonClientEvents(params);
2730
+ },
2731
+ identify: ({
2732
+ payload,
2733
+ instance
2734
+ }) => __awaiter(void 0, void 0, void 0, function* () {
2735
+ experience_jsShared.logger.info('Sending Identify event.');
2736
+ const ctx = buildClientNinetailedRequestContext();
2737
+ yield enqueueEvent(experience_jsShared.buildIdentifyEvent({
2738
+ // doing this here as the anonymous id is set to late from init
2739
+ messageId: payload.meta.rid,
2740
+ timestamp: payload.meta.ts,
2741
+ traits: payload.traits,
2742
+ userId: payload.userId,
2743
+ ctx
2744
+ }), instance);
2745
+ }),
2746
+ setItemStart: ({
2747
+ abort,
2748
+ payload
2749
+ }) => {
2750
+ if (![ANONYMOUS_ID, DEBUG_FLAG, PROFILE_FALLBACK_CACHE].includes(payload.key)) {
2751
+ return abort();
2752
+ }
2753
+ return payload;
2754
+ },
2755
+ methods: {
2756
+ reset: (...args) => __awaiter(void 0, void 0, void 0, function* () {
2757
+ // TODO it seems reset gets called during Next.js SSR builds. Need to verify that.
2758
+ experience_jsShared.logger.debug('Resetting profile.');
2759
+ const instance = args[args.length - 1];
2760
+ instance.dispatch({
2761
+ type: NINETAILED_TRACKER_EVENTS.reset
2762
+ });
2763
+ yield instance.storage.removeItem(ANONYMOUS_ID);
2764
+ yield instance.storage.removeItem(PROFILE_FALLBACK_CACHE);
2765
+ experience_jsShared.logger.debug('Removed old profile data from localstorage.');
2766
+ // sending a new page event, when no anonymousId is set will create a new profile.
2767
+ yield instance.page();
2768
+ experience_jsShared.logger.info('Profile reset successful.');
2769
+ yield delay(10);
2770
+ }),
2771
+ debug: (...args) => __awaiter(void 0, void 0, void 0, function* () {
2772
+ const enabled = args[0];
2773
+ const instance = args[args.length - 1];
2774
+ const consoleLogSink = new experience_jsShared.ConsoleLogSink();
2775
+ if (enabled) {
2776
+ yield instance.storage.setItem(DEBUG_FLAG, true);
2777
+ experience_jsShared.logger.addSink(consoleLogSink);
2778
+ experience_jsShared.logger.info('Debug mode enabled.');
2779
+ } else {
2780
+ yield instance.storage.removeItem(DEBUG_FLAG);
2781
+ experience_jsShared.logger.info('Debug mode disabled.');
2782
+ experience_jsShared.logger.removeSink(consoleLogSink.name);
2783
+ }
2784
+ })
2785
+ }
2786
+ };
2787
+ };
2788
+
2789
+ var fails$8 = fails$l;
2790
+
2791
+ var correctPrototypeGetter = !fails$8(function () {
2792
+ function F() { /* empty */ }
2793
+ F.prototype.constructor = null;
2794
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
2795
+ return Object.getPrototypeOf(new F()) !== F.prototype;
2796
+ });
2797
+
2798
+ var hasOwn = hasOwnProperty_1;
2799
+ var isCallable$4 = isCallable$m;
2800
+ var toObject$2 = toObject$5;
2801
+ var sharedKey = sharedKey$3;
2802
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
2803
+
2804
+ var IE_PROTO = sharedKey('IE_PROTO');
2805
+ var $Object = Object;
2806
+ var ObjectPrototype = $Object.prototype;
2807
+
2808
+ // `Object.getPrototypeOf` method
2809
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
2810
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
2811
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
2812
+ var object = toObject$2(O);
2813
+ if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
2814
+ var constructor = object.constructor;
2815
+ if (isCallable$4(constructor) && object instanceof constructor) {
2816
+ return constructor.prototype;
2817
+ } return object instanceof $Object ? ObjectPrototype : null;
2818
+ };
2819
+
2820
+ var fails$7 = fails$l;
2821
+ var isCallable$3 = isCallable$m;
2822
+ var isObject = isObject$9;
2823
+ var getPrototypeOf$1 = objectGetPrototypeOf;
2824
+ var defineBuiltIn$2 = defineBuiltIn$6;
2825
+ var wellKnownSymbol$4 = wellKnownSymbol$i;
2826
+
2827
+ var ITERATOR$3 = wellKnownSymbol$4('iterator');
2828
+ var BUGGY_SAFARI_ITERATORS$1 = false;
2829
+
2830
+ // `%IteratorPrototype%` object
2831
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
2832
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
2833
+
2834
+ /* eslint-disable es/no-array-prototype-keys -- safe */
2835
+ if ([].keys) {
2836
+ arrayIterator = [].keys();
2837
+ // Safari 8 has buggy iterators w/o `next`
2838
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
2839
+ else {
2840
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
2841
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
2842
+ }
2843
+ }
2844
+
2845
+ var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype$2) || fails$7(function () {
2846
+ var test = {};
2847
+ // FF44- legacy iterators case
2848
+ return IteratorPrototype$2[ITERATOR$3].call(test) !== test;
2849
+ });
2850
+
2851
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
2852
+
2853
+ // `%IteratorPrototype%[@@iterator]()` method
2854
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
2855
+ if (!isCallable$3(IteratorPrototype$2[ITERATOR$3])) {
2856
+ defineBuiltIn$2(IteratorPrototype$2, ITERATOR$3, function () {
2857
+ return this;
2858
+ });
2859
+ }
2860
+
2861
+ var iteratorsCore = {
2862
+ IteratorPrototype: IteratorPrototype$2,
2863
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
2864
+ };
2865
+
2866
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
2867
+ var create$1 = objectCreate;
2868
+ var createPropertyDescriptor = createPropertyDescriptor$3;
2869
+ var setToStringTag$1 = setToStringTag$3;
2870
+ var Iterators$2 = iterators;
2871
+
2872
+ var returnThis$1 = function () { return this; };
2873
+
2874
+ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
2875
+ var TO_STRING_TAG = NAME + ' Iterator';
2876
+ IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
2877
+ setToStringTag$1(IteratorConstructor, TO_STRING_TAG, false);
2878
+ Iterators$2[TO_STRING_TAG] = returnThis$1;
2879
+ return IteratorConstructor;
2880
+ };
2881
+
2882
+ var $$4 = _export;
2883
+ var call$3 = functionCall;
2884
+ var FunctionName = functionName;
2885
+ var isCallable$2 = isCallable$m;
2886
+ var createIteratorConstructor = iteratorCreateConstructor;
2887
+ var getPrototypeOf = objectGetPrototypeOf;
2888
+ var setPrototypeOf = objectSetPrototypeOf;
2889
+ var setToStringTag = setToStringTag$3;
2890
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
2891
+ var defineBuiltIn$1 = defineBuiltIn$6;
2892
+ var wellKnownSymbol$3 = wellKnownSymbol$i;
2893
+ var Iterators$1 = iterators;
2894
+ var IteratorsCore = iteratorsCore;
2895
+
2896
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
2897
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
2898
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
2899
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
2900
+ var ITERATOR$2 = wellKnownSymbol$3('iterator');
2901
+ var KEYS = 'keys';
2902
+ var VALUES = 'values';
2903
+ var ENTRIES = 'entries';
2904
+
2905
+ var returnThis = function () { return this; };
2906
+
2907
+ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
2908
+ createIteratorConstructor(IteratorConstructor, NAME, next);
2909
+
2910
+ var getIterationMethod = function (KIND) {
2911
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
2912
+ if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
2913
+ switch (KIND) {
2914
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
2915
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
2916
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
2917
+ } return function () { return new IteratorConstructor(this); };
2918
+ };
2919
+
2920
+ var TO_STRING_TAG = NAME + ' Iterator';
2921
+ var INCORRECT_VALUES_NAME = false;
2922
+ var IterablePrototype = Iterable.prototype;
2923
+ var nativeIterator = IterablePrototype[ITERATOR$2]
2924
+ || IterablePrototype['@@iterator']
2925
+ || DEFAULT && IterablePrototype[DEFAULT];
2926
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
2927
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
2928
+ var CurrentIteratorPrototype, methods, KEY;
2929
+
2930
+ // fix native
2931
+ if (anyNativeIterator) {
2932
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
2933
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
2934
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
2935
+ if (setPrototypeOf) {
2936
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
2937
+ } else if (!isCallable$2(CurrentIteratorPrototype[ITERATOR$2])) {
2938
+ defineBuiltIn$1(CurrentIteratorPrototype, ITERATOR$2, returnThis);
2939
+ }
2940
+ }
2941
+ // Set @@toStringTag to native iterators
2942
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
2943
+ }
2944
+ }
2945
+
2946
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
2947
+ if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
2948
+ if (CONFIGURABLE_FUNCTION_NAME) {
2949
+ createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
2950
+ } else {
2951
+ INCORRECT_VALUES_NAME = true;
2952
+ defaultIterator = function values() { return call$3(nativeIterator, this); };
2953
+ }
2954
+ }
2955
+
2956
+ // export additional methods
2957
+ if (DEFAULT) {
2958
+ methods = {
2959
+ values: getIterationMethod(VALUES),
2960
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
2961
+ entries: getIterationMethod(ENTRIES)
2962
+ };
2963
+ if (FORCED) for (KEY in methods) {
2964
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
2965
+ defineBuiltIn$1(IterablePrototype, KEY, methods[KEY]);
2966
+ }
2967
+ } else $$4({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
2968
+ }
2969
+
2970
+ // define iterator
2971
+ if (IterablePrototype[ITERATOR$2] !== defaultIterator) {
2972
+ defineBuiltIn$1(IterablePrototype, ITERATOR$2, defaultIterator, { name: DEFAULT });
2973
+ }
2974
+ Iterators$1[NAME] = defaultIterator;
2975
+
2976
+ return methods;
2977
+ };
2978
+
2979
+ // `CreateIterResultObject` abstract operation
2980
+ // https://tc39.es/ecma262/#sec-createiterresultobject
2981
+ var createIterResultObject$1 = function (value, done) {
2982
+ return { value: value, done: done };
2983
+ };
2984
+
2985
+ var toIndexedObject = toIndexedObject$5;
2986
+ var addToUnscopables = addToUnscopables$2;
2987
+ var Iterators = iterators;
2988
+ var InternalStateModule = internalState;
2989
+ var defineProperty = objectDefineProperty.f;
2990
+ var defineIterator = iteratorDefine;
2991
+ var createIterResultObject = createIterResultObject$1;
2992
+ var DESCRIPTORS = descriptors;
2993
+
2994
+ var ARRAY_ITERATOR = 'Array Iterator';
2995
+ var setInternalState = InternalStateModule.set;
2996
+ var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
2997
+
2998
+ // `Array.prototype.entries` method
2999
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
3000
+ // `Array.prototype.keys` method
3001
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
3002
+ // `Array.prototype.values` method
3003
+ // https://tc39.es/ecma262/#sec-array.prototype.values
3004
+ // `Array.prototype[@@iterator]` method
3005
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
3006
+ // `CreateArrayIterator` internal method
3007
+ // https://tc39.es/ecma262/#sec-createarrayiterator
3008
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
3009
+ setInternalState(this, {
3010
+ type: ARRAY_ITERATOR,
3011
+ target: toIndexedObject(iterated), // target
3012
+ index: 0, // next index
3013
+ kind: kind // kind
3014
+ });
3015
+ // `%ArrayIteratorPrototype%.next` method
3016
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
3017
+ }, function () {
3018
+ var state = getInternalState$1(this);
3019
+ var target = state.target;
3020
+ var kind = state.kind;
3021
+ var index = state.index++;
3022
+ if (!target || index >= target.length) {
3023
+ state.target = undefined;
3024
+ return createIterResultObject(undefined, true);
3025
+ }
3026
+ if (kind == 'keys') return createIterResultObject(index, false);
3027
+ if (kind == 'values') return createIterResultObject(target[index], false);
3028
+ return createIterResultObject([index, target[index]], false);
3029
+ }, 'values');
3030
+
3031
+ // argumentsList[@@iterator] is %ArrayProto_values%
3032
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
3033
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
3034
+ var values = Iterators.Arguments = Iterators.Array;
3035
+
3036
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
3037
+ addToUnscopables('keys');
3038
+ addToUnscopables('values');
3039
+ addToUnscopables('entries');
3040
+
3041
+ // V8 ~ Chrome 45- bug
3042
+ if (DESCRIPTORS && values.name !== 'values') try {
3043
+ defineProperty(values, 'name', { value: 'values' });
3044
+ } catch (error) { /* empty */ }
3045
+
3046
+ // iterable DOM collections
3047
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
3048
+ var domIterables = {
3049
+ CSSRuleList: 0,
3050
+ CSSStyleDeclaration: 0,
3051
+ CSSValueList: 0,
3052
+ ClientRectList: 0,
3053
+ DOMRectList: 0,
3054
+ DOMStringList: 0,
3055
+ DOMTokenList: 1,
3056
+ DataTransferItemList: 0,
3057
+ FileList: 0,
3058
+ HTMLAllCollection: 0,
3059
+ HTMLCollection: 0,
3060
+ HTMLFormElement: 0,
3061
+ HTMLSelectElement: 0,
3062
+ MediaList: 0,
3063
+ MimeTypeArray: 0,
3064
+ NamedNodeMap: 0,
3065
+ NodeList: 1,
3066
+ PaintRequestList: 0,
3067
+ Plugin: 0,
3068
+ PluginArray: 0,
3069
+ SVGLengthList: 0,
3070
+ SVGNumberList: 0,
3071
+ SVGPathSegList: 0,
3072
+ SVGPointList: 0,
3073
+ SVGStringList: 0,
3074
+ SVGTransformList: 0,
3075
+ SourceBufferList: 0,
3076
+ StyleSheetList: 0,
3077
+ TextTrackCueList: 0,
3078
+ TextTrackList: 0,
3079
+ TouchList: 0
3080
+ };
3081
+
3082
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
3083
+ var documentCreateElement = documentCreateElement$2;
3084
+
3085
+ var classList = documentCreateElement('span').classList;
3086
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
3087
+
3088
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
3089
+
3090
+ var global$5 = global$n;
3091
+ var DOMIterables = domIterables;
3092
+ var DOMTokenListPrototype = domTokenListPrototype;
3093
+ var ArrayIteratorMethods = es_array_iterator;
3094
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
3095
+ var wellKnownSymbol$2 = wellKnownSymbol$i;
3096
+
3097
+ var ITERATOR$1 = wellKnownSymbol$2('iterator');
3098
+ var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
3099
+ var ArrayValues = ArrayIteratorMethods.values;
3100
+
3101
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
3102
+ if (CollectionPrototype) {
3103
+ // some Chrome versions have non-configurable methods on DOMTokenList
3104
+ if (CollectionPrototype[ITERATOR$1] !== ArrayValues) try {
3105
+ createNonEnumerableProperty$1(CollectionPrototype, ITERATOR$1, ArrayValues);
3106
+ } catch (error) {
3107
+ CollectionPrototype[ITERATOR$1] = ArrayValues;
3108
+ }
3109
+ if (!CollectionPrototype[TO_STRING_TAG]) {
3110
+ createNonEnumerableProperty$1(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
3111
+ }
3112
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
3113
+ // some Chrome versions have non-configurable methods on DOMTokenList
3114
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
3115
+ createNonEnumerableProperty$1(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
3116
+ } catch (error) {
3117
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
3118
+ }
3119
+ }
3120
+ }
3121
+ };
3122
+
3123
+ for (var COLLECTION_NAME in DOMIterables) {
3124
+ handlePrototype(global$5[COLLECTION_NAME] && global$5[COLLECTION_NAME].prototype, COLLECTION_NAME);
3125
+ }
3126
+
3127
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
3128
+
3129
+ class Ninetailed {
3130
+ constructor({
3131
+ clientId,
3132
+ environment,
3133
+ preview
3134
+ }, {
3135
+ plugins,
3136
+ url,
3137
+ profile,
3138
+ locale,
3139
+ requestTimeout,
3140
+ onLog,
3141
+ onError
3142
+ } = {}) {
3143
+ this.isInitialized = false;
3144
+ this.page = (data, options) => __awaiter(this, void 0, void 0, function* () {
3145
+ yield this.waitUntilInitialized();
3146
+ return this.instance.page(data, this.buildOptions(options));
3147
+ });
3148
+ this.track = (event, payload, options) => __awaiter(this, void 0, void 0, function* () {
3149
+ yield this.waitUntilInitialized();
3150
+ return this.instance.track(event, payload, this.buildOptions(options));
3151
+ });
3152
+ this.trackHasSeenComponent = payload => __awaiter(this, void 0, void 0, function* () {
3153
+ return this.track('hasSeenComponent', payload, {
3154
+ plugins: {
3155
+ all: true,
3156
+ ninetailed: false
3157
+ }
3158
+ });
3159
+ });
3160
+ this.trackExperience = payload => {
3161
+ return this.track('nt_experience', payload, {
3162
+ plugins: {
3163
+ all: true,
3164
+ ninetailed: false
3165
+ }
3166
+ });
3167
+ };
3168
+ this.identify = (uid, traits, options) => __awaiter(this, void 0, void 0, function* () {
3169
+ yield this.waitUntilInitialized();
3170
+ /*console.log("Identify triggered");*/
3171
+ return this.instance.identify(uid, traits, this.buildOptions(options));
3172
+ });
3173
+ this.reset = () => {
3174
+ this.onIsInitialized(() => {
3175
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3176
+ // @ts-ignore
3177
+ this.instance.plugins[PLUGIN_NAME].reset();
3178
+ });
3179
+ };
3180
+ this.debug = enabled => {
3181
+ this.onIsInitialized(() => {
3182
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3183
+ // @ts-ignore
3184
+ this.instance.plugins[PLUGIN_NAME].debug(enabled);
3185
+ });
3186
+ };
3187
+ this.onProfileChange = cb => {
3188
+ cb(this.profileState);
3189
+ return this.instance.on(NINETAILED_TRACKER_EVENTS.profile, ({
3190
+ payload
3191
+ }) => {
3192
+ if (payload.error) {
3193
+ cb(Object.assign(Object.assign({}, this._profileState), {
3194
+ status: 'error',
3195
+ profile: payload.profile,
3196
+ error: payload.error
3197
+ }));
3198
+ } else {
3199
+ cb(Object.assign(Object.assign({}, this._profileState), {
3200
+ status: 'success',
3201
+ profile: payload.profile,
3202
+ error: null
3203
+ }));
3204
+ }
3205
+ });
3206
+ };
3207
+ this.onIsInitialized = onIsInitialized => {
3208
+ if (typeof onIsInitialized === 'function') {
3209
+ if (this.isInitialized) {
3210
+ onIsInitialized();
3211
+ } else {
3212
+ const detachOnReadyListener = this.instance.on('ready', () => {
3213
+ onIsInitialized();
3214
+ detachOnReadyListener();
3215
+ });
3216
+ }
3217
+ }
3218
+ };
3219
+ this.waitUntilInitialized = () => {
3220
+ return new Promise(resolve => {
3221
+ this.onIsInitialized(resolve);
3222
+ });
3223
+ };
3224
+ this.plugins = flatten__default["default"](plugins || []);
3225
+ if (profile) {
3226
+ this._profileState = {
3227
+ status: 'success',
3228
+ profile,
3229
+ error: null,
3230
+ from: 'hydrated'
3231
+ };
3232
+ } else {
3233
+ this._profileState = {
3234
+ status: 'loading',
3235
+ profile: null,
3236
+ error: null,
3237
+ from: 'api'
3238
+ };
3239
+ }
3240
+ if (typeof onLog === 'function') {
3241
+ experience_jsShared.logger.addSink(new experience_jsShared.OnLogLogSink(onLog));
3242
+ }
3243
+ if (typeof onError === 'function') {
3244
+ experience_jsShared.logger.addSink(new experience_jsShared.OnErrorLogSink(onError));
3245
+ }
3246
+ this.logger = experience_jsShared.logger;
3247
+ this.instance = Analytics__default["default"]({
3248
+ app: 'ninetailed',
3249
+ plugins: [...this.plugins, ninetailedPlugin({
3250
+ clientId,
3251
+ environment,
3252
+ url,
3253
+ profile,
3254
+ locale,
3255
+ requestTimeout,
3256
+ preview
3257
+ })]
3258
+ });
3259
+ const detachOnReadyListener = this.instance.on('ready', () => {
3260
+ this.isInitialized = true;
3261
+ experience_jsShared.logger.info('Ninetailed Experience.js SDK is completely initialized.');
3262
+ detachOnReadyListener();
3263
+ });
3264
+ // put in private method
3265
+ this.onProfileChange(profileState => {
3266
+ this._profileState = profileState;
3267
+ });
3268
+ this.registerWindowHandlers();
3269
+ }
3270
+ get profileState() {
3271
+ return this._profileState;
3272
+ }
3273
+ buildOptions(options = {}) {
3274
+ return Object.assign({}, options);
3275
+ }
3276
+ registerWindowHandlers() {
3277
+ if (typeof window !== 'undefined') {
3278
+ window.ninetailed = Object.assign({}, window.ninetailed, {
3279
+ page: this.page.bind(this),
3280
+ track: this.track.bind(this),
3281
+ trackHasSeenComponent: this.trackHasSeenComponent.bind(this),
3282
+ identify: this.identify.bind(this),
3283
+ reset: this.reset.bind(this),
3284
+ debug: this.debug.bind(this)
3285
+ });
3286
+ }
3287
+ }
3288
+ }
3289
+
3290
+ const selectVariant$1 = (baseline, variants, {
3291
+ status,
3292
+ profile,
3293
+ error
3294
+ }, options = {
3295
+ holdout: -1
3296
+ }) => {
3297
+ if (status === 'loading') {
3298
+ return {
3299
+ loading: true,
3300
+ variant: Object.assign(Object.assign({}, baseline), {
3301
+ id: 'baseline',
3302
+ audience: {
3303
+ id: 'baseline'
3304
+ }
3305
+ }),
3306
+ audience: {
3307
+ id: 'baseline'
3308
+ },
3309
+ isPersonalized: false,
3310
+ error: null
3311
+ };
3312
+ }
3313
+ if (status === 'error') {
3314
+ return {
3315
+ loading: false,
3316
+ variant: Object.assign(Object.assign({}, baseline), {
3317
+ id: 'baseline',
3318
+ audience: {
3319
+ id: 'baseline'
3320
+ }
3321
+ }),
3322
+ audience: {
3323
+ id: 'baseline'
3324
+ },
3325
+ isPersonalized: false,
3326
+ error: error
3327
+ };
3328
+ }
3329
+ const variant = find__default["default"](variants, variant => {
3330
+ var _a;
3331
+ return includes__default["default"](profile === null || profile === void 0 ? void 0 : profile.audiences, (_a = variant.audience) === null || _a === void 0 ? void 0 : _a.id);
3332
+ });
3333
+ if (variant) {
3334
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3335
+ // @ts-ignore
3336
+ if ((options === null || options === void 0 ? void 0 : options.holdout) || -1 > (profile === null || profile === void 0 ? void 0 : profile.random)) {
3337
+ return {
3338
+ loading: false,
3339
+ variant: Object.assign(Object.assign({}, baseline), {
3340
+ audience: {
3341
+ id: 'baseline'
3342
+ }
3343
+ }),
3344
+ audience: Object.assign(Object.assign({}, variant.audience), {
3345
+ id: variant.audience.id
3346
+ }),
3347
+ isPersonalized: false,
3348
+ error: null
3349
+ };
3350
+ }
3351
+ return {
3352
+ loading: false,
3353
+ variant,
3354
+ audience: Object.assign(Object.assign({}, variant.audience), {
3355
+ id: variant.audience.id
3356
+ }),
3357
+ isPersonalized: true,
3358
+ error: null
3359
+ };
3360
+ }
3361
+ /**
3362
+ * There was no matching audience found.
3363
+ */
3364
+ return {
3365
+ loading: false,
3366
+ variant: Object.assign(Object.assign({}, baseline), {
3367
+ id: 'baseline',
3368
+ audience: {
3369
+ id: 'baseline'
3370
+ }
3371
+ }),
3372
+ audience: {
3373
+ id: 'baseline'
3374
+ },
3375
+ isPersonalized: false,
3376
+ error: null
3377
+ };
3378
+ };
3379
+
3380
+ const EXPERIENCE_TRAIT_PREFIX = 'nt_experiment_';
3381
+
3382
+ const selectBaselineWithVariants = (experience, baseline) => {
3383
+ var _a;
3384
+ return (_a = experience.components.find(baselineWithVariants => baselineWithVariants.baseline.id === baseline.id)) !== null && _a !== void 0 ? _a : null;
3385
+ };
3386
+
3387
+ const selectVariants = (experience, baseline) => {
3388
+ const baselineWithVariants = selectBaselineWithVariants(experience, baseline);
3389
+ if (!baselineWithVariants) {
3390
+ return [];
3391
+ }
3392
+ return baselineWithVariants.variants;
3393
+ };
3394
+
3395
+ const selectHasVariants = (experience, baseline) => {
3396
+ const variants = selectVariants(experience, baseline);
3397
+ return variants.length > 0;
3398
+ };
3399
+
3400
+ var $$3 = _export;
3401
+ var uncurryThis$7 = functionUncurryThisClause;
3402
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
3403
+ var toLength$1 = toLength$3;
3404
+ var toString$5 = toString$7;
3405
+ var notARegExp = notARegexp;
3406
+ var requireObjectCoercible$3 = requireObjectCoercible$7;
3407
+ var correctIsRegExpLogic = correctIsRegexpLogic;
3408
+
3409
+ // eslint-disable-next-line es/no-string-prototype-startswith -- safe
3410
+ var nativeStartsWith = uncurryThis$7(''.startsWith);
3411
+ var stringSlice$4 = uncurryThis$7(''.slice);
3412
+ var min$1 = Math.min;
3413
+
3414
+ var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
3415
+ // https://github.com/zloirock/core-js/pull/702
3416
+ var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
3417
+ var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
3418
+ return descriptor && !descriptor.writable;
3419
+ }();
3420
+
3421
+ // `String.prototype.startsWith` method
3422
+ // https://tc39.es/ecma262/#sec-string.prototype.startswith
3423
+ $$3({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
3424
+ startsWith: function startsWith(searchString /* , position = 0 */) {
3425
+ var that = toString$5(requireObjectCoercible$3(this));
3426
+ notARegExp(searchString);
3427
+ var index = toLength$1(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
3428
+ var search = toString$5(searchString);
3429
+ return nativeStartsWith
3430
+ ? nativeStartsWith(that, search, index)
3431
+ : stringSlice$4(that, index, index + search.length) === search;
3432
+ }
3433
+ });
3434
+
3435
+ var anObject$2 = anObject$d;
3436
+
3437
+ // `RegExp.prototype.flags` getter implementation
3438
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
3439
+ var regexpFlags$1 = function () {
3440
+ var that = anObject$2(this);
3441
+ var result = '';
3442
+ if (that.hasIndices) result += 'd';
3443
+ if (that.global) result += 'g';
3444
+ if (that.ignoreCase) result += 'i';
3445
+ if (that.multiline) result += 'm';
3446
+ if (that.dotAll) result += 's';
3447
+ if (that.unicode) result += 'u';
3448
+ if (that.unicodeSets) result += 'v';
3449
+ if (that.sticky) result += 'y';
3450
+ return result;
3451
+ };
3452
+
3453
+ var fails$6 = fails$l;
3454
+ var global$4 = global$n;
3455
+
3456
+ // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
3457
+ var $RegExp$2 = global$4.RegExp;
3458
+
3459
+ var UNSUPPORTED_Y$1 = fails$6(function () {
3460
+ var re = $RegExp$2('a', 'y');
3461
+ re.lastIndex = 2;
3462
+ return re.exec('abcd') != null;
3463
+ });
3464
+
3465
+ // UC Browser bug
3466
+ // https://github.com/zloirock/core-js/issues/1008
3467
+ var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$6(function () {
3468
+ return !$RegExp$2('a', 'y').sticky;
3469
+ });
3470
+
3471
+ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$6(function () {
3472
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
3473
+ var re = $RegExp$2('^r', 'gy');
3474
+ re.lastIndex = 2;
3475
+ return re.exec('str') != null;
3476
+ });
3477
+
3478
+ var regexpStickyHelpers = {
3479
+ BROKEN_CARET: BROKEN_CARET,
3480
+ MISSED_STICKY: MISSED_STICKY,
3481
+ UNSUPPORTED_Y: UNSUPPORTED_Y$1
3482
+ };
3483
+
3484
+ var fails$5 = fails$l;
3485
+ var global$3 = global$n;
3486
+
3487
+ // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
3488
+ var $RegExp$1 = global$3.RegExp;
3489
+
3490
+ var regexpUnsupportedDotAll = fails$5(function () {
3491
+ var re = $RegExp$1('.', 's');
3492
+ return !(re.dotAll && re.exec('\n') && re.flags === 's');
3493
+ });
3494
+
3495
+ var fails$4 = fails$l;
3496
+ var global$2 = global$n;
3497
+
3498
+ // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
3499
+ var $RegExp = global$2.RegExp;
3500
+
3501
+ var regexpUnsupportedNcg = fails$4(function () {
3502
+ var re = $RegExp('(?<a>b)', 'g');
3503
+ return re.exec('b').groups.a !== 'b' ||
3504
+ 'b'.replace(re, '$<a>c') !== 'bc';
3505
+ });
3506
+
3507
+ /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
3508
+ /* eslint-disable regexp/no-useless-quantifier -- testing */
3509
+ var call$2 = functionCall;
3510
+ var uncurryThis$6 = functionUncurryThis;
3511
+ var toString$4 = toString$7;
3512
+ var regexpFlags = regexpFlags$1;
3513
+ var stickyHelpers = regexpStickyHelpers;
3514
+ var shared = shared$4.exports;
3515
+ var create = objectCreate;
3516
+ var getInternalState = internalState.get;
3517
+ var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
3518
+ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
3519
+
3520
+ var nativeReplace = shared('native-string-replace', String.prototype.replace);
3521
+ var nativeExec = RegExp.prototype.exec;
3522
+ var patchedExec = nativeExec;
3523
+ var charAt$3 = uncurryThis$6(''.charAt);
3524
+ var indexOf = uncurryThis$6(''.indexOf);
3525
+ var replace$2 = uncurryThis$6(''.replace);
3526
+ var stringSlice$3 = uncurryThis$6(''.slice);
3527
+
3528
+ var UPDATES_LAST_INDEX_WRONG = (function () {
3529
+ var re1 = /a/;
3530
+ var re2 = /b*/g;
3531
+ call$2(nativeExec, re1, 'a');
3532
+ call$2(nativeExec, re2, 'a');
3533
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
3534
+ })();
3535
+
3536
+ var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
3537
+
3538
+ // nonparticipating capturing group, copied from es5-shim's String#split patch.
3539
+ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
3540
+
3541
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
3542
+
3543
+ if (PATCH) {
3544
+ patchedExec = function exec(string) {
3545
+ var re = this;
3546
+ var state = getInternalState(re);
3547
+ var str = toString$4(string);
3548
+ var raw = state.raw;
3549
+ var result, reCopy, lastIndex, match, i, object, group;
3550
+
3551
+ if (raw) {
3552
+ raw.lastIndex = re.lastIndex;
3553
+ result = call$2(patchedExec, raw, str);
3554
+ re.lastIndex = raw.lastIndex;
3555
+ return result;
3556
+ }
3557
+
3558
+ var groups = state.groups;
3559
+ var sticky = UNSUPPORTED_Y && re.sticky;
3560
+ var flags = call$2(regexpFlags, re);
3561
+ var source = re.source;
3562
+ var charsAdded = 0;
3563
+ var strCopy = str;
3564
+
3565
+ if (sticky) {
3566
+ flags = replace$2(flags, 'y', '');
3567
+ if (indexOf(flags, 'g') === -1) {
3568
+ flags += 'g';
3569
+ }
3570
+
3571
+ strCopy = stringSlice$3(str, re.lastIndex);
3572
+ // Support anchored sticky behavior.
3573
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$3(str, re.lastIndex - 1) !== '\n')) {
3574
+ source = '(?: ' + source + ')';
3575
+ strCopy = ' ' + strCopy;
3576
+ charsAdded++;
3577
+ }
3578
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
3579
+ // simulate the 'y' flag.
3580
+ reCopy = new RegExp('^(?:' + source + ')', flags);
3581
+ }
3582
+
3583
+ if (NPCG_INCLUDED) {
3584
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
3585
+ }
3586
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
3587
+
3588
+ match = call$2(nativeExec, sticky ? reCopy : re, strCopy);
3589
+
3590
+ if (sticky) {
3591
+ if (match) {
3592
+ match.input = stringSlice$3(match.input, charsAdded);
3593
+ match[0] = stringSlice$3(match[0], charsAdded);
3594
+ match.index = re.lastIndex;
3595
+ re.lastIndex += match[0].length;
3596
+ } else re.lastIndex = 0;
3597
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
3598
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
3599
+ }
3600
+ if (NPCG_INCLUDED && match && match.length > 1) {
3601
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
3602
+ // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
3603
+ call$2(nativeReplace, match[0], reCopy, function () {
3604
+ for (i = 1; i < arguments.length - 2; i++) {
3605
+ if (arguments[i] === undefined) match[i] = undefined;
3606
+ }
3607
+ });
3608
+ }
3609
+
3610
+ if (match && groups) {
3611
+ match.groups = object = create(null);
3612
+ for (i = 0; i < groups.length; i++) {
3613
+ group = groups[i];
3614
+ object[group[0]] = match[group[1]];
3615
+ }
3616
+ }
3617
+
3618
+ return match;
3619
+ };
3620
+ }
3621
+
3622
+ var regexpExec$2 = patchedExec;
3623
+
3624
+ var $$2 = _export;
3625
+ var exec$1 = regexpExec$2;
3626
+
3627
+ // `RegExp.prototype.exec` method
3628
+ // https://tc39.es/ecma262/#sec-regexp.prototype.exec
3629
+ $$2({ target: 'RegExp', proto: true, forced: /./.exec !== exec$1 }, {
3630
+ exec: exec$1
3631
+ });
3632
+
3633
+ // TODO: Remove from `core-js@4` since it's moved to entry points
3634
+
3635
+ var uncurryThis$5 = functionUncurryThisClause;
3636
+ var defineBuiltIn = defineBuiltIn$6;
3637
+ var regexpExec$1 = regexpExec$2;
3638
+ var fails$3 = fails$l;
3639
+ var wellKnownSymbol$1 = wellKnownSymbol$i;
3640
+ var createNonEnumerableProperty = createNonEnumerableProperty$5;
3641
+
3642
+ var SPECIES = wellKnownSymbol$1('species');
3643
+ var RegExpPrototype = RegExp.prototype;
3644
+
3645
+ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
3646
+ var SYMBOL = wellKnownSymbol$1(KEY);
3647
+
3648
+ var DELEGATES_TO_SYMBOL = !fails$3(function () {
3649
+ // String methods call symbol-named RegEp methods
3650
+ var O = {};
3651
+ O[SYMBOL] = function () { return 7; };
3652
+ return ''[KEY](O) != 7;
3653
+ });
3654
+
3655
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$3(function () {
3656
+ // Symbol-named RegExp methods call .exec
3657
+ var execCalled = false;
3658
+ var re = /a/;
3659
+
3660
+ if (KEY === 'split') {
3661
+ // We can't use real regex here since it causes deoptimization
3662
+ // and serious performance degradation in V8
3663
+ // https://github.com/zloirock/core-js/issues/306
3664
+ re = {};
3665
+ // RegExp[@@split] doesn't call the regex's exec method, but first creates
3666
+ // a new one. We need to return the patched regex when creating the new one.
3667
+ re.constructor = {};
3668
+ re.constructor[SPECIES] = function () { return re; };
3669
+ re.flags = '';
3670
+ re[SYMBOL] = /./[SYMBOL];
3671
+ }
3672
+
3673
+ re.exec = function () { execCalled = true; return null; };
3674
+
3675
+ re[SYMBOL]('');
3676
+ return !execCalled;
3677
+ });
3678
+
3679
+ if (
3680
+ !DELEGATES_TO_SYMBOL ||
3681
+ !DELEGATES_TO_EXEC ||
3682
+ FORCED
3683
+ ) {
3684
+ var uncurriedNativeRegExpMethod = uncurryThis$5(/./[SYMBOL]);
3685
+ var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
3686
+ var uncurriedNativeMethod = uncurryThis$5(nativeMethod);
3687
+ var $exec = regexp.exec;
3688
+ if ($exec === regexpExec$1 || $exec === RegExpPrototype.exec) {
3689
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
3690
+ // The native String method already delegates to @@method (this
3691
+ // polyfilled function), leasing to infinite recursion.
3692
+ // We avoid it by directly calling the native @@method method.
3693
+ return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
3694
+ }
3695
+ return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
3696
+ }
3697
+ return { done: false };
3698
+ });
3699
+
3700
+ defineBuiltIn(String.prototype, KEY, methods[0]);
3701
+ defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
3702
+ }
3703
+
3704
+ if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
3705
+ };
3706
+
3707
+ var uncurryThis$4 = functionUncurryThis;
3708
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
3709
+ var toString$3 = toString$7;
3710
+ var requireObjectCoercible$2 = requireObjectCoercible$7;
3711
+
3712
+ var charAt$2 = uncurryThis$4(''.charAt);
3713
+ var charCodeAt = uncurryThis$4(''.charCodeAt);
3714
+ var stringSlice$2 = uncurryThis$4(''.slice);
3715
+
3716
+ var createMethod$2 = function (CONVERT_TO_STRING) {
3717
+ return function ($this, pos) {
3718
+ var S = toString$3(requireObjectCoercible$2($this));
3719
+ var position = toIntegerOrInfinity$1(pos);
3720
+ var size = S.length;
3721
+ var first, second;
3722
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
3723
+ first = charCodeAt(S, position);
3724
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size
3725
+ || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
3726
+ ? CONVERT_TO_STRING
3727
+ ? charAt$2(S, position)
3728
+ : first
3729
+ : CONVERT_TO_STRING
3730
+ ? stringSlice$2(S, position, position + 2)
3731
+ : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
3732
+ };
3733
+ };
3734
+
3735
+ var stringMultibyte = {
3736
+ // `String.prototype.codePointAt` method
3737
+ // https://tc39.es/ecma262/#sec-string.prototype.codepointat
3738
+ codeAt: createMethod$2(false),
3739
+ // `String.prototype.at` method
3740
+ // https://github.com/mathiasbynens/String.prototype.at
3741
+ charAt: createMethod$2(true)
3742
+ };
3743
+
3744
+ var charAt$1 = stringMultibyte.charAt;
3745
+
3746
+ // `AdvanceStringIndex` abstract operation
3747
+ // https://tc39.es/ecma262/#sec-advancestringindex
3748
+ var advanceStringIndex$1 = function (S, index, unicode) {
3749
+ return index + (unicode ? charAt$1(S, index).length : 1);
3750
+ };
3751
+
3752
+ var uncurryThis$3 = functionUncurryThis;
3753
+ var toObject$1 = toObject$5;
3754
+
3755
+ var floor = Math.floor;
3756
+ var charAt = uncurryThis$3(''.charAt);
3757
+ var replace$1 = uncurryThis$3(''.replace);
3758
+ var stringSlice$1 = uncurryThis$3(''.slice);
3759
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
3760
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
3761
+
3762
+ // `GetSubstitution` abstract operation
3763
+ // https://tc39.es/ecma262/#sec-getsubstitution
3764
+ var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
3765
+ var tailPos = position + matched.length;
3766
+ var m = captures.length;
3767
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
3768
+ if (namedCaptures !== undefined) {
3769
+ namedCaptures = toObject$1(namedCaptures);
3770
+ symbols = SUBSTITUTION_SYMBOLS;
3771
+ }
3772
+ return replace$1(replacement, symbols, function (match, ch) {
3773
+ var capture;
3774
+ switch (charAt(ch, 0)) {
3775
+ case '$': return '$';
3776
+ case '&': return matched;
3777
+ case '`': return stringSlice$1(str, 0, position);
3778
+ case "'": return stringSlice$1(str, tailPos);
3779
+ case '<':
3780
+ capture = namedCaptures[stringSlice$1(ch, 1, -1)];
3781
+ break;
3782
+ default: // \d\d?
3783
+ var n = +ch;
3784
+ if (n === 0) return match;
3785
+ if (n > m) {
3786
+ var f = floor(n / 10);
3787
+ if (f === 0) return match;
3788
+ if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
3789
+ return match;
3790
+ }
3791
+ capture = captures[n - 1];
3792
+ }
3793
+ return capture === undefined ? '' : capture;
3794
+ });
3795
+ };
3796
+
3797
+ var call$1 = functionCall;
3798
+ var anObject$1 = anObject$d;
3799
+ var isCallable$1 = isCallable$m;
3800
+ var classof = classofRaw$2;
3801
+ var regexpExec = regexpExec$2;
3802
+
3803
+ var $TypeError$1 = TypeError;
3804
+
3805
+ // `RegExpExec` abstract operation
3806
+ // https://tc39.es/ecma262/#sec-regexpexec
3807
+ var regexpExecAbstract = function (R, S) {
3808
+ var exec = R.exec;
3809
+ if (isCallable$1(exec)) {
3810
+ var result = call$1(exec, R, S);
3811
+ if (result !== null) anObject$1(result);
3812
+ return result;
3813
+ }
3814
+ if (classof(R) === 'RegExp') return call$1(regexpExec, R, S);
3815
+ throw $TypeError$1('RegExp#exec called on incompatible receiver');
3816
+ };
3817
+
3818
+ var apply = functionApply;
3819
+ var call = functionCall;
3820
+ var uncurryThis$2 = functionUncurryThis;
3821
+ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
3822
+ var fails$2 = fails$l;
3823
+ var anObject = anObject$d;
3824
+ var isCallable = isCallable$m;
3825
+ var isNullOrUndefined = isNullOrUndefined$5;
3826
+ var toIntegerOrInfinity = toIntegerOrInfinity$4;
3827
+ var toLength = toLength$3;
3828
+ var toString$2 = toString$7;
3829
+ var requireObjectCoercible$1 = requireObjectCoercible$7;
3830
+ var advanceStringIndex = advanceStringIndex$1;
3831
+ var getMethod = getMethod$4;
3832
+ var getSubstitution = getSubstitution$1;
3833
+ var regExpExec = regexpExecAbstract;
3834
+ var wellKnownSymbol = wellKnownSymbol$i;
3835
+
3836
+ var REPLACE = wellKnownSymbol('replace');
3837
+ var max = Math.max;
3838
+ var min = Math.min;
3839
+ var concat = uncurryThis$2([].concat);
3840
+ var push = uncurryThis$2([].push);
3841
+ var stringIndexOf = uncurryThis$2(''.indexOf);
3842
+ var stringSlice = uncurryThis$2(''.slice);
3843
+
3844
+ var maybeToString = function (it) {
3845
+ return it === undefined ? it : String(it);
3846
+ };
3847
+
3848
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
3849
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
3850
+ var REPLACE_KEEPS_$0 = (function () {
3851
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
3852
+ return 'a'.replace(/./, '$0') === '$0';
3853
+ })();
3854
+
3855
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
3856
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
3857
+ if (/./[REPLACE]) {
3858
+ return /./[REPLACE]('a', '$0') === '';
3859
+ }
3860
+ return false;
3861
+ })();
3862
+
3863
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$2(function () {
3864
+ var re = /./;
3865
+ re.exec = function () {
3866
+ var result = [];
3867
+ result.groups = { a: '7' };
3868
+ return result;
3869
+ };
3870
+ // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
3871
+ return ''.replace(re, '$<a>') !== '7';
3872
+ });
3873
+
3874
+ // @@replace logic
3875
+ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
3876
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
3877
+
3878
+ return [
3879
+ // `String.prototype.replace` method
3880
+ // https://tc39.es/ecma262/#sec-string.prototype.replace
3881
+ function replace(searchValue, replaceValue) {
3882
+ var O = requireObjectCoercible$1(this);
3883
+ var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
3884
+ return replacer
3885
+ ? call(replacer, searchValue, O, replaceValue)
3886
+ : call(nativeReplace, toString$2(O), searchValue, replaceValue);
3887
+ },
3888
+ // `RegExp.prototype[@@replace]` method
3889
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
3890
+ function (string, replaceValue) {
3891
+ var rx = anObject(this);
3892
+ var S = toString$2(string);
3893
+
3894
+ if (
3895
+ typeof replaceValue == 'string' &&
3896
+ stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
3897
+ stringIndexOf(replaceValue, '$<') === -1
3898
+ ) {
3899
+ var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
3900
+ if (res.done) return res.value;
3901
+ }
3902
+
3903
+ var functionalReplace = isCallable(replaceValue);
3904
+ if (!functionalReplace) replaceValue = toString$2(replaceValue);
3905
+
3906
+ var global = rx.global;
3907
+ if (global) {
3908
+ var fullUnicode = rx.unicode;
3909
+ rx.lastIndex = 0;
3910
+ }
3911
+ var results = [];
3912
+ while (true) {
3913
+ var result = regExpExec(rx, S);
3914
+ if (result === null) break;
3915
+
3916
+ push(results, result);
3917
+ if (!global) break;
3918
+
3919
+ var matchStr = toString$2(result[0]);
3920
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
3921
+ }
3922
+
3923
+ var accumulatedResult = '';
3924
+ var nextSourcePosition = 0;
3925
+ for (var i = 0; i < results.length; i++) {
3926
+ result = results[i];
3927
+
3928
+ var matched = toString$2(result[0]);
3929
+ var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
3930
+ var captures = [];
3931
+ // NOTE: This is equivalent to
3932
+ // captures = result.slice(1).map(maybeToString)
3933
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
3934
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
3935
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
3936
+ for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
3937
+ var namedCaptures = result.groups;
3938
+ if (functionalReplace) {
3939
+ var replacerArgs = concat([matched], captures, position, S);
3940
+ if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
3941
+ var replacement = toString$2(apply(replaceValue, undefined, replacerArgs));
3942
+ } else {
3943
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
3944
+ }
3945
+ if (position >= nextSourcePosition) {
3946
+ accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
3947
+ nextSourcePosition = position + matched.length;
3948
+ }
3949
+ }
3950
+ return accumulatedResult + stringSlice(S, nextSourcePosition);
3951
+ }
3952
+ ];
3953
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
3954
+
3955
+ const selectActiveExperiments = (experiments, profile) => {
3956
+ const experimentTraits = pickBy__default["default"](profile.traits, (value, key) => key.startsWith(EXPERIENCE_TRAIT_PREFIX) && value === true);
3957
+ const experimentTraitsIds = Object.keys(experimentTraits).map(id => id.replace(EXPERIENCE_TRAIT_PREFIX, ''));
3958
+ // a experiment is active when the use has it set as a true value on the traits and the experiment config is still active
3959
+ const activeExperiments = experiments.filter(experiment => includes__default["default"](experimentTraitsIds, experiment.id));
3960
+ return activeExperiments;
3961
+ };
3962
+
3963
+ /**
3964
+ * We can use any personalization as eligible experience
3965
+ * When going for an experiment we can only select a active experiment when 1 or more experiments are active
3966
+ * If the profile is not in any active experiments, we can select any expermiment
3967
+ */
3968
+ const selectEligibleExperiences = ({
3969
+ experiences,
3970
+ activeExperiments
3971
+ }) => {
3972
+ return experiences.filter(experience => experience.type === 'nt_personalization' || activeExperiments.length === 0 || find__default["default"](activeExperiments, {
3973
+ id: experience.id
3974
+ }));
3975
+ };
3976
+
3977
+ const LOWER_BOUND = 0;
3978
+ const UPPER_BOUND = 4294967295;
3979
+ const normalize = (val, min, max) => (val - min) / (max - min);
3980
+ const getRandom = text => {
3981
+ const hash = murmurhashJs.murmur3(text, 0);
3982
+ const random = normalize(hash, LOWER_BOUND, UPPER_BOUND);
3983
+ return random;
3984
+ };
3985
+ const getTrafficRandom = (profile, experience) => getRandom(`traffic-${experience.id}-${profile.id}`);
3986
+ const getDistributionRandom = (profile, experience) => getRandom(`distribution-${experience.id}-${profile.id}`);
3987
+
3988
+ const isExperienceMatch = ({
3989
+ experience,
3990
+ activeExperiments,
3991
+ profile
3992
+ }) => {
3993
+ const trafficRandom = getTrafficRandom(profile, experience);
3994
+ experience_jsShared.logger.info(`The traffic random factor for experience ${experience.id} is ${trafficRandom}. It's traffic allocation is set to ${experience.trafficAllocation}.`);
3995
+ const isInTrafficRange = experience.trafficAllocation > trafficRandom;
3996
+ const matchesAudience = !experience.audience || includes__default["default"](profile.audiences, experience.audience.id);
3997
+ const hasActiveExperiment = !!find__default["default"](activeExperiments, {
3998
+ id: experience.id
3999
+ });
4000
+ experience_jsShared.logger.info(`Is the profile in traffic allocation range? ${isInTrafficRange ? 'yes' : 'no'}.\n
4001
+ Does the profile match the audience of the experience? ${matchesAudience ? 'yes' : 'no'}.\n
4002
+ Is there an active experiment for this profile? ${hasActiveExperiment ? 'yes' : 'no'}.`);
4003
+ return isInTrafficRange && (matchesAudience ||
4004
+ // if the expriment is active already then it's selectible without further contraints to be fullfilled
4005
+ hasActiveExperiment);
4006
+ };
4007
+
4008
+ const selectExperience = ({
4009
+ experiences,
4010
+ activeExperiments,
4011
+ profile
4012
+ }) => {
4013
+ const eligibleExperiences = selectEligibleExperiences({
4014
+ experiences,
4015
+ activeExperiments
4016
+ });
4017
+ const selectedExperience = eligibleExperiences.find(experience => isExperienceMatch({
4018
+ experience,
4019
+ activeExperiments,
4020
+ profile
4021
+ }));
4022
+ return selectedExperience !== null && selectedExperience !== void 0 ? selectedExperience : null;
4023
+ };
4024
+
4025
+ const selectDistribution = ({
4026
+ experience,
4027
+ profile
4028
+ }) => {
4029
+ const distributionRandom = getDistributionRandom(profile, experience);
4030
+ experience_jsShared.logger.log(`The distribution random factor for experience ${experience.id} is ${distributionRandom}. It's distribution is set to ${JSON.stringify(experience.distribution, null, 2)}.`);
4031
+ const distribution = find__default["default"](experience.distribution, ({
4032
+ start,
4033
+ end
4034
+ }) => distributionRandom >= start && distributionRandom <= end // this overlaps on one value for each boundary but we just find the first match
4035
+ );
4036
+
4037
+ if (!distribution) {
4038
+ // This should never happen. If it happens then the distribution is not configured correctly. So we just return the baseline.
4039
+ return {
4040
+ index: 0,
4041
+ start: 0,
4042
+ end: 1
4043
+ };
4044
+ }
4045
+ return distribution;
4046
+ };
4047
+
4048
+ const selectVariant = ({
4049
+ baseline,
4050
+ experience,
4051
+ profile
4052
+ }) => {
4053
+ const variants = selectVariants(experience, baseline);
4054
+ if (!variants.length) {
4055
+ return null;
4056
+ }
4057
+ const distribution = selectDistribution({
4058
+ experience,
4059
+ profile
4060
+ });
4061
+ if (!distribution) {
4062
+ return null;
4063
+ }
4064
+ if (distribution.index === 0) {
4065
+ return Object.assign(Object.assign({}, baseline), {
4066
+ hidden: false
4067
+ });
4068
+ }
4069
+ const correctedVariantIndex = distribution.index - 1;
4070
+ if (variants.length <= correctedVariantIndex) {
4071
+ console.warn("A distribution for a variant was selected but it's metadata could not be found.");
4072
+ return null;
4073
+ }
4074
+ const variant = variants[correctedVariantIndex];
4075
+ if (!variant) {
4076
+ console.warn("A distribution for a variant was selected but it's metadata could not be found.");
4077
+ return null;
4078
+ }
4079
+ return variant;
4080
+ };
4081
+
4082
+ var aCallable = aCallable$8;
4083
+ var toObject = toObject$5;
4084
+ var IndexedObject = indexedObject;
4085
+ var lengthOfArrayLike = lengthOfArrayLike$3;
4086
+
4087
+ var $TypeError = TypeError;
4088
+
4089
+ // `Array.prototype.{ reduce, reduceRight }` methods implementation
4090
+ var createMethod$1 = function (IS_RIGHT) {
4091
+ return function (that, callbackfn, argumentsLength, memo) {
4092
+ aCallable(callbackfn);
4093
+ var O = toObject(that);
4094
+ var self = IndexedObject(O);
4095
+ var length = lengthOfArrayLike(O);
4096
+ var index = IS_RIGHT ? length - 1 : 0;
4097
+ var i = IS_RIGHT ? -1 : 1;
4098
+ if (argumentsLength < 2) while (true) {
4099
+ if (index in self) {
4100
+ memo = self[index];
4101
+ index += i;
4102
+ break;
4103
+ }
4104
+ index += i;
4105
+ if (IS_RIGHT ? index < 0 : length <= index) {
4106
+ throw $TypeError('Reduce of empty array with no initial value');
4107
+ }
4108
+ }
4109
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
4110
+ memo = callbackfn(memo, self[index], index, O);
4111
+ }
4112
+ return memo;
4113
+ };
4114
+ };
4115
+
4116
+ var arrayReduce = {
4117
+ // `Array.prototype.reduce` method
4118
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
4119
+ left: createMethod$1(false),
4120
+ // `Array.prototype.reduceRight` method
4121
+ // https://tc39.es/ecma262/#sec-array.prototype.reduceright
4122
+ right: createMethod$1(true)
4123
+ };
4124
+
4125
+ var fails$1 = fails$l;
4126
+
4127
+ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
4128
+ var method = [][METHOD_NAME];
4129
+ return !!method && fails$1(function () {
4130
+ // eslint-disable-next-line no-useless-call -- required for testing
4131
+ method.call(null, argument || function () { return 1; }, 1);
4132
+ });
4133
+ };
4134
+
4135
+ var $$1 = _export;
4136
+ var $reduce = arrayReduce.left;
4137
+ var arrayMethodIsStrict = arrayMethodIsStrict$1;
4138
+ var CHROME_VERSION = engineV8Version;
4139
+ var IS_NODE = engineIsNode;
4140
+
4141
+ var STRICT_METHOD = arrayMethodIsStrict('reduce');
4142
+ // Chrome 80-82 has a critical bug
4143
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
4144
+ var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
4145
+
4146
+ // `Array.prototype.reduce` method
4147
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
4148
+ $$1({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
4149
+ reduce: function reduce(callbackfn /* , initialValue */) {
4150
+ var length = arguments.length;
4151
+ return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
4152
+ }
4153
+ });
4154
+
4155
+ // a string of all valid unicode whitespaces
4156
+ var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
4157
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
4158
+
4159
+ var uncurryThis$1 = functionUncurryThis;
4160
+ var requireObjectCoercible = requireObjectCoercible$7;
4161
+ var toString$1 = toString$7;
4162
+ var whitespaces$1 = whitespaces$2;
4163
+
4164
+ var replace = uncurryThis$1(''.replace);
4165
+ var whitespace = '[' + whitespaces$1 + ']';
4166
+ var ltrim = RegExp('^' + whitespace + whitespace + '*');
4167
+ var rtrim = RegExp(whitespace + whitespace + '*$');
4168
+
4169
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
4170
+ var createMethod = function (TYPE) {
4171
+ return function ($this) {
4172
+ var string = toString$1(requireObjectCoercible($this));
4173
+ if (TYPE & 1) string = replace(string, ltrim, '');
4174
+ if (TYPE & 2) string = replace(string, rtrim, '');
4175
+ return string;
4176
+ };
4177
+ };
4178
+
4179
+ var stringTrim = {
4180
+ // `String.prototype.{ trimLeft, trimStart }` methods
4181
+ // https://tc39.es/ecma262/#sec-string.prototype.trimstart
4182
+ start: createMethod(1),
4183
+ // `String.prototype.{ trimRight, trimEnd }` methods
4184
+ // https://tc39.es/ecma262/#sec-string.prototype.trimend
4185
+ end: createMethod(2),
4186
+ // `String.prototype.trim` method
4187
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
4188
+ trim: createMethod(3)
4189
+ };
4190
+
4191
+ var global$1 = global$n;
4192
+ var fails = fails$l;
4193
+ var uncurryThis = functionUncurryThis;
4194
+ var toString = toString$7;
4195
+ var trim = stringTrim.trim;
4196
+ var whitespaces = whitespaces$2;
4197
+
4198
+ var $parseInt$1 = global$1.parseInt;
4199
+ var Symbol$1 = global$1.Symbol;
4200
+ var ITERATOR = Symbol$1 && Symbol$1.iterator;
4201
+ var hex = /^[+-]?0x/i;
4202
+ var exec = uncurryThis(hex.exec);
4203
+ var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
4204
+ // MS Edge 18- broken with boxed symbols
4205
+ || (ITERATOR && !fails(function () { $parseInt$1(Object(ITERATOR)); }));
4206
+
4207
+ // `parseInt` method
4208
+ // https://tc39.es/ecma262/#sec-parseint-string-radix
4209
+ var numberParseInt = FORCED ? function parseInt(string, radix) {
4210
+ var S = trim(toString(string));
4211
+ return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
4212
+ } : $parseInt$1;
4213
+
4214
+ var $ = _export;
4215
+ var $parseInt = numberParseInt;
4216
+
4217
+ // `parseInt` method
4218
+ // https://tc39.es/ecma262/#sec-parseint-string-radix
4219
+ $({ global: true, forced: parseInt != $parseInt }, {
4220
+ parseInt: $parseInt
4221
+ });
4222
+
4223
+ const decodeExperienceVariantsMap = encodedExperienceVariantsMap => {
4224
+ return encodedExperienceVariantsMap.split(',').map(experienceIdWithVariant => {
4225
+ const [experienceId, _variantIndex] = experienceIdWithVariant.split('=');
4226
+ const variantIndex = parseInt(_variantIndex);
4227
+ if (!experienceId || !variantIndex) {
4228
+ return null;
4229
+ }
4230
+ return {
4231
+ experienceId,
4232
+ variantIndex
4233
+ };
4234
+ }).filter(x => !!x).reduce((acc, curr) => Object.assign(Object.assign({}, acc), {
4235
+ [curr.experienceId]: curr.variantIndex
4236
+ }), {});
4237
+ };
4238
+
4239
+ exports.ANONYMOUS_ID = ANONYMOUS_ID;
4240
+ exports.DEBUG_FLAG = DEBUG_FLAG;
4241
+ exports.EXPERIENCE_TRAIT_PREFIX = EXPERIENCE_TRAIT_PREFIX;
4242
+ exports.LEGACY_ANONYMOUS_ID = LEGACY_ANONYMOUS_ID;
4243
+ exports.NINETAILED_TRACKER_EVENTS = NINETAILED_TRACKER_EVENTS;
4244
+ exports.Ninetailed = Ninetailed;
4245
+ exports.PLUGIN_NAME = PLUGIN_NAME;
4246
+ exports.PROFILE_FALLBACK_CACHE = PROFILE_FALLBACK_CACHE;
4247
+ exports.decodeExperienceVariantsMap = decodeExperienceVariantsMap;
4248
+ exports.isExperienceMatch = isExperienceMatch;
4249
+ exports.ninetailedPlugin = ninetailedPlugin;
4250
+ exports.selectActiveExperiments = selectActiveExperiments;
4251
+ exports.selectDistribution = selectDistribution;
4252
+ exports.selectEligibleExperiences = selectEligibleExperiences;
4253
+ exports.selectExperience = selectExperience;
4254
+ exports.selectExperienceBaselineWithVariants = selectBaselineWithVariants;
4255
+ exports.selectExperienceVariant = selectVariant;
4256
+ exports.selectExperienceVariants = selectVariants;
4257
+ exports.selectHasExperienceVariants = selectHasVariants;
4258
+ exports.selectVariant = selectVariant$1;