websocket-ts 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/cjs/src/backoff/backoff.d.ts +24 -0
  2. package/dist/cjs/src/backoff/backoff.d.ts.map +1 -0
  3. package/dist/cjs/src/backoff/backoff.js +3 -0
  4. package/dist/cjs/src/backoff/backoff.js.map +1 -0
  5. package/dist/cjs/src/backoff/constantbackoff.d.ts +18 -0
  6. package/dist/cjs/src/backoff/constantbackoff.d.ts.map +1 -0
  7. package/dist/cjs/src/backoff/constantbackoff.js +43 -0
  8. package/dist/cjs/src/backoff/constantbackoff.js.map +1 -0
  9. package/dist/cjs/src/backoff/exponentialbackoff.d.ts +48 -0
  10. package/dist/cjs/src/backoff/exponentialbackoff.d.ts.map +1 -0
  11. package/dist/cjs/src/backoff/exponentialbackoff.js +81 -0
  12. package/dist/cjs/src/backoff/exponentialbackoff.js.map +1 -0
  13. package/dist/cjs/src/backoff/linearbackoff.d.ts +51 -0
  14. package/dist/cjs/src/backoff/linearbackoff.d.ts.map +1 -0
  15. package/dist/cjs/src/backoff/linearbackoff.js +89 -0
  16. package/dist/cjs/src/backoff/linearbackoff.js.map +1 -0
  17. package/dist/cjs/src/index.d.ts +14 -0
  18. package/dist/cjs/src/index.d.ts.map +1 -0
  19. package/dist/cjs/src/index.js +20 -0
  20. package/dist/cjs/src/index.js.map +1 -0
  21. package/dist/cjs/src/queue/array_queue.d.ts +17 -0
  22. package/dist/cjs/src/queue/array_queue.d.ts.map +1 -0
  23. package/dist/cjs/src/queue/array_queue.js +36 -0
  24. package/dist/cjs/src/queue/array_queue.js.map +1 -0
  25. package/dist/cjs/src/queue/queue.d.ts +41 -0
  26. package/dist/cjs/src/queue/queue.d.ts.map +1 -0
  27. package/dist/cjs/src/queue/queue.js +3 -0
  28. package/dist/cjs/src/queue/queue.js.map +1 -0
  29. package/dist/cjs/src/queue/ring_queue.d.ts +20 -0
  30. package/dist/cjs/src/queue/ring_queue.d.ts.map +1 -0
  31. package/dist/cjs/src/queue/ring_queue.js +57 -0
  32. package/dist/cjs/src/queue/ring_queue.js.map +1 -0
  33. package/dist/cjs/src/websocket.d.ts +206 -0
  34. package/dist/cjs/src/websocket.d.ts.map +1 -0
  35. package/dist/cjs/src/websocket.js +434 -0
  36. package/dist/cjs/src/websocket.js.map +1 -0
  37. package/dist/cjs/src/websocket_buffer.d.ts +16 -0
  38. package/dist/cjs/src/websocket_buffer.d.ts.map +1 -0
  39. package/dist/cjs/src/websocket_buffer.js +3 -0
  40. package/dist/cjs/src/websocket_buffer.js.map +1 -0
  41. package/dist/cjs/src/websocket_builder.d.ts +147 -0
  42. package/dist/cjs/src/websocket_builder.d.ts.map +1 -0
  43. package/dist/cjs/src/websocket_builder.js +263 -0
  44. package/dist/cjs/src/websocket_builder.js.map +1 -0
  45. package/dist/cjs/src/websocket_event.d.ts +67 -0
  46. package/dist/cjs/src/websocket_event.d.ts.map +1 -0
  47. package/dist/cjs/src/websocket_event.js +22 -0
  48. package/dist/cjs/src/websocket_event.js.map +1 -0
  49. package/dist/cjs/src/websocket_options.d.ts +21 -0
  50. package/dist/cjs/src/websocket_options.d.ts.map +1 -0
  51. package/dist/cjs/src/websocket_options.js +3 -0
  52. package/dist/cjs/src/websocket_options.js.map +1 -0
  53. package/dist/cjs/src/websocket_retry_options.d.ts +20 -0
  54. package/dist/cjs/src/websocket_retry_options.d.ts.map +1 -0
  55. package/dist/cjs/src/websocket_retry_options.js +3 -0
  56. package/dist/cjs/src/websocket_retry_options.js.map +1 -0
  57. package/dist/esm/src/backoff/backoff.d.ts +24 -0
  58. package/dist/esm/src/backoff/backoff.d.ts.map +1 -0
  59. package/dist/esm/src/backoff/backoff.js +2 -0
  60. package/dist/esm/src/backoff/backoff.js.map +1 -0
  61. package/dist/esm/src/backoff/constantbackoff.d.ts +18 -0
  62. package/dist/esm/src/backoff/constantbackoff.d.ts.map +1 -0
  63. package/dist/esm/src/backoff/constantbackoff.js +30 -0
  64. package/dist/esm/src/backoff/constantbackoff.js.map +1 -0
  65. package/dist/esm/src/backoff/exponentialbackoff.d.ts +48 -0
  66. package/dist/esm/src/backoff/exponentialbackoff.d.ts.map +1 -0
  67. package/dist/esm/src/backoff/exponentialbackoff.js +68 -0
  68. package/dist/esm/src/backoff/exponentialbackoff.js.map +1 -0
  69. package/dist/esm/src/backoff/linearbackoff.d.ts +51 -0
  70. package/dist/esm/src/backoff/linearbackoff.d.ts.map +1 -0
  71. package/dist/esm/src/backoff/linearbackoff.js +76 -0
  72. package/dist/esm/src/backoff/linearbackoff.js.map +1 -0
  73. package/dist/esm/src/index.d.ts +14 -0
  74. package/dist/esm/src/index.d.ts.map +1 -0
  75. package/dist/esm/src/index.js +9 -0
  76. package/dist/esm/src/index.js.map +1 -0
  77. package/dist/esm/src/queue/array_queue.d.ts +17 -0
  78. package/dist/esm/src/queue/array_queue.d.ts.map +1 -0
  79. package/dist/esm/src/queue/array_queue.js +31 -0
  80. package/dist/esm/src/queue/array_queue.js.map +1 -0
  81. package/dist/esm/src/queue/queue.d.ts +41 -0
  82. package/dist/esm/src/queue/queue.d.ts.map +1 -0
  83. package/dist/esm/src/queue/queue.js +2 -0
  84. package/dist/esm/src/queue/queue.js.map +1 -0
  85. package/dist/esm/src/queue/ring_queue.d.ts +20 -0
  86. package/dist/esm/src/queue/ring_queue.d.ts.map +1 -0
  87. package/dist/esm/src/queue/ring_queue.js +52 -0
  88. package/dist/esm/src/queue/ring_queue.js.map +1 -0
  89. package/dist/esm/src/websocket.d.ts +206 -0
  90. package/dist/esm/src/websocket.d.ts.map +1 -0
  91. package/dist/esm/src/websocket.js +356 -0
  92. package/dist/esm/src/websocket.js.map +1 -0
  93. package/dist/esm/src/websocket_buffer.d.ts +16 -0
  94. package/dist/esm/src/websocket_buffer.d.ts.map +1 -0
  95. package/dist/esm/src/websocket_buffer.js +2 -0
  96. package/dist/esm/src/websocket_buffer.js.map +1 -0
  97. package/dist/esm/src/websocket_builder.d.ts +147 -0
  98. package/dist/esm/src/websocket_builder.d.ts.map +1 -0
  99. package/dist/esm/src/websocket_builder.js +213 -0
  100. package/dist/esm/src/websocket_builder.js.map +1 -0
  101. package/dist/esm/src/websocket_event.d.ts +67 -0
  102. package/dist/esm/src/websocket_event.d.ts.map +1 -0
  103. package/dist/esm/src/websocket_event.js +19 -0
  104. package/dist/esm/src/websocket_event.js.map +1 -0
  105. package/dist/esm/src/websocket_options.d.ts +21 -0
  106. package/dist/esm/src/websocket_options.d.ts.map +1 -0
  107. package/dist/esm/src/websocket_options.js +2 -0
  108. package/dist/esm/src/websocket_options.js.map +1 -0
  109. package/dist/esm/src/websocket_retry_options.d.ts +20 -0
  110. package/dist/esm/src/websocket_retry_options.d.ts.map +1 -0
  111. package/dist/esm/src/websocket_retry_options.js +2 -0
  112. package/dist/esm/src/websocket_retry_options.js.map +1 -0
  113. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constantbackoff.d.ts","sourceRoot":"","sources":["../../../../src/backoff/constantbackoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,qBAAa,eAAgB,YAAW,OAAO;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAa;IAE7B;;;OAGG;gBACS,OAAO,EAAE,MAAM;IAQ3B,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,IAAI,MAAM;IAKd,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * ConstantBackoff always returns the same backoff-time.
