@fncts/observable 0.0.9 → 0.0.11

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 (221) 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 +189 -195
  17. package/Observable/definition.d.ts +8 -6
  18. package/ObservableRef/api.d.ts +63 -0
  19. package/ObservableRef/atomic.d.ts +32 -0
  20. package/ObservableRef/definition.d.ts +52 -0
  21. package/Operator.d.ts +2 -2
  22. package/_cjs/Action.cjs +0 -7
  23. package/_cjs/Action.cjs.map +1 -1
  24. package/_cjs/AnimationFrameAction.cjs +0 -12
  25. package/_cjs/AnimationFrameAction.cjs.map +1 -1
  26. package/_cjs/AnimationFrameScheduler.cjs +0 -12
  27. package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
  28. package/_cjs/AsyncAction.cjs +0 -25
  29. package/_cjs/AsyncAction.cjs.map +1 -1
  30. package/_cjs/AsyncScheduler.cjs +2 -16
  31. package/_cjs/AsyncScheduler.cjs.map +1 -1
  32. package/_cjs/BehaviorSubject.cjs +1 -13
  33. package/_cjs/BehaviorSubject.cjs.map +1 -1
  34. package/_cjs/Notification.cjs +21 -40
  35. package/_cjs/Notification.cjs.map +1 -1
  36. package/_cjs/Observable/api/connect.cjs +12 -17
  37. package/_cjs/Observable/api/connect.cjs.map +1 -1
  38. package/_cjs/Observable/api/connectable.cjs +6 -18
  39. package/_cjs/Observable/api/connectable.cjs.map +1 -1
  40. package/_cjs/Observable/api/fromCallback.cjs +0 -15
  41. package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
  42. package/_cjs/Observable/api/fromEvent.cjs +3 -5
  43. package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
  44. package/_cjs/Observable/api/index.cjs +0 -28
  45. package/_cjs/Observable/api/index.cjs.map +1 -1
  46. package/_cjs/Observable/api/race.cjs +2 -12
  47. package/_cjs/Observable/api/race.cjs.map +1 -1
  48. package/_cjs/Observable/api/raceWith.cjs +8 -11
  49. package/_cjs/Observable/api/raceWith.cjs.map +1 -1
  50. package/_cjs/Observable/api/repeatWhen.cjs +44 -55
  51. package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
  52. package/_cjs/Observable/api/retryWhen.cjs +29 -45
  53. package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
  54. package/_cjs/Observable/api/share.cjs +61 -77
  55. package/_cjs/Observable/api/share.cjs.map +1 -1
  56. package/_cjs/Observable/api/window.cjs +33 -39
  57. package/_cjs/Observable/api/window.cjs.map +1 -1
  58. package/_cjs/Observable/api/windowCount.cjs +40 -48
  59. package/_cjs/Observable/api/windowCount.cjs.map +1 -1
  60. package/_cjs/Observable/api/windowTime.cjs +60 -73
  61. package/_cjs/Observable/api/windowTime.cjs.map +1 -1
  62. package/_cjs/Observable/api/windowToggle.cjs +55 -71
  63. package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
  64. package/_cjs/Observable/api/windowWhen.cjs +42 -52
  65. package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
  66. package/_cjs/Observable/api.cjs +1260 -1485
  67. package/_cjs/Observable/api.cjs.map +1 -1
  68. package/_cjs/Observable/definition.cjs +9 -37
  69. package/_cjs/Observable/definition.cjs.map +1 -1
  70. package/_cjs/Observable/dom/animationFrames.cjs +0 -12
  71. package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
  72. package/_cjs/Observable.cjs +0 -38
  73. package/_cjs/Observable.cjs.map +1 -1
  74. package/_cjs/ObservableRef/api.cjs +160 -0
  75. package/_cjs/ObservableRef/api.cjs.map +1 -0
  76. package/_cjs/ObservableRef/atomic.cjs +93 -0
  77. package/_cjs/ObservableRef/atomic.cjs.map +1 -0
  78. package/_cjs/ObservableRef/definition.cjs +24 -0
  79. package/_cjs/ObservableRef/definition.cjs.map +1 -0
  80. package/_cjs/Operator.cjs +11 -21
  81. package/_cjs/Operator.cjs.map +1 -1
  82. package/_cjs/Scheduler.cjs +0 -18
  83. package/_cjs/Scheduler.cjs.map +1 -1
  84. package/_cjs/Subject.cjs +3 -50
  85. package/_cjs/Subject.cjs.map +1 -1
  86. package/_cjs/Subscriber.cjs +0 -32
  87. package/_cjs/Subscriber.cjs.map +1 -1
  88. package/_cjs/Subscription.cjs +0 -37
  89. package/_cjs/Subscription.cjs.map +1 -1
  90. package/_cjs/index.cjs +0 -28
  91. package/_cjs/internal/animationFrameProvider.cjs +0 -9
  92. package/_cjs/internal/animationFrameProvider.cjs.map +1 -1
  93. package/_cjs/internal/args.cjs +0 -6
  94. package/_cjs/internal/args.cjs.map +1 -1
  95. package/_cjs/internal/intervalProvider.cjs +0 -2
  96. package/_cjs/internal/intervalProvider.cjs.map +1 -1
  97. package/_cjs/internal/performanceTimestampProvider.cjs +0 -1
  98. package/_cjs/internal/performanceTimestampProvider.cjs.map +1 -1
  99. package/_cjs/internal/timeoutProvider.cjs +0 -2
  100. package/_cjs/internal/timeoutProvider.cjs.map +1 -1
  101. package/_cjs/internal/timestampProvider.cjs +0 -1
  102. package/_cjs/internal/timestampProvider.cjs.map +1 -1
  103. package/_cjs/internal/util.cjs +2 -21
  104. package/_cjs/internal/util.cjs.map +1 -1
  105. package/_mjs/Action.mjs +0 -3
  106. package/_mjs/Action.mjs.map +1 -1
  107. package/_mjs/AnimationFrameAction.mjs +0 -6
  108. package/_mjs/AnimationFrameAction.mjs.map +1 -1
  109. package/_mjs/AnimationFrameScheduler.mjs +0 -7
  110. package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
  111. package/_mjs/AsyncAction.mjs +0 -17
  112. package/_mjs/AsyncAction.mjs.map +1 -1
  113. package/_mjs/AsyncScheduler.mjs +2 -10
  114. package/_mjs/AsyncScheduler.mjs.map +1 -1
  115. package/_mjs/BehaviorSubject.mjs +1 -8
  116. package/_mjs/BehaviorSubject.mjs.map +1 -1
  117. package/_mjs/Notification.mjs +18 -26
  118. package/_mjs/Notification.mjs.map +1 -1
  119. package/_mjs/Observable/api/connect.mjs +12 -11
  120. package/_mjs/Observable/api/connect.mjs.map +1 -1
  121. package/_mjs/Observable/api/connectable.mjs +6 -9
  122. package/_mjs/Observable/api/connectable.mjs.map +1 -1
  123. package/_mjs/Observable/api/fromCallback.mjs +0 -10
  124. package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
  125. package/_mjs/Observable/api/fromEvent.mjs +3 -1
  126. package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
  127. package/_mjs/Observable/api/index.mjs.map +1 -1
  128. package/_mjs/Observable/api/race.mjs +2 -6
  129. package/_mjs/Observable/api/race.mjs.map +1 -1
  130. package/_mjs/Observable/api/raceWith.mjs +7 -6
  131. package/_mjs/Observable/api/raceWith.mjs.map +1 -1
  132. package/_mjs/Observable/api/repeatWhen.mjs +44 -48
  133. package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
  134. package/_mjs/Observable/api/retryWhen.mjs +29 -37
  135. package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
  136. package/_mjs/Observable/api/share.mjs +60 -70
  137. package/_mjs/Observable/api/share.mjs.map +1 -1
  138. package/_mjs/Observable/api/window.mjs +32 -33
  139. package/_mjs/Observable/api/window.mjs.map +1 -1
  140. package/_mjs/Observable/api/windowCount.mjs +39 -43
  141. package/_mjs/Observable/api/windowCount.mjs.map +1 -1
  142. package/_mjs/Observable/api/windowTime.mjs +59 -63
  143. package/_mjs/Observable/api/windowTime.mjs.map +1 -1
  144. package/_mjs/Observable/api/windowToggle.mjs +54 -62
  145. package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
  146. package/_mjs/Observable/api/windowWhen.mjs +41 -45
  147. package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
  148. package/_mjs/Observable/api.mjs +1186 -1311
  149. package/_mjs/Observable/api.mjs.map +1 -1
  150. package/_mjs/Observable/definition.mjs +9 -24
  151. package/_mjs/Observable/definition.mjs.map +1 -1
  152. package/_mjs/Observable/dom/animationFrames.mjs +0 -5
  153. package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
  154. package/_mjs/Observable.mjs +4 -4
  155. package/_mjs/Observable.mjs.map +1 -1
  156. package/_mjs/ObservableRef/api.mjs +141 -0
  157. package/_mjs/ObservableRef/api.mjs.map +1 -0
  158. package/_mjs/ObservableRef/atomic.mjs +82 -0
  159. package/_mjs/ObservableRef/atomic.mjs.map +1 -0
  160. package/_mjs/ObservableRef/definition.mjs +16 -0
  161. package/_mjs/ObservableRef/definition.mjs.map +1 -0
  162. package/_mjs/Operator.mjs +11 -12
  163. package/_mjs/Operator.mjs.map +1 -1
  164. package/_mjs/Scheduler.mjs +0 -9
  165. package/_mjs/Scheduler.mjs.map +1 -1
  166. package/_mjs/Subject.mjs +3 -37
  167. package/_mjs/Subject.mjs.map +1 -1
  168. package/_mjs/Subscriber.mjs +0 -20
  169. package/_mjs/Subscriber.mjs.map +1 -1
  170. package/_mjs/Subscription.mjs +0 -26
  171. package/_mjs/Subscription.mjs.map +1 -1
  172. package/_mjs/index.mjs.map +1 -1
  173. package/_mjs/internal/animationFrameProvider.mjs +0 -5
  174. package/_mjs/internal/animationFrameProvider.mjs.map +1 -1
  175. package/_mjs/internal/args.mjs +0 -2
  176. package/_mjs/internal/args.mjs.map +1 -1
  177. package/_mjs/internal/intervalProvider.mjs +0 -2
  178. package/_mjs/internal/intervalProvider.mjs.map +1 -1
  179. package/_mjs/internal/performanceTimestampProvider.mjs +0 -1
  180. package/_mjs/internal/performanceTimestampProvider.mjs.map +1 -1
  181. package/_mjs/internal/timeoutProvider.mjs +0 -2
  182. package/_mjs/internal/timeoutProvider.mjs.map +1 -1
  183. package/_mjs/internal/timestampProvider.mjs +0 -1
  184. package/_mjs/internal/timestampProvider.mjs.map +1 -1
  185. package/_mjs/internal/util.mjs +2 -7
  186. package/_mjs/internal/util.mjs.map +1 -1
  187. package/_src/Action.ts +0 -1
  188. package/_src/AnimationFrameAction.ts +0 -2
  189. package/_src/AnimationFrameScheduler.ts +2 -7
  190. package/_src/BehaviorSubject.ts +3 -3
  191. package/_src/Notification.ts +21 -23
  192. package/_src/Observable/api/connect.ts +12 -9
  193. package/_src/Observable/api/connectable.ts +6 -7
  194. package/_src/Observable/api/fromCallback.ts +0 -1
  195. package/_src/Observable/api/fromEvent.ts +3 -0
  196. package/_src/Observable/api/race.ts +15 -13
  197. package/_src/Observable/api/raceWith.ts +15 -14
  198. package/_src/Observable/api/repeatWhen.ts +51 -56
  199. package/_src/Observable/api/retryWhen.ts +38 -43
  200. package/_src/Observable/api/share.ts +63 -71
  201. package/_src/Observable/api/window.ts +36 -41
  202. package/_src/Observable/api/windowCount.ts +44 -51
  203. package/_src/Observable/api/windowTime.ts +69 -81
  204. package/_src/Observable/api/windowToggle.ts +69 -73
  205. package/_src/Observable/api/windowWhen.ts +49 -55
  206. package/_src/Observable/api.ts +1493 -1498
  207. package/_src/Observable/definition.ts +24 -18
  208. package/_src/Observable/dom/animationFrames.ts +16 -6
  209. package/_src/Observable/instances.ts +0 -23
  210. package/_src/Observable.ts +0 -2
  211. package/_src/ObservableRef/api.ts +169 -0
  212. package/_src/ObservableRef/atomic.ts +85 -0
  213. package/_src/ObservableRef/definition.ts +57 -0
  214. package/_src/Operator.ts +20 -15
  215. package/_src/Scheduler.ts +0 -6
  216. package/_src/Subject.ts +1 -1
  217. package/_src/Subscriber.ts +3 -2
  218. package/_src/global.ts +5 -1
  219. package/_src/internal/util.ts +8 -4
  220. package/global.d.ts +5 -1
  221. 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,82 +94,58 @@ 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;
126
-
122
+ exports.zipWith = exports.zipLatest = void 0;
123
+ exports.zipWithLatest = zipWithLatest;
127
124
  var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
128
-
129
125
  var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/internal/util"));
130
-
131
126
  var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/util/predicates"));
132
-
133
127
  var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO"));
134
-
135
128
  var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/AsyncScheduler"));
136
-
137
129
  var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/Subscription"));
138
-
139
130
  var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/Scheduler"));
140
-
141
131
  var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/Operator"));
142
-
143
132
  var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/environment"));
144
-
145
133
  var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/runtime"));
146
-
147
134
  var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/api"));
148
-
149
135
  var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Fiber/api/interrupt"));
150
-
151
136
  var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/function/api"));
152
-
153
137
  var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/destructors"));
154
-
155
138
  var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
156
-
157
139
  var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Environment/api"));
158
-
159
140
  var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
160
-
161
141
  var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/definition"));
162
-
163
142
  var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
164
-
165
143
  var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/observable/Notification"));
166
-
167
144
  var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/HashSet/api"));
168
-
169
145
  var _args = /*#__PURE__*/require("@fncts/observable/internal/args");
170
-
171
146
  var _definition2 = /*#__PURE__*/require("@fncts/observable/Observable/definition");
172
-
173
147
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
174
-
175
148
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
176
-
177
149
  const fileName_1 = "(@fncts/observable) src/Observable/api.ts";
178
150
  const defer = defer_1;
179
151
  exports.defer = defer;
@@ -205,42 +177,42 @@ const mapWithIndex = mapWithIndex_1;
205
177
  exports.mapWithIndex = mapWithIndex;
206
178
  const map_ = map_1;
207
179
  exports.map_ = map_;
208
- const as_ = as_1;
209
- exports.as_ = as_;
210
- const filterWithIndex_ = filterWithIndex_1;
211
- exports.filterWithIndex_ = filterWithIndex_;
180
+ const as = as_1;
181
+ exports.as = as;
182
+ const filterWithIndex = filterWithIndex_1;
183
+ exports.filterWithIndex = filterWithIndex;
212
184
  const filterMapWithIndex = filterMapWithIndex_1;
