@most/core
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -1,2 +0,1 @@ | ||
(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){var e=n.length;var r=new Array(e+1);for(var i=0;i<e;++i){r[i]=n[i]}r[e]=t;return r}function e(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 r(t,n,e){var r=n;for(var i=0,s=e.length;i<s;++i){r=t(r,e[i],i)}return r}function i(t,n){if(t<0){throw new TypeError("i must be >= 0")}var e=n.length;if(e===0||t>=e){return n}if(e===1){return[]}return s(t,n,e-1)}function s(t,n,e){var r=new Array(e);var i;for(i=0;i<t;++i){r[i]=n[i]}for(i=t;i<e;++i){r[i]=n[i+1]}return r}function o(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}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}function f(t){setTimeout(v,0,t)}function v(t){throw t}var l=function(t,n,e){return new k(t,n,e)};var d=function(t,n){return l(m,t,n)};var y=function(t){return l(w,undefined,t)};var _=function(t,n){return l(g,t,n)};var k=function t(n,e,r){this._run=n;this.value=e;this.sink=r;this.active=true};k.prototype.dispose=function t(){this.active=false};k.prototype.run=function t(n){if(!this.active){return}var t=this._run;t(n,this.value,this.sink)};k.prototype.error=function t(n,e){if(!this.active){return f(e)}this.sink.error(n,e)};var m=function(t,n,e){return e.event(t,n)};var w=function(t,n,e){return e.end(t)};var g=function(t,n,e){return e.error(t,n)};function b(t,n){var e=n.length;var r=new Array(e);var i=0;for(var s=void 0,o=0;o<e;++o){s=n[o];if(!t(s)){r[i]=s;++i}}r.length=i;return r}function x(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}function T(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 A(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return T(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 O=function t(n,e,r,i,s){this.time=n;this.localOffset=e;this.period=r;this.task=i;this.scheduler=s;this.active=true};O.prototype.run=function t(){return this.task.run(this.time-this.localOffset)};O.prototype.error=function t(n){return this.task.error(this.time-this.localOffset,n)};O.prototype.dispose=function t(){this.scheduler.cancel(this);return this.task.dispose()};var j=function t(n,e){this.origin=n;this.scheduler=e};j.prototype.currentTime=function t(){return this.scheduler.currentTime()-this.origin};j.prototype.scheduleTask=function t(n,e,r,i){return this.scheduler.scheduleTask(n+this.origin,e,r,i)};j.prototype.relative=function t(n){return new j(n+this.origin,this.scheduler)};j.prototype.cancel=function t(n){return this.scheduler.cancel(n)};j.prototype.cancelAll=function t(n){return this.scheduler.cancelAll(n)};var I=function(t){return Promise.resolve(t).then(E)};function E(t){try{return t.run()}catch(n){return t.error(n)}}var C=function t(n,e){var r=this;this.timer=n;this.timeline=e;this._timer=null;this._nextArrival=Infinity;this._runReadyTasksBound=function(){return r._runReadyTasks(r.currentTime())}};C.prototype.currentTime=function t(){return this.timer.now()};C.prototype.scheduleTask=function t(n,e,r,i){var s=this.currentTime()+Math.max(0,e);var o=new O(s,n,r,i,this);this.timeline.add(o);this._scheduleNextRun();return o};C.prototype.relative=function t(n){return new j(n,this)};C.prototype.cancel=function t(n){n.active=false;if(this.timeline.remove(n)){this._reschedule()}};C.prototype.cancelAll=function t(n){this.timeline.removeAll(n);this._reschedule()};C.prototype._reschedule=function t(){if(this.timeline.isEmpty()){this._unschedule()}else{this._scheduleNextRun(this.currentTime())}};C.prototype._unschedule=function t(){this.timer.clearTimer(this._timer);this._timer=null};C.prototype._scheduleNextRun=function t(){if(this.timeline.isEmpty()){return}var n=this.timeline.nextArrival();if(this._timer===null){this._scheduleNextArrival(n)}else if(n<this._nextArrival){this._unschedule();this._scheduleNextArrival(n)}};C.prototype._scheduleNextArrival=function t(n){this._nextArrival=n;var e=Math.max(0,n-this.currentTime());this._timer=this.timer.setTimer(this._runReadyTasksBound,e)};C.prototype._runReadyTasks=function t(){this._timer=null;this.timeline.runTasks(this.currentTime(),E);this._scheduleNextRun()};var R=function t(){this.tasks=[]};R.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};R.prototype.isEmpty=function t(){return this.tasks.length===0};R.prototype.add=function t(n){M(n,this.tasks)};R.prototype.remove=function t(n){var e=W(P(n),this.tasks);if(e>=0&&e<this.tasks.length){var r=x(n,this.tasks[e].events);if(r>=0){this.tasks[e].events.splice(r,1);return true}}return false};R.prototype.removeAll=function t(n){var e=this;for(var r=0;r<this.tasks.length;++r){V(n,e.tasks[r])}};R.prototype.runTasks=function t(n,e){var r=this;var i=this.tasks;var s=i.length;var o=0;while(o<s&&i[o].time<=n){++o}this.tasks=i.slice(o);for(var u=0;u<o;++u){r.tasks=q(e,i[u].events,r.tasks)}};function q(t,n,e){for(var r=0;r<n.length;++r){var i=n[r];if(i.active){t(i);if(i.period>=0&&i.active){i.time=i.time+i.period;M(i,e)}}}return e}function M(t,n){var e=n.length;var r=P(t);if(e===0){n.push(D(r,[t]));return}var i=W(r,n);if(i>=e){n.push(D(r,[t]))}else{N(t,n,r,i)}}function N(t,n,e,r){var i=n[r];if(e===i.time){B(t,i.events,e)}else{n.splice(r,0,D(e,[t]))}}function B(t,n){if(n.length===0||t.time>=n[n.length-1].time){n.push(t)}else{S(t,n)}}function S(t,n){for(var e=0;e<n.length;e++){if(t.time<n[e].time){n.splice(e,0,t);break}}}function P(t){return Math.floor(t.time)}function V(t,n){n.events=b(t,n.events)}function W(t,n){var e=0;var r=n.length;var i,s;while(e<r){i=Math.floor((e+r)/2);s=n[i];if(t===s.time){return i}else if(t<s.time){r=i}else{e=i+1}}return r}var D=function(t,n){return{time:t,events:n}};var z=function t(n){this._clock=n};z.prototype.now=function t(){return this._clock.now()};z.prototype.setTimer=function t(n,e){return e<=0?F(n):setTimeout(n,e)};z.prototype.clearTimer=function t(n){return n instanceof L?n.cancel():clearTimeout(n)};var L=function t(n){this.f=n;this.active=true};L.prototype.run=function t(){return this.active&&this.f()};L.prototype.error=function t(n){throw n};L.prototype.cancel=function t(){this.active=false};function F(t){var n=new L(t);I(n);return n}var G=function t(n,e){this.origin=e;this.clock=n};G.prototype.now=function t(){return this.clock.now()-this.origin};var H=function t(n,e){this.origin=e;this.hrtime=n};H.prototype.now=function t(){var n=this.hrtime(this.origin);return(n[0]*1e9+n[1])/1e6};var J=function(t){return t.currentTime()};var K=T(function(t,n){return n.scheduleTask(0,0,-1,t)});var Q=A(function(t,n,e){return e.scheduleTask(0,t,-1,n)});var U=A(function(t,n,e){return e.scheduleTask(0,0,t,n)});var X=T(function(t,n){return n.cancelAll(t)});var Y=T(function(t,n){return new j(t,n)});var Z=function(){return tt};var $=function t(){};$.prototype.run=function t(n,e){return K(y(n),e)};var tt=new $;var nt=function(){return et};var et=new(function(){function t(){}t.prototype.dispose=function t(){};return t}());var rt=function(t){return new it(t)};var it=function t(n){this.disposed=false;this.disposable=n};it.prototype.dispose=function t(){if(!this.disposed){this.disposed=true;this.disposable.dispose();this.disposable=undefined}};function st(t,n,e){var r=n;for(var i=0,s=e.length;i<s;++i){r=t(r,e[i],i)}return r}function ot(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 ut(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return ot(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 ct=function t(n,e){this._dispose=n;this._resource=e};ct.prototype.dispose=function t(){this._dispose(this._resource)};var ht=function(t){return new pt(t)};var at=ot(function(t,n){return ht([t,n])});var pt=function t(n){this.disposables=n};pt.prototype.dispose=function t(){lt(ft(this.disposables))};var ft=function(t){return st(vt,[],t)};var vt=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t};var lt=function(t){if(t.length>0){throw new dt(t.length+" errors",t)}};var dt=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+yt(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 yt=function(t){return st(_t,"",t)};var _t=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack};var kt=ut(function(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}});var mt=function(){return gt};var wt=function t(){};wt.prototype.run=function t(){return nt()};var gt=new wt;var bt=function(t,n){return new xt(t,n)};var xt=function t(n,e){this.time=n;this.value=e};xt.prototype.run=function t(n,e){return Q(this.time,l(Tt,this.value,n),e)};function Tt(t,n,e){e.event(t,n);e.end(t)}var At=function(t){return bt(0,t)};var Ot=function(t){return new jt(t)};var jt=function t(n){this.period=n};jt.prototype.run=function t(n,e){return U(this.period,d(undefined,n),e)};var It=function(t){return new Et(t)};var Et=function t(n){this.run=n};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){return this.sink.end(n)};Ct.prototype.error=function t(n,e){return this.sink.error(n,e)};var Rt=function(t,n){return qt(Mt,t,n)};var qt=function(t,n,e){return n.length===0||e===Z()?Z():new Nt(t,n,e)};var Mt=function(t,n){return t};var Nt=function t(n,e,r){this.f=n;this.values=e;this.source=r};Nt.prototype.run=function t(n,e){return this.source.run(new Bt(this.f,this.values,n),e)};var Bt=function(t){function n(n,e,r){t.call(this,r);this.f=n;this.values=e;this.index=0}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(this.values[this.index],e));this.index+=1;if(this.index>=this.values.length){this.sink.end(n)}};return n}(Ct);var St=function t(){this.disposable=undefined;this.disposed=false};St.prototype.setDisposable=function t(n){if(this.disposable!==void 0){throw new Error("setDisposable called more than once")}this.disposable=n;if(this.disposed){n.dispose()}};St.prototype.dispose=function t(){if(this.disposed){return}this.disposed=true;if(this.disposable!==void 0){this.disposable.dispose()}};var Pt=function(t,n){return new Promise(function(e,r){return Vt(t,n,e,r)})};function Vt(t,n,e,r){var i=new St;var s=new Wt(e,r,i);i.setDisposable(t.run(s,n))}var Wt=function t(n,e,r){this._end=n;this._error=e;this._disposable=r;this.active=true};Wt.prototype.event=function t(n,e){};Wt.prototype.end=function t(n){if(!this.active){return}this._dispose(this._error,this._end,undefined)};Wt.prototype.error=function t(n,e){this._dispose(this._error,this._error,e)};Wt.prototype._dispose=function t(n,e,r){this.active=false;Dt(n,e,r,this._disposable)};function Dt(t,n,e,r){try{r.dispose()}catch(n){t(n);return}n(e)}var zt=function(t,n,e){return new Lt(t,n,e)};var Lt=function t(n,e,r){this.step=n;this.seed=e;this.source=r};Lt.prototype.run=function t(n,e){return this.source.run(new Ft(this.step,this.seed,n),e)};var Ft=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)};return n}(Ct);var Gt=function(t,n,e){return new Ht(t,n,e)};var Ht=function t(n,e,r){this.source=r;this.f=n;this.value=e};Ht.prototype.run=function t(n,e){var r=K(d(this.value,n),e);var i=this.source.run(new Jt(this.f,this.value,n),e);return at(r,i)};var Jt=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 Kt=function t(n,e){this.sink=e;this.offset=n};Kt.prototype.event=function t(n,e){this.sink.event(n+this.offset,e)};Kt.prototype.error=function t(n,e){this.sink.error(n+this.offset,e)};Kt.prototype.end=function t(n){this.sink.end(n+this.offset)};var Qt=function(t,n,e,r){return n.run(Ut(t,e),Y(t,r))};var Ut=function(t,n){return n instanceof Kt?new Kt(t+n.offset,n.sink):new Kt(t,n)};var Xt=function(t,n){return new Yt(t,n)};var Yt=function t(n,e){this.f=n;this.source=e};Yt.prototype.run=function t(n,e){return new Zt(this.f,this.source,n,e)};var Zt=function(t){function n(n,e,r,i){t.call(this,r);this.f=n;this.scheduler=i;this.active=true;this.disposable=rt(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){if(!this.active){return}kt(n,this.disposable,this.sink);this._startNext(n,this.sink)};n.prototype._startNext=function t(n,e){try{this.disposable=this._continue(this.f,n,e)}catch(t){e.error(n,t)}};n.prototype._continue=function t(n,e,r){return Qt(e,n(),r,this.scheduler)};n.prototype.dispose=function t(){this.active=false;return this.disposable.dispose()};return n}(Ct);var $t=function(t,n){return Xt(function(){return n},At(t))};var tn=function t(n,e){this.p=n;this.source=e};tn.prototype.run=function t(n,e){return this.source.run(new nn(this.p,n),e)};tn.create=function t(n,e){if(e instanceof tn){return new tn(en(e.p,n),e.source)}return new tn(n,e)};var nn=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 en=function(t,n){return function(e){return t(e)&&n(e)}};var rn=function t(n,e,r){this.p=n;this.f=e;this.source=r};rn.prototype.run=function t(n,e){return this.source.run(new sn(this.p,this.f,n),e)};var sn=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 on=function t(n,e){this.f=n;this.source=e};on.prototype.run=function t(n,e){return this.source.run(new un(this.f,n),e)};on.create=function t(n,e){if(e instanceof on){return new on(c(n,e.f),e.source)}if(e instanceof tn){return new rn(e.p,n,e.source)}return new on(n,e)};var un=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 cn=function(t,n){return on.create(t,n)};var hn=function(t,n){return cn(function(){return t},n)};var an=function(t,n){return new pn(t,n)};var pn=function t(n,e){this.source=e;this.f=n};pn.prototype.run=function t(n,e){return this.source.run(new fn(this.f,n),e)};var fn=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);var vn=function(t){function n(n,e){t.call(this,e);this.index=n;this.active=true;this.value=undefined}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.value=e;this.sink.event(n,this)};n.prototype.end=function t(n){if(!this.active){return}this.active=false;this.sink.event(n,this)};return n}(Ct);function ln(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 dn(t,n,e){return yn(t,[n,e])}var yn=function(t,n){return n.length===0?Z():n.length===1?cn(t,n[0]):new _n(t,n)};var _n=function t(n,e){this.f=n;this.sources=e};_n.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var s=new Array(i);var o=new Array(i);var u=new kn(s,o,n,this.f);for(var c=void 0,h=0;h<i;++h){c=o[h]=new vn(h,u);s[h]=r.sources[h].run(c,e)}return ht(s)};var kn=function(t){function n(n,e,r,i){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).fill(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){if(!e.active){this._dispose(n,e.index);return}var r=e.index;var i=this._updateReady(r);this.values[r]=e.value;if(i===0){this.sink.event(n,ln(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._dispose=function t(n,e){kt(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Ct);function mn(t,n){return dn(h,t,n)}function wn(){this.head=null;this.length=0}wn.prototype.add=function(t){if(this.head!==null){this.head.prev=t;t.next=this.head}this.head=t;++this.length};wn.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}};wn.prototype.isEmpty=function(){return this.length===0};wn.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 gn=function(t,n){return bn(u,t,n)};var bn=function(t,n,e){return new xn(t,n,e)};var xn=function t(n,e,r){this.f=n;this.concurrency=e;this.source=r};xn.prototype.run=function t(n,e){return new Tn(this.f,this.concurrency,this.source,n,e)};var Tn=function t(n,e,r,i,s){this.f=n;this.concurrency=e;this.sink=i;this.scheduler=s;this.pending=[];this.current=new wn;this.disposable=rt(r.run(this,s));this.active=true};Tn.prototype.event=function t(n,e){this._addInner(n,e)};Tn.prototype._addInner=function t(n,e){if(this.current.length<this.concurrency){this._startInner(n,e)}else{this.pending.push(e)}};Tn.prototype._startInner=function t(n,e){try{this._initInner(n,e)}catch(t){this.error(n,t)}};Tn.prototype._initInner=function t(n,e){var r=new On(n,this,this.sink);r.disposable=An(this.f,n,e,r,this.scheduler);this.current.add(r)};Tn.prototype.end=function t(n){this.active=false;kt(n,this.disposable,this.sink);this._checkEnd(n)};Tn.prototype.error=function t(n,e){this.active=false;this.sink.error(n,e)};Tn.prototype.dispose=function t(){this.active=false;this.pending.length=0;this.disposable.dispose();this.current.dispose()};Tn.prototype._endInner=function t(n,e){this.current.remove(e);kt(n,e,this);if(this.pending.length===0){this._checkEnd(n)}else{this._startInner(n,this.pending.shift())}};Tn.prototype._checkEnd=function t(n){if(!this.active&&this.current.isEmpty()){this.sink.end(n)}};var An=function(t,n,e,r,i){return t(e).run(r,Y(n,i))};var On=function t(n,e,r){this.prev=this.next=null;this.time=n;this.outer=e;this.sink=r;this.disposable=void 0};On.prototype.event=function t(n,e){this.sink.event(n+this.time,e)};On.prototype.end=function t(n){this.outer._endInner(n+this.time,this)};On.prototype.error=function t(n,e){this.outer.error(n+this.time,e)};On.prototype.dispose=function t(){return this.disposable.dispose()};var jn=function(t,n){return bn(t,Infinity,n)};var In=function(t){return gn(Infinity,t)};var En=function(t,n){return bn(t,1,n)};function Cn(t,n){return Rn([t,n])}var Rn=function(t){return t.length===0?Z():t.length===1?t[0]:qn(t)};var qn=function(t){return new Nn(r(Mn,[],t))};var Mn=function(t,n){return t.concat(n instanceof Nn?n.sources:n)};var Nn=function t(n){this.sources=n};Nn.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var s=new Array(i);var o=new Array(i);var u=new Bn(s,o,n);for(var c=void 0,h=0;h<i;++h){c=o[h]=new vn(h,u);s[h]=r.sources[h].run(c,e)}return ht(s)};var Bn=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){if(!e.active){this._dispose(n,e.index);return}this.sink.event(n,e.value)};n.prototype._dispose=function t(n,e){kt(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Ct);var Sn=function(t,n,e){return new Pn(t,n,e)};var Pn=function t(n,e,r){this.source=r;this.sampler=e;this.f=n};Pn.prototype.run=function t(n,e){var r=new Vn(this.f,this.source,n);var i=this.source.run(r.hold,e);var s=this.sampler.run(r,e);return at(s,i)};var Vn=function(t){function n(n,e,r){t.call(this,r);this.source=e;this.f=n;this.hold=new Wn(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 Wn=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 Dn(t){this._capacity=t||32;this._length=0;this._head=0}Dn.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};Dn.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};Dn.prototype.isEmpty=function(){return this._length===0};Dn.prototype.length=function(){return this._length};Dn.prototype._checkCapacity=function(t){if(this._capacity<t){this._ensureCapacity(this._capacity<<1)}};Dn.prototype._ensureCapacity=function(t){var n=this._capacity;this._capacity=t;var e=this._head+this._length;if(e>n){zn(this,0,this,n,e&n-1)}};function zn(t,n,e,r,i){for(var s=0;s<i;++s){e[s+r]=t[s+n];t[s+n]=void 0}}function Ln(t,n,e){return Fn(t,[n,e])}var Fn=function(t,n){return n.length===0?Z():n.length===1?cn(t,n[0]):new Gn(t,n)};var Gn=function t(n,e){this.f=n;this.sources=e};Gn.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var s=new Array(i);var o=new Array(i);var u=new Array(i);var c=new Hn(this.f,u,o,n);for(var h=void 0,a=0;a<i;++a){u[a]=new Dn;h=o[a]=new vn(a,c);s[a]=r.sources[a].run(h,e)}return ht(s)};var Hn=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){if(!e.active){this._dispose(n,e.index);return}var r=this.buffers;var i=r[e.index];i.push(e.value);if(i.length()===1){if(!Un(this.buffers)){return}Jn(this.f,n,r,this.sink);if(Qn(this.buffers,this.sinks)){this.sink.end(n)}}};n.prototype._dispose=function t(n,e){var r=this.buffers[e];if(r.isEmpty()){this.sink.end(n)}};return n}(Ct);var Jn=function(t,n,r,i){return i.event(n,ln(t,e(Kn,r)))};var Kn=function(t){return t.shift()};function Qn(t,n){for(var e=0,r=t.length;e<r;++e){if(t[e].isEmpty()&&!n[e].active){return true}}return false}function Un(t){for(var n=0,e=t.length;n<e;++n){if(t[n].isEmpty()){return false}}return true}var Xn=function(t){return new Yn(t)};var Yn=function t(n){this.source=n};Yn.prototype.run=function t(n,e){var r=new Zn(n,e);return at(r,this.source.run(r,e))};var Zn=function t(n,e){this.sink=n;this.scheduler=e;this.current=null;this.ended=false};Zn.prototype.event=function t(n,e){this._disposeCurrent(n);this.current=new $n(e,n,Infinity,this,this.sink,this.scheduler)};Zn.prototype.end=function t(n){this.ended=true;this._checkEnd(n)};Zn.prototype.error=function t(n,e){this.ended=true;this.sink.error(n,e)};Zn.prototype.dispose=function t(){return this._disposeCurrent(J(this.scheduler))};Zn.prototype._disposeCurrent=function t(n){if(this.current!==null){return this.current._dispose(n)}};Zn.prototype._disposeInner=function t(n,e){e._dispose(n);if(e===this.current){this.current=null}};Zn.prototype._checkEnd=function t(n){if(this.ended&&this.current===null){this.sink.end(n)}};Zn.prototype._endInner=function t(n,e){this._disposeInner(n,e);this._checkEnd(n)};Zn.prototype._errorInner=function t(n,e,r){this._disposeInner(n,r);this.sink.error(n,e)};var $n=function t(n,e,r,i,s,o){this.min=e;this.max=r;this.outer=i;this.sink=s;this.disposable=n.run(this,Y(e,o))};$n.prototype.event=function t(n,e){var r=Math.max(0,n+this.min);if(r<this.max){this.sink.event(r,e)}};$n.prototype.end=function t(n){this.outer._endInner(n+this.min,this)};$n.prototype.error=function t(n,e){this.outer._errorInner(n+this.min,e,this)};$n.prototype._dispose=function t(n){kt(n+this.min,this.disposable,this.sink)};var te=function(t,n){return tn.create(t,n)};var ne=function(t){return ee(se,t)};var ee=function(t,n){return new re(t,n)};var re=function t(n,e){this.equals=n;this.source=e};re.prototype.run=function t(n,e){return this.source.run(new ie(this.equals,n),e)};var ie=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 se(t,n){return t===n}var oe=function(t,n){return ce(0,t,n)};var ue=function(t,n){return ce(t,Infinity,n)};var ce=function(t,n,e){return n<=t?Z():he(t,n,e)};var he=function(t,n,e){return e instanceof on?ae(t,n,e):e instanceof fe?pe(t,n,e):new fe(t,n,e)};var ae=function(t,n,e){return on.create(e.f,he(t,n,e.source))};function pe(t,n,e){var r=t+e.min;var i=Math.min(n+e.min,e.max);return new fe(r,i,e.source)}var fe=function t(n,e,r){this.source=r;this.min=n;this.max=e};fe.prototype.run=function t(n,e){var r=new St;var i=new ve(this.min,this.max-this.min,n,r);r.setDisposable(this.source.run(i,e));return r};var ve=function(t){function n(n,e,r,i){t.call(this,r);this.skip=n;this.take=e;this.disposable=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.skip>0){this.skip-=1;return}if(this.take===0){return}this.take-=1;this.sink.event(n,e);if(this.take===0){this.disposable.dispose();this.sink.end(n)}};return n}(Ct);var le=function(t,n){return new de(t,n)};var de=function t(n,e){this.p=n;this.source=e};de.prototype.run=function t(n,e){var r=new St;var i=new ye(this.p,n,r);r.setDisposable(this.source.run(i,e));return r};var ye=function(t){function n(n,e,r){t.call(this,e);this.p=n;this.active=true;this.disposable=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(!this.active){return}var r=this.p;this.active=r(e);if(this.active){this.sink.event(n,e)}else{this.disposable.dispose();this.sink.end(n)}};return n}(Ct);var _e=function(t,n){return new ke(t,n)};var ke=function t(n,e){this.p=n;this.source=e};ke.prototype.run=function t(n,e){return this.source.run(new me(this.p,n),e)};var me=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 we=function(t,n){return new ge(t,n)};var ge=function t(n,e){this.p=n;this.source=e};ge.prototype.run=function t(n,e){return this.source.run(new be(this.p,n),e)};var be=function(t){function n(n,e){t.call(this,e);this.p=n;this.skipping=false}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){return}var r=this.p;this.skipping=r(e);this.sink.event(n,e);if(this.skipping){this.sink.end(n)}};return n}(Ct);var xe=function(t,n){return new Oe(t,n)};var Te=function(t,n){return new je(t,n)};var Ae=function(t,n){return xe(In(t),Te(t,n))};var Oe=function t(n,e){this.maxSignal=n;this.source=e};Oe.prototype.run=function t(n,e){var r=new Ie(-Infinity,n);var i=new Re(this.maxSignal,n,e);var s=this.source.run(new Ee(r,i,n),e);return ht([r,i,s])};var je=function t(n,e){this.minSignal=n;this.source=e};je.prototype.run=function t(n,e){var r=new Ce(this.minSignal,n,e);var i=new Ie(Infinity,n);var s=this.source.run(new Ee(r,i,n),e);return ht([r,i,s])};var Ie=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 Ee=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 Ce=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 Re=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)}};n.prototype.end=function t(){};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(Ct);var qe=function(t,n){return t<=0?n:new Me(t,n)};var Me=function t(n,e){this.dt=n;this.source=e};Me.prototype.run=function t(n,e){var r=new Ne(this.dt,n,e);return at(r,this.source.run(r,e))};var Ne=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;X(function(t){return t.sink===n.sink},this.scheduler)};n.prototype.event=function t(n,e){Q(this.dt,d(e,this.sink),this.scheduler)};n.prototype.end=function t(n){Q(this.dt,y(this.sink),this.scheduler)};return n}(Ct);var Be=function(t,n){return n instanceof on?Se(t,n):n instanceof Ve?Pe(t,n):new Ve(t,n)};var Se=function(t,n){return on.create(n.f,Be(t,n.source))};var Pe=function(t,n){return new Ve(Math.max(t,n.period),n.source)};var Ve=function t(n,e){this.period=n;this.source=e};Ve.prototype.run=function t(n,e){return this.source.run(new We(this.period,n),e)};var We=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 De=function(t,n){return new ze(t,n)};var ze=function t(n,e){this.dt=n;this.source=e};ze.prototype.run=function t(n,e){ | ||
return new Le(this.dt,this.source,n,e)};var Le=function t(n,e,r,i){this.dt=n;this.sink=r;this.scheduler=i;this.value=void 0;this.timer=null;this.disposable=e.run(this,i)};Le.prototype.event=function t(n,e){this._clearTimer();this.value=e;this.timer=Q(this.dt,d(e,this.sink),this.scheduler)};Le.prototype.end=function t(n){if(this._clearTimer()){this.sink.event(n,this.value);this.value=undefined}this.sink.end(n)};Le.prototype.error=function t(n,e){this._clearTimer();this.sink.error(n,e)};Le.prototype.dispose=function t(){this._clearTimer();this.disposable.dispose()};Le.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var Fe=function(t){return new He(t)};var Ge=c(Fe,At);var He=function t(n){this.source=n};He.prototype.run=function t(n,e){return this.source.run(new Je(n,e),e)};var Je=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(J(r.scheduler),t)};this._endBound=function(){return r.sink.end(J(r.scheduler))};this._errorBound=function(t){return r.sink.error(J(r.scheduler),t)}};Je.prototype.event=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._event(e)}).catch(this._errorBound)};Je.prototype.end=function t(n){this.queue=this.queue.then(this._endBound).catch(this._errorBound)};Je.prototype.error=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._errorBound(e)}).catch(f)};Je.prototype._event=function t(n){return n.then(this._eventBound)};function Ke(t){this.sink=t;this.active=true}Ke.prototype.event=function(t,n){if(!this.active){return}this.sink.event(t,n)};Ke.prototype.end=function(t,n){if(!this.active){return}this.disable();this.sink.end(t,n)};Ke.prototype.error=function(t,n){this.disable();this.sink.error(t,n)};Ke.prototype.disable=function(){this.active=false;return this.sink};function Qe(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}function Ue(t,n){try{n.end(t)}catch(e){n.error(t,e)}}var Xe=function(t,n){return new $e(t,n)};var Ye=function(t){return new Ze(t)};var Ze=function t(n){this.value=n};Ze.prototype.run=function t(n,e){return K(_(this.value,n),e)};var $e=function t(n,e){this.f=n;this.source=e};$e.prototype.run=function t(n,e){return new tr(this.f,this.source,n,e)};var tr=function t(n,e,r,i){this.f=n;this.sink=new Ke(r);this.scheduler=i;this.disposable=e.run(this,i)};tr.prototype.event=function t(n,e){Qe(n,e,this.sink)};tr.prototype.end=function t(n){Ue(n,this.sink)};tr.prototype.error=function t(n,e){var r=this.sink.disable();kt(n,this.disposable,this.sink);this._startNext(n,e,r)};tr.prototype._startNext=function t(n,e,r){try{this.disposable=this._continue(this.f,n,e,r)}catch(t){r.error(n,t)}};tr.prototype._continue=function t(n,e,r,i){return Qt(e,n(r),i,this.scheduler)};tr.prototype.dispose=function t(){return this.disposable.dispose()};var nr=function(t){return t instanceof er?t:new er(t)};var er=function t(n){this.source=new rr(n)};er.prototype.run=function t(n,e){return this.source.run(n,e)};var rr=function t(n){this.source=n;this.sinks=[];this.disposable=nt()};rr.prototype.run=function t(n,e){var r=this.add(n);if(r===1){this.disposable=this.source.run(this,e)}return rt(new ir(this,n))};rr.prototype.dispose=function t(){var n=this.disposable;this.disposable=nt();return n.dispose()};rr.prototype.add=function t(e){this.sinks=n(e,this.sinks);return this.sinks.length};rr.prototype.remove=function t(n){var e=o(n,this.sinks);if(e>=0){this.sinks=i(e,this.sinks)}return this.sinks.length};rr.prototype.event=function t(n,e){var r=this.sinks;if(r.length===1){return r[0].event(n,e)}for(var i=0;i<r.length;++i){Qe(n,e,r[i])}};rr.prototype.end=function t(n){var e=this.sinks;for(var r=0;r<e.length;++r){Ue(n,e[r])}};rr.prototype.error=function t(n,e){var r=this.sinks;for(var i=0;i<r.length;++i){r[i].error(n,e)}};var ir=function t(n,e){this.source=n;this.sink=e};ir.prototype.dispose=function t(){if(this.source.remove(this.sink)===0){this.source.dispose()}};var sr=p(qt);var or=a(Rt);var ur=a(Pt);var cr=p(zt);var hr=p(Gt);var ar=a($t);var pr=a(cn);var fr=a(hn);var vr=a(an);var lr=a(mn);var dr=a(jn);var yr=a(Xt);var _r=a(En);var kr=a(gn);var mr=p(bn);var wr=a(Cn);var gr=p(dn);var br=a(yn);var xr=p(Sn);var Tr=p(Ln);var Ar=a(Fn);var Or=a(te);var jr=a(ee);var Ir=a(oe);var Er=a(ue);var Cr=p(ce);var Rr=a(le);var qr=a(_e);var Mr=a(we);var Nr=a(xe);var Br=a(Te);var Sr=a(Ae);var Pr=a(qe);var Vr=a(Be);var Wr=a(De);var Dr=a(Xe);var zr=p(l);var Lr=a(d);var Fr=a(_);t.zipArrayValues=sr;t.withArrayValues=or;t.runEffects=ur;t.loop=cr;t.scan=hr;t.startWith=ar;t.map=pr;t.constant=fr;t.tap=vr;t.ap=lr;t.chain=dr;t.join=In;t.continueWith=yr;t.concatMap=_r;t.mergeConcurrently=kr;t.mergeMapConcurrently=mr;t.merge=wr;t.mergeArray=Rn;t.combine=gr;t.combineArray=br;t.sample=xr;t.zip=Tr;t.zipArray=Ar;t.filter=Or;t.skipRepeats=ne;t.skipRepeatsWith=jr;t.take=Ir;t.skip=Er;t.slice=Cr;t.takeWhile=Rr;t.skipWhile=qr;t.skipAfter=Mr;t.until=Nr;t.since=Br;t.during=Sr;t.delay=Pr;t.throttle=Vr;t.debounce=Wr;t.recoverWith=Dr;t.throwError=Ye;t.propagateTask=zr;t.propagateEventTask=Lr;t.propagateErrorTask=Fr;t.propagateEndTask=y;t.empty=Z;t.never=mt;t.now=At;t.at=bt;t.periodic=Ot;t.newStream=It;t.switchLatest=Xn;t.fromPromise=Ge;t.awaitPromises=Fe;t.multicast=nr;t.MulticastSource=rr;Object.defineProperty(t,"__esModule",{value:true})}); | ||
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("@most/prelude"),require("@most/scheduler"),require("@most/disposable")):typeof define==="function"&&define.amd?define(["exports","@most/prelude","@most/scheduler","@most/disposable"],e):e(t.mostCore=t.mostCore||{},t.mostPrelude,t.mostScheduler,t.mostDisposable)})(this,function(t,e,r,n){"use strict";function i(t){setTimeout(s,0,t)}function s(t){throw t}var o=function(t,e,r){return new p(t,e,r)};var u=function(t,e){return o(a,t,e)};var c=function(t){return o(f,undefined,t)};var h=function(t,e){return o(v,t,e)};var p=function t(e,r,n){this._run=e;this.value=r;this.sink=n;this.active=true};p.prototype.dispose=function t(){this.active=false};p.prototype.run=function t(e){if(!this.active){return}var t=this._run;t(e,this.value,this.sink)};p.prototype.error=function t(e,r){if(!this.active){return i(r)}this.sink.error(e,r)};var a=function(t,e,r){return r.event(t,e)};var f=function(t,e,r){return r.end(t)};var v=function(t,e,r){return r.error(t,e)};var l=function(){return d};var y=function t(){};y.prototype.run=function t(e,n){return r.asap(c(e),n)};var d=new y;var _=function(){return w};var k=function t(){};k.prototype.run=function t(){return n.disposeNone()};var w=new k;var m=function(t,e){return new b(t,e)};var b=function t(e,r){this.time=e;this.value=r};b.prototype.run=function t(e,n){return r.delay(this.time,o(g,this.value,e),n)};function g(t,e,r){r.event(t,e);r.end(t)}var x=function(t){return m(0,t)};var O=function(t){return new j(t)};var j=function t(e){this.period=e};j.prototype.run=function t(e,n){return r.periodic(this.period,u(undefined,e),n)};var I=function(t){return new A(t)};var A=function t(e){this.run=e};var E=function t(e){this.sink=e};E.prototype.event=function t(e,r){return this.sink.event(e,r)};E.prototype.end=function t(e){return this.sink.end(e)};E.prototype.error=function t(e,r){return this.sink.error(e,r)};var T=function(t,e){return C(q,t,e)};var C=function(t,e,r){return e.length===0||r===l()?l():new D(t,e,r)};var q=function(t,e){return t};var D=function t(e,r,n){this.f=e;this.values=r;this.source=n};D.prototype.run=function t(e,r){return this.source.run(new B(this.f,this.values,e),r)};var B=function(t){function e(e,r,n){t.call(this,n);this.f=e;this.values=r;this.index=0}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){var n=this.f;this.sink.event(e,n(this.values[this.index],r));this.index+=1;if(this.index>=this.values.length){this.sink.end(e)}};return e}(E);var P=function t(){this.disposable=undefined;this.disposed=false};P.prototype.setDisposable=function t(e){if(this.disposable!==void 0){throw new Error("setDisposable called more than once")}this.disposable=e;if(this.disposed){e.dispose()}};P.prototype.dispose=function t(){if(this.disposed){return}this.disposed=true;if(this.disposable!==void 0){this.disposable.dispose()}};var V=e.curry2(function(t,e){return new Promise(function(r,n){return M(t,e,r,n)})});function M(t,e,r,n){var i=new P;var s=new N(r,n,i);i.setDisposable(t.run(s,e))}var N=function t(e,r,n){this._end=e;this._error=r;this._disposable=n;this.active=true};N.prototype.event=function t(e,r){};N.prototype.end=function t(e){if(!this.active){return}this._dispose(this._error,this._end,undefined)};N.prototype.error=function t(e,r){this._dispose(this._error,this._error,r)};N.prototype._dispose=function t(e,r,n){this.active=false;R(e,r,n,this._disposable)};function R(t,e,r,n){try{n.dispose()}catch(e){t(e);return}e(r)}var S=function(t,e,r){return r.run(t,e)};var W=function t(e,r){this.sink=r;this.offset=e};W.prototype.event=function t(e,r){this.sink.event(e+this.offset,r)};W.prototype.error=function t(e,r){this.sink.error(e+this.offset,r)};W.prototype.end=function t(e){this.sink.end(e+this.offset)};var z=function(t,e){return new L(t,e)};var L=function t(e,r){this.origin=e;this.source=r};L.prototype.run=function t(e,n){return this.source.run(F(this.origin,e),r.schedulerRelativeTo(this.origin,n))};var F=function(t,e){return e instanceof W?new W(t+e.offset,e.sink):new W(t,e)};var G=function(t,e,r){return new H(t,e,r)};var H=function t(e,r,n){this.step=e;this.seed=r;this.source=n};H.prototype.run=function t(e,r){return this.source.run(new J(this.step,this.seed,e),r)};var J=function(t){function e(e,r,n){t.call(this,n);this.step=e;this.seed=r}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){var n=this.step(this.seed,r);this.seed=n.seed;this.sink.event(e,n.value)};return e}(E);var K=function(t,e,r){return new Q(t,e,r)};var Q=function t(e,r,n){this.source=n;this.f=e;this.value=r};Q.prototype.run=function t(e,i){var s=r.asap(u(this.value,e),i);var o=this.source.run(new U(this.f,this.value,e),i);return n.disposeBoth(s,o)};var U=function(t){function e(e,r,n){t.call(this,n);this.f=e;this.value=r}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){var n=this.f;this.value=n(this.value,r);this.sink.event(e,this.value)};return e}(E);var X=function(t,e){return new Y(t,e)};var Y=function t(e,r){this.f=e;this.source=r};Y.prototype.run=function t(e,r){return new Z(this.f,this.source,e,r)};var Z=function(t){function e(e,r,i,s){t.call(this,i);this.f=e;this.scheduler=s;this.active=true;this.disposable=n.disposeOnce(r.run(this,s))}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(!this.active){return}this.sink.event(e,r)};e.prototype.end=function t(e){if(!this.active){return}n.tryDispose(e,this.disposable,this.sink);this._startNext(e,this.sink)};e.prototype._startNext=function t(e,r){try{this.disposable=this._continue(this.f,e,r)}catch(t){r.error(e,t)}};e.prototype._continue=function t(e,r,n){return S(n,this.scheduler,z(r,e()))};e.prototype.dispose=function t(){this.active=false;return this.disposable.dispose()};return e}(E);var $=function(t,e){return X(function(){return e},x(t))};var tt=function t(e,r){this.p=e;this.source=r};tt.prototype.run=function t(e,r){return this.source.run(new et(this.p,e),r)};tt.create=function t(e,r){if(r instanceof tt){return new tt(rt(r.p,e),r.source)}return new tt(e,r)};var et=function(t){function e(e,r){t.call(this,r);this.p=e}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){var n=this.p;n(r)&&this.sink.event(e,r)};return e}(E);var rt=function(t,e){return function(r){return t(r)&&e(r)}};var nt=function t(e,r,n){this.p=e;this.f=r;this.source=n};nt.prototype.run=function t(e,r){return this.source.run(new it(this.p,this.f,e),r)};var it=function(t){function e(e,r,n){t.call(this,n);this.p=e;this.f=r}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){var n=this.f;var i=this.p;i(r)&&this.sink.event(e,n(r))};return e}(E);var st=function t(e,r){this.f=e;this.source=r};st.prototype.run=function t(e,r){return this.source.run(new ot(this.f,e),r)};st.create=function t(r,n){if(n instanceof st){return new st(e.compose(r,n.f),n.source)}if(n instanceof tt){return new nt(n.p,r,n.source)}return new st(r,n)};var ot=function(t){function e(e,r){t.call(this,r);this.f=e}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){var n=this.f;this.sink.event(e,n(r))};return e}(E);var ut=function(t,e){return st.create(t,e)};var ct=function(t,e){return ut(function(){return t},e)};var ht=function(t,e){return new pt(t,e)};var pt=function t(e,r){this.source=r;this.f=e};pt.prototype.run=function t(e,r){return this.source.run(new at(this.f,e),r)};var at=function(t){function e(e,r){t.call(this,r);this.f=e}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){var n=this.f;n(r);this.sink.event(e,r)};return e}(E);var ft=function(t){function e(e,r){t.call(this,r);this.index=e;this.active=true;this.value=undefined}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(!this.active){return}this.value=r;this.sink.event(e,this)};e.prototype.end=function t(e){if(!this.active){return}this.active=false;this.sink.event(e,this)};return e}(E);function vt(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)}}function lt(t,e,r){return yt(t,[e,r])}var yt=function(t,e){return e.length===0?l():e.length===1?ut(t,e[0]):new dt(t,e)};var dt=function t(e,r){this.f=e;this.sources=r};dt.prototype.run=function t(e,r){var i=this;var s=this.sources.length;var o=new Array(s);var u=new Array(s);var c=new _t(o,u,e,this.f);for(var h=void 0,p=0;p<s;++p){h=u[p]=new ft(p,c);o[p]=i.sources[p].run(h,r)}return n.disposeAll(o)};var _t=function(t){function e(e,r,n,i){t.call(this,n);this.disposables=e;this.sinks=r;this.f=i;var s=r.length;this.awaiting=s;this.values=new Array(s);this.hasValue=new Array(s).fill(false);this.activeCount=r.length}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(!r.active){this._dispose(e,r.index);return}var n=r.index;var i=this._updateReady(n);this.values[n]=r.value;if(i===0){this.sink.event(e,vt(this.f,this.values))}};e.prototype._updateReady=function t(e){if(this.awaiting>0){if(!this.hasValue[e]){this.hasValue[e]=true;this.awaiting-=1}}return this.awaiting};e.prototype._dispose=function t(e,r){n.tryDispose(e,this.disposables[r],this.sink);if(--this.activeCount===0){this.sink.end(e)}};return e}(E);function kt(t,r){return lt(e.apply,t,r)}var wt=function t(){this.head=null;this.length=0};wt.prototype.add=function t(e){if(this.head!==null){this.head.prev=e;e.next=this.head}this.head=e;++this.length};wt.prototype.remove=function t(e){--this.length;if(e===this.head){this.head=this.head.next}if(e.next!==null){e.next.prev=e.prev;e.next=null}if(e.prev!==null){e.prev.next=e.next;e.prev=null}};wt.prototype.isEmpty=function t(){return this.length===0};wt.prototype.dispose=function t(){if(this.isEmpty()){return Promise.resolve()}var e=[];var r=this.head;this.head=null;this.length=0;while(r!==null){e.push(r.dispose());r=r.next}return Promise.all(e)};var mt=function(t,r){return bt(e.id,t,r)};var bt=function(t,e,r){return new gt(t,e,r)};var gt=function t(e,r,n){this.f=e;this.concurrency=r;this.source=n};gt.prototype.run=function t(e,r){return new xt(this.f,this.concurrency,this.source,e,r)};var xt=function t(e,r,i,s,o){this.f=e;this.concurrency=r;this.sink=s;this.scheduler=o;this.pending=[];this.current=new wt;this.disposable=n.disposeOnce(i.run(this,o));this.active=true};xt.prototype.event=function t(e,r){this._addInner(e,r)};xt.prototype._addInner=function t(e,r){if(this.current.length<this.concurrency){this._startInner(e,r)}else{this.pending.push(r)}};xt.prototype._startInner=function t(e,r){try{this._initInner(e,r)}catch(t){this.error(e,t)}};xt.prototype._initInner=function t(e,r){var n=new jt(e,this,this.sink);n.disposable=Ot(this.f,e,r,n,this.scheduler);this.current.add(n)};xt.prototype.end=function t(e){this.active=false;n.tryDispose(e,this.disposable,this.sink);this._checkEnd(e)};xt.prototype.error=function t(e,r){this.active=false;this.sink.error(e,r)};xt.prototype.dispose=function t(){this.active=false;this.pending.length=0;this.disposable.dispose();this.current.dispose()};xt.prototype._endInner=function t(e,r){this.current.remove(r);n.tryDispose(e,r,this);if(this.pending.length===0){this._checkEnd(e)}else{this._startInner(e,this.pending.shift())}};xt.prototype._checkEnd=function t(e){if(!this.active&&this.current.isEmpty()){this.sink.end(e)}};var Ot=function(t,e,n,i,s){return t(n).run(i,r.schedulerRelativeTo(e,s))};var jt=function t(e,r,n){this.prev=this.next=null;this.time=e;this.outer=r;this.sink=n;this.disposable=void 0};jt.prototype.event=function t(e,r){this.sink.event(e+this.time,r)};jt.prototype.end=function t(e){this.outer._endInner(e+this.time,this)};jt.prototype.error=function t(e,r){this.outer.error(e+this.time,r)};jt.prototype.dispose=function t(){return this.disposable.dispose()};var It=function(t,e){return bt(t,Infinity,e)};var At=function(t){return mt(Infinity,t)};var Et=function(t,e){return bt(t,1,e)};function Tt(t,e){return Ct([t,e])}var Ct=function(t){return t.length===0?l():t.length===1?t[0]:qt(t)};var qt=function(t){return new Bt(e.reduce(Dt,[],t))};var Dt=function(t,e){return t.concat(e instanceof Bt?e.sources:e)};var Bt=function t(e){this.sources=e};Bt.prototype.run=function t(e,r){var i=this;var s=this.sources.length;var o=new Array(s);var u=new Array(s);var c=new Pt(o,u,e);for(var h=void 0,p=0;p<s;++p){h=u[p]=new ft(p,c);o[p]=i.sources[p].run(h,r)}return n.disposeAll(o)};var Pt=function(t){function e(e,r,n){t.call(this,n);this.disposables=e;this.activeCount=r.length}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(!r.active){this._dispose(e,r.index);return}this.sink.event(e,r.value)};e.prototype._dispose=function t(e,r){n.tryDispose(e,this.disposables[r],this.sink);if(--this.activeCount===0){this.sink.end(e)}};return e}(E);var Vt=function(t,e,r){return new Mt(t,e,r)};var Mt=function t(e,r,n){this.source=n;this.sampler=r;this.f=e};Mt.prototype.run=function t(e,r){var i=new Nt(this.f,this.source,e);var s=this.source.run(i.hold,r);var o=this.sampler.run(i,r);return n.disposeBoth(o,s)};var Nt=function(t){function e(e,r,n){t.call(this,n);this.source=r;this.f=e;this.hold=new Rt(this)}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(this.hold.hasValue){var n=this.f;this.sink.event(e,n(r,this.hold.value))}};return e}(E);var Rt=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,r){this.value=r;this.hasValue=true};e.prototype.end=function t(){};return e}(E);var St=function t(e){if(e===void 0)e=32;this._capacity=e;this._length=0;this._head=0};St.prototype.push=function t(e){var r=this._length;this._checkCapacity(r+1);var n=this._head+r&this._capacity-1;this[n]=e;this._length=r+1};St.prototype.shift=function t(){var e=this._head;var r=this[e];this[e]=void 0;this._head=e+1&this._capacity-1;this._length--;return r};St.prototype.isEmpty=function t(){return this._length===0};St.prototype.length=function t(){return this._length};St.prototype._checkCapacity=function t(e){if(this._capacity<e){this._ensureCapacity(this._capacity<<1)}};St.prototype._ensureCapacity=function t(e){var r=this._capacity;this._capacity=e;var n=this._head+this._length;if(n>r){Wt(this,0,this,r,n&r-1)}};function Wt(t,e,r,n,i){for(var s=0;s<i;++s){r[s+n]=t[s+e];t[s+e]=void 0}}function zt(t,e,r){return Lt(t,[e,r])}var Lt=function(t,e){return e.length===0?l():e.length===1?ut(t,e[0]):new Ft(t,e)};var Ft=function t(e,r){this.f=e;this.sources=r};Ft.prototype.run=function t(e,r){var i=this;var s=this.sources.length;var o=new Array(s);var u=new Array(s);var c=new Array(s);var h=new Gt(this.f,c,u,e);for(var p=void 0,a=0;a<s;++a){c[a]=new St;p=u[a]=new ft(a,h);o[a]=i.sources[a].run(p,r)}return n.disposeAll(o)};var Gt=function(t){function e(e,r,n,i){t.call(this,i);this.f=e;this.sinks=n;this.buffers=r}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(!r.active){this._dispose(e,r.index);return}var n=this.buffers;var i=n[r.index];i.push(r.value);if(i.length()===1){if(!Qt(this.buffers)){return}Ht(this.f,e,n,this.sink);if(Kt(this.buffers,this.sinks)){this.sink.end(e)}}};e.prototype._dispose=function t(e,r){var n=this.buffers[r];if(n.isEmpty()){this.sink.end(e)}};return e}(E);var Ht=function(t,r,n,i){return i.event(r,vt(t,e.map(Jt,n)))};var Jt=function(t){return t.shift()};function Kt(t,e){for(var r=0,n=t.length;r<n;++r){if(t[r].isEmpty()&&!e[r].active){return true}}return false}function Qt(t){for(var e=0,r=t.length;e<r;++e){if(t[e].isEmpty()){return false}}return true}var Ut=function(t){return new Xt(t)};var Xt=function t(e){this.source=e};Xt.prototype.run=function t(e,r){var i=new Yt(e,r);return n.disposeBoth(i,this.source.run(i,r))};var Yt=function t(e,r){this.sink=e;this.scheduler=r;this.current=null;this.ended=false};Yt.prototype.event=function t(e,r){this._disposeCurrent(e);this.current=new Zt(r,e,Infinity,this,this.sink,this.scheduler)};Yt.prototype.end=function t(e){this.ended=true;this._checkEnd(e)};Yt.prototype.error=function t(e,r){this.ended=true;this.sink.error(e,r)};Yt.prototype.dispose=function t(){return this._disposeCurrent(r.currentTime(this.scheduler))};Yt.prototype._disposeCurrent=function t(e){if(this.current!==null){return this.current._dispose(e)}};Yt.prototype._disposeInner=function t(e,r){r._dispose(e);if(r===this.current){this.current=null}};Yt.prototype._checkEnd=function t(e){if(this.ended&&this.current===null){this.sink.end(e)}};Yt.prototype._endInner=function t(e,r){this._disposeInner(e,r);this._checkEnd(e)};Yt.prototype._errorInner=function t(e,r,n){this._disposeInner(e,n);this.sink.error(e,r)};var Zt=function t(e,n,i,s,o,u){this.min=n;this.max=i;this.outer=s;this.sink=o;this.disposable=e.run(this,r.schedulerRelativeTo(n,u))};Zt.prototype.event=function t(e,r){var n=Math.max(0,e+this.min);if(n<this.max){this.sink.event(n,r)}};Zt.prototype.end=function t(e){this.outer._endInner(e+this.min,this)};Zt.prototype.error=function t(e,r){this.outer._errorInner(e+this.min,r,this)};Zt.prototype._dispose=function t(e){n.tryDispose(e+this.min,this.disposable,this.sink)};var $t=function(t,e){return tt.create(t,e)};var te=function(t){return ee(ie,t)};var ee=function(t,e){return new re(t,e)};var re=function t(e,r){this.equals=e;this.source=r};re.prototype.run=function t(e,r){return this.source.run(new ne(this.equals,e),r)};var ne=function(t){function e(e,r){t.call(this,r);this.equals=e;this.value=void 0;this.init=true}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(this.init){this.init=false;this.value=r;this.sink.event(e,r)}else if(!this.equals(this.value,r)){this.value=r;this.sink.event(e,r)}};return e}(E);function ie(t,e){return t===e}var se=function(t,e){return ue(0,t,e)};var oe=function(t,e){return ue(t,Infinity,e)};var ue=function(t,e,r){return e<=t?l():ce(t,e,r)};var ce=function(t,e,r){return r instanceof st?he(t,e,r):r instanceof ae?pe(t,e,r):new ae(t,e,r)};var he=function(t,e,r){return st.create(r.f,ce(t,e,r.source))};function pe(t,e,r){var n=t+r.min;var i=Math.min(e+r.min,r.max);return new ae(n,i,r.source)}var ae=function t(e,r,n){this.source=n;this.min=e;this.max=r};ae.prototype.run=function t(e,r){var n=new P;var i=new fe(this.min,this.max-this.min,e,n);n.setDisposable(this.source.run(i,r));return n};var fe=function(t){function e(e,r,n,i){t.call(this,n);this.skip=e;this.take=r;this.disposable=i}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(this.skip>0){this.skip-=1;return}if(this.take===0){return}this.take-=1;this.sink.event(e,r);if(this.take===0){this.disposable.dispose();this.sink.end(e)}};return e}(E);var ve=function(t,e){return new le(t,e)};var le=function t(e,r){this.p=e;this.source=r};le.prototype.run=function t(e,r){var n=new P;var i=new ye(this.p,e,n);n.setDisposable(this.source.run(i,r));return n};var ye=function(t){function e(e,r,n){t.call(this,r);this.p=e;this.active=true;this.disposable=n}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(!this.active){return}var n=this.p;this.active=n(r);if(this.active){this.sink.event(e,r)}else{this.disposable.dispose();this.sink.end(e)}};return e}(E);var de=function(t,e){return new _e(t,e)};var _e=function t(e,r){this.p=e;this.source=r};_e.prototype.run=function t(e,r){return this.source.run(new ke(this.p,e),r)};var ke=function(t){function e(e,r){t.call(this,r);this.p=e;this.skipping=true}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(this.skipping){var n=this.p;this.skipping=n(r);if(this.skipping){return}}this.sink.event(e,r)};return e}(E);var we=function(t,e){return new me(t,e)};var me=function t(e,r){this.p=e;this.source=r};me.prototype.run=function t(e,r){return this.source.run(new be(this.p,e),r)};var be=function(t){function e(e,r){t.call(this,r);this.p=e;this.skipping=false}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(this.skipping){return}var n=this.p;this.skipping=n(r);this.sink.event(e,r);if(this.skipping){this.sink.end(e)}};return e}(E);var ge=function(t,e){return new je(t,e)};var xe=function(t,e){return new Ie(t,e)};var Oe=function(t,e){return ge(At(t),xe(t,e))};var je=function t(e,r){this.maxSignal=e;this.source=r};je.prototype.run=function t(e,r){var i=new Ae(-Infinity,e);var s=new Ce(this.maxSignal,e,r);var o=this.source.run(new Ee(i,s,e),r);return n.disposeAll([i,s,o])};var Ie=function t(e,r){this.minSignal=e;this.source=r};Ie.prototype.run=function t(e,r){var i=new Te(this.minSignal,e,r);var s=new Ae(Infinity,e);var o=this.source.run(new Ee(i,s,e),r);return n.disposeAll([i,s,o])};var Ae=function(t){function e(e,r){t.call(this,r);this.value=e}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(){};e.prototype.end=function t(){};e.prototype.dispose=function t(){};return e}(E);var Ee=function(t){function e(e,r,n){t.call(this,n);this.min=e;this.max=r}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(e>=this.min.value&&e<this.max.value){this.sink.event(e,r)}};return e}(E);var Te=function(t){function e(e,r,n){t.call(this,r);this.value=Infinity;this.disposable=e.run(this,n)}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e){if(e<this.value){this.value=e}};e.prototype.end=function t(){};e.prototype.dispose=function t(){return this.disposable.dispose()};return e}(E);var Ce=function(t){function e(e,r,n){t.call(this,r);this.value=Infinity;this.disposable=e.run(this,n)}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.event=function t(e,r){if(e<this.value){this.value=e;this.sink.end(e)}};e.prototype.end=function t(){};e.prototype.dispose=function t(){return this.disposable.dispose()};return e}(E);var qe=function(t,e){return t<=0?e:new De(t,e)};var De=function t(e,r){this.dt=e;this.source=r};De.prototype.run=function t(e,r){var i=new Be(this.dt,e,r);return n.disposeBoth(i,this.source.run(i,r))};var Be=function(t){function e(e,r,n){t.call(this,r);this.dt=e;this.scheduler=n}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.dispose=function t(){var e=this;r.cancelAllTasks(function(t){return t.sink===e.sink},this.scheduler)};e.prototype.event=function t(e,n){r.delay(this.dt,u(n,this.sink),this.scheduler)};e.prototype.end=function t(e){r.delay(this.dt,c(this.sink),this.scheduler)};return e}(E);var Pe=function(t,e){return e instanceof st?Ve(t,e):e instanceof Ne?Me(t,e):new Ne(t,e)};var Ve=function(t,e){return st.create(e.f,Pe(t,e.source))};var Me=function(t,e){return new Ne(Math.max(t,e.period),e.source)};var Ne=function t(e,r){this.period=e;this.source=r};Ne.prototype.run=function t(e,r){return this.source.run(new Re(this.period,e),r)};var Re=function(t){function e(e,r){t.call(this,r);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,r){if(e>=this.time){this.time=e+this.period;this.sink.event(e,r)}};return e}(E);var Se=function(t,e){return new We(t,e)};var We=function t(e,r){this.dt=e;this.source=r};We.prototype.run=function t(e,r){return new ze(this.dt,this.source,e,r)};var ze=function t(e,r,n,i){this.dt=e;this.sink=n;this.scheduler=i;this.value=void 0;this.timer=null;this.disposable=r.run(this,i)};ze.prototype.event=function t(e,n){this._clearTimer();this.value=n;this.timer=r.delay(this.dt,u(n,this.sink),this.scheduler)};ze.prototype.end=function t(e){if(this._clearTimer()){this.sink.event(e,this.value);this.value=undefined}this.sink.end(e)};ze.prototype.error=function t(e,r){this._clearTimer();this.sink.error(e,r)};ze.prototype.dispose=function t(){this._clearTimer();this.disposable.dispose()};ze.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var Le=function(t){return new Ge(t)};var Fe=e.compose(Le,x);var Ge=function t(e){this.source=e};Ge.prototype.run=function t(e,r){return this.source.run(new He(e,r),r)};var He=function t(e,n){var i=this;this.sink=e;this.scheduler=n;this.queue=Promise.resolve();this._eventBound=function(t){return i.sink.event(r.currentTime(i.scheduler),t)};this._endBound=function(){return i.sink.end(r.currentTime(i.scheduler))};this._errorBound=function(t){return i.sink.error(r.currentTime(i.scheduler),t)}};He.prototype.event=function t(e,r){var n=this;this.queue=this.queue.then(function(){return n._event(r)}).catch(this._errorBound)};He.prototype.end=function t(e){this.queue=this.queue.then(this._endBound).catch(this._errorBound)};He.prototype.error=function t(e,r){var n=this;this.queue=this.queue.then(function(){return n._errorBound(r)}).catch(i)};He.prototype._event=function t(e){return e.then(this._eventBound)};var Je=function t(e){this.sink=e;this.active=true};Je.prototype.event=function t(e,r){if(!this.active){return}this.sink.event(e,r)};Je.prototype.end=function t(e,r){if(!this.active){return}this.disable();this.sink.end(e,r)};Je.prototype.error=function t(e,r){this.disable();this.sink.error(e,r)};Je.prototype.disable=function t(){this.active=false;return this.sink};function Ke(t,e,r){try{r.event(t,e)}catch(e){r.error(t,e)}}function Qe(t,e){try{e.end(t)}catch(r){e.error(t,r)}}var Ue=function(t,e){return new Ze(t,e)};var Xe=function(t){return new Ye(t)};var Ye=function t(e){this.value=e};Ye.prototype.run=function t(e,n){return r.asap(h(this.value,e),n)};var Ze=function t(e,r){this.f=e;this.source=r};Ze.prototype.run=function t(e,r){return new $e(this.f,this.source,e,r)};var $e=function t(e,r,n,i){this.f=e;this.sink=new Je(n);this.scheduler=i;this.disposable=r.run(this,i)};$e.prototype.event=function t(e,r){Ke(e,r,this.sink)};$e.prototype.end=function t(e){Qe(e,this.sink)};$e.prototype.error=function t(e,r){var i=this.sink.disable();n.tryDispose(e,this.disposable,this.sink);this._startNext(e,r,i)};$e.prototype._startNext=function t(e,r,n){try{this.disposable=this._continue(this.f,e,r,n)}catch(t){n.error(e,t)}};$e.prototype._continue=function t(e,r,n,i){return S(i,this.scheduler,z(r,e(n)))};$e.prototype.dispose=function t(){return this.disposable.dispose()};var tr=function(t){return t instanceof er?t:new er(t)};var er=function t(e){this.source=new rr(e)};er.prototype.run=function t(e,r){return this.source.run(e,r)};var rr=function t(e){this.source=e;this.sinks=[];this.disposable=n.disposeNone()};rr.prototype.run=function t(e,r){var i=this.add(e);if(i===1){this.disposable=this.source.run(this,r)}return n.disposeOnce(new nr(this,e))};rr.prototype.dispose=function t(){var e=this.disposable;this.disposable=n.disposeNone();return e.dispose()};rr.prototype.add=function t(r){this.sinks=e.append(r,this.sinks);return this.sinks.length};rr.prototype.remove=function t(r){var n=e.findIndex(r,this.sinks);if(n>=0){this.sinks=e.remove(n,this.sinks)}return this.sinks.length};rr.prototype.event=function t(e,r){var n=this.sinks;if(n.length===1){return n[0].event(e,r)}for(var i=0;i<n.length;++i){Ke(e,r,n[i])}};rr.prototype.end=function t(e){var r=this.sinks;for(var n=0;n<r.length;++n){Qe(e,r[n])}};rr.prototype.error=function t(e,r){var n=this.sinks;for(var i=0;i<n.length;++i){n[i].error(e,r)}};var nr=function t(e,r){this.source=e;this.sink=r};nr.prototype.dispose=function t(){if(this.source.remove(this.sink)===0){this.source.dispose()}};var ir=e.curry3(C);var sr=e.curry2(T);var or=e.curry2(V);var ur=e.curry3(S);var cr=e.curry2(z);var hr=e.curry3(G);var pr=e.curry3(K);var ar=e.curry2($);var fr=e.curry2(ut);var vr=e.curry2(ct);var lr=e.curry2(ht);var yr=e.curry2(kt);var dr=e.curry2(It);var _r=e.curry2(X);var kr=e.curry2(Et);var wr=e.curry2(mt);var mr=e.curry3(bt);var br=e.curry2(Tt);var gr=e.curry3(lt);var xr=e.curry2(yt);var Or=e.curry3(Vt);var jr=e.curry3(zt);var Ir=e.curry2(Lt);var Ar=e.curry2($t);var Er=e.curry2(ee);var Tr=e.curry2(se);var Cr=e.curry2(oe);var qr=e.curry3(ue);var Dr=e.curry2(ve);var Br=e.curry2(de);var Pr=e.curry2(we);var Vr=e.curry2(ge);var Mr=e.curry2(xe);var Nr=e.curry2(Oe);var Rr=e.curry2(qe);var Sr=e.curry2(Pe);var Wr=e.curry2(Se);var zr=e.curry2(Ue);var Lr=e.curry3(o);var Fr=e.curry2(u);var Gr=e.curry2(h);t.zipArrayValues=ir;t.withArrayValues=sr;t.runEffects=or;t.run=ur;t.withLocalTime=cr;t.loop=hr;t.scan=pr;t.startWith=ar;t.map=fr;t.constant=vr;t.tap=lr;t.ap=yr;t.chain=dr;t.join=At;t.continueWith=_r;t.concatMap=kr;t.mergeConcurrently=wr;t.mergeMapConcurrently=mr;t.merge=br;t.mergeArray=Ct;t.combine=gr;t.combineArray=xr;t.sample=Or;t.zip=jr;t.zipArray=Ir;t.filter=Ar;t.skipRepeats=te;t.skipRepeatsWith=Er;t.take=Tr;t.skip=Cr;t.slice=qr;t.takeWhile=Dr;t.skipWhile=Br;t.skipAfter=Pr;t.until=Vr;t.since=Mr;t.during=Nr;t.delay=Rr;t.throttle=Sr;t.debounce=Wr;t.recoverWith=zr;t.throwError=Xe;t.propagateTask=Lr;t.propagateEventTask=Fr;t.propagateErrorTask=Gr;t.propagateEndTask=c;t.empty=l;t.never=_;t.now=x;t.at=m;t.periodic=O;t.newStream=I;t.switchLatest=Ut;t.fromPromise=Fe;t.awaitPromises=Le;t.multicast=tr;t.MulticastSource=rr;Object.defineProperty(t,"__esModule",{value:true})}); |
{ | ||
"name": "@most/core", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "Reactive programming with lean, functions-only, curried, tree-shakeable API", | ||
@@ -51,3 +51,2 @@ "typings": "type-definitions/most.d.ts", | ||
"rollup-plugin-buble": "^0.15.0", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"sinon": "^1.17.7", | ||
@@ -59,5 +58,5 @@ "snazzy": "^7.0.0", | ||
"dependencies": { | ||
"@most/disposable": "^0.13.0", | ||
"@most/disposable": "^0.13.1", | ||
"@most/prelude": "^1.6.4", | ||
"@most/scheduler": "^0.13.0", | ||
"@most/scheduler": "^0.13.1", | ||
"@most/types": "^0.11.1" | ||
@@ -64,0 +63,0 @@ }, |
export * from './runEffects'; | ||
export * from './run'; | ||
export * from './PropagateTask'; | ||
@@ -27,2 +28,3 @@ | ||
export * from './combinator/withArrayValues'; | ||
export * from './combinator/withLocalTime'; | ||
@@ -29,0 +31,0 @@ export * from './source/never'; |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
12
44
469087
4262
3
Updated@most/disposable@^0.13.1
Updated@most/scheduler@^0.13.1