@fncts/observable 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/BehaviorSubject.d.ts +2 -2
  2. package/Notification.d.ts +4 -4
  3. package/Observable/api/connect.d.ts +2 -2
  4. package/Observable/api/connectable.d.ts +2 -2
  5. package/Observable/api/fromEvent.d.ts +4 -0
  6. package/Observable/api/race.d.ts +2 -1
  7. package/Observable/api/raceWith.d.ts +2 -2
  8. package/Observable/api/repeatWhen.d.ts +5 -2
  9. package/Observable/api/retryWhen.d.ts +2 -3
  10. package/Observable/api/share.d.ts +5 -4
  11. package/Observable/api/window.d.ts +2 -2
  12. package/Observable/api/windowCount.d.ts +2 -2
  13. package/Observable/api/windowTime.d.ts +5 -5
  14. package/Observable/api/windowToggle.d.ts +3 -3
  15. package/Observable/api/windowWhen.d.ts +3 -3
  16. package/Observable/api.d.ts +188 -194
  17. package/Observable/definition.d.ts +8 -6
  18. package/Operator.d.ts +2 -2
  19. package/_cjs/Action.cjs.map +1 -1
  20. package/_cjs/AnimationFrameAction.cjs.map +1 -1
  21. package/_cjs/AnimationFrameScheduler.cjs +0 -1
  22. package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
  23. package/_cjs/BehaviorSubject.cjs +1 -1
  24. package/_cjs/BehaviorSubject.cjs.map +1 -1
  25. package/_cjs/Notification.cjs +21 -17
  26. package/_cjs/Notification.cjs.map +1 -1
  27. package/_cjs/Observable/api/connect.cjs +12 -10
  28. package/_cjs/Observable/api/connect.cjs.map +1 -1
  29. package/_cjs/Observable/api/connectable.cjs +6 -4
  30. package/_cjs/Observable/api/connectable.cjs.map +1 -1
  31. package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
  32. package/_cjs/Observable/api/fromEvent.cjs +3 -0
  33. package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
  34. package/_cjs/Observable/api/race.cjs +2 -2
  35. package/_cjs/Observable/api/race.cjs.map +1 -1
  36. package/_cjs/Observable/api/raceWith.cjs +8 -6
  37. package/_cjs/Observable/api/raceWith.cjs.map +1 -1
  38. package/_cjs/Observable/api/repeatWhen.cjs +46 -46
  39. package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
  40. package/_cjs/Observable/api/retryWhen.cjs +31 -38
  41. package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
  42. package/_cjs/Observable/api/share.cjs +66 -64
  43. package/_cjs/Observable/api/share.cjs.map +1 -1
  44. package/_cjs/Observable/api/window.cjs +35 -33
  45. package/_cjs/Observable/api/window.cjs.map +1 -1
  46. package/_cjs/Observable/api/windowCount.cjs +41 -39
  47. package/_cjs/Observable/api/windowCount.cjs.map +1 -1
  48. package/_cjs/Observable/api/windowTime.cjs +66 -64
  49. package/_cjs/Observable/api/windowTime.cjs.map +1 -1
  50. package/_cjs/Observable/api/windowToggle.cjs +63 -61
  51. package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
  52. package/_cjs/Observable/api/windowWhen.cjs +43 -41
  53. package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
  54. package/_cjs/Observable/api.cjs +1270 -1105
  55. package/_cjs/Observable/api.cjs.map +1 -1
  56. package/_cjs/Observable/definition.cjs +9 -8
  57. package/_cjs/Observable/definition.cjs.map +1 -1
  58. package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
  59. package/_cjs/Observable.cjs.map +1 -1
  60. package/_cjs/Operator.cjs +11 -9
  61. package/_cjs/Operator.cjs.map +1 -1
  62. package/_cjs/Scheduler.cjs +0 -5
  63. package/_cjs/Scheduler.cjs.map +1 -1
  64. package/_cjs/Subject.cjs +3 -3
  65. package/_cjs/Subject.cjs.map +1 -1
  66. package/_cjs/Subscriber.cjs.map +1 -1
  67. package/_cjs/internal/util.cjs.map +1 -1
  68. package/_mjs/Action.mjs.map +1 -1
  69. package/_mjs/AnimationFrameAction.mjs.map +1 -1
  70. package/_mjs/AnimationFrameScheduler.mjs +0 -2
  71. package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
  72. package/_mjs/BehaviorSubject.mjs +1 -1
  73. package/_mjs/BehaviorSubject.mjs.map +1 -1
  74. package/_mjs/Notification.mjs +18 -14
  75. package/_mjs/Notification.mjs.map +1 -1
  76. package/_mjs/Observable/api/connect.mjs +12 -10
  77. package/_mjs/Observable/api/connect.mjs.map +1 -1
  78. package/_mjs/Observable/api/connectable.mjs +6 -4
  79. package/_mjs/Observable/api/connectable.mjs.map +1 -1
  80. package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
  81. package/_mjs/Observable/api/fromEvent.mjs +4 -0
  82. package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
  83. package/_mjs/Observable/api/race.mjs +2 -2
  84. package/_mjs/Observable/api/race.mjs.map +1 -1
  85. package/_mjs/Observable/api/raceWith.mjs +7 -5
  86. package/_mjs/Observable/api/raceWith.mjs.map +1 -1
  87. package/_mjs/Observable/api/repeatWhen.mjs +47 -44
  88. package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
  89. package/_mjs/Observable/api/retryWhen.mjs +30 -33
  90. package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
  91. package/_mjs/Observable/api/share.mjs +63 -61
  92. package/_mjs/Observable/api/share.mjs.map +1 -1
  93. package/_mjs/Observable/api/window.mjs +32 -30
  94. package/_mjs/Observable/api/window.mjs.map +1 -1
  95. package/_mjs/Observable/api/windowCount.mjs +40 -38
  96. package/_mjs/Observable/api/windowCount.mjs.map +1 -1
  97. package/_mjs/Observable/api/windowTime.mjs +60 -58
  98. package/_mjs/Observable/api/windowTime.mjs.map +1 -1
  99. package/_mjs/Observable/api/windowToggle.mjs +56 -54
  100. package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
  101. package/_mjs/Observable/api/windowWhen.mjs +42 -40
  102. package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
  103. package/_mjs/Observable/api.mjs +1198 -1031
  104. package/_mjs/Observable/api.mjs.map +1 -1
  105. package/_mjs/Observable/definition.mjs +9 -8
  106. package/_mjs/Observable/definition.mjs.map +1 -1
  107. package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
  108. package/_mjs/Observable.mjs.map +1 -1
  109. package/_mjs/Operator.mjs +11 -9
  110. package/_mjs/Operator.mjs.map +1 -1
  111. package/_mjs/Scheduler.mjs +0 -6
  112. package/_mjs/Scheduler.mjs.map +1 -1
  113. package/_mjs/Subject.mjs +3 -3
  114. package/_mjs/Subject.mjs.map +1 -1
  115. package/_mjs/Subscriber.mjs.map +1 -1
  116. package/_mjs/internal/util.mjs.map +1 -1
  117. package/_src/Action.ts +0 -1
  118. package/_src/AnimationFrameAction.ts +0 -2
  119. package/_src/AnimationFrameScheduler.ts +2 -7
  120. package/_src/BehaviorSubject.ts +3 -3
  121. package/_src/Notification.ts +21 -23
  122. package/_src/Observable/api/connect.ts +12 -9
  123. package/_src/Observable/api/connectable.ts +6 -7
  124. package/_src/Observable/api/fromCallback.ts +0 -1
  125. package/_src/Observable/api/fromEvent.ts +3 -0
  126. package/_src/Observable/api/race.ts +15 -13
  127. package/_src/Observable/api/raceWith.ts +15 -14
  128. package/_src/Observable/api/repeatWhen.ts +51 -56
  129. package/_src/Observable/api/retryWhen.ts +38 -43
  130. package/_src/Observable/api/share.ts +63 -71
  131. package/_src/Observable/api/window.ts +36 -41
  132. package/_src/Observable/api/windowCount.ts +44 -51
  133. package/_src/Observable/api/windowTime.ts +69 -81
  134. package/_src/Observable/api/windowToggle.ts +69 -73
  135. package/_src/Observable/api/windowWhen.ts +49 -55
  136. package/_src/Observable/api.ts +1489 -1495
  137. package/_src/Observable/definition.ts +24 -18
  138. package/_src/Observable/dom/animationFrames.ts +16 -6
  139. package/_src/Observable/instances.ts +0 -23
  140. package/_src/Observable.ts +0 -2
  141. package/_src/Operator.ts +20 -15
  142. package/_src/Scheduler.ts +0 -6
  143. package/_src/Subject.ts +1 -1
  144. package/_src/Subscriber.ts +3 -2
  145. package/_src/internal/util.ts +8 -4
  146. package/package.json +2 -2
@@ -5,48 +5,46 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.TimeoutError = void 0;
7
7
  exports.ap = ap;
8
- exports.as_ = void 0;
9
- exports.at_ = at_;
10
- exports.auditTime_ = auditTime_;
11
- exports.audit_ = void 0;
12
- exports.bufferCount_ = bufferCount_;
13
- exports.bufferTime_ = bufferTime_;
14
- exports.bufferToggle_ = bufferToggle_;
15
- exports.bufferWhen_ = bufferWhen_;
16
- exports.buffer_ = buffer_;
8
+ exports.as = void 0;
9
+ exports.at = at;
10
+ exports.audit = void 0;
11
+ exports.auditTime = auditTime;
12
+ exports.buffer = buffer;
13
+ exports.bufferCount = bufferCount;
14
+ exports.bufferTime = bufferTime;
15
+ exports.bufferToggle = bufferToggle;
16
+ exports.bufferWhen = bufferWhen;
17
17
  exports.catchAllCause = void 0;
18
18
  exports.combineLatestAll = combineLatestAll;
19
- exports.concatAll = exports.combineLatest_ = void 0;
19
+ exports.concatAll = exports.concat = void 0;
20
+ exports.concatMap = concatMap;
20
21
  exports.concatMapWithIndex = concatMapWithIndex;
21
- exports.concatMap_ = concatMap_;
22
- exports.contramapEnvironment = exports.concat_ = void 0;
22
+ exports.contramapEnvironment = void 0;
23
23
  exports.count = count;
24
+ exports.countWith = countWith;
24
25
  exports.countWithIndex = void 0;
25
- exports.countWith_ = countWith_;
26
- exports.debounceWith_ = debounceWith_;
27
- exports.debounce_ = debounce_;
28
- exports.delayWith_ = exports.delayWithIndex = exports.defer = exports.defaultThrottleConfig = void 0;
29
- exports.delay_ = delay_;
26
+ exports.debounce = debounce;
27
+ exports.debounceWith = debounceWith;
28
+ exports.defer = exports.defaultThrottleConfig = void 0;
29
+ exports.delay = delay;
30
+ exports.delayWithIndex = exports.delayWith = void 0;
30
31
  exports.dematerialize = dematerialize;
31
32
  exports.either = either;
32
33
  exports.empty = void 0;
33
- exports.ensuring_ = ensuring_;
34
+ exports.ensuring = ensuring;
34
35
  exports.environmentWithObservable = void 0;
35
36
  exports.exhaustAll = exhaustAll;
37
+ exports.exhaustMap = exhaustMap;
36
38
  exports.exhaustMapWithIndex = void 0;
37
- exports.exhaustMap_ = exhaustMap_;
38
- exports.expandWithIndex = void 0;
39
- exports.expand_ = expand_;
40
- exports.fail = void 0;
39
+ exports.expand = expand;
40
+ exports.fail = exports.expandWithIndex = void 0;
41
41
  exports.failCause = failCause;
42
- exports.filterMapWithIndex = void 0;
43
- exports.filterMap_ = filterMap_;
44
- exports.filterWithIndex_ = void 0;
45
- exports.filter_ = filter_;
46
- exports.findIndexWithIndex = void 0;
47
- exports.findIndex_ = findIndex_;
48
- exports.findWithIndex = void 0;
49
- exports.find_ = find_;
42
+ exports.filter = filter;
43
+ exports.filterMap = filterMap;
44
+ exports.filterWithIndex = exports.filterMapWithIndex = void 0;
45
+ exports.find = find;
46
+ exports.findIndex = findIndex;
47
+ exports.findWithIndex = exports.findIndexWithIndex = void 0;
50
48
  exports.flatten = flatten;
51
49
  exports.foldLeftWithIndex = exports.foldLeft = void 0;
52
50
  exports.forkJoin = forkJoin;
@@ -67,24 +65,22 @@ exports.isEmpty = isEmpty;
67
65
  exports.iterate = iterate;
68
66
  exports.joinAllInternal = joinAllInternal;
69
67
  exports.makeZip = makeZip;
70
- exports.mapError_ = mapError_;
68
+ exports.mapError = mapError;
71
69
  exports.map_ = exports.mapWithIndex = void 0;
72
70
  exports.materialize = materialize;
73
71
  exports.merge = merge;
74
- exports.mergeScanWithIndex = exports.mergeMap_ = exports.mergeMapWithIndex = exports.mergeAll_ = void 0;
75
- exports.mergeScan_ = mergeScan_;
76
- exports.onEmpty_ = exports.of = void 0;
72
+ exports.mergeMapWithIndex = exports.mergeMap = exports.mergeAll = void 0;
73
+ exports.mergeScan = mergeScan;
74
+ exports.onEmpty = exports.of = exports.mergeScanWithIndex = void 0;
77
75
  exports.onErrorResumeNext = onErrorResumeNext;
78
- exports.partitionMapWithIndex_ = void 0;
79
- exports.partitionMap_ = partitionMap_;
80
- exports.partitionWithIndex = void 0;
81
- exports.partition_ = partition_;
82
- exports.provideEnvironment = provideEnvironment;
76
+ exports.partition = partition;
77
+ exports.partitionMap = partitionMap;
78
+ exports.partitionWithIndex = exports.partitionMapWithIndex = void 0;
83
79
  exports.provideService = provideService;
84
- exports.repeat_ = repeat_;
85
- exports.retry_ = retry_;
86
- exports.sampleTime_ = sampleTime_;
87
- exports.sample_ = void 0;
80
+ exports.repeat = repeat;
81
+ exports.retry = retry;
82
+ exports.sample = void 0;
83
+ exports.sampleTime = sampleTime;
88
84
  exports.scanInternal = scanInternal;
89
85
  exports.scanLeft = scanLeft;
90
86
  exports.scanLeftWithIndex = void 0;
@@ -98,31 +94,33 @@ exports.scheduled = void 0;
98
94
  exports.service = service;
99
95
  exports.serviceWith = serviceWith;
100
96
  exports.single = exports.serviceWithObservable = void 0;
101
- exports.skipLast_ = skipLast_;
102
- exports.skipUntil_ = skipUntil_;
103
- exports.skipWhile_ = skipWhile_;
104
- exports.skip_ = skip_;
105
- exports.startWith_ = startWith_;
106
- exports.subscribeOn_ = subscribeOn_;
97
+ exports.skip = skip;
98
+ exports.skipLast = skipLast;
99
+ exports.skipUntil = skipUntil;
100
+ exports.skipWhile = skipWhile;
101
+ exports.startWith = startWith;
102
+ exports.subscribeOn = subscribeOn;
107
103
  exports.swap = swap;
108
104
  exports.switchAll = switchAll;
109
- exports.switchScanWithIndex = exports.switchMap_ = exports.switchMapWithIndex = void 0;
110
- exports.switchScan_ = switchScan_;
111
- exports.takeLast_ = takeLast_;
112
- exports.takeUntil_ = takeUntil_;
105
+ exports.switchMapWithIndex = exports.switchMap = void 0;
106
+ exports.switchScan = switchScan;
107
+ exports.take = exports.switchScanWithIndex = void 0;
108
+ exports.takeLast = takeLast;
109
+ exports.takeUntil = takeUntil;
110
+ exports.takeWhile = takeWhile;
113
111
  exports.takeWhileWithIndex = void 0;
