debug-fabulous 2.0.2 → 2.0.3

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/umd/index.js CHANGED
@@ -1,2106 +1,43 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (global = global || self, global.DebugFabulous = factory());
5
- }(this, (function () { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('memoizee')) :
3
+ typeof define === 'function' && define.amd ? define(['memoizee'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.DebugFabulous = factory(global.memoizee));
5
+ })(this, (function (memoize) { 'use strict';
6
6
 
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
-
22
- function __spreadArray(to, from, pack) {
23
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
24
- if (ar || !(i in from)) {
25
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
26
- ar[i] = from[i];
27
- }
28
- }
29
- return to.concat(ar || Array.prototype.slice.call(from));
30
- }
31
-
32
- // eslint-disable-next-line no-empty-function
33
- var noop = function () {};
34
-
35
- var _undefined = noop(); // Support ES3 engines
36
-
37
- var isValue = function (val) { return val !== _undefined && val !== null; };
38
-
39
- var forEach = Array.prototype.forEach, create = Object.create;
40
-
41
- var process$1 = function (src, obj) {
42
- var key;
43
- for (key in src) obj[key] = src[key];
44
- };
45
-
46
- // eslint-disable-next-line no-unused-vars
47
- var normalizeOptions = function (opts1/*, …options*/) {
48
- var result = create(null);
49
- forEach.call(arguments, function (options) {
50
- if (!isValue(options)) return;
51
- process$1(Object(options), result);
52
- });
53
- return result;
54
- };
55
-
56
- var isImplemented = function () {
57
- var sign = Math.sign;
58
- if (typeof sign !== "function") return false;
59
- return sign(10) === 1 && sign(-20) === -1;
60
- };
61
-
62
- var shim = function (value) {
63
- value = Number(value);
64
- if (isNaN(value) || value === 0) return value;
65
- return value > 0 ? 1 : -1;
66
- };
67
-
68
- var sign = isImplemented() ? Math.sign : shim;
69
-
70
- var abs = Math.abs
71
- , floor = Math.floor;
72
-
73
- var toInteger = function (value) {
74
- if (isNaN(value)) return 0;
75
- value = Number(value);
76
- if (value === 0 || !isFinite(value)) return value;
77
- return sign(value) * floor(abs(value));
78
- };
79
-
80
- var max = Math.max;
81
-
82
- var toPosInteger = function (value) { return max(0, toInteger(value)); };
83
-
84
- var resolveLength = function (optsLength, fnLength, isAsync) {
85
- var length;
86
- if (isNaN(optsLength)) {
87
- length = fnLength;
88
- if (!(length >= 0)) return 1;
89
- if (isAsync && length) return length - 1;
90
- return length;
91
- }
92
- if (optsLength === false) return false;
93
- return toPosInteger(optsLength);
94
- };
95
-
96
- var validCallable = function (fn) {
97
- if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
98
- return fn;
99
- };
100
-
101
- var validValue = function (value) {
102
- if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
103
- return value;
104
- };
105
-
106
- var bind = Function.prototype.bind
107
- , call = Function.prototype.call
108
- , keys = Object.keys
109
- , objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
110
-
111
- var _iterate = function (method, defVal) {
112
- return function (obj, cb/*, thisArg, compareFn*/) {
113
- var list, thisArg = arguments[2], compareFn = arguments[3];
114
- obj = Object(validValue(obj));
115
- validCallable(cb);
116
-
117
- list = keys(obj);
118
- if (compareFn) {
119
- list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined);
120
- }
121
- if (typeof method !== "function") method = list[method];
122
- return call.call(method, list, function (key, index) {
123
- if (!objPropertyIsEnumerable.call(obj, key)) return defVal;
124
- return call.call(cb, thisArg, obj[key], key, obj, index);
125
- });
126
- };
127
- };
128
-
129
- var forEach$1 = _iterate("forEach");
130
-
131
-
132
-
133
- var registeredExtensions = /*#__PURE__*/Object.freeze({
134
- __proto__: null
135
- });
136
-
137
- function createCommonjsModule(fn, module) {
138
- return module = { exports: {} }, fn(module, module.exports), module.exports;
139
- }
140
-
141
- var isImplemented$1 = function () {
142
- var assign = Object.assign, obj;
143
- if (typeof assign !== "function") return false;
144
- obj = { foo: "raz" };
145
- assign(obj, { bar: "dwa" }, { trzy: "trzy" });
146
- return obj.foo + obj.bar + obj.trzy === "razdwatrzy";
147
- };
148
-
149
- var isImplemented$2 = function () {
150
- try {
151
- Object.keys("primitive");
152
- return true;
153
- } catch (e) {
154
- return false;
155
- }
156
- };
157
-
158
- var keys$1 = Object.keys;
159
-
160
- var shim$1 = function (object) { return keys$1(isValue(object) ? Object(object) : object); };
161
-
162
- var keys$2 = isImplemented$2() ? Object.keys : shim$1;
163
-
164
- var max$1 = Math.max;
165
-
166
- var shim$2 = function (dest, src/*, …srcn*/) {
167
- var error, i, length = max$1(arguments.length, 2), assign;
168
- dest = Object(validValue(dest));
169
- assign = function (key) {
170
- try {
171
- dest[key] = src[key];
172
- } catch (e) {
173
- if (!error) error = e;
174
- }
175
- };
176
- for (i = 1; i < length; ++i) {
177
- src = arguments[i];
178
- keys$2(src).forEach(assign);
179
- }
180
- if (error !== undefined) throw error;
181
- return dest;
182
- };
183
-
184
- var assign = isImplemented$1() ? Object.assign : shim$2;
185
-
186
- var map = { function: true, object: true };
187
-
188
- var isObject = function (value) { return (isValue(value) && map[typeof value]) || false; };
189
-
190
- var custom = createCommonjsModule(function (module) {
191
-
192
- var captureStackTrace = Error.captureStackTrace;
193
-
194
- module.exports = function (message/*, code, ext*/) {
195
- var err = new Error(message), code = arguments[1], ext = arguments[2];
196
- if (!isValue(ext)) {
197
- if (isObject(code)) {
198
- ext = code;
199
- code = null;
200
- }
201
- }
202
- if (isValue(ext)) assign(err, ext);
203
- if (isValue(code)) err.code = code;
204
- if (captureStackTrace) captureStackTrace(err, module.exports);
205
- return err;
206
- };
207
- });
208
-
209
- var defineProperty = Object.defineProperty
210
- , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
211
- , getOwnPropertyNames = Object.getOwnPropertyNames
212
- , getOwnPropertySymbols = Object.getOwnPropertySymbols;
213
-
214
- var mixin = function (target, source) {
215
- var error, sourceObject = Object(validValue(source));
216
- target = Object(validValue(target));
217
- getOwnPropertyNames(sourceObject).forEach(function (name) {
218
- try {
219
- defineProperty(target, name, getOwnPropertyDescriptor(source, name));
220
- } catch (e) { error = e; }
221
- });
222
- if (typeof getOwnPropertySymbols === "function") {
223
- getOwnPropertySymbols(sourceObject).forEach(function (symbol) {
224
- try {
225
- defineProperty(target, symbol, getOwnPropertyDescriptor(source, symbol));
226
- } catch (e) { error = e; }
227
- });
228
- }
229
- if (error !== undefined) throw error;
230
- return target;
231
- };
232
-
233
- var _defineLength = createCommonjsModule(function (module) {
234
-
235
-
236
-
237
- var test = function (arg1, arg2) { return arg2; };
238
-
239
- var desc, defineProperty, generate, mixin$1;
240
-
241
- try {
242
- Object.defineProperty(test, "length", {
243
- configurable: true,
244
- writable: false,
245
- enumerable: false,
246
- value: 1
247
- });
248
- }
249
- catch (ignore) {}
250
-
251
- if (test.length === 1) {
252
- // ES6
253
- desc = { configurable: true, writable: false, enumerable: false };
254
- defineProperty = Object.defineProperty;
255
- module.exports = function (fn, length) {
256
- length = toPosInteger(length);
257
- if (fn.length === length) return fn;
258
- desc.value = length;
259
- return defineProperty(fn, "length", desc);
260
- };
261
- } else {
262
- mixin$1 = mixin;
263
- generate = (function () {
264
- var cache = [];
265
- return function (length) {
266
- var args, i = 0;
267
- if (cache[length]) return cache[length];
268
- args = [];
269
- while (length--) args.push("a" + (++i).toString(36));
270
- // eslint-disable-next-line no-new-func
271
- return new Function(
272
- "fn",
273
- "return function (" + args.join(", ") + ") { return fn.apply(this, arguments); };"
274
- );
275
- };
276
- })();
277
- module.exports = function (src, length) {
278
- var target;
279
- length = toPosInteger(length);
280
- if (src.length === length) return src;
281
- target = generate(length)(src);
282
- try { mixin$1(target, src); }
283
- catch (ignore) {}
284
- return target;
285
- };
286
- }
287
- });
288
-
289
- // ES3 safe
290
- var _undefined$1 = void 0;
291
-
292
- var is = function (value) { return value !== _undefined$1 && value !== null; };
293
-
294
- // prettier-ignore
295
- var possibleTypes = { "object": true, "function": true, "undefined": true /* document.all */ };
296
-
297
- var is$1 = function (value) {
298
- if (!is(value)) return false;
299
- return hasOwnProperty.call(possibleTypes, typeof value);
300
- };
301
-
302
- var is$2 = function (value) {
303
- if (!is$1(value)) return false;
304
- try {
305
- if (!value.constructor) return false;
306
- return value.constructor.prototype === value;
307
- } catch (error) {
308
- return false;
309
- }
310
- };
311
-
312
- var is$3 = function (value) {
313
- if (typeof value !== "function") return false;
314
-
315
- if (!hasOwnProperty.call(value, "length")) return false;
316
-
317
- try {
318
- if (typeof value.length !== "number") return false;
319
- if (typeof value.call !== "function") return false;
320
- if (typeof value.apply !== "function") return false;
321
- } catch (error) {
322
- return false;
323
- }
324
-
325
- return !is$2(value);
326
- };
327
-
328
- var classRe = /^\s*class[\s{/}]/, functionToString = Function.prototype.toString;
329
-
330
- var is$4 = function (value) {
331
- if (!is$3(value)) return false;
332
- if (classRe.test(functionToString.call(value))) return false;
333
- return true;
334
- };
335
-
336
- var str = "razdwatrzy";
337
-
338
- var isImplemented$3 = function () {
339
- if (typeof str.contains !== "function") return false;
340
- return str.contains("dwa") === true && str.contains("foo") === false;
341
- };
342
-
343
- var indexOf = String.prototype.indexOf;
344
-
345
- var shim$3 = function (searchString/*, position*/) {
346
- return indexOf.call(this, searchString, arguments[1]) > -1;
347
- };
348
-
349
- var contains = isImplemented$3() ? String.prototype.contains : shim$3;
350
-
351
- var d_1 = createCommonjsModule(function (module) {
352
-
353
-
354
-
355
- var d = (module.exports = function (dscr, value/*, options*/) {
356
- var c, e, w, options, desc;
357
- if (arguments.length < 2 || typeof dscr !== "string") {
358
- options = value;
359
- value = dscr;
360
- dscr = null;
361
- } else {
362
- options = arguments[2];
363
- }
364
- if (is(dscr)) {
365
- c = contains.call(dscr, "c");
366
- e = contains.call(dscr, "e");
367
- w = contains.call(dscr, "w");
368
- } else {
369
- c = w = true;
370
- e = false;
371
- }
372
-
373
- desc = { value: value, configurable: c, enumerable: e, writable: w };
374
- return !options ? desc : assign(normalizeOptions(options), desc);
375
- });
376
-
377
- d.gs = function (dscr, get, set/*, options*/) {
378
- var c, e, options, desc;
379
- if (typeof dscr !== "string") {
380
- options = set;
381
- set = get;
382
- get = dscr;
383
- dscr = null;
384
- } else {
385
- options = arguments[3];
386
- }
387
- if (!is(get)) {
388
- get = undefined;
389
- } else if (!is$4(get)) {
390
- options = get;
391
- get = set = undefined;
392
- } else if (!is(set)) {
393
- set = undefined;
394
- } else if (!is$4(set)) {
395
- options = set;
396
- set = undefined;
397
- }
398
- if (is(dscr)) {
399
- c = contains.call(dscr, "c");
400
- e = contains.call(dscr, "e");
401
- } else {
402
- c = true;
403
- e = false;
404
- }
405
-
406
- desc = { get: get, set: set, configurable: c, enumerable: e };
407
- return !options ? desc : assign(normalizeOptions(options), desc);
408
- };
409
- });
410
-
411
- var eventEmitter = createCommonjsModule(function (module, exports) {
412
-
413
- var apply = Function.prototype.apply, call = Function.prototype.call
414
- , create = Object.create, defineProperty = Object.defineProperty
415
- , defineProperties = Object.defineProperties
416
- , hasOwnProperty = Object.prototype.hasOwnProperty
417
- , descriptor = { configurable: true, enumerable: false, writable: true }
418
-
419
- , on, once, off, emit, methods, descriptors, base;
420
-
421
- on = function (type, listener) {
422
- var data;
423
-
424
- validCallable(listener);
425
-
426
- if (!hasOwnProperty.call(this, '__ee__')) {
427
- data = descriptor.value = create(null);
428
- defineProperty(this, '__ee__', descriptor);
429
- descriptor.value = null;
430
- } else {
431
- data = this.__ee__;
432
- }
433
- if (!data[type]) data[type] = listener;
434
- else if (typeof data[type] === 'object') data[type].push(listener);
435
- else data[type] = [data[type], listener];
436
-
437
- return this;
438
- };
439
-
440
- once = function (type, listener) {
441
- var once, self;
442
-
443
- validCallable(listener);
444
- self = this;
445
- on.call(this, type, once = function () {
446
- off.call(self, type, once);
447
- apply.call(listener, this, arguments);
448
- });
449
-
450
- once.__eeOnceListener__ = listener;
451
- return this;
452
- };
453
-
454
- off = function (type, listener) {
455
- var data, listeners, candidate, i;
456
-
457
- validCallable(listener);
458
-
459
- if (!hasOwnProperty.call(this, '__ee__')) return this;
460
- data = this.__ee__;
461
- if (!data[type]) return this;
462
- listeners = data[type];
463
-
464
- if (typeof listeners === 'object') {
465
- for (i = 0; (candidate = listeners[i]); ++i) {
466
- if ((candidate === listener) ||
467
- (candidate.__eeOnceListener__ === listener)) {
468
- if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
469
- else listeners.splice(i, 1);
470
- }
471
- }
472
- } else {
473
- if ((listeners === listener) ||
474
- (listeners.__eeOnceListener__ === listener)) {
475
- delete data[type];
476
- }
477
- }
478
-
479
- return this;
480
- };
481
-
482
- emit = function (type) {
483
- var i, l, listener, listeners, args;
484
-
485
- if (!hasOwnProperty.call(this, '__ee__')) return;
486
- listeners = this.__ee__[type];
487
- if (!listeners) return;
488
-
489
- if (typeof listeners === 'object') {
490
- l = arguments.length;
491
- args = new Array(l - 1);
492
- for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
493
-
494
- listeners = listeners.slice();
495
- for (i = 0; (listener = listeners[i]); ++i) {
496
- apply.call(listener, this, args);
497
- }
498
- } else {
499
- switch (arguments.length) {
500
- case 1:
501
- call.call(listeners, this);
502
- break;
503
- case 2:
504
- call.call(listeners, this, arguments[1]);
505
- break;
506
- case 3:
507
- call.call(listeners, this, arguments[1], arguments[2]);
508
- break;
509
- default:
510
- l = arguments.length;
511
- args = new Array(l - 1);
512
- for (i = 1; i < l; ++i) {
513
- args[i - 1] = arguments[i];
514
- }
515
- apply.call(listeners, this, args);
516
- }
517
- }
518
- };
519
-
520
- methods = {
521
- on: on,
522
- once: once,
523
- off: off,
524
- emit: emit
525
- };
526
-
527
- descriptors = {
528
- on: d_1(on),
529
- once: d_1(once),
530
- off: d_1(off),
531
- emit: d_1(emit)
532
- };
533
-
534
- base = defineProperties({}, descriptors);
535
-
536
- module.exports = exports = function (o) {
537
- return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
538
- };
539
- exports.methods = methods;
540
- });
541
- var eventEmitter_1 = eventEmitter.methods;
542
-
543
- var isImplemented$4 = function () {
544
- var from = Array.from, arr, result;
545
- if (typeof from !== "function") return false;
546
- arr = ["raz", "dwa"];
547
- result = from(arr);
548
- return Boolean(result && result !== arr && result[1] === "dwa");
549
- };
550
-
551
- var isImplemented$5 = function () {
552
- if (typeof globalThis !== "object") return false;
553
- if (!globalThis) return false;
554
- return globalThis.Array === Array;
555
- };
556
-
557
- var naiveFallback = function () {
558
- if (typeof self === "object" && self) return self;
559
- if (typeof window === "object" && window) return window;
560
- throw new Error("Unable to resolve global `this`");
561
- };
562
-
563
- var implementation = (function () {
564
- if (this) return this;
565
-
566
- // Unexpected strict mode (may happen if e.g. bundled into ESM module)
567
-
568
- // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
569
- // In all ES5+ engines global object inherits from Object.prototype
570
- // (if you approached one that doesn't please report)
571
- try {
572
- Object.defineProperty(Object.prototype, "__global__", {
573
- get: function () { return this; },
574
- configurable: true
575
- });
576
- } catch (error) {
577
- // Unfortunate case of Object.prototype being sealed (via preventExtensions, seal or freeze)
578
- return naiveFallback();
579
- }
580
- try {
581
- // Safari case (window.__global__ is resolved with global context, but __global__ does not)
582
- if (!__global__) return naiveFallback();
583
- return __global__;
584
- } finally {
585
- delete Object.prototype.__global__;
586
- }
587
- })();
588
-
589
- var globalThis_1 = isImplemented$5() ? globalThis : implementation;
590
-
591
- var validTypes = { object: true, symbol: true };
592
-
593
- var isImplemented$6 = function () {
594
- var Symbol = globalThis_1.Symbol;
595
- var symbol;
596
- if (typeof Symbol !== "function") return false;
597
- symbol = Symbol("test symbol");
598
- try { String(symbol); }
599
- catch (e) { return false; }
600
-
601
- // Return 'true' also for polyfills
602
- if (!validTypes[typeof Symbol.iterator]) return false;
603
- if (!validTypes[typeof Symbol.toPrimitive]) return false;
604
- if (!validTypes[typeof Symbol.toStringTag]) return false;
605
-
606
- return true;
607
- };
608
-
609
- var isSymbol = function (value) {
610
- if (!value) return false;
611
- if (typeof value === "symbol") return true;
612
- if (!value.constructor) return false;
613
- if (value.constructor.name !== "Symbol") return false;
614
- return value[value.constructor.toStringTag] === "Symbol";
615
- };
616
-
617
- var validateSymbol = function (value) {
618
- if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
619
- return value;
620
- };
621
-
622
- var create$1 = Object.create, defineProperty$1 = Object.defineProperty, objPrototype = Object.prototype;
623
-
624
- var created = create$1(null);
625
- var generateName = function (desc) {
626
- var postfix = 0, name, ie11BugWorkaround;
627
- while (created[desc + (postfix || "")]) ++postfix;
628
- desc += postfix || "";
629
- created[desc] = true;
630
- name = "@@" + desc;
631
- defineProperty$1(
632
- objPrototype,
633
- name,
634
- d_1.gs(null, function (value) {
635
- // For IE11 issue see:
636
- // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
637
- // ie11-broken-getters-on-dom-objects
638
- // https://github.com/medikoo/es6-symbol/issues/12
639
- if (ie11BugWorkaround) return;
640
- ie11BugWorkaround = true;
641
- defineProperty$1(this, name, d_1(value));
642
- ie11BugWorkaround = false;
643
- })
644
- );
645
- return name;
646
- };
647
-
648
- var NativeSymbol = globalThis_1.Symbol;
649
-
650
- var standardSymbols = function (SymbolPolyfill) {
651
- return Object.defineProperties(SymbolPolyfill, {
652
- // To ensure proper interoperability with other native functions (e.g. Array.from)
653
- // fallback to eventual native implementation of given symbol
654
- hasInstance: d_1(
655
- "", (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill("hasInstance")
656
- ),
657
- isConcatSpreadable: d_1(
658
- "",
659
- (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
660
- SymbolPolyfill("isConcatSpreadable")
661
- ),
662
- iterator: d_1("", (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill("iterator")),
663
- match: d_1("", (NativeSymbol && NativeSymbol.match) || SymbolPolyfill("match")),
664
- replace: d_1("", (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill("replace")),
665
- search: d_1("", (NativeSymbol && NativeSymbol.search) || SymbolPolyfill("search")),
666
- species: d_1("", (NativeSymbol && NativeSymbol.species) || SymbolPolyfill("species")),
667
- split: d_1("", (NativeSymbol && NativeSymbol.split) || SymbolPolyfill("split")),
668
- toPrimitive: d_1(
669
- "", (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill("toPrimitive")
670
- ),
671
- toStringTag: d_1(
672
- "", (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill("toStringTag")
673
- ),
674
- unscopables: d_1(
675
- "", (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill("unscopables")
676
- )
677
- });
678
- };
679
-
680
- var registry = Object.create(null);
681
-
682
- var symbolRegistry = function (SymbolPolyfill) {
683
- return Object.defineProperties(SymbolPolyfill, {
684
- for: d_1(function (key) {
685
- if (registry[key]) return registry[key];
686
- return (registry[key] = SymbolPolyfill(String(key)));
687
- }),
688
- keyFor: d_1(function (symbol) {
689
- var key;
690
- validateSymbol(symbol);
691
- for (key in registry) {
692
- if (registry[key] === symbol) return key;
693
- }
694
- return undefined;
695
- })
696
- });
697
- };
698
-
699
- var NativeSymbol$1 = globalThis_1.Symbol;
700
-
701
- var create$2 = Object.create
702
- , defineProperties = Object.defineProperties
703
- , defineProperty$2 = Object.defineProperty;
704
-
705
- var SymbolPolyfill, HiddenSymbol, isNativeSafe;
706
-
707
- if (typeof NativeSymbol$1 === "function") {
708
- try {
709
- String(NativeSymbol$1());
710
- isNativeSafe = true;
711
- } catch (ignore) {}
712
- } else {
713
- NativeSymbol$1 = null;
714
- }
715
-
716
- // Internal constructor (not one exposed) for creating Symbol instances.
717
- // This one is used to ensure that `someSymbol instanceof Symbol` always return false
718
- HiddenSymbol = function Symbol(description) {
719
- if (this instanceof HiddenSymbol) throw new TypeError("Symbol is not a constructor");
720
- return SymbolPolyfill(description);
721
- };
722
-
723
- // Exposed `Symbol` constructor
724
- // (returns instances of HiddenSymbol)
725
- var polyfill = SymbolPolyfill = function Symbol(description) {
726
- var symbol;
727
- if (this instanceof Symbol) throw new TypeError("Symbol is not a constructor");
728
- if (isNativeSafe) return NativeSymbol$1(description);
729
- symbol = create$2(HiddenSymbol.prototype);
730
- description = description === undefined ? "" : String(description);
731
- return defineProperties(symbol, {
732
- __description__: d_1("", description),
733
- __name__: d_1("", generateName(description))
734
- });
735
- };
736
-
737
- standardSymbols(SymbolPolyfill);
738
- symbolRegistry(SymbolPolyfill);
739
-
740
- // Internal tweaks for real symbol producer
741
- defineProperties(HiddenSymbol.prototype, {
742
- constructor: d_1(SymbolPolyfill),
743
- toString: d_1("", function () { return this.__name__; })
744
- });
745
-
746
- // Proper implementation of methods exposed on Symbol.prototype
747
- // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
748
- defineProperties(SymbolPolyfill.prototype, {
749
- toString: d_1(function () { return "Symbol (" + validateSymbol(this).__description__ + ")"; }),
750
- valueOf: d_1(function () { return validateSymbol(this); })
751
- });
752
- defineProperty$2(
753
- SymbolPolyfill.prototype,
754
- SymbolPolyfill.toPrimitive,
755
- d_1("", function () {
756
- var symbol = validateSymbol(this);
757
- if (typeof symbol === "symbol") return symbol;
758
- return symbol.toString();
759
- })
760
- );
761
- defineProperty$2(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d_1("c", "Symbol"));
762
-
763
- // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
764
- defineProperty$2(
765
- HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
766
- d_1("c", SymbolPolyfill.prototype[SymbolPolyfill.toStringTag])
767
- );
768
-
769
- // Note: It's important to define `toPrimitive` as last one, as some implementations
770
- // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
771
- // And that may invoke error in definition flow:
772
- // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
773
- defineProperty$2(
774
- HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
775
- d_1("c", SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive])
776
- );
777
-
778
- var es6Symbol = isImplemented$6()
779
- ? globalThis_1.Symbol
780
- : polyfill;
781
-
782
- var objToString = Object.prototype.toString
783
- , id = objToString.call((function () { return arguments; })());
784
-
785
- var isArguments = function (value) { return objToString.call(value) === id; };
786
-
787
- var objToString$1 = Object.prototype.toString
788
- , isFunctionStringTag = RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);
789
-
790
- var isFunction = function (value) {
791
- return typeof value === "function" && isFunctionStringTag(objToString$1.call(value));
792
- };
793
-
794
- var objToString$2 = Object.prototype.toString, id$1 = objToString$2.call("");
795
-
796
- var isString = function (value) {
797
- return (
798
- typeof value === "string" ||
799
- (value &&
800
- typeof value === "object" &&
801
- (value instanceof String || objToString$2.call(value) === id$1)) ||
802
- false
803
- );
804
- };
805
-
806
- var iteratorSymbol = es6Symbol.iterator
807
- , isArray = Array.isArray
808
- , call$1 = Function.prototype.call
809
- , desc = { configurable: true, enumerable: true, writable: true, value: null }
810
- , defineProperty$3 = Object.defineProperty;
811
-
812
- // eslint-disable-next-line complexity, max-lines-per-function
813
- var shim$4 = function (arrayLike/*, mapFn, thisArg*/) {
814
- var mapFn = arguments[1]
815
- , thisArg = arguments[2]
816
- , Context
817
- , i
818
- , j
819
- , arr
820
- , length
821
- , code
822
- , iterator
823
- , result
824
- , getIterator
825
- , value;
826
-
827
- arrayLike = Object(validValue(arrayLike));
828
-
829
- if (isValue(mapFn)) validCallable(mapFn);
830
- if (!this || this === Array || !isFunction(this)) {
831
- // Result: Plain array
832
- if (!mapFn) {
833
- if (isArguments(arrayLike)) {
834
- // Source: Arguments
835
- length = arrayLike.length;
836
- if (length !== 1) return Array.apply(null, arrayLike);
837
- arr = new Array(1);
838
- arr[0] = arrayLike[0];
839
- return arr;
840
- }
841
- if (isArray(arrayLike)) {
842
- // Source: Array
843
- arr = new Array((length = arrayLike.length));
844
- for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
845
- return arr;
846
- }
847
- }
848
- arr = [];
849
- } else {
850
- // Result: Non plain array
851
- Context = this;
852
- }
853
-
854
- if (!isArray(arrayLike)) {
855
- if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
856
- // Source: Iterator
857
- iterator = validCallable(getIterator).call(arrayLike);
858
- if (Context) arr = new Context();
859
- result = iterator.next();
860
- i = 0;
861
- while (!result.done) {
862
- value = mapFn ? call$1.call(mapFn, thisArg, result.value, i) : result.value;
863
- if (Context) {
864
- desc.value = value;
865
- defineProperty$3(arr, i, desc);
866
- } else {
867
- arr[i] = value;
868
- }
869
- result = iterator.next();
870
- ++i;
871
- }
872
- length = i;
873
- } else if (isString(arrayLike)) {
874
- // Source: String
875
- length = arrayLike.length;
876
- if (Context) arr = new Context();
877
- for (i = 0, j = 0; i < length; ++i) {
878
- value = arrayLike[i];
879
- if (i + 1 < length) {
880
- code = value.charCodeAt(0);
881
- // eslint-disable-next-line max-depth
882
- if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
883
- }
884
- value = mapFn ? call$1.call(mapFn, thisArg, value, j) : value;
885
- if (Context) {
886
- desc.value = value;
887
- defineProperty$3(arr, j, desc);
888
- } else {
889
- arr[j] = value;
890
- }
891
- ++j;
892
- }
893
- length = j;
894
- }
895
- }
896
- if (length === undefined) {
897
- // Source: array or array-like
898
- length = toPosInteger(arrayLike.length);
899
- if (Context) arr = new Context(length);
900
- for (i = 0; i < length; ++i) {
901
- value = mapFn ? call$1.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
902
- if (Context) {
903
- desc.value = value;
904
- defineProperty$3(arr, i, desc);
905
- } else {
906
- arr[i] = value;
907
- }
908
- }
909
- }
910
- if (Context) {
911
- desc.value = null;
912
- arr.length = length;
913
- }
914
- return arr;
915
- };
916
-
917
- var from_1 = isImplemented$4() ? Array.from : shim$4;
918
-
919
- var isArray$1 = Array.isArray;
920
-
921
- var toArray = function (arrayLike) { return isArray$1(arrayLike) ? arrayLike : from_1(arrayLike); };
922
-
923
- var slice = Array.prototype.slice, resolveArgs;
924
-
925
- resolveArgs = function (args) {
926
- return this.map(function (resolve, i) {
927
- return resolve ? resolve(args[i]) : args[i];
928
- }).concat(slice.call(args, this.length));
929
- };
930
-
931
- var resolveResolve = function (resolvers) {
932
- resolvers = toArray(resolvers);
933
- resolvers.forEach(function (resolve) {
934
- if (isValue(resolve)) validCallable(resolve);
935
- });
936
- return resolveArgs.bind(resolvers);
937
- };
938
-
939
- var resolveNormalize = function (userNormalizer) {
940
- var normalizer;
941
- if (typeof userNormalizer === "function") return { set: userNormalizer, get: userNormalizer };
942
- normalizer = { get: validCallable(userNormalizer.get) };
943
- if (userNormalizer.set !== undefined) {
944
- normalizer.set = validCallable(userNormalizer.set);
945
- if (userNormalizer.delete) normalizer.delete = validCallable(userNormalizer.delete);
946
- if (userNormalizer.clear) normalizer.clear = validCallable(userNormalizer.clear);
947
- return normalizer;
948
- }
949
- normalizer.set = normalizer.get;
950
- return normalizer;
951
- };
952
-
953
- var ee = eventEmitter.methods;
954
-
955
- var apply = Function.prototype.apply
956
- , call$2 = Function.prototype.call
957
- , create$3 = Object.create
958
- , defineProperties$1 = Object.defineProperties
959
- , on = ee.on
960
- , emit = ee.emit;
961
-
962
- var configureMap = function (original, length, options) {
963
- var cache = create$3(null)
964
- , conf
965
- , memLength
966
- , get
967
- , set
968
- , del
969
- , clear
970
- , extDel
971
- , extGet
972
- , extHas
973
- , normalizer
974
- , getListeners
975
- , setListeners
976
- , deleteListeners
977
- , memoized
978
- , resolve;
979
- if (length !== false) memLength = length;
980
- else if (isNaN(original.length)) memLength = 1;
981
- else memLength = original.length;
982
-
983
- if (options.normalizer) {
984
- normalizer = resolveNormalize(options.normalizer);
985
- get = normalizer.get;
986
- set = normalizer.set;
987
- del = normalizer.delete;
988
- clear = normalizer.clear;
989
- }
990
- if (options.resolvers != null) resolve = resolveResolve(options.resolvers);
991
-
992
- if (get) {
993
- memoized = _defineLength(function (arg) {
994
- var id, result, args = arguments;
995
- if (resolve) args = resolve(args);
996
- id = get(args);
997
- if (id !== null) {
998
- if (hasOwnProperty.call(cache, id)) {
999
- if (getListeners) conf.emit("get", id, args, this);
1000
- return cache[id];
1001
- }
1002
- }
1003
- if (args.length === 1) result = call$2.call(original, this, args[0]);
1004
- else result = apply.call(original, this, args);
1005
- if (id === null) {
1006
- id = get(args);
1007
- if (id !== null) throw custom("Circular invocation", "CIRCULAR_INVOCATION");
1008
- id = set(args);
1009
- } else if (hasOwnProperty.call(cache, id)) {
1010
- throw custom("Circular invocation", "CIRCULAR_INVOCATION");
1011
- }
1012
- cache[id] = result;
1013
- if (setListeners) conf.emit("set", id, null, result);
1014
- return result;
1015
- }, memLength);
1016
- } else if (length === 0) {
1017
- memoized = function () {
1018
- var result;
1019
- if (hasOwnProperty.call(cache, "data")) {
1020
- if (getListeners) conf.emit("get", "data", arguments, this);
1021
- return cache.data;
1022
- }
1023
- if (arguments.length) result = apply.call(original, this, arguments);
1024
- else result = call$2.call(original, this);
1025
- if (hasOwnProperty.call(cache, "data")) {
1026
- throw custom("Circular invocation", "CIRCULAR_INVOCATION");
1027
- }
1028
- cache.data = result;
1029
- if (setListeners) conf.emit("set", "data", null, result);
1030
- return result;
1031
- };
1032
- } else {
1033
- memoized = function (arg) {
1034
- var result, args = arguments, id;
1035
- if (resolve) args = resolve(arguments);
1036
- id = String(args[0]);
1037
- if (hasOwnProperty.call(cache, id)) {
1038
- if (getListeners) conf.emit("get", id, args, this);
1039
- return cache[id];
1040
- }
1041
- if (args.length === 1) result = call$2.call(original, this, args[0]);
1042
- else result = apply.call(original, this, args);
1043
- if (hasOwnProperty.call(cache, id)) {
1044
- throw custom("Circular invocation", "CIRCULAR_INVOCATION");
1045
- }
1046
- cache[id] = result;
1047
- if (setListeners) conf.emit("set", id, null, result);
1048
- return result;
1049
- };
1050
- }
1051
- conf = {
1052
- original: original,
1053
- memoized: memoized,
1054
- profileName: options.profileName,
1055
- get: function (args) {
1056
- if (resolve) args = resolve(args);
1057
- if (get) return get(args);
1058
- return String(args[0]);
1059
- },
1060
- has: function (id) { return hasOwnProperty.call(cache, id); },
1061
- delete: function (id) {
1062
- var result;
1063
- if (!hasOwnProperty.call(cache, id)) return;
1064
- if (del) del(id);
1065
- result = cache[id];
1066
- delete cache[id];
1067
- if (deleteListeners) conf.emit("delete", id, result);
1068
- },
1069
- clear: function () {
1070
- var oldCache = cache;
1071
- if (clear) clear();
1072
- cache = create$3(null);
1073
- conf.emit("clear", oldCache);
1074
- },
1075
- on: function (type, listener) {
1076
- if (type === "get") getListeners = true;
1077
- else if (type === "set") setListeners = true;
1078
- else if (type === "delete") deleteListeners = true;
1079
- return on.call(this, type, listener);
1080
- },
1081
- emit: emit,
1082
- updateEnv: function () { original = conf.original; }
1083
- };
1084
- if (get) {
1085
- extDel = _defineLength(function (arg) {
1086
- var id, args = arguments;
1087
- if (resolve) args = resolve(args);
1088
- id = get(args);
1089
- if (id === null) return;
1090
- conf.delete(id);
1091
- }, memLength);
1092
- } else if (length === 0) {
1093
- extDel = function () { return conf.delete("data"); };
1094
- } else {
1095
- extDel = function (arg) {
1096
- if (resolve) arg = resolve(arguments)[0];
1097
- return conf.delete(arg);
1098
- };
1099
- }
1100
- extGet = _defineLength(function () {
1101
- var id, args = arguments;
1102
- if (length === 0) return cache.data;
1103
- if (resolve) args = resolve(args);
1104
- if (get) id = get(args);
1105
- else id = String(args[0]);
1106
- return cache[id];
1107
- });
1108
- extHas = _defineLength(function () {
1109
- var id, args = arguments;
1110
- if (length === 0) return conf.has("data");
1111
- if (resolve) args = resolve(args);
1112
- if (get) id = get(args);
1113
- else id = String(args[0]);
1114
- if (id === null) return false;
1115
- return conf.has(id);
1116
- });
1117
- defineProperties$1(memoized, {
1118
- __memoized__: d_1(true),
1119
- delete: d_1(extDel),
1120
- clear: d_1(conf.clear),
1121
- _get: d_1(extGet),
1122
- _has: d_1(extHas)
1123
- });
1124
- return conf;
1125
- };
1126
-
1127
- var plain = function self(fn /*, options */) {
1128
- var options, length, conf;
1129
-
1130
- validCallable(fn);
1131
- options = Object(arguments[1]);
1132
-
1133
- if (options.async && options.promise) {
1134
- throw new Error("Options 'async' and 'promise' cannot be used together");
1135
- }
1136
-
1137
- // Do not memoize already memoized function
1138
- if (hasOwnProperty.call(fn, "__memoized__") && !options.force) return fn;
1139
-
1140
- // Resolve length;
1141
- length = resolveLength(options.length, fn.length, options.async && registeredExtensions.async);
1142
-
1143
- // Configure cache map
1144
- conf = configureMap(fn, length, options);
1145
-
1146
- // Bind eventual extensions
1147
- forEach$1(registeredExtensions, function (extFn, name) {
1148
- if (options[name]) extFn(options[name], conf, options);
1149
- });
1150
-
1151
- if (self.__profiler__) self.__profiler__(conf);
1152
-
1153
- conf.updateEnv();
1154
- return conf.memoized;
1155
- };
1156
-
1157
- var primitive = function (args) {
1158
- var id, i, length = args.length;
1159
- if (!length) return "\u0002";
1160
- id = String(args[i = 0]);
1161
- while (--length) id += "\u0001" + args[++i];
1162
- return id;
1163
- };
1164
-
1165
- var getPrimitiveFixed = function (length) {
1166
- if (!length) {
1167
- return function () {
1168
- return "";
1169
- };
1170
- }
1171
- return function (args) {
1172
- var id = String(args[0]), i = 0, currentLength = length;
1173
- while (--currentLength) {
1174
- id += "\u0001" + args[++i];
1175
- }
1176
- return id;
1177
- };
1178
- };
1179
-
1180
- var isImplemented$7 = function () {
1181
- var numberIsNaN = Number.isNaN;
1182
- if (typeof numberIsNaN !== "function") return false;
1183
- return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
1184
- };
1185
-
1186
- var shim$5 = function (value) {
1187
- // eslint-disable-next-line no-self-compare
1188
- return value !== value;
1189
- };
1190
-
1191
- var isNan = isImplemented$7() ? Number.isNaN : shim$5;
1192
-
1193
- var indexOf$1 = Array.prototype.indexOf
1194
- , objHasOwnProperty = Object.prototype.hasOwnProperty
1195
- , abs$1 = Math.abs
1196
- , floor$1 = Math.floor;
1197
-
1198
- var eIndexOf = function (searchElement/*, fromIndex*/) {
1199
- var i, length, fromIndex, val;
1200
- if (!isNan(searchElement)) return indexOf$1.apply(this, arguments);
1201
-
1202
- length = toPosInteger(validValue(this).length);
1203
- fromIndex = arguments[1];
1204
- if (isNaN(fromIndex)) fromIndex = 0;
1205
- else if (fromIndex >= 0) fromIndex = floor$1(fromIndex);
1206
- else fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex));
1207
-
1208
- for (i = fromIndex; i < length; ++i) {
1209
- if (objHasOwnProperty.call(this, i)) {
1210
- val = this[i];
1211
- if (isNan(val)) return i; // Jslint: ignore
1212
- }
1213
- }
1214
- return -1;
1215
- };
1216
-
1217
- var create$4 = Object.create;
1218
-
1219
- var get = function () {
1220
- var lastId = 0, map = [], cache = create$4(null);
1221
- return {
1222
- get: function (args) {
1223
- var index = 0, set = map, i, length = args.length;
1224
- if (length === 0) return set[length] || null;
1225
- if ((set = set[length])) {
1226
- while (index < length - 1) {
1227
- i = eIndexOf.call(set[0], args[index]);
1228
- if (i === -1) return null;
1229
- set = set[1][i];
1230
- ++index;
1231
- }
1232
- i = eIndexOf.call(set[0], args[index]);
1233
- if (i === -1) return null;
1234
- return set[1][i] || null;
1235
- }
1236
- return null;
1237
- },
1238
- set: function (args) {
1239
- var index = 0, set = map, i, length = args.length;
1240
- if (length === 0) {
1241
- set[length] = ++lastId;
1242
- } else {
1243
- if (!set[length]) {
1244
- set[length] = [[], []];
1245
- }
1246
- set = set[length];
1247
- while (index < length - 1) {
1248
- i = eIndexOf.call(set[0], args[index]);
1249
- if (i === -1) {
1250
- i = set[0].push(args[index]) - 1;
1251
- set[1].push([[], []]);
1252
- }
1253
- set = set[1][i];
1254
- ++index;
1255
- }
1256
- i = eIndexOf.call(set[0], args[index]);
1257
- if (i === -1) {
1258
- i = set[0].push(args[index]) - 1;
1259
- }
1260
- set[1][i] = ++lastId;
1261
- }
1262
- cache[lastId] = args;
1263
- return lastId;
1264
- },
1265
- delete: function (id) {
1266
- var index = 0, set = map, i, args = cache[id], length = args.length, path = [];
1267
- if (length === 0) {
1268
- delete set[length];
1269
- } else if ((set = set[length])) {
1270
- while (index < length - 1) {
1271
- i = eIndexOf.call(set[0], args[index]);
1272
- if (i === -1) {
1273
- return;
1274
- }
1275
- path.push(set, i);
1276
- set = set[1][i];
1277
- ++index;
1278
- }
1279
- i = eIndexOf.call(set[0], args[index]);
1280
- if (i === -1) {
1281
- return;
1282
- }
1283
- id = set[1][i];
1284
- set[0].splice(i, 1);
1285
- set[1].splice(i, 1);
1286
- while (!set[0].length && path.length) {
1287
- i = path.pop();
1288
- set = path.pop();
1289
- set[0].splice(i, 1);
1290
- set[1].splice(i, 1);
1291
- }
1292
- }
1293
- delete cache[id];
1294
- },
1295
- clear: function () {
1296
- map = [];
1297
- cache = create$4(null);
1298
- }
1299
- };
1300
- };
1301
-
1302
- var get1 = function () {
1303
- var lastId = 0, argsMap = [], cache = [];
1304
- return {
1305
- get: function (args) {
1306
- var index = eIndexOf.call(argsMap, args[0]);
1307
- return index === -1 ? null : cache[index];
1308
- },
1309
- set: function (args) {
1310
- argsMap.push(args[0]);
1311
- cache.push(++lastId);
1312
- return lastId;
1313
- },
1314
- delete: function (id) {
1315
- var index = eIndexOf.call(cache, id);
1316
- if (index !== -1) {
1317
- argsMap.splice(index, 1);
1318
- cache.splice(index, 1);
1319
- }
1320
- },
1321
- clear: function () {
1322
- argsMap = [];
1323
- cache = [];
1324
- }
1325
- };
1326
- };
1327
-
1328
- var create$5 = Object.create;
1329
-
1330
- var getFixed = function (length) {
1331
- var lastId = 0, map = [[], []], cache = create$5(null);
1332
- return {
1333
- get: function (args) {
1334
- var index = 0, set = map, i;
1335
- while (index < length - 1) {
1336
- i = eIndexOf.call(set[0], args[index]);
1337
- if (i === -1) return null;
1338
- set = set[1][i];
1339
- ++index;
1340
- }
1341
- i = eIndexOf.call(set[0], args[index]);
1342
- if (i === -1) return null;
1343
- return set[1][i] || null;
1344
- },
1345
- set: function (args) {
1346
- var index = 0, set = map, i;
1347
- while (index < length - 1) {
1348
- i = eIndexOf.call(set[0], args[index]);
1349
- if (i === -1) {
1350
- i = set[0].push(args[index]) - 1;
1351
- set[1].push([[], []]);
1352
- }
1353
- set = set[1][i];
1354
- ++index;
1355
- }
1356
- i = eIndexOf.call(set[0], args[index]);
1357
- if (i === -1) {
1358
- i = set[0].push(args[index]) - 1;
1359
- }
1360
- set[1][i] = ++lastId;
1361
- cache[lastId] = args;
1362
- return lastId;
1363
- },
1364
- delete: function (id) {
1365
- var index = 0, set = map, i, path = [], args = cache[id];
1366
- while (index < length - 1) {
1367
- i = eIndexOf.call(set[0], args[index]);
1368
- if (i === -1) {
1369
- return;
1370
- }
1371
- path.push(set, i);
1372
- set = set[1][i];
1373
- ++index;
1374
- }
1375
- i = eIndexOf.call(set[0], args[index]);
1376
- if (i === -1) {
1377
- return;
1378
- }
1379
- id = set[1][i];
1380
- set[0].splice(i, 1);
1381
- set[1].splice(i, 1);
1382
- while (!set[0].length && path.length) {
1383
- i = path.pop();
1384
- set = path.pop();
1385
- set[0].splice(i, 1);
1386
- set[1].splice(i, 1);
1387
- }
1388
- delete cache[id];
1389
- },
1390
- clear: function () {
1391
- map = [[], []];
1392
- cache = create$5(null);
1393
- }
1394
- };
1395
- };
1396
-
1397
- var call$3 = Function.prototype.call;
1398
-
1399
- var map$1 = function (obj, cb/*, thisArg*/) {
1400
- var result = {}, thisArg = arguments[2];
1401
- validCallable(cb);
1402
- forEach$1(obj, function (value, key, targetObj, index) {
1403
- result[key] = call$3.call(cb, thisArg, value, key, targetObj, index);
1404
- });
1405
- return result;
1406
- };
1407
-
1408
- var ensureCallable = function (fn) {
1409
- if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
1410
- return fn;
1411
- };
1412
-
1413
- var byObserver = function (Observer) {
1414
- var node = document.createTextNode(''), queue, currentQueue, i = 0;
1415
- new Observer(function () {
1416
- var callback;
1417
- if (!queue) {
1418
- if (!currentQueue) return;
1419
- queue = currentQueue;
1420
- } else if (currentQueue) {
1421
- queue = currentQueue.concat(queue);
1422
- }
1423
- currentQueue = queue;
1424
- queue = null;
1425
- if (typeof currentQueue === 'function') {
1426
- callback = currentQueue;
1427
- currentQueue = null;
1428
- callback();
1429
- return;
1430
- }
1431
- node.data = (i = ++i % 2); // Invoke other batch, to handle leftover callbacks in case of crash
1432
- while (currentQueue) {
1433
- callback = currentQueue.shift();
1434
- if (!currentQueue.length) currentQueue = null;
1435
- callback();
1436
- }
1437
- }).observe(node, { characterData: true });
1438
- return function (fn) {
1439
- ensureCallable(fn);
1440
- if (queue) {
1441
- if (typeof queue === 'function') queue = [queue, fn];
1442
- else queue.push(fn);
1443
- return;
1444
- }
1445
- queue = fn;
1446
- node.data = (i = ++i % 2);
1447
- };
1448
- };
1449
-
1450
- var nextTick = (function () {
1451
- // Node.js
1452
- if ((typeof process === 'object') && process && (typeof process.nextTick === 'function')) {
1453
- return process.nextTick;
1454
- }
1455
-
1456
- // queueMicrotask
1457
- if (typeof queueMicrotask === "function") {
1458
- return function (cb) { queueMicrotask(ensureCallable(cb)); };
1459
- }
1460
-
1461
- // MutationObserver
1462
- if ((typeof document === 'object') && document) {
1463
- if (typeof MutationObserver === 'function') return byObserver(MutationObserver);
1464
- if (typeof WebKitMutationObserver === 'function') return byObserver(WebKitMutationObserver);
1465
- }
1466
-
1467
- // W3C Draft
1468
- // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html
1469
- if (typeof setImmediate === 'function') {
1470
- return function (cb) { setImmediate(ensureCallable(cb)); };
1471
- }
1472
-
1473
- // Wide available standard
1474
- if ((typeof setTimeout === 'function') || (typeof setTimeout === 'object')) {
1475
- return function (cb) { setTimeout(ensureCallable(cb), 0); };
1476
- }
1477
-
1478
- return null;
1479
- }());
1480
-
1481
- var slice$1 = Array.prototype.slice, apply$1 = Function.prototype.apply, create$6 = Object.create;
1482
-
1483
- registeredExtensions.async = function (tbi, conf) {
1484
- var waiting = create$6(null)
1485
- , cache = create$6(null)
1486
- , base = conf.memoized
1487
- , original = conf.original
1488
- , currentCallback
1489
- , currentContext
1490
- , currentArgs;
1491
-
1492
- // Initial
1493
- conf.memoized = _defineLength(function (arg) {
1494
- var args = arguments, last = args[args.length - 1];
1495
- if (typeof last === "function") {
1496
- currentCallback = last;
1497
- args = slice$1.call(args, 0, -1);
1498
- }
1499
- return base.apply(currentContext = this, currentArgs = args);
1500
- }, base);
1501
- try { mixin(conf.memoized, base); }
1502
- catch (ignore) {}
1503
-
1504
- // From cache (sync)
1505
- conf.on("get", function (id) {
1506
- var cb, context, args;
1507
- if (!currentCallback) return;
1508
-
1509
- // Unresolved
1510
- if (waiting[id]) {
1511
- if (typeof waiting[id] === "function") waiting[id] = [waiting[id], currentCallback];
1512
- else waiting[id].push(currentCallback);
1513
- currentCallback = null;
1514
- return;
1515
- }
1516
-
1517
- // Resolved, assure next tick invocation
1518
- cb = currentCallback;
1519
- context = currentContext;
1520
- args = currentArgs;
1521
- currentCallback = currentContext = currentArgs = null;
1522
- nextTick(function () {
1523
- var data;
1524
- if (hasOwnProperty.call(cache, id)) {
1525
- data = cache[id];
1526
- conf.emit("getasync", id, args, context);
1527
- apply$1.call(cb, data.context, data.args);
1528
- } else {
1529
- // Purged in a meantime, we shouldn't rely on cached value, recall
1530
- currentCallback = cb;
1531
- currentContext = context;
1532
- currentArgs = args;
1533
- base.apply(context, args);
1534
- }
1535
- });
1536
- });
1537
-
1538
- // Not from cache
1539
- conf.original = function () {
1540
- var args, cb, origCb, result;
1541
- if (!currentCallback) return apply$1.call(original, this, arguments);
1542
- args = from_1(arguments);
1543
- cb = function self(err) {
1544
- var cb, args, id = self.id;
1545
- if (id == null) {
1546
- // Shouldn't happen, means async callback was called sync way
1547
- nextTick(apply$1.bind(self, this, arguments));
1548
- return undefined;
1549
- }
1550
- delete self.id;
1551
- cb = waiting[id];
1552
- delete waiting[id];
1553
- if (!cb) {
1554
- // Already processed,
1555
- // outcome of race condition: asyncFn(1, cb), asyncFn.clear(), asyncFn(1, cb)
1556
- return undefined;
1557
- }
1558
- args = from_1(arguments);
1559
- if (conf.has(id)) {
1560
- if (err) {
1561
- conf.delete(id);
1562
- } else {
1563
- cache[id] = { context: this, args: args };
1564
- conf.emit("setasync", id, typeof cb === "function" ? 1 : cb.length);
1565
- }
1566
- }
1567
- if (typeof cb === "function") {
1568
- result = apply$1.call(cb, this, args);
1569
- } else {
1570
- cb.forEach(function (cb) { result = apply$1.call(cb, this, args); }, this);
1571
- }
1572
- return result;
1573
- };
1574
- origCb = currentCallback;
1575
- currentCallback = currentContext = currentArgs = null;
1576
- args.push(cb);
1577
- result = apply$1.call(original, this, args);
1578
- cb.cb = origCb;
1579
- currentCallback = cb;
1580
- return result;
1581
- };
1582
-
1583
- // After not from cache call
1584
- conf.on("set", function (id) {
1585
- if (!currentCallback) {
1586
- conf.delete(id);
1587
- return;
1588
- }
1589
- if (waiting[id]) {
1590
- // Race condition: asyncFn(1, cb), asyncFn.clear(), asyncFn(1, cb)
1591
- if (typeof waiting[id] === "function") waiting[id] = [waiting[id], currentCallback.cb];
1592
- else waiting[id].push(currentCallback.cb);
1593
- } else {
1594
- waiting[id] = currentCallback.cb;
1595
- }
1596
- delete currentCallback.cb;
1597
- currentCallback.id = id;
1598
- currentCallback = null;
1599
- });
1600
-
1601
- // On delete
1602
- conf.on("delete", function (id) {
1603
- var result;
1604
- // If false, we don't have value yet, so we assume that intention is not
1605
- // to memoize this call. After value is obtained we don't cache it but
1606
- // gracefully pass to callback
1607
- if (hasOwnProperty.call(waiting, id)) return;
1608
- if (!cache[id]) return;
1609
- result = cache[id];
1610
- delete cache[id];
1611
- conf.emit("deleteasync", id, slice$1.call(result.args, 1));
1612
- });
1613
-
1614
- // On clear
1615
- conf.on("clear", function () {
1616
- var oldCache = cache;
1617
- cache = create$6(null);
1618
- conf.emit(
1619
- "clearasync", map$1(oldCache, function (data) { return slice$1.call(data.args, 1); })
1620
- );
1621
- });
1622
- };
1623
-
1624
- var forEach$2 = Array.prototype.forEach, create$7 = Object.create;
1625
-
1626
- // eslint-disable-next-line no-unused-vars
1627
- var primitiveSet = function (arg/*, …args*/) {
1628
- var set = create$7(null);
1629
- forEach$2.call(arguments, function (name) { set[name] = true; });
1630
- return set;
1631
- };
1632
-
1633
- // Deprecated
1634
-
1635
- var isCallable = function (obj) { return typeof obj === "function"; };
1636
-
1637
- var validateStringifiable = function (stringifiable) {
1638
- try {
1639
- if (stringifiable && isCallable(stringifiable.toString)) return stringifiable.toString();
1640
- return String(stringifiable);
1641
- } catch (e) {
1642
- throw new TypeError("Passed argument cannot be stringifed");
1643
- }
1644
- };
1645
-
1646
- var validateStringifiableValue = function (value) { return validateStringifiable(validValue(value)); };
1647
-
1648
- var safeToString = function (value) {
1649
- try {
1650
- if (value && isCallable(value.toString)) return value.toString();
1651
- return String(value);
1652
- } catch (e) {
1653
- return "<Non-coercible to string value>";
1654
- }
1655
- };
1656
-
1657
- var reNewLine = /[\n\r\u2028\u2029]/g;
1658
-
1659
- var toShortStringRepresentation = function (value) {
1660
- var string = safeToString(value);
1661
- // Trim if too long
1662
- if (string.length > 100) string = string.slice(0, 99) + "…";
1663
- // Replace eventual new lines
1664
- string = string.replace(reNewLine, function (char) {
1665
- return JSON.stringify(char).slice(1, -1);
1666
- });
1667
- return string;
1668
- };
1669
-
1670
- var isPromise_1 = isPromise;
1671
- var default_1 = isPromise;
1672
-
1673
- function isPromise(obj) {
1674
- return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
1675
- }
1676
- isPromise_1.default = default_1;
1677
-
1678
- var create$8 = Object.create
1679
- , supportedModes = primitiveSet("then", "then:finally", "done", "done:finally");
1680
-
1681
- registeredExtensions.promise = function (mode, conf) {
1682
- var waiting = create$8(null), cache = create$8(null), promises = create$8(null);
1683
-
1684
- if (mode === true) {
1685
- mode = null;
1686
- } else {
1687
- mode = validateStringifiableValue(mode);
1688
- if (!supportedModes[mode]) {
1689
- throw new TypeError("'" + toShortStringRepresentation(mode) + "' is not valid promise mode");
1690
- }
1691
- }
1692
-
1693
- // After not from cache call
1694
- conf.on("set", function (id, ignore, promise) {
1695
- var isFailed = false;
1696
-
1697
- if (!isPromise_1(promise)) {
1698
- // Non promise result
1699
- cache[id] = promise;
1700
- conf.emit("setasync", id, 1);
1701
- return;
1702
- }
1703
- waiting[id] = 1;
1704
- promises[id] = promise;
1705
- var onSuccess = function (result) {
1706
- var count = waiting[id];
1707
- if (isFailed) {
1708
- throw new Error(
1709
- "Memoizee error: Detected unordered then|done & finally resolution, which " +
1710
- "in turn makes proper detection of success/failure impossible (when in " +
1711
- "'done:finally' mode)\n" +
1712
- "Consider to rely on 'then' or 'done' mode instead."
1713
- );
1714
- }
1715
- if (!count) return; // Deleted from cache before resolved
1716
- delete waiting[id];
1717
- cache[id] = result;
1718
- conf.emit("setasync", id, count);
1719
- };
1720
- var onFailure = function () {
1721
- isFailed = true;
1722
- if (!waiting[id]) return; // Deleted from cache (or succeed in case of finally)
1723
- delete waiting[id];
1724
- delete promises[id];
1725
- conf.delete(id);
1726
- };
1727
-
1728
- var resolvedMode = mode;
1729
- if (!resolvedMode) resolvedMode = "then";
1730
-
1731
- if (resolvedMode === "then") {
1732
- var nextTickFailure = function () { nextTick(onFailure); };
1733
- // Eventual finally needs to be attached to non rejected promise
1734
- // (so we not force propagation of unhandled rejection)
1735
- promise = promise.then(function (result) {
1736
- nextTick(onSuccess.bind(this, result));
1737
- }, nextTickFailure);
1738
- // If `finally` is a function we attach to it to remove cancelled promises.
1739
- if (typeof promise.finally === "function") {
1740
- promise.finally(nextTickFailure);
1741
- }
1742
- } else if (resolvedMode === "done") {
1743
- // Not recommended, as it may mute any eventual "Unhandled error" events
1744
- if (typeof promise.done !== "function") {
1745
- throw new Error(
1746
- "Memoizee error: Retrieved promise does not implement 'done' " +
1747
- "in 'done' mode"
1748
- );
1749
- }
1750
- promise.done(onSuccess, onFailure);
1751
- } else if (resolvedMode === "done:finally") {
1752
- // The only mode with no side effects assuming library does not throw unconditionally
1753
- // for rejected promises.
1754
- if (typeof promise.done !== "function") {
1755
- throw new Error(
1756
- "Memoizee error: Retrieved promise does not implement 'done' " +
1757
- "in 'done:finally' mode"
1758
- );
1759
- }
1760
- if (typeof promise.finally !== "function") {
1761
- throw new Error(
1762
- "Memoizee error: Retrieved promise does not implement 'finally' " +
1763
- "in 'done:finally' mode"
1764
- );
1765
- }
1766
- promise.done(onSuccess);
1767
- promise.finally(onFailure);
1768
- }
1769
- });
1770
-
1771
- // From cache (sync)
1772
- conf.on("get", function (id, args, context) {
1773
- var promise;
1774
- if (waiting[id]) {
1775
- ++waiting[id]; // Still waiting
1776
- return;
1777
- }
1778
- promise = promises[id];
1779
- var emit = function () { conf.emit("getasync", id, args, context); };
1780
- if (isPromise_1(promise)) {
1781
- if (typeof promise.done === "function") promise.done(emit);
1782
- else {
1783
- promise.then(function () { nextTick(emit); });
1784
- }
1785
- } else {
1786
- emit();
1787
- }
1788
- });
1789
-
1790
- // On delete
1791
- conf.on("delete", function (id) {
1792
- delete promises[id];
1793
- if (waiting[id]) {
1794
- delete waiting[id];
1795
- return; // Not yet resolved
1796
- }
1797
- if (!hasOwnProperty.call(cache, id)) return;
1798
- var result = cache[id];
1799
- delete cache[id];
1800
- conf.emit("deleteasync", id, [result]);
1801
- });
1802
-
1803
- // On clear
1804
- conf.on("clear", function () {
1805
- var oldCache = cache;
1806
- cache = create$8(null);
1807
- waiting = create$8(null);
1808
- promises = create$8(null);
1809
- conf.emit("clearasync", map$1(oldCache, function (data) { return [data]; }));
1810
- });
1811
- };
1812
-
1813
- var apply$2 = Function.prototype.apply;
1814
-
1815
- registeredExtensions.dispose = function (dispose, conf, options) {
1816
- var del;
1817
- validCallable(dispose);
1818
- if ((options.async && registeredExtensions.async) || (options.promise && registeredExtensions.promise)) {
1819
- conf.on("deleteasync", del = function (id, resultArray) {
1820
- apply$2.call(dispose, null, resultArray);
1821
- });
1822
- conf.on("clearasync", function (cache) {
1823
- forEach$1(cache, function (result, id) {
1824
- del(id, result);
1825
- });
1826
- });
1827
- return;
1828
- }
1829
- conf.on("delete", del = function (id, result) {
1830
- dispose(result);
1831
- });
1832
- conf.on("clear", function (cache) {
1833
- forEach$1(cache, function (result, id) {
1834
- del(id, result);
1835
- });
1836
- });
1837
- };
1838
-
1839
- var maxTimeout = 2147483647;
1840
-
1841
- var validTimeout = function (value) {
1842
- value = toPosInteger(value);
1843
- if (value > maxTimeout) throw new TypeError(value + " exceeds maximum possible timeout");
1844
- return value;
1845
- };
1846
-
1847
- var noop$1 = Function.prototype, max$2 = Math.max, min = Math.min, create$9 = Object.create;
1848
-
1849
- registeredExtensions.maxAge = function (maxAge, conf, options) {
1850
- var timeouts, postfix, preFetchAge, preFetchTimeouts;
1851
-
1852
- maxAge = validTimeout(maxAge);
1853
- if (!maxAge) return;
1854
-
1855
- timeouts = create$9(null);
1856
- postfix =
1857
- (options.async && registeredExtensions.async) || (options.promise && registeredExtensions.promise)
1858
- ? "async"
1859
- : "";
1860
- conf.on("set" + postfix, function (id) {
1861
- timeouts[id] = setTimeout(function () { conf.delete(id); }, maxAge);
1862
- if (typeof timeouts[id].unref === "function") timeouts[id].unref();
1863
- if (!preFetchTimeouts) return;
1864
- if (preFetchTimeouts[id]) {
1865
- if (preFetchTimeouts[id] !== "nextTick") clearTimeout(preFetchTimeouts[id]);
1866
- }
1867
- preFetchTimeouts[id] = setTimeout(function () {
1868
- delete preFetchTimeouts[id];
1869
- }, preFetchAge);
1870
- if (typeof preFetchTimeouts[id].unref === "function") preFetchTimeouts[id].unref();
1871
- });
1872
- conf.on("delete" + postfix, function (id) {
1873
- clearTimeout(timeouts[id]);
1874
- delete timeouts[id];
1875
- if (!preFetchTimeouts) return;
1876
- if (preFetchTimeouts[id] !== "nextTick") clearTimeout(preFetchTimeouts[id]);
1877
- delete preFetchTimeouts[id];
1878
- });
1879
-
1880
- if (options.preFetch) {
1881
- if (options.preFetch === true || isNaN(options.preFetch)) {
1882
- preFetchAge = 0.333;
1883
- } else {
1884
- preFetchAge = max$2(min(Number(options.preFetch), 1), 0);
1885
- }
1886
- if (preFetchAge) {
1887
- preFetchTimeouts = {};
1888
- preFetchAge = (1 - preFetchAge) * maxAge;
1889
- conf.on("get" + postfix, function (id, args, context) {
1890
- if (!preFetchTimeouts[id]) {
1891
- preFetchTimeouts[id] = "nextTick";
1892
- nextTick(function () {
1893
- var result;
1894
- if (preFetchTimeouts[id] !== "nextTick") return;
1895
- delete preFetchTimeouts[id];
1896
- conf.delete(id);
1897
- if (options.async) {
1898
- args = from_1(args);
1899
- args.push(noop$1);
1900
- }
1901
- result = conf.memoized.apply(context, args);
1902
- if (options.promise) {
1903
- // Supress eventual error warnings
1904
- if (isPromise_1(result)) {
1905
- if (typeof result.done === "function") result.done(noop$1, noop$1);
1906
- else result.then(noop$1, noop$1);
1907
- }
1908
- }
1909
- });
1910
- }
1911
- });
1912
- }
1913
- }
1914
-
1915
- conf.on("clear" + postfix, function () {
1916
- forEach$1(timeouts, function (id) { clearTimeout(id); });
1917
- timeouts = {};
1918
- if (preFetchTimeouts) {
1919
- forEach$1(preFetchTimeouts, function (id) { if (id !== "nextTick") clearTimeout(id); });
1920
- preFetchTimeouts = {};
1921
- }
1922
- });
1923
- };
1924
-
1925
- var create$a = Object.create, hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1926
-
1927
- var lruQueue = function (limit) {
1928
- var size = 0, base = 1, queue = create$a(null), map = create$a(null), index = 0, del;
1929
- limit = toPosInteger(limit);
1930
- return {
1931
- hit: function (id) {
1932
- var oldIndex = map[id], nuIndex = ++index;
1933
- queue[nuIndex] = id;
1934
- map[id] = nuIndex;
1935
- if (!oldIndex) {
1936
- ++size;
1937
- if (size <= limit) return;
1938
- id = queue[base];
1939
- del(id);
1940
- return id;
1941
- }
1942
- delete queue[oldIndex];
1943
- if (base !== oldIndex) return;
1944
- while (!hasOwnProperty$1.call(queue, ++base)) continue; //jslint: skip
1945
- },
1946
- delete: del = function (id) {
1947
- var oldIndex = map[id];
1948
- if (!oldIndex) return;
1949
- delete queue[oldIndex];
1950
- delete map[id];
1951
- --size;
1952
- if (base !== oldIndex) return;
1953
- if (!size) {
1954
- index = 0;
1955
- base = 1;
1956
- return;
1957
- }
1958
- while (!hasOwnProperty$1.call(queue, ++base)) continue; //jslint: skip
1959
- },
1960
- clear: function () {
1961
- size = 0;
1962
- base = 1;
1963
- queue = create$a(null);
1964
- map = create$a(null);
1965
- index = 0;
1966
- }
1967
- };
1968
- };
1969
-
1970
- registeredExtensions.max = function (max, conf, options) {
1971
- var postfix, queue, hit;
1972
-
1973
- max = toPosInteger(max);
1974
- if (!max) return;
1975
-
1976
- queue = lruQueue(max);
1977
- postfix = (options.async && registeredExtensions.async) || (options.promise && registeredExtensions.promise)
1978
- ? "async" : "";
1979
-
1980
- conf.on("set" + postfix, hit = function (id) {
1981
- id = queue.hit(id);
1982
- if (id === undefined) return;
1983
- conf.delete(id);
1984
- });
1985
- conf.on("get" + postfix, hit);
1986
- conf.on("delete" + postfix, queue.delete);
1987
- conf.on("clear" + postfix, queue.clear);
1988
- };
1989
-
1990
- var create$b = Object.create, defineProperties$2 = Object.defineProperties;
1991
-
1992
- registeredExtensions.refCounter = function (ignore, conf, options) {
1993
- var cache, postfix;
1994
-
1995
- cache = create$b(null);
1996
- postfix = (options.async && registeredExtensions.async) || (options.promise && registeredExtensions.promise)
1997
- ? "async" : "";
1998
-
1999
- conf.on("set" + postfix, function (id, length) {
2000
- cache[id] = length || 1;
2001
- });
2002
- conf.on("get" + postfix, function (id) {
2003
- ++cache[id];
2004
- });
2005
- conf.on("delete" + postfix, function (id) {
2006
- delete cache[id];
2007
- });
2008
- conf.on("clear" + postfix, function () {
2009
- cache = {};
2010
- });
2011
-
2012
- defineProperties$2(conf.memoized, {
2013
- deleteRef: d_1(function () {
2014
- var id = conf.get(arguments);
2015
- if (id === null) return null;
2016
- if (!cache[id]) return null;
2017
- if (!--cache[id]) {
2018
- conf.delete(id);
2019
- return true;
2020
- }
2021
- return false;
2022
- }),
2023
- getRefCount: d_1(function () {
2024
- var id = conf.get(arguments);
2025
- if (id === null) return 0;
2026
- if (!cache[id]) return 0;
2027
- return cache[id];
2028
- })
2029
- });
2030
- };
2031
-
2032
- var memoizee = function (fn/*, options*/) {
2033
- var options = normalizeOptions(arguments[1]), length;
2034
-
2035
- if (!options.normalizer) {
2036
- length = options.length = resolveLength(options.length, fn.length, options.async);
2037
- if (length !== 0) {
2038
- if (options.primitive) {
2039
- if (length === false) {
2040
- options.normalizer = primitive;
2041
- } else if (length > 1) {
2042
- options.normalizer = getPrimitiveFixed(length);
2043
- }
2044
- } else if (length === false) options.normalizer = get();
2045
- else if (length === 1) options.normalizer = get1();
2046
- else options.normalizer = getFixed(length);
2047
- }
2048
- }
2049
-
2050
- // Assure extensions
2051
- if (options.async)
2052
- if (options.promise)
2053
- if (options.dispose)
2054
- if (options.maxAge)
2055
- if (options.max)
2056
- if (options.refCounter)
2057
-
2058
- return plain(fn, options);
2059
- };
2060
-
2061
- var extend = function (_debugger) {
2062
- var wrapped = function (formatter) {
2063
- var args = [];
2064
- for (var _i = 1; _i < arguments.length; _i++) {
2065
- args[_i - 1] = arguments[_i];
2066
- }
7
+ const extend = (_debugger) => {
8
+ const wrapped = (formatter, ...args) => {
2067
9
  if (typeof formatter === 'function') {
2068
- var ret = formatter();
2069
- var toApply = Array.isArray(ret) ? ret : [ret];
2070
- return _debugger.apply(void 0, toApply);
10
+ const ret = formatter();
11
+ const toApply = Array.isArray(ret) ? ret : [ret];
12
+ return _debugger(...toApply);
2071
13
  }
2072
- return _debugger.apply(void 0, __spreadArray([formatter], args, false));
14
+ return _debugger(formatter, ...args);
2073
15
  };
2074
16
  return Object.assign(wrapped, _debugger);
2075
17
  };
2076
- var lazyEval = function (debugInst) {
18
+ const lazyEval = (debugInst) => {
2077
19
  function debug(namespace) {
2078
20
  function noop() { }
2079
- var instance = debugInst(namespace);
21
+ const instance = debugInst(namespace);
2080
22
  if (!instance.enabled) {
2081
23
  return Object.assign(noop, instance);
2082
24
  }
2083
25
  return extend(instance);
2084
26
  }
2085
- var debugMemoized = memoizee(debug);
27
+ const debugMemoized = memoize(debug);
2086
28
  return Object.assign(debugMemoized, debugInst);
2087
29
  };
2088
30
 
2089
- function debugFactory(debugApi) {
2090
- if (debugApi === void 0) { debugApi = require('debug'); }
31
+ function debugFactory(debugApi = require('debug')) {
2091
32
  debugApi = lazyEval(debugApi);
2092
33
  return debugApi;
2093
34
  }
2094
35
  module.exports = debugFactory;
2095
36
 
2096
- function spawnFactory(namespace, debugFabFactory) {
2097
- if (namespace === void 0) { namespace = ''; }
2098
- if (debugFabFactory === void 0) { debugFabFactory = require('../debugFabFactory')(); }
2099
- function createDebugger(base, ns) {
2100
- if (base === void 0) { base = ''; }
2101
- if (ns === void 0) { ns = ''; }
2102
- var newNs = ns ? [base, ns].join(':') : base;
2103
- var debug = debugFabFactory(newNs);
37
+ function spawnFactory(namespace = '', debugFabFactory = require('../debugFabFactory')()) {
38
+ function createDebugger(base = '', ns = '') {
39
+ const newNs = ns ? [base, ns].join(':') : base;
40
+ const debug = debugFabFactory(newNs);
2104
41
  debug.spawn = spawn;
2105
42
  return debug;
2106
43
  }
@@ -2110,9 +47,9 @@
2110
47
  return createDebugger(namespace);
2111
48
  }
2112
49
 
2113
- var fabulous = Object.assign(debugFactory, { spawnable: spawnFactory });
50
+ const fabulous = Object.assign(debugFactory, { spawnable: spawnFactory });
2114
51
  module.exports = fabulous;
2115
52
 
2116
53
  return fabulous;
2117
54
 
2118
- })));
55
+ }));