@blackglory/structures 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/README.md +50 -13
  3. package/dist/es2015/index.min.mjs +16 -2
  4. package/dist/es2015/index.min.mjs.map +1 -1
  5. package/dist/es2015/index.mjs +1661 -488
  6. package/dist/es2015/index.mjs.map +1 -1
  7. package/dist/es2015/index.umd.js +1666 -489
  8. package/dist/es2015/index.umd.js.map +1 -1
  9. package/dist/es2015/index.umd.min.js +15 -2
  10. package/dist/es2015/index.umd.min.js.map +1 -1
  11. package/dist/es2018/index.min.mjs +16 -2
  12. package/dist/es2018/index.min.mjs.map +1 -1
  13. package/dist/es2018/index.mjs +1661 -488
  14. package/dist/es2018/index.mjs.map +1 -1
  15. package/dist/es2018/index.umd.js +1666 -489
  16. package/dist/es2018/index.umd.js.map +1 -1
  17. package/dist/es2018/index.umd.min.js +15 -2
  18. package/dist/es2018/index.umd.min.js.map +1 -1
  19. package/lib/es2015/box.d.ts +6 -0
  20. package/lib/es2015/box.js +30 -0
  21. package/lib/es2015/box.js.map +1 -0
  22. package/lib/es2015/expirable-map.d.ts +4 -4
  23. package/lib/es2015/expirable-map.js +38 -38
  24. package/lib/es2015/expirable-map.js.map +1 -1
  25. package/lib/es2015/finite-state-machine.d.ts +13 -0
  26. package/lib/es2015/finite-state-machine.js +46 -0
  27. package/lib/es2015/finite-state-machine.js.map +1 -0
  28. package/lib/es2015/index.d.ts +3 -0
  29. package/lib/es2015/index.js +3 -0
  30. package/lib/es2015/index.js.map +1 -1
  31. package/lib/es2015/observable-finite-state-machine.d.ts +13 -0
  32. package/lib/es2015/observable-finite-state-machine.js +28 -0
  33. package/lib/es2015/observable-finite-state-machine.js.map +1 -0
  34. package/lib/es2015/tlru-map.d.ts +4 -4
  35. package/lib/es2015/tlru-map.js +36 -36
  36. package/lib/es2015/tlru-map.js.map +1 -1
  37. package/lib/es2018/box.d.ts +6 -0
  38. package/lib/es2018/box.js +30 -0
  39. package/lib/es2018/box.js.map +1 -0
  40. package/lib/es2018/expirable-map.d.ts +4 -4
  41. package/lib/es2018/expirable-map.js +38 -38
  42. package/lib/es2018/expirable-map.js.map +1 -1
  43. package/lib/es2018/finite-state-machine.d.ts +13 -0
  44. package/lib/es2018/finite-state-machine.js +46 -0
  45. package/lib/es2018/finite-state-machine.js.map +1 -0
  46. package/lib/es2018/index.d.ts +3 -0
  47. package/lib/es2018/index.js +3 -0
  48. package/lib/es2018/index.js.map +1 -1
  49. package/lib/es2018/observable-finite-state-machine.d.ts +13 -0
  50. package/lib/es2018/observable-finite-state-machine.js +28 -0
  51. package/lib/es2018/observable-finite-state-machine.js.map +1 -0
  52. package/lib/es2018/tlru-map.d.ts +4 -4
  53. package/lib/es2018/tlru-map.js +36 -36
  54. package/lib/es2018/tlru-map.js.map +1 -1
  55. package/package.json +26 -24