213
185
  exports.filterMapWithIndex = filterMapWithIndex;
214
186
  const partitionWithIndex = partitionWithIndex_1;
215
187
  exports.partitionWithIndex = partitionWithIndex;
216
- const partitionMapWithIndex_ = partitionMapWithIndex_1;
217
- exports.partitionMapWithIndex_ = partitionMapWithIndex_;
188
+ const partitionMapWithIndex = partitionMapWithIndex_1;
189
+ exports.partitionMapWithIndex = partitionMapWithIndex;
218
190
  const mergeMapWithIndex = mergeMapWithIndex_1;
219
191
  exports.mergeMapWithIndex = mergeMapWithIndex;
220
- const mergeMap_ = mergeMap_1;
221
- exports.mergeMap_ = mergeMap_;
192
+ const mergeMap = mergeMap_1;
193
+ exports.mergeMap = mergeMap;
222
194
  const contramapEnvironment = contramapEnvironment_1;
223
195
  exports.contramapEnvironment = contramapEnvironment;
224
196
  const foldLeftWithIndex = foldLeftWithIndex_1;
225
197
  exports.foldLeftWithIndex = foldLeftWithIndex;
226
198
  const foldLeft = foldLeft_1;
227
199
  exports.foldLeft = foldLeft;
228
- const audit_ = audit_1;
229
- exports.audit_ = audit_;
200
+ const audit = audit_1;
201
+ exports.audit = audit;
230
202
  const catchAllCause = catchAllCause_1;
231
203
  exports.catchAllCause = catchAllCause;
232
204
  const concatAll = concatAll_1;
233
205
  exports.concatAll = concatAll;
234
- const concat_ = concat_1;
235
- exports.concat_ = concat_;
206
+ const concat = concat_1;
207
+ exports.concat = concat;
236
208
  const countWithIndex = countWithIndex_1;
237
209
  exports.countWithIndex = countWithIndex;
238
- const combineLatest_ = combineLatest_1;
239
- exports.combineLatest_ = combineLatest_;
210
+ const zipLatest = zipLatest_1;
211
+ exports.zipLatest = zipLatest;
240
212
  const delayWithIndex = delayWithIndex_1;
241
213
  exports.delayWithIndex = delayWithIndex;
242
- const delayWith_ = delayWith_1;
243
- exports.delayWith_ = delayWith_;
214
+ const delayWith = delayWith_1;
215
+ exports.delayWith = delayWith;
244
216
  const exhaustMapWithIndex = exhaustMapWithIndex_1;
245
217
  exports.exhaustMapWithIndex = exhaustMapWithIndex;
246
218
  const expandWithIndex = expandWithIndex_1;
@@ -249,35 +221,34 @@ const findWithIndex = findWithIndex_1;
249
221
  exports.findWithIndex = findWithIndex;
250
222
  const findIndexWithIndex = findIndexWithIndex_1;
251
223
  exports.findIndexWithIndex = findIndexWithIndex;
252
- const mergeAll_ = mergeAll_1;
253
- exports.mergeAll_ = mergeAll_;
224
+ const mergeAll = mergeAll_1;
225
+ exports.mergeAll = mergeAll;
254
226
  const mergeScanWithIndex = mergeScanWithIndex_1;
255
227
  exports.mergeScanWithIndex = mergeScanWithIndex;
256
- const onEmpty_ = onEmpty_1;
257
- exports.onEmpty_ = onEmpty_;
258
- const sample_ = sample_1;
259
- exports.sample_ = sample_;
228
+ const onEmpty = onEmpty_1;
229
+ exports.onEmpty = onEmpty;
230
+ const sample = sample_1;
231
+ exports.sample = sample;
260
232
  const scanLeftWithIndex = scanLeftWithIndex_1;
261
233
  exports.scanLeftWithIndex = scanLeftWithIndex;
262
234
  const serviceWithObservable = serviceWithObservable_1;
263
235
  exports.serviceWithObservable = serviceWithObservable;
264
236
  const switchMapWithIndex = switchMapWithIndex_1;
265
237
  exports.switchMapWithIndex = switchMapWithIndex;
266
- const switchMap_ = switchMap_1;
267
- exports.switchMap_ = switchMap_;
238
+ const switchMap = switchMap_1;
239
+ exports.switchMap = switchMap;
268
240
  const switchScanWithIndex = switchScanWithIndex_1;
269
241
  exports.switchScanWithIndex = switchScanWithIndex;
270
- const take_ = take_1;
271
- exports.take_ = take_;
242
+ const take = take_1;
243
+ exports.take = take;
272
244
  const takeWhileWithIndex = takeWhileWithIndex_1;
273
245
  exports.takeWhileWithIndex = takeWhileWithIndex;
274
- const throttle_ = throttle_1;
275
- exports.throttle_ = throttle_;
246
+ const throttle = throttle_1;
247
+ exports.throttle = throttle;
276
248
  const toArray = toArray_1;
277
249
  exports.toArray = toArray;
278
- const uniqueUntilChanged_ = uniqueUntilChanged_1;
279
- exports.uniqueUntilChanged_ = uniqueUntilChanged_;
280
-
250
+ const uniqueUntilChanged = uniqueUntilChanged_1;
251
+ exports.uniqueUntilChanged = uniqueUntilChanged;
281
252
  /**
282
253
  * @tsplus static fncts.observable.ObservableOps halt
283
254
  */