114
- exports.takeWhile_ = takeWhile_;
115
- exports.take_ = void 0;
116
- exports.tap_ = tap_;
117
- exports.throttleTime_ = throttleTime_;
118
- exports.throttle_ = void 0;
119
- exports.timeout_ = timeout_;
120
- exports.uniqueUntilChanged_ = exports.toArray = exports.timer = void 0;
121
- exports.uniqueUntilKeyChanged_ = uniqueUntilKeyChanged_;
122
- exports.unique_ = unique_;
112
+ exports.tap = tap;
113
+ exports.throttle = void 0;
114
+ exports.throttleTime = throttleTime;
115
+ exports.timeout = timeout;
116
+ exports.toArray = exports.timer = void 0;
117
+ exports.unique = unique;
118
+ exports.uniqueUntilChanged = void 0;
119
+ exports.uniqueUntilKeyChanged = uniqueUntilKeyChanged;
123
120
  exports.unit = void 0;
124
121
  exports.zip = zip;
125
- exports.zipWith = void 0;
122
+ exports.zipWith = exports.zipLatest = void 0;
123
+ exports.zipWithLatest = zipWithLatest;
126
124
 
127
125
  var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
128
126
 
@@ -205,42 +203,42 @@ const mapWithIndex = mapWithIndex_1;
205
203
  exports.mapWithIndex = mapWithIndex;
206
204
  const map_ = map_1;
207
205
  exports.map_ = map_;
208
- const as_ = as_1;
209
- exports.as_ = as_;
210
- const filterWithIndex_ = filterWithIndex_1;
211
- exports.filterWithIndex_ = filterWithIndex_;
206
+ const as = as_1;
207
+ exports.as = as;
208
+ const filterWithIndex = filterWithIndex_1;
209
+ exports.filterWithIndex = filterWithIndex;
212
210
  const filterMapWithIndex = filterMapWithIndex_1;
213
211
  exports.filterMapWithIndex = filterMapWithIndex;
214
212
  const partitionWithIndex = partitionWithIndex_1;
215
213
  exports.partitionWithIndex = partitionWithIndex;
216
- const partitionMapWithIndex_ = partitionMapWithIndex_1;
217
- exports.partitionMapWithIndex_ = partitionMapWithIndex_;
214
+ const partitionMapWithIndex = partitionMapWithIndex_1;
215
+ exports.partitionMapWithIndex = partitionMapWithIndex;
218
216
  const mergeMapWithIndex = mergeMapWithIndex_1;
219
217
  exports.mergeMapWithIndex = mergeMapWithIndex;
220
- const mergeMap_ = mergeMap_1;
221
- exports.mergeMap_ = mergeMap_;
218
+ const mergeMap = mergeMap_1;
219
+ exports.mergeMap = mergeMap;
222
220
  const contramapEnvironment = contramapEnvironment_1;
223
221
  exports.contramapEnvironment = contramapEnvironment;
224
222
  const foldLeftWithIndex = foldLeftWithIndex_1;
225
223
  exports.foldLeftWithIndex = foldLeftWithIndex;
226
224
  const foldLeft = foldLeft_1;
227
225
  exports.foldLeft = foldLeft;
228
- const audit_ = audit_1;
229
- exports.audit_ = audit_;
226
+ const audit = audit_1;
227
+ exports.audit = audit;
230
228
  const catchAllCause = catchAllCause_1;
231
229
  exports.catchAllCause = catchAllCause;
232
230
  const concatAll = concatAll_1;
233
231
  exports.concatAll = concatAll;
234
- const concat_ = concat_1;
235
- exports.concat_ = concat_;
232
+ const concat = concat_1;
233
+ exports.concat = concat;
236
234
  const countWithIndex = countWithIndex_1;
237
235
  exports.countWithIndex = countWithIndex;
238
- const combineLatest_ = combineLatest_1;
239
- exports.combineLatest_ = combineLatest_;
236
+ const zipLatest = zipLatest_1;
237
+ exports.zipLatest = zipLatest;
240
238
  const delayWithIndex = delayWithIndex_1;
241
239
  exports.delayWithIndex = delayWithIndex;
242
- const delayWith_ = delayWith_1;
243
- exports.delayWith_ = delayWith_;
240
+ const delayWith = delayWith_1;
241
+ exports.delayWith = delayWith;
244
242
  const exhaustMapWithIndex = exhaustMapWithIndex_1;
245
243
  exports.exhaustMapWithIndex = exhaustMapWithIndex;
246
244
  const expandWithIndex = expandWithIndex_1;
@@ -249,34 +247,34 @@ const findWithIndex = findWithIndex_1;
249
247
  exports.findWithIndex = findWithIndex;
250
248
  const findIndexWithIndex = findIndexWithIndex_1;
251
249
  exports.findIndexWithIndex = findIndexWithIndex;
252
- const mergeAll_ = mergeAll_1;
253
- exports.mergeAll_ = mergeAll_;
250
+ const mergeAll = mergeAll_1;
251
+ exports.mergeAll = mergeAll;
254
252
  const mergeScanWithIndex = mergeScanWithIndex_1;
255
253
  exports.mergeScanWithIndex = mergeScanWithIndex;
256
- const onEmpty_ = onEmpty_1;
257
- exports.onEmpty_ = onEmpty_;
258
- const sample_ = sample_1;
259
- exports.sample_ = sample_;
254
+ const onEmpty = onEmpty_1;
255
+ exports.onEmpty = onEmpty;
256
+ const sample = sample_1;
257
+ exports.sample = sample;
260
258
  const scanLeftWithIndex = scanLeftWithIndex_1;
261
259
  exports.scanLeftWithIndex = scanLeftWithIndex;
262
260
  const serviceWithObservable = serviceWithObservable_1;
263
261
  exports.serviceWithObservable = serviceWithObservable;
264
262
  const switchMapWithIndex = switchMapWithIndex_1;
265
263
  exports.switchMapWithIndex = switchMapWithIndex;
266
- const switchMap_ = switchMap_1;
267
- exports.switchMap_ = switchMap_;
264
+ const switchMap = switchMap_1;
265
+ exports.switchMap = switchMap;
268
266
  const switchScanWithIndex = switchScanWithIndex_1;
269
267
  exports.switchScanWithIndex = switchScanWithIndex;
270
- const take_ = take_1;
271
- exports.take_ = take_;
268
+ const take = take_1;
269
+ exports.take = take;
272
270
  const takeWhileWithIndex = takeWhileWithIndex_1;
273
271
  exports.takeWhileWithIndex = takeWhileWithIndex;
274
- const throttle_ = throttle_1;
275
- exports.throttle_ = throttle_;
272
+ const throttle = throttle_1;
273
+ exports.throttle = throttle;
276
274
  const toArray = toArray_1;
277
275
  exports.toArray = toArray;
278
- const uniqueUntilChanged_ = uniqueUntilChanged_1;
279
- exports.uniqueUntilChanged_ = uniqueUntilChanged_;
276
+ const uniqueUntilChanged = uniqueUntilChanged_1;
277
+ exports.uniqueUntilChanged = uniqueUntilChanged;
280
278
 
281
279
  /**
282
280
  * @tsplus static fncts.observable.ObservableOps halt
@@ -290,8 +288,8 @@ function halt(defect) {
290
288
 
291
289
 
292
290
  function defer_1(observable) {
293
- return new _definition2.Observable(s => {
294
- from_1(observable()).subscribe(s);
291
+ return new _definition2.Observable((s, environment) => {
292
+ from_1(observable()).provideEnvironment(environment).subscribe(s);
295
293
  });
296
294
  }
297
295
  /**
@@ -476,7 +474,7 @@ function interval_1(period = 0, scheduler = tsplus_module_5.asyncScheduler) {
476
474
 
477
475
  function merge(...sources) {
478
476
  const concurrency = (0, _args.popNumber)(sources, Infinity);
479
- return !sources.length ? empty_1() : sources.length === 1 ? from_1(sources[0]) : mergeAll_1(fromArrayLike(sources), concurrency);
477
+ return !sources.length ? empty_1() : sources.length === 1 ? from_1(sources[0]) : mergeAll_1(concurrency)(fromArrayLike(sources));
480
478
  }
481
479
  /**
482
480
  * @tsplus static fncts.observable.ObservableOps of
@@ -498,33 +496,35 @@ function single_1(a) {
498
496
  });
499
497
  }
500
498
  /**
501
- * @tsplus fluent fncts.observable.Observable scheduled
499
+ * @tsplus pipeable fncts.observable.Observable scheduled
502
500
  * @tsplus static fncts.observable.ObservableOps scheduled
503
501
  */
504
502
 
505
503
 
506
- function scheduled_1(input, scheduler) {
507
- if (tsplus_module_2.isArrayLike(input)) {
508
- return scheduleArray(input, scheduler);
509
- }
504
+ function scheduled_1(scheduler) {
505
+ return input => {
506
+ if (tsplus_module_2.isArrayLike(input)) {
507
+ return scheduleArray(input, scheduler);
508
+ }
510
509
 
511
- if (tsplus_module_2.isPromiseLike(input)) {
512
- return schedulePromise(input, scheduler);
513
- }
510
+ if (tsplus_module_2.isPromiseLike(input)) {
511
+ return schedulePromise(input, scheduler);
512
+ }
514
513
 
515
- if (tsplus_module_3.isIterable(input)) {
516
- return scheduleIterable(input, scheduler);
517
- }
514
+ if (tsplus_module_3.isIterable(input)) {
515
+ return scheduleIterable(input, scheduler);
516
+ }
518
517
 
519
- if (tsplus_module_2.isAsyncIterable(input)) {
520
- return scheduleAsyncIterable(input, scheduler);
521
- }
518
+ if (tsplus_module_2.isAsyncIterable(input)) {
519
+ return scheduleAsyncIterable(input, scheduler);
520
+ }
522
521
 
523
- if (tsplus_module_2.isReadableStream(input)) {
524
- return scheduleReadableStreamLike(input, scheduler);
525
- }
522
+ if (tsplus_module_2.isReadableStream(input)) {
523
+ return scheduleReadableStreamLike(input, scheduler);
524
+ }
526
525
 
527
- return scheduleObservable(from_1(input), scheduler);
526
+ return scheduleObservable(from_1(input), scheduler);
527
+ };
528
528
  }
529
529
 
530
530
  function scheduleArray(input, scheduler) {
@@ -588,10 +588,10 @@ function scheduleIterable(input, scheduler) {
588
588
  }
589
589
 
590
590
  function scheduleObservable(input, scheduler) {
591
- return new _definition2.Observable(subscriber => {
591
+ return new _definition2.Observable((subscriber, environment) => {
592
592
  const sub = new tsplus_module_6.Subscription();
593
593
  sub.add(scheduler.schedule(() => {
594
- sub.add(input.subscribe({
594
+ sub.add(input.provideEnvironment(environment).subscribe({
595
595
  next: value => {
596
596
  sub.add(scheduler.schedule(() => subscriber.next(value)));
597
597
  },
@@ -664,7 +664,7 @@ function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyn
664
664
 
665
665
 
666
666
  function makeZip(...sources) {
667
- return sources.length ? new _definition2.Observable(subscriber => {
667
+ return sources.length ? new _definition2.Observable((subscriber, environment) => {
668
668
  let buffers = sources.map(() => []);
669
669
  let completed = sources.map(() => false);
670
670
  subscriber.add(() => {
@@ -672,7 +672,7 @@ function makeZip(...sources) {
672
672
  });
673
673
 
674
674
  for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {
675
- from_1(sources[sourceIndex]).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
675
+ from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
676
676
  next: value => {
677
677
  buffers[sourceIndex].push(value);
678
678
 
@@ -706,17 +706,17 @@ function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
706
706
  return new _definition2.Observable((s, env) => {
707
707
  let fiber;
708
708
  const scheduled = scheduler.schedule(() => {
709
- fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment_(io, env, fileName_1 + ":487:36"), fileName_1 + ":487:56");
709
+ fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment(env, fileName_1 + ":489:36")(io), fileName_1 + ":489:56");
710
710
  fiber.unsafeOnDone(exit => {
711
711
  if (!s.closed) {
712
- tsplus_module_11.match_(tsplus_module_11.flatten(exit), cause => s.error(cause), a => s.next(a));
712
+ tsplus_module_11.match(cause => s.error(cause), a => s.next(a))(tsplus_module_11.flatten(exit));
713
713
  s.complete();
714
714
  }
715
715
  });
716
716
  });
717
717
  return () => {
718
718
  scheduled.unsubscribe();
719
- fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber, fileName_1 + ":500:21"), fileName_1 + ":500:46");
719
+ fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber, fileName_1 + ":502:21"), fileName_1 + ":502:46");
720
720
  };
721
721
  });
722
722
  }
@@ -727,74 +727,88 @@ function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
727
727
 
728
728
  const unit = /*#__PURE__*/single_1(undefined);
729
729
  /**
730
- * @tsplus fluent fncts.observable.Observable zipWith
730
+ * @tsplus pipeable fncts.observable.Observable zipWith
731
731
  */
732
732
 
733
733
  exports.unit = unit;
734
734
 
735
- function zipWith_1(fa, fb, f) {
736
- return mergeMap_1(fa, a => map_1(fb, b => f(a, b)));
735
+ function zipWith_1(fb, f) {
736
+ return fa => {
737
+ return mergeMap_1(a => map_1(b => f(a, b))(fb))(fa);
738
+ };
737
739
  }
738
740
  /**
739
- * @tsplus fluent fncts.observable.Observable zip
741
+ * @tsplus pipeable fncts.observable.Observable zip
740
742
  */
741
743
 
742
744
 
743
- function zip(fa, fb) {
744
- return zipWith_1(fa, fb, tsplus_module_13.tuple);
745
+ function zip(fb) {
746
+ return fa => {
747
+ return zipWith_1(fb, tsplus_module_13.tuple)(fa);
748
+ };
745
749
  }
746
750
  /**
747
- * @tsplus fluent fncts.observable.Observable ap
751
+ * @tsplus pipeable fncts.observable.Observable ap
748
752
  */
749
753
 
750
754
 
751
- function ap(fab, fa) {
752
- return zipWith_1(fab, fa, (f, a) => f(a));
755
+ function ap(fa) {
756
+ return fab => {
757
+ return zipWith_1(fa, (f, a) => f(a))(fab);
758
+ };
753
759
  }
754
760
  /**
755
- * @tsplus fluent fncts.observable.Observable mapWithIndex
761
+ * @tsplus pipeable fncts.observable.Observable mapWithIndex
756
762
  */
757
763
 
758
764
 
759
- function mapWithIndex_1(fa, f) {
760
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
761
- let i = 0;
762
- source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
763
- next: value => {
764
- subscriber.next(f(i++, value));
765
- }
766
- }));
767
- });
765
+ function mapWithIndex_1(f) {
766
+ return fa => {
767
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
768
+ let i = 0;
769
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
770
+ next: value => {
771
+ subscriber.next(f(i++, value));
772
+ }
773
+ }));
774
+ })(fa);
775
+ };
768
776
  }
769
777
  /**
770
- * @tsplus fluent fncts.observable.Observable map
778
+ * @tsplus pipeable fncts.observable.Observable map
771
779
  */
772
780
 
773
781
 
774
- function map_1(fa, f) {
775
- return mapWithIndex_1(fa, (_, a) => f(a));
782
+ function map_1(f) {
783
+ return fa => {
784
+ return mapWithIndex_1((_, a) => f(a))(fa);
785
+ };
776
786
  }
777
787
  /**
778
- * @tsplus fluent fncts.observable.Observable as
788
+ * @tsplus pipeable fncts.observable.Observable as
779
789
  */
780
790
 
781
791
 
782
- function as_1(fa, b) {
783
- return map_1(fa, b);
792
+ function as_1(b) {
793
+ return fa => {
794
+ return map_1(b)(fa);
795
+ };
784
796
  }
785
797
  /**
786
- * @tsplus fluent fncts.observable.Observable mapError
798
+ * @tsplus pipeable fncts.observable.Observable mapError
787
799
  */
788
800
 
789
801
 
790
- function mapError_(fa, f) {
791
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
792
- source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
793
- error: err => {
794
- subscriber.error(tsplus_module_1.map_(err, f));
795
- }
796
- }));
797
- });
802
+ function mapError(f) {
803
+ return fa => {
804
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
805
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
806
+ error: err => {
807
+ subscriber.error(tsplus_module_1.map(f)(err));
808
+ }
809
+ }));
810
+ })(fa);
811
+ };
798
812
  }
799
813
  /**
800
814
  * @tsplus getter fncts.observable.Observable swap
@@ -802,150 +816,170 @@ function mapError_(fa, f) {
802
816
 
803
817
 
804
818
  function swap(fa) {
805
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
806
- source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
819
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
820
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
807
821
  next: value => {
808
822
  subscriber.error(tsplus_module_1.fail(value));
809
823
  },
810
824
  error: err => {
811
- tsplus_module_14.match_(tsplus_module_1.failureOrCause(err), e => {
825
+ tsplus_module_14.match(e => {
812
826
  subscriber.next(e);
813
827
  }, cause => {
814
828
  subscriber.error(cause);
815
- });
829
+ })(tsplus_module_1.failureOrCause(err));
816
830
  }
817
831
  }));
818
- });
832
+ })(fa);
819
833
  }
820
834
 
821
- function filterWithIndex_1(fa, predicate) {
822
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
823
- let index = 0;
824
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
825
- next: value => predicate(index++, value) && subscriber.next(value)
826
- }));
827
- });
835
+ function filterWithIndex_1(predicate) {
836
+ return fa => {
837
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
838
+ let index = 0;
839
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
840
+ next: value => predicate(index++, value) && subscriber.next(value)
841
+ }));
842
+ })(fa);
843
+ };
828
844
  }
829
845
 
830
- function filter_(fa, predicate) {
831
- return filterWithIndex_1(fa, (_, a) => predicate(a));
846
+ function filter(predicate) {
847
+ return fa => {
848
+ return filterWithIndex_1((_, a) => predicate(a))(fa);
849
+ };
832
850
  }
833
851
  /**
834
- * @tsplus fluent fncts.observable.Observable filterMapWithIndex
852
+ * @tsplus pipeable fncts.observable.Observable filterMapWithIndex
835
853
  */
836
854
 
837
855
 
838
- function filterMapWithIndex_1(fa, f) {
839
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
840
- let index = 0;
841
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
842
- next: value => tsplus_module_15.match_(f(index++, value), () => tsplus_module_2.noop, b => subscriber.next(b))
843
- }));
844
- });
856
+ function filterMapWithIndex_1(f) {
857
+ return fa => {
858
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
859
+ let index = 0;
860
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
861
+ next: value => tsplus_module_15.match(() => tsplus_module_2.noop, b => subscriber.next(b))(f(index++, value))
862
+ }));
863
+ })(fa);
864
+ };
845
865
  }
