@fncts/observable 0.0.31 → 0.0.33

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