@@ -287,116 +258,89 @@ function halt(defect) {
287
258
  /**
288
259
  * @tsplus static fncts.observable.ObservableOps defer
289
260
  */
290
-
291
-
292
261
  function defer_1(observable) {
293
- return new _definition2.Observable(s => {
294
- from_1(observable()).subscribe(s);
262
+ return new _definition2.Observable((s, environment) => {
263
+ from_1(observable()).provideEnvironment(environment).subscribe(s);
295
264
  });
296
265
  }
297
266
  /**
298
267
  * @tsplus static fncts.observable.ObservableOps empty
299
268
  */
300
-
301
-
302
269
  function empty_1() {
303
270
  return _definition2.EMPTY;
304
271
  }
305
272
  /**
306
273
  * @tsplus static fncts.observable.ObservableOps environmentWithObservable
307
274
  */
308
-
309
-
310
275
  function environmentWithObservable_1(f) {
311
276
  return new _definition2.EnvironmentWith(f);
312
277
  }
313
278
  /**
314
279
  * @tsplus static fncts.observable.ObservableOps failCause
315
280
  */
316
-
317
-
318
281
  function failCause(cause) {
319
282
  return new _definition2.Observable(s => s.error(cause));
320
283
  }
321
284
  /**
322
285
  * @tsplus static fncts.observable.ObservableOps fail
323
286
  */
324
-
325
-
326
287
  function fail_1(e) {
327
288
  return new _definition2.Observable(s => s.error(tsplus_module_1.fail(e)));
328
289
  }
329
290
  /**
330
291
  * @tsplus static fncts.observable.ObservableOps from
331
292
  */
332
-
333
-
334
293
  function from_1(input) {
335
294
  if (input instanceof _definition2.Observable) {
336
295
  return input;
337
296
  }
338
-
339
297
  if (tsplus_module_2.isArrayLike(input)) {
340
298
  return fromArrayLike(input);
341
299
  }
342
-
343
300
  if (tsplus_module_2.isPromiseLike(input)) {
344
301
  return fromPromise(input);
345
302
  }
346
-
347
303
  if (tsplus_module_2.isAsyncIterable(input)) {
348
304
  return fromAsyncIterable(input);
349
305
  }
350
-
351
306
  if (tsplus_module_3.isIterable(input)) {
352
307
  return fromIterable(input);
353
308
  }
354
-
355
309
  if (tsplus_module_2.isReadableStream(input)) {
356
310
  return fromReadableStreamLike(input);
357
311
  }
358
-
359
312
  if (tsplus_module_4.isIO(input)) {
360
313
  return fromIO_1(input);
361
314
  }
362
-
363
315
  if ("subscribe" in input) {
364
316
  return fromSubscribable_1(input);
365
317
  }
366
-
367
318
  throw new TypeError("Invalid Observable input");
368
319
  }
369
-
370
320
  function fromArrayLike(input) {
371
321
  return new _definition2.Observable(s => {
372
322
  for (let i = 0; i < input.length && !s.closed; i++) {
373
323
  s.next(input[i]);
374
324
  }
375
-
376
325
  s.complete();
377
326
  });
378
327
  }
379
-
380
328
  function fromAsyncIterable(asyncIterable) {
381
329
  return new _definition2.Observable(s => {
382
330
  process(asyncIterable, s).catch(err => s.error(tsplus_module_1.halt(err)));
383
331
  });
384
332
  }
385
-
386
333
  function fromIterable(iterable) {
387
334
  return new _definition2.Observable(s => {
388
335
  for (const value of iterable) {
389
336
  s.next(value);
390
-
391
337
  if (s.closed) {
392
338
  return;
393
339
  }
394
340
  }
395
-
396
341
  s.complete();
397
342
  });
398
343
  }
399
-
400
344
  function fromPromise(promise) {
401
345
  return new _definition2.Observable(s => {
402
346
  promise.then(value => {
@@ -407,19 +351,15 @@ function fromPromise(promise) {
407
351
  }, err => s.error(tsplus_module_1.halt(err))).then(null, tsplus_module_2.reportUnhandledError);
408
352
  });
409
353
  }
410
-
411
354
  function fromReadableStreamLike(readableStream) {
412
355
  return fromAsyncIterable((0, tsplus_module_2.readableStreamToAsyncGenerator)(readableStream));
413
356
  }
414
357
  /**
415
358
  * @tsplus static fncts.observable.ObservableOps fromSubscribable
416
359
  */
417
-
418
-
419
360
  function fromSubscribable_1(subscribable) {
420
361
  return new _definition2.Observable(subscriber => subscribable.subscribe(subscriber));
421
362
  }
422
-
423
363
  function fromInterop(subscribable) {
424
364
  return new _definition2.Observable(subscriber => subscribable.subscribe({
425
365
  next: value => subscriber.next(value),
@@ -427,11 +367,9 @@ function fromInterop(subscribable) {
427
367
  complete: () => subscriber.complete()
428
368
  }));
429
369
  }
430
-
431
370
  function _if(condition, onTrue, onFalse) {
432
371
  return defer_1(() => condition() ? onTrue : onFalse);
433
372
  }
434
-
435
373
  function iterate(options) {
436
374
  const {
437
375
  initialState,
@@ -439,58 +377,45 @@ function iterate(options) {
439
377
  iterate,
440
378
  scheduler
441
379
  } = options;
442
-
443
380
  function* gen() {
444
381
  for (let state = initialState; !cont || cont(state); state = iterate(state)) {
445
382
  yield state;
446
383
  }
447
384
  }
448
-
449
385
  return defer_1(scheduler ? () => scheduleIterable(gen(), scheduler) : gen);
450
386
  }
451
-
452
387
  async function process(asyncIterable, subscriber) {
453
388
  for await (const value of asyncIterable) {
454
389
  subscriber.next(value);
455
-
456
390
  if (subscriber.closed) {
457
391
  return;
458
392
  }
459
393
  }
460
-
461
394
  subscriber.complete();
462
395
  }
463
396
  /**
464
397
  * @tsplus static fncts.obervable.ObservableOps interval
465
398
  */
466
-
467
-
468
399
  function interval_1(period = 0, scheduler = tsplus_module_5.asyncScheduler) {
469
400
  if (period < 0) {
470
401
  // eslint-disable-next-line no-param-reassign
471
402
  period = 0;
472
403
  }
473
-
474
404
  return timer_1(period, period, scheduler);
475
405
  }
476
-
477
406
  function merge(...sources) {
478
407
  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);
408
+ return !sources.length ? empty_1() : sources.length === 1 ? from_1(sources[0]) : mergeAll_1(concurrency)(fromArrayLike(sources));
480
409
  }
481
410
  /**
482
411
  * @tsplus static fncts.observable.ObservableOps of
483
412
  */
484
-
485
-
486
413
  function of_1(...items) {
487
414
  return fromArrayLike(items);
488
415
  }
489
416
  /**
490
417
  * @tsplus static fncts.observable.ObservableOps single
491
418
  */
492
-
493
-
494
419
  function single_1(a) {
495
420
  return new _definition2.Observable(s => {
496
421
  s.next(a);
@@ -498,35 +423,29 @@ function single_1(a) {
498
423
  });
499
424
  }
500
425
  /**
501
- * @tsplus fluent fncts.observable.Observable scheduled
426
+ * @tsplus pipeable fncts.observable.Observable scheduled
502
427
  * @tsplus static fncts.observable.ObservableOps scheduled
503
428
  */
504
-
505
-
506
- function scheduled_1(input, scheduler) {
507
- if (tsplus_module_2.isArrayLike(input)) {
508
- return scheduleArray(input, scheduler);
509
- }
510
-
511
- if (tsplus_module_2.isPromiseLike(input)) {
512
- return schedulePromise(input, scheduler);
513
- }
514
-
515
- if (tsplus_module_3.isIterable(input)) {
516
- return scheduleIterable(input, scheduler);
517
- }
518
-
519
- if (tsplus_module_2.isAsyncIterable(input)) {
520
- return scheduleAsyncIterable(input, scheduler);
521
- }
522
-
523
- if (tsplus_module_2.isReadableStream(input)) {
524
- return scheduleReadableStreamLike(input, scheduler);
525
- }
526
-
527
- return scheduleObservable(from_1(input), scheduler);
429
+ function scheduled_1(scheduler) {
430
+ return input => {
431
+ if (tsplus_module_2.isArrayLike(input)) {
432
+ return scheduleArray(input, scheduler);
433
+ }
434
+ if (tsplus_module_2.isPromiseLike(input)) {
435
+ return schedulePromise(input, scheduler);
436
+ }
437
+ if (tsplus_module_3.isIterable(input)) {
438
+ return scheduleIterable(input, scheduler);
439
+ }
440
+ if (tsplus_module_2.isAsyncIterable(input)) {
441
+ return scheduleAsyncIterable(input, scheduler);
442
+ }
443
+ if (tsplus_module_2.isReadableStream(input)) {
444
+ return scheduleReadableStreamLike(input, scheduler);
445
+ }
446
+ return scheduleObservable(from_1(input), scheduler);
447
+ };
528
448
  }
529
-
530
449
  function scheduleArray(input, scheduler) {
531
450
  return new _definition2.Observable(s => {
532
451
  let i = 0;
@@ -535,7 +454,6 @@ function scheduleArray(input, scheduler) {
535
454
  s.complete();
536
455
  } else {
537
456
  s.next(input[i++]);
538
-
539
457
  if (!s.closed) {
540
458
  this.schedule();
541
459
  }
@@ -543,7 +461,6 @@ function scheduleArray(input, scheduler) {
543
461
  });
544
462
  });
545
463
  }
546
-
547
464
  function scheduleAsyncIterable(input, scheduler) {
548
465
  return new _definition2.Observable(subscriber => {
549
466
  const sub = new tsplus_module_6.Subscription();
@@ -563,7 +480,6 @@ function scheduleAsyncIterable(input, scheduler) {
563
480
  return sub;
564
481
  });
565
482
  }
566
-
567
483
  function scheduleIterable(input, scheduler) {
568
484
  return new _definition2.Observable(s => {
569
485
  let iterator;
@@ -574,7 +490,6 @@ function scheduleIterable(input, scheduler) {
574
490
  value,
575
491
  done
576
492
  } = iterator.next();
577
-
578
493
  if (done) {
579
494
  s.complete();
580
495
  } else {
@@ -586,12 +501,11 @@ function scheduleIterable(input, scheduler) {
586
501
  return () => tsplus_module_3.isFunction(iterator?.return) && iterator.return();
587
502
  });
588
503
  }
589
-
590
504
  function scheduleObservable(input, scheduler) {
591
- return new _definition2.Observable(subscriber => {
505
+ return new _definition2.Observable((subscriber, environment) => {
592
506
  const sub = new tsplus_module_6.Subscription();
593
507
  sub.add(scheduler.schedule(() => {
594
- sub.add(input.subscribe({
508
+ sub.add(input.provideEnvironment(environment).subscribe({
595
509
  next: value => {
596
510
  sub.add(scheduler.schedule(() => subscriber.next(value)));
597
511
  },
@@ -605,7 +519,6 @@ function scheduleObservable(input, scheduler) {
605
519
  }));
606
520
  });
607
521
  }
608
-
609
522
  function schedulePromise(input, scheduler) {
610
523
  return new _definition2.Observable(subscriber => {
611
524
  return scheduler.schedule(() => {
@@ -620,14 +533,11 @@ function schedulePromise(input, scheduler) {
620
533
  });
621
534
  });
622
535
  }
623
-
624
536
  function scheduleReadableStreamLike(input, scheduler) {
625
537
  return scheduleAsyncIterable((0, tsplus_module_2.readableStreamToAsyncGenerator)(input), scheduler);
626
538
  }
627
-
628
539
  function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyncScheduler) {
629
540
  let intervalDuration = -1;
630
-
631
541
  if (intervalOrScheduler != null) {
632
542
  if (tsplus_module_7.isScheduler(intervalOrScheduler)) {
633
543
  // eslint-disable-next-line no-param-reassign
@@ -636,19 +546,15 @@ function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyn
636
546
  intervalDuration = intervalOrScheduler;
637
547
  }
638
548
  }
639
-
640
549
  return new _definition2.Observable(s => {
641
550
  let due = tsplus_module_2.isValidDate(time) ? +time - scheduler.now() : time;
642
-
643
551
  if (due < 0) {
644
552
  due = 0;
645
553
  }
646
-
647
554
  let n = 0;
648
555
  return scheduler.schedule(function () {
649
556
  if (!s.closed) {
650
557
  s.next(n++);
651
-
652
558
  if (0 <= intervalDuration) {
653
559
  this.schedule(undefined, intervalDuration);
654
560
  } else {
@@ -661,25 +567,20 @@ function timer_1(time = 0, intervalOrScheduler, scheduler = tsplus_module_5.asyn
661
567
  /**
662
568
  * @tsplus static fncts.observable.ObservableOps zip
663
569
  */
664
-
665
-
666
570
  function makeZip(...sources) {
667
- return sources.length ? new _definition2.Observable(subscriber => {
571
+ return sources.length ? new _definition2.Observable((subscriber, environment) => {
668
572
  let buffers = sources.map(() => []);
669
573
  let completed = sources.map(() => false);
670
574
  subscriber.add(() => {
671
575
  buffers = completed = null;
672
576
  });
673
-
674
577
  for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {
675
- from_1(sources[sourceIndex]).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
578
+ from_1(sources[sourceIndex]).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
676
579
  next: value => {
677
580
  buffers[sourceIndex].push(value);
678
-
679
581
  if (buffers.every(buffer => buffer.length)) {
680
582
  const result = buffers.map(buffer => buffer.shift());
681
583
  subscriber.next(result);
682
-
683
584
  if (buffers.some((buffer, i) => !buffer.length && completed[i])) {
684
585
  subscriber.complete();
685
586
  }
@@ -691,7 +592,6 @@ function makeZip(...sources) {
691
592
  }
692
593
  }));
693
594
  }
694
-
695
595
  return () => {
696
596
  buffers = completed = null;
697
597
  };
@@ -700,830 +600,779 @@ function makeZip(...sources) {
700
600
  /**
701
601
  * @tsplus static fncts.observable.ObservableOps fromIO
702
602
  */
703
-
704
-
705
603
  function fromIO_1(io, scheduler = tsplus_module_5.asyncScheduler) {
706
604
  return new _definition2.Observable((s, env) => {
707
605
  let fiber;
708
606
  const scheduled = scheduler.schedule(() => {
709
- fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment_(io, env, fileName_1 + ":487:36"), fileName_1 + ":487:56");
710
- fiber.unsafeOnDone(exit => {
607
+ fiber = tsplus_module_10.unsafeRunFiber(tsplus_module_9.provideEnvironment(env, fileName_1 + ":489:36")(io), fileName_1 + ":489:56");
608
+ fiber.addObserver(exit => {
711
609
  if (!s.closed) {
712
- tsplus_module_11.match_(tsplus_module_11.flatten(exit), cause => s.error(cause), a => s.next(a));
610
+ tsplus_module_11.match(cause => s.error(cause), a => s.next(a))(exit);
713
611
  s.complete();
714
612
  }
715
613
  });
716
614
  });
717
615
  return () => {
718
616
  scheduled.unsubscribe();
719
- fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber, fileName_1 + ":500:21"), fileName_1 + ":500:46");
617
+ fiber && tsplus_module_10.unsafeRunAsync(tsplus_module_12.interrupt(fiber), fileName_1 + ":502:46");
720
618
  };
721
619
  });
722
620
  }
723
621
  /**
724
622
  * @tsplus static fncts.observable.ObservableOps unit
725
623
  */
726
-
727
-
728
624
  const unit = /*#__PURE__*/single_1(undefined);
729
625
  /**
730
- * @tsplus fluent fncts.observable.Observable zipWith
626
+ * @tsplus pipeable fncts.observable.Observable zipWith
731
627
  */
732
-
733
628
  exports.unit = unit;
734
-
735
- function zipWith_1(fa, fb, f) {
736
- return mergeMap_1(fa, a => map_1(fb, b => f(a, b)));
629
+ function zipWith_1(fb, f) {
630
+ return fa => {
631
+ return mergeMap_1(a => map_1(b => f(a, b))(fb))(fa);
632
+ };
737
633
  }
738
634
  /**
739
- * @tsplus fluent fncts.observable.Observable zip
635
+ * @tsplus pipeable fncts.observable.Observable zip
740
636
  */
741
-
742
-
743
- function zip(fa, fb) {
744
- return zipWith_1(fa, fb, tsplus_module_13.tuple);
637
+ function zip(fb) {
638
+ return fa => {
639
+ return zipWith_1(fb, tsplus_module_13.tuple)(fa);
640
+ };
745
641
  }
746
642
  /**
747
- * @tsplus fluent fncts.observable.Observable ap
643
+ * @tsplus pipeable fncts.observable.Observable ap
748
644
  */
749
-
750
-
751
- function ap(fab, fa) {
752
- return zipWith_1(fab, fa, (f, a) => f(a));
645
+ function ap(fa) {
646
+ return fab => {
647
+ return zipWith_1(fa, (f, a) => f(a))(fab);
648
+ };
753
649
  }
754
650
  /**
755
- * @tsplus fluent fncts.observable.Observable mapWithIndex
651
+ * @tsplus pipeable fncts.observable.Observable mapWithIndex
756
652
  */
757
-
758
-
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
- });
653
+ function mapWithIndex_1(f) {
654
+ return fa => {
655
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
656
+ let i = 0;
657
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
658
+ next: value => {
659
+ subscriber.next(f(i++, value));
660
+ }
661
+ }));
662
+ })(fa);
663
+ };
768
664
  }
769
665
  /**
770
- * @tsplus fluent fncts.observable.Observable map
666
+ * @tsplus pipeable fncts.observable.Observable map
771
667
  */
772
-
773
-
774
- function map_1(fa, f) {
775
- return mapWithIndex_1(fa, (_, a) => f(a));
668
+ function map_1(f) {
669
+ return fa => {
670
+ return mapWithIndex_1((_, a) => f(a))(fa);
671
+ };
776
672
  }
777
673
  /**
778
- * @tsplus fluent fncts.observable.Observable as
674
+ * @tsplus pipeable fncts.observable.Observable as
779
675
  */
780
-
781
-
782
- function as_1(fa, b) {
783
- return map_1(fa, b);
676
+ function as_1(b) {
677
+ return fa => {
678
+ return map_1(b)(fa);
679
+ };
784
680
  }
785
681
  /**
786
- * @tsplus fluent fncts.observable.Observable mapError
682
+ * @tsplus pipeable fncts.observable.Observable mapError
787
683
  */
788
-
789
-
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
- });
684
+ function mapError(f) {
685
+ return fa => {
686
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
687
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
688
+ error: err => {
689
+ subscriber.error(tsplus_module_1.map(f)(err));
690
+ }
691
+ }));
692
+ })(fa);
693
+ };
798
694
  }
799
695
  /**
800
696
  * @tsplus getter fncts.observable.Observable swap
801
697
  */
802
-
803
-
804
698
  function swap(fa) {
805
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
806
- source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
699
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
700
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
807
701
  next: value => {
808
702
  subscriber.error(tsplus_module_1.fail(value));
809
703
  },
810
704
  error: err => {
811
- tsplus_module_14.match_(tsplus_module_1.failureOrCause(err), e => {
705
+ tsplus_module_14.match(e => {
812
706
  subscriber.next(e);
813
707
  }, cause => {
814
708
  subscriber.error(cause);
815
- });
709
+ })(tsplus_module_1.failureOrCause(err));
816
710
  }
817
711
  }));
818
- });
819
- }
820
-
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
- });
712
+ })(fa);
713
+ }
714
+ function filterWithIndex_1(predicate) {
715
+ return fa => {
716
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
717
+ let index = 0;
718
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
719
+ next: value => predicate(index++, value) && subscriber.next(value)
720
+ }));
721
+ })(fa);
722
+ };
828
723
  }
829
-
830
- function filter_(fa, predicate) {
831
- return filterWithIndex_1(fa, (_, a) => predicate(a));
724
+ function filter(predicate) {
725
+ return fa => {
726
+ return filterWithIndex_1((_, a) => predicate(a))(fa);
727
+ };
832
728
  }
833
729
  /**
834
- * @tsplus fluent fncts.observable.Observable filterMapWithIndex
730
+ * @tsplus pipeable fncts.observable.Observable filterMapWithIndex
835
731
  */
836
-
837
-
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
- });
732
+ function filterMapWithIndex_1(f) {
733
+ return fa => {
734
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
735
+ let index = 0;
736
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
737
+ next: value => tsplus_module_15.match(() => tsplus_module_2.noop, b => subscriber.next(b))(f(index++, value))
738
+ }));
739
+ })(fa);
740
+ };
845
741
  }
846
742
  /**
847
- * @tsplus fluent fncts.observable.Observable filterMap
743
+ * @tsplus pipeable fncts.observable.Observable filterMap
848
744
  */
849
-
850
-
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)];
745
+ function filterMap(f) {
746
+ return fa => {
747
+ return filterMapWithIndex_1((_, a) => f(a))(fa);
748
+ };
857
749
  }
858
-
859
- function partition_(fa, predicate) {
860
- return partitionWithIndex_1(fa, (_, a) => predicate(a));
750
+ function partitionWithIndex_1(predicate) {
751
+ return fa => {
752
+ return [filterWithIndex_1((i, a) => !predicate(i, a))(fa), filterWithIndex_1(predicate)(fa)];
753
+ };
861
754
  }
862
- /**
863
- * @tsplus fluent fncts.observable.Observable partitionMapWithIndex
864
- */
865
-
866
-
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
- })];
755
+ function partition(predicate) {
756
+ return fa => {
757
+ return partitionWithIndex_1((_, a) => predicate(a))(fa);
758
+ };
883
759
  }
884
760
  /**
885
- * @tsplus fluent fncts.observable.Observable partitionMap
761
+ * @tsplus pipeable fncts.observable.Observable partitionMapWithIndex
886
762
  */
887
-
888
-
889
- function partitionMap_(fa, f) {
890
- return partitionMapWithIndex_1(fa, (_, a) => f(a));
763
+ function partitionMapWithIndex_1(f) {
764
+ return fa => {
765
+ return [tsplus_module_8.operate_((source, subscriber, environment) => {
766
+ let index = 0;
767
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
768
+ next: value => {
769
+ tsplus_module_14.match(b => subscriber.next(b), tsplus_module_2.noop)(f(index++, value));
770
+ }
771
+ }));
772
+ })(fa), tsplus_module_8.operate_((source, subscriber, environment) => {
773
+ let index = 0;
774
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
775
+ next: value => {
776
+ tsplus_module_14.match(tsplus_module_2.noop, c => subscriber.next(c))(f(index++, value));
777
+ }
778
+ }));
779
+ })(fa)];
780
+ };
891
781
  }
892
782
  /**
893
- * @tsplus fluent fncts.observable.Observable provideEnvironment
783
+ * @tsplus pipeable fncts.observable.Observable partitionMap
894
784
  */
