@ninetailed/experience.js 1.0.0-beta.0
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.
- package/README.md +7 -0
- package/index.d.ts +3 -0
- package/index.esm.js +3896 -0
- package/index.umd.js +4129 -0
- package/lib/Ninetailed.d.ts +47 -0
- package/lib/analytics/Cache/cache.d.ts +11 -0
- package/lib/analytics/Cache/index.d.ts +1 -0
- package/lib/analytics/Events/build-context.d.ts +2 -0
- package/lib/analytics/Events/build-locale.d.ts +1 -0
- package/lib/analytics/Events/index.d.ts +1 -0
- package/lib/analytics/get-analytics-plugin.d.ts +22 -0
- package/lib/analytics/index.d.ts +1 -0
- package/lib/analytics/utility/apiClient.d.ts +19 -0
- package/lib/analytics/utility/debug.d.ts +3 -0
- package/lib/analytics/utility/index.d.ts +2 -0
- package/lib/selectVariant.d.ts +34 -0
- package/lib/types.d.ts +12 -0
- package/package.json +17 -0
package/index.esm.js
ADDED
|
@@ -0,0 +1,3896 @@
|
|
|
1
|
+
import get$2 from 'lodash/get';
|
|
2
|
+
import throttle from 'lodash/throttle';
|
|
3
|
+
import unionBy from 'lodash/unionBy';
|
|
4
|
+
import { buildEmptyCache, buildTrackEvent, buildIdentifyEvent, buildPageEvent } from '@ninetailed/experience.js-shared';
|
|
5
|
+
import require$$1 from 'tty';
|
|
6
|
+
import require$$1$1 from 'util';
|
|
7
|
+
import require$$0 from 'os';
|
|
8
|
+
import Analytics from 'analytics';
|
|
9
|
+
import includes from 'lodash/includes';
|
|
10
|
+
import find from 'lodash/find';
|
|
11
|
+
|
|
12
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
13
|
+
|
|
14
|
+
var check = function (it) {
|
|
15
|
+
return it && it.Math == Math && it;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
19
|
+
var global$A =
|
|
20
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
21
|
+
check(typeof globalThis == 'object' && globalThis) ||
|
|
22
|
+
check(typeof window == 'object' && window) ||
|
|
23
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
24
|
+
check(typeof self == 'object' && self) ||
|
|
25
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
26
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
27
|
+
(function () { return this; })() || Function('return this')();
|
|
28
|
+
|
|
29
|
+
var objectGetOwnPropertyDescriptor = {};
|
|
30
|
+
|
|
31
|
+
var fails$b = function (exec) {
|
|
32
|
+
try {
|
|
33
|
+
return !!exec();
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var fails$a = fails$b;
|
|
40
|
+
|
|
41
|
+
// Detect IE8's incomplete defineProperty implementation
|
|
42
|
+
var descriptors = !fails$a(function () {
|
|
43
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
44
|
+
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
var fails$9 = fails$b;
|
|
48
|
+
|
|
49
|
+
var functionBindNative = !fails$9(function () {
|
|
50
|
+
var test = (function () { /* empty */ }).bind();
|
|
51
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
52
|
+
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
var NATIVE_BIND$3 = functionBindNative;
|
|
56
|
+
|
|
57
|
+
var call$a = Function.prototype.call;
|
|
58
|
+
|
|
59
|
+
var functionCall = NATIVE_BIND$3 ? call$a.bind(call$a) : function () {
|
|
60
|
+
return call$a.apply(call$a, arguments);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var objectPropertyIsEnumerable = {};
|
|
64
|
+
|
|
65
|
+
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
66
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
67
|
+
var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
|
|
68
|
+
|
|
69
|
+
// Nashorn ~ JDK8 bug
|
|
70
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
71
|
+
|
|
72
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
73
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
74
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
75
|
+
var descriptor = getOwnPropertyDescriptor$2(this, V);
|
|
76
|
+
return !!descriptor && descriptor.enumerable;
|
|
77
|
+
} : $propertyIsEnumerable;
|
|
78
|
+
|
|
79
|
+
var createPropertyDescriptor$2 = function (bitmap, value) {
|
|
80
|
+
return {
|
|
81
|
+
enumerable: !(bitmap & 1),
|
|
82
|
+
configurable: !(bitmap & 2),
|
|
83
|
+
writable: !(bitmap & 4),
|
|
84
|
+
value: value
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var NATIVE_BIND$2 = functionBindNative;
|
|
89
|
+
|
|
90
|
+
var FunctionPrototype$2 = Function.prototype;
|
|
91
|
+
var bind$5 = FunctionPrototype$2.bind;
|
|
92
|
+
var call$9 = FunctionPrototype$2.call;
|
|
93
|
+
var uncurryThis$e = NATIVE_BIND$2 && bind$5.bind(call$9, call$9);
|
|
94
|
+
|
|
95
|
+
var functionUncurryThis = NATIVE_BIND$2 ? function (fn) {
|
|
96
|
+
return fn && uncurryThis$e(fn);
|
|
97
|
+
} : function (fn) {
|
|
98
|
+
return fn && function () {
|
|
99
|
+
return call$9.apply(fn, arguments);
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
var uncurryThis$d = functionUncurryThis;
|
|
104
|
+
|
|
105
|
+
var toString$1 = uncurryThis$d({}.toString);
|
|
106
|
+
var stringSlice = uncurryThis$d(''.slice);
|
|
107
|
+
|
|
108
|
+
var classofRaw$1 = function (it) {
|
|
109
|
+
return stringSlice(toString$1(it), 8, -1);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var global$z = global$A;
|
|
113
|
+
var uncurryThis$c = functionUncurryThis;
|
|
114
|
+
var fails$8 = fails$b;
|
|
115
|
+
var classof$4 = classofRaw$1;
|
|
116
|
+
|
|
117
|
+
var Object$4 = global$z.Object;
|
|
118
|
+
var split = uncurryThis$c(''.split);
|
|
119
|
+
|
|
120
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
121
|
+
var indexedObject = fails$8(function () {
|
|
122
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
123
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
124
|
+
return !Object$4('z').propertyIsEnumerable(0);
|
|
125
|
+
}) ? function (it) {
|
|
126
|
+
return classof$4(it) == 'String' ? split(it, '') : Object$4(it);
|
|
127
|
+
} : Object$4;
|
|
128
|
+
|
|
129
|
+
var global$y = global$A;
|
|
130
|
+
|
|
131
|
+
var TypeError$f = global$y.TypeError;
|
|
132
|
+
|
|
133
|
+
// `RequireObjectCoercible` abstract operation
|
|
134
|
+
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
135
|
+
var requireObjectCoercible$2 = function (it) {
|
|
136
|
+
if (it == undefined) throw TypeError$f("Can't call method on " + it);
|
|
137
|
+
return it;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// toObject with fallback for non-array-like ES3 strings
|
|
141
|
+
var IndexedObject$2 = indexedObject;
|
|
142
|
+
var requireObjectCoercible$1 = requireObjectCoercible$2;
|
|
143
|
+
|
|
144
|
+
var toIndexedObject$3 = function (it) {
|
|
145
|
+
return IndexedObject$2(requireObjectCoercible$1(it));
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// `IsCallable` abstract operation
|
|
149
|
+
// https://tc39.es/ecma262/#sec-iscallable
|
|
150
|
+
var isCallable$e = function (argument) {
|
|
151
|
+
return typeof argument == 'function';
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
var isCallable$d = isCallable$e;
|
|
155
|
+
|
|
156
|
+
var isObject$7 = function (it) {
|
|
157
|
+
return typeof it == 'object' ? it !== null : isCallable$d(it);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
var global$x = global$A;
|
|
161
|
+
var isCallable$c = isCallable$e;
|
|
162
|
+
|
|
163
|
+
var aFunction = function (argument) {
|
|
164
|
+
return isCallable$c(argument) ? argument : undefined;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var getBuiltIn$7 = function (namespace, method) {
|
|
168
|
+
return arguments.length < 2 ? aFunction(global$x[namespace]) : global$x[namespace] && global$x[namespace][method];
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
var uncurryThis$b = functionUncurryThis;
|
|
172
|
+
|
|
173
|
+
var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
|
|
174
|
+
|
|
175
|
+
var getBuiltIn$6 = getBuiltIn$7;
|
|
176
|
+
|
|
177
|
+
var engineUserAgent = getBuiltIn$6('navigator', 'userAgent') || '';
|
|
178
|
+
|
|
179
|
+
var global$w = global$A;
|
|
180
|
+
var userAgent$3 = engineUserAgent;
|
|
181
|
+
|
|
182
|
+
var process$4 = global$w.process;
|
|
183
|
+
var Deno = global$w.Deno;
|
|
184
|
+
var versions = process$4 && process$4.versions || Deno && Deno.version;
|
|
185
|
+
var v8 = versions && versions.v8;
|
|
186
|
+
var match, version;
|
|
187
|
+
|
|
188
|
+
if (v8) {
|
|
189
|
+
match = v8.split('.');
|
|
190
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
191
|
+
// but their correct versions are not interesting for us
|
|
192
|
+
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
196
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
197
|
+
if (!version && userAgent$3) {
|
|
198
|
+
match = userAgent$3.match(/Edge\/(\d+)/);
|
|
199
|
+
if (!match || match[1] >= 74) {
|
|
200
|
+
match = userAgent$3.match(/Chrome\/(\d+)/);
|
|
201
|
+
if (match) version = +match[1];
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
var engineV8Version = version;
|
|
206
|
+
|
|
207
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
208
|
+
|
|
209
|
+
var V8_VERSION$1 = engineV8Version;
|
|
210
|
+
var fails$7 = fails$b;
|
|
211
|
+
|
|
212
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
213
|
+
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$7(function () {
|
|
214
|
+
var symbol = Symbol();
|
|
215
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
216
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
217
|
+
return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
218
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
219
|
+
!Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
223
|
+
|
|
224
|
+
var NATIVE_SYMBOL$1 = nativeSymbol;
|
|
225
|
+
|
|
226
|
+
var useSymbolAsUid = NATIVE_SYMBOL$1
|
|
227
|
+
&& !Symbol.sham
|
|
228
|
+
&& typeof Symbol.iterator == 'symbol';
|
|
229
|
+
|
|
230
|
+
var global$v = global$A;
|
|
231
|
+
var getBuiltIn$5 = getBuiltIn$7;
|
|
232
|
+
var isCallable$b = isCallable$e;
|
|
233
|
+
var isPrototypeOf$2 = objectIsPrototypeOf;
|
|
234
|
+
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
|
235
|
+
|
|
236
|
+
var Object$3 = global$v.Object;
|
|
237
|
+
|
|
238
|
+
var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
|
|
239
|
+
return typeof it == 'symbol';
|
|
240
|
+
} : function (it) {
|
|
241
|
+
var $Symbol = getBuiltIn$5('Symbol');
|
|
242
|
+
return isCallable$b($Symbol) && isPrototypeOf$2($Symbol.prototype, Object$3(it));
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
var global$u = global$A;
|
|
246
|
+
|
|
247
|
+
var String$4 = global$u.String;
|
|
248
|
+
|
|
249
|
+
var tryToString$4 = function (argument) {
|
|
250
|
+
try {
|
|
251
|
+
return String$4(argument);
|
|
252
|
+
} catch (error) {
|
|
253
|
+
return 'Object';
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
var global$t = global$A;
|
|
258
|
+
var isCallable$a = isCallable$e;
|
|
259
|
+
var tryToString$3 = tryToString$4;
|
|
260
|
+
|
|
261
|
+
var TypeError$e = global$t.TypeError;
|
|
262
|
+
|
|
263
|
+
// `Assert: IsCallable(argument) is true`
|
|
264
|
+
var aCallable$6 = function (argument) {
|
|
265
|
+
if (isCallable$a(argument)) return argument;
|
|
266
|
+
throw TypeError$e(tryToString$3(argument) + ' is not a function');
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
var aCallable$5 = aCallable$6;
|
|
270
|
+
|
|
271
|
+
// `GetMethod` abstract operation
|
|
272
|
+
// https://tc39.es/ecma262/#sec-getmethod
|
|
273
|
+
var getMethod$3 = function (V, P) {
|
|
274
|
+
var func = V[P];
|
|
275
|
+
return func == null ? undefined : aCallable$5(func);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
var global$s = global$A;
|
|
279
|
+
var call$8 = functionCall;
|
|
280
|
+
var isCallable$9 = isCallable$e;
|
|
281
|
+
var isObject$6 = isObject$7;
|
|
282
|
+
|
|
283
|
+
var TypeError$d = global$s.TypeError;
|
|
284
|
+
|
|
285
|
+
// `OrdinaryToPrimitive` abstract operation
|
|
286
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
287
|
+
var ordinaryToPrimitive$1 = function (input, pref) {
|
|
288
|
+
var fn, val;
|
|
289
|
+
if (pref === 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$8(fn, input))) return val;
|
|
290
|
+
if (isCallable$9(fn = input.valueOf) && !isObject$6(val = call$8(fn, input))) return val;
|
|
291
|
+
if (pref !== 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$8(fn, input))) return val;
|
|
292
|
+
throw TypeError$d("Can't convert object to primitive value");
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
var shared$3 = {exports: {}};
|
|
296
|
+
|
|
297
|
+
var global$r = global$A;
|
|
298
|
+
|
|
299
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
300
|
+
var defineProperty$2 = Object.defineProperty;
|
|
301
|
+
|
|
302
|
+
var setGlobal$3 = function (key, value) {
|
|
303
|
+
try {
|
|
304
|
+
defineProperty$2(global$r, key, { value: value, configurable: true, writable: true });
|
|
305
|
+
} catch (error) {
|
|
306
|
+
global$r[key] = value;
|
|
307
|
+
} return value;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
var global$q = global$A;
|
|
311
|
+
var setGlobal$2 = setGlobal$3;
|
|
312
|
+
|
|
313
|
+
var SHARED = '__core-js_shared__';
|
|
314
|
+
var store$3 = global$q[SHARED] || setGlobal$2(SHARED, {});
|
|
315
|
+
|
|
316
|
+
var sharedStore = store$3;
|
|
317
|
+
|
|
318
|
+
var store$2 = sharedStore;
|
|
319
|
+
|
|
320
|
+
(shared$3.exports = function (key, value) {
|
|
321
|
+
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
322
|
+
})('versions', []).push({
|
|
323
|
+
version: '3.21.1',
|
|
324
|
+
mode: 'global',
|
|
325
|
+
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
326
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
|
|
327
|
+
source: 'https://github.com/zloirock/core-js'
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
var global$p = global$A;
|
|
331
|
+
var requireObjectCoercible = requireObjectCoercible$2;
|
|
332
|
+
|
|
333
|
+
var Object$2 = global$p.Object;
|
|
334
|
+
|
|
335
|
+
// `ToObject` abstract operation
|
|
336
|
+
// https://tc39.es/ecma262/#sec-toobject
|
|
337
|
+
var toObject$3 = function (argument) {
|
|
338
|
+
return Object$2(requireObjectCoercible(argument));
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
var uncurryThis$a = functionUncurryThis;
|
|
342
|
+
var toObject$2 = toObject$3;
|
|
343
|
+
|
|
344
|
+
var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
|
|
345
|
+
|
|
346
|
+
// `HasOwnProperty` abstract operation
|
|
347
|
+
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
348
|
+
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
349
|
+
return hasOwnProperty(toObject$2(it), key);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
353
|
+
|
|
354
|
+
var id = 0;
|
|
355
|
+
var postfix = Math.random();
|
|
356
|
+
var toString = uncurryThis$9(1.0.toString);
|
|
357
|
+
|
|
358
|
+
var uid$2 = function (key) {
|
|
359
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
var global$o = global$A;
|
|
363
|
+
var shared$2 = shared$3.exports;
|
|
364
|
+
var hasOwn$8 = hasOwnProperty_1;
|
|
365
|
+
var uid$1 = uid$2;
|
|
366
|
+
var NATIVE_SYMBOL = nativeSymbol;
|
|
367
|
+
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
368
|
+
|
|
369
|
+
var WellKnownSymbolsStore = shared$2('wks');
|
|
370
|
+
var Symbol$1 = global$o.Symbol;
|
|
371
|
+
var symbolFor = Symbol$1 && Symbol$1['for'];
|
|
372
|
+
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
|
|
373
|
+
|
|
374
|
+
var wellKnownSymbol$a = function (name) {
|
|
375
|
+
if (!hasOwn$8(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
|
|
376
|
+
var description = 'Symbol.' + name;
|
|
377
|
+
if (NATIVE_SYMBOL && hasOwn$8(Symbol$1, name)) {
|
|
378
|
+
WellKnownSymbolsStore[name] = Symbol$1[name];
|
|
379
|
+
} else if (USE_SYMBOL_AS_UID && symbolFor) {
|
|
380
|
+
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
381
|
+
} else {
|
|
382
|
+
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
383
|
+
}
|
|
384
|
+
} return WellKnownSymbolsStore[name];
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
var global$n = global$A;
|
|
388
|
+
var call$7 = functionCall;
|
|
389
|
+
var isObject$5 = isObject$7;
|
|
390
|
+
var isSymbol$1 = isSymbol$2;
|
|
391
|
+
var getMethod$2 = getMethod$3;
|
|
392
|
+
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
393
|
+
var wellKnownSymbol$9 = wellKnownSymbol$a;
|
|
394
|
+
|
|
395
|
+
var TypeError$c = global$n.TypeError;
|
|
396
|
+
var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive');
|
|
397
|
+
|
|
398
|
+
// `ToPrimitive` abstract operation
|
|
399
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
|
400
|
+
var toPrimitive$1 = function (input, pref) {
|
|
401
|
+
if (!isObject$5(input) || isSymbol$1(input)) return input;
|
|
402
|
+
var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
|
|
403
|
+
var result;
|
|
404
|
+
if (exoticToPrim) {
|
|
405
|
+
if (pref === undefined) pref = 'default';
|
|
406
|
+
result = call$7(exoticToPrim, input, pref);
|
|
407
|
+
if (!isObject$5(result) || isSymbol$1(result)) return result;
|
|
408
|
+
throw TypeError$c("Can't convert object to primitive value");
|
|
409
|
+
}
|
|
410
|
+
if (pref === undefined) pref = 'number';
|
|
411
|
+
return ordinaryToPrimitive(input, pref);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
var toPrimitive = toPrimitive$1;
|
|
415
|
+
var isSymbol = isSymbol$2;
|
|
416
|
+
|
|
417
|
+
// `ToPropertyKey` abstract operation
|
|
418
|
+
// https://tc39.es/ecma262/#sec-topropertykey
|
|
419
|
+
var toPropertyKey$2 = function (argument) {
|
|
420
|
+
var key = toPrimitive(argument, 'string');
|
|
421
|
+
return isSymbol(key) ? key : key + '';
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
var global$m = global$A;
|
|
425
|
+
var isObject$4 = isObject$7;
|
|
426
|
+
|
|
427
|
+
var document$3 = global$m.document;
|
|
428
|
+
// typeof document.createElement is 'object' in old IE
|
|
429
|
+
var EXISTS$1 = isObject$4(document$3) && isObject$4(document$3.createElement);
|
|
430
|
+
|
|
431
|
+
var documentCreateElement = function (it) {
|
|
432
|
+
return EXISTS$1 ? document$3.createElement(it) : {};
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
var DESCRIPTORS$7 = descriptors;
|
|
436
|
+
var fails$6 = fails$b;
|
|
437
|
+
var createElement$1 = documentCreateElement;
|
|
438
|
+
|
|
439
|
+
// Thanks to IE8 for its funny defineProperty
|
|
440
|
+
var ie8DomDefine = !DESCRIPTORS$7 && !fails$6(function () {
|
|
441
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
442
|
+
return Object.defineProperty(createElement$1('div'), 'a', {
|
|
443
|
+
get: function () { return 7; }
|
|
444
|
+
}).a != 7;
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
var DESCRIPTORS$6 = descriptors;
|
|
448
|
+
var call$6 = functionCall;
|
|
449
|
+
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
|
|
450
|
+
var createPropertyDescriptor$1 = createPropertyDescriptor$2;
|
|
451
|
+
var toIndexedObject$2 = toIndexedObject$3;
|
|
452
|
+
var toPropertyKey$1 = toPropertyKey$2;
|
|
453
|
+
var hasOwn$7 = hasOwnProperty_1;
|
|
454
|
+
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
455
|
+
|
|
456
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
457
|
+
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
458
|
+
|
|
459
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
460
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
461
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
462
|
+
O = toIndexedObject$2(O);
|
|
463
|
+
P = toPropertyKey$1(P);
|
|
464
|
+
if (IE8_DOM_DEFINE$1) try {
|
|
465
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
466
|
+
} catch (error) { /* empty */ }
|
|
467
|
+
if (hasOwn$7(O, P)) return createPropertyDescriptor$1(!call$6(propertyIsEnumerableModule$1.f, O, P), O[P]);
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
var objectDefineProperty = {};
|
|
471
|
+
|
|
472
|
+
var DESCRIPTORS$5 = descriptors;
|
|
473
|
+
var fails$5 = fails$b;
|
|
474
|
+
|
|
475
|
+
// V8 ~ Chrome 36-
|
|
476
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
477
|
+
var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$5(function () {
|
|
478
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
479
|
+
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
480
|
+
value: 42,
|
|
481
|
+
writable: false
|
|
482
|
+
}).prototype != 42;
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
var global$l = global$A;
|
|
486
|
+
var isObject$3 = isObject$7;
|
|
487
|
+
|
|
488
|
+
var String$3 = global$l.String;
|
|
489
|
+
var TypeError$b = global$l.TypeError;
|
|
490
|
+
|
|
491
|
+
// `Assert: Type(argument) is Object`
|
|
492
|
+
var anObject$8 = function (argument) {
|
|
493
|
+
if (isObject$3(argument)) return argument;
|
|
494
|
+
throw TypeError$b(String$3(argument) + ' is not an object');
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
var global$k = global$A;
|
|
498
|
+
var DESCRIPTORS$4 = descriptors;
|
|
499
|
+
var IE8_DOM_DEFINE = ie8DomDefine;
|
|
500
|
+
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
501
|
+
var anObject$7 = anObject$8;
|
|
502
|
+
var toPropertyKey = toPropertyKey$2;
|
|
503
|
+
|
|
504
|
+
var TypeError$a = global$k.TypeError;
|
|
505
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
506
|
+
var $defineProperty = Object.defineProperty;
|
|
507
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
508
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
509
|
+
var ENUMERABLE = 'enumerable';
|
|
510
|
+
var CONFIGURABLE$1 = 'configurable';
|
|
511
|
+
var WRITABLE = 'writable';
|
|
512
|
+
|
|
513
|
+
// `Object.defineProperty` method
|
|
514
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
515
|
+
objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
|
516
|
+
anObject$7(O);
|
|
517
|
+
P = toPropertyKey(P);
|
|
518
|
+
anObject$7(Attributes);
|
|
519
|
+
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
520
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
521
|
+
if (current && current[WRITABLE]) {
|
|
522
|
+
O[P] = Attributes.value;
|
|
523
|
+
Attributes = {
|
|
524
|
+
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
|
|
525
|
+
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
526
|
+
writable: false
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
} return $defineProperty(O, P, Attributes);
|
|
530
|
+
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
531
|
+
anObject$7(O);
|
|
532
|
+
P = toPropertyKey(P);
|
|
533
|
+
anObject$7(Attributes);
|
|
534
|
+
if (IE8_DOM_DEFINE) try {
|
|
535
|
+
return $defineProperty(O, P, Attributes);
|
|
536
|
+
} catch (error) { /* empty */ }
|
|
537
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError$a('Accessors not supported');
|
|
538
|
+
if ('value' in Attributes) O[P] = Attributes.value;
|
|
539
|
+
return O;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
var DESCRIPTORS$3 = descriptors;
|
|
543
|
+
var definePropertyModule$2 = objectDefineProperty;
|
|
544
|
+
var createPropertyDescriptor = createPropertyDescriptor$2;
|
|
545
|
+
|
|
546
|
+
var createNonEnumerableProperty$3 = DESCRIPTORS$3 ? function (object, key, value) {
|
|
547
|
+
return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
|
|
548
|
+
} : function (object, key, value) {
|
|
549
|
+
object[key] = value;
|
|
550
|
+
return object;
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
var redefine$3 = {exports: {}};
|
|
554
|
+
|
|
555
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
556
|
+
var isCallable$8 = isCallable$e;
|
|
557
|
+
var store$1 = sharedStore;
|
|
558
|
+
|
|
559
|
+
var functionToString = uncurryThis$8(Function.toString);
|
|
560
|
+
|
|
561
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
562
|
+
if (!isCallable$8(store$1.inspectSource)) {
|
|
563
|
+
store$1.inspectSource = function (it) {
|
|
564
|
+
return functionToString(it);
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
var inspectSource$4 = store$1.inspectSource;
|
|
569
|
+
|
|
570
|
+
var global$j = global$A;
|
|
571
|
+
var isCallable$7 = isCallable$e;
|
|
572
|
+
var inspectSource$3 = inspectSource$4;
|
|
573
|
+
|
|
574
|
+
var WeakMap$1 = global$j.WeakMap;
|
|
575
|
+
|
|
576
|
+
var nativeWeakMap = isCallable$7(WeakMap$1) && /native code/.test(inspectSource$3(WeakMap$1));
|
|
577
|
+
|
|
578
|
+
var shared$1 = shared$3.exports;
|
|
579
|
+
var uid = uid$2;
|
|
580
|
+
|
|
581
|
+
var keys = shared$1('keys');
|
|
582
|
+
|
|
583
|
+
var sharedKey$1 = function (key) {
|
|
584
|
+
return keys[key] || (keys[key] = uid(key));
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
var hiddenKeys$3 = {};
|
|
588
|
+
|
|
589
|
+
var NATIVE_WEAK_MAP = nativeWeakMap;
|
|
590
|
+
var global$i = global$A;
|
|
591
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
592
|
+
var isObject$2 = isObject$7;
|
|
593
|
+
var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
|
|
594
|
+
var hasOwn$6 = hasOwnProperty_1;
|
|
595
|
+
var shared = sharedStore;
|
|
596
|
+
var sharedKey = sharedKey$1;
|
|
597
|
+
var hiddenKeys$2 = hiddenKeys$3;
|
|
598
|
+
|
|
599
|
+
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
600
|
+
var TypeError$9 = global$i.TypeError;
|
|
601
|
+
var WeakMap = global$i.WeakMap;
|
|
602
|
+
var set$2, get$1, has;
|
|
603
|
+
|
|
604
|
+
var enforce = function (it) {
|
|
605
|
+
return has(it) ? get$1(it) : set$2(it, {});
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
var getterFor = function (TYPE) {
|
|
609
|
+
return function (it) {
|
|
610
|
+
var state;
|
|
611
|
+
if (!isObject$2(it) || (state = get$1(it)).type !== TYPE) {
|
|
612
|
+
throw TypeError$9('Incompatible receiver, ' + TYPE + ' required');
|
|
613
|
+
} return state;
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
if (NATIVE_WEAK_MAP || shared.state) {
|
|
618
|
+
var store = shared.state || (shared.state = new WeakMap());
|
|
619
|
+
var wmget = uncurryThis$7(store.get);
|
|
620
|
+
var wmhas = uncurryThis$7(store.has);
|
|
621
|
+
var wmset = uncurryThis$7(store.set);
|
|
622
|
+
set$2 = function (it, metadata) {
|
|
623
|
+
if (wmhas(store, it)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
|
|
624
|
+
metadata.facade = it;
|
|
625
|
+
wmset(store, it, metadata);
|
|
626
|
+
return metadata;
|
|
627
|
+
};
|
|
628
|
+
get$1 = function (it) {
|
|
629
|
+
return wmget(store, it) || {};
|
|
630
|
+
};
|
|
631
|
+
has = function (it) {
|
|
632
|
+
return wmhas(store, it);
|
|
633
|
+
};
|
|
634
|
+
} else {
|
|
635
|
+
var STATE = sharedKey('state');
|
|
636
|
+
hiddenKeys$2[STATE] = true;
|
|
637
|
+
set$2 = function (it, metadata) {
|
|
638
|
+
if (hasOwn$6(it, STATE)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
|
|
639
|
+
metadata.facade = it;
|
|
640
|
+
createNonEnumerableProperty$2(it, STATE, metadata);
|
|
641
|
+
return metadata;
|
|
642
|
+
};
|
|
643
|
+
get$1 = function (it) {
|
|
644
|
+
return hasOwn$6(it, STATE) ? it[STATE] : {};
|
|
645
|
+
};
|
|
646
|
+
has = function (it) {
|
|
647
|
+
return hasOwn$6(it, STATE);
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
var internalState = {
|
|
652
|
+
set: set$2,
|
|
653
|
+
get: get$1,
|
|
654
|
+
has: has,
|
|
655
|
+
enforce: enforce,
|
|
656
|
+
getterFor: getterFor
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
var DESCRIPTORS$2 = descriptors;
|
|
660
|
+
var hasOwn$5 = hasOwnProperty_1;
|
|
661
|
+
|
|
662
|
+
var FunctionPrototype$1 = Function.prototype;
|
|
663
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
664
|
+
var getDescriptor = DESCRIPTORS$2 && Object.getOwnPropertyDescriptor;
|
|
665
|
+
|
|
666
|
+
var EXISTS = hasOwn$5(FunctionPrototype$1, 'name');
|
|
667
|
+
// additional protection from minified / mangled / dropped function names
|
|
668
|
+
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
669
|
+
var CONFIGURABLE = EXISTS && (!DESCRIPTORS$2 || (DESCRIPTORS$2 && getDescriptor(FunctionPrototype$1, 'name').configurable));
|
|
670
|
+
|
|
671
|
+
var functionName = {
|
|
672
|
+
EXISTS: EXISTS,
|
|
673
|
+
PROPER: PROPER,
|
|
674
|
+
CONFIGURABLE: CONFIGURABLE
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
var global$h = global$A;
|
|
678
|
+
var isCallable$6 = isCallable$e;
|
|
679
|
+
var hasOwn$4 = hasOwnProperty_1;
|
|
680
|
+
var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
|
|
681
|
+
var setGlobal$1 = setGlobal$3;
|
|
682
|
+
var inspectSource$2 = inspectSource$4;
|
|
683
|
+
var InternalStateModule$1 = internalState;
|
|
684
|
+
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
685
|
+
|
|
686
|
+
var getInternalState$1 = InternalStateModule$1.get;
|
|
687
|
+
var enforceInternalState = InternalStateModule$1.enforce;
|
|
688
|
+
var TEMPLATE = String(String).split('String');
|
|
689
|
+
|
|
690
|
+
(redefine$3.exports = function (O, key, value, options) {
|
|
691
|
+
var unsafe = options ? !!options.unsafe : false;
|
|
692
|
+
var simple = options ? !!options.enumerable : false;
|
|
693
|
+
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
694
|
+
var name = options && options.name !== undefined ? options.name : key;
|
|
695
|
+
var state;
|
|
696
|
+
if (isCallable$6(value)) {
|
|
697
|
+
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
698
|
+
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
699
|
+
}
|
|
700
|
+
if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
701
|
+
createNonEnumerableProperty$1(value, 'name', name);
|
|
702
|
+
}
|
|
703
|
+
state = enforceInternalState(value);
|
|
704
|
+
if (!state.source) {
|
|
705
|
+
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
if (O === global$h) {
|
|
709
|
+
if (simple) O[key] = value;
|
|
710
|
+
else setGlobal$1(key, value);
|
|
711
|
+
return;
|
|
712
|
+
} else if (!unsafe) {
|
|
713
|
+
delete O[key];
|
|
714
|
+
} else if (!noTargetGet && O[key]) {
|
|
715
|
+
simple = true;
|
|
716
|
+
}
|
|
717
|
+
if (simple) O[key] = value;
|
|
718
|
+
else createNonEnumerableProperty$1(O, key, value);
|
|
719
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
720
|
+
})(Function.prototype, 'toString', function toString() {
|
|
721
|
+
return isCallable$6(this) && getInternalState$1(this).source || inspectSource$2(this);
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
var objectGetOwnPropertyNames = {};
|
|
725
|
+
|
|
726
|
+
var ceil = Math.ceil;
|
|
727
|
+
var floor = Math.floor;
|
|
728
|
+
|
|
729
|
+
// `ToIntegerOrInfinity` abstract operation
|
|
730
|
+
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
731
|
+
var toIntegerOrInfinity$2 = function (argument) {
|
|
732
|
+
var number = +argument;
|
|
733
|
+
// eslint-disable-next-line no-self-compare -- safe
|
|
734
|
+
return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
|
|
738
|
+
|
|
739
|
+
var max = Math.max;
|
|
740
|
+
var min$1 = Math.min;
|
|
741
|
+
|
|
742
|
+
// Helper for a popular repeating case of the spec:
|
|
743
|
+
// Let integer be ? ToInteger(index).
|
|
744
|
+
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
745
|
+
var toAbsoluteIndex$1 = function (index, length) {
|
|
746
|
+
var integer = toIntegerOrInfinity$1(index);
|
|
747
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
var toIntegerOrInfinity = toIntegerOrInfinity$2;
|
|
751
|
+
|
|
752
|
+
var min = Math.min;
|
|
753
|
+
|
|
754
|
+
// `ToLength` abstract operation
|
|
755
|
+
// https://tc39.es/ecma262/#sec-tolength
|
|
756
|
+
var toLength$1 = function (argument) {
|
|
757
|
+
return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
var toLength = toLength$1;
|
|
761
|
+
|
|
762
|
+
// `LengthOfArrayLike` abstract operation
|
|
763
|
+
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
764
|
+
var lengthOfArrayLike$3 = function (obj) {
|
|
765
|
+
return toLength(obj.length);
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
var toIndexedObject$1 = toIndexedObject$3;
|
|
769
|
+
var toAbsoluteIndex = toAbsoluteIndex$1;
|
|
770
|
+
var lengthOfArrayLike$2 = lengthOfArrayLike$3;
|
|
771
|
+
|
|
772
|
+
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
773
|
+
var createMethod$1 = function (IS_INCLUDES) {
|
|
774
|
+
return function ($this, el, fromIndex) {
|
|
775
|
+
var O = toIndexedObject$1($this);
|
|
776
|
+
var length = lengthOfArrayLike$2(O);
|
|
777
|
+
var index = toAbsoluteIndex(fromIndex, length);
|
|
778
|
+
var value;
|
|
779
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
780
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
781
|
+
if (IS_INCLUDES && el != el) while (length > index) {
|
|
782
|
+
value = O[index++];
|
|
783
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
784
|
+
if (value != value) return true;
|
|
785
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
786
|
+
} else for (;length > index; index++) {
|
|
787
|
+
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
788
|
+
} return !IS_INCLUDES && -1;
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
var arrayIncludes = {
|
|
793
|
+
// `Array.prototype.includes` method
|
|
794
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
795
|
+
includes: createMethod$1(true),
|
|
796
|
+
// `Array.prototype.indexOf` method
|
|
797
|
+
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
798
|
+
indexOf: createMethod$1(false)
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
802
|
+
var hasOwn$3 = hasOwnProperty_1;
|
|
803
|
+
var toIndexedObject = toIndexedObject$3;
|
|
804
|
+
var indexOf = arrayIncludes.indexOf;
|
|
805
|
+
var hiddenKeys$1 = hiddenKeys$3;
|
|
806
|
+
|
|
807
|
+
var push = uncurryThis$6([].push);
|
|
808
|
+
|
|
809
|
+
var objectKeysInternal = function (object, names) {
|
|
810
|
+
var O = toIndexedObject(object);
|
|
811
|
+
var i = 0;
|
|
812
|
+
var result = [];
|
|
813
|
+
var key;
|
|
814
|
+
for (key in O) !hasOwn$3(hiddenKeys$1, key) && hasOwn$3(O, key) && push(result, key);
|
|
815
|
+
// Don't enum bug & hidden keys
|
|
816
|
+
while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
|
|
817
|
+
~indexOf(result, key) || push(result, key);
|
|
818
|
+
}
|
|
819
|
+
return result;
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
// IE8- don't enum bug keys
|
|
823
|
+
var enumBugKeys$2 = [
|
|
824
|
+
'constructor',
|
|
825
|
+
'hasOwnProperty',
|
|
826
|
+
'isPrototypeOf',
|
|
827
|
+
'propertyIsEnumerable',
|
|
828
|
+
'toLocaleString',
|
|
829
|
+
'toString',
|
|
830
|
+
'valueOf'
|
|
831
|
+
];
|
|
832
|
+
|
|
833
|
+
var internalObjectKeys$1 = objectKeysInternal;
|
|
834
|
+
var enumBugKeys$1 = enumBugKeys$2;
|
|
835
|
+
|
|
836
|
+
var hiddenKeys = enumBugKeys$1.concat('length', 'prototype');
|
|
837
|
+
|
|
838
|
+
// `Object.getOwnPropertyNames` method
|
|
839
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
840
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
841
|
+
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
842
|
+
return internalObjectKeys$1(O, hiddenKeys);
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
var objectGetOwnPropertySymbols = {};
|
|
846
|
+
|
|
847
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
848
|
+
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
849
|
+
|
|
850
|
+
var getBuiltIn$4 = getBuiltIn$7;
|
|
851
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
852
|
+
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
|
853
|
+
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
|
|
854
|
+
var anObject$6 = anObject$8;
|
|
855
|
+
|
|
856
|
+
var concat$1 = uncurryThis$5([].concat);
|
|
857
|
+
|
|
858
|
+
// all object keys, includes non-enumerable and symbols
|
|
859
|
+
var ownKeys$1 = getBuiltIn$4('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
860
|
+
var keys = getOwnPropertyNamesModule.f(anObject$6(it));
|
|
861
|
+
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
|
|
862
|
+
return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
866
|
+
var ownKeys = ownKeys$1;
|
|
867
|
+
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
|
|
868
|
+
var definePropertyModule$1 = objectDefineProperty;
|
|
869
|
+
|
|
870
|
+
var copyConstructorProperties$1 = function (target, source, exceptions) {
|
|
871
|
+
var keys = ownKeys(source);
|
|
872
|
+
var defineProperty = definePropertyModule$1.f;
|
|
873
|
+
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
874
|
+
for (var i = 0; i < keys.length; i++) {
|
|
875
|
+
var key = keys[i];
|
|
876
|
+
if (!hasOwn$2(target, key) && !(exceptions && hasOwn$2(exceptions, key))) {
|
|
877
|
+
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
var fails$4 = fails$b;
|
|
883
|
+
var isCallable$5 = isCallable$e;
|
|
884
|
+
|
|
885
|
+
var replacement = /#|\.prototype\./;
|
|
886
|
+
|
|
887
|
+
var isForced$2 = function (feature, detection) {
|
|
888
|
+
var value = data[normalize(feature)];
|
|
889
|
+
return value == POLYFILL ? true
|
|
890
|
+
: value == NATIVE ? false
|
|
891
|
+
: isCallable$5(detection) ? fails$4(detection)
|
|
892
|
+
: !!detection;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
var normalize = isForced$2.normalize = function (string) {
|
|
896
|
+
return String(string).replace(replacement, '.').toLowerCase();
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
var data = isForced$2.data = {};
|
|
900
|
+
var NATIVE = isForced$2.NATIVE = 'N';
|
|
901
|
+
var POLYFILL = isForced$2.POLYFILL = 'P';
|
|
902
|
+
|
|
903
|
+
var isForced_1 = isForced$2;
|
|
904
|
+
|
|
905
|
+
var global$g = global$A;
|
|
906
|
+
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
907
|
+
var createNonEnumerableProperty = createNonEnumerableProperty$3;
|
|
908
|
+
var redefine$2 = redefine$3.exports;
|
|
909
|
+
var setGlobal = setGlobal$3;
|
|
910
|
+
var copyConstructorProperties = copyConstructorProperties$1;
|
|
911
|
+
var isForced$1 = isForced_1;
|
|
912
|
+
|
|
913
|
+
/*
|
|
914
|
+
options.target - name of the target object
|
|
915
|
+
options.global - target is the global object
|
|
916
|
+
options.stat - export as static methods of target
|
|
917
|
+
options.proto - export as prototype methods of target
|
|
918
|
+
options.real - real prototype method for the `pure` version
|
|
919
|
+
options.forced - export even if the native feature is available
|
|
920
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
921
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
922
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
923
|
+
options.sham - add a flag to not completely full polyfills
|
|
924
|
+
options.enumerable - export as enumerable property
|
|
925
|
+
options.noTargetGet - prevent calling a getter on target
|
|
926
|
+
options.name - the .name of the function if it does not match the key
|
|
927
|
+
*/
|
|
928
|
+
var _export = function (options, source) {
|
|
929
|
+
var TARGET = options.target;
|
|
930
|
+
var GLOBAL = options.global;
|
|
931
|
+
var STATIC = options.stat;
|
|
932
|
+
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
933
|
+
if (GLOBAL) {
|
|
934
|
+
target = global$g;
|
|
935
|
+
} else if (STATIC) {
|
|
936
|
+
target = global$g[TARGET] || setGlobal(TARGET, {});
|
|
937
|
+
} else {
|
|
938
|
+
target = (global$g[TARGET] || {}).prototype;
|
|
939
|
+
}
|
|
940
|
+
if (target) for (key in source) {
|
|
941
|
+
sourceProperty = source[key];
|
|
942
|
+
if (options.noTargetGet) {
|
|
943
|
+
descriptor = getOwnPropertyDescriptor$1(target, key);
|
|
944
|
+
targetProperty = descriptor && descriptor.value;
|
|
945
|
+
} else targetProperty = target[key];
|
|
946
|
+
FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
947
|
+
// contained in target
|
|
948
|
+
if (!FORCED && targetProperty !== undefined) {
|
|
949
|
+
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
950
|
+
copyConstructorProperties(sourceProperty, targetProperty);
|
|
951
|
+
}
|
|
952
|
+
// add a flag to not completely full polyfills
|
|
953
|
+
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
954
|
+
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
955
|
+
}
|
|
956
|
+
// extend global
|
|
957
|
+
redefine$2(target, key, sourceProperty, options);
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
var global$f = global$A;
|
|
962
|
+
|
|
963
|
+
var nativePromiseConstructor = global$f.Promise;
|
|
964
|
+
|
|
965
|
+
var redefine$1 = redefine$3.exports;
|
|
966
|
+
|
|
967
|
+
var redefineAll$1 = function (target, src, options) {
|
|
968
|
+
for (var key in src) redefine$1(target, key, src[key], options);
|
|
969
|
+
return target;
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
var global$e = global$A;
|
|
973
|
+
var isCallable$4 = isCallable$e;
|
|
974
|
+
|
|
975
|
+
var String$2 = global$e.String;
|
|
976
|
+
var TypeError$8 = global$e.TypeError;
|
|
977
|
+
|
|
978
|
+
var aPossiblePrototype$1 = function (argument) {
|
|
979
|
+
if (typeof argument == 'object' || isCallable$4(argument)) return argument;
|
|
980
|
+
throw TypeError$8("Can't set " + String$2(argument) + ' as a prototype');
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
/* eslint-disable no-proto -- safe */
|
|
984
|
+
|
|
985
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
986
|
+
var anObject$5 = anObject$8;
|
|
987
|
+
var aPossiblePrototype = aPossiblePrototype$1;
|
|
988
|
+
|
|
989
|
+
// `Object.setPrototypeOf` method
|
|
990
|
+
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
991
|
+
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
992
|
+
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
993
|
+
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
994
|
+
var CORRECT_SETTER = false;
|
|
995
|
+
var test = {};
|
|
996
|
+
var setter;
|
|
997
|
+
try {
|
|
998
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
999
|
+
setter = uncurryThis$4(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1000
|
+
setter(test, []);
|
|
1001
|
+
CORRECT_SETTER = test instanceof Array;
|
|
1002
|
+
} catch (error) { /* empty */ }
|
|
1003
|
+
return function setPrototypeOf(O, proto) {
|
|
1004
|
+
anObject$5(O);
|
|
1005
|
+
aPossiblePrototype(proto);
|
|
1006
|
+
if (CORRECT_SETTER) setter(O, proto);
|
|
1007
|
+
else O.__proto__ = proto;
|
|
1008
|
+
return O;
|
|
1009
|
+
};
|
|
1010
|
+
}() : undefined);
|
|
1011
|
+
|
|
1012
|
+
var defineProperty$1 = objectDefineProperty.f;
|
|
1013
|
+
var hasOwn$1 = hasOwnProperty_1;
|
|
1014
|
+
var wellKnownSymbol$8 = wellKnownSymbol$a;
|
|
1015
|
+
|
|
1016
|
+
var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag');
|
|
1017
|
+
|
|
1018
|
+
var setToStringTag$1 = function (target, TAG, STATIC) {
|
|
1019
|
+
if (target && !STATIC) target = target.prototype;
|
|
1020
|
+
if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
|
|
1021
|
+
defineProperty$1(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
var getBuiltIn$3 = getBuiltIn$7;
|
|
1026
|
+
var definePropertyModule = objectDefineProperty;
|
|
1027
|
+
var wellKnownSymbol$7 = wellKnownSymbol$a;
|
|
1028
|
+
var DESCRIPTORS$1 = descriptors;
|
|
1029
|
+
|
|
1030
|
+
var SPECIES$2 = wellKnownSymbol$7('species');
|
|
1031
|
+
|
|
1032
|
+
var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
1033
|
+
var Constructor = getBuiltIn$3(CONSTRUCTOR_NAME);
|
|
1034
|
+
var defineProperty = definePropertyModule.f;
|
|
1035
|
+
|
|
1036
|
+
if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES$2]) {
|
|
1037
|
+
defineProperty(Constructor, SPECIES$2, {
|
|
1038
|
+
configurable: true,
|
|
1039
|
+
get: function () { return this; }
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
var global$d = global$A;
|
|
1045
|
+
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
1046
|
+
|
|
1047
|
+
var TypeError$7 = global$d.TypeError;
|
|
1048
|
+
|
|
1049
|
+
var anInstance$1 = function (it, Prototype) {
|
|
1050
|
+
if (isPrototypeOf$1(Prototype, it)) return it;
|
|
1051
|
+
throw TypeError$7('Incorrect invocation');
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
var uncurryThis$3 = functionUncurryThis;
|
|
1055
|
+
var aCallable$4 = aCallable$6;
|
|
1056
|
+
var NATIVE_BIND$1 = functionBindNative;
|
|
1057
|
+
|
|
1058
|
+
var bind$4 = uncurryThis$3(uncurryThis$3.bind);
|
|
1059
|
+
|
|
1060
|
+
// optional / simple context binding
|
|
1061
|
+
var functionBindContext = function (fn, that) {
|
|
1062
|
+
aCallable$4(fn);
|
|
1063
|
+
return that === undefined ? fn : NATIVE_BIND$1 ? bind$4(fn, that) : function (/* ...args */) {
|
|
1064
|
+
return fn.apply(that, arguments);
|
|
1065
|
+
};
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
var iterators = {};
|
|
1069
|
+
|
|
1070
|
+
var wellKnownSymbol$6 = wellKnownSymbol$a;
|
|
1071
|
+
var Iterators$1 = iterators;
|
|
1072
|
+
|
|
1073
|
+
var ITERATOR$2 = wellKnownSymbol$6('iterator');
|
|
1074
|
+
var ArrayPrototype = Array.prototype;
|
|
1075
|
+
|
|
1076
|
+
// check on default Array iterator
|
|
1077
|
+
var isArrayIteratorMethod$1 = function (it) {
|
|
1078
|
+
return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
var wellKnownSymbol$5 = wellKnownSymbol$a;
|
|
1082
|
+
|
|
1083
|
+
var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
|
|
1084
|
+
var test = {};
|
|
1085
|
+
|
|
1086
|
+
test[TO_STRING_TAG$1] = 'z';
|
|
1087
|
+
|
|
1088
|
+
var toStringTagSupport = String(test) === '[object z]';
|
|
1089
|
+
|
|
1090
|
+
var global$c = global$A;
|
|
1091
|
+
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1092
|
+
var isCallable$3 = isCallable$e;
|
|
1093
|
+
var classofRaw = classofRaw$1;
|
|
1094
|
+
var wellKnownSymbol$4 = wellKnownSymbol$a;
|
|
1095
|
+
|
|
1096
|
+
var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
|
|
1097
|
+
var Object$1 = global$c.Object;
|
|
1098
|
+
|
|
1099
|
+
// ES3 wrong here
|
|
1100
|
+
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
1101
|
+
|
|
1102
|
+
// fallback for IE11 Script Access Denied error
|
|
1103
|
+
var tryGet = function (it, key) {
|
|
1104
|
+
try {
|
|
1105
|
+
return it[key];
|
|
1106
|
+
} catch (error) { /* empty */ }
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
1110
|
+
var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
|
1111
|
+
var O, tag, result;
|
|
1112
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
1113
|
+
// @@toStringTag case
|
|
1114
|
+
: typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
|
|
1115
|
+
// builtinTag case
|
|
1116
|
+
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
1117
|
+
// ES3 arguments fallback
|
|
1118
|
+
: (result = classofRaw(O)) == 'Object' && isCallable$3(O.callee) ? 'Arguments' : result;
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1121
|
+
var classof$2 = classof$3;
|
|
1122
|
+
var getMethod$1 = getMethod$3;
|
|
1123
|
+
var Iterators = iterators;
|
|
1124
|
+
var wellKnownSymbol$3 = wellKnownSymbol$a;
|
|
1125
|
+
|
|
1126
|
+
var ITERATOR$1 = wellKnownSymbol$3('iterator');
|
|
1127
|
+
|
|
1128
|
+
var getIteratorMethod$2 = function (it) {
|
|
1129
|
+
if (it != undefined) return getMethod$1(it, ITERATOR$1)
|
|
1130
|
+
|| getMethod$1(it, '@@iterator')
|
|
1131
|
+
|| Iterators[classof$2(it)];
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
var global$b = global$A;
|
|
1135
|
+
var call$5 = functionCall;
|
|
1136
|
+
var aCallable$3 = aCallable$6;
|
|
1137
|
+
var anObject$4 = anObject$8;
|
|
1138
|
+
var tryToString$2 = tryToString$4;
|
|
1139
|
+
var getIteratorMethod$1 = getIteratorMethod$2;
|
|
1140
|
+
|
|
1141
|
+
var TypeError$6 = global$b.TypeError;
|
|
1142
|
+
|
|
1143
|
+
var getIterator$1 = function (argument, usingIterator) {
|
|
1144
|
+
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
|
|
1145
|
+
if (aCallable$3(iteratorMethod)) return anObject$4(call$5(iteratorMethod, argument));
|
|
1146
|
+
throw TypeError$6(tryToString$2(argument) + ' is not iterable');
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
var call$4 = functionCall;
|
|
1150
|
+
var anObject$3 = anObject$8;
|
|
1151
|
+
var getMethod = getMethod$3;
|
|
1152
|
+
|
|
1153
|
+
var iteratorClose$1 = function (iterator, kind, value) {
|
|
1154
|
+
var innerResult, innerError;
|
|
1155
|
+
anObject$3(iterator);
|
|
1156
|
+
try {
|
|
1157
|
+
innerResult = getMethod(iterator, 'return');
|
|
1158
|
+
if (!innerResult) {
|
|
1159
|
+
if (kind === 'throw') throw value;
|
|
1160
|
+
return value;
|
|
1161
|
+
}
|
|
1162
|
+
innerResult = call$4(innerResult, iterator);
|
|
1163
|
+
} catch (error) {
|
|
1164
|
+
innerError = true;
|
|
1165
|
+
innerResult = error;
|
|
1166
|
+
}
|
|
1167
|
+
if (kind === 'throw') throw value;
|
|
1168
|
+
if (innerError) throw innerResult;
|
|
1169
|
+
anObject$3(innerResult);
|
|
1170
|
+
return value;
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
var global$a = global$A;
|
|
1174
|
+
var bind$3 = functionBindContext;
|
|
1175
|
+
var call$3 = functionCall;
|
|
1176
|
+
var anObject$2 = anObject$8;
|
|
1177
|
+
var tryToString$1 = tryToString$4;
|
|
1178
|
+
var isArrayIteratorMethod = isArrayIteratorMethod$1;
|
|
1179
|
+
var lengthOfArrayLike$1 = lengthOfArrayLike$3;
|
|
1180
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
1181
|
+
var getIterator = getIterator$1;
|
|
1182
|
+
var getIteratorMethod = getIteratorMethod$2;
|
|
1183
|
+
var iteratorClose = iteratorClose$1;
|
|
1184
|
+
|
|
1185
|
+
var TypeError$5 = global$a.TypeError;
|
|
1186
|
+
|
|
1187
|
+
var Result = function (stopped, result) {
|
|
1188
|
+
this.stopped = stopped;
|
|
1189
|
+
this.result = result;
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
var ResultPrototype = Result.prototype;
|
|
1193
|
+
|
|
1194
|
+
var iterate$1 = function (iterable, unboundFunction, options) {
|
|
1195
|
+
var that = options && options.that;
|
|
1196
|
+
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
1197
|
+
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
1198
|
+
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
1199
|
+
var fn = bind$3(unboundFunction, that);
|
|
1200
|
+
var iterator, iterFn, index, length, result, next, step;
|
|
1201
|
+
|
|
1202
|
+
var stop = function (condition) {
|
|
1203
|
+
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
1204
|
+
return new Result(true, condition);
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
var callFn = function (value) {
|
|
1208
|
+
if (AS_ENTRIES) {
|
|
1209
|
+
anObject$2(value);
|
|
1210
|
+
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
1211
|
+
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
if (IS_ITERATOR) {
|
|
1215
|
+
iterator = iterable;
|
|
1216
|
+
} else {
|
|
1217
|
+
iterFn = getIteratorMethod(iterable);
|
|
1218
|
+
if (!iterFn) throw TypeError$5(tryToString$1(iterable) + ' is not iterable');
|
|
1219
|
+
// optimisation for array iterators
|
|
1220
|
+
if (isArrayIteratorMethod(iterFn)) {
|
|
1221
|
+
for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
|
|
1222
|
+
result = callFn(iterable[index]);
|
|
1223
|
+
if (result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
1224
|
+
} return new Result(false);
|
|
1225
|
+
}
|
|
1226
|
+
iterator = getIterator(iterable, iterFn);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
next = iterator.next;
|
|
1230
|
+
while (!(step = call$3(next, iterator)).done) {
|
|
1231
|
+
try {
|
|
1232
|
+
result = callFn(step.value);
|
|
1233
|
+
} catch (error) {
|
|
1234
|
+
iteratorClose(iterator, 'throw', error);
|
|
1235
|
+
}
|
|
1236
|
+
if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
1237
|
+
} return new Result(false);
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
var wellKnownSymbol$2 = wellKnownSymbol$a;
|
|
1241
|
+
|
|
1242
|
+
var ITERATOR = wellKnownSymbol$2('iterator');
|
|
1243
|
+
var SAFE_CLOSING = false;
|
|
1244
|
+
|
|
1245
|
+
try {
|
|
1246
|
+
var called = 0;
|
|
1247
|
+
var iteratorWithReturn = {
|
|
1248
|
+
next: function () {
|
|
1249
|
+
return { done: !!called++ };
|
|
1250
|
+
},
|
|
1251
|
+
'return': function () {
|
|
1252
|
+
SAFE_CLOSING = true;
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
iteratorWithReturn[ITERATOR] = function () {
|
|
1256
|
+
return this;
|
|
1257
|
+
};
|
|
1258
|
+
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
1259
|
+
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
1260
|
+
} catch (error) { /* empty */ }
|
|
1261
|
+
|
|
1262
|
+
var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
|
|
1263
|
+
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
1264
|
+
var ITERATION_SUPPORT = false;
|
|
1265
|
+
try {
|
|
1266
|
+
var object = {};
|
|
1267
|
+
object[ITERATOR] = function () {
|
|
1268
|
+
return {
|
|
1269
|
+
next: function () {
|
|
1270
|
+
return { done: ITERATION_SUPPORT = true };
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
};
|
|
1274
|
+
exec(object);
|
|
1275
|
+
} catch (error) { /* empty */ }
|
|
1276
|
+
return ITERATION_SUPPORT;
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
var uncurryThis$2 = functionUncurryThis;
|
|
1280
|
+
var fails$3 = fails$b;
|
|
1281
|
+
var isCallable$2 = isCallable$e;
|
|
1282
|
+
var classof$1 = classof$3;
|
|
1283
|
+
var getBuiltIn$2 = getBuiltIn$7;
|
|
1284
|
+
var inspectSource$1 = inspectSource$4;
|
|
1285
|
+
|
|
1286
|
+
var noop = function () { /* empty */ };
|
|
1287
|
+
var empty = [];
|
|
1288
|
+
var construct = getBuiltIn$2('Reflect', 'construct');
|
|
1289
|
+
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1290
|
+
var exec = uncurryThis$2(constructorRegExp.exec);
|
|
1291
|
+
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
1292
|
+
|
|
1293
|
+
var isConstructorModern = function isConstructor(argument) {
|
|
1294
|
+
if (!isCallable$2(argument)) return false;
|
|
1295
|
+
try {
|
|
1296
|
+
construct(noop, empty, argument);
|
|
1297
|
+
return true;
|
|
1298
|
+
} catch (error) {
|
|
1299
|
+
return false;
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
var isConstructorLegacy = function isConstructor(argument) {
|
|
1304
|
+
if (!isCallable$2(argument)) return false;
|
|
1305
|
+
switch (classof$1(argument)) {
|
|
1306
|
+
case 'AsyncFunction':
|
|
1307
|
+
case 'GeneratorFunction':
|
|
1308
|
+
case 'AsyncGeneratorFunction': return false;
|
|
1309
|
+
}
|
|
1310
|
+
try {
|
|
1311
|
+
// we can't check .prototype since constructors produced by .bind haven't it
|
|
1312
|
+
// `Function#toString` throws on some built-it function in some legacy engines
|
|
1313
|
+
// (for example, `DOMQuad` and similar in FF41-)
|
|
1314
|
+
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
|
|
1315
|
+
} catch (error) {
|
|
1316
|
+
return true;
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
isConstructorLegacy.sham = true;
|
|
1321
|
+
|
|
1322
|
+
// `IsConstructor` abstract operation
|
|
1323
|
+
// https://tc39.es/ecma262/#sec-isconstructor
|
|
1324
|
+
var isConstructor$1 = !construct || fails$3(function () {
|
|
1325
|
+
var called;
|
|
1326
|
+
return isConstructorModern(isConstructorModern.call)
|
|
1327
|
+
|| !isConstructorModern(Object)
|
|
1328
|
+
|| !isConstructorModern(function () { called = true; })
|
|
1329
|
+
|| called;
|
|
1330
|
+
}) ? isConstructorLegacy : isConstructorModern;
|
|
1331
|
+
|
|
1332
|
+
var global$9 = global$A;
|
|
1333
|
+
var isConstructor = isConstructor$1;
|
|
1334
|
+
var tryToString = tryToString$4;
|
|
1335
|
+
|
|
1336
|
+
var TypeError$4 = global$9.TypeError;
|
|
1337
|
+
|
|
1338
|
+
// `Assert: IsConstructor(argument) is true`
|
|
1339
|
+
var aConstructor$1 = function (argument) {
|
|
1340
|
+
if (isConstructor(argument)) return argument;
|
|
1341
|
+
throw TypeError$4(tryToString(argument) + ' is not a constructor');
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1344
|
+
var anObject$1 = anObject$8;
|
|
1345
|
+
var aConstructor = aConstructor$1;
|
|
1346
|
+
var wellKnownSymbol$1 = wellKnownSymbol$a;
|
|
1347
|
+
|
|
1348
|
+
var SPECIES$1 = wellKnownSymbol$1('species');
|
|
1349
|
+
|
|
1350
|
+
// `SpeciesConstructor` abstract operation
|
|
1351
|
+
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
1352
|
+
var speciesConstructor$1 = function (O, defaultConstructor) {
|
|
1353
|
+
var C = anObject$1(O).constructor;
|
|
1354
|
+
var S;
|
|
1355
|
+
return C === undefined || (S = anObject$1(C)[SPECIES$1]) == undefined ? defaultConstructor : aConstructor(S);
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
var NATIVE_BIND = functionBindNative;
|
|
1359
|
+
|
|
1360
|
+
var FunctionPrototype = Function.prototype;
|
|
1361
|
+
var apply$1 = FunctionPrototype.apply;
|
|
1362
|
+
var call$2 = FunctionPrototype.call;
|
|
1363
|
+
|
|
1364
|
+
// eslint-disable-next-line es/no-reflect -- safe
|
|
1365
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$2.bind(apply$1) : function () {
|
|
1366
|
+
return call$2.apply(apply$1, arguments);
|
|
1367
|
+
});
|
|
1368
|
+
|
|
1369
|
+
var getBuiltIn$1 = getBuiltIn$7;
|
|
1370
|
+
|
|
1371
|
+
var html$1 = getBuiltIn$1('document', 'documentElement');
|
|
1372
|
+
|
|
1373
|
+
var uncurryThis$1 = functionUncurryThis;
|
|
1374
|
+
|
|
1375
|
+
var arraySlice$1 = uncurryThis$1([].slice);
|
|
1376
|
+
|
|
1377
|
+
var global$8 = global$A;
|
|
1378
|
+
|
|
1379
|
+
var TypeError$3 = global$8.TypeError;
|
|
1380
|
+
|
|
1381
|
+
var validateArgumentsLength$1 = function (passed, required) {
|
|
1382
|
+
if (passed < required) throw TypeError$3('Not enough arguments');
|
|
1383
|
+
return passed;
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
var userAgent$2 = engineUserAgent;
|
|
1387
|
+
|
|
1388
|
+
var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
|
|
1389
|
+
|
|
1390
|
+
var classof = classofRaw$1;
|
|
1391
|
+
var global$7 = global$A;
|
|
1392
|
+
|
|
1393
|
+
var engineIsNode = classof(global$7.process) == 'process';
|
|
1394
|
+
|
|
1395
|
+
var global$6 = global$A;
|
|
1396
|
+
var apply = functionApply;
|
|
1397
|
+
var bind$2 = functionBindContext;
|
|
1398
|
+
var isCallable$1 = isCallable$e;
|
|
1399
|
+
var hasOwn = hasOwnProperty_1;
|
|
1400
|
+
var fails$2 = fails$b;
|
|
1401
|
+
var html = html$1;
|
|
1402
|
+
var arraySlice = arraySlice$1;
|
|
1403
|
+
var createElement = documentCreateElement;
|
|
1404
|
+
var validateArgumentsLength = validateArgumentsLength$1;
|
|
1405
|
+
var IS_IOS$1 = engineIsIos;
|
|
1406
|
+
var IS_NODE$3 = engineIsNode;
|
|
1407
|
+
|
|
1408
|
+
var set$1 = global$6.setImmediate;
|
|
1409
|
+
var clear = global$6.clearImmediate;
|
|
1410
|
+
var process$3 = global$6.process;
|
|
1411
|
+
var Dispatch = global$6.Dispatch;
|
|
1412
|
+
var Function$1 = global$6.Function;
|
|
1413
|
+
var MessageChannel = global$6.MessageChannel;
|
|
1414
|
+
var String$1 = global$6.String;
|
|
1415
|
+
var counter = 0;
|
|
1416
|
+
var queue$1 = {};
|
|
1417
|
+
var ONREADYSTATECHANGE = 'onreadystatechange';
|
|
1418
|
+
var location, defer, channel, port;
|
|
1419
|
+
|
|
1420
|
+
try {
|
|
1421
|
+
// Deno throws a ReferenceError on `location` access without `--location` flag
|
|
1422
|
+
location = global$6.location;
|
|
1423
|
+
} catch (error) { /* empty */ }
|
|
1424
|
+
|
|
1425
|
+
var run = function (id) {
|
|
1426
|
+
if (hasOwn(queue$1, id)) {
|
|
1427
|
+
var fn = queue$1[id];
|
|
1428
|
+
delete queue$1[id];
|
|
1429
|
+
fn();
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
var runner = function (id) {
|
|
1434
|
+
return function () {
|
|
1435
|
+
run(id);
|
|
1436
|
+
};
|
|
1437
|
+
};
|
|
1438
|
+
|
|
1439
|
+
var listener = function (event) {
|
|
1440
|
+
run(event.data);
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
var post = function (id) {
|
|
1444
|
+
// old engines have not location.origin
|
|
1445
|
+
global$6.postMessage(String$1(id), location.protocol + '//' + location.host);
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
1449
|
+
if (!set$1 || !clear) {
|
|
1450
|
+
set$1 = function setImmediate(handler) {
|
|
1451
|
+
validateArgumentsLength(arguments.length, 1);
|
|
1452
|
+
var fn = isCallable$1(handler) ? handler : Function$1(handler);
|
|
1453
|
+
var args = arraySlice(arguments, 1);
|
|
1454
|
+
queue$1[++counter] = function () {
|
|
1455
|
+
apply(fn, undefined, args);
|
|
1456
|
+
};
|
|
1457
|
+
defer(counter);
|
|
1458
|
+
return counter;
|
|
1459
|
+
};
|
|
1460
|
+
clear = function clearImmediate(id) {
|
|
1461
|
+
delete queue$1[id];
|
|
1462
|
+
};
|
|
1463
|
+
// Node.js 0.8-
|
|
1464
|
+
if (IS_NODE$3) {
|
|
1465
|
+
defer = function (id) {
|
|
1466
|
+
process$3.nextTick(runner(id));
|
|
1467
|
+
};
|
|
1468
|
+
// Sphere (JS game engine) Dispatch API
|
|
1469
|
+
} else if (Dispatch && Dispatch.now) {
|
|
1470
|
+
defer = function (id) {
|
|
1471
|
+
Dispatch.now(runner(id));
|
|
1472
|
+
};
|
|
1473
|
+
// Browsers with MessageChannel, includes WebWorkers
|
|
1474
|
+
// except iOS - https://github.com/zloirock/core-js/issues/624
|
|
1475
|
+
} else if (MessageChannel && !IS_IOS$1) {
|
|
1476
|
+
channel = new MessageChannel();
|
|
1477
|
+
port = channel.port2;
|
|
1478
|
+
channel.port1.onmessage = listener;
|
|
1479
|
+
defer = bind$2(port.postMessage, port);
|
|
1480
|
+
// Browsers with postMessage, skip WebWorkers
|
|
1481
|
+
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
|
1482
|
+
} else if (
|
|
1483
|
+
global$6.addEventListener &&
|
|
1484
|
+
isCallable$1(global$6.postMessage) &&
|
|
1485
|
+
!global$6.importScripts &&
|
|
1486
|
+
location && location.protocol !== 'file:' &&
|
|
1487
|
+
!fails$2(post)
|
|
1488
|
+
) {
|
|
1489
|
+
defer = post;
|
|
1490
|
+
global$6.addEventListener('message', listener, false);
|
|
1491
|
+
// IE8-
|
|
1492
|
+
} else if (ONREADYSTATECHANGE in createElement('script')) {
|
|
1493
|
+
defer = function (id) {
|
|
1494
|
+
html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
|
|
1495
|
+
html.removeChild(this);
|
|
1496
|
+
run(id);
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1499
|
+
// Rest old browsers
|
|
1500
|
+
} else {
|
|
1501
|
+
defer = function (id) {
|
|
1502
|
+
setTimeout(runner(id), 0);
|
|
1503
|
+
};
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
var task$1 = {
|
|
1508
|
+
set: set$1,
|
|
1509
|
+
clear: clear
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
var userAgent$1 = engineUserAgent;
|
|
1513
|
+
var global$5 = global$A;
|
|
1514
|
+
|
|
1515
|
+
var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && global$5.Pebble !== undefined;
|
|
1516
|
+
|
|
1517
|
+
var userAgent = engineUserAgent;
|
|
1518
|
+
|
|
1519
|
+
var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
|
|
1520
|
+
|
|
1521
|
+
var global$4 = global$A;
|
|
1522
|
+
var bind$1 = functionBindContext;
|
|
1523
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
1524
|
+
var macrotask = task$1.set;
|
|
1525
|
+
var IS_IOS = engineIsIos;
|
|
1526
|
+
var IS_IOS_PEBBLE = engineIsIosPebble;
|
|
1527
|
+
var IS_WEBOS_WEBKIT = engineIsWebosWebkit;
|
|
1528
|
+
var IS_NODE$2 = engineIsNode;
|
|
1529
|
+
|
|
1530
|
+
var MutationObserver = global$4.MutationObserver || global$4.WebKitMutationObserver;
|
|
1531
|
+
var document$2 = global$4.document;
|
|
1532
|
+
var process$2 = global$4.process;
|
|
1533
|
+
var Promise$1 = global$4.Promise;
|
|
1534
|
+
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
|
|
1535
|
+
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global$4, 'queueMicrotask');
|
|
1536
|
+
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
|
|
1537
|
+
|
|
1538
|
+
var flush, head, last, notify$1, toggle, node$1, promise, then;
|
|
1539
|
+
|
|
1540
|
+
// modern engines have queueMicrotask method
|
|
1541
|
+
if (!queueMicrotask) {
|
|
1542
|
+
flush = function () {
|
|
1543
|
+
var parent, fn;
|
|
1544
|
+
if (IS_NODE$2 && (parent = process$2.domain)) parent.exit();
|
|
1545
|
+
while (head) {
|
|
1546
|
+
fn = head.fn;
|
|
1547
|
+
head = head.next;
|
|
1548
|
+
try {
|
|
1549
|
+
fn();
|
|
1550
|
+
} catch (error) {
|
|
1551
|
+
if (head) notify$1();
|
|
1552
|
+
else last = undefined;
|
|
1553
|
+
throw error;
|
|
1554
|
+
}
|
|
1555
|
+
} last = undefined;
|
|
1556
|
+
if (parent) parent.enter();
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
|
|
1560
|
+
// also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
|
|
1561
|
+
if (!IS_IOS && !IS_NODE$2 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
|
|
1562
|
+
toggle = true;
|
|
1563
|
+
node$1 = document$2.createTextNode('');
|
|
1564
|
+
new MutationObserver(flush).observe(node$1, { characterData: true });
|
|
1565
|
+
notify$1 = function () {
|
|
1566
|
+
node$1.data = toggle = !toggle;
|
|
1567
|
+
};
|
|
1568
|
+
// environments with maybe non-completely correct, but existent Promise
|
|
1569
|
+
} else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
|
|
1570
|
+
// Promise.resolve without an argument throws an error in LG WebOS 2
|
|
1571
|
+
promise = Promise$1.resolve(undefined);
|
|
1572
|
+
// workaround of WebKit ~ iOS Safari 10.1 bug
|
|
1573
|
+
promise.constructor = Promise$1;
|
|
1574
|
+
then = bind$1(promise.then, promise);
|
|
1575
|
+
notify$1 = function () {
|
|
1576
|
+
then(flush);
|
|
1577
|
+
};
|
|
1578
|
+
// Node.js without promises
|
|
1579
|
+
} else if (IS_NODE$2) {
|
|
1580
|
+
notify$1 = function () {
|
|
1581
|
+
process$2.nextTick(flush);
|
|
1582
|
+
};
|
|
1583
|
+
// for other environments - macrotask based on:
|
|
1584
|
+
// - setImmediate
|
|
1585
|
+
// - MessageChannel
|
|
1586
|
+
// - window.postMessag
|
|
1587
|
+
// - onreadystatechange
|
|
1588
|
+
// - setTimeout
|
|
1589
|
+
} else {
|
|
1590
|
+
// strange IE + webpack dev server bug - use .bind(global)
|
|
1591
|
+
macrotask = bind$1(macrotask, global$4);
|
|
1592
|
+
notify$1 = function () {
|
|
1593
|
+
macrotask(flush);
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
var microtask$1 = queueMicrotask || function (fn) {
|
|
1599
|
+
var task = { fn: fn, next: undefined };
|
|
1600
|
+
if (last) last.next = task;
|
|
1601
|
+
if (!head) {
|
|
1602
|
+
head = task;
|
|
1603
|
+
notify$1();
|
|
1604
|
+
} last = task;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
var newPromiseCapability$2 = {};
|
|
1608
|
+
|
|
1609
|
+
var aCallable$2 = aCallable$6;
|
|
1610
|
+
|
|
1611
|
+
var PromiseCapability = function (C) {
|
|
1612
|
+
var resolve, reject;
|
|
1613
|
+
this.promise = new C(function ($$resolve, $$reject) {
|
|
1614
|
+
if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
|
1615
|
+
resolve = $$resolve;
|
|
1616
|
+
reject = $$reject;
|
|
1617
|
+
});
|
|
1618
|
+
this.resolve = aCallable$2(resolve);
|
|
1619
|
+
this.reject = aCallable$2(reject);
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
// `NewPromiseCapability` abstract operation
|
|
1623
|
+
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
1624
|
+
newPromiseCapability$2.f = function (C) {
|
|
1625
|
+
return new PromiseCapability(C);
|
|
1626
|
+
};
|
|
1627
|
+
|
|
1628
|
+
var anObject = anObject$8;
|
|
1629
|
+
var isObject$1 = isObject$7;
|
|
1630
|
+
var newPromiseCapability$1 = newPromiseCapability$2;
|
|
1631
|
+
|
|
1632
|
+
var promiseResolve$1 = function (C, x) {
|
|
1633
|
+
anObject(C);
|
|
1634
|
+
if (isObject$1(x) && x.constructor === C) return x;
|
|
1635
|
+
var promiseCapability = newPromiseCapability$1.f(C);
|
|
1636
|
+
var resolve = promiseCapability.resolve;
|
|
1637
|
+
resolve(x);
|
|
1638
|
+
return promiseCapability.promise;
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1641
|
+
var global$3 = global$A;
|
|
1642
|
+
|
|
1643
|
+
var hostReportErrors$1 = function (a, b) {
|
|
1644
|
+
var console = global$3.console;
|
|
1645
|
+
if (console && console.error) {
|
|
1646
|
+
arguments.length == 1 ? console.error(a) : console.error(a, b);
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
|
|
1650
|
+
var perform$1 = function (exec) {
|
|
1651
|
+
try {
|
|
1652
|
+
return { error: false, value: exec() };
|
|
1653
|
+
} catch (error) {
|
|
1654
|
+
return { error: true, value: error };
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
var Queue$1 = function () {
|
|
1659
|
+
this.head = null;
|
|
1660
|
+
this.tail = null;
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1663
|
+
Queue$1.prototype = {
|
|
1664
|
+
add: function (item) {
|
|
1665
|
+
var entry = { item: item, next: null };
|
|
1666
|
+
if (this.head) this.tail.next = entry;
|
|
1667
|
+
else this.head = entry;
|
|
1668
|
+
this.tail = entry;
|
|
1669
|
+
},
|
|
1670
|
+
get: function () {
|
|
1671
|
+
var entry = this.head;
|
|
1672
|
+
if (entry) {
|
|
1673
|
+
this.head = entry.next;
|
|
1674
|
+
if (this.tail === entry) this.tail = null;
|
|
1675
|
+
return entry.item;
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
var queue = Queue$1;
|
|
1681
|
+
|
|
1682
|
+
var engineIsBrowser = typeof window == 'object';
|
|
1683
|
+
|
|
1684
|
+
var $$2 = _export;
|
|
1685
|
+
var global$2 = global$A;
|
|
1686
|
+
var getBuiltIn = getBuiltIn$7;
|
|
1687
|
+
var call$1 = functionCall;
|
|
1688
|
+
var NativePromise = nativePromiseConstructor;
|
|
1689
|
+
var redefine = redefine$3.exports;
|
|
1690
|
+
var redefineAll = redefineAll$1;
|
|
1691
|
+
var setPrototypeOf = objectSetPrototypeOf;
|
|
1692
|
+
var setToStringTag = setToStringTag$1;
|
|
1693
|
+
var setSpecies = setSpecies$1;
|
|
1694
|
+
var aCallable$1 = aCallable$6;
|
|
1695
|
+
var isCallable = isCallable$e;
|
|
1696
|
+
var isObject = isObject$7;
|
|
1697
|
+
var anInstance = anInstance$1;
|
|
1698
|
+
var inspectSource = inspectSource$4;
|
|
1699
|
+
var iterate = iterate$1;
|
|
1700
|
+
var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
|
|
1701
|
+
var speciesConstructor = speciesConstructor$1;
|
|
1702
|
+
var task = task$1.set;
|
|
1703
|
+
var microtask = microtask$1;
|
|
1704
|
+
var promiseResolve = promiseResolve$1;
|
|
1705
|
+
var hostReportErrors = hostReportErrors$1;
|
|
1706
|
+
var newPromiseCapabilityModule = newPromiseCapability$2;
|
|
1707
|
+
var perform = perform$1;
|
|
1708
|
+
var Queue = queue;
|
|
1709
|
+
var InternalStateModule = internalState;
|
|
1710
|
+
var isForced = isForced_1;
|
|
1711
|
+
var wellKnownSymbol = wellKnownSymbol$a;
|
|
1712
|
+
var IS_BROWSER = engineIsBrowser;
|
|
1713
|
+
var IS_NODE$1 = engineIsNode;
|
|
1714
|
+
var V8_VERSION = engineV8Version;
|
|
1715
|
+
|
|
1716
|
+
var SPECIES = wellKnownSymbol('species');
|
|
1717
|
+
var PROMISE = 'Promise';
|
|
1718
|
+
|
|
1719
|
+
var getInternalState = InternalStateModule.getterFor(PROMISE);
|
|
1720
|
+
var setInternalState = InternalStateModule.set;
|
|
1721
|
+
var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
|
|
1722
|
+
var NativePromisePrototype = NativePromise && NativePromise.prototype;
|
|
1723
|
+
var PromiseConstructor = NativePromise;
|
|
1724
|
+
var PromisePrototype = NativePromisePrototype;
|
|
1725
|
+
var TypeError$2 = global$2.TypeError;
|
|
1726
|
+
var document$1 = global$2.document;
|
|
1727
|
+
var process$1 = global$2.process;
|
|
1728
|
+
var newPromiseCapability = newPromiseCapabilityModule.f;
|
|
1729
|
+
var newGenericPromiseCapability = newPromiseCapability;
|
|
1730
|
+
|
|
1731
|
+
var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$2.dispatchEvent);
|
|
1732
|
+
var NATIVE_REJECTION_EVENT = isCallable(global$2.PromiseRejectionEvent);
|
|
1733
|
+
var UNHANDLED_REJECTION = 'unhandledrejection';
|
|
1734
|
+
var REJECTION_HANDLED = 'rejectionhandled';
|
|
1735
|
+
var PENDING = 0;
|
|
1736
|
+
var FULFILLED = 1;
|
|
1737
|
+
var REJECTED = 2;
|
|
1738
|
+
var HANDLED = 1;
|
|
1739
|
+
var UNHANDLED = 2;
|
|
1740
|
+
var SUBCLASSING = false;
|
|
1741
|
+
|
|
1742
|
+
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
1743
|
+
|
|
1744
|
+
var FORCED = isForced(PROMISE, function () {
|
|
1745
|
+
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
|
|
1746
|
+
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
|
|
1747
|
+
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
1748
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
1749
|
+
// We can't detect it synchronously, so just check versions
|
|
1750
|
+
if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
|
|
1751
|
+
// We can't use @@species feature detection in V8 since it causes
|
|
1752
|
+
// deoptimization and performance degradation
|
|
1753
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
1754
|
+
if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
|
|
1755
|
+
// Detect correctness of subclassing with @@species support
|
|
1756
|
+
var promise = new PromiseConstructor(function (resolve) { resolve(1); });
|
|
1757
|
+
var FakePromise = function (exec) {
|
|
1758
|
+
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
1759
|
+
};
|
|
1760
|
+
var constructor = promise.constructor = {};
|
|
1761
|
+
constructor[SPECIES] = FakePromise;
|
|
1762
|
+
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
1763
|
+
if (!SUBCLASSING) return true;
|
|
1764
|
+
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
1765
|
+
return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
|
|
1766
|
+
});
|
|
1767
|
+
|
|
1768
|
+
var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
|
|
1769
|
+
PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
// helpers
|
|
1773
|
+
var isThenable = function (it) {
|
|
1774
|
+
var then;
|
|
1775
|
+
return isObject(it) && isCallable(then = it.then) ? then : false;
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
var callReaction = function (reaction, state) {
|
|
1779
|
+
var value = state.value;
|
|
1780
|
+
var ok = state.state == FULFILLED;
|
|
1781
|
+
var handler = ok ? reaction.ok : reaction.fail;
|
|
1782
|
+
var resolve = reaction.resolve;
|
|
1783
|
+
var reject = reaction.reject;
|
|
1784
|
+
var domain = reaction.domain;
|
|
1785
|
+
var result, then, exited;
|
|
1786
|
+
try {
|
|
1787
|
+
if (handler) {
|
|
1788
|
+
if (!ok) {
|
|
1789
|
+
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
|
1790
|
+
state.rejection = HANDLED;
|
|
1791
|
+
}
|
|
1792
|
+
if (handler === true) result = value;
|
|
1793
|
+
else {
|
|
1794
|
+
if (domain) domain.enter();
|
|
1795
|
+
result = handler(value); // can throw
|
|
1796
|
+
if (domain) {
|
|
1797
|
+
domain.exit();
|
|
1798
|
+
exited = true;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
if (result === reaction.promise) {
|
|
1802
|
+
reject(TypeError$2('Promise-chain cycle'));
|
|
1803
|
+
} else if (then = isThenable(result)) {
|
|
1804
|
+
call$1(then, result, resolve, reject);
|
|
1805
|
+
} else resolve(result);
|
|
1806
|
+
} else reject(value);
|
|
1807
|
+
} catch (error) {
|
|
1808
|
+
if (domain && !exited) domain.exit();
|
|
1809
|
+
reject(error);
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
|
|
1813
|
+
var notify = function (state, isReject) {
|
|
1814
|
+
if (state.notified) return;
|
|
1815
|
+
state.notified = true;
|
|
1816
|
+
microtask(function () {
|
|
1817
|
+
var reactions = state.reactions;
|
|
1818
|
+
var reaction;
|
|
1819
|
+
while (reaction = reactions.get()) {
|
|
1820
|
+
callReaction(reaction, state);
|
|
1821
|
+
}
|
|
1822
|
+
state.notified = false;
|
|
1823
|
+
if (isReject && !state.rejection) onUnhandled(state);
|
|
1824
|
+
});
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1827
|
+
var dispatchEvent = function (name, promise, reason) {
|
|
1828
|
+
var event, handler;
|
|
1829
|
+
if (DISPATCH_EVENT) {
|
|
1830
|
+
event = document$1.createEvent('Event');
|
|
1831
|
+
event.promise = promise;
|
|
1832
|
+
event.reason = reason;
|
|
1833
|
+
event.initEvent(name, false, true);
|
|
1834
|
+
global$2.dispatchEvent(event);
|
|
1835
|
+
} else event = { promise: promise, reason: reason };
|
|
1836
|
+
if (!NATIVE_REJECTION_EVENT && (handler = global$2['on' + name])) handler(event);
|
|
1837
|
+
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1840
|
+
var onUnhandled = function (state) {
|
|
1841
|
+
call$1(task, global$2, function () {
|
|
1842
|
+
var promise = state.facade;
|
|
1843
|
+
var value = state.value;
|
|
1844
|
+
var IS_UNHANDLED = isUnhandled(state);
|
|
1845
|
+
var result;
|
|
1846
|
+
if (IS_UNHANDLED) {
|
|
1847
|
+
result = perform(function () {
|
|
1848
|
+
if (IS_NODE$1) {
|
|
1849
|
+
process$1.emit('unhandledRejection', value, promise);
|
|
1850
|
+
} else dispatchEvent(UNHANDLED_REJECTION, promise, value);
|
|
1851
|
+
});
|
|
1852
|
+
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
|
|
1853
|
+
state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
|
|
1854
|
+
if (result.error) throw result.value;
|
|
1855
|
+
}
|
|
1856
|
+
});
|
|
1857
|
+
};
|
|
1858
|
+
|
|
1859
|
+
var isUnhandled = function (state) {
|
|
1860
|
+
return state.rejection !== HANDLED && !state.parent;
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1863
|
+
var onHandleUnhandled = function (state) {
|
|
1864
|
+
call$1(task, global$2, function () {
|
|
1865
|
+
var promise = state.facade;
|
|
1866
|
+
if (IS_NODE$1) {
|
|
1867
|
+
process$1.emit('rejectionHandled', promise);
|
|
1868
|
+
} else dispatchEvent(REJECTION_HANDLED, promise, state.value);
|
|
1869
|
+
});
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1872
|
+
var bind = function (fn, state, unwrap) {
|
|
1873
|
+
return function (value) {
|
|
1874
|
+
fn(state, value, unwrap);
|
|
1875
|
+
};
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1878
|
+
var internalReject = function (state, value, unwrap) {
|
|
1879
|
+
if (state.done) return;
|
|
1880
|
+
state.done = true;
|
|
1881
|
+
if (unwrap) state = unwrap;
|
|
1882
|
+
state.value = value;
|
|
1883
|
+
state.state = REJECTED;
|
|
1884
|
+
notify(state, true);
|
|
1885
|
+
};
|
|
1886
|
+
|
|
1887
|
+
var internalResolve = function (state, value, unwrap) {
|
|
1888
|
+
if (state.done) return;
|
|
1889
|
+
state.done = true;
|
|
1890
|
+
if (unwrap) state = unwrap;
|
|
1891
|
+
try {
|
|
1892
|
+
if (state.facade === value) throw TypeError$2("Promise can't be resolved itself");
|
|
1893
|
+
var then = isThenable(value);
|
|
1894
|
+
if (then) {
|
|
1895
|
+
microtask(function () {
|
|
1896
|
+
var wrapper = { done: false };
|
|
1897
|
+
try {
|
|
1898
|
+
call$1(then, value,
|
|
1899
|
+
bind(internalResolve, wrapper, state),
|
|
1900
|
+
bind(internalReject, wrapper, state)
|
|
1901
|
+
);
|
|
1902
|
+
} catch (error) {
|
|
1903
|
+
internalReject(wrapper, error, state);
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
} else {
|
|
1907
|
+
state.value = value;
|
|
1908
|
+
state.state = FULFILLED;
|
|
1909
|
+
notify(state, false);
|
|
1910
|
+
}
|
|
1911
|
+
} catch (error) {
|
|
1912
|
+
internalReject({ done: false }, error, state);
|
|
1913
|
+
}
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
// constructor polyfill
|
|
1917
|
+
if (FORCED) {
|
|
1918
|
+
// 25.4.3.1 Promise(executor)
|
|
1919
|
+
PromiseConstructor = function Promise(executor) {
|
|
1920
|
+
anInstance(this, PromisePrototype);
|
|
1921
|
+
aCallable$1(executor);
|
|
1922
|
+
call$1(Internal, this);
|
|
1923
|
+
var state = getInternalState(this);
|
|
1924
|
+
try {
|
|
1925
|
+
executor(bind(internalResolve, state), bind(internalReject, state));
|
|
1926
|
+
} catch (error) {
|
|
1927
|
+
internalReject(state, error);
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
PromisePrototype = PromiseConstructor.prototype;
|
|
1931
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
1932
|
+
Internal = function Promise(executor) {
|
|
1933
|
+
setInternalState(this, {
|
|
1934
|
+
type: PROMISE,
|
|
1935
|
+
done: false,
|
|
1936
|
+
notified: false,
|
|
1937
|
+
parent: false,
|
|
1938
|
+
reactions: new Queue(),
|
|
1939
|
+
rejection: false,
|
|
1940
|
+
state: PENDING,
|
|
1941
|
+
value: undefined
|
|
1942
|
+
});
|
|
1943
|
+
};
|
|
1944
|
+
Internal.prototype = redefineAll(PromisePrototype, {
|
|
1945
|
+
// `Promise.prototype.then` method
|
|
1946
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
1947
|
+
// eslint-disable-next-line unicorn/no-thenable -- safe
|
|
1948
|
+
then: function then(onFulfilled, onRejected) {
|
|
1949
|
+
var state = getInternalPromiseState(this);
|
|
1950
|
+
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
|
1951
|
+
state.parent = true;
|
|
1952
|
+
reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
|
|
1953
|
+
reaction.fail = isCallable(onRejected) && onRejected;
|
|
1954
|
+
reaction.domain = IS_NODE$1 ? process$1.domain : undefined;
|
|
1955
|
+
if (state.state == PENDING) state.reactions.add(reaction);
|
|
1956
|
+
else microtask(function () {
|
|
1957
|
+
callReaction(reaction, state);
|
|
1958
|
+
});
|
|
1959
|
+
return reaction.promise;
|
|
1960
|
+
},
|
|
1961
|
+
// `Promise.prototype.catch` method
|
|
1962
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
1963
|
+
'catch': function (onRejected) {
|
|
1964
|
+
return this.then(undefined, onRejected);
|
|
1965
|
+
}
|
|
1966
|
+
});
|
|
1967
|
+
OwnPromiseCapability = function () {
|
|
1968
|
+
var promise = new Internal();
|
|
1969
|
+
var state = getInternalState(promise);
|
|
1970
|
+
this.promise = promise;
|
|
1971
|
+
this.resolve = bind(internalResolve, state);
|
|
1972
|
+
this.reject = bind(internalReject, state);
|
|
1973
|
+
};
|
|
1974
|
+
newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
|
|
1975
|
+
return C === PromiseConstructor || C === PromiseWrapper
|
|
1976
|
+
? new OwnPromiseCapability(C)
|
|
1977
|
+
: newGenericPromiseCapability(C);
|
|
1978
|
+
};
|
|
1979
|
+
|
|
1980
|
+
if (isCallable(NativePromise) && NativePromisePrototype !== Object.prototype) {
|
|
1981
|
+
nativeThen = NativePromisePrototype.then;
|
|
1982
|
+
|
|
1983
|
+
if (!SUBCLASSING) {
|
|
1984
|
+
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
1985
|
+
redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
1986
|
+
var that = this;
|
|
1987
|
+
return new PromiseConstructor(function (resolve, reject) {
|
|
1988
|
+
call$1(nativeThen, that, resolve, reject);
|
|
1989
|
+
}).then(onFulfilled, onRejected);
|
|
1990
|
+
// https://github.com/zloirock/core-js/issues/640
|
|
1991
|
+
}, { unsafe: true });
|
|
1992
|
+
|
|
1993
|
+
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
1994
|
+
redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true });
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
// make `.constructor === Promise` work for native promise-based APIs
|
|
1998
|
+
try {
|
|
1999
|
+
delete NativePromisePrototype.constructor;
|
|
2000
|
+
} catch (error) { /* empty */ }
|
|
2001
|
+
|
|
2002
|
+
// make `instanceof Promise` work for native promise-based APIs
|
|
2003
|
+
if (setPrototypeOf) {
|
|
2004
|
+
setPrototypeOf(NativePromisePrototype, PromisePrototype);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
$$2({ global: true, wrap: true, forced: FORCED }, {
|
|
2010
|
+
Promise: PromiseConstructor
|
|
2011
|
+
});
|
|
2012
|
+
|
|
2013
|
+
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
2014
|
+
setSpecies(PROMISE);
|
|
2015
|
+
|
|
2016
|
+
PromiseWrapper = getBuiltIn(PROMISE);
|
|
2017
|
+
|
|
2018
|
+
// statics
|
|
2019
|
+
$$2({ target: PROMISE, stat: true, forced: FORCED }, {
|
|
2020
|
+
// `Promise.reject` method
|
|
2021
|
+
// https://tc39.es/ecma262/#sec-promise.reject
|
|
2022
|
+
reject: function reject(r) {
|
|
2023
|
+
var capability = newPromiseCapability(this);
|
|
2024
|
+
call$1(capability.reject, undefined, r);
|
|
2025
|
+
return capability.promise;
|
|
2026
|
+
}
|
|
2027
|
+
});
|
|
2028
|
+
|
|
2029
|
+
$$2({ target: PROMISE, stat: true, forced: FORCED }, {
|
|
2030
|
+
// `Promise.resolve` method
|
|
2031
|
+
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
2032
|
+
resolve: function resolve(x) {
|
|
2033
|
+
return promiseResolve(this, x);
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
2036
|
+
|
|
2037
|
+
$$2({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
2038
|
+
// `Promise.all` method
|
|
2039
|
+
// https://tc39.es/ecma262/#sec-promise.all
|
|
2040
|
+
all: function all(iterable) {
|
|
2041
|
+
var C = this;
|
|
2042
|
+
var capability = newPromiseCapability(C);
|
|
2043
|
+
var resolve = capability.resolve;
|
|
2044
|
+
var reject = capability.reject;
|
|
2045
|
+
var result = perform(function () {
|
|
2046
|
+
var $promiseResolve = aCallable$1(C.resolve);
|
|
2047
|
+
var values = [];
|
|
2048
|
+
var counter = 0;
|
|
2049
|
+
var remaining = 1;
|
|
2050
|
+
iterate(iterable, function (promise) {
|
|
2051
|
+
var index = counter++;
|
|
2052
|
+
var alreadyCalled = false;
|
|
2053
|
+
remaining++;
|
|
2054
|
+
call$1($promiseResolve, C, promise).then(function (value) {
|
|
2055
|
+
if (alreadyCalled) return;
|
|
2056
|
+
alreadyCalled = true;
|
|
2057
|
+
values[index] = value;
|
|
2058
|
+
--remaining || resolve(values);
|
|
2059
|
+
}, reject);
|
|
2060
|
+
});
|
|
2061
|
+
--remaining || resolve(values);
|
|
2062
|
+
});
|
|
2063
|
+
if (result.error) reject(result.value);
|
|
2064
|
+
return capability.promise;
|
|
2065
|
+
},
|
|
2066
|
+
// `Promise.race` method
|
|
2067
|
+
// https://tc39.es/ecma262/#sec-promise.race
|
|
2068
|
+
race: function race(iterable) {
|
|
2069
|
+
var C = this;
|
|
2070
|
+
var capability = newPromiseCapability(C);
|
|
2071
|
+
var reject = capability.reject;
|
|
2072
|
+
var result = perform(function () {
|
|
2073
|
+
var $promiseResolve = aCallable$1(C.resolve);
|
|
2074
|
+
iterate(iterable, function (promise) {
|
|
2075
|
+
call$1($promiseResolve, C, promise).then(capability.resolve, reject);
|
|
2076
|
+
});
|
|
2077
|
+
});
|
|
2078
|
+
if (result.error) reject(result.value);
|
|
2079
|
+
return capability.promise;
|
|
2080
|
+
}
|
|
2081
|
+
});
|
|
2082
|
+
|
|
2083
|
+
var internalObjectKeys = objectKeysInternal;
|
|
2084
|
+
var enumBugKeys = enumBugKeys$2;
|
|
2085
|
+
|
|
2086
|
+
// `Object.keys` method
|
|
2087
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
2088
|
+
// eslint-disable-next-line es/no-object-keys -- safe
|
|
2089
|
+
var objectKeys$1 = Object.keys || function keys(O) {
|
|
2090
|
+
return internalObjectKeys(O, enumBugKeys);
|
|
2091
|
+
};
|
|
2092
|
+
|
|
2093
|
+
var DESCRIPTORS = descriptors;
|
|
2094
|
+
var uncurryThis = functionUncurryThis;
|
|
2095
|
+
var call = functionCall;
|
|
2096
|
+
var fails$1 = fails$b;
|
|
2097
|
+
var objectKeys = objectKeys$1;
|
|
2098
|
+
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
|
|
2099
|
+
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
|
2100
|
+
var toObject$1 = toObject$3;
|
|
2101
|
+
var IndexedObject$1 = indexedObject;
|
|
2102
|
+
|
|
2103
|
+
// eslint-disable-next-line es/no-object-assign -- safe
|
|
2104
|
+
var $assign = Object.assign;
|
|
2105
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2106
|
+
var defineProperty = Object.defineProperty;
|
|
2107
|
+
var concat = uncurryThis([].concat);
|
|
2108
|
+
|
|
2109
|
+
// `Object.assign` method
|
|
2110
|
+
// https://tc39.es/ecma262/#sec-object.assign
|
|
2111
|
+
var objectAssign = !$assign || fails$1(function () {
|
|
2112
|
+
// should have correct order of operations (Edge bug)
|
|
2113
|
+
if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
|
|
2114
|
+
enumerable: true,
|
|
2115
|
+
get: function () {
|
|
2116
|
+
defineProperty(this, 'b', {
|
|
2117
|
+
value: 3,
|
|
2118
|
+
enumerable: false
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
}), { b: 2 })).b !== 1) return true;
|
|
2122
|
+
// should work with symbols and should have deterministic property order (V8 bug)
|
|
2123
|
+
var A = {};
|
|
2124
|
+
var B = {};
|
|
2125
|
+
// eslint-disable-next-line es/no-symbol -- safe
|
|
2126
|
+
var symbol = Symbol();
|
|
2127
|
+
var alphabet = 'abcdefghijklmnopqrst';
|
|
2128
|
+
A[symbol] = 7;
|
|
2129
|
+
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
|
2130
|
+
return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
|
|
2131
|
+
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
|
|
2132
|
+
var T = toObject$1(target);
|
|
2133
|
+
var argumentsLength = arguments.length;
|
|
2134
|
+
var index = 1;
|
|
2135
|
+
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
2136
|
+
var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
|
2137
|
+
while (argumentsLength > index) {
|
|
2138
|
+
var S = IndexedObject$1(arguments[index++]);
|
|
2139
|
+
var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
|
|
2140
|
+
var length = keys.length;
|
|
2141
|
+
var j = 0;
|
|
2142
|
+
var key;
|
|
2143
|
+
while (length > j) {
|
|
2144
|
+
key = keys[j++];
|
|
2145
|
+
if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2146
|
+
}
|
|
2147
|
+
} return T;
|
|
2148
|
+
} : $assign;
|
|
2149
|
+
|
|
2150
|
+
var $$1 = _export;
|
|
2151
|
+
var assign = objectAssign;
|
|
2152
|
+
|
|
2153
|
+
// `Object.assign` method
|
|
2154
|
+
// https://tc39.es/ecma262/#sec-object.assign
|
|
2155
|
+
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
2156
|
+
$$1({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
|
|
2157
|
+
assign: assign
|
|
2158
|
+
});
|
|
2159
|
+
|
|
2160
|
+
/*! *****************************************************************************
|
|
2161
|
+
Copyright (c) Microsoft Corporation.
|
|
2162
|
+
|
|
2163
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2164
|
+
purpose with or without fee is hereby granted.
|
|
2165
|
+
|
|
2166
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2167
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2168
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2169
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2170
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2171
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2172
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2173
|
+
***************************************************************************** */
|
|
2174
|
+
|
|
2175
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2176
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2177
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2178
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2179
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2180
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2181
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
const NINETAILED_CACHE_KEY = '__nt-cache__';
|
|
2186
|
+
const initialize = ({
|
|
2187
|
+
instance
|
|
2188
|
+
}, data = {}) => {
|
|
2189
|
+
const cache = buildEmptyCache();
|
|
2190
|
+
instance.storage.setItem(NINETAILED_CACHE_KEY, Object.assign(Object.assign({}, cache), data));
|
|
2191
|
+
return cache;
|
|
2192
|
+
};
|
|
2193
|
+
const get = ({
|
|
2194
|
+
instance
|
|
2195
|
+
}) => {
|
|
2196
|
+
const cache = instance.storage.getItem(NINETAILED_CACHE_KEY);
|
|
2197
|
+
return cache;
|
|
2198
|
+
};
|
|
2199
|
+
const set = (cache, {
|
|
2200
|
+
instance
|
|
2201
|
+
}) => {
|
|
2202
|
+
instance.storage.setItem(NINETAILED_CACHE_KEY, cache);
|
|
2203
|
+
return cache;
|
|
2204
|
+
};
|
|
2205
|
+
const reset = ({
|
|
2206
|
+
instance
|
|
2207
|
+
}) => {
|
|
2208
|
+
return initialize({
|
|
2209
|
+
instance
|
|
2210
|
+
});
|
|
2211
|
+
};
|
|
2212
|
+
|
|
2213
|
+
const buildClientLocale = () => navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
|
|
2214
|
+
|
|
2215
|
+
const buildClientNinetailedRequestContext = () => ({
|
|
2216
|
+
url: window.location.href,
|
|
2217
|
+
referrer: document.referrer,
|
|
2218
|
+
locale: buildClientLocale(),
|
|
2219
|
+
userAgent: navigator.userAgent,
|
|
2220
|
+
document: {
|
|
2221
|
+
title: document.title
|
|
2222
|
+
}
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
var src = {exports: {}};
|
|
2226
|
+
|
|
2227
|
+
var browser = {exports: {}};
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* Helpers.
|
|
2231
|
+
*/
|
|
2232
|
+
|
|
2233
|
+
var s = 1000;
|
|
2234
|
+
var m = s * 60;
|
|
2235
|
+
var h = m * 60;
|
|
2236
|
+
var d = h * 24;
|
|
2237
|
+
var w = d * 7;
|
|
2238
|
+
var y = d * 365.25;
|
|
2239
|
+
|
|
2240
|
+
/**
|
|
2241
|
+
* Parse or format the given `val`.
|
|
2242
|
+
*
|
|
2243
|
+
* Options:
|
|
2244
|
+
*
|
|
2245
|
+
* - `long` verbose formatting [false]
|
|
2246
|
+
*
|
|
2247
|
+
* @param {String|Number} val
|
|
2248
|
+
* @param {Object} [options]
|
|
2249
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
2250
|
+
* @return {String|Number}
|
|
2251
|
+
* @api public
|
|
2252
|
+
*/
|
|
2253
|
+
|
|
2254
|
+
var ms = function(val, options) {
|
|
2255
|
+
options = options || {};
|
|
2256
|
+
var type = typeof val;
|
|
2257
|
+
if (type === 'string' && val.length > 0) {
|
|
2258
|
+
return parse(val);
|
|
2259
|
+
} else if (type === 'number' && isFinite(val)) {
|
|
2260
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
2261
|
+
}
|
|
2262
|
+
throw new Error(
|
|
2263
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
2264
|
+
JSON.stringify(val)
|
|
2265
|
+
);
|
|
2266
|
+
};
|
|
2267
|
+
|
|
2268
|
+
/**
|
|
2269
|
+
* Parse the given `str` and return milliseconds.
|
|
2270
|
+
*
|
|
2271
|
+
* @param {String} str
|
|
2272
|
+
* @return {Number}
|
|
2273
|
+
* @api private
|
|
2274
|
+
*/
|
|
2275
|
+
|
|
2276
|
+
function parse(str) {
|
|
2277
|
+
str = String(str);
|
|
2278
|
+
if (str.length > 100) {
|
|
2279
|
+
return;
|
|
2280
|
+
}
|
|
2281
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
2282
|
+
str
|
|
2283
|
+
);
|
|
2284
|
+
if (!match) {
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
var n = parseFloat(match[1]);
|
|
2288
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
2289
|
+
switch (type) {
|
|
2290
|
+
case 'years':
|
|
2291
|
+
case 'year':
|
|
2292
|
+
case 'yrs':
|
|
2293
|
+
case 'yr':
|
|
2294
|
+
case 'y':
|
|
2295
|
+
return n * y;
|
|
2296
|
+
case 'weeks':
|
|
2297
|
+
case 'week':
|
|
2298
|
+
case 'w':
|
|
2299
|
+
return n * w;
|
|
2300
|
+
case 'days':
|
|
2301
|
+
case 'day':
|
|
2302
|
+
case 'd':
|
|
2303
|
+
return n * d;
|
|
2304
|
+
case 'hours':
|
|
2305
|
+
case 'hour':
|
|
2306
|
+
case 'hrs':
|
|
2307
|
+
case 'hr':
|
|
2308
|
+
case 'h':
|
|
2309
|
+
return n * h;
|
|
2310
|
+
case 'minutes':
|
|
2311
|
+
case 'minute':
|
|
2312
|
+
case 'mins':
|
|
2313
|
+
case 'min':
|
|
2314
|
+
case 'm':
|
|
2315
|
+
return n * m;
|
|
2316
|
+
case 'seconds':
|
|
2317
|
+
case 'second':
|
|
2318
|
+
case 'secs':
|
|
2319
|
+
case 'sec':
|
|
2320
|
+
case 's':
|
|
2321
|
+
return n * s;
|
|
2322
|
+
case 'milliseconds':
|
|
2323
|
+
case 'millisecond':
|
|
2324
|
+
case 'msecs':
|
|
2325
|
+
case 'msec':
|
|
2326
|
+
case 'ms':
|
|
2327
|
+
return n;
|
|
2328
|
+
default:
|
|
2329
|
+
return undefined;
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
/**
|
|
2334
|
+
* Short format for `ms`.
|
|
2335
|
+
*
|
|
2336
|
+
* @param {Number} ms
|
|
2337
|
+
* @return {String}
|
|
2338
|
+
* @api private
|
|
2339
|
+
*/
|
|
2340
|
+
|
|
2341
|
+
function fmtShort(ms) {
|
|
2342
|
+
var msAbs = Math.abs(ms);
|
|
2343
|
+
if (msAbs >= d) {
|
|
2344
|
+
return Math.round(ms / d) + 'd';
|
|
2345
|
+
}
|
|
2346
|
+
if (msAbs >= h) {
|
|
2347
|
+
return Math.round(ms / h) + 'h';
|
|
2348
|
+
}
|
|
2349
|
+
if (msAbs >= m) {
|
|
2350
|
+
return Math.round(ms / m) + 'm';
|
|
2351
|
+
}
|
|
2352
|
+
if (msAbs >= s) {
|
|
2353
|
+
return Math.round(ms / s) + 's';
|
|
2354
|
+
}
|
|
2355
|
+
return ms + 'ms';
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
/**
|
|
2359
|
+
* Long format for `ms`.
|
|
2360
|
+
*
|
|
2361
|
+
* @param {Number} ms
|
|
2362
|
+
* @return {String}
|
|
2363
|
+
* @api private
|
|
2364
|
+
*/
|
|
2365
|
+
|
|
2366
|
+
function fmtLong(ms) {
|
|
2367
|
+
var msAbs = Math.abs(ms);
|
|
2368
|
+
if (msAbs >= d) {
|
|
2369
|
+
return plural(ms, msAbs, d, 'day');
|
|
2370
|
+
}
|
|
2371
|
+
if (msAbs >= h) {
|
|
2372
|
+
return plural(ms, msAbs, h, 'hour');
|
|
2373
|
+
}
|
|
2374
|
+
if (msAbs >= m) {
|
|
2375
|
+
return plural(ms, msAbs, m, 'minute');
|
|
2376
|
+
}
|
|
2377
|
+
if (msAbs >= s) {
|
|
2378
|
+
return plural(ms, msAbs, s, 'second');
|
|
2379
|
+
}
|
|
2380
|
+
return ms + ' ms';
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* Pluralization helper.
|
|
2385
|
+
*/
|
|
2386
|
+
|
|
2387
|
+
function plural(ms, msAbs, n, name) {
|
|
2388
|
+
var isPlural = msAbs >= n * 1.5;
|
|
2389
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
/**
|
|
2393
|
+
* This is the common logic for both the Node.js and web browser
|
|
2394
|
+
* implementations of `debug()`.
|
|
2395
|
+
*/
|
|
2396
|
+
|
|
2397
|
+
function setup(env) {
|
|
2398
|
+
createDebug.debug = createDebug;
|
|
2399
|
+
createDebug.default = createDebug;
|
|
2400
|
+
createDebug.coerce = coerce;
|
|
2401
|
+
createDebug.disable = disable;
|
|
2402
|
+
createDebug.enable = enable;
|
|
2403
|
+
createDebug.enabled = enabled;
|
|
2404
|
+
createDebug.humanize = ms;
|
|
2405
|
+
createDebug.destroy = destroy;
|
|
2406
|
+
|
|
2407
|
+
Object.keys(env).forEach(key => {
|
|
2408
|
+
createDebug[key] = env[key];
|
|
2409
|
+
});
|
|
2410
|
+
|
|
2411
|
+
/**
|
|
2412
|
+
* The currently active debug mode names, and names to skip.
|
|
2413
|
+
*/
|
|
2414
|
+
|
|
2415
|
+
createDebug.names = [];
|
|
2416
|
+
createDebug.skips = [];
|
|
2417
|
+
|
|
2418
|
+
/**
|
|
2419
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
2420
|
+
*
|
|
2421
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
2422
|
+
*/
|
|
2423
|
+
createDebug.formatters = {};
|
|
2424
|
+
|
|
2425
|
+
/**
|
|
2426
|
+
* Selects a color for a debug namespace
|
|
2427
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
2428
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
2429
|
+
* @api private
|
|
2430
|
+
*/
|
|
2431
|
+
function selectColor(namespace) {
|
|
2432
|
+
let hash = 0;
|
|
2433
|
+
|
|
2434
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
2435
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
2436
|
+
hash |= 0; // Convert to 32bit integer
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
2440
|
+
}
|
|
2441
|
+
createDebug.selectColor = selectColor;
|
|
2442
|
+
|
|
2443
|
+
/**
|
|
2444
|
+
* Create a debugger with the given `namespace`.
|
|
2445
|
+
*
|
|
2446
|
+
* @param {String} namespace
|
|
2447
|
+
* @return {Function}
|
|
2448
|
+
* @api public
|
|
2449
|
+
*/
|
|
2450
|
+
function createDebug(namespace) {
|
|
2451
|
+
let prevTime;
|
|
2452
|
+
let enableOverride = null;
|
|
2453
|
+
let namespacesCache;
|
|
2454
|
+
let enabledCache;
|
|
2455
|
+
|
|
2456
|
+
function debug(...args) {
|
|
2457
|
+
// Disabled?
|
|
2458
|
+
if (!debug.enabled) {
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
const self = debug;
|
|
2463
|
+
|
|
2464
|
+
// Set `diff` timestamp
|
|
2465
|
+
const curr = Number(new Date());
|
|
2466
|
+
const ms = curr - (prevTime || curr);
|
|
2467
|
+
self.diff = ms;
|
|
2468
|
+
self.prev = prevTime;
|
|
2469
|
+
self.curr = curr;
|
|
2470
|
+
prevTime = curr;
|
|
2471
|
+
|
|
2472
|
+
args[0] = createDebug.coerce(args[0]);
|
|
2473
|
+
|
|
2474
|
+
if (typeof args[0] !== 'string') {
|
|
2475
|
+
// Anything else let's inspect with %O
|
|
2476
|
+
args.unshift('%O');
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
// Apply any `formatters` transformations
|
|
2480
|
+
let index = 0;
|
|
2481
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
2482
|
+
// If we encounter an escaped % then don't increase the array index
|
|
2483
|
+
if (match === '%%') {
|
|
2484
|
+
return '%';
|
|
2485
|
+
}
|
|
2486
|
+
index++;
|
|
2487
|
+
const formatter = createDebug.formatters[format];
|
|
2488
|
+
if (typeof formatter === 'function') {
|
|
2489
|
+
const val = args[index];
|
|
2490
|
+
match = formatter.call(self, val);
|
|
2491
|
+
|
|
2492
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
2493
|
+
args.splice(index, 1);
|
|
2494
|
+
index--;
|
|
2495
|
+
}
|
|
2496
|
+
return match;
|
|
2497
|
+
});
|
|
2498
|
+
|
|
2499
|
+
// Apply env-specific formatting (colors, etc.)
|
|
2500
|
+
createDebug.formatArgs.call(self, args);
|
|
2501
|
+
|
|
2502
|
+
const logFn = self.log || createDebug.log;
|
|
2503
|
+
logFn.apply(self, args);
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
debug.namespace = namespace;
|
|
2507
|
+
debug.useColors = createDebug.useColors();
|
|
2508
|
+
debug.color = createDebug.selectColor(namespace);
|
|
2509
|
+
debug.extend = extend;
|
|
2510
|
+
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
2511
|
+
|
|
2512
|
+
Object.defineProperty(debug, 'enabled', {
|
|
2513
|
+
enumerable: true,
|
|
2514
|
+
configurable: false,
|
|
2515
|
+
get: () => {
|
|
2516
|
+
if (enableOverride !== null) {
|
|
2517
|
+
return enableOverride;
|
|
2518
|
+
}
|
|
2519
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
2520
|
+
namespacesCache = createDebug.namespaces;
|
|
2521
|
+
enabledCache = createDebug.enabled(namespace);
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
return enabledCache;
|
|
2525
|
+
},
|
|
2526
|
+
set: v => {
|
|
2527
|
+
enableOverride = v;
|
|
2528
|
+
}
|
|
2529
|
+
});
|
|
2530
|
+
|
|
2531
|
+
// Env-specific initialization logic for debug instances
|
|
2532
|
+
if (typeof createDebug.init === 'function') {
|
|
2533
|
+
createDebug.init(debug);
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
return debug;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
function extend(namespace, delimiter) {
|
|
2540
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
2541
|
+
newDebug.log = this.log;
|
|
2542
|
+
return newDebug;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
2547
|
+
* separated by a colon and wildcards.
|
|
2548
|
+
*
|
|
2549
|
+
* @param {String} namespaces
|
|
2550
|
+
* @api public
|
|
2551
|
+
*/
|
|
2552
|
+
function enable(namespaces) {
|
|
2553
|
+
createDebug.save(namespaces);
|
|
2554
|
+
createDebug.namespaces = namespaces;
|
|
2555
|
+
|
|
2556
|
+
createDebug.names = [];
|
|
2557
|
+
createDebug.skips = [];
|
|
2558
|
+
|
|
2559
|
+
let i;
|
|
2560
|
+
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
2561
|
+
const len = split.length;
|
|
2562
|
+
|
|
2563
|
+
for (i = 0; i < len; i++) {
|
|
2564
|
+
if (!split[i]) {
|
|
2565
|
+
// ignore empty strings
|
|
2566
|
+
continue;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
2570
|
+
|
|
2571
|
+
if (namespaces[0] === '-') {
|
|
2572
|
+
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
2573
|
+
} else {
|
|
2574
|
+
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
/**
|
|
2580
|
+
* Disable debug output.
|
|
2581
|
+
*
|
|
2582
|
+
* @return {String} namespaces
|
|
2583
|
+
* @api public
|
|
2584
|
+
*/
|
|
2585
|
+
function disable() {
|
|
2586
|
+
const namespaces = [
|
|
2587
|
+
...createDebug.names.map(toNamespace),
|
|
2588
|
+
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
2589
|
+
].join(',');
|
|
2590
|
+
createDebug.enable('');
|
|
2591
|
+
return namespaces;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
/**
|
|
2595
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
2596
|
+
*
|
|
2597
|
+
* @param {String} name
|
|
2598
|
+
* @return {Boolean}
|
|
2599
|
+
* @api public
|
|
2600
|
+
*/
|
|
2601
|
+
function enabled(name) {
|
|
2602
|
+
if (name[name.length - 1] === '*') {
|
|
2603
|
+
return true;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
let i;
|
|
2607
|
+
let len;
|
|
2608
|
+
|
|
2609
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
2610
|
+
if (createDebug.skips[i].test(name)) {
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
2616
|
+
if (createDebug.names[i].test(name)) {
|
|
2617
|
+
return true;
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
return false;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* Convert regexp to namespace
|
|
2626
|
+
*
|
|
2627
|
+
* @param {RegExp} regxep
|
|
2628
|
+
* @return {String} namespace
|
|
2629
|
+
* @api private
|
|
2630
|
+
*/
|
|
2631
|
+
function toNamespace(regexp) {
|
|
2632
|
+
return regexp.toString()
|
|
2633
|
+
.substring(2, regexp.toString().length - 2)
|
|
2634
|
+
.replace(/\.\*\?$/, '*');
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
/**
|
|
2638
|
+
* Coerce `val`.
|
|
2639
|
+
*
|
|
2640
|
+
* @param {Mixed} val
|
|
2641
|
+
* @return {Mixed}
|
|
2642
|
+
* @api private
|
|
2643
|
+
*/
|
|
2644
|
+
function coerce(val) {
|
|
2645
|
+
if (val instanceof Error) {
|
|
2646
|
+
return val.stack || val.message;
|
|
2647
|
+
}
|
|
2648
|
+
return val;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
2653
|
+
* XXX It WILL be removed in the next major release.
|
|
2654
|
+
*/
|
|
2655
|
+
function destroy() {
|
|
2656
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
createDebug.enable(createDebug.load());
|
|
2660
|
+
|
|
2661
|
+
return createDebug;
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
var common = setup;
|
|
2665
|
+
|
|
2666
|
+
/* eslint-env browser */
|
|
2667
|
+
|
|
2668
|
+
(function (module, exports) {
|
|
2669
|
+
/**
|
|
2670
|
+
* This is the web browser implementation of `debug()`.
|
|
2671
|
+
*/
|
|
2672
|
+
|
|
2673
|
+
exports.formatArgs = formatArgs;
|
|
2674
|
+
exports.save = save;
|
|
2675
|
+
exports.load = load;
|
|
2676
|
+
exports.useColors = useColors;
|
|
2677
|
+
exports.storage = localstorage();
|
|
2678
|
+
exports.destroy = (() => {
|
|
2679
|
+
let warned = false;
|
|
2680
|
+
|
|
2681
|
+
return () => {
|
|
2682
|
+
if (!warned) {
|
|
2683
|
+
warned = true;
|
|
2684
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
2685
|
+
}
|
|
2686
|
+
};
|
|
2687
|
+
})();
|
|
2688
|
+
|
|
2689
|
+
/**
|
|
2690
|
+
* Colors.
|
|
2691
|
+
*/
|
|
2692
|
+
|
|
2693
|
+
exports.colors = [
|
|
2694
|
+
'#0000CC',
|
|
2695
|
+
'#0000FF',
|
|
2696
|
+
'#0033CC',
|
|
2697
|
+
'#0033FF',
|
|
2698
|
+
'#0066CC',
|
|
2699
|
+
'#0066FF',
|
|
2700
|
+
'#0099CC',
|
|
2701
|
+
'#0099FF',
|
|
2702
|
+
'#00CC00',
|
|
2703
|
+
'#00CC33',
|
|
2704
|
+
'#00CC66',
|
|
2705
|
+
'#00CC99',
|
|
2706
|
+
'#00CCCC',
|
|
2707
|
+
'#00CCFF',
|
|
2708
|
+
'#3300CC',
|
|
2709
|
+
'#3300FF',
|
|
2710
|
+
'#3333CC',
|
|
2711
|
+
'#3333FF',
|
|
2712
|
+
'#3366CC',
|
|
2713
|
+
'#3366FF',
|
|
2714
|
+
'#3399CC',
|
|
2715
|
+
'#3399FF',
|
|
2716
|
+
'#33CC00',
|
|
2717
|
+
'#33CC33',
|
|
2718
|
+
'#33CC66',
|
|
2719
|
+
'#33CC99',
|
|
2720
|
+
'#33CCCC',
|
|
2721
|
+
'#33CCFF',
|
|
2722
|
+
'#6600CC',
|
|
2723
|
+
'#6600FF',
|
|
2724
|
+
'#6633CC',
|
|
2725
|
+
'#6633FF',
|
|
2726
|
+
'#66CC00',
|
|
2727
|
+
'#66CC33',
|
|
2728
|
+
'#9900CC',
|
|
2729
|
+
'#9900FF',
|
|
2730
|
+
'#9933CC',
|
|
2731
|
+
'#9933FF',
|
|
2732
|
+
'#99CC00',
|
|
2733
|
+
'#99CC33',
|
|
2734
|
+
'#CC0000',
|
|
2735
|
+
'#CC0033',
|
|
2736
|
+
'#CC0066',
|
|
2737
|
+
'#CC0099',
|
|
2738
|
+
'#CC00CC',
|
|
2739
|
+
'#CC00FF',
|
|
2740
|
+
'#CC3300',
|
|
2741
|
+
'#CC3333',
|
|
2742
|
+
'#CC3366',
|
|
2743
|
+
'#CC3399',
|
|
2744
|
+
'#CC33CC',
|
|
2745
|
+
'#CC33FF',
|
|
2746
|
+
'#CC6600',
|
|
2747
|
+
'#CC6633',
|
|
2748
|
+
'#CC9900',
|
|
2749
|
+
'#CC9933',
|
|
2750
|
+
'#CCCC00',
|
|
2751
|
+
'#CCCC33',
|
|
2752
|
+
'#FF0000',
|
|
2753
|
+
'#FF0033',
|
|
2754
|
+
'#FF0066',
|
|
2755
|
+
'#FF0099',
|
|
2756
|
+
'#FF00CC',
|
|
2757
|
+
'#FF00FF',
|
|
2758
|
+
'#FF3300',
|
|
2759
|
+
'#FF3333',
|
|
2760
|
+
'#FF3366',
|
|
2761
|
+
'#FF3399',
|
|
2762
|
+
'#FF33CC',
|
|
2763
|
+
'#FF33FF',
|
|
2764
|
+
'#FF6600',
|
|
2765
|
+
'#FF6633',
|
|
2766
|
+
'#FF9900',
|
|
2767
|
+
'#FF9933',
|
|
2768
|
+
'#FFCC00',
|
|
2769
|
+
'#FFCC33'
|
|
2770
|
+
];
|
|
2771
|
+
|
|
2772
|
+
/**
|
|
2773
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
2774
|
+
* and the Firebug extension (any Firefox version) are known
|
|
2775
|
+
* to support "%c" CSS customizations.
|
|
2776
|
+
*
|
|
2777
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
2778
|
+
*/
|
|
2779
|
+
|
|
2780
|
+
// eslint-disable-next-line complexity
|
|
2781
|
+
function useColors() {
|
|
2782
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
2783
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
2784
|
+
// explicitly
|
|
2785
|
+
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
2786
|
+
return true;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
// Internet Explorer and Edge do not support colors.
|
|
2790
|
+
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
2791
|
+
return false;
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
2795
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
2796
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
2797
|
+
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
2798
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
2799
|
+
// Is firefox >= v31?
|
|
2800
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
2801
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
2802
|
+
// Double check webkit in userAgent just in case we are in a worker
|
|
2803
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
/**
|
|
2807
|
+
* Colorize log arguments if enabled.
|
|
2808
|
+
*
|
|
2809
|
+
* @api public
|
|
2810
|
+
*/
|
|
2811
|
+
|
|
2812
|
+
function formatArgs(args) {
|
|
2813
|
+
args[0] = (this.useColors ? '%c' : '') +
|
|
2814
|
+
this.namespace +
|
|
2815
|
+
(this.useColors ? ' %c' : ' ') +
|
|
2816
|
+
args[0] +
|
|
2817
|
+
(this.useColors ? '%c ' : ' ') +
|
|
2818
|
+
'+' + module.exports.humanize(this.diff);
|
|
2819
|
+
|
|
2820
|
+
if (!this.useColors) {
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
const c = 'color: ' + this.color;
|
|
2825
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
2826
|
+
|
|
2827
|
+
// The final "%c" is somewhat tricky, because there could be other
|
|
2828
|
+
// arguments passed either before or after the %c, so we need to
|
|
2829
|
+
// figure out the correct index to insert the CSS into
|
|
2830
|
+
let index = 0;
|
|
2831
|
+
let lastC = 0;
|
|
2832
|
+
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
2833
|
+
if (match === '%%') {
|
|
2834
|
+
return;
|
|
2835
|
+
}
|
|
2836
|
+
index++;
|
|
2837
|
+
if (match === '%c') {
|
|
2838
|
+
// We only are interested in the *last* %c
|
|
2839
|
+
// (the user may have provided their own)
|
|
2840
|
+
lastC = index;
|
|
2841
|
+
}
|
|
2842
|
+
});
|
|
2843
|
+
|
|
2844
|
+
args.splice(lastC, 0, c);
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
/**
|
|
2848
|
+
* Invokes `console.debug()` when available.
|
|
2849
|
+
* No-op when `console.debug` is not a "function".
|
|
2850
|
+
* If `console.debug` is not available, falls back
|
|
2851
|
+
* to `console.log`.
|
|
2852
|
+
*
|
|
2853
|
+
* @api public
|
|
2854
|
+
*/
|
|
2855
|
+
exports.log = console.debug || console.log || (() => {});
|
|
2856
|
+
|
|
2857
|
+
/**
|
|
2858
|
+
* Save `namespaces`.
|
|
2859
|
+
*
|
|
2860
|
+
* @param {String} namespaces
|
|
2861
|
+
* @api private
|
|
2862
|
+
*/
|
|
2863
|
+
function save(namespaces) {
|
|
2864
|
+
try {
|
|
2865
|
+
if (namespaces) {
|
|
2866
|
+
exports.storage.setItem('debug', namespaces);
|
|
2867
|
+
} else {
|
|
2868
|
+
exports.storage.removeItem('debug');
|
|
2869
|
+
}
|
|
2870
|
+
} catch (error) {
|
|
2871
|
+
// Swallow
|
|
2872
|
+
// XXX (@Qix-) should we be logging these?
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
/**
|
|
2877
|
+
* Load `namespaces`.
|
|
2878
|
+
*
|
|
2879
|
+
* @return {String} returns the previously persisted debug modes
|
|
2880
|
+
* @api private
|
|
2881
|
+
*/
|
|
2882
|
+
function load() {
|
|
2883
|
+
let r;
|
|
2884
|
+
try {
|
|
2885
|
+
r = exports.storage.getItem('debug');
|
|
2886
|
+
} catch (error) {
|
|
2887
|
+
// Swallow
|
|
2888
|
+
// XXX (@Qix-) should we be logging these?
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
2892
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
2893
|
+
r = process.env.DEBUG;
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
return r;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
/**
|
|
2900
|
+
* Localstorage attempts to return the localstorage.
|
|
2901
|
+
*
|
|
2902
|
+
* This is necessary because safari throws
|
|
2903
|
+
* when a user disables cookies/localstorage
|
|
2904
|
+
* and you attempt to access it.
|
|
2905
|
+
*
|
|
2906
|
+
* @return {LocalStorage}
|
|
2907
|
+
* @api private
|
|
2908
|
+
*/
|
|
2909
|
+
|
|
2910
|
+
function localstorage() {
|
|
2911
|
+
try {
|
|
2912
|
+
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
2913
|
+
// The Browser also has localStorage in the global context.
|
|
2914
|
+
return localStorage;
|
|
2915
|
+
} catch (error) {
|
|
2916
|
+
// Swallow
|
|
2917
|
+
// XXX (@Qix-) should we be logging these?
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
module.exports = common(exports);
|
|
2922
|
+
|
|
2923
|
+
const {formatters} = module.exports;
|
|
2924
|
+
|
|
2925
|
+
/**
|
|
2926
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
2927
|
+
*/
|
|
2928
|
+
|
|
2929
|
+
formatters.j = function (v) {
|
|
2930
|
+
try {
|
|
2931
|
+
return JSON.stringify(v);
|
|
2932
|
+
} catch (error) {
|
|
2933
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2936
|
+
}(browser, browser.exports));
|
|
2937
|
+
|
|
2938
|
+
var node = {exports: {}};
|
|
2939
|
+
|
|
2940
|
+
var hasFlag$1 = (flag, argv = process.argv) => {
|
|
2941
|
+
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
2942
|
+
const position = argv.indexOf(prefix + flag);
|
|
2943
|
+
const terminatorPosition = argv.indexOf('--');
|
|
2944
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
2945
|
+
};
|
|
2946
|
+
|
|
2947
|
+
const os = require$$0;
|
|
2948
|
+
const tty = require$$1;
|
|
2949
|
+
const hasFlag = hasFlag$1;
|
|
2950
|
+
|
|
2951
|
+
const {env} = process;
|
|
2952
|
+
|
|
2953
|
+
let forceColor;
|
|
2954
|
+
if (hasFlag('no-color') ||
|
|
2955
|
+
hasFlag('no-colors') ||
|
|
2956
|
+
hasFlag('color=false') ||
|
|
2957
|
+
hasFlag('color=never')) {
|
|
2958
|
+
forceColor = 0;
|
|
2959
|
+
} else if (hasFlag('color') ||
|
|
2960
|
+
hasFlag('colors') ||
|
|
2961
|
+
hasFlag('color=true') ||
|
|
2962
|
+
hasFlag('color=always')) {
|
|
2963
|
+
forceColor = 1;
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
if ('FORCE_COLOR' in env) {
|
|
2967
|
+
if (env.FORCE_COLOR === 'true') {
|
|
2968
|
+
forceColor = 1;
|
|
2969
|
+
} else if (env.FORCE_COLOR === 'false') {
|
|
2970
|
+
forceColor = 0;
|
|
2971
|
+
} else {
|
|
2972
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
function translateLevel(level) {
|
|
2977
|
+
if (level === 0) {
|
|
2978
|
+
return false;
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
return {
|
|
2982
|
+
level,
|
|
2983
|
+
hasBasic: true,
|
|
2984
|
+
has256: level >= 2,
|
|
2985
|
+
has16m: level >= 3
|
|
2986
|
+
};
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
2990
|
+
if (forceColor === 0) {
|
|
2991
|
+
return 0;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
if (hasFlag('color=16m') ||
|
|
2995
|
+
hasFlag('color=full') ||
|
|
2996
|
+
hasFlag('color=truecolor')) {
|
|
2997
|
+
return 3;
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
if (hasFlag('color=256')) {
|
|
3001
|
+
return 2;
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
3005
|
+
return 0;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
const min = forceColor || 0;
|
|
3009
|
+
|
|
3010
|
+
if (env.TERM === 'dumb') {
|
|
3011
|
+
return min;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
if (process.platform === 'win32') {
|
|
3015
|
+
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
3016
|
+
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
3017
|
+
const osRelease = os.release().split('.');
|
|
3018
|
+
if (
|
|
3019
|
+
Number(osRelease[0]) >= 10 &&
|
|
3020
|
+
Number(osRelease[2]) >= 10586
|
|
3021
|
+
) {
|
|
3022
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
return 1;
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
if ('CI' in env) {
|
|
3029
|
+
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
3030
|
+
return 1;
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
return min;
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
3037
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
if (env.COLORTERM === 'truecolor') {
|
|
3041
|
+
return 3;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
if ('TERM_PROGRAM' in env) {
|
|
3045
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
3046
|
+
|
|
3047
|
+
switch (env.TERM_PROGRAM) {
|
|
3048
|
+
case 'iTerm.app':
|
|
3049
|
+
return version >= 3 ? 3 : 2;
|
|
3050
|
+
case 'Apple_Terminal':
|
|
3051
|
+
return 2;
|
|
3052
|
+
// No default
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
3057
|
+
return 2;
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
3061
|
+
return 1;
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
if ('COLORTERM' in env) {
|
|
3065
|
+
return 1;
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
return min;
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
function getSupportLevel(stream) {
|
|
3072
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
3073
|
+
return translateLevel(level);
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
var supportsColor_1 = {
|
|
3077
|
+
supportsColor: getSupportLevel,
|
|
3078
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
3079
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
3080
|
+
};
|
|
3081
|
+
|
|
3082
|
+
/**
|
|
3083
|
+
* Module dependencies.
|
|
3084
|
+
*/
|
|
3085
|
+
|
|
3086
|
+
(function (module, exports) {
|
|
3087
|
+
const tty = require$$1;
|
|
3088
|
+
const util = require$$1$1;
|
|
3089
|
+
|
|
3090
|
+
/**
|
|
3091
|
+
* This is the Node.js implementation of `debug()`.
|
|
3092
|
+
*/
|
|
3093
|
+
|
|
3094
|
+
exports.init = init;
|
|
3095
|
+
exports.log = log;
|
|
3096
|
+
exports.formatArgs = formatArgs;
|
|
3097
|
+
exports.save = save;
|
|
3098
|
+
exports.load = load;
|
|
3099
|
+
exports.useColors = useColors;
|
|
3100
|
+
exports.destroy = util.deprecate(
|
|
3101
|
+
() => {},
|
|
3102
|
+
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
3103
|
+
);
|
|
3104
|
+
|
|
3105
|
+
/**
|
|
3106
|
+
* Colors.
|
|
3107
|
+
*/
|
|
3108
|
+
|
|
3109
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
3110
|
+
|
|
3111
|
+
try {
|
|
3112
|
+
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
3113
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3114
|
+
const supportsColor = supportsColor_1;
|
|
3115
|
+
|
|
3116
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
3117
|
+
exports.colors = [
|
|
3118
|
+
20,
|
|
3119
|
+
21,
|
|
3120
|
+
26,
|
|
3121
|
+
27,
|
|
3122
|
+
32,
|
|
3123
|
+
33,
|
|
3124
|
+
38,
|
|
3125
|
+
39,
|
|
3126
|
+
40,
|
|
3127
|
+
41,
|
|
3128
|
+
42,
|
|
3129
|
+
43,
|
|
3130
|
+
44,
|
|
3131
|
+
45,
|
|
3132
|
+
56,
|
|
3133
|
+
57,
|
|
3134
|
+
62,
|
|
3135
|
+
63,
|
|
3136
|
+
68,
|
|
3137
|
+
69,
|
|
3138
|
+
74,
|
|
3139
|
+
75,
|
|
3140
|
+
76,
|
|
3141
|
+
77,
|
|
3142
|
+
78,
|
|
3143
|
+
79,
|
|
3144
|
+
80,
|
|
3145
|
+
81,
|
|
3146
|
+
92,
|
|
3147
|
+
93,
|
|
3148
|
+
98,
|
|
3149
|
+
99,
|
|
3150
|
+
112,
|
|
3151
|
+
113,
|
|
3152
|
+
128,
|
|
3153
|
+
129,
|
|
3154
|
+
134,
|
|
3155
|
+
135,
|
|
3156
|
+
148,
|
|
3157
|
+
149,
|
|
3158
|
+
160,
|
|
3159
|
+
161,
|
|
3160
|
+
162,
|
|
3161
|
+
163,
|
|
3162
|
+
164,
|
|
3163
|
+
165,
|
|
3164
|
+
166,
|
|
3165
|
+
167,
|
|
3166
|
+
168,
|
|
3167
|
+
169,
|
|
3168
|
+
170,
|
|
3169
|
+
171,
|
|
3170
|
+
172,
|
|
3171
|
+
173,
|
|
3172
|
+
178,
|
|
3173
|
+
179,
|
|
3174
|
+
184,
|
|
3175
|
+
185,
|
|
3176
|
+
196,
|
|
3177
|
+
197,
|
|
3178
|
+
198,
|
|
3179
|
+
199,
|
|
3180
|
+
200,
|
|
3181
|
+
201,
|
|
3182
|
+
202,
|
|
3183
|
+
203,
|
|
3184
|
+
204,
|
|
3185
|
+
205,
|
|
3186
|
+
206,
|
|
3187
|
+
207,
|
|
3188
|
+
208,
|
|
3189
|
+
209,
|
|
3190
|
+
214,
|
|
3191
|
+
215,
|
|
3192
|
+
220,
|
|
3193
|
+
221
|
|
3194
|
+
];
|
|
3195
|
+
}
|
|
3196
|
+
} catch (error) {
|
|
3197
|
+
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
/**
|
|
3201
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
3202
|
+
*
|
|
3203
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
3204
|
+
*/
|
|
3205
|
+
|
|
3206
|
+
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|
3207
|
+
return /^debug_/i.test(key);
|
|
3208
|
+
}).reduce((obj, key) => {
|
|
3209
|
+
// Camel-case
|
|
3210
|
+
const prop = key
|
|
3211
|
+
.substring(6)
|
|
3212
|
+
.toLowerCase()
|
|
3213
|
+
.replace(/_([a-z])/g, (_, k) => {
|
|
3214
|
+
return k.toUpperCase();
|
|
3215
|
+
});
|
|
3216
|
+
|
|
3217
|
+
// Coerce string value into JS value
|
|
3218
|
+
let val = process.env[key];
|
|
3219
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
3220
|
+
val = true;
|
|
3221
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
3222
|
+
val = false;
|
|
3223
|
+
} else if (val === 'null') {
|
|
3224
|
+
val = null;
|
|
3225
|
+
} else {
|
|
3226
|
+
val = Number(val);
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
obj[prop] = val;
|
|
3230
|
+
return obj;
|
|
3231
|
+
}, {});
|
|
3232
|
+
|
|
3233
|
+
/**
|
|
3234
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
3235
|
+
*/
|
|
3236
|
+
|
|
3237
|
+
function useColors() {
|
|
3238
|
+
return 'colors' in exports.inspectOpts ?
|
|
3239
|
+
Boolean(exports.inspectOpts.colors) :
|
|
3240
|
+
tty.isatty(process.stderr.fd);
|
|
3241
|
+
}
|
|
3242
|
+
|
|
3243
|
+
/**
|
|
3244
|
+
* Adds ANSI color escape codes if enabled.
|
|
3245
|
+
*
|
|
3246
|
+
* @api public
|
|
3247
|
+
*/
|
|
3248
|
+
|
|
3249
|
+
function formatArgs(args) {
|
|
3250
|
+
const {namespace: name, useColors} = this;
|
|
3251
|
+
|
|
3252
|
+
if (useColors) {
|
|
3253
|
+
const c = this.color;
|
|
3254
|
+
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
3255
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
3256
|
+
|
|
3257
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
3258
|
+
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
3259
|
+
} else {
|
|
3260
|
+
args[0] = getDate() + name + ' ' + args[0];
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
function getDate() {
|
|
3265
|
+
if (exports.inspectOpts.hideDate) {
|
|
3266
|
+
return '';
|
|
3267
|
+
}
|
|
3268
|
+
return new Date().toISOString() + ' ';
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
/**
|
|
3272
|
+
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|
3273
|
+
*/
|
|
3274
|
+
|
|
3275
|
+
function log(...args) {
|
|
3276
|
+
return process.stderr.write(util.format(...args) + '\n');
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
/**
|
|
3280
|
+
* Save `namespaces`.
|
|
3281
|
+
*
|
|
3282
|
+
* @param {String} namespaces
|
|
3283
|
+
* @api private
|
|
3284
|
+
*/
|
|
3285
|
+
function save(namespaces) {
|
|
3286
|
+
if (namespaces) {
|
|
3287
|
+
process.env.DEBUG = namespaces;
|
|
3288
|
+
} else {
|
|
3289
|
+
// If you set a process.env field to null or undefined, it gets cast to the
|
|
3290
|
+
// string 'null' or 'undefined'. Just delete instead.
|
|
3291
|
+
delete process.env.DEBUG;
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
/**
|
|
3296
|
+
* Load `namespaces`.
|
|
3297
|
+
*
|
|
3298
|
+
* @return {String} returns the previously persisted debug modes
|
|
3299
|
+
* @api private
|
|
3300
|
+
*/
|
|
3301
|
+
|
|
3302
|
+
function load() {
|
|
3303
|
+
return process.env.DEBUG;
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
/**
|
|
3307
|
+
* Init logic for `debug` instances.
|
|
3308
|
+
*
|
|
3309
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
3310
|
+
* differently for a particular `debug` instance.
|
|
3311
|
+
*/
|
|
3312
|
+
|
|
3313
|
+
function init(debug) {
|
|
3314
|
+
debug.inspectOpts = {};
|
|
3315
|
+
|
|
3316
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
3317
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3318
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
module.exports = common(exports);
|
|
3323
|
+
|
|
3324
|
+
const {formatters} = module.exports;
|
|
3325
|
+
|
|
3326
|
+
/**
|
|
3327
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
3328
|
+
*/
|
|
3329
|
+
|
|
3330
|
+
formatters.o = function (v) {
|
|
3331
|
+
this.inspectOpts.colors = this.useColors;
|
|
3332
|
+
return util.inspect(v, this.inspectOpts)
|
|
3333
|
+
.split('\n')
|
|
3334
|
+
.map(str => str.trim())
|
|
3335
|
+
.join(' ');
|
|
3336
|
+
};
|
|
3337
|
+
|
|
3338
|
+
/**
|
|
3339
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
3340
|
+
*/
|
|
3341
|
+
|
|
3342
|
+
formatters.O = function (v) {
|
|
3343
|
+
this.inspectOpts.colors = this.useColors;
|
|
3344
|
+
return util.inspect(v, this.inspectOpts);
|
|
3345
|
+
};
|
|
3346
|
+
}(node, node.exports));
|
|
3347
|
+
|
|
3348
|
+
/**
|
|
3349
|
+
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
3350
|
+
* treat as a browser.
|
|
3351
|
+
*/
|
|
3352
|
+
|
|
3353
|
+
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
3354
|
+
src.exports = browser.exports;
|
|
3355
|
+
} else {
|
|
3356
|
+
src.exports = node.exports;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
var Debug = src.exports;
|
|
3360
|
+
|
|
3361
|
+
const log = Debug('ninetailed:experience-sdk');
|
|
3362
|
+
const enable = () => {
|
|
3363
|
+
Debug.enable('ninetailed:experience-sdk');
|
|
3364
|
+
};
|
|
3365
|
+
const disable = () => Debug.disable();
|
|
3366
|
+
|
|
3367
|
+
const BASE_URL = 'https://api.ninetailed.co';
|
|
3368
|
+
|
|
3369
|
+
const fetchWithTimeout = (input, init) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3370
|
+
const {
|
|
3371
|
+
timeout
|
|
3372
|
+
} = init;
|
|
3373
|
+
const controller = new AbortController();
|
|
3374
|
+
const id = setTimeout(() => {
|
|
3375
|
+
log(`Profile Request timed out.`);
|
|
3376
|
+
controller.abort();
|
|
3377
|
+
}, timeout);
|
|
3378
|
+
const response = yield fetch(input, Object.assign(Object.assign({}, init), {
|
|
3379
|
+
signal: controller.signal
|
|
3380
|
+
}));
|
|
3381
|
+
clearTimeout(id);
|
|
3382
|
+
return response;
|
|
3383
|
+
});
|
|
3384
|
+
|
|
3385
|
+
class NinetailedApiClient {
|
|
3386
|
+
constructor({
|
|
3387
|
+
apiKey,
|
|
3388
|
+
url = BASE_URL
|
|
3389
|
+
}) {
|
|
3390
|
+
this.apiKey = apiKey;
|
|
3391
|
+
this.url = url;
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
profile(options) {
|
|
3395
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3396
|
+
log('Sending Profile Request.');
|
|
3397
|
+
const {
|
|
3398
|
+
events
|
|
3399
|
+
} = options; // TODO throw error if not all events have same anon id.
|
|
3400
|
+
|
|
3401
|
+
const anonymousId = events[0].anonymousId;
|
|
3402
|
+
const body = options;
|
|
3403
|
+
log('Profile Request Body: ', body);
|
|
3404
|
+
|
|
3405
|
+
try {
|
|
3406
|
+
const request = yield fetchWithTimeout(`${this.url}/profile/${anonymousId}/events`, {
|
|
3407
|
+
method: 'POST',
|
|
3408
|
+
headers: {
|
|
3409
|
+
'Content-Type': 'application/json',
|
|
3410
|
+
'x-ninetailed-api-key': this.apiKey
|
|
3411
|
+
},
|
|
3412
|
+
body: JSON.stringify(body),
|
|
3413
|
+
timeout: 8000
|
|
3414
|
+
});
|
|
3415
|
+
log('Profile Request: ', request);
|
|
3416
|
+
const {
|
|
3417
|
+
data
|
|
3418
|
+
} = yield request.json();
|
|
3419
|
+
log('Profile Request completed.');
|
|
3420
|
+
return data;
|
|
3421
|
+
} catch (error) {
|
|
3422
|
+
// TODO only during debug.
|
|
3423
|
+
log(error);
|
|
3424
|
+
throw error;
|
|
3425
|
+
}
|
|
3426
|
+
});
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
const NINETAILED_TRACKER_EVENTS = {
|
|
3432
|
+
/**
|
|
3433
|
+
* `profile` - Fires when the profile is returned by the cdp API.
|
|
3434
|
+
*/
|
|
3435
|
+
profile: 'profile'
|
|
3436
|
+
};
|
|
3437
|
+
const PLUGIN_NAME = 'ninetailed';
|
|
3438
|
+
|
|
3439
|
+
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
3440
|
+
|
|
3441
|
+
const ninetailedPlugin = ({
|
|
3442
|
+
apiKey,
|
|
3443
|
+
url,
|
|
3444
|
+
profile,
|
|
3445
|
+
locale
|
|
3446
|
+
}) => {
|
|
3447
|
+
const apiClient = new NinetailedApiClient({
|
|
3448
|
+
apiKey,
|
|
3449
|
+
url
|
|
3450
|
+
});
|
|
3451
|
+
let queue = [];
|
|
3452
|
+
let localOnly = false;
|
|
3453
|
+
|
|
3454
|
+
const flush = instance => __awaiter(void 0, void 0, void 0, function* () {
|
|
3455
|
+
const events = Object.assign([], queue);
|
|
3456
|
+
log('Start flushing events.');
|
|
3457
|
+
queue = [];
|
|
3458
|
+
|
|
3459
|
+
if (!events.length) {
|
|
3460
|
+
return;
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
const cache = get({
|
|
3464
|
+
instance
|
|
3465
|
+
});
|
|
3466
|
+
|
|
3467
|
+
try {
|
|
3468
|
+
log('Cache: ', cache);
|
|
3469
|
+
const {
|
|
3470
|
+
profile,
|
|
3471
|
+
signals,
|
|
3472
|
+
traitsUpdatedAt,
|
|
3473
|
+
sessions
|
|
3474
|
+
} = yield apiClient.profile({
|
|
3475
|
+
events,
|
|
3476
|
+
signals: get$2(cache, 'signals', {}),
|
|
3477
|
+
traits: get$2(cache, 'traits', {}),
|
|
3478
|
+
traitsUpdatedAt: get$2(cache, 'traitsUpdatedAt', new Date().toISOString()),
|
|
3479
|
+
localOnly,
|
|
3480
|
+
options: {
|
|
3481
|
+
locale: locale || 'en'
|
|
3482
|
+
},
|
|
3483
|
+
sessions: cache.sessions
|
|
3484
|
+
});
|
|
3485
|
+
log('Profile from api: ', profile);
|
|
3486
|
+
const updatedCache = set({
|
|
3487
|
+
id: profile.id,
|
|
3488
|
+
random: profile.random,
|
|
3489
|
+
audiences: profile.audiences,
|
|
3490
|
+
traits: profile.traits,
|
|
3491
|
+
location: profile.location,
|
|
3492
|
+
signals,
|
|
3493
|
+
traitsUpdatedAt,
|
|
3494
|
+
sessions,
|
|
3495
|
+
session: profile.session
|
|
3496
|
+
}, {
|
|
3497
|
+
instance
|
|
3498
|
+
});
|
|
3499
|
+
instance.dispatch({
|
|
3500
|
+
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
3501
|
+
profile,
|
|
3502
|
+
cache: updatedCache
|
|
3503
|
+
});
|
|
3504
|
+
} catch (error) {
|
|
3505
|
+
log('An error occurred during flushing the events: ', error);
|
|
3506
|
+
instance.dispatch({
|
|
3507
|
+
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
3508
|
+
profile: {
|
|
3509
|
+
id: cache.id,
|
|
3510
|
+
random: cache.random,
|
|
3511
|
+
audiences: cache.audiences,
|
|
3512
|
+
traits: cache.traits,
|
|
3513
|
+
location: cache.location,
|
|
3514
|
+
session: cache.session
|
|
3515
|
+
},
|
|
3516
|
+
cache
|
|
3517
|
+
});
|
|
3518
|
+
}
|
|
3519
|
+
});
|
|
3520
|
+
|
|
3521
|
+
const throttledFlush = throttle(flush, 200, {
|
|
3522
|
+
leading: false,
|
|
3523
|
+
trailing: true
|
|
3524
|
+
});
|
|
3525
|
+
|
|
3526
|
+
const createEvent = (event, instance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3527
|
+
queue = unionBy([event], queue, 'messageId');
|
|
3528
|
+
throttledFlush(instance);
|
|
3529
|
+
});
|
|
3530
|
+
|
|
3531
|
+
return {
|
|
3532
|
+
name: 'ninetailed',
|
|
3533
|
+
config: {},
|
|
3534
|
+
initialize: ({
|
|
3535
|
+
instance
|
|
3536
|
+
}) => {
|
|
3537
|
+
const cache = get({
|
|
3538
|
+
instance
|
|
3539
|
+
});
|
|
3540
|
+
|
|
3541
|
+
if (profile) {
|
|
3542
|
+
instance.storage.setItem('__anon_id', profile.id);
|
|
3543
|
+
initialize({
|
|
3544
|
+
instance
|
|
3545
|
+
}, Object.assign(Object.assign({}, cache), {
|
|
3546
|
+
id: profile.id
|
|
3547
|
+
}));
|
|
3548
|
+
} else {
|
|
3549
|
+
const anonymousId = instance.storage.getItem('__anon_id');
|
|
3550
|
+
initialize({
|
|
3551
|
+
instance
|
|
3552
|
+
}, Object.assign(Object.assign({}, cache), {
|
|
3553
|
+
id: anonymousId
|
|
3554
|
+
}));
|
|
3555
|
+
}
|
|
3556
|
+
},
|
|
3557
|
+
page: ({
|
|
3558
|
+
payload,
|
|
3559
|
+
instance
|
|
3560
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3561
|
+
log('Sending Page event.');
|
|
3562
|
+
const ctx = buildClientNinetailedRequestContext();
|
|
3563
|
+
localOnly = payload.localOnly;
|
|
3564
|
+
yield createEvent(buildPageEvent({
|
|
3565
|
+
// doing this here as the anonymous id is set to late from init
|
|
3566
|
+
anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
|
|
3567
|
+
messageId: payload.meta.rid,
|
|
3568
|
+
timestamp: payload.meta.ts,
|
|
3569
|
+
properties: payload.properties,
|
|
3570
|
+
ctx
|
|
3571
|
+
}), instance);
|
|
3572
|
+
}),
|
|
3573
|
+
track: ({
|
|
3574
|
+
payload,
|
|
3575
|
+
instance
|
|
3576
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3577
|
+
log('Sending Track event.');
|
|
3578
|
+
const ctx = buildClientNinetailedRequestContext();
|
|
3579
|
+
localOnly = payload.localOnly;
|
|
3580
|
+
yield createEvent(buildTrackEvent({
|
|
3581
|
+
// doing this here as the anonymous id is set to late from init
|
|
3582
|
+
anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
|
|
3583
|
+
messageId: payload.meta.rid,
|
|
3584
|
+
timestamp: payload.meta.ts,
|
|
3585
|
+
event: payload.event,
|
|
3586
|
+
properties: payload.properties,
|
|
3587
|
+
ctx
|
|
3588
|
+
}), instance);
|
|
3589
|
+
}),
|
|
3590
|
+
identify: ({
|
|
3591
|
+
payload,
|
|
3592
|
+
instance
|
|
3593
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3594
|
+
log('Sending Identify event.');
|
|
3595
|
+
localOnly = payload.localOnly;
|
|
3596
|
+
const ctx = buildClientNinetailedRequestContext();
|
|
3597
|
+
yield createEvent(buildIdentifyEvent({
|
|
3598
|
+
// doing this here as the anonymous id is set to late from init
|
|
3599
|
+
anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
|
|
3600
|
+
messageId: payload.meta.rid,
|
|
3601
|
+
timestamp: payload.meta.ts,
|
|
3602
|
+
traits: payload.traits,
|
|
3603
|
+
userId: payload.userId,
|
|
3604
|
+
ctx
|
|
3605
|
+
}), instance);
|
|
3606
|
+
}),
|
|
3607
|
+
loaded: () => {
|
|
3608
|
+
return true;
|
|
3609
|
+
},
|
|
3610
|
+
methods: {
|
|
3611
|
+
reset: (...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3612
|
+
const instance = args[args.length - 1];
|
|
3613
|
+
const cache = reset({
|
|
3614
|
+
instance
|
|
3615
|
+
});
|
|
3616
|
+
yield instance.storage.setItem('__anon_id', cache.id);
|
|
3617
|
+
instance.dispatch({
|
|
3618
|
+
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
3619
|
+
profile: {
|
|
3620
|
+
id: cache.id,
|
|
3621
|
+
random: 0,
|
|
3622
|
+
audiences: [],
|
|
3623
|
+
traits: {},
|
|
3624
|
+
location: {}
|
|
3625
|
+
},
|
|
3626
|
+
cache: cache
|
|
3627
|
+
});
|
|
3628
|
+
yield delay(10);
|
|
3629
|
+
}),
|
|
3630
|
+
debug: enabled => {
|
|
3631
|
+
if (enabled) {
|
|
3632
|
+
enable();
|
|
3633
|
+
log('Debug mode is now enabled.');
|
|
3634
|
+
} else {
|
|
3635
|
+
disable();
|
|
3636
|
+
log('Debug mode is now disabled.');
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
};
|
|
3641
|
+
};
|
|
3642
|
+
|
|
3643
|
+
var global$1 = global$A;
|
|
3644
|
+
var aCallable = aCallable$6;
|
|
3645
|
+
var toObject = toObject$3;
|
|
3646
|
+
var IndexedObject = indexedObject;
|
|
3647
|
+
var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
3648
|
+
|
|
3649
|
+
var TypeError$1 = global$1.TypeError;
|
|
3650
|
+
|
|
3651
|
+
// `Array.prototype.{ reduce, reduceRight }` methods implementation
|
|
3652
|
+
var createMethod = function (IS_RIGHT) {
|
|
3653
|
+
return function (that, callbackfn, argumentsLength, memo) {
|
|
3654
|
+
aCallable(callbackfn);
|
|
3655
|
+
var O = toObject(that);
|
|
3656
|
+
var self = IndexedObject(O);
|
|
3657
|
+
var length = lengthOfArrayLike(O);
|
|
3658
|
+
var index = IS_RIGHT ? length - 1 : 0;
|
|
3659
|
+
var i = IS_RIGHT ? -1 : 1;
|
|
3660
|
+
if (argumentsLength < 2) while (true) {
|
|
3661
|
+
if (index in self) {
|
|
3662
|
+
memo = self[index];
|
|
3663
|
+
index += i;
|
|
3664
|
+
break;
|
|
3665
|
+
}
|
|
3666
|
+
index += i;
|
|
3667
|
+
if (IS_RIGHT ? index < 0 : length <= index) {
|
|
3668
|
+
throw TypeError$1('Reduce of empty array with no initial value');
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
|
|
3672
|
+
memo = callbackfn(memo, self[index], index, O);
|
|
3673
|
+
}
|
|
3674
|
+
return memo;
|
|
3675
|
+
};
|
|
3676
|
+
};
|
|
3677
|
+
|
|
3678
|
+
var arrayReduce = {
|
|
3679
|
+
// `Array.prototype.reduce` method
|
|
3680
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduce
|
|
3681
|
+
left: createMethod(false),
|
|
3682
|
+
// `Array.prototype.reduceRight` method
|
|
3683
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduceright
|
|
3684
|
+
right: createMethod(true)
|
|
3685
|
+
};
|
|
3686
|
+
|
|
3687
|
+
var fails = fails$b;
|
|
3688
|
+
|
|
3689
|
+
var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
|
|
3690
|
+
var method = [][METHOD_NAME];
|
|
3691
|
+
return !!method && fails(function () {
|
|
3692
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
3693
|
+
method.call(null, argument || function () { return 1; }, 1);
|
|
3694
|
+
});
|
|
3695
|
+
};
|
|
3696
|
+
|
|
3697
|
+
var $ = _export;
|
|
3698
|
+
var $reduce = arrayReduce.left;
|
|
3699
|
+
var arrayMethodIsStrict = arrayMethodIsStrict$1;
|
|
3700
|
+
var CHROME_VERSION = engineV8Version;
|
|
3701
|
+
var IS_NODE = engineIsNode;
|
|
3702
|
+
|
|
3703
|
+
var STRICT_METHOD = arrayMethodIsStrict('reduce');
|
|
3704
|
+
// Chrome 80-82 has a critical bug
|
|
3705
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
|
|
3706
|
+
var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
|
|
3707
|
+
|
|
3708
|
+
// `Array.prototype.reduce` method
|
|
3709
|
+
// https://tc39.es/ecma262/#sec-array.prototype.reduce
|
|
3710
|
+
$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
|
|
3711
|
+
reduce: function reduce(callbackfn /* , initialValue */) {
|
|
3712
|
+
var length = arguments.length;
|
|
3713
|
+
return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
|
|
3714
|
+
}
|
|
3715
|
+
});
|
|
3716
|
+
|
|
3717
|
+
class Ninetailed {
|
|
3718
|
+
constructor(apiKey, {
|
|
3719
|
+
plugins,
|
|
3720
|
+
url,
|
|
3721
|
+
profile,
|
|
3722
|
+
locale
|
|
3723
|
+
}) {
|
|
3724
|
+
this.page = (data, options) => {
|
|
3725
|
+
return this.instance.page(data, this.buildOptions(options));
|
|
3726
|
+
};
|
|
3727
|
+
|
|
3728
|
+
this.track = (event, payload, options) => {
|
|
3729
|
+
return this.instance.track(event, payload, this.buildOptions(options));
|
|
3730
|
+
};
|
|
3731
|
+
|
|
3732
|
+
this.identify = (uid, traits, options) => {
|
|
3733
|
+
return this.instance.identify(uid, traits, this.buildOptions(options));
|
|
3734
|
+
};
|
|
3735
|
+
|
|
3736
|
+
this.reset = () => {
|
|
3737
|
+
return this.instance.plugins[PLUGIN_NAME].reset();
|
|
3738
|
+
};
|
|
3739
|
+
|
|
3740
|
+
this.debug = enabled => {
|
|
3741
|
+
return this.instance.plugins[PLUGIN_NAME].debug(enabled);
|
|
3742
|
+
};
|
|
3743
|
+
|
|
3744
|
+
this.onProfileChange = cb => {
|
|
3745
|
+
return this.instance.on(NINETAILED_TRACKER_EVENTS.profile, ({
|
|
3746
|
+
payload
|
|
3747
|
+
}) => {
|
|
3748
|
+
cb(Object.assign(Object.assign({}, this._profileState), {
|
|
3749
|
+
loading: false,
|
|
3750
|
+
profile: payload.profile,
|
|
3751
|
+
error: undefined
|
|
3752
|
+
}));
|
|
3753
|
+
});
|
|
3754
|
+
};
|
|
3755
|
+
|
|
3756
|
+
this.plugins = plugins || [];
|
|
3757
|
+
this._profileState = {
|
|
3758
|
+
loading: !profile,
|
|
3759
|
+
profile,
|
|
3760
|
+
error: undefined,
|
|
3761
|
+
from: profile ? 'hydrated' : 'api'
|
|
3762
|
+
};
|
|
3763
|
+
this.instance = Analytics({
|
|
3764
|
+
app: 'ninetailed',
|
|
3765
|
+
plugins: [ninetailedPlugin({
|
|
3766
|
+
apiKey,
|
|
3767
|
+
url,
|
|
3768
|
+
profile,
|
|
3769
|
+
locale
|
|
3770
|
+
})]
|
|
3771
|
+
}); // register plugins conditionally
|
|
3772
|
+
// const additionalPlugins: AnalyticsPlugin[] = useMemo(() => {
|
|
3773
|
+
// const importedPlugins = [];
|
|
3774
|
+
// if (options.analyticsPlugins?.googleAnalytics) {
|
|
3775
|
+
// importedPlugins.push(
|
|
3776
|
+
// googleAnalytics({
|
|
3777
|
+
// trackingId: options.analyticsPlugins.googleAnalytics.trackingId,
|
|
3778
|
+
// })
|
|
3779
|
+
// );
|
|
3780
|
+
// }
|
|
3781
|
+
// return importedPlugins;
|
|
3782
|
+
// }, []);
|
|
3783
|
+
// put in private method
|
|
3784
|
+
|
|
3785
|
+
this.onProfileChange(profileState => {
|
|
3786
|
+
this._profileState = profileState;
|
|
3787
|
+
});
|
|
3788
|
+
this.registerWindowHandlers();
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
get profileState() {
|
|
3792
|
+
return this._profileState;
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
buildOptions(options = {}) {
|
|
3796
|
+
return Object.assign(Object.assign({}, options), {
|
|
3797
|
+
plugins: Object.assign(Object.assign({
|
|
3798
|
+
all: false,
|
|
3799
|
+
ninetailed: true
|
|
3800
|
+
}, this.plugins.map(plugin => plugin).filter(plugin => includes(plugin.name, 'ninetailed:')).reduce((acc, curr) => Object.assign(Object.assign({}, acc), {
|
|
3801
|
+
[curr.name]: true
|
|
3802
|
+
}), {})), get$2(options, 'plugins'))
|
|
3803
|
+
});
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3806
|
+
registerWindowHandlers() {
|
|
3807
|
+
if (typeof window !== 'undefined') {
|
|
3808
|
+
window.ninetailed = Object.assign({}, window.ninetailed, {
|
|
3809
|
+
page: this.page.bind(this),
|
|
3810
|
+
track: this.track.bind(this),
|
|
3811
|
+
identify: this.identify.bind(this),
|
|
3812
|
+
reset: this.reset.bind(this),
|
|
3813
|
+
debug: this.debug.bind(this)
|
|
3814
|
+
});
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
const selectVariant = (baseline, variants, {
|
|
3821
|
+
loading,
|
|
3822
|
+
profile,
|
|
3823
|
+
error
|
|
3824
|
+
}, options = {
|
|
3825
|
+
holdout: -1
|
|
3826
|
+
}) => {
|
|
3827
|
+
if (loading) {
|
|
3828
|
+
return {
|
|
3829
|
+
loading: true,
|
|
3830
|
+
variant: baseline,
|
|
3831
|
+
audience: {
|
|
3832
|
+
id: 'baseline'
|
|
3833
|
+
},
|
|
3834
|
+
isPersonalized: false,
|
|
3835
|
+
error: null
|
|
3836
|
+
};
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
if (error) {
|
|
3840
|
+
return {
|
|
3841
|
+
loading: false,
|
|
3842
|
+
variant: baseline,
|
|
3843
|
+
audience: {
|
|
3844
|
+
id: 'baseline'
|
|
3845
|
+
},
|
|
3846
|
+
isPersonalized: false,
|
|
3847
|
+
error: error
|
|
3848
|
+
};
|
|
3849
|
+
}
|
|
3850
|
+
|
|
3851
|
+
const variant = find(variants, variant => {
|
|
3852
|
+
var _a;
|
|
3853
|
+
|
|
3854
|
+
return includes(profile === null || profile === void 0 ? void 0 : profile.audiences, (_a = variant.audience) === null || _a === void 0 ? void 0 : _a.id);
|
|
3855
|
+
});
|
|
3856
|
+
|
|
3857
|
+
if (variant) {
|
|
3858
|
+
if (options.holdout > profile.random) {
|
|
3859
|
+
return {
|
|
3860
|
+
loading: false,
|
|
3861
|
+
variant: baseline,
|
|
3862
|
+
audience: {
|
|
3863
|
+
id: variant.audience.id
|
|
3864
|
+
},
|
|
3865
|
+
isPersonalized: false,
|
|
3866
|
+
error: null
|
|
3867
|
+
};
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3870
|
+
return {
|
|
3871
|
+
loading: false,
|
|
3872
|
+
variant,
|
|
3873
|
+
audience: {
|
|
3874
|
+
id: variant.audience.id
|
|
3875
|
+
},
|
|
3876
|
+
isPersonalized: true,
|
|
3877
|
+
error: null
|
|
3878
|
+
};
|
|
3879
|
+
}
|
|
3880
|
+
/**
|
|
3881
|
+
* There was no matching audience found.
|
|
3882
|
+
*/
|
|
3883
|
+
|
|
3884
|
+
|
|
3885
|
+
return {
|
|
3886
|
+
loading: false,
|
|
3887
|
+
variant: baseline,
|
|
3888
|
+
audience: {
|
|
3889
|
+
id: 'baseline'
|
|
3890
|
+
},
|
|
3891
|
+
isPersonalized: false,
|
|
3892
|
+
error: null
|
|
3893
|
+
};
|
|
3894
|
+
};
|
|
3895
|
+
|
|
3896
|
+
export { NINETAILED_TRACKER_EVENTS, Ninetailed, PLUGIN_NAME, ninetailedPlugin, selectVariant };
|