@most/core
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -1,2 +0,2 @@ | ||
(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,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 o(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 s=function(t){return t};var u=function(t,n){return function(e){return t(n(e))}};var c=function(t,n){return t(n)};function h(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 h(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 p=function(){return f};var f=new(function(){function t(){}t.prototype.dispose=function t(){};return t}());var v=function(t){return new l(t)};var l=function t(n){this.disposed=false;this.disposable=n};l.prototype.dispose=function t(){if(!this.disposed){this.disposed=true;this.disposable.dispose();this.disposable=undefined}};var d=function t(n,e){this._dispose=n;this._resource=e};d.prototype.dispose=function t(){this._dispose(this._resource)};function y(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 _=function(t){return new w(t)};var k=function(t,n){return _([t,n])};var w=function t(n){this.disposables=n};w.prototype.dispose=function t(){b(m(this.disposables))};var m=function(t){return y(g,[],t)};var g=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t};var b=function(t){if(t.length>0){throw new x(t.length+" errors",t)}};var x=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+j(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 j=function(t){return y(O,"",t)};var O=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack};function I(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}}function T(t){setTimeout(E,0,t)}function E(t){throw t}var A=function(t,n,e){return new B(t,n,e)};var C=function(t,n){return A(M,t,n)};var P=function(t){return A(V,undefined,t)};var q=function(t,n){return A(S,t,n)};var B=function t(n,e,r){this._run=n;this.value=e;this.sink=r;this.active=true};B.prototype.dispose=function t(){this.active=false};B.prototype.run=function t(n){if(!this.active){return}var t=this._run;t(n,this.value,this.sink,this)};B.prototype.error=function t(n,e){if(!this.active){return T(e)}this.sink.error(n,e)};var M=function(t,n,e){return e.event(t,n)};var V=function(t,n,e){return e.end(t)};var S=function(t,n,e){return e.error(t,n)};var W=function(t){return new N(t)};var N=function t(n){this.value=n};N.prototype.run=function t(n,e){return e.asap(A(R,this.value,n))};function R(t,n,e){e.event(t,n);e.end(t,undefined)}var z=function(){return L};var D=function t(){};D.prototype.run=function t(n,e){return e.asap(P(n))};var L=new D;var F=function(){return H};var G=function t(){};G.prototype.run=function t(){return p()};var H=new G;var J=function(t){return new K(t)};var K=function t(n){this.period=n};K.prototype.run=function t(n,e){return e.periodic(this.period,C(undefined,n))};var Q=function t(n){this.sink=n};Q.prototype.event=function t(n,e){return this.sink.event(n,e)};Q.prototype.end=function t(n){return this.sink.end(n)};Q.prototype.error=function t(n,e){return this.sink.error(n,e)};var U=function(t,n){return X(Y,t,n)};var X=function(t,n,e){return n.length===0||e===z()?z():new Z(t,n,e)};var Y=function(t,n){return t};var Z=function t(n,e,r){this.f=n;this.values=e;this.source=r};Z.prototype.run=function t(n,e){return this.source.run(new $(this.f,this.values,n),e)};var $=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}(Q);var tt=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})};tt.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())}};tt.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 nt=function(t,n){return new Promise(function(e,r){return et(t,n,e,r)})};function et(t,n,e,r){var i=new tt;var o=new rt(e,r,i);i.setDisposable(t.run(o,n))}var rt=function t(n,e,r){this._end=n;this._error=e;this._disposable=r;this.active=true};rt.prototype.event=function t(n,e){};rt.prototype.end=function t(n){if(!this.active){return}this._dispose(this._error,this._end,undefined)};rt.prototype.error=function t(n,e){this._dispose(this._error,this._error,e)};rt.prototype._dispose=function t(n,e,r){this.active=false;it(n,e,r,this._disposable)};function it(t,n,e,r){try{r.dispose()}catch(n){t(n);return}n(e)}var ot=function(t,n,e){return new st(t,n,e)};var st=function t(n,e,r){this.step=n;this.seed=e;this.source=r};st.prototype.run=function t(n,e){return this.source.run(new ut(this.step,this.seed,n),e)};var ut=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}(Q);var ct=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=e.asap(C(this.value,n));var i=this.source.run(new at(this.f,this.value,n),e);return k(r,i)};var at=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}(Q);var pt=function(t,n){return new ft(t,n)};var ft=function t(n,e){this.f=n;this.value=e};ft.prototype.run=function t(n,e){return new vt(this.f,this.value,n,e)};var vt=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 lt(t,e)};Promise.resolve(this).then(u).catch(s)};vt.prototype.dispose=function t(){this.active=false};function lt(t,n){var e=t.f;return Promise.resolve(e(n)).then(function(n){return dt(t,n)})}function dt(t,n){if(n.done){t.sink.end(t.scheduler.now());return n.value}t.sink.event(t.scheduler.now(),n.value);return t.active?lt(t,n.seed):n.value}var yt=function(t,n){return new _t(t,n)};var _t=function t(n,e){this.f=n;this.value=e};_t.prototype.run=function t(n,e){return new kt(this.f,this.value,n,e)};var kt=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)};kt.prototype.dispose=function t(){this.active=false};function wt(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 mt(t,n)})}var mt=function(t,n){return t.active?wt(t,n):t.value};function gt(t){return new bt(t,r(arguments))}var bt=function t(n,e){this.f=n;this.args=e};bt.prototype.run=function t(n,e){return new xt(this.f.apply(void 0,this.args),n,e)};var xt=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(jt).catch(o)};xt.prototype.dispose=function t(){this.active=false};var jt=function(t,n){return t.active?Ot(t,t.iterator.next(n)):n};function Ot(t,n){if(n.done){return t.sink.end(t.scheduler.now())}return Promise.resolve(n.value).then(function(n){return It(t,n)},function(n){return Tt(t,n)})}function It(t,n){t.sink.event(t.scheduler.now(),n);return jt(t,n)}function Tt(t,n){return Ot(t,t.iterator.throw(n))}var Et=function t(n,e){this.sink=e;this.offset=n};Et.prototype.event=function t(n,e){this.sink.event(n+this.offset,e)};Et.prototype.error=function t(n,e){this.sink.error(n+this.offset,e)};Et.prototype.end=function t(n){this.sink.end(n+this.offset)};function At(t,n){var e=n.length;var r=new Array(e);var i=0;for(var o,s=0;s<e;++s){o=n[s];if(!t(o)){r[i]=o;++i}}r.length=i;return r}function Ct(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}function Pt(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}var qt=function t(n,e,r,i,o){this.time=n;this.localOffset=e;this.period=r;this.task=i;this.scheduler=o;this.active=true};qt.prototype.run=function t(){return this.task.run(this.time-this.localOffset)};qt.prototype.error=function t(n){return this.task.error(this.time-this.localOffset,n)};qt.prototype.dispose=function t(){this.scheduler.cancel(this);return this.task.dispose()};var Bt=function t(){};Bt.prototype.asap=function t(n){return this.scheduleTask(0,0,-1,n)};Bt.prototype.delay=function t(n,e){return this.scheduleTask(0,n,-1,e)};Bt.prototype.periodic=function t(n,e){return this.scheduleTask(0,0,n,e)};Bt.prototype.schedule=function t(n,e,r){return this.scheduleTask(0,n,e,r)};var Mt=function(t){function n(n,e){t.call(this);this.origin=n;this.scheduler=e}if(t){n.__proto__=t}n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.now=function t(){return this.scheduler.now()-this.origin};n.prototype.scheduleTask=function t(n,e,r,i){return this.scheduler.scheduleTask(n+this.origin,e,r,i)};n.prototype.relative=function t(e){return new n(e+this.origin,this.scheduler)};n.prototype.cancel=function t(n){return this.scheduler.cancel(n)};n.prototype.cancelAll=function t(n){return this.scheduler.cancelAll(n)};return n}(Bt);var Vt=function(t){return Promise.resolve(t).then(St)};function St(t){try{return t.run()}catch(n){return t.error(n)}}var Wt=function t(){this.tasks=[]};Wt.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};Wt.prototype.isEmpty=function t(){return this.tasks.length===0};Wt.prototype.add=function t(n){Rt(n,this.tasks)};Wt.prototype.remove=function t(n){var e=Ht(Ft(n),this.tasks);if(e>=0&&e<this.tasks.length){var r=Ct(n,this.tasks[e].events);if(r>=0){this.tasks[e].events.splice(r,1);return true}}return false};Wt.prototype.removeAll=function t(n){var e=this;for(var r=0;r<this.tasks.length;++r){Gt(n,e.tasks[r])}};Wt.prototype.runTasks=function t(n,e){var r=this;var i=this.tasks;var o=i.length;var s=0;while(s<o&&i[s].time<=n){++s}this.tasks=i.slice(s);for(var u=0;u<s;++u){r.tasks=Nt(e,i[u].events,r.tasks)}};function Nt(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;Rt(i,e)}}}return e}function Rt(t,n){var e=n.length;var r=Ft(t);if(e===0){n.push(Jt(r,[t]));return}var i=Ht(r,n);if(i>=e){n.push(Jt(r,[t]))}else{zt(t,n,r,i)}}function zt(t,n,e,r){var i=n[r];if(e===i.time){Dt(t,i.events,e)}else{n.splice(r,0,Jt(e,[t]))}}function Dt(t,n){if(n.length===0||t.time>=n[n.length-1].time){n.push(t)}else{Lt(t,n)}}function Lt(t,n){for(var e=0;e<n.length;e++){if(t.time<n[e].time){n.splice(e,0,t);break}}}function Ft(t){return Math.floor(t.time)}function Gt(t,n){n.events=At(t,n.events)}function Ht(t,n){var e=0;var r=n.length;var i,o;while(e<r){i=Math.floor((e+r)/2);o=n[i];if(t===o.time){return i}else if(t<o.time){r=i}else{e=i+1}}return r}var Jt=function(t,n){return{time:t,events:n}};var Kt=function t(n){this._clock=n};Kt.prototype.now=function t(){return this._clock.now()};Kt.prototype.setTimer=function t(n,e){return e<=0?Ut(n):setTimeout(n,e)};Kt.prototype.clearTimer=function t(n){return n instanceof Qt?n.cancel():clearTimeout(n)};var Qt=function t(n){this.f=n;this.active=true};Qt.prototype.run=function t(){return this.active&&this.f()};Qt.prototype.error=function t(n){throw n};Qt.prototype.cancel=function t(){this.active=false};function Ut(t){var n=new Qt(t);Vt(n);return n}var Xt=function t(n,e){this.origin=e;this.clock=n};Xt.prototype.now=function t(){return this.clock.now()-this.origin};var Yt=function t(n,e){this.origin=e;this.hrtime=n};Yt.prototype.now=function t(){var n=this.hrtime(this.origin);return(n[0]*1e9+n[1])/1e6};var Zt=Pt(function(t,n){return new Mt(t,n)});var $t=function(t,n,e,r){return n.run(new Et(t,e),Zt(t,r))};var tn=function(t,n){return new nn(t,n)};var nn=function t(n,e){this.f=n;this.source=e};nn.prototype.run=function t(n,e){return new en(this.f,this.source,n,e)};var en=function(t){function n(n,e,r,i){t.call(this,r);this.f=n;this.scheduler=i;this.active=true;this.disposable=v(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}I(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 $t(e,n(),r,this.scheduler)};n.prototype.dispose=function t(){this.active=false;return this.disposable.dispose()};return n}(Q);var rn=function(t,n){return on(W(t),n)};var on=function(t,n){return tn(function(){return n},t)};var sn=function t(n,e){this.p=n;this.source=e};sn.prototype.run=function t(n,e){return this.source.run(new un(this.p,n),e)};sn.create=function t(n,e){if(e instanceof sn){return new sn(cn(e.p,n),e.source)}return new sn(n,e)};var un=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}(Q);var cn=function(t,n){return function(e){return t(e)&&n(e)}};var hn=function t(n,e,r){this.p=n;this.f=e;this.source=r};hn.prototype.run=function t(n,e){return this.source.run(new an(this.p,this.f,n),e)};var an=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}(Q);var pn=function t(n,e){this.f=n;this.source=e};pn.prototype.run=function t(n,e){return this.source.run(new fn(this.f,n),e)};pn.create=function t(n,e){if(e instanceof pn){return new pn(u(n,e.f),e.source)}if(e instanceof sn){return new hn(e.p,n,e.source)}return new pn(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;this.sink.event(n,r(e))};return n}(Q);var vn=function(t,n){return pn.create(t,n)};var ln=function(t,n){return vn(function(){return t},n)};var dn=function(t,n){return new yn(t,n)};var yn=function t(n,e){this.source=e;this.f=n};yn.prototype.run=function t(n,e){return this.source.run(new _n(this.f,n),e)};var _n=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}(Q);var kn=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}(Q);function wn(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 mn(t,n,e){return gn(t,[n,e])}var gn=function(t,n){return n.length===0?z():n.length===1?vn(t,n[0]):new bn(t,n)};var bn=function t(n,e){this.f=n;this.sources=e};bn.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 xn(o,s,n,this.f);for(var c=void 0,h=0;h<i;++h){c=s[h]=new kn(h,u);o[h]=r.sources[h].run(c,e)}return _(o)};var xn=function(t){function n(n,e,r,i){t.call(this,r);this.disposables=n;this.sinks=e;this.f=i;var o=e.length;this.awaiting=o;this.values=new Array(o);this.hasValue=new Array(o).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,wn(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){I(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Q);function jn(t,n){return mn(c,t,n)}function On(){this.head=null;this.length=0}On.prototype.add=function(t){if(this.head!==null){this.head.prev=t;t.next=this.head}this.head=t;++this.length};On.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}};On.prototype.isEmpty=function(){return this.length===0};On.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 In=function(t,n){return Tn(s,t,n)};var Tn=function(t,n,e){return new En(t,n,e)};var En=function t(n,e,r){this.f=n;this.concurrency=e;this.source=r};En.prototype.run=function t(n,e){return new An(this.f,this.concurrency,this.source,n,e)};var An=function t(n,e,r,i,o){this.f=n;this.concurrency=e;this.sink=i;this.scheduler=o;this.pending=[];this.current=new On;this.disposable=v(r.run(this,o));this.active=true};An.prototype.event=function t(n,e){this._addInner(n,e)};An.prototype._addInner=function t(n,e){if(this.current.length<this.concurrency){this._startInner(n,e)}else{this.pending.push(e)}};An.prototype._startInner=function t(n,e){try{this._initInner(n,e)}catch(t){this.error(n,t)}};An.prototype._initInner=function t(n,e){var r=new Pn(n,this,this.sink);r.disposable=Cn(this.f,n,e,r,this.scheduler);this.current.add(r)};An.prototype.end=function t(n){this.active=false;I(n,this.disposable,this.sink);this._checkEnd(n)};An.prototype.error=function t(n,e){this.active=false;this.sink.error(n,e)};An.prototype.dispose=function t(){this.active=false;this.pending.length=0;this.disposable.dispose();this.current.dispose()};An.prototype._endInner=function t(n,e){this.current.remove(e);I(n,e,this);if(this.pending.length===0){this._checkEnd(n)}else{this._startInner(n,this.pending.shift())}};An.prototype._checkEnd=function t(n){if(!this.active&&this.current.isEmpty()){this.sink.end(n)}};var Cn=function(t,n,e,r,i){return t(e).run(r,Zt(n,i))};var Pn=function t(n,e,r){this.prev=this.next=null;this.time=n;this.outer=e;this.sink=r;this.disposable=void 0};Pn.prototype.event=function t(n,e){this.sink.event(n+this.time,e)};Pn.prototype.end=function t(n){this.outer._endInner(n+this.time,this)};Pn.prototype.error=function t(n,e){this.outer.error(n+this.time,e)};Pn.prototype.dispose=function t(){return this.disposable.dispose()};var qn=function(t,n){return Tn(t,Infinity,n)};var Bn=function(t){return In(Infinity,t)};var Mn=function(t,n){return Tn(t,1,n)};function Vn(t,n){return Sn([t,n])}var Sn=function(t){return t.length===0?z():t.length===1?t[0]:Wn(t)};var Wn=function(t){return new Rn(o(Nn,[],t))};var Nn=function(t,n){return t.concat(n instanceof Rn?n.sources:n)};var Rn=function t(n){this.sources=n};Rn.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 zn(o,s,n);for(var c=void 0,h=0;h<i;++h){c=s[h]=new kn(h,u);o[h]=r.sources[h].run(c,e)}return _(o)};var zn=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){I(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Q);var Dn=function(t,n,e){return new Ln(t,n,e)};var Ln=function t(n,e,r){this.source=r;this.sampler=e;this.f=n};Ln.prototype.run=function t(n,e){var r=new Fn(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 Fn=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}(Q);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}(Q);function Hn(t){this._capacity=t||32;this._length=0;this._head=0}Hn.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};Hn.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};Hn.prototype.isEmpty=function(){return this._length===0};Hn.prototype.length=function(){return this._length};Hn.prototype._checkCapacity=function(t){if(this._capacity<t){this._ensureCapacity(this._capacity<<1)}};Hn.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 Kn(t,n,e){return Qn(t,[n,e])}var Qn=function(t,n){return n.length===0?z():n.length===1?vn(t,n[0]):new Un(t,n)};var Un=function t(n,e){this.f=n;this.sources=e};Un.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 Xn(this.f,u,s,n);for(var h=void 0,a=0;a<i;++a){u[a]=new Hn;h=s[a]=new kn(a,c);o[a]=r.sources[a].run(h,e)}return _(o)};var Xn=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(!te(this.buffers)){return}Yn(this.f,n,r,this.sink);if($n(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}(Q);var Yn=function(t,n,e,r){return r.event(n,wn(t,i(Zn,e)))};var Zn=function(t){return t.shift()};function $n(t,n){for(var e=0,r=t.length;e<r;++e){if(t[e].isEmpty()&&!n[e].active){return true}}return false}function te(t){for(var n=0,e=t.length;n<e;++n){if(t[n].isEmpty()){return false}}return true}var ne=function(t){return new ee(t)};var ee=function t(n){this.source=n};ee.prototype.run=function t(n,e){var r=new re(n,e);return k(r,this.source.run(r,e))};var re=function t(n,e){this.sink=n;this.scheduler=e;this.current=null;this.ended=false};re.prototype.event=function t(n,e){this._disposeCurrent(n);this.current=new ie(e,n,Infinity,this,this.sink,this.scheduler)};re.prototype.end=function t(n){this.ended=true;this._checkEnd(n)};re.prototype.error=function t(n,e){this.ended=true;this.sink.error(n,e)};re.prototype.dispose=function t(){return this._disposeCurrent(this.scheduler.now())};re.prototype._disposeCurrent=function t(n){if(this.current!==null){return this.current._dispose(n)}};re.prototype._disposeInner=function t(n,e){e._dispose(n);if(e===this.current){this.current=null}};re.prototype._checkEnd=function t(n){if(this.ended&&this.current===null){this.sink.end(n)}};re.prototype._endInner=function t(n,e){this._disposeInner(n,e);this._checkEnd(n)};re.prototype._errorInner=function t(n,e,r){this._disposeInner(n,r);this.sink.error(n,e)};var ie=function t(n,e,r,i,o,s){this.min=e;this.max=r;this.outer=i;this.sink=o;this.disposable=n.run(this,Zt(e,s))};ie.prototype.event=function t(n,e){var r=Math.max(0,n+this.min);if(r<this.max){this.sink.event(r,e)}};ie.prototype.end=function t(n){this.outer._endInner(n+this.min,this)};ie.prototype.error=function t(n,e){this.outer._errorInner(n+this.min,e,this)};ie.prototype._dispose=function t(n){I(n+this.min,this.disposable,this.sink)};var oe=function(t,n){return sn.create(t,n)};var se=function(t){return ue(ae,t)};var ue=function(t,n){return new ce(t,n)};var ce=function t(n,e){this.equals=n;this.source=e};ce.prototype.run=function t(n,e){return this.source.run(new he(this.equals,n),e)};var he=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}(Q);function ae(t,n){return t===n}var pe=function(t,n){return ve(0,t,n)};var fe=function(t,n){return ve(t,Infinity,n)};var ve=function(t,n,e){return n<=t?z():le(t,n,e)};var le=function(t,n,e){return e instanceof pn?de(t,n,e):e instanceof _e?ye(t,n,e):new _e(t,n,e)};var de=function(t,n,e){return pn.create(e.f,le(t,n,e.source))};function ye(t,n,e){var r=t+e.min;var i=Math.min(n+e.min,e.max);return new _e(r,i,e.source)}var _e=function t(n,e,r){this.source=r;this.min=n;this.max=e};_e.prototype.run=function t(n,e){return this.source.run(new ke(this.min,this.max-this.min,n),e)};var ke=function(t){function n(n,e,r){t.call(this,r);this.skip=n;this.take=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(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.sink.end(n)}};return n}(Q);var we=function(t,n){return new me(t,n)};var me=function t(n,e){this.p=n;this.source=e};me.prototype.run=function t(n,e){return this.source.run(new ge(this.p,n),e)};var ge=function(t){function n(n,e){t.call(this,e);this.p=n;this.active=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.active){return}var r=this.p;this.active=r(e);if(this.active){this.sink.event(n,e)}else{this.sink.end(n)}};return n}(Q);var be=function(t,n){return new xe(t,n)};var xe=function t(n,e){this.p=n;this.source=e};xe.prototype.run=function t(n,e){return this.source.run(new je(this.p,n),e)};var je=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}(Q);var Oe=function t(n,e){this.p=n;this.source=e};Oe.prototype.run=function t(n,e){return this.source.run(new Ie(this.p,n),e)};var Ie=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}(Q);var Te=function(t,n){return new Ce(t,n)};var Ee=function(t,n){return new Pe(t,n)};var Ae=function(t,n){return Te(Bn(t),Ee(t,n))};var Ce=function t(n,e){this.maxSignal=n;this.source=e};Ce.prototype.run=function t(n,e){var r=new qe(-Infinity,n);var i=new Ve(this.maxSignal,n,e);var o=this.source.run(new Be(r,i,n),e);return _([r,i,o])};var Pe=function t(n,e){this.minSignal=n;this.source=e};Pe.prototype.run=function t(n,e){var r=new Me(this.minSignal,n,e);var i=new qe(Infinity,n);var o=this.source.run(new Be(r,i,n),e);return _([r,i,o])};var qe=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}(Q);var Be=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}(Q);var Me=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}(Q);var Ve=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}(Q);var Se=function(t,n){return t<=0?n:new We(t,n)};var We=function t(n,e){this.dt=n;this.source=e};We.prototype.run=function t(n,e){var r=new Ne(this.dt,n,e);return k(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;this.scheduler.cancelAll(function(t){return t.sink===n.sink})};n.prototype.event=function t(n,e){this.scheduler.delay(this.dt,C(e,this.sink))};n.prototype.end=function t(n){this.scheduler.delay(this.dt,P(this.sink))};return n}(Q);var Re=function(t,n){return n instanceof pn?ze(t,n):n instanceof Le?De(t,n):new Le(t,n)};var ze=function(t,n){return pn.create(n.f,Re(t,n.source))};var De=function(t,n){return new Le(Math.max(t,n.period),n.source)};var Le=function t(n,e){this.period=n;this.source=e};Le.prototype.run=function t(n,e){return this.source.run(new Fe(this.period,n),e)};var Fe=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}(Q);var Ge=function(t,n){return new He(t,n)};var He=function t(n,e){this.dt=n;this.source=e};He.prototype.run=function t(n,e){return new Je(this.dt,this.source,n,e)};var Je=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)};Je.prototype.event=function t(n,e){ | ||
this._clearTimer();this.value=e;this.timer=this.scheduler.delay(this.dt,C(e,this.sink))};Je.prototype.end=function t(n){if(this._clearTimer()){this.sink.event(n,this.value);this.value=undefined}this.sink.end(n)};Je.prototype.error=function t(n,e){this._clearTimer();this.sink.error(n,e)};Je.prototype.dispose=function t(){this._clearTimer()};Je.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var Ke=function(t){return new Ue(t)};var Qe=u(Ke,W);var Ue=function t(n){this.source=n};Ue.prototype.run=function t(n,e){return this.source.run(new Xe(n,e),e)};var Xe=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(){return r.sink.end(r.scheduler.now())};this._errorBound=function(t){return r.sink.error(r.scheduler.now(),t)}};Xe.prototype.event=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._event(e)}).catch(this._errorBound)};Xe.prototype.end=function t(n){this.queue=this.queue.then(this._endBound).catch(this._errorBound)};Xe.prototype.error=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._errorBound(e)}).catch(T)};Xe.prototype._event=function t(n){return n.then(this._eventBound)};function Ye(t){this.sink=t;this.active=true}Ye.prototype.event=function(t,n){if(!this.active){return}this.sink.event(t,n)};Ye.prototype.end=function(t,n){if(!this.active){return}this.disable();this.sink.end(t,n)};Ye.prototype.error=function(t,n){this.disable();this.sink.error(t,n)};Ye.prototype.disable=function(){this.active=false;return this.sink};function Ze(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}function $e(t,n){try{n.end(t)}catch(e){n.error(t,e)}}var tr=function(t,n){return new rr(t,n)};var nr=function(t){return new er(t)};var er=function t(n){this.value=n};er.prototype.run=function t(n,e){return e.asap(q(this.value,n))};var rr=function t(n,e){this.f=n;this.source=e};rr.prototype.run=function t(n,e){return new ir(this.f,this.source,n,e)};var ir=function t(n,e,r,i){this.f=n;this.sink=new Ye(r);this.scheduler=i;this.disposable=e.run(this,i)};ir.prototype.event=function t(n,e){Ze(n,e,this.sink)};ir.prototype.end=function t(n){$e(n,this.sink)};ir.prototype.error=function t(n,e){var r=this.sink.disable();I(n,this.disposable,this.sink);this._startNext(n,e,r)};ir.prototype._startNext=function t(n,e,r){try{this.disposable=this._continue(this.f,n,e,r)}catch(t){r.error(n,t)}};ir.prototype._continue=function t(n,e,r,i){return $t(e,n(r),i,this.scheduler)};ir.prototype.dispose=function t(){return this.disposable.dispose()};var or=a(X);var sr=h(U);var ur=h(nt);var cr=a(ot);var hr=a(ct);var ar=h(pt);var pr=h(yt);var fr=h(on);var vr=h(rn);var lr=h(vn);var dr=h(ln);var yr=h(dn);var _r=h(jn);var kr=h(qn);var wr=h(tn);var mr=h(Mn);var gr=h(In);var br=a(Tn);var xr=h(Vn);var jr=a(mn);var Or=h(gn);var Ir=a(Dn);var Tr=a(Kn);var Er=h(Qn);var Ar=h(oe);var Cr=h(ue);var Pr=h(pe);var qr=h(fe);var Br=a(ve);var Mr=h(we);var Vr=h(be);var Sr=h(Te);var Wr=h(Ee);var Nr=h(Ae);var Rr=h(Se);var zr=h(Re);var Dr=h(Ge);var Lr=h(tr);var Fr=a(A);var Gr=h(C);var Hr=h(q);t.zipArrayValues=or;t.withArrayValues=sr;t.runEffects=ur;t.loop=cr;t.scan=hr;t.unfold=ar;t.iterate=pr;t.concat=fr;t.startWith=vr;t.map=lr;t.constant=dr;t.tap=yr;t.ap=_r;t.chain=kr;t.join=Bn;t.continueWith=wr;t.concatMap=mr;t.mergeConcurrently=gr;t.mergeMapConcurrently=br;t.merge=xr;t.mergeArray=Sn;t.combine=jr;t.combineArray=Or;t.sample=Ir;t.zip=Tr;t.zipArray=Er;t.filter=Ar;t.skipRepeats=se;t.skipRepeatsWith=Cr;t.take=Pr;t.skip=qr;t.slice=Br;t.takeWhile=Mr;t.skipWhile=Vr;t.until=Sr;t.since=Wr;t.during=Nr;t.delay=Rr;t.throttle=zr;t.debounce=Dr;t.recoverWith=Lr;t.throwError=nr;t.propagateTask=Fr;t.propagateEventTask=Gr;t.propagateErrorTask=Hr;t.propagateEndTask=P;t.just=W;t.empty=z;t.never=F;t.periodic=J;t.generate=gt;t.switchLatest=ne;t.fromPromise=Qe;t.awaitPromises=Ke;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){var e=n.length;var r=new Array(e);for(var i=0;i<e;++i){r[i]=t(n[i])}return r}function e(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 r=function(t){return t};var i=function(t,n){return function(e){return t(n(e))}};var o=function(t,n){return t(n)};function s(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 u(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return s(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 c(t){setTimeout(h,0,t)}function h(t){throw t}var a=function(t,n,e){return new l(t,n,e)};var p=function(t,n){return a(d,t,n)};var f=function(t){return a(y,undefined,t)};var v=function(t,n){return a(_,t,n)};var l=function t(n,e,r){this._run=n;this.value=e;this.sink=r;this.active=true};l.prototype.dispose=function t(){this.active=false};l.prototype.run=function t(n){if(!this.active){return}var t=this._run;t(n,this.value,this.sink,this)};l.prototype.error=function t(n,e){if(!this.active){return c(e)}this.sink.error(n,e)};var d=function(t,n,e){return e.event(t,n)};var y=function(t,n,e){return e.end(t)};var _=function(t,n,e){return e.error(t,n)};var k=function(t,n){return new w(t,n)};var w=function t(n,e){this.time=n;this.value=e};w.prototype.run=function t(n,e){return e.delay(this.time,a(m,this.value,n))};function m(t,n,e){e.event(t,n);e.end(t)}var g=function(t){return k(0,t)};var b=function(){return O};var x=function t(){};x.prototype.run=function t(n,e){return e.asap(f(n))};var O=new x;var j=function(){return I};var I=new(function(){function t(){}t.prototype.dispose=function t(){};return t}());var T=function(t){return new E(t)};var E=function t(n){this.disposed=false;this.disposable=n};E.prototype.dispose=function t(){if(!this.disposed){this.disposed=true;this.disposable.dispose();this.disposable=undefined}};var A=function t(n,e){this._dispose=n;this._resource=e};A.prototype.dispose=function t(){this._dispose(this._resource)};function C(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 q=function(t){return new B(t)};var P=function(t,n){return q([t,n])};var B=function t(n){this.disposables=n};B.prototype.dispose=function t(){V(M(this.disposables))};var M=function(t){return C(S,[],t)};var S=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t};var V=function(t){if(t.length>0){throw new W(t.length+" errors",t)}};var W=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+N(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 N=function(t){return C(R,"",t)};var R=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack};function z(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}}var D=function(){return F};var L=function t(){};L.prototype.run=function t(){return j()};var F=new L;var G=function(t){return new H(t)};var H=function t(n){this.period=n};H.prototype.run=function t(n,e){return e.periodic(this.period,p(undefined,n))};var J=function(t){return new K(t)};var K=function t(n){this.run=n};var Q=function t(n){this.sink=n};Q.prototype.event=function t(n,e){return this.sink.event(n,e)};Q.prototype.end=function t(n){return this.sink.end(n)};Q.prototype.error=function t(n,e){return this.sink.error(n,e)};var U=function(t,n){return X(Y,t,n)};var X=function(t,n,e){return n.length===0||e===b()?b():new Z(t,n,e)};var Y=function(t,n){return t};var Z=function t(n,e,r){this.f=n;this.values=e;this.source=r};Z.prototype.run=function t(n,e){return this.source.run(new $(this.f,this.values,n),e)};var $=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}(Q);var tt=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})};tt.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())}};tt.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 nt=function(t,n){return new Promise(function(e,r){return et(t,n,e,r)})};function et(t,n,e,r){var i=new tt;var o=new rt(e,r,i);i.setDisposable(t.run(o,n))}var rt=function t(n,e,r){this._end=n;this._error=e;this._disposable=r;this.active=true};rt.prototype.event=function t(n,e){};rt.prototype.end=function t(n){if(!this.active){return}this._dispose(this._error,this._end,undefined)};rt.prototype.error=function t(n,e){this._dispose(this._error,this._error,e)};rt.prototype._dispose=function t(n,e,r){this.active=false;it(n,e,r,this._disposable)};function it(t,n,e,r){try{r.dispose()}catch(n){t(n);return}n(e)}var ot=function(t,n,e){return new st(t,n,e)};var st=function t(n,e,r){this.step=n;this.seed=e;this.source=r};st.prototype.run=function t(n,e){return this.source.run(new ut(this.step,this.seed,n),e)};var ut=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}(Q);var ct=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=e.asap(p(this.value,n));var i=this.source.run(new at(this.f,this.value,n),e);return P(r,i)};var at=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}(Q);var pt=function t(n,e){this.sink=e;this.offset=n};pt.prototype.event=function t(n,e){this.sink.event(n+this.offset,e)};pt.prototype.error=function t(n,e){this.sink.error(n+this.offset,e)};pt.prototype.end=function t(n){this.sink.end(n+this.offset)};function ft(t,n){var e=n.length;var r=new Array(e);var i=0;for(var o=void 0,s=0;s<e;++s){o=n[s];if(!t(o)){r[i]=o;++i}}r.length=i;return r}function vt(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}function lt(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}var dt=function t(n,e,r,i,o){this.time=n;this.localOffset=e;this.period=r;this.task=i;this.scheduler=o;this.active=true};dt.prototype.run=function t(){return this.task.run(this.time-this.localOffset)};dt.prototype.error=function t(n){return this.task.error(this.time-this.localOffset,n)};dt.prototype.dispose=function t(){this.scheduler.cancel(this);return this.task.dispose()};var yt=function t(){};yt.prototype.asap=function t(n){return this.scheduleTask(0,0,-1,n)};yt.prototype.delay=function t(n,e){return this.scheduleTask(0,n,-1,e)};yt.prototype.periodic=function t(n,e){return this.scheduleTask(0,0,n,e)};yt.prototype.schedule=function t(n,e,r){return this.scheduleTask(0,n,e,r)};var _t=function(t){function n(n,e){t.call(this);this.origin=n;this.scheduler=e}if(t){n.__proto__=t}n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.now=function t(){return this.scheduler.now()-this.origin};n.prototype.scheduleTask=function t(n,e,r,i){return this.scheduler.scheduleTask(n+this.origin,e,r,i)};n.prototype.relative=function t(e){return new n(e+this.origin,this.scheduler)};n.prototype.cancel=function t(n){return this.scheduler.cancel(n)};n.prototype.cancelAll=function t(n){return this.scheduler.cancelAll(n)};return n}(yt);var kt=function(t){return Promise.resolve(t).then(wt)};function wt(t){try{return t.run()}catch(n){return t.error(n)}}var mt=function t(){this.tasks=[]};mt.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};mt.prototype.isEmpty=function t(){return this.tasks.length===0};mt.prototype.add=function t(n){bt(n,this.tasks)};mt.prototype.remove=function t(n){var e=Et(It(n),this.tasks);if(e>=0&&e<this.tasks.length){var r=vt(n,this.tasks[e].events);if(r>=0){this.tasks[e].events.splice(r,1);return true}}return false};mt.prototype.removeAll=function t(n){var e=this;for(var r=0;r<this.tasks.length;++r){Tt(n,e.tasks[r])}};mt.prototype.runTasks=function t(n,e){var r=this;var i=this.tasks;var o=i.length;var s=0;while(s<o&&i[s].time<=n){++s}this.tasks=i.slice(s);for(var u=0;u<s;++u){r.tasks=gt(e,i[u].events,r.tasks)}};function gt(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;bt(i,e)}}}return e}function bt(t,n){var e=n.length;var r=It(t);if(e===0){n.push(At(r,[t]));return}var i=Et(r,n);if(i>=e){n.push(At(r,[t]))}else{xt(t,n,r,i)}}function xt(t,n,e,r){var i=n[r];if(e===i.time){Ot(t,i.events,e)}else{n.splice(r,0,At(e,[t]))}}function Ot(t,n){if(n.length===0||t.time>=n[n.length-1].time){n.push(t)}else{jt(t,n)}}function jt(t,n){for(var e=0;e<n.length;e++){if(t.time<n[e].time){n.splice(e,0,t);break}}}function It(t){return Math.floor(t.time)}function Tt(t,n){n.events=ft(t,n.events)}function Et(t,n){var e=0;var r=n.length;var i,o;while(e<r){i=Math.floor((e+r)/2);o=n[i];if(t===o.time){return i}else if(t<o.time){r=i}else{e=i+1}}return r}var At=function(t,n){return{time:t,events:n}};var Ct=function t(n){this._clock=n};Ct.prototype.now=function t(){return this._clock.now()};Ct.prototype.setTimer=function t(n,e){return e<=0?Pt(n):setTimeout(n,e)};Ct.prototype.clearTimer=function t(n){return n instanceof qt?n.cancel():clearTimeout(n)};var qt=function t(n){this.f=n;this.active=true};qt.prototype.run=function t(){return this.active&&this.f()};qt.prototype.error=function t(n){throw n};qt.prototype.cancel=function t(){this.active=false};function Pt(t){var n=new qt(t);kt(n);return n}var Bt=function t(n,e){this.origin=e;this.clock=n};Bt.prototype.now=function t(){return this.clock.now()-this.origin};var Mt=function t(n,e){this.origin=e;this.hrtime=n};Mt.prototype.now=function t(){var n=this.hrtime(this.origin);return(n[0]*1e9+n[1])/1e6};var St=lt(function(t,n){return new _t(t,n)});var Vt=function(t,n,e,r){return n.run(new pt(t,e),St(t,r))};var Wt=function(t,n){return new Nt(t,n)};var Nt=function t(n,e){this.f=n;this.source=e};Nt.prototype.run=function t(n,e){return new Rt(this.f,this.source,n,e)};var Rt=function(t){function n(n,e,r,i){t.call(this,r);this.f=n;this.scheduler=i;this.active=true;this.disposable=T(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}z(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 Vt(e,n(),r,this.scheduler)};n.prototype.dispose=function t(){this.active=false;return this.disposable.dispose()};return n}(Q);var zt=function(t,n){return Wt(function(){return n},g(t))};var Dt=function t(n,e){this.p=n;this.source=e};Dt.prototype.run=function t(n,e){return this.source.run(new Lt(this.p,n),e)};Dt.create=function t(n,e){if(e instanceof Dt){return new Dt(Ft(e.p,n),e.source)}return new Dt(n,e)};var Lt=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}(Q);var Ft=function(t,n){return function(e){return t(e)&&n(e)}};var Gt=function t(n,e,r){this.p=n;this.f=e;this.source=r};Gt.prototype.run=function t(n,e){return this.source.run(new Ht(this.p,this.f,n),e)};var Ht=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}(Q);var Jt=function t(n,e){this.f=n;this.source=e};Jt.prototype.run=function t(n,e){return this.source.run(new Kt(this.f,n),e)};Jt.create=function t(n,e){if(e instanceof Jt){return new Jt(i(n,e.f),e.source)}if(e instanceof Dt){return new Gt(e.p,n,e.source)}return new Jt(n,e)};var Kt=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}(Q);var Qt=function(t,n){return Jt.create(t,n)};var Ut=function(t,n){return Qt(function(){return t},n)};var Xt=function(t,n){return new Yt(t,n)};var Yt=function t(n,e){this.source=e;this.f=n};Yt.prototype.run=function t(n,e){return this.source.run(new Zt(this.f,n),e)};var Zt=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}(Q);var $t=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}(Q);function tn(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 nn(t,n,e){return en(t,[n,e])}var en=function(t,n){return n.length===0?b():n.length===1?Qt(t,n[0]):new rn(t,n)};var rn=function t(n,e){this.f=n;this.sources=e};rn.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 on(o,s,n,this.f);for(var c=void 0,h=0;h<i;++h){c=s[h]=new $t(h,u);o[h]=r.sources[h].run(c,e)}return q(o)};var on=function(t){function n(n,e,r,i){t.call(this,r);this.disposables=n;this.sinks=e;this.f=i;var o=e.length;this.awaiting=o;this.values=new Array(o);this.hasValue=new Array(o).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,tn(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){z(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Q);function sn(t,n){return nn(o,t,n)}function un(){this.head=null;this.length=0}un.prototype.add=function(t){if(this.head!==null){this.head.prev=t;t.next=this.head}this.head=t;++this.length};un.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}};un.prototype.isEmpty=function(){return this.length===0};un.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 cn=function(t,n){return hn(r,t,n)};var hn=function(t,n,e){return new an(t,n,e)};var an=function t(n,e,r){this.f=n;this.concurrency=e;this.source=r};an.prototype.run=function t(n,e){return new pn(this.f,this.concurrency,this.source,n,e)};var pn=function t(n,e,r,i,o){this.f=n;this.concurrency=e;this.sink=i;this.scheduler=o;this.pending=[];this.current=new un;this.disposable=T(r.run(this,o));this.active=true};pn.prototype.event=function t(n,e){this._addInner(n,e)};pn.prototype._addInner=function t(n,e){if(this.current.length<this.concurrency){this._startInner(n,e)}else{this.pending.push(e)}};pn.prototype._startInner=function t(n,e){try{this._initInner(n,e)}catch(t){this.error(n,t)}};pn.prototype._initInner=function t(n,e){var r=new vn(n,this,this.sink);r.disposable=fn(this.f,n,e,r,this.scheduler);this.current.add(r)};pn.prototype.end=function t(n){this.active=false;z(n,this.disposable,this.sink);this._checkEnd(n)};pn.prototype.error=function t(n,e){this.active=false;this.sink.error(n,e)};pn.prototype.dispose=function t(){this.active=false;this.pending.length=0;this.disposable.dispose();this.current.dispose()};pn.prototype._endInner=function t(n,e){this.current.remove(e);z(n,e,this);if(this.pending.length===0){this._checkEnd(n)}else{this._startInner(n,this.pending.shift())}};pn.prototype._checkEnd=function t(n){if(!this.active&&this.current.isEmpty()){this.sink.end(n)}};var fn=function(t,n,e,r,i){return t(e).run(r,St(n,i))};var vn=function t(n,e,r){this.prev=this.next=null;this.time=n;this.outer=e;this.sink=r;this.disposable=void 0};vn.prototype.event=function t(n,e){this.sink.event(n+this.time,e)};vn.prototype.end=function t(n){this.outer._endInner(n+this.time,this)};vn.prototype.error=function t(n,e){this.outer.error(n+this.time,e)};vn.prototype.dispose=function t(){return this.disposable.dispose()};var ln=function(t,n){return hn(t,Infinity,n)};var dn=function(t){return cn(Infinity,t)};var yn=function(t,n){return hn(t,1,n)};function _n(t,n){return kn([t,n])}var kn=function(t){return t.length===0?b():t.length===1?t[0]:wn(t)};var wn=function(t){return new gn(e(mn,[],t))};var mn=function(t,n){return t.concat(n instanceof gn?n.sources:n)};var gn=function t(n){this.sources=n};gn.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 bn(o,s,n);for(var c=void 0,h=0;h<i;++h){c=s[h]=new $t(h,u);o[h]=r.sources[h].run(c,e)}return q(o)};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){z(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Q);var xn=function(t,n,e){return new On(t,n,e)};var On=function t(n,e,r){this.source=r;this.sampler=e;this.f=n};On.prototype.run=function t(n,e){var r=new jn(this.f,this.source,n);var i=this.source.run(r.hold,e);var o=this.sampler.run(r,e);return P(o,i)};var jn=function(t){function n(n,e,r){t.call(this,r);this.source=e;this.f=n;this.hold=new In(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}(Q);var In=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}(Q);function Tn(t){this._capacity=t||32;this._length=0;this._head=0}Tn.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};Tn.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};Tn.prototype.isEmpty=function(){return this._length===0};Tn.prototype.length=function(){return this._length};Tn.prototype._checkCapacity=function(t){if(this._capacity<t){this._ensureCapacity(this._capacity<<1)}};Tn.prototype._ensureCapacity=function(t){var n=this._capacity;this._capacity=t;var e=this._head+this._length;if(e>n){En(this,0,this,n,e&n-1)}};function En(t,n,e,r,i){for(var o=0;o<i;++o){e[o+r]=t[o+n];t[o+n]=void 0}}function An(t,n,e){return Cn(t,[n,e])}var Cn=function(t,n){return n.length===0?b():n.length===1?Qt(t,n[0]):new qn(t,n)};var qn=function t(n,e){this.f=n;this.sources=e};qn.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 Pn(this.f,u,s,n);for(var h=void 0,a=0;a<i;++a){u[a]=new Tn;h=s[a]=new $t(a,c);o[a]=r.sources[a].run(h,e)}return q(o)};var Pn=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(!Vn(this.buffers)){return}Bn(this.f,n,r,this.sink);if(Sn(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}(Q);var Bn=function(t,e,r,i){return i.event(e,tn(t,n(Mn,r)))};var Mn=function(t){return t.shift()};function Sn(t,n){for(var e=0,r=t.length;e<r;++e){if(t[e].isEmpty()&&!n[e].active){return true}}return false}function Vn(t){for(var n=0,e=t.length;n<e;++n){if(t[n].isEmpty()){return false}}return true}var Wn=function(t){return new Nn(t)};var Nn=function t(n){this.source=n};Nn.prototype.run=function t(n,e){var r=new Rn(n,e);return P(r,this.source.run(r,e))};var Rn=function t(n,e){this.sink=n;this.scheduler=e;this.current=null;this.ended=false};Rn.prototype.event=function t(n,e){this._disposeCurrent(n);this.current=new zn(e,n,Infinity,this,this.sink,this.scheduler)};Rn.prototype.end=function t(n){this.ended=true;this._checkEnd(n)};Rn.prototype.error=function t(n,e){this.ended=true;this.sink.error(n,e)};Rn.prototype.dispose=function t(){return this._disposeCurrent(this.scheduler.now())};Rn.prototype._disposeCurrent=function t(n){if(this.current!==null){return this.current._dispose(n)}};Rn.prototype._disposeInner=function t(n,e){e._dispose(n);if(e===this.current){this.current=null}};Rn.prototype._checkEnd=function t(n){if(this.ended&&this.current===null){this.sink.end(n)}};Rn.prototype._endInner=function t(n,e){this._disposeInner(n,e);this._checkEnd(n)};Rn.prototype._errorInner=function t(n,e,r){this._disposeInner(n,r);this.sink.error(n,e)};var zn=function t(n,e,r,i,o,s){this.min=e;this.max=r;this.outer=i;this.sink=o;this.disposable=n.run(this,St(e,s))};zn.prototype.event=function t(n,e){var r=Math.max(0,n+this.min);if(r<this.max){this.sink.event(r,e)}};zn.prototype.end=function t(n){this.outer._endInner(n+this.min,this)};zn.prototype.error=function t(n,e){this.outer._errorInner(n+this.min,e,this)};zn.prototype._dispose=function t(n){z(n+this.min,this.disposable,this.sink)};var Dn=function(t,n){return Dt.create(t,n)};var Ln=function(t){return Fn(Jn,t)};var Fn=function(t,n){return new Gn(t,n)};var Gn=function t(n,e){this.equals=n;this.source=e};Gn.prototype.run=function t(n,e){return this.source.run(new Hn(this.equals,n),e)};var Hn=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}(Q);function Jn(t,n){return t===n}var Kn=function(t,n){return Un(0,t,n)};var Qn=function(t,n){return Un(t,Infinity,n)};var Un=function(t,n,e){return n<=t?b():Xn(t,n,e)};var Xn=function(t,n,e){return e instanceof Jt?Yn(t,n,e):e instanceof $n?Zn(t,n,e):new $n(t,n,e)};var Yn=function(t,n,e){return Jt.create(e.f,Xn(t,n,e.source))};function Zn(t,n,e){var r=t+e.min;var i=Math.min(n+e.min,e.max);return new $n(r,i,e.source)}var $n=function t(n,e,r){this.source=r;this.min=n;this.max=e};$n.prototype.run=function t(n,e){return this.source.run(new te(this.min,this.max-this.min,n),e)};var te=function(t){function n(n,e,r){t.call(this,r);this.skip=n;this.take=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(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.sink.end(n)}};return n}(Q);var ne=function(t,n){return new ee(t,n)};var ee=function t(n,e){this.p=n;this.source=e};ee.prototype.run=function t(n,e){return this.source.run(new re(this.p,n),e)};var re=function(t){function n(n,e){t.call(this,e);this.p=n;this.active=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.active){return}var r=this.p;this.active=r(e);if(this.active){this.sink.event(n,e)}else{this.sink.end(n)}};return n}(Q);var ie=function(t,n){return new oe(t,n)};var oe=function t(n,e){this.p=n;this.source=e};oe.prototype.run=function t(n,e){return this.source.run(new se(this.p,n),e)};var se=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}(Q);var ue=function t(n,e){this.p=n;this.source=e};ue.prototype.run=function t(n,e){return this.source.run(new ce(this.p,n),e)};var ce=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}(Q);var he=function(t,n){return new fe(t,n)};var ae=function(t,n){return new ve(t,n)};var pe=function(t,n){return he(dn(t),ae(t,n))};var fe=function t(n,e){this.maxSignal=n;this.source=e};fe.prototype.run=function t(n,e){var r=new le(-Infinity,n);var i=new _e(this.maxSignal,n,e);var o=this.source.run(new de(r,i,n),e);return q([r,i,o])};var ve=function t(n,e){this.minSignal=n;this.source=e};ve.prototype.run=function t(n,e){var r=new ye(this.minSignal,n,e);var i=new le(Infinity,n);var o=this.source.run(new de(r,i,n),e);return q([r,i,o])};var le=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}(Q);var de=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}(Q);var ye=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}(Q);var _e=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}(Q);var ke=function(t,n){return t<=0?n:new we(t,n)};var we=function t(n,e){this.dt=n;this.source=e};we.prototype.run=function t(n,e){var r=new me(this.dt,n,e);return P(r,this.source.run(r,e))};var me=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,p(e,this.sink))};n.prototype.end=function t(n){this.scheduler.delay(this.dt,f(this.sink))};return n}(Q);var ge=function(t,n){return n instanceof Jt?be(t,n):n instanceof Oe?xe(t,n):new Oe(t,n)};var be=function(t,n){return Jt.create(n.f,ge(t,n.source))};var xe=function(t,n){return new Oe(Math.max(t,n.period),n.source)};var Oe=function t(n,e){this.period=n;this.source=e};Oe.prototype.run=function t(n,e){return this.source.run(new je(this.period,n),e)};var je=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}(Q);var Ie=function(t,n){return new Te(t,n)};var Te=function t(n,e){this.dt=n;this.source=e};Te.prototype.run=function t(n,e){return new Ee(this.dt,this.source,n,e)};var Ee=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=P(this,o)};Ee.prototype.event=function t(n,e){this._clearTimer();this.value=e;this.timer=this.scheduler.delay(this.dt,p(e,this.sink))};Ee.prototype.end=function t(n){if(this._clearTimer()){this.sink.event(n,this.value);this.value=undefined}this.sink.end(n)};Ee.prototype.error=function t(n,e){this._clearTimer();this.sink.error(n,e)};Ee.prototype.dispose=function t(){this._clearTimer()};Ee.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var Ae=function(t){return new qe(t)};var Ce=i(Ae,g);var qe=function t(n){this.source=n};qe.prototype.run=function t(n,e){return this.source.run(new Pe(n,e),e)};var Pe=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(){return r.sink.end(r.scheduler.now())};this._errorBound=function(t){return r.sink.error(r.scheduler.now(),t)}};Pe.prototype.event=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._event(e)}).catch(this._errorBound)};Pe.prototype.end=function t(n){this.queue=this.queue.then(this._endBound).catch(this._errorBound)};Pe.prototype.error=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._errorBound(e)}).catch(c)};Pe.prototype._event=function t(n){return n.then(this._eventBound)};function Be(t){this.sink=t;this.active=true}Be.prototype.event=function(t,n){if(!this.active){return}this.sink.event(t,n)};Be.prototype.end=function(t,n){if(!this.active){return}this.disable();this.sink.end(t,n)};Be.prototype.error=function(t,n){this.disable();this.sink.error(t,n)};Be.prototype.disable=function(){this.active=false;return this.sink};function Me(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}function Se(t,n){try{n.end(t)}catch(e){n.error(t,e)}}var Ve=function(t,n){return new Re(t,n)};var We=function(t){return new Ne(t)};var Ne=function t(n){this.value=n};Ne.prototype.run=function t(n,e){return e.asap(v(this.value,n))};var Re=function t(n,e){this.f=n;this.source=e};Re.prototype.run=function t(n,e){return new ze(this.f,this.source,n,e)};var ze=function t(n,e,r,i){this.f=n;this.sink=new Be(r);this.scheduler=i;this.disposable=e.run(this,i)};ze.prototype.event=function t(n,e){ | ||
Me(n,e,this.sink)};ze.prototype.end=function t(n){Se(n,this.sink)};ze.prototype.error=function t(n,e){var r=this.sink.disable();z(n,this.disposable,this.sink);this._startNext(n,e,r)};ze.prototype._startNext=function t(n,e,r){try{this.disposable=this._continue(this.f,n,e,r)}catch(t){r.error(n,t)}};ze.prototype._continue=function t(n,e,r,i){return Vt(e,n(r),i,this.scheduler)};ze.prototype.dispose=function t(){return this.disposable.dispose()};var De=u(X);var Le=s(U);var Fe=s(nt);var Ge=u(ot);var He=u(ct);var Je=s(zt);var Ke=s(Qt);var Qe=s(Ut);var Ue=s(Xt);var Xe=s(sn);var Ye=s(ln);var Ze=s(Wt);var $e=s(yn);var tr=s(cn);var nr=u(hn);var er=s(_n);var rr=u(nn);var ir=s(en);var or=u(xn);var sr=u(An);var ur=s(Cn);var cr=s(Dn);var hr=s(Fn);var ar=s(Kn);var pr=s(Qn);var fr=u(Un);var vr=s(ne);var lr=s(ie);var dr=s(he);var yr=s(ae);var _r=s(pe);var kr=s(ke);var wr=s(ge);var mr=s(Ie);var gr=s(Ve);var br=u(a);var xr=s(p);var Or=s(v);t.zipArrayValues=De;t.withArrayValues=Le;t.runEffects=Fe;t.loop=Ge;t.scan=He;t.startWith=Je;t.map=Ke;t.constant=Qe;t.tap=Ue;t.ap=Xe;t.chain=Ye;t.join=dn;t.continueWith=Ze;t.concatMap=$e;t.mergeConcurrently=tr;t.mergeMapConcurrently=nr;t.merge=er;t.mergeArray=kn;t.combine=rr;t.combineArray=ir;t.sample=or;t.zip=sr;t.zipArray=ur;t.filter=cr;t.skipRepeats=Ln;t.skipRepeatsWith=hr;t.take=ar;t.skip=pr;t.slice=fr;t.takeWhile=vr;t.skipWhile=lr;t.until=dr;t.since=yr;t.during=_r;t.delay=kr;t.throttle=wr;t.debounce=mr;t.recoverWith=gr;t.throwError=We;t.propagateTask=br;t.propagateEventTask=xr;t.propagateErrorTask=Or;t.propagateEndTask=f;t.now=g;t.empty=b;t.never=D;t.periodic=G;t.newStream=J;t.switchLatest=Wn;t.fromPromise=Ce;t.awaitPromises=Ae;Object.defineProperty(t,"__esModule",{value:true})}); |
{ | ||
"name": "@most/core", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "Reactive programming with lean, functions-only, curried, tree-shakeable API", | ||
@@ -49,5 +49,5 @@ "typings": "type-definitions/most.d.ts", | ||
"eslint": "^3.15.0", | ||
"flow-bin": "^0.43.1", | ||
"mocha": "^3.2.0", | ||
"rollup": "^0.41.4", | ||
"flow-bin": "^0.47.0", | ||
"mocha": "^3.4.2", | ||
"rollup": "^0.43.0", | ||
"rollup-plugin-buble": "^0.15.0", | ||
@@ -59,7 +59,7 @@ "rollup-plugin-node-resolve": "^2.0.0", | ||
"dependencies": { | ||
"@most/disposable": "^0.8.0", | ||
"@most/prelude": "^1.5.2", | ||
"@most/scheduler": "^0.8.0", | ||
"@most/types": "^0.8.0" | ||
"@most/disposable": "^0.9.0", | ||
"@most/prelude": "^1.5.3", | ||
"@most/scheduler": "^0.9.0", | ||
"@most/types": "^0.9.0" | ||
} | ||
} |
@@ -5,3 +5,2 @@ export * from './runEffects'; | ||
export * from './combinator/applicative'; | ||
export * from './combinator/build'; | ||
export * from './combinator/chain'; | ||
@@ -22,2 +21,3 @@ export * from './combinator/combine'; | ||
export * from './combinator/slice'; | ||
export * from './combinator/startWith'; | ||
export * from './combinator/switch'; | ||
@@ -29,7 +29,7 @@ export * from './combinator/timeslice'; | ||
export * from './source/core'; | ||
export * from './source/never'; | ||
export * from './source/empty'; | ||
export * from './source/now'; | ||
export * from './source/at'; | ||
export * from './source/newStream'; | ||
export * from './source/periodic'; | ||
export * from './source/generate'; | ||
export * from './source/iterate'; | ||
export * from './source/unfold'; |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
0
560453
41
5041
+ Added@most/disposable@0.9.1(transitive)
+ Added@most/scheduler@0.9.1(transitive)
+ Added@most/types@0.9.1(transitive)
- Removed@most/disposable@0.8.0(transitive)
- Removed@most/scheduler@0.8.0(transitive)
- Removed@most/types@0.8.0(transitive)
Updated@most/disposable@^0.9.0
Updated@most/prelude@^1.5.3
Updated@most/scheduler@^0.9.0
Updated@most/types@^0.9.0