895
-
896
-
897
- function provideEnvironment(self, environment) {
898
- return self.provide(environment);
785
+ function partitionMap(f) {
786
+ return fa => {
787
+ return partitionMapWithIndex_1((_, a) => f(a))(fa);
788
+ };
899
789
  }
900
790
  /**
901
- * @tsplus fluent fncts.observable.Observable provideService
791
+ * @tsplus pipeable fncts.observable.Observable provideService
902
792
  */
903
-
904
-
905
- function provideService(self, service,
906
- /** @tsplus auto */
907
- tag) {
908
- return contramapEnvironment_1(self, environment => tsplus_module_16.add(environment, service, tag));
793
+ function provideService(service, /** @tsplus auto */tag) {
794
+ return self => {
795
+ return contramapEnvironment_1(environment => tsplus_module_16.add(service, tag)(environment))(self);
796
+ };
909
797
  }
910
798
  /**
911
- * @tsplus fluent fncts.observable.Observable mergeMapWithIndex
799
+ * @tsplus pipeable fncts.observable.Observable mergeMapWithIndex
912
800
  */
913
-
914
-
915
- function mergeMapWithIndex_1(ma, f, concurrent = Infinity) {
916
- return tsplus_module_8.operate_(ma, (source, sub) => mergeInternal(source, sub, f, concurrent));
801
+ function mergeMapWithIndex_1(f, concurrent = Infinity) {
802
+ return ma => {
803
+ return tsplus_module_8.operate_((source, sub, environment) => mergeInternal(source, sub, environment, f, concurrent))(ma);
804
+ };
917
805
  }
918
806
  /**
919
- * @tsplus fluent fncts.observable.Observable mergeMap
807
+ * @tsplus pipeable fncts.observable.Observable mergeMap
920
808
  */
921
-
922
-
923
- function mergeMap_1(ma, f, concurrent = Infinity) {
924
- return mergeMapWithIndex_1(ma, (_, a) => f(a), concurrent);
809
+ function mergeMap_1(f, concurrent = Infinity) {
810
+ return ma => {
811
+ return mergeMapWithIndex_1((_, a) => f(a), concurrent)(ma);
812
+ };
925
813
  }
926
814
  /**
927
- * @tsplus fluent fncts.observable.Observable concatMapWithIndex
815
+ * @tsplus pipeable fncts.observable.Observable concatMapWithIndex
928
816
  */
929
-
930
-
931
- function concatMapWithIndex(ma, f) {
932
- return mergeMapWithIndex_1(ma, f, 1);
817
+ function concatMapWithIndex(f) {
818
+ return ma => {
819
+ return mergeMapWithIndex_1(f, 1)(ma);
820
+ };
933
821
  }
934
822
  /**
935
- * @tsplus fluent fncts.observable.Observable concatMap
823
+ * @tsplus pipeable fncts.observable.Observable concatMap
936
824
  */
937
-
938
-
939
- function concatMap_(ma, f) {
940
- return mergeMapWithIndex_1(ma, (_, a) => f(a), 1);
825
+ function concatMap(f) {
826
+ return ma => {
827
+ return mergeMapWithIndex_1((_, a) => f(a), 1)(ma);
828
+ };
941
829
  }
942
830
  /**
943
- * @tsplus fluent fncts.observable.Observable contramapEnvironment
831
+ * @tsplus pipeable fncts.observable.Observable contramapEnvironment
944
832
  */
945
-
946
-
947
- function contramapEnvironment_1(self, f) {
948
- return environmentWithObservable_1(environment => self.provide(f(environment)));
833
+ function contramapEnvironment_1(f) {
834
+ return self => {
835
+ return environmentWithObservable_1(environment => self.provideEnvironment(f(environment)));
836
+ };
949
837
  }
950
838
  /**
951
839
  * @tsplus getter fncts.observable.Observable flatten
952
840
  */
953
-
954
-
955
841
  function flatten(mma) {
956
842
  return concatAll_1(mma);
957
843
  }
958
844
  /**
959
- * @tsplus fluent fncts.observable.Observable foldLeftWithIndex
845
+ * @tsplus pipeable fncts.observable.Observable foldLeftWithIndex
960
846
  */
961
-
962
-
963
- function foldLeftWithIndex_1(fa, initial, f) {
964
- return tsplus_module_8.operate_(fa, scanInternal(f, initial, true, false, true));
847
+ function foldLeftWithIndex_1(initial, f) {
848
+ return fa => {
849
+ return tsplus_module_8.operate_(scanInternal(f, initial, true, false, true))(fa);
850
+ };
965
851
  }
966
852
  /**
967
- * @tsplus fluent fncts.observable.Observable foldLeft
853
+ * @tsplus pipeable fncts.observable.Observable foldLeft
968
854
  */
969
-
970
-
971
- function foldLeft_1(fa, initial, f) {
972
- return foldLeftWithIndex_1(fa, initial, (_, b, a) => f(b, a));
855
+ function foldLeft_1(initial, f) {
856
+ return fa => {
857
+ return foldLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
858
+ };
973
859
  }
974
860
  /**
975
- * @tsplus fluent fncts.observable.Observable at
861
+ * @tsplus pipeable fncts.observable.Observable at
976
862
  */
977
-
978
-
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());
863
+ function at(index) {
864
+ return fa => {
865
+ return onEmpty_1(() => tsplus_module_17.nothing())(map_1(tsplus_module_17.just)(take_1(1)(filterWithIndex_1(i => i === index)(fa))));
866
+ };
981
867
  }
982
868
  /**
983
- * @tsplus fluent fncts.observable.Observable audit
869
+ * @tsplus pipeable fncts.observable.Observable audit
984
870
  */
985
-
986
-
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;
992
-
993
- const endDuration = () => {
994
- durationSubscriber?.unsubscribe();
995
- durationSubscriber = null;
996
-
997
- if (tsplus_module_18.isJust(lastValue)) {
998
- const {
999
- value
1000
- } = lastValue;
1001
- lastValue = tsplus_module_17.nothing();
1002
- subscriber.next(value);
1003
- }
1004
-
1005
- isComplete && subscriber.complete();
1006
- };
1007
-
1008
- const cleanupDuration = () => {
1009
- durationSubscriber = null;
1010
- isComplete && subscriber.complete();
1011
- };
1012
-
1013
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1014
- next: value => {
1015
- lastValue = tsplus_module_17.just(value);
1016
-
1017
- if (!durationSubscriber) {
1018
- from_1(durationSelector(value)).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1019
- next: endDuration,
1020
- complete: cleanupDuration
1021
- }));
1022
- }
1023
- },
1024
- complete: () => {
1025
- isComplete = true;
1026
- (tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
1027
- }
1028
- }));
1029
- });
871
+ function audit_1(durationSelector) {
872
+ return fa => {
873
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
874
+ let lastValue = tsplus_module_17.nothing();
875
+ let durationSubscriber = null;
876
+ let isComplete = false;
877
+ const endDuration = () => {
878
+ durationSubscriber?.unsubscribe();
879
+ durationSubscriber = null;
880
+ if (tsplus_module_18.isJust(lastValue)) {
881
+ const {
882
+ value
883
+ } = lastValue;
884
+ lastValue = tsplus_module_17.nothing();
885
+ subscriber.next(value);
886
+ }
887
+ isComplete && subscriber.complete();
888
+ };
889
+ const cleanupDuration = () => {
890
+ durationSubscriber = null;
891
+ isComplete && subscriber.complete();
892
+ };
893
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
894
+ next: value => {
895
+ lastValue = tsplus_module_17.just(value);
896
+ if (!durationSubscriber) {
897
+ from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
898
+ next: endDuration,
899
+ complete: cleanupDuration
900
+ }));
901
+ }
902
+ },
903
+ complete: () => {
904
+ isComplete = true;
905
+ (tsplus_module_18.isNothing(lastValue) || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
906
+ }
907
+ }));
908
+ })(fa);
909
+ };
1030
910
  }
1031
911
  /**
1032
- * @tsplus fluent fncts.observable.Observable auditTime
912
+ * @tsplus pipeable fncts.observable.Observable auditTime
1033
913
  */
1034
-
1035
-
1036
- function auditTime_(fa, duration, scheduler = tsplus_module_5.asyncScheduler) {
1037
- return audit_1(fa, () => timer_1(duration, scheduler));
914
+ function auditTime(duration, scheduler = tsplus_module_5.asyncScheduler) {
915
+ return fa => {
916
+ return audit_1(() => timer_1(duration, scheduler))(fa);
917
+ };
1038
918
  }
1039
919
  /**
1040
- * @tsplus fluent fncts.observable.Observable buffer
920
+ * @tsplus pipeable fncts.observable.Observable buffer
1041
921
  */
1042
-
1043
-
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
- });
922
+ function buffer(closingNotifier) {
923
+ return fa => {
924
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
925
+ let buffer = [];
926
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
927
+ next: value => buffer.push(value),
928
+ complete: () => {
929
+ subscriber.next(buffer);
930
+ subscriber.complete();
931
+ }
932
+ }));
933
+ closingNotifier.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
934
+ next: () => {
935
+ const b = buffer;
936
+ buffer = [];
937
+ subscriber.next(b);
938
+ },
939
+ complete: tsplus_module_2.noop
940
+ }));
941
+ return () => {
942
+ buffer = null;
943
+ };
944
+ })(fa);
945
+ };
1066
946
  }
1067
947
  /**
1068
- * @tsplus fluent fncts.observable.Observable bufferCount
948
+ * @tsplus pipeable fncts.observable.Observable bufferCount
1069
949
  */
1070
-
1071
-
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;
1081
-
1082
- if (count++ % startBufferEvery === 0) {
1083
- buffers.push([]);
1084
- }
1085
-
1086
- for (const buffer of buffers) {
1087
- buffer.push(value);
1088
-
1089
- if (bufferSize <= buffer.length) {
1090
- toEmit = toEmit ?? [];
1091
- toEmit.push(buffer);
950
+ function bufferCount(bufferSize, startBufferEvery) {
951
+ return fa => {
952
+ // eslint-disable-next-line no-param-reassign
953
+ startBufferEvery = startBufferEvery ?? bufferSize;
954
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
955
+ let buffers = [];
956
+ let count = 0;
957
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
958
+ next: value => {
959
+ let toEmit = null;
960
+ if (count++ % startBufferEvery === 0) {
961
+ buffers.push([]);
1092
962
  }
1093
- }
1094
-
1095
- if (toEmit) {
1096
- for (const buffer of toEmit) {
1097
- (0, tsplus_module_2.arrayRemove)(buffers, buffer);
963
+ for (const buffer of buffers) {
964
+ buffer.push(value);
965
+ if (bufferSize <= buffer.length) {
966
+ toEmit = toEmit ?? [];
967
+ toEmit.push(buffer);
968
+ }
969
+ }
970
+ if (toEmit) {
971
+ for (const buffer of toEmit) {
972
+ (0, tsplus_module_2.arrayRemove)(buffers, buffer);
973
+ subscriber.next(buffer);
974
+ }
975
+ }
976
+ },
977
+ complete: () => {
978
+ for (const buffer of buffers) {
1098
979
  subscriber.next(buffer);
1099
980
  }
981
+ subscriber.complete();
1100
982
  }
1101
- },
1102
- complete: () => {
1103
- for (const buffer of buffers) {
1104
- subscriber.next(buffer);
1105
- }
1106
-
1107
- subscriber.complete();
1108
- }
1109
- }, () => {
1110
- buffers = null;
1111
- }));
1112
- });
983
+ }, () => {
984
+ buffers = null;
985
+ }));
986
+ })(fa);
987
+ };
1113
988
  }
1114
989
  /**
1115
- * @tsplus fluent fncts.observable.Observable bufferTime
990
+ * @tsplus pipeable fncts.observable.Observable bufferTime
1116
991
  */
1117
-
1118
-
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 = {
992
+ function bufferTime(config) {
993
+ return fa => {
994
+ const {
995
+ bufferTimeSpan,
996
+ bufferCreationInterval = null,
997
+ maxBufferSize = Infinity,
998
+ scheduler = tsplus_module_5.asyncScheduler
999
+ } = config;
1000
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1001
+ let bufferRecords = [];
1002
+ let restartOnEmit = true;
1003
+ const emit = record => {
1004
+ const {
1147
1005
  buffer,
1148
1006
  subs
1149
- };
1150
- bufferRecords.push(record);
1151
- subs.add(scheduler.schedule(() => emit(record), bufferTimeSpan));
1152
- }
1153
- };
1154
-
1155
- bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function () {
1156
- 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();
1163
-
1164
- for (const record of recordsCopy) {
1165
- const {
1166
- buffer
1167
- } = record;
1168
- buffer.push(value);
1169
- maxBufferSize <= buffer.length && emit(record);
1007
+ } = record;
1008
+ subs.unsubscribe();
1009
+ (0, tsplus_module_2.arrayRemove)(bufferRecords, record);
1010
+ subscriber.next(buffer);
1011
+ restartOnEmit && startBuffer();
1012
+ };
1013
+ const startBuffer = () => {
1014
+ if (bufferRecords) {
1015
+ const subs = new tsplus_module_6.Subscription();
1016
+ subscriber.add(subs);
1017
+ const buffer = [];
1018
+ const record = {
1019
+ buffer,
1020
+ subs
1021
+ };
1022
+ bufferRecords.push(record);
1023
+ subs.add(scheduler.schedule(() => emit(record), bufferTimeSpan));
1170
1024
  }
1171
- },
1172
- complete: () => {
1173
- while (bufferRecords?.length) {
1174
- subscriber.next(bufferRecords.shift().buffer);
1025
+ };
1026
+ bufferCreationInterval !== null && bufferCreationInterval >= 0 ? subscriber.add(scheduler.schedule(function () {
1027
+ startBuffer();
1028
+ !this.closed && subscriber.add(this.schedule(null, bufferCreationInterval));
1029
+ }, bufferCreationInterval)) : restartOnEmit = true;
1030
+ startBuffer();
1031
+ const bufferTimeSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1032
+ next: value => {
1033
+ const recordsCopy = bufferRecords.slice();
1034
+ for (const record of recordsCopy) {
1035
+ const {
1036
+ buffer
1037
+ } = record;
1038
+ buffer.push(value);
1039
+ maxBufferSize <= buffer.length && emit(record);
1040
+ }
1041
+ },
1042
+ complete: () => {
1043
+ while (bufferRecords?.length) {
1044
+ subscriber.next(bufferRecords.shift().buffer);
1045
+ }
1046
+ bufferTimeSubscriber?.unsubscribe();
1047
+ subscriber.complete();
1048
+ subscriber.unsubscribe();
1175
1049
  }
1176
-
1177
- bufferTimeSubscriber?.unsubscribe();
1178
- subscriber.complete();
1179
- subscriber.unsubscribe();
1180
- }
1181
- }, () => bufferRecords = null);
1182
- source.subscribe(bufferTimeSubscriber);
1183
- });
1050
+ }, () => bufferRecords = null);
1051
+ source.provideEnvironment(environment).subscribe(bufferTimeSubscriber);
1052
+ })(fa);
1053
+ };
1184
1054
  }
1185
1055
  /**
1186
- * @tsplus fluent fncts.observable.Observable bufferToggle
1056
+ * @tsplus pipeable fncts.observable.Observable bufferToggle
1187
1057
  */
1188
-
1189
-
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();
1198
-
1199
- const emitBuffer = () => {
1200
- (0, tsplus_module_2.arrayRemove)(buffers, buffer);
1201
- subscriber.next(buffer);
1202
- closingSubscription.unsubscribe();
1203
- };
1204
-
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());
1058
+ function bufferToggle(openings, closingSelector) {
1059
+ return fa => {
1060
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1061
+ const buffers = [];
1062
+ from_1(openings).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1063
+ next: openValue => {
1064
+ const buffer = [];
1065
+ buffers.push(buffer);
1066
+ const closingSubscription = new tsplus_module_6.Subscription();
1067
+ const emitBuffer = () => {
1068
+ (0, tsplus_module_2.arrayRemove)(buffers, buffer);
1069
+ subscriber.next(buffer);
1070
+ closingSubscription.unsubscribe();
1071
+ };
1072
+ closingSubscription.add(from_1(closingSelector(openValue)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1073
+ next: emitBuffer,
1074
+ complete: tsplus_module_2.noop
1075
+ })));
1076
+ },
1077
+ complete: tsplus_module_2.noop
1078
+ }));
1079
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1080
+ next: value => {
1081
+ for (const buffer of buffers) {
1082
+ buffer.push(value);
1083
+ }
1084
+ },
1085
+ complete: () => {
1086
+ while (buffers.length > 0) {
1087
+ subscriber.next(buffers.shift());
1088
+ }
1089
+ subscriber.complete();
1221
1090
  }
1222
-
1223
- subscriber.complete();
1224
- }
1225
- }));
1226
- });
1091
+ }));
1092
+ })(fa);
1093
+ };
1227
1094
  }