@@ -2,16 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Structures = {}));
5
- }(this, (function (exports) { 'use strict';
6
-
7
- function convertConsToArray([value, next]) {
8
- if (next === null)
9
- return [value];
10
- return [value, ...convertConsToArray(next)];
11
- }
12
- function convertArrayToCons([value, ...next]) {
13
- return [value, next.length ? convertArrayToCons(next) : null];
14
- }
5
+ })(this, (function (exports) { 'use strict';
15
6
 
16
7
  /*! *****************************************************************************
17
8
  Copyright (c) Microsoft Corporation.
@@ -41,6 +32,30 @@
41
32
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
42
33
  }
43
34
 
35
+ var _Box_value;
36
+ class Box {
37
+ constructor(value) {
38
+ _Box_value.set(this, void 0);
39
+ __classPrivateFieldSet(this, _Box_value, value, "f");
40
+ }
41
+ set(value) {
42
+ __classPrivateFieldSet(this, _Box_value, value, "f");
43
+ }
44
+ get() {
45
+ return __classPrivateFieldGet(this, _Box_value, "f");
46
+ }
47
+ }
48
+ _Box_value = new WeakMap();
49
+
50
+ function convertConsToArray([value, next]) {
51
+ if (next === null)
52
+ return [value];
53
+ return [value, ...convertConsToArray(next)];
54
+ }
55
+ function convertArrayToCons([value, ...next]) {
56
+ return [value, next.length ? convertArrayToCons(next) : null];
57
+ }
58
+
44
59
  var _Emitter_map;
45
60
  class Emitter {
46
61
  constructor() {
@@ -169,7 +184,7 @@
169
184
 
170
185
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
171
186
 
172
- var es2018$4 = {};
187
+ var es2018$6 = {};
173
188
 
174
189
  var customError = {};
175
190
 
@@ -247,15 +262,15 @@
247
262
  __exportStar(refute$1, exports);
248
263
  __exportStar(assert$1, exports);
249
264
 
250
- }(es2018$4));
265
+ }(es2018$6));
251
266
 
252
- var es2018$3 = {};
267
+ var es2018$5 = {};
253
268
 
254
269
  var middleware = {};
255
270
 
256
271
  var chunkAsync$1 = {};
257
272
 
258
- var es2018$2 = {};
273
+ var es2018$4 = {};
259
274
 
260
275
  var go$1 = {};
261
276
 
@@ -277,15 +292,15 @@
277
292
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
278
293
  };__exportStar(go$1, exports);
279
294
 
280
- }(es2018$2));
295
+ }(es2018$4));
281
296
 
282
297
  chunkAsync$1.chunkAsync = void 0;
283
- const go_1$f = es2018$2;
284
- const errors_1$f = es2018$4;
298
+ const go_1$f = es2018$4;
299
+ const errors_1$f = es2018$6;
285
300
  function chunkAsync(iterable, size) {
286
- errors_1$f.assert(Number.isInteger(size), 'The parameter size must be an integer');
287
- errors_1$f.assert(size > 0, 'The parameter size must be greater than 0');
288
- return go_1$f.go(async function* () {
301
+ (0, errors_1$f.assert)(Number.isInteger(size), 'The parameter size must be an integer');
302
+ (0, errors_1$f.assert)(size > 0, 'The parameter size must be greater than 0');
303
+ return (0, go_1$f.go)(async function* () {
289
304
  let buffer = [];
290
305
  for await (const element of iterable) {
291
306
  buffer.push(element);
@@ -302,285 +317,297 @@
302
317
 
303
318
  var chunkByAsync$1 = {};
304
319
 
305
- var es2018$1 = {};
320
+ var es2018$3 = {};
306
321
 
307
- var array = {};
322
+ var array$1 = {};
308
323
 
309
- array.isntEmptyArray = array.isEmptyArray = array.isntArray = array.isArray = void 0;
310
- function isArray(val) {
324
+ array$1.isntEmptyArray = array$1.isEmptyArray = array$1.isntArray = array$1.isArray = void 0;
325
+ function isArray$1(val) {
311
326
  return Array.isArray(val);
312
327
  }
313
- array.isArray = isArray;
314
- function isntArray(val) {
315
- return !isArray(val);
328
+ array$1.isArray = isArray$1;
329
+ function isntArray$1(val) {
330
+ return !isArray$1(val);
316
331
  }
317
- array.isntArray = isntArray;
318
- function isEmptyArray(val) {
332
+ array$1.isntArray = isntArray$1;
333
+ function isEmptyArray$1(val) {
319
334
  return val.length === 0;
320
335
  }
321
- array.isEmptyArray = isEmptyArray;
322
- function isntEmptyArray(val) {
336
+ array$1.isEmptyArray = isEmptyArray$1;
337
+ function isntEmptyArray$1(val) {
323
338
  return val.length !== 0;
324
339
  }
325
- array.isntEmptyArray = isntEmptyArray;
340
+ array$1.isntEmptyArray = isntEmptyArray$1;
326
341
 
327
- var asyncIterable = {};
342
+ var asyncIterable$1 = {};
328
343
 
329
- var _null = {};
344
+ var _null$1 = {};
330
345
 
331
- _null.isntNull = _null.isNull = void 0;
332
- function isNull(val) {
346
+ _null$1.isntNull = _null$1.isNull = void 0;
347
+ function isNull$1(val) {
333
348
  return val === null;
334
349
  }
335
- _null.isNull = isNull;
336
- function isntNull(val) {
337
- return !isNull(val);
350
+ _null$1.isNull = isNull$1;
351
+ function isntNull$1(val) {
352
+ return !isNull$1(val);
338
353
  }
339
- _null.isntNull = isntNull;
354
+ _null$1.isntNull = isntNull$1;
340
355
 
341
- var _undefined = {};
356
+ var _undefined$1 = {};
342
357
 
343
- _undefined.isntUndefined = _undefined.isUndefined = void 0;
344
- function isUndefined(val) {
358
+ _undefined$1.isntUndefined = _undefined$1.isUndefined = void 0;
359
+ function isUndefined$1(val) {
345
360
  return val === undefined;
346
361
  }
347
- _undefined.isUndefined = isUndefined;
348
- function isntUndefined(val) {
349
- return !isUndefined(val);
362
+ _undefined$1.isUndefined = isUndefined$1;
363
+ function isntUndefined$1(val) {
364
+ return !isUndefined$1(val);
350
365
  }
351
- _undefined.isntUndefined = isntUndefined;
366
+ _undefined$1.isntUndefined = isntUndefined$1;
352
367
 
353
- asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
354
- const null_1$1 = _null;
355
- const undefined_1$2 = _undefined;
356
- function isAsyncIterable(val) {
357
- return null_1$1.isntNull(val)
358
- && undefined_1$2.isntUndefined(val)
368
+ asyncIterable$1.isntAsyncIterable = asyncIterable$1.isAsyncIterable = void 0;
369
+ const null_1$3 = _null$1;
370
+ const undefined_1$5 = _undefined$1;
371
+ function isAsyncIterable$1(val) {
372
+ return (0, null_1$3.isntNull)(val)
373
+ && (0, undefined_1$5.isntUndefined)(val)
359
374
  && typeof val[Symbol.asyncIterator] === 'function';
360
375
  }
361
- asyncIterable.isAsyncIterable = isAsyncIterable;
362
- function isntAsyncIterable(val) {
363
- return !isAsyncIterable(val);
376
+ asyncIterable$1.isAsyncIterable = isAsyncIterable$1;
377
+ function isntAsyncIterable$1(val) {
378
+ return !isAsyncIterable$1(val);
364
379
  }
365
- asyncIterable.isntAsyncIterable = isntAsyncIterable;
380
+ asyncIterable$1.isntAsyncIterable = isntAsyncIterable$1;
366
381
 
367
- var bigint = {};
382
+ var bigint$1 = {};
368
383
 
369
- bigint.isntBigInt = bigint.isBigInt = void 0;
370
- function isBigInt(val) {
384
+ bigint$1.isntBigInt = bigint$1.isBigInt = void 0;
385
+ function isBigInt$1(val) {
371
386
  return typeof val === 'bigint';
372
387
  }
373
- bigint.isBigInt = isBigInt;
374
- function isntBigInt(val) {
375
- return !isBigInt(val);
388
+ bigint$1.isBigInt = isBigInt$1;
389
+ function isntBigInt$1(val) {
390
+ return !isBigInt$1(val);
376
391
  }
377
- bigint.isntBigInt = isntBigInt;
392
+ bigint$1.isntBigInt = isntBigInt$1;
378
393
 
379
- var boolean = {};
394
+ var boolean$1 = {};
380
395
 
381
- boolean.isntBoolean = boolean.isBoolean = void 0;
382
- function isBoolean(val) {
396
+ boolean$1.isntBoolean = boolean$1.isBoolean = void 0;
397
+ function isBoolean$1(val) {
383
398
  return typeof val === 'boolean';
384
399
  }
385
- boolean.isBoolean = isBoolean;
386
- function isntBoolean(val) {
387
- return !isBoolean(val);
400
+ boolean$1.isBoolean = isBoolean$1;
401
+ function isntBoolean$1(val) {
402
+ return !isBoolean$1(val);
388
403
  }
389
- boolean.isntBoolean = isntBoolean;
404
+ boolean$1.isntBoolean = isntBoolean$1;
390
405
 
391
- var char = {};
406
+ var char$1 = {};
392
407
 
393
- var string = {};
408
+ var string$1 = {};
394
409
 
395
- string.isntString = string.isString = void 0;
396
- function isString(val) {
410
+ string$1.isntString = string$1.isString = void 0;
411
+ function isString$1(val) {
397
412
  return typeof val === 'string';
398
413
  }
399
- string.isString = isString;
400
- function isntString(val) {
401
- return !isString(val);
414
+ string$1.isString = isString$1;
415
+ function isntString$1(val) {
416
+ return !isString$1(val);
402
417
  }
403
- string.isntString = isntString;
418
+ string$1.isntString = isntString$1;
404
419
 
405
- char.isntChar = char.isChar = void 0;
406
- const string_1$1 = string;
407
- function isChar(val) {
408
- return string_1$1.isString(val)
420
+ char$1.isntChar = char$1.isChar = void 0;
421
+ const string_1$3 = string$1;
422
+ function isChar$1(val) {
423
+ return (0, string_1$3.isString)(val)
409
424
  && val.length === 1;
410
425
  }
411
- char.isChar = isChar;
412
- function isntChar(val) {
413
- return !isChar(val);
426
+ char$1.isChar = isChar$1;
427
+ function isntChar$1(val) {
428
+ return !isChar$1(val);
414
429
  }
415
- char.isntChar = isntChar;
430
+ char$1.isntChar = isntChar$1;
416
431
 
417
- var date = {};
432
+ var date$1 = {};
418
433
 
419
- date.isntDate = date.isDate = void 0;
420
- function isDate(val) {
434
+ date$1.isntDate = date$1.isDate = void 0;
435
+ function isDate$1(val) {
421
436
  return val instanceof Date;
422
437
  }
423
- date.isDate = isDate;
424
- function isntDate(val) {
425
- return !isDate(val);
438
+ date$1.isDate = isDate$1;
439
+ function isntDate$1(val) {
440
+ return !isDate$1(val);
426
441
  }
427
- date.isntDate = isntDate;
442
+ date$1.isntDate = isntDate$1;
428
443
 
429
- var _enum = {};
444
+ var _enum$1 = {};
430
445
 
431
- _enum.inEnum = void 0;
432
- function inEnum(val, _enum) {
446
+ _enum$1.inEnum = void 0;
447
+ function inEnum$1(val, _enum) {
433
448
  return Object.values(_enum).includes(val);
434
449
  }
435
- _enum.inEnum = inEnum;
450
+ _enum$1.inEnum = inEnum$1;
436
451
 
437
- var falsy = {};
452
+ var error$1 = {};
438
453
 
439
- falsy.isntFalsy = falsy.isFalsy = void 0;
440
- function isFalsy(val) {
454
+ error$1.isntError = error$1.isError = void 0;
455
+ function isError$1(val) {
456
+ return val instanceof Error;
457
+ }
458
+ error$1.isError = isError$1;
459
+ function isntError$1(val) {
460
+ return !isError$1(val);
461
+ }
462
+ error$1.isntError = isntError$1;
463
+
464
+ var falsy$1 = {};
465
+
466
+ falsy$1.isntFalsy = falsy$1.isFalsy = void 0;
467
+ function isFalsy$1(val) {
441
468
  return !val;
442
469
  }
443
- falsy.isFalsy = isFalsy;
444
- function isntFalsy(val) {
445
- return !isFalsy(val);
470
+ falsy$1.isFalsy = isFalsy$1;
471
+ function isntFalsy$1(val) {
472
+ return !isFalsy$1(val);
446
473
  }
447
- falsy.isntFalsy = isntFalsy;
474
+ falsy$1.isntFalsy = isntFalsy$1;
448
475
 
449
- var _function = {};
476
+ var _function$1 = {};
450
477
 
451
- _function.isntFunction = _function.isFunction = void 0;
452
- function isFunction(val) {
478
+ _function$1.isntFunction = _function$1.isFunction = void 0;
479
+ function isFunction$2(val) {
453
480
  return typeof val === 'function';
454
481
  }
455
- _function.isFunction = isFunction;
456
- function isntFunction(val) {
457
- return !isFunction(val);
482
+ _function$1.isFunction = isFunction$2;
483
+ function isntFunction$1(val) {
484
+ return !isFunction$2(val);
458
485
  }
459
- _function.isntFunction = isntFunction;
486
+ _function$1.isntFunction = isntFunction$1;
460
487
 
461
- var iterable = {};
488
+ var iterable$1 = {};
462
489
 
463
- iterable.isntIterable = iterable.isIterable = void 0;
464
- const null_1 = _null;
465
- const undefined_1$1 = _undefined;
466
- function isIterable(val) {
467
- return null_1.isntNull(val)
468
- && undefined_1$1.isntUndefined(val)
490
+ iterable$1.isntIterable = iterable$1.isIterable = void 0;
491
+ const null_1$2 = _null$1;
492
+ const undefined_1$4 = _undefined$1;
493
+ function isIterable$1(val) {
494
+ return (0, null_1$2.isntNull)(val)
495
+ && (0, undefined_1$4.isntUndefined)(val)
469
496
  && typeof val[Symbol.iterator] === 'function';
470
497
  }
471
- iterable.isIterable = isIterable;
472
- function isntIterable(val) {
473
- return !isIterable(val);
498
+ iterable$1.isIterable = isIterable$1;
499
+ function isntIterable$1(val) {
500
+ return !isIterable$1(val);
474
501
  }
475
- iterable.isntIterable = isntIterable;
502
+ iterable$1.isntIterable = isntIterable$1;
476
503
 
477
- var jsonRpc = {};
504
+ var jsonRpc$1 = {};
478
505
 
479
- var object = {};
506
+ var object$1 = {};
480
507
 
481
- object.isntEmptyObject = object.isEmptyObject = object.isRecord = object.isntObject = object.isObject = void 0;
482
- function isObject(val) {
508
+ object$1.isntEmptyObject = object$1.isEmptyObject = object$1.isRecord = object$1.isntObject = object$1.isObject = void 0;
509
+ function isObject$1(val) {
483
510
  return val !== null && typeof val === 'object';
484
511
  }
485
- object.isObject = isObject;
486
- function isntObject(val) {
487
- return !isObject(val);
512
+ object$1.isObject = isObject$1;
513
+ function isntObject$1(val) {
514
+ return !isObject$1(val);
488
515
  }
489
- object.isntObject = isntObject;
490
- function isRecord(val) {
491
- return isObject(val);
516
+ object$1.isntObject = isntObject$1;
517
+ function isRecord$1(val) {
518
+ return isObject$1(val);
492
519
  }
493
- object.isRecord = isRecord;
494
- function isEmptyObject(val) {
520
+ object$1.isRecord = isRecord$1;
521
+ function isEmptyObject$1(val) {
495
522
  return Object.keys(val).length === 0;
496
523
  }
497
- object.isEmptyObject = isEmptyObject;
498
- function isntEmptyObject(val) {
524
+ object$1.isEmptyObject = isEmptyObject$1;
525
+ function isntEmptyObject$1(val) {
499
526
  return Object.keys(val).length !== 0;
500
527
  }
501
- object.isntEmptyObject = isntEmptyObject;
528
+ object$1.isntEmptyObject = isntEmptyObject$1;
502
529
 
503
- var number = {};
530
+ var number$1 = {};
504
531
 
505
- number.isntNumber = number.isNumber = void 0;
506
- function isNumber(val) {
532
+ number$1.isntNumber = number$1.isNumber = void 0;
533
+ function isNumber$1(val) {
507
534
  return typeof val === 'number';
508
535
  }
509
- number.isNumber = isNumber;
510
- function isntNumber(val) {
511
- return !isNumber(val);
512
- }
513
- number.isntNumber = isntNumber;
514
-
515
- jsonRpc.isntJsonRpcError = jsonRpc.isJsonRpcError = jsonRpc.isntJsonRpcSuccess = jsonRpc.isJsonRpcSuccess = jsonRpc.isntJsonRpcRequest = jsonRpc.isJsonRpcRequest = jsonRpc.isntJsonRpcNotification = jsonRpc.isJsonRpcNotification = void 0;
516
- const array_1 = array;
517
- const object_1 = object;
518
- const string_1 = string;
519
- const number_1 = number;
520
- const undefined_1 = _undefined;
521
- function isJsonRpcId(val) {
522
- return string_1.isString(val) || number_1.isNumber(val);
523
- }
524
- function isJsonRpcParams(val) {
525
- return array_1.isArray(val) || object_1.isObject(val);
526
- }
527
- function isJsonRpcNotification(val) {
528
- return object_1.isRecord(val)
529
- && string_1.isString(val.jsonrpc)
530
- && string_1.isString(val.method)
531
- && undefined_1.isUndefined(val.id)
532
- && isJsonRpcParams(val.params);
533
- }
534
- jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
535
- function isntJsonRpcNotification(val) {
536
- return !isJsonRpcNotification(val);
537
- }
538
- jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
539
- function isJsonRpcRequest(val) {
540
- return object_1.isRecord(val)
541
- && string_1.isString(val.jsonrpc)
542
- && string_1.isString(val.method)
543
- && isJsonRpcId(val.id)
544
- && isJsonRpcParams(val.params);
545
- }
546
- jsonRpc.isJsonRpcRequest = isJsonRpcRequest;
547
- function isntJsonRpcRequest(val) {
548
- return !isJsonRpcRequest(val);
549
- }
550
- jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
551
- function isJsonRpcSuccess(val) {
552
- return object_1.isRecord(val)
553
- && string_1.isString(val.jsonrpc)
554
- && string_1.isString(val.id)
555
- && undefined_1.isntUndefined(val.result);
556
- }
557
- jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
558
- function isntJsonRpcSuccess(val) {
559
- return !isJsonRpcSuccess(val);
560
- }
561
- jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
562
- function isJsonRpcError(val) {
563
- return object_1.isRecord(val)
564
- && string_1.isString(val.jsonrpc)
565
- && isJsonRpcId(val.id)
566
- && isJsonRpcErrorObject(val.error);
567
- }
568
- jsonRpc.isJsonRpcError = isJsonRpcError;
569
- function isntJsonRpcError(val) {
570
- return !isJsonRpcError(val);
571
- }
572
- jsonRpc.isntJsonRpcError = isntJsonRpcError;
573
- function isJsonRpcErrorObject(val) {
574
- return object_1.isRecord(val)
575
- && number_1.isNumber(val.code)
576
- && string_1.isString(val.message)
577
- && (undefined_1.isUndefined(val.data) || object_1.isObject(val.data));
578
- }
579
-
580
- var json = {};
581
-
582
- json.isntJson = json.isJson = void 0;
583
- function isJson(val) {
536
+ number$1.isNumber = isNumber$1;
537
+ function isntNumber$1(val) {
538
+ return !isNumber$1(val);
539
+ }
540
+ number$1.isntNumber = isntNumber$1;
541
+
542
+ jsonRpc$1.isntJsonRpcError = jsonRpc$1.isJsonRpcError = jsonRpc$1.isntJsonRpcSuccess = jsonRpc$1.isJsonRpcSuccess = jsonRpc$1.isntJsonRpcRequest = jsonRpc$1.isJsonRpcRequest = jsonRpc$1.isntJsonRpcNotification = jsonRpc$1.isJsonRpcNotification = void 0;
543
+ const array_1$1 = array$1;
544
+ const object_1$1 = object$1;
545
+ const string_1$2 = string$1;
546
+ const number_1$1 = number$1;
547
+ const undefined_1$3 = _undefined$1;
548
+ function isJsonRpcId$1(val) {
549
+ return (0, string_1$2.isString)(val) || (0, number_1$1.isNumber)(val);
550
+ }
551
+ function isJsonRpcParams$1(val) {
552
+ return (0, array_1$1.isArray)(val) || (0, object_1$1.isObject)(val);
553
+ }
554
+ function isJsonRpcNotification$1(val) {
555
+ return (0, object_1$1.isRecord)(val)
556
+ && (0, string_1$2.isString)(val.jsonrpc)
557
+ && (0, string_1$2.isString)(val.method)
558
+ && (0, undefined_1$3.isUndefined)(val.id)
559
+ && isJsonRpcParams$1(val.params);
560
+ }
561
+ jsonRpc$1.isJsonRpcNotification = isJsonRpcNotification$1;
562
+ function isntJsonRpcNotification$1(val) {
563
+ return !isJsonRpcNotification$1(val);
564
+ }
565
+ jsonRpc$1.isntJsonRpcNotification = isntJsonRpcNotification$1;
566
+ function isJsonRpcRequest$1(val) {
567
+ return (0, object_1$1.isRecord)(val)
568
+ && (0, string_1$2.isString)(val.jsonrpc)
569
+ && (0, string_1$2.isString)(val.method)
570
+ && isJsonRpcId$1(val.id)
571
+ && isJsonRpcParams$1(val.params);
572
+ }
573
+ jsonRpc$1.isJsonRpcRequest = isJsonRpcRequest$1;
574
+ function isntJsonRpcRequest$1(val) {
575
+ return !isJsonRpcRequest$1(val);
576
+ }
577
+ jsonRpc$1.isntJsonRpcRequest = isntJsonRpcRequest$1;
578
+ function isJsonRpcSuccess$1(val) {
579
+ return (0, object_1$1.isRecord)(val)
580
+ && (0, string_1$2.isString)(val.jsonrpc)
581
+ && (0, string_1$2.isString)(val.id)
582
+ && (0, undefined_1$3.isntUndefined)(val.result);
583
+ }
584
+ jsonRpc$1.isJsonRpcSuccess = isJsonRpcSuccess$1;
585
+ function isntJsonRpcSuccess$1(val) {
586
+ return !isJsonRpcSuccess$1(val);
587
+ }
588
+ jsonRpc$1.isntJsonRpcSuccess = isntJsonRpcSuccess$1;
589
+ function isJsonRpcError$1(val) {
590
+ return (0, object_1$1.isRecord)(val)
591
+ && (0, string_1$2.isString)(val.jsonrpc)
592
+ && isJsonRpcId$1(val.id)
593
+ && isJsonRpcErrorObject$1(val.error);
594
+ }
595
+ jsonRpc$1.isJsonRpcError = isJsonRpcError$1;
596
+ function isntJsonRpcError$1(val) {
597
+ return !isJsonRpcError$1(val);
598
+ }
599
+ jsonRpc$1.isntJsonRpcError = isntJsonRpcError$1;
600
+ function isJsonRpcErrorObject$1(val) {
601
+ return (0, object_1$1.isRecord)(val)
602
+ && (0, number_1$1.isNumber)(val.code)
603
+ && (0, string_1$2.isString)(val.message)
604
+ && ((0, undefined_1$3.isUndefined)(val.data) || (0, object_1$1.isObject)(val.data));
605
+ }
606
+
607
+ var json$1 = {};
608
+
609
+ json$1.isntJson = json$1.isJson = void 0;
610
+ function isJson$1(val) {
584
611
  try {
585
612
  JSON.stringify(val);
586
613
  return true;
@@ -589,16 +616,16 @@
589
616
  return false;
590
617
  }
591
618
  }
592
- json.isJson = isJson;
593
- function isntJson(val) {
594
- return !isntJson();
619
+ json$1.isJson = isJson$1;
620
+ function isntJson$1(val) {
621
+ return !isntJson$1();
595
622
  }
596
- json.isntJson = isntJson;
623
+ json$1.isntJson = isntJson$1;
597
624
 
598
- var url = {};
625
+ var url$1 = {};
599
626
 
600
- url.isAbsoluteURL = void 0;
601
- function isAbsoluteURL(str) {
627
+ url$1.isAbsoluteURL = void 0;
628
+ function isAbsoluteURL$1(str) {
602
629
  try {
603
630
  new URL(str);
604
631
  return true;
@@ -607,7 +634,7 @@
607
634
  return false;
608
635
  }
609
636
  }
610
- url.isAbsoluteURL = isAbsoluteURL;
637
+ url$1.isAbsoluteURL = isAbsoluteURL$1;
611
638
 
612
639
  (function (exports) {
613
640
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -619,31 +646,32 @@
619
646
  }));
620
647
  var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
621
648
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
622
- };__exportStar(array, exports);
623
- __exportStar(asyncIterable, exports);
624
- __exportStar(bigint, exports);
625
- __exportStar(boolean, exports);
626
- __exportStar(char, exports);
627
- __exportStar(date, exports);
628
- __exportStar(_enum, exports);
629
- __exportStar(falsy, exports);
630
- __exportStar(_function, exports);
631
- __exportStar(iterable, exports);
632
- __exportStar(jsonRpc, exports);
633
- __exportStar(json, exports);
634
- __exportStar(_null, exports);
635
- __exportStar(number, exports);
636
- __exportStar(object, exports);
637
- __exportStar(string, exports);
638
- __exportStar(_undefined, exports);
639
- __exportStar(url, exports);
649
+ };__exportStar(array$1, exports);
650
+ __exportStar(asyncIterable$1, exports);
651
+ __exportStar(bigint$1, exports);
652
+ __exportStar(boolean$1, exports);
653
+ __exportStar(char$1, exports);
654
+ __exportStar(date$1, exports);
655
+ __exportStar(_enum$1, exports);
656
+ __exportStar(error$1, exports);
657
+ __exportStar(falsy$1, exports);
658
+ __exportStar(_function$1, exports);
659
+ __exportStar(iterable$1, exports);
660
+ __exportStar(jsonRpc$1, exports);
661
+ __exportStar(json$1, exports);
662
+ __exportStar(_null$1, exports);
663
+ __exportStar(number$1, exports);
664
+ __exportStar(object$1, exports);
665
+ __exportStar(string$1, exports);
666
+ __exportStar(_undefined$1, exports);
667
+ __exportStar(url$1, exports);
640
668
 
641
- }(es2018$1));
669
+ }(es2018$3));
642
670
 
643
671
  chunkByAsync$1.chunkByAsync = void 0;
644
- const types_1$h = es2018$1;
672
+ const types_1$h = es2018$3;
645
673
  function chunkByAsync(iterable, predicate) {
646
- if (types_1$h.isAsyncIterable(iterable)) {
674
+ if ((0, types_1$h.isAsyncIterable)(iterable)) {
647
675
  return chunkByAsyncIterable(iterable);
648
676
  }
649
677
  else {
@@ -702,12 +730,12 @@
702
730
  var chunk$1 = {};
703
731
 
704
732
  chunk$1.chunk = void 0;
705
- const go_1$e = es2018$2;
706
- const errors_1$e = es2018$4;
733
+ const go_1$e = es2018$4;
734
+ const errors_1$e = es2018$6;
707
735
  function chunk(iterable, size) {
708
- errors_1$e.assert(Number.isInteger(size), 'The parameter size must be an integer');
709
- errors_1$e.assert(size > 0, 'The parameter size must be greater than 0');
710
- return go_1$e.go(function* () {
736
+ (0, errors_1$e.assert)(Number.isInteger(size), 'The parameter size must be an integer');
737
+ (0, errors_1$e.assert)(size > 0, 'The parameter size must be greater than 0');
738
+ return (0, go_1$e.go)(function* () {
711
739
  let buffer = [];
712
740
  for (const element of iterable) {
713
741
  buffer.push(element);
@@ -725,12 +753,12 @@
725
753
  var concatAsync$1 = {};
726
754
 
727
755
  concatAsync$1.concatAsync = void 0;
728
- const types_1$g = es2018$1;
729
- const go_1$d = es2018$2;
756
+ const types_1$g = es2018$3;
757
+ const go_1$d = es2018$4;
730
758
  function concatAsync(iterable, ...otherIterables) {
731
- return go_1$d.go(async function* () {
759
+ return (0, go_1$d.go)(async function* () {
732
760
  for (const iter of [iterable, ...otherIterables]) {
733
- if (types_1$g.isAsyncIterable(iter)) {
761
+ if ((0, types_1$g.isAsyncIterable)(iter)) {
734
762
  for await (const element of iter) {
735
763
  yield element;
736
764
  }
@@ -748,9 +776,9 @@
748
776
  var concat$1 = {};
749
777
 
750
778
  concat$1.concat = void 0;
751
- const go_1$c = es2018$2;
779
+ const go_1$c = es2018$4;
752
780
  function concat(iterable, ...otherIterables) {
753
- return go_1$c.go(function* () {
781
+ return (0, go_1$c.go)(function* () {
754
782
  for (const iter of [iterable, ...otherIterables]) {
755
783
  yield* iter;
756
784
  }
@@ -777,15 +805,15 @@
777
805
  utils.copyIterable = copyIterable;
778
806
 
779
807
  dropAsync$1.dropAsync = void 0;
780
- const go_1$b = es2018$2;
808
+ const go_1$b = es2018$4;
781
809
  const utils_1$3 = utils;
782
- const errors_1$d = es2018$4;
810
+ const errors_1$d = es2018$6;
783
811
  function dropAsync(iterable, count) {
784
- errors_1$d.assert(Number.isInteger(count), 'The parameter count must be an integer');
785
- errors_1$d.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
812
+ (0, errors_1$d.assert)(Number.isInteger(count), 'The parameter count must be an integer');
813
+ (0, errors_1$d.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
786
814
  if (count === 0)
787
- return utils_1$3.copyAsyncIterable(iterable);
788
- return go_1$b.go(async function* () {
815
+ return (0, utils_1$3.copyAsyncIterable)(iterable);
816
+ return (0, go_1$b.go)(async function* () {
789
817
  var _a;
790
818
  const iterator = iterable[Symbol.asyncIterator]();
791
819
  let done;
@@ -812,15 +840,15 @@
812
840
  var dropRightAsync$1 = {};
813
841
 
814
842
  dropRightAsync$1.dropRightAsync = void 0;
815
- const go_1$a = es2018$2;
843
+ const go_1$a = es2018$4;
816
844
  const utils_1$2 = utils;
817
- const errors_1$c = es2018$4;
845
+ const errors_1$c = es2018$6;
818
846
  function dropRightAsync(iterable, count) {
819
- errors_1$c.assert(Number.isInteger(count), 'The parameter count must be an integer');
820
- errors_1$c.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
847
+ (0, errors_1$c.assert)(Number.isInteger(count), 'The parameter count must be an integer');
848
+ (0, errors_1$c.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
821
849
  if (count === 0)
822
- return utils_1$2.copyAsyncIterable(iterable);
823
- return go_1$a.go(async function* () {
850
+ return (0, utils_1$2.copyAsyncIterable)(iterable);
851
+ return (0, go_1$a.go)(async function* () {
824
852
  const arr = await toArrayAsync$2(iterable);
825
853
  const result = arr.slice(0, -count);
826
854
  for (const value of result) {
@@ -840,15 +868,15 @@
840
868
  var dropRight$1 = {};
841
869
 
842
870
  dropRight$1.dropRight = void 0;
843
- const go_1$9 = es2018$2;
871
+ const go_1$9 = es2018$4;
844
872
  const utils_1$1 = utils;
845
- const errors_1$b = es2018$4;
873
+ const errors_1$b = es2018$6;
846
874
  function dropRight(iterable, count) {
847
- errors_1$b.assert(Number.isInteger(count), 'The parameter count must be an integer');
848
- errors_1$b.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
875
+ (0, errors_1$b.assert)(Number.isInteger(count), 'The parameter count must be an integer');
876
+ (0, errors_1$b.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
849
877
  if (count === 0)
850
- return utils_1$1.copyIterable(iterable);
851
- return go_1$9.go(function* () {
878
+ return (0, utils_1$1.copyIterable)(iterable);
879
+ return (0, go_1$9.go)(function* () {
852
880
  const arr = Array.from(iterable);
853
881
  yield* arr.slice(0, -count);
854
882
  });
@@ -858,9 +886,9 @@
858
886
  var dropUntilAsync$1 = {};
859
887
 
860
888
  dropUntilAsync$1.dropUntilAsync = void 0;
861
- const types_1$f = es2018$1;
889
+ const types_1$f = es2018$3;
862
890
  function dropUntilAsync(iterable, predicate) {
863
- if (types_1$f.isAsyncIterable(iterable)) {
891
+ if ((0, types_1$f.isAsyncIterable)(iterable)) {
864
892
  return dropUntilAsyncIterable(iterable);
865
893
  }
866
894
  else {
@@ -940,15 +968,15 @@
940
968
  var drop$1 = {};
941
969
 
942
970
  drop$1.drop = void 0;
943
- const go_1$8 = es2018$2;
971
+ const go_1$8 = es2018$4;
944
972
  const utils_1 = utils;
945
- const errors_1$a = es2018$4;
973
+ const errors_1$a = es2018$6;
946
974
  function drop(iterable, count) {
947
- errors_1$a.assert(Number.isInteger(count), 'The parameter count must be an integer');
948
- errors_1$a.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
975
+ (0, errors_1$a.assert)(Number.isInteger(count), 'The parameter count must be an integer');
976
+ (0, errors_1$a.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
949
977
  if (count === 0)
950
- return utils_1.copyIterable(iterable);
951
- return go_1$8.go(function* () {
978
+ return (0, utils_1.copyIterable)(iterable);
979
+ return (0, go_1$8.go)(function* () {
952
980
  var _a;
953
981
  const iterator = iterable[Symbol.iterator]();
954
982
  let done;
@@ -975,9 +1003,9 @@
975
1003
  var filterAsync$1 = {};
976
1004
 
977
1005
  filterAsync$1.filterAsync = void 0;
978
- const types_1$e = es2018$1;
1006
+ const types_1$e = es2018$3;
979
1007
  function filterAsync(iterable, predicate) {
980
- if (types_1$e.isAsyncIterable(iterable)) {
1008
+ if ((0, types_1$e.isAsyncIterable)(iterable)) {
981
1009
  return filterAsyncIterable(iterable);
982
1010
  }
983
1011
  else {
@@ -1022,9 +1050,9 @@
1022
1050
  var flattenByAsync$1 = {};
1023
1051
 
1024
1052
  flattenByAsync$1.flattenByAsync = void 0;
1025
- const types_1$d = es2018$1;
1053
+ const types_1$d = es2018$3;
1026
1054
  function flattenByAsync(iterable, predicate) {
1027
- if (types_1$d.isAsyncIterable(iterable)) {
1055
+ if ((0, types_1$d.isAsyncIterable)(iterable)) {
1028
1056
  return flattenByAsyncIterable(iterable);
1029
1057
  }
1030
1058
  else {
@@ -1057,30 +1085,30 @@
1057
1085
  }
1058
1086
  flattenByAsync$1.flattenByAsync = flattenByAsync;
1059
1087
  function isFiniteIterable$1(val) {
1060
- return types_1$d.isIterable(val) && types_1$d.isntChar(val);
1088
+ return (0, types_1$d.isIterable)(val) && (0, types_1$d.isntChar)(val);
1061
1089
  }
1062
1090
 
1063
1091
  flattenDeepAsync$1.flattenDeepAsync = void 0;
1064
1092
  const flatten_by_async_1 = flattenByAsync$1;
1065
- const errors_1$9 = es2018$4;
1093
+ const errors_1$9 = es2018$6;
1066
1094
  function flattenDeepAsync(iterable, depth = Infinity) {
1067
- errors_1$9.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1068
- errors_1$9.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1069
- return flatten_by_async_1.flattenByAsync(iterable, (_, level) => level <= depth);
1095
+ (0, errors_1$9.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1096
+ (0, errors_1$9.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1097
+ return (0, flatten_by_async_1.flattenByAsync)(iterable, (_, level) => level <= depth);
1070
1098
  }
1071
1099
  flattenDeepAsync$1.flattenDeepAsync = flattenDeepAsync;
1072
1100
 
1073
1101
  flattenAsync$1.flattenAsync = void 0;
1074
1102
  const flatten_deep_async_1 = flattenDeepAsync$1;
1075
1103
  function flattenAsync(iterable) {
1076
- return flatten_deep_async_1.flattenDeepAsync(iterable, 1);
1104
+ return (0, flatten_deep_async_1.flattenDeepAsync)(iterable, 1);
1077
1105
  }
1078
1106
  flattenAsync$1.flattenAsync = flattenAsync;
1079
1107
 
1080
1108
  var flattenBy$1 = {};
1081
1109
 
1082
1110
  flattenBy$1.flattenBy = void 0;
1083
- const types_1$c = es2018$1;
1111
+ const types_1$c = es2018$3;
1084
1112
  function flattenBy(iterable, predicate) {
1085
1113
  return flatten(iterable, 1);
1086
1114
  function* flatten(iterable, level) {
@@ -1096,18 +1124,18 @@
1096
1124
  }
1097
1125
  flattenBy$1.flattenBy = flattenBy;
1098
1126
  function isFiniteIterable(val) {
1099
- return types_1$c.isIterable(val) && types_1$c.isntChar(val);
1127
+ return (0, types_1$c.isIterable)(val) && (0, types_1$c.isntChar)(val);
1100
1128
  }
1101
1129
 
1102
1130
  var flattenDeep$1 = {};
1103
1131
 
1104
1132
  flattenDeep$1.flattenDeep = void 0;
1105
1133
  const flatten_by_1 = flattenBy$1;
1106
- const errors_1$8 = es2018$4;
1134
+ const errors_1$8 = es2018$6;
1107
1135
  function flattenDeep(iterable, depth = Infinity) {
1108
- errors_1$8.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1109
- errors_1$8.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1110
- return flatten_by_1.flattenBy(iterable, (_, level) => level <= depth);
1136
+ (0, errors_1$8.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1137
+ (0, errors_1$8.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1138
+ return (0, flatten_by_1.flattenBy)(iterable, (_, level) => level <= depth);
1111
1139
  }
1112
1140
  flattenDeep$1.flattenDeep = flattenDeep;
1113
1141
 
@@ -1116,16 +1144,16 @@
1116
1144
  flatten$1.flatten = void 0;
1117
1145
  const flatten_deep_1 = flattenDeep$1;
1118
1146
  function flatten(iterable) {
1119
- return flatten_deep_1.flattenDeep(iterable, 1);
1147
+ return (0, flatten_deep_1.flattenDeep)(iterable, 1);
1120
1148
  }
1121
1149
  flatten$1.flatten = flatten;
1122
1150
 
1123
1151
  var mapAsync$1 = {};
1124
1152
 
1125
1153
  mapAsync$1.mapAsync = void 0;
1126
- const types_1$b = es2018$1;
1154
+ const types_1$b = es2018$3;
1127
1155
  function mapAsync(iterable, fn) {
1128
- if (types_1$b.isAsyncIterable(iterable)) {
1156
+ if ((0, types_1$b.isAsyncIterable)(iterable)) {
1129
1157
  return mapAsyncIterable(iterable);
1130
1158
  }
1131
1159
  else {
@@ -1163,14 +1191,14 @@
1163
1191
  var repeatAsync$1 = {};
1164
1192
 
1165
1193
  repeatAsync$1.repeatAsync = void 0;
1166
- const go_1$7 = es2018$2;
1167
- const errors_1$7 = es2018$4;
1194
+ const go_1$7 = es2018$4;
1195
+ const errors_1$7 = es2018$6;
1168
1196
  function repeatAsync(iterable, times) {
1169
- errors_1$7.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1170
- errors_1$7.assert(times >= 0, 'The parameter times must be greater than or equal to 0');
1197
+ (0, errors_1$7.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1198
+ (0, errors_1$7.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
1171
1199
  if (times === Infinity)
1172
1200
  warnInfiniteLoop$1();
1173
- return go_1$7.go(async function* () {
1201
+ return (0, go_1$7.go)(async function* () {
1174
1202
  const cache = [];
1175
1203
  if (times > 0) {
1176
1204
  for await (const element of iterable) {
@@ -1198,14 +1226,14 @@
1198
1226
  var repeat$1 = {};
1199
1227
 
1200
1228
  repeat$1.repeat = void 0;
1201
- const go_1$6 = es2018$2;
1202
- const errors_1$6 = es2018$4;
1229
+ const go_1$6 = es2018$4;
1230
+ const errors_1$6 = es2018$6;
1203
1231
  function repeat(iterable, times) {
1204
- errors_1$6.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1205
- errors_1$6.assert(times >= 0, 'The parameter times must be greater than or equal to 0');
1232
+ (0, errors_1$6.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1233
+ (0, errors_1$6.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
1206
1234
  if (times === Infinity)
1207
1235
  warnInfiniteLoop();
1208
- return go_1$6.go(function* () {
1236
+ return (0, go_1$6.go)(function* () {
1209
1237
  const cache = [];
1210
1238
  if (times > 0) {
1211
1239
  for (const element of iterable) {
@@ -1233,14 +1261,14 @@
1233
1261
  var sliceAsync$1 = {};
1234
1262
 
1235
1263
  sliceAsync$1.sliceAsync = void 0;
1236
- const go_1$5 = es2018$2;
1237
- const errors_1$5 = es2018$4;
1264
+ const go_1$5 = es2018$4;
1265
+ const errors_1$5 = es2018$6;
1238
1266
  function sliceAsync(iterable, start, end = Infinity) {
1239
- errors_1$5.assert(Number.isInteger(start), 'The parameter start must be an integer');
1240
- errors_1$5.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
1241
- errors_1$5.assert(Number.isInteger(end), 'The parameter end must be an integer');
1242
- errors_1$5.assert(end >= start, 'The parameter end must be greater than or equal to start');
1243
- return go_1$5.go(async function* () {
1267
+ (0, errors_1$5.assert)(Number.isInteger(start), 'The parameter start must be an integer');
1268
+ (0, errors_1$5.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
1269
+ (0, errors_1$5.assert)(Number.isInteger(end), 'The parameter end must be an integer');
1270
+ (0, errors_1$5.assert)(end >= start, 'The parameter end must be greater than or equal to start');
1271
+ return (0, go_1$5.go)(async function* () {
1244
1272
  let index = 0;
1245
1273
  for await (const element of iterable) {
1246
1274
  if (index >= end)
@@ -1256,14 +1284,14 @@
1256
1284
  var slice$1 = {};
1257
1285
 
1258
1286
  slice$1.slice = void 0;
1259
- const go_1$4 = es2018$2;
1260
- const errors_1$4 = es2018$4;
1287
+ const go_1$4 = es2018$4;
1288
+ const errors_1$4 = es2018$6;
1261
1289
  function slice(iterable, start, end = Infinity) {
1262
- errors_1$4.assert(Number.isInteger(start), 'The parameter start must be an integer');
1263
- errors_1$4.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
1264
- errors_1$4.assert(Number.isInteger(end), 'The parameter end must be an integer');
1265
- errors_1$4.assert(end >= start, 'The parameter end must be greater than or equal to start');
1266
- return go_1$4.go(function* () {
1290
+ (0, errors_1$4.assert)(Number.isInteger(start), 'The parameter start must be an integer');
1291
+ (0, errors_1$4.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
1292
+ (0, errors_1$4.assert)(Number.isInteger(end), 'The parameter end must be an integer');
1293
+ (0, errors_1$4.assert)(end >= start, 'The parameter end must be greater than or equal to start');
1294
+ return (0, go_1$4.go)(function* () {
1267
1295
  let index = 0;
1268
1296
  for (const element of iterable) {
1269
1297
  if (index >= end)
@@ -1297,9 +1325,9 @@
1297
1325
  var splitByAsync$1 = {};
1298
1326
 
1299
1327
  splitByAsync$1.splitByAsync = void 0;
1300
- const types_1$a = es2018$1;
1328
+ const types_1$a = es2018$3;
1301
1329
  function splitByAsync(iterable, predicate) {
1302
- if (types_1$a.isAsyncIterable(iterable)) {
1330
+ if ((0, types_1$a.isAsyncIterable)(iterable)) {
1303
1331
  return splitByAsyncIterable(iterable);
1304
1332
  }
1305
1333
  else {
@@ -1379,12 +1407,12 @@
1379
1407
  var takeAsync$1 = {};
1380
1408
 
1381
1409
  takeAsync$1.takeAsync = void 0;
1382
- const go_1$3 = es2018$2;
1383
- const errors_1$3 = es2018$4;
1410
+ const go_1$3 = es2018$4;
1411
+ const errors_1$3 = es2018$6;
1384
1412
  function takeAsync(iterable, count) {
1385
- errors_1$3.assert(Number.isInteger(count), 'The parameter count must be an integer');
1386
- errors_1$3.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1387
- return go_1$3.go(async function* () {
1413
+ (0, errors_1$3.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1414
+ (0, errors_1$3.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1415
+ return (0, go_1$3.go)(async function* () {
1388
1416
  if (count === 0)
1389
1417
  return;
1390
1418
  for await (const element of iterable) {
@@ -1400,12 +1428,12 @@
1400
1428
  var takeRightAsync$1 = {};
1401
1429
 
1402
1430
  takeRightAsync$1.takeRightAsync = void 0;
1403
- const go_1$2 = es2018$2;
1404
- const errors_1$2 = es2018$4;
1431
+ const go_1$2 = es2018$4;
1432
+ const errors_1$2 = es2018$6;
1405
1433
  function takeRightAsync(iterable, count) {
1406
- errors_1$2.assert(Number.isInteger(count), 'The parameter count must be an integer');
1407
- errors_1$2.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1408
- return go_1$2.go(async function* () {
1434
+ (0, errors_1$2.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1435
+ (0, errors_1$2.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1436
+ return (0, go_1$2.go)(async function* () {
1409
1437
  var _a;
1410
1438
  const iterator = iterable[Symbol.asyncIterator]();
1411
1439
  let done;
@@ -1430,12 +1458,12 @@
1430
1458
  var takeRight$1 = {};
1431
1459
 
1432
1460
  takeRight$1.takeRight = void 0;
1433
- const go_1$1 = es2018$2;
1434
- const errors_1$1 = es2018$4;
1461
+ const go_1$1 = es2018$4;
1462
+ const errors_1$1 = es2018$6;
1435
1463
  function takeRight(iterable, count) {
1436
- errors_1$1.assert(Number.isInteger(count), 'The parameter count must be an integer');
1437
- errors_1$1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1438
- return go_1$1.go(function* () {
1464
+ (0, errors_1$1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1465
+ (0, errors_1$1.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1466
+ return (0, go_1$1.go)(function* () {
1439
1467
  var _a;
1440
1468
  const iterator = iterable[Symbol.iterator]();
1441
1469
  let done;
@@ -1460,9 +1488,9 @@
1460
1488
  var takeUntilAsync$1 = {};
1461
1489
 
1462
1490
  takeUntilAsync$1.takeUntilAsync = void 0;
1463
- const types_1$9 = es2018$1;
1491
+ const types_1$9 = es2018$3;
1464
1492
  function takeUntilAsync(iterable, predicate) {
1465
- if (types_1$9.isAsyncIterable(iterable)) {
1493
+ if ((0, types_1$9.isAsyncIterable)(iterable)) {
1466
1494
  return takeUntilAsyncIterable(iterable);
1467
1495
  }
1468
1496
  else {
@@ -1506,12 +1534,12 @@
1506
1534
  var take$1 = {};
1507
1535
 
1508
1536
  take$1.take = void 0;
1509
- const go_1 = es2018$2;
1510
- const errors_1 = es2018$4;
1537
+ const go_1 = es2018$4;
1538
+ const errors_1 = es2018$6;
1511
1539
  function take(iterable, count) {
1512
- errors_1.assert(Number.isInteger(count), 'The parameter count must be an integer');
1513
- errors_1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1514
- return go_1.go(function* () {
1540
+ (0, errors_1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1541
+ (0, errors_1.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1542
+ return (0, go_1.go)(function* () {
1515
1543
  if (count === 0)
1516
1544
  return;
1517
1545
  for (const element of iterable) {
@@ -1527,9 +1555,9 @@
1527
1555
  var tapAsync$1 = {};
1528
1556
 
1529
1557
  tapAsync$1.tapAsync = void 0;
1530
- const types_1$8 = es2018$1;
1558
+ const types_1$8 = es2018$3;
1531
1559
  function tapAsync(iterable, fn) {
1532
- if (types_1$8.isAsyncIterable(iterable)) {
1560
+ if ((0, types_1$8.isAsyncIterable)(iterable)) {
1533
1561
  return tapAsyncIterable(iterable);
1534
1562
  }
1535
1563
  else {
@@ -1610,9 +1638,9 @@
1610
1638
  var uniqByAsync$1 = {};
1611
1639
 
1612
1640
  uniqByAsync$1.uniqByAsync = void 0;
1613
- const types_1$7 = es2018$1;
1641
+ const types_1$7 = es2018$3;
1614
1642
  function uniqByAsync(iterable, fn) {
1615
- if (types_1$7.isAsyncIterable(iterable)) {
1643
+ if ((0, types_1$7.isAsyncIterable)(iterable)) {
1616
1644
  return uniqByAsyncIterable(iterable);
1617
1645
  }
1618
1646
  else {
@@ -1679,7 +1707,7 @@
1679
1707
  var zipAsync$1 = {};
1680
1708
 
1681
1709
  zipAsync$1.zipAsync = void 0;
1682
- const types_1$6 = es2018$1;
1710
+ const types_1$6 = es2018$3;
1683
1711
  var Kind;
1684
1712
  (function (Kind) {
1685
1713
  Kind[Kind["Sync"] = 0] = "Sync";
@@ -1693,7 +1721,7 @@
1693
1721
  var _a, _b, _c, _d;
1694
1722
  const length = iterables.length;
1695
1723
  const iterators = iterables.map(iterable => {
1696
- if (types_1$6.isAsyncIterable(iterable)) {
1724
+ if ((0, types_1$6.isAsyncIterable)(iterable)) {
1697
1725
  return [Kind.Async, iterable[Symbol.asyncIterator]()];
1698
1726
  }
1699
1727
  else {
@@ -1839,9 +1867,9 @@
1839
1867
  var eachAsync$1 = {};
1840
1868
 
1841
1869
  eachAsync$1.eachAsync = void 0;
1842
- const types_1$5 = es2018$1;
1870
+ const types_1$5 = es2018$3;
1843
1871
  function eachAsync(iterable, fn) {
1844
- if (types_1$5.isAsyncIterable(iterable)) {
1872
+ if ((0, types_1$5.isAsyncIterable)(iterable)) {
1845
1873
  return eachAsyncIterable(iterable);
1846
1874
  }
1847
1875
  else {
@@ -1879,9 +1907,9 @@
1879
1907
  var everyAsync$1 = {};
1880
1908
 
1881
1909
  everyAsync$1.everyAsync = void 0;
1882
- const types_1$4 = es2018$1;
1910
+ const types_1$4 = es2018$3;
1883
1911
  function everyAsync(iterable, predicate) {
1884
- if (types_1$4.isAsyncIterable(iterable)) {
1912
+ if ((0, types_1$4.isAsyncIterable)(iterable)) {
1885
1913
  return everyAsyncIterable(iterable);
1886
1914
  }
1887
1915
  else {
@@ -1925,9 +1953,9 @@
1925
1953
  var findAsync$1 = {};
1926
1954
 
1927
1955
  findAsync$1.findAsync = void 0;
1928
- const types_1$3 = es2018$1;
1956
+ const types_1$3 = es2018$3;
1929
1957
  function findAsync(iterable, predicate) {
1930
- if (types_1$3.isAsyncIterable(iterable)) {
1958
+ if ((0, types_1$3.isAsyncIterable)(iterable)) {
1931
1959
  return findAsyncIterable(iterable);
1932
1960
  }
1933
1961
  else {
@@ -2049,9 +2077,9 @@
2049
2077
  var reduceAsync$1 = {};
2050
2078
 
2051
2079
  reduceAsync$1.reduceAsync = void 0;
2052
- const types_1$2 = es2018$1;
2080
+ const types_1$2 = es2018$3;
2053
2081
  function reduceAsync(iterable, fn, initialValue) {
2054
- if (types_1$2.isUndefined(initialValue)) {
2082
+ if ((0, types_1$2.isUndefined)(initialValue)) {
2055
2083
  return reduceAsyncWithoutInitialValue(iterable, fn);
2056
2084
  }
2057
2085
  else {
@@ -2060,7 +2088,7 @@
2060
2088
  }
2061
2089
  reduceAsync$1.reduceAsync = reduceAsync;
2062
2090
  function reduceAsyncWithInitialValue(iterable, fn, initialValue) {
2063
- if (types_1$2.isAsyncIterable(iterable)) {
2091
+ if ((0, types_1$2.isAsyncIterable)(iterable)) {
2064
2092
  return reduceAsyncIterable(iterable);
2065
2093
  }
2066
2094
  else {
@@ -2082,7 +2110,7 @@
2082
2110
  }
2083
2111
  }
2084
2112
  function reduceAsyncWithoutInitialValue(iterable, fn) {
2085
- if (types_1$2.isAsyncIterable(iterable)) {
2113
+ if ((0, types_1$2.isAsyncIterable)(iterable)) {
2086
2114
  return reduceAsyncIterable(iterable);
2087
2115
  }
2088
2116
  else {
@@ -2145,9 +2173,9 @@
2145
2173
  var reduce$1 = {};
2146
2174
 
2147
2175
  reduce$1.reduce = void 0;
2148
- const types_1$1 = es2018$1;
2176
+ const types_1$1 = es2018$3;
2149
2177
  function reduce(iterable, fn, initialValue) {
2150
- if (types_1$1.isUndefined(initialValue)) {
2178
+ if ((0, types_1$1.isUndefined)(initialValue)) {
2151
2179
  return reduceWithoutInitialValue(iterable, fn);
2152
2180
  }
2153
2181
  else {
@@ -2192,9 +2220,9 @@
2192
2220
  var someAsync$1 = {};
2193
2221
 
2194
2222
  someAsync$1.someAsync = void 0;
2195
- const types_1 = es2018$1;
2223
+ const types_1 = es2018$3;
2196
2224
  function someAsync(iterable, predicate) {
2197
- if (types_1.isAsyncIterable(iterable)) {
2225
+ if ((0, types_1.isAsyncIterable)(iterable)) {
2198
2226
  return someAsyncIterable(iterable);
2199
2227
  }
2200
2228
  else {
@@ -2284,7 +2312,7 @@
2284
2312
  toArrayAsync$1.toArrayAsync = void 0;
2285
2313
  const consume_1$3 = consume$1;
2286
2314
  function toArrayAsync(iterable) {
2287
- return consume_1$3.consume(iterable, async (iterable) => {
2315
+ return (0, consume_1$3.consume)(iterable, async (iterable) => {
2288
2316
  const result = [];
2289
2317
  for await (const element of iterable) {
2290
2318
  result.push(element);
@@ -2299,7 +2327,7 @@
2299
2327
  toArray$1.toArray = void 0;
2300
2328
  const consume_1$2 = consume$1;
2301
2329
  function toArray(iterable) {
2302
- return consume_1$2.consume(iterable, iterable => Array.from(iterable));
2330
+ return (0, consume_1$2.consume)(iterable, iterable => Array.from(iterable));
2303
2331
  }
2304
2332
  toArray$1.toArray = toArray;
2305
2333
 
@@ -2308,7 +2336,7 @@
2308
2336
  toSetAsync$1.toSetAsync = void 0;
2309
2337
  const consume_1$1 = consume$1;
2310
2338
  function toSetAsync(iterable) {
2311
- return consume_1$1.consume(iterable, async (iterable) => {
2339
+ return (0, consume_1$1.consume)(iterable, async (iterable) => {
2312
2340
  const result = new Set();
2313
2341
  for await (const element of iterable) {
2314
2342
  result.add(element);
@@ -2323,7 +2351,7 @@
2323
2351
  toSet$1.toSet = void 0;
2324
2352
  const consume_1 = consume$1;
2325
2353
  function toSet(iterable) {
2326
- return consume_1.consume(iterable, iterable => new Set(iterable));
2354
+ return (0, consume_1.consume)(iterable, iterable => new Set(iterable));
2327
2355
  }
2328
2356
  toSet$1.toSet = toSet;
2329
2357
 
@@ -2376,15 +2404,15 @@
2376
2404
  };__exportStar(middleware, exports);
2377
2405
  __exportStar(output, exports);
2378
2406
 
2379
- }(es2018$3));
2407
+ }(es2018$5));
2380
2408
 
2381
2409
  var _LRUMap_limit, _LRUMap_map;
2382
2410
  class LRUMap {
2383
2411
  constructor(limit) {
2384
2412
  _LRUMap_limit.set(this, void 0);
2385
2413
  _LRUMap_map.set(this, new Map());
2386
- es2018$4.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2387
- es2018$4.assert(limit > 0, 'The parameter limit must be a positive value');
2414
+ es2018$6.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2415
+ es2018$6.assert(limit > 0, 'The parameter limit must be a positive value');
2388
2416
  __classPrivateFieldSet(this, _LRUMap_limit, limit, "f");
2389
2417
  }
2390
2418
  get [(_LRUMap_limit = new WeakMap(), _LRUMap_map = new WeakMap(), Symbol.toStringTag)]() {
@@ -2432,44 +2460,105 @@
2432
2460
  * Return the earliest key inserted in the Map
2433
2461
  */
2434
2462
  getColdestKey() {
2435
- return es2018$3.first(__classPrivateFieldGet(this, _LRUMap_map, "f").keys());
2463
+ return es2018$5.first(__classPrivateFieldGet(this, _LRUMap_map, "f").keys());
2436
2464
  }
2437
2465
  }
2438
2466
 
2439
- var es2018 = {};
2467
+ var es2018$2 = {};
2440
2468
 
2441
- var setTimeout$1 = {};
2469
+ var exponentialBackoff = {};
2442
2470
 
2443
- setTimeout$1.setTimeout = void 0;
2444
- function setTimeout(timeout, cb) {
2445
- const timer = globalThis.setTimeout(cb, timeout);
2446
- return () => clearTimeout(timer);
2447
- }
2448
- setTimeout$1.setTimeout = setTimeout;
2471
+ var es2018$1 = {};
2449
2472
 
2450
- var setSchedule$1 = {};
2473
+ var random$1 = {};
2451
2474
 
2452
- setSchedule$1.setSchedule = void 0;
2453
- const set_timeout_1$3 = setTimeout$1;
2454
- function setSchedule(timestamp, cb) {
2455
- const timeout = timestamp - Date.now();
2456
- return (0, set_timeout_1$3.setTimeout)(timeout, cb);
2475
+ random$1.random = void 0;
2476
+ function random(min, max) {
2477
+ return Math.random() * (max - min) + min;
2457
2478
  }
2458
- setSchedule$1.setSchedule = setSchedule;
2479
+ random$1.random = random;
2459
2480
 
2460
- var setInterval$1 = {};
2481
+ var randomInt$1 = {};
2461
2482
 
2462
- setInterval$1.setInterval = void 0;
2463
- function setInterval(timeout, cb) {
2464
- const timer = globalThis.setInterval(cb, timeout);
2465
- return () => clearInterval(timer);
2483
+ randomInt$1.randomInt = void 0;
2484
+ function randomInt(min, max) {
2485
+ min = Math.ceil(min);
2486
+ max = Math.floor(max);
2487
+ return Math.floor(Math.random() * (max - min)) + min;
2466
2488
  }
2467
- setInterval$1.setInterval = setInterval;
2489
+ randomInt$1.randomInt = randomInt;
2468
2490
 
2469
- var setImmediate$1 = {};
2491
+ var randomIntInclusive$1 = {};
2492
+
2493
+ randomIntInclusive$1.randomIntInclusive = void 0;
2494
+ function randomIntInclusive(min, max) {
2495
+ min = Math.ceil(min);
2496
+ max = Math.floor(max);
2497
+ return Math.floor(Math.random() * (max - min + 1)) + min;
2498
+ }
2499
+ randomIntInclusive$1.randomIntInclusive = randomIntInclusive;
2500
+
2501
+ (function (exports) {
2502
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2503
+ if (k2 === undefined) k2 = k;
2504
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2505
+ }) : (function(o, m, k, k2) {
2506
+ if (k2 === undefined) k2 = k;
2507
+ o[k2] = m[k];
2508
+ }));
2509
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2510
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2511
+ };__exportStar(random$1, exports);
2512
+ __exportStar(randomInt$1, exports);
2513
+ __exportStar(randomIntInclusive$1, exports);
2514
+
2515
+ }(es2018$1));
2516
+
2517
+ exponentialBackoff.calculateExponentialBackoffTimeout = void 0;
2518
+ const extra_rand_1 = es2018$1;
2519
+ function calculateExponentialBackoffTimeout({ baseTimeout, retries, maxTimeout = Infinity, factor = 2, jitter = true }) {
2520
+ const timeout = Math.min(factor ** retries * baseTimeout, maxTimeout);
2521
+ if (jitter) {
2522
+ return (0, extra_rand_1.randomIntInclusive)(0, timeout);
2523
+ }
2524
+ else {
2525
+ return timeout;
2526
+ }
2527
+ }
2528
+ exponentialBackoff.calculateExponentialBackoffTimeout = calculateExponentialBackoffTimeout;
2529
+
2530
+ var setTimeout$2 = {};
2531
+
2532
+ setTimeout$2.setTimeout = void 0;
2533
+ function setTimeout$1(timeout, cb) {
2534
+ const timer = globalThis.setTimeout(cb, timeout);
2535
+ return () => clearTimeout(timer);
2536
+ }
2537
+ setTimeout$2.setTimeout = setTimeout$1;
2538
+
2539
+ var setSchedule$1 = {};
2540
+
2541
+ setSchedule$1.setSchedule = void 0;
2542
+ const set_timeout_1$3 = setTimeout$2;
2543
+ function setSchedule(timestamp, cb) {
2544
+ const timeout = timestamp - Date.now();
2545
+ return (0, set_timeout_1$3.setTimeout)(timeout, cb);
2546
+ }
2547
+ setSchedule$1.setSchedule = setSchedule;
2548
+
2549
+ var setInterval$1 = {};
2550
+
2551
+ setInterval$1.setInterval = void 0;
2552
+ function setInterval(timeout, cb) {
2553
+ const timer = globalThis.setInterval(cb, timeout);
2554
+ return () => clearInterval(timer);
2555
+ }
2556
+ setInterval$1.setInterval = setInterval;
2557
+
2558
+ var setImmediate$1 = {};
2470
2559
 
2471
2560
  setImmediate$1.setImmediate = void 0;
2472
- const set_timeout_1$2 = setTimeout$1;
2561
+ const set_timeout_1$2 = setTimeout$2;
2473
2562
  function setImmediate(cb) {
2474
2563
  if (globalThis.setImmediate) {
2475
2564
  const timer = globalThis.setImmediate(cb);
@@ -2484,7 +2573,7 @@
2484
2573
  var setTimeoutLoop$1 = {};
2485
2574
 
2486
2575
  setTimeoutLoop$1.setTimeoutLoop = void 0;
2487
- const set_timeout_1$1 = setTimeout$1;
2576
+ const set_timeout_1$1 = setTimeout$2;
2488
2577
  function setTimeoutLoop(timeout, cb) {
2489
2578
  let isCancelled = false;
2490
2579
  let cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
@@ -2494,8 +2583,9 @@
2494
2583
  };
2495
2584
  async function loop() {
2496
2585
  await cb();
2497
- if (!isCancelled)
2586
+ if (!isCancelled) {
2498
2587
  cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
2588
+ }
2499
2589
  }
2500
2590
  }
2501
2591
  setTimeoutLoop$1.setTimeoutLoop = setTimeoutLoop;
@@ -2503,7 +2593,7 @@
2503
2593
  var setDynamicTimeoutLoop$1 = {};
2504
2594
 
2505
2595
  setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = void 0;
2506
- const set_timeout_1 = setTimeout$1;
2596
+ const set_timeout_1 = setTimeout$2;
2507
2597
  function setDynamicTimeoutLoop(timeout, cb) {
2508
2598
  let isCancelled = false;
2509
2599
  let cancel = (0, set_timeout_1.setTimeout)(timeout, loop);
@@ -2515,8 +2605,9 @@
2515
2605
  const start = Date.now();
2516
2606
  await cb();
2517
2607
  const elapsed = Date.now() - start;
2518
- if (!isCancelled)
2608
+ if (!isCancelled) {
2519
2609
  cancel = (0, set_timeout_1.setTimeout)(Math.max(timeout - elapsed, 0), loop);
2610
+ }
2520
2611
  }
2521
2612
  }
2522
2613
  setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = setDynamicTimeoutLoop;
@@ -2531,26 +2622,27 @@
2531
2622
  }));