846
866
  /**
847
- * @tsplus fluent fncts.observable.Observable filterMap
867
+ * @tsplus pipeable fncts.observable.Observable filterMap
848
868
  */
849
869
 
850
870
 
851
- function filterMap_(fa, f) {
852
- return filterMapWithIndex_1(fa, (_, a) => f(a));
853
- }
854
-
855
- function partitionWithIndex_1(fa, predicate) {
856
- return [filterWithIndex_1(fa, (i, a) => !predicate(i, a)), filterWithIndex_1(fa, predicate)];
871
+ function filterMap(f) {
872
+ return fa => {
873
+ return filterMapWithIndex_1((_, a) => f(a))(fa);
874
+ };
857
875
  }
858
876
 
859
- function partition_(fa, predicate) {
860
- return partitionWithIndex_1(fa, (_, a) => predicate(a));
877
+ function partitionWithIndex_1(predicate) {
878
+ return fa => {
879
+ return [filterWithIndex_1((i, a) => !predicate(i, a))(fa), filterWithIndex_1(predicate)(fa)];
880
+ };
861
881
  }
862
- /**
863
- * @tsplus fluent fncts.observable.Observable partitionMapWithIndex
864
- */
865
-
866
882
 
867
- function partitionMapWithIndex_1(fa, f) {
868
- return [tsplus_module_8.operate_(fa, (source, subscriber) => {
869
- let index = 0;
870
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
871
- next: value => {
872
- tsplus_module_14.match_(f(index++, value), b => subscriber.next(b), tsplus_module_2.noop);
873
- }
874
- }));
875
- }), tsplus_module_8.operate_(fa, (source, subscriber) => {
876
- let index = 0;
877
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
878
- next: value => {
879
- tsplus_module_14.match_(f(index++, value), tsplus_module_2.noop, c => subscriber.next(c));
880
- }
881
- }));
882
- })];
883
+ function partition(predicate) {
884
+ return fa => {
885
+ return partitionWithIndex_1((_, a) => predicate(a))(fa);
886
+ };
883
887
  }
884
888
  /**
885
- * @tsplus fluent fncts.observable.Observable partitionMap
889
+ * @tsplus pipeable fncts.observable.Observable partitionMapWithIndex
886
890
  */
887
891
 
888
892
 
889
- function partitionMap_(fa, f) {
890
- return partitionMapWithIndex_1(fa, (_, a) => f(a));
893
+ function partitionMapWithIndex_1(f) {
894
+ return fa => {
895
+ return [tsplus_module_8.operate_((source, subscriber, environment) => {
896
+ let index = 0;
897
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
898
+ next: value => {
899
+ tsplus_module_14.match(b => subscriber.next(b), tsplus_module_2.noop)(f(index++, value));
900
+ }
901
+ }));
902
+ })(fa), tsplus_module_8.operate_((source, subscriber, environment) => {
903
+ let index = 0;
904
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
905
+ next: value => {
906
+ tsplus_module_14.match(tsplus_module_2.noop, c => subscriber.next(c))(f(index++, value));
907
+ }
908
+ }));
909
+ })(fa)];
910
+ };
891
911
  }
892
912
  /**
893
- * @tsplus fluent fncts.observable.Observable provideEnvironment
913
+ * @tsplus pipeable fncts.observable.Observable partitionMap
894
914
  */
895
915
 
896
916
 
897
- function provideEnvironment(self, environment) {
898
- return self.provide(environment);
917
+ function partitionMap(f) {
918
+ return fa => {
919
+ return partitionMapWithIndex_1((_, a) => f(a))(fa);
920
+ };
899
921
  }
900
922
  /**
901
- * @tsplus fluent fncts.observable.Observable provideService
923
+ * @tsplus pipeable fncts.observable.Observable provideService
902
924
  */
903
925
 
904
926
 
905
- function provideService(self, service,
927
+ function provideService(service,
906
928
  /** @tsplus auto */
907
929
  tag) {
908
- return contramapEnvironment_1(self, environment => tsplus_module_16.add(environment, service, tag));
930
+ return self => {
931
+ return contramapEnvironment_1(environment => tsplus_module_16.add(service, tag)(environment))(self);
932
+ };
909
933
  }
910
934
  /**
911
- * @tsplus fluent fncts.observable.Observable mergeMapWithIndex
935
+ * @tsplus pipeable fncts.observable.Observable mergeMapWithIndex
912
936
  */
913
937
 
914
938
 
915
- function mergeMapWithIndex_1(ma, f, concurrent = Infinity) {
916
- return tsplus_module_8.operate_(ma, (source, sub) => mergeInternal(source, sub, f, concurrent));
939
+ function mergeMapWithIndex_1(f, concurrent = Infinity) {
940
+ return ma => {
941
+ return tsplus_module_8.operate_((source, sub, environment) => mergeInternal(source, sub, environment, f, concurrent))(ma);
942
+ };
917
943
  }
918
944
  /**
919
- * @tsplus fluent fncts.observable.Observable mergeMap
945
+ * @tsplus pipeable fncts.observable.Observable mergeMap
920
946
  */
921
947
 
922
948
 
923
- function mergeMap_1(ma, f, concurrent = Infinity) {
924
- return mergeMapWithIndex_1(ma, (_, a) => f(a), concurrent);
949
+ function mergeMap_1(f, concurrent = Infinity) {
950
+ return ma => {
951
+ return mergeMapWithIndex_1((_, a) => f(a), concurrent)(ma);
952
+ };
925
953
  }
926
954
  /**
927
- * @tsplus fluent fncts.observable.Observable concatMapWithIndex
955
+ * @tsplus pipeable fncts.observable.Observable concatMapWithIndex
928
956
  */
929
957
 
930
958
 
931
- function concatMapWithIndex(ma, f) {
932
- return mergeMapWithIndex_1(ma, f, 1);
959
+ function concatMapWithIndex(f) {
960
+ return ma => {
961
+ return mergeMapWithIndex_1(f, 1)(ma);
962
+ };
933
963
  }
934
964
  /**
935
- * @tsplus fluent fncts.observable.Observable concatMap
965
+ * @tsplus pipeable fncts.observable.Observable concatMap
936
966
  */
937
967
 
938
968
 
939
- function concatMap_(ma, f) {
940
- return mergeMapWithIndex_1(ma, (_, a) => f(a), 1);
969
+ function concatMap(f) {
970
+ return ma => {
971
+ return mergeMapWithIndex_1((_, a) => f(a), 1)(ma);
972
+ };
941
973
  }
942
974
  /**
943
- * @tsplus fluent fncts.observable.Observable contramapEnvironment
975
+ * @tsplus pipeable fncts.observable.Observable contramapEnvironment
944
976
  */
945
977
 
946
978
 
947
- function contramapEnvironment_1(self, f) {
948
- return environmentWithObservable_1(environment => self.provide(f(environment)));
979
+ function contramapEnvironment_1(f) {
980
+ return self => {
981
+ return environmentWithObservable_1(environment => self.provideEnvironment(f(environment)));
982
+ };
949
983
  }
950
984
  /**
951
985
  * @tsplus getter fncts.observable.Observable flatten
@@ -956,336 +990,358 @@ function flatten(mma) {
956
990
  return concatAll_1(mma);
957
991
  }
958
992
  /**
959
- * @tsplus fluent fncts.observable.Observable foldLeftWithIndex
993
+ * @tsplus pipeable fncts.observable.Observable foldLeftWithIndex
960
994
  */
961
995
 
962
996
 
963
- function foldLeftWithIndex_1(fa, initial, f) {
964
- return tsplus_module_8.operate_(fa, scanInternal(f, initial, true, false, true));
997
+ function foldLeftWithIndex_1(initial, f) {
998
+ return fa => {
999
+ return tsplus_module_8.operate_(scanInternal(f, initial, true, false, true))(fa);
1000
+ };
965
1001
  }
966
1002
  /**
967
- * @tsplus fluent fncts.observable.Observable foldLeft
1003
+ * @tsplus pipeable fncts.observable.Observable foldLeft
968
1004
  */
969
1005
 
970
1006
 
971
- function foldLeft_1(fa, initial, f) {
972
- return foldLeftWithIndex_1(fa, initial, (_, b, a) => f(b, a));
1007
+ function foldLeft_1(initial, f) {
1008
+ return fa => {
1009
+ return foldLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
1010
+ };
973
1011
  }
974
1012
  /**
975
- * @tsplus fluent fncts.observable.Observable at
1013
+ * @tsplus pipeable fncts.observable.Observable at
976
1014
  */
977
1015
 
978
1016
 
979
- function at_(fa, index) {
980
- return onEmpty_1(map_1(take_1(filterWithIndex_1(fa, i => i === index), 1), tsplus_module_17.just), () => tsplus_module_17.nothing());
1017
+ function at(index) {
1018
+ return fa => {
1019
+ return onEmpty_1(() => tsplus_module_17.nothing())(map_1(tsplus_module_17.just)(take_1(1)(filterWithIndex_1(i => i === index)(fa))));
1020
+ };
981
1021
  }
982
1022
  /**
983
- * @tsplus fluent fncts.observable.Observable audit
1023
+ * @tsplus pipeable fncts.observable.Observable audit
984
1024
  */
985
1025
 
986
1026
 
987
- function audit_1(fa, durationSelector) {
988
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
989
- let lastValue = tsplus_module_17.nothing();
990
- let durationSubscriber = null;
991
- let isComplete = false;
1027
+ function audit_1(durationSelector) {
1028
+ return fa => {
1029
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1030
+ let lastValue = tsplus_module_17.nothing();
1031
+ let durationSubscriber = null;
1032
+ let isComplete = false;
992
1033
 
993
- const endDuration = () => {
994
- durationSubscriber?.unsubscribe();
995
- durationSubscriber = null;
1034
+ const endDuration = () => {
1035
+ durationSubscriber?.unsubscribe();
1036
+ durationSubscriber = null;
996
1037
 
997
- if (tsplus_module_18.isJust(lastValue)) {
998
- const {
999
- value
1000
- } = lastValue;
1001
- lastValue = tsplus_module_17.nothing();
1002
- subscriber.next(value);
1003
- }
1038
+ if (tsplus_module_18.isJust(lastValue)) {
1039
+ const {
1040
+ value
1041
+ } = lastValue;
1042
+ lastValue = tsplus_module_17.nothing();
1043
+ subscriber.next(value);
1044
+ }
1004
1045
 
1005
- isComplete && subscriber.complete();
1006
- };
1046
+ isComplete && subscriber.complete();
1047
+ };
1007
1048
 
1008
- const cleanupDuration = () => {
1009
- durationSubscriber = null;
1010
- isComplete && subscriber.complete();
1011
- };
1049
+ const cleanupDuration = () => {
1050
+ durationSubscriber = null;
1051
+ isComplete && subscriber.complete();
1052
+ };
1012
1053
 
1013
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1014
- next: value => {
1015
- lastValue = tsplus_module_17.just(value);
1054
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1055
+ next: value => {
1056
+ lastValue = tsplus_module_17.just(value);
1016
1057
 
1017
- if (!durationSubscriber) {
1018
- from_1(durationSelector(value)).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1019
- next: endDuration,
1020
- complete: cleanupDuration
1021
- }));
1058
+ if (!durationSubscriber) {
1059
+ from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1060
+ next: endDuration,
1061
+ complete: cleanupDuration
1062
+ }));
1063
+ }
1064
+ },
1065
+ complete: () => {
1066
+ isComplete = true;
1067
+ (tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
1022
1068
  }
1023
- },
1024
- complete: () => {
1025
- isComplete = true;
1026
- (tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
1027
- }
1028
- }));
1029
- });
1069
+ }));
1070
+ })(fa);
1071
+ };
1030
1072
  }
1031
1073
  /**
1032
- * @tsplus fluent fncts.observable.Observable auditTime
1074
+ * @tsplus pipeable fncts.observable.Observable auditTime
1033
1075
  */
1034
1076
 
1035
1077
 
1036
- function auditTime_(fa, duration, scheduler = tsplus_module_5.asyncScheduler) {
1037
- return audit_1(fa, () => timer_1(duration, scheduler));
1078
+ function auditTime(duration, scheduler = tsplus_module_5.asyncScheduler) {
1079
+ return fa => {
1080
+ return audit_1(() => timer_1(duration, scheduler))(fa);
1081
+ };
1038
1082
  }
1039
1083
  /**
1040
- * @tsplus fluent fncts.observable.Observable buffer
1084
+ * @tsplus pipeable fncts.observable.Observable buffer
1041
1085
  */
1042
1086
 
1043
1087
 
1044
- function buffer_(fa, closingNotifier) {
1045
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1046
- let buffer = [];
1047
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1048
- next: value => buffer.push(value),
1049
- complete: () => {
1050
- subscriber.next(buffer);
1051
- subscriber.complete();
1052
- }
1053
- }));
1054
- closingNotifier.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1055
- next: () => {
1056
- const b = buffer;
1057
- buffer = [];
1058
- subscriber.next(b);
1059
- },
1060
- complete: tsplus_module_2.noop
1061
- }));
1062
- return () => {
1063
- buffer = null;
1064
- };
1065
- });
1088
+ function buffer(closingNotifier) {
1089
+ return fa => {
1090
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1091
+ let buffer = [];
1092
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1093
+ next: value => buffer.push(value),
1094
+ complete: () => {
1095
+ subscriber.next(buffer);
1096
+ subscriber.complete();
1097
+ }
1098
+ }));
1099
+ closingNotifier.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1100
+ next: () => {
1101
+ const b = buffer;
1102
+ buffer = [];
1103
+ subscriber.next(b);
1104
+ },
1105
+ complete: tsplus_module_2.noop
1106
+ }));
1107
+ return () => {
1108
+ buffer = null;
1109
+ };
1110
+ })(fa);
1111
+ };
1066
1112
  }
