index.es.js.map 120 KB

1
  1. {"version":3,"file":"index.es.js","sources":["../src/fatalError.js","../src/scheduler/PropagateTask.js","../src/source/empty.js","../src/source/never.js","../src/source/at.js","../src/source/now.js","../src/source/periodic.js","../src/source/newStream.js","../src/sink/Pipe.js","../src/combinator/slice/bounds.js","../src/fusion/Filter.js","../src/fusion/FilterMap.js","../src/fusion/Map.js","../src/disposable/SettableDisposable.js","../src/combinator/slice/index.js","../src/combinator/zipItems.js","../src/runEffects.js","../src/run.js","../src/sink/RelativeSink.js","../src/combinator/withLocalTime.js","../src/combinator/loop.js","../src/combinator/scan.js","../src/combinator/continueWith.js","../src/combinator/startWith.js","../src/combinator/transform.js","../src/sink/IndexSink.js","../src/invoke.js","../src/combinator/combine.js","../src/combinator/applicative.js","../src/combinator/mergeConcurrently.js","../src/combinator/chain.js","../src/combinator/concatMap.js","../src/combinator/merge.js","../src/combinator/snapshot.js","../src/Queue.js","../src/combinator/zip.js","../src/combinator/switch.js","../src/combinator/filter.js","../src/combinator/timeslice.js","../src/combinator/delay.js","../src/combinator/limit.js","../src/combinator/promises.js","../src/sink/SafeSink.js","../src/source/tryEvent.js","../src/combinator/errors.js","../src/combinator/multicast.js","../src/index.js"],"sourcesContent":["/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nexport default function fatalError (e) {\n setTimeout(rethrow, 0, e)\n}\n\nfunction rethrow (e) {\n throw e\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport fatal from '../fatalError'\n\nexport const propagateTask = (run, value, sink) => new PropagateTask(run, value, sink)\n\nexport const propagateEventTask = (value, sink) => propagateTask(runEvent, value, sink)\n\nexport const propagateEndTask = sink => propagateTask(runEnd, undefined, sink)\n\nexport const propagateErrorTask = (value, sink) => propagateTask(runError, value, sink)\n\nexport class PropagateTask {\n constructor (run, value, sink) {\n this._run = run\n this.value = value\n this.sink = sink\n this.active = true\n }\n\n dispose () {\n this.active = false\n }\n\n run (t) {\n if (!this.active) {\n return\n }\n const run = this._run\n run(t, this.value, this.sink)\n }\n\n error (t, e) {\n // TODO: Remove this check and just do this.sink.error(t, e)?\n if (!this.active) {\n return fatal(e)\n }\n this.sink.error(t, e)\n }\n}\n\nconst runEvent = (t, x, sink) => sink.event(t, x)\n\nconst runEnd = (t, _, sink) => sink.end(t)\n\nconst runError = (t, e, sink) => sink.error(t, e)\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nimport { propagateEndTask } from '../scheduler/PropagateTask'\nimport { asap } from '@most/scheduler'\n\nexport const empty = () => EMPTY\n\nexport const isCanonicalEmpty = stream =>\n stream === EMPTY\n\nexport const containsCanonicalEmpty = streams =>\n streams.some(isCanonicalEmpty)\n\nclass Empty {\n run (sink, scheduler) {\n return asap(propagateEndTask(sink), scheduler)\n }\n}\n\nconst EMPTY = new Empty()\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nimport { disposeNone } from '@most/disposable'\n\nexport const never = () => NEVER\n\nclass Never {\n run () {\n return disposeNone()\n }\n}\n\nconst NEVER = new Never()\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nimport { propagateTask } from '../scheduler/PropagateTask'\nimport { delay } from '@most/scheduler'\n\nexport const at = (t, x) => new At(t, x)\n\nclass At {\n constructor (t, x) {\n this.time = t\n this.value = x\n }\n\n run (sink, scheduler) {\n return delay(this.time, propagateTask(runAt, this.value, sink), scheduler)\n }\n}\n\nfunction runAt (t, x, sink) {\n sink.event(t, x)\n sink.end(t)\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nimport { at } from './at'\n\nexport const now = x => at(0, x)\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport { propagateEventTask } from '../scheduler/PropagateTask'\nimport { periodic as schedulePeriodic } from '@most/scheduler'\n\n/**\n * Create a stream of events that occur at a regular period\n * @param {Number} period periodicity of events\n * @returns {Stream} new stream of periodic events, the event value is undefined\n */\nexport const periodic = period =>\n new Periodic(period)\n\nclass Periodic {\n constructor (period) {\n this.period = period\n }\n\n run (sink, scheduler) {\n return schedulePeriodic(this.period, propagateEventTask(undefined, sink), scheduler)\n }\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nexport const newStream = run => new Stream(run)\n\nclass Stream {\n constructor (run) {\n this.run = run\n }\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n/** @author Brian Cavalier */\n\nexport default class Pipe {\n constructor (sink) {\n this.sink = sink\n }\n\n event (t, x) {\n return this.sink.event(t, x)\n }\n\n end (t) {\n return this.sink.end(t)\n }\n\n error (t, e) {\n return this.sink.error(t, e)\n }\n}\n","/** @license MIT License (c) copyright 2010 original author or authors */\n\n// A slice Bounds type that narrows min values via accumulation\n// and max values via Math.min.\n// type Bounds = { min: number, max: number }\n// Notes:\n// 0 <= min <= max\n// slice(min2, max2, slice(min1, max1, s)) ~ slice(min1 + min2, Math.min(max1, min1 + max2), s)\n// A bounds has a 1d coord system with origin 0, extending to Infinity. Both min and max\n// are relative to the origin (0). However, when merging bounds b1 and b2, we\n// *interpret* b2 as being relative to b1, hence adding min1 to *both* min2 and max2.\n// This essentially translates b2's coordinates back into origin coordinates\n// as bounds are merged.\n\n// Construct a constrained bounds\nexport const boundsFrom = (unsafeMin, unsafeMax) => {\n const min = Math.max(0, unsafeMin)\n const max = Math.max(min, unsafeMax)\n return { min, max }\n}\n\n// Combine 2 bounds by narrowing min and max\nexport const mergeBounds = (b1, b2) =>\n boundsFrom(b1.min + b2.min, Math.min(b1.max, b1.min + b2.max))\n\n// Nil bounds excludes all slice indices\nexport const isNilBounds = b =>\n b.min >= b.max\n\n// Infinite bounds includes all slice indices\nexport const isInfiniteBounds = b =>\n b.min <= 0 && b.max === Infinity\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport { isCanonicalEmpty } from '../source/empty'\n\nexport default class Filter {\n constructor (p, source) {\n this.p = p\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new FilterSink(this.p, sink), scheduler)\n }\n\n /**\n * Create a filtered source, fusing adjacent filter.filter if possible\n * @param {function(x:*):boolean} p filtering predicate\n * @param {{run:function}} source source to filter\n * @returns {Filter} filtered source\n */\n static create (p, source) {\n if (isCanonicalEmpty(source)) {\n return source\n }\n\n if (source instanceof Filter) {\n return new Filter(and(source.p, p), source.source)\n }\n\n return new Filter(p, source)\n }\n}\n\nclass FilterSink extends Pipe {\n constructor (p, sink) {\n super(sink)\n this.p = p\n }\n\n event (t, x) {\n const p = this.p\n p(x) && this.sink.event(t, x)\n }\n}\n\nconst and = (p, q) => x => p(x) && q(x)\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\n\nexport default class FilterMap {\n constructor (p, f, source) {\n this.p = p\n this.f = f\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new FilterMapSink(this.p, this.f, sink), scheduler)\n }\n}\n\nclass FilterMapSink extends Pipe {\n constructor (p, f, sink) {\n super(sink)\n this.p = p\n this.f = f\n }\n\n event (t, x) {\n const f = this.f\n const p = this.p\n p(x) && this.sink.event(t, f(x))\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport Filter from './Filter'\nimport FilterMap from './FilterMap'\nimport { compose } from '@most/prelude'\nimport { isCanonicalEmpty, empty } from '../source/empty'\n\nexport default class Map {\n constructor (f, source) {\n this.f = f\n this.source = source\n }\n\n run (sink, scheduler) { // eslint-disable-line no-extend-native\n return this.source.run(new MapSink(this.f, sink), scheduler)\n }\n\n /**\n * Create a mapped source, fusing adjacent map.map, filter.map,\n * and filter.map.map if possible\n * @param {function(*):*} f mapping function\n * @param {{run:function}} source source to map\n * @returns {Map|FilterMap} mapped source, possibly fused\n */\n static create (f, source) {\n if (isCanonicalEmpty(source)) {\n return empty()\n }\n\n if (source instanceof Map) {\n return new Map(compose(f, source.f), source.source)\n }\n\n if (source instanceof Filter) {\n return new FilterMap(source.p, f, source.source)\n }\n\n return new Map(f, source)\n }\n}\n\nclass MapSink extends Pipe {\n constructor (f, sink) {\n super(sink)\n this.f = f\n }\n\n event (t, x) {\n const f = this.f\n this.sink.event(t, f(x))\n }\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nexport default class SettableDisposable {\n constructor () {\n this.disposable = undefined\n this.disposed = false\n }\n\n setDisposable (disposable) {\n if (this.disposable !== void 0) {\n throw new Error('setDisposable called more than once')\n }\n\n this.disposable = disposable\n\n if (this.disposed) {\n disposable.dispose()\n }\n }\n\n dispose () {\n if (this.disposed) {\n return\n }\n\n this.disposed = true\n\n if (this.disposable !== void 0) {\n this.disposable.dispose()\n }\n }\n}\n","import { empty, isCanonicalEmpty } from '../../source/empty'\nimport { boundsFrom, isNilBounds, isInfiniteBounds, mergeBounds } from './bounds'\nimport Map from '../../fusion/Map'\nimport Pipe from '../../sink/Pipe'\nimport SettableDisposable from '../../disposable/SettableDisposable'\n\n/**\n * @param {number} n\n * @param {Stream} stream\n * @returns {Stream} new stream containing only up to the first n items from stream\n */\nexport const take = (n, stream) =>\n slice(0, n, stream)\n\n/**\n * @param {number} n\n * @param {Stream} stream\n * @returns {Stream} new stream with the first n items removed\n */\nexport const skip = (n, stream) =>\n slice(n, Infinity, stream)\n\n/**\n * Slice a stream by index. Negative start/end indexes are not supported\n * @param {number} start\n * @param {number} end\n * @param {Stream} stream\n * @returns {Stream} stream containing items where start <= index < end\n */\nexport const slice = (start, end, stream) =>\n sliceBounds(boundsFrom(start, end), stream)\n\nconst sliceBounds = (bounds, stream) =>\n isSliceEmpty(bounds, stream) ? empty()\n : stream instanceof Map ? commuteMapSlice(bounds, stream)\n : stream instanceof Slice ? fuseSlice(bounds, stream)\n : createSlice(bounds, stream)\n\nconst isSliceEmpty = (bounds, stream) =>\n isCanonicalEmpty(stream) || isNilBounds(bounds)\n\nconst createSlice = (bounds, stream) =>\n isInfiniteBounds(bounds) ? stream : new Slice(bounds, stream)\n\nconst commuteMapSlice = (bounds, mapStream) =>\n Map.create(mapStream.f, sliceBounds(bounds, mapStream.source))\n\nconst fuseSlice = (bounds, sliceStream) =>\n sliceBounds(mergeBounds(sliceStream.bounds, bounds), sliceStream.source)\n\nclass Slice {\n constructor (bounds, source) {\n this.source = source\n this.bounds = bounds\n }\n\n run (sink, scheduler) {\n const disposable = new SettableDisposable()\n const sliceSink = new SliceSink(this.bounds.min, this.bounds.max - this.bounds.min, sink, disposable)\n\n disposable.setDisposable(this.source.run(sliceSink, scheduler))\n\n return disposable\n }\n}\n\nclass SliceSink extends Pipe {\n constructor (skip, take, sink, disposable) {\n super(sink)\n this.skip = skip\n this.take = take\n this.disposable = disposable\n }\n\n event (t, x) {\n /* eslint complexity: [1, 4] */\n if (this.skip > 0) {\n this.skip -= 1\n return\n }\n\n if (this.take === 0) {\n return\n }\n\n this.take -= 1\n this.sink.event(t, x)\n if (this.take === 0) {\n this.disposable.dispose()\n this.sink.end(t)\n }\n }\n}\n\nexport const takeWhile = (p, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new TakeWhile(p, stream)\n\nclass TakeWhile {\n constructor (p, source) {\n this.p = p\n this.source = source\n }\n\n run (sink, scheduler) {\n const disposable = new SettableDisposable()\n const takeWhileSink = new TakeWhileSink(this.p, sink, disposable)\n\n disposable.setDisposable(this.source.run(takeWhileSink, scheduler))\n\n return disposable\n }\n}\n\nclass TakeWhileSink extends Pipe {\n constructor (p, sink, disposable) {\n super(sink)\n this.p = p\n this.active = true\n this.disposable = disposable\n }\n\n event (t, x) {\n if (!this.active) {\n return\n }\n\n const p = this.p\n this.active = p(x)\n\n if (this.active) {\n this.sink.event(t, x)\n } else {\n this.disposable.dispose()\n this.sink.end(t)\n }\n }\n}\n\nexport const skipWhile = (p, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new SkipWhile(p, stream)\n\nclass SkipWhile {\n constructor (p, source) {\n this.p = p\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new SkipWhileSink(this.p, sink), scheduler)\n }\n}\n\nclass SkipWhileSink extends Pipe {\n constructor (p, sink) {\n super(sink)\n this.p = p\n this.skipping = true\n }\n\n event (t, x) {\n if (this.skipping) {\n const p = this.p\n this.skipping = p(x)\n if (this.skipping) {\n return\n }\n }\n\n this.sink.event(t, x)\n }\n}\n\nexport const skipAfter = (p, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new SkipAfter(p, stream)\n\nclass SkipAfter {\n constructor (p, source) {\n this.p = p\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new SkipAfterSink(this.p, sink), scheduler)\n }\n}\n\nclass SkipAfterSink extends Pipe {\n constructor (p, sink) {\n super(sink)\n this.p = p\n this.skipping = false\n }\n\n event (t, x) {\n if (this.skipping) {\n return\n }\n\n const p = this.p\n this.skipping = p(x)\n this.sink.event(t, x)\n\n if (this.skipping) {\n this.sink.end(t)\n }\n }\n}\n","/** @license MIT License (c) copyright 2017 original author or authors */\n\nimport Pipe from '../sink/Pipe'\nimport { empty, isCanonicalEmpty } from '../source/empty'\nimport { take } from './slice'\n\nexport const withItems = (items, stream) =>\n zipItems(keepLeft, items, stream)\n\nexport const zipItems = (f, items, stream) =>\n isCanonicalEmpty(stream) || items.length === 0\n ? empty()\n : new ZipItems(f, items, take(items.length, stream))\n\nconst keepLeft = (a, _) => a\n\nclass ZipItems {\n constructor (f, items, source) {\n this.f = f\n this.items = items\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new ZipItemsSink(this.f, this.items, sink), scheduler)\n }\n}\n\nclass ZipItemsSink extends Pipe {\n constructor (f, items, sink) {\n super(sink)\n this.f = f\n this.items = items\n this.index = 0\n }\n\n event (t, b) {\n const f = this.f\n this.sink.event(t, f(this.items[this.index], b))\n this.index += 1\n }\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nimport { curry2 } from '@most/prelude'\nimport SettableDisposable from './disposable/SettableDisposable'\n\nexport const runEffects = curry2((stream, scheduler) =>\n new Promise((resolve, reject) =>\n runStream(stream, scheduler, resolve, reject)))\n\nfunction runStream (stream, scheduler, resolve, reject) {\n const disposable = new SettableDisposable()\n const observer = new RunEffectsSink(resolve, reject, disposable)\n\n disposable.setDisposable(stream.run(observer, scheduler))\n}\n\nclass RunEffectsSink {\n constructor (end, error, disposable) {\n this._end = end\n this._error = error\n this._disposable = disposable\n this.active = true\n }\n\n event (t, x) {}\n\n end (t) {\n if (!this.active) {\n return\n }\n this._dispose(this._error, this._end, undefined)\n }\n\n error (t, e) {\n this._dispose(this._error, this._error, e)\n }\n\n _dispose (error, end, x) {\n this.active = false\n tryDispose(error, end, x, this._disposable)\n }\n}\n\nfunction tryDispose (error, end, x, disposable) {\n try {\n disposable.dispose()\n } catch (e) {\n error(e)\n return\n }\n\n end(x)\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\n// Run a Stream, sending all its events to the\n// provided Sink.\nexport const run = (sink, scheduler, stream) =>\n stream.run(sink, scheduler)\n","export default class RelativeSink {\n constructor (offset, sink) {\n this.sink = sink\n this.offset = offset\n }\n\n event (t, x) {\n this.sink.event(t + this.offset, x)\n }\n\n error (t, e) {\n this.sink.error(t + this.offset, e)\n }\n\n end (t) {\n this.sink.end(t + this.offset)\n }\n}\n","import RelativeSink from '../sink/RelativeSink'\nimport { schedulerRelativeTo } from '@most/scheduler'\n\n// Create a stream with its own local clock\n// This transforms time from the provided scheduler's clock to a stream-local\n// clock (which starts at 0), and then *back* to the scheduler's clock before\n// propagating events to sink. In other words, upstream sources will see local times,\n// and downstream sinks will see non-local (original) times.\nexport const withLocalTime = (origin, stream) =>\n new WithLocalTime(origin, stream)\n\nclass WithLocalTime {\n constructor (origin, source) {\n this.origin = origin\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(relativeSink(this.origin, sink), schedulerRelativeTo(this.origin, scheduler))\n }\n}\n\n// Accumulate offsets instead of nesting RelativeSinks, which can happen\n// with higher-order stream and combinators like continueWith when they're\n// applied recursively.\nexport const relativeSink = (origin, sink) =>\n sink instanceof RelativeSink\n ? new RelativeSink(origin + sink.offset, sink.sink)\n : new RelativeSink(origin, sink)\n","/** @license MIT License (c) copyright 2010 original author or authors */\n\nimport Pipe from '../sink/Pipe'\nimport { empty, isCanonicalEmpty } from '../source/empty'\n\n/**\n * Generalized feedback loop. Call a stepper function for each event. The stepper\n * will be called with 2 params: the current seed and the an event value. It must\n * return a new { seed, value } pair. The `seed` will be fed back into the next\n * invocation of stepper, and the `value` will be propagated as the event value.\n * @param {function(seed:*, value:*):{seed:*, value:*}} stepper loop step function\n * @param {*} seed initial seed value passed to first stepper call\n * @param {Stream} stream event stream\n * @returns {Stream} new stream whose values are the `value` field of the objects\n * returned by the stepper\n */\nexport const loop = (stepper, seed, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new Loop(stepper, seed, stream)\n\nclass Loop {\n constructor (stepper, seed, source) {\n this.step = stepper\n this.seed = seed\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new LoopSink(this.step, this.seed, sink), scheduler)\n }\n}\n\nclass LoopSink extends Pipe {\n constructor (stepper, seed, sink) {\n super(sink)\n this.step = stepper\n this.seed = seed\n }\n\n event (t, x) {\n const result = this.step(this.seed, x)\n this.seed = result.seed\n this.sink.event(t, result.value)\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport { disposeBoth } from '@most/disposable'\nimport { asap } from '@most/scheduler'\nimport { propagateEventTask } from '../scheduler/PropagateTask'\n\n/**\n * Create a stream containing successive reduce results of applying f to\n * the previous reduce result and the current stream item.\n * @param {function(result:*, x:*):*} f reducer function\n * @param {*} initial initial value\n * @param {Stream} stream stream to scan\n * @returns {Stream} new stream containing successive reduce results\n */\nexport const scan = (f, initial, stream) =>\n new Scan(f, initial, stream)\n\nclass Scan {\n constructor (f, z, source) {\n this.source = source\n this.f = f\n this.value = z\n }\n\n run (sink, scheduler) {\n const d1 = asap(propagateEventTask(this.value, sink), scheduler)\n const d2 = this.source.run(new ScanSink(this.f, this.value, sink), scheduler)\n return disposeBoth(d1, d2)\n }\n}\n\nclass ScanSink extends Pipe {\n constructor (f, z, sink) {\n super(sink)\n this.f = f\n this.value = z\n }\n\n event (t, x) {\n const f = this.f\n this.value = f(this.value, x)\n this.sink.event(t, this.value)\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport { run } from '../run'\nimport { withLocalTime } from '../combinator/withLocalTime'\nimport { disposeOnce, tryDispose } from '@most/disposable'\n\nexport const continueWith = (f, stream) =>\n new ContinueWith(f, stream)\n\nclass ContinueWith {\n constructor (f, source) {\n this.f = f\n this.source = source\n }\n\n run (sink, scheduler) {\n return new ContinueWithSink(this.f, this.source, sink, scheduler)\n }\n}\n\nclass ContinueWithSink extends Pipe {\n constructor (f, source, sink, scheduler) {\n super(sink)\n this.f = f\n this.scheduler = scheduler\n this.active = true\n this.disposable = disposeOnce(source.run(this, scheduler))\n }\n\n event (t, x) {\n if (!this.active) {\n return\n }\n this.sink.event(t, x)\n }\n\n end (t) {\n if (!this.active) {\n return\n }\n\n tryDispose(t, this.disposable, this.sink)\n\n this._startNext(t, this.sink)\n }\n\n _startNext (t, sink) {\n try {\n this.disposable = this._continue(this.f, t, sink)\n } catch (e) {\n sink.error(t, e)\n }\n }\n\n _continue (f, t, sink) {\n return run(sink, this.scheduler, withLocalTime(t, f()))\n }\n\n dispose () {\n this.active = false\n return this.disposable.dispose()\n }\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nimport { now } from '../source/now'\nimport { continueWith } from './continueWith'\n\nexport const startWith = (x, stream) =>\n continueWith(() => stream, now(x))\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Map from '../fusion/Map'\nimport Pipe from '../sink/Pipe'\n\n/**\n * Transform each value in the stream by applying f to each\n * @param {function(*):*} f mapping function\n * @param {Stream} stream stream to map\n * @returns {Stream} stream containing items transformed by f\n */\nexport const map = (f, stream) =>\n Map.create(f, stream)\n\n/**\n* Replace each value in the stream with x\n* @param {*} x\n* @param {Stream} stream\n* @returns {Stream} stream containing items replaced with x\n*/\nexport const constant = (x, stream) =>\n map(() => x, stream)\n\n/**\n* Perform a side effect for each item in the stream\n* @param {function(x:*):*} f side effect to execute for each item. The\n* return value will be discarded.\n* @param {Stream} stream stream to tap\n* @returns {Stream} new stream containing the same items as this stream\n*/\nexport const tap = (f, stream) =>\n new Tap(f, stream)\n\nclass Tap {\n constructor (f, source) {\n this.source = source\n this.f = f\n }\n\n run (sink, scheduler) {\n return this.source.run(new TapSink(this.f, sink), scheduler)\n }\n}\n\nclass TapSink extends Pipe {\n constructor (f, sink) {\n super(sink)\n this.f = f\n }\n\n event (t, x) {\n const f = this.f\n f(x)\n this.sink.event(t, x)\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Sink from './Pipe'\n\nexport default class IndexSink extends Sink {\n constructor (i, sink) {\n super(sink)\n this.index = i\n this.active = true\n this.value = undefined\n }\n\n event (t, x) {\n if (!this.active) {\n return\n }\n this.value = x\n this.sink.event(t, this)\n }\n\n end (t) {\n if (!this.active) {\n return\n }\n this.active = false\n this.sink.event(t, this)\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nexport default function invoke (f, args) {\n /* eslint complexity: [2,7] */\n switch (args.length) {\n case 0: return f()\n case 1: return f(args[0])\n case 2: return f(args[0], args[1])\n case 3: return f(args[0], args[1], args[2])\n case 4: return f(args[0], args[1], args[2], args[3])\n case 5: return f(args[0], args[1], args[2], args[3], args[4])\n default:\n return f.apply(void 0, args)\n }\n}\n","/** @license MIT License (c) copyright 2010 original author or authors */\n\nimport { map } from './transform'\nimport { empty, containsCanonicalEmpty } from '../source/empty'\nimport Pipe from '../sink/Pipe'\nimport IndexSink from '../sink/IndexSink'\nimport { disposeAll, tryDispose } from '@most/disposable'\nimport invoke from '../invoke'\n\n/**\n * Combine latest events from two streams\n * @param {function(...events):*} f function to combine most recent events\n * @returns {Stream} stream containing the result of applying f to the most recent\n * event of each input stream, whenever a new event arrives on any stream.\n */\nexport const combine = (f, stream1, stream2) =>\n combineArray(f, [stream1, stream2])\n\n/**\n* Combine latest events from all input streams\n* @param {function(...events):*} f function to combine most recent events\n* @param {[Stream]} streams most recent events\n* @returns {Stream} stream containing the result of applying f to the most recent\n* event of each input stream, whenever a new event arrives on any stream.\n*/\nexport const combineArray = (f, streams) =>\n streams.length === 0 || containsCanonicalEmpty(streams) ? empty()\n : streams.length === 1 ? map(f, streams[0])\n : new Combine(f, streams)\n\nclass Combine {\n constructor (f, sources) {\n this.f = f\n this.sources = sources\n }\n\n run (sink, scheduler) {\n const l = this.sources.length\n const disposables = new Array(l)\n const sinks = new Array(l)\n\n const mergeSink = new CombineSink(disposables, sinks, sink, this.f)\n\n for (let indexSink, i = 0; i < l; ++i) {\n indexSink = sinks[i] = new IndexSink(i, mergeSink)\n disposables[i] = this.sources[i].run(indexSink, scheduler)\n }\n\n return disposeAll(disposables)\n }\n}\n\nclass CombineSink extends Pipe {\n constructor (disposables, sinks, sink, f) {\n super(sink)\n this.disposables = disposables\n this.sinks = sinks\n this.f = f\n\n const l = sinks.length\n this.awaiting = l\n this.values = new Array(l)\n this.hasValue = new Array(l).fill(false)\n this.activeCount = sinks.length\n }\n\n event (t, indexedValue) {\n if (!indexedValue.active) {\n this._dispose(t, indexedValue.index)\n return\n }\n\n const i = indexedValue.index\n const awaiting = this._updateReady(i)\n\n this.values[i] = indexedValue.value\n if (awaiting === 0) {\n this.sink.event(t, invoke(this.f, this.values))\n }\n }\n\n _updateReady (index) {\n if (this.awaiting > 0) {\n if (!this.hasValue[index]) {\n this.hasValue[index] = true\n this.awaiting -= 1\n }\n }\n return this.awaiting\n }\n\n _dispose (t, index) {\n tryDispose(t, this.disposables[index], this.sink)\n if (--this.activeCount === 0) {\n this.sink.end(t)\n }\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport { combine } from './combine'\nimport { apply } from '@most/prelude'\n\n/**\n * Assume fs is a stream containing functions, and apply the latest function\n * in fs to the latest value in xs.\n * fs: --f---------g--------h------>\n * xs: -a-------b-------c-------d-->\n * ap(fs, xs): --fa-----fb-gb---gc--hc--hd->\n * @param {Stream} fs stream of functions to apply to the latest x\n * @param {Stream} xs stream of values to which to apply all the latest f\n * @returns {Stream} stream containing all the applications of fs to xs\n */\nexport function ap (fs, xs) {\n return combine(apply, fs, xs)\n}\n","/** @license MIT License (c) copyright 2010 original author or authors */\n\nimport { disposeAll, disposeNone, disposeOnce, tryDispose } from '@most/disposable'\nimport { empty, isCanonicalEmpty } from '../source/empty'\nimport { id as identity } from '@most/prelude'\nimport { schedulerRelativeTo } from '@most/scheduler'\n\nexport const mergeConcurrently = (concurrency, stream) =>\n mergeMapConcurrently(identity, concurrency, stream)\n\nexport const mergeMapConcurrently = (f, concurrency, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new MergeConcurrently(f, concurrency, stream)\n\nclass MergeConcurrently {\n constructor (f, concurrency, source) {\n this.f = f\n this.concurrency = concurrency\n this.source = source\n }\n\n run (sink, scheduler) {\n return new Outer(this.f, this.concurrency, this.source, sink, scheduler)\n }\n}\n\nclass Outer {\n constructor (f, concurrency, source, sink, scheduler) {\n this.f = f\n this.concurrency = concurrency\n this.sink = sink\n this.scheduler = scheduler\n this.pending = []\n this.current = []\n this.disposable = disposeOnce(source.run(this, scheduler))\n this.active = true\n }\n\n event (t, x) {\n this._addInner(t, x)\n }\n\n _addInner (t, x) {\n if (this.current.length < this.concurrency) {\n this._startInner(t, x)\n } else {\n this.pending.push(x)\n }\n }\n\n _startInner (t, x) {\n try {\n this._initInner(t, x)\n } catch (e) {\n this.error(t, e)\n }\n }\n\n _initInner (t, x) {\n const innerSink = new Inner(t, this, this.sink)\n innerSink.disposable = mapAndRun(this.f, t, x, innerSink, this.scheduler)\n this.current.push(innerSink)\n }\n\n end (t) {\n this.active = false\n tryDispose(t, this.disposable, this.sink)\n this._checkEnd(t)\n }\n\n error (t, e) {\n this.active = false\n this.sink.error(t, e)\n }\n\n dispose () {\n this.active = false\n this.pending.length = 0\n this.disposable.dispose()\n disposeAll(this.current).dispose()\n }\n\n _endInner (t, inner) {\n const i = this.current.indexOf(inner)\n if (i >= 0) {\n this.current.splice(i, 1)\n }\n tryDispose(t, inner, this)\n\n if (this.pending.length === 0) {\n this._checkEnd(t)\n } else {\n this._startInner(t, this.pending.shift())\n }\n }\n\n _checkEnd (t) {\n if (!this.active && this.current.length === 0) {\n this.sink.end(t)\n }\n }\n}\n\nconst mapAndRun = (f, t, x, sink, scheduler) =>\n f(x).run(sink, schedulerRelativeTo(t, scheduler))\n\nclass Inner {\n constructor (time, outer, sink) {\n this.time = time\n this.outer = outer\n this.sink = sink\n this.disposable = disposeNone()\n }\n\n event (t, x) {\n this.sink.event(t + this.time, x)\n }\n\n end (t) {\n this.outer._endInner(t + this.time, this)\n }\n\n error (t, e) {\n this.outer.error(t + this.time, e)\n }\n\n dispose () {\n return this.disposable.dispose()\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport { mergeConcurrently, mergeMapConcurrently } from './mergeConcurrently'\n\n/**\n * Map each value in the stream to a new stream, and merge it into the\n * returned outer stream. Event arrival times are preserved.\n * @param {function(x:*):Stream} f chaining function, must return a Stream\n * @param {Stream} stream\n * @returns {Stream} new stream containing all events from each stream returned by f\n */\nexport const chain = (f, stream) => mergeMapConcurrently(f, Infinity, stream)\n\n/**\n * Monadic join. Flatten a Stream<Stream<X>> to Stream<X> by merging inner\n * streams to the outer. Event arrival times are preserved.\n * @param {Stream<Stream<X>>} stream stream of streams\n * @returns {Stream<X>} new stream containing all events of all inner streams\n */\nexport const join = stream => mergeConcurrently(Infinity, stream)\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport { mergeMapConcurrently } from './mergeConcurrently'\n\n/**\n * Map each value in stream to a new stream, and concatenate them all\n * stream: -a---b---cX\n * f(a): 1-1-1-1X\n * f(b): -2-2-2-2X\n * f(c): -3-3-3-3X\n * stream.concatMap(f): -1-1-1-1-2-2-2-2-3-3-3-3X\n * @param {function(x:*):Stream} f function to map each value to a stream\n * @param {Stream} stream\n * @returns {Stream} new stream containing all events from each stream returned by f\n */\nexport const concatMap = (f, stream) =>\n mergeMapConcurrently(f, 1, stream)\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport IndexSink from '../sink/IndexSink'\nimport { empty, isCanonicalEmpty } from '../source/empty'\nimport { disposeAll, tryDispose } from '@most/disposable'\nimport { reduce } from '@most/prelude'\n\n/**\n * @returns {Stream} stream containing events from two streams in time order.\n * If two events are simultaneous they will be merged in arbitrary order.\n */\nexport function merge (stream1, stream2) {\n return mergeArray([stream1, stream2])\n}\n\n/**\n * @param {Array} streams array of stream to merge\n * @returns {Stream} stream containing events from all input observables\n * in time order. If two events are simultaneous they will be merged in\n * arbitrary order.\n */\nexport const mergeArray = streams =>\n mergeStreams(withoutCanonicalEmpty(streams))\n\n/**\n * This implements fusion/flattening for merge. It will\n * fuse adjacent merge operations. For example:\n * - a.merge(b).merge(c) effectively becomes merge(a, b, c)\n * - merge(a, merge(b, c)) effectively becomes merge(a, b, c)\n * It does this by concatenating the sources arrays of\n * any nested Merge sources, in effect \"flattening\" nested\n * merge operations into a single merge.\n */\nconst mergeStreams = streams =>\n streams.length === 0 ? empty()\n : streams.length === 1 ? streams[0]\n : new Merge(reduce(appendSources, [], streams))\n\nconst withoutCanonicalEmpty = streams =>\n streams.filter(isNotCanonicalEmpty)\n\nconst isNotCanonicalEmpty = stream =>\n !isCanonicalEmpty(stream)\n\nconst appendSources = (sources, stream) =>\n sources.concat(stream instanceof Merge ? stream.sources : stream)\n\nclass Merge {\n constructor (sources) {\n this.sources = sources\n }\n\n run (sink, scheduler) {\n const l = this.sources.length\n const disposables = new Array(l)\n const sinks = new Array(l)\n\n const mergeSink = new MergeSink(disposables, sinks, sink)\n\n for (let indexSink, i = 0; i < l; ++i) {\n indexSink = sinks[i] = new IndexSink(i, mergeSink)\n disposables[i] = this.sources[i].run(indexSink, scheduler)\n }\n\n return disposeAll(disposables)\n }\n}\n\nclass MergeSink extends Pipe {\n constructor (disposables, sinks, sink) {\n super(sink)\n this.disposables = disposables\n this.activeCount = sinks.length\n }\n\n event (t, indexValue) {\n if (!indexValue.active) {\n this._dispose(t, indexValue.index)\n return\n }\n this.sink.event(t, indexValue.value)\n }\n\n _dispose (t, index) {\n tryDispose(t, this.disposables[index], this.sink)\n if (--this.activeCount === 0) {\n this.sink.end(t)\n }\n }\n}\n","/** @license MIT License (c) copyright 2010 original author or authors */\n\nimport Pipe from '../sink/Pipe'\nimport { disposeBoth } from '@most/disposable'\nimport { empty, isCanonicalEmpty } from '../source/empty'\n\nexport const sample = (values, sampler) =>\n snapshot((x, _) => x, values, sampler)\n\nexport const snapshot = (f, values, sampler) =>\n isCanonicalEmpty(sampler) || isCanonicalEmpty(values)\n ? empty()\n : new Snapshot(f, values, sampler)\n\nexport class Snapshot {\n constructor (f, values, sampler) {\n this.f = f\n this.values = values\n this.sampler = sampler\n }\n\n run (sink, scheduler) {\n const sampleSink = new SnapshotSink(this.f, sink)\n const valuesDisposable = this.values.run(sampleSink.latest, scheduler)\n const samplerDisposable = this.sampler.run(sampleSink, scheduler)\n\n return disposeBoth(samplerDisposable, valuesDisposable)\n }\n}\n\nexport class SnapshotSink extends Pipe {\n constructor (f, sink) {\n super(sink)\n this.f = f\n this.latest = new LatestValueSink(this)\n }\n\n event (t, x) {\n if (this.latest.hasValue) {\n const f = this.f\n this.sink.event(t, f(this.latest.value, x))\n }\n }\n}\n\nexport class LatestValueSink extends Pipe {\n constructor (sink) {\n super(sink)\n this.hasValue = false\n }\n\n event (t, x) {\n this.value = x\n this.hasValue = true\n }\n\n end () {}\n}\n","// Copied and modified from https://github.com/invertase/denque\n// MIT License\n\n// These constants were extracted directly from denque's shift()\n// It's not clear exactly why the authors chose these particular\n// values, but given denque's stated goals, it seems likely that\n// they were chosen for speed/memory reasons.\n\n// Max value of _head at which Queue is willing to shink\n// its internal array\nconst HEAD_MAX_SHRINK = 2\n\n// Min value of _tail at which Queue is willing to shink\n// its internal array\nconst TAIL_MIN_SHRINK = 10000\n\nexport default class Queue {\n constructor () {\n this._head = 0\n this._tail = 0\n this._capacityMask = 0x3\n this._list = new Array(4)\n }\n\n push (x) {\n const tail = this._tail\n this._list[tail] = x\n this._tail = (tail + 1) & this._capacityMask\n if (this._tail === this._head) {\n this._growArray()\n }\n\n if (this._head < this._tail) {\n return this._tail - this._head\n } else {\n return this._capacityMask + 1 - (this._head - this._tail)\n }\n }\n\n shift () {\n const head = this._head\n if (head === this._tail) {\n return undefined\n }\n\n const x = this._list[head]\n this._list[head] = undefined\n this._head = (head + 1) & this._capacityMask\n if (head < HEAD_MAX_SHRINK &&\n this._tail > TAIL_MIN_SHRINK &&\n this._tail <= this._list.length >>> 2) {\n this._shrinkArray()\n }\n\n return x\n }\n\n isEmpty () {\n return this._head === this._tail\n }\n\n length () {\n if (this._head === this._tail) {\n return 0\n } else if (this._head < this._tail) {\n return this._tail - this._head\n } else {\n return this._capacityMask + 1 - (this._head - this._tail)\n }\n }\n\n _growArray () {\n if (this._head) {\n // copy existing data, head to end, then beginning to tail.\n this._list = this._copyArray()\n this._head = 0\n }\n\n // head is at 0 and array is now full, safe to extend\n this._tail = this._list.length\n\n this._list.length *= 2\n this._capacityMask = (this._capacityMask << 1) | 1\n }\n\n _shrinkArray () {\n this._list.length >>>= 1\n this._capacityMask >>>= 1\n }\n\n _copyArray () {\n const newArray = []\n const list = this._list\n const len = list.length\n\n let i\n for (i = this._head; i < len; i++) {\n newArray.push(list[i])\n }\n for (i = 0; i < this._tail; i++) {\n newArray.push(list[i])\n }\n\n return newArray\n }\n}\n","/** @license MIT License (c) copyright 2010 original author or authors */\n\nimport { map } from './transform'\nimport { empty, containsCanonicalEmpty } from '../source/empty'\nimport Pipe from '../sink/Pipe'\nimport IndexSink from '../sink/IndexSink'\nimport { disposeAll } from '@most/disposable'\nimport { map as mapArray } from '@most/prelude'\nimport invoke from '../invoke'\nimport Queue from '../Queue'\n\n/**\n * Combine two streams pairwise by index by applying f to values at corresponding\n * indices. The returned stream ends when either of the input streams ends.\n * @param {function} f function to combine values\n * @returns {Stream} new stream with items at corresponding indices combined\n * using f\n */\nexport function zip (f, stream1, stream2) {\n return zipArray(f, [stream1, stream2])\n}\n\n/**\n* Combine streams pairwise (or tuple-wise) by index by applying f to values\n* at corresponding indices. The returned stream ends when any of the input\n* streams ends.\n* @param {function} f function to combine values\n* @param {[Stream]} streams streams to zip using f\n* @returns {Stream} new stream with items at corresponding indices combined\n* using f\n*/\nexport const zipArray = (f, streams) =>\n streams.length === 0 || containsCanonicalEmpty(streams) ? empty()\n : streams.length === 1 ? map(f, streams[0])\n : new Zip(f, streams)\n\nclass Zip {\n constructor (f, sources) {\n this.f = f\n this.sources = sources\n }\n\n run (sink, scheduler) {\n const l = this.sources.length\n const disposables = new Array(l)\n const sinks = new Array(l)\n const buffers = new Array(l)\n\n const zipSink = new ZipSink(this.f, buffers, sinks, sink)\n\n for (let indexSink, i = 0; i < l; ++i) {\n buffers[i] = new Queue()\n indexSink = sinks[i] = new IndexSink(i, zipSink)\n disposables[i] = this.sources[i].run(indexSink, scheduler)\n }\n\n return disposeAll(disposables)\n }\n}\n\nclass ZipSink extends Pipe {\n constructor (f, buffers, sinks, sink) {\n super(sink)\n this.f = f\n this.sinks = sinks\n this.buffers = buffers\n }\n\n event (t, indexedValue) {\n /* eslint complexity: [1, 5] */\n if (!indexedValue.active) {\n this._dispose(t, indexedValue.index)\n return\n }\n\n const buffers = this.buffers\n const buffer = buffers[indexedValue.index]\n\n buffer.push(indexedValue.value)\n\n if (buffer.length() === 1) {\n if (!ready(this.buffers)) {\n return\n }\n\n emitZipped(this.f, t, buffers, this.sink)\n\n if (ended(this.buffers, this.sinks)) {\n this.sink.end(t)\n }\n }\n }\n\n _dispose (t, index) {\n const buffer = this.buffers[index]\n if (buffer.isEmpty()) {\n this.sink.end(t)\n }\n }\n}\n\nconst emitZipped = (f, t, buffers, sink) =>\n sink.event(t, invoke(f, mapArray(head, buffers)))\n\nconst head = buffer => buffer.shift()\n\nfunction ended (buffers, sinks) {\n for (let i = 0, l = buffers.length; i < l; ++i) {\n if (buffers[i].isEmpty() && !sinks[i].active) {\n return true\n }\n }\n return false\n}\n\nfunction ready (buffers) {\n for (let i = 0, l = buffers.length; i < l; ++i) {\n if (buffers[i].isEmpty()) {\n return false\n }\n }\n return true\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport { disposeBoth, tryDispose } from '@most/disposable'\nimport { schedulerRelativeTo, currentTime } from '@most/scheduler'\nimport { empty, isCanonicalEmpty } from '../source/empty'\n\n/**\n * Given a stream of streams, return a new stream that adopts the behavior\n * of the most recent inner stream.\n * @param {Stream} stream of streams on which to switch\n * @returns {Stream} switching stream\n */\nexport const switchLatest = stream =>\n isCanonicalEmpty(stream)\n ? empty()\n : new Switch(stream)\n\nclass Switch {\n constructor (source) {\n this.source = source\n }\n\n run (sink, scheduler) {\n const switchSink = new SwitchSink(sink, scheduler)\n return disposeBoth(switchSink, this.source.run(switchSink, scheduler))\n }\n}\n\nclass SwitchSink {\n constructor (sink, scheduler) {\n this.sink = sink\n this.scheduler = scheduler\n this.current = null\n this.ended = false\n }\n\n event (t, stream) {\n this._disposeCurrent(t)\n this.current = new Segment(stream, t, Infinity, this, this.sink, this.scheduler)\n }\n\n end (t) {\n this.ended = true\n this._checkEnd(t)\n }\n\n error (t, e) {\n this.ended = true\n this.sink.error(t, e)\n }\n\n dispose () {\n return this._disposeCurrent(currentTime(this.scheduler))\n }\n\n _disposeCurrent (t) {\n if (this.current !== null) {\n return this.current._dispose(t)\n }\n }\n\n _disposeInner (t, inner) {\n inner._dispose(t)\n if (inner === this.current) {\n this.current = null\n }\n }\n\n _checkEnd (t) {\n if (this.ended && this.current === null) {\n this.sink.end(t)\n }\n }\n\n _endInner (t, inner) {\n this._disposeInner(t, inner)\n this._checkEnd(t)\n }\n\n _errorInner (t, e, inner) {\n this._disposeInner(t, inner)\n this.sink.error(t, e)\n }\n}\n\nclass Segment {\n constructor (source, min, max, outer, sink, scheduler) {\n this.min = min\n this.max = max\n this.outer = outer\n this.sink = sink\n this.disposable = source.run(this, schedulerRelativeTo(min, scheduler))\n }\n\n event (t, x) {\n const time = Math.max(0, t + this.min)\n if (time < this.max) {\n this.sink.event(time, x)\n }\n }\n\n end (t) {\n this.outer._endInner(t + this.min, this)\n }\n\n error (t, e) {\n this.outer._errorInner(t + this.min, e, this)\n }\n\n _dispose (t) {\n tryDispose(t, this.disposable, this.sink)\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport Filter from '../fusion/Filter'\nimport { empty, isCanonicalEmpty } from '../source/empty'\n\n/**\n * Retain only items matching a predicate\n * @param {function(x:*):boolean} p filtering predicate called for each item\n * @param {Stream} stream stream to filter\n * @returns {Stream} stream containing only items for which predicate returns truthy\n */\nexport const filter = (p, stream) =>\n Filter.create(p, stream)\n\n/**\n * Skip repeated events, using === to detect duplicates\n * @param {Stream} stream stream from which to omit repeated events\n * @returns {Stream} stream without repeated events\n */\nexport const skipRepeats = stream =>\n skipRepeatsWith(same, stream)\n\n/**\n * Skip repeated events using the provided equals function to detect duplicates\n * @param {function(a:*, b:*):boolean} equals optional function to compare items\n * @param {Stream} stream stream from which to omit repeated events\n * @returns {Stream} stream without repeated events\n */\nexport const skipRepeatsWith = (equals, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new SkipRepeats(equals, stream)\n\nclass SkipRepeats {\n constructor (equals, source) {\n this.equals = equals\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new SkipRepeatsSink(this.equals, sink), scheduler)\n }\n}\n\nclass SkipRepeatsSink extends Pipe {\n constructor (equals, sink) {\n super(sink)\n this.equals = equals\n this.value = void 0\n this.init = true\n }\n\n event (t, x) {\n if (this.init) {\n this.init = false\n this.value = x\n this.sink.event(t, x)\n } else if (!this.equals(this.value, x)) {\n this.value = x\n this.sink.event(t, x)\n }\n }\n}\n\nfunction same (a, b) {\n return a === b\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport { disposeBoth } from '@most/disposable'\nimport { join } from './chain'\nimport SettableDisposable from '../disposable/SettableDisposable'\n\nexport const until = (signal, stream) =>\n new Until(signal, stream)\n\nexport const since = (signal, stream) =>\n new Since(signal, stream)\n\nexport const during = (timeWindow, stream) =>\n until(join(timeWindow), since(timeWindow, stream))\n\nclass Until {\n constructor (maxSignal, source) {\n this.maxSignal = maxSignal\n this.source = source\n }\n\n run (sink, scheduler) {\n const disposable = new SettableDisposable()\n\n const d1 = this.source.run(sink, scheduler)\n const d2 = this.maxSignal.run(new UntilSink(sink, disposable), scheduler)\n disposable.setDisposable(disposeBoth(d1, d2))\n\n return disposable\n }\n}\n\nclass Since {\n constructor (minSignal, source) {\n this.minSignal = minSignal\n this.source = source\n }\n\n run (sink, scheduler) {\n const min = new LowerBoundSink(this.minSignal, sink, scheduler)\n const d = this.source.run(new SinceSink(min, sink), scheduler)\n\n return disposeBoth(min, d)\n }\n}\n\nclass SinceSink extends Pipe {\n constructor (min, sink) {\n super(sink)\n this.min = min\n }\n\n event (t, x) {\n if (this.min.allow) {\n this.sink.event(t, x)\n }\n }\n}\n\nclass LowerBoundSink extends Pipe {\n constructor (signal, sink, scheduler) {\n super(sink)\n this.allow = false\n this.disposable = signal.run(this, scheduler)\n }\n\n event (/* t, x */) {\n this.allow = true\n this.dispose()\n }\n\n end () {}\n\n dispose () {\n this.disposable.dispose()\n }\n}\n\nclass UntilSink extends Pipe {\n constructor (sink, disposable) {\n super(sink)\n this.disposable = disposable\n }\n\n event (t, x) {\n this.disposable.dispose()\n this.sink.end(t)\n }\n\n end () {}\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport Pipe from '../sink/Pipe'\nimport { disposeBoth } from '@most/disposable'\nimport { cancelTask, delay as scheduleDelay } from '@most/scheduler'\nimport { propagateEndTask, propagateEventTask } from '../scheduler/PropagateTask'\n\n/**\n * @param {Number} delayTime milliseconds to delay each item\n * @param {Stream} stream\n * @returns {Stream} new stream containing the same items, but delayed by ms\n */\nexport const delay = (delayTime, stream) =>\n delayTime <= 0 ? stream : new Delay(delayTime, stream)\n\nclass Delay {\n constructor (dt, source) {\n this.dt = dt\n this.source = source\n }\n\n run (sink, scheduler) {\n const delaySink = new DelaySink(this.dt, sink, scheduler)\n return disposeBoth(delaySink, this.source.run(delaySink, scheduler))\n }\n}\n\nclass DelaySink extends Pipe {\n constructor (dt, sink, scheduler) {\n super(sink)\n this.dt = dt\n this.scheduler = scheduler\n this.tasks = []\n }\n\n dispose () {\n this.tasks.forEach(cancelTask)\n }\n\n event (t, x) {\n this.tasks.push(scheduleDelay(this.dt, propagateEventTask(x, this.sink), this.scheduler))\n }\n\n end (t) {\n this.tasks.push(scheduleDelay(this.dt, propagateEndTask(this.sink), this.scheduler))\n }\n}\n","/** @license MIT License (c) copyright 2010-2017 original author or authors */\n\nimport Pipe from '../sink/Pipe'\nimport Map from '../fusion/Map'\nimport { empty, isCanonicalEmpty } from '../source/empty'\nimport { delay } from '@most/scheduler'\n\n/**\n * Limit the rate of events by suppressing events that occur too often\n * @param {Number} period time to suppress events\n * @param {Stream} stream\n * @returns {Stream}\n */\nexport const throttle = (period, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : stream instanceof Map ? commuteMapThrottle(period, stream)\n : stream instanceof Throttle ? fuseThrottle(period, stream)\n : new Throttle(period, stream)\n\nconst commuteMapThrottle = (period, mapStream) =>\n Map.create(mapStream.f, throttle(period, mapStream.source))\n\nconst fuseThrottle = (period, throttleStream) =>\n new Throttle(Math.max(period, throttleStream.period), throttleStream.source)\n\nclass Throttle {\n constructor (period, source) {\n this.period = period\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new ThrottleSink(this.period, sink), scheduler)\n }\n}\n\nclass ThrottleSink extends Pipe {\n constructor (period, sink) {\n super(sink)\n this.time = 0\n this.period = period\n }\n\n event (t, x) {\n if (t >= this.time) {\n this.time = t + this.period\n this.sink.event(t, x)\n }\n }\n}\n/**\n * Wait for a burst of events to subside and emit only the last event in the burst\n * @param {Number} period events occuring more frequently than this\n * will be suppressed\n * @param {Stream} stream stream to debounce\n * @returns {Stream} new debounced stream\n */\nexport const debounce = (period, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new Debounce(period, stream)\n\nclass Debounce {\n constructor (dt, source) {\n this.dt = dt\n this.source = source\n }\n\n run (sink, scheduler) {\n return new DebounceSink(this.dt, this.source, sink, scheduler)\n }\n}\n\nclass DebounceSink {\n constructor (dt, source, sink, scheduler) {\n this.dt = dt\n this.sink = sink\n this.scheduler = scheduler\n this.value = void 0\n this.timer = null\n\n this.disposable = source.run(this, scheduler)\n }\n\n event (t, x) {\n this._clearTimer()\n this.value = x\n this.timer = delay(this.dt, new DebounceTask(this, x), this.scheduler)\n }\n\n _event (t, x) {\n this._clearTimer()\n this.sink.event(t, x)\n }\n\n end (t) {\n if (this._clearTimer()) {\n this.sink.event(t, this.value)\n this.value = undefined\n }\n this.sink.end(t)\n }\n\n error (t, x) {\n this._clearTimer()\n this.sink.error(t, x)\n }\n\n dispose () {\n this._clearTimer()\n this.disposable.dispose()\n }\n\n _clearTimer () {\n if (this.timer === null) {\n return false\n }\n this.timer.dispose()\n this.timer = null\n return true\n }\n}\n\nclass DebounceTask {\n constructor (debounce, value) {\n this.debounce = debounce\n this.value = value\n }\n\n run (t) {\n this.debounce._event(t, this.value)\n }\n\n error (t, e) {\n this.debounce.error(t, e)\n }\n\n dispose () {}\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport fatal from '../fatalError'\nimport { now } from '../source/now'\nimport { empty, isCanonicalEmpty } from '../source/empty'\nimport { compose } from '@most/prelude'\nimport { currentTime } from '@most/scheduler'\n\n/**\n * Turn a Stream<Promise<T>> into Stream<T> by awaiting each promise.\n * Event order is preserved. The stream will fail if any promise rejects.\n */\nexport const awaitPromises = stream =>\n isCanonicalEmpty(stream) ? empty() : new Await(stream)\n\n/**\n * Create a stream containing only the promise's fulfillment\n * value at the time it fulfills.\n * @param {Promise<T>} p promise\n * @return {Stream<T>} stream containing promise's fulfillment value.\n * If the promise rejects, the stream will error\n */\nexport const fromPromise = compose(awaitPromises, now)\n\nclass Await {\n constructor (source) {\n this.source = source\n }\n\n run (sink, scheduler) {\n return this.source.run(new AwaitSink(sink, scheduler), scheduler)\n }\n}\n\nclass AwaitSink {\n constructor (sink, scheduler) {\n this.sink = sink\n this.scheduler = scheduler\n this.queue = Promise.resolve()\n\n // Pre-create closures, to avoid creating them per event\n this._eventBound = x => this.sink.event(currentTime(this.scheduler), x)\n this._endBound = () => this.sink.end(currentTime(this.scheduler))\n this._errorBound = e => this.sink.error(currentTime(this.scheduler), e)\n }\n\n event (t, promise) {\n this.queue = this.queue.then(() => this._event(promise))\n .catch(this._errorBound)\n }\n\n end (t) {\n this.queue = this.queue.then(this._endBound)\n .catch(this._errorBound)\n }\n\n error (t, e) {\n // Don't resolve error values, propagate directly\n this.queue = this.queue.then(() => this._errorBound(e))\n .catch(fatal)\n }\n\n _event (promise) {\n return promise.then(this._eventBound)\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nexport default class SafeSink {\n constructor (sink) {\n this.sink = sink\n this.active = true\n }\n\n event (t, x) {\n if (!this.active) {\n return\n }\n this.sink.event(t, x)\n }\n\n end (t, x) {\n if (!this.active) {\n return\n }\n this.disable()\n this.sink.end(t, x)\n }\n\n error (t, e) {\n this.disable()\n this.sink.error(t, e)\n }\n\n disable () {\n this.active = false\n return this.sink\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nexport function tryEvent (t, x, sink) {\n try {\n sink.event(t, x)\n } catch (e) {\n sink.error(t, e)\n }\n}\n\nexport function tryEnd (t, sink) {\n try {\n sink.end(t)\n } catch (e) {\n sink.error(t, e)\n }\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\nimport SafeSink from '../sink/SafeSink'\nimport { tryDispose } from '@most/disposable'\nimport { asap } from '@most/scheduler'\nimport { tryEvent, tryEnd } from '../source/tryEvent'\nimport { empty, isCanonicalEmpty } from '../source/empty'\nimport { propagateErrorTask } from '../scheduler/PropagateTask'\nimport { run } from '../run'\nimport { withLocalTime } from './withLocalTime'\n\n/**\n * If stream encounters an error, recover and continue with items from stream\n * returned by f.\n * @param {function(error:*):Stream} f function which returns a new stream\n * @param {Stream} stream\n * @returns {Stream} new stream which will recover from an error by calling f\n */\nexport const recoverWith = (f, stream) =>\n isCanonicalEmpty(stream) ? empty()\n : new RecoverWith(f, stream)\n\n/**\n * Create a stream containing only an error\n * @param {*} e error value, preferably an Error or Error subtype\n * @returns {Stream} new stream containing only an error\n */\nexport const throwError = e =>\n new ErrorStream(e)\n\nclass ErrorStream {\n constructor (e) {\n this.value = e\n }\n\n run (sink, scheduler) {\n return asap(propagateErrorTask(this.value, sink), scheduler)\n }\n}\n\nclass RecoverWith {\n constructor (f, source) {\n this.f = f\n this.source = source\n }\n\n run (sink, scheduler) {\n return new RecoverWithSink(this.f, this.source, sink, scheduler)\n }\n}\n\nclass RecoverWithSink {\n constructor (f, source, sink, scheduler) {\n this.f = f\n this.sink = new SafeSink(sink)\n this.scheduler = scheduler\n this.disposable = source.run(this, scheduler)\n }\n\n event (t, x) {\n tryEvent(t, x, this.sink)\n }\n\n end (t) {\n tryEnd(t, this.sink)\n }\n\n error (t, e) {\n const nextSink = this.sink.disable()\n\n tryDispose(t, this.disposable, this.sink)\n\n this._startNext(t, e, nextSink)\n }\n\n _startNext (t, x, sink) {\n try {\n this.disposable = this._continue(this.f, t, x, sink)\n } catch (e) {\n sink.error(t, e)\n }\n }\n\n _continue (f, t, x, sink) {\n return run(sink, this.scheduler, withLocalTime(t, f(x)))\n }\n\n dispose () {\n return this.disposable.dispose()\n }\n}\n","import { append, findIndex, remove } from '@most/prelude'\nimport { disposeNone, disposeOnce } from '@most/disposable'\nimport { tryEnd, tryEvent } from '../source/tryEvent'\nimport { isCanonicalEmpty } from '../source/empty'\n\nexport const multicast = stream =>\n stream instanceof Multicast || isCanonicalEmpty(stream)\n ? stream\n : new Multicast(stream)\n\nclass Multicast {\n constructor (source) {\n this.source = new MulticastSource(source)\n }\n run (sink, scheduler) {\n return this.source.run(sink, scheduler)\n }\n}\n\nexport class MulticastSource {\n constructor (source) {\n this.source = source\n this.sinks = []\n this.disposable = disposeNone()\n }\n\n run (sink, scheduler) {\n const n = this.add(sink)\n if (n === 1) {\n this.disposable = this.source.run(this, scheduler)\n }\n return disposeOnce(new MulticastDisposable(this, sink))\n }\n\n dispose () {\n const disposable = this.disposable\n this.disposable = disposeNone()\n return disposable.dispose()\n }\n\n add (sink) {\n this.sinks = append(sink, this.sinks)\n return this.sinks.length\n }\n\n remove (sink) {\n const i = findIndex(sink, this.sinks)\n // istanbul ignore next\n if (i >= 0) {\n this.sinks = remove(i, this.sinks)\n }\n\n return this.sinks.length\n }\n\n event (time, value) {\n const s = this.sinks\n if (s.length === 1) {\n return s[0].event(time, value)\n }\n for (let i = 0; i < s.length; ++i) {\n tryEvent(time, value, s[i])\n }\n }\n\n end (time) {\n const s = this.sinks\n for (let i = 0; i < s.length; ++i) {\n tryEnd(time, s[i])\n }\n }\n\n error (time, err) {\n const s = this.sinks\n for (let i = 0; i < s.length; ++i) {\n s[i].error(time, err)\n }\n }\n}\n\nexport class MulticastDisposable {\n constructor (source, sink) {\n this.source = source\n this.sink = sink\n }\n\n dispose () {\n if (this.source.remove(this.sink) === 0) {\n this.source.dispose()\n }\n }\n}\n","/** @license MIT License (c) copyright 2016 original author or authors */\n/* eslint-disable import/first */\nimport { curry2, curry3 } from '@most/prelude'\n\nexport { empty } from './source/empty'\nexport { never } from './source/never'\nexport { now } from './source/now'\nexport { at } from './source/at'\n\nexport { periodic } from './source/periodic'\n\nexport { newStream } from './source/newStream'\n\nimport { zipItems as _zipItems, withItems as _withItems } from './combinator/zipItems'\nexport const zipItems = curry3(_zipItems)\nexport const withItems = curry2(_withItems)\n\n// -----------------------------------------------------------------------\n// Observing\n\nimport { runEffects as _runEffects } from './runEffects'\nimport { run as _run } from './run'\n\nexport const runEffects = curry2(_runEffects)\nexport const run = curry3(_run)\n\n// -------------------------------------------------------\n\nimport { withLocalTime as _withLocalTime } from './combinator/withLocalTime'\n\nexport const withLocalTime = curry2(_withLocalTime)\n\n// -------------------------------------------------------\n\nimport { loop as _loop } from './combinator/loop'\n\nexport const loop = curry3(_loop)\n\n// -------------------------------------------------------\n\nimport { scan as _scan } from './combinator/scan'\n\nexport const scan = curry3(_scan)\n\n// -----------------------------------------------------------------------\n// Extending\n\nimport { startWith as _startWith } from './combinator/startWith'\n\nexport const startWith = curry2(_startWith)\n\n// -----------------------------------------------------------------------\n// Transforming\n\nimport { map as _map, constant as _constant, tap as _tap } from './combinator/transform'\nimport { ap as _ap } from './combinator/applicative'\n\nexport const map = curry2(_map)\nexport const constant = curry2(_constant)\nexport const tap = curry2(_tap)\nexport const ap = curry2(_ap)\n\n// -----------------------------------------------------------------------\n// FlatMapping\n\nimport { chain as _chain, join } from './combinator/chain'\nexport const chain = curry2(_chain)\nexport { join }\n\nimport { continueWith as _continueWith } from './combinator/continueWith'\nexport const continueWith = curry2(_continueWith)\n\nimport { concatMap as _concatMap } from './combinator/concatMap'\nexport const concatMap = curry2(_concatMap)\n\n// -----------------------------------------------------------------------\n// Concurrent merging\n\nimport { mergeConcurrently as _mergeConcurrently, mergeMapConcurrently as _mergeMapConcurrently } from './combinator/mergeConcurrently'\n\nexport const mergeConcurrently = curry2(_mergeConcurrently)\nexport const mergeMapConcurrently = curry3(_mergeMapConcurrently)\n\n// -----------------------------------------------------------------------\n// Merging\n\nimport { merge as _merge, mergeArray } from './combinator/merge'\n\nexport const merge = curry2(_merge)\nexport { mergeArray }\n\n// -----------------------------------------------------------------------\n// Combining\n\nimport { combine as _combine, combineArray as _combineArray } from './combinator/combine'\n\nexport const combine = curry3(_combine)\nexport const combineArray = curry2(_combineArray)\n\n// -----------------------------------------------------------------------\n// Sampling\n\nimport { sample as _sample, snapshot as _snapshot } from './combinator/snapshot'\n\nexport const sample = curry2(_sample)\nexport const snapshot = curry3(_snapshot)\n\n// -----------------------------------------------------------------------\n// Zipping\n\nimport { zip as _zip, zipArray as _zipArray } from './combinator/zip'\n\nexport const zip = curry3(_zip)\nexport const zipArray = curry2(_zipArray)\n\n// -----------------------------------------------------------------------\n// Switching\n\nexport { switchLatest } from './combinator/switch'\n\n// -----------------------------------------------------------------------\n// Filtering\n\nimport { filter as _filter, skipRepeats, skipRepeatsWith as _skipRepeatsWith } from './combinator/filter'\n\nexport const filter = curry2(_filter)\nexport { skipRepeats }\nexport const skipRepeatsWith = curry2(_skipRepeatsWith)\n\n// -----------------------------------------------------------------------\n// Slicing\n\nimport { take as _take, skip as _skip, slice as _slice, takeWhile as _takeWhile, skipWhile as _skipWhile, skipAfter as _skipAfter } from './combinator/slice'\n\nexport const take = curry2(_take)\nexport const skip = curry2(_skip)\nexport const slice = curry3(_slice)\nexport const takeWhile = curry2(_takeWhile)\nexport const skipWhile = curry2(_skipWhile)\nexport const skipAfter = curry2(_skipAfter)\n\n// -----------------------------------------------------------------------\n// Time slicing\n\nimport { until as _until, since as _since, during as _during } from './combinator/timeslice'\n\nexport const until = curry2(_until)\nexport const since = curry2(_since)\nexport const during = curry2(_during)\n\n// -----------------------------------------------------------------------\n// Delaying\n\nimport { delay as _delay } from './combinator/delay'\n\nexport const delay = curry2(_delay)\n\n// -----------------------------------------------------------------------\n// Rate limiting\n\nimport { throttle as _throttle, debounce as _debounce } from './combinator/limit'\n\nexport const throttle = curry2(_throttle)\nexport const debounce = curry2(_debounce)\n\n// -----------------------------------------------------------------------\n// Awaiting Promises\n\nexport { fromPromise, awaitPromises } from './combinator/promises'\n\n// -----------------------------------------------------------------------\n// Error handling\n\nimport { recoverWith as _recoverWith, throwError } from './combinator/errors'\n\nexport const recoverWith = curry2(_recoverWith)\nexport { throwError }\n\n// -----------------------------------------------------------------------\n// Multicasting\n\nexport { multicast, MulticastSource } from './combinator/multicast'\n\n// ----------------------------------------------------------------------\nimport {\n propagateTask as _propagateTask,\n propagateEventTask as _propagateEventTask,\n propagateErrorTask as _propagateErrorTask,\n propagateEndTask\n} from './scheduler/PropagateTask'\n\nexport const propagateTask = curry3(_propagateTask)\nexport const propagateEventTask = curry2(_propagateEventTask)\nexport const propagateErrorTask = curry2(_propagateErrorTask)\nexport { propagateEndTask }\n"],"names":["fatalError","e","rethrow","propagateTask","run","value","sink","PropagateTask","propagateEventTask","runEvent","propagateEndTask","runEnd","undefined","propagateErrorTask","runError","_run","active","dispose","t","error","fatal","x","event","_","end","empty","EMPTY","isCanonicalEmpty","stream","containsCanonicalEmpty","streams","some","Empty","scheduler","asap","never","NEVER","Never","disposeNone","at","At","time","delay","runAt","now","periodic","Periodic","period","schedulePeriodic","newStream","Stream","Pipe","boundsFrom","unsafeMin","unsafeMax","min","Math","max","mergeBounds","b1","b2","isNilBounds","b","isInfiniteBounds","Infinity","Filter","p","source","FilterSink","create","and","q","FilterMap","f","FilterMapSink","Map","MapSink","compose","SettableDisposable","disposable","disposed","setDisposable","Error","take","n","slice","skip","start","sliceBounds","bounds","isSliceEmpty","commuteMapSlice","Slice","fuseSlice","createSlice","mapStream","sliceStream","sliceSink","SliceSink","takeWhile","TakeWhile","takeWhileSink","TakeWhileSink","skipWhile","SkipWhile","SkipWhileSink","skipping","skipAfter","SkipAfter","SkipAfterSink","withItems","items","zipItems","keepLeft","length","ZipItems","a","ZipItemsSink","index","runEffects","curry2","Promise","resolve","reject","runStream","observer","RunEffectsSink","_end","_error","_disposable","_dispose","tryDispose","RelativeSink","offset","withLocalTime","origin","WithLocalTime","relativeSink","schedulerRelativeTo","loop","stepper","seed","Loop","step","LoopSink","result","scan","initial","Scan","z","d1","d2","ScanSink","disposeBoth","continueWith","ContinueWith","ContinueWithSink","disposeOnce","_startNext","_continue","startWith","map","constant","tap","Tap","TapSink","IndexSink","i","Sink","invoke","args","apply","combine","stream1","stream2","combineArray","Combine","sources","l","disposables","Array","sinks","mergeSink","CombineSink","indexSink","disposeAll","awaiting","values","hasValue","fill","activeCount","indexedValue","_updateReady","ap","fs","xs","mergeConcurrently","concurrency","mergeMapConcurrently","identity","MergeConcurrently","Outer","pending","current","_addInner","_startInner","push","_initInner","innerSink","Inner","mapAndRun","_checkEnd","_endInner","inner","indexOf","splice","shift","outer","chain","join","concatMap","merge","mergeArray","mergeStreams","withoutCanonicalEmpty","Merge","reduce","appendSources","filter","isNotCanonicalEmpty","concat","MergeSink","indexValue","sample","sampler","snapshot","Snapshot","sampleSink","SnapshotSink","valuesDisposable","latest","samplerDisposable","LatestValueSink","HEAD_MAX_SHRINK","TAIL_MIN_SHRINK","Queue","_head","_tail","_capacityMask","_list","tail","_growArray","head","_shrinkArray","isEmpty","_copyArray","newArray","list","len","zip","zipArray","Zip","buffers","zipSink","ZipSink","buffer","ready","ended","emitZipped","mapArray","switchLatest","Switch","switchSink","SwitchSink","_disposeCurrent","Segment","currentTime","_disposeInner","_errorInner","skipRepeats","skipRepeatsWith","same","equals","SkipRepeats","SkipRepeatsSink","init","until","signal","Until","since","Since","during","timeWindow","maxSignal","UntilSink","minSignal","LowerBoundSink","d","SinceSink","allow","delayTime","Delay","dt","delaySink","DelaySink","tasks","forEach","cancelTask","scheduleDelay","throttle","commuteMapThrottle","Throttle","fuseThrottle","throttleStream","ThrottleSink","debounce","Debounce","DebounceSink","timer","_clearTimer","DebounceTask","_event","awaitPromises","Await","fromPromise","AwaitSink","queue","_eventBound","_endBound","_errorBound","promise","then","catch","SafeSink","disable","tryEvent","tryEnd","recoverWith","RecoverWith","throwError","ErrorStream","RecoverWithSink","nextSink","multicast","Multicast","MulticastSource","add","MulticastDisposable","append","remove","findIndex","s","err","curry3","_zipItems","_withItems","_runEffects","_withLocalTime","_loop","_scan","_startWith","_map","_constant","_tap","_ap","_chain","_continueWith","_concatMap","_mergeConcurrently","_mergeMapConcurrently","_merge","_combine","_combineArray","_sample","_snapshot","_zip","_zipArray","_filter","_skipRepeatsWith","_take","_skip","_slice","_takeWhile","_skipWhile","_skipAfter","_until","_since","_during","_delay","_throttle","_debounce","_recoverWith","_propagateTask","_propagateEventTask","_propagateErrorTask"],"mappings":";;;;AAAA;;;;AAIA,AAAe,SAASA,UAAT,CAAqBC,CAArB,EAAwB;aAC1BC,OAAX,EAAoB,CAApB,EAAuBD,CAAvB;;;AAGF,SAASC,OAAT,CAAkBD,CAAlB,EAAqB;QACbA,CAAN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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