2532
2623
  var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2533
2624
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2534
- };__exportStar(setTimeout$1, exports);
2625
+ };__exportStar(exponentialBackoff, exports);
2626
+ __exportStar(setTimeout$2, exports);
2535
2627
  __exportStar(setSchedule$1, exports);
2536
2628
  __exportStar(setInterval$1, exports);
2537
2629
  __exportStar(setImmediate$1, exports);
2538
2630
  __exportStar(setTimeoutLoop$1, exports);
2539
2631
  __exportStar(setDynamicTimeoutLoop$1, exports);
2540
2632
 
2541
- }(es2018));
2633
+ }(es2018$2));
2542
2634
 
2543
- var _ExpirableMap_map, _ExpirableMap_cancelNextTimeout;
2635
+ var _ExpirableMap_map, _ExpirableMap_cancelClearTimeout;
2544
2636
  class ExpirableMap {
2545
2637
  constructor() {
2546
2638
  _ExpirableMap_map.set(this, new Map());
2547
- _ExpirableMap_cancelNextTimeout.set(this, void 0);
2639
+ _ExpirableMap_cancelClearTimeout.set(this, void 0);
2548
2640
  /**
2549
- * 按过期时间升序排列所有Map项目的信息
2641
+ * 按过期时间升序排列所有项目的元数据
2550
2642
  */
2551
- this.itemsSortedByExpirationTime = [];
2643
+ this.itemMetadataSortedByExpirationTime = [];
2552
2644
  }
2553
- get [(_ExpirableMap_map = new WeakMap(), _ExpirableMap_cancelNextTimeout = new WeakMap(), Symbol.toStringTag)]() {
2645
+ get [(_ExpirableMap_map = new WeakMap(), _ExpirableMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
2554
2646
  return this.constructor.name;
2555
2647
  }
2556
2648
  get size() {
@@ -2558,8 +2650,8 @@
2558
2650
  }
2559
2651
  set(key, value, maxAge) {
2560
2652
  __classPrivateFieldGet(this, _ExpirableMap_map, "f").set(key, value);
2561
- this.removeItem(key);
2562
- this.addItem(key, Date.now() + maxAge);
2653
+ this.removeItemMetadata(key);
2654
+ this.addItemMetadata(key, Date.now() + maxAge);
2563
2655
  return this;
2564
2656
  }
2565
2657
  has(key) {
@@ -2569,79 +2661,79 @@
2569
2661
  return __classPrivateFieldGet(this, _ExpirableMap_map, "f").get(key);
2570
2662
  }
2571
2663
  delete(key) {
2572
- const result = __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(key);
2573
- if (result) {
2574
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2575
- this.itemsSortedByExpirationTime.splice(index, 1);
2664
+ const exists = __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(key);
2665
+ if (exists) {
2666
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2667
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2576
2668
  // 如果被删除的项目是第一个项目, 则需要重新规划过期回调
2577
2669
  if (index === 0) {
2578
- this.rescheduleTimeout();
2670
+ this.rescheduleClearTimeout();
2579
2671
  }
2580
2672
  }
2581
- return result;
2673
+ return exists;
2582
2674
  }
2583
2675
  clear() {
2584
2676
  var _a;
2585
2677
  __classPrivateFieldGet(this, _ExpirableMap_map, "f").clear();
2586
- (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2587
- this.itemsSortedByExpirationTime = [];
2678
+ (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2679
+ this.itemMetadataSortedByExpirationTime = [];
2588
2680
  }
2589
- addItem(key, expirationTime) {
2590
- for (let i = 0; i < this.itemsSortedByExpirationTime.length; i++) {
2591
- const item = this.itemsSortedByExpirationTime[i];
2681
+ addItemMetadata(key, expirationTime) {
2682
+ for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
2683
+ const item = this.itemMetadataSortedByExpirationTime[i];
2592
2684
  if (expirationTime < item.expirationTime) {
2593
- this.itemsSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2685
+ this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2594
2686
  // 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
2595
2687
  if (i === 0) {
2596
- this.rescheduleTimeout();
2688
+ this.rescheduleClearTimeout();
2597
2689
  }
2598
2690
  return;
2599
2691
  }
2600
2692
  }
2601
2693
  // 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
2602
- this.itemsSortedByExpirationTime.push({ key, expirationTime });
2694
+ this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
2603
2695
  // 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
2604
- if (this.itemsSortedByExpirationTime.length === 1) {
2605
- this.rescheduleTimeout();
2696
+ if (this.itemMetadataSortedByExpirationTime.length === 1) {
2697
+ this.rescheduleClearTimeout();
2606
2698
  }
2607
2699
  }
2608
- removeItem(key) {
2609
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2700
+ removeItemMetadata(key) {
2701
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2610
2702
  if (index >= 0) {
2611
- this.itemsSortedByExpirationTime.splice(index, 1);
2703
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2612
2704
  // 如果被移除的是第一个项目, 则需要重新规划过期回调
2613
2705
  if (index === 0) {
2614
- this.rescheduleTimeout();
2706
+ this.rescheduleClearTimeout();
2615
2707
  }
2616
2708
  }
2617
2709
  }
2618
2710
  clearExpiredItems(timestamp) {
2619
- const indexOfFirstUnexpiredItem = this.itemsSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2620
- const expiredItems = indexOfFirstUnexpiredItem >= 0
2621
- ? this.itemsSortedByExpirationTime.splice(0, indexOfFirstUnexpiredItem)
2622
- : this.itemsSortedByExpirationTime.splice(0, this.itemsSortedByExpirationTime.length);
2623
- expiredItems.forEach(x => __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(x.key));
2711
+ const indexOfFirstUnexpired = this.itemMetadataSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2712
+ const expiredItemKeys = indexOfFirstUnexpired >= 0
2713
+ ? this.itemMetadataSortedByExpirationTime.splice(0, indexOfFirstUnexpired)
2714
+ : this.itemMetadataSortedByExpirationTime.splice(0, this.itemMetadataSortedByExpirationTime.length);
2715
+ expiredItemKeys.forEach(x => __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(x.key));
2624
2716
  }
2625
- rescheduleTimeout() {
2717
+ rescheduleClearTimeout() {
2626
2718
  var _a;
2627
- (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2628
- if (this.itemsSortedByExpirationTime.length > 0) {
2629
- const item = this.itemsSortedByExpirationTime[0];
2719
+ (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2720
+ if (this.itemMetadataSortedByExpirationTime.length > 0) {
2721
+ const item = this.itemMetadataSortedByExpirationTime[0];
2630
2722
  if (Number.isFinite(item.expirationTime)) {
2631
- const cancel = es2018.setSchedule(item.expirationTime, () => {
2723
+ const cancel = es2018$2.setSchedule(item.expirationTime, () => {
2632
2724
  this.clearExpiredItems(Date.now());
2633
- this.rescheduleTimeout();
2725
+ this.rescheduleClearTimeout();
2634
2726
  });
2635
- __classPrivateFieldSet(this, _ExpirableMap_cancelNextTimeout, () => {
2727
+ __classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, () => {
2636
2728
  cancel();
2637
- __classPrivateFieldSet(this, _ExpirableMap_cancelNextTimeout, undefined, "f");
2729
+ __classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, undefined, "f");
2638
2730
  }, "f");
2639
2731
  }
2640
2732
  }
2641
2733
  }
2642
2734
  }
2643
2735
 
2644
- var _TLRUMap_limit, _TLRUMap_map, _TLRUMap_cancelNextTimeout;
2736
+ var _TLRUMap_limit, _TLRUMap_map, _TLRUMap_cancelClearTimeout;
2645
2737
  /**
2646
2738
  * TLRUMap = LRUMap + ExpirableMap
2647
2739
  */
@@ -2649,16 +2741,16 @@
2649
2741
  constructor(limit) {
2650
2742
  _TLRUMap_limit.set(this, void 0);
2651
2743
  _TLRUMap_map.set(this, new Map());
2652
- _TLRUMap_cancelNextTimeout.set(this, void 0);
2744
+ _TLRUMap_cancelClearTimeout.set(this, void 0);
2653
2745
  /**
2654
- * 按过期时间升序排列所有Map项目的信息
2746
+ * 按过期时间升序排列所有项目的元数据
2655
2747
  */
2656
- this.itemsSortedByExpirationTime = [];
2657
- es2018$4.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2658
- es2018$4.assert(limit > 0, 'The parameter limit must be a positive value');
2748
+ this.itemMetadataSortedByExpirationTime = [];
2749
+ es2018$6.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2750
+ es2018$6.assert(limit > 0, 'The parameter limit must be a positive value');
2659
2751
  __classPrivateFieldSet(this, _TLRUMap_limit, limit, "f");
2660
2752
  }
2661
- get [(_TLRUMap_limit = new WeakMap(), _TLRUMap_map = new WeakMap(), _TLRUMap_cancelNextTimeout = new WeakMap(), Symbol.toStringTag)]() {
2753
+ get [(_TLRUMap_limit = new WeakMap(), _TLRUMap_map = new WeakMap(), _TLRUMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
2662
2754
  return this.constructor.name;
2663
2755
  }
2664
2756
  get size() {
@@ -2667,15 +2759,15 @@
2667
2759
  set(key, value, maxAge) {
2668
2760
  if (__classPrivateFieldGet(this, _TLRUMap_map, "f").has(key)) {
2669
2761
  this.updateItem(key, value);
2670
- this.removeItem(key);
2671
- this.addItem(key, Date.now() + maxAge);
2762
+ this.removeItemMetadata(key);
2763
+ this.addItemMetadata(key, Date.now() + maxAge);
2672
2764
  }
2673
2765
  else {
2674
2766
  if (__classPrivateFieldGet(this, _TLRUMap_map, "f").size === __classPrivateFieldGet(this, _TLRUMap_limit, "f")) {
2675
2767
  __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(this.getColdestKey());
2676
2768
  }
2677
2769
  __classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
2678
- this.addItem(key, Date.now() + maxAge);
2770
+ this.addItemMetadata(key, Date.now() + maxAge);
2679
2771
  }
2680
2772
  return this;
2681
2773
  }
@@ -2695,11 +2787,11 @@
2695
2787
  delete(key) {
2696
2788
  const result = __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
2697
2789
  if (result) {
2698
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2699
- this.itemsSortedByExpirationTime.splice(index, 1);
2790
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2791
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2700
2792
  // 如果被删除的项目是第一个项目, 则需要重新规划过期回调
2701
2793
  if (index === 0) {
2702
- this.rescheduleTimeout();
2794
+ this.rescheduleClearTimeout();
2703
2795
  }
2704
2796
  }
2705
2797
  return result;
@@ -2707,8 +2799,8 @@
2707
2799
  clear() {
2708
2800
  var _a;
2709
2801
  __classPrivateFieldGet(this, _TLRUMap_map, "f").clear();
2710
- (_a = __classPrivateFieldGet(this, _TLRUMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2711
- this.itemsSortedByExpirationTime = [];
2802
+ (_a = __classPrivateFieldGet(this, _TLRUMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2803
+ this.itemMetadataSortedByExpirationTime = [];
2712
2804
  }
2713
2805
  /**
2714
2806
  * 重新插入项目, 这会使项目置于#map迭代器的末端.
@@ -2717,55 +2809,55 @@
2717
2809
  __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
2718
2810
  __classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
2719
2811
  }
2720
- addItem(key, expirationTime) {
2721
- for (let i = 0; i < this.itemsSortedByExpirationTime.length; i++) {
2722
- const item = this.itemsSortedByExpirationTime[i];
2812
+ addItemMetadata(key, expirationTime) {
2813
+ for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
2814
+ const item = this.itemMetadataSortedByExpirationTime[i];
2723
2815
  if (expirationTime < item.expirationTime) {
2724
- this.itemsSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2816
+ this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2725
2817
  // 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
2726
2818
  if (i === 0) {
2727
- this.rescheduleTimeout();
2819
+ this.rescheduleClearTimeout();
2728
2820
  }
2729
2821
  return;
2730
2822
  }
2731
2823
  }
2732
2824
  // 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
2733
- this.itemsSortedByExpirationTime.push({ key, expirationTime });
2825
+ this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
2734
2826
  // 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
2735
- if (this.itemsSortedByExpirationTime.length === 1) {
2736
- this.rescheduleTimeout();
2827
+ if (this.itemMetadataSortedByExpirationTime.length === 1) {
2828
+ this.rescheduleClearTimeout();
2737
2829
  }
2738
2830
  }
2739
- removeItem(key) {
2740
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2831
+ removeItemMetadata(key) {
2832
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2741
2833
  if (index >= 0) {
2742
- this.itemsSortedByExpirationTime.splice(index, 1);
2834
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2743
2835
  // 如果被移除的是第一个项目, 则需要重新规划过期回调
2744
2836
  if (index === 0) {
2745
- this.rescheduleTimeout();
2837
+ this.rescheduleClearTimeout();
2746
2838
  }
2747
2839
  }
2748
2840
  }
2749
2841
  clearExpiredItems(timestamp) {
2750
- const indexOfFirstUnexpiredItem = this.itemsSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2751
- const expiredItems = indexOfFirstUnexpiredItem >= 0
2752
- ? this.itemsSortedByExpirationTime.splice(0, indexOfFirstUnexpiredItem)
2753
- : this.itemsSortedByExpirationTime.splice(0, this.itemsSortedByExpirationTime.length);
2754
- expiredItems.forEach(x => __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(x.key));
2842
+ const indexOfFirstUnexpiredItem = this.itemMetadataSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2843
+ const expiredItemKeys = indexOfFirstUnexpiredItem >= 0
2844
+ ? this.itemMetadataSortedByExpirationTime.splice(0, indexOfFirstUnexpiredItem)
2845
+ : this.itemMetadataSortedByExpirationTime.splice(0, this.itemMetadataSortedByExpirationTime.length);
2846
+ expiredItemKeys.forEach(x => __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(x.key));
2755
2847
  }
2756
- rescheduleTimeout() {
2848
+ rescheduleClearTimeout() {
2757
2849
  var _a;
2758
- (_a = __classPrivateFieldGet(this, _TLRUMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2759
- if (this.itemsSortedByExpirationTime.length > 0) {
2760
- const item = this.itemsSortedByExpirationTime[0];
2850
+ (_a = __classPrivateFieldGet(this, _TLRUMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2851
+ if (this.itemMetadataSortedByExpirationTime.length > 0) {
2852
+ const item = this.itemMetadataSortedByExpirationTime[0];
2761
2853
  if (Number.isFinite(item.expirationTime)) {
2762
- const cancel = es2018.setSchedule(item.expirationTime, () => {
2854
+ const cancel = es2018$2.setSchedule(item.expirationTime, () => {
2763
2855
  this.clearExpiredItems(Date.now());
2764
- this.rescheduleTimeout();
2856
+ this.rescheduleClearTimeout();
2765
2857
  });
2766
- __classPrivateFieldSet(this, _TLRUMap_cancelNextTimeout, () => {
2858
+ __classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, () => {
2767
2859
  cancel();
2768
- __classPrivateFieldSet(this, _TLRUMap_cancelNextTimeout, undefined, "f");
2860
+ __classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, undefined, "f");
2769
2861
  }, "f");
2770
2862
  }
2771
2863
  }
@@ -2774,7 +2866,7 @@
2774
2866
  * Return the earliest key inserted in the Map
2775
2867
  */
2776
2868
  getColdestKey() {
2777
- return es2018$3.first(__classPrivateFieldGet(this, _TLRUMap_map, "f").keys());
2869
+ return es2018$5.first(__classPrivateFieldGet(this, _TLRUMap_map, "f").keys());
2778
2870
  }
2779
2871
  }
2780
2872
 
@@ -2842,7 +2934,7 @@
2842
2934
  delete node.value;
2843
2935
  // 如果节点没有后缀, 则代表这是末端节点, 往前删除其前缀
2844
2936
  if (node.children.size === 0) {
2845
- for (const [part, parentNode] of es2018$3.toArray(es2018$3.zip(key, parentNodes)).reverse()) {
2937
+ for (const [part, parentNode] of es2018$5.toArray(es2018$5.zip(key, parentNodes)).reverse()) {
2846
2938
  parentNode.children.delete(part);
2847
2939
  if (parentNode.children.size !== 0)
2848
2940
  break;
@@ -2852,11 +2944,1096 @@
2852
2944
  }
2853
2945
  }
2854
2946
 
2947
+ var _FiniteStateMachine_state;
2948
+ class FiniteStateMachine {
2949
+ constructor(schema, initialState) {
2950
+ this.schema = schema;
2951
+ _FiniteStateMachine_state.set(this, void 0);
2952
+ __classPrivateFieldSet(this, _FiniteStateMachine_state, initialState, "f");
2953
+ }
2954
+ get state() {
2955
+ return __classPrivateFieldGet(this, _FiniteStateMachine_state, "f");
2956
+ }
2957
+ matches(state) {
2958
+ return __classPrivateFieldGet(this, _FiniteStateMachine_state, "f") === state;
2959
+ }
2960
+ /**
2961
+ * @throws {BadEventError}
2962
+ */
2963
+ send(event) {
2964
+ if (event in this.schema[this.state]) {
2965
+ __classPrivateFieldSet(this, _FiniteStateMachine_state, this.schema[this.state][event], "f");
2966
+ }
2967
+ else {
2968
+ throw new BadEventError(this.state, event);
2969
+ }
2970
+ }
2971
+ }
2972
+ _FiniteStateMachine_state = new WeakMap();
2973
+ class BadEventError extends es2018$6.CustomError {
2974
+ constructor(state, event) {
2975
+ super(`State ${state} cannot react to event ${event}`);
2976
+ }
2977
+ }
2978
+
2979
+ /*! *****************************************************************************
2980
+ Copyright (c) Microsoft Corporation.
2981
+
2982
+ Permission to use, copy, modify, and/or distribute this software for any
2983
+ purpose with or without fee is hereby granted.
2984
+
2985
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2986
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2987
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2988
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2989
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2990
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2991
+ PERFORMANCE OF THIS SOFTWARE.
2992
+ ***************************************************************************** */
2993
+ /* global Reflect, Promise */
2994
+
2995
+ var extendStatics = function(d, b) {
2996
+ extendStatics = Object.setPrototypeOf ||
2997
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2998
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
2999
+ return extendStatics(d, b);
3000
+ };
3001
+
3002
+ function __extends(d, b) {
3003
+ if (typeof b !== "function" && b !== null)
3004
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
3005
+ extendStatics(d, b);
3006
+ function __() { this.constructor = d; }
3007
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3008
+ }
3009
+
3010
+ function __values(o) {
3011
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3012
+ if (m) return m.call(o);
3013
+ if (o && typeof o.length === "number") return {
3014
+ next: function () {
3015
+ if (o && i >= o.length) o = void 0;
3016
+ return { value: o && o[i++], done: !o };
3017
+ }
3018
+ };
3019
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3020
+ }
3021
+
3022
+ function __read(o, n) {
3023
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3024
+ if (!m) return o;
3025
+ var i = m.call(o), r, ar = [], e;
3026
+ try {
3027
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3028
+ }
3029
+ catch (error) { e = { error: error }; }
3030
+ finally {
3031
+ try {
3032
+ if (r && !r.done && (m = i["return"])) m.call(i);
3033
+ }
3034
+ finally { if (e) throw e.error; }
3035
+ }
3036
+ return ar;
3037
+ }
3038
+
3039
+ function __spreadArray(to, from) {
3040
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
3041
+ to[j] = from[i];
3042
+ return to;
3043
+ }
3044
+
3045
+ function isFunction$1(value) {
3046
+ return typeof value === 'function';
3047
+ }
3048
+
3049
+ function createErrorClass(createImpl) {
3050
+ var _super = function (instance) {
3051
+ Error.call(instance);
3052
+ instance.stack = new Error().stack;
3053
+ };
3054
+ var ctorFunc = createImpl(_super);
3055
+ ctorFunc.prototype = Object.create(Error.prototype);
3056
+ ctorFunc.prototype.constructor = ctorFunc;
3057
+ return ctorFunc;
3058
+ }
3059
+
3060
+ var UnsubscriptionError = createErrorClass(function (_super) {
3061
+ return function UnsubscriptionErrorImpl(errors) {
3062
+ _super(this);
3063
+ this.message = errors
3064
+ ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
3065
+ : '';
3066
+ this.name = 'UnsubscriptionError';
3067
+ this.errors = errors;
3068
+ };
3069
+ });
3070
+
3071
+ function arrRemove(arr, item) {
3072
+ if (arr) {
3073
+ var index = arr.indexOf(item);
3074
+ 0 <= index && arr.splice(index, 1);
3075
+ }
3076
+ }
3077
+
3078
+ var Subscription = (function () {
3079
+ function Subscription(initialTeardown) {
3080
+ this.initialTeardown = initialTeardown;
3081
+ this.closed = false;
3082
+ this._parentage = null;
3083
+ this._teardowns = null;
3084
+ }
3085
+ Subscription.prototype.unsubscribe = function () {
3086
+ var e_1, _a, e_2, _b;
3087
+ var errors;
3088
+ if (!this.closed) {
3089
+ this.closed = true;
3090
+ var _parentage = this._parentage;
3091
+ if (_parentage) {
3092
+ this._parentage = null;
3093
+ if (Array.isArray(_parentage)) {
3094
+ try {
3095
+ for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
3096
+ var parent_1 = _parentage_1_1.value;
3097
+ parent_1.remove(this);
3098
+ }
3099
+ }
3100
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3101
+ finally {
3102
+ try {
3103
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
3104
+ }
3105
+ finally { if (e_1) throw e_1.error; }
3106
+ }
3107
+ }
3108
+ else {
3109
+ _parentage.remove(this);
3110
+ }
3111
+ }
3112
+ var initialTeardown = this.initialTeardown;
3113
+ if (isFunction$1(initialTeardown)) {
3114
+ try {
3115
+ initialTeardown();
3116
+ }
3117
+ catch (e) {
3118
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
3119
+ }
3120
+ }
3121
+ var _teardowns = this._teardowns;
3122
+ if (_teardowns) {
3123
+ this._teardowns = null;
3124
+ try {
3125
+ for (var _teardowns_1 = __values(_teardowns), _teardowns_1_1 = _teardowns_1.next(); !_teardowns_1_1.done; _teardowns_1_1 = _teardowns_1.next()) {
3126
+ var teardown_1 = _teardowns_1_1.value;
3127
+ try {
3128
+ execTeardown(teardown_1);
3129
+ }
3130
+ catch (err) {
3131
+ errors = errors !== null && errors !== void 0 ? errors : [];
3132
+ if (err instanceof UnsubscriptionError) {
3133
+ errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
3134
+ }
3135
+ else {
3136
+ errors.push(err);
3137
+ }
3138
+ }
3139
+ }
3140
+ }
3141
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3142
+ finally {
3143
+ try {
3144
+ if (_teardowns_1_1 && !_teardowns_1_1.done && (_b = _teardowns_1.return)) _b.call(_teardowns_1);
3145
+ }
3146
+ finally { if (e_2) throw e_2.error; }
3147
+ }
3148
+ }
3149
+ if (errors) {
3150
+ throw new UnsubscriptionError(errors);
3151
+ }
3152
+ }
3153
+ };
3154
+ Subscription.prototype.add = function (teardown) {
3155
+ var _a;
3156
+ if (teardown && teardown !== this) {
3157
+ if (this.closed) {
3158
+ execTeardown(teardown);
3159
+ }
3160
+ else {
3161
+ if (teardown instanceof Subscription) {
3162
+ if (teardown.closed || teardown._hasParent(this)) {
3163
+ return;
3164
+ }
3165
+ teardown._addParent(this);
3166
+ }
3167
+ (this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown);
3168
+ }
3169
+ }
3170
+ };
3171
+ Subscription.prototype._hasParent = function (parent) {
3172
+ var _parentage = this._parentage;
3173
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
3174
+ };
3175
+ Subscription.prototype._addParent = function (parent) {
3176
+ var _parentage = this._parentage;
3177
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
3178
+ };
3179
+ Subscription.prototype._removeParent = function (parent) {
3180
+ var _parentage = this._parentage;
3181
+ if (_parentage === parent) {
3182
+ this._parentage = null;
3183
+ }
3184
+ else if (Array.isArray(_parentage)) {
3185
+ arrRemove(_parentage, parent);
3186
+ }
3187
+ };
3188
+ Subscription.prototype.remove = function (teardown) {
3189
+ var _teardowns = this._teardowns;
3190
+ _teardowns && arrRemove(_teardowns, teardown);
3191
+ if (teardown instanceof Subscription) {
3192
+ teardown._removeParent(this);
3193
+ }
3194
+ };
3195
+ Subscription.EMPTY = (function () {
3196
+ var empty = new Subscription();
3197
+ empty.closed = true;
3198
+ return empty;
3199
+ })();
3200
+ return Subscription;
3201
+ }());
3202
+ var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
3203
+ function isSubscription(value) {
3204
+ return (value instanceof Subscription ||
3205
+ (value && 'closed' in value && isFunction$1(value.remove) && isFunction$1(value.add) && isFunction$1(value.unsubscribe)));
3206
+ }
3207
+ function execTeardown(teardown) {
3208
+ if (isFunction$1(teardown)) {
3209
+ teardown();
3210
+ }
3211
+ else {
3212
+ teardown.unsubscribe();
3213
+ }
3214
+ }
3215
+
3216
+ var config = {
3217
+ onUnhandledError: null,
3218
+ onStoppedNotification: null,
3219
+ Promise: undefined,
3220
+ useDeprecatedSynchronousErrorHandling: false,
3221
+ useDeprecatedNextContext: false,
3222
+ };
3223
+
3224
+ var timeoutProvider = {
3225
+ setTimeout: function () {
3226
+ var args = [];
3227
+ for (var _i = 0; _i < arguments.length; _i++) {
3228
+ args[_i] = arguments[_i];
3229
+ }
3230
+ var delegate = timeoutProvider.delegate;
3231
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args)));
3232
+ },
3233
+ clearTimeout: function (handle) {
3234
+ var delegate = timeoutProvider.delegate;
3235
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
3236
+ },
3237
+ delegate: undefined,
3238
+ };
3239
+
3240
+ function reportUnhandledError(err) {
3241
+ timeoutProvider.setTimeout(function () {
3242
+ {
3243
+ throw err;
3244
+ }
3245
+ });
3246
+ }
3247
+
3248
+ function noop() { }
3249
+
3250
+ var context = null;
3251
+ function errorContext(cb) {
3252
+ if (config.useDeprecatedSynchronousErrorHandling) {
3253
+ var isRoot = !context;
3254
+ if (isRoot) {
3255
+ context = { errorThrown: false, error: null };
3256
+ }
3257
+ cb();
3258
+ if (isRoot) {
3259
+ var _a = context, errorThrown = _a.errorThrown, error = _a.error;
3260
+ context = null;
3261
+ if (errorThrown) {
3262
+ throw error;
3263
+ }
3264
+ }
3265
+ }
3266
+ else {
3267
+ cb();
3268
+ }
3269
+ }
3270
+
3271
+ var Subscriber = (function (_super) {
3272
+ __extends(Subscriber, _super);
3273
+ function Subscriber(destination) {
3274
+ var _this = _super.call(this) || this;
3275
+ _this.isStopped = false;
3276
+ if (destination) {
3277
+ _this.destination = destination;
3278
+ if (isSubscription(destination)) {
3279
+ destination.add(_this);
3280
+ }
3281
+ }
3282
+ else {
3283
+ _this.destination = EMPTY_OBSERVER;
3284
+ }
3285
+ return _this;
3286
+ }
3287
+ Subscriber.create = function (next, error, complete) {
3288
+ return new SafeSubscriber(next, error, complete);
3289
+ };
3290
+ Subscriber.prototype.next = function (value) {
3291
+ if (this.isStopped) ;
3292
+ else {
3293
+ this._next(value);
3294
+ }
3295
+ };
3296
+ Subscriber.prototype.error = function (err) {
3297
+ if (this.isStopped) ;
3298
+ else {
3299
+ this.isStopped = true;
3300
+ this._error(err);
3301
+ }
3302
+ };
3303
+ Subscriber.prototype.complete = function () {
3304
+ if (this.isStopped) ;
3305
+ else {
3306
+ this.isStopped = true;
3307
+ this._complete();
3308
+ }
3309
+ };
3310
+ Subscriber.prototype.unsubscribe = function () {
3311
+ if (!this.closed) {
3312
+ this.isStopped = true;
3313
+ _super.prototype.unsubscribe.call(this);
3314
+ this.destination = null;
3315
+ }
3316
+ };
3317
+ Subscriber.prototype._next = function (value) {
3318
+ this.destination.next(value);
3319
+ };
3320
+ Subscriber.prototype._error = function (err) {
3321
+ try {
3322
+ this.destination.error(err);
3323
+ }
3324
+ finally {
3325
+ this.unsubscribe();
3326
+ }
3327
+ };
3328
+ Subscriber.prototype._complete = function () {
3329
+ try {
3330
+ this.destination.complete();
3331
+ }
3332
+ finally {
3333
+ this.unsubscribe();
3334
+ }
3335
+ };
3336
+ return Subscriber;
3337
+ }(Subscription));
3338
+ var SafeSubscriber = (function (_super) {
3339
+ __extends(SafeSubscriber, _super);
3340
+ function SafeSubscriber(observerOrNext, error, complete) {
3341
+ var _this = _super.call(this) || this;
3342
+ var next;
3343
+ if (isFunction$1(observerOrNext)) {
3344
+ next = observerOrNext;
3345
+ }
3346
+ else if (observerOrNext) {
3347
+ (next = observerOrNext.next, error = observerOrNext.error, complete = observerOrNext.complete);
3348
+ var context_1;
3349
+ if (_this && config.useDeprecatedNextContext) {
3350
+ context_1 = Object.create(observerOrNext);
3351
+ context_1.unsubscribe = function () { return _this.unsubscribe(); };
3352
+ }
3353
+ else {
3354
+ context_1 = observerOrNext;
3355
+ }
3356
+ next = next === null || next === void 0 ? void 0 : next.bind(context_1);
3357
+ error = error === null || error === void 0 ? void 0 : error.bind(context_1);
3358
+ complete = complete === null || complete === void 0 ? void 0 : complete.bind(context_1);
3359
+ }
3360
+ _this.destination = {
3361
+ next: next ? wrapForErrorHandling(next) : noop,
3362
+ error: wrapForErrorHandling(error !== null && error !== void 0 ? error : defaultErrorHandler),
3363
+ complete: complete ? wrapForErrorHandling(complete) : noop,
3364
+ };
3365
+ return _this;
3366
+ }
3367
+ return SafeSubscriber;
3368
+ }(Subscriber));
3369
+ function wrapForErrorHandling(handler, instance) {
3370
+ return function () {
3371
+ var args = [];
3372
+ for (var _i = 0; _i < arguments.length; _i++) {
3373
+ args[_i] = arguments[_i];
3374
+ }
3375
+ try {
3376
+ handler.apply(void 0, __spreadArray([], __read(args)));
3377
+ }
3378
+ catch (err) {
3379
+ {
3380
+ reportUnhandledError(err);
3381
+ }
3382
+ }
3383
+ };
3384
+ }
3385
+ function defaultErrorHandler(err) {
3386
+ throw err;
3387
+ }
3388
+ var EMPTY_OBSERVER = {
3389
+ closed: true,
3390
+ next: noop,
3391
+ error: defaultErrorHandler,
3392
+ complete: noop,
3393
+ };
3394
+
3395
+ var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
3396
+
3397
+ function identity(x) {
3398
+ return x;
3399
+ }
3400
+
3401
+ function pipeFromArray(fns) {
3402
+ if (fns.length === 0) {
3403
+ return identity;
3404
+ }
3405
+ if (fns.length === 1) {
3406
+ return fns[0];
3407
+ }
3408
+ return function piped(input) {
3409
+ return fns.reduce(function (prev, fn) { return fn(prev); }, input);
3410
+ };
3411
+ }
3412
+
3413
+ var Observable = (function () {
3414
+ function Observable(subscribe) {
3415
+ if (subscribe) {
3416
+ this._subscribe = subscribe;
3417
+ }
3418
+ }
3419
+ Observable.prototype.lift = function (operator) {
3420
+ var observable = new Observable();
3421
+ observable.source = this;
3422
+ observable.operator = operator;
3423
+ return observable;
3424
+ };
3425
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
3426
+ var _this = this;
3427
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
3428
+ errorContext(function () {
3429
+ var _a = _this, operator = _a.operator, source = _a.source;
3430
+ subscriber.add(operator
3431
+ ?
3432
+ operator.call(subscriber, source)
3433
+ : source
3434
+ ?
3435
+ _this._subscribe(subscriber)
3436
+ :
3437
+ _this._trySubscribe(subscriber));
3438
+ });
3439
+ return subscriber;
3440
+ };
3441
+ Observable.prototype._trySubscribe = function (sink) {
3442
+ try {
3443
+ return this._subscribe(sink);
3444
+ }
3445
+ catch (err) {
3446
+ sink.error(err);
3447
+ }
3448
+ };
3449
+ Observable.prototype.forEach = function (next, promiseCtor) {
3450
+ var _this = this;
3451
+ promiseCtor = getPromiseCtor(promiseCtor);
3452
+ return new promiseCtor(function (resolve, reject) {
3453
+ var subscription;
3454
+ subscription = _this.subscribe(function (value) {
3455
+ try {
3456
+ next(value);
3457
+ }
3458
+ catch (err) {
3459
+ reject(err);
3460
+ subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
3461
+ }
3462
+ }, reject, resolve);
3463
+ });
3464
+ };
3465
+ Observable.prototype._subscribe = function (subscriber) {
3466
+ var _a;
3467
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
3468
+ };
3469
+ Observable.prototype[observable] = function () {
3470
+ return this;
3471
+ };
3472
+ Observable.prototype.pipe = function () {
3473
+ var operations = [];
3474
+ for (var _i = 0; _i < arguments.length; _i++) {
3475
+ operations[_i] = arguments[_i];
3476
+ }
3477
+ return pipeFromArray(operations)(this);
3478
+ };
3479
+ Observable.prototype.toPromise = function (promiseCtor) {
3480
+ var _this = this;
3481
+ promiseCtor = getPromiseCtor(promiseCtor);
3482
+ return new promiseCtor(function (resolve, reject) {
3483
+ var value;
3484
+ _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
3485
+ });
3486
+ };
3487
+ Observable.create = function (subscribe) {
3488
+ return new Observable(subscribe);
3489
+ };
3490
+ return Observable;
3491
+ }());
3492
+ function getPromiseCtor(promiseCtor) {
3493
+ var _a;
3494
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
3495
+ }
3496
+ function isObserver(value) {
3497
+ return value && isFunction$1(value.next) && isFunction$1(value.error) && isFunction$1(value.complete);
3498
+ }
3499
+ function isSubscriber(value) {
3500
+ return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
3501
+ }
3502
+
3503
+ var ObjectUnsubscribedError = createErrorClass(function (_super) {
3504
+ return function ObjectUnsubscribedErrorImpl() {
3505
+ _super(this);
3506
+ this.name = 'ObjectUnsubscribedError';
3507
+ this.message = 'object unsubscribed';
3508
+ };
3509
+ });
3510
+
3511
+ var Subject = (function (_super) {
3512
+ __extends(Subject, _super);
3513
+ function Subject() {
3514
+ var _this = _super.call(this) || this;
3515
+ _this.closed = false;
3516
+ _this.observers = [];
3517
+ _this.isStopped = false;
3518
+ _this.hasError = false;
3519
+ _this.thrownError = null;
3520
+ return _this;
3521
+ }
3522
+ Subject.prototype.lift = function (operator) {
3523
+ var subject = new AnonymousSubject(this, this);
3524
+ subject.operator = operator;
3525
+ return subject;
3526
+ };
3527
+ Subject.prototype._throwIfClosed = function () {
3528
+ if (this.closed) {
3529
+ throw new ObjectUnsubscribedError();
3530
+ }
3531
+ };
3532
+ Subject.prototype.next = function (value) {
3533
+ var _this = this;
3534
+ errorContext(function () {
3535
+ var e_1, _a;
3536
+ _this._throwIfClosed();
3537
+ if (!_this.isStopped) {
3538
+ var copy = _this.observers.slice();
3539
+ try {
3540
+ for (var copy_1 = __values(copy), copy_1_1 = copy_1.next(); !copy_1_1.done; copy_1_1 = copy_1.next()) {
3541
+ var observer = copy_1_1.value;
3542
+ observer.next(value);
3543
+ }
3544
+ }
3545
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3546
+ finally {
3547
+ try {
3548
+ if (copy_1_1 && !copy_1_1.done && (_a = copy_1.return)) _a.call(copy_1);
3549
+ }
3550
+ finally { if (e_1) throw e_1.error; }
3551
+ }
3552
+ }
3553
+ });
3554
+ };
3555
+ Subject.prototype.error = function (err) {
3556
+ var _this = this;
3557
+ errorContext(function () {
3558
+ _this._throwIfClosed();
3559
+ if (!_this.isStopped) {
3560
+ _this.hasError = _this.isStopped = true;
3561
+ _this.thrownError = err;
3562
+ var observers = _this.observers;
3563
+ while (observers.length) {
3564
+ observers.shift().error(err);
3565
+ }
3566
+ }
3567
+ });
3568
+ };
3569
+ Subject.prototype.complete = function () {
3570
+ var _this = this;
3571
+ errorContext(function () {
3572
+ _this._throwIfClosed();
3573
+ if (!_this.isStopped) {
3574
+ _this.isStopped = true;
3575
+ var observers = _this.observers;
3576
+ while (observers.length) {
3577
+ observers.shift().complete();
3578
+ }
3579
+ }
3580
+ });
3581
+ };
3582
+ Subject.prototype.unsubscribe = function () {
3583
+ this.isStopped = this.closed = true;
3584
+ this.observers = null;
3585
+ };
3586
+ Object.defineProperty(Subject.prototype, "observed", {
3587
+ get: function () {
3588
+ var _a;
3589
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
3590
+ },
3591
+ enumerable: false,
3592
+ configurable: true
3593
+ });
3594
+ Subject.prototype._trySubscribe = function (subscriber) {
3595
+ this._throwIfClosed();
3596
+ return _super.prototype._trySubscribe.call(this, subscriber);
3597
+ };
3598
+ Subject.prototype._subscribe = function (subscriber) {
3599
+ this._throwIfClosed();
3600
+ this._checkFinalizedStatuses(subscriber);
3601
+ return this._innerSubscribe(subscriber);
3602
+ };
3603
+ Subject.prototype._innerSubscribe = function (subscriber) {
3604
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
3605
+ return hasError || isStopped
3606
+ ? EMPTY_SUBSCRIPTION
3607
+ : (observers.push(subscriber), new Subscription(function () { return arrRemove(observers, subscriber); }));
3608
+ };
3609
+ Subject.prototype._checkFinalizedStatuses = function (subscriber) {
3610
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
3611
+ if (hasError) {
3612
+ subscriber.error(thrownError);
3613
+ }
3614
+ else if (isStopped) {
3615
+ subscriber.complete();
3616
+ }
3617
+ };
3618
+ Subject.prototype.asObservable = function () {
3619
+ var observable = new Observable();
3620
+ observable.source = this;
3621
+ return observable;
3622
+ };
3623
+ Subject.create = function (destination, source) {
3624
+ return new AnonymousSubject(destination, source);
3625
+ };
3626
+ return Subject;
3627
+ }(Observable));
3628
+ var AnonymousSubject = (function (_super) {
3629
+ __extends(AnonymousSubject, _super);
3630
+ function AnonymousSubject(destination, source) {
3631
+ var _this = _super.call(this) || this;
3632
+ _this.destination = destination;
3633
+ _this.source = source;
3634
+ return _this;
3635
+ }
3636
+ AnonymousSubject.prototype.next = function (value) {
3637
+ var _a, _b;
3638
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
3639
+ };
3640
+ AnonymousSubject.prototype.error = function (err) {
3641
+ var _a, _b;
3642
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
3643
+ };
3644
+ AnonymousSubject.prototype.complete = function () {
3645
+ var _a, _b;
3646
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
3647
+ };
3648
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
3649
+ var _a, _b;
3650
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
3651
+ };
3652
+ return AnonymousSubject;
3653
+ }(Subject));
3654
+
3655
+ var es2018 = {};
3656
+
3657
+ var array = {};
3658
+
3659
+ array.isntEmptyArray = array.isEmptyArray = array.isntArray = array.isArray = void 0;
3660
+ function isArray(val) {
3661
+ return Array.isArray(val);
3662
+ }
3663
+ array.isArray = isArray;
3664
+ function isntArray(val) {
3665
+ return !isArray(val);
3666
+ }
3667
+ array.isntArray = isntArray;
3668
+ function isEmptyArray(val) {
3669
+ return val.length === 0;
3670
+ }
3671
+ array.isEmptyArray = isEmptyArray;
3672
+ function isntEmptyArray(val) {
3673
+ return val.length !== 0;
3674
+ }
3675
+ array.isntEmptyArray = isntEmptyArray;
3676
+
3677
+ var asyncIterable = {};
3678
+
3679
+ var _null = {};
3680
+
3681
+ _null.isntNull = _null.isNull = void 0;
3682
+ function isNull(val) {
3683
+ return val === null;
3684
+ }
3685
+ _null.isNull = isNull;
3686
+ function isntNull(val) {
3687
+ return !isNull(val);
3688
+ }
3689
+ _null.isntNull = isntNull;
3690
+
3691
+ var _undefined = {};
3692
+
3693
+ _undefined.isntUndefined = _undefined.isUndefined = void 0;
3694
+ function isUndefined(val) {
3695
+ return val === undefined;
3696
+ }
3697
+ _undefined.isUndefined = isUndefined;
3698
+ function isntUndefined(val) {
3699
+ return !isUndefined(val);
3700
+ }
3701
+ _undefined.isntUndefined = isntUndefined;
3702
+
3703
+ asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
3704
+ const null_1$1 = _null;
3705
+ const undefined_1$2 = _undefined;
3706
+ function isAsyncIterable(val) {
3707
+ return (0, null_1$1.isntNull)(val)
3708
+ && (0, undefined_1$2.isntUndefined)(val)
3709
+ && typeof val[Symbol.asyncIterator] === 'function';
3710
+ }
3711
+ asyncIterable.isAsyncIterable = isAsyncIterable;
3712
+ function isntAsyncIterable(val) {
3713
+ return !isAsyncIterable(val);
3714
+ }
3715
+ asyncIterable.isntAsyncIterable = isntAsyncIterable;
3716
+
3717
+ var bigint = {};
3718
+
3719
+ bigint.isntBigInt = bigint.isBigInt = void 0;
3720
+ function isBigInt(val) {
3721
+ return typeof val === 'bigint';
3722
+ }
3723
+ bigint.isBigInt = isBigInt;
3724
+ function isntBigInt(val) {
3725
+ return !isBigInt(val);
3726
+ }
3727
+ bigint.isntBigInt = isntBigInt;
3728
+
3729
+ var boolean = {};
3730
+
3731
+ boolean.isntBoolean = boolean.isBoolean = void 0;
3732
+ function isBoolean(val) {
3733
+ return typeof val === 'boolean';
3734
+ }
3735
+ boolean.isBoolean = isBoolean;
3736
+ function isntBoolean(val) {
3737
+ return !isBoolean(val);
3738
+ }
3739
+ boolean.isntBoolean = isntBoolean;
3740
+
3741
+ var char = {};
3742
+
3743
+ var string = {};
3744
+
3745
+ string.isntString = string.isString = void 0;
3746
+ function isString(val) {
3747
+ return typeof val === 'string';
3748
+ }
3749
+ string.isString = isString;
3750
+ function isntString(val) {
3751
+ return !isString(val);
3752
+ }
3753
+ string.isntString = isntString;
3754
+
3755
+ char.isntChar = char.isChar = void 0;
3756
+ const string_1$1 = string;
3757
+ function isChar(val) {
3758
+ return (0, string_1$1.isString)(val)
3759
+ && val.length === 1;
3760
+ }
3761
+ char.isChar = isChar;
3762
+ function isntChar(val) {
3763
+ return !isChar(val);
3764
+ }
3765
+ char.isntChar = isntChar;
3766
+
3767
+ var date = {};
3768
+
3769
+ date.isntDate = date.isDate = void 0;
3770
+ function isDate(val) {
3771
+ return val instanceof Date;
3772
+ }
3773
+ date.isDate = isDate;
3774
+ function isntDate(val) {
3775
+ return !isDate(val);
3776
+ }
3777
+ date.isntDate = isntDate;
3778
+
3779
+ var _enum = {};
3780
+
3781
+ _enum.inEnum = void 0;
3782
+ function inEnum(val, _enum) {
3783
+ return Object.values(_enum).includes(val);
3784
+ }
3785
+ _enum.inEnum = inEnum;
3786
+
3787
+ var error = {};
3788
+
3789
+ error.isntError = error.isError = void 0;
3790
+ function isError(val) {
3791
+ return val instanceof Error;
3792
+ }
3793
+ error.isError = isError;
3794
+ function isntError(val) {
3795
+ return !isError(val);
3796
+ }
3797
+ error.isntError = isntError;
3798
+
3799
+ var falsy = {};
3800
+
3801
+ falsy.isntFalsy = falsy.isFalsy = void 0;
3802
+ function isFalsy(val) {
3803
+ return !val;
3804
+ }
3805
+ falsy.isFalsy = isFalsy;
3806
+ function isntFalsy(val) {
3807
+ return !isFalsy(val);
3808
+ }
3809
+ falsy.isntFalsy = isntFalsy;
3810
+
3811
+ var _function = {};
3812
+
3813
+ _function.isntFunction = _function.isFunction = void 0;
3814
+ function isFunction(val) {
3815
+ return typeof val === 'function';
3816
+ }
3817
+ _function.isFunction = isFunction;
3818
+ function isntFunction(val) {
3819
+ return !isFunction(val);
3820
+ }
3821
+ _function.isntFunction = isntFunction;
3822
+
3823
+ var iterable = {};
3824
+
3825
+ iterable.isntIterable = iterable.isIterable = void 0;
3826
+ const null_1 = _null;
3827
+ const undefined_1$1 = _undefined;
3828
+ function isIterable(val) {
3829
+ return (0, null_1.isntNull)(val)
3830
+ && (0, undefined_1$1.isntUndefined)(val)
3831
+ && typeof val[Symbol.iterator] === 'function';
3832
+ }
3833
+ iterable.isIterable = isIterable;
3834
+ function isntIterable(val) {
3835
+ return !isIterable(val);
3836
+ }
3837
+ iterable.isntIterable = isntIterable;
3838
+
3839
+ var jsonRpc = {};
3840
+
3841
+ var object = {};
3842
+
3843
+ object.isntEmptyObject = object.isEmptyObject = object.isRecord = object.isntObject = object.isObject = void 0;
3844
+ function isObject(val) {
3845
+ return val !== null && typeof val === 'object';
3846
+ }
3847
+ object.isObject = isObject;
3848
+ function isntObject(val) {
3849
+ return !isObject(val);
3850
+ }
3851
+ object.isntObject = isntObject;
3852
+ function isRecord(val) {
3853
+ return isObject(val);
3854
+ }
3855
+ object.isRecord = isRecord;
3856
+ function isEmptyObject(val) {
3857
+ return Object.keys(val).length === 0;
3858
+ }
3859
+ object.isEmptyObject = isEmptyObject;
3860
+ function isntEmptyObject(val) {
3861
+ return Object.keys(val).length !== 0;
3862
+ }
3863
+ object.isntEmptyObject = isntEmptyObject;
3864
+
3865
+ var number = {};
3866
+
3867
+ number.isntNumber = number.isNumber = void 0;
3868
+ function isNumber(val) {
3869
+ return typeof val === 'number';
3870
+ }
3871
+ number.isNumber = isNumber;
3872
+ function isntNumber(val) {
3873
+ return !isNumber(val);
3874
+ }
3875
+ number.isntNumber = isntNumber;
3876
+
3877
+ jsonRpc.isntJsonRpcError = jsonRpc.isJsonRpcError = jsonRpc.isntJsonRpcSuccess = jsonRpc.isJsonRpcSuccess = jsonRpc.isntJsonRpcRequest = jsonRpc.isJsonRpcRequest = jsonRpc.isntJsonRpcNotification = jsonRpc.isJsonRpcNotification = void 0;
3878
+ const array_1 = array;
3879
+ const object_1 = object;
3880
+ const string_1 = string;
3881
+ const number_1 = number;
3882
+ const undefined_1 = _undefined;
3883
+ function isJsonRpcId(val) {
3884
+ return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
3885
+ }
3886
+ function isJsonRpcParams(val) {
3887
+ return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
3888
+ }
3889
+ function isJsonRpcNotification(val) {
3890
+ return (0, object_1.isRecord)(val)
3891
+ && (0, string_1.isString)(val.jsonrpc)
3892
+ && (0, string_1.isString)(val.method)
3893
+ && (0, undefined_1.isUndefined)(val.id)
3894
+ && isJsonRpcParams(val.params);
3895
+ }
3896
+ jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
3897
+ function isntJsonRpcNotification(val) {
3898
+ return !isJsonRpcNotification(val);
3899
+ }
3900
+ jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
3901
+ function isJsonRpcRequest(val) {
3902
+ return (0, object_1.isRecord)(val)
3903
+ && (0, string_1.isString)(val.jsonrpc)
3904
+ && (0, string_1.isString)(val.method)
3905
+ && isJsonRpcId(val.id)
3906
+ && isJsonRpcParams(val.params);
3907
+ }
3908
+ jsonRpc.isJsonRpcRequest = isJsonRpcRequest;
3909
+ function isntJsonRpcRequest(val) {
3910
+ return !isJsonRpcRequest(val);
3911
+ }
3912
+ jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
3913
+ function isJsonRpcSuccess(val) {
3914
+ return (0, object_1.isRecord)(val)
3915
+ && (0, string_1.isString)(val.jsonrpc)
3916
+ && (0, string_1.isString)(val.id)
3917
+ && 'result' in val;
3918
+ }
3919
+ jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
3920
+ function isntJsonRpcSuccess(val) {
3921
+ return !isJsonRpcSuccess(val);
3922
+ }
3923
+ jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
3924
+ function isJsonRpcError(val) {
3925
+ return (0, object_1.isRecord)(val)
3926
+ && (0, string_1.isString)(val.jsonrpc)
3927
+ && isJsonRpcId(val.id)
3928
+ && isJsonRpcErrorObject(val.error);
3929
+ }
3930
+ jsonRpc.isJsonRpcError = isJsonRpcError;
3931
+ function isntJsonRpcError(val) {
3932
+ return !isJsonRpcError(val);
3933
+ }
3934
+ jsonRpc.isntJsonRpcError = isntJsonRpcError;
3935
+ function isJsonRpcErrorObject(val) {
3936
+ return (0, object_1.isRecord)(val)
3937
+ && (0, number_1.isNumber)(val.code)
3938
+ && (0, string_1.isString)(val.message)
3939
+ && ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
3940
+ }
3941
+
3942
+ var json = {};
3943
+
3944
+ json.isntJson = json.isJson = void 0;
3945
+ function isJson(val) {
3946
+ try {
3947
+ JSON.stringify(val);
3948
+ return true;
3949
+ }
3950
+ catch (_a) {
3951
+ return false;
3952
+ }
3953
+ }
3954
+ json.isJson = isJson;
3955
+ function isntJson(val) {
3956
+ return !isntJson();
3957
+ }
3958
+ json.isntJson = isntJson;
3959
+
3960
+ var url = {};
3961
+
3962
+ url.isAbsoluteURL = void 0;
3963
+ function isAbsoluteURL(str) {
3964
+ try {
3965
+ new URL(str);
3966
+ return true;
3967
+ }
3968
+ catch (_a) {
3969
+ return false;
3970
+ }
3971
+ }
3972
+ url.isAbsoluteURL = isAbsoluteURL;
3973
+
3974
+ (function (exports) {
3975
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3976
+ if (k2 === undefined) k2 = k;
3977
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3978
+ }) : (function(o, m, k, k2) {
3979
+ if (k2 === undefined) k2 = k;
3980
+ o[k2] = m[k];
3981
+ }));
3982
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3983
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3984
+ };__exportStar(array, exports);
3985
+ __exportStar(asyncIterable, exports);
3986
+ __exportStar(bigint, exports);
3987
+ __exportStar(boolean, exports);
3988
+ __exportStar(char, exports);
3989
+ __exportStar(date, exports);
3990
+ __exportStar(_enum, exports);
3991
+ __exportStar(error, exports);
3992
+ __exportStar(falsy, exports);
3993
+ __exportStar(_function, exports);
3994
+ __exportStar(iterable, exports);
3995
+ __exportStar(jsonRpc, exports);
3996
+ __exportStar(json, exports);
3997
+ __exportStar(_null, exports);
3998
+ __exportStar(number, exports);
3999
+ __exportStar(object, exports);
4000
+ __exportStar(string, exports);
4001
+ __exportStar(_undefined, exports);
4002
+ __exportStar(url, exports);
4003
+
4004
+ }(es2018));
4005
+
4006
+ class ObservableFiniteStateMachine extends FiniteStateMachine {
4007
+ constructor() {
4008
+ super(...arguments);
4009
+ this.stateChanges = new Subject();
4010
+ }
4011
+ observeStateChanges() {
4012
+ return this.stateChanges;
4013
+ }
4014
+ /**
4015
+ * @throws {BadEventError}
4016
+ */
4017
+ send(event) {
4018
+ const oldState = this.state;
4019
+ super.send(event);
4020
+ const newState = this.state;
4021
+ this.stateChanges.next({ event, oldState, newState });
4022
+ if (es2018.isEmptyObject(this.schema[newState])) {
4023
+ this.stateChanges.complete();
4024
+ }
4025
+ }
4026
+ }
4027
+
4028
+ exports.BadEventError = BadEventError;
4029
+ exports.Box = Box;
2855
4030
  exports.Emitter = Emitter;
2856
4031
  exports.ExpirableMap = ExpirableMap;
4032
+ exports.FiniteStateMachine = FiniteStateMachine;
2857
4033
  exports.HashMap = HashMap;
2858
4034
  exports.HashSet = HashSet;
2859
4035
  exports.LRUMap = LRUMap;
4036
+ exports.ObservableFiniteStateMachine = ObservableFiniteStateMachine;
2860
4037
  exports.Queue = Queue;
2861
4038
  exports.TLRUMap = TLRUMap;
2862
4039
  exports.TrieMap = TrieMap;
@@ -2865,5 +4042,5 @@
2865
4042
 
2866
4043
  Object.defineProperty(exports, '__esModule', { value: true });
2867
4044
 
2868
- })));
4045
+ }));
2869
4046
  //# sourceMappingURL=index.umd.js.map