3
+ */
4
+ export class ConstantBackoff {
5
+ /**
6
+ * Creates a new ConstantBackoff.
7
+ * @param backoff the backoff-time to return
8
+ */
9
+ constructor(backoff) {
10
+ this._retries = 0;
11
+ if (!Number.isInteger(backoff) || backoff < 0) {
12
+ throw new Error("Backoff must be a positive integer");
13
+ }
14
+ this.backoff = backoff;
15
+ }
16
+ get retries() {
17
+ return this._retries;
18
+ }
19
+ get current() {
20
+ return this.backoff;
21
+ }
22
+ next() {
23
+ this._retries++;
24
+ return this.backoff;
25
+ }
26
+ reset() {
27
+ this._retries = 0;
28
+ }
29
+ }
30
+ //# sourceMappingURL=constantbackoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constantbackoff.js","sourceRoot":"","sources":["../../../../src/backoff/constantbackoff.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,eAAe;IAI1B;;;OAGG;IACH,YAAY,OAAe;QANnB,aAAQ,GAAW,CAAC,CAAC;QAO3B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;SACvD;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ import { Backoff } from "./backoff";
2
+ /**
3
+ * ExponentialBackoff increases the backoff-time exponentially.
4
+ * An optional maximum can be provided as an upper bound to the
5
+ * exponent and thus to the returned backoff.
6
+ *
7
+ * The series can be described as ('i' is the current step/retry):
8
+ * backoff = base * 2^i | without bound
9
+ * backoff = base * 2^min(i, expMax) | with bound
10
+ *
11
+ * Example:
12
+ *
13
+ * 1) Without bound:
14
+ * base = 1000, expMax = undefined
15
+ * backoff = 1000 * 2^0 = 1000 // first retry
16
+ * backoff = 1000 * 2^1 = 2000 // second retry
17
+ * backoff = 1000 * 2^2 = 4000 // ...doubles with every retry
18
+ * backoff = 1000 * 2^3 = 8000
19
+ * backoff = 1000 * 2^4 = 16000
20
+ * ... // and so on
21
+ *
22
+ * 2) With bound:
23
+ * base = 1000, expMax = 3
24
+ * backoff = 1000 * 2^0 = 1000 // first retry
25
+ * backoff = 1000 * 2^1 = 2000 // second retry
26
+ * backoff = 1000 * 2^2 = 4000 // third retry
27
+ * backoff = 1000 * 2^3 = 8000 // maximum reached, don't increase further
28
+ * backoff = 1000 * 2^3 = 8000
29
+ * backoff = 1000 * 2^3 = 8000
30
+ * ... // and so on
31
+ */
32
+ export declare class ExponentialBackoff implements Backoff {
33
+ private readonly base;
34
+ private readonly expMax?;
35
+ private i;
36
+ private _retries;
37
+ /**
38
+ * Creates a new ExponentialBackoff.
39
+ * @param base the base of the exponentiation
40
+ * @param expMax the maximum exponent, no bound if undefined
41
+ */
42
+ constructor(base: number, expMax?: number);
43
+ get retries(): number;
44
+ get current(): number;
45
+ next(): number;
46
+ reset(): void;
47
+ }
48
+ //# sourceMappingURL=exponentialbackoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exponentialbackoff.d.ts","sourceRoot":"","sources":["../../../../src/backoff/exponentialbackoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,kBAAmB,YAAW,OAAO;IAChD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,QAAQ,CAAa;IAE7B;;;;OAIG;gBACS,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAazC,IAAI,OAAO,WAEV;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,IAAI,MAAM;IASd,KAAK,IAAI,IAAI;CAId"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * ExponentialBackoff increases the backoff-time exponentially.
3
+ * An optional maximum can be provided as an upper bound to the
4
+ * exponent and thus to the returned backoff.
5
+ *
6
+ * The series can be described as ('i' is the current step/retry):
7
+ * backoff = base * 2^i | without bound
8
+ * backoff = base * 2^min(i, expMax) | with bound
9
+ *
10
+ * Example:
11
+ *
12
+ * 1) Without bound:
13
+ * base = 1000, expMax = undefined
14
+ * backoff = 1000 * 2^0 = 1000 // first retry
15
+ * backoff = 1000 * 2^1 = 2000 // second retry
16
+ * backoff = 1000 * 2^2 = 4000 // ...doubles with every retry
17
+ * backoff = 1000 * 2^3 = 8000
18
+ * backoff = 1000 * 2^4 = 16000
19
+ * ... // and so on
20
+ *
21
+ * 2) With bound:
22
+ * base = 1000, expMax = 3
23
+ * backoff = 1000 * 2^0 = 1000 // first retry
24
+ * backoff = 1000 * 2^1 = 2000 // second retry
25
+ * backoff = 1000 * 2^2 = 4000 // third retry
26
+ * backoff = 1000 * 2^3 = 8000 // maximum reached, don't increase further
27
+ * backoff = 1000 * 2^3 = 8000
28
+ * backoff = 1000 * 2^3 = 8000
29
+ * ... // and so on
30
+ */
31
+ export class ExponentialBackoff {
32
+ /**
33
+ * Creates a new ExponentialBackoff.
34
+ * @param base the base of the exponentiation
35
+ * @param expMax the maximum exponent, no bound if undefined
36
+ */
37
+ constructor(base, expMax) {
38
+ this._retries = 0;
39
+ if (!Number.isInteger(base) || base < 0) {
40
+ throw new Error("Base must be a positive integer or zero");
41
+ }
42
+ if (expMax !== undefined && (!Number.isInteger(expMax) || expMax < 0)) {
43
+ throw new Error("ExpMax must be a undefined, a positive integer or zero");
44
+ }
45
+ this.base = base;
46
+ this.expMax = expMax;
47
+ this.i = 0;
48
+ }
49
+ get retries() {
50
+ return this._retries;
51
+ }
52
+ get current() {
53
+ return this.base * Math.pow(2, this.i);
54
+ }
55
+ next() {
56
+ this._retries++;
57
+ this.i =
58
+ this.expMax === undefined
59
+ ? this.i + 1
60
+ : Math.min(this.i + 1, this.expMax);
61
+ return this.current;
62
+ }
63
+ reset() {
64
+ this._retries = 0;
65
+ this.i = 0;
66
+ }
67
+ }
68
+ //# sourceMappingURL=exponentialbackoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exponentialbackoff.js","sourceRoot":"","sources":["../../../../src/backoff/exponentialbackoff.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,kBAAkB;IAM7B;;;;OAIG;IACH,YAAY,IAAY,EAAE,MAAe;QAPjC,aAAQ,GAAW,CAAC,CAAC;QAQ3B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC5D;QACD,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,EAAE;YACrE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;SAC3E;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,IAAI;QACF,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,CAAC;YACJ,IAAI,CAAC,MAAM,KAAK,SAAS;gBACvB,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;gBACZ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF"}
@@ -0,0 +1,51 @@
1
+ import { Backoff } from "./backoff";
2
+ /**
3
+ * LinearBackoff returns a backoff-time that is incremented by a fixed amount
4
+ * with every step/retry. An optional maximum can be provided as an upper bound
5
+ * to the returned backoff.
6
+ *
7
+ * The series can be described as ('i' is the current step/retry):
8
+ * backoff = initial + increment * i | without bound
9
+ * backoff = initial + increment * min(i, max) | with bound
10
+ *
11
+ * Example:
12
+ *
13
+ * 1) Without bound:
14
+ * initial = 1000, increment = 1000
15
+ * backoff = 1000 + 1000 * 0 = 1000 // first retry
16
+ * backoff = 1000 + 1000 * 1 = 2000 // second retry
17
+ * backoff = 1000 + 1000 * 2 = 3000 // ...increases by 'increment' with every retry
18
+ * backoff = 1000 + 1000 * 3 = 4000
19
+ * backoff = 1000 + 1000 * 4 = 5000
20
+ * ... // and so on
21
+ *
22
+ * 2) With bound:
23
+ * initial = 1000, increment = 1000, max = 5000
24
+ * backoff = 1000 + 1000 * 0 = 1000 // first retry
25
+ * backoff = 1000 + 1000 * 1 = 2000 // second retry
26
+ * backoff = 1000 + 1000 * 2 = 3000 // third retry
27
+ * backoff = 1000 + 1000 * 3 = 4000 // fourth retry
28
+ * backoff = 1000 + 1000 * 4 = 5000 // maximum reached, don't increase further
29
+ * backoff = 1000 + 1000 * 4 = 5000
30
+ * backoff = 1000 + 1000 * 4 = 5000
31
+ * ... // and so on
32
+ */
33
+ export declare class LinearBackoff implements Backoff {
34
+ private readonly initial;
35
+ private readonly increment;
36
+ private readonly max?;
37
+ private i;
38
+ private _retries;
39
+ /**
40
+ * Creates a new LinearBackoff.
41
+ * @param initial the initial backoff-time in milliseconds
42
+ * @param increment the amount to increment the backoff-time with every step (in milliseconds)
43
+ * @param max the maximum backoff-time (in milliseconds), no bound if undefined
44
+ */
45
+ constructor(initial: number, increment: number, max?: number);
46
+ get retries(): number;
47
+ get current(): number;
48
+ next(): number;
49
+ reset(): void;
50
+ }
51
+ //# sourceMappingURL=linearbackoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linearbackoff.d.ts","sourceRoot":"","sources":["../../../../src/backoff/linearbackoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAS;IAC9B,OAAO,CAAC,CAAC,CAAa;IACtB,OAAO,CAAC,QAAQ,CAAa;IAE7B;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAqB5D,IAAI,OAAO,WAEV;IAED,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,IAAI,MAAM;IAMd,KAAK,IAAI,IAAI;CAId"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * LinearBackoff returns a backoff-time that is incremented by a fixed amount
3
+ * with every step/retry. An optional maximum can be provided as an upper bound
4
+ * to the returned backoff.
5
+ *
6
+ * The series can be described as ('i' is the current step/retry):
7
+ * backoff = initial + increment * i | without bound
8
+ * backoff = initial + increment * min(i, max) | with bound
9
+ *
10
+ * Example:
11
+ *
12
+ * 1) Without bound:
13
+ * initial = 1000, increment = 1000
14
+ * backoff = 1000 + 1000 * 0 = 1000 // first retry
15
+ * backoff = 1000 + 1000 * 1 = 2000 // second retry
16
+ * backoff = 1000 + 1000 * 2 = 3000 // ...increases by 'increment' with every retry
17
+ * backoff = 1000 + 1000 * 3 = 4000
18
+ * backoff = 1000 + 1000 * 4 = 5000
19
+ * ... // and so on
20
+ *
21
+ * 2) With bound:
22
+ * initial = 1000, increment = 1000, max = 5000
23
+ * backoff = 1000 + 1000 * 0 = 1000 // first retry
24
+ * backoff = 1000 + 1000 * 1 = 2000 // second retry
25
+ * backoff = 1000 + 1000 * 2 = 3000 // third retry
26
+ * backoff = 1000 + 1000 * 3 = 4000 // fourth retry
27
+ * backoff = 1000 + 1000 * 4 = 5000 // maximum reached, don't increase further
28
+ * backoff = 1000 + 1000 * 4 = 5000
29
+ * backoff = 1000 + 1000 * 4 = 5000
30
+ * ... // and so on
31
+ */
32
+ export class LinearBackoff {
33
+ /**
34
+ * Creates a new LinearBackoff.
35
+ * @param initial the initial backoff-time in milliseconds
36
+ * @param increment the amount to increment the backoff-time with every step (in milliseconds)
37
+ * @param max the maximum backoff-time (in milliseconds), no bound if undefined
38
+ */
39
+ constructor(initial, increment, max) {
40
+ this.i = 0;
41
+ this._retries = 0;
42
+ if (initial < 0) {
43
+ throw new Error("Initial must be a positive number or zero");
44
+ }
45
+ if (increment < 0) {
46
+ throw new Error("Increment must be a positive number or zero");
47
+ }
48
+ if (max !== undefined && max < 0) {
49
+ throw new Error("Max must be undefined, a positive number or zero");
50
+ }
51
+ if (max !== undefined && max < initial) {
52
+ throw new Error("Max must be undefined or greater than or equal to initial");
53
+ }
54
+ this.initial = initial;
55
+ this.increment = increment;
56
+ this.max = max;
57
+ }
58
+ get retries() {
59
+ return this._retries;
60
+ }
61
+ get current() {
62
+ return this.max === undefined
63
+ ? this.initial + this.increment * this.i
64
+ : Math.min(this.initial + this.increment * this.i, this.max);
65
+ }
66
+ next() {
67
+ this._retries++;
68
+ this.i++;
69
+ return this.current;
70
+ }
71
+ reset() {
72
+ this._retries = 0;
73
+ this.i = 0;
74
+ }
75
+ }
76
+ //# sourceMappingURL=linearbackoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linearbackoff.js","sourceRoot":"","sources":["../../../../src/backoff/linearbackoff.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,aAAa;IAOxB;;;;;OAKG;IACH,YAAY,OAAe,EAAE,SAAiB,EAAE,GAAY;QATpD,MAAC,GAAW,CAAC,CAAC;QACd,aAAQ,GAAW,CAAC,CAAC;QAS3B,IAAI,OAAO,GAAG,CAAC,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;SAC9D;QACD,IAAI,SAAS,GAAG,CAAC,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;SAChE;QACD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACrE;QACD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,OAAO,EAAE;YACtC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;SACH;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,GAAG,KAAK,SAAS;YAC3B,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;YACxC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IAED,IAAI;QACF,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,CAAC,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ export { Backoff } from "./backoff/backoff";
2
+ export { ConstantBackoff } from "./backoff/constantbackoff";
3
+ export { ExponentialBackoff } from "./backoff/exponentialbackoff";
4
+ export { LinearBackoff } from "./backoff/linearbackoff";
5
+ export { Queue } from "./queue/queue";
6
+ export { ArrayQueue } from "./queue/array_queue";
7
+ export { RingQueue } from "./queue/ring_queue";
8
+ export { Websocket } from "./websocket";
9
+ export { WebsocketBuffer } from "./websocket_buffer";
10
+ export { WebsocketBuilder } from "./websocket_builder";
11
+ export { WebsocketEvent, RetryEventDetail, ReconnectEventDetail, WebsocketEventMap, WebsocketEventListener, WebsocketEventListenerParams, WebsocketEventListenerOptions, WebsocketEventListenerWithOptions, WebsocketEventListeners, } from "./websocket_event";
12
+ export { WebsocketOptions } from "./websocket_options";
13
+ export { WebsocketConnectionRetryOptions } from "./websocket_retry_options";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EACjC,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { ConstantBackoff } from "./backoff/constantbackoff";
2
+ export { ExponentialBackoff } from "./backoff/exponentialbackoff";
3
+ export { LinearBackoff } from "./backoff/linearbackoff";
4
+ export { ArrayQueue } from "./queue/array_queue";
5
+ export { RingQueue } from "./queue/ring_queue";
6
+ export { Websocket } from "./websocket";
7
+ export { WebsocketBuilder } from "./websocket_builder";
8
+ export { WebsocketEvent, } from "./websocket_event";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,cAAc,GASf,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Queue } from "./queue";
2
+ /**
3
+ * An array queue is a queue that has an unbounded capacity. Reading from an array queue
4
+ * will return the oldest element and effectively remove it from the queue.
5
+ */
6
+ export declare class ArrayQueue<E> implements Queue<E> {
7
+ private readonly elements;
8
+ constructor();
9
+ add(element: E): void;
10
+ clear(): void;
11
+ forEach(fn: (element: E) => unknown): void;
12
+ length(): number;
13
+ isEmpty(): boolean;
14
+ peek(): E | undefined;
15
+ read(): E | undefined;
16
+ }
17
+ //# sourceMappingURL=array_queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_queue.d.ts","sourceRoot":"","sources":["../../../../src/queue/array_queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,KAAK,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAM;;IAM/B,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI;IAIrB,KAAK;IAIL,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO;IAInC,MAAM,IAAI,MAAM;IAIhB,OAAO,IAAI,OAAO;IAIlB,IAAI,IAAI,CAAC,GAAG,SAAS;IAIrB,IAAI,IAAI,CAAC,GAAG,SAAS;CAGtB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * An array queue is a queue that has an unbounded capacity. Reading from an array queue
3
+ * will return the oldest element and effectively remove it from the queue.
4
+ */
5
+ export class ArrayQueue {
6
+ constructor() {
7
+ this.elements = [];
8
+ }
9
+ add(element) {
10
+ this.elements.push(element);
11
+ }
12
+ clear() {
13
+ this.elements.length = 0;
14
+ }
15
+ forEach(fn) {
16
+ this.elements.forEach(fn);
17
+ }
18
+ length() {
19
+ return this.elements.length;
20
+ }
21
+ isEmpty() {
22
+ return this.elements.length === 0;
23
+ }
24
+ peek() {
25
+ return this.elements[0];
26
+ }
27
+ read() {
28
+ return this.elements.shift();
29
+ }
30
+ }
31
+ //# sourceMappingURL=array_queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_queue.js","sourceRoot":"","sources":["../../../../src/queue/array_queue.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,UAAU;IAGrB;QACE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,GAAG,CAAC,OAAU;QACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,CAAC,EAA2B;QACjC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * A queue holds elements until they are read. The order in which elements are
3
+ * read is determined by the implementation of the queue.
4
+ */
5
+ export interface Queue<E> {
6
+ /**
7
+ * Adds an element to the queue.
8
+ * @param element the element to add
9
+ */
10
+ add(element: E): void;
11
+ /**
12
+ * Clears the queue, removing all elements.
13
+ */
14
+ clear(): void;
15
+ /**
16
+ * Calls the given function for each element in the queue.
17
+ * @param fn the function to call
18
+ */
19
+ forEach(fn: (element: E) => unknown): void;
20
+ /**
21
+ * Number of elements in the queue.
22
+ * @return the number of elements in the queue
23
+ */
24
+ length(): number;
25
+ /**
26
+ * Whether the queue is empty.
27
+ * @return true if the queue is empty, false otherwise
28
+ */
29
+ isEmpty(): boolean;
30
+ /**
31
+ * Returns the next element in the queue without removing it.
32
+ * @return the next element in the queue, or undefined if the queue is empty
33
+ */
34
+ peek(): E | undefined;
35
+ /**
36
+ * Removes and returns the next element in the queue.
37
+ * @return the next element in the queue, or undefined if the queue is empty
38
+ */
39
+ read(): E | undefined;
40
+ }
41
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../../src/queue/queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB;;;OAGG;IACH,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAEtB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,GAAG,IAAI,CAAC;IAE3C;;;OAGG;IACH,MAAM,IAAI,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;;OAGG;IACH,IAAI,IAAI,CAAC,GAAG,SAAS,CAAC;IAEtB;;;OAGG;IACH,IAAI,IAAI,CAAC,GAAG,SAAS,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../../src/queue/queue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { Queue } from "./queue";
2
+ /**
3
+ * A ring queue is a queue that has a fixed capacity. When the queue is full, the oldest element is
4
+ * removed to make room for the new element. Reading from a ring queue will return the oldest
5
+ * element and effectively remove it from the queue.
6
+ */
7
+ export declare class RingQueue<E> implements Queue<E> {
8
+ private readonly elements;
9
+ private head;
10
+ private tail;
11
+ constructor(capacity: number);
12
+ add(element: E): void;
13
+ clear(): void;
14
+ forEach(fn: (element: E) => unknown): void;
15
+ length(): number;
16
+ isEmpty(): boolean;
17
+ peek(): E | undefined;
18
+ read(): E | undefined;
19
+ }
20
+ //# sourceMappingURL=ring_queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ring_queue.d.ts","sourceRoot":"","sources":["../../../../src/queue/ring_queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;GAIG;AACH,qBAAa,SAAS,CAAC,CAAC,CAAE,YAAW,KAAK,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAM;IAC/B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;gBAET,QAAQ,EAAE,MAAM;IAU5B,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI;IAQrB,KAAK;IAKL,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO;IAUnC,MAAM,IAAI,MAAM;IAQhB,OAAO,IAAI,OAAO;IAIlB,IAAI,IAAI,CAAC,GAAG,SAAS;IAIrB,IAAI,IAAI,CAAC,GAAG,SAAS;CAOtB"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * A ring queue is a queue that has a fixed capacity. When the queue is full, the oldest element is
3
+ * removed to make room for the new element. Reading from a ring queue will return the oldest
4
+ * element and effectively remove it from the queue.
5
+ */
6
+ export class RingQueue {
7
+ constructor(capacity) {
8
+ if (!Number.isInteger(capacity) || capacity <= 0) {
9
+ throw new Error("Capacity must be a positive integer");
10
+ }
11
+ this.elements = new Array(capacity + 1); // +1 to distinguish between full and empty
12
+ this.head = 0;
13
+ this.tail = 0;
14
+ }
15
+ add(element) {
16
+ this.elements[this.head] = element;
17
+ this.head = (this.head + 1) % this.elements.length;
18
+ if (this.head === this.tail) {
19
+ this.tail = (this.tail + 1) % this.elements.length;
20
+ }
21
+ }
22
+ clear() {
23
+ this.head = 0;
24
+ this.tail = 0;
25
+ }
26
+ forEach(fn) {
27
+ for (let i = this.tail; i !== this.head; i = (i + 1) % this.elements.length) {
28
+ fn(this.elements[i]);
29
+ }
30
+ }
31
+ length() {
32
+ return this.tail === this.head
33
+ ? 0
34
+ : this.tail < this.head
35
+ ? this.head - this.tail
36
+ : this.elements.length - this.tail + this.head;
37
+ }
38
+ isEmpty() {
39
+ return this.head === this.tail;
40
+ }
41
+ peek() {
42
+ return this.isEmpty() ? undefined : this.elements[this.tail];
43
+ }
44
+ read() {
45
+ const e = this.peek();
46
+ if (e !== undefined) {
47
+ this.tail = (this.tail + 1) % this.elements.length;
48
+ }
49
+ return e;
50
+ }
51
+ }
52
+ //# sourceMappingURL=ring_queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ring_queue.js","sourceRoot":"","sources":["../../../../src/queue/ring_queue.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAKpB,YAAY,QAAgB;QAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE;YAChD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,2CAA2C;QACvF,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAChB,CAAC;IAED,GAAG,CAAC,OAAU;QACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QACnD,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;YAC3B,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;SACpD;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,EAA2B;QACjC,KACE,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EACjB,CAAC,KAAK,IAAI,CAAC,IAAI,EACf,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAClC;YACA,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;SACtB;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;YAC5B,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;gBACvB,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;gBACvB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACnD,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;IACjC,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,SAAS,EAAE;YACnB,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;SACpD;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}