1067
1113
  /**
1068
- * @tsplus fluent fncts.observable.Observable bufferCount
1114
+ * @tsplus pipeable fncts.observable.Observable bufferCount
1069
1115
  */
1070
1116
 
1071
1117
 
1072
- function bufferCount_(fa, bufferSize, startBufferEvery) {
1073
- // eslint-disable-next-line no-param-reassign
1074
- startBufferEvery = startBufferEvery ?? bufferSize;
1075
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1076
- let buffers = [];
1077
- let count = 0;
1078
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1079
- next: value => {
1080
- let toEmit = null;
1118
+ function bufferCount(bufferSize, startBufferEvery) {
1119
+ return fa => {
1120
+ // eslint-disable-next-line no-param-reassign
1121
+ startBufferEvery = startBufferEvery ?? bufferSize;
1122
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1123
+ let buffers = [];
1124
+ let count = 0;
1125
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1126
+ next: value => {
1127
+ let toEmit = null;
1081
1128
 
1082
- if (count++ % startBufferEvery === 0) {
1083
- buffers.push([]);
1084
- }
1129
+ if (count++ % startBufferEvery === 0) {
1130
+ buffers.push([]);
1131
+ }
1085
1132
 
1086
- for (const buffer of buffers) {
1087
- buffer.push(value);
1133
+ for (const buffer of buffers) {
1134
+ buffer.push(value);
1088
1135
 
1089
- if (bufferSize <= buffer.length) {
1090
- toEmit = toEmit ?? [];
1091
- toEmit.push(buffer);
1136
+ if (bufferSize <= buffer.length) {
1137
+ toEmit = toEmit ?? [];
1138
+ toEmit.push(buffer);
1139
+ }
1092
1140
  }
1093
- }
1094
1141
 
1095
- if (toEmit) {
1096
- for (const buffer of toEmit) {
1097
- (0, tsplus_module_2.arrayRemove)(buffers, buffer);
1142
+ if (toEmit) {
1143
+ for (const buffer of toEmit) {
1144
+ (0, tsplus_module_2.arrayRemove)(buffers, buffer);
1145
+ subscriber.next(buffer);
1146
+ }
1147
+ }
1148
+ },
1149
+ complete: () => {
1150
+ for (const buffer of buffers) {
1098
1151
  subscriber.next(buffer);
1099
1152
  }
1100
- }
1101
- },
1102
- complete: () => {
1103
- for (const buffer of buffers) {
1104
- subscriber.next(buffer);
1105
- }
1106
1153
 
1107
- subscriber.complete();
1108
- }
1109
- }, () => {
1110
- buffers = null;
1111
- }));
1112
- });
1154
+ subscriber.complete();
1155
+ }
1156
+ }, () => {
1157
+ buffers = null;
1158
+ }));
1159
+ })(fa);
1160
+ };
1113
1161
  }
1114
1162
  /**
1115
- * @tsplus fluent fncts.observable.Observable bufferTime
1163
+ * @tsplus pipeable fncts.observable.Observable bufferTime
1116
1164
  */
1117
1165
 
1118
1166
 
1119
- function bufferTime_(fa, config) {
1120
- const {
1121
- bufferTimeSpan,
1122
- bufferCreationInterval = null,
1123
- maxBufferSize = Infinity,
1124
- scheduler = tsplus_module_5.asyncScheduler
1125
- } = config;
1126
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1127
- let bufferRecords = [];
1128
- let restartOnEmit = true;
1129
-
1130
- const emit = record => {
1131
- const {
1132
- buffer,
1133
- subs
1134
- } = record;
1135
- subs.unsubscribe();
1136
- (0, tsplus_module_2.arrayRemove)(bufferRecords, record);
1137
- subscriber.next(buffer);
1138
- restartOnEmit && startBuffer();
1139
- };
1140
-
1141
- const startBuffer = () => {
1142
- if (bufferRecords) {
1143
- const subs = new tsplus_module_6.Subscription();
1144
- subscriber.add(subs);
1145
- const buffer = [];
1146
- const record = {
1167
+ function bufferTime(config) {
1168
+ return fa => {
1169
+ const {
1170
+ bufferTimeSpan,
1171
+ bufferCreationInterval = null,
1172
+ maxBufferSize = Infinity,
1173
+ scheduler = tsplus_module_5.asyncScheduler
1174
+ } = config;
1175
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1176
+ let bufferRecords = [];
1177
+ let restartOnEmit = true;
1178
+
1179
+ const emit = record => {
1180
+ const {
1147
1181
  buffer,
1148
1182
  subs
1149
- };
1150
- bufferRecords.push(record);
1151
- subs.add(scheduler.schedule(() => emit(record), bufferTimeSpan));
1152
- }
1153
- };
1183
+ } = record;
1184
+ subs.unsubscribe();
1185
+ (0, tsplus_module_2.arrayRemove)(bufferRecords, record);
1186
+ subscriber.next(buffer);
1187
+ restartOnEmit && startBuffer();
1188
+ };
1189
+
1190
+ const startBuffer = () => {
1191
+ if (bufferRecords) {
1192
+ const subs = new tsplus_module_6.Subscription();
1193
+ subscriber.add(subs);
1194
+ const buffer = [];
1195
+ const record = {
1196
+ buffer,
1197
+ subs
1198
+ };
1199
+ bufferRecords.push(record);
1200
+ subs.add(scheduler.schedule(() => emit(record), bufferTimeSpan));
1201
+ }
1202
+ };
1154
1203
 
1155
- bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function () {
1204
+ bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function () {
1205
+ startBuffer();
1206
+ !this.closed && subscriber.add(this.schedule(null, bufferCreationInterval));
1207
+ }, bufferCreationInterval)) : restartOnEmit = true;
1156
1208
  startBuffer();
1157
- !this.closed && subscriber.add(this.schedule(null, bufferCreationInterval));
1158
- }, bufferCreationInterval)) : restartOnEmit = true;
1159
- startBuffer();
1160
- const bufferTimeSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1161
- next: value => {
1162
- const recordsCopy = bufferRecords.slice();
1209
+ const bufferTimeSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1210
+ next: value => {
1211
+ const recordsCopy = bufferRecords.slice();
1212
+
1213
+ for (const record of recordsCopy) {
1214
+ const {
1215
+ buffer
1216
+ } = record;
1217
+ buffer.push(value);
1218
+ maxBufferSize <= buffer.length && emit(record);
1219
+ }
1220
+ },
1221
+ complete: () => {
1222
+ while (bufferRecords?.length) {
1223
+ subscriber.next(bufferRecords.shift().buffer);
1224
+ }
1163
1225
 
1164
- for (const record of recordsCopy) {
1165
- const {
1166
- buffer
1167
- } = record;
1168
- buffer.push(value);
1169
- maxBufferSize <= buffer.length && emit(record);
1170
- }
1171
- },
1172
- complete: () => {
1173
- while (bufferRecords?.length) {
1174
- subscriber.next(bufferRecords.shift().buffer);
1226
+ bufferTimeSubscriber?.unsubscribe();
1227
+ subscriber.complete();
1228
+ subscriber.unsubscribe();
1175
1229
  }
1176
-
1177
- bufferTimeSubscriber?.unsubscribe();
1178
- subscriber.complete();
1179
- subscriber.unsubscribe();
1180
- }
1181
- }, () => bufferRecords = null);
1182
- source.subscribe(bufferTimeSubscriber);
1183
- });
1230
+ }, () => bufferRecords = null);
1231
+ source.provideEnvironment(environment).subscribe(bufferTimeSubscriber);
1232
+ })(fa);
1233
+ };
1184
1234
  }
1185
1235
  /**
1186
- * @tsplus fluent fncts.observable.Observable bufferToggle
1236
+ * @tsplus pipeable fncts.observable.Observable bufferToggle
1187
1237
  */
1188
1238
 
1189
1239
 
1190
- function bufferToggle_(fa, openings, closingSelector) {
1191
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1192
- const buffers = [];
1193
- from_1(openings).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1194
- next: openValue => {
1195
- const buffer = [];
1196
- buffers.push(buffer);
1197
- const closingSubscription = new tsplus_module_6.Subscription();
1240
+ function bufferToggle(openings, closingSelector) {
1241
+ return fa => {
1242
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1243
+ const buffers = [];
1244
+ from_1(openings).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1245
+ next: openValue => {
1246
+ const buffer = [];
1247
+ buffers.push(buffer);
1248
+ const closingSubscription = new tsplus_module_6.Subscription();
1198
1249
 
1199
- const emitBuffer = () => {
1200
- (0, tsplus_module_2.arrayRemove)(buffers, buffer);
1201
- subscriber.next(buffer);
1202
- closingSubscription.unsubscribe();
1203
- };
1250
+ const emitBuffer = () => {
1251
+ (0, tsplus_module_2.arrayRemove)(buffers, buffer);
1252
+ subscriber.next(buffer);
1253
+ closingSubscription.unsubscribe();
1254
+ };
1204
1255
 
1205
- closingSubscription.add(from_1(closingSelector(openValue)).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1206
- next: emitBuffer,
1207
- complete: tsplus_module_2.noop
1208
- })));
1209
- },
1210
- complete: tsplus_module_2.noop
1211
- }));
1212
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1213
- next: value => {
1214
- for (const buffer of buffers) {
1215
- buffer.push(value);
1216
- }
1217
- },
1218
- complete: () => {
1219
- while (buffers.length > 0) {
1220
- subscriber.next(buffers.shift());
1221
- }
1256
+ closingSubscription.add(from_1(closingSelector(openValue)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1257
+ next: emitBuffer,
1258
+ complete: tsplus_module_2.noop
1259
+ })));
1260
+ },
1261
+ complete: tsplus_module_2.noop
1262
+ }));
1263
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1264
+ next: value => {
1265
+ for (const buffer of buffers) {
1266
+ buffer.push(value);
1267
+ }
1268
+ },
1269
+ complete: () => {
1270
+ while (buffers.length > 0) {
1271
+ subscriber.next(buffers.shift());
1272
+ }
1222
1273
 
1223
- subscriber.complete();
1224
- }
1225
- }));
1226
- });
1274
+ subscriber.complete();
1275
+ }
1276
+ }));
1277
+ })(fa);
1278
+ };
1227
1279
  }
1228
1280
  /**
1229
- * @tsplus fluent fncts.observable.Observable bufferWhen
1281
+ * @tsplus pipeable fncts.observable.Observable bufferWhen
1230
1282
  */
1231
1283
 
1232
1284
 
1233
- function bufferWhen_(fa, closingSelector) {
1234
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1235
- let buffer = null;
1236
- let closingSubscriber = null;
1285
+ function bufferWhen(closingSelector) {
1286
+ return fa => {
1287
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1288
+ let buffer = null;
1289
+ let closingSubscriber = null;
1237
1290
 
1238
- const openBuffer = () => {
1239
- closingSubscriber?.unsubscribe();
1240
- const b = buffer;
1241
- buffer = [];
1242
- b && subscriber.next(b);
1243
- from_1(closingSelector()).subscribe(closingSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1244
- next: openBuffer,
1245
- complete: tsplus_module_2.noop
1246
- }));
1247
- };
1291
+ const openBuffer = () => {
1292
+ closingSubscriber?.unsubscribe();
1293
+ const b = buffer;
1294
+ buffer = [];
1295
+ b && subscriber.next(b);
1296
+ from_1(closingSelector()).provideEnvironment(environment).subscribe(closingSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1297
+ next: openBuffer,
1298
+ complete: tsplus_module_2.noop
1299
+ }));
1300
+ };
1248
1301
 
1249
- openBuffer();
1250
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1251
- next: value => buffer?.push(value),
1252
- complete: () => {
1253
- buffer && subscriber.next(buffer);
1254
- subscriber.complete();
1255
- }
1256
- }, () => buffer = closingSubscriber = null));
1257
- });
1302
+ openBuffer();
1303
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1304
+ next: value => buffer?.push(value),
1305
+ complete: () => {
1306
+ buffer && subscriber.next(buffer);
1307
+ subscriber.complete();
1308
+ }
1309
+ }, () => buffer = closingSubscriber = null));
1310
+ })(fa);
1311
+ };
1258
1312
  }
1259
1313
  /**
1260
- * @tsplus fluent fncts.observable.Observable catchAllCause
1314
+ * @tsplus pipeable fncts.observable.Observable catchAllCause
1261
1315
  */
1262
1316
 
1263
1317
 
1264
- function catchAllCause_1(self, f) {
1265
- return tsplus_module_8.operate_(self, (source, subscriber) => {
1266
- let innerSub = null;
1267
- let syncUnsub = false;
1268
- let handledResult;
1269
- innerSub = source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1270
- error: cause => {
1271
- handledResult = from_1(f(cause, catchAllCause_1(source, f)));
1272
-
1273
- if (innerSub) {
1274
- innerSub.unsubscribe();
1275
- innerSub = null;
1276
- handledResult.subscribe(subscriber);
1277
- } else {
1278
- syncUnsub = true;
1318
+ function catchAllCause_1(f) {
1319
+ return self => {
1320
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1321
+ let innerSub = null;
1322
+ let syncUnsub = false;
1323
+ let handledResult;
1324
+ innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1325
+ error: cause => {
1326
+ handledResult = from_1(f(cause, catchAllCause_1(f)(source)));
1327
+
1328
+ if (innerSub) {
1329
+ innerSub.unsubscribe();
1330
+ innerSub = null;
1331
+ handledResult.provideEnvironment(environment).subscribe(subscriber);
1332
+ } else {
1333
+ syncUnsub = true;
1334
+ }
1279
1335
  }
1280
- }
1281
- }));
1336
+ }));
1282
1337
 
1283
- if (syncUnsub) {
1284
- innerSub.unsubscribe();
1285
- innerSub = null;
1286
- handledResult.subscribe(subscriber);
1287
- }
1288
- });
1338
+ if (syncUnsub) {
1339
+ innerSub.unsubscribe();
1340
+ innerSub = null;
1341
+ handledResult.provideEnvironment(environment).subscribe(subscriber);
1342
+ }
1343
+ })(self);
1344
+ };
1289
1345
  }
1290
1346
  /**
1291
1347
  * @tsplus getter fncts.observable.Observable concatAll
@@ -1293,17 +1349,19 @@ function catchAllCause_1(self, f) {
1293
1349
 
1294
1350
 
1295
1351
  function concatAll_1(ffa) {
1296
- return mergeAll_1(ffa, 1);
1352
+ return mergeAll_1(1)(ffa);
1297
1353
  }
1298
1354
  /**
1299
- * @tsplus fluent fncts.observable.Observable concat
1355
+ * @tsplus pipeable fncts.observable.Observable concat
1300
1356
  */
1301
1357
 
1302
1358
 
1303
- function concat_1(fa, ...sources) {
1304
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1305
- concatAll_1(fromArrayLike([source, ...sources])).subscribe(subscriber);
1306
- });
1359
+ function concat_1(...sources) {
1360
+ return fa => {
1361
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1362
+ concatAll_1(fromArrayLike([source, ...sources])).provideEnvironment(environment).subscribe(subscriber);
1363
+ })(fa);
1364
+ };
1307
1365
  }
1308
1366
  /**
1309
1367
  * @tsplus getter fncts.observable.Observable count
@@ -1311,23 +1369,27 @@ function concat_1(fa, ...sources) {
1311
1369
 
1312
1370
 
1313
1371
  function count(fa) {
1314
- return foldLeft_1(fa, 0, (total, _) => total + 1);
1372
+ return foldLeft_1(0, (total, _) => total + 1)(fa);
1315
1373
  }
1316
1374
  /**
1317
- * @tsplus fluent fncts.observable.Observable countWithIndex
1375
+ * @tsplus pipeable fncts.observable.Observable countWithIndex
1318
1376
  */
