@flarehr/apollo-super-selection 3.51.59881 → 3.54.61365

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 (162) hide show
  1. package/dist/lib/apollo-super-selection/apollo-super-selection.css +1 -0
  2. package/dist/lib/apollo-super-selection/apollo-super-selection.esm.js +1 -1
  3. package/dist/lib/apollo-super-selection/apollo-super-selection.js +1 -1
  4. package/dist/lib/apollo-super-selection/assets/icon-check.svg +3 -0
  5. package/dist/lib/apollo-super-selection/assets/icon-exclamation.svg +3 -0
  6. package/dist/lib/apollo-super-selection/assets/icon-information-circle.svg +3 -0
  7. package/dist/lib/apollo-super-selection/p-03373b03.system.js +1 -0
  8. package/dist/lib/apollo-super-selection/p-14885f78.system.js +15 -0
  9. package/dist/lib/apollo-super-selection/{p-381262c1.system.js → p-15f0e5eb.system.js} +1 -1
  10. package/dist/lib/apollo-super-selection/p-29c11183.js +15 -0
  11. package/dist/lib/apollo-super-selection/p-37369ee1.system.entry.js +69 -0
  12. package/dist/lib/apollo-super-selection/p-52c08b79.entry.js +14 -0
  13. package/dist/lib/apollo-super-selection/p-86e3e03f.js +1 -0
  14. package/dist/lib/cjs/apollo-super-selection.cjs.js +3 -4
  15. package/dist/lib/cjs/{app-globals-45007120.js → app-globals-b1125d8c.js} +1 -1
  16. package/dist/lib/cjs/{datorama-akita-7f4b082a.js → datorama-akita-6c9cb8fb.js} +1005 -68
  17. package/dist/lib/cjs/loader.cjs.js +3 -4
  18. package/dist/lib/cjs/{fl-button_31.cjs.entry.js → sss-button_28.cjs.entry.js} +2096 -2162
  19. package/dist/lib/collection/apollo-super-selection.css +1 -0
  20. package/dist/lib/collection/collection-manifest.json +16 -28
  21. package/dist/lib/collection/components/app-host/loading-page.js +3 -3
  22. package/dist/lib/collection/components/app-host/super-selection-app-host.css +0 -4
  23. package/dist/lib/collection/components/app-host/super-selection-app-host.js +7 -19
  24. package/dist/lib/collection/components/super-selection-app/api/super-selection.api.dto.js +69 -1
  25. package/dist/lib/collection/components/super-selection-app/api/super-selection.api.js +9 -3
  26. package/dist/lib/collection/components/super-selection-app/app-state-pages/success.js +16 -21
  27. package/dist/lib/collection/components/super-selection-app/assets/icon-check.svg +3 -0
  28. package/dist/lib/collection/components/super-selection-app/assets/icon-exclamation.svg +3 -0
  29. package/dist/lib/collection/components/super-selection-app/assets/icon-information-circle.svg +3 -0
  30. package/dist/lib/collection/components/super-selection-app/consent/consent.js +57 -0
  31. package/dist/lib/collection/components/super-selection-app/existing-choice/existing-choice.js +131 -0
  32. package/dist/lib/collection/components/super-selection-app/footer-section/footer-section.js +6 -18
  33. package/dist/lib/collection/components/super-selection-app/funds/constants.js +50 -0
  34. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/custom-fund.js +32 -16
  35. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/custom-fund.store.js +10 -14
  36. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/default-fund/default-fund.js +36 -45
  37. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.js +40 -19
  38. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.js +45 -40
  39. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.js +104 -58
  40. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.js +53 -49
  41. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-not-supported.js +6 -16
  42. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund-join-page.js +1 -1
  43. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund.store.js +1 -4
  44. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/services/promoted-fund-join-iframe-builder.js +10 -4
  45. package/dist/lib/collection/components/super-selection-app/funds/slate-super/services/slate-iframe-builder.js +13 -4
  46. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-join-page.js +2 -3
  47. package/dist/lib/collection/components/super-selection-app/header-section/header-section.js +28 -0
  48. package/dist/lib/collection/components/super-selection-app/misc/button.js +146 -0
  49. package/dist/lib/collection/components/super-selection-app/misc/dropdown-async.css +7 -0
  50. package/dist/lib/collection/components/super-selection-app/misc/dropdown-async.js +359 -0
  51. package/dist/lib/collection/components/super-selection-app/misc/loading-indicator.js +52 -0
  52. package/dist/lib/collection/components/super-selection-app/services/australian-fund-lookup.service.js +8 -4
  53. package/dist/lib/collection/components/super-selection-app/services/event-tracking.service.js +20 -0
  54. package/dist/lib/collection/components/super-selection-app/services/existing-super-choice-info.service.js +95 -0
  55. package/dist/lib/collection/components/super-selection-app/services/navigation.service.js +8 -0
  56. package/dist/lib/collection/components/super-selection-app/services/super-selection-app.routes.js +6 -4
  57. package/dist/lib/collection/components/super-selection-app/standard-choice/standard-choice-form.js +69 -34
  58. package/dist/lib/collection/components/super-selection-app/standard-choice/standard-choice-form.store.js +10 -0
  59. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-bottom.js +94 -0
  60. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-top.js +89 -0
  61. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-page.js +67 -90
  62. package/dist/lib/collection/components/super-selection-app/super-selection-app.css +16 -4
  63. package/dist/lib/collection/components/super-selection-app/super-selection-app.js +54 -11
  64. package/dist/lib/esm/apollo-super-selection.js +3 -4
  65. package/dist/lib/esm/{app-globals-7ac1ffba.js → app-globals-c1f89805.js} +1 -1
  66. package/dist/lib/esm/{datorama-akita-79ce4385.js → datorama-akita-127aea91.js} +960 -28
  67. package/dist/lib/esm/loader.js +3 -4
  68. package/dist/lib/esm/{fl-button_31.entry.js → sss-button_28.entry.js} +2083 -2146
  69. package/dist/lib/esm-es5/apollo-super-selection.js +1 -1
  70. package/dist/lib/esm-es5/{app-globals-7ac1ffba.js → app-globals-c1f89805.js} +1 -1
  71. package/dist/lib/esm-es5/datorama-akita-127aea91.js +15 -0
  72. package/dist/lib/esm-es5/loader.js +1 -1
  73. package/dist/lib/esm-es5/sss-button_28.entry.js +69 -0
  74. package/dist/lib/types/components/app-host/super-selection-app-host.d.ts +0 -3
  75. package/dist/lib/types/components/super-selection-app/api/super-selection-events.model.d.ts +30 -0
  76. package/dist/lib/types/components/super-selection-app/api/super-selection.api.d.ts +2 -1
  77. package/dist/lib/types/components/super-selection-app/api/super-selection.api.dto.d.ts +19 -4
  78. package/dist/lib/types/components/super-selection-app/consent/consent.d.ts +9 -0
  79. package/dist/lib/types/components/super-selection-app/existing-choice/existing-choice.d.ts +12 -0
  80. package/dist/lib/types/components/super-selection-app/footer-section/footer-section.d.ts +0 -1
  81. package/dist/lib/types/components/super-selection-app/funds/constants.d.ts +3 -0
  82. package/dist/lib/types/components/super-selection-app/funds/custom-fund/custom-fund.d.ts +1 -1
  83. package/dist/lib/types/components/super-selection-app/funds/custom-fund/custom-fund.store.d.ts +4 -6
  84. package/dist/lib/types/components/super-selection-app/funds/custom-fund/default-fund/default-fund.d.ts +0 -2
  85. package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.d.ts +2 -1
  86. package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.d.ts +1 -0
  87. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.d.ts +7 -0
  88. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.d.ts +1 -0
  89. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.form.d.ts +0 -1
  90. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/promoted-fund.store.d.ts +0 -3
  91. package/dist/lib/types/components/super-selection-app/header-section/header-section.d.ts +4 -0
  92. package/dist/lib/types/components/super-selection-app/misc/button.d.ts +11 -0
  93. package/dist/lib/types/components/super-selection-app/misc/dropdown-async.d.ts +44 -0
  94. package/dist/lib/types/components/super-selection-app/misc/loading-indicator.d.ts +5 -0
  95. package/dist/lib/types/components/super-selection-app/services/australian-fund-lookup.service.d.ts +1 -0
  96. package/dist/lib/types/components/super-selection-app/services/event-tracking.service.d.ts +4 -0
  97. package/dist/lib/types/components/super-selection-app/services/existing-super-choice-info.service.d.ts +51 -0
  98. package/dist/lib/types/components/super-selection-app/services/navigation.service.d.ts +6 -0
  99. package/dist/lib/types/components/super-selection-app/services/super-selection-app.routes.d.ts +3 -2
  100. package/dist/lib/types/components/super-selection-app/standard-choice/standard-choice-form.d.ts +6 -3
  101. package/dist/lib/types/components/super-selection-app/standard-choice/standard-choice-form.store.d.ts +8 -0
  102. package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-bottom.d.ts +9 -0
  103. package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-item/super-choice-item-top.d.ts +7 -0
  104. package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-page.d.ts +0 -3
  105. package/dist/lib/types/components/super-selection-app/super-selection-app.d.ts +2 -1
  106. package/dist/lib/types/components.d.ts +148 -97
  107. package/package.json +12 -7
  108. package/dist/lib/apollo-super-selection/assets/logo-qsuper-square.png +0 -0
  109. package/dist/lib/apollo-super-selection/assets/logo-qsuper.png +0 -0
  110. package/dist/lib/apollo-super-selection/p-13573238.system.js +0 -15
  111. package/dist/lib/apollo-super-selection/p-342cee5a.js +0 -1
  112. package/dist/lib/apollo-super-selection/p-38f24f69.js +0 -1
  113. package/dist/lib/apollo-super-selection/p-5c1ee0f8.system.entry.js +0 -69
  114. package/dist/lib/apollo-super-selection/p-64ebe17d.system.entry.js +0 -1
  115. package/dist/lib/apollo-super-selection/p-7dbe5a2f.system.js +0 -1
  116. package/dist/lib/apollo-super-selection/p-9317c049.entry.js +0 -14
  117. package/dist/lib/apollo-super-selection/p-d82b00ed.system.js +0 -1
  118. package/dist/lib/apollo-super-selection/p-df9ce4b7.js +0 -15
  119. package/dist/lib/apollo-super-selection/p-f7a45412.entry.js +0 -1
  120. package/dist/lib/cjs/delay-81aff2f1.js +0 -955
  121. package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -90
  122. package/dist/lib/collection/components/super-selection-app/footer-section/footer-section.css +0 -11
  123. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-not-supported.css +0 -23
  124. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund-standard-choice-page.js +0 -62
  125. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-fund.store.js +0 -10
  126. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-standard-choice-page.js +0 -67
  127. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slatesuper-header.css +0 -0
  128. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slatesuper-header.js +0 -19
  129. package/dist/lib/collection/components/super-selection-app/notifications-section/notifications-section.js +0 -25
  130. package/dist/lib/collection/components/super-selection-app/services/notifications.service.js +0 -37
  131. package/dist/lib/collection/components/super-selection-app/services/notifications.store.js +0 -3
  132. package/dist/lib/collection/components/super-selection-app/services/selected-super-choice-info.service.js +0 -50
  133. package/dist/lib/collection/components/super-selection-app/standard-choice/api/standard-choice.model.js +0 -1
  134. package/dist/lib/collection/components/super-selection-app/super-choice-page/assets/logo-qsuper-square.png +0 -0
  135. package/dist/lib/collection/components/super-selection-app/super-choice-page/assets/logo-qsuper.png +0 -0
  136. package/dist/lib/collection/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.css +0 -18
  137. package/dist/lib/collection/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.js +0 -53
  138. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-item.js +0 -296
  139. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-page.css +0 -70
  140. package/dist/lib/esm/delay-c0555599.js +0 -935
  141. package/dist/lib/esm/fl-style-guide.entry.js +0 -86
  142. package/dist/lib/esm-es5/datorama-akita-79ce4385.js +0 -15
  143. package/dist/lib/esm-es5/delay-c0555599.js +0 -1
  144. package/dist/lib/esm-es5/fl-button_31.entry.js +0 -69
  145. package/dist/lib/esm-es5/fl-style-guide.entry.js +0 -1
  146. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -45
  147. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
  148. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
  149. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
  150. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
  151. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
  152. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/promoted-fund-standard-choice-page.d.ts +0 -8
  153. package/dist/lib/types/components/super-selection-app/funds/slate-super/slate-fund.store.d.ts +0 -7
  154. package/dist/lib/types/components/super-selection-app/funds/slate-super/slate-standard-choice-page.d.ts +0 -8
  155. package/dist/lib/types/components/super-selection-app/funds/slate-super/slatesuper-header.d.ts +0 -3
  156. package/dist/lib/types/components/super-selection-app/notifications-section/notifications-section.d.ts +0 -5
  157. package/dist/lib/types/components/super-selection-app/services/notifications.service.d.ts +0 -15
  158. package/dist/lib/types/components/super-selection-app/services/notifications.store.d.ts +0 -14
  159. package/dist/lib/types/components/super-selection-app/services/selected-super-choice-info.service.d.ts +0 -18
  160. package/dist/lib/types/components/super-selection-app/standard-choice/api/standard-choice.model.d.ts +0 -3
  161. package/dist/lib/types/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.d.ts +0 -5
  162. package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-item.d.ts +0 -22
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const delay = require('./delay-81aff2f1.js');
4
-
5
3
  /*! *****************************************************************************
6
4
  Copyright (c) Microsoft Corporation.
7
5
 
@@ -40,6 +38,571 @@ function __metadata(metadataKey, metadataValue) {
40
38
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
41
39
  }
42
40
 
41
+ function isFunction(x) {
42
+ return typeof x === 'function';
43
+ }
44
+
45
+ let _enable_super_gross_mode_that_will_cause_bad_things = false;
46
+ const config = {
47
+ Promise: undefined,
48
+ set useDeprecatedSynchronousErrorHandling(value) {
49
+ if (value) {
50
+ const error = new Error();
51
+ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
52
+ }
53
+ else if (_enable_super_gross_mode_that_will_cause_bad_things) {
54
+ console.log('RxJS: Back to a better error behavior. Thank you. <3');
55
+ }
56
+ _enable_super_gross_mode_that_will_cause_bad_things = value;
57
+ },
58
+ get useDeprecatedSynchronousErrorHandling() {
59
+ return _enable_super_gross_mode_that_will_cause_bad_things;
60
+ },
61
+ };
62
+
63
+ function hostReportError(err) {
64
+ setTimeout(() => { throw err; }, 0);
65
+ }
66
+
67
+ const empty = {
68
+ closed: true,
69
+ next(value) { },
70
+ error(err) {
71
+ if (config.useDeprecatedSynchronousErrorHandling) {
72
+ throw err;
73
+ }
74
+ else {
75
+ hostReportError(err);
76
+ }
77
+ },
78
+ complete() { }
79
+ };
80
+
81
+ const isArray = (() => Array.isArray || ((x) => x && typeof x.length === 'number'))();
82
+
83
+ function isObject(x) {
84
+ return x !== null && typeof x === 'object';
85
+ }
86
+
87
+ const UnsubscriptionErrorImpl = (() => {
88
+ function UnsubscriptionErrorImpl(errors) {
89
+ Error.call(this);
90
+ this.message = errors ?
91
+ `${errors.length} errors occurred during unsubscription:
92
+ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
93
+ this.name = 'UnsubscriptionError';
94
+ this.errors = errors;
95
+ return this;
96
+ }
97
+ UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype);
98
+ return UnsubscriptionErrorImpl;
99
+ })();
100
+ const UnsubscriptionError = UnsubscriptionErrorImpl;
101
+
102
+ class Subscription {
103
+ constructor(unsubscribe) {
104
+ this.closed = false;
105
+ this._parentOrParents = null;
106
+ this._subscriptions = null;
107
+ if (unsubscribe) {
108
+ this._ctorUnsubscribe = true;
109
+ this._unsubscribe = unsubscribe;
110
+ }
111
+ }
112
+ unsubscribe() {
113
+ let errors;
114
+ if (this.closed) {
115
+ return;
116
+ }
117
+ let { _parentOrParents, _ctorUnsubscribe, _unsubscribe, _subscriptions } = this;
118
+ this.closed = true;
119
+ this._parentOrParents = null;
120
+ this._subscriptions = null;
121
+ if (_parentOrParents instanceof Subscription) {
122
+ _parentOrParents.remove(this);
123
+ }
124
+ else if (_parentOrParents !== null) {
125
+ for (let index = 0; index < _parentOrParents.length; ++index) {
126
+ const parent = _parentOrParents[index];
127
+ parent.remove(this);
128
+ }
129
+ }
130
+ if (isFunction(_unsubscribe)) {
131
+ if (_ctorUnsubscribe) {
132
+ this._unsubscribe = undefined;
133
+ }
134
+ try {
135
+ _unsubscribe.call(this);
136
+ }
137
+ catch (e) {
138
+ errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
139
+ }
140
+ }
141
+ if (isArray(_subscriptions)) {
142
+ let index = -1;
143
+ let len = _subscriptions.length;
144
+ while (++index < len) {
145
+ const sub = _subscriptions[index];
146
+ if (isObject(sub)) {
147
+ try {
148
+ sub.unsubscribe();
149
+ }
150
+ catch (e) {
151
+ errors = errors || [];
152
+ if (e instanceof UnsubscriptionError) {
153
+ errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
154
+ }
155
+ else {
156
+ errors.push(e);
157
+ }
158
+ }
159
+ }
160
+ }
161
+ }
162
+ if (errors) {
163
+ throw new UnsubscriptionError(errors);
164
+ }
165
+ }
166
+ add(teardown) {
167
+ let subscription = teardown;
168
+ if (!teardown) {
169
+ return Subscription.EMPTY;
170
+ }
171
+ switch (typeof teardown) {
172
+ case 'function':
173
+ subscription = new Subscription(teardown);
174
+ case 'object':
175
+ if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
176
+ return subscription;
177
+ }
178
+ else if (this.closed) {
179
+ subscription.unsubscribe();
180
+ return subscription;
181
+ }
182
+ else if (!(subscription instanceof Subscription)) {
183
+ const tmp = subscription;
184
+ subscription = new Subscription();
185
+ subscription._subscriptions = [tmp];
186
+ }
187
+ break;
188
+ default: {
189
+ throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
190
+ }
191
+ }
192
+ let { _parentOrParents } = subscription;
193
+ if (_parentOrParents === null) {
194
+ subscription._parentOrParents = this;
195
+ }
196
+ else if (_parentOrParents instanceof Subscription) {
197
+ if (_parentOrParents === this) {
198
+ return subscription;
199
+ }
200
+ subscription._parentOrParents = [_parentOrParents, this];
201
+ }
202
+ else if (_parentOrParents.indexOf(this) === -1) {
203
+ _parentOrParents.push(this);
204
+ }
205
+ else {
206
+ return subscription;
207
+ }
208
+ const subscriptions = this._subscriptions;
209
+ if (subscriptions === null) {
210
+ this._subscriptions = [subscription];
211
+ }
212
+ else {
213
+ subscriptions.push(subscription);
214
+ }
215
+ return subscription;
216
+ }
217
+ remove(subscription) {
218
+ const subscriptions = this._subscriptions;
219
+ if (subscriptions) {
220
+ const subscriptionIndex = subscriptions.indexOf(subscription);
221
+ if (subscriptionIndex !== -1) {
222
+ subscriptions.splice(subscriptionIndex, 1);
223
+ }
224
+ }
225
+ }
226
+ }
227
+ Subscription.EMPTY = (function (empty) {
228
+ empty.closed = true;
229
+ return empty;
230
+ }(new Subscription()));
231
+ function flattenUnsubscriptionErrors(errors) {
232
+ return errors.reduce((errs, err) => errs.concat((err instanceof UnsubscriptionError) ? err.errors : err), []);
233
+ }
234
+
235
+ const rxSubscriber = (() => typeof Symbol === 'function'
236
+ ? Symbol('rxSubscriber')
237
+ : '@@rxSubscriber_' + Math.random())();
238
+
239
+ class Subscriber extends Subscription {
240
+ constructor(destinationOrNext, error, complete) {
241
+ super();
242
+ this.syncErrorValue = null;
243
+ this.syncErrorThrown = false;
244
+ this.syncErrorThrowable = false;
245
+ this.isStopped = false;
246
+ switch (arguments.length) {
247
+ case 0:
248
+ this.destination = empty;
249
+ break;
250
+ case 1:
251
+ if (!destinationOrNext) {
252
+ this.destination = empty;
253
+ break;
254
+ }
255
+ if (typeof destinationOrNext === 'object') {
256
+ if (destinationOrNext instanceof Subscriber) {
257
+ this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
258
+ this.destination = destinationOrNext;
259
+ destinationOrNext.add(this);
260
+ }
261
+ else {
262
+ this.syncErrorThrowable = true;
263
+ this.destination = new SafeSubscriber(this, destinationOrNext);
264
+ }
265
+ break;
266
+ }
267
+ default:
268
+ this.syncErrorThrowable = true;
269
+ this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
270
+ break;
271
+ }
272
+ }
273
+ [rxSubscriber]() { return this; }
274
+ static create(next, error, complete) {
275
+ const subscriber = new Subscriber(next, error, complete);
276
+ subscriber.syncErrorThrowable = false;
277
+ return subscriber;
278
+ }
279
+ next(value) {
280
+ if (!this.isStopped) {
281
+ this._next(value);
282
+ }
283
+ }
284
+ error(err) {
285
+ if (!this.isStopped) {
286
+ this.isStopped = true;
287
+ this._error(err);
288
+ }
289
+ }
290
+ complete() {
291
+ if (!this.isStopped) {
292
+ this.isStopped = true;
293
+ this._complete();
294
+ }
295
+ }
296
+ unsubscribe() {
297
+ if (this.closed) {
298
+ return;
299
+ }
300
+ this.isStopped = true;
301
+ super.unsubscribe();
302
+ }
303
+ _next(value) {
304
+ this.destination.next(value);
305
+ }
306
+ _error(err) {
307
+ this.destination.error(err);
308
+ this.unsubscribe();
309
+ }
310
+ _complete() {
311
+ this.destination.complete();
312
+ this.unsubscribe();
313
+ }
314
+ _unsubscribeAndRecycle() {
315
+ const { _parentOrParents } = this;
316
+ this._parentOrParents = null;
317
+ this.unsubscribe();
318
+ this.closed = false;
319
+ this.isStopped = false;
320
+ this._parentOrParents = _parentOrParents;
321
+ return this;
322
+ }
323
+ }
324
+ class SafeSubscriber extends Subscriber {
325
+ constructor(_parentSubscriber, observerOrNext, error, complete) {
326
+ super();
327
+ this._parentSubscriber = _parentSubscriber;
328
+ let next;
329
+ let context = this;
330
+ if (isFunction(observerOrNext)) {
331
+ next = observerOrNext;
332
+ }
333
+ else if (observerOrNext) {
334
+ next = observerOrNext.next;
335
+ error = observerOrNext.error;
336
+ complete = observerOrNext.complete;
337
+ if (observerOrNext !== empty) {
338
+ context = Object.create(observerOrNext);
339
+ if (isFunction(context.unsubscribe)) {
340
+ this.add(context.unsubscribe.bind(context));
341
+ }
342
+ context.unsubscribe = this.unsubscribe.bind(this);
343
+ }
344
+ }
345
+ this._context = context;
346
+ this._next = next;
347
+ this._error = error;
348
+ this._complete = complete;
349
+ }
350
+ next(value) {
351
+ if (!this.isStopped && this._next) {
352
+ const { _parentSubscriber } = this;
353
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
354
+ this.__tryOrUnsub(this._next, value);
355
+ }
356
+ else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
357
+ this.unsubscribe();
358
+ }
359
+ }
360
+ }
361
+ error(err) {
362
+ if (!this.isStopped) {
363
+ const { _parentSubscriber } = this;
364
+ const { useDeprecatedSynchronousErrorHandling } = config;
365
+ if (this._error) {
366
+ if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
367
+ this.__tryOrUnsub(this._error, err);
368
+ this.unsubscribe();
369
+ }
370
+ else {
371
+ this.__tryOrSetError(_parentSubscriber, this._error, err);
372
+ this.unsubscribe();
373
+ }
374
+ }
375
+ else if (!_parentSubscriber.syncErrorThrowable) {
376
+ this.unsubscribe();
377
+ if (useDeprecatedSynchronousErrorHandling) {
378
+ throw err;
379
+ }
380
+ hostReportError(err);
381
+ }
382
+ else {
383
+ if (useDeprecatedSynchronousErrorHandling) {
384
+ _parentSubscriber.syncErrorValue = err;
385
+ _parentSubscriber.syncErrorThrown = true;
386
+ }
387
+ else {
388
+ hostReportError(err);
389
+ }
390
+ this.unsubscribe();
391
+ }
392
+ }
393
+ }
394
+ complete() {
395
+ if (!this.isStopped) {
396
+ const { _parentSubscriber } = this;
397
+ if (this._complete) {
398
+ const wrappedComplete = () => this._complete.call(this._context);
399
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
400
+ this.__tryOrUnsub(wrappedComplete);
401
+ this.unsubscribe();
402
+ }
403
+ else {
404
+ this.__tryOrSetError(_parentSubscriber, wrappedComplete);
405
+ this.unsubscribe();
406
+ }
407
+ }
408
+ else {
409
+ this.unsubscribe();
410
+ }
411
+ }
412
+ }
413
+ __tryOrUnsub(fn, value) {
414
+ try {
415
+ fn.call(this._context, value);
416
+ }
417
+ catch (err) {
418
+ this.unsubscribe();
419
+ if (config.useDeprecatedSynchronousErrorHandling) {
420
+ throw err;
421
+ }
422
+ else {
423
+ hostReportError(err);
424
+ }
425
+ }
426
+ }
427
+ __tryOrSetError(parent, fn, value) {
428
+ if (!config.useDeprecatedSynchronousErrorHandling) {
429
+ throw new Error('bad call');
430
+ }
431
+ try {
432
+ fn.call(this._context, value);
433
+ }
434
+ catch (err) {
435
+ if (config.useDeprecatedSynchronousErrorHandling) {
436
+ parent.syncErrorValue = err;
437
+ parent.syncErrorThrown = true;
438
+ return true;
439
+ }
440
+ else {
441
+ hostReportError(err);
442
+ return true;
443
+ }
444
+ }
445
+ return false;
446
+ }
447
+ _unsubscribe() {
448
+ const { _parentSubscriber } = this;
449
+ this._context = null;
450
+ this._parentSubscriber = null;
451
+ _parentSubscriber.unsubscribe();
452
+ }
453
+ }
454
+
455
+ function canReportError(observer) {
456
+ while (observer) {
457
+ const { closed, destination, isStopped } = observer;
458
+ if (closed || isStopped) {
459
+ return false;
460
+ }
461
+ else if (destination && destination instanceof Subscriber) {
462
+ observer = destination;
463
+ }
464
+ else {
465
+ observer = null;
466
+ }
467
+ }
468
+ return true;
469
+ }
470
+
471
+ function toSubscriber(nextOrObserver, error, complete) {
472
+ if (nextOrObserver) {
473
+ if (nextOrObserver instanceof Subscriber) {
474
+ return nextOrObserver;
475
+ }
476
+ if (nextOrObserver[rxSubscriber]) {
477
+ return nextOrObserver[rxSubscriber]();
478
+ }
479
+ }
480
+ if (!nextOrObserver && !error && !complete) {
481
+ return new Subscriber(empty);
482
+ }
483
+ return new Subscriber(nextOrObserver, error, complete);
484
+ }
485
+
486
+ const observable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();
487
+
488
+ function identity(x) {
489
+ return x;
490
+ }
491
+
492
+ function pipeFromArray(fns) {
493
+ if (fns.length === 0) {
494
+ return identity;
495
+ }
496
+ if (fns.length === 1) {
497
+ return fns[0];
498
+ }
499
+ return function piped(input) {
500
+ return fns.reduce((prev, fn) => fn(prev), input);
501
+ };
502
+ }
503
+
504
+ class Observable {
505
+ constructor(subscribe) {
506
+ this._isScalar = false;
507
+ if (subscribe) {
508
+ this._subscribe = subscribe;
509
+ }
510
+ }
511
+ lift(operator) {
512
+ const observable = new Observable();
513
+ observable.source = this;
514
+ observable.operator = operator;
515
+ return observable;
516
+ }
517
+ subscribe(observerOrNext, error, complete) {
518
+ const { operator } = this;
519
+ const sink = toSubscriber(observerOrNext, error, complete);
520
+ if (operator) {
521
+ sink.add(operator.call(sink, this.source));
522
+ }
523
+ else {
524
+ sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
525
+ this._subscribe(sink) :
526
+ this._trySubscribe(sink));
527
+ }
528
+ if (config.useDeprecatedSynchronousErrorHandling) {
529
+ if (sink.syncErrorThrowable) {
530
+ sink.syncErrorThrowable = false;
531
+ if (sink.syncErrorThrown) {
532
+ throw sink.syncErrorValue;
533
+ }
534
+ }
535
+ }
536
+ return sink;
537
+ }
538
+ _trySubscribe(sink) {
539
+ try {
540
+ return this._subscribe(sink);
541
+ }
542
+ catch (err) {
543
+ if (config.useDeprecatedSynchronousErrorHandling) {
544
+ sink.syncErrorThrown = true;
545
+ sink.syncErrorValue = err;
546
+ }
547
+ if (canReportError(sink)) {
548
+ sink.error(err);
549
+ }
550
+ else {
551
+ console.warn(err);
552
+ }
553
+ }
554
+ }
555
+ forEach(next, promiseCtor) {
556
+ promiseCtor = getPromiseCtor(promiseCtor);
557
+ return new promiseCtor((resolve, reject) => {
558
+ let subscription;
559
+ subscription = this.subscribe((value) => {
560
+ try {
561
+ next(value);
562
+ }
563
+ catch (err) {
564
+ reject(err);
565
+ if (subscription) {
566
+ subscription.unsubscribe();
567
+ }
568
+ }
569
+ }, reject, resolve);
570
+ });
571
+ }
572
+ _subscribe(subscriber) {
573
+ const { source } = this;
574
+ return source && source.subscribe(subscriber);
575
+ }
576
+ [observable]() {
577
+ return this;
578
+ }
579
+ pipe(...operations) {
580
+ if (operations.length === 0) {
581
+ return this;
582
+ }
583
+ return pipeFromArray(operations)(this);
584
+ }
585
+ toPromise(promiseCtor) {
586
+ promiseCtor = getPromiseCtor(promiseCtor);
587
+ return new promiseCtor((resolve, reject) => {
588
+ let value;
589
+ this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value));
590
+ });
591
+ }
592
+ }
593
+ Observable.create = (subscribe) => {
594
+ return new Observable(subscribe);
595
+ };
596
+ function getPromiseCtor(promiseCtor) {
597
+ if (!promiseCtor) {
598
+ promiseCtor = Promise;
599
+ }
600
+ if (!promiseCtor) {
601
+ throw new Error('no Promise impl found');
602
+ }
603
+ return promiseCtor;
604
+ }
605
+
43
606
  const ObjectUnsubscribedErrorImpl = (() => {
44
607
  function ObjectUnsubscribedErrorImpl() {
45
608
  Error.call(this);
@@ -52,7 +615,7 @@ const ObjectUnsubscribedErrorImpl = (() => {
52
615
  })();
53
616
  const ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
54
617
 
55
- class SubjectSubscription extends delay.Subscription {
618
+ class SubjectSubscription extends Subscription {
56
619
  constructor(subject, subscriber) {
57
620
  super();
58
621
  this.subject = subject;
@@ -77,13 +640,13 @@ class SubjectSubscription extends delay.Subscription {
77
640
  }
78
641
  }
79
642
 
80
- class SubjectSubscriber extends delay.Subscriber {
643
+ class SubjectSubscriber extends Subscriber {
81
644
  constructor(destination) {
82
645
  super(destination);
83
646
  this.destination = destination;
84
647
  }
85
648
  }
86
- class Subject extends delay.Observable {
649
+ class Subject extends Observable {
87
650
  constructor() {
88
651
  super();
89
652
  this.observers = [];
@@ -92,7 +655,7 @@ class Subject extends delay.Observable {
92
655
  this.hasError = false;
93
656
  this.thrownError = null;
94
657
  }
95
- [delay.rxSubscriber]() {
658
+ [rxSubscriber]() {
96
659
  return new SubjectSubscriber(this);
97
660
  }
98
661
  lift(operator) {
@@ -160,11 +723,11 @@ class Subject extends delay.Observable {
160
723
  }
161
724
  else if (this.hasError) {
162
725
  subscriber.error(this.thrownError);
163
- return delay.Subscription.EMPTY;
726
+ return Subscription.EMPTY;
164
727
  }
165
728
  else if (this.isStopped) {
166
729
  subscriber.complete();
167
- return delay.Subscription.EMPTY;
730
+ return Subscription.EMPTY;
168
731
  }
169
732
  else {
170
733
  this.observers.push(subscriber);
@@ -172,7 +735,7 @@ class Subject extends delay.Observable {
172
735
  }
173
736
  }
174
737
  asObservable() {
175
- const observable = new delay.Observable();
738
+ const observable = new Observable();
176
739
  observable.source = this;
177
740
  return observable;
178
741
  }
@@ -210,7 +773,7 @@ class AnonymousSubject extends Subject {
210
773
  return this.source.subscribe(subscriber);
211
774
  }
212
775
  else {
213
- return delay.Subscription.EMPTY;
776
+ return Subscription.EMPTY;
214
777
  }
215
778
  }
216
779
  }
@@ -246,7 +809,95 @@ class BehaviorSubject extends Subject {
246
809
  }
247
810
  }
248
811
 
249
- class QueueAction extends delay.AsyncAction {
812
+ class Action extends Subscription {
813
+ constructor(scheduler, work) {
814
+ super();
815
+ }
816
+ schedule(state, delay = 0) {
817
+ return this;
818
+ }
819
+ }
820
+
821
+ class AsyncAction extends Action {
822
+ constructor(scheduler, work) {
823
+ super(scheduler, work);
824
+ this.scheduler = scheduler;
825
+ this.work = work;
826
+ this.pending = false;
827
+ }
828
+ schedule(state, delay = 0) {
829
+ if (this.closed) {
830
+ return this;
831
+ }
832
+ this.state = state;
833
+ const id = this.id;
834
+ const scheduler = this.scheduler;
835
+ if (id != null) {
836
+ this.id = this.recycleAsyncId(scheduler, id, delay);
837
+ }
838
+ this.pending = true;
839
+ this.delay = delay;
840
+ this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
841
+ return this;
842
+ }
843
+ requestAsyncId(scheduler, id, delay = 0) {
844
+ return setInterval(scheduler.flush.bind(scheduler, this), delay);
845
+ }
846
+ recycleAsyncId(scheduler, id, delay = 0) {
847
+ if (delay !== null && this.delay === delay && this.pending === false) {
848
+ return id;
849
+ }
850
+ clearInterval(id);
851
+ return undefined;
852
+ }
853
+ execute(state, delay) {
854
+ if (this.closed) {
855
+ return new Error('executing a cancelled action');
856
+ }
857
+ this.pending = false;
858
+ const error = this._execute(state, delay);
859
+ if (error) {
860
+ return error;
861
+ }
862
+ else if (this.pending === false && this.id != null) {
863
+ this.id = this.recycleAsyncId(this.scheduler, this.id, null);
864
+ }
865
+ }
866
+ _execute(state, delay) {
867
+ let errored = false;
868
+ let errorValue = undefined;
869
+ try {
870
+ this.work(state);
871
+ }
872
+ catch (e) {
873
+ errored = true;
874
+ errorValue = !!e && e || new Error(e);
875
+ }
876
+ if (errored) {
877
+ this.unsubscribe();
878
+ return errorValue;
879
+ }
880
+ }
881
+ _unsubscribe() {
882
+ const id = this.id;
883
+ const scheduler = this.scheduler;
884
+ const actions = scheduler.actions;
885
+ const index = actions.indexOf(this);
886
+ this.work = null;
887
+ this.state = null;
888
+ this.pending = false;
889
+ this.scheduler = null;
890
+ if (index !== -1) {
891
+ actions.splice(index, 1);
892
+ }
893
+ if (id != null) {
894
+ this.id = this.recycleAsyncId(scheduler, id, null);
895
+ }
896
+ this.delay = null;
897
+ }
898
+ }
899
+
900
+ class QueueAction extends AsyncAction {
250
901
  constructor(scheduler, work) {
251
902
  super(scheduler, work);
252
903
  this.scheduler = scheduler;
@@ -274,13 +925,208 @@ class QueueAction extends delay.AsyncAction {
274
925
  }
275
926
  }
276
927
 
277
- class QueueScheduler extends delay.AsyncScheduler {
928
+ class Scheduler {
929
+ constructor(SchedulerAction, now = Scheduler.now) {
930
+ this.SchedulerAction = SchedulerAction;
931
+ this.now = now;
932
+ }
933
+ schedule(work, delay = 0, state) {
934
+ return new this.SchedulerAction(this, work).schedule(state, delay);
935
+ }
936
+ }
937
+ Scheduler.now = () => Date.now();
938
+
939
+ class AsyncScheduler extends Scheduler {
940
+ constructor(SchedulerAction, now = Scheduler.now) {
941
+ super(SchedulerAction, () => {
942
+ if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
943
+ return AsyncScheduler.delegate.now();
944
+ }
945
+ else {
946
+ return now();
947
+ }
948
+ });
949
+ this.actions = [];
950
+ this.active = false;
951
+ this.scheduled = undefined;
952
+ }
953
+ schedule(work, delay = 0, state) {
954
+ if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
955
+ return AsyncScheduler.delegate.schedule(work, delay, state);
956
+ }
957
+ else {
958
+ return super.schedule(work, delay, state);
959
+ }
960
+ }
961
+ flush(action) {
962
+ const { actions } = this;
963
+ if (this.active) {
964
+ actions.push(action);
965
+ return;
966
+ }
967
+ let error;
968
+ this.active = true;
969
+ do {
970
+ if (error = action.execute(action.state, action.delay)) {
971
+ break;
972
+ }
973
+ } while (action = actions.shift());
974
+ this.active = false;
975
+ if (error) {
976
+ while (action = actions.shift()) {
977
+ action.unsubscribe();
978
+ }
979
+ throw error;
980
+ }
981
+ }
982
+ }
983
+
984
+ class QueueScheduler extends AsyncScheduler {
278
985
  }
279
986
 
280
987
  const queueScheduler = new QueueScheduler(QueueAction);
281
988
  const queue = queueScheduler;
282
989
 
283
- class ObserveOnSubscriber extends delay.Subscriber {
990
+ const EMPTY = new Observable(subscriber => subscriber.complete());
991
+ function empty$1(scheduler) {
992
+ return scheduler ? emptyScheduled(scheduler) : EMPTY;
993
+ }
994
+ function emptyScheduled(scheduler) {
995
+ return new Observable(subscriber => scheduler.schedule(() => subscriber.complete()));
996
+ }
997
+
998
+ function isScheduler(value) {
999
+ return value && typeof value.schedule === 'function';
1000
+ }
1001
+
1002
+ const subscribeToArray = (array) => (subscriber) => {
1003
+ for (let i = 0, len = array.length; i < len && !subscriber.closed; i++) {
1004
+ subscriber.next(array[i]);
1005
+ }
1006
+ subscriber.complete();
1007
+ };
1008
+
1009
+ function scheduleArray(input, scheduler) {
1010
+ return new Observable(subscriber => {
1011
+ const sub = new Subscription();
1012
+ let i = 0;
1013
+ sub.add(scheduler.schedule(function () {
1014
+ if (i === input.length) {
1015
+ subscriber.complete();
1016
+ return;
1017
+ }
1018
+ subscriber.next(input[i++]);
1019
+ if (!subscriber.closed) {
1020
+ sub.add(this.schedule());
1021
+ }
1022
+ }));
1023
+ return sub;
1024
+ });
1025
+ }
1026
+
1027
+ function fromArray(input, scheduler) {
1028
+ if (!scheduler) {
1029
+ return new Observable(subscribeToArray(input));
1030
+ }
1031
+ else {
1032
+ return scheduleArray(input, scheduler);
1033
+ }
1034
+ }
1035
+
1036
+ function of(...args) {
1037
+ let scheduler = args[args.length - 1];
1038
+ if (isScheduler(scheduler)) {
1039
+ args.pop();
1040
+ return scheduleArray(args, scheduler);
1041
+ }
1042
+ else {
1043
+ return fromArray(args);
1044
+ }
1045
+ }
1046
+
1047
+ function throwError(error, scheduler) {
1048
+ if (!scheduler) {
1049
+ return new Observable(subscriber => subscriber.error(error));
1050
+ }
1051
+ else {
1052
+ return new Observable(subscriber => scheduler.schedule(dispatch, 0, { error, subscriber }));
1053
+ }
1054
+ }
1055
+ function dispatch({ error, subscriber }) {
1056
+ subscriber.error(error);
1057
+ }
1058
+
1059
+ var NotificationKind;
1060
+ (function (NotificationKind) {
1061
+ NotificationKind["NEXT"] = "N";
1062
+ NotificationKind["ERROR"] = "E";
1063
+ NotificationKind["COMPLETE"] = "C";
1064
+ })(NotificationKind || (NotificationKind = {}));
1065
+ class Notification {
1066
+ constructor(kind, value, error) {
1067
+ this.kind = kind;
1068
+ this.value = value;
1069
+ this.error = error;
1070
+ this.hasValue = kind === 'N';
1071
+ }
1072
+ observe(observer) {
1073
+ switch (this.kind) {
1074
+ case 'N':
1075
+ return observer.next && observer.next(this.value);
1076
+ case 'E':
1077
+ return observer.error && observer.error(this.error);
1078
+ case 'C':
1079
+ return observer.complete && observer.complete();
1080
+ }
1081
+ }
1082
+ do(next, error, complete) {
1083
+ const kind = this.kind;
1084
+ switch (kind) {
1085
+ case 'N':
1086
+ return next && next(this.value);
1087
+ case 'E':
1088
+ return error && error(this.error);
1089
+ case 'C':
1090
+ return complete && complete();
1091
+ }
1092
+ }
1093
+ accept(nextOrObserver, error, complete) {
1094
+ if (nextOrObserver && typeof nextOrObserver.next === 'function') {
1095
+ return this.observe(nextOrObserver);
1096
+ }
1097
+ else {
1098
+ return this.do(nextOrObserver, error, complete);
1099
+ }
1100
+ }
1101
+ toObservable() {
1102
+ const kind = this.kind;
1103
+ switch (kind) {
1104
+ case 'N':
1105
+ return of(this.value);
1106
+ case 'E':
1107
+ return throwError(this.error);
1108
+ case 'C':
1109
+ return empty$1();
1110
+ }
1111
+ throw new Error('unexpected notification kind value');
1112
+ }
1113
+ static createNext(value) {
1114
+ if (typeof value !== 'undefined') {
1115
+ return new Notification('N', value);
1116
+ }
1117
+ return Notification.undefinedValueNotification;
1118
+ }
1119
+ static createError(err) {
1120
+ return new Notification('E', undefined, err);
1121
+ }
1122
+ static createComplete() {
1123
+ return Notification.completeNotification;
1124
+ }
1125
+ }
1126
+ Notification.completeNotification = new Notification('C');
1127
+ Notification.undefinedValueNotification = new Notification('N', undefined);
1128
+
1129
+ class ObserveOnSubscriber extends Subscriber {
284
1130
  constructor(destination, scheduler, delay = 0) {
285
1131
  super(destination);
286
1132
  this.scheduler = scheduler;
@@ -296,14 +1142,14 @@ class ObserveOnSubscriber extends delay.Subscriber {
296
1142
  destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
297
1143
  }
298
1144
  _next(value) {
299
- this.scheduleMessage(delay.Notification.createNext(value));
1145
+ this.scheduleMessage(Notification.createNext(value));
300
1146
  }
301
1147
  _error(err) {
302
- this.scheduleMessage(delay.Notification.createError(err));
1148
+ this.scheduleMessage(Notification.createError(err));
303
1149
  this.unsubscribe();
304
1150
  }
305
1151
  _complete() {
306
- this.scheduleMessage(delay.Notification.createComplete());
1152
+ this.scheduleMessage(Notification.createComplete());
307
1153
  this.unsubscribe();
308
1154
  }
309
1155
  }
@@ -357,7 +1203,7 @@ class ReplaySubject extends Subject {
357
1203
  throw new ObjectUnsubscribedError();
358
1204
  }
359
1205
  else if (this.isStopped || this.hasError) {
360
- subscription = delay.Subscription.EMPTY;
1206
+ subscription = Subscription.EMPTY;
361
1207
  }
362
1208
  else {
363
1209
  this.observers.push(subscriber);
@@ -416,8 +1262,11 @@ class ReplayEvent {
416
1262
  }
417
1263
  }
418
1264
 
1265
+ const asyncScheduler = new AsyncScheduler(AsyncAction);
1266
+ const async = asyncScheduler;
1267
+
419
1268
  function isObservable(obj) {
420
- return !!obj && (obj instanceof delay.Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));
1269
+ return !!obj && (obj instanceof Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));
421
1270
  }
422
1271
 
423
1272
  const ArgumentOutOfRangeErrorImpl = (() => {
@@ -449,7 +1298,7 @@ class MapOperator {
449
1298
  return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
450
1299
  }
451
1300
  }
452
- class MapSubscriber extends delay.Subscriber {
1301
+ class MapSubscriber extends Subscriber {
453
1302
  constructor(destination, project, thisArg) {
454
1303
  super(destination);
455
1304
  this.project = project;
@@ -476,7 +1325,7 @@ const subscribeToPromise = (promise) => (subscriber) => {
476
1325
  subscriber.complete();
477
1326
  }
478
1327
  }, (err) => subscriber.error(err))
479
- .then(null, delay.hostReportError);
1328
+ .then(null, hostReportError);
480
1329
  return subscriber;
481
1330
  };
482
1331
 
@@ -519,7 +1368,7 @@ const subscribeToIterable = (iterable) => (subscriber) => {
519
1368
  };
520
1369
 
521
1370
  const subscribeToObservable = (obj) => (subscriber) => {
522
- const obs = obj[delay.observable]();
1371
+ const obs = obj[observable]();
523
1372
  if (typeof obs.subscribe !== 'function') {
524
1373
  throw new TypeError('Provided object does not correctly implement Symbol.observable');
525
1374
  }
@@ -535,11 +1384,11 @@ function isPromise(value) {
535
1384
  }
536
1385
 
537
1386
  const subscribeTo = (result) => {
538
- if (!!result && typeof result[delay.observable] === 'function') {
1387
+ if (!!result && typeof result[observable] === 'function') {
539
1388
  return subscribeToObservable(result);
540
1389
  }
541
1390
  else if (isArrayLike(result)) {
542
- return delay.subscribeToArray(result);
1391
+ return subscribeToArray(result);
543
1392
  }
544
1393
  else if (isPromise(result)) {
545
1394
  return subscribeToPromise(result);
@@ -548,7 +1397,7 @@ const subscribeTo = (result) => {
548
1397
  return subscribeToIterable(result);
549
1398
  }
550
1399
  else {
551
- const value = delay.isObject(result) ? 'an invalid object' : `'${result}'`;
1400
+ const value = isObject(result) ? 'an invalid object' : `'${result}'`;
552
1401
  const msg = `You provided ${value} where a stream was expected.`
553
1402
  + ' You can provide an Observable, Promise, Array, or Iterable.';
554
1403
  throw new TypeError(msg);
@@ -556,11 +1405,11 @@ const subscribeTo = (result) => {
556
1405
  };
557
1406
 
558
1407
  function scheduleObservable(input, scheduler) {
559
- return new delay.Observable(subscriber => {
560
- const sub = new delay.Subscription();
1408
+ return new Observable(subscriber => {
1409
+ const sub = new Subscription();
561
1410
  sub.add(scheduler.schedule(() => {
562
- const observable = input[delay.observable]();
563
- sub.add(observable.subscribe({
1411
+ const observable$1 = input[observable]();
1412
+ sub.add(observable$1.subscribe({
564
1413
  next(value) { sub.add(scheduler.schedule(() => subscriber.next(value))); },
565
1414
  error(err) { sub.add(scheduler.schedule(() => subscriber.error(err))); },
566
1415
  complete() { sub.add(scheduler.schedule(() => subscriber.complete())); },
@@ -571,8 +1420,8 @@ function scheduleObservable(input, scheduler) {
571
1420
  }
572
1421
 
573
1422
  function schedulePromise(input, scheduler) {
574
- return new delay.Observable(subscriber => {
575
- const sub = new delay.Subscription();
1423
+ return new Observable(subscriber => {
1424
+ const sub = new Subscription();
576
1425
  sub.add(scheduler.schedule(() => input.then(value => {
577
1426
  sub.add(scheduler.schedule(() => {
578
1427
  subscriber.next(value);
@@ -589,8 +1438,8 @@ function scheduleIterable(input, scheduler) {
589
1438
  if (!input) {
590
1439
  throw new Error('Iterable cannot be null');
591
1440
  }
592
- return new delay.Observable(subscriber => {
593
- const sub = new delay.Subscription();
1441
+ return new Observable(subscriber => {
1442
+ const sub = new Subscription();
594
1443
  let iterator$1;
595
1444
  sub.add(() => {
596
1445
  if (iterator$1 && typeof iterator$1.return === 'function') {
@@ -628,7 +1477,7 @@ function scheduleIterable(input, scheduler) {
628
1477
  }
629
1478
 
630
1479
  function isInteropObservable(input) {
631
- return input && typeof input[delay.observable] === 'function';
1480
+ return input && typeof input[observable] === 'function';
632
1481
  }
633
1482
 
634
1483
  function isIterable(input) {
@@ -644,7 +1493,7 @@ function scheduled(input, scheduler) {
644
1493
  return schedulePromise(input, scheduler);
645
1494
  }
646
1495
  else if (isArrayLike(input)) {
647
- return delay.scheduleArray(input, scheduler);
1496
+ return scheduleArray(input, scheduler);
648
1497
  }
649
1498
  else if (isIterable(input) || typeof input === 'string') {
650
1499
  return scheduleIterable(input, scheduler);
@@ -655,17 +1504,17 @@ function scheduled(input, scheduler) {
655
1504
 
656
1505
  function from(input, scheduler) {
657
1506
  if (!scheduler) {
658
- if (input instanceof delay.Observable) {
1507
+ if (input instanceof Observable) {
659
1508
  return input;
660
1509
  }
661
- return new delay.Observable(subscribeTo(input));
1510
+ return new Observable(subscribeTo(input));
662
1511
  }
663
1512
  else {
664
1513
  return scheduled(input, scheduler);
665
1514
  }
666
1515
  }
667
1516
 
668
- class SimpleInnerSubscriber extends delay.Subscriber {
1517
+ class SimpleInnerSubscriber extends Subscriber {
669
1518
  constructor(parent) {
670
1519
  super();
671
1520
  this.parent = parent;
@@ -682,7 +1531,7 @@ class SimpleInnerSubscriber extends delay.Subscriber {
682
1531
  this.unsubscribe();
683
1532
  }
684
1533
  }
685
- class SimpleOuterSubscriber extends delay.Subscriber {
1534
+ class SimpleOuterSubscriber extends Subscriber {
686
1535
  notifyNext(innerValue) {
687
1536
  this.destination.next(innerValue);
688
1537
  }
@@ -697,7 +1546,7 @@ function innerSubscribe(result, innerSubscriber) {
697
1546
  if (innerSubscriber.closed) {
698
1547
  return undefined;
699
1548
  }
700
- if (result instanceof delay.Observable) {
1549
+ if (result instanceof Observable) {
701
1550
  return result.subscribe(innerSubscriber);
702
1551
  }
703
1552
  return subscribeTo(result)(innerSubscriber);
@@ -717,7 +1566,7 @@ class FilterOperator {
717
1566
  return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
718
1567
  }
719
1568
  }
720
- class FilterSubscriber extends delay.Subscriber {
1569
+ class FilterSubscriber extends Subscriber {
721
1570
  constructor(destination, predicate, thisArg) {
722
1571
  super(destination);
723
1572
  this.predicate = predicate;
@@ -739,6 +1588,89 @@ class FilterSubscriber extends delay.Subscriber {
739
1588
  }
740
1589
  }
741
1590
 
1591
+ function isDate(value) {
1592
+ return value instanceof Date && !isNaN(+value);
1593
+ }
1594
+
1595
+ function delay(delay, scheduler = async) {
1596
+ const absoluteDelay = isDate(delay);
1597
+ const delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);
1598
+ return (source) => source.lift(new DelayOperator(delayFor, scheduler));
1599
+ }
1600
+ class DelayOperator {
1601
+ constructor(delay, scheduler) {
1602
+ this.delay = delay;
1603
+ this.scheduler = scheduler;
1604
+ }
1605
+ call(subscriber, source) {
1606
+ return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));
1607
+ }
1608
+ }
1609
+ class DelaySubscriber extends Subscriber {
1610
+ constructor(destination, delay, scheduler) {
1611
+ super(destination);
1612
+ this.delay = delay;
1613
+ this.scheduler = scheduler;
1614
+ this.queue = [];
1615
+ this.active = false;
1616
+ this.errored = false;
1617
+ }
1618
+ static dispatch(state) {
1619
+ const source = state.source;
1620
+ const queue = source.queue;
1621
+ const scheduler = state.scheduler;
1622
+ const destination = state.destination;
1623
+ while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {
1624
+ queue.shift().notification.observe(destination);
1625
+ }
1626
+ if (queue.length > 0) {
1627
+ const delay = Math.max(0, queue[0].time - scheduler.now());
1628
+ this.schedule(state, delay);
1629
+ }
1630
+ else {
1631
+ this.unsubscribe();
1632
+ source.active = false;
1633
+ }
1634
+ }
1635
+ _schedule(scheduler) {
1636
+ this.active = true;
1637
+ const destination = this.destination;
1638
+ destination.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
1639
+ source: this, destination: this.destination, scheduler: scheduler
1640
+ }));
1641
+ }
1642
+ scheduleNotification(notification) {
1643
+ if (this.errored === true) {
1644
+ return;
1645
+ }
1646
+ const scheduler = this.scheduler;
1647
+ const message = new DelayMessage(scheduler.now() + this.delay, notification);
1648
+ this.queue.push(message);
1649
+ if (this.active === false) {
1650
+ this._schedule(scheduler);
1651
+ }
1652
+ }
1653
+ _next(value) {
1654
+ this.scheduleNotification(Notification.createNext(value));
1655
+ }
1656
+ _error(err) {
1657
+ this.errored = true;
1658
+ this.queue = [];
1659
+ this.destination.error(err);
1660
+ this.unsubscribe();
1661
+ }
1662
+ _complete() {
1663
+ this.scheduleNotification(Notification.createComplete());
1664
+ this.unsubscribe();
1665
+ }
1666
+ }
1667
+ class DelayMessage {
1668
+ constructor(time, notification) {
1669
+ this.time = time;
1670
+ this.notification = notification;
1671
+ }
1672
+ }
1673
+
742
1674
  function distinctUntilChanged(compare, keySelector) {
743
1675
  return (source) => source.lift(new DistinctUntilChangedOperator(compare, keySelector));
744
1676
  }
@@ -751,7 +1683,7 @@ class DistinctUntilChangedOperator {
751
1683
  return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
752
1684
  }
753
1685
  }
754
- class DistinctUntilChangedSubscriber extends delay.Subscriber {
1686
+ class DistinctUntilChangedSubscriber extends Subscriber {
755
1687
  constructor(destination, compare, keySelector) {
756
1688
  super(destination);
757
1689
  this.keySelector = keySelector;
@@ -795,7 +1727,7 @@ class DistinctUntilChangedSubscriber extends delay.Subscriber {
795
1727
  function take(count) {
796
1728
  return (source) => {
797
1729
  if (count === 0) {
798
- return delay.empty();
1730
+ return empty$1();
799
1731
  }
800
1732
  else {
801
1733
  return source.lift(new TakeOperator(count));
@@ -813,7 +1745,7 @@ class TakeOperator {
813
1745
  return source.subscribe(new TakeSubscriber(subscriber, this.total));
814
1746
  }
815
1747
  }
816
- class TakeSubscriber extends delay.Subscriber {
1748
+ class TakeSubscriber extends Subscriber {
817
1749
  constructor(destination, total) {
818
1750
  super(destination);
819
1751
  this.total = total;
@@ -999,24 +1931,24 @@ function isDev() {
999
1931
  }
1000
1932
 
1001
1933
  // @internal
1002
- function isObject(value) {
1934
+ function isObject$1(value) {
1003
1935
  const type = typeof value;
1004
1936
  return value != null && (type == 'object' || type == 'function');
1005
1937
  }
1006
1938
 
1007
1939
  // @internal
1008
- function isArray(value) {
1940
+ function isArray$1(value) {
1009
1941
  return Array.isArray(value);
1010
1942
  }
1011
1943
 
1012
1944
  // @internal
1013
1945
  function getActiveEntities(idOrOptions, ids, currentActive) {
1014
1946
  let result;
1015
- if (isArray(idOrOptions)) {
1947
+ if (isArray$1(idOrOptions)) {
1016
1948
  result = idOrOptions;
1017
1949
  }
1018
1950
  else {
1019
- if (isObject(idOrOptions)) {
1951
+ if (isObject$1(idOrOptions)) {
1020
1952
  if (isNil(currentActive))
1021
1953
  return;
1022
1954
  idOrOptions = Object.assign({ wrap: true }, idOrOptions);
@@ -1058,14 +1990,14 @@ function isDefined(val) {
1058
1990
 
1059
1991
  // @internal
1060
1992
  function isEmpty(arr) {
1061
- if (isArray(arr)) {
1993
+ if (isArray$1(arr)) {
1062
1994
  return arr.length === 0;
1063
1995
  }
1064
1996
  return false;
1065
1997
  }
1066
1998
 
1067
1999
  // @internal
1068
- function isFunction(value) {
2000
+ function isFunction$1(value) {
1069
2001
  return typeof value === 'function';
1070
2002
  }
1071
2003
 
@@ -1080,7 +2012,7 @@ function hasActiveState(state) {
1080
2012
  }
1081
2013
  // @internal
1082
2014
  function isMultiActiveState(active) {
1083
- return isArray(active);
2015
+ return isArray$1(active);
1084
2016
  }
1085
2017
  // @internal
1086
2018
  function resolveActiveEntity({ active, ids, entities }) {
@@ -1155,7 +2087,7 @@ function applyMiddleware(entities, preAddEntity) {
1155
2087
  function setEntities({ state, entities, idKey, preAddEntity, isNativePreAdd }) {
1156
2088
  let newEntities;
1157
2089
  let newIds;
1158
- if (isArray(entities)) {
2090
+ if (isArray$1(entities)) {
1159
2091
  const resolve = toEntitiesObject(entities, idKey, preAddEntity);
1160
2092
  newEntities = resolve.entities;
1161
2093
  newIds = resolve.ids;
@@ -1299,7 +2231,7 @@ function isTransactionInProcess() {
1299
2231
  }
1300
2232
  // @internal
1301
2233
  function commit() {
1302
- return transactionManager.batchTransaction ? transactionManager.batchTransaction.asObservable() : delay.of(true);
2234
+ return transactionManager.batchTransaction ? transactionManager.batchTransaction.asObservable() : of(true);
1303
2235
  }
1304
2236
  /**
1305
2237
  * A logical transaction.
@@ -1485,7 +2417,7 @@ class Store {
1485
2417
  }
1486
2418
  // @internal
1487
2419
  _setState(newState, _dispatchAction = true) {
1488
- if (isFunction(newState)) {
2420
+ if (isFunction$1(newState)) {
1489
2421
  const _newState = newState(this._value());
1490
2422
  this.storeValue = __DEV__ ? this.deepFreeze(_newState) : _newState;
1491
2423
  }
@@ -1532,8 +2464,8 @@ class Store {
1532
2464
  isDev() && setAction('Update');
1533
2465
  let newState;
1534
2466
  const currentState = this._value();
1535
- if (isFunction(stateOrCallback)) {
1536
- newState = isFunction(this._producerFn) ? this._producerFn(currentState, stateOrCallback) : stateOrCallback(currentState);
2467
+ if (isFunction$1(stateOrCallback)) {
2468
+ newState = isFunction$1(this._producerFn) ? this._producerFn(currentState, stateOrCallback) : stateOrCallback(currentState);
1537
2469
  }
1538
2470
  else {
1539
2471
  newState = stateOrCallback;
@@ -1623,8 +2555,8 @@ function updateEntities({ state, ids, idKey, newStateOrFn, preUpdateEntity, prod
1623
2555
  }
1624
2556
  const oldEntity = state.entities[id];
1625
2557
  let newState;
1626
- if (isFunction(newStateOrFn)) {
1627
- newState = isFunction(producerFn) ? producerFn(oldEntity, newStateOrFn) : newStateOrFn(oldEntity);
2558
+ if (isFunction$1(newStateOrFn)) {
2559
+ newState = isFunction$1(producerFn) ? producerFn(oldEntity, newStateOrFn) : newStateOrFn(oldEntity);
1628
2560
  }
1629
2561
  else {
1630
2562
  newState = newStateOrFn;
@@ -1782,7 +2714,7 @@ class EntityStore extends Store {
1782
2714
  return;
1783
2715
  }
1784
2716
  let ids = [];
1785
- if (isFunction(idsOrFnOrState)) {
2717
+ if (isFunction$1(idsOrFnOrState)) {
1786
2718
  // We need to filter according the predicate function
1787
2719
  ids = this.ids.filter((id) => idsOrFnOrState(this.entities[id]));
1788
2720
  }
@@ -1814,12 +2746,12 @@ class EntityStore extends Store {
1814
2746
  upsert(ids, newState, onCreate, options = {}) {
1815
2747
  const toArray = coerceArray(ids);
1816
2748
  const predicate = (isUpdate) => (id) => hasEntity(this.entities, id) === isUpdate;
1817
- const baseClass = isFunction(onCreate) ? options.baseClass : onCreate ? onCreate.baseClass : undefined;
1818
- const isClassBased = isFunction(baseClass);
2749
+ const baseClass = isFunction$1(onCreate) ? options.baseClass : onCreate ? onCreate.baseClass : undefined;
2750
+ const isClassBased = isFunction$1(baseClass);
1819
2751
  const updateIds = toArray.filter(predicate(true));
1820
2752
  const newEntities = toArray.filter(predicate(false)).map((id) => {
1821
2753
  const newStateObj = typeof newState === 'function' ? newState({}) : newState;
1822
- const entity = isFunction(onCreate) ? onCreate(id, newStateObj) : newStateObj;
2754
+ const entity = isFunction$1(onCreate) ? onCreate(id, newStateObj) : newStateObj;
1823
2755
  const withId = Object.assign({}, entity, { [this.idKey]: id });
1824
2756
  if (isClassBased) {
1825
2757
  return new baseClass(withId);
@@ -1921,7 +2853,7 @@ class EntityStore extends Store {
1921
2853
  const idPassed = isDefined(idsOrFn);
1922
2854
  // null means remove all
1923
2855
  let ids = [];
1924
- if (isFunction(idsOrFn)) {
2856
+ if (isFunction$1(idsOrFn)) {
1925
2857
  ids = this.ids.filter((entityId) => idsOrFn(this.entities[entityId]));
1926
2858
  }
1927
2859
  else {
@@ -2089,7 +3021,7 @@ class EntityStore extends Store {
2089
3021
  }
2090
3022
  handleUICreation(add = false) {
2091
3023
  const ids = this.ids;
2092
- const isFunc = isFunction(this.ui._akitaCreateEntityFn);
3024
+ const isFunc = isFunction$1(this.ui._akitaCreateEntityFn);
2093
3025
  let uiEntities;
2094
3026
  const createFn = (id) => {
2095
3027
  const current = this.entities[id];
@@ -2167,7 +3099,7 @@ const queryConfigKey = 'akitaQueryConfig';
2167
3099
 
2168
3100
  function compareKeys(keysOrFuncs) {
2169
3101
  return function (prevState, currState) {
2170
- const isFns = isFunction(keysOrFuncs[0]);
3102
+ const isFns = isFunction$1(keysOrFuncs[0]);
2171
3103
  // Return when they are NOT changed
2172
3104
  return keysOrFuncs.some(keyOrFunc => {
2173
3105
  if (isFns) {
@@ -2189,7 +3121,7 @@ class Query {
2189
3121
  }
2190
3122
  select(project) {
2191
3123
  let mapFn;
2192
- if (isFunction(project)) {
3124
+ if (isFunction$1(project)) {
2193
3125
  mapFn = project;
2194
3126
  }
2195
3127
  else if (isString(project)) {
@@ -2199,7 +3131,7 @@ class Query {
2199
3131
  return this.store
2200
3132
  ._select(state => state)
2201
3133
  .pipe(distinctUntilChanged(compareKeys(project)), map(state => {
2202
- if (isFunction(project[0])) {
3134
+ if (isFunction$1(project[0])) {
2203
3135
  return project.map(func => func(state));
2204
3136
  }
2205
3137
  return project.reduce((acc, k) => {
@@ -2321,7 +3253,7 @@ function setValue(obj, prop, val) {
2321
3253
  acc[part] = Object.assign({}, acc[part]);
2322
3254
  return acc && acc[part];
2323
3255
  }
2324
- acc[part] = Array.isArray(acc[part]) || !isObject(acc[part]) ? val : Object.assign({}, acc[part], val);
3256
+ acc[part] = Array.isArray(acc[part]) || !isObject$1(acc[part]) ? val : Object.assign({}, acc[part], val);
2325
3257
  return acc && acc[part];
2326
3258
  }, obj);
2327
3259
  return obj;
@@ -2440,7 +3372,7 @@ class PaginatorPlugin extends AkitaPlugin {
2440
3372
  /**
2441
3373
  * Proxy to the query loading
2442
3374
  */
