Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

baconjs

Package Overview
Dependencies
Maintainers
2
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baconjs - npm Package Compare versions

Comparing version 0.7.76 to 0.7.77

4

dist/Bacon.min.js

@@ -1,2 +0,2 @@

(function(){function t(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}return Array.from(t)}var n,r,e,u,i,o,s,c,a,f,h,p,l,d,v,y,b,m,g,w,E,D,S,A,O,M,_,k,I,W,P,T,x,V,H,B,F,C,q,L,U,N,z,j,R,$,Q,Z,X,G,J,K,Y,tt,nt,rt,et,ut,it,ot,st,ct,at,ft,ht={}.hasOwnProperty,pt=function(t,n){function r(){this.constructor=t}for(var e in n)ht.call(n,e)&&(t[e]=n[e]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},lt=[].slice,dt=function(t,n){return function(){return t.apply(n,arguments)}};n={toString:function(){return"Bacon"}},n.version="0.7.76",p=("undefined"!=typeof global&&null!==global?global:this).Error,J=function(){},z=function(t,n){return n},F=function(t,n){return t},M=function(t){return t.slice(0)},L=function(t){return t instanceof Array},N=function(t){return t instanceof y},D={indexOf:Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n===i)return r;return-1},indexWhere:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n(i))return r;return-1},head:function(t){return t[0]},always:function(t){return function(){return t}},negate:function(t){return function(n){return!t(n)}},empty:function(t){return 0===t.length},tail:function(t){return t.slice(1,t.length)},filter:function(t,n){var r,e,u,i;for(r=[],e=0,u=n.length;u>e;e++)i=n[e],t(i)&&r.push(i);return r},map:function(t,n){var r,e,u,i;for(u=[],r=0,e=n.length;e>r;r++)i=n[r],u.push(t(i));return u},each:function(t,n){var r,e;for(r in t)ht.call(t,r)&&(e=t[r],n(r,e));return void 0},toArray:function(t){return L(t)?t:[t]},contains:function(t,n){return-1!==D.indexOf(t,n)},id:function(t){return t},last:function(t){return t[t.length-1]},all:function(t,n){var r,e,u;for(null==n&&(n=D.id),r=0,e=t.length;e>r;r++)if(u=t[r],!n(u))return!1;return!0},any:function(t,n){var r,e,u;for(null==n&&(n=D.id),r=0,e=t.length;e>r;r++)if(u=t[r],n(u))return!0;return!1},without:function(t,n){return D.filter(function(n){return n!==t},n)},remove:function(t,n){var r;return r=D.indexOf(n,t),r>=0?n.splice(r,1):void 0},fold:function(t,n,r){var e,u,i;for(e=0,u=t.length;u>e;e++)i=t[e],n=r(n,i);return n},flatMap:function(t,n){return D.fold(n,[],function(n,r){return n.concat(t(r))})},cached:function(t){var n;return n=v,function(){return n===v&&(n=t(),t=void 0),n}},isFunction:function(t){return"function"==typeof t},toString:function(t){var n,r,e,u;try{return Y++,null==t?"undefined":D.isFunction(t)?"function":L(t)?Y>5?"[..]":"["+D.map(D.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?Y>5?"{..}":(r=function(){var r;r=[];for(e in t)ht.call(t,e)&&(u=function(){try{return t[e]}catch(r){return n=r}}(),r.push(D.toString(e)+":"+D.toString(u)));return r}(),"{"+r+"}"):t}finally{Y--}}},Y=0,n._=D,E=n.UpdateBarrier=function(){var t,r,e,u,i,o,s,c,a,f,h,p,l,d;return f=void 0,h=[],p={},r=[],e=0,t=function(t){return f?r.push(t):t()},l=function(t,n){var r;return f?(r=p[t.id],null==r?(r=p[t.id]=[n],h.push(t)):r.push(n)):n()},i=function(){for(;h.length>0;)s(0);return void 0},s=function(t){var n,r,e,u,i,s;for(u=h[t],i=u.id,s=p[i],h.splice(t,1),delete p[i],o(u),r=0,e=s.length;e>r;r++)(n=s[r])();return void 0},o=function(t){var n,r,e,u,i;for(r=t.internalDeps(),u=0,i=r.length;i>u;u++)n=r[u],o(n),p[n.id]&&(e=D.indexOf(h,n),s(e));return void 0},a=function(t,n,u,o){var s,c;if(f)return u.apply(n,o);f=t;try{c=u.apply(n,o),i()}finally{for(f=void 0;e<r.length;)s=r[e],e++,s();e=0,r=[]}return c},u=function(){return f?f.id:void 0},d=function(r,e){var u,i,o,s;return s=!1,i=!1,u=function(){return i=!0},o=function(){return s=!0,u()},u=r.dispatcher.subscribe(function(r){return t(function(){var t;return s||(t=e(r),t!==n.noMore)?void 0:o()})}),i&&u(),o},c=function(){return h.length>0},{whenDoneWith:l,hasWaiters:c,inTransaction:a,currentEventId:u,wrappedSubscribe:d,afterTransaction:t}}(),w=function(){function t(t,n,r){this.obs=t,this.sync=n,this.lazy=null!=r?r:!1,this.queue=[]}return t.prototype.subscribe=function(t){return this.obs.dispatcher.subscribe(t)},t.prototype.toString=function(){return this.obs.toString()},t.prototype.markEnded=function(){return this.ended=!0},t.prototype.consume=function(){return this.lazy?{value:D.always(this.queue[0])}:this.queue[0]},t.prototype.push=function(t){return this.queue=[t]},t.prototype.mayHave=function(){return!0},t.prototype.hasAtLeast=function(){return this.queue.length},t.prototype.flatten=!0,t}(),i=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return pt(n,t),n.prototype.consume=function(){return this.queue.shift()},n.prototype.push=function(t){return this.queue.push(t)},n.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},n.prototype.hasAtLeast=function(t){return this.queue.length>=t},n.prototype.flatten=!1,n}(w),r=function(t){function n(t){n.__super__.constructor.call(this,t,!0)}return pt(n,t),n.prototype.consume=function(){var t;return t=this.queue,this.queue=[],{value:function(){return t}}},n.prototype.push=function(t){return this.queue.push(t.value())},n.prototype.hasAtLeast=function(){return!0},n}(w),w.isTrigger=function(t){return t instanceof w?t.sync:t instanceof h},w.fromObservable=function(t){return t instanceof w?t:t instanceof b?new w(t,!1):new i(t,!0)},o=function(){function t(t,n,r){this.context=t,this.method=n,this.args=r}return t.prototype.deps=function(){return this.cached||(this.cached=V([this.context].concat(this.args)))},t.prototype.toString=function(){return D.toString(this.context)+"."+D.toString(this.method)+"("+D.map(D.toString,this.args)+")"},t}(),W=function(){var t,n,r;return n=arguments[0],r=arguments[1],t=3<=arguments.length?lt.call(arguments,2):[],(n||r)instanceof o?n||r:new o(n,r,t)},at=function(t,n){return n.desc=t,n},V=function(t){return L(t)?D.flatMap(V,t):N(t)?[t]:t instanceof w?[t.obs]:[]},n.Desc=o,n.Desc.empty=new n.Desc("","",[]),ft=function(t){return function(){var n,r,e,u;return e=arguments[0],n=2<=arguments.length?lt.call(arguments,1):[],"object"==typeof e&&n.length&&(r=e,u=n[0],e=function(){return r[u].apply(r,arguments)},n=n.slice(1)),t.apply(null,[e].concat(lt.call(n)))}},$=function(t){return t=Array.prototype.slice.call(t),Q.apply(null,t)},K=function(t,n){return function(){var r;return r=1<=arguments.length?lt.call(arguments,0):[],t.apply(null,n.concat(r))}},st=function(t){return function(n){return function(r){var e;return null==r?void 0:(e=r[n],D.isFunction(e)?e.apply(r,t):e)}}},ut=function(t,n){var r,e;return e=t.slice(1).split("."),r=D.map(st(n),e),function(n){var e,u;for(e=0,u=r.length;u>e;e++)t=r[e],n=t(n);return n}},U=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},Q=ft(function(){var t,n;return n=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],D.isFunction(n)?t.length?K(n,t):n:U(n)?ut(n,t):D.always(n)}),R=function(t,n){return Q.apply(null,[t].concat(lt.call(n)))},I=function(t,n,r,e){var u;return n instanceof b?(u=n.sampledBy(t,function(t,n){return[t,n]}),e.call(u,function(t){var n,r;return n=t[0],r=t[1],n}).map(function(t){var n,r;return n=t[0],r=t[1]})):(n=R(n,r),e.call(t,n))},rt=function(t){var n;if(D.isFunction(t))return t;if(U(t))return n=it(t),function(t,r){return t[n](r)};throw new p("not a function or a field key: "+t)},it=function(t){return t.slice(1)},g=function(){function t(t){this.value=t}return t.prototype.getOrElse=function(){return this.value},t.prototype.get=function(){return this.value},t.prototype.filter=function(n){return n(this.value)?new t(this.value):v},t.prototype.map=function(n){return new t(n(this.value))},t.prototype.forEach=function(t){return t(this.value)},t.prototype.isDefined=!0,t.prototype.toArray=function(){return[this.value]},t.prototype.inspect=function(){return"Some("+this.value+")"},t.prototype.toString=function(){return this.inspect()},t}(),v={getOrElse:function(t){return t},filter:function(){return v},map:function(){return v},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}},ot=function(t){return t instanceof g||t===v?t:new g(t)},n.noMore=["<no-more>"],n.more=["<more>"],T=0,f=function(){function t(){this.id=++T}return t.prototype.isEvent=function(){return!0},t.prototype.isEnd=function(){return!1},t.prototype.isInitial=function(){return!1},t.prototype.isNext=function(){return!1},t.prototype.isError=function(){return!1},t.prototype.hasValue=function(){return!1},t.prototype.filter=function(){return!0},t.prototype.inspect=function(){return this.toString()},t.prototype.log=function(){return this.toString()},t}(),d=function(t){function n(t,r){return this instanceof n?(n.__super__.constructor.call(this),void(!r&&D.isFunction(t)||t instanceof n?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t))):new n(t,r)}return pt(n,t),n.prototype.isNext=function(){return!0},n.prototype.hasValue=function(){return!0},n.prototype.value=function(){return this.valueF instanceof n?(this.valueInternal=this.valueF.value(),this.valueF=void 0):this.valueF&&(this.valueInternal=this.valueF(),this.valueF=void 0),this.valueInternal},n.prototype.fmap=function(t){var n,r;return this.valueInternal?(r=this.valueInternal,this.apply(function(){return t(r)})):(n=this,this.apply(function(){return t(n.value())}))},n.prototype.apply=function(t){return new n(t)},n.prototype.filter=function(t){return t(this.value())},n.prototype.toString=function(){return D.toString(this.value())},n.prototype.log=function(){return this.value()},n}(f),l=function(t){function n(t,r){return this instanceof n?void n.__super__.constructor.call(this,t,r):new n(t,r)}return pt(n,t),n.prototype.isInitial=function(){return!0},n.prototype.isNext=function(){return!1},n.prototype.apply=function(t){return new n(t)},n.prototype.toNext=function(){return new d(this)},n}(d),c=function(t){function n(){return this instanceof n?void 0:new n}return pt(n,t),n.prototype.isEnd=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<end>"},n}(f),a=function(t){function n(t){return this instanceof n?void(this.error=t):new n(t)}return pt(n,t),n.prototype.isError=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<error> "+D.toString(this.error)},n}(f),n.Event=f,n.Initial=l,n.Next=d,n.End=c,n.Error=a,q=function(t){return new l(t,!0)},G=function(t){return new d(t,!0)},P=function(){return new c},et=function(t){return t instanceof f?t:G(t)},C=0,tt=function(){},y=function(){function t(t){this.desc=t,this.id=++C,this.initialDesc=this.desc}return t.prototype.subscribe=function(t){return E.wrappedSubscribe(this,t)},t.prototype.subscribeInternal=function(t){return this.dispatcher.subscribe(t)},t.prototype.onValue=function(){var t;return t=$(arguments),this.subscribe(function(n){return n.hasValue()?t(n.value()):void 0})},t.prototype.onValues=function(t){return this.onValue(function(n){return t.apply(null,n)})},t.prototype.onError=function(){var t;return t=$(arguments),this.subscribe(function(n){return n.isError()?t(n.error):void 0})},t.prototype.onEnd=function(){var t;return t=$(arguments),this.subscribe(function(n){return n.isEnd()?t():void 0})},t.prototype.name=function(t){return this._name=t,this},t.prototype.withDescription=function(){return this.desc=W.apply(null,arguments),this},t.prototype.toString=function(){return this._name?this._name:this.desc.toString()},t.prototype.internalDeps=function(){return this.initialDesc.deps()},t}(),y.prototype.assign=y.prototype.onValue,y.prototype.forEach=y.prototype.onValue,y.prototype.inspect=y.prototype.toString,n.Observable=y,u=function(){function t(t){var n,r,e;for(null==t&&(t=[]),this.unsubscribe=dt(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[],n=0,r=t.length;r>n;n++)e=t[n],this.add(e)}return t.prototype.add=function(t){var n,r,e;if(!this.unsubscribed)return n=!1,r=J,this.starting.push(t),e=function(e){return function(){return e.unsubscribed?void 0:(n=!0,e.remove(r),D.remove(t,e.starting))}}(this),r=t(this.unsubscribe,e),this.unsubscribed||n?r():this.subscriptions.push(r),D.remove(t,this.starting),r},t.prototype.remove=function(t){return this.unsubscribed?void 0:void 0!==D.remove(t,this.subscriptions)?t():void 0},t.prototype.unsubscribe=function(){var t,n,r,e;if(!this.unsubscribed){for(this.unsubscribed=!0,r=this.subscriptions,t=0,n=r.length;n>t;t++)(e=r[t])();return this.subscriptions=[],this.starting=[]}},t.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},t.prototype.empty=function(){return 0===this.count()},t}(),n.CompositeUnsubscribe=u,s=function(){function t(t,n){this._subscribe=t,this._handleEvent=n,this.subscribe=dt(this.subscribe,this),this.handleEvent=dt(this.handleEvent,this),this.subscriptions=[],this.queue=[]}return t.prototype.pushing=!1,t.prototype.ended=!1,t.prototype.prevError=void 0,t.prototype.unsubSrc=void 0,t.prototype.hasSubscribers=function(){return this.subscriptions.length>0},t.prototype.removeSub=function(t){return this.subscriptions=D.without(t,this.subscriptions)},t.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),E.inTransaction(t,this,this.pushIt,[t])},t.prototype.pushToSubscriptions=function(t){var r,e,u,i,o,s;try{for(s=this.subscriptions,e=0,u=s.length;u>e;e++)o=s[e],i=o.sink(t),(i===n.noMore||t.isEnd())&&this.removeSub(o);return!0}catch(c){throw r=c,this.pushing=!1,this.queue=[],r}},t.prototype.pushIt=function(t){if(this.pushing)return this.queue.push(t),n.more;if(t!==this.prevError){for(t.isError()&&(this.prevError=t),this.pushing=!0,this.pushToSubscriptions(t),this.pushing=!1;this.queue.length;)t=this.queue.shift(),this.push(t);return this.hasSubscribers()?n.more:(this.unsubscribeFromSource(),n.noMore)}},t.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},t.prototype.unsubscribeFromSource=function(){return this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},t.prototype.subscribe=function(t){var n;return this.ended?(t(P()),J):(n={sink:t},this.subscriptions.push(n),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(t){return function(){return t.removeSub(n),t.hasSubscribers()?void 0:t.unsubscribeFromSource()}}(this))},t}(),n.Dispatcher=s,h=function(t){function r(t,n,e){return this instanceof r?(D.isFunction(t)&&(e=n,n=t,t=o.empty),r.__super__.constructor.call(this,t),this.dispatcher=new s(n,e),void tt(this)):new r(t,n,e)}return pt(r,t),r.prototype.toProperty=function(t){var r,e;return e=0===arguments.length?v:ot(function(){return t}),r=this.dispatcher,new b(new n.Desc(this,"toProperty",[t]),function(t){var u,i,o,s;return u=!1,s=J,i=n.more,o=function(){return u?void 0:e.forEach(function(r){return u=!0,i=t(new l(r)),i===n.noMore?(s(),s=J):void 0})},s=r.subscribe(function(r){return r.hasValue()?u&&r.isInitial()?n.more:(r.isInitial()||o(),u=!0,e=new g(r),t(r)):(r.isEnd()&&(i=o()),i!==n.noMore?t(r):void 0)}),o(),s})},r.prototype.toEventStream=function(){return this},r.prototype.withHandler=function(t){return new r(new n.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)},r}(y),n.EventStream=h,n.never=function(){return new h(W(n,"never"),function(t){return t(P()),J})},n.when=function(){var t,r,e,u,i,o,s,c,a,f,p,l,d,v,y,b,m,g,S,A;if(0===arguments.length)return n.never();for(s=arguments.length,A="when: expecting arguments in the form (Observable+,function)+",g=[],d=[],r=0,v=[];s>r;){for(v[r]=arguments[r],v[r+1]=arguments[r+1],l=D.toArray(arguments[r]),t=_(arguments[r+1]),p={f:t,ixs:[]},S=!1,i=0,c=l.length;c>i;i++){for(m=l[i],e=D.indexOf(g,m),S||(S=w.isTrigger(m)),0>e&&(g.push(m),e=g.length-1),y=p.ixs,o=0,a=y.length;a>o;o++)u=y[o],u.index===e&&u.count++;p.ixs.push({index:e,count:1})}l.length>0&&d.push(p),r+=2}return g.length?(g=D.map(w.fromObservable,g),f=D.any(g,function(t){return t.flatten})&&k(D.map(function(t){return t.obs},g)),b=new h(new n.Desc(n,"when",v),function(t){var e,u,i,o,s,c,a;return a=[],i=!1,o=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!g[r.index].hasAtLeast(r.count))return!1;return!0},u=function(t){return!t.sync||t.ended},e=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!g[r.index].mayHave(r.count))return!0},s=function(t){return!t.source.flatten},c=function(c){return function(h){var p,l,v;return l=function(){return E.whenDoneWith(b,p)},v=function(){var e,u,i,c,f,h;if(!(a.length>0))return n.more;for(f=n.more,h=a.pop(),u=0,i=d.length;i>u;u++)if(c=d[u],o(c))return e=function(){var t,n,e,u;for(e=c.ixs,u=[],n=0,t=e.length;t>n;n++)r=e[n],u.push(g[r.index].consume());return u}(),f=t(h.e.apply(function(){var t,n;return n=function(){var n,r,u;for(u=[],r=0,n=e.length;n>r;r++)t=e[r],u.push(t.value());return u}(),c.f.apply(c,n)})),a.length&&(a=D.filter(s,a)),f===n.noMore?f:v()},p=function(){var r;return r=v(),i&&(D.all(g,u)||D.all(d,e))&&(r=n.noMore,t(P())),r===n.noMore&&h(),r},c.subscribe(function(r){var e;return r.isEnd()?(i=!0,c.markEnded(),l()):r.isError()?e=t(r):(c.push(r),c.sync&&(a.push({source:c,e:r}),f||E.hasWaiters()?l():p())),e===n.noMore&&h(),e||n.more})}},new n.CompositeUnsubscribe(function(){var t,n,r;for(r=[],t=0,n=g.length;n>t;t++)m=g[t],r.push(c(m));return r}()).unsubscribe})):n.never()},k=function(t,n){var r;return null==n&&(n=[]),r=function(t){var e;return D.contains(n,t)?!0:(e=t.internalDeps(),e.length?(n.push(t),D.any(e,r)):(n.push(t),!1))},D.any(t,r)},_=function(t){return D.isFunction(t)?t:D.always(t)},n.groupSimultaneous=function(){var t,e,u;return u=1<=arguments.length?lt.call(arguments,0):[],1===u.length&&L(u[0])&&(u=u[0]),e=function(){var n,e,i;for(i=[],n=0,e=u.length;e>n;n++)t=u[n],i.push(new r(t));return i}(),at(new n.Desc(n,"groupSimultaneous",u),n.when(e,function(){var t;return t=1<=arguments.length?lt.call(arguments,0):[]}))},m=function(t){function r(t,n,e){this.property=t,this.subscribe=dt(this.subscribe,this),r.__super__.constructor.call(this,n,e),this.current=v,this.currentValueRootId=void 0,this.propertyEnded=!1}return pt(r,t),r.prototype.push=function(t){return t.isEnd()&&(this.propertyEnded=!0),t.hasValue()&&(this.current=new g(t),this.currentValueRootId=E.currentEventId()),r.__super__.push.call(this,t)},r.prototype.maybeSubSource=function(t,r){return r===n.noMore?J:this.propertyEnded?(t(P()),J):s.prototype.subscribe.call(this,t)},r.prototype.subscribe=function(t){var r,e,u,i;return e=!1,u=n.more,this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)?(r=E.currentEventId(),i=this.currentValueRootId,!this.propertyEnded&&i&&r&&r!==i?(E.whenDoneWith(this.property,function(n){return function(){return n.currentValueRootId===i?t(q(n.current.get().value())):void 0}}(this)),this.maybeSubSource(t,u)):(E.inTransaction(void 0,this,function(){return u=t(q(this.current.get().value()))},[]),this.maybeSubSource(t,u))):this.maybeSubSource(t,u)},r}(s),b=function(t){function r(t,n,e){r.__super__.constructor.call(this,t),this.dispatcher=new m(this,n,e),tt(this)}return pt(r,t),r.prototype.changes=function(){return new h(new n.Desc(this,"changes",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})}}(this))},r.prototype.withHandler=function(t){return new r(new n.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)},r.prototype.toProperty=function(){return this},r.prototype.toEventStream=function(){return new h(new n.Desc(this,"toEventStream",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})}}(this))},r}(y),n.Property=b,n.constant=function(t){return new b(new n.Desc(n,"constant",[t]),function(n){return n(q(t)),n(P()),J})},n.fromBinder=function(t,r){return null==r&&(r=D.id),new h(new n.Desc(n,"fromBinder",[t,r]),function(e){var u,i,o,s;return s=!1,u=!1,i=function(){return s?void 0:"undefined"!=typeof o&&null!==o?(o(),s=!0):u=!0},o=t(function(){var t,u,o,s,c,a;for(t=1<=arguments.length?lt.call(arguments,0):[],a=r.apply(this,t),L(a)&&D.last(a)instanceof f||(a=[a]),c=n.more,o=0,s=a.length;s>o;o++)if(u=a[o],c=e(u=et(u)),c===n.noMore||u.isEnd())return i(),c;return c}),u&&i(),i})},n.Observable.prototype.map=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],I(this,r,t,function(t){return at(new n.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})},A=function(t){return L(t[0])?t[0]:Array.prototype.slice.call(t)},O=function(t){return D.isFunction(t[0])?[A(Array.prototype.slice.call(t,1)),t[0]]:[A(Array.prototype.slice.call(t,0,t.length-1)),D.last(t)]},n.combineAsArray=function(){var t,r,e,u,i,o,s;for(s=A(arguments),t=r=0,e=s.length;e>r;t=++r)o=s[t],N(o)||(s[t]=n.constant(o));return s.length?(i=function(){var t,n,r;for(r=[],t=0,n=s.length;n>t;t++)u=s[t],r.push(new w(u,!0));return r}(),at(new n.Desc(n,"combineAsArray",s),n.when(i,function(){var t;return t=1<=arguments.length?lt.call(arguments,0):[]}).toProperty())):n.constant([])},n.onValues=function(){var t,r,e;return e=2<=arguments.length?lt.call(arguments,0,r=arguments.length-1):(r=0,[]),t=arguments[r++],n.combineAsArray(e).onValues(t)},n.combineWith=function(){var t,r,e;return r=O(arguments),e=r[0],t=r[1],at(new n.Desc(n,"combineWith",[t].concat(lt.call(e))),n.combineAsArray(e).map(function(n){return t.apply(null,n)}))},n.Observable.prototype.combine=function(t,r){var e;return e=rt(r),at(new n.Desc(this,"combine",[t,r]),n.combineAsArray(this,t).map(function(t){return e(t[0],t[1])}))},n.Observable.prototype.withStateMachine=function(t,r){var e;return e=t,at(new n.Desc(this,"withStateMachine",[t,r]),this.withHandler(function(t){var u,i,o,s,c,a,f;for(u=r(e,t),s=u[0],a=u[1],e=s,f=n.more,i=0,o=a.length;o>i;i++)if(c=a[i],f=this.push(c),f===n.noMore)return f;return f}))},n.Observable.prototype.skipDuplicates=function(t){return null==t&&(t=function(t,n){return t===n}),at(new n.Desc(this,"skipDuplicates",[]),this.withStateMachine(v,function(n,r){return r.hasValue()?r.isInitial()||n===v||!t(n.get(),r.value())?[new g(r.value()),[r]]:[n,[]]:[n,[r]]}))},n.Observable.prototype.awaiting=function(t){return at(new n.Desc(this,"awaiting",[t]),n.groupSimultaneous(this,t).map(function(t){var n,r;return n=t[0],r=t[1],0===r.length}).toProperty(!1).skipDuplicates())},n.Observable.prototype.not=function(){return at(new n.Desc(this,"not",[]),this.map(function(t){return!t}))},n.Property.prototype.and=function(t){return at(new n.Desc(this,"and",[t]),this.combine(t,function(t,n){return t&&n}))},n.Property.prototype.or=function(t){return at(new n.Desc(this,"or",[t]),this.combine(t,function(t,n){return t||n}))},n.scheduler={setTimeout:function(t,n){return setTimeout(t,n)},setInterval:function(t,n){return setInterval(t,n)},clearInterval:function(t){return clearInterval(t)},clearTimeout:function(t){return clearTimeout(t)},now:function(){return(new Date).getTime()}},n.EventStream.prototype.bufferWithTime=function(t){return at(new n.Desc(this,"bufferWithTime",[t]),this.bufferWithTimeOrCount(t,Number.MAX_VALUE))},n.EventStream.prototype.bufferWithCount=function(t){return at(new n.Desc(this,"bufferWithCount",[t]),this.bufferWithTimeOrCount(void 0,t))},n.EventStream.prototype.bufferWithTimeOrCount=function(t,r){var e;return e=function(n){return n.values.length===r?n.flush():void 0!==t?n.schedule():void 0},at(new n.Desc(this,"bufferWithTimeOrCount",[t,r]),this.buffer(t,e,e))},n.EventStream.prototype.buffer=function(t,r,e){var u,i,o;return null==r&&(r=J),null==e&&(e=J),u={scheduled:null,end:void 0,values:[],flush:function(){var t,r;if(this.scheduled&&(n.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){if(r=this.values,this.values=[],t=this.push(G(r)),null!=this.end)return this.push(this.end);if(t!==n.noMore)return e(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){return this.scheduled?void 0:this.scheduled=t(function(t){return function(){return t.flush()}}(this))}},o=n.more,D.isFunction(t)||(i=t,t=function(t){return n.scheduler.setTimeout(t,i)}),at(new n.Desc(this,"buffer",[]),this.withHandler(function(t){return u.push=function(t){return function(n){return t.push(n)}}(this),t.isError()?o=this.push(t):t.isEnd()?(u.end=t,u.scheduled||u.flush()):(u.values.push(t.value()),r(u)),o}))},n.Observable.prototype.filter=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],I(this,r,t,function(t){return at(new n.Desc(this,"filter",[t]),this.withHandler(function(r){return r.filter(t)?this.push(r):n.more}))})},n.once=function(t){return new h(new o(n,"once",[t]),function(n){return n(et(t)),n(P()),J})},n.EventStream.prototype.concat=function(t){var r;return r=this,new h(new n.Desc(r,"concat",[t]),function(n){var e,u;return u=J,e=r.dispatcher.subscribe(function(r){return r.isEnd()?u=t.dispatcher.subscribe(n):n(r)}),function(){return e(),u()}})},n.Observable.prototype.flatMap=function(){return B(this,X(arguments))},n.Observable.prototype.flatMapFirst=function(){return B(this,X(arguments),!0)},B=function(t,r,e,i){var o,s,c;return c=[t],o=[],s=new h(new n.Desc(t,"flatMap"+(e?"First":""),[r]),function(s){var c,a,f,h,p;return f=new u,h=[],p=function(t){var e;return e=Z(r(t.value())),o.push(e),f.add(function(t,r){return e.dispatcher.subscribe(function(u){var i;return u.isEnd()?(D.remove(e,o),a(),c(r),n.noMore):(u instanceof l&&(u=u.toNext()),i=s(u),i===n.noMore&&t(),i)})})},a=function(){var t;return t=h.shift(),t?p(t):void 0},c=function(t){return t(),f.empty()?s(P()):void 0},f.add(function(r,u){return t.dispatcher.subscribe(function(t){return t.isEnd()?c(u):t.isError()?s(t):e&&f.count()>1?n.more:f.unsubscribed?n.noMore:i&&f.count()>i?h.push(t):p(t)})}),f.unsubscribe}),s.internalDeps=function(){return o.length?c.concat(o):c},s},X=function(t){return 1===t.length&&N(t[0])?D.always(t[0]):$(t)},Z=function(t){return N(t)?t:n.once(t)},n.Observable.prototype.flatMapWithConcurrencyLimit=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],at(new n.Desc(this,"flatMapWithConcurrencyLimit",[r].concat(lt.call(t))),B(this,X(t),!1,r))},n.Observable.prototype.flatMapConcat=function(){return at(new n.Desc(this,"flatMapConcat",Array.prototype.slice.call(arguments,0)),this.flatMapWithConcurrencyLimit.apply(this,[1].concat(lt.call(arguments))))},n.later=function(t,r){return at(new n.Desc(n,"later",[t,r]),n.fromBinder(function(e){var u,i;return i=function(){return e([r,P()])},u=n.scheduler.setTimeout(i,t),function(){return n.scheduler.clearTimeout(u)}}))},n.Observable.prototype.bufferingThrottle=function(t){return at(new n.Desc(this,"bufferingThrottle",[t]),this.flatMapConcat(function(r){return n.once(r).concat(n.later(t).filter(!1))}))},n.Property.prototype.bufferingThrottle=function(){return n.Observable.prototype.bufferingThrottle.apply(this,arguments).toProperty()},e=function(t){function r(){return this.guardedSink=dt(this.guardedSink,this),this.subscribeAll=dt(this.subscribeAll,this),this.unsubAll=dt(this.unsubAll,this),this instanceof r?(this.sink=void 0,this.subscriptions=[],this.ended=!1,void r.__super__.constructor.call(this,new n.Desc(n,"Bus",[]),this.subscribeAll)):new r}return pt(r,t),r.prototype.unsubAll=function(){var t,n,r,e;for(r=this.subscriptions,t=0,n=r.length;n>t;t++)e=r[t],"function"==typeof e.unsub&&e.unsub();return void 0},r.prototype.subscribeAll=function(t){var n,r,e,u;if(this.ended)t(P());else for(this.sink=t,e=M(this.subscriptions),n=0,r=e.length;r>n;n++)u=e[n],this.subscribeInput(u);return this.unsubAll},r.prototype.guardedSink=function(t){return function(r){return function(e){return e.isEnd()?(r.unsubscribeInput(t),n.noMore):r.sink(e)}}(this)},r.prototype.subscribeInput=function(t){return t.unsub=t.input.dispatcher.subscribe(this.guardedSink(t.input))},r.prototype.unsubscribeInput=function(t){var n,r,e,u,i;for(u=this.subscriptions,n=r=0,e=u.length;e>r;n=++r)if(i=u[n],i.input===t)return"function"==typeof i.unsub&&i.unsub(),void this.subscriptions.splice(n,1)},r.prototype.plug=function(t){var n;if(!this.ended)return n={input:t},this.subscriptions.push(n),null!=this.sink&&this.subscribeInput(n),function(n){return function(){return n.unsubscribeInput(t)}}(this)},r.prototype.end=function(){return this.ended=!0,this.unsubAll(),"function"==typeof this.sink?this.sink(P()):void 0},r.prototype.push=function(t){return this.ended?void 0:"function"==typeof this.sink?this.sink(G(t)):void 0},r.prototype.error=function(t){return"function"==typeof this.sink?this.sink(new a(t)):void 0},r}(h),n.Bus=e,j=function(t,r){return ft(function(){var e,u,i;return u=arguments[0],e=2<=arguments.length?lt.call(arguments,1):[],i=K(r,[function(t,n){return u.apply(null,lt.call(t).concat([n]))}]),at(new n.Desc(n,t,[u].concat(lt.call(e))),n.combineAsArray(e).flatMap(i))})},n.fromCallback=j("fromCallback",function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],n.fromBinder(function(n){return R(r,t)(n),J},function(t){return[t,P()]})}),n.fromNodeCallback=j("fromNodeCallback",function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],n.fromBinder(function(n){return R(r,t)(n),J},function(t,n){return t?[new a(t),P()]:[n,P()]})}),n.combineTemplate=function(t){var r,e,u,i,o,s,c,a,f,h,p;return c=[],p=[],s=function(t){return t[t.length-1]},h=function(t,n,r){return s(t)[n]=r},r=function(t,n){return function(r,e){return h(r,t,e[n])}},o=function(t,n){return function(r){return h(r,t,n)}},a=function(t){return L(t)?[]:{}},f=function(t,n){return function(r){var e;return e=a(n),h(r,t,e),r.push(e)}},u=function(t,n){var e;return N(n)?(p.push(n),c.push(r(t,p.length-1))):n!==Object(n)||"function"==typeof n||n instanceof RegExp||n instanceof Date?c.push(o(t,n)):(e=function(t){return t.pop()},c.push(f(t,n)),i(n),c.push(e))},i=function(t){return D.each(t,u)},i(t),e=function(n){var r,e,u,i,o;for(o=a(t),r=[o],u=0,i=c.length;i>u;u++)(e=c[u])(r,n);return o},at(new n.Desc(n,"combineTemplate",[t]),n.combineAsArray(p).map(e))},S=function(t,r){var e;return e=new h(W(t,"justInitValue"),function(r){var u,i;return i=void 0,u=t.dispatcher.subscribe(function(t){return t.isEnd()||(i=t),n.noMore}),E.whenDoneWith(e,function(){return null!=i&&r(i),r(P())}),u}),e.concat(r).toProperty()},n.Observable.prototype.mapEnd=function(){var t;return t=$(arguments),at(new n.Desc(this,"mapEnd",[t]),this.withHandler(function(r){return r.isEnd()?(this.push(G(t(r))),this.push(P()),n.noMore):this.push(r)}))},n.Observable.prototype.skipErrors=function(){return at(new n.Desc(this,"skipErrors",[]),this.withHandler(function(t){return t.isError()?n.more:this.push(t)}))},n.EventStream.prototype.takeUntil=function(t){var r;return r={},at(new n.Desc(this,"takeUntil",[t]),n.groupSimultaneous(this.mapEnd(r),t.skipErrors()).withHandler(function(e){var u,i,o,s,c,a;if(e.hasValue()){if(s=e.value(),u=s[0],t=s[1],t.length)return this.push(P());for(c=n.more,i=0,o=u.length;o>i;i++)a=u[i],c=this.push(a===r?P():G(a));return c}return this.push(e)}))},n.Property.prototype.takeUntil=function(t){var r;return r=this.changes().takeUntil(t),at(new n.Desc(this,"takeUntil",[t]),S(this,r))},n.Observable.prototype.flatMapLatest=function(){var t,r;return t=X(arguments),r=this.toEventStream(),at(new n.Desc(this,"flatMapLatest",[t]),r.flatMap(function(n){return Z(t(n)).takeUntil(r)}))},n.Property.prototype.delayChanges=function(t,n){return at(t,S(this,n(this.changes())))},n.EventStream.prototype.delay=function(t){return at(new n.Desc(this,"delay",[t]),this.flatMap(function(r){return n.later(t,r)}))},n.Property.prototype.delay=function(t){return this.delayChanges(new n.Desc(this,"delay",[t]),function(n){return n.delay(t)})},n.EventStream.prototype.debounce=function(t){return at(new n.Desc(this,"debounce",[t]),this.flatMapLatest(function(r){return n.later(t,r)}))},n.Property.prototype.debounce=function(t){return this.delayChanges(new n.Desc(this,"debounce",[t]),function(n){
return n.debounce(t)})},n.EventStream.prototype.debounceImmediate=function(t){return at(new n.Desc(this,"debounceImmediate",[t]),this.flatMapFirst(function(r){return n.once(r).concat(n.later(t).filter(!1))}))},n.Observable.prototype.decode=function(t){return at(new n.Desc(this,"decode",[t]),this.combine(n.combineTemplate(t),function(t,n){return n[t]}))},n.Observable.prototype.scan=function(t,r){var e,u,i,o;return r=rt(r),e=ot(t),u=!1,o=function(t){return function(o){var s,c,a,f;return s=!1,f=J,c=n.more,a=function(){return s?void 0:e.forEach(function(t){return s=u=!0,c=o(new l(function(){return t})),c===n.noMore?(f(),f=J):void 0})},f=t.dispatcher.subscribe(function(t){var i,f;return t.hasValue()?u&&t.isInitial()?n.more:(t.isInitial()||a(),s=u=!0,f=e.getOrElse(void 0),i=r(f,t.value()),e=new g(i),o(t.apply(function(){return i}))):(t.isEnd()&&(c=a()),c!==n.noMore?o(t):void 0)}),E.whenDoneWith(i,a),f}}(this),i=new b(new n.Desc(this,"scan",[t,r]),o)},n.Observable.prototype.diff=function(t,r){return r=rt(r),at(new n.Desc(this,"diff",[t,r]),this.scan([t],function(t,n){return[n,r(t[0],n)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},n.Observable.prototype.doAction=function(){var t;return t=$(arguments),at(new n.Desc(this,"doAction",[t]),this.withHandler(function(n){return n.hasValue()&&t(n.value()),this.push(n)}))},n.Observable.prototype.doEnd=function(){var t;return t=$(arguments),at(new n.Desc(this,"doEnd",[t]),this.withHandler(function(n){return n.isEnd()&&t(),this.push(n)}))},n.Observable.prototype.doError=function(){var t;return t=$(arguments),at(new n.Desc(this,"doError",[t]),this.withHandler(function(n){return n.isError()&&t(n.error),this.push(n)}))},n.Observable.prototype.doLog=function(){var t;return t=1<=arguments.length?lt.call(arguments,0):[],at(new n.Desc(this,"doLog",t),this.withHandler(function(n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,lt.call(t).concat([n.log()])),this.push(n)}))},n.Observable.prototype.endOnError=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],null==r&&(r=!0),I(this,r,t,function(t){return at(new n.Desc(this,"endOnError",[]),this.withHandler(function(n){return n.isError()&&t(n.error)?(this.push(n),this.push(P())):this.push(n)}))})},y.prototype.errors=function(){return at(new n.Desc(this,"errors",[]),this.filter(function(){return!1}))},n.Observable.prototype.mapError=function(){var t;return t=$(arguments),at(new n.Desc(this,"mapError",[t]),this.withHandler(function(n){return this.push(n.isError()?G(t(n.error)):n)}))},n.Observable.prototype.flatMapError=function(t){return at(new n.Desc(this,"flatMapError",[t]),this.mapError(function(t){return new a(t)}).flatMap(function(r){return r instanceof a?t(r.error):n.once(r)}))},n.EventStream.prototype.sampledBy=function(t,r){return at(new n.Desc(this,"sampledBy",[t,r]),this.toProperty().sampledBy(t,r))},n.Property.prototype.sampledBy=function(t,r){var e,u,i,o,s;return null!=r?r=rt(r):(e=!0,r=function(t){return t.value()}),s=new w(this,!1,e),i=new w(t,!0,e),o=n.when([s,i],r),u=t instanceof b?o.toProperty():o,at(new n.Desc(this,"sampledBy",[t,r]),u)},n.Property.prototype.sample=function(t){return at(new n.Desc(this,"sample",[t]),this.sampledBy(n.interval(t,{})))},n.Observable.prototype.map=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],r instanceof b?r.sampledBy(this,F):I(this,r,t,function(t){return at(new n.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})},n.Observable.prototype.fold=function(t,r){return at(new n.Desc(this,"fold",[t,r]),this.scan(t,r).sampledBy(this.filter(!1).mapEnd().toProperty()))},y.prototype.reduce=y.prototype.fold,x=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],H=function(t){var n,r,e,u,i,o,s;for(r=0,u=x.length;u>r;r++)if(s=x[r],o=[t[s[0]],t[s[1]]],o[0]&&o[1])return o;for(e=0,i=x.length;i>e;e++)if(s=x[e],n=t[s[0]])return[n,function(){}];throw new a("No suitable event methods in "+t)},n.fromEventTarget=function(t,r,e){var u,i,o;return u=H(t),i=u[0],o=u[1],at(new n.Desc(n,"fromEvent",[t,r]),n.fromBinder(function(n){return i.call(t,r,n),function(){return o.call(t,r,n)}},e))},n.fromEvent=n.fromEventTarget,n.fromPoll=function(t,r){return at(new n.Desc(n,"fromPoll",[t,r]),n.fromBinder(function(r){var e;return e=n.scheduler.setInterval(r,t),function(){return n.scheduler.clearInterval(e)}},r))},ct=function(t){return[t,P()]},n.fromPromise=function(t,r,e){return null==e&&(e=ct),at(new n.Desc(n,"fromPromise",[t]),n.fromBinder(function(n){var e;return null!=(e=t.then(n,function(t){return n(new a(t))}))&&"function"==typeof e.done&&e.done(),function(){return r&&"function"==typeof t.abort?t.abort():void 0}},e))},n.spy=function(t){return nt.push(t)},nt=[],tt=function(t){var n,r,e;if(nt.length&&!tt.running)try{for(tt.running=!0,n=0,r=nt.length;r>n;n++)(e=nt[n])(t)}finally{delete tt.running}return void 0},n.Observable.prototype.take=function(t){return 0>=t?n.never():at(new n.Desc(this,"take",[t]),this.withHandler(function(r){return r.hasValue()?(t--,t>0?this.push(r):(0===t&&this.push(r),this.push(P()),n.noMore)):this.push(r)}))},n.Observable.prototype.first=function(){return at(new n.Desc(this,"first",[]),this.take(1))},n.Observable.prototype.groupBy=function(t,r){null==r&&(r=n._.id);var e={},u=this;return u.filter(function(n){return!e[t(n)]}).map(function(i){var o=t(i),s=u.filter(function(n){return t(n)===o}),c=n.once(i).concat(s),a=r(c,i).withHandler(function(t){return this.push(t),t.isEnd()?delete e[o]:void 0});return e[o]=a,a})},n.fromArray=function(t){if(t.length){var r=0;return new h(new n.Desc(n,"fromArray",[t]),function(e){var u=!1,i=n.more,o=!1,s=!1,c=function(){if(s=!0,!o){for(o=!0;s;)if(s=!1,i!==n.noMore&&!u){var a=t[r++];i=e(et(a)),i!==n.noMore&&(r===t.length?e(P()):E.afterTransaction(c))}return o=!1}};return c(),function(){return u=!0}})}return at(new n.Desc(n,"fromArray",t),n.never())},n.EventStream.prototype.holdWhen=function(t){var r=!1,e=[],i=this;return new h(new n.Desc(this,"holdWhen",[t]),function(n){var o=new u,s=!1,c=function(t){return"function"==typeof t&&t(),o.empty()&&s?n(P()):void 0};return o.add(function(u,i){return t.subscribeInternal(function(t){if(!t.hasValue())return t.isEnd()?c(i):n(t);if(r=t.value(),!r){var u=e;return e=[],function(){for(var t,r=[],e=0;e<u.length;e++)t=u[e],r.push(n(G(t)));return r}()}})}),o.add(function(t,u){return i.subscribeInternal(function(t){return r&&t.hasValue()?e.push(t.value()):t.isEnd()&&e.length?c(u):n(t)})}),s=!0,c(),o.unsubscribe})},n.interval=function(t,r){return("undefined"==typeof r||null===r)&&(r={}),at(new n.Desc(n,"interval",[t,r]),n.fromPoll(t,function(){return G(r)}))},n.$={},n.$.asEventStream=function(t,r,e){var u=this;return D.isFunction(r)&&(e=r,r=void 0),at(new n.Desc(this.selector||this,"asEventStream",[t]),n.fromBinder(function(n){return u.on(t,r,n),function(){return u.off(t,r,n)}}),e)},"undefined"!=typeof jQuery&&jQuery&&(jQuery.fn.asEventStream=n.$.asEventStream),"undefined"!=typeof Zepto&&Zepto&&(Zepto.fn.asEventStream=n.$.asEventStream),n.Observable.prototype.last=function(){var t;return at(new n.Desc(this,"last",[]),this.withHandler(function(r){return r.isEnd()?(t&&this.push(t),this.push(P()),n.noMore):void(t=r)}))},n.Observable.prototype.log=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return this.subscribe(function(t){"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()]))}),this},n.EventStream.prototype.merge=function(t){var r=this;return at(new n.Desc(r,"merge",[t]),n.mergeAll(this,t))},n.mergeAll=function(){var t=A(arguments);return t.length?new h(new n.Desc(n,"mergeAll",t),function(r){var e=0,u=function(u){return function(i){return u.dispatcher.subscribe(function(u){if(u.isEnd())return e++,e===t.length?r(P()):n.more;var o=r(u);return o===n.noMore&&i(),o})}},i=D.map(u,t);return new n.CompositeUnsubscribe(i).unsubscribe}):n.never()},n.repeatedly=function(t,r){var e=0;return at(new n.Desc(n,"repeatedly",[t,r]),n.fromPoll(t,function(){return r[e++%r.length]}))},n.repeat=function(t){var r=0;return n.fromBinder(function(e){function u(t){return t.isEnd()?o?i():o=!0:s=e(t)}function i(){var i;for(o=!0;o&&s!==n.noMore;)i=t(r++),o=!1,i?c=i.subscribeInternal(u):e(P());return o=!0}var o=!1,s=n.more,c=function(){};return i(),function(){return c()}})},n.retry=function(t){if(!D.isFunction(t.source))throw new p("'source' option has to be a function");var r=t.source,e=t.retries||0,u=t.maxRetries||e,i=t.delay||function(){return 0},o=t.isRetryable||function(){return!0},s=!1,c=null;return at(new n.Desc(n,"retry",[t]),n.repeat(function(){function t(){return r().endOnError().withHandler(function(t){return t.isError()?(c=t,o(c.error)&&e>0?void 0:(s=!0,this.push(t))):(t.hasValue()&&(c=null,s=!0),this.push(t))})}if(s)return null;if(c){var a={error:c.error,retriesDone:u-e},f=n.later(i(a)).filter(!1);return e-=1,f.concat(n.once().flatMap(t))}return t()}))},n.sequentially=function(t,r){var e=0;return at(new n.Desc(n,"sequentially",[t,r]),n.fromPoll(t,function(){var t=r[e++];return e<r.length?t:e===r.length?[t,P()]:P()}))},n.Observable.prototype.skip=function(t){return at(new n.Desc(this,"skip",[t]),this.withHandler(function(r){return r.hasValue()&&t>0?(t--,n.more):this.push(r)}))},n.EventStream.prototype.skipUntil=function(t){var r=t.take(1).map(!0).toProperty(!1);return at(new n.Desc(this,"skipUntil",[t]),this.filter(r))},n.EventStream.prototype.skipWhile=function(t){for(var r=!1,e=arguments.length,u=Array(e>1?e-1:0),i=1;e>i;i++)u[i-1]=arguments[i];return I(this,t,u,function(t){return at(new n.Desc(this,"skipWhile",[t]),this.withHandler(function(e){return!r&&e.hasValue()&&t(e.value())?n.more:(e.hasValue()&&(r=!0),this.push(e))}))})},n.Observable.prototype.slidingWindow=function(t,r){return null==r&&(r=0),at(new n.Desc(this,"slidingWindow",[t,r]),this.scan([],function(n,r){return n.concat([r]).slice(-t)}).filter(function(t){return t.length>=r}))},n.Property.prototype.startWith=function(t){return at(new n.Desc(this,"startWith",[t]),this.scan(t,function(t,n){return n}))},n.EventStream.prototype.startWith=function(t){return at(new n.Desc(this,"startWith",[t]),n.once(t).concat(this))},n.Observable.prototype.takeWhile=function(t){for(var r=arguments.length,e=Array(r>1?r-1:0),u=1;r>u;u++)e[u-1]=arguments[u];return I(this,t,e,function(t){return at(new n.Desc(this,"takeWhile",[t]),this.withHandler(function(r){return r.filter(t)?this.push(r):(this.push(P()),n.noMore)}))})},n.EventStream.prototype.throttle=function(t){return at(new n.Desc(this,"throttle",[t]),this.bufferWithTime(t).map(function(t){return t[t.length-1]}))},n.Property.prototype.throttle=function(t){return this.delayChanges(new n.Desc(this,"throttle",[t]),function(n){return n.throttle(t)})},y.prototype.firstToPromise=function(t){var r=this;if("function"!=typeof t){if("function"!=typeof Promise)throw new p("There isn't default Promise, use shim or parameter");t=Promise}return new t(function(t,e){return r.subscribe(function(r){return r.hasValue()&&t(r.value()),r.isError()&&e(r.error),n.noMore})})},y.prototype.toPromise=function(t){return this.last().firstToPromise(t)},n["try"]=function(t){return function(r){try{return n.once(t(r))}catch(e){return new n.Error(e)}}},n.update=function(r){function e(n){return function(){for(var r=arguments.length,e=Array(r),u=0;r>u;u++)e[u]=arguments[u];return function(r){return n.apply(void 0,t([r].concat(e)))}}}for(var u,i=arguments.length,o=Array(i>1?i-1:0),s=1;i>s;s++)o[s-1]=arguments[s];for(var c=o.length-1;c>0;)o[c]instanceof Function||(o[c]=D.always(o[c])),o[c]=e(o[c]),c-=2;return at(new n.Desc(n,"update",[r].concat(o)),(u=n).when.apply(u,o).scan(r,function(t,n){return n(t)}))},n.zipAsArray=function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];var u=A(r);return at(new n.Desc(n,"zipAsArray",u),n.zipWith(u,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}))},n.zipWith=function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];var u=O(r),i=u[0],o=u[1];return i=D.map(function(t){return t.toEventStream()},i),at(new n.Desc(n,"zipWith",[o].concat(i)),n.when(i,o))},n.Observable.prototype.zip=function(t,r){return at(new n.Desc(this,"zip",[t]),n.zipWith([this,t],r||Array))},"undefined"!=typeof define&&null!==define&&null!=define.amd?(define([],function(){return n}),"undefined"!=typeof this&&null!==this&&(this.Bacon=n)):"undefined"!=typeof module&&null!==module&&null!=module.exports?(module.exports=n,n.Bacon=n):this.Bacon=n}).call(this);
(function(){function t(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}return Array.from(t)}var n,r,e,u,i,o,s,c,a,f,h,p,l,d,v,y,b,m,g,w,E,D,S,A,O,M,_,k,I,W,P,T,x,V,H,B,F,C,q,L,U,N,z,j,R,$,Q,Z,X,G,J,K,Y,tt,nt,rt,et,ut,it,ot,st,ct,at,ft,ht={}.hasOwnProperty,pt=function(t,n){function r(){this.constructor=t}for(var e in n)ht.call(n,e)&&(t[e]=n[e]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},lt=[].slice,dt=function(t,n){return function(){return t.apply(n,arguments)}};n={toString:function(){return"Bacon"}},n.version="0.7.77",p=("undefined"!=typeof global&&null!==global?global:this).Error,J=function(){},z=function(t,n){return n},F=function(t,n){return t},M=function(t){return t.slice(0)},L=function(t){return t instanceof Array},N=function(t){return t instanceof y},D={indexOf:Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n===i)return r;return-1},indexWhere:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n(i))return r;return-1},head:function(t){return t[0]},always:function(t){return function(){return t}},negate:function(t){return function(n){return!t(n)}},empty:function(t){return 0===t.length},tail:function(t){return t.slice(1,t.length)},filter:function(t,n){var r,e,u,i;for(r=[],e=0,u=n.length;u>e;e++)i=n[e],t(i)&&r.push(i);return r},map:function(t,n){var r,e,u,i;for(u=[],r=0,e=n.length;e>r;r++)i=n[r],u.push(t(i));return u},each:function(t,n){var r,e;for(r in t)ht.call(t,r)&&(e=t[r],n(r,e));return void 0},toArray:function(t){return L(t)?t:[t]},contains:function(t,n){return-1!==D.indexOf(t,n)},id:function(t){return t},last:function(t){return t[t.length-1]},all:function(t,n){var r,e,u;for(null==n&&(n=D.id),r=0,e=t.length;e>r;r++)if(u=t[r],!n(u))return!1;return!0},any:function(t,n){var r,e,u;for(null==n&&(n=D.id),r=0,e=t.length;e>r;r++)if(u=t[r],n(u))return!0;return!1},without:function(t,n){return D.filter(function(n){return n!==t},n)},remove:function(t,n){var r;return r=D.indexOf(n,t),r>=0?n.splice(r,1):void 0},fold:function(t,n,r){var e,u,i;for(e=0,u=t.length;u>e;e++)i=t[e],n=r(n,i);return n},flatMap:function(t,n){return D.fold(n,[],function(n,r){return n.concat(t(r))})},cached:function(t){var n;return n=v,function(){return n===v&&(n=t(),t=void 0),n}},isFunction:function(t){return"function"==typeof t},toString:function(t){var n,r,e,u;try{return Y++,null==t?"undefined":D.isFunction(t)?"function":L(t)?Y>5?"[..]":"["+D.map(D.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?Y>5?"{..}":(r=function(){var r;r=[];for(e in t)ht.call(t,e)&&(u=function(){try{return t[e]}catch(r){return n=r}}(),r.push(D.toString(e)+":"+D.toString(u)));return r}(),"{"+r+"}"):t}finally{Y--}}},Y=0,n._=D,E=n.UpdateBarrier=function(){var t,r,e,u,i,o,s,c,a,f,h,p,l,d;return f=void 0,h=[],p={},r=[],e=0,t=function(t){return f?r.push(t):t()},l=function(t,n){var r;return f?(r=p[t.id],null==r?(r=p[t.id]=[n],h.push(t)):r.push(n)):n()},i=function(){for(;h.length>0;)s(0);return void 0},s=function(t){var n,r,e,u,i,s;for(u=h[t],i=u.id,s=p[i],h.splice(t,1),delete p[i],o(u),r=0,e=s.length;e>r;r++)(n=s[r])();return void 0},o=function(t){var n,r,e,u,i;for(r=t.internalDeps(),u=0,i=r.length;i>u;u++)n=r[u],o(n),p[n.id]&&(e=D.indexOf(h,n),s(e));return void 0},a=function(t,n,u,o){var s,c;if(f)return u.apply(n,o);f=t;try{c=u.apply(n,o),i()}finally{for(f=void 0;e<r.length;)s=r[e],e++,s();e=0,r=[]}return c},u=function(){return f?f.id:void 0},d=function(r,e){var u,i,o,s;return s=!1,i=!1,u=function(){return i=!0},o=function(){return s=!0,u()},u=r.dispatcher.subscribe(function(r){return t(function(){var t;return s||(t=e(r),t!==n.noMore)?void 0:o()})}),i&&u(),o},c=function(){return h.length>0},{whenDoneWith:l,hasWaiters:c,inTransaction:a,currentEventId:u,wrappedSubscribe:d,afterTransaction:t}}(),w=function(){function t(t,n,r){this.obs=t,this.sync=n,this.lazy=null!=r?r:!1,this.queue=[]}return t.prototype.subscribe=function(t){return this.obs.dispatcher.subscribe(t)},t.prototype.toString=function(){return this.obs.toString()},t.prototype.markEnded=function(){return this.ended=!0},t.prototype.consume=function(){return this.lazy?{value:D.always(this.queue[0])}:this.queue[0]},t.prototype.push=function(t){return this.queue=[t]},t.prototype.mayHave=function(){return!0},t.prototype.hasAtLeast=function(){return this.queue.length},t.prototype.flatten=!0,t}(),i=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return pt(n,t),n.prototype.consume=function(){return this.queue.shift()},n.prototype.push=function(t){return this.queue.push(t)},n.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},n.prototype.hasAtLeast=function(t){return this.queue.length>=t},n.prototype.flatten=!1,n}(w),r=function(t){function n(t){n.__super__.constructor.call(this,t,!0)}return pt(n,t),n.prototype.consume=function(){var t;return t=this.queue,this.queue=[],{value:function(){return t}}},n.prototype.push=function(t){return this.queue.push(t.value())},n.prototype.hasAtLeast=function(){return!0},n}(w),w.isTrigger=function(t){return t instanceof w?t.sync:t instanceof h},w.fromObservable=function(t){return t instanceof w?t:t instanceof b?new w(t,!1):new i(t,!0)},o=function(){function t(t,n,r){this.context=t,this.method=n,this.args=r}return t.prototype.deps=function(){return this.cached||(this.cached=V([this.context].concat(this.args)))},t.prototype.toString=function(){return D.toString(this.context)+"."+D.toString(this.method)+"("+D.map(D.toString,this.args)+")"},t}(),W=function(){var t,n,r;return n=arguments[0],r=arguments[1],t=3<=arguments.length?lt.call(arguments,2):[],(n||r)instanceof o?n||r:new o(n,r,t)},at=function(t,n){return n.desc=t,n},V=function(t){return L(t)?D.flatMap(V,t):N(t)?[t]:t instanceof w?[t.obs]:[]},n.Desc=o,n.Desc.empty=new n.Desc("","",[]),ft=function(t){return function(){var n,r,e,u;return e=arguments[0],n=2<=arguments.length?lt.call(arguments,1):[],"object"==typeof e&&n.length&&(r=e,u=n[0],e=function(){return r[u].apply(r,arguments)},n=n.slice(1)),t.apply(null,[e].concat(lt.call(n)))}},$=function(t){return t=Array.prototype.slice.call(t),Q.apply(null,t)},K=function(t,n){return function(){var r;return r=1<=arguments.length?lt.call(arguments,0):[],t.apply(null,n.concat(r))}},st=function(t){return function(n){return function(r){var e;return null==r?void 0:(e=r[n],D.isFunction(e)?e.apply(r,t):e)}}},ut=function(t,n){var r,e;return e=t.slice(1).split("."),r=D.map(st(n),e),function(n){var e,u;for(e=0,u=r.length;u>e;e++)t=r[e],n=t(n);return n}},U=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},Q=ft(function(){var t,n;return n=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],D.isFunction(n)?t.length?K(n,t):n:U(n)?ut(n,t):D.always(n)}),R=function(t,n){return Q.apply(null,[t].concat(lt.call(n)))},I=function(t,n,r,e){var u;return n instanceof b?(u=n.sampledBy(t,function(t,n){return[t,n]}),e.call(u,function(t){var n,r;return n=t[0],r=t[1],n}).map(function(t){var n,r;return n=t[0],r=t[1]})):(n=R(n,r),e.call(t,n))},rt=function(t){var n;if(D.isFunction(t))return t;if(U(t))return n=it(t),function(t,r){return t[n](r)};throw new p("not a function or a field key: "+t)},it=function(t){return t.slice(1)},g=function(){function t(t){this.value=t}return t.prototype.getOrElse=function(){return this.value},t.prototype.get=function(){return this.value},t.prototype.filter=function(n){return n(this.value)?new t(this.value):v},t.prototype.map=function(n){return new t(n(this.value))},t.prototype.forEach=function(t){return t(this.value)},t.prototype.isDefined=!0,t.prototype.toArray=function(){return[this.value]},t.prototype.inspect=function(){return"Some("+this.value+")"},t.prototype.toString=function(){return this.inspect()},t}(),v={getOrElse:function(t){return t},filter:function(){return v},map:function(){return v},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}},ot=function(t){return t instanceof g||t===v?t:new g(t)},n.noMore=["<no-more>"],n.more=["<more>"],T=0,f=function(){function t(){this.id=++T}return t.prototype.isEvent=function(){return!0},t.prototype.isEnd=function(){return!1},t.prototype.isInitial=function(){return!1},t.prototype.isNext=function(){return!1},t.prototype.isError=function(){return!1},t.prototype.hasValue=function(){return!1},t.prototype.filter=function(){return!0},t.prototype.inspect=function(){return this.toString()},t.prototype.log=function(){return this.toString()},t}(),d=function(t){function n(t,r){return this instanceof n?(n.__super__.constructor.call(this),void(!r&&D.isFunction(t)||t instanceof n?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t))):new n(t,r)}return pt(n,t),n.prototype.isNext=function(){return!0},n.prototype.hasValue=function(){return!0},n.prototype.value=function(){return this.valueF instanceof n?(this.valueInternal=this.valueF.value(),this.valueF=void 0):this.valueF&&(this.valueInternal=this.valueF(),this.valueF=void 0),this.valueInternal},n.prototype.fmap=function(t){var n,r;return this.valueInternal?(r=this.valueInternal,this.apply(function(){return t(r)})):(n=this,this.apply(function(){return t(n.value())}))},n.prototype.apply=function(t){return new n(t)},n.prototype.filter=function(t){return t(this.value())},n.prototype.toString=function(){return D.toString(this.value())},n.prototype.log=function(){return this.value()},n}(f),l=function(t){function n(t,r){return this instanceof n?void n.__super__.constructor.call(this,t,r):new n(t,r)}return pt(n,t),n.prototype.isInitial=function(){return!0},n.prototype.isNext=function(){return!1},n.prototype.apply=function(t){return new n(t)},n.prototype.toNext=function(){return new d(this)},n}(d),c=function(t){function n(){return this instanceof n?void 0:new n}return pt(n,t),n.prototype.isEnd=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<end>"},n}(f),a=function(t){function n(t){return this instanceof n?void(this.error=t):new n(t)}return pt(n,t),n.prototype.isError=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<error> "+D.toString(this.error)},n}(f),n.Event=f,n.Initial=l,n.Next=d,n.End=c,n.Error=a,q=function(t){return new l(t,!0)},G=function(t){return new d(t,!0)},P=function(){return new c},et=function(t){return t instanceof f?t:G(t)},C=0,tt=function(){},y=function(){function t(t){this.desc=t,this.id=++C,this.initialDesc=this.desc}return t.prototype.subscribe=function(t){return E.wrappedSubscribe(this,t)},t.prototype.subscribeInternal=function(t){return this.dispatcher.subscribe(t)},t.prototype.onValue=function(){var t;return t=$(arguments),this.subscribe(function(n){return n.hasValue()?t(n.value()):void 0})},t.prototype.onValues=function(t){return this.onValue(function(n){return t.apply(null,n)})},t.prototype.onError=function(){var t;return t=$(arguments),this.subscribe(function(n){return n.isError()?t(n.error):void 0})},t.prototype.onEnd=function(){var t;return t=$(arguments),this.subscribe(function(n){return n.isEnd()?t():void 0})},t.prototype.name=function(t){return this._name=t,this},t.prototype.withDescription=function(){return this.desc=W.apply(null,arguments),this},t.prototype.toString=function(){return this._name?this._name:this.desc.toString()},t.prototype.internalDeps=function(){return this.initialDesc.deps()},t}(),y.prototype.assign=y.prototype.onValue,y.prototype.forEach=y.prototype.onValue,y.prototype.inspect=y.prototype.toString,n.Observable=y,u=function(){function t(t){var n,r,e;for(null==t&&(t=[]),this.unsubscribe=dt(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[],n=0,r=t.length;r>n;n++)e=t[n],this.add(e)}return t.prototype.add=function(t){var n,r,e;if(!this.unsubscribed)return n=!1,r=J,this.starting.push(t),e=function(e){return function(){return e.unsubscribed?void 0:(n=!0,e.remove(r),D.remove(t,e.starting))}}(this),r=t(this.unsubscribe,e),this.unsubscribed||n?r():this.subscriptions.push(r),D.remove(t,this.starting),r},t.prototype.remove=function(t){return this.unsubscribed?void 0:void 0!==D.remove(t,this.subscriptions)?t():void 0},t.prototype.unsubscribe=function(){var t,n,r,e;if(!this.unsubscribed){for(this.unsubscribed=!0,r=this.subscriptions,t=0,n=r.length;n>t;t++)(e=r[t])();return this.subscriptions=[],this.starting=[]}},t.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},t.prototype.empty=function(){return 0===this.count()},t}(),n.CompositeUnsubscribe=u,s=function(){function t(t,n){this._subscribe=t,this._handleEvent=n,this.subscribe=dt(this.subscribe,this),this.handleEvent=dt(this.handleEvent,this),this.subscriptions=[],this.queue=[]}return t.prototype.pushing=!1,t.prototype.ended=!1,t.prototype.prevError=void 0,t.prototype.unsubSrc=void 0,t.prototype.hasSubscribers=function(){return this.subscriptions.length>0},t.prototype.removeSub=function(t){return this.subscriptions=D.without(t,this.subscriptions)},t.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),E.inTransaction(t,this,this.pushIt,[t])},t.prototype.pushToSubscriptions=function(t){var r,e,u,i,o,s;try{for(s=this.subscriptions,e=0,u=s.length;u>e;e++)o=s[e],i=o.sink(t),(i===n.noMore||t.isEnd())&&this.removeSub(o);return!0}catch(c){throw r=c,this.pushing=!1,this.queue=[],r}},t.prototype.pushIt=function(t){if(this.pushing)return this.queue.push(t),n.more;if(t!==this.prevError){for(t.isError()&&(this.prevError=t),this.pushing=!0,this.pushToSubscriptions(t),this.pushing=!1;this.queue.length;)t=this.queue.shift(),this.push(t);return this.hasSubscribers()?n.more:(this.unsubscribeFromSource(),n.noMore)}},t.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},t.prototype.unsubscribeFromSource=function(){return this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},t.prototype.subscribe=function(t){var n;return this.ended?(t(P()),J):(n={sink:t},this.subscriptions.push(n),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(t){return function(){return t.removeSub(n),t.hasSubscribers()?void 0:t.unsubscribeFromSource()}}(this))},t}(),n.Dispatcher=s,h=function(t){function r(t,n,e){return this instanceof r?(D.isFunction(t)&&(e=n,n=t,t=o.empty),r.__super__.constructor.call(this,t),this.dispatcher=new s(n,e),void tt(this)):new r(t,n,e)}return pt(r,t),r.prototype.toProperty=function(t){var r,e;return e=0===arguments.length?v:ot(function(){return t}),r=this.dispatcher,new b(new n.Desc(this,"toProperty",[t]),function(t){var u,i,o,s,c;return u=!1,s=!1,c=J,i=n.more,o=function(){return u?void 0:e.forEach(function(r){return u=!0,i=t(new l(r)),i===n.noMore?(c(),c=J):void 0})},c=r.subscribe(function(r){return r.hasValue()?r.isInitial()&&!s?(e=new g(function(t){return function(){return r.value()}}(this)),n.more):(r.isInitial()||o(),u=!0,e=new g(r),t(r)):(r.isEnd()&&(i=o()),i!==n.noMore?t(r):void 0)}),s=!0,o(),c})},r.prototype.toEventStream=function(){return this},r.prototype.withHandler=function(t){return new r(new n.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)},r}(y),n.EventStream=h,n.never=function(){return new h(W(n,"never"),function(t){return t(P()),J})},n.when=function(){var t,r,e,u,i,o,s,c,a,f,p,l,d,v,y,b,m,g,S,A;if(0===arguments.length)return n.never();for(s=arguments.length,A="when: expecting arguments in the form (Observable+,function)+",g=[],d=[],r=0,v=[];s>r;){for(v[r]=arguments[r],v[r+1]=arguments[r+1],l=D.toArray(arguments[r]),t=_(arguments[r+1]),p={f:t,ixs:[]},S=!1,i=0,c=l.length;c>i;i++){for(m=l[i],e=D.indexOf(g,m),S||(S=w.isTrigger(m)),0>e&&(g.push(m),e=g.length-1),y=p.ixs,o=0,a=y.length;a>o;o++)u=y[o],u.index===e&&u.count++;p.ixs.push({index:e,count:1})}l.length>0&&d.push(p),r+=2}return g.length?(g=D.map(w.fromObservable,g),f=D.any(g,function(t){return t.flatten})&&k(D.map(function(t){return t.obs},g)),b=new h(new n.Desc(n,"when",v),function(t){var e,u,i,o,s,c,a;return a=[],i=!1,o=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!g[r.index].hasAtLeast(r.count))return!1;return!0},u=function(t){return!t.sync||t.ended},e=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!g[r.index].mayHave(r.count))return!0},s=function(t){return!t.source.flatten},c=function(c){return function(h){var p,l,v;return l=function(){return E.whenDoneWith(b,p)},v=function(){var e,u,i,c,f,h;if(!(a.length>0))return n.more;for(f=n.more,h=a.pop(),u=0,i=d.length;i>u;u++)if(c=d[u],o(c))return e=function(){var t,n,e,u;for(e=c.ixs,u=[],n=0,t=e.length;t>n;n++)r=e[n],u.push(g[r.index].consume());return u}(),f=t(h.e.apply(function(){var t,n;return n=function(){var n,r,u;for(u=[],r=0,n=e.length;n>r;r++)t=e[r],u.push(t.value());return u}(),c.f.apply(c,n)})),a.length&&(a=D.filter(s,a)),f===n.noMore?f:v()},p=function(){var r;return r=v(),i&&(D.all(g,u)||D.all(d,e))&&(r=n.noMore,t(P())),r===n.noMore&&h(),r},c.subscribe(function(r){var e;return r.isEnd()?(i=!0,c.markEnded(),l()):r.isError()?e=t(r):(c.push(r),c.sync&&(a.push({source:c,e:r}),f||E.hasWaiters()?l():p())),e===n.noMore&&h(),e||n.more})}},new n.CompositeUnsubscribe(function(){var t,n,r;for(r=[],t=0,n=g.length;n>t;t++)m=g[t],r.push(c(m));return r}()).unsubscribe})):n.never()},k=function(t,n){var r;return null==n&&(n=[]),r=function(t){var e;return D.contains(n,t)?!0:(e=t.internalDeps(),e.length?(n.push(t),D.any(e,r)):(n.push(t),!1))},D.any(t,r)},_=function(t){return D.isFunction(t)?t:D.always(t)},n.groupSimultaneous=function(){var t,e,u;return u=1<=arguments.length?lt.call(arguments,0):[],1===u.length&&L(u[0])&&(u=u[0]),e=function(){var n,e,i;for(i=[],n=0,e=u.length;e>n;n++)t=u[n],i.push(new r(t));return i}(),at(new n.Desc(n,"groupSimultaneous",u),n.when(e,function(){var t;return t=1<=arguments.length?lt.call(arguments,0):[]}))},m=function(t){function r(t,n,e){this.property=t,this.subscribe=dt(this.subscribe,this),r.__super__.constructor.call(this,n,e),this.current=v,this.currentValueRootId=void 0,this.propertyEnded=!1}return pt(r,t),r.prototype.push=function(t){return t.isEnd()&&(this.propertyEnded=!0),t.hasValue()&&(this.current=new g(t),this.currentValueRootId=E.currentEventId()),r.__super__.push.call(this,t)},r.prototype.maybeSubSource=function(t,r){return r===n.noMore?J:this.propertyEnded?(t(P()),J):s.prototype.subscribe.call(this,t)},r.prototype.subscribe=function(t){var r,e,u,i;return e=!1,u=n.more,this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)?(r=E.currentEventId(),i=this.currentValueRootId,!this.propertyEnded&&i&&r&&r!==i?(E.whenDoneWith(this.property,function(n){return function(){return n.currentValueRootId===i?t(q(n.current.get().value())):void 0}}(this)),this.maybeSubSource(t,u)):(E.inTransaction(void 0,this,function(){return u=t(q(this.current.get().value()))},[]),this.maybeSubSource(t,u))):this.maybeSubSource(t,u)},r}(s),b=function(t){function r(t,n,e){r.__super__.constructor.call(this,t),this.dispatcher=new m(this,n,e),tt(this)}return pt(r,t),r.prototype.changes=function(){return new h(new n.Desc(this,"changes",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})}}(this))},r.prototype.withHandler=function(t){return new r(new n.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)},r.prototype.toProperty=function(){return this},r.prototype.toEventStream=function(){return new h(new n.Desc(this,"toEventStream",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})}}(this))},r}(y),n.Property=b,n.constant=function(t){return new b(new n.Desc(n,"constant",[t]),function(n){return n(q(t)),n(P()),J})},n.fromBinder=function(t,r){return null==r&&(r=D.id),new h(new n.Desc(n,"fromBinder",[t,r]),function(e){var u,i,o,s;return s=!1,u=!1,i=function(){return s?void 0:"undefined"!=typeof o&&null!==o?(o(),s=!0):u=!0},o=t(function(){var t,u,o,s,c,a;for(t=1<=arguments.length?lt.call(arguments,0):[],a=r.apply(this,t),L(a)&&D.last(a)instanceof f||(a=[a]),c=n.more,o=0,s=a.length;s>o;o++)if(u=a[o],c=e(u=et(u)),c===n.noMore||u.isEnd())return i(),c;return c}),u&&i(),i})},n.Observable.prototype.map=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],I(this,r,t,function(t){return at(new n.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})},A=function(t){return L(t[0])?t[0]:Array.prototype.slice.call(t)},O=function(t){return D.isFunction(t[0])?[A(Array.prototype.slice.call(t,1)),t[0]]:[A(Array.prototype.slice.call(t,0,t.length-1)),D.last(t)]},n.combineAsArray=function(){var t,r,e,u,i,o,s;for(s=A(arguments),t=r=0,e=s.length;e>r;t=++r)o=s[t],N(o)||(s[t]=n.constant(o));return s.length?(i=function(){var t,n,r;for(r=[],t=0,n=s.length;n>t;t++)u=s[t],r.push(new w(u,!0));return r}(),at(new n.Desc(n,"combineAsArray",s),n.when(i,function(){var t;return t=1<=arguments.length?lt.call(arguments,0):[]}).toProperty())):n.constant([])},n.onValues=function(){var t,r,e;return e=2<=arguments.length?lt.call(arguments,0,r=arguments.length-1):(r=0,[]),t=arguments[r++],n.combineAsArray(e).onValues(t)},n.combineWith=function(){var t,r,e;return r=O(arguments),e=r[0],t=r[1],at(new n.Desc(n,"combineWith",[t].concat(lt.call(e))),n.combineAsArray(e).map(function(n){return t.apply(null,n)}))},n.Observable.prototype.combine=function(t,r){var e;return e=rt(r),at(new n.Desc(this,"combine",[t,r]),n.combineAsArray(this,t).map(function(t){return e(t[0],t[1])}))},n.Observable.prototype.withStateMachine=function(t,r){var e;return e=t,at(new n.Desc(this,"withStateMachine",[t,r]),this.withHandler(function(t){var u,i,o,s,c,a,f;for(u=r(e,t),s=u[0],a=u[1],e=s,f=n.more,i=0,o=a.length;o>i;i++)if(c=a[i],f=this.push(c),f===n.noMore)return f;return f}))},n.Observable.prototype.skipDuplicates=function(t){return null==t&&(t=function(t,n){return t===n}),at(new n.Desc(this,"skipDuplicates",[]),this.withStateMachine(v,function(n,r){return r.hasValue()?r.isInitial()||n===v||!t(n.get(),r.value())?[new g(r.value()),[r]]:[n,[]]:[n,[r]]}))},n.Observable.prototype.awaiting=function(t){return at(new n.Desc(this,"awaiting",[t]),n.groupSimultaneous(this,t).map(function(t){var n,r;return n=t[0],r=t[1],0===r.length}).toProperty(!1).skipDuplicates())},n.Observable.prototype.not=function(){return at(new n.Desc(this,"not",[]),this.map(function(t){return!t}))},n.Property.prototype.and=function(t){return at(new n.Desc(this,"and",[t]),this.combine(t,function(t,n){return t&&n}))},n.Property.prototype.or=function(t){return at(new n.Desc(this,"or",[t]),this.combine(t,function(t,n){return t||n}))},n.scheduler={setTimeout:function(t,n){return setTimeout(t,n)},setInterval:function(t,n){return setInterval(t,n)},clearInterval:function(t){return clearInterval(t)},clearTimeout:function(t){return clearTimeout(t)},now:function(){return(new Date).getTime()}},n.EventStream.prototype.bufferWithTime=function(t){return at(new n.Desc(this,"bufferWithTime",[t]),this.bufferWithTimeOrCount(t,Number.MAX_VALUE))},n.EventStream.prototype.bufferWithCount=function(t){return at(new n.Desc(this,"bufferWithCount",[t]),this.bufferWithTimeOrCount(void 0,t))},n.EventStream.prototype.bufferWithTimeOrCount=function(t,r){var e;return e=function(n){return n.values.length===r?n.flush():void 0!==t?n.schedule():void 0},at(new n.Desc(this,"bufferWithTimeOrCount",[t,r]),this.buffer(t,e,e))},n.EventStream.prototype.buffer=function(t,r,e){var u,i,o;return null==r&&(r=J),null==e&&(e=J),u={scheduled:null,end:void 0,values:[],flush:function(){var t,r;if(this.scheduled&&(n.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){if(r=this.values,this.values=[],t=this.push(G(r)),null!=this.end)return this.push(this.end);if(t!==n.noMore)return e(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){return this.scheduled?void 0:this.scheduled=t(function(t){return function(){return t.flush()}}(this))}},o=n.more,D.isFunction(t)||(i=t,t=function(t){return n.scheduler.setTimeout(t,i)}),at(new n.Desc(this,"buffer",[]),this.withHandler(function(t){return u.push=function(t){return function(n){return t.push(n)}}(this),t.isError()?o=this.push(t):t.isEnd()?(u.end=t,u.scheduled||u.flush()):(u.values.push(t.value()),r(u)),o}))},n.Observable.prototype.filter=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],I(this,r,t,function(t){return at(new n.Desc(this,"filter",[t]),this.withHandler(function(r){return r.filter(t)?this.push(r):n.more}))})},n.once=function(t){return new h(new o(n,"once",[t]),function(n){return n(et(t)),n(P()),J})},n.EventStream.prototype.concat=function(t){var r;return r=this,new h(new n.Desc(r,"concat",[t]),function(n){var e,u;return u=J,e=r.dispatcher.subscribe(function(r){return r.isEnd()?u=t.dispatcher.subscribe(n):n(r)}),function(){return e(),u()}})},n.Observable.prototype.flatMap=function(){return B(this,X(arguments))},n.Observable.prototype.flatMapFirst=function(){return B(this,X(arguments),!0)},B=function(t,r,e,i){var o,s,c;return c=[t],o=[],s=new h(new n.Desc(t,"flatMap"+(e?"First":""),[r]),function(s){var c,a,f,h,p;return f=new u,h=[],p=function(t){var e;return e=Z(r(t.value())),o.push(e),f.add(function(t,r){return e.dispatcher.subscribe(function(u){var i;return u.isEnd()?(D.remove(e,o),a(),c(r),n.noMore):(u instanceof l&&(u=u.toNext()),i=s(u),i===n.noMore&&t(),i)})})},a=function(){var t;return t=h.shift(),t?p(t):void 0},c=function(t){return t(),f.empty()?s(P()):void 0},f.add(function(r,u){return t.dispatcher.subscribe(function(t){return t.isEnd()?c(u):t.isError()?s(t):e&&f.count()>1?n.more:f.unsubscribed?n.noMore:i&&f.count()>i?h.push(t):p(t)})}),f.unsubscribe}),s.internalDeps=function(){return o.length?c.concat(o):c},s},X=function(t){return 1===t.length&&N(t[0])?D.always(t[0]):$(t)},Z=function(t){return N(t)?t:n.once(t)},n.Observable.prototype.flatMapWithConcurrencyLimit=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],at(new n.Desc(this,"flatMapWithConcurrencyLimit",[r].concat(lt.call(t))),B(this,X(t),!1,r))},n.Observable.prototype.flatMapConcat=function(){return at(new n.Desc(this,"flatMapConcat",Array.prototype.slice.call(arguments,0)),this.flatMapWithConcurrencyLimit.apply(this,[1].concat(lt.call(arguments))))},n.later=function(t,r){return at(new n.Desc(n,"later",[t,r]),n.fromBinder(function(e){var u,i;return i=function(){return e([r,P()])},u=n.scheduler.setTimeout(i,t),function(){return n.scheduler.clearTimeout(u)}}))},n.Observable.prototype.bufferingThrottle=function(t){return at(new n.Desc(this,"bufferingThrottle",[t]),this.flatMapConcat(function(r){return n.once(r).concat(n.later(t).filter(!1))}))},n.Property.prototype.bufferingThrottle=function(){return n.Observable.prototype.bufferingThrottle.apply(this,arguments).toProperty()},e=function(t){function r(){return this.guardedSink=dt(this.guardedSink,this),this.subscribeAll=dt(this.subscribeAll,this),this.unsubAll=dt(this.unsubAll,this),this instanceof r?(this.sink=void 0,this.subscriptions=[],this.ended=!1,void r.__super__.constructor.call(this,new n.Desc(n,"Bus",[]),this.subscribeAll)):new r}return pt(r,t),r.prototype.unsubAll=function(){var t,n,r,e;for(r=this.subscriptions,t=0,n=r.length;n>t;t++)e=r[t],"function"==typeof e.unsub&&e.unsub();return void 0},r.prototype.subscribeAll=function(t){var n,r,e,u;if(this.ended)t(P());else for(this.sink=t,e=M(this.subscriptions),n=0,r=e.length;r>n;n++)u=e[n],this.subscribeInput(u);return this.unsubAll},r.prototype.guardedSink=function(t){return function(r){return function(e){return e.isEnd()?(r.unsubscribeInput(t),n.noMore):r.sink(e)}}(this)},r.prototype.subscribeInput=function(t){return t.unsub=t.input.dispatcher.subscribe(this.guardedSink(t.input))},r.prototype.unsubscribeInput=function(t){var n,r,e,u,i;for(u=this.subscriptions,n=r=0,e=u.length;e>r;n=++r)if(i=u[n],i.input===t)return"function"==typeof i.unsub&&i.unsub(),void this.subscriptions.splice(n,1)},r.prototype.plug=function(t){var n;if(!this.ended)return n={input:t},this.subscriptions.push(n),null!=this.sink&&this.subscribeInput(n),function(n){return function(){return n.unsubscribeInput(t)}}(this)},r.prototype.end=function(){return this.ended=!0,this.unsubAll(),"function"==typeof this.sink?this.sink(P()):void 0},r.prototype.push=function(t){return this.ended?void 0:"function"==typeof this.sink?this.sink(G(t)):void 0},r.prototype.error=function(t){return"function"==typeof this.sink?this.sink(new a(t)):void 0},r}(h),n.Bus=e,j=function(t,r){return ft(function(){var e,u,i;return u=arguments[0],e=2<=arguments.length?lt.call(arguments,1):[],i=K(r,[function(t,n){return u.apply(null,lt.call(t).concat([n]))}]),at(new n.Desc(n,t,[u].concat(lt.call(e))),n.combineAsArray(e).flatMap(i))})},n.fromCallback=j("fromCallback",function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],n.fromBinder(function(n){return R(r,t)(n),J},function(t){return[t,P()]})}),n.fromNodeCallback=j("fromNodeCallback",function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],n.fromBinder(function(n){return R(r,t)(n),J},function(t,n){return t?[new a(t),P()]:[n,P()]})}),n.combineTemplate=function(t){var r,e,u,i,o,s,c,a,f,h,p;return c=[],p=[],s=function(t){return t[t.length-1]},h=function(t,n,r){return s(t)[n]=r},r=function(t,n){return function(r,e){return h(r,t,e[n])}},o=function(t,n){return function(r){return h(r,t,n)}},a=function(t){return L(t)?[]:{}},f=function(t,n){return function(r){var e;return e=a(n),h(r,t,e),r.push(e)}},u=function(t,n){var e;return N(n)?(p.push(n),c.push(r(t,p.length-1))):n!==Object(n)||"function"==typeof n||n instanceof RegExp||n instanceof Date?c.push(o(t,n)):(e=function(t){return t.pop()},c.push(f(t,n)),i(n),c.push(e))},i=function(t){return D.each(t,u)},i(t),e=function(n){var r,e,u,i,o;for(o=a(t),r=[o],u=0,i=c.length;i>u;u++)(e=c[u])(r,n);return o},at(new n.Desc(n,"combineTemplate",[t]),n.combineAsArray(p).map(e))},S=function(t,r){var e;return e=new h(W(t,"justInitValue"),function(r){var u,i;return i=void 0,u=t.dispatcher.subscribe(function(t){return t.isEnd()||(i=t),n.noMore}),E.whenDoneWith(e,function(){return null!=i&&r(i),r(P())}),u}),e.concat(r).toProperty()},n.Observable.prototype.mapEnd=function(){var t;return t=$(arguments),at(new n.Desc(this,"mapEnd",[t]),this.withHandler(function(r){return r.isEnd()?(this.push(G(t(r))),this.push(P()),n.noMore):this.push(r)}))},n.Observable.prototype.skipErrors=function(){return at(new n.Desc(this,"skipErrors",[]),this.withHandler(function(t){return t.isError()?n.more:this.push(t)}))},n.EventStream.prototype.takeUntil=function(t){var r;return r={},at(new n.Desc(this,"takeUntil",[t]),n.groupSimultaneous(this.mapEnd(r),t.skipErrors()).withHandler(function(e){var u,i,o,s,c,a;if(e.hasValue()){if(s=e.value(),u=s[0],t=s[1],t.length)return this.push(P());for(c=n.more,i=0,o=u.length;o>i;i++)a=u[i],c=this.push(a===r?P():G(a));return c}return this.push(e)}))},n.Property.prototype.takeUntil=function(t){var r;return r=this.changes().takeUntil(t),at(new n.Desc(this,"takeUntil",[t]),S(this,r))},n.Observable.prototype.flatMapLatest=function(){var t,r;return t=X(arguments),r=this.toEventStream(),at(new n.Desc(this,"flatMapLatest",[t]),r.flatMap(function(n){return Z(t(n)).takeUntil(r)}))},n.Property.prototype.delayChanges=function(t,n){return at(t,S(this,n(this.changes())))},n.EventStream.prototype.delay=function(t){return at(new n.Desc(this,"delay",[t]),this.flatMap(function(r){return n.later(t,r)}))},n.Property.prototype.delay=function(t){return this.delayChanges(new n.Desc(this,"delay",[t]),function(n){return n.delay(t)})},n.EventStream.prototype.debounce=function(t){return at(new n.Desc(this,"debounce",[t]),this.flatMapLatest(function(r){
return n.later(t,r)}))},n.Property.prototype.debounce=function(t){return this.delayChanges(new n.Desc(this,"debounce",[t]),function(n){return n.debounce(t)})},n.EventStream.prototype.debounceImmediate=function(t){return at(new n.Desc(this,"debounceImmediate",[t]),this.flatMapFirst(function(r){return n.once(r).concat(n.later(t).filter(!1))}))},n.Observable.prototype.decode=function(t){return at(new n.Desc(this,"decode",[t]),this.combine(n.combineTemplate(t),function(t,n){return n[t]}))},n.Observable.prototype.scan=function(t,r){var e,u,i,o;return r=rt(r),e=ot(t),u=!1,o=function(t){return function(o){var s,c,a,f;return s=!1,f=J,c=n.more,a=function(){return s?void 0:e.forEach(function(t){return s=u=!0,c=o(new l(function(){return t})),c===n.noMore?(f(),f=J):void 0})},f=t.dispatcher.subscribe(function(t){var i,f;return t.hasValue()?u&&t.isInitial()?n.more:(t.isInitial()||a(),s=u=!0,f=e.getOrElse(void 0),i=r(f,t.value()),e=new g(i),o(t.apply(function(){return i}))):(t.isEnd()&&(c=a()),c!==n.noMore?o(t):void 0)}),E.whenDoneWith(i,a),f}}(this),i=new b(new n.Desc(this,"scan",[t,r]),o)},n.Observable.prototype.diff=function(t,r){return r=rt(r),at(new n.Desc(this,"diff",[t,r]),this.scan([t],function(t,n){return[n,r(t[0],n)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},n.Observable.prototype.doAction=function(){var t;return t=$(arguments),at(new n.Desc(this,"doAction",[t]),this.withHandler(function(n){return n.hasValue()&&t(n.value()),this.push(n)}))},n.Observable.prototype.doEnd=function(){var t;return t=$(arguments),at(new n.Desc(this,"doEnd",[t]),this.withHandler(function(n){return n.isEnd()&&t(),this.push(n)}))},n.Observable.prototype.doError=function(){var t;return t=$(arguments),at(new n.Desc(this,"doError",[t]),this.withHandler(function(n){return n.isError()&&t(n.error),this.push(n)}))},n.Observable.prototype.doLog=function(){var t;return t=1<=arguments.length?lt.call(arguments,0):[],at(new n.Desc(this,"doLog",t),this.withHandler(function(n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,lt.call(t).concat([n.log()])),this.push(n)}))},n.Observable.prototype.endOnError=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],null==r&&(r=!0),I(this,r,t,function(t){return at(new n.Desc(this,"endOnError",[]),this.withHandler(function(n){return n.isError()&&t(n.error)?(this.push(n),this.push(P())):this.push(n)}))})},y.prototype.errors=function(){return at(new n.Desc(this,"errors",[]),this.filter(function(){return!1}))},n.Observable.prototype.mapError=function(){var t;return t=$(arguments),at(new n.Desc(this,"mapError",[t]),this.withHandler(function(n){return this.push(n.isError()?G(t(n.error)):n)}))},n.Observable.prototype.flatMapError=function(t){return at(new n.Desc(this,"flatMapError",[t]),this.mapError(function(t){return new a(t)}).flatMap(function(r){return r instanceof a?t(r.error):n.once(r)}))},n.EventStream.prototype.sampledBy=function(t,r){return at(new n.Desc(this,"sampledBy",[t,r]),this.toProperty().sampledBy(t,r))},n.Property.prototype.sampledBy=function(t,r){var e,u,i,o,s;return null!=r?r=rt(r):(e=!0,r=function(t){return t.value()}),s=new w(this,!1,e),i=new w(t,!0,e),o=n.when([s,i],r),u=t instanceof b?o.toProperty():o,at(new n.Desc(this,"sampledBy",[t,r]),u)},n.Property.prototype.sample=function(t){return at(new n.Desc(this,"sample",[t]),this.sampledBy(n.interval(t,{})))},n.Observable.prototype.map=function(){var t,r;return r=arguments[0],t=2<=arguments.length?lt.call(arguments,1):[],r instanceof b?r.sampledBy(this,F):I(this,r,t,function(t){return at(new n.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})},n.Observable.prototype.fold=function(t,r){return at(new n.Desc(this,"fold",[t,r]),this.scan(t,r).sampledBy(this.filter(!1).mapEnd().toProperty()))},y.prototype.reduce=y.prototype.fold,x=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],H=function(t){var n,r,e,u,i,o,s;for(r=0,u=x.length;u>r;r++)if(s=x[r],o=[t[s[0]],t[s[1]]],o[0]&&o[1])return o;for(e=0,i=x.length;i>e;e++)if(s=x[e],n=t[s[0]])return[n,function(){}];throw new a("No suitable event methods in "+t)},n.fromEventTarget=function(t,r,e){var u,i,o;return u=H(t),i=u[0],o=u[1],at(new n.Desc(n,"fromEvent",[t,r]),n.fromBinder(function(n){return i.call(t,r,n),function(){return o.call(t,r,n)}},e))},n.fromEvent=n.fromEventTarget,n.fromPoll=function(t,r){return at(new n.Desc(n,"fromPoll",[t,r]),n.fromBinder(function(r){var e;return e=n.scheduler.setInterval(r,t),function(){return n.scheduler.clearInterval(e)}},r))},ct=function(t){return[t,P()]},n.fromPromise=function(t,r,e){return null==e&&(e=ct),at(new n.Desc(n,"fromPromise",[t]),n.fromBinder(function(n){var e;return null!=(e=t.then(n,function(t){return n(new a(t))}))&&"function"==typeof e.done&&e.done(),function(){return r&&"function"==typeof t.abort?t.abort():void 0}},e))},n.spy=function(t){return nt.push(t)},nt=[],tt=function(t){var n,r,e;if(nt.length&&!tt.running)try{for(tt.running=!0,n=0,r=nt.length;r>n;n++)(e=nt[n])(t)}finally{delete tt.running}return void 0},n.Observable.prototype.take=function(t){return 0>=t?n.never():at(new n.Desc(this,"take",[t]),this.withHandler(function(r){return r.hasValue()?(t--,t>0?this.push(r):(0===t&&this.push(r),this.push(P()),n.noMore)):this.push(r)}))},n.Observable.prototype.first=function(){return at(new n.Desc(this,"first",[]),this.take(1))},n.Observable.prototype.groupBy=function(t,r){null==r&&(r=n._.id);var e={},u=this;return u.filter(function(n){return!e[t(n)]}).map(function(i){var o=t(i),s=u.filter(function(n){return t(n)===o}),c=n.once(i).concat(s),a=r(c,i).withHandler(function(t){return this.push(t),t.isEnd()?delete e[o]:void 0});return e[o]=a,a})},n.fromArray=function(t){if(t.length){var r=0;return new h(new n.Desc(n,"fromArray",[t]),function(e){var u=!1,i=n.more,o=!1,s=!1,c=function(){if(s=!0,!o){for(o=!0;s;)if(s=!1,i!==n.noMore&&!u){var a=t[r++];i=e(et(a)),i!==n.noMore&&(r===t.length?e(P()):E.afterTransaction(c))}return o=!1}};return c(),function(){return u=!0}})}return at(new n.Desc(n,"fromArray",t),n.never())},n.EventStream.prototype.holdWhen=function(t){var r=!1,e=[],i=this;return new h(new n.Desc(this,"holdWhen",[t]),function(n){var o=new u,s=!1,c=function(t){return"function"==typeof t&&t(),o.empty()&&s?n(P()):void 0};return o.add(function(u,i){return t.subscribeInternal(function(t){if(!t.hasValue())return t.isEnd()?c(i):n(t);if(r=t.value(),!r){var u=e;return e=[],function(){for(var t,r=[],e=0;e<u.length;e++)t=u[e],r.push(n(G(t)));return r}()}})}),o.add(function(t,u){return i.subscribeInternal(function(t){return r&&t.hasValue()?e.push(t.value()):t.isEnd()&&e.length?c(u):n(t)})}),s=!0,c(),o.unsubscribe})},n.interval=function(t,r){return("undefined"==typeof r||null===r)&&(r={}),at(new n.Desc(n,"interval",[t,r]),n.fromPoll(t,function(){return G(r)}))},n.$={},n.$.asEventStream=function(t,r,e){var u=this;return D.isFunction(r)&&(e=r,r=void 0),at(new n.Desc(this.selector||this,"asEventStream",[t]),n.fromBinder(function(n){return u.on(t,r,n),function(){return u.off(t,r,n)}}),e)},"undefined"!=typeof jQuery&&jQuery&&(jQuery.fn.asEventStream=n.$.asEventStream),"undefined"!=typeof Zepto&&Zepto&&(Zepto.fn.asEventStream=n.$.asEventStream),n.Observable.prototype.last=function(){var t;return at(new n.Desc(this,"last",[]),this.withHandler(function(r){return r.isEnd()?(t&&this.push(t),this.push(P()),n.noMore):void(t=r)}))},n.Observable.prototype.log=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return this.subscribe(function(t){"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()]))}),this},n.EventStream.prototype.merge=function(t){var r=this;return at(new n.Desc(r,"merge",[t]),n.mergeAll(this,t))},n.mergeAll=function(){var t=A(arguments);return t.length?new h(new n.Desc(n,"mergeAll",t),function(r){var e=0,u=function(u){return function(i){return u.dispatcher.subscribe(function(u){if(u.isEnd())return e++,e===t.length?r(P()):n.more;var o=r(u);return o===n.noMore&&i(),o})}},i=D.map(u,t);return new n.CompositeUnsubscribe(i).unsubscribe}):n.never()},n.repeatedly=function(t,r){var e=0;return at(new n.Desc(n,"repeatedly",[t,r]),n.fromPoll(t,function(){return r[e++%r.length]}))},n.repeat=function(t){var r=0;return n.fromBinder(function(e){function u(t){return t.isEnd()?o?i():o=!0:s=e(t)}function i(){var i;for(o=!0;o&&s!==n.noMore;)i=t(r++),o=!1,i?c=i.subscribeInternal(u):e(P());return o=!0}var o=!1,s=n.more,c=function(){};return i(),function(){return c()}})},n.retry=function(t){if(!D.isFunction(t.source))throw new p("'source' option has to be a function");var r=t.source,e=t.retries||0,u=t.maxRetries||e,i=t.delay||function(){return 0},o=t.isRetryable||function(){return!0},s=!1,c=null;return at(new n.Desc(n,"retry",[t]),n.repeat(function(){function t(){return r().endOnError().withHandler(function(t){return t.isError()?(c=t,o(c.error)&&e>0?void 0:(s=!0,this.push(t))):(t.hasValue()&&(c=null,s=!0),this.push(t))})}if(s)return null;if(c){var a={error:c.error,retriesDone:u-e},f=n.later(i(a)).filter(!1);return e-=1,f.concat(n.once().flatMap(t))}return t()}))},n.sequentially=function(t,r){var e=0;return at(new n.Desc(n,"sequentially",[t,r]),n.fromPoll(t,function(){var t=r[e++];return e<r.length?t:e===r.length?[t,P()]:P()}))},n.Observable.prototype.skip=function(t){return at(new n.Desc(this,"skip",[t]),this.withHandler(function(r){return r.hasValue()&&t>0?(t--,n.more):this.push(r)}))},n.EventStream.prototype.skipUntil=function(t){var r=t.take(1).map(!0).toProperty(!1);return at(new n.Desc(this,"skipUntil",[t]),this.filter(r))},n.EventStream.prototype.skipWhile=function(t){for(var r=!1,e=arguments.length,u=Array(e>1?e-1:0),i=1;e>i;i++)u[i-1]=arguments[i];return I(this,t,u,function(t){return at(new n.Desc(this,"skipWhile",[t]),this.withHandler(function(e){return!r&&e.hasValue()&&t(e.value())?n.more:(e.hasValue()&&(r=!0),this.push(e))}))})},n.Observable.prototype.slidingWindow=function(t,r){return null==r&&(r=0),at(new n.Desc(this,"slidingWindow",[t,r]),this.scan([],function(n,r){return n.concat([r]).slice(-t)}).filter(function(t){return t.length>=r}))},n.Property.prototype.startWith=function(t){return at(new n.Desc(this,"startWith",[t]),this.scan(t,function(t,n){return n}))},n.EventStream.prototype.startWith=function(t){return at(new n.Desc(this,"startWith",[t]),n.once(t).concat(this))},n.Observable.prototype.takeWhile=function(t){for(var r=arguments.length,e=Array(r>1?r-1:0),u=1;r>u;u++)e[u-1]=arguments[u];return I(this,t,e,function(t){return at(new n.Desc(this,"takeWhile",[t]),this.withHandler(function(r){return r.filter(t)?this.push(r):(this.push(P()),n.noMore)}))})},n.EventStream.prototype.throttle=function(t){return at(new n.Desc(this,"throttle",[t]),this.bufferWithTime(t).map(function(t){return t[t.length-1]}))},n.Property.prototype.throttle=function(t){return this.delayChanges(new n.Desc(this,"throttle",[t]),function(n){return n.throttle(t)})},y.prototype.firstToPromise=function(t){var r=this;if("function"!=typeof t){if("function"!=typeof Promise)throw new p("There isn't default Promise, use shim or parameter");t=Promise}return new t(function(t,e){return r.subscribe(function(r){return r.hasValue()&&t(r.value()),r.isError()&&e(r.error),n.noMore})})},y.prototype.toPromise=function(t){return this.last().firstToPromise(t)},n["try"]=function(t){return function(r){try{return n.once(t(r))}catch(e){return new n.Error(e)}}},n.update=function(r){function e(n){return function(){for(var r=arguments.length,e=Array(r),u=0;r>u;u++)e[u]=arguments[u];return function(r){return n.apply(void 0,t([r].concat(e)))}}}for(var u,i=arguments.length,o=Array(i>1?i-1:0),s=1;i>s;s++)o[s-1]=arguments[s];for(var c=o.length-1;c>0;)o[c]instanceof Function||(o[c]=D.always(o[c])),o[c]=e(o[c]),c-=2;return at(new n.Desc(n,"update",[r].concat(o)),(u=n).when.apply(u,o).scan(r,function(t,n){return n(t)}))},n.zipAsArray=function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];var u=A(r);return at(new n.Desc(n,"zipAsArray",u),n.zipWith(u,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}))},n.zipWith=function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];var u=O(r),i=u[0],o=u[1];return i=D.map(function(t){return t.toEventStream()},i),at(new n.Desc(n,"zipWith",[o].concat(i)),n.when(i,o))},n.Observable.prototype.zip=function(t,r){return at(new n.Desc(this,"zip",[t]),n.zipWith([this,t],r||Array))},"undefined"!=typeof define&&null!==define&&null!=define.amd?(define([],function(){return n}),"undefined"!=typeof this&&null!==this&&(this.Bacon=n)):"undefined"!=typeof module&&null!==module&&null!=module.exports?(module.exports=n,n.Bacon=n):this.Bacon=n}).call(this);
{
"name": "baconjs",
"description": "A small functional reactive programming lib for JavaScript.",
"version": "0.7.76",
"version": "0.7.77",
"keywords": [

@@ -6,0 +6,0 @@ "bacon.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc