@most/core
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -1,2 +0,1 @@ | ||
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports):typeof define==="function"&&define.amd?define(["exports"],e):e(t.mostCore=t.mostCore||{})})(this,function(t){"use strict";function e(t,e){if(t<0){throw new TypeError("n must be >= 0")}var r=e.length;if(t===0||r===0){return e}if(t>=r){return[]}return n(t,e,r-t)}function n(t,e,n){var r=new Array(n);for(var i=0;i<n;++i){r[i]=e[t+i]}return r}function r(t){return e(1,t)}function i(t){var e=t.length;var n=new Array(e);for(var r=0;r<e;++r){n[r]=t[r]}return n}function s(t,e){var n=e.length;var r=new Array(n);for(var i=0;i<n;++i){r[i]=t(e[i])}return r}function o(t,e,n){var r=e;for(var i=0,s=n.length;i<s;++i){r=t(r,n[i],i)}return r}function u(t,e){var n=e.length;var r=new Array(n);var i=0;for(var s=void 0,o=0;o<n;++o){s=e[o];if(!t(s)){r[i]=s;++i}}r.length=i;return r}function h(t,e){for(var n=0,r=e.length;n<r;++n){if(t===e[n]){return n}}return-1}var c=function(t){return t};var a=function(t,e){return function(n){return t(e(n))}};var p=function(t,e){return t(e)};function f(t){function e(n,r){switch(arguments.length){case 0:return e;case 1:return function(e){return t(n,e)};default:return t(n,r)}}return e}function v(t){function e(n,r,i){switch(arguments.length){case 0:return e;case 1:return f(function(e,r){return t(n,e,r)});case 2:return function(e){return t(n,r,e)};default:return t(n,r,i)}}return e}function l(t){this.source=t}var d=function t(e,n){this._dispose=e;this._data=n};d.prototype.dispose=function t(){return this._dispose(this._data)};var y=function t(){var e=this;this.disposable=void 0;this.disposed=false;this._resolve=void 0;this.result=new Promise(function(t){e._resolve=t})};y.prototype.setDisposable=function t(e){if(this.disposable!==void 0){throw new Error("setDisposable called more than once")}this.disposable=e;if(this.disposed){this._resolve(e.dispose())}};y.prototype.dispose=function t(){if(this.disposed){return this.result}this.disposed=true;if(this.disposable!==void 0){this.result=this.disposable.dispose()}return this.result};function w(t){try{return t.dispose()}catch(t){return Promise.reject(t)}}var k=function t(e){this.disposed=false;this.value=undefined;this.disposable=e};k.prototype.dispose=function t(){if(!this.disposed){this.disposed=true;this.value=w(this.disposable);this.disposable=undefined}return this.value};function m(t){return t!==null&&typeof t==="object"&&typeof t.then==="function"}function _(t,e,n){var r=w(e);return m(r)?r.catch(function(e){return n.error(t,e)}):r}var g=function(t,e){return T(new d(t,e))};var b=function(){return new d(c,undefined)};var x=function(t){return g(A,t)};var A=function(t){return Promise.all(s(w,t))};var I=function(){return new y};var T=function(t){return new k(t)};function E(t){setTimeout(function(){throw t},0)}var P=function(t,e,n){return new S(t,e,n)};var C=function(t,e){return P(q,t,e)};var M=function(t,e){return P(N,t,e)};var R=function(t,e){return P(j,t,e)};var S=function t(e,n,r){this._run=e;this.value=n;this.sink=r;this.active=true};S.prototype.dispose=function t(){this.active=false};S.prototype.run=function t(e){if(!this.active){return}var t=this._run;t(e,this.value,this.sink,this)};S.prototype.error=function t(e,n){if(!this.active){return E(n)}this.sink.error(e,n)};var q=function(t,e,n){return n.event(t,e)};var N=function(t,e,n){return n.end(t,e)};var j=function(t,e,n){return n.error(t,e)};var B=function(t){return new l(new V(t))};var V=function t(e){this.value=e};V.prototype.run=function t(e,n){return n.asap(P(W,this.value,e))};function W(t,e,n){n.event(t,e);n.end(t,undefined)}var D=function(){return L};var O=function t(){};O.prototype.run=function t(e,n){var r=M(undefined,e);n.asap(r);return g(z,r)};var z=function(t){return t.dispose()};var L=new l(new O);var F=function(){return H};var G=function t(){};G.prototype.run=function t(){return b()};var H=new l(new G);function J(t){return new l(new K(t))}var K=function t(e){this.period=e};K.prototype.run=function t(e,n){return n.periodic(this.period,C(undefined,e))};var Q=function(t){return new l(new U(t))};var U=function t(e){this.array=e};U.prototype.run=function t(e,n){return n.asap(P(X,this.array,e))};function X(t,e,n,r){for(var i=0,s=e.length;i<s&&r.active;++i){n.event(t,e[i])}r.active&&o(t);function o(t){n.end(t)}}var Y;if(typeof Set==="function"&&typeof(new Set)["@@iterator"]==="function"){Y="@@iterator"}else{Y=typeof Symbol==="function"&&Symbol.iterator||"_es6shim_iterator_"}function Z(t){return t[Y]()}var $=function(t){return new l(new tt(t))};var tt=function t(e){this.iterable=e};tt.prototype.run=function t(e,n){return n.asap(P(et,Z(this.iterable),e))};function et(t,e,n,r){var i=e.next();while(!i.done&&r.active){n.event(t,i.value);i=e.next()}r.active&&n.end(t,i.value)}var nt=function(t,e){var n=t.source;return rt(n,e)};var rt=function(t,e){return new Promise(function(n,r){return it(t,e,n,r)})};function it(t,e,n,r){var i=I();var s=new st(n,r,i);i.setDisposable(t.run(s,e))}var st=function t(e,n,r){this._end=e;this._error=n;this._disposable=r;this.active=true};st.prototype.event=function t(e,n){};st.prototype.end=function t(e,n){if(!this.active){return}this.active=false;ot(this._end,this._error,this._disposable,n)};st.prototype.error=function t(e,n){this.active=false;ot(this._error,this._error,this._disposable,n)};var ot=function(t,e,n,r){return Promise.resolve(n.dispose()).then(function(){return t(r)},e)};function ut(t){this.sink=t}ut.prototype.event=function(t,e){return this.sink.event(t,e)};ut.prototype.end=function(t,e){return this.sink.end(t,e)};ut.prototype.error=function(t,e){return this.sink.error(t,e)};function ht(t,e,n){return new l(new ct(t,e,n.source))}function ct(t,e,n){this.step=t;this.seed=e;this.source=n}ct.prototype.run=function(t,e){return this.source.run(new at(this.step,this.seed,t),e)};function at(t,e,n){this.step=t;this.seed=e;this.sink=n}at.prototype.error=ut.prototype.error;at.prototype.event=function(t,e){var n=this.step(this.seed,e);this.seed=n.seed;this.sink.event(t,n.value)};at.prototype.end=function(t){this.sink.end(t,this.seed)};var pt=function(t,e,n){return new l(new ft(t,e,n.source))};var ft=function t(e,n,r){this.source=r;this.f=e;this.value=n};ft.prototype.run=function t(e,n){var r=n.asap(C(this.value,e));var i=this.source.run(new vt(this.f,this.value,e),n);return x([r,i])};var vt=function(t){function e(e,n,r){t.call(this);this.f=e;this.value=n;this.sink=r}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,n){var r=this.f;this.value=r(this.value,n);this.sink.event(e,this.value)};return e}(ut);function lt(t,e){return new l(new dt(t,e))}function dt(t,e){this.f=t;this.value=e}dt.prototype.run=function(t,e){return new yt(this.f,this.value,t,e)};function yt(t,e,n,r){this.f=t;this.sink=n;this.scheduler=r;this.active=true;var i=this;function s(t){i.sink.error(i.scheduler.now(),t)}function o(t){return wt(t,e)}Promise.resolve(this).then(o).catch(s)}yt.prototype.dispose=function(){this.active=false};function wt(t,e){var n=t.f;return Promise.resolve(n(e)).then(function(e){return kt(t,e)})}function kt(t,e){if(e.done){t.sink.end(t.scheduler.now(),e.value);return e.value}t.sink.event(t.scheduler.now(),e.value);if(!t.active){return e.value}return wt(t,e.seed)}function mt(t,e){return new l(new _t(t,e))}function _t(t,e){this.f=t;this.value=e}_t.prototype.run=function(t,e){return new gt(this.f,this.value,t,e)};function gt(t,e,n,r){this.f=t;this.sink=n;this.scheduler=r;this.active=true;var i=e;var s=this;function o(t){s.sink.error(s.scheduler.now(),t)}function u(t){return bt(t,i)}Promise.resolve(this).then(u).catch(o)}gt.prototype.dispose=function(){this.active=false};function bt(t,e){t.sink.event(t.scheduler.now(),e);if(!t.active){return e}var n=t.f;return Promise.resolve(n(e)).then(function(e){return xt(t,e)})}function xt(t,e){return!t.active?t.value:bt(t,e)}function At(t){return new l(new It(t,r(arguments)))}function It(t,e){this.f=t;this.args=e}It.prototype.run=function(t,e){return new Tt(this.f.apply(void 0,this.args),t,e)};function Tt(t,e,n){this.iterator=t;this.sink=e;this.scheduler=n;this.active=true;var r=this;function i(t){r.sink.error(r.scheduler.now(),t)}Promise.resolve(this).then(Et).catch(i)}function Et(t,e){return t.active?Pt(t,t.iterator.next(e)):e}function Pt(t,e){if(e.done){return t.sink.end(t.scheduler.now(),e.value)}return Promise.resolve(e.value).then(function(e){return Ct(t,e)},function(e){return Mt(t,e)})}function Ct(t,e){t.sink.event(t.scheduler.now(),e);return Et(t,e)}function Mt(t,e){return Pt(t,t.iterator.throw(e))}Tt.prototype.dispose=function(){this.active=false};function Rt(t,e){return new l(new St(t,e.source))}function St(t,e){this.f=t;this.source=e}St.prototype.run=function(t,e){return new qt(this.f,this.source,t,e)};function qt(t,e,n,r){this.f=t;this.sink=n;this.scheduler=r;this.active=true;this.disposable=T(e.run(this,r))}qt.prototype.error=ut.prototype.error;qt.prototype.event=function(t,e){if(!this.active){return}this.sink.event(t,e)};qt.prototype.end=function(t,e){if(!this.active){return}_(t,this.disposable,this.sink);this._startNext(t,e,this.sink)};qt.prototype._startNext=function(t,e,n){try{this.disposable=this._continue(this.f,e,n)}catch(e){n.error(t,e)}};qt.prototype._continue=function(t,e,n){return t(e).source.run(n,this.scheduler)};qt.prototype.dispose=function(){this.active=false;return this.disposable.dispose()};var Nt=function(t,e){return jt(B(t),e)};var jt=function(t,e){return Rt(function(){return e},t)};function Bt(t,e){this.p=t;this.source=e}Bt.create=function t(e,n){if(n instanceof Bt){return new Bt(Wt(n.p,e),n.source)}return new Bt(e,n)};Bt.prototype.run=function(t,e){return this.source.run(new Vt(this.p,t),e)};function Vt(t,e){this.p=t;this.sink=e}Vt.prototype.end=ut.prototype.end;Vt.prototype.error=ut.prototype.error;Vt.prototype.event=function(t,e){var n=this.p;n(e)&&this.sink.event(t,e)};function Wt(t,e){return function(n){return t(n)&&e(n)}}function Dt(t,e,n){this.p=t;this.f=e;this.source=n}Dt.prototype.run=function(t,e){return this.source.run(new Ot(this.p,this.f,t),e)};function Ot(t,e,n){this.p=t;this.f=e;this.sink=n}Ot.prototype.event=function(t,e){var n=this.f;var r=this.p;r(e)&&this.sink.event(t,n(e))};Ot.prototype.end=ut.prototype.end;Ot.prototype.error=ut.prototype.error;function zt(t,e){this.f=t;this.source=e}zt.create=function t(e,n){if(n instanceof zt){return new zt(a(e,n.f),n.source)}if(n instanceof Bt){return new Dt(n.p,e,n.source)}return new zt(e,n)};zt.prototype.run=function(t,e){return this.source.run(new Lt(this.f,t),e)};function Lt(t,e){this.f=t;this.sink=e}Lt.prototype.end=ut.prototype.end;Lt.prototype.error=ut.prototype.error;Lt.prototype.event=function(t,e){var n=this.f;this.sink.event(t,n(e))};function Ft(t,e){return new l(zt.create(t,e.source))}function Gt(t,e){return Ft(function(){return t},e)}function Ht(t,e){return new l(new Jt(t,e.source))}function Jt(t,e){this.source=e;this.f=t}Jt.prototype.run=function(t,e){return this.source.run(new Kt(this.f,t),e)};function Kt(t,e){this.sink=e;this.f=t}Kt.prototype.end=ut.prototype.end;Kt.prototype.error=ut.prototype.error;Kt.prototype.event=function(t,e){var n=this.f;n(e);this.sink.event(t,e)};function Qt(t,e){this.sink=e;this.index=t;this.active=true;this.value=void 0}Qt.prototype.event=function(t,e){if(!this.active){return}this.value=e;this.sink.event(t,this)};Qt.prototype.end=function(t,e){if(!this.active){return}this.active=false;this.sink.end(t,{index:this.index,value:e})};Qt.prototype.error=ut.prototype.error;function Ut(t,e){switch(e.length){case 0:return t();case 1:return t(e[0]);case 2:return t(e[0],e[1]);case 3:return t(e[0],e[1],e[2]);case 4:return t(e[0],e[1],e[2],e[3]);case 5:return t(e[0],e[1],e[2],e[3],e[4]);default:return t.apply(void 0,e)}}var Xt=s;var Yt=r;function Zt(t){return $t(t,Yt(arguments))}function $t(t,e){var n=e.length;return n===0?D():n===1?Ft(t,e[0]):new l(te(t,e))}function te(t,e){return new ne(t,Xt(ee,e))}function ee(t){return t.source}function ne(t,e){this.f=t;this.sources=e}ne.prototype.run=function(t,e){var n=this;var r=this.sources.length;var i=new Array(r);var s=new Array(r);var o=new re(i,s,t,this.f);for(var u,h=0;h<r;++h){u=s[h]=new Qt(h,o);i[h]=n.sources[h].run(u,e)}return x(i)};function re(t,e,n,r){var i=this;this.sink=n;this.disposables=t;this.sinks=e;this.f=r;var s=e.length;this.awaiting=s;this.values=new Array(s);this.hasValue=new Array(s);for(var o=0;o<s;++o){i.hasValue[o]=false}this.activeCount=e.length}re.prototype.error=ut.prototype.error;re.prototype.event=function(t,e){var n=e.index;var r=this._updateReady(n);this.values[n]=e.value;if(r===0){this.sink.event(t,Ut(this.f,this.values))}};re.prototype._updateReady=function(t){if(this.awaiting>0){if(!this.hasValue[t]){this.hasValue[t]=true;this.awaiting-=1}}return this.awaiting};re.prototype.end=function(t,e){_(t,this.disposables[e.index],this.sink);if(--this.activeCount===0){this.sink.end(t,e.value)}};function ie(t,e){return Zt(p,t,e)}function se(){this.head=null;this.length=0}se.prototype.add=function(t){if(this.head!==null){this.head.prev=t;t.next=this.head}this.head=t;++this.length};se.prototype.remove=function(t){--this.length;if(t===this.head){this.head=this.head.next}if(t.next!==null){t.next.prev=t.prev;t.next=null}if(t.prev!==null){t.prev.next=t.next;t.prev=null}};se.prototype.isEmpty=function(){return this.length===0};se.prototype.dispose=function(){if(this.isEmpty()){return Promise.resolve()}var t=[];var e=this.head;this.head=null;this.length=0;while(e!==null){t.push(e.dispose());e=e.next}return Promise.all(t)};function oe(t,e){return ue(c,t,e)}function ue(t,e,n){return new l(new he(t,e,n.source))}function he(t,e,n){this.f=t;this.concurrency=e;this.source=n}he.prototype.run=function(t,e){return new ce(this.f,this.concurrency,this.source,t,e)};function ce(t,e,n,r,i){this.f=t;this.concurrency=e;this.sink=r;this.scheduler=i;this.pending=[];this.current=new se;this.disposable=T(n.run(this,i));this.active=true}ce.prototype.event=function(t,e){this._addInner(t,e)};ce.prototype._addInner=function(t,e){if(this.current.length<this.concurrency){this._startInner(t,e)}else{this.pending.push(e)}};ce.prototype._startInner=function(t,e){try{this._initInner(t,e)}catch(e){this.error(t,e)}};ce.prototype._initInner=function(t,e){var n=new pe(t,this,this.sink);n.disposable=ae(this.f,e,n,this.scheduler);this.current.add(n)};function ae(t,e,n,r){return t(e).source.run(n,r)}ce.prototype.end=function(t,e){this.active=false;_(t,this.disposable,this.sink);this._checkEnd(t,e)};ce.prototype.error=function(t,e){this.active=false;this.sink.error(t,e)};ce.prototype.dispose=function(){this.active=false;this.pending.length=0;return Promise.all([this.disposable.dispose(),this.current.dispose()])};ce.prototype._endInner=function(t,e,n){this.current.remove(n);_(t,n,this);if(this.pending.length===0){this._checkEnd(t,e)}else{this._startInner(t,this.pending.shift())}};ce.prototype._checkEnd=function(t,e){if(!this.active&&this.current.isEmpty()){this.sink.end(t,e)}};function pe(t,e,n){this.prev=this.next=null;this.time=t;this.outer=e;this.sink=n;this.disposable=void 0}pe.prototype.event=function(t,e){this.sink.event(Math.max(t,this.time),e)};pe.prototype.end=function(t,e){this.outer._endInner(Math.max(t,this.time),e,this)};pe.prototype.error=function(t,e){this.outer.error(Math.max(t,this.time),e)};pe.prototype.dispose=function(){return this.disposable.dispose()};var fe=function(t,e){return ue(t,Infinity,e)};var ve=function(t){return oe(Infinity,t)};function le(t,e){return ue(t,1,e)}var de=i;var ye=o;function we(){return ke(de(arguments))}function ke(t){var e=t.length;return e===0?D():e===1?t[0]:new l(me(t))}function me(t){return new ge(ye(_e,[],t))}function _e(t,e){var n=e.source;return n instanceof ge?t.concat(n.sources):t.concat(n)}function ge(t){this.sources=t}ge.prototype.run=function(t,e){var n=this;var r=this.sources.length;var i=new Array(r);var s=new Array(r);var o=new be(i,s,t);for(var u,h=0;h<r;++h){u=s[h]=new Qt(h,o);i[h]=n.sources[h].run(u,e)}return x(i)};function be(t,e,n){this.sink=n;this.disposables=t;this.activeCount=e.length}be.prototype.error=ut.prototype.error;be.prototype.event=function(t,e){this.sink.event(t,e.value)};be.prototype.end=function(t,e){_(t,this.disposables[e.index],this.sink);if(--this.activeCount===0){this.sink.end(t,e.value)}};var xe=function(t,e,n){return new l(new Ae(t,e,n))};var Ae=function t(e,n,r){this.source=r.source;this.sampler=n.source;this.f=e};Ae.prototype.run=function t(e,n){var r=new Ie(this.f,this.source,e);var i=this.source.run(r.hold,n);var s=this.sampler.run(r,n);return x([s,i])};var Ie=function(t){function e(e,n,r){t.call(this,r);this.sink=r;this.source=n;this.f=e;this.hold=new Te(this)}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,n){if(this.hold.hasValue){var r=this.f;this.sink.event(e,r(n,this.hold.value))}};return e}(ut);var Te=function(t){function e(e){t.call(this,e);this.hasValue=false}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,n){this.value=n;this.hasValue=true};e.prototype.end=function t(){};return e}(ut);function Ee(t){this._capacity=t||32;this._length=0;this._head=0}Ee.prototype.push=function(t){var e=this._length;this._checkCapacity(e+1);var n=this._head+e&this._capacity-1;this[n]=t;this._length=e+1};Ee.prototype.shift=function(){var t=this._head;var e=this[t];this[t]=void 0;this._head=t+1&this._capacity-1;this._length--;return e};Ee.prototype.isEmpty=function(){return this._length===0};Ee.prototype.length=function(){return this._length};Ee.prototype._checkCapacity=function(t){if(this._capacity<t){this._ensureCapacity(this._capacity<<1)}};Ee.prototype._ensureCapacity=function(t){var e=this._capacity;this._capacity=t;var n=this._head+this._length;if(n>e){Pe(this,0,this,e,n&e-1)}};function Pe(t,e,n,r,i){for(var s=0;s<i;++s){n[s+r]=t[s+e];t[s+e]=void 0}}var Ce=s;var Me=r;function Re(t){return Se(t,Me(arguments))}function Se(t,e){return e.length===0?D():e.length===1?Ft(t,e[0]):new l(new Ne(t,Ce(qe,e)))}function qe(t){return t.source}function Ne(t,e){this.f=t;this.sources=e}Ne.prototype.run=function(t,e){var n=this;var r=this.sources.length;var i=new Array(r);var s=new Array(r);var o=new Array(r);var u=new je(this.f,o,s,t);for(var h,c=0;c<r;++c){o[c]=new Ee;h=s[c]=new Qt(c,u);i[c]=n.sources[c].run(h,e)}return x(i)};function je(t,e,n,r){this.f=t;this.sinks=n;this.sink=r;this.buffers=e}je.prototype.event=function(t,e){var n=this.buffers;var r=n[e.index];r.push(e.value);if(r.length()===1){if(!De(this.buffers)){return}Be(this.f,t,n,this.sink);if(We(this.buffers,this.sinks)){this.sink.end(t,void 0)}}};je.prototype.end=function(t,e){var n=this.buffers[e.index];if(n.isEmpty()){this.sink.end(t,e.value)}};je.prototype.error=ut.prototype.error;function Be(t,e,n,r){r.event(e,Ut(t,Ce(Ve,n)))}function Ve(t){return t.shift()}function We(t,e){for(var n=0,r=t.length;n<r;++n){if(t[n].isEmpty()&&!e[n].active){return true}}return false}function De(t){for(var e=0,n=t.length;e<n;++e){if(t[e].isEmpty()){return false}}return true}var Oe=function(t){return new l(new ze(t.source))};var ze=function t(e){this.source=e};ze.prototype.run=function t(e,n){var r=new Le(e,n);return x([r,this.source.run(r,n)])};var Le=function t(e,n){this.sink=e;this.scheduler=n;this.current=null;this.ended=false};Le.prototype.event=function t(e,n){this._disposeCurrent(e);this.current=new Fe(e,Infinity,this,this.sink);this.current.disposable=n.source.run(this.current,this.scheduler)};Le.prototype.end=function t(e,n){this.ended=true;this._checkEnd(e,n)};Le.prototype.error=function t(e,n){this.ended=true;this.sink.error(e,n)};Le.prototype.dispose=function t(){return this._disposeCurrent(this.scheduler.now())};Le.prototype._disposeCurrent=function t(e){if(this.current!==null){return this.current._dispose(e)}};Le.prototype._disposeInner=function t(e,n){n._dispose(e);if(n===this.current){this.current=null}};Le.prototype._checkEnd=function t(e,n){if(this.ended&&this.current===null){this.sink.end(e,n)}};Le.prototype._endInner=function t(e,n,r){this._disposeInner(e,r);this._checkEnd(e,n)};Le.prototype._errorInner=function t(e,n,r){this._disposeInner(e,r);this.sink.error(e,n)};var Fe=function t(e,n,r,i){this.min=e;this.max=n;this.outer=r;this.sink=i;this.disposable=b()};Fe.prototype.event=function t(e,n){if(e<this.max){this.sink.event(Math.max(e,this.min),n)}};Fe.prototype.end=function t(e,n){this.outer._endInner(Math.max(e,this.min),n,this)};Fe.prototype.error=function t(e,n){this.outer._errorInner(Math.max(e,this.min),n,this)};Fe.prototype._dispose=function t(e){this.max=e;_(e,this.disposable,this.sink)};function Ge(t,e){return new l(Bt.create(t,e.source))}function He(t){return Je(Ue,t)}function Je(t,e){return new l(new Ke(t,e.source))}function Ke(t,e){this.equals=t;this.source=e}Ke.prototype.run=function(t,e){return this.source.run(new Qe(this.equals,t),e)};function Qe(t,e){this.equals=t;this.sink=e;this.value=void 0;this.init=true}Qe.prototype.end=ut.prototype.end;Qe.prototype.error=ut.prototype.error;Qe.prototype.event=function(t,e){if(this.init){this.init=false;this.value=e;this.sink.event(t,e)}else if(!this.equals(this.value,e)){this.value=e;this.sink.event(t,e)}};function Ue(t,e){return t===e}function Xe(t,e){return Ze(0,t,e)}function Ye(t,e){return Ze(t,Infinity,e)}function Ze(t,e,n){return e<=t?D():new l($e(t,e,n.source))}function $e(t,e,n){return n instanceof zt?tn(t,e,n):n instanceof nn?en(t,e,n):new nn(t,e,n)}function tn(t,e,n){return zt.create(n.f,$e(t,e,n.source))}function en(t,e,n){t+=n.min;e=Math.min(e+n.min,n.max);return new nn(t,e,n.source)}function nn(t,e,n){this.source=n;this.min=t;this.max=e}nn.prototype.run=function(t,e){return new rn(this.min,this.max-this.min,this.source,t,e)};function rn(t,e,n,r,i){this.sink=r;this.skip=t;this.take=e;this.disposable=T(n.run(this,i))}rn.prototype.end=ut.prototype.end;rn.prototype.error=ut.prototype.error;rn.prototype.event=function(t,e){if(this.skip>0){this.skip-=1;return}if(this.take===0){return}this.take-=1;this.sink.event(t,e);if(this.take===0){this.dispose();this.sink.end(t,e)}};rn.prototype.dispose=function(){return this.disposable.dispose()};function sn(t,e){return new l(new on(t,e.source))}function on(t,e){this.p=t;this.source=e}on.prototype.run=function(t,e){return new un(this.p,this.source,t,e)};function un(t,e,n,r){this.p=t;this.sink=n;this.active=true;this.disposable=T(e.run(this,r))}un.prototype.end=ut.prototype.end;un.prototype.error=ut.prototype.error;un.prototype.event=function(t,e){if(!this.active){return}var n=this.p;this.active=n(e);if(this.active){this.sink.event(t,e)}else{this.dispose();this.sink.end(t,e)}};un.prototype.dispose=function(){return this.disposable.dispose()};function hn(t,e){return new l(new cn(t,e.source))}function cn(t,e){this.p=t;this.source=e}cn.prototype.run=function(t,e){return this.source.run(new an(this.p,t),e)};function an(t,e){this.p=t;this.sink=e;this.skipping=true}an.prototype.end=ut.prototype.end;an.prototype.error=ut.prototype.error;an.prototype.event=function(t,e){if(this.skipping){var n=this.p;this.skipping=n(e);if(this.skipping){return}}this.sink.event(t,e)};function pn(t,e){return new l(new ln(t.source,e.source))}function fn(t,e){return new l(new dn(t.source,e.source))}function vn(t,e){return pn(ve(t),fn(t,e))}function ln(t,e){this.maxSignal=t;this.source=e}ln.prototype.run=function(t,e){var n=new yn(-Infinity,t);var r=new mn(this.maxSignal,t,e);var i=this.source.run(new wn(n,r,t),e);return x([n,r,i])};function dn(t,e){this.minSignal=t;this.source=e}dn.prototype.run=function(t,e){var n=new kn(this.minSignal,t,e);var r=new yn(Infinity,t);var i=this.source.run(new wn(n,r,t),e);return x([n,r,i])};function yn(t,e){this.value=t;this.sink=e}yn.prototype.error=ut.prototype.error;yn.prototype.event=_n;yn.prototype.end=_n;yn.prototype.dispose=_n;function wn(t,e,n){this.min=t;this.max=e;this.sink=n}wn.prototype.event=function(t,e){if(t>=this.min.value&&t<this.max.value){this.sink.event(t,e)}};wn.prototype.error=ut.prototype.error;wn.prototype.end=ut.prototype.end;function kn(t,e,n){this.value=Infinity;this.sink=e;this.disposable=t.run(this,n)}kn.prototype.event=function(t){if(t<this.value){this.value=t}};kn.prototype.end=_n;kn.prototype.error=ut.prototype.error;kn.prototype.dispose=function(){return this.disposable.dispose()};function mn(t,e,n){this.value=Infinity;this.sink=e;this.disposable=t.run(this,n)}mn.prototype.event=function(t,e){if(t<this.value){this.value=t;this.sink.end(t,e)}};mn.prototype.end=_n;mn.prototype.error=ut.prototype.error;mn.prototype.dispose=function(){return this.disposable.dispose()};function _n(){}function gn(t,e){return t<=0?e:new l(new bn(t,e.source))}function bn(t,e){this.dt=t;this.source=e}bn.prototype.run=function(t,e){var n=new xn(this.dt,t,e);return x([n,this.source.run(n,e)])};function xn(t,e,n){this.dt=t;this.sink=e;this.scheduler=n}xn.prototype.dispose=function(){var t=this;this.scheduler.cancelAll(function(e){return e.sink===t.sink})};xn.prototype.event=function(t,e){this.scheduler.delay(this.dt,C(e,this.sink))};xn.prototype.end=function(t,e){this.scheduler.delay(this.dt,M(e,this.sink))};xn.prototype.error=ut.prototype.error;var An=function(t,e){return new l(In(t,e.source))};var In=function(t,e){return e instanceof zt?Tn(t,e):e instanceof Pn?En(t,e):new Pn(t,e)};var Tn=function(t,e){return zt.create(e.f,In(t,e.source))};var En=function(t,e){return new Pn(Math.max(t,e.period),e.source)};var Pn=function t(e,n){this.period=e;this.source=n};Pn.prototype.run=function t(e,n){return this.source.run(new Cn(this.period,e),n)};var Cn=function(t){function e(e,n){t.call(this,n);this.time=0;this.period=e}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,n){if(e>=this.time){this.time=e+this.period;this.sink.event(e,n)}};return e}(ut);var Mn=function(t,e){return new l(new Rn(t,e.source))};var Rn=function t(e,n){this.dt=e;this.source=n};Rn.prototype.run=function t(e,n){return new Sn(this.dt,this.source,e,n)};var Sn=function t(e,n,r,i){this.dt=e;this.sink=r;this.scheduler=i;this.value=void 0;this.timer=null;var s=n.run(this,i);this.disposable=x([this,s])};Sn.prototype.event=function t(e,n){this._clearTimer();this.value=n;this.timer=this.scheduler.delay(this.dt,C(n,this.sink))};Sn.prototype.end=function t(e,n){if(this._clearTimer()){this.sink.event(e,this.value);this.value=void 0}this.sink.end(e,n)};Sn.prototype.error=function t(e,n){this._clearTimer();this.sink.error(e,n)};Sn.prototype.dispose=function t(){this._clearTimer()};Sn.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var qn=function(t){return new l(new jn(t.source))};var Nn=a(qn,B);var jn=function t(e){this.source=e};jn.prototype.run=function t(e,n){return this.source.run(new Bn(e,n),n)};var Bn=function t(e,n){var r=this;this.sink=e;this.scheduler=n;this.queue=Promise.resolve();this._eventBound=function(t){return r.sink.event(r.scheduler.now(),t)};this._endBound=function(t){return r.sink.end(r.scheduler.now(),t)};this._errorBound=function(t){return r.sink.error(r.scheduler.now(),t)}};Bn.prototype.event=function t(e,n){var r=this;this.queue=this.queue.then(function(){return r._event(n)}).catch(this._errorBound)};Bn.prototype.end=function t(e,n){var r=this;this.queue=this.queue.then(function(){return r._end(n)}).catch(this._errorBound)};Bn.prototype.error=function t(e,n){var r=this;this.queue=this.queue.then(function(){return r._errorBound(n)}).catch(E)};Bn.prototype._event=function t(e){return e.then(this._eventBound)};Bn.prototype._end=function t(e){return Promise.resolve(e).then(this._endBound)};function Vn(t){this.sink=t;this.active=true}Vn.prototype.event=function(t,e){if(!this.active){return}this.sink.event(t,e)};Vn.prototype.end=function(t,e){if(!this.active){return}this.disable();this.sink.end(t,e)};Vn.prototype.error=function(t,e){this.disable();this.sink.error(t,e)};Vn.prototype.disable=function(){this.active=false;return this.sink};function Wn(t,e,n){try{n.event(t,e)}catch(e){n.error(t,e)}}function Dn(t,e,n){try{n.end(t,e)}catch(e){n.error(t,e)}}var On=function(t,e){return new l(new Fn(t,e.source))};var zn=function(t){return new l(new Ln(t))};var Ln=function t(e){this.value=e};Ln.prototype.run=function t(e,n){return n.asap(R(this.value,e))};var Fn=function t(e,n){this.f=e;this.source=n};Fn.prototype.run=function t(e,n){return new Gn(this.f,this.source,e,n)};var Gn=function t(e,n,r,i){this.f=e;this.sink=new Vn(r);this.scheduler=i;this.disposable=n.run(this,i)};Gn.prototype.event=function t(e,n){Wn(e,n,this.sink)};Gn.prototype.end=function t(e,n){Dn(e,n,this.sink)};Gn.prototype.error=function t(e,n){var r=this.sink.disable();_(e,this.disposable,this.sink);this._startNext(e,n,r)};Gn.prototype._startNext=function t(e,n,r){try{this.disposable=this._continue(this.f,n,r)}catch(t){r.error(e,t)}};Gn.prototype._continue=function t(e,n,r){var i=e(n);return i.source.run(r,this.scheduler)};Gn.prototype.dispose=function t(){return this.disposable.dispose()};function Hn(t,e,n,r){this.time=t;this.period=e;this.task=n;this.scheduler=r;this.active=true}Hn.prototype.run=function(){return this.task.run(this.time)};Hn.prototype.error=function(t){return this.task.error(this.time,t)};Hn.prototype.dispose=function(){this.scheduler.cancel(this);return this.task.dispose()};function Jn(t){return Promise.resolve(t).then(Kn)}function Kn(t){try{return t.run()}catch(e){return t.error(e)}}var Qn=function t(e,n){var r=this;this.timer=e;this.timeline=n;this._timer=null;this._nextArrival=Infinity;this._runReadyTasksBound=function(){return r._runReadyTasks(r.now())}};Qn.prototype.now=function t(){return this.timer.now()};Qn.prototype.asap=function t(e){return this.schedule(0,-1,e)};Qn.prototype.delay=function t(e,n){return this.schedule(e,-1,n)};Qn.prototype.periodic=function t(e,n){return this.schedule(0,e,n)};Qn.prototype.schedule=function t(e,n,r){var i=this.now();var s=new Hn(i+Math.max(0,e),n,r,this);this.timeline.add(s);this._scheduleNextRun(i);return s};Qn.prototype.cancel=function t(e){e.active=false;if(this.timeline.remove(e)){this._reschedule()}};Qn.prototype.cancelAll=function t(e){this.timeline.removeAll(e);this._reschedule()};Qn.prototype._reschedule=function t(){if(this.timeline.isEmpty()){this._unschedule()}else{this._scheduleNextRun(this.now())}};Qn.prototype._unschedule=function t(){this.timer.clearTimer(this._timer);this._timer=null};Qn.prototype._scheduleNextRun=function t(e){if(this.timeline.isEmpty()){return}var n=this.timeline.nextArrival();if(this._timer===null){this._scheduleNextArrival(n,e)}else if(n<this._nextArrival){this._unschedule();this._scheduleNextArrival(n,e)}};Qn.prototype._scheduleNextArrival=function t(e,n){this._nextArrival=e;var r=Math.max(0,e-n);this._timer=this.timer.setTimer(this._runReadyTasksBound,r)};Qn.prototype._runReadyTasks=function t(e){this._timer=null;this.timeline.runTasks(e,Kn);this._scheduleNextRun(this.now())};var Un=function t(){this.tasks=[]};Un.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};Un.prototype.isEmpty=function t(){return this.tasks.length===0};Un.prototype.add=function t(e){Yn(e,this.tasks)};Un.prototype.remove=function t(e){var n=$n(e.time,this.tasks);if(n>=0&&n<this.tasks.length){var r=h(e,this.tasks[n].events);if(r>=0){this.tasks[n].events.splice(r,1);return true}}return false};Un.prototype.removeAll=function t(e){var n=this;for(var r=0;r<this.tasks.length;++r){Zn(e,n.tasks[r])}};Un.prototype.runTasks=function t(e,n){var r=this;var i=this.tasks;var s=i.length;var o=0;while(o<s&&i[o].time<=e){++o}this.tasks=i.slice(o);for(var u=0;u<o;++u){r.tasks=Xn(n,i[u].events,r.tasks)}};function Xn(t,e,n){for(var r=0;r<e.length;++r){var i=e[r];if(i.active){t(i);if(i.period>=0&&i.active){i.time=i.time+i.period;Yn(i,n)}}}return n}function Yn(t,e){var n=e.length;if(n===0){e.push(tr(t.time,[t]));return}var r=$n(t.time,e); | ||
if(r>=n){e.push(tr(t.time,[t]))}else if(t.time===e[r].time){e[r].events.push(t)}else{e.splice(r,0,tr(t.time,[t]))}}function Zn(t,e){e.events=u(t,e.events)}function $n(t,e){var n=0;var r=e.length;var i,s;while(n<r){i=Math.floor((n+r)/2);s=e[i];if(t===s.time){return i}else if(t<s.time){r=i}else{n=i+1}}return r}var tr=function(t,e){return{time:t,events:e}};var er=function t(){this.now=Date.now};er.prototype.setTimer=function t(e,n){return n<=0?rr(e):setTimeout(e,n)};er.prototype.clearTimer=function t(e){return e instanceof nr?e.cancel():clearTimeout(e)};var nr=function t(e){this.f=e;this.active=true};nr.prototype.run=function t(){return this.active&&this.f()};nr.prototype.error=function t(e){throw e};nr.prototype.cancel=function t(){this.active=false};function rr(t){var e=new nr(t);Jn(e);return e}var ir=f(nt);var sr=v(ht);var or=v(pt);var ur=f(lt);var hr=f(mt);var cr=f(jt);var ar=f(Nt);var pr=f(Ft);var fr=f(Gt);var vr=f(Ht);var lr=f(ie);var dr=f(fe);var yr=f(Rt);var wr=f(le);var kr=f(oe);var mr=v(ue);var _r=f($t);var gr=v(xe);var br=f(Se);var xr=f(Ge);var Ar=f(Je);var Ir=f(Xe);var Tr=f(Ye);var Er=v(Ze);var Pr=f(sn);var Cr=f(hn);var Mr=f(pn);var Rr=f(fn);var Sr=f(vn);var qr=f(gn);var Nr=f(An);var jr=f(Mn);var Br=f(On);var Vr=function(t,e){return new Qn(t,e)};var Wr=function(){return new Un};var Dr=function(){return new er};var Or=f(Vr);var zr=function(){return Vr(Dr(),Wr())};var Lr=v(P);var Fr=f(C);var Gr=f(R);var Hr=f(M);t.runEffects=ir;t.loop=sr;t.scan=or;t.unfold=ur;t.iterate=hr;t.concat=cr;t.startWith=ar;t.map=pr;t.constant=fr;t.tap=vr;t.ap=lr;t.chain=dr;t.join=ve;t.continueWith=yr;t.concatMap=wr;t.mergeConcurrently=kr;t.mergeMapConcurrently=mr;t.combine=Zt;t.combineArray=_r;t.sample=gr;t.zip=Re;t.zipArray=br;t.filter=xr;t.skipRepeats=He;t.skipRepeatsWith=Ar;t.take=Ir;t.skip=Tr;t.slice=Er;t.takeWhile=Pr;t.skipWhile=Cr;t.until=Mr;t.since=Rr;t.during=Sr;t.delay=qr;t.throttle=Nr;t.debounce=jr;t.recoverWith=Br;t.throwError=zn;t.newTimeline=Wr;t.newClockTimer=Dr;t.newScheduler=Or;t.newDefaultScheduler=zr;t.Scheduler=Qn;t.Timeline=Un;t.ClockTimer=er;t.propagateTask=Lr;t.propagateEventTask=Fr;t.propagateErrorTask=Gr;t.propagateEndTask=Hr;t.Stream=l;t.just=B;t.empty=D;t.never=F;t.periodic=J;t.fromArray=Q;t.fromIterable=$;t.generate=At;t.merge=we;t.mergeArray=ke;t.switchLatest=Oe;t.fromPromise=Nn;t.awaitPromises=qn;Object.defineProperty(t,"__esModule",{value:true})}); | ||
(function(t,n){typeof exports==="object"&&typeof module!=="undefined"?n(exports):typeof define==="function"&&define.amd?define(["exports"],n):n(t.mostCore=t.mostCore||{})})(this,function(t){"use strict";function n(t,n){if(t<0){throw new TypeError("n must be >= 0")}var r=n.length;if(t===0||r===0){return n}if(t>=r){return[]}return e(t,n,r-t)}function e(t,n,e){var r=new Array(e);for(var i=0;i<e;++i){r[i]=n[t+i]}return r}function r(t){return n(1,t)}function i(t){var n=t.length;var e=new Array(n);for(var r=0;r<n;++r){e[r]=t[r]}return e}function o(t,n){var e=n.length;var r=new Array(e);for(var i=0;i<e;++i){r[i]=t(n[i])}return r}function s(t,n,e){var r=n;for(var i=0,o=e.length;i<o;++i){r=t(r,e[i],i)}return r}var u=function(t){return t};var c=function(t,n){return function(e){return t(n(e))}};var h=function(t,n){return t(n)};function a(t){function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}return n}function p(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return a(function(n,r){return t(e,n,r)});case 2:return function(n){return t(e,r,n)};default:return t(e,r,i)}}return n}var f=function(){return v};var v=new(function(){function t(){}t.prototype.dispose=function t(){};return t}());var l=function(t){return new d(t)};var d=function t(n){this.disposed=false;this.disposable=n};d.prototype.dispose=function t(){if(!this.disposed){this.disposed=true;this.disposable.dispose();this.disposable=undefined}};var y=function t(n,e){this._dispose=n;this._resource=e};y.prototype.dispose=function t(){this._dispose(this._resource)};function _(t,n,e){var r=n;for(var i=0,o=e.length;i<o;++i){r=t(r,e[i],i)}return r}var w=function(t){return new m(t)};var k=function(t,n){return w([t,n])};var m=function t(n){this.disposables=n};m.prototype.dispose=function t(){x(b(this.disposables))};var b=function(t){return _(g,[],t)};var g=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t};var x=function(t){if(t.length>0){throw new j(t.length+" errors",t)}};var j=function(t){function n(n,e){t.call(this,n);this.message=n;this.name=this.constructor.name;this.errors=e;if(t.captureStackTrace){t.captureStackTrace(this,this.constructor)}this.stack=""+this.stack+I(this.errors)}if(t){n.__proto__=t}n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.toString=function t(){return this.stack};return n}(Error);var I=function(t){return _(O,"",t)};var O=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack};function E(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}}function A(t){setTimeout(C,0,t)}function C(t){throw t}var P=function(t,n,e){return new S(t,n,e)};var T=function(t,n){return P(B,t,n)};var q=function(t,n){return P(V,t,n)};var M=function(t,n){return P(W,t,n)};var S=function t(n,e,r){this._run=n;this.value=e;this.sink=r;this.active=true};S.prototype.dispose=function t(){this.active=false};S.prototype.run=function t(n){if(!this.active){return}var t=this._run;t(n,this.value,this.sink,this)};S.prototype.error=function t(n,e){if(!this.active){return A(e)}this.sink.error(n,e)};var B=function(t,n,e){return e.event(t,n)};var V=function(t,n,e){return e.end(t,n)};var W=function(t,n,e){return e.error(t,n)};var N=function(t){return new R(t)};var R=function t(n){this.value=n};R.prototype.run=function t(n,e){return e.asap(P(D,this.value,n))};function D(t,n,e){e.event(t,n);e.end(t,undefined)}var z=function(){return F};var L=function t(){};L.prototype.run=function t(n,e){return e.asap(q(undefined,n))};var F=new L;var G=function(){return J};var H=function t(){};H.prototype.run=function t(){return f()};var J=new H;var K=function(t){return new Q(t)};var Q=function t(n){this.period=n};Q.prototype.run=function t(n,e){return e.periodic(this.period,T(undefined,n))};var U=function(t){return new X(t)};var X=function t(n){this.array=n};X.prototype.run=function t(n,e){return e.asap(P(Y,this.array,n))};function Y(t,n,e,r){for(var i=0,o=n.length;i<o&&r.active;++i){e.event(t,n[i])}r.active&&s(t);function s(t){e.end(t)}}var Z;if(typeof Set==="function"&&typeof(new Set)["@@iterator"]==="function"){Z="@@iterator"}else{Z=typeof Symbol==="function"&&Symbol.iterator||"_es6shim_iterator_"}function $(t){return t[Z]()}var tt=function(t){return new nt(t)};var nt=function t(n){this.iterable=n};nt.prototype.run=function t(n,e){return e.asap(P(et,$(this.iterable),n))};function et(t,n,e,r){var i=n.next();while(!i.done&&r.active){e.event(t,i.value);i=n.next()}r.active&&e.end(t,i.value)}var rt=function t(){var n=this;this.disposable=void 0;this.disposed=false;this._resolve=void 0;this.result=new Promise(function(t){n._resolve=t})};rt.prototype.setDisposable=function t(n){if(this.disposable!==void 0){throw new Error("setDisposable called more than once")}this.disposable=n;if(this.disposed){this._resolve(n.dispose())}};rt.prototype.dispose=function t(){if(this.disposed){return this.result}this.disposed=true;if(this.disposable!==void 0){this.result=this.disposable.dispose()}return this.result};var it=function(t,n){return new Promise(function(e,r){return ot(t,n,e,r)})};function ot(t,n,e,r){var i=new rt;var o=new st(e,r,i);i.setDisposable(t.run(o,n))}var st=function t(n,e,r){this._end=n;this._error=e;this._disposable=r;this.active=true};st.prototype.event=function t(n,e){};st.prototype.end=function t(n,e){if(!this.active){return}this._dispose(this._error,this._end,e)};st.prototype.error=function t(n,e){this._dispose(this._error,this._error,e)};st.prototype._dispose=function t(n,e,r){this.active=false;ut(n,e,r,this._disposable)};function ut(t,n,e,r){try{r.dispose()}catch(n){t(n);return}n(e)}var ct=function t(n){this.sink=n};ct.prototype.event=function t(n,e){return this.sink.event(n,e)};ct.prototype.end=function t(n,e){return this.sink.end(n,e)};ct.prototype.error=function t(n,e){return this.sink.error(n,e)};var ht=function(t,n,e){return new at(t,n,e)};var at=function t(n,e,r){this.step=n;this.seed=e;this.source=r};at.prototype.run=function t(n,e){return this.source.run(new pt(this.step,this.seed,n),e)};var pt=function(t){function n(n,e,r){t.call(this,r);this.step=n;this.seed=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.step(this.seed,e);this.seed=r.seed;this.sink.event(n,r.value)};n.prototype.end=function t(n){this.sink.end(n,this.seed)};return n}(ct);var ft=function(t,n,e){return new vt(t,n,e)};var vt=function t(n,e,r){this.source=r;this.f=n;this.value=e};vt.prototype.run=function t(n,e){var r=e.asap(T(this.value,n));var i=this.source.run(new lt(this.f,this.value,n),e);return k(r,i)};var lt=function(t){function n(n,e,r){t.call(this,r);this.f=n;this.value=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.value=r(this.value,e);this.sink.event(n,this.value)};return n}(ct);var dt=function(t,n){return new yt(t,n)};var yt=function t(n,e){this.f=n;this.value=e};yt.prototype.run=function t(n,e){return new _t(this.f,this.value,n,e)};var _t=function t(n,e,r,i){var o=this;this.f=n;this.sink=r;this.scheduler=i;this.active=true;var s=function(t){return o.sink.error(o.scheduler.now(),t)};var u=function(t){return wt(t,e)};Promise.resolve(this).then(u).catch(s)};_t.prototype.dispose=function t(){this.active=false};function wt(t,n){var e=t.f;return Promise.resolve(e(n)).then(function(n){return kt(t,n)})}function kt(t,n){if(n.done){t.sink.end(t.scheduler.now(),n.value);return n.value}t.sink.event(t.scheduler.now(),n.value);return t.active?wt(t,n.seed):n.value}var mt=function(t,n){return new bt(t,n)};var bt=function t(n,e){this.f=n;this.value=e};bt.prototype.run=function t(n,e){return new gt(this.f,this.value,n,e)};var gt=function t(n,e,r,i){var o=this;this.f=n;this.sink=r;this.scheduler=i;this.active=true;var s=function(t){return o.sink.error(o.scheduler.now(),t)};var u=function(t){return xt(t,e)};Promise.resolve(this).then(u).catch(s)};gt.prototype.dispose=function t(){this.active=false};function xt(t,n){t.sink.event(t.scheduler.now(),n);if(!t.active){return n}var e=t.f;return Promise.resolve(e(n)).then(function(n){return jt(t,n)})}var jt=function(t,n){return t.active?xt(t,n):t.value};function It(t){return new Ot(t,r(arguments))}var Ot=function t(n,e){this.f=n;this.args=e};Ot.prototype.run=function t(n,e){return new Et(this.f.apply(void 0,this.args),n,e)};var Et=function t(n,e,r){var i=this;this.iterator=n;this.sink=e;this.scheduler=r;this.active=true;var o=function(t){return i.sink.error(i.scheduler.now(),t)};Promise.resolve(this).then(At).catch(o)};Et.prototype.dispose=function t(){this.active=false};var At=function(t,n){return t.active?Ct(t,t.iterator.next(n)):n};function Ct(t,n){if(n.done){return t.sink.end(t.scheduler.now(),n.value)}return Promise.resolve(n.value).then(function(n){return Pt(t,n)},function(n){return Tt(t,n)})}function Pt(t,n){t.sink.event(t.scheduler.now(),n);return At(t,n)}function Tt(t,n){return Ct(t,t.iterator.throw(n))}var qt=function(t,n){return new Mt(t,n)};var Mt=function t(n,e){this.f=n;this.source=e};Mt.prototype.run=function t(n,e){return new St(this.f,this.source,n,e)};var St=function(t){function n(n,e,r,i){t.call(this,r);this.f=n;this.scheduler=i;this.active=true;this.disposable=l(e.run(this,i))}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}this.sink.event(n,e)};n.prototype.end=function t(n,e){if(!this.active){return}E(n,this.disposable,this.sink);this._startNext(n,e,this.sink)};n.prototype._startNext=function t(n,e,r){try{this.disposable=this._continue(this.f,e,r)}catch(t){r.error(n,t)}};n.prototype._continue=function t(n,e,r){return n(e).run(r,this.scheduler)};n.prototype.dispose=function t(){this.active=false;return this.disposable.dispose()};return n}(ct);var Bt=function(t,n){return Vt(N(t),n)};var Vt=function(t,n){return qt(function(){return n},t)};var Wt=function t(n,e){this.p=n;this.source=e};Wt.prototype.run=function t(n,e){return this.source.run(new Nt(this.p,n),e)};Wt.create=function t(n,e){if(e instanceof Wt){return new Wt(Rt(e.p,n),e.source)}return new Wt(n,e)};var Nt=function(t){function n(n,e){t.call(this,e);this.p=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.p;r(e)&&this.sink.event(n,e)};return n}(ct);var Rt=function(t,n){return function(e){return t(e)&&n(e)}};var Dt=function t(n,e,r){this.p=n;this.f=e;this.source=r};Dt.prototype.run=function t(n,e){return this.source.run(new zt(this.p,this.f,n),e)};var zt=function(t){function n(n,e,r){t.call(this,r);this.p=n;this.f=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;var i=this.p;i(e)&&this.sink.event(n,r(e))};return n}(ct);var Lt=function t(n,e){this.f=n;this.source=e};Lt.prototype.run=function t(n,e){return this.source.run(new Ft(this.f,n),e)};Lt.create=function t(n,e){if(e instanceof Lt){return new Lt(c(n,e.f),e.source)}if(e instanceof Wt){return new Dt(e.p,n,e.source)}return new Lt(n,e)};var Ft=function(t){function n(n,e){t.call(this,e);this.f=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.sink.event(n,r(e))};return n}(ct);var Gt=function(t,n){return Lt.create(t,n)};var Ht=function(t,n){return Gt(function(){return t},n)};var Jt=function(t,n){return new Kt(t,n)};var Kt=function t(n,e){this.source=e;this.f=n};Kt.prototype.run=function t(n,e){return this.source.run(new Qt(this.f,n),e)};var Qt=function(t){function n(n,e){t.call(this,e);this.f=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;r(e);this.sink.event(n,e)};return n}(ct);function Ut(t,n){this.sink=n;this.index=t;this.active=true;this.value=void 0}Ut.prototype.event=function(t,n){if(!this.active){return}this.value=n;this.sink.event(t,this)};Ut.prototype.end=function(t,n){if(!this.active){return}this.active=false;this.sink.end(t,{index:this.index,value:n})};Ut.prototype.error=ct.prototype.error;function Xt(t,n){switch(n.length){case 0:return t();case 1:return t(n[0]);case 2:return t(n[0],n[1]);case 3:return t(n[0],n[1],n[2]);case 4:return t(n[0],n[1],n[2],n[3]);case 5:return t(n[0],n[1],n[2],n[3],n[4]);default:return t.apply(void 0,n)}}function Yt(t){return Zt(t,r(arguments))}var Zt=function(t,n){return n.length===0?z():n.length===1?Gt(t,n[0]):new $t(t,n)};var $t=function t(n,e){this.f=n;this.sources=e};$t.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var o=new Array(i);var s=new Array(i);var u=new tn(o,s,n,this.f);for(var c=void 0,h=0;h<i;++h){c=s[h]=new Ut(h,u);o[h]=r.sources[h].run(c,e)}return w(o)};var tn=function(t){function n(n,e,r,i){var o=this;t.call(this,r);this.disposables=n;this.sinks=e;this.f=i;var s=e.length;this.awaiting=s;this.values=new Array(s);this.hasValue=new Array(s);for(var u=0;u<s;++u){o.hasValue[u]=false}this.activeCount=e.length}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=e.index;var i=this._updateReady(r);this.values[r]=e.value;if(i===0){this.sink.event(n,Xt(this.f,this.values))}};n.prototype._updateReady=function t(n){if(this.awaiting>0){if(!this.hasValue[n]){this.hasValue[n]=true;this.awaiting-=1}}return this.awaiting};n.prototype.end=function t(n,e){E(n,this.disposables[e.index],this.sink);if(--this.activeCount===0){this.sink.end(n,e.value)}};return n}(ct);function nn(t,n){return Yt(h,t,n)}function en(){this.head=null;this.length=0}en.prototype.add=function(t){if(this.head!==null){this.head.prev=t;t.next=this.head}this.head=t;++this.length};en.prototype.remove=function(t){--this.length;if(t===this.head){this.head=this.head.next}if(t.next!==null){t.next.prev=t.prev;t.next=null}if(t.prev!==null){t.prev.next=t.next;t.prev=null}};en.prototype.isEmpty=function(){return this.length===0};en.prototype.dispose=function(){if(this.isEmpty()){return Promise.resolve()}var t=[];var n=this.head;this.head=null;this.length=0;while(n!==null){t.push(n.dispose());n=n.next}return Promise.all(t)};var rn=function(t,n){return on(u,t,n)};var on=function(t,n,e){return new sn(t,n,e)};var sn=function t(n,e,r){this.f=n;this.concurrency=e;this.source=r};sn.prototype.run=function t(n,e){return new un(this.f,this.concurrency,this.source,n,e)};var un=function t(n,e,r,i,o){this.f=n;this.concurrency=e;this.sink=i;this.scheduler=o;this.pending=[];this.current=new en;this.disposable=l(r.run(this,o));this.active=true};un.prototype.event=function t(n,e){this._addInner(n,e)};un.prototype._addInner=function t(n,e){if(this.current.length<this.concurrency){this._startInner(n,e)}else{this.pending.push(e)}};un.prototype._startInner=function t(n,e){try{this._initInner(n,e)}catch(t){this.error(n,t)}};un.prototype._initInner=function t(n,e){var r=new hn(n,this,this.sink);r.disposable=cn(this.f,e,r,this.scheduler);this.current.add(r)};un.prototype.end=function t(n,e){this.active=false;E(n,this.disposable,this.sink);this._checkEnd(n,e)};un.prototype.error=function t(n,e){this.active=false;this.sink.error(n,e)};un.prototype.dispose=function t(){this.active=false;this.pending.length=0;this.disposable.dispose();this.current.dispose()};un.prototype._endInner=function t(n,e,r){this.current.remove(r);E(n,r,this);if(this.pending.length===0){this._checkEnd(n,e)}else{this._startInner(n,this.pending.shift())}};un.prototype._checkEnd=function t(n,e){if(!this.active&&this.current.isEmpty()){this.sink.end(n,e)}};var cn=function(t,n,e,r){return t(n).run(e,r)};var hn=function t(n,e,r){this.prev=this.next=null;this.time=n;this.outer=e;this.sink=r;this.disposable=void 0};hn.prototype.event=function t(n,e){this.sink.event(Math.max(n,this.time),e)};hn.prototype.end=function t(n,e){this.outer._endInner(Math.max(n,this.time),e,this)};hn.prototype.error=function t(n,e){this.outer.error(Math.max(n,this.time),e)};hn.prototype.dispose=function t(){return this.disposable.dispose()};var an=function(t,n){return on(t,Infinity,n)};var pn=function(t){return rn(Infinity,t)};var fn=function(t,n){return on(t,1,n)};function vn(){return ln(i(arguments))}var ln=function(t){return t.length===0?z():t.length===1?t[0]:dn(t)};var dn=function(t){return new _n(s(yn,[],t))};var yn=function(t,n){return t.concat(n instanceof _n?n.sources:n)};var _n=function t(n){this.sources=n};_n.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var o=new Array(i);var s=new Array(i);var u=new wn(o,s,n);for(var c=void 0,h=0;h<i;++h){c=s[h]=new Ut(h,u);o[h]=r.sources[h].run(c,e)}return w(o)};var wn=function(t){function n(n,e,r){t.call(this,r);this.disposables=n;this.activeCount=e.length}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){this.sink.event(n,e.value)};n.prototype.end=function t(n,e){E(n,this.disposables[e.index],this.sink);if(--this.activeCount===0){this.sink.end(n,e.value)}};return n}(ct);var kn=function(t,n,e){return new mn(t,n,e)};var mn=function t(n,e,r){this.source=r;this.sampler=e;this.f=n};mn.prototype.run=function t(n,e){var r=new bn(this.f,this.source,n);var i=this.source.run(r.hold,e);var o=this.sampler.run(r,e);return k(o,i)};var bn=function(t){function n(n,e,r){t.call(this,r);this.source=e;this.f=n;this.hold=new gn(this)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.hold.hasValue){var r=this.f;this.sink.event(n,r(e,this.hold.value))}};return n}(ct);var gn=function(t){function n(n){t.call(this,n);this.hasValue=false}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){this.value=e;this.hasValue=true};n.prototype.end=function t(){};return n}(ct);function xn(t){this._capacity=t||32;this._length=0;this._head=0}xn.prototype.push=function(t){var n=this._length;this._checkCapacity(n+1);var e=this._head+n&this._capacity-1;this[e]=t;this._length=n+1};xn.prototype.shift=function(){var t=this._head;var n=this[t];this[t]=void 0;this._head=t+1&this._capacity-1;this._length--;return n};xn.prototype.isEmpty=function(){return this._length===0};xn.prototype.length=function(){return this._length};xn.prototype._checkCapacity=function(t){if(this._capacity<t){this._ensureCapacity(this._capacity<<1)}};xn.prototype._ensureCapacity=function(t){var n=this._capacity;this._capacity=t;var e=this._head+this._length;if(e>n){jn(this,0,this,n,e&n-1)}};function jn(t,n,e,r,i){for(var o=0;o<i;++o){e[o+r]=t[o+n];t[o+n]=void 0}}function In(t){return On(t,r(arguments))}var On=function(t,n){return n.length===0?z():n.length===1?Gt(t,n[0]):new En(t,n)};var En=function t(n,e){this.f=n;this.sources=e};En.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var o=new Array(i);var s=new Array(i);var u=new Array(i);var c=new An(this.f,u,s,n);for(var h=void 0,a=0;a<i;++a){u[a]=new xn;h=s[a]=new Ut(a,c);o[a]=r.sources[a].run(h,e)}return w(o)};var An=function(t){function n(n,e,r,i){t.call(this,i);this.f=n;this.sinks=r;this.buffers=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.buffers;var i=r[e.index];i.push(e.value);if(i.length()===1){if(!qn(this.buffers)){return}Cn(this.f,n,r,this.sink);if(Tn(this.buffers,this.sinks)){this.sink.end(n,void 0)}}};n.prototype.end=function t(n,e){var r=this.buffers[e.index];if(r.isEmpty()){this.sink.end(n,e.value)}};return n}(ct);var Cn=function(t,n,e,r){return r.event(n,Xt(t,o(Pn,e)))};var Pn=function(t){return t.shift()};function Tn(t,n){for(var e=0,r=t.length;e<r;++e){if(t[e].isEmpty()&&!n[e].active){return true}}return false}function qn(t){for(var n=0,e=t.length;n<e;++n){if(t[n].isEmpty()){return false}}return true}var Mn=function(t){return new Sn(t)};var Sn=function t(n){this.source=n};Sn.prototype.run=function t(n,e){var r=new Bn(n,e);return k(r,this.source.run(r,e))};var Bn=function t(n,e){this.sink=n;this.scheduler=e;this.current=null;this.ended=false};Bn.prototype.event=function t(n,e){this._disposeCurrent(n);this.current=new Vn(n,Infinity,this,this.sink);this.current.disposable=e.run(this.current,this.scheduler)};Bn.prototype.end=function t(n,e){this.ended=true;this._checkEnd(n,e)};Bn.prototype.error=function t(n,e){this.ended=true;this.sink.error(n,e)};Bn.prototype.dispose=function t(){return this._disposeCurrent(this.scheduler.now())};Bn.prototype._disposeCurrent=function t(n){if(this.current!==null){return this.current._dispose(n)}};Bn.prototype._disposeInner=function t(n,e){e._dispose(n);if(e===this.current){this.current=null}};Bn.prototype._checkEnd=function t(n,e){if(this.ended&&this.current===null){this.sink.end(n,e)}};Bn.prototype._endInner=function t(n,e,r){this._disposeInner(n,r);this._checkEnd(n,e)};Bn.prototype._errorInner=function t(n,e,r){this._disposeInner(n,r);this.sink.error(n,e)};var Vn=function t(n,e,r,i){this.min=n;this.max=e;this.outer=r;this.sink=i;this.disposable=f()};Vn.prototype.event=function t(n,e){if(n<this.max){this.sink.event(Math.max(n,this.min),e)}};Vn.prototype.end=function t(n,e){this.outer._endInner(Math.max(n,this.min),e,this)};Vn.prototype.error=function t(n,e){this.outer._errorInner(Math.max(n,this.min),e,this)};Vn.prototype._dispose=function t(n){this.max=n;E(n,this.disposable,this.sink)};var Wn=function(t,n){return Wt.create(t,n)};var Nn=function(t){return Rn(Ln,t)};var Rn=function(t,n){return new Dn(t,n)};var Dn=function t(n,e){this.equals=n;this.source=e};Dn.prototype.run=function t(n,e){return this.source.run(new zn(this.equals,n),e)};var zn=function(t){function n(n,e){t.call(this,e);this.equals=n;this.value=void 0;this.init=true}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.init){this.init=false;this.value=e;this.sink.event(n,e)}else if(!this.equals(this.value,e)){this.value=e;this.sink.event(n,e)}};return n}(ct);function Ln(t,n){return t===n}var Fn=function(t,n){return Hn(0,t,n)};var Gn=function(t,n){return Hn(t,Infinity,n)};var Hn=function(t,n,e){return n<=t?z():Jn(t,n,e)};var Jn=function(t,n,e){return e instanceof Lt?Kn(t,n,e):e instanceof Un?Qn(t,n,e):new Un(t,n,e)};var Kn=function(t,n,e){return Lt.create(e.f,Jn(t,n,e.source))};function Qn(t,n,e){var r=t+e.min;var i=Math.min(n+e.min,e.max);return new Un(r,i,e.source)}var Un=function t(n,e,r){this.source=r;this.min=n;this.max=e};Un.prototype.run=function t(n,e){return new Xn(this.min,this.max-this.min,this.source,n,e)};var Xn=function(t){function n(n,e,r,i,o){t.call(this,i);this.skip=n;this.take=e;this.disposable=l(r.run(this,o))}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skip>0){this.skip-=1;return}if(this.take===0){return}this.take-=1;this.sink.event(n,e);if(this.take===0){this.dispose();this.sink.end(n,e)}};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(ct);var Yn=function(t,n){return new Zn(t,n)};var Zn=function t(n,e){this.p=n;this.source=e};Zn.prototype.run=function t(n,e){return new $n(this.p,this.source,n,e)};var $n=function(t){function n(n,e,r,i){t.call(this,r);this.p=n;this.active=true;this.disposable=l(e.run(this,i))}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}var r=this.p;this.active=r(e);if(this.active){this.sink.event(n,e)}else{this.dispose();this.sink.end(n,e)}};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(ct);var te=function(t,n){return new ne(t,n)};var ne=function t(n,e){this.p=n;this.source=e};ne.prototype.run=function t(n,e){return this.source.run(new ee(this.p,n),e)};var ee=function(t){function n(n,e){t.call(this,e);this.p=n;this.skipping=true}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skipping){var r=this.p;this.skipping=r(e);if(this.skipping){return}}this.sink.event(n,e)};return n}(ct);var re=function(t,n){return new se(t,n)};var ie=function(t,n){return new ue(t,n)};var oe=function(t,n){return re(pn(t),ie(t,n))};var se=function t(n,e){this.maxSignal=n;this.source=e};se.prototype.run=function t(n,e){var r=new ce(-Infinity,n);var i=new pe(this.maxSignal,n,e);var o=this.source.run(new he(r,i,n),e);return w([r,i,o])};var ue=function t(n,e){this.minSignal=n;this.source=e};ue.prototype.run=function t(n,e){var r=new ae(this.minSignal,n,e);var i=new ce(Infinity,n);var o=this.source.run(new he(r,i,n),e);return w([r,i,o])};var ce=function(t){function n(n,e){t.call(this,e);this.value=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(){};n.prototype.end=function t(){};n.prototype.dispose=function t(){};return n}(ct);var he=function(t){function n(n,e,r){t.call(this,r);this.min=n;this.max=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n>=this.min.value&&n<this.max.value){this.sink.event(n,e)}};return n}(ct);var ae=function(t){function n(n,e,r){t.call(this,e);this.value=Infinity;this.disposable=n.run(this,r)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n){if(n<this.value){this.value=n}};n.prototype.end=function t(){};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(ct);var pe=function(t){function n(n,e,r){t.call(this,e);this.value=Infinity;this.disposable=n.run(this,r)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n<this.value){this.value=n;this.sink.end(n,e)}};n.prototype.end=function t(){};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(ct);var fe=function(t,n){return t<=0?n:new ve(t,n)};var ve=function t(n,e){this.dt=n;this.source=e};ve.prototype.run=function t(n,e){var r=new le(this.dt,n,e);return k(r,this.source.run(r,e))};var le=function(t){function n(n,e,r){t.call(this,e);this.dt=n;this.scheduler=r}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.dispose=function t(){var n=this;this.scheduler.cancelAll(function(t){return t.sink===n.sink})};n.prototype.event=function t(n,e){this.scheduler.delay(this.dt,T(e,this.sink))};n.prototype.end=function t(n,e){this.scheduler.delay(this.dt,q(e,this.sink))};return n}(ct);var de=function(t,n){return n instanceof Lt?ye(t,n):n instanceof we?_e(t,n):new we(t,n)};var ye=function(t,n){return Lt.create(n.f,de(t,n.source))};var _e=function(t,n){return new we(Math.max(t,n.period),n.source)};var we=function t(n,e){this.period=n;this.source=e};we.prototype.run=function t(n,e){return this.source.run(new ke(this.period,n),e)};var ke=function(t){function n(n,e){t.call(this,e);this.time=0;this.period=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n>=this.time){this.time=n+this.period;this.sink.event(n,e)}};return n}(ct);var me=function(t,n){return new be(t,n)};var be=function t(n,e){this.dt=n;this.source=e};be.prototype.run=function t(n,e){return new ge(this.dt,this.source,n,e)};var ge=function t(n,e,r,i){this.dt=n;this.sink=r;this.scheduler=i;this.value=void 0;this.timer=null;var o=e.run(this,i);this.disposable=k(this,o)};ge.prototype.event=function t(n,e){this._clearTimer();this.value=e;this.timer=this.scheduler.delay(this.dt,T(e,this.sink))};ge.prototype.end=function t(n,e){if(this._clearTimer()){this.sink.event(n,this.value);this.value=void 0}this.sink.end(n,e)};ge.prototype.error=function t(n,e){this._clearTimer();this.sink.error(n,e)};ge.prototype.dispose=function t(){this._clearTimer()};ge.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var xe=function(t){return new Ie(t)};var je=c(xe,N);var Ie=function t(n){this.source=n};Ie.prototype.run=function t(n,e){return this.source.run(new Oe(n,e),e)};var Oe=function t(n,e){var r=this;this.sink=n;this.scheduler=e;this.queue=Promise.resolve();this._eventBound=function(t){return r.sink.event(r.scheduler.now(),t)};this._endBound=function(t){return r.sink.end(r.scheduler.now(),t)};this._errorBound=function(t){return r.sink.error(r.scheduler.now(),t)}};Oe.prototype.event=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._event(e)}).catch(this._errorBound)};Oe.prototype.end=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._end(e)}).catch(this._errorBound)};Oe.prototype.error=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._errorBound(e)}).catch(A)};Oe.prototype._event=function t(n){return n.then(this._eventBound)};Oe.prototype._end=function t(n){return Promise.resolve(n).then(this._endBound)};function Ee(t){this.sink=t;this.active=true}Ee.prototype.event=function(t,n){if(!this.active){return}this.sink.event(t,n)};Ee.prototype.end=function(t,n){if(!this.active){return}this.disable();this.sink.end(t,n)};Ee.prototype.error=function(t,n){this.disable();this.sink.error(t,n)};Ee.prototype.disable=function(){this.active=false;return this.sink};function Ae(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}function Ce(t,n,e){try{e.end(t,n)}catch(n){e.error(t,n)}}var Pe=function(t,n){return new Me(t,n)};var Te=function(t){return new qe(t)};var qe=function t(n){this.value=n};qe.prototype.run=function t(n,e){return e.asap(M(this.value,n))};var Me=function t(n,e){this.f=n;this.source=e};Me.prototype.run=function t(n,e){return new Se(this.f,this.source,n,e)};var Se=function t(n,e,r,i){this.f=n;this.sink=new Ee(r);this.scheduler=i;this.disposable=e.run(this,i)};Se.prototype.event=function t(n,e){Ae(n,e,this.sink)};Se.prototype.end=function t(n,e){Ce(n,e,this.sink)};Se.prototype.error=function t(n,e){var r=this.sink.disable();E(n,this.disposable,this.sink);this._startNext(n,e,r)};Se.prototype._startNext=function t(n,e,r){try{this.disposable=this._continue(this.f,e,r)}catch(t){r.error(n,t)}};Se.prototype._continue=function t(n,e,r){var i=n(e);return i.run(r,this.scheduler)};Se.prototype.dispose=function t(){return this.disposable.dispose()};var Be=a(it);var Ve=p(ht);var We=p(ft);var Ne=a(dt);var Re=a(mt);var De=a(Vt);var ze=a(Bt);var Le=a(Gt);var Fe=a(Ht);var Ge=a(Jt);var He=a(nn);var Je=a(an);var Ke=a(qt);var Qe=a(fn);var Ue=a(rn);var Xe=p(on);var Ye=a(Zt);var Ze=p(kn);var $e=a(On);var tr=a(Wn);var nr=a(Rn);var er=a(Fn);var rr=a(Gn);var ir=p(Hn);var or=a(Yn);var sr=a(te);var ur=a(re);var cr=a(ie);var hr=a(oe);var ar=a(fe);var pr=a(de);var fr=a(me);var vr=a(Pe);var lr=p(P);var dr=a(T);var yr=a(M);var _r=a(q);t.runEffects=Be;t.loop=Ve;t.scan=We;t.unfold=Ne;t.iterate=Re;t.concat=De;t.startWith=ze;t.map=Le;t.constant=Fe;t.tap=Ge;t.ap=He;t.chain=Je;t.join=pn;t.continueWith=Ke;t.concatMap=Qe;t.mergeConcurrently=Ue;t.mergeMapConcurrently=Xe;t.combine=Yt;t.combineArray=Ye;t.sample=Ze;t.zip=In;t.zipArray=$e;t.filter=tr;t.skipRepeats=Nn;t.skipRepeatsWith=nr;t.take=er;t.skip=rr;t.slice=ir;t.takeWhile=or;t.skipWhile=sr;t.until=ur;t.since=cr;t.during=hr;t.delay=ar;t.throttle=pr;t.debounce=fr;t.recoverWith=vr;t.throwError=Te;t.propagateTask=lr;t.propagateEventTask=dr;t.propagateErrorTask=yr;t.propagateEndTask=_r;t.just=N;t.empty=z;t.never=G;t.periodic=K;t.fromArray=U;t.fromIterable=tt;t.generate=It;t.merge=vn;t.mergeArray=ln;t.switchLatest=Mn;t.fromPromise=je;t.awaitPromises=xe;Object.defineProperty(t,"__esModule",{value:true})}); |
{ | ||
"name": "@most/core", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Reactive programming with lean, functions-only, curried, tree-shakeable API", | ||
@@ -16,3 +16,3 @@ "typings": "type-definitions/most.d.ts", | ||
"test:unit": "mocha -r buba/register --reporter dot --recursive 'test/**/*-test.js'", | ||
"test:lint": "eslint src test", | ||
"test:lint": "eslint --fix --ignore-path ../../.eslintignore src test", | ||
"test:flow": "flow check", | ||
@@ -48,3 +48,2 @@ "build": "npm run build:dist && npm run build:min && npm run build:flow", | ||
"buba": "^4.0.2", | ||
"buster": "^0.8.0", | ||
"cpy-cli": "^1.0.1", | ||
@@ -61,4 +60,7 @@ "eslint": "^3.15.0", | ||
"dependencies": { | ||
"@most/prelude": "^1.4.0" | ||
"@most/disposable": "^0.4.0", | ||
"@most/prelude": "^1.4.0", | ||
"@most/scheduler": "^0.4.0", | ||
"@most/types": "^0.4.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function ap<A, B>(streamofFunctions: Stream<(a: A) => B>, streamOfValues: Stream<A>): Stream<B>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function startWith<A>(value: A, stream: Stream<A>): Stream<A>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function chain<A, B>(f: (value: A) => Stream<B>, stream: Stream<A>): Stream<B>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function combine<A, B, R>(fn: (a: A, b: B) => R, a: Stream<A>, b: Stream<B>): Stream<R>; |
@@ -1,4 +0,4 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function concatMap<A, B>(f: (a: A) => Stream<B>, stream: Stream<A>): Stream<B>; | ||
export function concatMap<A, B>(f: (a: A) => Stream<B>): (stream: Stream<A>) => Stream<B>; |
@@ -1,4 +0,4 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function continueWith<A>(f: (a: any) => Stream<A>, s: Stream<A>): Stream<A>; | ||
export function continueWith<A>(f: (a: any) => Stream<A>): (s: Stream<A>) => Stream<A>; |
@@ -1,4 +0,4 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function delay<A>(dt: number, s: Stream<A>): Stream<A>; | ||
export function delay<A>(dt: number): (s: Stream<A>) => Stream<A>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function recoverWith<A, E extends Error>(p: (error: E) => Stream<A>, s: Stream<A>): Stream<A>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function filter<A>(p: (a: A) => boolean, s: Stream<A>): Stream<A>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function throttle<A>(period: number, s: Stream<A>): Stream<A>; |
@@ -1,2 +0,3 @@ | ||
import { Stream, SeedValue } from '../types'; | ||
import { Stream } from '../types'; | ||
import { SeedValue } from '../seedValue'; | ||
@@ -3,0 +4,0 @@ export function loop<A, B, S>(f: (seed: S, a: A) => SeedValue<S, B>, seed: S, s: Stream<A>): Stream<B>; |
@@ -1,4 +0,4 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function merge<A>(...streams: Array<Stream<A>>): Stream<A>; | ||
export function mergeArray<A>(streams: Array<Stream<A>>): Stream<A>; |
@@ -1,4 +0,4 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function mergeConcurrently<A>(concurrency: number, s: Stream<Stream<A>>): Stream<A>; | ||
export function mergeConcurrently<A>(concurrency: number): (s: Stream<Stream<A>>) => Stream<A>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function awaitPromises<A>(stream: Stream<Promise<A>>): Stream<A>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ // all 3 args |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function scan<A, B>(f: (b: B, a: A) => B, b: B, s: Stream<A>): Stream<B>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function take<A>(n: number, s: Stream<A>): Stream<A>; |
@@ -1,3 +0,3 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function switchLatest<A>(s: Stream<Stream<A>>): Stream<A>; |
@@ -1,10 +0,10 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function takeUntil<A>(signal: Stream<any>, s: Stream<A>): Stream<A>; | ||
export function takeUntil<A>(signal: Stream<A>): (s: Stream<A>) => Stream<A>; | ||
export function until<A>(signal: Stream<any>, s: Stream<A>): Stream<A>; | ||
export function until<A>(signal: Stream<any>): (s: Stream<A>) => Stream<A>; | ||
export function skipUntil<A>(signal: Stream<any>, s: Stream<A>): Stream<A>; | ||
export function skipUntil<A>(signal: Stream<any>): (s: Stream<A>) => Stream<A>; | ||
export function since<A>(signal: Stream<any>, s: Stream<A>): Stream<A>; | ||
export function since<A>(signal: Stream<any>): (s: Stream<A>) => Stream<A>; | ||
export function during<A>(timeWindow: Stream<Stream<any>>, s: Stream<A>): Stream<A>; | ||
export function during<A>(timeWindow: Stream<Stream<any>>): (s: Stream<A>) => Stream<A>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function map<A, B>(f: (a: A) => B, s: Stream<A>): Stream<B>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function zip<A, B, R>(fn: (a: A, b: B) => R, a: Stream<A>, b: Stream<B>): Stream<R>; |
@@ -1,5 +0,2 @@ | ||
export * from './types'; | ||
export * from './runEffects'; | ||
export * from './scheduler'; | ||
export * from './PropagateTask'; | ||
@@ -30,2 +27,3 @@ | ||
export * from './source/core'; | ||
export * from './source/newStream'; | ||
export * from './source/fromArray'; | ||
@@ -32,0 +30,0 @@ export * from './source/fromIterable'; |
@@ -1,2 +0,2 @@ | ||
import { Sink, Task } from './types'; | ||
import { Sink, Task } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function propagateTask<T>(run: PropagateTaskRun<T>, value: T, sink: Sink<T>): PropagateTask<T>; |
@@ -1,4 +0,4 @@ | ||
import { Scheduler, Stream } from './types'; | ||
import { Scheduler, Stream } from '@most/types'; | ||
export function runEffects(stream: Stream<any>, scheduler: Scheduler): Promise<any>; | ||
export function runEffects(stream: Stream<any>): (scheduler: Scheduler) => Promise<any>; |
@@ -1,2 +0,2 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
@@ -3,0 +3,0 @@ export function just<A>(a: A): Stream<A>; |
@@ -1,4 +0,4 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function fromArray<A>(array: Array<A> | ArrayLike<A>): Stream<A>; | ||
export function fromArray(array: Array<any> | ArrayLike<any>): Stream<any>; |
@@ -1,3 +0,3 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function fromIterable<A>(iterable: Iterable<A>): Stream<A>; |
@@ -1,3 +0,3 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function generate<A>(g: GeneratorFunction, ...args: Array<any>): Stream<A>; |
@@ -1,4 +0,4 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function iterate<A>(f: (a: A) => A | Promise<A>, a: A): Stream<A>; | ||
export function iterate<A>(f: (a: A) => A | Promise<A>): (a: A) => Stream<A>; |
@@ -1,3 +0,3 @@ | ||
import { Stream } from '../types'; | ||
import { Stream } from '@most/types'; | ||
export function periodic(period: number): Stream<void>; |
@@ -1,4 +0,5 @@ | ||
import { Stream, SeedValue } from '../types'; | ||
import { Stream } from '@most/types'; | ||
import { SeedValue } from '../seedValue'; | ||
export function unfold<A, B, S>(f: (seed: S) => SeedValue<S, B|Promise<B>>, seed: S): Stream<B>; | ||
export function unfold<A, B, S>(f: (seed: S) => SeedValue<S, B|Promise<B>>): (seed: S) => Stream<B>; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13
529555
4
4786
+ Added@most/disposable@^0.4.0
+ Added@most/scheduler@^0.4.0
+ Added@most/types@^0.4.0
+ Added@most/disposable@0.4.1(transitive)
+ Added@most/scheduler@0.4.1(transitive)
+ Added@most/types@0.4.1(transitive)