2443
- this.isLoading$ = this.query.selectLoading().pipe(delay.delay(0));
3375
+ this.isLoading$ = this.query.selectLoading().pipe(delay(0));
2444
3376
  this.config = Object.assign(paginatorDefaults, config);
2445
3377
  const { startWith, cacheTimeout } = this.config;
2446
3378
  this.page = new BehaviorSubject(startWith);
@@ -2691,14 +3623,19 @@ var EntityStoreAction;
2691
3623
  EntityStoreAction["UpsertManyEntities"] = "UPSERT_MANY_ENTITIES";
2692
3624
  })(EntityStoreAction || (EntityStoreAction = {}));
2693
3625
 
3626
+ exports.Observable = Observable;
2694
3627
  exports.Query = Query;
2695
3628
  exports.SimpleInnerSubscriber = SimpleInnerSubscriber;
2696
3629
  exports.SimpleOuterSubscriber = SimpleOuterSubscriber;
2697
3630
  exports.Store = Store;
2698
3631
  exports.StoreConfig = StoreConfig;
3632
+ exports.Subscriber = Subscriber;
3633
+ exports.async = async;
2699
3634
  exports.distinctUntilChanged = distinctUntilChanged;
2700
3635
  exports.enableAkitaProdMode = enableAkitaProdMode;
2701
3636
  exports.filter = filter;
2702
3637
  exports.from = from;
2703
3638
  exports.innerSubscribe = innerSubscribe;
3639
+ exports.isArray = isArray;
3640
+ exports.isFunction = isFunction;
2704
3641
  exports.map = map;