1228
1095
  /**
1229
- * @tsplus fluent fncts.observable.Observable bufferWhen
1096
+ * @tsplus pipeable fncts.observable.Observable bufferWhen
1230
1097
  */
1231
-
1232
-
1233
- function bufferWhen_(fa, closingSelector) {
1234
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1235
- let buffer = null;
1236
- let closingSubscriber = null;
1237
-
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
- };
1248
-
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
- });
1098
+ function bufferWhen(closingSelector) {
1099
+ return fa => {
1100
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1101
+ let buffer = null;
1102
+ let closingSubscriber = null;
1103
+ const openBuffer = () => {
1104
+ closingSubscriber?.unsubscribe();
1105
+ const b = buffer;
1106
+ buffer = [];
1107
+ b && subscriber.next(b);
1108
+ from_1(closingSelector()).provideEnvironment(environment).subscribe(closingSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1109
+ next: openBuffer,
1110
+ complete: tsplus_module_2.noop
1111
+ }));
1112
+ };
1113
+ openBuffer();
1114
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1115
+ next: value => buffer?.push(value),
1116
+ complete: () => {
1117
+ buffer && subscriber.next(buffer);
1118
+ subscriber.complete();
1119
+ }
1120
+ }, () => buffer = closingSubscriber = null));
1121
+ })(fa);
1122
+ };
1258
1123
  }
1259
1124
  /**
1260
- * @tsplus fluent fncts.observable.Observable catchAllCause
1125
+ * @tsplus pipeable fncts.observable.Observable catchAllCause
1261
1126
  */
1262
-
1263
-
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;
1127
+ function catchAllCause_1(f) {
1128
+ return self => {
1129
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1130
+ let innerSub = null;
1131
+ let syncUnsub = false;
1132
+ let handledResult;
1133
+ innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1134
+ error: cause => {
1135
+ handledResult = from_1(f(cause, catchAllCause_1(f)(source)));
1136
+ if (innerSub) {
1137
+ innerSub.unsubscribe();
1138
+ innerSub = null;
1139
+ handledResult.provideEnvironment(environment).subscribe(subscriber);
1140
+ } else {
1141
+ syncUnsub = true;
1142
+ }
1279
1143
  }
1144
+ }));
1145
+ if (syncUnsub) {
1146
+ innerSub.unsubscribe();
1147
+ innerSub = null;
1148
+ handledResult.provideEnvironment(environment).subscribe(subscriber);
1280
1149
  }
1281
- }));
1282
-
1283
- if (syncUnsub) {
1284
- innerSub.unsubscribe();
1285
- innerSub = null;
1286
- handledResult.subscribe(subscriber);
1287
- }
1288
- });
1150
+ })(self);
1151
+ };
1289
1152
  }
1290
1153
  /**
1291
1154
  * @tsplus getter fncts.observable.Observable concatAll
1292
1155
  */
1293
-
1294
-
1295
1156
  function concatAll_1(ffa) {
1296
- return mergeAll_1(ffa, 1);
1157
+ return mergeAll_1(1)(ffa);
1297
1158
  }
1298
1159
  /**
1299
- * @tsplus fluent fncts.observable.Observable concat
1160
+ * @tsplus pipeable fncts.observable.Observable concat
1300
1161
  */
1301
-
1302
-
1303
- function concat_1(fa, ...sources) {
1304
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1305
- concatAll_1(fromArrayLike([source, ...sources])).subscribe(subscriber);
1306
- });
1162
+ function concat_1(...sources) {
1163
+ return fa => {
1164
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1165
+ concatAll_1(fromArrayLike([source, ...sources])).provideEnvironment(environment).subscribe(subscriber);
1166
+ })(fa);
1167
+ };
1307
1168
  }
1308
1169
  /**
1309
1170
  * @tsplus getter fncts.observable.Observable count
1310
1171
  */
1311
-
1312
-
1313
1172
  function count(fa) {
1314
- return foldLeft_1(fa, 0, (total, _) => total + 1);
1173
+ return foldLeft_1(0, (total, _) => total + 1)(fa);
1315
1174
  }
1316
1175
  /**
1317
- * @tsplus fluent fncts.observable.Observable countWithIndex
1176
+ * @tsplus pipeable fncts.observable.Observable countWithIndex
1318
1177
  */
1319
-
1320
-
1321
- function countWithIndex_1(fa, predicate) {
1322
- return foldLeftWithIndex_1(fa, 0, (i, total, v) => predicate(i, v) ? total + 1 : total);
1178
+ function countWithIndex_1(predicate) {
1179
+ return fa => {
1180
+ return foldLeftWithIndex_1(0, (i, total, v) => predicate(i, v) ? total + 1 : total)(fa);
1181
+ };
1323
1182
  }
1324
1183
  /**
1325
- * @tsplus fluent fncts.observable.Observable countWith
1184
+ * @tsplus pipeable fncts.observable.Observable countWith
1326
1185
  */
1327
-
1328
-
1329
- function countWith_(fa, predicate) {
1330
- return countWithIndex_1(fa, (_, a) => predicate(a));
1186
+ function countWith(predicate) {
1187
+ return fa => {
1188
+ return countWithIndex_1((_, a) => predicate(a))(fa);
1189
+ };
1331
1190
  }
1332
1191
  /**
1333
1192
  * @tsplus getter fncts.observable.Observable combineLatestAll
1334
1193
  */
1335
-
1336
-
1337
1194
  function combineLatestAll(fa) {
1338
- return joinAllInternal(fa, sources => !sources.length ? empty_1() : combineLatest_1(sources[0], ...sources.slice(1)));
1195
+ return joinAllInternal(fa, sources => !sources.length ? empty_1() : zipLatest_1(sources[0], ...sources.slice(1)));
1339
1196
  }
1340
1197
  /**
1341
- * @tsplus fluent fncts.observable.Observable combineLatest
1198
+ * @tsplus pipeable fncts.observable.Observable zipLatest
1342
1199
  */
1343
-
1344
-
1345
- function combineLatest_1(self, ...sources) {
1346
- if (!sources.length) {
1347
- return from_1(self).unsafeCoerce();
1348
- }
1349
-
1350
- return tsplus_module_8.operate_(from_1(self), (source, subscriber) => {
1351
- combineLatestInternal(subscriber, [source, ...sources]);
1352
- });
1200
+ function zipLatest_1(...sources) {
1201
+ return self => {
1202
+ if (!sources.length) {
1203
+ return from_1(self).unsafeCoerce();
1204
+ }
1205
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1206
+ combineLatestInternal(subscriber, environment, [source, ...sources]);
1207
+ })(from_1(self));
1208
+ };
1353
1209
  }
1354
1210
  /**
1355
- * @tsplus fluent fncts.observable.Observable debounceWith
1211
+ * @tsplus pipeable fncts.observable.Observable zipWithLatest
1356
1212
  */
1357
-
1358
-
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;
1363
-
1364
- const emit = () => {
1365
- durationSubscriber?.unsubscribe();
1366
- durationSubscriber = null;
1367
-
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
- };
1376
-
1377
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1378
- next: value => {
1379
- 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
- });
1213
+ function zipWithLatest(that, f) {
1214
+ return self => {
1215
+ return map_1(tsplus_module_13.tupled(f))(zipLatest_1(from_1(that))(self));
1216
+ };
1395
1217
  }
1396
1218
  /**
1397
- * @tsplus fluent fncts.observable.Observable debounce
1219
+ * @tsplus pipeable fncts.observable.Observable debounceWith
1398
1220
  */
1399
-
1400
-
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
- }
1426
-
1427
- emit();
1428
- }
1429
-
1430
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1431
- next: value => {
1432
- lastValue = value;
1433
- lastTime = scheduler.now();
1434
-
1435
- if (!activeTask) {
1436
- activeTask = scheduler.schedule(emitWhenIdle, dueTime);
1221
+ function debounceWith(durationSelector) {
1222
+ return fa => {
1223
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1224
+ let lastValue = tsplus_module_17.nothing();
1225
+ let durationSubscriber = null;
1226
+ const emit = () => {
1227
+ durationSubscriber?.unsubscribe();
1228
+ durationSubscriber = null;
1229
+ if (tsplus_module_18.isJust(lastValue)) {
1230
+ const {
1231
+ value
1232
+ } = lastValue;
1233
+ lastValue = tsplus_module_17.nothing();
1234
+ subscriber.next(value);
1235
+ }
1236
+ };
1237
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1238
+ next: value => {
1239
+ durationSubscriber?.unsubscribe();
1240
+ lastValue = tsplus_module_17.just(value);
1241
+ durationSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1242
+ next: emit,
1243
+ complete: tsplus_module_2.noop
1244
+ });
1245
+ from_1(durationSelector(value)).provideEnvironment(environment).subscribe(durationSubscriber);
1246
+ },
1247
+ complete: () => {
1248
+ emit();
1249
+ subscriber.complete();
1250
+ }
1251
+ }, () => {
1252
+ lastValue = durationSubscriber = null;
1253
+ }));
1254
+ })(fa);
1255
+ };
1256
+ }
1257
+ /**
1258
+ * @tsplus pipeable fncts.observable.Observable debounce
1259
+ */
1260
+ function debounce(dueTime, scheduler = tsplus_module_5.asyncScheduler) {
1261
+ return fa => {
1262
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1263
+ let activeTask = null;
1264
+ let lastValue = null;
1265
+ let lastTime = null;
1266
+ const emit = () => {
1267
+ if (activeTask) {
1268
+ activeTask.unsubscribe();
1269
+ activeTask = null;
1270
+ const value = lastValue;
1271
+ lastValue = null;
1272
+ subscriber.next(value);
1273
+ }
1274
+ };
1275
+ function emitWhenIdle() {
1276
+ const targetTime = lastTime + dueTime;
1277
+ const now = scheduler.now();
1278
+ if (now < targetTime) {
1279
+ activeTask = this.schedule(undefined, targetTime - now);
1437
1280
  subscriber.add(activeTask);
1281
+ return;
1438
1282
  }
1439
- },
1440
- complete: () => {
1441
1283
  emit();
1442
- subscriber.complete();
1443
1284
  }
1444
- }, () => {
1445
- lastValue = activeTask = null;
1446
- }));
1447
- });
1285
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1286
+ next: value => {
1287
+ lastValue = value;
1288
+ lastTime = scheduler.now();
1289
+ if (!activeTask) {
1290
+ activeTask = scheduler.schedule(emitWhenIdle, dueTime);
1291
+ subscriber.add(activeTask);
1292
+ }
1293
+ },
1294
+ complete: () => {
1295
+ emit();
1296
+ subscriber.complete();
1297
+ }
1298
+ }, () => {
1299
+ lastValue = activeTask = null;
1300
+ }));
1301
+ })(fa);
1302
+ };
1448
1303
  }
1449
1304
  /**
1450
1305
  * @tsplus getter fncts.observable.Observable either
1451
1306
  */
1452
-
1453
-
1454
1307
  function either(fa) {
1455
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1456
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1308
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1309
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1457
1310
  next: value => {
1458
1311
  subscriber.next(tsplus_module_19.right(value));
1459
1312
  },
1460
1313
  error: error => {
1461
- tsplus_module_14.match_(tsplus_module_1.failureOrCause(error), e => subscriber.next(tsplus_module_19.left(e)), cause => subscriber.error(cause));
1314
+ tsplus_module_14.match(e => subscriber.next(tsplus_module_19.left(e)), cause => subscriber.error(cause))(tsplus_module_1.failureOrCause(error));
1462
1315
  }
1463
1316
  }));
1464
- });
1317
+ })(fa);
1465
1318
  }
1466
1319
  /**
1467
- * @tsplus fluent fncts.observable.Observable delayWithIndex
1320
+ * @tsplus pipeable fncts.observable.Observable delayWithIndex
1468
1321
  */
1469
-
1470
-
1471
- function delayWithIndex_1(fa, f) {
1472
- return mergeMapWithIndex_1(fa, (i, a) => as_1(take_1(f(i, a), 1), () => a));
1322
+ function delayWithIndex_1(f) {
1323
+ return fa => {
1324
+ return mergeMapWithIndex_1((i, a) => as_1(() => a)(take_1(1)(f(i, a))))(fa);
1325
+ };
1473
1326
  }
1474
1327
  /**
1475
- * @tsplus fluent fncts.observable.Observable delayWith
1328
+ * @tsplus pipeable fncts.observable.Observable delayWith
1476
1329
  */
1477
-
1478
-
1479
- function delayWith_1(fa, f) {
1480
- return delayWithIndex_1(fa, (_, a) => f(a));
1330
+ function delayWith_1(f) {
1331
+ return fa => {
1332
+ return delayWithIndex_1((_, a) => f(a))(fa);
1333
+ };
1481
1334
  }
1482
1335
  /**
1483
- * @tsplus fluent fncts.observable.Observable delay
1336
+ * @tsplus pipeable fncts.observable.Observable delay
1484
1337
  */
1485
-
1486
-
1487
- function delay_(fa, due, scheduler = tsplus_module_5.asyncScheduler) {
1488
- const duration = timer_1(due, scheduler);
1489
- return delayWith_1(fa, () => duration);
1338
+ function delay(due, scheduler = tsplus_module_5.asyncScheduler) {
1339
+ return fa => {
1340
+ const duration = timer_1(due, scheduler);
1341
+ return delayWith_1(() => duration)(fa);
1342
+ };
1490
1343
  }
1491
1344
  /**
1492
1345
  * @tsplus getter fncts.observable.Observable dematerialize
1493
1346
  */
1494
-
1495
-
1496
1347
  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)
1348
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1349
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1350
+ next: notification => tsplus_module_20.observe(subscriber)(notification)
1500
1351
  }));
1501
- });
1352
+ })(fa);
1502
1353
  }
1503
1354
  /**
1504
- * @tsplus fluent fncts.observable.Observable ensuring
1355
+ * @tsplus pipeable fncts.observable.Observable ensuring
1505
1356
  */
1506
-
1507
-
1508
- function ensuring_(fa, finalizer) {
1509
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1510
- source.subscribe(subscriber);
1511
- subscriber.add(finalizer);
1512
- });
1357
+ function ensuring(finalizer) {
1358
+ return fa => {
1359
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1360
+ source.provideEnvironment(environment).subscribe(subscriber);
1361
+ subscriber.add(finalizer);
1362
+ })(fa);
1363
+ };
1513
1364
  }
1514
1365
  /**
1515
1366
  * @tsplus getter fncts.observable.Observable exhaustAll
1516
1367
  */