1319
1377
 
1320
1378
 
1321
- function countWithIndex_1(fa, predicate) {
1322
- return foldLeftWithIndex_1(fa, 0, (i, total, v) => predicate(i, v) ? total + 1 : total);
1379
+ function countWithIndex_1(predicate) {
1380
+ return fa => {
1381
+ return foldLeftWithIndex_1(0, (i, total, v) => predicate(i, v) ? total + 1 : total)(fa);
1382
+ };
1323
1383
  }
1324
1384
  /**
1325
- * @tsplus fluent fncts.observable.Observable countWith
1385
+ * @tsplus pipeable fncts.observable.Observable countWith
1326
1386
  */
1327
1387
 
1328
1388
 
1329
- function countWith_(fa, predicate) {
1330
- return countWithIndex_1(fa, (_, a) => predicate(a));
1389
+ function countWith(predicate) {
1390
+ return fa => {
1391
+ return countWithIndex_1((_, a) => predicate(a))(fa);
1392
+ };
1331
1393
  }
1332
1394
  /**
1333
1395
  * @tsplus getter fncts.observable.Observable combineLatestAll
@@ -1335,116 +1397,132 @@ function countWith_(fa, predicate) {
1335
1397
 
1336
1398
 
1337
1399
  function combineLatestAll(fa) {
1338
- return joinAllInternal(fa, sources => !sources.length ? empty_1() : combineLatest_1(sources[0], ...sources.slice(1)));
1400
+ return joinAllInternal(fa, sources => !sources.length ? empty_1() : zipLatest_1(sources[0], ...sources.slice(1)));
1339
1401
  }
1340
1402
  /**
1341
- * @tsplus fluent fncts.observable.Observable combineLatest
1403
+ * @tsplus pipeable fncts.observable.Observable zipLatest
1342
1404
  */
1343
1405
 
1344
1406
 
1345
- function combineLatest_1(self, ...sources) {
1346
- if (!sources.length) {
1347
- return from_1(self).unsafeCoerce();
1348
- }
1407
+ function zipLatest_1(...sources) {
1408
+ return self => {
1409
+ if (!sources.length) {
1410
+ return from_1(self).unsafeCoerce();
1411
+ }
1349
1412
 
1350
- return tsplus_module_8.operate_(from_1(self), (source, subscriber) => {
1351
- combineLatestInternal(subscriber, [source, ...sources]);
1352
- });
1413
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1414
+ combineLatestInternal(subscriber, environment, [source, ...sources]);
1415
+ })(from_1(self));
1416
+ };
1353
1417
  }
1354
1418
  /**
1355
- * @tsplus fluent fncts.observable.Observable debounceWith
1419
+ * @tsplus pipeable fncts.observable.Observable zipWithLatest
1356
1420
  */
1357
1421
 
1358
1422
 
1359
- function debounceWith_(fa, durationSelector) {
1360
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1361
- let lastValue = tsplus_module_17.nothing();
1362
- let durationSubscriber = null;
1423
+ function zipWithLatest(that, f) {
1424
+ return self => {
1425
+ return map_1(tsplus_module_13.tupled(f))(zipLatest_1(from_1(that))(self));
1426
+ };
1427
+ }
1428
+ /**
1429
+ * @tsplus pipeable fncts.observable.Observable debounceWith
1430
+ */
1363
1431
 
1364
- const emit = () => {
1365
- durationSubscriber?.unsubscribe();
1366
- durationSubscriber = null;
1367
1432
 
1368
- if (tsplus_module_18.isJust(lastValue)) {
1369
- const {
1370
- value
1371
- } = lastValue;
1372
- lastValue = tsplus_module_17.nothing();
1373
- subscriber.next(value);
1374
- }
1375
- };
1433
+ function debounceWith(durationSelector) {
1434
+ return fa => {
1435
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1436
+ let lastValue = tsplus_module_17.nothing();
1437
+ let durationSubscriber = null;
1376
1438
 
1377
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1378
- next: value => {
1439
+ const emit = () => {
1379
1440
  durationSubscriber?.unsubscribe();
1380
- lastValue = tsplus_module_17.just(value);
1381
- durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1382
- next: emit,
1383
- complete: tsplus_module_2.noop
1384
- });
1385
- from_1(durationSelector(value)).subscribe(durationSubscriber);
1386
- },
1387
- complete: () => {
1388
- emit();
1389
- subscriber.complete();
1390
- }
1391
- }, () => {
1392
- lastValue = durationSubscriber = null;
1393
- }));
1394
- });
1441
+ durationSubscriber = null;
1442
+
1443
+ if (tsplus_module_18.isJust(lastValue)) {
1444
+ const {
1445
+ value
1446
+ } = lastValue;
1447
+ lastValue = tsplus_module_17.nothing();
1448
+ subscriber.next(value);
1449
+ }
1450
+ };
1451
+
1452
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1453
+ next: value => {
1454
+ durationSubscriber?.unsubscribe();
1455
+ lastValue = tsplus_module_17.just(value);
1456
+ durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1457
+ next: emit,
1458
+ complete: tsplus_module_2.noop
1459
+ });
1460
+ from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber);
1461
+ },
1462
+ complete: () => {
1463
+ emit();
1464
+ subscriber.complete();
1465
+ }
1466
+ }, () => {
1467
+ lastValue = durationSubscriber = null;
1468
+ }));
1469
+ })(fa);
1470
+ };
1395
1471
  }
1396
1472
  /**
1397
- * @tsplus fluent fncts.observable.Observable debounce
1473
+ * @tsplus pipeable fncts.observable.Observable debounce
1398
1474
  */
1399
1475
 
1400
1476
 
1401
- function debounce_(fa, dueTime, scheduler = tsplus_module_5.asyncScheduler) {
1402
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1403
- let activeTask = null;
1404
- let lastValue = null;
1405
- let lastTime = null;
1406
-
1407
- const emit = () => {
1408
- if (activeTask) {
1409
- activeTask.unsubscribe();
1410
- activeTask = null;
1411
- const value = lastValue;
1412
- lastValue = null;
1413
- subscriber.next(value);
1414
- }
1415
- };
1416
-
1417
- function emitWhenIdle() {
1418
- const targetTime = lastTime + dueTime;
1419
- const now = scheduler.now();
1420
-
1421
- if (now < targetTime) {
1422
- activeTask = this.schedule(undefined, targetTime - now);
1423
- subscriber.add(activeTask);
1424
- return;
1425
- }
1477
+ function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
1478
+ return fa => {
1479
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1480
+ let activeTask = null;
1481
+ let lastValue = null;
1482
+ let lastTime = null;
1426
1483
 
1427
- emit();
1428
- }
1484
+ const emit = () => {
1485
+ if (activeTask) {
1486
+ activeTask.unsubscribe();
1487
+ activeTask = null;
1488
+ const value = lastValue;
1489
+ lastValue = null;
1490
+ subscriber.next(value);
1491
+ }
1492
+ };
1429
1493
 
1430
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1431
- next: value => {
1432
- lastValue = value;
1433
- lastTime = scheduler.now();
1494
+ function emitWhenIdle() {
1495
+ const targetTime = lastTime + dueTime;
1496
+ const now = scheduler.now();
1434
1497
 
1435
- if (!activeTask) {
1436
- activeTask = scheduler.schedule(emitWhenIdle, dueTime);
1498
+ if (now < targetTime) {
1499
+ activeTask = this.schedule(undefined, targetTime - now);
1437
1500
  subscriber.add(activeTask);
1501
+ return;
1438
1502
  }
1439
- },
1440
- complete: () => {
1503
+
1441
1504
  emit();
1442
- subscriber.complete();
1443
1505
  }
1444
- }, () => {
1445
- lastValue = activeTask = null;
1446
- }));
1447
- });
1506
+
1507
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1508
+ next: value => {
1509
+ lastValue = value;
1510
+ lastTime = scheduler.now();
1511
+
1512
+ if (!activeTask) {
1513
+ activeTask = scheduler.schedule(emitWhenIdle, dueTime);
1514
+ subscriber.add(activeTask);
1515
+ }
1516
+ },
1517
+ complete: () => {
1518
+ emit();
1519
+ subscriber.complete();
1520
+ }
1521
+ }, () => {
1522
+ lastValue = activeTask = null;
1523
+ }));
1524
+ })(fa);
1525
+ };
1448
1526
  }
1449
1527
  /**
1450
1528
  * @tsplus getter fncts.observable.Observable either
@@ -1452,41 +1530,47 @@ function debounce_(fa, dueTime, scheduler = tsplus_module_5.asyncScheduler) {
1452
1530
 
1453
1531
 
1454
1532
  function either(fa) {
1455
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1456
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1533
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1534
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1457
1535
  next: value => {
1458
1536
  subscriber.next(tsplus_module_19.right(value));
1459
1537
  },
1460
1538
  error: error => {
1461
- tsplus_module_14.match_(tsplus_module_1.failureOrCause(error), e => subscriber.next(tsplus_module_19.left(e)), cause => subscriber.error(cause));
1539
+ tsplus_module_14.match(e => subscriber.next(tsplus_module_19.left(e)), cause => subscriber.error(cause))(tsplus_module_1.failureOrCause(error));
1462
1540
  }
1463
1541
  }));
1464
- });
1542
+ })(fa);
1465
1543
  }
1466
1544
  /**
1467
- * @tsplus fluent fncts.observable.Observable delayWithIndex
1545
+ * @tsplus pipeable fncts.observable.Observable delayWithIndex
1468
1546
  */
1469
1547
 
1470
1548
 
1471
- function delayWithIndex_1(fa, f) {
1472
- return mergeMapWithIndex_1(fa, (i, a) => as_1(take_1(f(i, a), 1), () => a));
1549
+ function delayWithIndex_1(f) {
1550
+ return fa => {
1551
+ return mergeMapWithIndex_1((i, a) => as_1(() => a)(take_1(1)(f(i, a))))(fa);
1552
+ };
1473
1553
  }
1474
1554
  /**
1475
- * @tsplus fluent fncts.observable.Observable delayWith
1555
+ * @tsplus pipeable fncts.observable.Observable delayWith
1476
1556
  */
1477
1557
 
1478
1558
 
1479
- function delayWith_1(fa, f) {
1480
- return delayWithIndex_1(fa, (_, a) => f(a));
1559
+ function delayWith_1(f) {
1560
+ return fa => {
1561
+ return delayWithIndex_1((_, a) => f(a))(fa);
1562
+ };
1481
1563
  }
1482
1564
  /**
1483
- * @tsplus fluent fncts.observable.Observable delay
1565
+ * @tsplus pipeable fncts.observable.Observable delay
1484
1566
  */
1485
1567
 
1486
1568
 
1487
- function delay_(fa, due, scheduler = tsplus_module_5.asyncScheduler) {
1488
- const duration = timer_1(due, scheduler);
1489
- return delayWith_1(fa, () => duration);
1569
+ function delay(due, scheduler = tsplus_module_5.asyncScheduler) {
1570
+ return fa => {
1571
+ const duration = timer_1(due, scheduler);
1572
+ return delayWith_1(() => duration)(fa);
1573
+ };
1490
1574
  }
1491
1575
  /**
1492
1576
  * @tsplus getter fncts.observable.Observable dematerialize
@@ -1494,22 +1578,24 @@ function delay_(fa, due, scheduler = tsplus_module_5.asyncScheduler) {
1494
1578
 
1495
1579
 
1496
1580
  function dematerialize(fa) {
1497
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1498
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1499
- next: notification => tsplus_module_20.observe_(notification, subscriber)
1581
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1582
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1583
+ next: notification => tsplus_module_20.observe(subscriber)(notification)
1500
1584
  }));
1501
- });
1585
+ })(fa);
1502
1586
  }
1503
1587
  /**
1504
- * @tsplus fluent fncts.observable.Observable ensuring
1588
+ * @tsplus pipeable fncts.observable.Observable ensuring
1505
1589
  */
1506
1590
 
1507
1591
 
1508
- function ensuring_(fa, finalizer) {
1509
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1510
- source.subscribe(subscriber);
1511
- subscriber.add(finalizer);
1512
- });
1592
+ function ensuring(finalizer) {
1593
+ return fa => {
1594
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1595
+ source.provideEnvironment(environment).subscribe(subscriber);
1596
+ subscriber.add(finalizer);
1597
+ })(fa);
1598
+ };
1513
1599
  }
1514
1600
  /**
1515
1601
  * @tsplus getter fncts.observable.Observable exhaustAll
@@ -1517,13 +1603,13 @@ function ensuring_(fa, finalizer) {
1517
1603
 
1518
1604
 
1519
1605
  function exhaustAll(ffa) {
1520
- return tsplus_module_8.operate_(ffa, (source, subscriber) => {
1606
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1521
1607
  let isComplete = false;
1522
1608
  let innerSub = null;
1523
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1609
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1524
1610
  next: inner => {
1525
1611
  if (!innerSub) {
1526
- innerSub = from_1(inner).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1612
+ innerSub = from_1(inner).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1527
1613
  complete: () => {
1528
1614
  innerSub = null;
1529
1615
  isComplete && subscriber.complete();
@@ -1536,78 +1622,93 @@ function exhaustAll(ffa) {
1536
1622
  !innerSub && subscriber.complete();
1537
1623
  }
1538
1624
  }));
1539
- });
1625
+ })(ffa);
1540
1626
  }
1541
1627
  /**
1542
- * @tsplus fluent fncts.observable.Observable exhaustMapWithIndex
1628
+ * @tsplus pipeable fncts.observable.Observable exhaustMapWithIndex
1543
1629
  */
1544
1630
 
1545
1631
 
1546
- function exhaustMapWithIndex_1(self, f) {
1547
- return tsplus_module_8.operate_(self, (source, subscriber) => {
1548
- let index = 0;
1549
- let innerSub = null;
1550
- let isComplete = false;
1551
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1552
- next: outerValue => {
1553
- if (!innerSub) {
1554
- innerSub = tsplus_module_8.operatorSubscriber(subscriber, {
1555
- complete: () => {
1556
- innerSub = null;
1557
- isComplete && subscriber.complete();
1558
- }
1559
- });
1560
- from_1(f(index++, outerValue)).subscribe(innerSub);
1632
+ function exhaustMapWithIndex_1(f) {
1633
+ return self => {
1634
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1635
+ let index = 0;
1636
+ let innerSub = null;
1637
+ let isComplete = false;
1638
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1639
+ next: outerValue => {
1640
+ if (!innerSub) {
1641
+ innerSub = tsplus_module_8.operatorSubscriber(subscriber, {
1642
+ complete: () => {
1643
+ innerSub = null;
1644
+ isComplete && subscriber.complete();
1645
+ }
1646
+ });
1647
+ from_1(f(index++, outerValue)).provideEnvironment(environment).subscribe(innerSub);
1648
+ }
1649
+ },
1650
+ complete: () => {
1651
+ isComplete = true;
1652
+ !innerSub && subscriber.complete();
1561
1653
  }
1562
- },
1563
- complete: () => {
1564
- isComplete = true;
1565
- !innerSub && subscriber.complete();
1566
- }
1567
- }));
1568
- });
1654
+ }));
1655
+ })(self);
1656
+ };
1569
1657
  }
1570
1658
  /**
1571
- * @tsplus fluent fncts.observable.Observable exhaustMap
1659
+ * @tsplus pipeable fncts.observable.Observable exhaustMap
1572
1660
  */
1573
1661
 
1574
1662
 
