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