UNPKG

284 kBJavaScriptView Raw
1/**
2 @license
3 Apache License
4 Version 2.0, January 2004
5 http://www.apache.org/licenses/
6
7 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
9 1. Definitions.
10
11 "License" shall mean the terms and conditions for use, reproduction,
12 and distribution as defined by Sections 1 through 9 of this document.
13
14 "Licensor" shall mean the copyright owner or entity authorized by
15 the copyright owner that is granting the License.
16
17 "Legal Entity" shall mean the union of the acting entity and all
18 other entities that control, are controlled by, or are under common
19 control with that entity. For the purposes of this definition,
20 "control" means (i) the power, direct or indirect, to cause the
21 direction or management of such entity, whether by contract or
22 otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 outstanding shares, or (iii) beneficial ownership of such entity.
24
25 "You" (or "Your") shall mean an individual or Legal Entity
26 exercising permissions granted by this License.
27
28 "Source" form shall mean the preferred form for making modifications,
29 including but not limited to software source code, documentation
30 source, and configuration files.
31
32 "Object" form shall mean any form resulting from mechanical
33 transformation or translation of a Source form, including but
34 not limited to compiled object code, generated documentation,
35 and conversions to other media types.
36
37 "Work" shall mean the work of authorship, whether in Source or
38 Object form, made available under the License, as indicated by a
39 copyright notice that is included in or attached to the work
40 (an example is provided in the Appendix below).
41
42 "Derivative Works" shall mean any work, whether in Source or Object
43 form, that is based on (or derived from) the Work and for which the
44 editorial revisions, annotations, elaborations, or other modifications
45 represent, as a whole, an original work of authorship. For the purposes
46 of this License, Derivative Works shall not include works that remain
47 separable from, or merely link (or bind by name) to the interfaces of,
48 the Work and Derivative Works thereof.
49
50 "Contribution" shall mean any work of authorship, including
51 the original version of the Work and any modifications or additions
52 to that Work or Derivative Works thereof, that is intentionally
53 submitted to Licensor for inclusion in the Work by the copyright owner
54 or by an individual or Legal Entity authorized to submit on behalf of
55 the copyright owner. For the purposes of this definition, "submitted"
56 means any form of electronic, verbal, or written communication sent
57 to the Licensor or its representatives, including but not limited to
58 communication on electronic mailing lists, source code control systems,
59 and issue tracking systems that are managed by, or on behalf of, the
60 Licensor for the purpose of discussing and improving the Work, but
61 excluding communication that is conspicuously marked or otherwise
62 designated in writing by the copyright owner as "Not a Contribution."
63
64 "Contributor" shall mean Licensor and any individual or Legal Entity
65 on behalf of whom a Contribution has been received by Licensor and
66 subsequently incorporated within the Work.
67
68 2. Grant of Copyright License. Subject to the terms and conditions of
69 this License, each Contributor hereby grants to You a perpetual,
70 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 copyright license to reproduce, prepare Derivative Works of,
72 publicly display, publicly perform, sublicense, and distribute the
73 Work and such Derivative Works in Source or Object form.
74
75 3. Grant of Patent License. Subject to the terms and conditions of
76 this License, each Contributor hereby grants to You a perpetual,
77 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 (except as stated in this section) patent license to make, have made,
79 use, offer to sell, sell, import, and otherwise transfer the Work,
80 where such license applies only to those patent claims licensable
81 by such Contributor that are necessarily infringed by their
82 Contribution(s) alone or by combination of their Contribution(s)
83 with the Work to which such Contribution(s) was submitted. If You
84 institute patent litigation against any entity (including a
85 cross-claim or counterclaim in a lawsuit) alleging that the Work
86 or a Contribution incorporated within the Work constitutes direct
87 or contributory patent infringement, then any patent licenses
88 granted to You under this License for that Work shall terminate
89 as of the date such litigation is filed.
90
91 4. Redistribution. You may reproduce and distribute copies of the
92 Work or Derivative Works thereof in any medium, with or without
93 modifications, and in Source or Object form, provided that You
94 meet the following conditions:
95
96 (a) You must give any other recipients of the Work or
97 Derivative Works a copy of this License; and
98
99 (b) You must cause any modified files to carry prominent notices
100 stating that You changed the files; and
101
102 (c) You must retain, in the Source form of any Derivative Works
103 that You distribute, all copyright, patent, trademark, and
104 attribution notices from the Source form of the Work,
105 excluding those notices that do not pertain to any part of
106 the Derivative Works; and
107
108 (d) If the Work includes a "NOTICE" text file as part of its
109 distribution, then any Derivative Works that You distribute must
110 include a readable copy of the attribution notices contained
111 within such NOTICE file, excluding those notices that do not
112 pertain to any part of the Derivative Works, in at least one
113 of the following places: within a NOTICE text file distributed
114 as part of the Derivative Works; within the Source form or
115 documentation, if provided along with the Derivative Works; or,
116 within a display generated by the Derivative Works, if and
117 wherever such third-party notices normally appear. The contents
118 of the NOTICE file are for informational purposes only and
119 do not modify the License. You may add Your own attribution
120 notices within Derivative Works that You distribute, alongside
121 or as an addendum to the NOTICE text from the Work, provided
122 that such additional attribution notices cannot be construed
123 as modifying the License.
124
125 You may add Your own copyright statement to Your modifications and
126 may provide additional or different license terms and conditions
127 for use, reproduction, or distribution of Your modifications, or
128 for any such Derivative Works as a whole, provided Your use,
129 reproduction, and distribution of the Work otherwise complies with
130 the conditions stated in this License.
131
132 5. Submission of Contributions. Unless You explicitly state otherwise,
133 any Contribution intentionally submitted for inclusion in the Work
134 by You to the Licensor shall be under the terms and conditions of
135 this License, without any additional terms or conditions.
136 Notwithstanding the above, nothing herein shall supersede or modify
137 the terms of any separate license agreement you may have executed
138 with Licensor regarding such Contributions.
139
140 6. Trademarks. This License does not grant permission to use the trade
141 names, trademarks, service marks, or product names of the Licensor,
142 except as required for reasonable and customary use in describing the
143 origin of the Work and reproducing the content of the NOTICE file.
144
145 7. Disclaimer of Warranty. Unless required by applicable law or
146 agreed to in writing, Licensor provides the Work (and each
147 Contributor provides its Contributions) on an "AS IS" BASIS,
148 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 implied, including, without limitation, any warranties or conditions
150 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 PARTICULAR PURPOSE. You are solely responsible for determining the
152 appropriateness of using or redistributing the Work and assume any
153 risks associated with Your exercise of permissions under this License.
154
155 8. Limitation of Liability. In no event and under no legal theory,
156 whether in tort (including negligence), contract, or otherwise,
157 unless required by applicable law (such as deliberate and grossly
158 negligent acts) or agreed to in writing, shall any Contributor be
159 liable to You for damages, including any direct, indirect, special,
160 incidental, or consequential damages of any character arising as a
161 result of this License or out of the use or inability to use the
162 Work (including but not limited to damages for loss of goodwill,
163 work stoppage, computer failure or malfunction, or any and all
164 other commercial damages or losses), even if such Contributor
165 has been advised of the possibility of such damages.
166
167 9. Accepting Warranty or Additional Liability. While redistributing
168 the Work or Derivative Works thereof, You may choose to offer,
169 and charge a fee for, acceptance of support, warranty, indemnity,
170 or other liability obligations and/or rights consistent with this
171 License. However, in accepting such obligations, You may act only
172 on Your own behalf and on Your sole responsibility, not on behalf
173 of any other Contributor, and only if You agree to indemnify,
174 defend, and hold each Contributor harmless for any liability
175 incurred by, or claims asserted against, such Contributor by reason
176 of your accepting any such warranty or additional liability.
177
178 END OF TERMS AND CONDITIONS
179
180 APPENDIX: How to apply the Apache License to your work.
181
182 To apply the Apache License to your work, attach the following
183 boilerplate notice, with the fields enclosed by brackets "[]"
184 replaced with your own identifying information. (Don't include
185 the brackets!) The text should be enclosed in the appropriate
186 comment syntax for the file format. We also recommend that a
187 file or class name and description of purpose be included on the
188 same "printed page" as the copyright notice for easier
189 identification within third-party archives.
190
191 Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors
192
193 Licensed under the Apache License, Version 2.0 (the "License");
194 you may not use this file except in compliance with the License.
195 You may obtain a copy of the License at
196
197 http://www.apache.org/licenses/LICENSE-2.0
198
199 Unless required by applicable law or agreed to in writing, software
200 distributed under the License is distributed on an "AS IS" BASIS,
201 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 See the License for the specific language governing permissions and
203 limitations under the License.
204
205
206 **/
207/**
208 @license
209 Apache License
210 Version 2.0, January 2004
211 http://www.apache.org/licenses/
212
213 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
214
215 1. Definitions.
216
217 "License" shall mean the terms and conditions for use, reproduction,
218 and distribution as defined by Sections 1 through 9 of this document.
219
220 "Licensor" shall mean the copyright owner or entity authorized by
221 the copyright owner that is granting the License.
222
223 "Legal Entity" shall mean the union of the acting entity and all
224 other entities that control, are controlled by, or are under common
225 control with that entity. For the purposes of this definition,
226 "control" means (i) the power, direct or indirect, to cause the
227 direction or management of such entity, whether by contract or
228 otherwise, or (ii) ownership of fifty percent (50%) or more of the
229 outstanding shares, or (iii) beneficial ownership of such entity.
230
231 "You" (or "Your") shall mean an individual or Legal Entity
232 exercising permissions granted by this License.
233
234 "Source" form shall mean the preferred form for making modifications,
235 including but not limited to software source code, documentation
236 source, and configuration files.
237
238 "Object" form shall mean any form resulting from mechanical
239 transformation or translation of a Source form, including but
240 not limited to compiled object code, generated documentation,
241 and conversions to other media types.
242
243 "Work" shall mean the work of authorship, whether in Source or
244 Object form, made available under the License, as indicated by a
245 copyright notice that is included in or attached to the work
246 (an example is provided in the Appendix below).
247
248 "Derivative Works" shall mean any work, whether in Source or Object
249 form, that is based on (or derived from) the Work and for which the
250 editorial revisions, annotations, elaborations, or other modifications
251 represent, as a whole, an original work of authorship. For the purposes
252 of this License, Derivative Works shall not include works that remain
253 separable from, or merely link (or bind by name) to the interfaces of,
254 the Work and Derivative Works thereof.
255
256 "Contribution" shall mean any work of authorship, including
257 the original version of the Work and any modifications or additions
258 to that Work or Derivative Works thereof, that is intentionally
259 submitted to Licensor for inclusion in the Work by the copyright owner
260 or by an individual or Legal Entity authorized to submit on behalf of
261 the copyright owner. For the purposes of this definition, "submitted"
262 means any form of electronic, verbal, or written communication sent
263 to the Licensor or its representatives, including but not limited to
264 communication on electronic mailing lists, source code control systems,
265 and issue tracking systems that are managed by, or on behalf of, the
266 Licensor for the purpose of discussing and improving the Work, but
267 excluding communication that is conspicuously marked or otherwise
268 designated in writing by the copyright owner as "Not a Contribution."
269
270 "Contributor" shall mean Licensor and any individual or Legal Entity
271 on behalf of whom a Contribution has been received by Licensor and
272 subsequently incorporated within the Work.
273
274 2. Grant of Copyright License. Subject to the terms and conditions of
275 this License, each Contributor hereby grants to You a perpetual,
276 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
277 copyright license to reproduce, prepare Derivative Works of,
278 publicly display, publicly perform, sublicense, and distribute the
279 Work and such Derivative Works in Source or Object form.
280
281 3. Grant of Patent License. Subject to the terms and conditions of
282 this License, each Contributor hereby grants to You a perpetual,
283 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
284 (except as stated in this section) patent license to make, have made,
285 use, offer to sell, sell, import, and otherwise transfer the Work,
286 where such license applies only to those patent claims licensable
287 by such Contributor that are necessarily infringed by their
288 Contribution(s) alone or by combination of their Contribution(s)
289 with the Work to which such Contribution(s) was submitted. If You
290 institute patent litigation against any entity (including a
291 cross-claim or counterclaim in a lawsuit) alleging that the Work
292 or a Contribution incorporated within the Work constitutes direct
293 or contributory patent infringement, then any patent licenses
294 granted to You under this License for that Work shall terminate
295 as of the date such litigation is filed.
296
297 4. Redistribution. You may reproduce and distribute copies of the
298 Work or Derivative Works thereof in any medium, with or without
299 modifications, and in Source or Object form, provided that You
300 meet the following conditions:
301
302 (a) You must give any other recipients of the Work or
303 Derivative Works a copy of this License; and
304
305 (b) You must cause any modified files to carry prominent notices
306 stating that You changed the files; and
307
308 (c) You must retain, in the Source form of any Derivative Works
309 that You distribute, all copyright, patent, trademark, and
310 attribution notices from the Source form of the Work,
311 excluding those notices that do not pertain to any part of
312 the Derivative Works; and
313
314 (d) If the Work includes a "NOTICE" text file as part of its
315 distribution, then any Derivative Works that You distribute must
316 include a readable copy of the attribution notices contained
317 within such NOTICE file, excluding those notices that do not
318 pertain to any part of the Derivative Works, in at least one
319 of the following places: within a NOTICE text file distributed
320 as part of the Derivative Works; within the Source form or
321 documentation, if provided along with the Derivative Works; or,
322 within a display generated by the Derivative Works, if and
323 wherever such third-party notices normally appear. The contents
324 of the NOTICE file are for informational purposes only and
325 do not modify the License. You may add Your own attribution
326 notices within Derivative Works that You distribute, alongside
327 or as an addendum to the NOTICE text from the Work, provided
328 that such additional attribution notices cannot be construed
329 as modifying the License.
330
331 You may add Your own copyright statement to Your modifications and
332 may provide additional or different license terms and conditions
333 for use, reproduction, or distribution of Your modifications, or
334 for any such Derivative Works as a whole, provided Your use,
335 reproduction, and distribution of the Work otherwise complies with
336 the conditions stated in this License.
337
338 5. Submission of Contributions. Unless You explicitly state otherwise,
339 any Contribution intentionally submitted for inclusion in the Work
340 by You to the Licensor shall be under the terms and conditions of
341 this License, without any additional terms or conditions.
342 Notwithstanding the above, nothing herein shall supersede or modify
343 the terms of any separate license agreement you may have executed
344 with Licensor regarding such Contributions.
345
346 6. Trademarks. This License does not grant permission to use the trade
347 names, trademarks, service marks, or product names of the Licensor,
348 except as required for reasonable and customary use in describing the
349 origin of the Work and reproducing the content of the NOTICE file.
350
351 7. Disclaimer of Warranty. Unless required by applicable law or
352 agreed to in writing, Licensor provides the Work (and each
353 Contributor provides its Contributions) on an "AS IS" BASIS,
354 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
355 implied, including, without limitation, any warranties or conditions
356 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
357 PARTICULAR PURPOSE. You are solely responsible for determining the
358 appropriateness of using or redistributing the Work and assume any
359 risks associated with Your exercise of permissions under this License.
360
361 8. Limitation of Liability. In no event and under no legal theory,
362 whether in tort (including negligence), contract, or otherwise,
363 unless required by applicable law (such as deliberate and grossly
364 negligent acts) or agreed to in writing, shall any Contributor be
365 liable to You for damages, including any direct, indirect, special,
366 incidental, or consequential damages of any character arising as a
367 result of this License or out of the use or inability to use the
368 Work (including but not limited to damages for loss of goodwill,
369 work stoppage, computer failure or malfunction, or any and all
370 other commercial damages or losses), even if such Contributor
371 has been advised of the possibility of such damages.
372
373 9. Accepting Warranty or Additional Liability. While redistributing
374 the Work or Derivative Works thereof, You may choose to offer,
375 and charge a fee for, acceptance of support, warranty, indemnity,
376 or other liability obligations and/or rights consistent with this
377 License. However, in accepting such obligations, You may act only
378 on Your own behalf and on Your sole responsibility, not on behalf
379 of any other Contributor, and only if You agree to indemnify,
380 defend, and hold each Contributor harmless for any liability
381 incurred by, or claims asserted against, such Contributor by reason
382 of your accepting any such warranty or additional liability.
383
384 END OF TERMS AND CONDITIONS
385
386 APPENDIX: How to apply the Apache License to your work.
387
388 To apply the Apache License to your work, attach the following
389 boilerplate notice, with the fields enclosed by brackets "[]"
390 replaced with your own identifying information. (Don't include
391 the brackets!) The text should be enclosed in the appropriate
392 comment syntax for the file format. We also recommend that a
393 file or class name and description of purpose be included on the
394 same "printed page" as the copyright notice for easier
395 identification within third-party archives.
396
397 Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors
398
399 Licensed under the Apache License, Version 2.0 (the "License");
400 you may not use this file except in compliance with the License.
401 You may obtain a copy of the License at
402
403 http://www.apache.org/licenses/LICENSE-2.0
404
405 Unless required by applicable law or agreed to in writing, software
406 distributed under the License is distributed on an "AS IS" BASIS,
407 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
408 See the License for the specific language governing permissions and
409 limitations under the License.
410
411
412 **/
413(function (global, factory) {
414 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
415 typeof define === 'function' && define.amd ? define('rxjs', ['exports'], factory) :
416 (factory((global.rxjs = {})));
417}(this, (function (exports) { 'use strict';
418
419 /*! *****************************************************************************
420 Copyright (c) Microsoft Corporation.
421
422 Permission to use, copy, modify, and/or distribute this software for any
423 purpose with or without fee is hereby granted.
424
425 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
426 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
427 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
428 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
429 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
430 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
431 PERFORMANCE OF THIS SOFTWARE.
432 ***************************************************************************** */
433 /* global Reflect, Promise */
434
435 var extendStatics = function(d, b) {
436 extendStatics = Object.setPrototypeOf ||
437 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
438 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
439 return extendStatics(d, b);
440 };
441
442 function __extends(d, b) {
443 if (typeof b !== "function" && b !== null)
444 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
445 extendStatics(d, b);
446 function __() { this.constructor = d; }
447 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
448 }
449
450 var __assign = function() {
451 __assign = Object.assign || function __assign(t) {
452 for (var s, i = 1, n = arguments.length; i < n; i++) {
453 s = arguments[i];
454 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
455 }
456 return t;
457 };
458 return __assign.apply(this, arguments);
459 };
460
461 function __rest(s, e) {
462 var t = {};
463 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
464 t[p] = s[p];
465 if (s != null && typeof Object.getOwnPropertySymbols === "function")
466 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
467 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
468 t[p[i]] = s[p[i]];
469 }
470 return t;
471 }
472
473 function __awaiter(thisArg, _arguments, P, generator) {
474 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
475 return new (P || (P = Promise))(function (resolve, reject) {
476 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
477 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
478 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
479 step((generator = generator.apply(thisArg, _arguments || [])).next());
480 });
481 }
482
483 function __generator(thisArg, body) {
484 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
485 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
486 function verb(n) { return function (v) { return step([n, v]); }; }
487 function step(op) {
488 if (f) throw new TypeError("Generator is already executing.");
489 while (_) try {
490 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
491 if (y = 0, t) op = [op[0] & 2, t.value];
492 switch (op[0]) {
493 case 0: case 1: t = op; break;
494 case 4: _.label++; return { value: op[1], done: false };
495 case 5: _.label++; y = op[1]; op = [0]; continue;
496 case 7: op = _.ops.pop(); _.trys.pop(); continue;
497 default:
498 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
499 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
500 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
501 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
502 if (t[2]) _.ops.pop();
503 _.trys.pop(); continue;
504 }
505 op = body.call(thisArg, _);
506 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
507 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
508 }
509 }
510
511 function __values(o) {
512 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
513 if (m) return m.call(o);
514 if (o && typeof o.length === "number") return {
515 next: function () {
516 if (o && i >= o.length) o = void 0;
517 return { value: o && o[i++], done: !o };
518 }
519 };
520 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
521 }
522
523 function __read(o, n) {
524 var m = typeof Symbol === "function" && o[Symbol.iterator];
525 if (!m) return o;
526 var i = m.call(o), r, ar = [], e;
527 try {
528 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
529 }
530 catch (error) { e = { error: error }; }
531 finally {
532 try {
533 if (r && !r.done && (m = i["return"])) m.call(i);
534 }
535 finally { if (e) throw e.error; }
536 }
537 return ar;
538 }
539
540 function __spreadArray(to, from, pack) {
541 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
542 if (ar || !(i in from)) {
543 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
544 ar[i] = from[i];
545 }
546 }
547 return to.concat(ar || Array.prototype.slice.call(from));
548 }
549
550 function __await(v) {
551 return this instanceof __await ? (this.v = v, this) : new __await(v);
552 }
553
554 function __asyncGenerator(thisArg, _arguments, generator) {
555 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
556 var g = generator.apply(thisArg, _arguments || []), i, q = [];
557 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
558 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
559 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
560 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
561 function fulfill(value) { resume("next", value); }
562 function reject(value) { resume("throw", value); }
563 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
564 }
565
566 function __asyncValues(o) {
567 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
568 var m = o[Symbol.asyncIterator], i;
569 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
570 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
571 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
572 }
573
574 function isFunction(value) {
575 return typeof value === 'function';
576 }
577
578 function createErrorClass(createImpl) {
579 var _super = function (instance) {
580 Error.call(instance);
581 instance.stack = new Error().stack;
582 };
583 var ctorFunc = createImpl(_super);
584 ctorFunc.prototype = Object.create(Error.prototype);
585 ctorFunc.prototype.constructor = ctorFunc;
586 return ctorFunc;
587 }
588
589 var UnsubscriptionError = createErrorClass(function (_super) {
590 return function UnsubscriptionErrorImpl(errors) {
591 _super(this);
592 this.message = errors
593 ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
594 : '';
595 this.name = 'UnsubscriptionError';
596 this.errors = errors;
597 };
598 });
599
600 function arrRemove(arr, item) {
601 if (arr) {
602 var index = arr.indexOf(item);
603 0 <= index && arr.splice(index, 1);
604 }
605 }
606
607 var Subscription = (function () {
608 function Subscription(initialTeardown) {
609 this.initialTeardown = initialTeardown;
610 this.closed = false;
611 this._parentage = null;
612 this._finalizers = null;
613 }
614 Subscription.prototype.unsubscribe = function () {
615 var e_1, _a, e_2, _b;
616 var errors;
617 if (!this.closed) {
618 this.closed = true;
619 var _parentage = this._parentage;
620 if (_parentage) {
621 this._parentage = null;
622 if (Array.isArray(_parentage)) {
623 try {
624 for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
625 var parent_1 = _parentage_1_1.value;
626 parent_1.remove(this);
627 }
628 }
629 catch (e_1_1) { e_1 = { error: e_1_1 }; }
630 finally {
631 try {
632 if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
633 }
634 finally { if (e_1) throw e_1.error; }
635 }
636 }
637 else {
638 _parentage.remove(this);
639 }
640 }
641 var initialFinalizer = this.initialTeardown;
642 if (isFunction(initialFinalizer)) {
643 try {
644 initialFinalizer();
645 }
646 catch (e) {
647 errors = e instanceof UnsubscriptionError ? e.errors : [e];
648 }
649 }
650 var _finalizers = this._finalizers;
651 if (_finalizers) {
652 this._finalizers = null;
653 try {
654 for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
655 var finalizer = _finalizers_1_1.value;
656 try {
657 execFinalizer(finalizer);
658 }
659 catch (err) {
660 errors = errors !== null && errors !== void 0 ? errors : [];
661 if (err instanceof UnsubscriptionError) {
662 errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
663 }
664 else {
665 errors.push(err);
666 }
667 }
668 }
669 }
670 catch (e_2_1) { e_2 = { error: e_2_1 }; }
671 finally {
672 try {
673 if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
674 }
675 finally { if (e_2) throw e_2.error; }
676 }
677 }
678 if (errors) {
679 throw new UnsubscriptionError(errors);
680 }
681 }
682 };
683 Subscription.prototype.add = function (teardown) {
684 var _a;
685 if (teardown && teardown !== this) {
686 if (this.closed) {
687 execFinalizer(teardown);
688 }
689 else {
690 if (teardown instanceof Subscription) {
691 if (teardown.closed || teardown._hasParent(this)) {
692 return;
693 }
694 teardown._addParent(this);
695 }
696 (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
697 }
698 }
699 };
700 Subscription.prototype._hasParent = function (parent) {
701 var _parentage = this._parentage;
702 return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
703 };
704 Subscription.prototype._addParent = function (parent) {
705 var _parentage = this._parentage;
706 this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
707 };
708 Subscription.prototype._removeParent = function (parent) {
709 var _parentage = this._parentage;
710 if (_parentage === parent) {
711 this._parentage = null;
712 }
713 else if (Array.isArray(_parentage)) {
714 arrRemove(_parentage, parent);
715 }
716 };
717 Subscription.prototype.remove = function (teardown) {
718 var _finalizers = this._finalizers;
719 _finalizers && arrRemove(_finalizers, teardown);
720 if (teardown instanceof Subscription) {
721 teardown._removeParent(this);
722 }
723 };
724 Subscription.EMPTY = (function () {
725 var empty = new Subscription();
726 empty.closed = true;
727 return empty;
728 })();
729 return Subscription;
730 }());
731 var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
732 function isSubscription(value) {
733 return (value instanceof Subscription ||
734 (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
735 }
736 function execFinalizer(finalizer) {
737 if (isFunction(finalizer)) {
738 finalizer();
739 }
740 else {
741 finalizer.unsubscribe();
742 }
743 }
744
745 var config = {
746 onUnhandledError: null,
747 onStoppedNotification: null,
748 Promise: undefined,
749 useDeprecatedSynchronousErrorHandling: false,
750 useDeprecatedNextContext: false,
751 };
752
753 var timeoutProvider = {
754 setTimeout: function (handler, timeout) {
755 var args = [];
756 for (var _i = 2; _i < arguments.length; _i++) {
757 args[_i - 2] = arguments[_i];
758 }
759 var delegate = timeoutProvider.delegate;
760 if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
761 return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
762 }
763 return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
764 },
765 clearTimeout: function (handle) {
766 var delegate = timeoutProvider.delegate;
767 return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
768 },
769 delegate: undefined,
770 };
771
772 function reportUnhandledError(err) {
773 timeoutProvider.setTimeout(function () {
774 var onUnhandledError = config.onUnhandledError;
775 if (onUnhandledError) {
776 onUnhandledError(err);
777 }
778 else {
779 throw err;
780 }
781 });
782 }
783
784 function noop() { }
785
786 var COMPLETE_NOTIFICATION = (function () { return createNotification('C', undefined, undefined); })();
787 function errorNotification(error) {
788 return createNotification('E', undefined, error);
789 }
790 function nextNotification(value) {
791 return createNotification('N', value, undefined);
792 }
793 function createNotification(kind, value, error) {
794 return {
795 kind: kind,
796 value: value,
797 error: error,
798 };
799 }
800
801 var context = null;
802 function errorContext(cb) {
803 if (config.useDeprecatedSynchronousErrorHandling) {
804 var isRoot = !context;
805 if (isRoot) {
806 context = { errorThrown: false, error: null };
807 }
808 cb();
809 if (isRoot) {
810 var _a = context, errorThrown = _a.errorThrown, error = _a.error;
811 context = null;
812 if (errorThrown) {
813 throw error;
814 }
815 }
816 }
817 else {
818 cb();
819 }
820 }
821 function captureError(err) {
822 if (config.useDeprecatedSynchronousErrorHandling && context) {
823 context.errorThrown = true;
824 context.error = err;
825 }
826 }
827
828 var Subscriber = (function (_super) {
829 __extends(Subscriber, _super);
830 function Subscriber(destination) {
831 var _this = _super.call(this) || this;
832 _this.isStopped = false;
833 if (destination) {
834 _this.destination = destination;
835 if (isSubscription(destination)) {
836 destination.add(_this);
837 }
838 }
839 else {
840 _this.destination = EMPTY_OBSERVER;
841 }
842 return _this;
843 }
844 Subscriber.create = function (next, error, complete) {
845 return new SafeSubscriber(next, error, complete);
846 };
847 Subscriber.prototype.next = function (value) {
848 if (this.isStopped) {
849 handleStoppedNotification(nextNotification(value), this);
850 }
851 else {
852 this._next(value);
853 }
854 };
855 Subscriber.prototype.error = function (err) {
856 if (this.isStopped) {
857 handleStoppedNotification(errorNotification(err), this);
858 }
859 else {
860 this.isStopped = true;
861 this._error(err);
862 }
863 };
864 Subscriber.prototype.complete = function () {
865 if (this.isStopped) {
866 handleStoppedNotification(COMPLETE_NOTIFICATION, this);
867 }
868 else {
869 this.isStopped = true;
870 this._complete();
871 }
872 };
873 Subscriber.prototype.unsubscribe = function () {
874 if (!this.closed) {
875 this.isStopped = true;
876 _super.prototype.unsubscribe.call(this);
877 this.destination = null;
878 }
879 };
880 Subscriber.prototype._next = function (value) {
881 this.destination.next(value);
882 };
883 Subscriber.prototype._error = function (err) {
884 try {
885 this.destination.error(err);
886 }
887 finally {
888 this.unsubscribe();
889 }
890 };
891 Subscriber.prototype._complete = function () {
892 try {
893 this.destination.complete();
894 }
895 finally {
896 this.unsubscribe();
897 }
898 };
899 return Subscriber;
900 }(Subscription));
901 var _bind = Function.prototype.bind;
902 function bind(fn, thisArg) {
903 return _bind.call(fn, thisArg);
904 }
905 var ConsumerObserver = (function () {
906 function ConsumerObserver(partialObserver) {
907 this.partialObserver = partialObserver;
908 }
909 ConsumerObserver.prototype.next = function (value) {
910 var partialObserver = this.partialObserver;
911 if (partialObserver.next) {
912 try {
913 partialObserver.next(value);
914 }
915 catch (error) {
916 handleUnhandledError(error);
917 }
918 }
919 };
920 ConsumerObserver.prototype.error = function (err) {
921 var partialObserver = this.partialObserver;
922 if (partialObserver.error) {
923 try {
924 partialObserver.error(err);
925 }
926 catch (error) {
927 handleUnhandledError(error);
928 }
929 }
930 else {
931 handleUnhandledError(err);
932 }
933 };
934 ConsumerObserver.prototype.complete = function () {
935 var partialObserver = this.partialObserver;
936 if (partialObserver.complete) {
937 try {
938 partialObserver.complete();
939 }
940 catch (error) {
941 handleUnhandledError(error);
942 }
943 }
944 };
945 return ConsumerObserver;
946 }());
947 var SafeSubscriber = (function (_super) {
948 __extends(SafeSubscriber, _super);
949 function SafeSubscriber(observerOrNext, error, complete) {
950 var _this = _super.call(this) || this;
951 var partialObserver;
952 if (isFunction(observerOrNext) || !observerOrNext) {
953 partialObserver = {
954 next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
955 error: error !== null && error !== void 0 ? error : undefined,
956 complete: complete !== null && complete !== void 0 ? complete : undefined,
957 };
958 }
959 else {
960 var context_1;
961 if (_this && config.useDeprecatedNextContext) {
962 context_1 = Object.create(observerOrNext);
963 context_1.unsubscribe = function () { return _this.unsubscribe(); };
964 partialObserver = {
965 next: observerOrNext.next && bind(observerOrNext.next, context_1),
966 error: observerOrNext.error && bind(observerOrNext.error, context_1),
967 complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
968 };
969 }
970 else {
971 partialObserver = observerOrNext;
972 }
973 }
974 _this.destination = new ConsumerObserver(partialObserver);
975 return _this;
976 }
977 return SafeSubscriber;
978 }(Subscriber));
979 function handleUnhandledError(error) {
980 if (config.useDeprecatedSynchronousErrorHandling) {
981 captureError(error);
982 }
983 else {
984 reportUnhandledError(error);
985 }
986 }
987 function defaultErrorHandler(err) {
988 throw err;
989 }
990 function handleStoppedNotification(notification, subscriber) {
991 var onStoppedNotification = config.onStoppedNotification;
992 onStoppedNotification && timeoutProvider.setTimeout(function () { return onStoppedNotification(notification, subscriber); });
993 }
994 var EMPTY_OBSERVER = {
995 closed: true,
996 next: noop,
997 error: defaultErrorHandler,
998 complete: noop,
999 };
1000
1001 var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
1002
1003 function identity(x) {
1004 return x;
1005 }
1006
1007 function pipe() {
1008 var fns = [];
1009 for (var _i = 0; _i < arguments.length; _i++) {
1010 fns[_i] = arguments[_i];
1011 }
1012 return pipeFromArray(fns);
1013 }
1014 function pipeFromArray(fns) {
1015 if (fns.length === 0) {
1016 return identity;
1017 }
1018 if (fns.length === 1) {
1019 return fns[0];
1020 }
1021 return function piped(input) {
1022 return fns.reduce(function (prev, fn) { return fn(prev); }, input);
1023 };
1024 }
1025
1026 var Observable = (function () {
1027 function Observable(subscribe) {
1028 if (subscribe) {
1029 this._subscribe = subscribe;
1030 }
1031 }
1032 Observable.prototype.lift = function (operator) {
1033 var observable$$1 = new Observable();
1034 observable$$1.source = this;
1035 observable$$1.operator = operator;
1036 return observable$$1;
1037 };
1038 Observable.prototype.subscribe = function (observerOrNext, error, complete) {
1039 var _this = this;
1040 var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
1041 errorContext(function () {
1042 var _a = _this, operator = _a.operator, source = _a.source;
1043 subscriber.add(operator
1044 ?
1045 operator.call(subscriber, source)
1046 : source
1047 ?
1048 _this._subscribe(subscriber)
1049 :
1050 _this._trySubscribe(subscriber));
1051 });
1052 return subscriber;
1053 };
1054 Observable.prototype._trySubscribe = function (sink) {
1055 try {
1056 return this._subscribe(sink);
1057 }
1058 catch (err) {
1059 sink.error(err);
1060 }
1061 };
1062 Observable.prototype.forEach = function (next, promiseCtor) {
1063 var _this = this;
1064 promiseCtor = getPromiseCtor(promiseCtor);
1065 return new promiseCtor(function (resolve, reject) {
1066 var subscriber = new SafeSubscriber({
1067 next: function (value) {
1068 try {
1069 next(value);
1070 }
1071 catch (err) {
1072 reject(err);
1073 subscriber.unsubscribe();
1074 }
1075 },
1076 error: reject,
1077 complete: resolve,
1078 });
1079 _this.subscribe(subscriber);
1080 });
1081 };
1082 Observable.prototype._subscribe = function (subscriber) {
1083 var _a;
1084 return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
1085 };
1086 Observable.prototype[observable] = function () {
1087 return this;
1088 };
1089 Observable.prototype.pipe = function () {
1090 var operations = [];
1091 for (var _i = 0; _i < arguments.length; _i++) {
1092 operations[_i] = arguments[_i];
1093 }
1094 return pipeFromArray(operations)(this);
1095 };
1096 Observable.prototype.toPromise = function (promiseCtor) {
1097 var _this = this;
1098 promiseCtor = getPromiseCtor(promiseCtor);
1099 return new promiseCtor(function (resolve, reject) {
1100 var value;
1101 _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
1102 });
1103 };
1104 Observable.create = function (subscribe) {
1105 return new Observable(subscribe);
1106 };
1107 return Observable;
1108 }());
1109 function getPromiseCtor(promiseCtor) {
1110 var _a;
1111 return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
1112 }
1113 function isObserver(value) {
1114 return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
1115 }
1116 function isSubscriber(value) {
1117 return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
1118 }
1119
1120 function hasLift(source) {
1121 return isFunction(source === null || source === void 0 ? void 0 : source.lift);
1122 }
1123 function operate(init) {
1124 return function (source) {
1125 if (hasLift(source)) {
1126 return source.lift(function (liftedSource) {
1127 try {
1128 return init(liftedSource, this);
1129 }
1130 catch (err) {
1131 this.error(err);
1132 }
1133 });
1134 }
1135 throw new TypeError('Unable to lift unknown Observable type');
1136 };
1137 }
1138
1139 function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
1140 return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
1141 }
1142 var OperatorSubscriber = (function (_super) {
1143 __extends(OperatorSubscriber, _super);
1144 function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
1145 var _this = _super.call(this, destination) || this;
1146 _this.onFinalize = onFinalize;
1147 _this.shouldUnsubscribe = shouldUnsubscribe;
1148 _this._next = onNext
1149 ? function (value) {
1150 try {
1151 onNext(value);
1152 }
1153 catch (err) {
1154 destination.error(err);
1155 }
1156 }
1157 : _super.prototype._next;
1158 _this._error = onError
1159 ? function (err) {
1160 try {
1161 onError(err);
1162 }
1163 catch (err) {
1164 destination.error(err);
1165 }
1166 finally {
1167 this.unsubscribe();
1168 }
1169 }
1170 : _super.prototype._error;
1171 _this._complete = onComplete
1172 ? function () {
1173 try {
1174 onComplete();
1175 }
1176 catch (err) {
1177 destination.error(err);
1178 }
1179 finally {
1180 this.unsubscribe();
1181 }
1182 }
1183 : _super.prototype._complete;
1184 return _this;
1185 }
1186 OperatorSubscriber.prototype.unsubscribe = function () {
1187 var _a;
1188 if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
1189 var closed_1 = this.closed;
1190 _super.prototype.unsubscribe.call(this);
1191 !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
1192 }
1193 };
1194 return OperatorSubscriber;
1195 }(Subscriber));
1196
1197 function refCount() {
1198 return operate(function (source, subscriber) {
1199 var connection = null;
1200 source._refCount++;
1201 var refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, function () {
1202 if (!source || source._refCount <= 0 || 0 < --source._refCount) {
1203 connection = null;
1204 return;
1205 }
1206 var sharedConnection = source._connection;
1207 var conn = connection;
1208 connection = null;
1209 if (sharedConnection && (!conn || sharedConnection === conn)) {
1210 sharedConnection.unsubscribe();
1211 }
1212 subscriber.unsubscribe();
1213 });
1214 source.subscribe(refCounter);
1215 if (!refCounter.closed) {
1216 connection = source.connect();
1217 }
1218 });
1219 }
1220
1221 var ConnectableObservable = (function (_super) {
1222 __extends(ConnectableObservable, _super);
1223 function ConnectableObservable(source, subjectFactory) {
1224 var _this = _super.call(this) || this;
1225 _this.source = source;
1226 _this.subjectFactory = subjectFactory;
1227 _this._subject = null;
1228 _this._refCount = 0;
1229 _this._connection = null;
1230 if (hasLift(source)) {
1231 _this.lift = source.lift;
1232 }
1233 return _this;
1234 }
1235 ConnectableObservable.prototype._subscribe = function (subscriber) {
1236 return this.getSubject().subscribe(subscriber);
1237 };
1238 ConnectableObservable.prototype.getSubject = function () {
1239 var subject = this._subject;
1240 if (!subject || subject.isStopped) {
1241 this._subject = this.subjectFactory();
1242 }
1243 return this._subject;
1244 };
1245 ConnectableObservable.prototype._teardown = function () {
1246 this._refCount = 0;
1247 var _connection = this._connection;
1248 this._subject = this._connection = null;
1249 _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();
1250 };
1251 ConnectableObservable.prototype.connect = function () {
1252 var _this = this;
1253 var connection = this._connection;
1254 if (!connection) {
1255 connection = this._connection = new Subscription();
1256 var subject_1 = this.getSubject();
1257 connection.add(this.source.subscribe(createOperatorSubscriber(subject_1, undefined, function () {
1258 _this._teardown();
1259 subject_1.complete();
1260 }, function (err) {
1261 _this._teardown();
1262 subject_1.error(err);
1263 }, function () { return _this._teardown(); })));
1264 if (connection.closed) {
1265 this._connection = null;
1266 connection = Subscription.EMPTY;
1267 }
1268 }
1269 return connection;
1270 };
1271 ConnectableObservable.prototype.refCount = function () {
1272 return refCount()(this);
1273 };
1274 return ConnectableObservable;
1275 }(Observable));
1276
1277 var performanceTimestampProvider = {
1278 now: function () {
1279 return (performanceTimestampProvider.delegate || performance).now();
1280 },
1281 delegate: undefined,
1282 };
1283
1284 var animationFrameProvider = {
1285 schedule: function (callback) {
1286 var request = requestAnimationFrame;
1287 var cancel = cancelAnimationFrame;
1288 var delegate = animationFrameProvider.delegate;
1289 if (delegate) {
1290 request = delegate.requestAnimationFrame;
1291 cancel = delegate.cancelAnimationFrame;
1292 }
1293 var handle = request(function (timestamp) {
1294 cancel = undefined;
1295 callback(timestamp);
1296 });
1297 return new Subscription(function () { return cancel === null || cancel === void 0 ? void 0 : cancel(handle); });
1298 },
1299 requestAnimationFrame: function () {
1300 var args = [];
1301 for (var _i = 0; _i < arguments.length; _i++) {
1302 args[_i] = arguments[_i];
1303 }
1304 var delegate = animationFrameProvider.delegate;
1305 return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
1306 },
1307 cancelAnimationFrame: function () {
1308 var args = [];
1309 for (var _i = 0; _i < arguments.length; _i++) {
1310 args[_i] = arguments[_i];
1311 }
1312 var delegate = animationFrameProvider.delegate;
1313 return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
1314 },
1315 delegate: undefined,
1316 };
1317
1318 function animationFrames(timestampProvider) {
1319 return timestampProvider ? animationFramesFactory(timestampProvider) : DEFAULT_ANIMATION_FRAMES;
1320 }
1321 function animationFramesFactory(timestampProvider) {
1322 return new Observable(function (subscriber) {
1323 var provider = timestampProvider || performanceTimestampProvider;
1324 var start = provider.now();
1325 var id = 0;
1326 var run = function () {
1327 if (!subscriber.closed) {
1328 id = animationFrameProvider.requestAnimationFrame(function (timestamp) {
1329 id = 0;
1330 var now = provider.now();
1331 subscriber.next({
1332 timestamp: timestampProvider ? now : timestamp,
1333 elapsed: now - start,
1334 });
1335 run();
1336 });
1337 }
1338 };
1339 run();
1340 return function () {
1341 if (id) {
1342 animationFrameProvider.cancelAnimationFrame(id);
1343 }
1344 };
1345 });
1346 }
1347 var DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
1348
1349 var ObjectUnsubscribedError = createErrorClass(function (_super) {
1350 return function ObjectUnsubscribedErrorImpl() {
1351 _super(this);
1352 this.name = 'ObjectUnsubscribedError';
1353 this.message = 'object unsubscribed';
1354 };
1355 });
1356
1357 var Subject = (function (_super) {
1358 __extends(Subject, _super);
1359 function Subject() {
1360 var _this = _super.call(this) || this;
1361 _this.closed = false;
1362 _this.currentObservers = null;
1363 _this.observers = [];
1364 _this.isStopped = false;
1365 _this.hasError = false;
1366 _this.thrownError = null;
1367 return _this;
1368 }
1369 Subject.prototype.lift = function (operator) {
1370 var subject = new AnonymousSubject(this, this);
1371 subject.operator = operator;
1372 return subject;
1373 };
1374 Subject.prototype._throwIfClosed = function () {
1375 if (this.closed) {
1376 throw new ObjectUnsubscribedError();
1377 }
1378 };
1379 Subject.prototype.next = function (value) {
1380 var _this = this;
1381 errorContext(function () {
1382 var e_1, _a;
1383 _this._throwIfClosed();
1384 if (!_this.isStopped) {
1385 if (!_this.currentObservers) {
1386 _this.currentObservers = Array.from(_this.observers);
1387 }
1388 try {
1389 for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
1390 var observer = _c.value;
1391 observer.next(value);
1392 }
1393 }
1394 catch (e_1_1) { e_1 = { error: e_1_1 }; }
1395 finally {
1396 try {
1397 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1398 }
1399 finally { if (e_1) throw e_1.error; }
1400 }
1401 }
1402 });
1403 };
1404 Subject.prototype.error = function (err) {
1405 var _this = this;
1406 errorContext(function () {
1407 _this._throwIfClosed();
1408 if (!_this.isStopped) {
1409 _this.hasError = _this.isStopped = true;
1410 _this.thrownError = err;
1411 var observers = _this.observers;
1412 while (observers.length) {
1413 observers.shift().error(err);
1414 }
1415 }
1416 });
1417 };
1418 Subject.prototype.complete = function () {
1419 var _this = this;
1420 errorContext(function () {
1421 _this._throwIfClosed();
1422 if (!_this.isStopped) {
1423 _this.isStopped = true;
1424 var observers = _this.observers;
1425 while (observers.length) {
1426 observers.shift().complete();
1427 }
1428 }
1429 });
1430 };
1431 Subject.prototype.unsubscribe = function () {
1432 this.isStopped = this.closed = true;
1433 this.observers = this.currentObservers = null;
1434 };
1435 Object.defineProperty(Subject.prototype, "observed", {
1436 get: function () {
1437 var _a;
1438 return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
1439 },
1440 enumerable: false,
1441 configurable: true
1442 });
1443 Subject.prototype._trySubscribe = function (subscriber) {
1444 this._throwIfClosed();
1445 return _super.prototype._trySubscribe.call(this, subscriber);
1446 };
1447 Subject.prototype._subscribe = function (subscriber) {
1448 this._throwIfClosed();
1449 this._checkFinalizedStatuses(subscriber);
1450 return this._innerSubscribe(subscriber);
1451 };
1452 Subject.prototype._innerSubscribe = function (subscriber) {
1453 var _this = this;
1454 var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1455 if (hasError || isStopped) {
1456 return EMPTY_SUBSCRIPTION;
1457 }
1458 this.currentObservers = null;
1459 observers.push(subscriber);
1460 return new Subscription(function () {
1461 _this.currentObservers = null;
1462 arrRemove(observers, subscriber);
1463 });
1464 };
1465 Subject.prototype._checkFinalizedStatuses = function (subscriber) {
1466 var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1467 if (hasError) {
1468 subscriber.error(thrownError);
1469 }
1470 else if (isStopped) {
1471 subscriber.complete();
1472 }
1473 };
1474 Subject.prototype.asObservable = function () {
1475 var observable = new Observable();
1476 observable.source = this;
1477 return observable;
1478 };
1479 Subject.create = function (destination, source) {
1480 return new AnonymousSubject(destination, source);
1481 };
1482 return Subject;
1483 }(Observable));
1484 var AnonymousSubject = (function (_super) {
1485 __extends(AnonymousSubject, _super);
1486 function AnonymousSubject(destination, source) {
1487 var _this = _super.call(this) || this;
1488 _this.destination = destination;
1489 _this.source = source;
1490 return _this;
1491 }
1492 AnonymousSubject.prototype.next = function (value) {
1493 var _a, _b;
1494 (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1495 };
1496 AnonymousSubject.prototype.error = function (err) {
1497 var _a, _b;
1498 (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1499 };
1500 AnonymousSubject.prototype.complete = function () {
1501 var _a, _b;
1502 (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1503 };
1504 AnonymousSubject.prototype._subscribe = function (subscriber) {
1505 var _a, _b;
1506 return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1507 };
1508 return AnonymousSubject;
1509 }(Subject));
1510
1511 var BehaviorSubject = (function (_super) {
1512 __extends(BehaviorSubject, _super);
1513 function BehaviorSubject(_value) {
1514 var _this = _super.call(this) || this;
1515 _this._value = _value;
1516 return _this;
1517 }
1518 Object.defineProperty(BehaviorSubject.prototype, "value", {
1519 get: function () {
1520 return this.getValue();
1521 },
1522 enumerable: false,
1523 configurable: true
1524 });
1525 BehaviorSubject.prototype._subscribe = function (subscriber) {
1526 var subscription = _super.prototype._subscribe.call(this, subscriber);
1527 !subscription.closed && subscriber.next(this._value);
1528 return subscription;
1529 };
1530 BehaviorSubject.prototype.getValue = function () {
1531 var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
1532 if (hasError) {
1533 throw thrownError;
1534 }
1535 this._throwIfClosed();
1536 return _value;
1537 };
1538 BehaviorSubject.prototype.next = function (value) {
1539 _super.prototype.next.call(this, (this._value = value));
1540 };
1541 return BehaviorSubject;
1542 }(Subject));
1543
1544 var dateTimestampProvider = {
1545 now: function () {
1546 return (dateTimestampProvider.delegate || Date).now();
1547 },
1548 delegate: undefined,
1549 };
1550
1551 var ReplaySubject = (function (_super) {
1552 __extends(ReplaySubject, _super);
1553 function ReplaySubject(_bufferSize, _windowTime, _timestampProvider) {
1554 if (_bufferSize === void 0) { _bufferSize = Infinity; }
1555 if (_windowTime === void 0) { _windowTime = Infinity; }
1556 if (_timestampProvider === void 0) { _timestampProvider = dateTimestampProvider; }
1557 var _this = _super.call(this) || this;
1558 _this._bufferSize = _bufferSize;
1559 _this._windowTime = _windowTime;
1560 _this._timestampProvider = _timestampProvider;
1561 _this._buffer = [];
1562 _this._infiniteTimeWindow = true;
1563 _this._infiniteTimeWindow = _windowTime === Infinity;
1564 _this._bufferSize = Math.max(1, _bufferSize);
1565 _this._windowTime = Math.max(1, _windowTime);
1566 return _this;
1567 }
1568 ReplaySubject.prototype.next = function (value) {
1569 var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
1570 if (!isStopped) {
1571 _buffer.push(value);
1572 !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
1573 }
1574 this._trimBuffer();
1575 _super.prototype.next.call(this, value);
1576 };
1577 ReplaySubject.prototype._subscribe = function (subscriber) {
1578 this._throwIfClosed();
1579 this._trimBuffer();
1580 var subscription = this._innerSubscribe(subscriber);
1581 var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
1582 var copy = _buffer.slice();
1583 for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
1584 subscriber.next(copy[i]);
1585 }
1586 this._checkFinalizedStatuses(subscriber);
1587 return subscription;
1588 };
1589 ReplaySubject.prototype._trimBuffer = function () {
1590 var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
1591 var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
1592 _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
1593 if (!_infiniteTimeWindow) {
1594 var now = _timestampProvider.now();
1595 var last = 0;
1596 for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
1597 last = i;
1598 }
1599 last && _buffer.splice(0, last + 1);
1600 }
1601 };
1602 return ReplaySubject;
1603 }(Subject));
1604
1605 var AsyncSubject = (function (_super) {
1606 __extends(AsyncSubject, _super);
1607 function AsyncSubject() {
1608 var _this = _super !== null && _super.apply(this, arguments) || this;
1609 _this._value = null;
1610 _this._hasValue = false;
1611 _this._isComplete = false;
1612 return _this;
1613 }
1614 AsyncSubject.prototype._checkFinalizedStatuses = function (subscriber) {
1615 var _a = this, hasError = _a.hasError, _hasValue = _a._hasValue, _value = _a._value, thrownError = _a.thrownError, isStopped = _a.isStopped, _isComplete = _a._isComplete;
1616 if (hasError) {
1617 subscriber.error(thrownError);
1618 }
1619 else if (isStopped || _isComplete) {
1620 _hasValue && subscriber.next(_value);
1621 subscriber.complete();
1622 }
1623 };
1624 AsyncSubject.prototype.next = function (value) {
1625 if (!this.isStopped) {
1626 this._value = value;
1627 this._hasValue = true;
1628 }
1629 };
1630 AsyncSubject.prototype.complete = function () {
1631 var _a = this, _hasValue = _a._hasValue, _value = _a._value, _isComplete = _a._isComplete;
1632 if (!_isComplete) {
1633 this._isComplete = true;
1634 _hasValue && _super.prototype.next.call(this, _value);
1635 _super.prototype.complete.call(this);
1636 }
1637 };
1638 return AsyncSubject;
1639 }(Subject));
1640
1641 var Action = (function (_super) {
1642 __extends(Action, _super);
1643 function Action(scheduler, work) {
1644 return _super.call(this) || this;
1645 }
1646 Action.prototype.schedule = function (state, delay) {
1647 if (delay === void 0) { delay = 0; }
1648 return this;
1649 };
1650 return Action;
1651 }(Subscription));
1652
1653 var intervalProvider = {
1654 setInterval: function (handler, timeout) {
1655 var args = [];
1656 for (var _i = 2; _i < arguments.length; _i++) {
1657 args[_i - 2] = arguments[_i];
1658 }
1659 var delegate = intervalProvider.delegate;
1660 if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
1661 return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
1662 }
1663 return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
1664 },
1665 clearInterval: function (handle) {
1666 var delegate = intervalProvider.delegate;
1667 return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
1668 },
1669 delegate: undefined,
1670 };
1671
1672 var AsyncAction = (function (_super) {
1673 __extends(AsyncAction, _super);
1674 function AsyncAction(scheduler, work) {
1675 var _this = _super.call(this, scheduler, work) || this;
1676 _this.scheduler = scheduler;
1677 _this.work = work;
1678 _this.pending = false;
1679 return _this;
1680 }
1681 AsyncAction.prototype.schedule = function (state, delay) {
1682 var _a;
1683 if (delay === void 0) { delay = 0; }
1684 if (this.closed) {
1685 return this;
1686 }
1687 this.state = state;
1688 var id = this.id;
1689 var scheduler = this.scheduler;
1690 if (id != null) {
1691 this.id = this.recycleAsyncId(scheduler, id, delay);
1692 }
1693 this.pending = true;
1694 this.delay = delay;
1695 this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
1696 return this;
1697 };
1698 AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
1699 if (delay === void 0) { delay = 0; }
1700 return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
1701 };
1702 AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
1703 if (delay === void 0) { delay = 0; }
1704 if (delay != null && this.delay === delay && this.pending === false) {
1705 return id;
1706 }
1707 if (id != null) {
1708 intervalProvider.clearInterval(id);
1709 }
1710 return undefined;
1711 };
1712 AsyncAction.prototype.execute = function (state, delay) {
1713 if (this.closed) {
1714 return new Error('executing a cancelled action');
1715 }
1716 this.pending = false;
1717 var error = this._execute(state, delay);
1718 if (error) {
1719 return error;
1720 }
1721 else if (this.pending === false && this.id != null) {
1722 this.id = this.recycleAsyncId(this.scheduler, this.id, null);
1723 }
1724 };
1725 AsyncAction.prototype._execute = function (state, _delay) {
1726 var errored = false;
1727 var errorValue;
1728 try {
1729 this.work(state);
1730 }
1731 catch (e) {
1732 errored = true;
1733 errorValue = e ? e : new Error('Scheduled action threw falsy error');
1734 }
1735 if (errored) {
1736 this.unsubscribe();
1737 return errorValue;
1738 }
1739 };
1740 AsyncAction.prototype.unsubscribe = function () {
1741 if (!this.closed) {
1742 var _a = this, id = _a.id, scheduler = _a.scheduler;
1743 var actions = scheduler.actions;
1744 this.work = this.state = this.scheduler = null;
1745 this.pending = false;
1746 arrRemove(actions, this);
1747 if (id != null) {
1748 this.id = this.recycleAsyncId(scheduler, id, null);
1749 }
1750 this.delay = null;
1751 _super.prototype.unsubscribe.call(this);
1752 }
1753 };
1754 return AsyncAction;
1755 }(Action));
1756
1757 var nextHandle = 1;
1758 var resolved;
1759 var activeHandles = {};
1760 function findAndClearHandle(handle) {
1761 if (handle in activeHandles) {
1762 delete activeHandles[handle];
1763 return true;
1764 }
1765 return false;
1766 }
1767 var Immediate = {
1768 setImmediate: function (cb) {
1769 var handle = nextHandle++;
1770 activeHandles[handle] = true;
1771 if (!resolved) {
1772 resolved = Promise.resolve();
1773 }
1774 resolved.then(function () { return findAndClearHandle(handle) && cb(); });
1775 return handle;
1776 },
1777 clearImmediate: function (handle) {
1778 findAndClearHandle(handle);
1779 },
1780 };
1781
1782 var setImmediate = Immediate.setImmediate, clearImmediate = Immediate.clearImmediate;
1783 var immediateProvider = {
1784 setImmediate: function () {
1785 var args = [];
1786 for (var _i = 0; _i < arguments.length; _i++) {
1787 args[_i] = arguments[_i];
1788 }
1789 var delegate = immediateProvider.delegate;
1790 return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate).apply(void 0, __spreadArray([], __read(args)));
1791 },
1792 clearImmediate: function (handle) {
1793 var delegate = immediateProvider.delegate;
1794 return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);
1795 },
1796 delegate: undefined,
1797 };
1798
1799 var AsapAction = (function (_super) {
1800 __extends(AsapAction, _super);
1801 function AsapAction(scheduler, work) {
1802 var _this = _super.call(this, scheduler, work) || this;
1803 _this.scheduler = scheduler;
1804 _this.work = work;
1805 return _this;
1806 }
1807 AsapAction.prototype.requestAsyncId = function (scheduler, id, delay) {
1808 if (delay === void 0) { delay = 0; }
1809 if (delay !== null && delay > 0) {
1810 return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
1811 }
1812 scheduler.actions.push(this);
1813 return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, undefined)));
1814 };
1815 AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
1816 var _a;
1817 if (delay === void 0) { delay = 0; }
1818 if (delay != null ? delay > 0 : this.delay > 0) {
1819 return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
1820 }
1821 var actions = scheduler.actions;
1822 if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
1823 immediateProvider.clearImmediate(id);
1824 if (scheduler._scheduled === id) {
1825 scheduler._scheduled = undefined;
1826 }
1827 }
1828 return undefined;
1829 };
1830 return AsapAction;
1831 }(AsyncAction));
1832
1833 var Scheduler = (function () {
1834 function Scheduler(schedulerActionCtor, now) {
1835 if (now === void 0) { now = Scheduler.now; }
1836 this.schedulerActionCtor = schedulerActionCtor;
1837 this.now = now;
1838 }
1839 Scheduler.prototype.schedule = function (work, delay, state) {
1840 if (delay === void 0) { delay = 0; }
1841 return new this.schedulerActionCtor(this, work).schedule(state, delay);
1842 };
1843 Scheduler.now = dateTimestampProvider.now;
1844 return Scheduler;
1845 }());
1846
1847 var AsyncScheduler = (function (_super) {
1848 __extends(AsyncScheduler, _super);
1849 function AsyncScheduler(SchedulerAction, now) {
1850 if (now === void 0) { now = Scheduler.now; }
1851 var _this = _super.call(this, SchedulerAction, now) || this;
1852 _this.actions = [];
1853 _this._active = false;
1854 return _this;
1855 }
1856 AsyncScheduler.prototype.flush = function (action) {
1857 var actions = this.actions;
1858 if (this._active) {
1859 actions.push(action);
1860 return;
1861 }
1862 var error;
1863 this._active = true;
1864 do {
1865 if ((error = action.execute(action.state, action.delay))) {
1866 break;
1867 }
1868 } while ((action = actions.shift()));
1869 this._active = false;
1870 if (error) {
1871 while ((action = actions.shift())) {
1872 action.unsubscribe();
1873 }
1874 throw error;
1875 }
1876 };
1877 return AsyncScheduler;
1878 }(Scheduler));
1879
1880 var AsapScheduler = (function (_super) {
1881 __extends(AsapScheduler, _super);
1882 function AsapScheduler() {
1883 return _super !== null && _super.apply(this, arguments) || this;
1884 }
1885 AsapScheduler.prototype.flush = function (action) {
1886 this._active = true;
1887 var flushId = this._scheduled;
1888 this._scheduled = undefined;
1889 var actions = this.actions;
1890 var error;
1891 action = action || actions.shift();
1892 do {
1893 if ((error = action.execute(action.state, action.delay))) {
1894 break;
1895 }
1896 } while ((action = actions[0]) && action.id === flushId && actions.shift());
1897 this._active = false;
1898 if (error) {
1899 while ((action = actions[0]) && action.id === flushId && actions.shift()) {
1900 action.unsubscribe();
1901 }
1902 throw error;
1903 }
1904 };
1905 return AsapScheduler;
1906 }(AsyncScheduler));
1907
1908 var asapScheduler = new AsapScheduler(AsapAction);
1909 var asap = asapScheduler;
1910
1911 var asyncScheduler = new AsyncScheduler(AsyncAction);
1912 var async = asyncScheduler;
1913
1914 var QueueAction = (function (_super) {
1915 __extends(QueueAction, _super);
1916 function QueueAction(scheduler, work) {
1917 var _this = _super.call(this, scheduler, work) || this;
1918 _this.scheduler = scheduler;
1919 _this.work = work;
1920 return _this;
1921 }
1922 QueueAction.prototype.schedule = function (state, delay) {
1923 if (delay === void 0) { delay = 0; }
1924 if (delay > 0) {
1925 return _super.prototype.schedule.call(this, state, delay);
1926 }
1927 this.delay = delay;
1928 this.state = state;
1929 this.scheduler.flush(this);
1930 return this;
1931 };
1932 QueueAction.prototype.execute = function (state, delay) {
1933 return delay > 0 || this.closed ? _super.prototype.execute.call(this, state, delay) : this._execute(state, delay);
1934 };
1935 QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {
1936 if (delay === void 0) { delay = 0; }
1937 if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
1938 return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
1939 }
1940 scheduler.flush(this);
1941 return 0;
1942 };
1943 return QueueAction;
1944 }(AsyncAction));
1945
1946 var QueueScheduler = (function (_super) {
1947 __extends(QueueScheduler, _super);
1948 function QueueScheduler() {
1949 return _super !== null && _super.apply(this, arguments) || this;
1950 }
1951 return QueueScheduler;
1952 }(AsyncScheduler));
1953
1954 var queueScheduler = new QueueScheduler(QueueAction);
1955 var queue = queueScheduler;
1956
1957 var AnimationFrameAction = (function (_super) {
1958 __extends(AnimationFrameAction, _super);
1959 function AnimationFrameAction(scheduler, work) {
1960 var _this = _super.call(this, scheduler, work) || this;
1961 _this.scheduler = scheduler;
1962 _this.work = work;
1963 return _this;
1964 }
1965 AnimationFrameAction.prototype.requestAsyncId = function (scheduler, id, delay) {
1966 if (delay === void 0) { delay = 0; }
1967 if (delay !== null && delay > 0) {
1968 return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
1969 }
1970 scheduler.actions.push(this);
1971 return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(function () { return scheduler.flush(undefined); }));
1972 };
1973 AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
1974 var _a;
1975 if (delay === void 0) { delay = 0; }
1976 if (delay != null ? delay > 0 : this.delay > 0) {
1977 return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
1978 }
1979 var actions = scheduler.actions;
1980 if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
1981 animationFrameProvider.cancelAnimationFrame(id);
1982 scheduler._scheduled = undefined;
1983 }
1984 return undefined;
1985 };
1986 return AnimationFrameAction;
1987 }(AsyncAction));
1988
1989 var AnimationFrameScheduler = (function (_super) {
1990 __extends(AnimationFrameScheduler, _super);
1991 function AnimationFrameScheduler() {
1992 return _super !== null && _super.apply(this, arguments) || this;
1993 }
1994 AnimationFrameScheduler.prototype.flush = function (action) {
1995 this._active = true;
1996 var flushId = this._scheduled;
1997 this._scheduled = undefined;
1998 var actions = this.actions;
1999 var error;
2000 action = action || actions.shift();
2001 do {
2002 if ((error = action.execute(action.state, action.delay))) {
2003 break;
2004 }
2005 } while ((action = actions[0]) && action.id === flushId && actions.shift());
2006 this._active = false;
2007 if (error) {
2008 while ((action = actions[0]) && action.id === flushId && actions.shift()) {
2009 action.unsubscribe();
2010 }
2011 throw error;
2012 }
2013 };
2014 return AnimationFrameScheduler;
2015 }(AsyncScheduler));
2016
2017 var animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);
2018 var animationFrame = animationFrameScheduler;
2019
2020 var VirtualTimeScheduler = (function (_super) {
2021 __extends(VirtualTimeScheduler, _super);
2022 function VirtualTimeScheduler(schedulerActionCtor, maxFrames) {
2023 if (schedulerActionCtor === void 0) { schedulerActionCtor = VirtualAction; }
2024 if (maxFrames === void 0) { maxFrames = Infinity; }
2025 var _this = _super.call(this, schedulerActionCtor, function () { return _this.frame; }) || this;
2026 _this.maxFrames = maxFrames;
2027 _this.frame = 0;
2028 _this.index = -1;
2029 return _this;
2030 }
2031 VirtualTimeScheduler.prototype.flush = function () {
2032 var _a = this, actions = _a.actions, maxFrames = _a.maxFrames;
2033 var error;
2034 var action;
2035 while ((action = actions[0]) && action.delay <= maxFrames) {
2036 actions.shift();
2037 this.frame = action.delay;
2038 if ((error = action.execute(action.state, action.delay))) {
2039 break;
2040 }
2041 }
2042 if (error) {
2043 while ((action = actions.shift())) {
2044 action.unsubscribe();
2045 }
2046 throw error;
2047 }
2048 };
2049 VirtualTimeScheduler.frameTimeFactor = 10;
2050 return VirtualTimeScheduler;
2051 }(AsyncScheduler));
2052 var VirtualAction = (function (_super) {
2053 __extends(VirtualAction, _super);
2054 function VirtualAction(scheduler, work, index) {
2055 if (index === void 0) { index = (scheduler.index += 1); }
2056 var _this = _super.call(this, scheduler, work) || this;
2057 _this.scheduler = scheduler;
2058 _this.work = work;
2059 _this.index = index;
2060 _this.active = true;
2061 _this.index = scheduler.index = index;
2062 return _this;
2063 }
2064 VirtualAction.prototype.schedule = function (state, delay) {
2065 if (delay === void 0) { delay = 0; }
2066 if (Number.isFinite(delay)) {
2067 if (!this.id) {
2068 return _super.prototype.schedule.call(this, state, delay);
2069 }
2070 this.active = false;
2071 var action = new VirtualAction(this.scheduler, this.work);
2072 this.add(action);
2073 return action.schedule(state, delay);
2074 }
2075 else {
2076 return Subscription.EMPTY;
2077 }
2078 };
2079 VirtualAction.prototype.requestAsyncId = function (scheduler, id, delay) {
2080 if (delay === void 0) { delay = 0; }
2081 this.delay = scheduler.frame + delay;
2082 var actions = scheduler.actions;
2083 actions.push(this);
2084 actions.sort(VirtualAction.sortActions);
2085 return 1;
2086 };
2087 VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
2088 if (delay === void 0) { delay = 0; }
2089 return undefined;
2090 };
2091 VirtualAction.prototype._execute = function (state, delay) {
2092 if (this.active === true) {
2093 return _super.prototype._execute.call(this, state, delay);
2094 }
2095 };
2096 VirtualAction.sortActions = function (a, b) {
2097 if (a.delay === b.delay) {
2098 if (a.index === b.index) {
2099 return 0;
2100 }
2101 else if (a.index > b.index) {
2102 return 1;
2103 }
2104 else {
2105 return -1;
2106 }
2107 }
2108 else if (a.delay > b.delay) {
2109 return 1;
2110 }
2111 else {
2112 return -1;
2113 }
2114 };
2115 return VirtualAction;
2116 }(AsyncAction));
2117
2118 var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
2119 function empty(scheduler) {
2120 return scheduler ? emptyScheduled(scheduler) : EMPTY;
2121 }
2122 function emptyScheduled(scheduler) {
2123 return new Observable(function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); });
2124 }
2125
2126 function isScheduler(value) {
2127 return value && isFunction(value.schedule);
2128 }
2129
2130 function last(arr) {
2131 return arr[arr.length - 1];
2132 }
2133 function popResultSelector(args) {
2134 return isFunction(last(args)) ? args.pop() : undefined;
2135 }
2136 function popScheduler(args) {
2137 return isScheduler(last(args)) ? args.pop() : undefined;
2138 }
2139 function popNumber(args, defaultValue) {
2140 return typeof last(args) === 'number' ? args.pop() : defaultValue;
2141 }
2142
2143 var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
2144
2145 function isPromise(value) {
2146 return isFunction(value === null || value === void 0 ? void 0 : value.then);
2147 }
2148
2149 function isInteropObservable(input) {
2150 return isFunction(input[observable]);
2151 }
2152
2153 function isAsyncIterable(obj) {
2154 return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
2155 }
2156
2157 function createInvalidObservableTypeError(input) {
2158 return new TypeError("You provided " + (input !== null && typeof input === 'object' ? 'an invalid object' : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
2159 }
2160
2161 function getSymbolIterator() {
2162 if (typeof Symbol !== 'function' || !Symbol.iterator) {
2163 return '@@iterator';
2164 }
2165 return Symbol.iterator;
2166 }
2167 var iterator = getSymbolIterator();
2168
2169 function isIterable(input) {
2170 return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
2171 }
2172
2173 function readableStreamLikeToAsyncGenerator(readableStream) {
2174 return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
2175 var reader, _a, value, done;
2176 return __generator(this, function (_b) {
2177 switch (_b.label) {
2178 case 0:
2179 reader = readableStream.getReader();
2180 _b.label = 1;
2181 case 1:
2182 _b.trys.push([1, , 9, 10]);
2183 _b.label = 2;
2184 case 2:
2185 return [4, __await(reader.read())];
2186 case 3:
2187 _a = _b.sent(), value = _a.value, done = _a.done;
2188 if (!done) return [3, 5];
2189 return [4, __await(void 0)];
2190 case 4: return [2, _b.sent()];
2191 case 5: return [4, __await(value)];
2192 case 6: return [4, _b.sent()];
2193 case 7:
2194 _b.sent();
2195 return [3, 2];
2196 case 8: return [3, 10];
2197 case 9:
2198 reader.releaseLock();
2199 return [7];
2200 case 10: return [2];
2201 }
2202 });
2203 });
2204 }
2205 function isReadableStreamLike(obj) {
2206 return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
2207 }
2208
2209 function innerFrom(input) {
2210 if (input instanceof Observable) {
2211 return input;
2212 }
2213 if (input != null) {
2214 if (isInteropObservable(input)) {
2215 return fromInteropObservable(input);
2216 }
2217 if (isArrayLike(input)) {
2218 return fromArrayLike(input);
2219 }
2220 if (isPromise(input)) {
2221 return fromPromise(input);
2222 }
2223 if (isAsyncIterable(input)) {
2224 return fromAsyncIterable(input);
2225 }
2226 if (isIterable(input)) {
2227 return fromIterable(input);
2228 }
2229 if (isReadableStreamLike(input)) {
2230 return fromReadableStreamLike(input);
2231 }
2232 }
2233 throw createInvalidObservableTypeError(input);
2234 }
2235 function fromInteropObservable(obj) {
2236 return new Observable(function (subscriber) {
2237 var obs = obj[observable]();
2238 if (isFunction(obs.subscribe)) {
2239 return obs.subscribe(subscriber);
2240 }
2241 throw new TypeError('Provided object does not correctly implement Symbol.observable');
2242 });
2243 }
2244 function fromArrayLike(array) {
2245 return new Observable(function (subscriber) {
2246 for (var i = 0; i < array.length && !subscriber.closed; i++) {
2247 subscriber.next(array[i]);
2248 }
2249 subscriber.complete();
2250 });
2251 }
2252 function fromPromise(promise) {
2253 return new Observable(function (subscriber) {
2254 promise
2255 .then(function (value) {
2256 if (!subscriber.closed) {
2257 subscriber.next(value);
2258 subscriber.complete();
2259 }
2260 }, function (err) { return subscriber.error(err); })
2261 .then(null, reportUnhandledError);
2262 });
2263 }
2264 function fromIterable(iterable) {
2265 return new Observable(function (subscriber) {
2266 var e_1, _a;
2267 try {
2268 for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
2269 var value = iterable_1_1.value;
2270 subscriber.next(value);
2271 if (subscriber.closed) {
2272 return;
2273 }
2274 }
2275 }
2276 catch (e_1_1) { e_1 = { error: e_1_1 }; }
2277 finally {
2278 try {
2279 if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
2280 }
2281 finally { if (e_1) throw e_1.error; }
2282 }
2283 subscriber.complete();
2284 });
2285 }
2286 function fromAsyncIterable(asyncIterable) {
2287 return new Observable(function (subscriber) {
2288 process(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
2289 });
2290 }
2291 function fromReadableStreamLike(readableStream) {
2292 return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
2293 }
2294 function process(asyncIterable, subscriber) {
2295 var asyncIterable_1, asyncIterable_1_1;
2296 var e_2, _a;
2297 return __awaiter(this, void 0, void 0, function () {
2298 var value, e_2_1;
2299 return __generator(this, function (_b) {
2300 switch (_b.label) {
2301 case 0:
2302 _b.trys.push([0, 5, 6, 11]);
2303 asyncIterable_1 = __asyncValues(asyncIterable);
2304 _b.label = 1;
2305 case 1: return [4, asyncIterable_1.next()];
2306 case 2:
2307 if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
2308 value = asyncIterable_1_1.value;
2309 subscriber.next(value);
2310 if (subscriber.closed) {
2311 return [2];
2312 }
2313 _b.label = 3;
2314 case 3: return [3, 1];
2315 case 4: return [3, 11];
2316 case 5:
2317 e_2_1 = _b.sent();
2318 e_2 = { error: e_2_1 };
2319 return [3, 11];
2320 case 6:
2321 _b.trys.push([6, , 9, 10]);
2322 if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
2323 return [4, _a.call(asyncIterable_1)];
2324 case 7:
2325 _b.sent();
2326 _b.label = 8;
2327 case 8: return [3, 10];
2328 case 9:
2329 if (e_2) throw e_2.error;
2330 return [7];
2331 case 10: return [7];
2332 case 11:
2333 subscriber.complete();
2334 return [2];
2335 }
2336 });
2337 });
2338 }
2339
2340 function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
2341 if (delay === void 0) { delay = 0; }
2342 if (repeat === void 0) { repeat = false; }
2343 var scheduleSubscription = scheduler.schedule(function () {
2344 work();
2345 if (repeat) {
2346 parentSubscription.add(this.schedule(null, delay));
2347 }
2348 else {
2349 this.unsubscribe();
2350 }
2351 }, delay);
2352 parentSubscription.add(scheduleSubscription);
2353 if (!repeat) {
2354 return scheduleSubscription;
2355 }
2356 }
2357
2358 function observeOn(scheduler, delay) {
2359 if (delay === void 0) { delay = 0; }
2360 return operate(function (source, subscriber) {
2361 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
2362 });
2363 }
2364
2365 function subscribeOn(scheduler, delay) {
2366 if (delay === void 0) { delay = 0; }
2367 return operate(function (source, subscriber) {
2368 subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
2369 });
2370 }
2371
2372 function scheduleObservable(input, scheduler) {
2373 return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
2374 }
2375
2376 function schedulePromise(input, scheduler) {
2377 return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
2378 }
2379
2380 function scheduleArray(input, scheduler) {
2381 return new Observable(function (subscriber) {
2382 var i = 0;
2383 return scheduler.schedule(function () {
2384 if (i === input.length) {
2385 subscriber.complete();
2386 }
2387 else {
2388 subscriber.next(input[i++]);
2389 if (!subscriber.closed) {
2390 this.schedule();
2391 }
2392 }
2393 });
2394 });
2395 }
2396
2397 function scheduleIterable(input, scheduler) {
2398 return new Observable(function (subscriber) {
2399 var iterator$$1;
2400 executeSchedule(subscriber, scheduler, function () {
2401 iterator$$1 = input[iterator]();
2402 executeSchedule(subscriber, scheduler, function () {
2403 var _a;
2404 var value;
2405 var done;
2406 try {
2407 (_a = iterator$$1.next(), value = _a.value, done = _a.done);
2408 }
2409 catch (err) {
2410 subscriber.error(err);
2411 return;
2412 }
2413 if (done) {
2414 subscriber.complete();
2415 }
2416 else {
2417 subscriber.next(value);
2418 }
2419 }, 0, true);
2420 });
2421 return function () { return isFunction(iterator$$1 === null || iterator$$1 === void 0 ? void 0 : iterator$$1.return) && iterator$$1.return(); };
2422 });
2423 }
2424
2425 function scheduleAsyncIterable(input, scheduler) {
2426 if (!input) {
2427 throw new Error('Iterable cannot be null');
2428 }
2429 return new Observable(function (subscriber) {
2430 executeSchedule(subscriber, scheduler, function () {
2431 var iterator = input[Symbol.asyncIterator]();
2432 executeSchedule(subscriber, scheduler, function () {
2433 iterator.next().then(function (result) {
2434 if (result.done) {
2435 subscriber.complete();
2436 }
2437 else {
2438 subscriber.next(result.value);
2439 }
2440 });
2441 }, 0, true);
2442 });
2443 });
2444 }
2445
2446 function scheduleReadableStreamLike(input, scheduler) {
2447 return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
2448 }
2449
2450 function scheduled(input, scheduler) {
2451 if (input != null) {
2452 if (isInteropObservable(input)) {
2453 return scheduleObservable(input, scheduler);
2454 }
2455 if (isArrayLike(input)) {
2456 return scheduleArray(input, scheduler);
2457 }
2458 if (isPromise(input)) {
2459 return schedulePromise(input, scheduler);
2460 }
2461 if (isAsyncIterable(input)) {
2462 return scheduleAsyncIterable(input, scheduler);
2463 }
2464 if (isIterable(input)) {
2465 return scheduleIterable(input, scheduler);
2466 }
2467 if (isReadableStreamLike(input)) {
2468 return scheduleReadableStreamLike(input, scheduler);
2469 }
2470 }
2471 throw createInvalidObservableTypeError(input);
2472 }
2473
2474 function from(input, scheduler) {
2475 return scheduler ? scheduled(input, scheduler) : innerFrom(input);
2476 }
2477
2478 function of() {
2479 var args = [];
2480 for (var _i = 0; _i < arguments.length; _i++) {
2481 args[_i] = arguments[_i];
2482 }
2483 var scheduler = popScheduler(args);
2484 return from(args, scheduler);
2485 }
2486
2487 function throwError(errorOrErrorFactory, scheduler) {
2488 var errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
2489 var init = function (subscriber) { return subscriber.error(errorFactory()); };
2490 return new Observable(scheduler ? function (subscriber) { return scheduler.schedule(init, 0, subscriber); } : init);
2491 }
2492
2493 (function (NotificationKind) {
2494 NotificationKind["NEXT"] = "N";
2495 NotificationKind["ERROR"] = "E";
2496 NotificationKind["COMPLETE"] = "C";
2497 })(exports.NotificationKind || (exports.NotificationKind = {}));
2498 var Notification = (function () {
2499 function Notification(kind, value, error) {
2500 this.kind = kind;
2501 this.value = value;
2502 this.error = error;
2503 this.hasValue = kind === 'N';
2504 }
2505 Notification.prototype.observe = function (observer) {
2506 return observeNotification(this, observer);
2507 };
2508 Notification.prototype.do = function (nextHandler, errorHandler, completeHandler) {
2509 var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
2510 return kind === 'N' ? nextHandler === null || nextHandler === void 0 ? void 0 : nextHandler(value) : kind === 'E' ? errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error) : completeHandler === null || completeHandler === void 0 ? void 0 : completeHandler();
2511 };
2512 Notification.prototype.accept = function (nextOrObserver, error, complete) {
2513 var _a;
2514 return isFunction((_a = nextOrObserver) === null || _a === void 0 ? void 0 : _a.next)
2515 ? this.observe(nextOrObserver)
2516 : this.do(nextOrObserver, error, complete);
2517 };
2518 Notification.prototype.toObservable = function () {
2519 var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
2520 var result = kind === 'N'
2521 ?
2522 of(value)
2523 :
2524 kind === 'E'
2525 ?
2526 throwError(function () { return error; })
2527 :
2528 kind === 'C'
2529 ?
2530 EMPTY
2531 :
2532 0;
2533 if (!result) {
2534 throw new TypeError("Unexpected notification kind " + kind);
2535 }
2536 return result;
2537 };
2538 Notification.createNext = function (value) {
2539 return new Notification('N', value);
2540 };
2541 Notification.createError = function (err) {
2542 return new Notification('E', undefined, err);
2543 };
2544 Notification.createComplete = function () {
2545 return Notification.completeNotification;
2546 };
2547 Notification.completeNotification = new Notification('C');
2548 return Notification;
2549 }());
2550 function observeNotification(notification, observer) {
2551 var _a, _b, _c;
2552 var _d = notification, kind = _d.kind, value = _d.value, error = _d.error;
2553 if (typeof kind !== 'string') {
2554 throw new TypeError('Invalid notification, missing "kind"');
2555 }
2556 kind === 'N' ? (_a = observer.next) === null || _a === void 0 ? void 0 : _a.call(observer, value) : kind === 'E' ? (_b = observer.error) === null || _b === void 0 ? void 0 : _b.call(observer, error) : (_c = observer.complete) === null || _c === void 0 ? void 0 : _c.call(observer);
2557 }
2558
2559 function isObservable(obj) {
2560 return !!obj && (obj instanceof Observable || (isFunction(obj.lift) && isFunction(obj.subscribe)));
2561 }
2562
2563 var EmptyError = createErrorClass(function (_super) { return function EmptyErrorImpl() {
2564 _super(this);
2565 this.name = 'EmptyError';
2566 this.message = 'no elements in sequence';
2567 }; });
2568
2569 function lastValueFrom(source, config) {
2570 var hasConfig = typeof config === 'object';
2571 return new Promise(function (resolve, reject) {
2572 var _hasValue = false;
2573 var _value;
2574 source.subscribe({
2575 next: function (value) {
2576 _value = value;
2577 _hasValue = true;
2578 },
2579 error: reject,
2580 complete: function () {
2581 if (_hasValue) {
2582 resolve(_value);
2583 }
2584 else if (hasConfig) {
2585 resolve(config.defaultValue);
2586 }
2587 else {
2588 reject(new EmptyError());
2589 }
2590 },
2591 });
2592 });
2593 }
2594
2595 function firstValueFrom(source, config) {
2596 var hasConfig = typeof config === 'object';
2597 return new Promise(function (resolve, reject) {
2598 var subscriber = new SafeSubscriber({
2599 next: function (value) {
2600 resolve(value);
2601 subscriber.unsubscribe();
2602 },
2603 error: reject,
2604 complete: function () {
2605 if (hasConfig) {
2606 resolve(config.defaultValue);
2607 }
2608 else {
2609 reject(new EmptyError());
2610 }
2611 },
2612 });
2613 source.subscribe(subscriber);
2614 });
2615 }
2616
2617 var ArgumentOutOfRangeError = createErrorClass(function (_super) {
2618 return function ArgumentOutOfRangeErrorImpl() {
2619 _super(this);
2620 this.name = 'ArgumentOutOfRangeError';
2621 this.message = 'argument out of range';
2622 };
2623 });
2624
2625 var NotFoundError = createErrorClass(function (_super) {
2626 return function NotFoundErrorImpl(message) {
2627 _super(this);
2628 this.name = 'NotFoundError';
2629 this.message = message;
2630 };
2631 });
2632
2633 var SequenceError = createErrorClass(function (_super) {
2634 return function SequenceErrorImpl(message) {
2635 _super(this);
2636 this.name = 'SequenceError';
2637 this.message = message;
2638 };
2639 });
2640
2641 function isValidDate(value) {
2642 return value instanceof Date && !isNaN(value);
2643 }
2644
2645 var TimeoutError = createErrorClass(function (_super) {
2646 return function TimeoutErrorImpl(info) {
2647 if (info === void 0) { info = null; }
2648 _super(this);
2649 this.message = 'Timeout has occurred';
2650 this.name = 'TimeoutError';
2651 this.info = info;
2652 };
2653 });
2654 function timeout(config, schedulerArg) {
2655 var _a = (isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config), first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
2656 if (first == null && each == null) {
2657 throw new TypeError('No timeout provided.');
2658 }
2659 return operate(function (source, subscriber) {
2660 var originalSourceSubscription;
2661 var timerSubscription;
2662 var lastValue = null;
2663 var seen = 0;
2664 var startTimer = function (delay) {
2665 timerSubscription = executeSchedule(subscriber, scheduler, function () {
2666 try {
2667 originalSourceSubscription.unsubscribe();
2668 innerFrom(_with({
2669 meta: meta,
2670 lastValue: lastValue,
2671 seen: seen,
2672 })).subscribe(subscriber);
2673 }
2674 catch (err) {
2675 subscriber.error(err);
2676 }
2677 }, delay);
2678 };
2679 originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, function (value) {
2680 timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
2681 seen++;
2682 subscriber.next((lastValue = value));
2683 each > 0 && startTimer(each);
2684 }, undefined, undefined, function () {
2685 if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) {
2686 timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
2687 }
2688 lastValue = null;
2689 }));
2690 !seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
2691 });
2692 }
2693 function timeoutErrorFactory(info) {
2694 throw new TimeoutError(info);
2695 }
2696
2697 function map(project, thisArg) {
2698 return operate(function (source, subscriber) {
2699 var index = 0;
2700 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
2701 subscriber.next(project.call(thisArg, value, index++));
2702 }));
2703 });
2704 }
2705
2706 var isArray = Array.isArray;
2707 function callOrApply(fn, args) {
2708 return isArray(args) ? fn.apply(void 0, __spreadArray([], __read(args))) : fn(args);
2709 }
2710 function mapOneOrManyArgs(fn) {
2711 return map(function (args) { return callOrApply(fn, args); });
2712 }
2713
2714 function bindCallbackInternals(isNodeStyle, callbackFunc, resultSelector, scheduler) {
2715 if (resultSelector) {
2716 if (isScheduler(resultSelector)) {
2717 scheduler = resultSelector;
2718 }
2719 else {
2720 return function () {
2721 var args = [];
2722 for (var _i = 0; _i < arguments.length; _i++) {
2723 args[_i] = arguments[_i];
2724 }
2725 return bindCallbackInternals(isNodeStyle, callbackFunc, scheduler)
2726 .apply(this, args)
2727 .pipe(mapOneOrManyArgs(resultSelector));
2728 };
2729 }
2730 }
2731 if (scheduler) {
2732 return function () {
2733 var args = [];
2734 for (var _i = 0; _i < arguments.length; _i++) {
2735 args[_i] = arguments[_i];
2736 }
2737 return bindCallbackInternals(isNodeStyle, callbackFunc)
2738 .apply(this, args)
2739 .pipe(subscribeOn(scheduler), observeOn(scheduler));
2740 };
2741 }
2742 return function () {
2743 var _this = this;
2744 var args = [];
2745 for (var _i = 0; _i < arguments.length; _i++) {
2746 args[_i] = arguments[_i];
2747 }
2748 var subject = new AsyncSubject();
2749 var uninitialized = true;
2750 return new Observable(function (subscriber) {
2751 var subs = subject.subscribe(subscriber);
2752 if (uninitialized) {
2753 uninitialized = false;
2754 var isAsync_1 = false;
2755 var isComplete_1 = false;
2756 callbackFunc.apply(_this, __spreadArray(__spreadArray([], __read(args)), [
2757 function () {
2758 var results = [];
2759 for (var _i = 0; _i < arguments.length; _i++) {
2760 results[_i] = arguments[_i];
2761 }
2762 if (isNodeStyle) {
2763 var err = results.shift();
2764 if (err != null) {
2765 subject.error(err);
2766 return;
2767 }
2768 }
2769 subject.next(1 < results.length ? results : results[0]);
2770 isComplete_1 = true;
2771 if (isAsync_1) {
2772 subject.complete();
2773 }
2774 },
2775 ]));
2776 if (isComplete_1) {
2777 subject.complete();
2778 }
2779 isAsync_1 = true;
2780 }
2781 return subs;
2782 });
2783 };
2784 }
2785
2786 function bindCallback(callbackFunc, resultSelector, scheduler) {
2787 return bindCallbackInternals(false, callbackFunc, resultSelector, scheduler);
2788 }
2789
2790 function bindNodeCallback(callbackFunc, resultSelector, scheduler) {
2791 return bindCallbackInternals(true, callbackFunc, resultSelector, scheduler);
2792 }
2793
2794 var isArray$1 = Array.isArray;
2795 var getPrototypeOf = Object.getPrototypeOf, objectProto = Object.prototype, getKeys = Object.keys;
2796 function argsArgArrayOrObject(args) {
2797 if (args.length === 1) {
2798 var first_1 = args[0];
2799 if (isArray$1(first_1)) {
2800 return { args: first_1, keys: null };
2801 }
2802 if (isPOJO(first_1)) {
2803 var keys = getKeys(first_1);
2804 return {
2805 args: keys.map(function (key) { return first_1[key]; }),
2806 keys: keys,
2807 };
2808 }
2809 }
2810 return { args: args, keys: null };
2811 }
2812 function isPOJO(obj) {
2813 return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;
2814 }
2815
2816 function createObject(keys, values) {
2817 return keys.reduce(function (result, key, i) { return ((result[key] = values[i]), result); }, {});
2818 }
2819
2820 function combineLatest() {
2821 var args = [];
2822 for (var _i = 0; _i < arguments.length; _i++) {
2823 args[_i] = arguments[_i];
2824 }
2825 var scheduler = popScheduler(args);
2826 var resultSelector = popResultSelector(args);
2827 var _a = argsArgArrayOrObject(args), observables = _a.args, keys = _a.keys;
2828 if (observables.length === 0) {
2829 return from([], scheduler);
2830 }
2831 var result = new Observable(combineLatestInit(observables, scheduler, keys
2832 ?
2833 function (values) { return createObject(keys, values); }
2834 :
2835 identity));
2836 return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
2837 }
2838 function combineLatestInit(observables, scheduler, valueTransform) {
2839 if (valueTransform === void 0) { valueTransform = identity; }
2840 return function (subscriber) {
2841 maybeSchedule(scheduler, function () {
2842 var length = observables.length;
2843 var values = new Array(length);
2844 var active = length;
2845 var remainingFirstValues = length;
2846 var _loop_1 = function (i) {
2847 maybeSchedule(scheduler, function () {
2848 var source = from(observables[i], scheduler);
2849 var hasFirstValue = false;
2850 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
2851 values[i] = value;
2852 if (!hasFirstValue) {
2853 hasFirstValue = true;
2854 remainingFirstValues--;
2855 }
2856 if (!remainingFirstValues) {
2857 subscriber.next(valueTransform(values.slice()));
2858 }
2859 }, function () {
2860 if (!--active) {
2861 subscriber.complete();
2862 }
2863 }));
2864 }, subscriber);
2865 };
2866 for (var i = 0; i < length; i++) {
2867 _loop_1(i);
2868 }
2869 }, subscriber);
2870 };
2871 }
2872 function maybeSchedule(scheduler, execute, subscription) {
2873 if (scheduler) {
2874 executeSchedule(subscription, scheduler, execute);
2875 }
2876 else {
2877 execute();
2878 }
2879 }
2880
2881 function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
2882 var buffer = [];
2883 var active = 0;
2884 var index = 0;
2885 var isComplete = false;
2886 var checkComplete = function () {
2887 if (isComplete && !buffer.length && !active) {
2888 subscriber.complete();
2889 }
2890 };
2891 var outerNext = function (value) { return (active < concurrent ? doInnerSub(value) : buffer.push(value)); };
2892 var doInnerSub = function (value) {
2893 expand && subscriber.next(value);
2894 active++;
2895 var innerComplete = false;
2896 innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function (innerValue) {
2897 onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
2898 if (expand) {
2899 outerNext(innerValue);
2900 }
2901 else {
2902 subscriber.next(innerValue);
2903 }
2904 }, function () {
2905 innerComplete = true;
2906 }, undefined, function () {
2907 if (innerComplete) {
2908 try {
2909 active--;
2910 var _loop_1 = function () {
2911 var bufferedValue = buffer.shift();
2912 if (innerSubScheduler) {
2913 executeSchedule(subscriber, innerSubScheduler, function () { return doInnerSub(bufferedValue); });
2914 }
2915 else {
2916 doInnerSub(bufferedValue);
2917 }
2918 };
2919 while (buffer.length && active < concurrent) {
2920 _loop_1();
2921 }
2922 checkComplete();
2923 }
2924 catch (err) {
2925 subscriber.error(err);
2926 }
2927 }
2928 }));
2929 };
2930 source.subscribe(createOperatorSubscriber(subscriber, outerNext, function () {
2931 isComplete = true;
2932 checkComplete();
2933 }));
2934 return function () {
2935 additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
2936 };
2937 }
2938
2939 function mergeMap(project, resultSelector, concurrent) {
2940 if (concurrent === void 0) { concurrent = Infinity; }
2941 if (isFunction(resultSelector)) {
2942 return mergeMap(function (a, i) { return map(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
2943 }
2944 else if (typeof resultSelector === 'number') {
2945 concurrent = resultSelector;
2946 }
2947 return operate(function (source, subscriber) { return mergeInternals(source, subscriber, project, concurrent); });
2948 }
2949
2950 function mergeAll(concurrent) {
2951 if (concurrent === void 0) { concurrent = Infinity; }
2952 return mergeMap(identity, concurrent);
2953 }
2954
2955 function concatAll() {
2956 return mergeAll(1);
2957 }
2958
2959 function concat() {
2960 var args = [];
2961 for (var _i = 0; _i < arguments.length; _i++) {
2962 args[_i] = arguments[_i];
2963 }
2964 return concatAll()(from(args, popScheduler(args)));
2965 }
2966
2967 function defer(observableFactory) {
2968 return new Observable(function (subscriber) {
2969 innerFrom(observableFactory()).subscribe(subscriber);
2970 });
2971 }
2972
2973 var DEFAULT_CONFIG = {
2974 connector: function () { return new Subject(); },
2975 resetOnDisconnect: true,
2976 };
2977 function connectable(source, config) {
2978 if (config === void 0) { config = DEFAULT_CONFIG; }
2979 var connection = null;
2980 var connector = config.connector, _a = config.resetOnDisconnect, resetOnDisconnect = _a === void 0 ? true : _a;
2981 var subject = connector();
2982 var result = new Observable(function (subscriber) {
2983 return subject.subscribe(subscriber);
2984 });
2985 result.connect = function () {
2986 if (!connection || connection.closed) {
2987 connection = defer(function () { return source; }).subscribe(subject);
2988 if (resetOnDisconnect) {
2989 connection.add(function () { return (subject = connector()); });
2990 }
2991 }
2992 return connection;
2993 };
2994 return result;
2995 }
2996
2997 function forkJoin() {
2998 var args = [];
2999 for (var _i = 0; _i < arguments.length; _i++) {
3000 args[_i] = arguments[_i];
3001 }
3002 var resultSelector = popResultSelector(args);
3003 var _a = argsArgArrayOrObject(args), sources = _a.args, keys = _a.keys;
3004 var result = new Observable(function (subscriber) {
3005 var length = sources.length;
3006 if (!length) {
3007 subscriber.complete();
3008 return;
3009 }
3010 var values = new Array(length);
3011 var remainingCompletions = length;
3012 var remainingEmissions = length;
3013 var _loop_1 = function (sourceIndex) {
3014 var hasValue = false;
3015 innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, function (value) {
3016 if (!hasValue) {
3017 hasValue = true;
3018 remainingEmissions--;
3019 }
3020 values[sourceIndex] = value;
3021 }, function () { return remainingCompletions--; }, undefined, function () {
3022 if (!remainingCompletions || !hasValue) {
3023 if (!remainingEmissions) {
3024 subscriber.next(keys ? createObject(keys, values) : values);
3025 }
3026 subscriber.complete();
3027 }
3028 }));
3029 };
3030 for (var sourceIndex = 0; sourceIndex < length; sourceIndex++) {
3031 _loop_1(sourceIndex);
3032 }
3033 });
3034 return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
3035 }
3036
3037 var nodeEventEmitterMethods = ['addListener', 'removeListener'];
3038 var eventTargetMethods = ['addEventListener', 'removeEventListener'];
3039 var jqueryMethods = ['on', 'off'];
3040 function fromEvent(target, eventName, options, resultSelector) {
3041 if (isFunction(options)) {
3042 resultSelector = options;
3043 options = undefined;
3044 }
3045 if (resultSelector) {
3046 return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));
3047 }
3048 var _a = __read(isEventTarget(target)
3049 ? eventTargetMethods.map(function (methodName) { return function (handler) { return target[methodName](eventName, handler, options); }; })
3050 :
3051 isNodeStyleEventEmitter(target)
3052 ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName))
3053 : isJQueryStyleEventEmitter(target)
3054 ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName))
3055 : [], 2), add = _a[0], remove = _a[1];
3056 if (!add) {
3057 if (isArrayLike(target)) {
3058 return mergeMap(function (subTarget) { return fromEvent(subTarget, eventName, options); })(innerFrom(target));
3059 }
3060 }
3061 if (!add) {
3062 throw new TypeError('Invalid event target');
3063 }
3064 return new Observable(function (subscriber) {
3065 var handler = function () {
3066 var args = [];
3067 for (var _i = 0; _i < arguments.length; _i++) {
3068 args[_i] = arguments[_i];
3069 }
3070 return subscriber.next(1 < args.length ? args : args[0]);
3071 };
3072 add(handler);
3073 return function () { return remove(handler); };
3074 });
3075 }
3076 function toCommonHandlerRegistry(target, eventName) {
3077 return function (methodName) { return function (handler) { return target[methodName](eventName, handler); }; };
3078 }
3079 function isNodeStyleEventEmitter(target) {
3080 return isFunction(target.addListener) && isFunction(target.removeListener);
3081 }
3082 function isJQueryStyleEventEmitter(target) {
3083 return isFunction(target.on) && isFunction(target.off);
3084 }
3085 function isEventTarget(target) {
3086 return isFunction(target.addEventListener) && isFunction(target.removeEventListener);
3087 }
3088
3089 function fromEventPattern(addHandler, removeHandler, resultSelector) {
3090 if (resultSelector) {
3091 return fromEventPattern(addHandler, removeHandler).pipe(mapOneOrManyArgs(resultSelector));
3092 }
3093 return new Observable(function (subscriber) {
3094 var handler = function () {
3095 var e = [];
3096 for (var _i = 0; _i < arguments.length; _i++) {
3097 e[_i] = arguments[_i];
3098 }
3099 return subscriber.next(e.length === 1 ? e[0] : e);
3100 };
3101 var retValue = addHandler(handler);
3102 return isFunction(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
3103 });
3104 }
3105
3106 function generate(initialStateOrOptions, condition, iterate, resultSelectorOrScheduler, scheduler) {
3107 var _a, _b;
3108 var resultSelector;
3109 var initialState;
3110 if (arguments.length === 1) {
3111 (_a = initialStateOrOptions, initialState = _a.initialState, condition = _a.condition, iterate = _a.iterate, _b = _a.resultSelector, resultSelector = _b === void 0 ? identity : _b, scheduler = _a.scheduler);
3112 }
3113 else {
3114 initialState = initialStateOrOptions;
3115 if (!resultSelectorOrScheduler || isScheduler(resultSelectorOrScheduler)) {
3116 resultSelector = identity;
3117 scheduler = resultSelectorOrScheduler;
3118 }
3119 else {
3120 resultSelector = resultSelectorOrScheduler;
3121 }
3122 }
3123 function gen() {
3124 var state;
3125 return __generator(this, function (_a) {
3126 switch (_a.label) {
3127 case 0:
3128 state = initialState;
3129 _a.label = 1;
3130 case 1:
3131 if (!(!condition || condition(state))) return [3, 4];
3132 return [4, resultSelector(state)];
3133 case 2:
3134 _a.sent();
3135 _a.label = 3;
3136 case 3:
3137 state = iterate(state);
3138 return [3, 1];
3139 case 4: return [2];
3140 }
3141 });
3142 }
3143 return defer((scheduler
3144 ?
3145 function () { return scheduleIterable(gen(), scheduler); }
3146 :
3147 gen));
3148 }
3149
3150 function iif(condition, trueResult, falseResult) {
3151 return defer(function () { return (condition() ? trueResult : falseResult); });
3152 }
3153
3154 function timer(dueTime, intervalOrScheduler, scheduler) {
3155 if (dueTime === void 0) { dueTime = 0; }
3156 if (scheduler === void 0) { scheduler = async; }
3157 var intervalDuration = -1;
3158 if (intervalOrScheduler != null) {
3159 if (isScheduler(intervalOrScheduler)) {
3160 scheduler = intervalOrScheduler;
3161 }
3162 else {
3163 intervalDuration = intervalOrScheduler;
3164 }
3165 }
3166 return new Observable(function (subscriber) {
3167 var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
3168 if (due < 0) {
3169 due = 0;
3170 }
3171 var n = 0;
3172 return scheduler.schedule(function () {
3173 if (!subscriber.closed) {
3174 subscriber.next(n++);
3175 if (0 <= intervalDuration) {
3176 this.schedule(undefined, intervalDuration);
3177 }
3178 else {
3179 subscriber.complete();
3180 }
3181 }
3182 }, due);
3183 });
3184 }
3185
3186 function interval(period, scheduler) {
3187 if (period === void 0) { period = 0; }
3188 if (scheduler === void 0) { scheduler = asyncScheduler; }
3189 if (period < 0) {
3190 period = 0;
3191 }
3192 return timer(period, period, scheduler);
3193 }
3194
3195 function merge() {
3196 var args = [];
3197 for (var _i = 0; _i < arguments.length; _i++) {
3198 args[_i] = arguments[_i];
3199 }
3200 var scheduler = popScheduler(args);
3201 var concurrent = popNumber(args, Infinity);
3202 var sources = args;
3203 return !sources.length
3204 ?
3205 EMPTY
3206 : sources.length === 1
3207 ?
3208 innerFrom(sources[0])
3209 :
3210 mergeAll(concurrent)(from(sources, scheduler));
3211 }
3212
3213 var NEVER = new Observable(noop);
3214 function never() {
3215 return NEVER;
3216 }
3217
3218 var isArray$2 = Array.isArray;
3219 function argsOrArgArray(args) {
3220 return args.length === 1 && isArray$2(args[0]) ? args[0] : args;
3221 }
3222
3223 function onErrorResumeNext() {
3224 var sources = [];
3225 for (var _i = 0; _i < arguments.length; _i++) {
3226 sources[_i] = arguments[_i];
3227 }
3228 var nextSources = argsOrArgArray(sources);
3229 return new Observable(function (subscriber) {
3230 var sourceIndex = 0;
3231 var subscribeNext = function () {
3232 if (sourceIndex < nextSources.length) {
3233 var nextSource = void 0;
3234 try {
3235 nextSource = innerFrom(nextSources[sourceIndex++]);
3236 }
3237 catch (err) {
3238 subscribeNext();
3239 return;
3240 }
3241 var innerSubscriber = new OperatorSubscriber(subscriber, undefined, noop, noop);
3242 nextSource.subscribe(innerSubscriber);
3243 innerSubscriber.add(subscribeNext);
3244 }
3245 else {
3246 subscriber.complete();
3247 }
3248 };
3249 subscribeNext();
3250 });
3251 }
3252
3253 function pairs(obj, scheduler) {
3254 return from(Object.entries(obj), scheduler);
3255 }
3256
3257 function not(pred, thisArg) {
3258 return function (value, index) { return !pred.call(thisArg, value, index); };
3259 }
3260
3261 function filter(predicate, thisArg) {
3262 return operate(function (source, subscriber) {
3263 var index = 0;
3264 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
3265 });
3266 }
3267
3268 function partition(source, predicate, thisArg) {
3269 return [filter(predicate, thisArg)(innerFrom(source)), filter(not(predicate, thisArg))(innerFrom(source))];
3270 }
3271
3272 function race() {
3273 var sources = [];
3274 for (var _i = 0; _i < arguments.length; _i++) {
3275 sources[_i] = arguments[_i];
3276 }
3277 sources = argsOrArgArray(sources);
3278 return sources.length === 1 ? innerFrom(sources[0]) : new Observable(raceInit(sources));
3279 }
3280 function raceInit(sources) {
3281 return function (subscriber) {
3282 var subscriptions = [];
3283 var _loop_1 = function (i) {
3284 subscriptions.push(innerFrom(sources[i]).subscribe(createOperatorSubscriber(subscriber, function (value) {
3285 if (subscriptions) {
3286 for (var s = 0; s < subscriptions.length; s++) {
3287 s !== i && subscriptions[s].unsubscribe();
3288 }
3289 subscriptions = null;
3290 }
3291 subscriber.next(value);
3292 })));
3293 };
3294 for (var i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) {
3295 _loop_1(i);
3296 }
3297 };
3298 }
3299
3300 function range(start, count, scheduler) {
3301 if (count == null) {
3302 count = start;
3303 start = 0;
3304 }
3305 if (count <= 0) {
3306 return EMPTY;
3307 }
3308 var end = count + start;
3309 return new Observable(scheduler
3310 ?
3311 function (subscriber) {
3312 var n = start;
3313 return scheduler.schedule(function () {
3314 if (n < end) {
3315 subscriber.next(n++);
3316 this.schedule();
3317 }
3318 else {
3319 subscriber.complete();
3320 }
3321 });
3322 }
3323 :
3324 function (subscriber) {
3325 var n = start;
3326 while (n < end && !subscriber.closed) {
3327 subscriber.next(n++);
3328 }
3329 subscriber.complete();
3330 });
3331 }
3332
3333 function using(resourceFactory, observableFactory) {
3334 return new Observable(function (subscriber) {
3335 var resource = resourceFactory();
3336 var result = observableFactory(resource);
3337 var source = result ? innerFrom(result) : EMPTY;
3338 source.subscribe(subscriber);
3339 return function () {
3340 if (resource) {
3341 resource.unsubscribe();
3342 }
3343 };
3344 });
3345 }
3346
3347 function zip() {
3348 var args = [];
3349 for (var _i = 0; _i < arguments.length; _i++) {
3350 args[_i] = arguments[_i];
3351 }
3352 var resultSelector = popResultSelector(args);
3353 var sources = argsOrArgArray(args);
3354 return sources.length
3355 ? new Observable(function (subscriber) {
3356 var buffers = sources.map(function () { return []; });
3357 var completed = sources.map(function () { return false; });
3358 subscriber.add(function () {
3359 buffers = completed = null;
3360 });
3361 var _loop_1 = function (sourceIndex) {
3362 innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, function (value) {
3363 buffers[sourceIndex].push(value);
3364 if (buffers.every(function (buffer) { return buffer.length; })) {
3365 var result = buffers.map(function (buffer) { return buffer.shift(); });
3366 subscriber.next(resultSelector ? resultSelector.apply(void 0, __spreadArray([], __read(result))) : result);
3367 if (buffers.some(function (buffer, i) { return !buffer.length && completed[i]; })) {
3368 subscriber.complete();
3369 }
3370 }
3371 }, function () {
3372 completed[sourceIndex] = true;
3373 !buffers[sourceIndex].length && subscriber.complete();
3374 }));
3375 };
3376 for (var sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {
3377 _loop_1(sourceIndex);
3378 }
3379 return function () {
3380 buffers = completed = null;
3381 };
3382 })
3383 : EMPTY;
3384 }
3385
3386 function audit(durationSelector) {
3387 return operate(function (source, subscriber) {
3388 var hasValue = false;
3389 var lastValue = null;
3390 var durationSubscriber = null;
3391 var isComplete = false;
3392 var endDuration = function () {
3393 durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
3394 durationSubscriber = null;
3395 if (hasValue) {
3396 hasValue = false;
3397 var value = lastValue;
3398 lastValue = null;
3399 subscriber.next(value);
3400 }
3401 isComplete && subscriber.complete();
3402 };
3403 var cleanupDuration = function () {
3404 durationSubscriber = null;
3405 isComplete && subscriber.complete();
3406 };
3407 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3408 hasValue = true;
3409 lastValue = value;
3410 if (!durationSubscriber) {
3411 innerFrom(durationSelector(value)).subscribe((durationSubscriber = createOperatorSubscriber(subscriber, endDuration, cleanupDuration)));
3412 }
3413 }, function () {
3414 isComplete = true;
3415 (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
3416 }));
3417 });
3418 }
3419
3420 function auditTime(duration, scheduler) {
3421 if (scheduler === void 0) { scheduler = asyncScheduler; }
3422 return audit(function () { return timer(duration, scheduler); });
3423 }
3424
3425 function buffer(closingNotifier) {
3426 return operate(function (source, subscriber) {
3427 var currentBuffer = [];
3428 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return currentBuffer.push(value); }, function () {
3429 subscriber.next(currentBuffer);
3430 subscriber.complete();
3431 }));
3432 innerFrom(closingNotifier).subscribe(createOperatorSubscriber(subscriber, function () {
3433 var b = currentBuffer;
3434 currentBuffer = [];
3435 subscriber.next(b);
3436 }, noop));
3437 return function () {
3438 currentBuffer = null;
3439 };
3440 });
3441 }
3442
3443 function bufferCount(bufferSize, startBufferEvery) {
3444 if (startBufferEvery === void 0) { startBufferEvery = null; }
3445 startBufferEvery = startBufferEvery !== null && startBufferEvery !== void 0 ? startBufferEvery : bufferSize;
3446 return operate(function (source, subscriber) {
3447 var buffers = [];
3448 var count = 0;
3449 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3450 var e_1, _a, e_2, _b;
3451 var toEmit = null;
3452 if (count++ % startBufferEvery === 0) {
3453 buffers.push([]);
3454 }
3455 try {
3456 for (var buffers_1 = __values(buffers), buffers_1_1 = buffers_1.next(); !buffers_1_1.done; buffers_1_1 = buffers_1.next()) {
3457 var buffer = buffers_1_1.value;
3458 buffer.push(value);
3459 if (bufferSize <= buffer.length) {
3460 toEmit = toEmit !== null && toEmit !== void 0 ? toEmit : [];
3461 toEmit.push(buffer);
3462 }
3463 }
3464 }
3465 catch (e_1_1) { e_1 = { error: e_1_1 }; }
3466 finally {
3467 try {
3468 if (buffers_1_1 && !buffers_1_1.done && (_a = buffers_1.return)) _a.call(buffers_1);
3469 }
3470 finally { if (e_1) throw e_1.error; }
3471 }
3472 if (toEmit) {
3473 try {
3474 for (var toEmit_1 = __values(toEmit), toEmit_1_1 = toEmit_1.next(); !toEmit_1_1.done; toEmit_1_1 = toEmit_1.next()) {
3475 var buffer = toEmit_1_1.value;
3476 arrRemove(buffers, buffer);
3477 subscriber.next(buffer);
3478 }
3479 }
3480 catch (e_2_1) { e_2 = { error: e_2_1 }; }
3481 finally {
3482 try {
3483 if (toEmit_1_1 && !toEmit_1_1.done && (_b = toEmit_1.return)) _b.call(toEmit_1);
3484 }
3485 finally { if (e_2) throw e_2.error; }
3486 }
3487 }
3488 }, function () {
3489 var e_3, _a;
3490 try {
3491 for (var buffers_2 = __values(buffers), buffers_2_1 = buffers_2.next(); !buffers_2_1.done; buffers_2_1 = buffers_2.next()) {
3492 var buffer = buffers_2_1.value;
3493 subscriber.next(buffer);
3494 }
3495 }
3496 catch (e_3_1) { e_3 = { error: e_3_1 }; }
3497 finally {
3498 try {
3499 if (buffers_2_1 && !buffers_2_1.done && (_a = buffers_2.return)) _a.call(buffers_2);
3500 }
3501 finally { if (e_3) throw e_3.error; }
3502 }
3503 subscriber.complete();
3504 }, undefined, function () {
3505 buffers = null;
3506 }));
3507 });
3508 }
3509
3510 function bufferTime(bufferTimeSpan) {
3511 var _a, _b;
3512 var otherArgs = [];
3513 for (var _i = 1; _i < arguments.length; _i++) {
3514 otherArgs[_i - 1] = arguments[_i];
3515 }
3516 var scheduler = (_a = popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : asyncScheduler;
3517 var bufferCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
3518 var maxBufferSize = otherArgs[1] || Infinity;
3519 return operate(function (source, subscriber) {
3520 var bufferRecords = [];
3521 var restartOnEmit = false;
3522 var emit = function (record) {
3523 var buffer = record.buffer, subs = record.subs;
3524 subs.unsubscribe();
3525 arrRemove(bufferRecords, record);
3526 subscriber.next(buffer);
3527 restartOnEmit && startBuffer();
3528 };
3529 var startBuffer = function () {
3530 if (bufferRecords) {
3531 var subs = new Subscription();
3532 subscriber.add(subs);
3533 var buffer = [];
3534 var record_1 = {
3535 buffer: buffer,
3536 subs: subs,
3537 };
3538 bufferRecords.push(record_1);
3539 executeSchedule(subs, scheduler, function () { return emit(record_1); }, bufferTimeSpan);
3540 }
3541 };
3542 if (bufferCreationInterval !== null && bufferCreationInterval >= 0) {
3543 executeSchedule(subscriber, scheduler, startBuffer, bufferCreationInterval, true);
3544 }
3545 else {
3546 restartOnEmit = true;
3547 }
3548 startBuffer();
3549 var bufferTimeSubscriber = createOperatorSubscriber(subscriber, function (value) {
3550 var e_1, _a;
3551 var recordsCopy = bufferRecords.slice();
3552 try {
3553 for (var recordsCopy_1 = __values(recordsCopy), recordsCopy_1_1 = recordsCopy_1.next(); !recordsCopy_1_1.done; recordsCopy_1_1 = recordsCopy_1.next()) {
3554 var record = recordsCopy_1_1.value;
3555 var buffer = record.buffer;
3556 buffer.push(value);
3557 maxBufferSize <= buffer.length && emit(record);
3558 }
3559 }
3560 catch (e_1_1) { e_1 = { error: e_1_1 }; }
3561 finally {
3562 try {
3563 if (recordsCopy_1_1 && !recordsCopy_1_1.done && (_a = recordsCopy_1.return)) _a.call(recordsCopy_1);
3564 }
3565 finally { if (e_1) throw e_1.error; }
3566 }
3567 }, function () {
3568 while (bufferRecords === null || bufferRecords === void 0 ? void 0 : bufferRecords.length) {
3569 subscriber.next(bufferRecords.shift().buffer);
3570 }
3571 bufferTimeSubscriber === null || bufferTimeSubscriber === void 0 ? void 0 : bufferTimeSubscriber.unsubscribe();
3572 subscriber.complete();
3573 subscriber.unsubscribe();
3574 }, undefined, function () { return (bufferRecords = null); });
3575 source.subscribe(bufferTimeSubscriber);
3576 });
3577 }
3578
3579 function bufferToggle(openings, closingSelector) {
3580 return operate(function (source, subscriber) {
3581 var buffers = [];
3582 innerFrom(openings).subscribe(createOperatorSubscriber(subscriber, function (openValue) {
3583 var buffer = [];
3584 buffers.push(buffer);
3585 var closingSubscription = new Subscription();
3586 var emitBuffer = function () {
3587 arrRemove(buffers, buffer);
3588 subscriber.next(buffer);
3589 closingSubscription.unsubscribe();
3590 };
3591 closingSubscription.add(innerFrom(closingSelector(openValue)).subscribe(createOperatorSubscriber(subscriber, emitBuffer, noop)));
3592 }, noop));
3593 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3594 var e_1, _a;
3595 try {
3596 for (var buffers_1 = __values(buffers), buffers_1_1 = buffers_1.next(); !buffers_1_1.done; buffers_1_1 = buffers_1.next()) {
3597 var buffer = buffers_1_1.value;
3598 buffer.push(value);
3599 }
3600 }
3601 catch (e_1_1) { e_1 = { error: e_1_1 }; }
3602 finally {
3603 try {
3604 if (buffers_1_1 && !buffers_1_1.done && (_a = buffers_1.return)) _a.call(buffers_1);
3605 }
3606 finally { if (e_1) throw e_1.error; }
3607 }
3608 }, function () {
3609 while (buffers.length > 0) {
3610 subscriber.next(buffers.shift());
3611 }
3612 subscriber.complete();
3613 }));
3614 });
3615 }
3616
3617 function bufferWhen(closingSelector) {
3618 return operate(function (source, subscriber) {
3619 var buffer = null;
3620 var closingSubscriber = null;
3621 var openBuffer = function () {
3622 closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
3623 var b = buffer;
3624 buffer = [];
3625 b && subscriber.next(b);
3626 innerFrom(closingSelector()).subscribe((closingSubscriber = createOperatorSubscriber(subscriber, openBuffer, noop)));
3627 };
3628 openBuffer();
3629 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return buffer === null || buffer === void 0 ? void 0 : buffer.push(value); }, function () {
3630 buffer && subscriber.next(buffer);
3631 subscriber.complete();
3632 }, undefined, function () { return (buffer = closingSubscriber = null); }));
3633 });
3634 }
3635
3636 function catchError(selector) {
3637 return operate(function (source, subscriber) {
3638 var innerSub = null;
3639 var syncUnsub = false;
3640 var handledResult;
3641 innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
3642 handledResult = innerFrom(selector(err, catchError(selector)(source)));
3643 if (innerSub) {
3644 innerSub.unsubscribe();
3645 innerSub = null;
3646 handledResult.subscribe(subscriber);
3647 }
3648 else {
3649 syncUnsub = true;
3650 }
3651 }));
3652 if (syncUnsub) {
3653 innerSub.unsubscribe();
3654 innerSub = null;
3655 handledResult.subscribe(subscriber);
3656 }
3657 });
3658 }
3659
3660 function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
3661 return function (source, subscriber) {
3662 var hasState = hasSeed;
3663 var state = seed;
3664 var index = 0;
3665 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3666 var i = index++;
3667 state = hasState
3668 ?
3669 accumulator(state, value, i)
3670 :
3671 ((hasState = true), value);
3672 emitOnNext && subscriber.next(state);
3673 }, emitBeforeComplete &&
3674 (function () {
3675 hasState && subscriber.next(state);
3676 subscriber.complete();
3677 })));
3678 };
3679 }
3680
3681 function reduce(accumulator, seed) {
3682 return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));
3683 }
3684
3685 var arrReducer = function (arr, value) { return (arr.push(value), arr); };
3686 function toArray() {
3687 return operate(function (source, subscriber) {
3688 reduce(arrReducer, [])(source).subscribe(subscriber);
3689 });
3690 }
3691
3692 function joinAllInternals(joinFn, project) {
3693 return pipe(toArray(), mergeMap(function (sources) { return joinFn(sources); }), project ? mapOneOrManyArgs(project) : identity);
3694 }
3695
3696 function combineLatestAll(project) {
3697 return joinAllInternals(combineLatest, project);
3698 }
3699
3700 var combineAll = combineLatestAll;
3701
3702 function combineLatest$1() {
3703 var args = [];
3704 for (var _i = 0; _i < arguments.length; _i++) {
3705 args[_i] = arguments[_i];
3706 }
3707 var resultSelector = popResultSelector(args);
3708 return resultSelector
3709 ? pipe(combineLatest$1.apply(void 0, __spreadArray([], __read(args))), mapOneOrManyArgs(resultSelector))
3710 : operate(function (source, subscriber) {
3711 combineLatestInit(__spreadArray([source], __read(argsOrArgArray(args))))(subscriber);
3712 });
3713 }
3714
3715 function combineLatestWith() {
3716 var otherSources = [];
3717 for (var _i = 0; _i < arguments.length; _i++) {
3718 otherSources[_i] = arguments[_i];
3719 }
3720 return combineLatest$1.apply(void 0, __spreadArray([], __read(otherSources)));
3721 }
3722
3723 function concatMap(project, resultSelector) {
3724 return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
3725 }
3726
3727 function concatMapTo(innerObservable, resultSelector) {
3728 return isFunction(resultSelector) ? concatMap(function () { return innerObservable; }, resultSelector) : concatMap(function () { return innerObservable; });
3729 }
3730
3731 function concat$1() {
3732 var args = [];
3733 for (var _i = 0; _i < arguments.length; _i++) {
3734 args[_i] = arguments[_i];
3735 }
3736 var scheduler = popScheduler(args);
3737 return operate(function (source, subscriber) {
3738 concatAll()(from(__spreadArray([source], __read(args)), scheduler)).subscribe(subscriber);
3739 });
3740 }
3741
3742 function concatWith() {
3743 var otherSources = [];
3744 for (var _i = 0; _i < arguments.length; _i++) {
3745 otherSources[_i] = arguments[_i];
3746 }
3747 return concat$1.apply(void 0, __spreadArray([], __read(otherSources)));
3748 }
3749
3750 function fromSubscribable(subscribable) {
3751 return new Observable(function (subscriber) { return subscribable.subscribe(subscriber); });
3752 }
3753
3754 var DEFAULT_CONFIG$1 = {
3755 connector: function () { return new Subject(); },
3756 };
3757 function connect(selector, config) {
3758 if (config === void 0) { config = DEFAULT_CONFIG$1; }
3759 var connector = config.connector;
3760 return operate(function (source, subscriber) {
3761 var subject = connector();
3762 innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);
3763 subscriber.add(source.subscribe(subject));
3764 });
3765 }
3766
3767 function count(predicate) {
3768 return reduce(function (total, value, i) { return (!predicate || predicate(value, i) ? total + 1 : total); }, 0);
3769 }
3770
3771 function debounce(durationSelector) {
3772 return operate(function (source, subscriber) {
3773 var hasValue = false;
3774 var lastValue = null;
3775 var durationSubscriber = null;
3776 var emit = function () {
3777 durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
3778 durationSubscriber = null;
3779 if (hasValue) {
3780 hasValue = false;
3781 var value = lastValue;
3782 lastValue = null;
3783 subscriber.next(value);
3784 }
3785 };
3786 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3787 durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
3788 hasValue = true;
3789 lastValue = value;
3790 durationSubscriber = createOperatorSubscriber(subscriber, emit, noop);
3791 innerFrom(durationSelector(value)).subscribe(durationSubscriber);
3792 }, function () {
3793 emit();
3794 subscriber.complete();
3795 }, undefined, function () {
3796 lastValue = durationSubscriber = null;
3797 }));
3798 });
3799 }
3800
3801 function debounceTime(dueTime, scheduler) {
3802 if (scheduler === void 0) { scheduler = asyncScheduler; }
3803 return operate(function (source, subscriber) {
3804 var activeTask = null;
3805 var lastValue = null;
3806 var lastTime = null;
3807 var emit = function () {
3808 if (activeTask) {
3809 activeTask.unsubscribe();
3810 activeTask = null;
3811 var value = lastValue;
3812 lastValue = null;
3813 subscriber.next(value);
3814 }
3815 };
3816 function emitWhenIdle() {
3817 var targetTime = lastTime + dueTime;
3818 var now = scheduler.now();
3819 if (now < targetTime) {
3820 activeTask = this.schedule(undefined, targetTime - now);
3821 subscriber.add(activeTask);
3822 return;
3823 }
3824 emit();
3825 }
3826 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3827 lastValue = value;
3828 lastTime = scheduler.now();
3829 if (!activeTask) {
3830 activeTask = scheduler.schedule(emitWhenIdle, dueTime);
3831 subscriber.add(activeTask);
3832 }
3833 }, function () {
3834 emit();
3835 subscriber.complete();
3836 }, undefined, function () {
3837 lastValue = activeTask = null;
3838 }));
3839 });
3840 }
3841
3842 function defaultIfEmpty(defaultValue) {
3843 return operate(function (source, subscriber) {
3844 var hasValue = false;
3845 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3846 hasValue = true;
3847 subscriber.next(value);
3848 }, function () {
3849 if (!hasValue) {
3850 subscriber.next(defaultValue);
3851 }
3852 subscriber.complete();
3853 }));
3854 });
3855 }
3856
3857 function take(count) {
3858 return count <= 0
3859 ?
3860 function () { return EMPTY; }
3861 : operate(function (source, subscriber) {
3862 var seen = 0;
3863 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3864 if (++seen <= count) {
3865 subscriber.next(value);
3866 if (count <= seen) {
3867 subscriber.complete();
3868 }
3869 }
3870 }));
3871 });
3872 }
3873
3874 function ignoreElements() {
3875 return operate(function (source, subscriber) {
3876 source.subscribe(createOperatorSubscriber(subscriber, noop));
3877 });
3878 }
3879
3880 function mapTo(value) {
3881 return map(function () { return value; });
3882 }
3883
3884 function delayWhen(delayDurationSelector, subscriptionDelay) {
3885 if (subscriptionDelay) {
3886 return function (source) {
3887 return concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
3888 };
3889 }
3890 return mergeMap(function (value, index) { return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)); });
3891 }
3892
3893 function delay(due, scheduler) {
3894 if (scheduler === void 0) { scheduler = asyncScheduler; }
3895 var duration = timer(due, scheduler);
3896 return delayWhen(function () { return duration; });
3897 }
3898
3899 function dematerialize() {
3900 return operate(function (source, subscriber) {
3901 source.subscribe(createOperatorSubscriber(subscriber, function (notification) { return observeNotification(notification, subscriber); }));
3902 });
3903 }
3904
3905 function distinct(keySelector, flushes) {
3906 return operate(function (source, subscriber) {
3907 var distinctKeys = new Set();
3908 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3909 var key = keySelector ? keySelector(value) : value;
3910 if (!distinctKeys.has(key)) {
3911 distinctKeys.add(key);
3912 subscriber.next(value);
3913 }
3914 }));
3915 flushes && innerFrom(flushes).subscribe(createOperatorSubscriber(subscriber, function () { return distinctKeys.clear(); }, noop));
3916 });
3917 }
3918
3919 function distinctUntilChanged(comparator, keySelector) {
3920 if (keySelector === void 0) { keySelector = identity; }
3921 comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
3922 return operate(function (source, subscriber) {
3923 var previousKey;
3924 var first = true;
3925 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3926 var currentKey = keySelector(value);
3927 if (first || !comparator(previousKey, currentKey)) {
3928 first = false;
3929 previousKey = currentKey;
3930 subscriber.next(value);
3931 }
3932 }));
3933 });
3934 }
3935 function defaultCompare(a, b) {
3936 return a === b;
3937 }
3938
3939 function distinctUntilKeyChanged(key, compare) {
3940 return distinctUntilChanged(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; });
3941 }
3942
3943 function throwIfEmpty(errorFactory) {
3944 if (errorFactory === void 0) { errorFactory = defaultErrorFactory; }
3945 return operate(function (source, subscriber) {
3946 var hasValue = false;
3947 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3948 hasValue = true;
3949 subscriber.next(value);
3950 }, function () { return (hasValue ? subscriber.complete() : subscriber.error(errorFactory())); }));
3951 });
3952 }
3953 function defaultErrorFactory() {
3954 return new EmptyError();
3955 }
3956
3957 function elementAt(index, defaultValue) {
3958 if (index < 0) {
3959 throw new ArgumentOutOfRangeError();
3960 }
3961 var hasDefaultValue = arguments.length >= 2;
3962 return function (source) {
3963 return source.pipe(filter(function (v, i) { return i === index; }), take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function () { return new ArgumentOutOfRangeError(); }));
3964 };
3965 }
3966
3967 function endWith() {
3968 var values = [];
3969 for (var _i = 0; _i < arguments.length; _i++) {
3970 values[_i] = arguments[_i];
3971 }
3972 return function (source) { return concat(source, of.apply(void 0, __spreadArray([], __read(values)))); };
3973 }
3974
3975 function every(predicate, thisArg) {
3976 return operate(function (source, subscriber) {
3977 var index = 0;
3978 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
3979 if (!predicate.call(thisArg, value, index++, source)) {
3980 subscriber.next(false);
3981 subscriber.complete();
3982 }
3983 }, function () {
3984 subscriber.next(true);
3985 subscriber.complete();
3986 }));
3987 });
3988 }
3989
3990 function exhaustMap(project, resultSelector) {
3991 if (resultSelector) {
3992 return function (source) {
3993 return source.pipe(exhaustMap(function (a, i) { return innerFrom(project(a, i)).pipe(map(function (b, ii) { return resultSelector(a, b, i, ii); })); }));
3994 };
3995 }
3996 return operate(function (source, subscriber) {
3997 var index = 0;
3998 var innerSub = null;
3999 var isComplete = false;
4000 source.subscribe(createOperatorSubscriber(subscriber, function (outerValue) {
4001 if (!innerSub) {
4002 innerSub = createOperatorSubscriber(subscriber, undefined, function () {
4003 innerSub = null;
4004 isComplete && subscriber.complete();
4005 });
4006 innerFrom(project(outerValue, index++)).subscribe(innerSub);
4007 }
4008 }, function () {
4009 isComplete = true;
4010 !innerSub && subscriber.complete();
4011 }));
4012 });
4013 }
4014
4015 function exhaustAll() {
4016 return exhaustMap(identity);
4017 }
4018
4019 var exhaust = exhaustAll;
4020
4021 function expand(project, concurrent, scheduler) {
4022 if (concurrent === void 0) { concurrent = Infinity; }
4023 concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
4024 return operate(function (source, subscriber) {
4025 return mergeInternals(source, subscriber, project, concurrent, undefined, true, scheduler);
4026 });
4027 }
4028
4029 function finalize(callback) {
4030 return operate(function (source, subscriber) {
4031 try {
4032 source.subscribe(subscriber);
4033 }
4034 finally {
4035 subscriber.add(callback);
4036 }
4037 });
4038 }
4039
4040 function find(predicate, thisArg) {
4041 return operate(createFind(predicate, thisArg, 'value'));
4042 }
4043 function createFind(predicate, thisArg, emit) {
4044 var findIndex = emit === 'index';
4045 return function (source, subscriber) {
4046 var index = 0;
4047 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4048 var i = index++;
4049 if (predicate.call(thisArg, value, i, source)) {
4050 subscriber.next(findIndex ? i : value);
4051 subscriber.complete();
4052 }
4053 }, function () {
4054 subscriber.next(findIndex ? -1 : undefined);
4055 subscriber.complete();
4056 }));
4057 };
4058 }
4059
4060 function findIndex(predicate, thisArg) {
4061 return operate(createFind(predicate, thisArg, 'index'));
4062 }
4063
4064 function first(predicate, defaultValue) {
4065 var hasDefaultValue = arguments.length >= 2;
4066 return function (source) {
4067 return source.pipe(predicate ? filter(function (v, i) { return predicate(v, i, source); }) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function () { return new EmptyError(); }));
4068 };
4069 }
4070
4071 function groupBy(keySelector, elementOrOptions, duration, connector) {
4072 return operate(function (source, subscriber) {
4073 var element;
4074 if (!elementOrOptions || typeof elementOrOptions === 'function') {
4075 element = elementOrOptions;
4076 }
4077 else {
4078 (duration = elementOrOptions.duration, element = elementOrOptions.element, connector = elementOrOptions.connector);
4079 }
4080 var groups = new Map();
4081 var notify = function (cb) {
4082 groups.forEach(cb);
4083 cb(subscriber);
4084 };
4085 var handleError = function (err) { return notify(function (consumer) { return consumer.error(err); }); };
4086 var activeGroups = 0;
4087 var teardownAttempted = false;
4088 var groupBySourceSubscriber = new OperatorSubscriber(subscriber, function (value) {
4089 try {
4090 var key_1 = keySelector(value);
4091 var group_1 = groups.get(key_1);
4092 if (!group_1) {
4093 groups.set(key_1, (group_1 = connector ? connector() : new Subject()));
4094 var grouped = createGroupedObservable(key_1, group_1);
4095 subscriber.next(grouped);
4096 if (duration) {
4097 var durationSubscriber_1 = createOperatorSubscriber(group_1, function () {
4098 group_1.complete();
4099 durationSubscriber_1 === null || durationSubscriber_1 === void 0 ? void 0 : durationSubscriber_1.unsubscribe();
4100 }, undefined, undefined, function () { return groups.delete(key_1); });
4101 groupBySourceSubscriber.add(innerFrom(duration(grouped)).subscribe(durationSubscriber_1));
4102 }
4103 }
4104 group_1.next(element ? element(value) : value);
4105 }
4106 catch (err) {
4107 handleError(err);
4108 }
4109 }, function () { return notify(function (consumer) { return consumer.complete(); }); }, handleError, function () { return groups.clear(); }, function () {
4110 teardownAttempted = true;
4111 return activeGroups === 0;
4112 });
4113 source.subscribe(groupBySourceSubscriber);
4114 function createGroupedObservable(key, groupSubject) {
4115 var result = new Observable(function (groupSubscriber) {
4116 activeGroups++;
4117 var innerSub = groupSubject.subscribe(groupSubscriber);
4118 return function () {
4119 innerSub.unsubscribe();
4120 --activeGroups === 0 && teardownAttempted && groupBySourceSubscriber.unsubscribe();
4121 };
4122 });
4123 result.key = key;
4124 return result;
4125 }
4126 });
4127 }
4128
4129 function isEmpty() {
4130 return operate(function (source, subscriber) {
4131 source.subscribe(createOperatorSubscriber(subscriber, function () {
4132 subscriber.next(false);
4133 subscriber.complete();
4134 }, function () {
4135 subscriber.next(true);
4136 subscriber.complete();
4137 }));
4138 });
4139 }
4140
4141 function takeLast(count) {
4142 return count <= 0
4143 ? function () { return EMPTY; }
4144 : operate(function (source, subscriber) {
4145 var buffer = [];
4146 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4147 buffer.push(value);
4148 count < buffer.length && buffer.shift();
4149 }, function () {
4150 var e_1, _a;
4151 try {
4152 for (var buffer_1 = __values(buffer), buffer_1_1 = buffer_1.next(); !buffer_1_1.done; buffer_1_1 = buffer_1.next()) {
4153 var value = buffer_1_1.value;
4154 subscriber.next(value);
4155 }
4156 }
4157 catch (e_1_1) { e_1 = { error: e_1_1 }; }
4158 finally {
4159 try {
4160 if (buffer_1_1 && !buffer_1_1.done && (_a = buffer_1.return)) _a.call(buffer_1);
4161 }
4162 finally { if (e_1) throw e_1.error; }
4163 }
4164 subscriber.complete();
4165 }, undefined, function () {
4166 buffer = null;
4167 }));
4168 });
4169 }
4170
4171 function last$1(predicate, defaultValue) {
4172 var hasDefaultValue = arguments.length >= 2;
4173 return function (source) {
4174 return source.pipe(predicate ? filter(function (v, i) { return predicate(v, i, source); }) : identity, takeLast(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function () { return new EmptyError(); }));
4175 };
4176 }
4177
4178 function materialize() {
4179 return operate(function (source, subscriber) {
4180 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4181 subscriber.next(Notification.createNext(value));
4182 }, function () {
4183 subscriber.next(Notification.createComplete());
4184 subscriber.complete();
4185 }, function (err) {
4186 subscriber.next(Notification.createError(err));
4187 subscriber.complete();
4188 }));
4189 });
4190 }
4191
4192 function max(comparer) {
4193 return reduce(isFunction(comparer) ? function (x, y) { return (comparer(x, y) > 0 ? x : y); } : function (x, y) { return (x > y ? x : y); });
4194 }
4195
4196 var flatMap = mergeMap;
4197
4198 function mergeMapTo(innerObservable, resultSelector, concurrent) {
4199 if (concurrent === void 0) { concurrent = Infinity; }
4200 if (isFunction(resultSelector)) {
4201 return mergeMap(function () { return innerObservable; }, resultSelector, concurrent);
4202 }
4203 if (typeof resultSelector === 'number') {
4204 concurrent = resultSelector;
4205 }
4206 return mergeMap(function () { return innerObservable; }, concurrent);
4207 }
4208
4209 function mergeScan(accumulator, seed, concurrent) {
4210 if (concurrent === void 0) { concurrent = Infinity; }
4211 return operate(function (source, subscriber) {
4212 var state = seed;
4213 return mergeInternals(source, subscriber, function (value, index) { return accumulator(state, value, index); }, concurrent, function (value) {
4214 state = value;
4215 }, false, undefined, function () { return (state = null); });
4216 });
4217 }
4218
4219 function merge$1() {
4220 var args = [];
4221 for (var _i = 0; _i < arguments.length; _i++) {
4222 args[_i] = arguments[_i];
4223 }
4224 var scheduler = popScheduler(args);
4225 var concurrent = popNumber(args, Infinity);
4226 args = argsOrArgArray(args);
4227 return operate(function (source, subscriber) {
4228 mergeAll(concurrent)(from(__spreadArray([source], __read(args)), scheduler)).subscribe(subscriber);
4229 });
4230 }
4231
4232 function mergeWith() {
4233 var otherSources = [];
4234 for (var _i = 0; _i < arguments.length; _i++) {
4235 otherSources[_i] = arguments[_i];
4236 }
4237 return merge$1.apply(void 0, __spreadArray([], __read(otherSources)));
4238 }
4239
4240 function min(comparer) {
4241 return reduce(isFunction(comparer) ? function (x, y) { return (comparer(x, y) < 0 ? x : y); } : function (x, y) { return (x < y ? x : y); });
4242 }
4243
4244 function multicast(subjectOrSubjectFactory, selector) {
4245 var subjectFactory = isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : function () { return subjectOrSubjectFactory; };
4246 if (isFunction(selector)) {
4247 return connect(selector, {
4248 connector: subjectFactory,
4249 });
4250 }
4251 return function (source) { return new ConnectableObservable(source, subjectFactory); };
4252 }
4253
4254 function onErrorResumeNextWith() {
4255 var sources = [];
4256 for (var _i = 0; _i < arguments.length; _i++) {
4257 sources[_i] = arguments[_i];
4258 }
4259 var nextSources = argsOrArgArray(sources);
4260 return function (source) { return onErrorResumeNext.apply(void 0, __spreadArray([source], __read(nextSources))); };
4261 }
4262 var onErrorResumeNext$1 = onErrorResumeNextWith;
4263
4264 function pairwise() {
4265 return operate(function (source, subscriber) {
4266 var prev;
4267 var hasPrev = false;
4268 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4269 var p = prev;
4270 prev = value;
4271 hasPrev && subscriber.next([p, value]);
4272 hasPrev = true;
4273 }));
4274 });
4275 }
4276
4277 function pluck() {
4278 var properties = [];
4279 for (var _i = 0; _i < arguments.length; _i++) {
4280 properties[_i] = arguments[_i];
4281 }
4282 var length = properties.length;
4283 if (length === 0) {
4284 throw new Error('list of properties cannot be empty.');
4285 }
4286 return map(function (x) {
4287 var currentProp = x;
4288 for (var i = 0; i < length; i++) {
4289 var p = currentProp === null || currentProp === void 0 ? void 0 : currentProp[properties[i]];
4290 if (typeof p !== 'undefined') {
4291 currentProp = p;
4292 }
4293 else {
4294 return undefined;
4295 }
4296 }
4297 return currentProp;
4298 });
4299 }
4300
4301 function publish(selector) {
4302 return selector ? function (source) { return connect(selector)(source); } : function (source) { return multicast(new Subject())(source); };
4303 }
4304
4305 function publishBehavior(initialValue) {
4306 return function (source) {
4307 var subject = new BehaviorSubject(initialValue);
4308 return new ConnectableObservable(source, function () { return subject; });
4309 };
4310 }
4311
4312 function publishLast() {
4313 return function (source) {
4314 var subject = new AsyncSubject();
4315 return new ConnectableObservable(source, function () { return subject; });
4316 };
4317 }
4318
4319 function publishReplay(bufferSize, windowTime, selectorOrScheduler, timestampProvider) {
4320 if (selectorOrScheduler && !isFunction(selectorOrScheduler)) {
4321 timestampProvider = selectorOrScheduler;
4322 }
4323 var selector = isFunction(selectorOrScheduler) ? selectorOrScheduler : undefined;
4324 return function (source) { return multicast(new ReplaySubject(bufferSize, windowTime, timestampProvider), selector)(source); };
4325 }
4326
4327 function raceWith() {
4328 var otherSources = [];
4329 for (var _i = 0; _i < arguments.length; _i++) {
4330 otherSources[_i] = arguments[_i];
4331 }
4332 return !otherSources.length
4333 ? identity
4334 : operate(function (source, subscriber) {
4335 raceInit(__spreadArray([source], __read(otherSources)))(subscriber);
4336 });
4337 }
4338
4339 function repeat(countOrConfig) {
4340 var _a;
4341 var count = Infinity;
4342 var delay;
4343 if (countOrConfig != null) {
4344 if (typeof countOrConfig === 'object') {
4345 (_a = countOrConfig.count, count = _a === void 0 ? Infinity : _a, delay = countOrConfig.delay);
4346 }
4347 else {
4348 count = countOrConfig;
4349 }
4350 }
4351 return count <= 0
4352 ? function () { return EMPTY; }
4353 : operate(function (source, subscriber) {
4354 var soFar = 0;
4355 var sourceSub;
4356 var resubscribe = function () {
4357 sourceSub === null || sourceSub === void 0 ? void 0 : sourceSub.unsubscribe();
4358 sourceSub = null;
4359 if (delay != null) {
4360 var notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(soFar));
4361 var notifierSubscriber_1 = createOperatorSubscriber(subscriber, function () {
4362 notifierSubscriber_1.unsubscribe();
4363 subscribeToSource();
4364 });
4365 notifier.subscribe(notifierSubscriber_1);
4366 }
4367 else {
4368 subscribeToSource();
4369 }
4370 };
4371 var subscribeToSource = function () {
4372 var syncUnsub = false;
4373 sourceSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, function () {
4374 if (++soFar < count) {
4375 if (sourceSub) {
4376 resubscribe();
4377 }
4378 else {
4379 syncUnsub = true;
4380 }
4381 }
4382 else {
4383 subscriber.complete();
4384 }
4385 }));
4386 if (syncUnsub) {
4387 resubscribe();
4388 }
4389 };
4390 subscribeToSource();
4391 });
4392 }
4393
4394 function repeatWhen(notifier) {
4395 return operate(function (source, subscriber) {
4396 var innerSub;
4397 var syncResub = false;
4398 var completions$;
4399 var isNotifierComplete = false;
4400 var isMainComplete = false;
4401 var checkComplete = function () { return isMainComplete && isNotifierComplete && (subscriber.complete(), true); };
4402 var getCompletionSubject = function () {
4403 if (!completions$) {
4404 completions$ = new Subject();
4405 innerFrom(notifier(completions$)).subscribe(createOperatorSubscriber(subscriber, function () {
4406 if (innerSub) {
4407 subscribeForRepeatWhen();
4408 }
4409 else {
4410 syncResub = true;
4411 }
4412 }, function () {
4413 isNotifierComplete = true;
4414 checkComplete();
4415 }));
4416 }
4417 return completions$;
4418 };
4419 var subscribeForRepeatWhen = function () {
4420 isMainComplete = false;
4421 innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, function () {
4422 isMainComplete = true;
4423 !checkComplete() && getCompletionSubject().next();
4424 }));
4425 if (syncResub) {
4426 innerSub.unsubscribe();
4427 innerSub = null;
4428 syncResub = false;
4429 subscribeForRepeatWhen();
4430 }
4431 };
4432 subscribeForRepeatWhen();
4433 });
4434 }
4435
4436 function retry(configOrCount) {
4437 if (configOrCount === void 0) { configOrCount = Infinity; }
4438 var config;
4439 if (configOrCount && typeof configOrCount === 'object') {
4440 config = configOrCount;
4441 }
4442 else {
4443 config = {
4444 count: configOrCount,
4445 };
4446 }
4447 var _a = config.count, count = _a === void 0 ? Infinity : _a, delay = config.delay, _b = config.resetOnSuccess, resetOnSuccess = _b === void 0 ? false : _b;
4448 return count <= 0
4449 ? identity
4450 : operate(function (source, subscriber) {
4451 var soFar = 0;
4452 var innerSub;
4453 var subscribeForRetry = function () {
4454 var syncUnsub = false;
4455 innerSub = source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4456 if (resetOnSuccess) {
4457 soFar = 0;
4458 }
4459 subscriber.next(value);
4460 }, undefined, function (err) {
4461 if (soFar++ < count) {
4462 var resub_1 = function () {
4463 if (innerSub) {
4464 innerSub.unsubscribe();
4465 innerSub = null;
4466 subscribeForRetry();
4467 }
4468 else {
4469 syncUnsub = true;
4470 }
4471 };
4472 if (delay != null) {
4473 var notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(err, soFar));
4474 var notifierSubscriber_1 = createOperatorSubscriber(subscriber, function () {
4475 notifierSubscriber_1.unsubscribe();
4476 resub_1();
4477 }, function () {
4478 subscriber.complete();
4479 });
4480 notifier.subscribe(notifierSubscriber_1);
4481 }
4482 else {
4483 resub_1();
4484 }
4485 }
4486 else {
4487 subscriber.error(err);
4488 }
4489 }));
4490 if (syncUnsub) {
4491 innerSub.unsubscribe();
4492 innerSub = null;
4493 subscribeForRetry();
4494 }
4495 };
4496 subscribeForRetry();
4497 });
4498 }
4499
4500 function retryWhen(notifier) {
4501 return operate(function (source, subscriber) {
4502 var innerSub;
4503 var syncResub = false;
4504 var errors$;
4505 var subscribeForRetryWhen = function () {
4506 innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
4507 if (!errors$) {
4508 errors$ = new Subject();
4509 innerFrom(notifier(errors$)).subscribe(createOperatorSubscriber(subscriber, function () {
4510 return innerSub ? subscribeForRetryWhen() : (syncResub = true);
4511 }));
4512 }
4513 if (errors$) {
4514 errors$.next(err);
4515 }
4516 }));
4517 if (syncResub) {
4518 innerSub.unsubscribe();
4519 innerSub = null;
4520 syncResub = false;
4521 subscribeForRetryWhen();
4522 }
4523 };
4524 subscribeForRetryWhen();
4525 });
4526 }
4527
4528 function sample(notifier) {
4529 return operate(function (source, subscriber) {
4530 var hasValue = false;
4531 var lastValue = null;
4532 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4533 hasValue = true;
4534 lastValue = value;
4535 }));
4536 innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function () {
4537 if (hasValue) {
4538 hasValue = false;
4539 var value = lastValue;
4540 lastValue = null;
4541 subscriber.next(value);
4542 }
4543 }, noop));
4544 });
4545 }
4546
4547 function sampleTime(period, scheduler) {
4548 if (scheduler === void 0) { scheduler = asyncScheduler; }
4549 return sample(interval(period, scheduler));
4550 }
4551
4552 function scan(accumulator, seed) {
4553 return operate(scanInternals(accumulator, seed, arguments.length >= 2, true));
4554 }
4555
4556 function sequenceEqual(compareTo, comparator) {
4557 if (comparator === void 0) { comparator = function (a, b) { return a === b; }; }
4558 return operate(function (source, subscriber) {
4559 var aState = createState();
4560 var bState = createState();
4561 var emit = function (isEqual) {
4562 subscriber.next(isEqual);
4563 subscriber.complete();
4564 };
4565 var createSubscriber = function (selfState, otherState) {
4566 var sequenceEqualSubscriber = createOperatorSubscriber(subscriber, function (a) {
4567 var buffer = otherState.buffer, complete = otherState.complete;
4568 if (buffer.length === 0) {
4569 complete ? emit(false) : selfState.buffer.push(a);
4570 }
4571 else {
4572 !comparator(a, buffer.shift()) && emit(false);
4573 }
4574 }, function () {
4575 selfState.complete = true;
4576 var complete = otherState.complete, buffer = otherState.buffer;
4577 complete && emit(buffer.length === 0);
4578 sequenceEqualSubscriber === null || sequenceEqualSubscriber === void 0 ? void 0 : sequenceEqualSubscriber.unsubscribe();
4579 });
4580 return sequenceEqualSubscriber;
4581 };
4582 source.subscribe(createSubscriber(aState, bState));
4583 innerFrom(compareTo).subscribe(createSubscriber(bState, aState));
4584 });
4585 }
4586 function createState() {
4587 return {
4588 buffer: [],
4589 complete: false,
4590 };
4591 }
4592
4593 function share(options) {
4594 if (options === void 0) { options = {}; }
4595 var _a = options.connector, connector = _a === void 0 ? function () { return new Subject(); } : _a, _b = options.resetOnError, resetOnError = _b === void 0 ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === void 0 ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === void 0 ? true : _d;
4596 return function (wrapperSource) {
4597 var connection;
4598 var resetConnection;
4599 var subject;
4600 var refCount = 0;
4601 var hasCompleted = false;
4602 var hasErrored = false;
4603 var cancelReset = function () {
4604 resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
4605 resetConnection = undefined;
4606 };
4607 var reset = function () {
4608 cancelReset();
4609 connection = subject = undefined;
4610 hasCompleted = hasErrored = false;
4611 };
4612 var resetAndUnsubscribe = function () {
4613 var conn = connection;
4614 reset();
4615 conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
4616 };
4617 return operate(function (source, subscriber) {
4618 refCount++;
4619 if (!hasErrored && !hasCompleted) {
4620 cancelReset();
4621 }
4622 var dest = (subject = subject !== null && subject !== void 0 ? subject : connector());
4623 subscriber.add(function () {
4624 refCount--;
4625 if (refCount === 0 && !hasErrored && !hasCompleted) {
4626 resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
4627 }
4628 });
4629 dest.subscribe(subscriber);
4630 if (!connection &&
4631 refCount > 0) {
4632 connection = new SafeSubscriber({
4633 next: function (value) { return dest.next(value); },
4634 error: function (err) {
4635 hasErrored = true;
4636 cancelReset();
4637 resetConnection = handleReset(reset, resetOnError, err);
4638 dest.error(err);
4639 },
4640 complete: function () {
4641 hasCompleted = true;
4642 cancelReset();
4643 resetConnection = handleReset(reset, resetOnComplete);
4644 dest.complete();
4645 },
4646 });
4647 innerFrom(source).subscribe(connection);
4648 }
4649 })(wrapperSource);
4650 };
4651 }
4652 function handleReset(reset, on) {
4653 var args = [];
4654 for (var _i = 2; _i < arguments.length; _i++) {
4655 args[_i - 2] = arguments[_i];
4656 }
4657 if (on === true) {
4658 reset();
4659 return;
4660 }
4661 if (on === false) {
4662 return;
4663 }
4664 var onSubscriber = new SafeSubscriber({
4665 next: function () {
4666 onSubscriber.unsubscribe();
4667 reset();
4668 },
4669 });
4670 return innerFrom(on.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber);
4671 }
4672
4673 function shareReplay(configOrBufferSize, windowTime, scheduler) {
4674 var _a, _b, _c;
4675 var bufferSize;
4676 var refCount = false;
4677 if (configOrBufferSize && typeof configOrBufferSize === 'object') {
4678 (_a = configOrBufferSize.bufferSize, bufferSize = _a === void 0 ? Infinity : _a, _b = configOrBufferSize.windowTime, windowTime = _b === void 0 ? Infinity : _b, _c = configOrBufferSize.refCount, refCount = _c === void 0 ? false : _c, scheduler = configOrBufferSize.scheduler);
4679 }
4680 else {
4681 bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);
4682 }
4683 return share({
4684 connector: function () { return new ReplaySubject(bufferSize, windowTime, scheduler); },
4685 resetOnError: true,
4686 resetOnComplete: false,
4687 resetOnRefCountZero: refCount,
4688 });
4689 }
4690
4691 function single(predicate) {
4692 return operate(function (source, subscriber) {
4693 var hasValue = false;
4694 var singleValue;
4695 var seenValue = false;
4696 var index = 0;
4697 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4698 seenValue = true;
4699 if (!predicate || predicate(value, index++, source)) {
4700 hasValue && subscriber.error(new SequenceError('Too many matching values'));
4701 hasValue = true;
4702 singleValue = value;
4703 }
4704 }, function () {
4705 if (hasValue) {
4706 subscriber.next(singleValue);
4707 subscriber.complete();
4708 }
4709 else {
4710 subscriber.error(seenValue ? new NotFoundError('No matching values') : new EmptyError());
4711 }
4712 }));
4713 });
4714 }
4715
4716 function skip(count) {
4717 return filter(function (_, index) { return count <= index; });
4718 }
4719
4720 function skipLast(skipCount) {
4721 return skipCount <= 0
4722 ?
4723 identity
4724 : operate(function (source, subscriber) {
4725 var ring = new Array(skipCount);
4726 var seen = 0;
4727 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4728 var valueIndex = seen++;
4729 if (valueIndex < skipCount) {
4730 ring[valueIndex] = value;
4731 }
4732 else {
4733 var index = valueIndex % skipCount;
4734 var oldValue = ring[index];
4735 ring[index] = value;
4736 subscriber.next(oldValue);
4737 }
4738 }));
4739 return function () {
4740 ring = null;
4741 };
4742 });
4743 }
4744
4745 function skipUntil(notifier) {
4746 return operate(function (source, subscriber) {
4747 var taking = false;
4748 var skipSubscriber = createOperatorSubscriber(subscriber, function () {
4749 skipSubscriber === null || skipSubscriber === void 0 ? void 0 : skipSubscriber.unsubscribe();
4750 taking = true;
4751 }, noop);
4752 innerFrom(notifier).subscribe(skipSubscriber);
4753 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return taking && subscriber.next(value); }));
4754 });
4755 }
4756
4757 function skipWhile(predicate) {
4758 return operate(function (source, subscriber) {
4759 var taking = false;
4760 var index = 0;
4761 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return (taking || (taking = !predicate(value, index++))) && subscriber.next(value); }));
4762 });
4763 }
4764
4765 function startWith() {
4766 var values = [];
4767 for (var _i = 0; _i < arguments.length; _i++) {
4768 values[_i] = arguments[_i];
4769 }
4770 var scheduler = popScheduler(values);
4771 return operate(function (source, subscriber) {
4772 (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);
4773 });
4774 }
4775
4776 function switchMap(project, resultSelector) {
4777 return operate(function (source, subscriber) {
4778 var innerSubscriber = null;
4779 var index = 0;
4780 var isComplete = false;
4781 var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
4782 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4783 innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
4784 var innerIndex = 0;
4785 var outerIndex = index++;
4786 innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
4787 innerSubscriber = null;
4788 checkComplete();
4789 })));
4790 }, function () {
4791 isComplete = true;
4792 checkComplete();
4793 }));
4794 });
4795 }
4796
4797 function switchAll() {
4798 return switchMap(identity);
4799 }
4800
4801 function switchMapTo(innerObservable, resultSelector) {
4802 return isFunction(resultSelector) ? switchMap(function () { return innerObservable; }, resultSelector) : switchMap(function () { return innerObservable; });
4803 }
4804
4805 function switchScan(accumulator, seed) {
4806 return operate(function (source, subscriber) {
4807 var state = seed;
4808 switchMap(function (value, index) { return accumulator(state, value, index); }, function (_, innerValue) { return ((state = innerValue), innerValue); })(source).subscribe(subscriber);
4809 return function () {
4810 state = null;
4811 };
4812 });
4813 }
4814
4815 function takeUntil(notifier) {
4816 return operate(function (source, subscriber) {
4817 innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function () { return subscriber.complete(); }, noop));
4818 !subscriber.closed && source.subscribe(subscriber);
4819 });
4820 }
4821
4822 function takeWhile(predicate, inclusive) {
4823 if (inclusive === void 0) { inclusive = false; }
4824 return operate(function (source, subscriber) {
4825 var index = 0;
4826 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4827 var result = predicate(value, index++);
4828 (result || inclusive) && subscriber.next(value);
4829 !result && subscriber.complete();
4830 }));
4831 });
4832 }
4833
4834 function tap(observerOrNext, error, complete) {
4835 var tapObserver = isFunction(observerOrNext) || error || complete
4836 ?
4837 { next: observerOrNext, error: error, complete: complete }
4838 : observerOrNext;
4839 return tapObserver
4840 ? operate(function (source, subscriber) {
4841 var _a;
4842 (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
4843 var isUnsub = true;
4844 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4845 var _a;
4846 (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
4847 subscriber.next(value);
4848 }, function () {
4849 var _a;
4850 isUnsub = false;
4851 (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
4852 subscriber.complete();
4853 }, function (err) {
4854 var _a;
4855 isUnsub = false;
4856 (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
4857 subscriber.error(err);
4858 }, function () {
4859 var _a, _b;
4860 if (isUnsub) {
4861 (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
4862 }
4863 (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
4864 }));
4865 })
4866 :
4867 identity;
4868 }
4869
4870 function throttle(durationSelector, config) {
4871 return operate(function (source, subscriber) {
4872 var _a = config !== null && config !== void 0 ? config : {}, _b = _a.leading, leading = _b === void 0 ? true : _b, _c = _a.trailing, trailing = _c === void 0 ? false : _c;
4873 var hasValue = false;
4874 var sendValue = null;
4875 var throttled = null;
4876 var isComplete = false;
4877 var endThrottling = function () {
4878 throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();
4879 throttled = null;
4880 if (trailing) {
4881 send();
4882 isComplete && subscriber.complete();
4883 }
4884 };
4885 var cleanupThrottling = function () {
4886 throttled = null;
4887 isComplete && subscriber.complete();
4888 };
4889 var startThrottle = function (value) {
4890 return (throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling)));
4891 };
4892 var send = function () {
4893 if (hasValue) {
4894 hasValue = false;
4895 var value = sendValue;
4896 sendValue = null;
4897 subscriber.next(value);
4898 !isComplete && startThrottle(value);
4899 }
4900 };
4901 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4902 hasValue = true;
4903 sendValue = value;
4904 !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));
4905 }, function () {
4906 isComplete = true;
4907 !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();
4908 }));
4909 });
4910 }
4911
4912 function throttleTime(duration, scheduler, config) {
4913 if (scheduler === void 0) { scheduler = asyncScheduler; }
4914 var duration$ = timer(duration, scheduler);
4915 return throttle(function () { return duration$; }, config);
4916 }
4917
4918 function timeInterval(scheduler) {
4919 if (scheduler === void 0) { scheduler = asyncScheduler; }
4920 return operate(function (source, subscriber) {
4921 var last = scheduler.now();
4922 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
4923 var now = scheduler.now();
4924 var interval = now - last;
4925 last = now;
4926 subscriber.next(new TimeInterval(value, interval));
4927 }));
4928 });
4929 }
4930 var TimeInterval = (function () {
4931 function TimeInterval(value, interval) {
4932 this.value = value;
4933 this.interval = interval;
4934 }
4935 return TimeInterval;
4936 }());
4937
4938 function timeoutWith(due, withObservable, scheduler) {
4939 var first;
4940 var each;
4941 var _with;
4942 scheduler = scheduler !== null && scheduler !== void 0 ? scheduler : async;
4943 if (isValidDate(due)) {
4944 first = due;
4945 }
4946 else if (typeof due === 'number') {
4947 each = due;
4948 }
4949 if (withObservable) {
4950 _with = function () { return withObservable; };
4951 }
4952 else {
4953 throw new TypeError('No observable provided to switch to');
4954 }
4955 if (first == null && each == null) {
4956 throw new TypeError('No timeout provided.');
4957 }
4958 return timeout({
4959 first: first,
4960 each: each,
4961 scheduler: scheduler,
4962 with: _with,
4963 });
4964 }
4965
4966 function timestamp(timestampProvider) {
4967 if (timestampProvider === void 0) { timestampProvider = dateTimestampProvider; }
4968 return map(function (value) { return ({ value: value, timestamp: timestampProvider.now() }); });
4969 }
4970
4971 function window(windowBoundaries) {
4972 return operate(function (source, subscriber) {
4973 var windowSubject = new Subject();
4974 subscriber.next(windowSubject.asObservable());
4975 var errorHandler = function (err) {
4976 windowSubject.error(err);
4977 subscriber.error(err);
4978 };
4979 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.next(value); }, function () {
4980 windowSubject.complete();
4981 subscriber.complete();
4982 }, errorHandler));
4983 innerFrom(windowBoundaries).subscribe(createOperatorSubscriber(subscriber, function () {
4984 windowSubject.complete();
4985 subscriber.next((windowSubject = new Subject()));
4986 }, noop, errorHandler));
4987 return function () {
4988 windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.unsubscribe();
4989 windowSubject = null;
4990 };
4991 });
4992 }
4993
4994 function windowCount(windowSize, startWindowEvery) {
4995 if (startWindowEvery === void 0) { startWindowEvery = 0; }
4996 var startEvery = startWindowEvery > 0 ? startWindowEvery : windowSize;
4997 return operate(function (source, subscriber) {
4998 var windows = [new Subject()];
4999 var count = 0;
5000 subscriber.next(windows[0].asObservable());
5001 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
5002 var e_1, _a;
5003 try {
5004 for (var windows_1 = __values(windows), windows_1_1 = windows_1.next(); !windows_1_1.done; windows_1_1 = windows_1.next()) {
5005 var window_1 = windows_1_1.value;
5006 window_1.next(value);
5007 }
5008 }
5009 catch (e_1_1) { e_1 = { error: e_1_1 }; }
5010 finally {
5011 try {
5012 if (windows_1_1 && !windows_1_1.done && (_a = windows_1.return)) _a.call(windows_1);
5013 }
5014 finally { if (e_1) throw e_1.error; }
5015 }
5016 var c = count - windowSize + 1;
5017 if (c >= 0 && c % startEvery === 0) {
5018 windows.shift().complete();
5019 }
5020 if (++count % startEvery === 0) {
5021 var window_2 = new Subject();
5022 windows.push(window_2);
5023 subscriber.next(window_2.asObservable());
5024 }
5025 }, function () {
5026 while (windows.length > 0) {
5027 windows.shift().complete();
5028 }
5029 subscriber.complete();
5030 }, function (err) {
5031 while (windows.length > 0) {
5032 windows.shift().error(err);
5033 }
5034 subscriber.error(err);
5035 }, function () {
5036 windows = null;
5037 }));
5038 });
5039 }
5040
5041 function windowTime(windowTimeSpan) {
5042 var _a, _b;
5043 var otherArgs = [];
5044 for (var _i = 1; _i < arguments.length; _i++) {
5045 otherArgs[_i - 1] = arguments[_i];
5046 }
5047 var scheduler = (_a = popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : asyncScheduler;
5048 var windowCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
5049 var maxWindowSize = otherArgs[1] || Infinity;
5050 return operate(function (source, subscriber) {
5051 var windowRecords = [];
5052 var restartOnClose = false;
5053 var closeWindow = function (record) {
5054 var window = record.window, subs = record.subs;
5055 window.complete();
5056 subs.unsubscribe();
5057 arrRemove(windowRecords, record);
5058 restartOnClose && startWindow();
5059 };
5060 var startWindow = function () {
5061 if (windowRecords) {
5062 var subs = new Subscription();
5063 subscriber.add(subs);
5064 var window_1 = new Subject();
5065 var record_1 = {
5066 window: window_1,
5067 subs: subs,
5068 seen: 0,
5069 };
5070 windowRecords.push(record_1);
5071 subscriber.next(window_1.asObservable());
5072 executeSchedule(subs, scheduler, function () { return closeWindow(record_1); }, windowTimeSpan);
5073 }
5074 };
5075 if (windowCreationInterval !== null && windowCreationInterval >= 0) {
5076 executeSchedule(subscriber, scheduler, startWindow, windowCreationInterval, true);
5077 }
5078 else {
5079 restartOnClose = true;
5080 }
5081 startWindow();
5082 var loop = function (cb) { return windowRecords.slice().forEach(cb); };
5083 var terminate = function (cb) {
5084 loop(function (_a) {
5085 var window = _a.window;
5086 return cb(window);
5087 });
5088 cb(subscriber);
5089 subscriber.unsubscribe();
5090 };
5091 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
5092 loop(function (record) {
5093 record.window.next(value);
5094 maxWindowSize <= ++record.seen && closeWindow(record);
5095 });
5096 }, function () { return terminate(function (consumer) { return consumer.complete(); }); }, function (err) { return terminate(function (consumer) { return consumer.error(err); }); }));
5097 return function () {
5098 windowRecords = null;
5099 };
5100 });
5101 }
5102
5103 function windowToggle(openings, closingSelector) {
5104 return operate(function (source, subscriber) {
5105 var windows = [];
5106 var handleError = function (err) {
5107 while (0 < windows.length) {
5108 windows.shift().error(err);
5109 }
5110 subscriber.error(err);
5111 };
5112 innerFrom(openings).subscribe(createOperatorSubscriber(subscriber, function (openValue) {
5113 var window = new Subject();
5114 windows.push(window);
5115 var closingSubscription = new Subscription();
5116 var closeWindow = function () {
5117 arrRemove(windows, window);
5118 window.complete();
5119 closingSubscription.unsubscribe();
5120 };
5121 var closingNotifier;
5122 try {
5123 closingNotifier = innerFrom(closingSelector(openValue));
5124 }
5125 catch (err) {
5126 handleError(err);
5127 return;
5128 }
5129 subscriber.next(window.asObservable());
5130 closingSubscription.add(closingNotifier.subscribe(createOperatorSubscriber(subscriber, closeWindow, noop, handleError)));
5131 }, noop));
5132 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
5133 var e_1, _a;
5134 var windowsCopy = windows.slice();
5135 try {
5136 for (var windowsCopy_1 = __values(windowsCopy), windowsCopy_1_1 = windowsCopy_1.next(); !windowsCopy_1_1.done; windowsCopy_1_1 = windowsCopy_1.next()) {
5137 var window_1 = windowsCopy_1_1.value;
5138 window_1.next(value);
5139 }
5140 }
5141 catch (e_1_1) { e_1 = { error: e_1_1 }; }
5142 finally {
5143 try {
5144 if (windowsCopy_1_1 && !windowsCopy_1_1.done && (_a = windowsCopy_1.return)) _a.call(windowsCopy_1);
5145 }
5146 finally { if (e_1) throw e_1.error; }
5147 }
5148 }, function () {
5149 while (0 < windows.length) {
5150 windows.shift().complete();
5151 }
5152 subscriber.complete();
5153 }, handleError, function () {
5154 while (0 < windows.length) {
5155 windows.shift().unsubscribe();
5156 }
5157 }));
5158 });
5159 }
5160
5161 function windowWhen(closingSelector) {
5162 return operate(function (source, subscriber) {
5163 var window;
5164 var closingSubscriber;
5165 var handleError = function (err) {
5166 window.error(err);
5167 subscriber.error(err);
5168 };
5169 var openWindow = function () {
5170 closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
5171 window === null || window === void 0 ? void 0 : window.complete();
5172 window = new Subject();
5173 subscriber.next(window.asObservable());
5174 var closingNotifier;
5175 try {
5176 closingNotifier = innerFrom(closingSelector());
5177 }
5178 catch (err) {
5179 handleError(err);
5180 return;
5181 }
5182 closingNotifier.subscribe((closingSubscriber = createOperatorSubscriber(subscriber, openWindow, openWindow, handleError)));
5183 };
5184 openWindow();
5185 source.subscribe(createOperatorSubscriber(subscriber, function (value) { return window.next(value); }, function () {
5186 window.complete();
5187 subscriber.complete();
5188 }, handleError, function () {
5189 closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
5190 window = null;
5191 }));
5192 });
5193 }
5194
5195 function withLatestFrom() {
5196 var inputs = [];
5197 for (var _i = 0; _i < arguments.length; _i++) {
5198 inputs[_i] = arguments[_i];
5199 }
5200 var project = popResultSelector(inputs);
5201 return operate(function (source, subscriber) {
5202 var len = inputs.length;
5203 var otherValues = new Array(len);
5204 var hasValue = inputs.map(function () { return false; });
5205 var ready = false;
5206 var _loop_1 = function (i) {
5207 innerFrom(inputs[i]).subscribe(createOperatorSubscriber(subscriber, function (value) {
5208 otherValues[i] = value;
5209 if (!ready && !hasValue[i]) {
5210 hasValue[i] = true;
5211 (ready = hasValue.every(identity)) && (hasValue = null);
5212 }
5213 }, noop));
5214 };
5215 for (var i = 0; i < len; i++) {
5216 _loop_1(i);
5217 }
5218 source.subscribe(createOperatorSubscriber(subscriber, function (value) {
5219 if (ready) {
5220 var values = __spreadArray([value], __read(otherValues));
5221 subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
5222 }
5223 }));
5224 });
5225 }
5226
5227 function zipAll(project) {
5228 return joinAllInternals(zip, project);
5229 }
5230
5231 function zip$1() {
5232 var sources = [];
5233 for (var _i = 0; _i < arguments.length; _i++) {
5234 sources[_i] = arguments[_i];
5235 }
5236 return operate(function (source, subscriber) {
5237 zip.apply(void 0, __spreadArray([source], __read(sources))).subscribe(subscriber);
5238 });
5239 }
5240
5241 function zipWith() {
5242 var otherInputs = [];
5243 for (var _i = 0; _i < arguments.length; _i++) {
5244 otherInputs[_i] = arguments[_i];
5245 }
5246 return zip$1.apply(void 0, __spreadArray([], __read(otherInputs)));
5247 }
5248
5249 function partition$1(predicate, thisArg) {
5250 return function (source) {
5251 return [filter(predicate, thisArg)(source), filter(not(predicate, thisArg))(source)];
5252 };
5253 }
5254
5255 function race$1() {
5256 var args = [];
5257 for (var _i = 0; _i < arguments.length; _i++) {
5258 args[_i] = arguments[_i];
5259 }
5260 return raceWith.apply(void 0, __spreadArray([], __read(argsOrArgArray(args))));
5261 }
5262
5263
5264
5265 var _operators = /*#__PURE__*/Object.freeze({
5266 audit: audit,
5267 auditTime: auditTime,
5268 buffer: buffer,
5269 bufferCount: bufferCount,
5270 bufferTime: bufferTime,
5271 bufferToggle: bufferToggle,
5272 bufferWhen: bufferWhen,
5273 catchError: catchError,
5274 combineAll: combineAll,
5275 combineLatestAll: combineLatestAll,
5276 combineLatest: combineLatest$1,
5277 combineLatestWith: combineLatestWith,
5278 concat: concat$1,
5279 concatAll: concatAll,
5280 concatMap: concatMap,
5281 concatMapTo: concatMapTo,
5282 concatWith: concatWith,
5283 connect: connect,
5284 count: count,
5285 debounce: debounce,
5286 debounceTime: debounceTime,
5287 defaultIfEmpty: defaultIfEmpty,
5288 delay: delay,
5289 delayWhen: delayWhen,
5290 dematerialize: dematerialize,
5291 distinct: distinct,
5292 distinctUntilChanged: distinctUntilChanged,
5293 distinctUntilKeyChanged: distinctUntilKeyChanged,
5294 elementAt: elementAt,
5295 endWith: endWith,
5296 every: every,
5297 exhaust: exhaust,
5298 exhaustAll: exhaustAll,
5299 exhaustMap: exhaustMap,
5300 expand: expand,
5301 filter: filter,
5302 finalize: finalize,
5303 find: find,
5304 findIndex: findIndex,
5305 first: first,
5306 groupBy: groupBy,
5307 ignoreElements: ignoreElements,
5308 isEmpty: isEmpty,
5309 last: last$1,
5310 map: map,
5311 mapTo: mapTo,
5312 materialize: materialize,
5313 max: max,
5314 merge: merge$1,
5315 mergeAll: mergeAll,
5316 flatMap: flatMap,
5317 mergeMap: mergeMap,
5318 mergeMapTo: mergeMapTo,
5319 mergeScan: mergeScan,
5320 mergeWith: mergeWith,
5321 min: min,
5322 multicast: multicast,
5323 observeOn: observeOn,
5324 onErrorResumeNext: onErrorResumeNext$1,
5325 pairwise: pairwise,
5326 partition: partition$1,
5327 pluck: pluck,
5328 publish: publish,
5329 publishBehavior: publishBehavior,
5330 publishLast: publishLast,
5331 publishReplay: publishReplay,
5332 race: race$1,
5333 raceWith: raceWith,
5334 reduce: reduce,
5335 repeat: repeat,
5336 repeatWhen: repeatWhen,
5337 retry: retry,
5338 retryWhen: retryWhen,
5339 refCount: refCount,
5340 sample: sample,
5341 sampleTime: sampleTime,
5342 scan: scan,
5343 sequenceEqual: sequenceEqual,
5344 share: share,
5345 shareReplay: shareReplay,
5346 single: single,
5347 skip: skip,
5348 skipLast: skipLast,
5349 skipUntil: skipUntil,
5350 skipWhile: skipWhile,
5351 startWith: startWith,
5352 subscribeOn: subscribeOn,
5353 switchAll: switchAll,
5354 switchMap: switchMap,
5355 switchMapTo: switchMapTo,
5356 switchScan: switchScan,
5357 take: take,
5358 takeLast: takeLast,
5359 takeUntil: takeUntil,
5360 takeWhile: takeWhile,
5361 tap: tap,
5362 throttle: throttle,
5363 throttleTime: throttleTime,
5364 throwIfEmpty: throwIfEmpty,
5365 timeInterval: timeInterval,
5366 timeout: timeout,
5367 timeoutWith: timeoutWith,
5368 timestamp: timestamp,
5369 toArray: toArray,
5370 window: window,
5371 windowCount: windowCount,
5372 windowTime: windowTime,
5373 windowToggle: windowToggle,
5374 windowWhen: windowWhen,
5375 withLatestFrom: withLatestFrom,
5376 zip: zip$1,
5377 zipAll: zipAll,
5378 zipWith: zipWith
5379 });
5380
5381 var SubscriptionLog = (function () {
5382 function SubscriptionLog(subscribedFrame, unsubscribedFrame) {
5383 if (unsubscribedFrame === void 0) { unsubscribedFrame = Infinity; }
5384 this.subscribedFrame = subscribedFrame;
5385 this.unsubscribedFrame = unsubscribedFrame;
5386 }
5387 return SubscriptionLog;
5388 }());
5389
5390 var SubscriptionLoggable = (function () {
5391 function SubscriptionLoggable() {
5392 this.subscriptions = [];
5393 }
5394 SubscriptionLoggable.prototype.logSubscribedFrame = function () {
5395 this.subscriptions.push(new SubscriptionLog(this.scheduler.now()));
5396 return this.subscriptions.length - 1;
5397 };
5398 SubscriptionLoggable.prototype.logUnsubscribedFrame = function (index) {
5399 var subscriptionLogs = this.subscriptions;
5400 var oldSubscriptionLog = subscriptionLogs[index];
5401 subscriptionLogs[index] = new SubscriptionLog(oldSubscriptionLog.subscribedFrame, this.scheduler.now());
5402 };
5403 return SubscriptionLoggable;
5404 }());
5405
5406 function applyMixins(derivedCtor, baseCtors) {
5407 for (var i = 0, len = baseCtors.length; i < len; i++) {
5408 var baseCtor = baseCtors[i];
5409 var propertyKeys = Object.getOwnPropertyNames(baseCtor.prototype);
5410 for (var j = 0, len2 = propertyKeys.length; j < len2; j++) {
5411 var name_1 = propertyKeys[j];
5412 derivedCtor.prototype[name_1] = baseCtor.prototype[name_1];
5413 }
5414 }
5415 }
5416
5417 var ColdObservable = (function (_super) {
5418 __extends(ColdObservable, _super);
5419 function ColdObservable(messages, scheduler) {
5420 var _this = _super.call(this, function (subscriber) {
5421 var observable = this;
5422 var index = observable.logSubscribedFrame();
5423 var subscription = new Subscription();
5424 subscription.add(new Subscription(function () {
5425 observable.logUnsubscribedFrame(index);
5426 }));
5427 observable.scheduleMessages(subscriber);
5428 return subscription;
5429 }) || this;
5430 _this.messages = messages;
5431 _this.subscriptions = [];
5432 _this.scheduler = scheduler;
5433 return _this;
5434 }
5435 ColdObservable.prototype.scheduleMessages = function (subscriber) {
5436 var messagesLength = this.messages.length;
5437 for (var i = 0; i < messagesLength; i++) {
5438 var message = this.messages[i];
5439 subscriber.add(this.scheduler.schedule(function (state) {
5440 var _a = state, notification = _a.message.notification, destination = _a.subscriber;
5441 observeNotification(notification, destination);
5442 }, message.frame, { message: message, subscriber: subscriber }));
5443 }
5444 };
5445 return ColdObservable;
5446 }(Observable));
5447 applyMixins(ColdObservable, [SubscriptionLoggable]);
5448
5449 var HotObservable = (function (_super) {
5450 __extends(HotObservable, _super);
5451 function HotObservable(messages, scheduler) {
5452 var _this = _super.call(this) || this;
5453 _this.messages = messages;
5454 _this.subscriptions = [];
5455 _this.scheduler = scheduler;
5456 return _this;
5457 }
5458 HotObservable.prototype._subscribe = function (subscriber) {
5459 var subject = this;
5460 var index = subject.logSubscribedFrame();
5461 var subscription = new Subscription();
5462 subscription.add(new Subscription(function () {
5463 subject.logUnsubscribedFrame(index);
5464 }));
5465 subscription.add(_super.prototype._subscribe.call(this, subscriber));
5466 return subscription;
5467 };
5468 HotObservable.prototype.setup = function () {
5469 var subject = this;
5470 var messagesLength = subject.messages.length;
5471 var _loop_1 = function (i) {
5472 (function () {
5473 var _a = subject.messages[i], notification = _a.notification, frame = _a.frame;
5474 subject.scheduler.schedule(function () {
5475 observeNotification(notification, subject);
5476 }, frame);
5477 })();
5478 };
5479 for (var i = 0; i < messagesLength; i++) {
5480 _loop_1(i);
5481 }
5482 };
5483 return HotObservable;
5484 }(Subject));
5485 applyMixins(HotObservable, [SubscriptionLoggable]);
5486
5487 var defaultMaxFrame = 750;
5488 var TestScheduler = (function (_super) {
5489 __extends(TestScheduler, _super);
5490 function TestScheduler(assertDeepEqual) {
5491 var _this = _super.call(this, VirtualAction, defaultMaxFrame) || this;
5492 _this.assertDeepEqual = assertDeepEqual;
5493 _this.hotObservables = [];
5494 _this.coldObservables = [];
5495 _this.flushTests = [];
5496 _this.runMode = false;
5497 return _this;
5498 }
5499 TestScheduler.prototype.createTime = function (marbles) {
5500 var indexOf = this.runMode ? marbles.trim().indexOf('|') : marbles.indexOf('|');
5501 if (indexOf === -1) {
5502 throw new Error('marble diagram for time should have a completion marker "|"');
5503 }
5504 return indexOf * TestScheduler.frameTimeFactor;
5505 };
5506 TestScheduler.prototype.createColdObservable = function (marbles, values, error) {
5507 if (marbles.indexOf('^') !== -1) {
5508 throw new Error('cold observable cannot have subscription offset "^"');
5509 }
5510 if (marbles.indexOf('!') !== -1) {
5511 throw new Error('cold observable cannot have unsubscription marker "!"');
5512 }
5513 var messages = TestScheduler.parseMarbles(marbles, values, error, undefined, this.runMode);
5514 var cold = new ColdObservable(messages, this);
5515 this.coldObservables.push(cold);
5516 return cold;
5517 };
5518 TestScheduler.prototype.createHotObservable = function (marbles, values, error) {
5519 if (marbles.indexOf('!') !== -1) {
5520 throw new Error('hot observable cannot have unsubscription marker "!"');
5521 }
5522 var messages = TestScheduler.parseMarbles(marbles, values, error, undefined, this.runMode);
5523 var subject = new HotObservable(messages, this);
5524 this.hotObservables.push(subject);
5525 return subject;
5526 };
5527 TestScheduler.prototype.materializeInnerObservable = function (observable, outerFrame) {
5528 var _this = this;
5529 var messages = [];
5530 observable.subscribe({
5531 next: function (value) {
5532 messages.push({ frame: _this.frame - outerFrame, notification: nextNotification(value) });
5533 },
5534 error: function (error) {
5535 messages.push({ frame: _this.frame - outerFrame, notification: errorNotification(error) });
5536 },
5537 complete: function () {
5538 messages.push({ frame: _this.frame - outerFrame, notification: COMPLETE_NOTIFICATION });
5539 },
5540 });
5541 return messages;
5542 };
5543 TestScheduler.prototype.expectObservable = function (observable, subscriptionMarbles) {
5544 var _this = this;
5545 if (subscriptionMarbles === void 0) { subscriptionMarbles = null; }
5546 var actual = [];
5547 var flushTest = { actual: actual, ready: false };
5548 var subscriptionParsed = TestScheduler.parseMarblesAsSubscriptions(subscriptionMarbles, this.runMode);
5549 var subscriptionFrame = subscriptionParsed.subscribedFrame === Infinity ? 0 : subscriptionParsed.subscribedFrame;
5550 var unsubscriptionFrame = subscriptionParsed.unsubscribedFrame;
5551 var subscription;
5552 this.schedule(function () {
5553 subscription = observable.subscribe({
5554 next: function (x) {
5555 var value = x instanceof Observable ? _this.materializeInnerObservable(x, _this.frame) : x;
5556 actual.push({ frame: _this.frame, notification: nextNotification(value) });
5557 },
5558 error: function (error) {
5559 actual.push({ frame: _this.frame, notification: errorNotification(error) });
5560 },
5561 complete: function () {
5562 actual.push({ frame: _this.frame, notification: COMPLETE_NOTIFICATION });
5563 },
5564 });
5565 }, subscriptionFrame);
5566 if (unsubscriptionFrame !== Infinity) {
5567 this.schedule(function () { return subscription.unsubscribe(); }, unsubscriptionFrame);
5568 }
5569 this.flushTests.push(flushTest);
5570 var runMode = this.runMode;
5571 return {
5572 toBe: function (marbles, values, errorValue) {
5573 flushTest.ready = true;
5574 flushTest.expected = TestScheduler.parseMarbles(marbles, values, errorValue, true, runMode);
5575 },
5576 toEqual: function (other) {
5577 flushTest.ready = true;
5578 flushTest.expected = [];
5579 _this.schedule(function () {
5580 subscription = other.subscribe({
5581 next: function (x) {
5582 var value = x instanceof Observable ? _this.materializeInnerObservable(x, _this.frame) : x;
5583 flushTest.expected.push({ frame: _this.frame, notification: nextNotification(value) });
5584 },
5585 error: function (error) {
5586 flushTest.expected.push({ frame: _this.frame, notification: errorNotification(error) });
5587 },
5588 complete: function () {
5589 flushTest.expected.push({ frame: _this.frame, notification: COMPLETE_NOTIFICATION });
5590 },
5591 });
5592 }, subscriptionFrame);
5593 },
5594 };
5595 };
5596 TestScheduler.prototype.expectSubscriptions = function (actualSubscriptionLogs) {
5597 var flushTest = { actual: actualSubscriptionLogs, ready: false };
5598 this.flushTests.push(flushTest);
5599 var runMode = this.runMode;
5600 return {
5601 toBe: function (marblesOrMarblesArray) {
5602 var marblesArray = typeof marblesOrMarblesArray === 'string' ? [marblesOrMarblesArray] : marblesOrMarblesArray;
5603 flushTest.ready = true;
5604 flushTest.expected = marblesArray
5605 .map(function (marbles) { return TestScheduler.parseMarblesAsSubscriptions(marbles, runMode); })
5606 .filter(function (marbles) { return marbles.subscribedFrame !== Infinity; });
5607 },
5608 };
5609 };
5610 TestScheduler.prototype.flush = function () {
5611 var _this = this;
5612 var hotObservables = this.hotObservables;
5613 while (hotObservables.length > 0) {
5614 hotObservables.shift().setup();
5615 }
5616 _super.prototype.flush.call(this);
5617 this.flushTests = this.flushTests.filter(function (test) {
5618 if (test.ready) {
5619 _this.assertDeepEqual(test.actual, test.expected);
5620 return false;
5621 }
5622 return true;
5623 });
5624 };
5625 TestScheduler.parseMarblesAsSubscriptions = function (marbles, runMode) {
5626 var _this = this;
5627 if (runMode === void 0) { runMode = false; }
5628 if (typeof marbles !== 'string') {
5629 return new SubscriptionLog(Infinity);
5630 }
5631 var characters = __spreadArray([], __read(marbles));
5632 var len = characters.length;
5633 var groupStart = -1;
5634 var subscriptionFrame = Infinity;
5635 var unsubscriptionFrame = Infinity;
5636 var frame = 0;
5637 var _loop_1 = function (i) {
5638 var nextFrame = frame;
5639 var advanceFrameBy = function (count) {
5640 nextFrame += count * _this.frameTimeFactor;
5641 };
5642 var c = characters[i];
5643 switch (c) {
5644 case ' ':
5645 if (!runMode) {
5646 advanceFrameBy(1);
5647 }
5648 break;
5649 case '-':
5650 advanceFrameBy(1);
5651 break;
5652 case '(':
5653 groupStart = frame;
5654 advanceFrameBy(1);
5655 break;
5656 case ')':
5657 groupStart = -1;
5658 advanceFrameBy(1);
5659 break;
5660 case '^':
5661 if (subscriptionFrame !== Infinity) {
5662 throw new Error("found a second subscription point '^' in a " + 'subscription marble diagram. There can only be one.');
5663 }
5664 subscriptionFrame = groupStart > -1 ? groupStart : frame;
5665 advanceFrameBy(1);
5666 break;
5667 case '!':
5668 if (unsubscriptionFrame !== Infinity) {
5669 throw new Error("found a second unsubscription point '!' in a " + 'subscription marble diagram. There can only be one.');
5670 }
5671 unsubscriptionFrame = groupStart > -1 ? groupStart : frame;
5672 break;
5673 default:
5674 if (runMode && c.match(/^[0-9]$/)) {
5675 if (i === 0 || characters[i - 1] === ' ') {
5676 var buffer = characters.slice(i).join('');
5677 var match = buffer.match(/^([0-9]+(?:\.[0-9]+)?)(ms|s|m) /);
5678 if (match) {
5679 i += match[0].length - 1;
5680 var duration = parseFloat(match[1]);
5681 var unit = match[2];
5682 var durationInMs = void 0;
5683 switch (unit) {
5684 case 'ms':
5685 durationInMs = duration;
5686 break;
5687 case 's':
5688 durationInMs = duration * 1000;
5689 break;
5690 case 'm':
5691 durationInMs = duration * 1000 * 60;
5692 break;
5693 default:
5694 break;
5695 }
5696 advanceFrameBy(durationInMs / this_1.frameTimeFactor);
5697 break;
5698 }
5699 }
5700 }
5701 throw new Error("there can only be '^' and '!' markers in a " + "subscription marble diagram. Found instead '" + c + "'.");
5702 }
5703 frame = nextFrame;
5704 out_i_1 = i;
5705 };
5706 var this_1 = this, out_i_1;
5707 for (var i = 0; i < len; i++) {
5708 _loop_1(i);
5709 i = out_i_1;
5710 }
5711 if (unsubscriptionFrame < 0) {
5712 return new SubscriptionLog(subscriptionFrame);
5713 }
5714 else {
5715 return new SubscriptionLog(subscriptionFrame, unsubscriptionFrame);
5716 }
5717 };
5718 TestScheduler.parseMarbles = function (marbles, values, errorValue, materializeInnerObservables, runMode) {
5719 var _this = this;
5720 if (materializeInnerObservables === void 0) { materializeInnerObservables = false; }
5721 if (runMode === void 0) { runMode = false; }
5722 if (marbles.indexOf('!') !== -1) {
5723 throw new Error('conventional marble diagrams cannot have the ' + 'unsubscription marker "!"');
5724 }
5725 var characters = __spreadArray([], __read(marbles));
5726 var len = characters.length;
5727 var testMessages = [];
5728 var subIndex = runMode ? marbles.replace(/^[ ]+/, '').indexOf('^') : marbles.indexOf('^');
5729 var frame = subIndex === -1 ? 0 : subIndex * -this.frameTimeFactor;
5730 var getValue = typeof values !== 'object'
5731 ? function (x) { return x; }
5732 : function (x) {
5733 if (materializeInnerObservables && values[x] instanceof ColdObservable) {
5734 return values[x].messages;
5735 }
5736 return values[x];
5737 };
5738 var groupStart = -1;
5739 var _loop_2 = function (i) {
5740 var nextFrame = frame;
5741 var advanceFrameBy = function (count) {
5742 nextFrame += count * _this.frameTimeFactor;
5743 };
5744 var notification = void 0;
5745 var c = characters[i];
5746 switch (c) {
5747 case ' ':
5748 if (!runMode) {
5749 advanceFrameBy(1);
5750 }
5751 break;
5752 case '-':
5753 advanceFrameBy(1);
5754 break;
5755 case '(':
5756 groupStart = frame;
5757 advanceFrameBy(1);
5758 break;
5759 case ')':
5760 groupStart = -1;
5761 advanceFrameBy(1);
5762 break;
5763 case '|':
5764 notification = COMPLETE_NOTIFICATION;
5765 advanceFrameBy(1);
5766 break;
5767 case '^':
5768 advanceFrameBy(1);
5769 break;
5770 case '#':
5771 notification = errorNotification(errorValue || 'error');
5772 advanceFrameBy(1);
5773 break;
5774 default:
5775 if (runMode && c.match(/^[0-9]$/)) {
5776 if (i === 0 || characters[i - 1] === ' ') {
5777 var buffer = characters.slice(i).join('');
5778 var match = buffer.match(/^([0-9]+(?:\.[0-9]+)?)(ms|s|m) /);
5779 if (match) {
5780 i += match[0].length - 1;
5781 var duration = parseFloat(match[1]);
5782 var unit = match[2];
5783 var durationInMs = void 0;
5784 switch (unit) {
5785 case 'ms':
5786 durationInMs = duration;
5787 break;
5788 case 's':
5789 durationInMs = duration * 1000;
5790 break;
5791 case 'm':
5792 durationInMs = duration * 1000 * 60;
5793 break;
5794 default:
5795 break;
5796 }
5797 advanceFrameBy(durationInMs / this_2.frameTimeFactor);
5798 break;
5799 }
5800 }
5801 }
5802 notification = nextNotification(getValue(c));
5803 advanceFrameBy(1);
5804 break;
5805 }
5806 if (notification) {
5807 testMessages.push({ frame: groupStart > -1 ? groupStart : frame, notification: notification });
5808 }
5809 frame = nextFrame;
5810 out_i_2 = i;
5811 };
5812 var this_2 = this, out_i_2;
5813 for (var i = 0; i < len; i++) {
5814 _loop_2(i);
5815 i = out_i_2;
5816 }
5817 return testMessages;
5818 };
5819 TestScheduler.prototype.createAnimator = function () {
5820 var _this = this;
5821 if (!this.runMode) {
5822 throw new Error('animate() must only be used in run mode');
5823 }
5824 var lastHandle = 0;
5825 var map;
5826 var delegate = {
5827 requestAnimationFrame: function (callback) {
5828 if (!map) {
5829 throw new Error('animate() was not called within run()');
5830 }
5831 var handle = ++lastHandle;
5832 map.set(handle, callback);
5833 return handle;
5834 },
5835 cancelAnimationFrame: function (handle) {
5836 if (!map) {
5837 throw new Error('animate() was not called within run()');
5838 }
5839 map.delete(handle);
5840 },
5841 };
5842 var animate = function (marbles) {
5843 var e_1, _a;
5844 if (map) {
5845 throw new Error('animate() must not be called more than once within run()');
5846 }
5847 if (/[|#]/.test(marbles)) {
5848 throw new Error('animate() must not complete or error');
5849 }
5850 map = new Map();
5851 var messages = TestScheduler.parseMarbles(marbles, undefined, undefined, undefined, true);
5852 try {
5853 for (var messages_1 = __values(messages), messages_1_1 = messages_1.next(); !messages_1_1.done; messages_1_1 = messages_1.next()) {
5854 var message = messages_1_1.value;
5855 _this.schedule(function () {
5856 var e_2, _a;
5857 var now = _this.now();
5858 var callbacks = Array.from(map.values());
5859 map.clear();
5860 try {
5861 for (var callbacks_1 = (e_2 = void 0, __values(callbacks)), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) {
5862 var callback = callbacks_1_1.value;
5863 callback(now);
5864 }
5865 }
5866 catch (e_2_1) { e_2 = { error: e_2_1 }; }
5867 finally {
5868 try {
5869 if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1);
5870 }
5871 finally { if (e_2) throw e_2.error; }
5872 }
5873 }, message.frame);
5874 }
5875 }
5876 catch (e_1_1) { e_1 = { error: e_1_1 }; }
5877 finally {
5878 try {
5879 if (messages_1_1 && !messages_1_1.done && (_a = messages_1.return)) _a.call(messages_1);
5880 }
5881 finally { if (e_1) throw e_1.error; }
5882 }
5883 };
5884 return { animate: animate, delegate: delegate };
5885 };
5886 TestScheduler.prototype.createDelegates = function () {
5887 var _this = this;
5888 var lastHandle = 0;
5889 var scheduleLookup = new Map();
5890 var run = function () {
5891 var now = _this.now();
5892 var scheduledRecords = Array.from(scheduleLookup.values());
5893 var scheduledRecordsDue = scheduledRecords.filter(function (_a) {
5894 var due = _a.due;
5895 return due <= now;
5896 });
5897 var dueImmediates = scheduledRecordsDue.filter(function (_a) {
5898 var type = _a.type;
5899 return type === 'immediate';
5900 });
5901 if (dueImmediates.length > 0) {
5902 var _a = dueImmediates[0], handle = _a.handle, handler = _a.handler;
5903 scheduleLookup.delete(handle);
5904 handler();
5905 return;
5906 }
5907 var dueIntervals = scheduledRecordsDue.filter(function (_a) {
5908 var type = _a.type;
5909 return type === 'interval';
5910 });
5911 if (dueIntervals.length > 0) {
5912 var firstDueInterval = dueIntervals[0];
5913 var duration = firstDueInterval.duration, handler = firstDueInterval.handler;
5914 firstDueInterval.due = now + duration;
5915 firstDueInterval.subscription = _this.schedule(run, duration);
5916 handler();
5917 return;
5918 }
5919 var dueTimeouts = scheduledRecordsDue.filter(function (_a) {
5920 var type = _a.type;
5921 return type === 'timeout';
5922 });
5923 if (dueTimeouts.length > 0) {
5924 var _b = dueTimeouts[0], handle = _b.handle, handler = _b.handler;
5925 scheduleLookup.delete(handle);
5926 handler();
5927 return;
5928 }
5929 throw new Error('Expected a due immediate or interval');
5930 };
5931 var immediate = {
5932 setImmediate: function (handler) {
5933 var handle = ++lastHandle;
5934 scheduleLookup.set(handle, {
5935 due: _this.now(),
5936 duration: 0,
5937 handle: handle,
5938 handler: handler,
5939 subscription: _this.schedule(run, 0),
5940 type: 'immediate',
5941 });
5942 return handle;
5943 },
5944 clearImmediate: function (handle) {
5945 var value = scheduleLookup.get(handle);
5946 if (value) {
5947 value.subscription.unsubscribe();
5948 scheduleLookup.delete(handle);
5949 }
5950 },
5951 };
5952 var interval = {
5953 setInterval: function (handler, duration) {
5954 if (duration === void 0) { duration = 0; }
5955 var handle = ++lastHandle;
5956 scheduleLookup.set(handle, {
5957 due: _this.now() + duration,
5958 duration: duration,
5959 handle: handle,
5960 handler: handler,
5961 subscription: _this.schedule(run, duration),
5962 type: 'interval',
5963 });
5964 return handle;
5965 },
5966 clearInterval: function (handle) {
5967 var value = scheduleLookup.get(handle);
5968 if (value) {
5969 value.subscription.unsubscribe();
5970 scheduleLookup.delete(handle);
5971 }
5972 },
5973 };
5974 var timeout = {
5975 setTimeout: function (handler, duration) {
5976 if (duration === void 0) { duration = 0; }
5977 var handle = ++lastHandle;
5978 scheduleLookup.set(handle, {
5979 due: _this.now() + duration,
5980 duration: duration,
5981 handle: handle,
5982 handler: handler,
5983 subscription: _this.schedule(run, duration),
5984 type: 'timeout',
5985 });
5986 return handle;
5987 },
5988 clearTimeout: function (handle) {
5989 var value = scheduleLookup.get(handle);
5990 if (value) {
5991 value.subscription.unsubscribe();
5992 scheduleLookup.delete(handle);
5993 }
5994 },
5995 };
5996 return { immediate: immediate, interval: interval, timeout: timeout };
5997 };
5998 TestScheduler.prototype.run = function (callback) {
5999 var prevFrameTimeFactor = TestScheduler.frameTimeFactor;
6000 var prevMaxFrames = this.maxFrames;
6001 TestScheduler.frameTimeFactor = 1;
6002 this.maxFrames = Infinity;
6003 this.runMode = true;
6004 var animator = this.createAnimator();
6005 var delegates = this.createDelegates();
6006 animationFrameProvider.delegate = animator.delegate;
6007 dateTimestampProvider.delegate = this;
6008 immediateProvider.delegate = delegates.immediate;
6009 intervalProvider.delegate = delegates.interval;
6010 timeoutProvider.delegate = delegates.timeout;
6011 performanceTimestampProvider.delegate = this;
6012 var helpers = {
6013 cold: this.createColdObservable.bind(this),
6014 hot: this.createHotObservable.bind(this),
6015 flush: this.flush.bind(this),
6016 time: this.createTime.bind(this),
6017 expectObservable: this.expectObservable.bind(this),
6018 expectSubscriptions: this.expectSubscriptions.bind(this),
6019 animate: animator.animate,
6020 };
6021 try {
6022 var ret = callback(helpers);
6023 this.flush();
6024 return ret;
6025 }
6026 finally {
6027 TestScheduler.frameTimeFactor = prevFrameTimeFactor;
6028 this.maxFrames = prevMaxFrames;
6029 this.runMode = false;
6030 animationFrameProvider.delegate = undefined;
6031 dateTimestampProvider.delegate = undefined;
6032 immediateProvider.delegate = undefined;
6033 intervalProvider.delegate = undefined;
6034 timeoutProvider.delegate = undefined;
6035 performanceTimestampProvider.delegate = undefined;
6036 }
6037 };
6038 TestScheduler.frameTimeFactor = 10;
6039 return TestScheduler;
6040 }(VirtualTimeScheduler));
6041
6042
6043
6044 var _testing = /*#__PURE__*/Object.freeze({
6045 TestScheduler: TestScheduler
6046 });
6047
6048 function getXHRResponse(xhr) {
6049 switch (xhr.responseType) {
6050 case 'json': {
6051 if ('response' in xhr) {
6052 return xhr.response;
6053 }
6054 else {
6055 var ieXHR = xhr;
6056 return JSON.parse(ieXHR.responseText);
6057 }
6058 }
6059 case 'document':
6060 return xhr.responseXML;
6061 case 'text':
6062 default: {
6063 if ('response' in xhr) {
6064 return xhr.response;
6065 }
6066 else {
6067 var ieXHR = xhr;
6068 return ieXHR.responseText;
6069 }
6070 }
6071 }
6072 }
6073
6074 var AjaxResponse = (function () {
6075 function AjaxResponse(originalEvent, xhr, request, type) {
6076 if (type === void 0) { type = 'download_load'; }
6077 this.originalEvent = originalEvent;
6078 this.xhr = xhr;
6079 this.request = request;
6080 this.type = type;
6081 var status = xhr.status, responseType = xhr.responseType;
6082 this.status = status !== null && status !== void 0 ? status : 0;
6083 this.responseType = responseType !== null && responseType !== void 0 ? responseType : '';
6084 var allHeaders = xhr.getAllResponseHeaders();
6085 this.responseHeaders = allHeaders
6086 ?
6087 allHeaders.split('\n').reduce(function (headers, line) {
6088 var index = line.indexOf(': ');
6089 headers[line.slice(0, index)] = line.slice(index + 2);
6090 return headers;
6091 }, {})
6092 : {};
6093 this.response = getXHRResponse(xhr);
6094 var loaded = originalEvent.loaded, total = originalEvent.total;
6095 this.loaded = loaded;
6096 this.total = total;
6097 }
6098 return AjaxResponse;
6099 }());
6100
6101 var AjaxError = createErrorClass(function (_super) {
6102 return function AjaxErrorImpl(message, xhr, request) {
6103 this.message = message;
6104 this.name = 'AjaxError';
6105 this.xhr = xhr;
6106 this.request = request;
6107 this.status = xhr.status;
6108 this.responseType = xhr.responseType;
6109 var response;
6110 try {
6111 response = getXHRResponse(xhr);
6112 }
6113 catch (err) {
6114 response = xhr.responseText;
6115 }
6116 this.response = response;
6117 };
6118 });
6119 var AjaxTimeoutError = (function () {
6120 function AjaxTimeoutErrorImpl(xhr, request) {
6121 AjaxError.call(this, 'ajax timeout', xhr, request);
6122 this.name = 'AjaxTimeoutError';
6123 return this;
6124 }
6125 AjaxTimeoutErrorImpl.prototype = Object.create(AjaxError.prototype);
6126 return AjaxTimeoutErrorImpl;
6127 })();
6128
6129 function ajaxGet(url, headers) {
6130 return ajax({ method: 'GET', url: url, headers: headers });
6131 }
6132 function ajaxPost(url, body, headers) {
6133 return ajax({ method: 'POST', url: url, body: body, headers: headers });
6134 }
6135 function ajaxDelete(url, headers) {
6136 return ajax({ method: 'DELETE', url: url, headers: headers });
6137 }
6138 function ajaxPut(url, body, headers) {
6139 return ajax({ method: 'PUT', url: url, body: body, headers: headers });
6140 }
6141 function ajaxPatch(url, body, headers) {
6142 return ajax({ method: 'PATCH', url: url, body: body, headers: headers });
6143 }
6144 var mapResponse = map(function (x) { return x.response; });
6145 function ajaxGetJSON(url, headers) {
6146 return mapResponse(ajax({
6147 method: 'GET',
6148 url: url,
6149 headers: headers,
6150 }));
6151 }
6152 var ajax = (function () {
6153 var create = function (urlOrConfig) {
6154 var config = typeof urlOrConfig === 'string'
6155 ? {
6156 url: urlOrConfig,
6157 }
6158 : urlOrConfig;
6159 return fromAjax(config);
6160 };
6161 create.get = ajaxGet;
6162 create.post = ajaxPost;
6163 create.delete = ajaxDelete;
6164 create.put = ajaxPut;
6165 create.patch = ajaxPatch;
6166 create.getJSON = ajaxGetJSON;
6167 return create;
6168 })();
6169 var UPLOAD = 'upload';
6170 var DOWNLOAD = 'download';
6171 var LOADSTART = 'loadstart';
6172 var PROGRESS = 'progress';
6173 var LOAD = 'load';
6174 function fromAjax(init) {
6175 return new Observable(function (destination) {
6176 var _a, _b;
6177 var config = __assign({ async: true, crossDomain: false, withCredentials: false, method: 'GET', timeout: 0, responseType: 'json' }, init);
6178 var queryParams = config.queryParams, configuredBody = config.body, configuredHeaders = config.headers;
6179 var url = config.url;
6180 if (!url) {
6181 throw new TypeError('url is required');
6182 }
6183 if (queryParams) {
6184 var searchParams_1;
6185 if (url.includes('?')) {
6186 var parts = url.split('?');
6187 if (2 < parts.length) {
6188 throw new TypeError('invalid url');
6189 }
6190 searchParams_1 = new URLSearchParams(parts[1]);
6191 new URLSearchParams(queryParams).forEach(function (value, key) { return searchParams_1.set(key, value); });
6192 url = parts[0] + '?' + searchParams_1;
6193 }
6194 else {
6195 searchParams_1 = new URLSearchParams(queryParams);
6196 url = url + '?' + searchParams_1;
6197 }
6198 }
6199 var headers = {};
6200 if (configuredHeaders) {
6201 for (var key in configuredHeaders) {
6202 if (configuredHeaders.hasOwnProperty(key)) {
6203 headers[key.toLowerCase()] = configuredHeaders[key];
6204 }
6205 }
6206 }
6207 var crossDomain = config.crossDomain;
6208 if (!crossDomain && !('x-requested-with' in headers)) {
6209 headers['x-requested-with'] = 'XMLHttpRequest';
6210 }
6211 var withCredentials = config.withCredentials, xsrfCookieName = config.xsrfCookieName, xsrfHeaderName = config.xsrfHeaderName;
6212 if ((withCredentials || !crossDomain) && xsrfCookieName && xsrfHeaderName) {
6213 var xsrfCookie = (_b = (_a = document === null || document === void 0 ? void 0 : document.cookie.match(new RegExp("(^|;\\s*)(" + xsrfCookieName + ")=([^;]*)"))) === null || _a === void 0 ? void 0 : _a.pop()) !== null && _b !== void 0 ? _b : '';
6214 if (xsrfCookie) {
6215 headers[xsrfHeaderName] = xsrfCookie;
6216 }
6217 }
6218 var body = extractContentTypeAndMaybeSerializeBody(configuredBody, headers);
6219 var _request = __assign(__assign({}, config), { url: url,
6220 headers: headers,
6221 body: body });
6222 var xhr;
6223 xhr = init.createXHR ? init.createXHR() : new XMLHttpRequest();
6224 {
6225 var progressSubscriber_1 = init.progressSubscriber, _c = init.includeDownloadProgress, includeDownloadProgress = _c === void 0 ? false : _c, _d = init.includeUploadProgress, includeUploadProgress = _d === void 0 ? false : _d;
6226 var addErrorEvent = function (type, errorFactory) {
6227 xhr.addEventListener(type, function () {
6228 var _a;
6229 var error = errorFactory();
6230 (_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.error) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1, error);
6231 destination.error(error);
6232 });
6233 };
6234 addErrorEvent('timeout', function () { return new AjaxTimeoutError(xhr, _request); });
6235 addErrorEvent('abort', function () { return new AjaxError('aborted', xhr, _request); });
6236 var createResponse_1 = function (direction, event) {
6237 return new AjaxResponse(event, xhr, _request, direction + "_" + event.type);
6238 };
6239 var addProgressEvent_1 = function (target, type, direction) {
6240 target.addEventListener(type, function (event) {
6241 destination.next(createResponse_1(direction, event));
6242 });
6243 };
6244 if (includeUploadProgress) {
6245 [LOADSTART, PROGRESS, LOAD].forEach(function (type) { return addProgressEvent_1(xhr.upload, type, UPLOAD); });
6246 }
6247 if (progressSubscriber_1) {
6248 [LOADSTART, PROGRESS].forEach(function (type) { return xhr.upload.addEventListener(type, function (e) { var _a; return (_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.next) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1, e); }); });
6249 }
6250 if (includeDownloadProgress) {
6251 [LOADSTART, PROGRESS].forEach(function (type) { return addProgressEvent_1(xhr, type, DOWNLOAD); });
6252 }
6253 var emitError_1 = function (status) {
6254 var msg = 'ajax error' + (status ? ' ' + status : '');
6255 destination.error(new AjaxError(msg, xhr, _request));
6256 };
6257 xhr.addEventListener('error', function (e) {
6258 var _a;
6259 (_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.error) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1, e);
6260 emitError_1();
6261 });
6262 xhr.addEventListener(LOAD, function (event) {
6263 var _a, _b;
6264 var status = xhr.status;
6265 if (status < 400) {
6266 (_a = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.complete) === null || _a === void 0 ? void 0 : _a.call(progressSubscriber_1);
6267 var response = void 0;
6268 try {
6269 response = createResponse_1(DOWNLOAD, event);
6270 }
6271 catch (err) {
6272 destination.error(err);
6273 return;
6274 }
6275 destination.next(response);
6276 destination.complete();
6277 }
6278 else {
6279 (_b = progressSubscriber_1 === null || progressSubscriber_1 === void 0 ? void 0 : progressSubscriber_1.error) === null || _b === void 0 ? void 0 : _b.call(progressSubscriber_1, event);
6280 emitError_1(status);
6281 }
6282 });
6283 }
6284 var user = _request.user, method = _request.method, async = _request.async;
6285 if (user) {
6286 xhr.open(method, url, async, user, _request.password);
6287 }
6288 else {
6289 xhr.open(method, url, async);
6290 }
6291 if (async) {
6292 xhr.timeout = _request.timeout;
6293 xhr.responseType = _request.responseType;
6294 }
6295 if ('withCredentials' in xhr) {
6296 xhr.withCredentials = _request.withCredentials;
6297 }
6298 for (var key in headers) {
6299 if (headers.hasOwnProperty(key)) {
6300 xhr.setRequestHeader(key, headers[key]);
6301 }
6302 }
6303 if (body) {
6304 xhr.send(body);
6305 }
6306 else {
6307 xhr.send();
6308 }
6309 return function () {
6310 if (xhr && xhr.readyState !== 4) {
6311 xhr.abort();
6312 }
6313 };
6314 });
6315 }
6316 function extractContentTypeAndMaybeSerializeBody(body, headers) {
6317 var _a;
6318 if (!body ||
6319 typeof body === 'string' ||
6320 isFormData(body) ||
6321 isURLSearchParams(body) ||
6322 isArrayBuffer(body) ||
6323 isFile(body) ||
6324 isBlob(body) ||
6325 isReadableStream(body)) {
6326 return body;
6327 }
6328 if (isArrayBufferView(body)) {
6329 return body.buffer;
6330 }
6331 if (typeof body === 'object') {
6332 headers['content-type'] = (_a = headers['content-type']) !== null && _a !== void 0 ? _a : 'application/json;charset=utf-8';
6333 return JSON.stringify(body);
6334 }
6335 throw new TypeError('Unknown body type');
6336 }
6337 var _toString = Object.prototype.toString;
6338 function toStringCheck(obj, name) {
6339 return _toString.call(obj) === "[object " + name + "]";
6340 }
6341 function isArrayBuffer(body) {
6342 return toStringCheck(body, 'ArrayBuffer');
6343 }
6344 function isFile(body) {
6345 return toStringCheck(body, 'File');
6346 }
6347 function isBlob(body) {
6348 return toStringCheck(body, 'Blob');
6349 }
6350 function isArrayBufferView(body) {
6351 return typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(body);
6352 }
6353 function isFormData(body) {
6354 return typeof FormData !== 'undefined' && body instanceof FormData;
6355 }
6356 function isURLSearchParams(body) {
6357 return typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams;
6358 }
6359 function isReadableStream(body) {
6360 return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream;
6361 }
6362
6363
6364
6365 var _ajax = /*#__PURE__*/Object.freeze({
6366 ajax: ajax,
6367 AjaxError: AjaxError,
6368 AjaxTimeoutError: AjaxTimeoutError,
6369 AjaxResponse: AjaxResponse
6370 });
6371
6372 var DEFAULT_WEBSOCKET_CONFIG = {
6373 url: '',
6374 deserializer: function (e) { return JSON.parse(e.data); },
6375 serializer: function (value) { return JSON.stringify(value); },
6376 };
6377 var WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT = 'WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }';
6378 var WebSocketSubject = (function (_super) {
6379 __extends(WebSocketSubject, _super);
6380 function WebSocketSubject(urlConfigOrSource, destination) {
6381 var _this = _super.call(this) || this;
6382 _this._socket = null;
6383 if (urlConfigOrSource instanceof Observable) {
6384 _this.destination = destination;
6385 _this.source = urlConfigOrSource;
6386 }
6387 else {
6388 var config = (_this._config = __assign({}, DEFAULT_WEBSOCKET_CONFIG));
6389 _this._output = new Subject();
6390 if (typeof urlConfigOrSource === 'string') {
6391 config.url = urlConfigOrSource;
6392 }
6393 else {
6394 for (var key in urlConfigOrSource) {
6395 if (urlConfigOrSource.hasOwnProperty(key)) {
6396 config[key] = urlConfigOrSource[key];
6397 }
6398 }
6399 }
6400 if (!config.WebSocketCtor && WebSocket) {
6401 config.WebSocketCtor = WebSocket;
6402 }
6403 else if (!config.WebSocketCtor) {
6404 throw new Error('no WebSocket constructor can be found');
6405 }
6406 _this.destination = new ReplaySubject();
6407 }
6408 return _this;
6409 }
6410 WebSocketSubject.prototype.lift = function (operator) {
6411 var sock = new WebSocketSubject(this._config, this.destination);
6412 sock.operator = operator;
6413 sock.source = this;
6414 return sock;
6415 };
6416 WebSocketSubject.prototype._resetState = function () {
6417 this._socket = null;
6418 if (!this.source) {
6419 this.destination = new ReplaySubject();
6420 }
6421 this._output = new Subject();
6422 };
6423 WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) {
6424 var self = this;
6425 return new Observable(function (observer) {
6426 try {
6427 self.next(subMsg());
6428 }
6429 catch (err) {
6430 observer.error(err);
6431 }
6432 var subscription = self.subscribe({
6433 next: function (x) {
6434 try {
6435 if (messageFilter(x)) {
6436 observer.next(x);
6437 }
6438 }
6439 catch (err) {
6440 observer.error(err);
6441 }
6442 },
6443 error: function (err) { return observer.error(err); },
6444 complete: function () { return observer.complete(); },
6445 });
6446 return function () {
6447 try {
6448 self.next(unsubMsg());
6449 }
6450 catch (err) {
6451 observer.error(err);
6452 }
6453 subscription.unsubscribe();
6454 };
6455 });
6456 };
6457 WebSocketSubject.prototype._connectSocket = function () {
6458 var _this = this;
6459 var _a = this._config, WebSocketCtor = _a.WebSocketCtor, protocol = _a.protocol, url = _a.url, binaryType = _a.binaryType;
6460 var observer = this._output;
6461 var socket = null;
6462 try {
6463 socket = protocol ? new WebSocketCtor(url, protocol) : new WebSocketCtor(url);
6464 this._socket = socket;
6465 if (binaryType) {
6466 this._socket.binaryType = binaryType;
6467 }
6468 }
6469 catch (e) {
6470 observer.error(e);
6471 return;
6472 }
6473 var subscription = new Subscription(function () {
6474 _this._socket = null;
6475 if (socket && socket.readyState === 1) {
6476 socket.close();
6477 }
6478 });
6479 socket.onopen = function (evt) {
6480 var _socket = _this._socket;
6481 if (!_socket) {
6482 socket.close();
6483 _this._resetState();
6484 return;
6485 }
6486 var openObserver = _this._config.openObserver;
6487 if (openObserver) {
6488 openObserver.next(evt);
6489 }
6490 var queue = _this.destination;
6491 _this.destination = Subscriber.create(function (x) {
6492 if (socket.readyState === 1) {
6493 try {
6494 var serializer = _this._config.serializer;
6495 socket.send(serializer(x));
6496 }
6497 catch (e) {
6498 _this.destination.error(e);
6499 }
6500 }
6501 }, function (err) {
6502 var closingObserver = _this._config.closingObserver;
6503 if (closingObserver) {
6504 closingObserver.next(undefined);
6505 }
6506 if (err && err.code) {
6507 socket.close(err.code, err.reason);
6508 }
6509 else {
6510 observer.error(new TypeError(WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT));
6511 }
6512 _this._resetState();
6513 }, function () {
6514 var closingObserver = _this._config.closingObserver;
6515 if (closingObserver) {
6516 closingObserver.next(undefined);
6517 }
6518 socket.close();
6519 _this._resetState();
6520 });
6521 if (queue && queue instanceof ReplaySubject) {
6522 subscription.add(queue.subscribe(_this.destination));
6523 }
6524 };
6525 socket.onerror = function (e) {
6526 _this._resetState();
6527 observer.error(e);
6528 };
6529 socket.onclose = function (e) {
6530 if (socket === _this._socket) {
6531 _this._resetState();
6532 }
6533 var closeObserver = _this._config.closeObserver;
6534 if (closeObserver) {
6535 closeObserver.next(e);
6536 }
6537 if (e.wasClean) {
6538 observer.complete();
6539 }
6540 else {
6541 observer.error(e);
6542 }
6543 };
6544 socket.onmessage = function (e) {
6545 try {
6546 var deserializer = _this._config.deserializer;
6547 observer.next(deserializer(e));
6548 }
6549 catch (err) {
6550 observer.error(err);
6551 }
6552 };
6553 };
6554 WebSocketSubject.prototype._subscribe = function (subscriber) {
6555 var _this = this;
6556 var source = this.source;
6557 if (source) {
6558 return source.subscribe(subscriber);
6559 }
6560 if (!this._socket) {
6561 this._connectSocket();
6562 }
6563 this._output.subscribe(subscriber);
6564 subscriber.add(function () {
6565 var _socket = _this._socket;
6566 if (_this._output.observers.length === 0) {
6567 if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
6568 _socket.close();
6569 }
6570 _this._resetState();
6571 }
6572 });
6573 return subscriber;
6574 };
6575 WebSocketSubject.prototype.unsubscribe = function () {
6576 var _socket = this._socket;
6577 if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
6578 _socket.close();
6579 }
6580 this._resetState();
6581 _super.prototype.unsubscribe.call(this);
6582 };
6583 return WebSocketSubject;
6584 }(AnonymousSubject));
6585
6586 function webSocket(urlConfigOrSource) {
6587 return new WebSocketSubject(urlConfigOrSource);
6588 }
6589
6590
6591
6592 var _webSocket = /*#__PURE__*/Object.freeze({
6593 webSocket: webSocket,
6594 WebSocketSubject: WebSocketSubject
6595 });
6596
6597 function fromFetch(input, initWithSelector) {
6598 if (initWithSelector === void 0) { initWithSelector = {}; }
6599 var selector = initWithSelector.selector, init = __rest(initWithSelector, ["selector"]);
6600 return new Observable(function (subscriber) {
6601 var controller = new AbortController();
6602 var signal = controller.signal;
6603 var abortable = true;
6604 var outerSignal = init.signal;
6605 if (outerSignal) {
6606 if (outerSignal.aborted) {
6607 controller.abort();
6608 }
6609 else {
6610 var outerSignalHandler_1 = function () {
6611 if (!signal.aborted) {
6612 controller.abort();
6613 }
6614 };
6615 outerSignal.addEventListener('abort', outerSignalHandler_1);
6616 subscriber.add(function () { return outerSignal.removeEventListener('abort', outerSignalHandler_1); });
6617 }
6618 }
6619 var perSubscriberInit = __assign(__assign({}, init), { signal: signal });
6620 var handleError = function (err) {
6621 abortable = false;
6622 subscriber.error(err);
6623 };
6624 fetch(input, perSubscriberInit)
6625 .then(function (response) {
6626 if (selector) {
6627 innerFrom(selector(response)).subscribe(createOperatorSubscriber(subscriber, undefined, function () {
6628 abortable = false;
6629 subscriber.complete();
6630 }, handleError));
6631 }
6632 else {
6633 abortable = false;
6634 subscriber.next(response);
6635 subscriber.complete();
6636 }
6637 })
6638 .catch(handleError);
6639 return function () {
6640 if (abortable) {
6641 controller.abort();
6642 }
6643 };
6644 });
6645 }
6646
6647
6648
6649 var _fetch = /*#__PURE__*/Object.freeze({
6650 fromFetch: fromFetch
6651 });
6652
6653 var operators = _operators;
6654 var testing = _testing;
6655 var ajax$1 = _ajax;
6656 var webSocket$1 = _webSocket;
6657 var fetch$1 = _fetch;
6658
6659 exports.operators = operators;
6660 exports.testing = testing;
6661 exports.ajax = ajax$1;
6662 exports.webSocket = webSocket$1;
6663 exports.fetch = fetch$1;
6664 exports.Observable = Observable;
6665 exports.ConnectableObservable = ConnectableObservable;
6666 exports.observable = observable;
6667 exports.animationFrames = animationFrames;
6668 exports.Subject = Subject;
6669 exports.BehaviorSubject = BehaviorSubject;
6670 exports.ReplaySubject = ReplaySubject;
6671 exports.AsyncSubject = AsyncSubject;
6672 exports.asap = asap;
6673 exports.asapScheduler = asapScheduler;
6674 exports.async = async;
6675 exports.asyncScheduler = asyncScheduler;
6676 exports.queue = queue;
6677 exports.queueScheduler = queueScheduler;
6678 exports.animationFrame = animationFrame;
6679 exports.animationFrameScheduler = animationFrameScheduler;
6680 exports.VirtualTimeScheduler = VirtualTimeScheduler;
6681 exports.VirtualAction = VirtualAction;
6682 exports.Scheduler = Scheduler;
6683 exports.Subscription = Subscription;
6684 exports.Subscriber = Subscriber;
6685 exports.Notification = Notification;
6686 exports.pipe = pipe;
6687 exports.noop = noop;
6688 exports.identity = identity;
6689 exports.isObservable = isObservable;
6690 exports.lastValueFrom = lastValueFrom;
6691 exports.firstValueFrom = firstValueFrom;
6692 exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError;
6693 exports.EmptyError = EmptyError;
6694 exports.NotFoundError = NotFoundError;
6695 exports.ObjectUnsubscribedError = ObjectUnsubscribedError;
6696 exports.SequenceError = SequenceError;
6697 exports.TimeoutError = TimeoutError;
6698 exports.UnsubscriptionError = UnsubscriptionError;
6699 exports.bindCallback = bindCallback;
6700 exports.bindNodeCallback = bindNodeCallback;
6701 exports.combineLatest = combineLatest;
6702 exports.concat = concat;
6703 exports.connectable = connectable;
6704 exports.defer = defer;
6705 exports.empty = empty;
6706 exports.forkJoin = forkJoin;
6707 exports.from = from;
6708 exports.fromEvent = fromEvent;
6709 exports.fromEventPattern = fromEventPattern;
6710 exports.generate = generate;
6711 exports.iif = iif;
6712 exports.interval = interval;
6713 exports.merge = merge;
6714 exports.never = never;
6715 exports.of = of;
6716 exports.onErrorResumeNext = onErrorResumeNext;
6717 exports.pairs = pairs;
6718 exports.partition = partition;
6719 exports.race = race;
6720 exports.range = range;
6721 exports.throwError = throwError;
6722 exports.timer = timer;
6723 exports.using = using;
6724 exports.zip = zip;
6725 exports.scheduled = scheduled;
6726 exports.EMPTY = EMPTY;
6727 exports.NEVER = NEVER;
6728 exports.config = config;
6729 exports.audit = audit;
6730 exports.auditTime = auditTime;
6731 exports.buffer = buffer;
6732 exports.bufferCount = bufferCount;
6733 exports.bufferTime = bufferTime;
6734 exports.bufferToggle = bufferToggle;
6735 exports.bufferWhen = bufferWhen;
6736 exports.catchError = catchError;
6737 exports.combineAll = combineAll;
6738 exports.combineLatestAll = combineLatestAll;
6739 exports.combineLatestWith = combineLatestWith;
6740 exports.concatAll = concatAll;
6741 exports.concatMap = concatMap;
6742 exports.concatMapTo = concatMapTo;
6743 exports.concatWith = concatWith;
6744 exports.connect = connect;
6745 exports.count = count;
6746 exports.debounce = debounce;
6747 exports.debounceTime = debounceTime;
6748 exports.defaultIfEmpty = defaultIfEmpty;
6749 exports.delay = delay;
6750 exports.delayWhen = delayWhen;
6751 exports.dematerialize = dematerialize;
6752 exports.distinct = distinct;
6753 exports.distinctUntilChanged = distinctUntilChanged;
6754 exports.distinctUntilKeyChanged = distinctUntilKeyChanged;
6755 exports.elementAt = elementAt;
6756 exports.endWith = endWith;
6757 exports.every = every;
6758 exports.exhaust = exhaust;
6759 exports.exhaustAll = exhaustAll;
6760 exports.exhaustMap = exhaustMap;
6761 exports.expand = expand;
6762 exports.filter = filter;
6763 exports.finalize = finalize;
6764 exports.find = find;
6765 exports.findIndex = findIndex;
6766 exports.first = first;
6767 exports.groupBy = groupBy;
6768 exports.ignoreElements = ignoreElements;
6769 exports.isEmpty = isEmpty;
6770 exports.last = last$1;
6771 exports.map = map;
6772 exports.mapTo = mapTo;
6773 exports.materialize = materialize;
6774 exports.max = max;
6775 exports.mergeAll = mergeAll;
6776 exports.flatMap = flatMap;
6777 exports.mergeMap = mergeMap;
6778 exports.mergeMapTo = mergeMapTo;
6779 exports.mergeScan = mergeScan;
6780 exports.mergeWith = mergeWith;
6781 exports.min = min;
6782 exports.multicast = multicast;
6783 exports.observeOn = observeOn;
6784 exports.onErrorResumeNextWith = onErrorResumeNextWith;
6785 exports.pairwise = pairwise;
6786 exports.pluck = pluck;
6787 exports.publish = publish;
6788 exports.publishBehavior = publishBehavior;
6789 exports.publishLast = publishLast;
6790 exports.publishReplay = publishReplay;
6791 exports.raceWith = raceWith;
6792 exports.reduce = reduce;
6793 exports.repeat = repeat;
6794 exports.repeatWhen = repeatWhen;
6795 exports.retry = retry;
6796 exports.retryWhen = retryWhen;
6797 exports.refCount = refCount;
6798 exports.sample = sample;
6799 exports.sampleTime = sampleTime;
6800 exports.scan = scan;
6801 exports.sequenceEqual = sequenceEqual;
6802 exports.share = share;
6803 exports.shareReplay = shareReplay;
6804 exports.single = single;
6805 exports.skip = skip;
6806 exports.skipLast = skipLast;
6807 exports.skipUntil = skipUntil;
6808 exports.skipWhile = skipWhile;
6809 exports.startWith = startWith;
6810 exports.subscribeOn = subscribeOn;
6811 exports.switchAll = switchAll;
6812 exports.switchMap = switchMap;
6813 exports.switchMapTo = switchMapTo;
6814 exports.switchScan = switchScan;
6815 exports.take = take;
6816 exports.takeLast = takeLast;
6817 exports.takeUntil = takeUntil;
6818 exports.takeWhile = takeWhile;
6819 exports.tap = tap;
6820 exports.throttle = throttle;
6821 exports.throttleTime = throttleTime;
6822 exports.throwIfEmpty = throwIfEmpty;
6823 exports.timeInterval = timeInterval;
6824 exports.timeout = timeout;
6825 exports.timeoutWith = timeoutWith;
6826 exports.timestamp = timestamp;
6827 exports.toArray = toArray;
6828 exports.window = window;
6829 exports.windowCount = windowCount;
6830 exports.windowTime = windowTime;
6831 exports.windowToggle = windowToggle;
6832 exports.windowWhen = windowWhen;
6833 exports.withLatestFrom = withLatestFrom;
6834 exports.zipAll = zipAll;
6835 exports.zipWith = zipWith;
6836
6837 Object.defineProperty(exports, '__esModule', { value: true });
6838
6839})));
6840
6841//# sourceMappingURL=rxjs.umd.js.map
6842
6843
\No newline at end of file