1575
- function exhaustMap_(self, f) {
1576
- return exhaustMapWithIndex_1(self, (_, a) => f(a));
1663
+ function exhaustMap(f) {
1664
+ return self => {
1665
+ return exhaustMapWithIndex_1((_, a) => f(a))(self);
1666
+ };
1577
1667
  }
1578
1668
  /**
1579
- * @tsplus fluent fncts.observable.Observable expandWithIndex
1669
+ * @tsplus pipeable fncts.observable.Observable expandWithIndex
1580
1670
  */
1581
1671
 
1582
1672
 
1583
- function expandWithIndex_1(fa, f, concurrent = Infinity) {
1584
- // eslint-disable-next-line no-param-reassign
1585
- concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
1586
- return tsplus_module_8.operate_(fa, (source, subscriber) => mergeInternal(source, subscriber, f, concurrent, undefined, true));
1673
+ function expandWithIndex_1(f, concurrent = Infinity) {
1674
+ return fa => {
1675
+ concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
1676
+ return tsplus_module_8.operate_((source, subscriber, environment) => mergeInternal(source, subscriber, environment, f, concurrent, undefined, true))(fa);
1677
+ };
1587
1678
  }
1588
1679
  /**
1589
- * @tsplus fluent fncts.observable.Observable expand
1680
+ * @tsplus pipeable fncts.observable.Observable expand
1590
1681
  */
1591
1682
 
1592
1683
 
1593
- function expand_(fa, f, concurrent = Infinity) {
1594
- return expandWithIndex_1(fa, (_, a) => f(a), concurrent);
1684
+ function expand(f, concurrent = Infinity) {
1685
+ return fa => {
1686
+ return expandWithIndex_1((_, a) => f(a), concurrent)(fa);
1687
+ };
1595
1688
  }
1596
1689
 
1597
- function findWithIndex_1(fa, predicate) {
1598
- return tsplus_module_8.operate_(fa, findInternal(predicate, "value"));
1690
+ function findWithIndex_1(predicate) {
1691
+ return fa => {
1692
+ return tsplus_module_8.operate_(findInternal(predicate, "value"))(fa);
1693
+ };
1599
1694
  }
1600
1695
 
1601
- function find_(fa, predicate) {
1602
- return findWithIndex_1(fa, (_, a) => predicate(a));
1696
+ function find(predicate) {
1697
+ return fa => {
1698
+ return findWithIndex_1((_, a) => predicate(a))(fa);
1699
+ };
1603
1700
  }
1604
1701
 
1605
- function findIndexWithIndex_1(fa, predicate) {
1606
- return tsplus_module_8.operate_(fa, findInternal(predicate, "index"));
1702
+ function findIndexWithIndex_1(predicate) {
1703
+ return fa => {
1704
+ return tsplus_module_8.operate_(findInternal(predicate, "index"))(fa);
1705
+ };
1607
1706
  }
1608
1707
 
1609
- function findIndex_(fa, predicate) {
1610
- return findIndexWithIndex_1(fa, (_, a) => predicate(a));
1708
+ function findIndex(predicate) {
1709
+ return fa => {
1710
+ return findIndexWithIndex_1((_, a) => predicate(a))(fa);
1711
+ };
1611
1712
  }
1612
1713
 
1613
1714
  function forkJoin(...args) {
@@ -1660,11 +1761,11 @@ function forkJoin(...args) {
1660
1761
 
1661
1762
 
1662
1763
  function ignore(fa) {
1663
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1664
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1764
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1765
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1665
1766
  next: tsplus_module_2.noop
1666
1767
  }));
1667
- });
1768
+ })(fa);
1668
1769
  }
1669
1770
  /**
1670
1771
  * @tsplus getter fncts.observable.Observable isEmpty
@@ -1672,8 +1773,8 @@ function ignore(fa) {
1672
1773
 
1673
1774
 
1674
1775
  function isEmpty(fa) {
1675
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1676
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1776
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1777
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1677
1778
  next: () => {
1678
1779
  subscriber.next(false);
1679
1780
  subscriber.complete();
@@ -1683,7 +1784,7 @@ function isEmpty(fa) {
1683
1784
  subscriber.complete();
1684
1785
  }
1685
1786
  }));
1686
- });
1787
+ })(fa);
1687
1788
  }
1688
1789
  /**
1689
1790
  * @tsplus getter fncts.observable.Observable materialize
@@ -1691,8 +1792,8 @@ function isEmpty(fa) {
1691
1792
 
1692
1793
 
1693
1794
  function materialize(fa) {
1694
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1695
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1795
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1796
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1696
1797
  next: value => {
1697
1798
  subscriber.next(tsplus_module_20.next(value));
1698
1799
  },
@@ -1703,40 +1804,46 @@ function materialize(fa) {
1703
1804
  subscriber.next(tsplus_module_20.complete());
1704
1805
  }
1705
1806
  }));
1706
- });
1807
+ })(fa);
1707
1808
  }
1708
1809
  /**
1709
- * @tsplus fluent fncts.observable.Observable mergeAll
1810
+ * @tsplus pipeable fncts.observable.Observable mergeAll
1710
1811
  */
1711
1812
 
1712
1813
 
1713
- function mergeAll_1(self, concurrent = Infinity) {
1714
- return mergeMap_1(self, tsplus_module_13.identity, concurrent);
1814
+ function mergeAll_1(concurrent = Infinity) {
1815
+ return self => {
1816
+ return mergeMap_1(tsplus_module_13.identity, concurrent)(self);
1817
+ };
1715
1818
  }
1716
1819
  /**
1717
- * @tsplus fluent fncts.observable.Observable mergeScanWithIndex
1820
+ * @tsplus pipeable fncts.observable.Observable mergeScanWithIndex
1718
1821
  */
1719
1822
 
1720
1823
 
1721
- function mergeScanWithIndex_1(fa, initial, f, concurrent = Infinity) {
1722
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1723
- let state = initial;
1724
- return mergeInternal(source, subscriber, (index, value) => f(index, state, value), concurrent, value => {
1725
- state = value;
1726
- }, false, undefined, () => state = null);
1727
- });
1824
+ function mergeScanWithIndex_1(initial, f, concurrent = Infinity) {
1825
+ return fa => {
1826
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1827
+ let state = initial;
1828
+ return mergeInternal(source, subscriber, environment, (index, value) => f(index, state, value), concurrent, value => {
1829
+ state = value;
1830
+ }, false, undefined, () => state = null);
1831
+ })(fa);
1832
+ };
1728
1833
  }
1729
1834
  /**
1730
- * @tsplus fluent fncts.observable.Observable mergeScan
1835
+ * @tsplus pipeable fncts.observable.Observable mergeScan
1731
1836
  */
1732
1837
 
1733
1838
 
1734
- function mergeScan_(fa, initial, f, concurrent = Infinity) {
1735
- return mergeScanWithIndex_1(fa, initial, (_, b, a) => f(b, a), concurrent);
1839
+ function mergeScan(initial, f, concurrent = Infinity) {
1840
+ return fa => {
1841
+ return mergeScanWithIndex_1(initial, (_, b, a) => f(b, a), concurrent)(fa);
1842
+ };
1736
1843
  }
1737
1844
 
1738
1845
  function onErrorResumeNext(fa, ...sources) {
1739
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1846
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1740
1847
  const remaining = [source, ...sources];
1741
1848
 
1742
1849
  const subscribeNext = () => {
@@ -1755,7 +1862,7 @@ function onErrorResumeNext(fa, ...sources) {
1755
1862
  error: tsplus_module_2.noop,
1756
1863
  complete: tsplus_module_2.noop
1757
1864
  });
1758
- subscriber.add(nextSource.subscribe(innerSub));
1865
+ subscriber.add(nextSource.provideEnvironment(environment).subscribe(innerSub));
1759
1866
  innerSub.add(subscribeNext);
1760
1867
  } else {
1761
1868
  subscriber.complete();
@@ -1764,178 +1871,192 @@ function onErrorResumeNext(fa, ...sources) {
1764
1871
  };
1765
1872
 
1766
1873
  subscribeNext();
1767
- });
1874
+ })(fa);
1768
1875
  }
1769
1876
  /**
1770
- * @tsplus fluent fncts.observable.Observable onEmpty
1877
+ * @tsplus pipeable fncts.observable.Observable onEmpty
1771
1878
  */
1772
1879
 
1773
1880
 
1774
- function onEmpty_1(fa, f) {
1775
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1776
- let hasValue = false;
1777
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1778
- next: value => {
1779
- hasValue = true;
1780
- subscriber.next(value);
1781
- },
1782
- complete: () => {
1783
- if (!hasValue) {
1784
- subscriber.next(f());
1785
- }
1881
+ function onEmpty_1(f) {
1882
+ return fa => {
1883
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1884
+ let hasValue = false;
1885
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1886
+ next: value => {
1887
+ hasValue = true;
1888
+ subscriber.next(value);
1889
+ },
1890
+ complete: () => {
1891
+ if (!hasValue) {
1892
+ subscriber.next(f());
1893
+ }
1786
1894
 
1787
- subscriber.complete();
1788
- }
1789
- }));
1790
- });
1895
+ subscriber.complete();
1896
+ }
1897
+ }));
1898
+ })(fa);
1899
+ };
1791
1900
  }
1792
1901
  /**
1793
- * @tsplus fluent fncts.observable.Observable repeat
1902
+ * @tsplus pipeable fncts.observable.Observable repeat
1794
1903
  */
1795
1904
 
1796
1905
 
1797
- function repeat_(fa, count = Infinity) {
1798
- return count <= 0 ? empty_1() : tsplus_module_8.operate_(fa, (source, subscriber) => {
1799
- let repeats = 0;
1800
- let innerSub;
1906
+ function repeat(count = Infinity) {
1907
+ return fa => {
1908
+ return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
1909
+ let repeats = 0;
1910
+ let innerSub;
1801
1911
 
1802
- const loop = () => {
1803
- let syncUnsub = false;
1804
- innerSub = source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1805
- complete: () => {
1806
- if (++repeats < count) {
1807
- if (innerSub) {
1808
- innerSub.unsubscribe();
1809
- innerSub = null;
1810
- loop();
1912
+ const loop = () => {
1913
+ let syncUnsub = false;
1914
+ innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1915
+ complete: () => {
1916
+ if (++repeats < count) {
1917
+ if (innerSub) {
1918
+ innerSub.unsubscribe();
1919
+ innerSub = null;
1920
+ loop();
1921
+ } else {
1922
+ syncUnsub = true;
1923
+ }
1811
1924
  } else {
1812
- syncUnsub = true;
1925
+ subscriber.complete;
1813
1926
  }
1814
- } else {
1815
- subscriber.complete;
1816
1927
  }
1817
- }
1818
- }));
1928
+ }));
1819
1929
 
1820
- if (syncUnsub) {
1821
- innerSub.unsubscribe();
1822
- innerSub = null;
1823
- loop();
1824
- }
1825
- };
1930
+ if (syncUnsub) {
1931
+ innerSub.unsubscribe();
1932
+ innerSub = null;
1933
+ loop();
1934
+ }
1935
+ };
1826
1936
 
1827
- loop();
1828
- });
1937
+ loop();
1938
+ })(fa);
1939
+ };
1829
1940
  }
1830
1941
 
1831
- function retry_(fa, configOrCount = Infinity) {
1832
- let config;
1942
+ function retry(configOrCount = Infinity) {
1943
+ return fa => {
1944
+ let config;
1833
1945
 
1834
- if (configOrCount && typeof configOrCount === "object") {
1835
- config = configOrCount;
1836
- } else {
1837
- config = {
1838
- count: configOrCount
1839
- };
1840
- }
1946
+ if (configOrCount && typeof configOrCount === "object") {
1947
+ config = configOrCount;
1948
+ } else {
1949
+ config = {
1950
+ count: configOrCount
1951
+ };
1952
+ }
1841
1953
 
1842
- const {
1843
- count,
1844
- resetOnSuccess = false
1845
- } = config;
1846
- return count <= 0 ? fa : tsplus_module_8.operate_(fa, (source, subscriber) => {
1847
- let retries = 0;
1848
- let innerSub;
1849
-
1850
- const loop = () => {
1851
- let syncUnsub = false;
1852
- innerSub = source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1853
- next: value => {
1854
- if (resetOnSuccess) {
1855
- retries = 0;
1856
- }
1954
+ const {
1955
+ count,
1956
+ resetOnSuccess = false
1957
+ } = config;
1958
+ return count <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
1959
+ let retries = 0;
1960
+ let innerSub;
1961
+
1962
+ const loop = () => {
1963
+ let syncUnsub = false;
1964
+ innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1965
+ next: value => {
1966
+ if (resetOnSuccess) {
1967
+ retries = 0;
1968
+ }
1857
1969
 
1858
- subscriber.next(value);
1859
- },
1860
- error: err => {
1861
- if (retries++ < count) {
1862
- if (innerSub) {
1863
- innerSub.unsubscribe();
1864
- innerSub = null;
1865
- loop();
1970
+ subscriber.next(value);
1971
+ },
1972
+ error: err => {
1973
+ if (retries++ < count) {
1974
+ if (innerSub) {
1975
+ innerSub.unsubscribe();
1976
+ innerSub = null;
1977
+ loop();
1978
+ } else {
1979
+ syncUnsub = true;
1980
+ }
1866
1981
  } else {
1867
- syncUnsub = true;
1982
+ subscriber.error(err);
1868
1983
  }
1869
- } else {
1870
- subscriber.error(err);
1871
1984
  }
1872
- }
1873
- }));
1985
+ }));
1874
1986
 
1875
- if (syncUnsub) {
1876
- innerSub.unsubscribe();
1877
- innerSub = null;
1878
- loop();
1879
- }
1880
- };
1987
+ if (syncUnsub) {
1988
+ innerSub.unsubscribe();
1989
+ innerSub = null;
1990
+ loop();
1991
+ }
1992
+ };
1881
1993
 
1882
- loop();
1883
- });
1994
+ loop();
1995
+ })(fa);
1996
+ };
1884
1997
  }
1885
1998
  /**
1886
- * @tsplus fluent fncts.observable.Observable sample
1999
+ * @tsplus pipeable fncts.observable.Observable sample
1887
2000
  */
1888
2001
 
1889
2002
 
1890
- function sample_1(fa, notifier) {
1891
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1892
- let hasValue = false;
1893
- let lastValue = null;
1894
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1895
- next: value => {
1896
- hasValue = true;
1897
- lastValue = value;
1898
- }
1899
- }));
2003
+ function sample_1(notifier) {
2004
+ return fa => {
2005
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2006
+ let hasValue = false;
2007
+ let lastValue = null;
2008
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2009
+ next: value => {
2010
+ hasValue = true;
2011
+ lastValue = value;
2012
+ }
2013
+ }));
1900
2014
 
1901
- const emit = () => {
1902
- if (hasValue) {
1903
- hasValue = false;
1904
- const value = lastValue;
1905
- lastValue = null;
1906
- subscriber.next(value);
1907
- }
1908
- };
2015
+ const emit = () => {
2016
+ if (hasValue) {
2017
+ hasValue = false;
2018
+ const value = lastValue;
2019
+ lastValue = null;
2020
+ subscriber.next(value);
2021
+ }
2022
+ };
1909
2023
 
1910
- notifier.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1911
- next: emit,
1912
- complete: tsplus_module_2.noop
1913
- }));
1914
- });
2024
+ notifier.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2025
+ next: emit,
2026
+ complete: tsplus_module_2.noop
2027
+ }));
2028
+ })(fa);
2029
+ };
1915
2030
  }
1916
2031
  /**
1917
- * @tsplus fluent fncts.observable.Observable sampleTime
2032
+ * @tsplus pipeable fncts.observable.Observable sampleTime
1918
2033
  */
1919
2034
 
1920
2035
 
1921
- function sampleTime_(fa, period, scheduler = tsplus_module_5.asyncScheduler) {
1922
- return sample_1(fa, interval_1(period, scheduler));
2036
+ function sampleTime(period, scheduler = tsplus_module_5.asyncScheduler) {
2037
+ return fa => {
2038
+ return sample_1(interval_1(period, scheduler))(fa);
2039
+ };
1923
2040
  }
1924
2041
  /**
1925
- * @tsplus fluent fncts.observable.Observable scanLeftWithIndex
2042
+ * @tsplus pipeable fncts.observable.Observable scanLeftWithIndex
1926
2043
  */
1927
2044
 
1928
2045
 
1929
- function scanLeftWithIndex_1(fa, initial, f) {
1930
- return tsplus_module_8.operate_(fa, scanInternal(f, initial, true, true));
2046
+ function scanLeftWithIndex_1(initial, f) {
2047
+ return fa => {
2048
+ return tsplus_module_8.operate_(scanInternal(f, initial, true, true))(fa);
2049
+ };
1931
2050
  }
1932
2051
  /**
1933
- * @tsplus fluent fncts.observable.Observable scanLeft
2052
+ * @tsplus pipeable fncts.observable.Observable scanLeft
1934
2053
  */
1935
2054
 
1936
2055
 
1937
- function scanLeft(fa, initial, f) {
1938
- return scanLeftWithIndex_1(fa, initial, (_, b, a) => f(b, a));
2056
+ function scanLeft(initial, f) {
2057
+ return fa => {
2058
+ return scanLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
2059
+ };
1939
2060
  }
1940
2061
  /**
1941
2062
  * @tsplus static fncts.observable.ObservableOps service
@@ -1965,99 +2086,111 @@ tag) {
1965
2086
  function serviceWithObservable_1(f,
1966
2087
  /** @tsplus auto */
1967
2088
  tag) {
1968
- return environmentWithObservable_1(environment => f(tsplus_module_16.unsafeGet(environment, tag)));
2089
+ return environmentWithObservable_1(environment => f(tsplus_module_16.unsafeGet(tag)(environment)));
1969
2090
  }
1970
2091
  /**
1971
- * @tsplus fluent fncts.observable.Observable skip
2092
+ * @tsplus pipeable fncts.observable.Observable skip
1972
2093
  */
1973
2094
 
1974
2095
 
1975
- function skip_(fa, count) {
1976
- return filterWithIndex_1(fa, (index, _) => count <= index);
2096
+ function skip(count) {
2097
+ return fa => {
2098
+ return filterWithIndex_1((index, _) => count <= index)(fa);
2099
+ };
1977
2100
  }
1978
2101
  /**
1979
- * @tsplus fluent fncts.observable.Observable skipLast
2102
+ * @tsplus pipeable fncts.observable.Observable skipLast
1980
2103
  */
1981
2104
 
1982
2105
 
1983
- function skipLast_(fa, skipCount) {
1984
- return skipCount <= 0 ? fa : tsplus_module_8.operate_(fa, (source, subscriber) => {
1985
- let ring = new Array(skipCount);
1986
- let seen = 0;
1987
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1988
- next: value => {
1989
- const valueIndex = seen++;
2106
+ function skipLast(skipCount) {
2107
+ return fa => {
2108
+ return skipCount <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
2109
+ let ring = new Array(skipCount);
2110
+ let seen = 0;
2111
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2112
+ next: value => {
2113
+ const valueIndex = seen++;
1990
2114
 
1991
- if (valueIndex < skipCount) {
1992
- ring[valueIndex] = value;
1993
- } else {
1994
- const index = valueIndex % skipCount;
1995
- const oldValue = ring[index];
1996
- ring[index] = value;
1997
- subscriber.next(oldValue);
2115
+ if (valueIndex < skipCount) {
2116
+ ring[valueIndex] = value;
2117
+ } else {
2118
+ const index = valueIndex % skipCount;
2119
+ const oldValue = ring[index];
2120
+ ring[index] = value;
2121
+ subscriber.next(oldValue);
2122
+ }
1998
2123
  }
1999
- }
2000
- }));
2001
- return () => {
2002
- ring = null;
2003
- };
2004
- });
2124
+ }));
2125
+ return () => {
2126
+ ring = null;
2127
+ };
2128
+ })(fa);
2129
+ };
2005
2130
  }
2006
2131
  /**
2007
- * @tsplus fluent fncts.observable.Observable skipUntil
2132
+ * @tsplus pipeable fncts.observable.Observable skipUntil
2008
2133
  */
2009
2134
 
2010
2135
 
2011
- function skipUntil_(fa, notifier) {
2012
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2013
- let taking = false;
2014
- const skipSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
2015
- next: () => {
2016
- skipSubscriber?.unsubscribe();
2017
- taking = true;
2018
- },
2019
- complete: tsplus_module_2.noop
2020
- });
2021
- from_1(notifier).subscribe(skipSubscriber);
2022
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2023
- next: value => taking && subscriber.next(value)
2024
- }));
2025
- });
2136
+ function skipUntil(notifier) {
2137
+ return fa => {
2138
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2139
+ let taking = false;
2140
+ const skipSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
2141
+ next: () => {
2142
+ skipSubscriber?.unsubscribe();
2143
+ taking = true;
2144
+ },
2145
+ complete: tsplus_module_2.noop
2146
+ });
2147
+ from_1(notifier).provideEnvironment(environment).subscribe(skipSubscriber);
2148
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2149
+ next: value => taking && subscriber.next(value)
2150
+ }));
2151
+ })(fa);
2152
+ };
2026
2153
  }
2027
2154
  /**
2028
- * @tsplus fluent fncts.observable.Observable skipWhile
2155
+ * @tsplus pipeable fncts.observable.Observable skipWhile
2029
2156
  */
2030
2157
 
2031
2158
 
2032
- function skipWhile_(fa, predicate) {
2033
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2034
- let taking = false;
2035
- let index = 0;
2036
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2037
- next: value => (taking || (taking = !predicate(index++, value))) && subscriber.next(value)
2038
- }));
2039
- });
2159
+ function skipWhile(predicate) {
2160
+ return fa => {
2161
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2162
+ let taking = false;
2163
+ let index = 0;
2164
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2165
+ next: value => (taking || (taking = !predicate(index++, value))) && subscriber.next(value)
2166
+ }));
2167
+ })(fa);
2168
+ };
2040
2169
  }
2041
2170
  /**
2042
- * @tsplus fluent fncts.observable.Observable startWith
2171
+ * @tsplus pipeable fncts.observable.Observable startWith
2043
2172
  */
2044
2173
 
2045
2174
 
2046
- function startWith_(fa, ...values) {
2047
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2048
- // @ts-expect-error
2049
- concat_1(source, values).subscribe(subscriber);
2050
- });
2175
+ function startWith(...values) {
2176
+ return fa => {
2177
+ return tsplus_module_8.operate_((source, subscriber) => {
2178
+ // @ts-expect-error
2179
+ concat_1(values)(source).subscribe(subscriber);
2180
+ })(fa);
2181
+ };
2051
2182
  }
2052
2183
  /**
2053
- * @tsplus fluent fncts.observable.Observable subscribeOn
2184
+ * @tsplus pipeable fncts.observable.Observable subscribeOn
2054
2185
  */
2055
2186
 
2056
2187
 
2057
- function subscribeOn_(fa, scheduler, delay = 0) {
2058
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2059
- subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));
2060
- });
2188
+ function subscribeOn(scheduler, delay = 0) {
2189
+ return fa => {
2190
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2191
+ subscriber.add(scheduler.schedule(() => source.provideEnvironment(environment).subscribe(subscriber), delay));
2192
+ })(fa);
2193
+ };
2061
2194
  }
2062
2195
  /**
2063
2196
  * @tsplus getter fncts.observable.Observable switchAll
@@ -2065,168 +2198,188 @@ function subscribeOn_(fa, scheduler, delay = 0) {
2065
2198
 
2066
2199
 
2067
2200
  function switchAll(ffa) {
2068
- return switchMap_1(ffa, tsplus_module_13.identity);
2201
+ return switchMap_1(tsplus_module_13.identity)(ffa);
2069
2202
  }
2070
2203
  /**
2071
- * @tsplus fluent fncts.observable.Observable switchMapWithIndex
2204
+ * @tsplus pipeable fncts.observable.Observable switchMapWithIndex
2072
2205
  */
2073
2206
 
2074
2207
 
2075
- function switchMapWithIndex_1(fa, f) {
2076
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2077
- let innerSubscriber = null;
2078
- let index = 0;
2079
- let isComplete = false;
2208
+ function switchMapWithIndex_1(f) {
2209
+ return fa => {
2210
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2211
+ let innerSubscriber = null;
2212
+ let index = 0;
2213
+ let isComplete = false;
2080
2214
 
2081
- const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();
2215
+ const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();
2082
2216
 
2083
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2084
- next: value => {
2085
- innerSubscriber?.unsubscribe();
2086
- const outerIndex = index++;
2087
- from_1(f(outerIndex, value)).subscribe(innerSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
2088
- next: innerValue => subscriber.next(innerValue),
2089
- complete: () => {
2090
- innerSubscriber = null;
2091
- checkComplete();
2092
- }
2093
- }));
2094
- }
2095
- }, () => {
2096
- isComplete = true;
2097
- checkComplete();
2098
- }));
2099
- });
2217
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2218
+ next: value => {
2219
+ innerSubscriber?.unsubscribe();
2220
+ const outerIndex = index++;
2221
+ from_1(f(outerIndex, value)).provideEnvironment(environment).subscribe(innerSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
2222
+ next: innerValue => subscriber.next(innerValue),
2223
+ complete: () => {
2224
+ innerSubscriber = null;
2225
+ checkComplete();
2226
+ }
2227
+ }));
2228
+ }
2229
+ }, () => {
2230
+ isComplete = true;
2231
+ checkComplete();
2232
+ }));
2233
+ })(fa);
2234
+ };
2100
2235
  }
2101
2236
  /**
2102
- * @tsplus fluent fncts.observable.Observable switchMap
2237
+ * @tsplus pipeable fncts.observable.Observable switchMap
2103
2238
  */
2104
2239
 
2105
2240
 
2106
- function switchMap_1(fa, f) {
2107
- return switchMapWithIndex_1(fa, (_, a) => f(a));
2241
+ function switchMap_1(f) {
2242
+ return fa => {
2243
+ return switchMapWithIndex_1((_, a) => f(a))(fa);
2244
+ };
2108
2245
  }
2109
2246
  /**
2110
- * @tsplus fluent fncts.observable.Observable switchScanWithIndex
2247
+ * @tsplus pipeable fncts.observable.Observable switchScanWithIndex
2111
2248
  */
2112
2249
 
2113
2250
 
2114
- function switchScanWithIndex_1(fa, initial, f) {
2115
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2116
- let state = initial;
2117
- switchMapWithIndex_1(source, (index, value) => map_1(from_1(f(index, state, value)), b => (state = b, b))).subscribe(subscriber);
2118
- return () => {
2119
- state = null;
2120
- };
2121
- });
2251
+ function switchScanWithIndex_1(initial, f) {
2252
+ return fa => {
2253
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2254
+ let state = initial;
2255
+ switchMapWithIndex_1((index, value) => map_1(b => (state = b, b))(from_1(f(index, state, value))))(source).provideEnvironment(environment).subscribe(subscriber);
2256
+ return () => {
2257
+ state = null;
2258
+ };
2259
+ })(fa);
2260
+ };
2122
2261
  }
2123
2262
  /**
2124
- * @tsplus fluent fncts.observable.Observable switchScan
2263
+ * @tsplus pipeable fncts.observable.Observable switchScan
2125
2264
  */
2126
2265
 
2127
2266
 
2128
- function switchScan_(fa, initial, f) {
2129
- return switchScanWithIndex_1(fa, initial, (_, b, a) => f(b, a));
2267
+ function switchScan(initial, f) {
2268
+ return fa => {
2269
+ return switchScanWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
2270
+ };
2130
2271
  }
2131
2272
  /**
2132
- * @tsplus fluent fncts.observable.Observable take
2273
+ * @tsplus pipeable fncts.observable.Observable take
2133
2274
  */
2134
2275
 
2135
2276
 
2136
- function take_1(fa, count) {
2137
- return count <= 0 ? empty_1() : tsplus_module_8.operate_(fa, (source, sub) => {
2138
- let seen = 0;
2139
- source.subscribe(new tsplus_module_8.OperatorSubscriber(sub, {
2140
- next: value => {
2141
- if (++seen <= count) {
2142
- sub.next(value);
2277
+ function take_1(count) {
2278
+ return fa => {
2279
+ return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, sub, environment) => {
2280
+ let seen = 0;
2281
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(sub, {
2282
+ next: value => {
2283
+ if (++seen <= count) {
2284
+ sub.next(value);
2143
2285
 
2144
- if (count <= seen) {
2145
- sub.complete();
2286
+ if (count <= seen) {
2287
+ sub.complete();
2288
+ }
2146
2289
  }
2147
2290
  }
2148
- }
2149
- }));
2150
- });
2291
+ }));
2292
+ })(fa);
2293
+ };
2151
2294
  }
2152
2295
  /**
2153
- * @tsplus fluent fncts.observable.Observable takeLast
2296
+ * @tsplus pipeable fncts.observable.Observable takeLast
2154
2297
  */
2155
2298
 
2156
2299
 
2157
- function takeLast_(fa, count) {
2158
- return count <= 0 ? empty_1() : tsplus_module_8.operate_(fa, (source, subscriber) => {
2159
- let buffer = [];
2160
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2161
- next: value => {
2162
- buffer.push(value);
2163
- count < buffer.length && buffer.shift();
2164
- },
2165
- complete: () => {
2166
- for (const value of buffer) {
2167
- subscriber.next(value);
2168
- }
2300
+ function takeLast(count) {
2301
+ return fa => {
2302
+ return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
2303
+ let buffer = [];
2304
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2305
+ next: value => {
2306
+ buffer.push(value);
2307
+ count < buffer.length && buffer.shift();
2308
+ },
2309
+ complete: () => {
2310
+ for (const value of buffer) {
2311
+ subscriber.next(value);
2312
+ }
2169
2313
 
2170
- subscriber.complete();
2171
- }
2172
- }, () => {
2173
- buffer = null;
2174
- }));
2175
- });
2314
+ subscriber.complete();
2315
+ }
2316
+ }, () => {
2317
+ buffer = null;
2318
+ }));
2319
+ })(fa);
2320
+ };
2176
2321
  }
2177
2322
  /**
2178
- * @tsplus fluent fncts.observable.Observable takeUntil
2323
+ * @tsplus pipeable fncts.observable.Observable takeUntil
2179
2324
  */
2180
2325
 
2181
2326
 
2182
- function takeUntil_(fa, notifier) {
2183
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2184
- from_1(notifier).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2185
- next: () => subscriber.complete(),
2186
- complete: tsplus_module_2.noop
2187
- }));
2188
- !subscriber.closed && source.subscribe(subscriber);
2189
- });
2327
+ function takeUntil(notifier) {
2328
+ return fa => {
2329
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2330
+ from_1(notifier).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2331
+ next: () => subscriber.complete(),
2332
+ complete: tsplus_module_2.noop
2333
+ }));
2334
+ !subscriber.closed && source.provideEnvironment(environment).subscribe(subscriber);
2335
+ })(fa);
2336
+ };
2190
2337
  }
2191
2338
 
2192
- function takeWhileWithIndex_1(fa, predicate, inclusive) {
2193
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2194
- let index = 0;
2195
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2196
- next: value => {
2197
- const result = predicate(index++, value);
2198
- (result || inclusive) && subscriber.next(value);
2199
- !result && subscriber.complete();
2200
- }
2201
- }));
2202
- });
2339
+ function takeWhileWithIndex_1(predicate, inclusive) {
2340
+ return fa => {
2341
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2342
+ let index = 0;
2343
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2344
+ next: value => {
2345
+ const result = predicate(index++, value);
2346
+ (result || inclusive) && subscriber.next(value);
2347
+ !result && subscriber.complete();
2348
+ }
2349
+ }));
2350
+ })(fa);
2351
+ };
2203
2352
  }
2204
2353
 