1517
-
1518
-
1519
1368
  function exhaustAll(ffa) {
1520
- return tsplus_module_8.operate_(ffa, (source, subscriber) => {
1369
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1521
1370
  let isComplete = false;
1522
1371
  let innerSub = null;
1523
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1372
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1524
1373
  next: inner => {
1525
1374
  if (!innerSub) {
1526
- innerSub = from_1(inner).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1375
+ innerSub = from_1(inner).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1527
1376
  complete: () => {
1528
1377
  innerSub = null;
1529
1378
  isComplete && subscriber.complete();
@@ -1536,80 +1385,82 @@ function exhaustAll(ffa) {
1536
1385
  !innerSub && subscriber.complete();
1537
1386
  }
1538
1387
  }));
1539
- });
1540
- }
1541
- /**
1542
- * @tsplus fluent fncts.observable.Observable exhaustMapWithIndex
1543
- */
1544
-
1545
-
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);
1388
+ })(ffa);
1389
+ }
1390
+ /**
1391
+ * @tsplus pipeable fncts.observable.Observable exhaustMapWithIndex
1392
+ */
1393
+ function exhaustMapWithIndex_1(f) {
1394
+ return self => {
1395
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1396
+ let index = 0;
1397
+ let innerSub = null;
1398
+ let isComplete = false;
1399
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1400
+ next: outerValue => {
1401
+ if (!innerSub) {
1402
+ innerSub = tsplus_module_8.operatorSubscriber(subscriber, {
1403
+ complete: () => {
1404
+ innerSub = null;
1405
+ isComplete && subscriber.complete();
1406
+ }
1407
+ });
1408
+ from_1(f(index++, outerValue)).provideEnvironment(environment).subscribe(innerSub);
1409
+ }
1410
+ },
1411
+ complete: () => {
1412
+ isComplete = true;
1413
+ !innerSub && subscriber.complete();
1561
1414
  }
1562
- },
1563
- complete: () => {
1564
- isComplete = true;
1565
- !innerSub && subscriber.complete();
1566
- }
1567
- }));
1568
- });
1415
+ }));
1416
+ })(self);
1417
+ };
1569
1418
  }
1570
1419
  /**
1571
- * @tsplus fluent fncts.observable.Observable exhaustMap
1420
+ * @tsplus pipeable fncts.observable.Observable exhaustMap
1572
1421
  */
1573
-
1574
-
1575
- function exhaustMap_(self, f) {
1576
- return exhaustMapWithIndex_1(self, (_, a) => f(a));
1422
+ function exhaustMap(f) {
1423
+ return self => {
1424
+ return exhaustMapWithIndex_1((_, a) => f(a))(self);
1425
+ };
1577
1426
  }
1578
1427
  /**
1579
- * @tsplus fluent fncts.observable.Observable expandWithIndex
1428
+ * @tsplus pipeable fncts.observable.Observable expandWithIndex
1580
1429
  */
1581
-
1582
-
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));
1430
+ function expandWithIndex_1(f, concurrent = Infinity) {
1431
+ return fa => {
1432
+ concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
1433
+ return tsplus_module_8.operate_((source, subscriber, environment) => mergeInternal(source, subscriber, environment, f, concurrent, undefined, true))(fa);
1434
+ };
1587
1435
  }
1588
1436
  /**
1589
- * @tsplus fluent fncts.observable.Observable expand
1437
+ * @tsplus pipeable fncts.observable.Observable expand
1590
1438
  */
1591
-
1592
-
1593
- function expand_(fa, f, concurrent = Infinity) {
1594
- return expandWithIndex_1(fa, (_, a) => f(a), concurrent);
1439
+ function expand(f, concurrent = Infinity) {
1440
+ return fa => {
1441
+ return expandWithIndex_1((_, a) => f(a), concurrent)(fa);
1442
+ };
1595
1443
  }
1596
-
1597
- function findWithIndex_1(fa, predicate) {
1598
- return tsplus_module_8.operate_(fa, findInternal(predicate, "value"));
1444
+ function findWithIndex_1(predicate) {
1445
+ return fa => {
1446
+ return tsplus_module_8.operate_(findInternal(predicate, "value"))(fa);
1447
+ };
1599
1448
  }
1600
-
1601
- function find_(fa, predicate) {
1602
- return findWithIndex_1(fa, (_, a) => predicate(a));
1449
+ function find(predicate) {
1450
+ return fa => {
1451
+ return findWithIndex_1((_, a) => predicate(a))(fa);
1452
+ };
1603
1453
  }
1604
-
1605
- function findIndexWithIndex_1(fa, predicate) {
1606
- return tsplus_module_8.operate_(fa, findInternal(predicate, "index"));
1454
+ function findIndexWithIndex_1(predicate) {
1455
+ return fa => {
1456
+ return tsplus_module_8.operate_(findInternal(predicate, "index"))(fa);
1457
+ };
1607
1458
  }
1608
-
1609
- function findIndex_(fa, predicate) {
1610
- return findIndexWithIndex_1(fa, (_, a) => predicate(a));
1459
+ function findIndex(predicate) {
1460
+ return fa => {
1461
+ return findIndexWithIndex_1((_, a) => predicate(a))(fa);
1462
+ };
1611
1463
  }
1612
-
1613
1464
  function forkJoin(...args) {
1614
1465
  const {
1615
1466
  args: sources,
@@ -1617,16 +1468,13 @@ function forkJoin(...args) {
1617
1468
  } = (0, tsplus_module_2.arrayOrObject)(args);
1618
1469
  return new _definition2.Observable(s => {
1619
1470
  const length = sources.length;
1620
-
1621
1471
  if (!length) {
1622
1472
  s.complete();
1623
1473
  return;
1624
1474
  }
1625
-
1626
1475
  const values = new Array(length);
1627
1476
  let remainingCompletions = length;
1628
1477
  let remainingEmissions = length;
1629
-
1630
1478
  for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {
1631
1479
  let hasValue = false;
1632
1480
  from_1(sources[sourceIndex]).subscribe(tsplus_module_8.operatorSubscriber(s, {
@@ -1635,7 +1483,6 @@ function forkJoin(...args) {
1635
1483
  hasValue = true;
1636
1484
  remainingEmissions--;
1637
1485
  }
1638
-
1639
1486
  values[sourceIndex] = value;
1640
1487
  },
1641
1488
  complete: () => {
@@ -1646,7 +1493,6 @@ function forkJoin(...args) {
1646
1493
  return b;
1647
1494
  }, {}) : values);
1648
1495
  }
1649
-
1650
1496
  s.complete();
1651
1497
  }
1652
1498
  }
@@ -1657,23 +1503,19 @@ function forkJoin(...args) {
1657
1503
  /**
1658
1504
  * @tsplus getter fncts.observable.Observable ignore
1659
1505
  */
1660
-
1661
-
1662
1506
  function ignore(fa) {
1663
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1664
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1507
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1508
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1665
1509
  next: tsplus_module_2.noop
1666
1510
  }));
1667
- });
1511
+ })(fa);
1668
1512
  }
1669
1513
  /**
1670
1514
  * @tsplus getter fncts.observable.Observable isEmpty
1671
1515
  */
1672
-
1673
-
1674
1516
  function isEmpty(fa) {
1675
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1676
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1517
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1518
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1677
1519
  next: () => {
1678
1520
  subscriber.next(false);
1679
1521
  subscriber.complete();
@@ -1683,16 +1525,14 @@ function isEmpty(fa) {
1683
1525
  subscriber.complete();
1684
1526
  }
1685
1527
  }));
1686
- });
1528
+ })(fa);
1687
1529
  }
1688
1530
  /**
1689
1531
  * @tsplus getter fncts.observable.Observable materialize
1690
1532
  */
1691
-
1692
-
1693
1533
  function materialize(fa) {
1694
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1695
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1534
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1535
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1696
1536
  next: value => {
1697
1537
  subscriber.next(tsplus_module_20.next(value));
1698
1538
  },
@@ -1703,727 +1543,678 @@ function materialize(fa) {
1703
1543
  subscriber.next(tsplus_module_20.complete());
1704
1544
  }
1705
1545
  }));
1706
- });
1546
+ })(fa);
1707
1547
  }
1708
1548
  /**
1709
- * @tsplus fluent fncts.observable.Observable mergeAll
1549
+ * @tsplus pipeable fncts.observable.Observable mergeAll
1710
1550
  */
1711
-
1712
-
1713
- function mergeAll_1(self, concurrent = Infinity) {
1714
- return mergeMap_1(self, tsplus_module_13.identity, concurrent);
1551
+ function mergeAll_1(concurrent = Infinity) {
1552
+ return self => {
1553
+ return mergeMap_1(tsplus_module_13.identity, concurrent)(self);
1554
+ };
1715
1555
  }
1716
1556
  /**
1717
- * @tsplus fluent fncts.observable.Observable mergeScanWithIndex
1557
+ * @tsplus pipeable fncts.observable.Observable mergeScanWithIndex
1718
1558
  */
1719
-
1720
-
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
- });
1559
+ function mergeScanWithIndex_1(initial, f, concurrent = Infinity) {
1560
+ return fa => {
1561
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1562
+ let state = initial;
1563
+ return mergeInternal(source, subscriber, environment, (index, value) => f(index, state, value), concurrent, value => {
1564
+ state = value;
1565
+ }, false, undefined, () => state = null);
1566
+ })(fa);
1567
+ };
1728
1568
  }
1729
1569
  /**
1730
- * @tsplus fluent fncts.observable.Observable mergeScan
1570
+ * @tsplus pipeable fncts.observable.Observable mergeScan
1731
1571
  */
1732
-
1733
-
1734
- function mergeScan_(fa, initial, f, concurrent = Infinity) {
1735
- return mergeScanWithIndex_1(fa, initial, (_, b, a) => f(b, a), concurrent);
1572
+ function mergeScan(initial, f, concurrent = Infinity) {
1573
+ return fa => {
1574
+ return mergeScanWithIndex_1(initial, (_, b, a) => f(b, a), concurrent)(fa);
1575
+ };
1736
1576
  }
1737
-
1738
1577
  function onErrorResumeNext(fa, ...sources) {
1739
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
1578
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1740
1579
  const remaining = [source, ...sources];
1741
-
1742
1580
  const subscribeNext = () => {
1743
1581
  if (!subscriber.closed) {
1744
1582
  if (remaining.length > 0) {
1745
1583
  let nextSource;
1746
-
1747
1584
  try {
1748
1585
  nextSource = from_1(remaining.shift());
1749
1586
  } catch (err) {
1750
1587
  subscribeNext();
1751
1588
  return;
1752
1589
  }
1753
-
1754
1590
  const innerSub = tsplus_module_8.operatorSubscriber(subscriber, {
1755
1591
  error: tsplus_module_2.noop,
1756
1592
  complete: tsplus_module_2.noop
1757
1593
  });
1758
- subscriber.add(nextSource.subscribe(innerSub));
1594
+ subscriber.add(nextSource.provideEnvironment(environment).subscribe(innerSub));
1759
1595
  innerSub.add(subscribeNext);
1760
1596
  } else {
1761
1597
  subscriber.complete();
1762
1598
  }
1763
1599
  }
1764
1600
  };
1765
-
1766
1601
  subscribeNext();
1767
- });
1602
+ })(fa);
1768
1603
  }
1769
1604
  /**
1770
- * @tsplus fluent fncts.observable.Observable onEmpty
1605
+ * @tsplus pipeable fncts.observable.Observable onEmpty
1771
1606
  */
1772
-
1773
-
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());
1607
+ function onEmpty_1(f) {
1608
+ return fa => {
1609
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1610
+ let hasValue = false;
1611
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1612
+ next: value => {
1613
+ hasValue = true;
1614
+ subscriber.next(value);
1615
+ },
1616
+ complete: () => {
1617
+ if (!hasValue) {
1618
+ subscriber.next(f());
1619
+ }
1620
+ subscriber.complete();
1785
1621
  }
1786
-
1787
- subscriber.complete();
1788
- }
1789
- }));
1790
- });
1622
+ }));
1623
+ })(fa);
1624
+ };
1791
1625
  }
1792
1626
  /**
1793
- * @tsplus fluent fncts.observable.Observable repeat
1627
+ * @tsplus pipeable fncts.observable.Observable repeat
1794
1628
  */
1795
-
1796
-
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;
1801
-
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();
1629
+ function repeat(count = Infinity) {
1630
+ return fa => {
1631
+ return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
1632
+ let repeats = 0;
1633
+ let innerSub;
1634
+ const loop = () => {
1635
+ let syncUnsub = false;
1636
+ innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1637
+ complete: () => {
1638
+ if (++repeats < count) {
1639
+ if (innerSub) {
1640
+ innerSub.unsubscribe();
1641
+ innerSub = null;
1642
+ loop();
1643
+ } else {
1644
+ syncUnsub = true;
1645
+ }
1811
1646
  } else {
1812
- syncUnsub = true;
1647
+ subscriber.complete;
1813
1648
  }
1814
- } else {
1815
- subscriber.complete;
1816
1649
  }
1650
+ }));
1651
+ if (syncUnsub) {
1652
+ innerSub.unsubscribe();
1653
+ innerSub = null;
1654
+ loop();
1817
1655
  }
1818
- }));
1819
-
1820
- if (syncUnsub) {
1821
- innerSub.unsubscribe();
1822
- innerSub = null;
1823
- loop();
1824
- }
1825
- };
1826
-
1827
- loop();
1828
- });
1656
+ };
1657
+ loop();
1658
+ })(fa);
1659
+ };
1829
1660
  }
1830
-
1831
- function retry_(fa, configOrCount = Infinity) {
1832
- let config;
1833
-
1834
- if (configOrCount && typeof configOrCount === "object") {
1835
- config = configOrCount;
1836
- } else {
1837
- config = {
1838
- count: configOrCount
1839
- };
1840
- }
1841
-
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
- }
1857
-
1858
- subscriber.next(value);
1859
- },
1860
- error: err => {
1861
- if (retries++ < count) {
1862
- if (innerSub) {
1863
- innerSub.unsubscribe();
1864
- innerSub = null;
1865
- loop();
1661
+ function retry(configOrCount = Infinity) {
1662
+ return fa => {
1663
+ let config;
1664
+ if (configOrCount && typeof configOrCount === "object") {
1665
+ config = configOrCount;
1666
+ } else {
1667
+ config = {
1668
+ count: configOrCount
1669
+ };
1670
+ }
1671
+ const {
1672
+ count,
1673
+ resetOnSuccess = false
1674
+ } = config;
1675
+ return count <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
1676
+ let retries = 0;
1677
+ let innerSub;
1678
+ const loop = () => {
1679
+ let syncUnsub = false;
1680
+ innerSub = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1681
+ next: value => {
1682
+ if (resetOnSuccess) {
1683
+ retries = 0;
1684
+ }
1685
+ subscriber.next(value);
1686
+ },
1687
+ error: err => {
1688
+ if (retries++ < count) {
1689
+ if (innerSub) {
1690
+ innerSub.unsubscribe();
1691
+ innerSub = null;
1692
+ loop();
1693
+ } else {
1694
+ syncUnsub = true;
1695
+ }
1866
1696
  } else {
1867
- syncUnsub = true;
1697
+ subscriber.error(err);
1868
1698
  }
1869
- } else {
1870
- subscriber.error(err);
1871
1699
  }
1700
+ }));
1701
+ if (syncUnsub) {
1702
+ innerSub.unsubscribe();
1703
+ innerSub = null;
1704
+ loop();
1872
1705
  }
1873
- }));
1874
-
1875
- if (syncUnsub) {
1876
- innerSub.unsubscribe();
1877
- innerSub = null;
1878
- loop();
1879
- }
1880
- };
1881
-
1882
- loop();
1883
- });
1706
+ };
1707
+ loop();
1708
+ })(fa);
1709
+ };
1884
1710
  }
