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