Comparing version 3.0.13 to 3.0.14
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).Bacon={})}(this,function(n){"use strict";var e=function(n,t){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])})(n,t)};function o(n,t){function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(){}var h=Array.isArray||function(n){return n instanceof Array};function f(n){return n&&n._isObservable}function y(n,t){for(var r=0;r<n.length;r++)if(!t(n[r]))return!1;return!0}function i(n,t){for(var r=0;r<n.length;r++)if(t(n[r]))return!0;return!1}function u(n,t){return-1!==w(n,t)}function b(n,t){for(var r,e=[],i=0;i<t.length;i++)n(r=t[i])&&e.push(r);return e}function s(r){return function(n,t){return r(t,n)}}function c(n,t,r){for(var e=0;e<n.length;e++)t=r(t,n[e]);return t}function p(n){return n[0]}var w=Array.prototype.indexOf?function(n,t){return n.indexOf(t)}:function(n,t){for(var r=0;r<n.length;r++)if(t===n[r])return r;return-1};function l(n){return"function"==typeof n}function m(n,t){for(var r,e=[],i=0;i<t.length;i++)r=t[i],e.push(n(r));return e}function v(n){return n.slice(1,n.length)}function d(n){return h(n)?n:[n]}function g(t){return"function"==typeof t?t:function(n){return t}}var E={indexOf:w,indexWhere:function(n,t){for(var r=0;r<n.length;r++)if(t(n[r]))return r;return-1},head:p,always:function(n){return function(){return n}},negate:function(t){return function(n){return!t(n)}},empty:function(n){return 0===n.length},tail:v,filter:b,map:m,each:function(n,t){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t(r,n[r])},toArray:d,contains:u,id:function(n){return n},last:function(n){return n[n.length-1]},all:y,any:i,without:function(t,n){return b(function(n){return n!==t},n)},remove:function(n,t){var r=w(t,n);if(0<=r)return t.splice(r,1)},fold:c,flatMap:function(r,n){return c(n,[],function(n,t){return n.concat(r(t))})},bind:function(n,t){return function(){return n.apply(t,arguments)}},isFunction:l,toFunction:g,toString:function n(t){var r={}.hasOwnProperty;try{if(S++,null==t)return"undefined";if(l(t))return"function";if(h(t))return 5<S?"[..]":"["+m(n,t).toString()+"]";if(null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString)return t.toString();if("object"!=typeof t)return t;if(5<S)return"{..}";var e=[];for(var i in t)if(r.call(t,i)){var u=function(){try{return t[i]}catch(n){return n}}();e.push(n(i)+":"+n(u))}return"{"+e+"}"}finally{S--}}},S=0,D=void 0,I="<no-more>",A={scheduler:{setTimeout:function(n,t){return setTimeout(n,t)},setInterval:function(n,t){return setInterval(n,t)},clearInterval:function(n){return clearInterval(n)},clearTimeout:function(n){return clearTimeout(n)},now:function(){return(new Date).getTime()}}};var k=void 0,_=[],B={},x=[],M=0,W={},O=!1;function T(n){n<=M||(x[n-1]||(x[n-1]=[[],0]),M=n)}function P(n,t){if(!k&&!O)return t();T(1);for(var r=0;r<M-1&&!C(n,x[r][0]);)r++;x[r][0].push([n,t]),k||N()}function C(n,t){for(var r=0;r<t.length;r++)if(t[r][0].id==n.id)return!0;return!1}function N(){var n=M;if(n){var t=!O;O=!0;try{for(;n<=M;){var r=x[M-1];if(!r)throw new Error("Unexpected stack top: "+r);var e=r[0],i=r[1];if(!(i<e.length)){r[0]=[],r[1]=0;break}var u=e[i][1];r[1]++,T(M+1);var o=!1;try{for(u(),o=!0;n<M&&0==x[M-1][0].length;)M--}finally{o||(x=[],M=0)}}}finally{t&&(O=!1)}}}function r(n,t){if(k){var r=B[n.id];return void 0===r?(r=B[n.id]=[t],_.push(n)):r.push(t)}return t()}function F(n,t){var r=_[n],e=r.id,i=B[e];_.splice(n,1),delete B[e],t&&0<_.length&&function n(t){if(W[t.id])return;var r=t.internalDeps();for(var e,i=0;i<r.length;i++)if(e=r[i],n(e),B[e.id]){var u=E.indexOf(_,e);F(u,!1)}W[t.id]=!0}(r);for(var u=0;u<i.length;u++)(0,i[u])()}var L={toString:function(){return E.toString({rootEvent:k,processingAfters:O,waiterObs:_,waiters:B,aftersStack:x,aftersStackHeight:M,flushed:W})},whenDoneWith:r,hasWaiters:function(){return 0<_.length},inTransaction:function(n,t,r,e){if(k)return r.apply(t,e);k=n;try{var i=r.apply(t,e);!function(){for(;0<_.length;)F(0,!0);W={}}()}finally{k=void 0,N()}return i},currentEventId:function(){return k?k.id:void 0},wrappedSubscribe:function(t,n,r){var e=!1,i=!1,u=function(){i=!0},o=function(){e=!0,u()};return u=n(function(n){return P(t,function(){e||r(n)===I&&o()}),D}),i&&u(),o},afterTransaction:P,soonButNotYet:function(n,t){k?r(n,t):A.scheduler.setTimeout(t,0)},isInTransaction:function(){return void 0!==k}},V=function(){function n(n,t,r){void 0===r&&(r=[]),this._isDesc=!0,this.context=n,this.method=t,this.args=r}return n.prototype.deps=function(){return this.cachedDeps||(this.cachedDeps=t([this.context].concat(this.args))),this.cachedDeps},n.prototype.toString=function(){var n=E.map(E.toString,this.args);return E.toString(this.context)+"."+E.toString(this.method)+"("+n+")"},n}();function q(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var i=n||t;return i&&i._isDesc?n||t:new V(n,t,r)}function t(n){return h(n)?E.flatMap(t,n):f(n)?[n]:(null!=n?n._isSource:void 0)?[n.obs]:[]}var j=function(){return D},U=function(){return D};function Q(n,t,r){return r.transform(function(n,c){var f=n;return function(n,t){var r=c(f,n),e=r[0],i=r[1];f=e;for(var u=D,o=0;o<i.length;o++){var s=i[o];if((u=t(s))===I)return u}return u}}(n,t),new V(r,"withStateMachine",[n,t]))}var z=function(){function t(n){this._isSome=!0,this.isDefined=!0,this.value=n}return t.prototype.getOrElse=function(n){return this.value},t.prototype.get=function(){return this.value},t.prototype.filter=function(n){return n(this.value)?new t(this.value):H},t.prototype.map=function(n){return new t(n(this.value))},t.prototype.forEach=function(n){n(this.value)},t.prototype.toArray=function(){return[this.value]},t.prototype.inspect=function(){return"Some("+this.value+")"},t.prototype.toString=function(){return this.inspect()},t}(),H={_isNone:!0,getOrElse:function(n){return n},get:function(){throw new Error("None.get()")},filter:function(){return H},map:function(){return H},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}};function R(){return H}var Y=0,X=function(){function n(){this.id=++Y,this.isEvent=!0,this._isEvent=!0,this.isEnd=!1,this.isInitial=!1,this.isNext=!1,this.isError=!1,this.hasValue=!1}return n.prototype.filter=function(n){return!0},n.prototype.inspect=function(){return this.toString()},n.prototype.log=function(){return this.toString()},n.prototype.toNext=function(){return this},n}(),$=function(r){function n(n){var t=r.call(this)||this;if(t.hasValue=!0,n instanceof X)throw new nn("Wrapping an event inside other event");return t.value=n,t}return o(n,r),n.prototype.fmap=function(n){return this.apply(n(this.value))},n.prototype.filter=function(n){return n(this.value)},n.prototype.toString=function(){return E.toString(this.value)},n.prototype.log=function(){return this.value},n}(X),G=function(r){function t(n){var t=r.call(this,n)||this;return t.isNext=!0,t._isNext=!0,t}return o(t,r),t.prototype.apply=function(n){return new t(n)},t}($),J=function(r){function t(n){var t=r.call(this,n)||this;return t.isInitial=!0,t._isInitial=!0,t}return o(t,r),t.prototype.apply=function(n){return new t(n)},t.prototype.toNext=function(){return new G(this.value)},t}($),K=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.hasValue=!1,n}return o(n,t),n.prototype.fmap=function(n){return this},n}(X),Z=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.isEnd=!0,n}return o(n,t),n.prototype.toString=function(){return"<end>"},n}(K),nn=function(r){function n(n){var t=r.call(this)||this;return t.isError=!0,t.error=n,t}return o(n,r),n.prototype.toString=function(){return"<error> "+E.toString(this.error)},n}(K);function tn(n){return new J(n)}function rn(n){return new G(n)}function en(){return new Z}function un(n){return n&&n._isEvent?n:rn(n)}function on(n){return n&&n._isEvent}function sn(n){return n&&n._isInitial}function cn(n){return n.isError}function fn(n){return n.hasValue}function an(n){return n.isEnd}function hn(n,t){return n===t}function pn(n,t,r){return t.transform(ln(n),r||new V(t,"take",[n]))}function ln(r){return function(n,t){return n.hasValue?0<--r?t(n):(0===r&&t(n),t(en()),I):t(n)}}function vn(t,n,o){var s,c=n,f=!1;return s=new Mt(new V(t,"scan",[n,o]),function(r){var e=!1,n=a,i=D,u=function(){return e||(e=f=!0,(i=r(new J(c)))===I&&(n(),n=a)),i};return n=t.subscribeInternal(function(n){if(fn(n)){if(f&&n.isInitial)return D;n.isInitial||u(),e=f=!0;var t=o(c,n.value);return c=t,r(n.apply(t))}return n.isEnd&&(i=u()),i!==I?r(n):i}),L.whenDoneWith(s,u),n})}var dn=function(){function n(n){void 0===n&&(n=[]),this.unsubscribed=!1,this.unsubscribe=E.bind(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[];for(var t,r=0;r<n.length;r++)t=n[r],this.add(t)}return n.prototype.add=function(n){var t=this;if(!this.unsubscribed){var r=!1,e=a;this.starting.push(n);e=n(this.unsubscribe,function(){t.unsubscribed||(r=!0,t.remove(e),E.remove(n,t.starting))}),this.unsubscribed||r?e():this.subscriptions.push(e),E.remove(n,this.starting)}},n.prototype.remove=function(n){if(!this.unsubscribed)return void 0!==E.remove(n,this.subscriptions)?n():void 0},n.prototype.unsubscribe=function(){if(!this.unsubscribed){this.unsubscribed=!0;for(var n=this.subscriptions,t=0;t<n.length;t++)n[t]();this.subscriptions=[],this.starting=[]}},n.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},n.prototype.empty=function(){return 0===this.count()},n}();function yn(s,n){return function(t){var r=!1,e=!1,i=a,u=D,o=function(){if(!r)return s.forEach(function(n){if(r=!0,(u=t(new J(n)))===I)return i(),i=a})};return i=n(function(n){return n instanceof $?n.isInitial&&!e?(s=new z(n.value),D):(n.isInitial||o(),r=!0,s=new z(n.value),t(n)):(n.isEnd&&(u=o()),u!==I?t(n):u)}),e=!0,o(),i}}function bn(n,t){return new Mt(n,yn(R(),t))}function wn(t){var r=new Tt(new V("Bacon","once",[t]),function(n){return L.soonButNotYet(r,function(){n(un(t)),n(en())}),a});return r}function mn(t,n,e){void 0===e&&(e={});var i=n,r=[i],f=[],a=n._isProperty,h=!1,u=(a?bn:Ct)(e.desc||new V(n,"flatMap_",[t]),function(u){var r=new dn,o=[];function s(n){if(a&&n.isInitial){if(h)return D;h=!0}var i=En(t(n));return f.push(i),r.add(function(r,e){return i.subscribeInternal(function(n){if(n.isEnd)return E.remove(i,f),function(){var n=o.shift();n&&s(n)}(),c(e),I;n=n.toNext();var t=u(n);return t===I&&r(),t})})}function c(n){return n(),r.empty()?u(en()):D}return r.add(function(n,t){return i.subscribeInternal(function(n){return n.isEnd?c(t):n.isError&&!e.mapError?u(n):e.firstOnly&&1<r.count()?D:r.unsubscribed?I:(e.limit&&r.count()>e.limit?o.push(n):s(n),D)})}),r.unsubscribe});return u.internalDeps=function(){return f.length?r.concat(f):r},u}function gn(t){return"function"==typeof t?function(n){return fn(n)?t(n.value):n}:function(n){return t}}function En(n){return f(n)?n:wn(n)}function Sn(n,t){return mn(t,n,{mapError:!0,desc:new V(n,"flatMapEvent",[t])})}var Dn=function(){function n(n,t){this._isSource=!0,this.flatten=!0,this.ended=!1,this.obs=n,this.sync=t}return n.prototype.subscribe=function(n){return this.obs.subscribeInternal(n)},n.prototype.toString=function(){return this.obs.toString()},n.prototype.markEnded=function(){this.ended=!0},n.prototype.mayHave=function(n){return!0},n}(),In=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.consume=function(){return this.value},t.prototype.push=function(n){this.value=n},t.prototype.hasAtLeast=function(n){return!!this.value},t}(Dn),An=function(e){function n(n,t){var r=e.call(this,n,t)||this;return r.flatten=!1,r.queue=[],r}return o(n,e),n.prototype.consume=function(){return this.queue.shift()},n.prototype.push=function(n){this.queue.push(n)},n.prototype.mayHave=function(n){return!this.ended||this.queue.length>=n},n.prototype.hasAtLeast=function(n){return this.queue.length>=n},n}(Dn),kn=function(r){function n(n){var t=r.call(this,n,!0)||this;return t.queue=[],t}return o(n,r),n.prototype.consume=function(){var n=this.queue;return this.queue=[],{value:n}},n.prototype.push=function(n){return this.queue.push(n.value)},n.prototype.hasAtLeast=function(n){return!0},n}(Dn);function _n(n){return null!=n&&n._isSource?n:null!=n&&n._isProperty?new In(n,!1):new An(n,!0)}function Bn(){return new Tt(q("Bacon","never"),function(n){return n(en()),a})}function xn(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return Wn(Pt,n)}function Mn(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return Wn(bn,n)}function Wn(n,t){if(0===t.length)return Bn();var r=function(n){for(var t=[],r=[],e=0;e<n.length;e++){for(var i,u=n[e],o=u[0],s=u[1],c={f:s,ixs:[]},f=!1,a=0;a<o.length;a++){i=o[a];var h=w(t,i);f||(f=null!=(v=i)&&(v._isSource?v.sync:v._isEventStream)),h<0&&(t.push(i),h=t.length-1);for(var p=0;p<c.ixs.length;p++){var l=c.ixs[p];l.index===h&&l.count++}c.ixs.push({index:h,count:1})}if(0<o.length&&!f)throw new Error("At least one EventStream required, none found in "+o);0<o.length&&r.push(c)}var v;return[m(_n,t),r]}(Tn(t)),l=r[0],v=r[1];if(!l.length)return Bn();var c=i(l,function(n){return n.flatten})&&function(n,e){void 0===e&&(e=[]);return i(n,function n(t){{if(u(e,t))return!0;var r=t.internalDeps();return r.length?(e.push(t),i(r,n)):(e.push(t),!1)}})}(m(function(n){return n.obs},l)),d=n(new V("Bacon","when",Array.prototype.slice.call(t)),function(f){var a=[],s=!1;function h(n){for(var t=0;t<n.ixs.length;t++){var r=n.ixs[t];if(!l[r.index].hasAtLeast(r.count))return!1}return!0}function t(n){for(var t=0;t<n.ixs.length;t++){var r=n.ixs[t];if(!l[r.index].mayHave(r.count))return!0}return!1}function p(n){return!n.source.flatten}return new dn(m(function(o){return function(e){function i(){return L.whenDoneWith(d,u)}function u(){var n=function n(){var t;if(void 0!==(t=a.pop()))for(var r,e=D,i=0;i<v.length;i++)if(h(r=v[i])){for(var u=[],o=0;o<r.ixs.length;o++){var s=l[r.ixs[o].index].consume();if(!s)throw new Error("Event was undefined");u.push(s.value)}var c=r.f.apply(null,u);return e=f(t.e.apply(c)),a.length&&(a=b(p,a)),e===I?e:n()}return D}();s&&(y(l,Pn)||y(v,t))&&(n=I,f(en())),n===I&&e()}return o.subscribe(function(n){var t=D;if(n.isEnd)s=!0,o.markEnded(),i();else if(n.isError)t=f(n);else{var r=n;o.push(r),o.sync&&(a.push({source:o,e:r}),c||L.hasWaiters()?i():u())}return t===I&&e(),t})}},l)).unsubscribe});return d}function On(n){for(var t=0,r=n.length,e=[];t<r;){var i=d(n[t++]),u=g(n[t++]);e.push([i,u])}return e}function Tn(n){for(var t,r=[],e=0;e<n.length;e++){var i=n[e];if(!((t=i)instanceof Array)||f(t[t.length-1]))return On(n);if(i[0]instanceof Array)r.push([i[0],g(i[1])]);else{var u=i.slice(0,i.length-1),o=g(i[i.length-1]);r.push([u,o])}}return r}function Pn(n){return!n.sync||n.ended}function Cn(n,t,r){return xn([new In(t.toProperty(),!1),new In(n,!0),s(r)]).withDesc(new V(n,"withLatestFrom",[t,r]))}function Nn(n,t,r){return Mn([new In(t.toProperty(),!1),new In(n,!0),s(r)]).withDesc(new V(n,"withLatestFrom",[t,r]))}function Fn(n,t,r){if(n instanceof Mt)return Nn(n,t,r);if(n instanceof Tt)return Cn(n,t,r);throw new Error("Unknown observable: "+n)}function Ln(n,t){return t instanceof Mt?Fn(n,t,function(n,t){return t}):n.transform(Vn(t),new V(n,"map",[t]))}function Vn(n){var r=E.toFunction(n);return function(n,t){return t(n.fmap(r))}}function qn(t){return new Mt(new V("Bacon","constant",[t]),function(n){return n(tn(t)),n(en()),a})}function jn(n){return n=Array.prototype.slice.call(n),E.flatMap(Un,n)}function Un(n){return f(n)?[n]:h(n)?jn(n):[qn(n)]}function Qn(n){return E.isFunction(n[0])?[jn(Array.prototype.slice.call(n,1)),n[0]]:[jn(Array.prototype.slice.call(n,0,n.length-1)),E.last(n)]}function zn(n,r){return Wn(function(n,t){return new Tt(n,t,void 0,r)},[E.map(function(n){return new kn(n)},n),function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n}]).withDesc(new V("Bacon","groupSimultaneous",n))}function Hn(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];if((n=jn(n)).length){for(var r=[],e=0;e<n.length;e++){var i=f(n[e])?n[e]:qn(n[e]);r.push(Yn(i))}return Mn([r,function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n}]).withDesc(new V("Bacon","combineAsArray",n))}return qn([])}function Rn(n,t,r){return Mn([[Yn(n),Yn(t)],r]).withDesc(new V(n,"combine",[t,r]))}function Yn(n){return new In(n,!0)}function Xn(n,t){return mn(gn(t),n,{desc:new V(n,"flatMapConcat",[t]),limit:1})}function $n(e,f){void 0===f&&(f=E.id);var n=new V("Bacon","fromBinder",[e,f]);return new Tt(n,function(s){var n=!1,t=!1,c=function(){if(!n)return null!=r?(r(),n=!0):t=!0},r=e(function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];for(var r=f.apply(void 0,n),e=h(r)&&on(E.last(r))?r:[r],i=D,u=0;u<e.length;u++){var o=un(e[u]);if((i=s(o))===I||o.isEnd)return c(),i}return i});return t&&c(),c})}function Gn(r,n){var t=new V("Bacon","fromPoll",[r,n]);return $n(function(n){var t=A.scheduler.setInterval(n,r);return function(){return A.scheduler.clearInterval(t)}},n).withDesc(t)}function Jn(n,t){return Gn(n,function(){return rn(t)}).withDesc(new V("Bacon","interval",[n,t]))}function Kn(n,t,r){return n instanceof Tt?function(n,t,r){return Zn(n.toProperty(),t,r).withDesc(new V(n,"sampledBy",[t]))}(n,t,r):Zn(n,t,r)}function Zn(n,t,r){return Fn(t,n,s(function(n){return"function"==typeof n?n:E.id}(r))).withDesc(new V(n,"sampledBy",[t]))}function nt(n,r,t){return new Mt(new V(n,"transform",[r]),function(t){return n.subscribeInternal(function(n){return r(n,t)})}).withDesc(t)}function tt(r,t){var e,i=function(n){return t(n,e)};return function(n,t){return e=t,r(n,i)}}function rt(n,t,r,e){return t instanceof Mt?Fn(n,t,function(n,t){return[n,t]}).transform(tt(r(function(n){return n[1]}),Vn(function(n){return n[0]})),e):n.transform(r(function(n){if("boolean"==typeof n)return E.always(n);if("function"!=typeof n)throw new Error("Not a function: "+n);return n}(t)),e)}function et(r){return function(n,t){return n.filter(r)?t(n):D}}function it(n){return n.map(function(n){return!n}).withDesc(new V(n,"not",[]))}function ut(n){return Wt(n)?n:qn(n)}function ot(n,t){return mn(gn(t),n,{firstOnly:!0,desc:new V(n,"flatMapFirst",[t])})}function st(n,t,r){return n.scan(t,r).last().withDesc(new V(n,"fold",[t,r]))}var ct={};function ft(n,t){return mn(gn(t),n,{desc:new V(n,"flatMap",[t])})}function at(n,r){return mn(function(n){if(n instanceof nn){var t=n.error;return r(t)}return n},n,{mapError:!0,desc:new V(n,"flatMapError",[r])})}var ht=[],pt=!1;function lt(t){if(ht.length&&!pt)try{pt=!0,ht.forEach(function(n){n(t)})}finally{pt=!1}}function vt(n,t){var r=E.toFunction(t),e=Wt(n)?n.toEventStream(Ot):n,i=ft(e,function(n){return En(r(n)).takeUntil(e)});return Wt(n)&&(i=i.toProperty()),i.withDesc(new V(n,"flatMapLatest",[r]))}var dt=function(){function n(n,t,r){this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0,this._subscribe=t,this._handleEvent=r,this.subscribe=E.bind(this.subscribe,this),this.handleEvent=E.bind(this.handleEvent,this),this.subscriptions=[],this.observable=n,this.queue=[]}return n.prototype.hasSubscribers=function(){return 0<this.subscriptions.length},n.prototype.removeSub=function(n){return this.subscriptions=E.without(n,this.subscriptions),this.subscriptions},n.prototype.push=function(n){return n.isEnd&&(this.ended=!0),L.inTransaction(n,this,this.pushIt,[n])},n.prototype.pushToSubscriptions=function(n){try{for(var t=this.subscriptions,r=t.length,e=0;e<r;e++){var i=t[e];(i.sink(n)===I||n.isEnd)&&this.removeSub(i)}return!0}catch(n){throw this.pushing=!1,this.queue=[],n}},n.prototype.pushIt=function(n){if(this.pushing)return this.queue.push(n),D;if(n!==this.prevError){for(n.isError&&(this.prevError=n),this.pushing=!0,this.pushToSubscriptions(n),this.pushing=!1;;){var t=this.queue.shift();if(!t)break;this.push(t)}return this.hasSubscribers()?D:(this.unsubscribeFromSource(),I)}},n.prototype.handleEvent=function(n){return this._handleEvent?this._handleEvent(n):this.push(n)},n.prototype.unsubscribeFromSource=function(){this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},n.prototype.subscribe=function(n){var t=this;if(this.ended)return n(en()),a;var r={sink:n};return this.subscriptions.push(r),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(){if(t.removeSub(r),!t.hasSubscribers())return t.unsubscribeFromSource()}},n.prototype.inspect=function(){return this.observable.toString()},n}(),yt=function(i){function n(n,t,r){var e=i.call(this,n,t,r)||this;return e.current=R(),e.propertyEnded=!1,e.subscribe=E.bind(e.subscribe,e),e}return o(n,i),n.prototype.push=function(n){return n.isEnd&&(this.propertyEnded=!0),n instanceof $?(this.current=new z(n),this.currentValueRootId=L.currentEventId()):n.hasValue&&console.error("Unknown event, two Bacons loaded?",n.constructor),i.prototype.push.call(this,n)},n.prototype.maybeSubSource=function(n,t){return t===I?a:this.propertyEnded?(n(en()),a):i.prototype.subscribe.call(this,n)},n.prototype.subscribe=function(n){var t=this,r=D;if(this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)){var e=L.currentEventId(),i=this.currentValueRootId;return!this.propertyEnded&&i&&e&&e!==i?L.whenDoneWith(this.observable,function(){if(t.currentValueRootId===i)return n(tn(t.current.get().value))}):L.inTransaction(void 0,this,function(){return r=n(tn(t.current.get().value))},[]),this.maybeSubSource(n,r)}return this.maybeSubSource(n,r)},n.prototype.inspect=function(){return this.observable+" current= "+this.current},n}(dt);function bt(n,t,r){return mn(gn(r),n,{desc:new V(n,"flatMapWithConcurrencyLimit",[t,r]),limit:t})}function wt(n,t,r){var e=function(n){if(void 0===n)return;if("number"!=typeof n)return n;var t=n;return function(n){return A.scheduler.setTimeout(n,t)}}(t);function i(n){return n.values.length===r?n.flush():void 0!==e?n.schedule(e):void 0}var u=new V(n,"bufferWithTimeOrCount",[t,r]);return function(n,r,t){void 0===r&&(r=a);void 0===t&&(t=a);var e=D,i=new mt(t,r);return n.transform(function(n,t){return i.push=t,fn(n)?(i.values.push(n.value),r(i)):cn(n)?e=t(n):an(n)&&(i.end=n,i.scheduled||i.flush()),e}).withDesc(new V(n,"buffer",[]))}(n,i,i).withDesc(u)}var mt=function(){function n(n,t){this.push=function(n){return D},this.scheduled=null,this.end=void 0,this.values=[],this.onFlush=n,this.onInput=t}return n.prototype.flush=function(){if(this.scheduled&&(A.scheduler.clearTimeout(this.scheduled),this.scheduled=null),0<this.values.length){var n=this.values;this.values=[];var t=this.push(rn(n));if(null!=this.end)return this.push(this.end);if(t!==I)return this.onFlush(this)}else if(null!=this.end)return this.push(this.end)},n.prototype.schedule=function(n){var t=this;if(!this.scheduled)return this.scheduled=n(function(){return t.flush()})},n}();function gt(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var u=jn(n);return u.length?new Tt(new V("Bacon","mergeAll",u),function(e){var i=0,n=m(function(n){return function(r){return n.subscribeInternal(function(n){if(n.isEnd)return++i===u.length?e(en()):D;n=n.toNext();var t=e(n);return t===I&&r(),t})}},u);return new dn(n).unsubscribe}):Bn()}function Et(r,e){return $n(function(n){var t=A.scheduler.setTimeout(function(){return n([un(e),en()])},r);return function(){return A.scheduler.clearTimeout(t)}}).withDesc(new V("Bacon","later",[r,e]))}function St(r){return function(n,t){return n.filter(r)?t(n):(t(en()),I)}}function Dt(r){var e=!1;return function(n,t){return!e&&fn(n)&&r(n.value)?D:(n.hasValue&&(e=!0),t(n))}}function It(u,o,s){void 0===s&&(s=E.id);var c={};return u.transform(tt(et(function(n){return!c[o(n)]}),Vn(function(n){var e=o(n),t=u.changes().filter(function(n){return o(n)===e}),r=wn(n).concat(t),i=s(r,n).toEventStream().transform(function(n,t){var r=t(n);return n.isEnd&&delete c[e],r});return c[e]=i})))}var At={};function kt(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var e=Qn(arguments);t=e[0],n=e[1];return xn([t=E.map(function(n){return n.toEventStream()},t),n]).withDesc(new V("Bacon","zipWith",[n].concat(t)))}function _t(i){function u(n,t,r){return function(n){return n[n.length-1]}(n)[t]=r}function o(n){return h(n)?[]:{}}function r(n){if(f(n))return!0;if(n&&(n.constructor==Object||n.constructor==Array))for(var t in n){if(Object.prototype.hasOwnProperty.call(n,t))if(r(n[t]))return!0}}function t(n,t){if(f(t))c.push(t),s.push(function(r,e){return function(n,t){u(n,r,t[e])}}(n,c.length-1));else if(r(t)){s.push(function(r,e){return function(n){var t=o(e);u(n,r,t),n.push(t)}}(n,t)),e(t),s.push(function(n){n.pop()})}else s.push(function(t,r){return function(n){u(n,t,r)}}(n,t))}function e(n){E.each(n,t)}var s=[],c=[];return(r(i)?(e(i),Hn(c).map(function(n){for(var t=o(i),r=[t],e=0;e<s.length;e++)(0,s[e])(r,n);return t})):qn(i)).withDesc(new V("Bacon","combineTemplate",[i]))}var Bt=0,xt=function(){function n(n){this.id=++Bt,this._isObservable=!0,this.desc=n,this.initialDesc=n}return n.prototype.awaiting=function(n){return function(n,t){return zn([n,t],Ot).map(function(n){return 0===n[1].length}).toProperty(!1).skipDuplicates().withDesc(new V(n,"awaiting",[t]))}(this,n)},n.prototype.bufferingThrottle=function(n){return function(n,t){var r=new V(n,"bufferingThrottle",[t]);return n.transformChanges(r,function(n){return n.flatMapConcat(function(n){return wn(n).concat(Et(t,n).errors())})})}(this,n)},n.prototype.combine=function(n,t){return Rn(this,n,t)},n.prototype.debounce=function(n){return function(n,t){return n.transformChanges(new V(n,"debounce",[t]),function(n){return n.flatMapLatest(function(n){return Et(t,n)})})}(this,n)},n.prototype.debounceImmediate=function(n){return function(n,t){return n.transformChanges(new V(n,"debounceImmediate",[t]),function(n){return n.flatMapFirst(function(n){return wn(n).concat(Et(t,n).errors())})})}(this,n)},n.prototype.decode=function(n){return function(n,t){return n.combine(_t(t),function(n,t){return t[n]}).withDesc(new V(n,"decode",[t]))}(this,n)},n.prototype.delay=function(n){return function(n,t){return n.transformChanges(new V(n,"delay",[t]),function(n){return n.flatMap(function(n){return Et(t,n)})})}(this,n)},n.prototype.deps=function(){return this.desc.deps()},n.prototype.diff=function(n,t){return function(n,t,r){return nt(vn(n,[t,At],function(n,t){return[t,r(n[0],t)]}),tt(et(function(n){return n[1]!==At}),Vn(function(n){return n[1]})),new V(n,"diff",[t,r]))}(this,n,t)},n.prototype.doAction=function(n){return this.transform(function(r){return function(n,t){return fn(n)&&r(n.value),t(n)}}(n),new V(this,"doAction",[n]))},n.prototype.doEnd=function(n){return this.transform(function(r){return function(n,t){return an(n)&&r(),t(n)}}(n),new V(this,"doEnd",[n]))},n.prototype.doError=function(n){return this.transform(function(r){return function(n,t){return cn(n)&&r(n.error),t(n)}}(n),new V(this,"doError",[n]))},n.prototype.doLog=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return this.transform(function(r){return function(n,t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,r.concat([n.log()])),t(n)}}(n),new V(this,"doLog",n))},n.prototype.endAsValue=function(){return function(n){return n.transform(function(n,t){return an(n)?(t(rn({})),t(en()),I):D})}(this)},n.prototype.endOnError=function(n){return void 0===n&&(n=function(n){return!0}),function(n,r){return void 0===r&&(r=function(n){return!0}),n.transform(function(n,t){return cn(n)&&r(n.error)?(t(n),t(en())):t(n)},new V(n,"endOnError",[]))}(this,n)},n.prototype.errors=function(){return this.filter(function(n){return!1}).withDesc(new V(this,"errors"))},n.prototype.filter=function(n){return function(n,t){return rt(n,t,et,new V(n,"filter",[t]))}(this,n)},n.prototype.first=function(){return pn(1,this,new V(this,"first"))},n.prototype.firstToPromise=function(n){return function(n,t){if("function"!=typeof t){if("function"!=typeof Promise)throw new Error("There isn't default Promise, use shim or parameter");t=function(n){return new Promise(n)}}return new t(function(t,r){return n.subscribe(function(n){return fn(n)&&t(n.value),cn(n)&&r(n.error),I})})}(this,n)},n.prototype.fold=function(n,t){return st(this,n,t)},n.prototype.forEach=function(n){return void 0===n&&(n=j),this.onValue(n)},n.prototype.holdWhen=function(n){return function(e,s){var c=!1,f=[],a=!1;return new Tt(new V(e,"holdWhen",[s]),function(u){var t=new dn,r=!1,o=function(n){return n&&n(),t.empty()&&r?u(en()):D};return t.add(function(n,i){return s.subscribeInternal(function(n){if(fn(n)){c=n.value;var t=D;if(!c){var r=f;f=[];for(var e=0;e<r.length;e++)t=u(rn(r[e]));a&&(u(en()),i(),t=I)}return t}return n.isEnd?o(i):u(n)})}),t.add(function(n,t){return e.subscribeInternal(function(n){return c&&fn(n)?(f.push(n.value),D):n.isEnd&&f.length?(a=!0,o(t)):u(n)})}),r=!0,o(),t.unsubscribe})}(this,n)},n.prototype.inspect=function(){return this.toString()},n.prototype.internalDeps=function(){return this.initialDesc.deps()},n.prototype.last=function(){return function(n){var r;return n.transform(function(n,t){return an(n)?(r&&t(r),t(en()),I):fn(n)?(r=n,D):t(n)}).withDesc(new V(n,"last",[]))}(this)},n.prototype.log=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(t,n){n.subscribe(function(n){return"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,t.concat([n.log()])),D})}(n,this),this},n.prototype.mapEnd=function(n){return this.transform(function(n){var r=E.toFunction(n);return function(n,t){return an(n)?(t(rn(r(n))),t(en()),I):t(n)}}(n),new V(this,"mapEnd",[n]))},n.prototype.mapError=function(n){return this.transform(function(n){var r=E.toFunction(n);return function(n,t){return cn(n)?t(rn(r(n.error))):t(n)}}(n),new V(this,"mapError",[n]))},n.prototype.name=function(n){return this._name=n,this},n.prototype.onEnd=function(t){return void 0===t&&(t=U),this.subscribe(function(n){return n.isEnd?t():D})},n.prototype.onError=function(t){return void 0===t&&(t=j),this.subscribe(function(n){return cn(n)?t(n.error):D})},n.prototype.onValue=function(t){return void 0===t&&(t=j),this.subscribe(function(n){return fn(n)?t(n.value):D})},n.prototype.onValues=function(t){return this.onValue(function(n){return t.apply(void 0,n)})},n.prototype.reduce=function(n,t){return st(this,n,t)},n.prototype.sampledBy=function(n){return Kn(this,n,arguments[1])},n.prototype.scan=function(n,t){return vn(this,n,t)},n.prototype.skip=function(n){return function(n,r){return n.transform(function(n,t){return n.hasValue&&0<r?(r--,D):t(n)},new V(n,"skip",[r]))}(this,n)},n.prototype.skipDuplicates=function(n){return function(n,r){void 0===r&&(r=hn);var t=new V(n,"skipDuplicates",[]);return Q(R(),function(n,t){return fn(t)?t.isInitial||function(n){return null!=n&&n._isNone}(n)||!r(n.get(),t.value)?[new z(t.value),[t]]:[n,[]]:[n,[t]]},n).withDesc(t)}(this,n)},n.prototype.skipErrors=function(){return function(n){return n.transform(function(n,t){return cn(n)?D:t(n)},new V(n,"skipErrors",[]))}(this)},n.prototype.skipUntil=function(n){return function(n,t){var r=t.transform(tt(ln(1),Vn(!0))).toProperty().startWith(!1);return n.filter(r).withDesc(new V(n,"skipUntil",[t]))}(this,n)},n.prototype.skipWhile=function(n){return function(n,t){return rt(n,t,Dt,new V(n,"skipWhile",[t]))}(this,n)},n.prototype.slidingWindow=function(n,t){return void 0===t&&(t=0),function(n,r,t){return void 0===t&&(t=0),n.scan([],function(n,t){return n.concat([t]).slice(-r)}).filter(function(n){return n.length>=t}).withDesc(new V(n,"slidingWindow",[r,t]))}(this,n,t)},n.prototype.subscribe=function(n){var t=this;return void 0===n&&(n=j),L.wrappedSubscribe(this,function(n){return t.subscribeInternal(n)},n)},n.prototype.take=function(n){return pn(n,this)},n.prototype.takeUntil=function(n){return function(n,t){var r=zn([n.mapEnd(ct),t.skipErrors()],Ot);return n instanceof Mt&&(r=r.toProperty()),r.transform(function(n,t){if(fn(n)){var r=n.value,e=r[0];if(r[1].length)return t(en());for(var i=D,u=0;u<e.length;u++){var o=e[u];if(o===ct)return t(en());i=t(rn(o))}return i}return t(n)},new V(n,"takeUntil",[t]))}(this,n)},n.prototype.takeWhile=function(n){return function(n,t){return rt(n,t,St,new V(n,"takeWhile",[t]))}(this,n)},n.prototype.throttle=function(n){return function(n,t){return n.transformChanges(new V(n,"throttle",[t]),function(n){return n.bufferWithTime(t).map(function(n){return n[n.length-1]})})}(this,n)},n.prototype.toPromise=function(n){return function(n,t){return n.last().firstToPromise(t)}(this,n)},n.prototype.toString=function(){return this._name?this._name:this.desc.toString()},n.prototype.withDesc=function(n){return n&&(this.desc=n),this},n.prototype.withDescription=function(n,t){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return this.desc=q.apply(void 0,[n,t].concat(r)),this},n.prototype.zip=function(n,t){return function(n,t,r){return kt(r||Array,n,t).withDesc(new V(n,"zip",[t]))}(this,n,t)},n}(),Mt=function(i){function n(n,t,r){var e=i.call(this,n)||this;return e._isProperty=!0,e.dispatcher=new yt(e,t,r),lt(e),e}return o(n,i),n.prototype.and=function(n){return function(n,t){return n.combine(ut(t),function(n,t){return!(!n||!t)}).withDesc(new V(n,"and",[t]))}(this,n)},n.prototype.changes=function(){var n=this;return new Tt(new V(this,"changes",[]),function(t){return n.dispatcher.subscribe(function(n){return n.isInitial?D:t(n)})})},n.prototype.concat=function(t){return this.transformChanges(q(this,"concat",t),function(n){return n.concat(t)})},n.prototype.transformChanges=function(n,t){return function(n,t,r){var e,i,u=t(new Tt(q(n,"changes",[]),function(t){return n.dispatcher.subscribe(function(n){return!e&&sn(n)&&(e=n,L.whenDoneWith(o,function(){if(!i)throw new Error("Init sequence fail");i(e)})),n.isInitial?D:t(n)})},void 0,Ot)),o=bn(r,function(t){return i=t,u.dispatcher.subscribe(function(n){t(n)})});return o}(this,t,n)},n.prototype.flatMap=function(n){return ft(this,n)},n.prototype.flatMapConcat=function(n){return Xn(this,n)},n.prototype.flatMapError=function(n){return at(this,n)},n.prototype.flatMapEvent=function(n){return Sn(this,n)},n.prototype.flatMapFirst=function(n){return ot(this,n)},n.prototype.flatMapLatest=function(n){return vt(this,n)},n.prototype.flatMapWithConcurrencyLimit=function(n,t){return bt(this,n,t)},n.prototype.groupBy=function(n,t){return It(this,n,t)},n.prototype.map=function(n){return Ln(this,n)},n.prototype.not=function(){return it(this)},n.prototype.or=function(n){return function(n,t){return n.combine(ut(t),function(n,t){return n||t}).withDesc(new V(n,"or",[t]))}(this,n)},n.prototype.sample=function(n){return function(n,t){return Zn(n,Jn(t,{}),function(n,t){return n}).withDesc(new V(n,"sample",[t]))}(this,n)},n.prototype.startWith=function(n){return function(n,t){return n.scan(t,function(n,t){return t}).withDesc(new V(n,"startWith",[t]))}(this,n)},n.prototype.subscribeInternal=function(n){return void 0===n&&(n=j),this.dispatcher.subscribe(n)},n.prototype.toEventStream=function(n){var r=this;return new Tt(new V(this,"toEventStream",[]),function(t){return r.subscribeInternal(function(n){return t(n.toNext())})},void 0,n)},n.prototype.toProperty=function(){return this},n.prototype.transform=function(n,t){return nt(this,n,t)},n.prototype.withLatestFrom=function(n,t){return Nn(this,n,t)},n.prototype.withStateMachine=function(n,t){return Q(n,t,this)},n}(xt);function Wt(n){return!!n._isProperty}var Ot={forceAsync:!1},Tt=function(u){function n(n,t,r,e){var i=u.call(this,n)||this;return i._isEventStream=!0,e!==Ot&&(t=function(u,n){var o=!1;return function(e){var i,t=L.isInTransaction();function r(){var n=i||[];i=void 0;for(var t=0;t<n.length;t++){var r=n[t];e(r)}}o=!0;try{return n(function(n){return o||i?(i?i.push(n):(i=[n],t?L.soonButNotYet(u,r):A.scheduler.setTimeout(r,0)),D):e(n)})}finally{o=!1}}}(i,t)),i.dispatcher=new dt(i,t,r),lt(i),i}return o(n,u),n.prototype.bufferWithTime=function(n){return function(n,t){return wt(n,t,Number.MAX_VALUE).withDesc(new V(n,"bufferWithTime",[t]))}(this,n)},n.prototype.bufferWithCount=function(n){return function(n,t){return wt(n,void 0,t).withDesc(new V(n,"bufferWithCount",[t]))}(this,n)},n.prototype.bufferWithTimeOrCount=function(n,t){return wt(this,n,t)},n.prototype.changes=function(){return this},n.prototype.concat=function(n,t){return function(e,i,n){return new Tt(new V(e,"concat",[i]),function(t){var r=a,n=e.dispatcher.subscribe(function(n){return n.isEnd?(r=i.toEventStream().dispatcher.subscribe(t),D):t(n)});return function(){return n(),r()}},void 0,n)}(this,n,t)},n.prototype.transformChanges=function(n,t){return t(this).withDesc(n)},n.prototype.flatMap=function(n){return ft(this,n)},n.prototype.flatMapConcat=function(n){return Xn(this,n)},n.prototype.flatMapError=function(n){return at(this,n)},n.prototype.flatMapFirst=function(n){return ot(this,n)},n.prototype.flatMapLatest=function(n){return vt(this,n)},n.prototype.flatMapWithConcurrencyLimit=function(n,t){return bt(this,n,t)},n.prototype.flatMapEvent=function(n){return Sn(this,n)},n.prototype.flatScan=function(n,t){return function(n,t,r){var e=t;return n.flatMapConcat(function(n){return En(r(e,n)).doAction(function(n){return e=n})}).toProperty().startWith(t).withDesc(new V(n,"flatScan",[t,r]))}(this,n,t)},n.prototype.groupBy=function(n,t){return It(this,n,t)},n.prototype.map=function(n){return Ln(this,n)},n.prototype.merge=function(n){return gt(this,n).withDesc(new V(this,"merge",[n]))},n.prototype.not=function(){return it(this)},n.prototype.startWith=function(n){return function(n,t){return wn(t).concat(n).withDesc(new V(n,"startWith",[t]))}(this,n)},n.prototype.subscribeInternal=function(n){return void 0===n&&(n=j),this.dispatcher.subscribe(n)},n.prototype.toEventStream=function(){return this},n.prototype.toProperty=function(n){var t=arguments.length?function(n){return n&&(n._isSome||n._isNone)?n:new z(n)}(n):R(),r=this.dispatcher,e=new V(this,"toProperty",Array.prototype.slice.apply(arguments)),i=r.subscribe;return new Mt(e,yn(t,i))},n.prototype.transform=function(n,t){return function(n,r,t){return new Tt(new V(n,"transform",[r]),function(t){return n.subscribeInternal(function(n){return r(n,t)})},void 0,Ot).withDesc(t)}(this,n,t)},n.prototype.withLatestFrom=function(n,t){return Cn(this,n,t)},n.prototype.withStateMachine=function(n,t){return Q(n,t,this)},n}(xt);function Pt(n,t){return new Tt(n,t)}function Ct(n,t){return new Tt(n,t,void 0,Ot)}function Nt(n){return"undefined"!=typeof Symbol&&Symbol[n]?Symbol[n]:"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol[n]=Symbol.for(n):"@@"+n}var Ft=function(){function n(n){this.observable=n}return n.prototype.subscribe=function(n,t,r){var e="function"==typeof n?{next:n,error:t,complete:r}:n,i={closed:!1,unsubscribe:function(){i.closed=!0,u()}},u=this.observable.subscribe(function(n){fn(n)&&e.next?e.next(n.value):cn(n)?(e.error&&e.error(n.error),i.unsubscribe()):n.isEnd&&(i.closed=!0,e.complete&&e.complete())});return i},n}();function Lt(r){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(n){return r.apply(void 0,[n].concat(t))}}}Ft.prototype[Nt("observable")]=function(){return this},xt.prototype.toESObservable=function(){return new Ft(this)},xt.prototype[Nt("observable")]=xt.prototype.toESObservable;var Vt=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]];function qt(t,r,n){var e=function(n){for(var t,r=0;r<Vt.length;r++){var e=[n[(t=Vt[r])[0]],n[t[1]]];if(e[0]&&e[1])return e}for(var i=0;i<Vt.length;i++){var u=n[(t=Vt[i])[0]];if(u)return[u,function(){}]}throw new Error("No suitable event methods in "+n)}(t),i=e[0],u=e[1],o=new V("Bacon","fromEvent",[t,r]);return $n(function(n){return function(n){return E.isFunction(n)}(r)?(r(i.bind(t),n),function(){return r(u.bind(t),n)}):(i.call(t,r,n),function(){return u.call(t,r,n)})},n).withDesc(o)}function jt(s){var c=0;return $n(function(t){var r=!1,e=D,i=function(){};function u(n){return n.isEnd?(r?o():r=!0,D):e=t(n)}function o(){var n;for(r=!0;r&&e!==I;)n=s(c++),r=!1,n?i=n.subscribeInternal(u):t(en());r=!0}return o(),function(){return i()}}).withDesc(new V("Bacon","repeat",[s]))}function Ut(n){return Et(n,"").filter(!1).withDesc(new V("Bacon","silence",[n]))}function Qt(n){return[un(n),en()]}var zt,Ht=(zt=function(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return E.isFunction(n)?t.length?function(r,e){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return r.apply(void 0,e.concat(n))}}(n,t):n:E.always(n)},function(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if("object"==typeof n&&t.length){var e=n,i=t[0];n=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e[i].apply(e,n)},t=t.slice(1)}return zt.apply(void 0,[n].concat(t))});function Rt(n,t){return Ht.apply(void 0,[n].concat(t))}var Yt=function(n){function t(){var t=n.call(this,new V("Bacon","Bus",[]),function(n){return t.subscribeAll(n)})||this;return t.pushing=!1,t.pushQueue=void 0,t.ended=!1,t.subscriptions=[],t.unsubAll=E.bind(t.unsubAll,t),t.subscriptions=[],t.ended=!1,t}return o(t,n),t.prototype.plug=function(n){var t=this;if(!this.ended){var r={input:n,unsub:void 0};return this.subscriptions.push(r),void 0!==this.sink&&this.subscribeInput(r),function(){return t.unsubscribeInput(n)}}},t.prototype.end=function(){if(this.ended=!0,this.unsubAll(),"function"==typeof this.sink)return this.sink(en())},t.prototype.push=function(n){if(!this.ended&&"function"==typeof this.sink){var t=!this.pushing;if(!t)return this.pushQueue||(this.pushQueue=[]),void this.pushQueue.push(n);this.pushing=!0;try{return this.sink(rn(n))}finally{if(t&&this.pushQueue){for(var r=0;r<this.pushQueue.length;){var e=this.pushQueue[r];this.sink(rn(e)),r++}this.pushQueue=void 0}this.pushing=!1}}},t.prototype.error=function(n){if("function"==typeof this.sink)return this.sink(new nn(n))},t.prototype.unsubAll=function(){for(var n,t=this.subscriptions,r=0;r<t.length;r++)"function"==typeof(n=t[r]).unsub&&n.unsub()},t.prototype.subscribeAll=function(n){if(this.ended)n(en());else{this.sink=n;for(var t,r=this.subscriptions.slice(),e=0;e<r.length;e++)t=r[e],this.subscribeInput(t)}return this.unsubAll},t.prototype.guardedSink=function(t){var r=this;return function(n){return n.isEnd?(r.unsubscribeInput(t),I):r.sink?r.sink(n):D}},t.prototype.subscribeInput=function(n){return n.unsub=n.input.subscribeInternal(this.guardedSink(n.input)),n.unsub},t.prototype.unsubscribeInput=function(n){for(var t,r=this.subscriptions,e=0;e<r.length;e++)if((t=r[e]).input===n)return"function"==typeof t.unsub&&t.unsub(),void this.subscriptions.splice(e,1)},t}(Tt);var Xt={asEventStream:function(t,r,n){var e=this;return E.isFunction(r)&&(n=r,r=void 0),$n(function(n){return e.on(t,r,n),function(){return e.off(t,r,n)}},n).withDesc(new V(this.selector||this,"asEventStream",[t]))},init:function(n){n.fn.asEventStream=Xt.asEventStream}};n.$=Xt,n.Bus=Yt,n.CompositeUnsubscribe=dn,n.Desc=V,n.End=Z,n.Error=nn,n.Event=X,n.EventStream=Tt,n.Initial=J,n.Next=G,n.Observable=xt,n.Property=Mt,n.Value=$,n._=E,n.combine=Rn,n.combineAsArray=Hn,n.combineTemplate=_t,n.combineWith=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var e=Qn(arguments),i=(n=e[0],t=e[1],new V("Bacon","combineWith",[t].concat(n)));return Hn(n).map(function(n){return t.apply(void 0,n)}).withDesc(i)},n.concatAll=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var r=jn(n);return(r.length?c(v(r),p(r).toEventStream(),function(n,t){return n.concat(t)}):Bn()).withDesc(new V("Bacon","concatAll",r))},n.constant=qn,n.fromArray=function(s){if(s.length){var c=0,f=new Tt(new V("Bacon","fromArray",[s]),function(r){var e=!1,i=D,u=!1,o=!1;return L.soonButNotYet(f,function n(){if(o=!0,!u){if(c===s.length)return r(en()),!1;for(u=!0;o;)if(o=!1,i!==I&&!e){var t=s[c++];(i=r(un(t)))!==I&&(c===s.length?r(en()):L.afterTransaction(f,n))}return u=!1}}),function(){return e=!0}});return f}return Bn().withDesc(new V("Bacon","fromArray",s))},n.fromBinder=$n,n.fromCallback=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return $n(function(n){return Rt(t,r)(n),a},function(n){return[n,en()]}).withDesc(new V("Bacon","fromCallback",[t].concat(r)))},n.fromESObservable=function(n){var r;r=n[Nt("observable")]?n[Nt("observable")]():n;var t=new V("Bacon","fromESObservable",[r]);return new Tt(t,function(t){var n=r.subscribe({error:function(n){t(new nn(n)),t(new Z)},next:function(n){t(new G(n))},complete:function(){t(new Z)}});return n.unsubscribe?function(){n.unsubscribe()}:n})},n.fromEvent=qt,n.fromEventTarget=qt,n.fromNodeCallback=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return $n(function(n){return Rt(t,r)(n),a},function(n,t){return n?[new nn(n),en()]:[t,en()]}).withDesc(new V("Bacon","fromNodeCallback",[t].concat(r)))},n.fromPoll=Gn,n.fromPromise=function(r,e,n){return void 0===n&&(n=Qt),$n(function(t){var n=r.then(t,function(n){return t(new nn(n))});return n&&"function"==typeof n.done&&n.done(),e?function(){if("function"==typeof r.abort)return r.abort()}:function(){}},n).withDesc(new V("Bacon","fromPromise",[r]))},n.getScheduler=function(){return A.scheduler},n.groupSimultaneous=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return zn(jn(n))},n.hasValue=fn,n.interval=Jn,n.isEnd=an,n.isError=cn,n.isEvent=on,n.isInitial=sn,n.isNext=function(n){return n.isNext},n.later=Et,n.mergeAll=gt,n.more=D,n.never=Bn,n.noMore=I,n.nullSink=j,n.nullVoidSink=U,n.onValues=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return Hn(n.slice(0,n.length-1)).onValues(n[arguments.length-1])},n.once=wn,n.repeat=jt,n.repeatedly=function(n,t){var r=0;return Gn(n,function(){return t[r++%t.length]}).withDesc(new V("Bacon","repeatedly",[n,t]))},n.retry=function(n){if(!E.isFunction(n.source))throw new Error("'source' option has to be a function");var i=n.source,u=n.retries||0,o=0,s=n.delay||function(){return 0},c=n.isRetryable||function(){return!0},f=!1,a=null;return jt(function(n){function t(){return i(n).endOnError().transform(function(n,t){return cn(n)?c((a=n).error)&&(0===u||o<u)?D:(f=!0,t(n)):(fn(n)&&(f=!(a=null)),t(n))})}if(!f){if(a){var r={error:a.error,retriesDone:o},e=Ut(s(r));return o++,e.concat(wn(null).flatMap(t))}return t()}}).withDesc(new V("Bacon","retry",[n]))},n.sequentially=function(n,t){var r=0;return Gn(n,function(){var n=t[r++];return r<t.length?n:r===t.length?[un(n),en()]:en()}).withDesc(new V("Bacon","sequentially",[n,t]))},n.setScheduler=function(n){A.scheduler=n},n.silence=Ut,n.spy=function(n){return ht.push(n)},n.try=function(t){return function(n){try{return wn(t(n))}catch(n){return wn(new nn(n))}}},n.update=function(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var e=Tn(t),i=0;i<e.length;i++){var u=e[i];u[1]=Lt(u[1])}return xn.apply(void 0,e).scan(n,function(n,t){return t(n)}).withDesc(new V("Bacon","update",[n].concat(t)))},n.version="3.0.13",n.when=xn,n.zipAsArray=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return xn([E.map(function(n){return n.toEventStream()},jn(n)),function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n}]).withDesc(new V("Bacon","zipAsArray",n))},n.zipWith=kt,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).Bacon={})}(this,function(t){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function u(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var e=Array(t),i=0;for(n=0;n<r;n++)for(var o=arguments[n],u=0,s=o.length;u<s;u++,i++)e[i]=o[u];return e}function a(){}var v=Array.isArray||function(t){return t instanceof Array};function d(t){return t&&t._isObservable}function y(t,n){for(var r=0;r<t.length;r++)if(!n(t[r]))return!1;return!0}function i(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return!0;return!1}function o(t,n){return-1!==w(t,n)}function b(t,n){for(var r,e=[],i=0;i<n.length;i++)t(r=n[i])&&e.push(r);return e}function s(r){return function(t,n){return r(n,t)}}function c(t,n,r){for(var e=0;e<t.length;e++)n=r(n,t[e]);return n}function f(t){return t[0]}var w=Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){for(var r=0;r<t.length;r++)if(n===t[r])return r;return-1};function h(t){return"function"==typeof t}function m(t,n){for(var r,e=[],i=0;i<n.length;i++)r=n[i],e.push(t(r));return e}function p(t){return t.slice(1,t.length)}function l(t){return v(t)?t:[t]}function g(n){return"function"==typeof n?n:function(t){return n}}var E={indexOf:w,indexWhere:function(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return r;return-1},head:f,always:function(t){return function(){return t}},negate:function(n){return function(t){return!n(t)}},empty:function(t){return 0===t.length},tail:p,filter:b,map:m,each:function(t,n){for(var r in t){if(Object.prototype.hasOwnProperty.call(t,r))n(r,t[r])}},toArray:l,contains:o,id:function(t){return t},last:function(t){return t[t.length-1]},all:y,any:i,without:function(n,t){return b(function(t){return t!==n},t)},remove:function(t,n){var r=w(n,t);if(0<=r)return n.splice(r,1)},fold:c,flatMap:function(r,t){return c(t,[],function(t,n){return t.concat(r(n))})},bind:function(t,n){return function(){return t.apply(n,arguments)}},isFunction:h,toFunction:g,toString:function t(n){var r={}.hasOwnProperty;try{if(S++,null==n)return"undefined";if(h(n))return"function";if(v(n))return 5<S?"[..]":"["+m(t,n).toString()+"]";if(null!=(null!=n?n.toString:void 0)&&n.toString!==Object.prototype.toString)return n.toString();if("object"!=typeof n)return n;if(5<S)return"{..}";var e=[];for(var i in n)if(r.call(n,i)){var o=function(){try{return n[i]}catch(t){return t}}();e.push(t(i)+":"+t(o))}return"{"+e+"}"}finally{S--}}},S=0,D=void 0,I="<no-more>",A={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()}}};var k=void 0,_=[],B={},x=[],M=0,W={},T=!1;function O(t){t<=M||(x[t-1]||(x[t-1]=[[],0]),M=t)}function P(t,n){if(!k&&!T)return n();O(1);for(var r=0;r<M-1&&!C(t,x[r][0]);)r++;x[r][0].push([t,n]),k||N()}function C(t,n){for(var r=0;r<n.length;r++)if(n[r][0].id==t.id)return 1}function N(){var t=M;if(t){var n=!T;T=!0;try{for(;t<=M;){var r=x[M-1];if(!r)throw new Error("Unexpected stack top: "+r);var e=r[0],i=r[1];if(!(i<e.length)){r[0]=[],r[1]=0;break}var o=e[i][1];r[1]++,O(M+1);var u=!1;try{for(o(),u=!0;t<M&&0==x[M-1][0].length;)M--}finally{u||(x=[],M=0)}}}finally{n&&(T=!1)}}}function r(t,n){if(k){var r=B[t.id];return void 0===r?(r=B[t.id]=[n],_.push(t)):r.push(n)}return n()}function F(t,n){var r=_[t],e=r.id,i=B[e];_.splice(t,1),delete B[e],n&&0<_.length&&function t(n){if(W[n.id])return;var r=n.internalDeps();for(var e,i=0;i<r.length;i++)if(e=r[i],t(e),B[e.id]){var o=E.indexOf(_,e);F(o,!1)}W[n.id]=!0}(r);for(var o=0;o<i.length;o++)(0,i[o])()}var L={toString:function(){return E.toString({rootEvent:k,processingAfters:T,waiterObs:_,waiters:B,aftersStack:x,aftersStackHeight:M,flushed:W})},whenDoneWith:r,hasWaiters:function(){return 0<_.length},inTransaction:function(t,n,r,e){if(k)return r.apply(n,e);k=t;try{var i=r.apply(n,e);!function(){for(;0<_.length;)F(0,!0);W={}}()}finally{k=void 0,N()}return i},currentEventId:function(){return k?k.id:void 0},wrappedSubscribe:function(n,t,r){function e(){i=!0,u()}var i=!1,o=!1,u=function(){o=!0};return u=t(function(t){return P(n,function(){i||r(t)===I&&e()}),D}),o&&u(),e},afterTransaction:P,soonButNotYet:function(t,n){k?r(t,n):A.scheduler.setTimeout(n,0)},isInTransaction:function(){return void 0!==k}},V=(q.prototype.deps=function(){return this.cachedDeps||(this.cachedDeps=U([this.context].concat(this.args))),this.cachedDeps},q.prototype.toString=function(){var t=E.map(E.toString,this.args);return E.toString(this.context)+"."+E.toString(this.method)+"("+t+")"},q);function q(t,n,r){void 0===r&&(r=[]),this._isDesc=!0,this.context=t,this.method=n,this.args=r}function j(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var i=t||n;return i&&i._isDesc?t||n:new V(t,n,r)}function U(t){return v(t)?E.flatMap(U,t):d(t)?[t]:null!=t&&t._isSource?[t.obs]:[]}function Q(){return D}function z(){return D}function H(t,n,r){return r.transform((c=t,function(t,n){var r=s(c,t),e=r[0],i=r[1];c=e;for(var o=D,u=0;u<i.length;u++)if((o=n(i[u]))===I)return o;return o}),new V(r,"withStateMachine",[t,s=n]));var s,c}var R=(Y.prototype.getOrElse=function(t){return this.value},Y.prototype.get=function(){return this.value},Y.prototype.filter=function(t){return t(this.value)?new Y(this.value):X},Y.prototype.map=function(t){return new Y(t(this.value))},Y.prototype.forEach=function(t){t(this.value)},Y.prototype.toArray=function(){return[this.value]},Y.prototype.inspect=function(){return"Some("+this.value+")"},Y.prototype.toString=function(){return this.inspect()},Y);function Y(t){this._isSome=!0,this.isDefined=!0,this.value=t}var X={_isNone:!0,getOrElse:function(t){return t},get:function(){throw new Error("None.get()")},filter:function(){return X},map:function(){return X},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}};var $=0,G=(J.prototype.filter=function(t){return!0},J.prototype.inspect=function(){return this.toString()},J.prototype.log=function(){return this.toString()},J.prototype.toNext=function(){return this},J);function J(){this.id=++$,this.isEvent=!0,this._isEvent=!0,this.isEnd=!1,this.isInitial=!1,this.isNext=!1,this.isError=!1,this.hasValue=!1}var K,Z=(n(tt,K=G),tt.prototype.fmap=function(t){return this.apply(t(this.value))},tt.prototype.filter=function(t){return t(this.value)},tt.prototype.toString=function(){return E.toString(this.value)},tt.prototype.log=function(){return this.value},tt);function tt(t){var n=K.call(this)||this;if(n.hasValue=!0,t instanceof G)throw new vt("Wrapping an event inside other event");return n.value=t,n}var nt,rt=(n(et,nt=Z),et.prototype.apply=function(t){return new et(t)},et);function et(t){var n=nt.call(this,t)||this;return n.isNext=!0,n._isNext=!0,n}var it,ot=(n(ut,it=Z),ut.prototype.apply=function(t){return new ut(t)},ut.prototype.toNext=function(){return new rt(this.value)},ut);function ut(t){var n=it.call(this,t)||this;return n.isInitial=!0,n._isInitial=!0,n}var st,ct=(n(ft,st=G),ft.prototype.fmap=function(t){return this},ft);function ft(){var t=null!==st&&st.apply(this,arguments)||this;return t.hasValue=!1,t}var at,ht=(n(pt,at=ct),pt.prototype.toString=function(){return"<end>"},pt);function pt(){var t=null!==at&&at.apply(this,arguments)||this;return t.isEnd=!0,t}var lt,vt=(n(dt,lt=ct),dt.prototype.toString=function(){return"<error> "+E.toString(this.error)},dt);function dt(t){var n=lt.call(this)||this;return n.isError=!0,n.error=t,n}function yt(t){return new ot(t)}function bt(t){return new rt(t)}function wt(){return new ht}function mt(t){return t&&t._isEvent?t:bt(t)}function gt(t){return t&&t._isEvent}function Et(t){return t&&t._isInitial}function St(t){return t.isError}function Dt(t){return t.hasValue}function It(t){return t.isEnd}function At(t,n){return t===n}function kt(t,e){void 0===e&&(e=At);var n=new V(t,"skipDuplicates",[]);return H(X,function(t,n){return Dt(n)?n.isInitial||null!=(r=t)&&r._isNone||!e(t.get(),n.value)?[new R(n.value),[n]]:[t,[]]:[t,[n]];var r},t).withDesc(n)}function _t(t,n,r){return n.transform(Bt(t),r||new V(n,"take",[t]))}function Bt(r){return function(t,n){return!t.hasValue||0<--r?n(t):(0===r&&n(t),n(wt()),I)}}function xt(n,t,u){var s,c=t,f=!1;return s=new fr(new V(n,"scan",[t,u]),function(r){function e(){return i||(i=f=!0,(o=r(new ot(c)))===I&&(t(),t=a)),o}var i=!1,t=a,o=D;return t=n.subscribeInternal(function(t){if(Dt(t)){if(f&&t.isInitial)return D;t.isInitial||e(),i=f=!0;var n=u(c,t.value);return c=n,r(t.apply(n))}return t.isEnd&&(o=e()),o!==I?r(t):o}),L.whenDoneWith(s,e),t})}var Mt=(Wt.prototype.add=function(t){var n=this;if(!this.unsubscribed){var r=!1,e=a;this.starting.push(t),e=t(this.unsubscribe,function(){n.unsubscribed||(r=!0,n.remove(e),E.remove(t,n.starting))}),this.unsubscribed||r?e():this.subscriptions.push(e),E.remove(t,this.starting)}},Wt.prototype.remove=function(t){if(!this.unsubscribed)return void 0!==E.remove(t,this.subscriptions)?t():void 0},Wt.prototype.unsubscribe=function(){if(!this.unsubscribed){this.unsubscribed=!0;for(var t=this.subscriptions,n=0;n<t.length;n++)t[n]();this.subscriptions=[],this.starting=[]}},Wt.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},Wt.prototype.empty=function(){return 0===this.count()},Wt);function Wt(t){void 0===t&&(t=[]),this.unsubscribed=!1,this.unsubscribe=E.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 Tt(s,t){return function(n){function r(){if(!e)return s.forEach(function(t){if(e=!0,(u=n(new ot(t)))===I)return o(),o=a})}var e=!1,i=!1,o=a,u=D;return o=t(function(t){return t instanceof Z?t.isInitial&&!i?(s=new R(t.value),D):(t.isInitial||r(),e=!0,s=new R(t.value),n(t)):(t.isEnd&&(u=r()),u!==I?n(t):u)}),i=!0,r(),o}}function Ot(t,n){return new fr(t,Tt(X,n))}function Pt(n){var r=new vr(new V("Bacon","once",[n]),function(t){return L.soonButNotYet(r,function(){t(mt(n)),t(wt())}),a});return r}function Ct(n,t,e){void 0===e&&(e={});var i=t,r=[i],a=[],h=t._isProperty,p=!1,o=(h?Ot:br)(e.desc||new V(t,"flatMap_",[n]),function(u){var r=new Mt,s=[];function c(t){if(h&&t.isInitial){if(p)return D;p=!0}var o=Ft(n(t));return a.push(o),r.add(function(e,i){return o.subscribeInternal(function(t){if(t.isEnd)return E.remove(o,a),(n=s.shift())&&c(n),f(i),I;t=t.toNext();var n,r=u(t);return r===I&&e(),r})})}function f(t){return t(),r.empty()?u(wt()):D}return r.add(function(t,n){return i.subscribeInternal(function(t){return t.isEnd?f(n):t.isError&&!e.mapError?u(t):e.firstOnly&&1<r.count()?D:r.unsubscribed?I:(e.limit&&r.count()>e.limit?s.push(t):c(t),D)})}),r.unsubscribe});return o.internalDeps=function(){return a.length?r.concat(a):r},o}function Nt(n){return"function"==typeof n?function(t){return Dt(t)?n(t.value):t}:function(t){return n}}function Ft(t){return d(t)?t:Pt(t)}function Lt(t,n){return Ct(n,t,{mapError:!0,desc:new V(t,"flatMapEvent",[n])})}var Vt=(qt.prototype.subscribe=function(t){return this.obs.subscribeInternal(t)},qt.prototype.toString=function(){return this.obs.toString()},qt.prototype.markEnded=function(){this.ended=!0},qt.prototype.mayHave=function(t){return!0},qt);function qt(t,n){this._isSource=!0,this.flatten=!0,this.ended=!1,this.obs=t,this.sync=n}var jt,Ut=(n(Qt,jt=Vt),Qt.prototype.consume=function(){return this.value},Qt.prototype.push=function(t){this.value=t},Qt.prototype.hasAtLeast=function(t){return!!this.value},Qt);function Qt(){return null!==jt&&jt.apply(this,arguments)||this}var zt,Ht=(n(Rt,zt=Vt),Rt.prototype.consume=function(){return this.queue.shift()},Rt.prototype.push=function(t){this.queue.push(t)},Rt.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},Rt.prototype.hasAtLeast=function(t){return this.queue.length>=t},Rt);function Rt(t,n){var r=zt.call(this,t,n)||this;return r.flatten=!1,r.queue=[],r}var Yt,Xt=(n($t,Yt=Vt),$t.prototype.consume=function(){var t=this.queue;return this.queue=[],{value:t}},$t.prototype.push=function(t){return this.queue.push(t.value)},$t.prototype.hasAtLeast=function(t){return!0},$t);function $t(t){var n=Yt.call(this,t,!0)||this;return n.queue=[],n}function Gt(t){return null!=t&&t._isSource?t:null!=t&&t._isProperty?new Ut(t,!1):new Ht(t,!0)}function Jt(){return new vr(j("Bacon","never"),function(t){return t(wt()),a})}function Kt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return tn(yr,t)}function Zt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return tn(Ot,t)}function tn(t,n){if(0===n.length)return Jt();var r=function(t){for(var n=[],r=[],e=0;e<t.length;e++){for(var i,o=t[e],u=o[0],s={f:o[1],ixs:[]},c=!1,f=0;f<u.length;f++){i=u[f];var a=w(n,i);c=c||null!=(l=i)&&(l._isSource?l.sync:l._isEventStream),a<0&&(n.push(i),a=n.length-1);for(var h=0;h<s.ixs.length;h++){var p=s.ixs[h];p.index===a&&p.count++}s.ixs.push({index:a,count:1})}if(0<u.length&&!c)throw new Error("At least one EventStream required, none found in "+u);0<u.length&&r.push(s)}var l;return[m(Gt,n),r]}(rn(n)),l=r[0],v=r[1];if(!l.length)return Jt();var c=i(l,function(t){return t.flatten})&&function(t,e){void 0===e&&(e=[]);return i(t,function t(n){if(o(e,n))return!0;var r=n.internalDeps();return r.length?(e.push(n),i(r,t)):(e.push(n),!1)})}(m(function(t){return t.obs},l)),d=t(new V("Bacon","when",Array.prototype.slice.call(n)),function(f){var a=[],s=!1;function h(t){for(var n=0;n<t.ixs.length;n++){var r=t.ixs[n];if(!l[r.index].hasAtLeast(r.count))return}return 1}function n(t){for(var n=0;n<t.ixs.length;n++){var r=t.ixs[n];if(!l[r.index].mayHave(r.count))return!0}return!1}function p(t){return!t.source.flatten}return new Mt(m(function(u){return function(e){function i(){return L.whenDoneWith(d,o)}function o(){var t=function t(){var n;if(void 0!==(n=a.pop()))for(var r,e=D,i=0;i<v.length;i++)if(h(r=v[i])){for(var o=[],u=0;u<r.ixs.length;u++){var s=l[r.ixs[u].index].consume();if(!s)throw new Error("Event was undefined");o.push(s.value)}var c=r.f.apply(null,o);return e=f(n.e.apply(c)),a.length&&(a=b(p,a)),e===I?e:t()}return D}();s&&(y(l,en)||y(v,n))&&(t=I,f(wt())),t===I&&e()}return u.subscribe(function(t){var n=D;if(t.isEnd)s=!0,u.markEnded(),i();else if(t.isError)n=f(t);else{var r=t;u.push(r),u.sync&&(a.push({source:u,e:r}),(c||L.hasWaiters()?i:o)())}return n===I&&e(),n})}},l)).unsubscribe});return d}function nn(t){for(var n=0,r=t.length,e=[];n<r;){var i=l(t[n++]),o=g(t[n++]);e.push([i,o])}return e}function rn(t){for(var n,r=[],e=0;e<t.length;e++){var i=t[e];if(!((n=i)instanceof Array)||d(n[n.length-1]))return nn(t);if(i[0]instanceof Array)r.push([i[0],g(i[1])]);else{var o=i.slice(0,i.length-1),u=g(i[i.length-1]);r.push([o,u])}}return r}function en(t){return!t.sync||t.ended}function on(t,n,r){return Kt([new Ut(n.toProperty(),!1),new Ut(t,!0),s(r)]).withDesc(new V(t,"withLatestFrom",[n,r]))}function un(t,n,r){return Zt([new Ut(n.toProperty(),!1),new Ut(t,!0),s(r)]).withDesc(new V(t,"withLatestFrom",[n,r]))}function sn(t,n,r){if(t instanceof fr)return un(t,n,r);if(t instanceof vr)return on(t,n,r);throw new Error("Unknown observable: "+t)}function cn(t,n){return n instanceof fr?sn(t,n,function(t,n){return n}):t.transform(fn(n),new V(t,"map",[n]))}function fn(t){var r=E.toFunction(t);return function(t,n){return n(t.fmap(r))}}function an(n){return new fr(new V("Bacon","constant",[n]),function(t){return t(yt(n)),t(wt()),a})}function hn(t){return t=Array.prototype.slice.call(t),E.flatMap(pn,t)}function pn(t){return d(t)?[t]:v(t)?hn(t):[an(t)]}function ln(t){return E.isFunction(t[0])?[hn(Array.prototype.slice.call(t,1)),t[0]]:[hn(Array.prototype.slice.call(t,0,t.length-1)),E.last(t)]}function vn(t,r){return tn(function(t,n){return new vr(t,n,void 0,r)},[E.map(function(t){return new Xt(t)},t),function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","groupSimultaneous",t))}function dn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if((t=hn(t)).length){for(var r=[],e=0;e<t.length;e++){var i=d(t[e])?t[e]:an(t[e]);r.push(mn(i))}return Zt([r,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","combineAsArray",t))}return an([])}function yn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=ln(arguments),e=r[0],i=r[1],o=new V("Bacon","combineWith",u([i],e));return dn(e).map(function(t){return i.apply(void 0,t)}).withDesc(o)}var bn=yn;function wn(t,n,r){return Zt([[mn(t),mn(n)],r]).withDesc(new V(t,"combine",[n,r]))}function mn(t){return new Ut(t,!0)}function gn(t,n){return Ct(Nt(n),t,{desc:new V(t,"flatMapConcat",[n]),limit:1})}function En(e,f){void 0===f&&(f=E.id);var t=new V("Bacon","fromBinder",[e,f]);return new vr(t,function(s){function c(){if(!t)return null!=r?(r(),t=!0):n=!0}var t=!1,n=!1,r=e(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=f.apply(void 0,t),e=v(r)&>(E.last(r))?r:[r],i=D,o=0;o<e.length;o++){var u=mt(e[o]);if((i=s(u))===I||u.isEnd)return c(),i}return i});return n&&c(),c})}function Sn(r,t){var n=new V("Bacon","fromPoll",[r,t]);return En(function(t){var n=A.scheduler.setInterval(t,r);return function(){return A.scheduler.clearInterval(n)}},t).withDesc(n)}function Dn(t,n){return Sn(t,function(){return bt(n)}).withDesc(new V("Bacon","interval",[t,n]))}function In(t,n,r){return t instanceof vr?(i=n,o=r,An((e=t).toProperty(),i,o).withDesc(new V(e,"sampledBy",[i]))):An(t,n,r);var e,i,o}function An(t,n,r){var e;return sn(n,t,s("function"==typeof(e=r)?e:E.id)).withDesc(new V(t,"sampledBy",[n]))}function kn(t,r,n){return new fr(new V(t,"transform",[r]),function(n){return t.subscribeInternal(function(t){return r(t,n)})}).withDesc(n)}function _n(r,n){function e(t){return n(t,i)}var i;return function(t,n){return i=n,r(t,e)}}function Bn(t,n,r,e){return n instanceof fr?sn(t,n,function(t,n){return[t,n]}).transform(_n(r(function(t){return t[1]}),fn(function(t){return t[0]})),e):t.transform(r(function(t){if("boolean"==typeof t)return E.always(t);if("function"!=typeof t)throw new Error("Not a function: "+t);return t}(n)),e)}function xn(r){return function(t,n){return t.filter(r)?n(t):D}}function Mn(t){return t.map(function(t){return!t}).withDesc(new V(t,"not",[]))}function Wn(t){return hr(t)?t:an(t)}function Tn(t,n){return Ct(Nt(n),t,{firstOnly:!0,desc:new V(t,"flatMapFirst",[n])})}function On(t,n,r){return t.scan(n,r).last().withDesc(new V(t,"fold",[n,r]))}var Pn={};function Cn(t,n){return Ct(Nt(n),t,{desc:new V(t,"flatMap",[n])})}function Nn(t,r){return Ct(function(t){if(t instanceof vt){var n=t.error;return r(n)}return t},t,{mapError:!0,desc:new V(t,"flatMapError",[r])})}var Fn=[],Ln=!1;function Vn(n){if(Fn.length&&!Ln)try{Ln=!0,Fn.forEach(function(t){t(n)})}finally{Ln=!1}}function qn(t,n){var r=E.toFunction(n),e=hr(t)?t.toEventStream(lr):t,i=Cn(e,function(t){return Ft(r(t)).takeUntil(e)});return hr(t)&&(i=i.toProperty()),i.withDesc(new V(t,"flatMapLatest",[r]))}var jn=(Un.prototype.hasSubscribers=function(){return 0<this.subscriptions.length},Un.prototype.removeSub=function(t){return this.subscriptions=E.without(t,this.subscriptions),this.subscriptions},Un.prototype.push=function(t){return t.isEnd&&(this.ended=!0),L.inTransaction(t,this,this.pushIt,[t])},Un.prototype.pushToSubscriptions=function(t){try{for(var n=this.subscriptions,r=n.length,e=0;e<r;e++){var i=n[e];i.sink(t)!==I&&!t.isEnd||this.removeSub(i)}return!0}catch(t){throw this.pushing=!1,this.queue=[],t}},Un.prototype.pushIt=function(t){if(this.pushing)return this.queue.push(t),D;if(t!==this.prevError){for(t.isError&&(this.prevError=t),this.pushing=!0,this.pushToSubscriptions(t),this.pushing=!1;;){var n=this.queue.shift();if(!n)break;this.push(n)}return this.hasSubscribers()?D:(this.unsubscribeFromSource(),I)}},Un.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},Un.prototype.unsubscribeFromSource=function(){this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},Un.prototype.subscribe=function(t){var n=this;if(this.ended)return t(wt()),a;var r={sink:t};return this.subscriptions.push(r),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(){if(n.removeSub(r),!n.hasSubscribers())return n.unsubscribeFromSource()}},Un.prototype.inspect=function(){return this.observable.toString()},Un);function Un(t,n,r){this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0,this._subscribe=n,this._handleEvent=r,this.subscribe=E.bind(this.subscribe,this),this.handleEvent=E.bind(this.handleEvent,this),this.subscriptions=[],this.observable=t,this.queue=[]}var Qn,zn=(n(Hn,Qn=jn),Hn.prototype.push=function(t){return t.isEnd&&(this.propertyEnded=!0),t instanceof Z?(this.current=new R(t),this.currentValueRootId=L.currentEventId()):t.hasValue&&console.error("Unknown event, two Bacons loaded?",t.constructor),Qn.prototype.push.call(this,t)},Hn.prototype.maybeSubSource=function(t,n){return n===I?a:this.propertyEnded?(t(wt()),a):Qn.prototype.subscribe.call(this,t)},Hn.prototype.subscribe=function(t){var n=this,r=D;if(this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)){var e=L.currentEventId(),i=this.currentValueRootId;return!this.propertyEnded&&i&&e&&e!==i?L.whenDoneWith(this.observable,function(){if(n.currentValueRootId===i)return t(yt(n.current.get().value))}):L.inTransaction(void 0,this,function(){return r=t(yt(n.current.get().value))},[]),this.maybeSubSource(t,r)}return this.maybeSubSource(t,r)},Hn.prototype.inspect=function(){return this.observable+" current= "+this.current},Hn);function Hn(t,n,r){var e=Qn.call(this,t,n,r)||this;return e.current=X,e.propertyEnded=!1,e.subscribe=E.bind(e.subscribe,e),e}function Rn(t,n,r){return Ct(Nt(r),t,{desc:new V(t,"flatMapWithConcurrencyLimit",[n,r]),limit:n})}function Yn(t,n,r){var e=function(t){if(void 0===t)return;if("number"!=typeof t)return t;var n=t;return function(t){return A.scheduler.setTimeout(t,n)}}(n);function i(t){return t.values.length===r?t.flush():void 0!==e?t.schedule(e):void 0}var o=new V(t,"bufferWithTimeOrCount",[n,r]);return function(t,r,n){void 0===r&&(r=a);void 0===n&&(n=a);var e=D,i=new Xn(n,r);return t.transform(function(t,n){return i.push=n,Dt(t)?(i.values.push(t.value),r(i)):St(t)?e=n(t):It(t)&&(i.end=t,i.scheduled||i.flush()),e}).withDesc(new V(t,"buffer",[]))}(t,i,i).withDesc(o)}var Xn=($n.prototype.flush=function(){if(this.scheduled&&(A.scheduler.clearTimeout(this.scheduled),this.scheduled=null),0<this.values.length){var t=this.values;this.values=[];var n=this.push(bt(t));if(null!=this.end)return this.push(this.end);if(n!==I)return this.onFlush(this)}else if(null!=this.end)return this.push(this.end)},$n.prototype.schedule=function(t){var n=this;if(!this.scheduled)return this.scheduled=t(function(){return n.flush()})},$n);function $n(t,n){this.push=function(t){return D},this.scheduled=null,this.end=void 0,this.values=[],this.onFlush=t,this.onInput=n}function Gn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=hn(t);return o.length?new vr(new V("Bacon","mergeAll",o),function(e){var i=0,t=m(function(t){return function(r){return t.subscribeInternal(function(t){if(t.isEnd)return++i===o.length?e(wt()):D;t=t.toNext();var n=e(t);return n===I&&r(),n})}},o);return new Mt(t).unsubscribe}):Jt()}function Jn(r,e){return En(function(t){var n=A.scheduler.setTimeout(function(){return t([mt(e),wt()])},r);return function(){return A.scheduler.clearTimeout(n)}}).withDesc(new V("Bacon","later",[r,e]))}function Kn(r){return function(t,n){return t.filter(r)?n(t):(n(wt()),I)}}function Zn(r){var e=!1;return function(t,n){return!e&&Dt(t)&&r(t.value)?D:(t.hasValue&&(e=!0),n(t))}}function tr(o,u,s){void 0===s&&(s=E.id);var c={};return o.transform(_n(xn(function(t){return!c[u(t)]}),fn(function(t){var e=u(t),n=o.changes().filter(function(t){return u(t)===e}),r=Pt(t).concat(n),i=s(r,t).toEventStream().transform(function(t,n){var r=n(t);return t.isEnd&&delete c[e],r});return c[e]=i})))}var nr={};function rr(e,s){var c=!1,f=[],a=!1;return new vr(new V(e,"holdWhen",[s]),function(o){function u(t){return t&&t(),n.empty()&&r?o(wt()):D}var n=new Mt,r=!1;return n.add(function(t,i){return s.subscribeInternal(function(t){if(Dt(t)){c=t.value;var n=D;if(!c){var r=f;f=[];for(var e=0;e<r.length;e++)n=o(bt(r[e]));a&&(o(wt()),i(),n=I)}return n}return t.isEnd?u(i):o(t)})}),n.add(function(t,n){return e.subscribeInternal(function(t){return c&&Dt(t)?(f.push(t.value),D):t.isEnd&&f.length?(a=!0,u(n)):o(t)})}),r=!0,u(),n.unsubscribe})}function er(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var e=ln(arguments);n=e[0],t=e[1];return Kt([n=E.map(function(t){return t.toEventStream()},n),t]).withDesc(new V("Bacon","zipWith",[t].concat(n)))}function ir(i){function c(t,n,r){var e;return(e=t)[e.length-1][n]=r}function f(t){return v(t)?[]:{}}function a(t){if(d(t))return 1;if(t&&(t.constructor==Object||t.constructor==Array))for(var n in t){if(Object.prototype.hasOwnProperty.call(t,n))if(a(t[n]))return 1}}function n(t,n){if(d(n))l.push(n),p.push((u=t,s=l.length-1,function(t,n){c(t,u,n[s])}));else if(a(n)){p.push((i=t,o=n,function(t){var n=f(o);c(t,i,n),t.push(n)})),h(n),p.push(function(t){t.pop()})}else p.push((r=t,e=n,function(t){c(t,r,e)}));var r,e,i,o,u,s}function h(t){E.each(t,n)}var p=[],l=[];return(a(i)?(h(i),dn(l).map(function(t){for(var n=f(i),r=[n],e=0;e<p.length;e++)(0,p[e])(r,t);return n})):an(i)).withDesc(new V("Bacon","combineTemplate",[i]))}var or=0,ur=(sr.prototype.awaiting=function(t){return vn([n=this,r=t],lr).map(function(t){return 0===t[1].length}).toProperty(!1).skipDuplicates().withDesc(new V(n,"awaiting",[r]));var n,r},sr.prototype.bufferingThrottle=function(t){return e=new V(n=this,"bufferingThrottle",[r=t]),n.transformChanges(e,function(t){return t.flatMapConcat(function(t){return Pt(t).concat(Jn(r,t).errors())})});var n,r,e},sr.prototype.combine=function(t,n){return wn(this,t,n).withDesc(new V(this,"combine",[t,n]))},sr.prototype.debounce=function(t){return r=t,(n=this).transformChanges(new V(n,"debounce",[r]),function(t){return t.flatMapLatest(function(t){return Jn(r,t)})});var n,r},sr.prototype.debounceImmediate=function(t){return r=t,(n=this).transformChanges(new V(n,"debounceImmediate",[r]),function(t){return t.flatMapFirst(function(t){return Pt(t).concat(Jn(r,t).errors())})});var n,r},sr.prototype.decode=function(t){return r=t,(n=this).combine(ir(r),function(t,n){return n[t]}).withDesc(new V(n,"decode",[r]));var n,r},sr.prototype.delay=function(t){return r=t,(n=this).transformChanges(new V(n,"delay",[r]),function(t){return t.flatMap(function(t){return Jn(r,t)})});var n,r},sr.prototype.deps=function(){return this.desc.deps()},sr.prototype.diff=function(t,n){return i=n,kn(xt(r=this,[e=t,nr],function(t,n){return[n,i(t[0],n)]}),_n(xn(function(t){return t[1]!==nr}),fn(function(t){return t[1]})),new V(r,"diff",[e,i]));var r,e,i},sr.prototype.doAction=function(t){return this.transform(function(t,n){return Dt(t)&&r(t.value),n(t)},new V(this,"doAction",[r=t]));var r},sr.prototype.doEnd=function(t){return this.transform(function(t,n){return It(t)&&r(),n(t)},new V(this,"doEnd",[r=t]));var r},sr.prototype.doError=function(t){return this.transform(function(t,n){return St(t)&&r(t.error),n(t)},new V(this,"doError",[r=t]));var r},sr.prototype.doLog=function(){for(var r,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.transform(function(t,n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,r.concat([t.log()])),n(t)},new V(this,"doLog",r=t))},sr.prototype.endAsValue=function(){return this.transform(function(t,n){return It(t)?(n(bt({})),n(wt()),I):D})},sr.prototype.endOnError=function(t){return void 0===t&&(t=function(t){return!0}),void 0===(r=t)&&(r=function(t){return!0}),(n=this).transform(function(t,n){return St(t)&&r(t.error)?(n(t),n(wt())):n(t)},new V(n,"endOnError",[]));var n,r},sr.prototype.errors=function(){return this.filter(function(t){return!1}).withDesc(new V(this,"errors"))},sr.prototype.filter=function(t){return Bn(n=this,r=t,xn,new V(n,"filter",[r]));var n,r},sr.prototype.first=function(){return _t(1,this,new V(this,"first"))},sr.prototype.firstToPromise=function(t){return function(t,n){if("function"!=typeof n){if("function"!=typeof Promise)throw new Error("There isn't default Promise, use shim or parameter");n=function(t){return new Promise(t)}}return new n(function(n,r){return t.subscribe(function(t){return Dt(t)&&n(t.value),St(t)&&r(t.error),I})})}(this,t)},sr.prototype.fold=function(t,n){return On(this,t,n)},sr.prototype.forEach=function(t){return void 0===t&&(t=Q),this.onValue(t)},sr.prototype.holdWhen=function(t){return rr(this,t)},sr.prototype.inspect=function(){return this.toString()},sr.prototype.internalDeps=function(){return this.initialDesc.deps()},sr.prototype.last=function(){return(t=this).transform(function(t,n){return It(t)?(r&&n(r),n(wt()),I):Dt(t)?(r=t,D):n(t)}).withDesc(new V(t,"last",[]));var t,r},sr.prototype.log=function(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n=t,this.subscribe(function(t){return"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()])),D}),this},sr.prototype.mapEnd=function(t){return this.transform((n=t,r=E.toFunction(n),function(t,n){return It(t)?(n(bt(r(t))),n(wt()),I):n(t)}),new V(this,"mapEnd",[t]));var n,r},sr.prototype.mapError=function(t){return this.transform((n=t,r=E.toFunction(n),function(t,n){return St(t)?n(bt(r(t.error))):n(t)}),new V(this,"mapError",[t]));var n,r},sr.prototype.name=function(t){return this._name=t,this},sr.prototype.onEnd=function(n){return void 0===n&&(n=z),this.subscribe(function(t){return t.isEnd?n():D})},sr.prototype.onError=function(n){return void 0===n&&(n=Q),this.subscribe(function(t){return St(t)?n(t.error):D})},sr.prototype.onValue=function(n){return void 0===n&&(n=Q),this.subscribe(function(t){return Dt(t)?n(t.value):D})},sr.prototype.onValues=function(n){return this.onValue(function(t){return n.apply(void 0,t)})},sr.prototype.reduce=function(t,n){return On(this,t,n)},sr.prototype.sampledBy=function(t){return In(this,t,arguments[1])},sr.prototype.scan=function(t,n){return xt(this,t,n)},sr.prototype.skip=function(t){return r=t,(n=this).transform(function(t,n){return t.hasValue&&0<r?(r--,D):n(t)},new V(n,"skip",[r]));var n,r},sr.prototype.skipDuplicates=function(t){return kt(this,t)},sr.prototype.skipErrors=function(){return(t=this).transform(function(t,n){return St(t)?D:n(t)},new V(t,"skipErrors",[]));var t},sr.prototype.skipUntil=function(t){return n=this,e=(r=t).transform(_n(Bt(1),fn(!0))).toProperty().startWith(!1),n.filter(e).withDesc(new V(n,"skipUntil",[r]));var n,r,e},sr.prototype.skipWhile=function(t){return Bn(n=this,r=t,Zn,new V(n,"skipWhile",[r]));var n,r},sr.prototype.slidingWindow=function(t,n){return void 0===n&&(n=0),e=t,void 0===(i=n)&&(i=0),(r=this).scan([],function(t,n){return t.concat([n]).slice(-e)}).filter(function(t){return t.length>=i}).withDesc(new V(r,"slidingWindow",[e,i]));var r,e,i},sr.prototype.subscribe=function(t){var n=this;return void 0===t&&(t=Q),L.wrappedSubscribe(this,function(t){return n.subscribeInternal(t)},t)},sr.prototype.take=function(t){return _t(t,this)},sr.prototype.takeUntil=function(t){return r=t,e=vn([(n=this).mapEnd(Pn),r.skipErrors()],lr),n instanceof fr&&(e=e.toProperty()),e.transform(function(t,n){if(Dt(t)){var r=t.value,e=r[0];if(r[1].length)return n(wt());for(var i=D,o=0;o<e.length;o++){var u=e[o];if(u===Pn)return n(wt());i=n(bt(u))}return i}return n(t)},new V(n,"takeUntil",[r]));var n,r,e},sr.prototype.takeWhile=function(t){return Bn(n=this,r=t,Kn,new V(n,"takeWhile",[r]));var n,r},sr.prototype.throttle=function(t){return r=t,(n=this).transformChanges(new V(n,"throttle",[r]),function(t){return t.bufferWithTime(r).map(function(t){return t[t.length-1]})});var n,r},sr.prototype.toPromise=function(t){return n=t,this.last().firstToPromise(n);var n},sr.prototype.toString=function(){return this._name?this._name:this.desc.toString()},sr.prototype.withDesc=function(t){return t&&(this.desc=t),this},sr.prototype.withDescription=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return this.desc=j.apply(void 0,u([t,n],r)),this},sr.prototype.zip=function(t,n){return r=this,e=t,er(n||Array,r,e).withDesc(new V(r,"zip",[e]));var r,e},sr);function sr(t){this.id=++or,this._isObservable=!0,this.desc=t,this.initialDesc=t}var cr,fr=(n(ar,cr=ur),ar.prototype.and=function(t){return r=t,(n=this).combine(Wn(r),function(t,n){return!(!t||!n)}).withDesc(new V(n,"and",[r]));var n,r},ar.prototype.changes=function(){var t=this;return new vr(new V(this,"changes",[]),function(n){return t.dispatcher.subscribe(function(t){return t.isInitial?D:n(t)})})},ar.prototype.concat=function(n){return this.transformChanges(j(this,"concat",n),function(t){return t.concat(n)})},ar.prototype.transformChanges=function(t,n){return e=t,u=n(new vr(j(r=this,"changes",[]),function(n){return r.dispatcher.subscribe(function(t){return!i&&Et(t)&&(i=t,L.whenDoneWith(s,function(){if(!o)throw new Error("Init sequence fail");o(i)})),t.isInitial?D:n(t)})},void 0,lr)),s=Ot(e,function(n){return o=n,u.dispatcher.subscribe(function(t){n(t)})});var r,e,i,o,u,s},ar.prototype.flatMap=function(t){return Cn(this,t)},ar.prototype.flatMapConcat=function(t){return gn(this,t)},ar.prototype.flatMapError=function(t){return Nn(this,t)},ar.prototype.flatMapEvent=function(t){return Lt(this,t)},ar.prototype.flatMapFirst=function(t){return Tn(this,t)},ar.prototype.flatMapLatest=function(t){return qn(this,t)},ar.prototype.flatMapWithConcurrencyLimit=function(t,n){return Rn(this,t,n)},ar.prototype.groupBy=function(t,n){return tr(this,t,n)},ar.prototype.map=function(t){return cn(this,t)},ar.prototype.not=function(){return Mn(this)},ar.prototype.or=function(t){return r=t,(n=this).combine(Wn(r),function(t,n){return t||n}).withDesc(new V(n,"or",[r]));var n,r},ar.prototype.sample=function(t){return An(n=this,Dn(r=t,{}),function(t,n){return t}).withDesc(new V(n,"sample",[r]));var n,r},ar.prototype.startWith=function(t){return r=t,(n=this).scan(r,function(t,n){return n}).withDesc(new V(n,"startWith",[r]));var n,r},ar.prototype.subscribeInternal=function(t){return void 0===t&&(t=Q),this.dispatcher.subscribe(t)},ar.prototype.toEventStream=function(t){var r=this;return new vr(new V(this,"toEventStream",[]),function(n){return r.subscribeInternal(function(t){return n(t.toNext())})},void 0,t)},ar.prototype.toProperty=function(){return this},ar.prototype.transform=function(t,n){return kn(this,t,n)},ar.prototype.withLatestFrom=function(t,n){return un(this,t,n)},ar.prototype.withStateMachine=function(t,n){return H(t,n,this)},ar);function ar(t,n,r){var e=cr.call(this,t)||this;return e._isProperty=!0,e.dispatcher=new zn(e,n,r),Vn(e),e}function hr(t){return t._isProperty}var pr,lr={forceAsync:!1},vr=(n(dr,pr=ur),dr.prototype.bufferWithTime=function(t){return Yn(n=this,r=t,Number.MAX_VALUE).withDesc(new V(n,"bufferWithTime",[r]));var n,r},dr.prototype.bufferWithCount=function(t){return Yn(n=this,void 0,r=t).withDesc(new V(n,"bufferWithCount",[r]));var n,r},dr.prototype.bufferWithTimeOrCount=function(t,n){return Yn(this,t,n)},dr.prototype.changes=function(){return this},dr.prototype.concat=function(t,n){return r=n,new vr(new V(e=this,"concat",[i=t]),function(n){var r=a,t=e.dispatcher.subscribe(function(t){return t.isEnd?(r=i.toEventStream().dispatcher.subscribe(n),D):n(t)});return function(){return t(),r()}},void 0,r);var e,i,r},dr.prototype.transformChanges=function(t,n){return n(this).withDesc(t)},dr.prototype.flatMap=function(t){return Cn(this,t)},dr.prototype.flatMapConcat=function(t){return gn(this,t)},dr.prototype.flatMapError=function(t){return Nn(this,t)},dr.prototype.flatMapFirst=function(t){return Tn(this,t)},dr.prototype.flatMapLatest=function(t){return qn(this,t)},dr.prototype.flatMapWithConcurrencyLimit=function(t,n){return Rn(this,t,n)},dr.prototype.flatMapEvent=function(t){return Lt(this,t)},dr.prototype.flatScan=function(t,n){return i=n,o=e=t,(r=this).flatMapConcat(function(t){return Ft(i(o,t)).doAction(function(t){return o=t})}).toProperty().startWith(e).withDesc(new V(r,"flatScan",[e,i]));var r,e,i,o},dr.prototype.groupBy=function(t,n){return tr(this,t,n)},dr.prototype.map=function(t){return cn(this,t)},dr.prototype.merge=function(t){return Gn(this,t).withDesc(new V(this,"merge",[t]))},dr.prototype.not=function(){return Mn(this)},dr.prototype.startWith=function(t){return n=this,Pt(r=t).concat(n).withDesc(new V(n,"startWith",[r]));var n,r},dr.prototype.subscribeInternal=function(t){return void 0===t&&(t=Q),this.dispatcher.subscribe(t)},dr.prototype.toEventStream=function(){return this},dr.prototype.toProperty=function(t){var n,r=arguments.length?(n=t)&&(n._isSome||n._isNone)?n:new R(n):X,e=this.dispatcher,i=new V(this,"toProperty",Array.prototype.slice.apply(arguments)),o=e.subscribe;return new fr(i,Tt(r,o))},dr.prototype.transform=function(t,n){return i=n,new vr(new V(r=this,"transform",[e=t]),function(n){return r.subscribeInternal(function(t){return e(t,n)})},void 0,lr).withDesc(i);var r,e,i},dr.prototype.withLatestFrom=function(t,n){return on(this,t,n)},dr.prototype.withStateMachine=function(t,n){return H(t,n,this)},dr);function dr(t,n,r,e){var o,u,s,i=pr.call(this,t)||this;return i._isEventStream=!0,e!==lr&&(o=i,u=n,s=!1,n=function(r){var e,n=L.isInTransaction();function i(){var t=e||[];e=void 0;for(var n=0;n<t.length;n++)r(t[n])}s=!0;try{return u(function(t){return s||e?(e?e.push(t):(e=[t],n?L.soonButNotYet(o,i):A.scheduler.setTimeout(i,0)),D):r(t)})}finally{s=!1}}),i.dispatcher=new jn(i,n,r),Vn(i),i}function yr(t,n){return new vr(t,n)}function br(t,n){return new vr(t,n,void 0,lr)}function wr(t){return"undefined"!=typeof Symbol&&Symbol[t]?Symbol[t]:"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol[t]=Symbol.for(t):"@@"+t}var mr=(gr.prototype.subscribe=function(t,n,r){var e="function"==typeof t?{next:t,error:n,complete:r}:t,i={closed:!1,unsubscribe:function(){i.closed=!0,o()}},o=this.observable.subscribe(function(t){Dt(t)&&e.next?e.next(t.value):St(t)?(e.error&&e.error(t.error),i.unsubscribe()):t.isEnd&&(i.closed=!0,e.complete&&e.complete())});return i},gr);function gr(t){this.observable=t}function Er(r){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(t){return r.apply(void 0,[t].concat(n))}}}mr.prototype[wr("observable")]=function(){return this},ur.prototype.toESObservable=function(){return new mr(this)},ur.prototype[wr("observable")]=ur.prototype.toESObservable;var Sr=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]];function Dr(r,e,t){var n=function(t){for(var n,r=0;r<Sr.length;r++){var e=[t[(n=Sr[r])[0]],t[n[1]]];if(e[0]&&e[1])return e}for(var i=0;i<Sr.length;i++){var o=t[(n=Sr[i])[0]];if(o)return[o,function(){}]}throw new Error("No suitable event methods in "+t)}(r),i=n[0],o=n[1],u=new V("Bacon","fromEvent",[r,e]);return En(function(t){return n=e,E.isFunction(n)?(e(i.bind(r),t),function(){return e(o.bind(r),t)}):(i.call(r,e,t),function(){return o.call(r,e,t)});var n},t).withDesc(u)}function Ir(s){var c=0;return En(function(n){var r=!1,e=D,i=function(){};function o(t){return t.isEnd?(r?u():r=!0,D):e=n(t)}function u(){var t;for(r=!0;r&&e!==I;)t=s(c++),r=!1,t?i=t.subscribeInternal(o):n(wt());r=!0}return u(),function(){return i()}}).withDesc(new V("Bacon","repeat",[s]))}function Ar(t){return Jn(t,"").filter(!1).withDesc(new V("Bacon","silence",[t]))}function kr(t){return[mt(t),wt()]}var _r,Br=(_r=function(t){for(var r,e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return E.isFunction(t)?n.length?(r=t,e=n,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r.apply(void 0,e.concat(t))}):t:E.always(t)},function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if("object"==typeof t&&n.length){var e=t,i=n[0];t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e[i].apply(e,t)},n=n.slice(1)}return _r.apply(void 0,u([t],n))});function xr(t,n){return Br.apply(void 0,u([t],n))}var Mr,Wr=(n(Tr,Mr=vr),Tr.prototype.plug=function(t){var n=this;if(!this.ended){var r={input:t,unsub:void 0};return this.subscriptions.push(r),void 0!==this.sink&&this.subscribeInput(r),function(){return n.unsubscribeInput(t)}}},Tr.prototype.end=function(){if(this.ended=!0,this.unsubAll(),"function"==typeof this.sink)return this.sink(wt())},Tr.prototype.push=function(t){if(!this.ended&&"function"==typeof this.sink){var n=!this.pushing;if(!n)return this.pushQueue||(this.pushQueue=[]),void this.pushQueue.push(t);this.pushing=!0;try{return this.sink(bt(t))}finally{if(n&&this.pushQueue){for(var r=0;r<this.pushQueue.length;){var e=this.pushQueue[r];this.sink(bt(e)),r++}this.pushQueue=void 0}this.pushing=!1}}},Tr.prototype.error=function(t){if("function"==typeof this.sink)return this.sink(new vt(t))},Tr.prototype.unsubAll=function(){for(var t,n=this.subscriptions,r=0;r<n.length;r++)"function"==typeof(t=n[r]).unsub&&t.unsub()},Tr.prototype.subscribeAll=function(t){if(this.ended)t(wt());else{this.sink=t;for(var n,r=this.subscriptions.slice(),e=0;e<r.length;e++)n=r[e],this.subscribeInput(n)}return this.unsubAll},Tr.prototype.guardedSink=function(n){var r=this;return function(t){return t.isEnd?(r.unsubscribeInput(n),I):r.sink?r.sink(t):D}},Tr.prototype.subscribeInput=function(t){return t.unsub=t.input.subscribeInternal(this.guardedSink(t.input)),t.unsub},Tr.prototype.unsubscribeInput=function(t){for(var n,r=this.subscriptions,e=0;e<r.length;e++)if((n=r[e]).input===t)return"function"==typeof n.unsub&&n.unsub(),void this.subscriptions.splice(e,1)},Tr);function Tr(){var n=Mr.call(this,new V("Bacon","Bus",[]),function(t){return n.subscribeAll(t)})||this;return n.pushing=!1,n.pushQueue=void 0,n.ended=!1,n.subscriptions=[],n.unsubAll=E.bind(n.unsubAll,n),n.subscriptions=[],n.ended=!1,n}var Or={asEventStream:function(n,r,t){var e=this;return E.isFunction(r)&&(t=r,r=void 0),En(function(t){return e.on(n,r,t),function(){return e.off(n,r,t)}},t).withDesc(new V(this.selector||this,"asEventStream",[n]))},init:function(t){t.fn.asEventStream=Or.asEventStream}};t.$=Or,t.Bus=Wr,t.CompositeUnsubscribe=Mt,t.Desc=V,t.End=ht,t.Error=vt,t.Event=G,t.EventStream=vr,t.Initial=ot,t.Next=rt,t.Observable=ur,t.Property=fr,t.Value=Z,t._=E,t.combine=bn,t.combineAsArray=dn,t.combineTemplate=ir,t.combineTwo=wn,t.combineWith=yn,t.concatAll=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=hn(t);return(r.length?c(p(r),f(r).toEventStream(),function(t,n){return t.concat(n)}):Jt()).withDesc(new V("Bacon","concatAll",r))},t.constant=an,t.fromArray=function(s){if(s.length){var c=0,f=new vr(new V("Bacon","fromArray",[s]),function(r){var e=!1,i=D,o=!1,u=!1;return L.soonButNotYet(f,function t(){if(u=!0,!o){if(c===s.length)return r(wt()),!1;for(o=!0;u;)if(u=!1,i!==I&&!e){var n=s[c++];(i=r(mt(n)))!==I&&(c===s.length?r(wt()):L.afterTransaction(f,t))}return o=!1}}),function(){return e=!0}});return f}return Jt().withDesc(new V("Bacon","fromArray",s))},t.fromBinder=En,t.fromCallback=function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return En(function(t){return xr(n,r)(t),a},function(t){return[t,wt()]}).withDesc(new V("Bacon","fromCallback",u([n],r)))},t.fromESObservable=function(t){var r;r=t[wr("observable")]?t[wr("observable")]():t;var n=new V("Bacon","fromESObservable",[r]);return new vr(n,function(n){var t=r.subscribe({error:function(t){n(new vt(t)),n(new ht)},next:function(t){n(new rt(t))},complete:function(){n(new ht)}});return t.unsubscribe?function(){t.unsubscribe()}:t})},t.fromEvent=Dr,t.fromEventTarget=Dr,t.fromNodeCallback=function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return En(function(t){return xr(n,r)(t),a},function(t,n){return t?[new vt(t),wt()]:[n,wt()]}).withDesc(new V("Bacon","fromNodeCallback",u([n],r)))},t.fromPoll=Sn,t.fromPromise=function(r,e,t){return void 0===t&&(t=kr),En(function(n){var t=r.then(n,function(t){return n(new vt(t))});return t&&"function"==typeof t.done&&t.done(),e?function(){if("function"==typeof r.abort)return r.abort()}:function(){}},t).withDesc(new V("Bacon","fromPromise",[r]))},t.getScheduler=function(){return A.scheduler},t.groupSimultaneous=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return vn(hn(t))},t.hasValue=Dt,t.interval=Dn,t.isEnd=It,t.isError=St,t.isEvent=gt,t.isInitial=Et,t.isNext=function(t){return t.isNext},t.later=Jn,t.mergeAll=Gn,t.more=D,t.never=Jt,t.noMore=I,t.nullSink=Q,t.nullVoidSink=z,t.onValues=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return dn(t.slice(0,t.length-1)).onValues(t[arguments.length-1])},t.once=Pt,t.repeat=Ir,t.repeatedly=function(t,n){var r=0;return Sn(t,function(){return n[r++%n.length]}).withDesc(new V("Bacon","repeatedly",[t,n]))},t.retry=function(t){if(!E.isFunction(t.source))throw new Error("'source' option has to be a function");var i=t.source,o=t.retries||0,u=0,s=t.delay||function(){return 0},c=t.isRetryable||function(){return!0},f=!1,a=null;return Ir(function(t){function n(){return i(t).endOnError().transform(function(t,n){return St(t)?c((a=t).error)&&(0===o||u<o)?D:(f=!0,n(t)):(Dt(t)&&(f=!(a=null)),n(t))})}if(!f){if(a){var r={error:a.error,retriesDone:u},e=Ar(s(r));return u++,e.concat(Pt(null).flatMap(n))}return n()}}).withDesc(new V("Bacon","retry",[t]))},t.sequentially=function(t,n){var r=0;return Sn(t,function(){var t=n[r++];return r<n.length?t:r===n.length?[mt(t),wt()]:wt()}).withDesc(new V("Bacon","sequentially",[t,n]))},t.setScheduler=function(t){A.scheduler=t},t.silence=Ar,t.spy=function(t){return Fn.push(t)},t.try=function(n){return function(t){try{return Pt(n(t))}catch(t){return Pt(new vt(t))}}},t.update=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];for(var e=rn(n),i=0;i<e.length;i++){var o=e[i];o[1]=Er(o[1])}return Kt.apply(void 0,e).scan(t,function(t,n){return n(t)}).withDesc(new V("Bacon","update",u([t],n)))},t.version="3.0.14",t.when=Kt,t.zipAsArray=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Kt([E.map(function(t){return t.toEventStream()},hn(t)),function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","zipAsArray",t))},t.zipWith=er,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "baconjs", | ||
"description": "A small functional reactive programming lib for JavaScript.", | ||
"version": "3.0.13", | ||
"version": "3.0.14", | ||
"keywords": [ | ||
@@ -32,8 +32,10 @@ "bacon.js", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"dependencies": { | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.6.0", | ||
"@types/bluebird": "^3.5.26", | ||
"@types/chai": "^4.1.7", | ||
"@types/mocha": "^5.2.5", | ||
"@types/sinon": "^7.0.10", | ||
"@types/mocha": "^7.0.2", | ||
"@types/sinon": "^9.0.0", | ||
"@types/zen-observable": "^0.8.0", | ||
@@ -49,16 +51,16 @@ "benchmark": "^2", | ||
"esprima": "^4.0.1", | ||
"estraverse": "^4.2.0", | ||
"estraverse": "^5.1.0", | ||
"jquery": "^3.3.1", | ||
"jsstana": "^1.0.0", | ||
"mocha": "^6", | ||
"nodemon": "^1", | ||
"rollup": "^1.7", | ||
"rollup-plugin-typescript2": "^0.20", | ||
"mocha": "^7.1.1", | ||
"nodemon": "^2.0.3", | ||
"rollup": "^2.6.1", | ||
"rollup-plugin-typescript2": "^0.27.0", | ||
"rxjs": "^6", | ||
"sinon": "^7", | ||
"sinon": "^9.0.0", | ||
"terser": "^4.3.9", | ||
"ts-node": "^7.0.0", | ||
"ts-node": "^8.9.0", | ||
"tsify": "^4.0.1", | ||
"typedoc": "~0.14", | ||
"typescript": "~3.5", | ||
"typedoc": "~0.18", | ||
"typescript": "~3.8.3", | ||
"uglify-js": "^3", | ||
@@ -81,3 +83,3 @@ "zen-observable": "~0.8" | ||
"prepublish": "npm run lint && npm run dist", | ||
"version": "3.0.13", | ||
"version": "3.0.14", | ||
"browsertest-bundle": "browsertest/browserify", | ||
@@ -87,3 +89,3 @@ "browsertest-open": "open browsertest/mocha.runner.html", | ||
"release": "scripts/release", | ||
"watch": "node_modules/nodemon/bin/nodemon.js -w src -e js,ts,json --ignore 'dist/*' --exec 'scripts/dist&&npm test'", | ||
"watch": "node_modules/nodemon/bin/nodemon.js -w src -w test -e js,ts,json --ignore 'dist/*' --exec 'scripts/dist&&npm test'", | ||
"watch-dist": "node_modules/nodemon/bin/nodemon.js -w src -e js,ts,json --ignore 'dist/*' --exec 'scripts/dist'", | ||
@@ -90,0 +92,0 @@ "watch-doc": "node_modules/nodemon/bin/nodemon.js -w src -w README.md -e js,ts,json,md --ignore 'dist/*' --exec 'npm run typedoc'", |
@@ -27,3 +27,3 @@ Bacon.js | ||
[![Build Status](https://travis-ci.org/baconjs/bacon.js.svg?branch=master)](https://travis-ci.org/baconjs/bacon.js) | ||
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=RDRnTElXMlRsK2pWdXhYQXVOMkQvdz09LS1mbmgyL0l2NlVBUFZQNWEzYlIvWit3PT0=--779bf4c07cb76abcbee64b15f00e1998f7880ff2%)](https://www.browserstack.com/automate/public-build/RDRnTElXMlRsK2pWdXhYQXVOMkQvdz09LS1mbmgyL0l2NlVBUFZQNWEzYlIvWit3PT0=--779bf4c07cb76abcbee64b15f00e1998f7880ff2%) | ||
[![BrowserStack Status](https://automate.browserstack.com/badge.svg?badge_key=Mlh0UHp2b1pJS01Uam5ZNHdIZnNHTjJoWGFpNldqR2JUSHdiV2NWb2dyST0tLUowV2Nrd0VmZXJhZWsyNVlyZUJxeHc9PQ==--040027ccf71cd208e0d2597276f5ef1e79eedd43%)](https://automate.browserstack.com/badge.svg?badge_key=Mlh0UHp2b1pJS01Uam5ZNHdIZnNHTjJoWGFpNldqR2JUSHdiV2NWb2dyST0tLUowV2Nrd0VmZXJhZWsyNVlyZUJxeHc9PQ==--040027ccf71cd208e0d2597276f5ef1e79eedd43%) | ||
[![NPM version](http://img.shields.io/npm/v/baconjs.svg)](https://www.npmjs.org/package/baconjs) | ||
@@ -386,3 +386,3 @@ [![Dependency Status](https://david-dm.org/baconjs/bacon.js.svg)](https://david-dm.org/baconjs/bacon.js) | ||
Bacon.js supports atomic updates to properties. | ||
Bacon.js supports atomic updates to properties for solving a [glitches problem](https://en.wikipedia.org/wiki/Reactive_programming#Glitches). | ||
@@ -532,2 +532,2 @@ Assume you have properties A and B and property C = A + B. Assume that | ||
<a href="https://reaktor.com/"><img src="https://baconjs.github.io/supported-by-reaktor.png" /></a> | ||
<a href="https://reaktor.com/"><img src="https://baconjs.github.io/supported-by-reaktor.png" /></a> |
@@ -18,3 +18,3 @@ { | ||
"lib": [ | ||
"ES5", "DOM" | ||
"ES2015", "DOM" | ||
] | ||
@@ -21,0 +21,0 @@ }, |
import "./map"; | ||
import Observable from "./observable"; | ||
import { Property } from "./observable"; | ||
import { Function2 } from "./types"; | ||
import { Function0, Function1, Function2, Function3, Function4, Function5, Function6 } from "./types"; | ||
/** | ||
@@ -22,4 +22,4 @@ Combines Properties, EventStreams and constant values so that the result Property will have an array of the latest | ||
/** | ||
Combines given *n* Properties, | ||
EventStreams and constant values using the given n-ary function `f(v1, v2 ...)`. | ||
Combines given *n* Properties and | ||
EventStreams using the given n-ary function `f(v1, v2 ...)`. | ||
@@ -33,4 +33,19 @@ To calculate the current sum of three numeric Properties, you can do | ||
*/ | ||
export declare function combineWith<Out>(f: (...args: any[]) => Out, ...streams: Observable<any>[]): Property<Out>; | ||
export declare function combineWith<R>(fn: Function0<R>): Property<R>; | ||
export declare function combineWith<V, R>(a: Observable<V>, fn: Function1<V, R>): Property<R>; | ||
export declare function combineWith<V, V2, R>(a: Observable<V>, b: Observable<V2>, fn: Function2<V, V2, R>): Property<R>; | ||
export declare function combineWith<V, V2, V3, R>(a: Observable<V>, b: Observable<V2>, c: Observable<V3>, fn: Function3<V, V2, V3, R>): Property<R>; | ||
export declare function combineWith<V, V2, V3, V4, R>(a: Observable<V>, b: Observable<V2>, c: Observable<V3>, d: Observable<V4>, fn: Function4<V, V2, V3, V4, R>): Property<R>; | ||
export declare function combineWith<V, V2, V3, V4, V5, R>(a: Observable<V>, b: Observable<V2>, c: Observable<V3>, d: Observable<V4>, e: Observable<V5>, fn: Function5<V, V2, V3, V4, V5, R>): Property<R>; | ||
export declare function combineWith<V, V2, V3, V4, V5, V6, R>(a: Observable<V>, b: Observable<V2>, c: Observable<V3>, d: Observable<V4>, e: Observable<V5>, f: Observable<V6>, fn: Function6<V, V2, V3, V4, V5, V6, R>): Property<R>; | ||
export declare function combineWith<R>(observables: Observable<any>[], fn: Function): Property<R>; | ||
export declare function combineWith<V, R>(fn: Function1<V, R>, a: Observable<V>): Property<R>; | ||
export declare function combineWith<V, V2, R>(fn: Function2<V, V2, R>, a: Observable<V>, b: Observable<V2>): Property<R>; | ||
export declare function combineWith<V, V2, V3, R>(fn: Function3<V, V2, V3, R>, a: Observable<V>, b: Observable<V2>, c: Observable<V3>): Property<R>; | ||
export declare function combineWith<V, V2, V3, V4, R>(fn: Function4<V, V2, V3, V4, R>, a: Observable<V>, b: Observable<V2>, c: Observable<V3>, d: Observable<V4>): Property<R>; | ||
export declare function combineWith<V, V2, V3, V4, V5, R>(fn: Function5<V, V2, V3, V4, V5, R>, a: Observable<V>, b: Observable<V2>, c: Observable<V3>, d: Observable<V4>, e: Observable<V5>): Property<R>; | ||
export declare function combineWith<V, V2, V3, V4, V5, V6, R>(fn: Function6<V, V2, V3, V4, V5, V6, R>, a: Observable<V>, b: Observable<V2>, c: Observable<V3>, d: Observable<V4>, e: Observable<V5>, f: Observable<V6>): Property<R>; | ||
export declare function combineWith<R>(fn: Function, observables: Observable<any>[]): Property<R>; | ||
export declare const combine: typeof combineWith; | ||
/** @hidden */ | ||
export declare function combine<V, V2, R>(left: Observable<V>, right: Observable<V2>, f: Function2<V, V2, R>): Property<R>; | ||
export declare function combineTwo<V, V2, R>(left: Observable<V>, right: Observable<V2>, f: Function2<V, V2, R>): Property<R>; |
@@ -20,1 +20,5 @@ import { Event } from "./event"; | ||
export declare type Function2<T1, T2, R> = (t1: T1, t2: T2) => R; | ||
export declare type Function3<T1, T2, T3, R> = (t1: T1, t2: T2, t3: T3) => R; | ||
export declare type Function4<T1, T2, T3, T4, R> = (t1: T1, t2: T2, t3: T3, t4: T4) => R; | ||
export declare type Function5<T1, T2, T3, T4, T5, R> = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R; | ||
export declare type Function6<T1, T2, T3, T4, T5, T6, R> = (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
720095
16615
531
31
11351