1885
1711
  /**
1886
- * @tsplus fluent fncts.observable.Observable sample
1712
+ * @tsplus pipeable fncts.observable.Observable sample
1887
1713
  */
1888
-
1889
-
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
- }));
1900
-
1901
- const emit = () => {
1902
- if (hasValue) {
1903
- hasValue = false;
1904
- const value = lastValue;
1905
- lastValue = null;
1906
- subscriber.next(value);
1907
- }
1908
- };
1909
-
1910
- notifier.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1911
- next: emit,
1912
- complete: tsplus_module_2.noop
1913
- }));
1914
- });
1714
+ function sample_1(notifier) {
1715
+ return fa => {
1716
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1717
+ let hasValue = false;
1718
+ let lastValue = null;
1719
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1720
+ next: value => {
1721
+ hasValue = true;
1722
+ lastValue = value;
1723
+ }
1724
+ }));
1725
+ const emit = () => {
1726
+ if (hasValue) {
1727
+ hasValue = false;
1728
+ const value = lastValue;
1729
+ lastValue = null;
1730
+ subscriber.next(value);
1731
+ }
1732
+ };
1733
+ notifier.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1734
+ next: emit,
1735
+ complete: tsplus_module_2.noop
1736
+ }));
1737
+ })(fa);
1738
+ };
1915
1739
  }
1916
1740
  /**
1917
- * @tsplus fluent fncts.observable.Observable sampleTime
1741
+ * @tsplus pipeable fncts.observable.Observable sampleTime
1918
1742
  */
1919
-
1920
-
1921
- function sampleTime_(fa, period, scheduler = tsplus_module_5.asyncScheduler) {
1922
- return sample_1(fa, interval_1(period, scheduler));
1743
+ function sampleTime(period, scheduler = tsplus_module_5.asyncScheduler) {
1744
+ return fa => {
1745
+ return sample_1(interval_1(period, scheduler))(fa);
1746
+ };
1923
1747
  }
1924
1748
  /**
1925
- * @tsplus fluent fncts.observable.Observable scanLeftWithIndex
1749
+ * @tsplus pipeable fncts.observable.Observable scanLeftWithIndex
1926
1750
  */
1927
-
1928
-
1929
- function scanLeftWithIndex_1(fa, initial, f) {
1930
- return tsplus_module_8.operate_(fa, scanInternal(f, initial, true, true));
1751
+ function scanLeftWithIndex_1(initial, f) {
1752
+ return fa => {
1753
+ return tsplus_module_8.operate_(scanInternal(f, initial, true, true))(fa);
1754
+ };
1931
1755
  }
1932
1756
  /**
1933
- * @tsplus fluent fncts.observable.Observable scanLeft
1757
+ * @tsplus pipeable fncts.observable.Observable scanLeft
1934
1758
  */
1935
-
1936
-
1937
- function scanLeft(fa, initial, f) {
1938
- return scanLeftWithIndex_1(fa, initial, (_, b, a) => f(b, a));
1759
+ function scanLeft(initial, f) {
1760
+ return fa => {
1761
+ return scanLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
1762
+ };
1939
1763
  }
1940
1764
  /**
1941
1765
  * @tsplus static fncts.observable.ObservableOps service
1942
1766
  */
1943
-
1944
-
1945
- function service(
1946
- /** @tsplus auto */
1947
- tag) {
1767
+ function service( /** @tsplus auto */tag) {
1948
1768
  return serviceWithObservable_1(service => of_1(service), tag);
1949
1769
  }
1950
1770
  /**
1951
1771
  * @tsplus static fncts.observable.ObservableOps serviceWith
1952
1772
  */
1953
-
1954
-
1955
- function serviceWith(f,
1956
- /** @tsplus auto */
1957
- tag) {
1773
+ function serviceWith(f, /** @tsplus auto */tag) {
1958
1774
  return serviceWithObservable_1(service => of_1(f(service)), tag);
1959
1775
  }
1960
1776
  /**
1961
1777
  * @tsplus static fncts.observable.ObservableOps serviceWithObservable
1962
1778
  */
1963
-
1964
-
1965
- function serviceWithObservable_1(f,
1966
- /** @tsplus auto */
1967
- tag) {
1968
- return environmentWithObservable_1(environment => f(tsplus_module_16.unsafeGet(environment, tag)));
1779
+ function serviceWithObservable_1(f, /** @tsplus auto */tag) {
1780
+ return environmentWithObservable_1(environment => f(tsplus_module_16.unsafeGet(tag)(environment)));
1969
1781
  }
1970
1782
  /**
1971
- * @tsplus fluent fncts.observable.Observable skip
1783
+ * @tsplus pipeable fncts.observable.Observable skip
1972
1784
  */
1973
-
1974
-
1975
- function skip_(fa, count) {
1976
- return filterWithIndex_1(fa, (index, _) => count <= index);
1785
+ function skip(count) {
1786
+ return fa => {
1787
+ return filterWithIndex_1((index, _) => count <= index)(fa);
1788
+ };
1977
1789
  }
1978
1790
  /**
1979
- * @tsplus fluent fncts.observable.Observable skipLast
1791
+ * @tsplus pipeable fncts.observable.Observable skipLast
1980
1792
  */
1981
-
1982
-
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++;
1990
-
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);
1793
+ function skipLast(skipCount) {
1794
+ return fa => {
1795
+ return skipCount <= 0 ? fa : tsplus_module_8.operate_((source, subscriber, environment) => {
1796
+ let ring = new Array(skipCount);
1797
+ let seen = 0;
1798
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1799
+ next: value => {
1800
+ const valueIndex = seen++;
1801
+ if (valueIndex < skipCount) {
1802
+ ring[valueIndex] = value;
1803
+ } else {
1804
+ const index = valueIndex % skipCount;
1805
+ const oldValue = ring[index];
1806
+ ring[index] = value;
1807
+ subscriber.next(oldValue);
1808
+ }
1998
1809
  }
1999
- }
2000
- }));
2001
- return () => {
2002
- ring = null;
2003
- };
2004
- });
1810
+ }));
1811
+ return () => {
1812
+ ring = null;
1813
+ };
1814
+ })(fa);
1815
+ };
2005
1816
  }
2006
1817
  /**
2007
- * @tsplus fluent fncts.observable.Observable skipUntil
1818
+ * @tsplus pipeable fncts.observable.Observable skipUntil
2008
1819
  */
2009
-
2010
-
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
- });
1820
+ function skipUntil(notifier) {
1821
+ return fa => {
1822
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1823
+ let taking = false;
1824
+ const skipSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1825
+ next: () => {
1826
+ skipSubscriber?.unsubscribe();
1827
+ taking = true;
1828
+ },
1829
+ complete: tsplus_module_2.noop
1830
+ });
1831
+ from_1(notifier).provideEnvironment(environment).subscribe(skipSubscriber);
1832
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1833
+ next: value => taking && subscriber.next(value)
1834
+ }));
1835
+ })(fa);
1836
+ };
2026
1837
  }
2027
1838
  /**
2028
- * @tsplus fluent fncts.observable.Observable skipWhile
1839
+ * @tsplus pipeable fncts.observable.Observable skipWhile
2029
1840
  */
2030
-
2031
-
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
- });
1841
+ function skipWhile(predicate) {
1842
+ return fa => {
1843
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1844
+ let taking = false;
1845
+ let index = 0;
1846
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1847
+ next: value => (taking || (taking = !predicate(index++, value))) && subscriber.next(value)
1848
+ }));
1849
+ })(fa);
1850
+ };
2040
1851
  }
2041
1852
  /**
2042
- * @tsplus fluent fncts.observable.Observable startWith
1853
+ * @tsplus pipeable fncts.observable.Observable startWith
2043
1854
  */
2044
-
2045
-
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
- });
1855
+ function startWith(...values) {
1856
+ return fa => {
1857
+ return tsplus_module_8.operate_((source, subscriber) => {
1858
+ // @ts-expect-error
1859
+ concat_1(values)(source).subscribe(subscriber);
1860
+ })(fa);
1861
+ };
2051
1862
  }
2052
1863
  /**
2053
- * @tsplus fluent fncts.observable.Observable subscribeOn
1864
+ * @tsplus pipeable fncts.observable.Observable subscribeOn
2054
1865
  */
2055
-
2056
-
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
- });
1866
+ function subscribeOn(scheduler, delay = 0) {
1867
+ return fa => {
1868
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1869
+ subscriber.add(scheduler.schedule(() => source.provideEnvironment(environment).subscribe(subscriber), delay));
1870
+ })(fa);
1871
+ };
2061
1872
  }
2062
1873
  /**
2063
1874
  * @tsplus getter fncts.observable.Observable switchAll
2064
1875
  */
2065
-
2066
-
2067
1876
  function switchAll(ffa) {
2068
- return switchMap_1(ffa, tsplus_module_13.identity);
1877
+ return switchMap_1(tsplus_module_13.identity)(ffa);
2069
1878
  }
2070
1879
  /**
2071
- * @tsplus fluent fncts.observable.Observable switchMapWithIndex
1880
+ * @tsplus pipeable fncts.observable.Observable switchMapWithIndex
2072
1881
  */
2073
-
2074
-
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;
2080
-
2081
- const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();
2082
-
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
- });
1882
+ function switchMapWithIndex_1(f) {
1883
+ return fa => {
1884
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1885
+ let innerSubscriber = null;
1886
+ let index = 0;
1887
+ let isComplete = false;
1888
+ const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();
1889
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1890
+ next: value => {
1891
+ innerSubscriber?.unsubscribe();
1892
+ const outerIndex = index++;
1893
+ from_1(f(outerIndex, value)).provideEnvironment(environment).subscribe(innerSubscriber = tsplus_module_8.operatorSubscriber(subscriber, {
1894
+ next: innerValue => subscriber.next(innerValue),
1895
+ complete: () => {
1896
+ innerSubscriber = null;
1897
+ checkComplete();
1898
+ }
1899
+ }));
1900
+ }
1901
+ }, () => {
1902
+ isComplete = true;
1903
+ checkComplete();
1904
+ }));
1905
+ })(fa);
1906
+ };
2100
1907
  }
2101
1908
  /**
2102
- * @tsplus fluent fncts.observable.Observable switchMap
1909
+ * @tsplus pipeable fncts.observable.Observable switchMap
2103
1910
  */
2104
-
2105
-
2106
- function switchMap_1(fa, f) {
2107
- return switchMapWithIndex_1(fa, (_, a) => f(a));
1911
+ function switchMap_1(f) {
1912
+ return fa => {
1913
+ return switchMapWithIndex_1((_, a) => f(a))(fa);
1914
+ };
2108
1915
  }
2109
1916
  /**
2110
- * @tsplus fluent fncts.observable.Observable switchScanWithIndex
1917
+ * @tsplus pipeable fncts.observable.Observable switchScanWithIndex
2111
1918
  */
2112
-
2113
-
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
- });
1919
+ function switchScanWithIndex_1(initial, f) {
1920
+ return fa => {
1921
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1922
+ let state = initial;
1923
+ switchMapWithIndex_1((index, value) => map_1(b => (state = b, b))(from_1(f(index, state, value))))(source).provideEnvironment(environment).subscribe(subscriber);
1924
+ return () => {
1925
+ state = null;
1926
+ };
1927
+ })(fa);
1928
+ };
2122
1929
  }
2123
1930
  /**
2124
- * @tsplus fluent fncts.observable.Observable switchScan
1931
+ * @tsplus pipeable fncts.observable.Observable switchScan
2125
1932
  */
2126
-
2127
-
2128
- function switchScan_(fa, initial, f) {
2129
- return switchScanWithIndex_1(fa, initial, (_, b, a) => f(b, a));
1933
+ function switchScan(initial, f) {
1934
+ return fa => {
1935
+ return switchScanWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
1936
+ };
2130
1937
  }
2131
1938
  /**
2132
- * @tsplus fluent fncts.observable.Observable take
1939
+ * @tsplus pipeable fncts.observable.Observable take
2133
1940
  */
2134
-
2135
-
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);
2143
-
2144
- if (count <= seen) {
2145
- sub.complete();
1941
+ function take_1(count) {
1942
+ return fa => {
1943
+ return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, sub, environment) => {
1944
+ let seen = 0;
1945
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(sub, {
1946
+ next: value => {
1947
+ if (++seen <= count) {
1948
+ sub.next(value);
1949
+ if (count <= seen) {
1950
+ sub.complete();
1951
+ }
2146
1952
  }
2147
1953
  }
2148
- }
2149
- }));
2150
- });
1954
+ }));
1955
+ })(fa);
1956
+ };
2151
1957
  }
2152
1958
  /**
2153
- * @tsplus fluent fncts.observable.Observable takeLast
1959
+ * @tsplus pipeable fncts.observable.Observable takeLast
2154
1960
  */
2155
-
2156
-
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);
1961
+ function takeLast(count) {
1962
+ return fa => {
1963
+ return count <= 0 ? empty_1() : tsplus_module_8.operate_((source, subscriber, environment) => {
1964
+ let buffer = [];
1965
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1966
+ next: value => {
1967
+ buffer.push(value);
1968
+ count < buffer.length && buffer.shift();
1969
+ },
1970
+ complete: () => {
1971
+ for (const value of buffer) {
1972
+ subscriber.next(value);
1973
+ }
1974
+ subscriber.complete();
2168
1975
  }
2169
-
2170
- subscriber.complete();
2171
- }
2172
- }, () => {
2173
- buffer = null;
2174
- }));
2175
- });
1976
+ }, () => {
1977
+ buffer = null;
1978
+ }));
1979
+ })(fa);
1980
+ };
2176
1981
  }
2177
1982
  /**
2178
- * @tsplus fluent fncts.observable.Observable takeUntil
1983
+ * @tsplus pipeable fncts.observable.Observable takeUntil
2179
1984
  */
2180
-
2181
-
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
- });
1985
+ function takeUntil(notifier) {
1986
+ return fa => {
1987
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1988
+ from_1(notifier).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
1989
+ next: () => subscriber.complete(),
1990
+ complete: tsplus_module_2.noop
1991
+ }));
1992
+ !subscriber.closed && source.provideEnvironment(environment).subscribe(subscriber);
1993
+ })(fa);
1994
+ };
2190
1995
  }
2191
-
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
- });
1996
+ function takeWhileWithIndex_1(predicate, inclusive) {
1997
+ return fa => {
1998
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
1999
+ let index = 0;
2000
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2001
+ next: value => {
2002
+ const result = predicate(index++, value);
2003
+ (result || inclusive) && subscriber.next(value);
2004
+ !result && subscriber.complete();
2005
+ }
2006
+ }));
2007
+ })(fa);
2008
+ };
2203
2009
  }
2204
-
2205
- function takeWhile_(fa, predicate, inclusive) {
2206
- return takeWhileWithIndex_1(fa, (_, a) => predicate(a), inclusive);
2010
+ function takeWhile(predicate, inclusive) {
2011
+ return fa => {
2012
+ return takeWhileWithIndex_1((_, a) => predicate(a), inclusive)(fa);
2013
+ };
2207
2014
  }
2208
2015
  /**
2209
- * @tsplus fluent fncts.observable.Observable tap
2016
+ * @tsplus pipeable fncts.observable.Observable tap
2210
2017
  */
2211
-
2212
-
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
- });
2018
+ function tap(observer) {
2019
+ return fa => {
2020
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2021
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2022
+ next: value => {
2023
+ observer.next?.(value);
2024
+ subscriber.next(value);
2025
+ },
2026
+ error: err => {
2027
+ observer.error?.(err);
2028
+ subscriber.error(err);
2029
+ },
2030
+ complete: () => {
2031
+ observer.complete?.();
2032
+ subscriber.complete();
2033
+ }
2034
+ }));
2035
+ })(fa);
2036
+ };
2230
2037
  }
2231
-
2232
2038
  const defaultThrottleConfig = {
2233
2039
  leading: true,
2234
2040
  trailing: false
2235
2041
  };
2236
2042
  /**
2237
- * @tsplus fluent fncts.observable.Observable throttle
2043
+ * @tsplus pipeable fncts.observable.Observable throttle
2238
2044
  */
2239
-
2240
2045
  exports.defaultThrottleConfig = defaultThrottleConfig;
2241
-
2242
- function throttle_1(fa, durationSelector, {
2046
+ function throttle_1(durationSelector, {
2243
2047
  leading,
2244
2048
  trailing
2245
2049
  } = 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;
2254
-
2255
- if (trailing) {
2256
- send();
2050
+ return fa => {
2051
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2052
+ let sendValue = tsplus_module_17.nothing();
2053
+ let throttled = null;
2054
+ let isComplete = false;
2055
+ const endThrottling = () => {
2056
+ throttled?.unsubscribe();
2057
+ throttled = null;
2058
+ if (trailing) {
2059
+ send();
2060
+ isComplete && subscriber.complete();
2061
+ }
2062
+ };
2063
+ const cleanupThrottling = () => {
2064
+ throttled = null;
2257
2065
  isComplete && subscriber.complete();
2258
- }
2259
- };
2260
-
2261
- const cleanupThrottling = () => {
2262
- throttled = null;
2263
- isComplete && subscriber.complete();
2264
- };
2265
-
2266
- const startThrottling = value => throttled = from_1(durationSelector(value)).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2267
- next: endThrottling,
2268
- complete: cleanupThrottling
2269
- }));
2270
-
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
- };
2281
-
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
- });
2066
+ };
2067
+ const startThrottling = value => throttled = from_1(durationSelector(value)).provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2068
+ next: endThrottling,
2069
+ complete: cleanupThrottling
2070
+ }));
2071
+ const send = () => {
2072
+ if (tsplus_module_18.isJust(sendValue)) {
2073
+ const {
2074
+ value
2075
+ } = sendValue;
2076
+ sendValue = tsplus_module_17.nothing();
2077
+ subscriber.next(value);
2078
+ !isComplete && startThrottling(value);
2079
+ }
2080
+ };
2081
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2082
+ next: value => {
2083
+ sendValue = tsplus_module_17.just(value);
2084
+ !(throttled && !throttled.closed) && (leading ? send() : startThrottling(value));
2085
+ },
2086
+ complete: () => {
2087
+ isComplete = true;
2088
+ !(trailing && tsplus_module_18.isJust(sendValue) && throttled && !throttled.closed) && subscriber.complete();
2089
+ }
2090
+ }));
2091
+ })(fa);
2092
+ };
2293
2093
  }
2294
2094
  /**
2295
- * @tsplus fluent fncts.observable.Observable throttleTime
2095
+ * @tsplus pipeable fncts.observable.Observable throttleTime
2296
2096
  */
2297
-
2298
-
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);
2097
+ function throttleTime(duration, scheduler = tsplus_module_5.asyncScheduler, config = defaultThrottleConfig) {
2098
+ return fa => {
2099
+ const duration$ = timer_1(duration, scheduler);
2100
+ return throttle_1(() => duration$, config)(fa);
2101
+ };
2302
2102
  }
2303
-
2304
2103
  class TimeoutError extends Error {
2305
2104
  constructor(info) {
2306
2105
  super("Timeout has occurred");
2307
2106
  this.info = info;
2308
2107
  this.name = "TimeoutError";
2309
2108
  }
2310
-
2311
2109
  }
2312
-
2313
2110
  exports.TimeoutError = TimeoutError;
2314
-
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
- }
2353
-
2354
- lastValue = tsplus_module_17.nothing();
2355
- }));
2356
- startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
2357
- });
2111
+ function timeout(config) {
2112
+ return fa => {
2113
+ const {
2114
+ first,
2115
+ each,
2116
+ with: _with = timeoutError,
2117
+ scheduler = tsplus_module_5.asyncScheduler,
2118
+ meta = null
2119
+ } = config;
2120
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2121
+ // eslint-disable-next-line prefer-const
2122
+ let originalSourceSubscription;
2123
+ let timerSubscription;
2124
+ let lastValue = tsplus_module_17.nothing();
2125
+ let seen = 0;
2126
+ const startTimer = delay => {
2127
+ timerSubscription = (0, tsplus_module_7.caughtSchedule)(subscriber, scheduler, () => {
2128
+ originalSourceSubscription.unsubscribe();
2129
+ from_1(_with({
2130
+ meta,
2131
+ lastValue,
2132
+ seen
2133
+ })).provideEnvironment(environment).subscribe(subscriber);
2134
+ }, delay);
2135
+ };
2136
+ originalSourceSubscription = source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2137
+ next: value => {
2138
+ timerSubscription?.unsubscribe();
2139
+ seen++;
2140
+ lastValue = tsplus_module_17.just(value);
2141
+ subscriber.next(value);
2142
+ each > 0 && startTimer(each);
2143
+ }
2144
+ }, () => {
2145
+ if (!timerSubscription?.closed) {
2146
+ timerSubscription?.unsubscribe();
2147
+ }
2148
+ lastValue = tsplus_module_17.nothing();
2149
+ }));
2150
+ startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
2151
+ })(fa);
2152
+ };
2358
2153
  }
2359
-
2360
2154
  function timeoutError(info) {
2361
2155
  return fail_1(new TimeoutError(info));
2362
2156
  }
2363
-
2364
2157
  function toArrayAccumulator(arr, value) {
2365
2158
  return arr.push(value), arr;
2366
2159
  }
2367
2160
  /**
2368
2161
  * @tsplus getter fncts.observable.Observable toArray
2369
2162
  */
2370
-
2371
-
2372
2163
  function toArray_1(fa) {
2373
- return tsplus_module_8.operate_(fa, (source, subscriber) => {
2374
- foldLeft_1(source, [], toArrayAccumulator).subscribe(subscriber);
2375
- });
2164
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2165
+ foldLeft_1([], toArrayAccumulator)(source).provideEnvironment(environment).subscribe(subscriber);
2166
+ })(fa);
2376
2167
  }
2377
2168
  /**
2378
- * @tsplus fluent fncts.observable.Observable unique
2169
+ * @tsplus pipeable fncts.observable.Observable unique
2379
2170
  */
2380
-
2381
-
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;
2388
-
2389
- if (!tsplus_module_21.has_(distinctKeys, key)) {
2390
- tsplus_module_21.add_(distinctKeys, key);
2391
- subscriber.next(value);
2171
+ function unique(toKey, flushes) {
2172
+ return fa => {
2173
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2174
+ let distinctKeys = tsplus_module_21.empty();
2175
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2176
+ next: value => {
2177
+ const key = toKey ? toKey(value) : value;
2178
+ if (!tsplus_module_21.has(key)(distinctKeys)) {
2179
+ tsplus_module_21.add(key)(distinctKeys);
2180
+ subscriber.next(value);
2181
+ }
2392
2182
  }
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
- });
2183
+ }));
2184
+ flushes?.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2185
+ next: () => distinctKeys = tsplus_module_21.empty(),
2186
+ complete: tsplus_module_2.noop
2187
+ }));
2188
+ })(fa);
2189
+ };
2400
2190
  }
2401
-
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);
2410
-
2411
- if (first || !compare(previousKey, currentKey)) {
2412
- first = false;
2413
- previousKey = currentKey;
2414
- subscriber.next(value);
2191
+ function uniqueUntilChanged_1(E, keySelector = tsplus_module_13.identity) {
2192
+ return fa => {
2193
+ const compare = "equals" in E ? E.equals : E;
2194
+ return tsplus_module_8.operate_((source, subscriber, environment) => {
2195
+ let previousKey;
2196
+ let first = true;
2197
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2198
+ next: value => {
2199
+ const currentKey = keySelector(value);
2200
+ if (first || !compare(previousKey, currentKey)) {
2201
+ first = false;
2202
+ previousKey = currentKey;
2203
+ subscriber.next(value);
2204
+ }
2415
2205
  }
2416
- }
2417
- }));
2418
- });
2206
+ }));
2207
+ })(fa);
2208
+ };
2419
2209
  }
2420
-
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]));
2210
+ function uniqueUntilKeyChanged(key, equals) {
2211
+ if ("equals" in equals) {
2212
+ return fa => uniqueUntilChanged_1((x, y) => equals.equals(y[key])(x[key]))(fa);
2213
+ } else {
2214
+ return fa => uniqueUntilChanged_1((x, y) => equals(x[key], y[key]))(fa);
2215
+ }
2424
2216
  }
2425
-
2426
- function combineLatestInternal(subscriber, observables, scheduler, valueTransform = tsplus_module_13.identity) {
2217
+ function combineLatestInternal(subscriber, environment, observables, scheduler, valueTransform = tsplus_module_13.identity) {
2427
2218
  return maybeSchedule(subscriber, scheduler, () => {
2428
2219
  const {
2429
2220
  length
@@ -2431,20 +2222,17 @@ function combineLatestInternal(subscriber, observables, scheduler, valueTransfor
2431
2222
  const values = new Array(length);
2432
2223
  let active = length;
2433
2224
  let remainingFirstValues = length;
2434
-
2435
2225
  for (let i = 0; i < length; i++) {
2436
2226
  maybeSchedule(subscriber, scheduler, () => {
2437
- const source = scheduler ? scheduled_1(observables[i], scheduler) : from_1(observables[i]);
2227
+ const source = scheduler ? scheduled_1(scheduler)(observables[i]) : from_1(observables[i]);
2438
2228
  let hasFirstValue = false;
2439
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2229
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2440
2230
  next: value => {
2441
2231
  values[i] = value;
2442
-
2443
2232
  if (!hasFirstValue) {
2444
2233
  hasFirstValue = true;
2445
2234
  remainingFirstValues--;
2446
2235
  }
2447
-
2448
2236
  if (!remainingFirstValues) {
2449
2237
  subscriber.next(valueTransform(values.slice()));
2450
2238
  }
@@ -2459,15 +2247,13 @@ function combineLatestInternal(subscriber, observables, scheduler, valueTransfor
2459
2247
  }
2460
2248
  });
2461
2249
  }
2462
-
2463
2250
  function findInternal(predicate, emit) {
2464
2251
  const findIndex = emit === "index";
2465
- return (source, subscriber) => {
2252
+ return (source, subscriber, environment) => {
2466
2253
  let index = 0;
2467
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2254
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2468
2255
  next: value => {
2469
2256
  const i = index++;
2470
-
2471
2257
  if (predicate(index++, value)) {
2472
2258
  subscriber.next(findIndex ? i : tsplus_module_17.just(value));
2473
2259
  subscriber.complete();
@@ -2480,11 +2266,9 @@ function findInternal(predicate, emit) {
2480
2266
  }));
2481
2267
  };
2482
2268
  }
2483
-
2484
2269
  function joinAllInternal(fa, joiner) {
2485
- return mergeMap_1(toArray_1(fa), joiner);
2270
+ return mergeMap_1(joiner)(toArray_1(fa));
2486
2271
  }
2487
-
2488
2272
  function maybeSchedule(subscription, scheduler, execute) {
2489
2273
  if (scheduler) {
2490
2274
  subscription.add(scheduler.schedule(execute));
@@ -2492,29 +2276,24 @@ function maybeSchedule(subscription, scheduler, execute) {
2492
2276
  execute();
2493
2277
  }
2494
2278
  }
2495
-
2496
- function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
2279
+ function mergeInternal(source, subscriber, environment, f, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
2497
2280
  const buffer = [];
2498
2281
  let active = 0;
2499
2282
  let index = 0;
2500
2283
  let isComplete = false;
2501
-
2502
2284
  const checkComplete = () => {
2503
2285
  if (isComplete && !buffer.length && !active) {
2504
2286
  subscriber.complete();
2505
2287
  }
2506
2288
  };
2507
-
2508
2289
  const outerNext = a => active < concurrent ? doInnerSub(a) : buffer.push(a);
2509
-
2510
2290
  const doInnerSub = a => {
2511
2291
  expand && subscriber.next(a);
2512
2292
  active++;
2513
2293
  let innerComplete = false;
2514
- from_1(f(index++, a)).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2294
+ from_1(f(index++, a)).provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2515
2295
  next: b => {
2516
2296
  onBeforeNext?.(b);
2517
-
2518
2297
  if (expand) {
2519
2298
  outerNext(b);
2520
2299
  } else {
@@ -2528,12 +2307,10 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
2528
2307
  if (innerComplete) {
2529
2308
  try {
2530
2309
  active--;
2531
-
2532
2310
  while (buffer.length && active < concurrent) {
2533
2311
  const bufferedValue = buffer.shift();
2534
2312
  innerSubScheduler ? subscriber.add(innerSubScheduler.schedule(() => doInnerSub(bufferedValue))) : doInnerSub(bufferedValue);
2535
2313
  }
2536
-
2537
2314
  checkComplete();
2538
2315
  } catch (err) {
2539
2316
  subscriber.error(tsplus_module_1.halt(err));
@@ -2541,8 +2318,7 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
2541
2318
  }
2542
2319
  }));
2543
2320
  };
2544
-
2545
- source.subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2321
+ source.provideEnvironment(environment).subscribe(new tsplus_module_8.OperatorSubscriber(subscriber, {
2546
2322
  next: outerNext,
2547
2323
  complete: () => {
2548
2324
  isComplete = true;
@@ -2553,13 +2329,12 @@ function mergeInternal(source, subscriber, f, concurrent, onBeforeNext, expand,
2553
2329
  additionalTeardown?.();
2554
2330
  };
2555
2331
  }
2556
-
2557
2332
  function scanInternal(f, initial, hasInitial, emitOnNext, emitBeforeComplete) {
2558
- return (source, subscriber) => {
2333
+ return (source, subscriber, environment) => {
2559
2334
  let hasState = hasInitial;
2560
2335
  let state = initial;
2561
2336
  let index = 0;
2562
- source.subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2337
+ source.provideEnvironment(environment).subscribe(tsplus_module_8.operatorSubscriber(subscriber, {
2563
2338
  next: value => {
2564
2339
  const i = index++;
2565
2340
  state = hasState ? f(i, state, value) : (hasState = true, value);