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