2205
- function takeWhile_(fa, predicate, inclusive) {
2206
- return takeWhileWithIndex_1(fa, (_, a) => predicate(a), inclusive);
2354
+ function takeWhile(predicate, inclusive) {
2355
+ return fa => {
2356
+ return takeWhileWithIndex_1((_, a) => predicate(a), inclusive)(fa);
2357
+ };
2207
2358
  }
2208
2359
  /**
2209
- * @tsplus fluent fncts.observable.Observable tap
2360
+ * @tsplus pipeable fncts.observable.Observable tap
2210
2361
  */
2211
2362
 
2212
2363
 
2213
- function tap_(fa, observer) {
2214
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2215
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2216
- next: value => {
2217
- observer.next?.(value);
2218
- subscriber.next(value);
2219
- },
2220
- error: err => {
2221
- observer.error?.(err);
2222
- subscriber.error(err);
2223
- },
2224
- complete: () => {
2225
- observer.complete?.();
2226
- subscriber.complete();
2227
- }
2228
- }));
2229
- });
2364
+ function tap(observer) {
2365
+ return fa => {
2366
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2367
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2368
+ next: value => {
2369
+ observer.next?.(value);
2370
+ subscriber.next(value);
2371
+ },
2372
+ error: err => {
2373
+ observer.error?.(err);
2374
+ subscriber.error(err);
2375
+ },
2376
+ complete: () => {
2377
+ observer.complete?.();
2378
+ subscriber.complete();
2379
+ }
2380
+ }));
2381
+ })(fa);
2382
+ };
2230
2383
  }
2231
2384
 
2232
2385
  const defaultThrottleConfig = {
@@ -2234,71 +2387,75 @@ const defaultThrottleConfig = {
2234
2387
  trailing: false
2235
2388
  };
2236
2389
  /**
2237
- * @tsplus fluent fncts.observable.Observable throttle
2390
+ * @tsplus pipeable fncts.observable.Observable throttle
2238
2391
  */
2239
2392
 
2240
2393
  exports.defaultThrottleConfig = defaultThrottleConfig;
2241
2394
 
2242
- function throttle_1(fa, durationSelector, {
2395
+ function throttle_1(durationSelector, {
2243
2396
  leading,
2244
2397
  trailing
2245
2398
  } = defaultThrottleConfig) {
2246
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2247
- let sendValue = tsplus_module_17.nothing();
2248
- let throttled = null;
2249
- let isComplete = false;
2250
-
2251
- const endThrottling = () => {
2252
- throttled?.unsubscribe();
2253
- throttled = null;
2399
+ return fa => {
2400
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2401
+ let sendValue = tsplus_module_17.nothing();
2402
+ let throttled = null;
2403
+ let isComplete = false;
2404
+
2405
+ const endThrottling = () => {
2406
+ throttled?.unsubscribe();
2407
+ throttled = null;
2408
+
2409
+ if (trailing) {
2410
+ send();
2411
+ isComplete && subscriber.complete();
2412
+ }
2413
+ };
2254
2414
 
2255
- if (trailing) {
2256
- send();
2415
+ const cleanupThrottling = () => {
2416
+ throttled = null;
2257
2417
  isComplete && subscriber.complete();
2258
- }
2259
- };
2260
-
2261
- const cleanupThrottling = () => {
2262
- throttled = null;
2263
- isComplete && subscriber.complete();
2264
- };
2418
+ };
2265
2419
 
2266
- const startThrottling = value => throttled = from_1(durationSelector(value)).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2267
- next: endThrottling,
2268
- complete: cleanupThrottling
2269
- }));
2420
+ const startThrottling = value => throttled = from_1(durationSelector(value)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2421
+ next: endThrottling,
2422
+ complete: cleanupThrottling
2423
+ }));
2270
2424
 
2271
- const send = () => {
2272
- if (tsplus_module_18.isJust(sendValue)) {
2273
- const {
2274
- value
2275
- } = sendValue;
2276
- sendValue = tsplus_module_17.nothing();
2277
- subscriber.next(value);
2278
- !isComplete && startThrottling(value);
2279
- }
2280
- };
2425
+ const send = () => {
2426
+ if (tsplus_module_18.isJust(sendValue)) {
2427
+ const {
2428
+ value
2429
+ } = sendValue;
2430
+ sendValue = tsplus_module_17.nothing();
2431
+ subscriber.next(value);
2432
+ !isComplete && startThrottling(value);
2433
+ }
2434
+ };
2281
2435
 
2282
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2283
- next: value => {
2284
- sendValue = tsplus_module_17.just(value);
2285
- !(throttled && !throttled.closed) && (leading ? send() : startThrottling(value));
2286
- },
2287
- complete: () => {
2288
- isComplete = true;
2289
- !(trailing && tsplus_module_18.isJust(sendValue) && throttled && !throttled.closed) && subscriber.complete();
2290
- }
2291
- }));
2292
- });
2436
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2437
+ next: value => {
2438
+ sendValue = tsplus_module_17.just(value);
2439
+ !(throttled && !throttled.closed) && (leading ? send() : startThrottling(value));
2440
+ },
2441
+ complete: () => {
2442
+ isComplete = true;
2443
+ !(trailing && tsplus_module_18.isJust(sendValue) && throttled && !throttled.closed) && subscriber.complete();
2444
+ }
2445
+ }));
2446
+ })(fa);
2447
+ };
2293
2448
  }
2294
2449
  /**
2295
- * @tsplus fluent fncts.observable.Observable throttleTime
2450
+ * @tsplus pipeable fncts.observable.Observable throttleTime
2296
2451
  */
2297
2452
 
2298
2453
 
2299
- function throttleTime_(fa, duration, scheduler = tsplus_module_5.asyncScheduler, config = defaultThrottleConfig) {
2300
- const duration$ = timer_1(duration, scheduler);
2301
- return throttle_1(fa, () => duration$, config);
2454
+ function throttleTime(duration, scheduler = tsplus_module_5.asyncScheduler, config = defaultThrottleConfig) {
2455
+ return fa => {
2456
+ const duration$ = timer_1(duration, scheduler);
2457
+ return throttle_1(() => duration$, config)(fa);
2458
+ };
2302
2459
  }
2303
2460
 
2304
2461
  class TimeoutError extends Error {
@@ -2312,49 +2469,51 @@ class TimeoutError extends Error {
2312
2469
 
2313
2470
  exports.TimeoutError = TimeoutError;
2314
2471
 
2315
- function timeout_(fa, config) {
2316
- const {
2317
- first,
2318
- each,
2319
- with: _with = timeoutError,
2320
- scheduler = tsplus_module_5.asyncScheduler,
2321
- meta = null
2322
- } = config;
2323
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2324
- // eslint-disable-next-line prefer-const
2325
- let originalSourceSubscription;
2326
- let timerSubscription;
2327
- let lastValue = tsplus_module_17.nothing();
2328
- let seen = 0;
2329
-
2330
- const startTimer = delay => {
2331
- timerSubscription = (0, tsplus_module_7.caughtSchedule)(subscriber, scheduler, () => {
2332
- originalSourceSubscription.unsubscribe();
2333
- from_1(_with({
2334
- meta,
2335
- lastValue,
2336
- seen
2337
- })).subscribe(subscriber);
2338
- }, delay);
2339
- };
2340
-
2341
- originalSourceSubscription = source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2342
- next: value => {
2343
- timerSubscription?.unsubscribe();
2344
- seen++;
2345
- lastValue = tsplus_module_17.just(value);
2346
- subscriber.next(value);
2347
- each > 0 && startTimer(each);
2348
- }
2349
- }, () => {
2350
- if (!timerSubscription?.closed) {
2351
- timerSubscription?.unsubscribe();
2352
- }
2472
+ function timeout(config) {
2473
+ return fa => {
2474
+ const {
2475
+ first,
2476
+ each,
2477
+ with: _with = timeoutError,
2478
+ scheduler = tsplus_module_5.asyncScheduler,
2479
+ meta = null
2480
+ } = config;
2481
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2482
+ // eslint-disable-next-line prefer-const
2483
+ let originalSourceSubscription;
2484
+ let timerSubscription;
2485
+ let lastValue = tsplus_module_17.nothing();
2486
+ let seen = 0;
2487
+
2488
+ const startTimer = delay => {
2489
+ timerSubscription = (0, tsplus_module_7.caughtSchedule)(subscriber, scheduler, () => {
2490
+ originalSourceSubscription.unsubscribe();
2491
+ from_1(_with({
2492
+ meta,
2493
+ lastValue,
2494
+ seen
2495
+ })).provideEnvironment(environment).subscribe(subscriber);
2496
+ }, delay);
2497
+ };
2498
+
2499
+ originalSourceSubscription = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2500
+ next: value => {
2501
+ timerSubscription?.unsubscribe();
2502
+ seen++;
2503
+ lastValue = tsplus_module_17.just(value);
2504
+ subscriber.next(value);
2505
+ each > 0 && startTimer(each);
2506
+ }
2507
+ }, () => {
2508
+ if (!timerSubscription?.closed) {
2509
+ timerSubscription?.unsubscribe();
2510
+ }
2353
2511
 
2354
- lastValue = tsplus_module_17.nothing();
2355
- }));
2356
- startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
2357
- });
2512
+ lastValue = tsplus_module_17.nothing();
2513
+ }));
2514
+ startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
2515
+ })(fa);
2516
+ };
2358
2517
  }
2359
2518
 
2360
2519
  function timeoutError(info) {
@@ -2370,60 +2529,66 @@ function toArrayAccumulator(arr, value) {
2370
2529
 
2371
2530
 
2372
2531
  function toArray_1(fa) {
2373
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2374
- foldLeft_1(source, [], toArrayAccumulator).subscribe(subscriber);
2375
- });
2532
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2533
+ foldLeft_1([], toArrayAccumulator)(source).provideEnvironment(environment).subscribe(subscriber);
2534
+ })(fa);
2376
2535
  }
2377
2536
  /**
2378
- * @tsplus fluent fncts.observable.Observable unique
2537
+ * @tsplus pipeable fncts.observable.Observable unique
2379
2538
  */
2380
2539
 
2381
2540
 
2382
- function unique_(fa, toKey, flushes) {
2383
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2384
- let distinctKeys = tsplus_module_21.makeDefault();
2385
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2386
- next: value => {
2387
- const key = toKey ? toKey(value) : value;
2541
+ function unique(toKey, flushes) {
2542
+ return fa => {
2543
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2544
+ let distinctKeys = tsplus_module_21.makeDefault();
2545
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2546
+ next: value => {
2547
+ const key = toKey ? toKey(value) : value;
2388
2548
 
2389
- if (!tsplus_module_21.has_(distinctKeys, key)) {
2390
- tsplus_module_21.add_(distinctKeys, key);
2391
- subscriber.next(value);
2549
+ if (!tsplus_module_21.has(key)(distinctKeys)) {
2550
+ tsplus_module_21.add(key)(distinctKeys);
2551
+ subscriber.next(value);
2552
+ }
2392
2553
  }
2393
- }
2394
- }));
2395
- flushes?.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2396
- next: () => distinctKeys = tsplus_module_21.makeDefault(),
2397
- complete: tsplus_module_2.noop
2398
- }));
2399
- });
2554
+ }));
2555
+ flushes?.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2556
+ next: () => distinctKeys = tsplus_module_21.makeDefault(),
2557
+ complete: tsplus_module_2.noop
2558
+ }));
2559
+ })(fa);
2560
+ };
2400
2561
  }
2401
2562
 
2402
- function uniqueUntilChanged_1(fa, E, keySelector = tsplus_module_13.identity) {
2403
- const compare = "equals" in E ? E.equals : E;
2404
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2405
- let previousKey;
2406
- let first = true;
2407
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2408
- next: value => {
2409
- const currentKey = keySelector(value);
2563
+ function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
2564
+ return fa => {
2565
+ const compare = "equals" in E ? E.equals : E;
2566
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2567
+ let previousKey;
2568
+ let first = true;
2569
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2570
+ next: value => {
2571
+ const currentKey = keySelector(value);
2410
2572
 
2411
- if (first || !compare(previousKey, currentKey)) {
2412
- first = false;
2413
- previousKey = currentKey;
2414
- subscriber.next(value);
2573
+ if (first || !compare(previousKey, currentKey)) {
2574
+ first = false;
2575
+ previousKey = currentKey;
2576
+ subscriber.next(value);
2577
+ }
2415
2578
  }
2416
- }
2417
- }));
2418
- });
2579
+ }));
2580
+ })(fa);
2581
+ };
2419
2582
  }
2420
2583
 
2421
- function uniqueUntilKeyChanged_(fa, key, equals) {
2422
- const compare = "equals" in equals ? equals.equals : equals;
2423
- return uniqueUntilChanged_1(fa, (x, y) => compare(x[key], y[key]));
2584
+ function uniqueUntilKeyChanged(key, equals) {
2585
+ return fa => {
2586
+ const compare = "equals" in equals ? equals.equals : equals;
2587
+ return uniqueUntilChanged_1((x, y) => compare(x[key], y[key]))(fa);
2588
+ };
2424
2589
  }
2425
2590
 
2426
- function combineLatestInternal(subscriber, observables, scheduler, valueTransform = tsplus_module_13.identity) {
2591
+ function combineLatestInternal(subscriber, environment, observables, scheduler, valueTransform = tsplus_module_13.identity) {
2427
2592
  return maybeSchedule(subscriber, scheduler, () => {
2428
2593
  const {
2429
2594
  length
@@ -2434,9 +2599,9 @@ function combineLatestInternal(subscriber, observables, scheduler, valueTransfor
2434
2599
 
2435
2600
  for (let i = 0; i < length; i++) {
2436
2601
  maybeSchedule(subscriber, scheduler, () => {
2437
- const source = scheduler ? scheduled_1(observables[i], scheduler) : from_1(observables[i]);
2602
+ const source = scheduler ? scheduled_1(scheduler)(observables[i]) : from_1(observables[i]);
2438
2603
  let hasFirstValue = false;
2439
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2604
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2440
2605
  next: value => {
2441
2606
  values[i] = value;
2442
2607
 
@@ -2462,9 +2627,9 @@ function combineLatestInternal(subscriber, observables, scheduler, valueTransfor
2462
2627
 
2463
2628
  function findInternal(predicate, emit) {
2464
2629
  const findIndex = emit === "index";
2465
- return (source, subscriber) => {
2630
+ return (source, subscriber, environment) => {
2466
2631
  let index = 0;
2467
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2632
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2468
2633
  next: value => {
2469
2634
  const i = index++;
2470
2635
 
@@ -2482,7 +2647,7 @@ function findInternal(predicate, emit) {
2482
2647
  }
2483
2648
 
2484
2649
  function joinAllInternal(fa, joiner) {
2485
- return mergeMap_1(toArray_1(fa), joiner);
2650
+ return mergeMap_1(joiner)(toArray_1(fa));
2486
2651
  }
2487
2652
 
2488
2653
  function maybeSchedule(subscription, scheduler, execute) {
@@ -2493,7 +2658,7 @@ function maybeSchedule(subscription, scheduler, execute) {
2493
2658
  }
2494
2659
  }
2495
2660
 
2496
- function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
2661
+ function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
2497
2662
  const buffer = [];
2498
2663
  let active = 0;
2499
2664
  let index = 0;
@@ -2511,7 +2676,7 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
2511
2676
  expand && subscriber.next(a);
2512
2677
  active++;
2513
2678
  let innerComplete = false;
2514
- from_1(f(index++, a)).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2679
+ from_1(f(index++, a)).provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2515
2680
  next: b => {
2516
2681
  onBeforeNext?.(b);
2517
2682
 
@@ -2542,7 +2707,7 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
2542
2707
  }));
2543
2708
  };
2544
2709
 
2545
- source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2710
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2546
2711
  next: outerNext,
2547
2712
  complete: () => {
2548
2713
  isComplete = true;
@@ -2555,11 +2720,11 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
2555
2720
  }
2556
2721
 
2557
2722
  function scanInternal(f, initial, hasInitial, emitOnNext, emitBeforeComplete) {
2558
- return (source, subscriber) => {
2723
+ return (source, subscriber, environment) => {
2559
2724
  let hasState = hasInitial;
2560
2725
  let state = initial;
2561
2726
  let index = 0;
2562
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2727
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2563
2728
  next: value => {
2564
2729
  const i = index++;
2565
2730
  state = hasState ? f(i, state, value) : (hasState = true, value);