Socket
Socket
Sign inDemoInstall

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.64 to 0.7.65

5

dist/Bacon.min.js

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

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

2

package.json
{
"name": "baconjs",
"description": "A small functional reactive programming lib for JavaScript.",
"version": "0.7.64",
"version": "0.7.65",
"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

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