%PDF- %PDF-
| Direktori : /data/old/home/stash/atlassian/stash/3.7.1/atlassian-stash/static/bower/bacon/dist/ |
| Current File : //data/old/home/stash/atlassian/stash/3.7.1/atlassian-stash/static/bower/bacon/dist/Bacon-min.js |
(function(){var U,AJ,P,AN,i,X,Z,c,AC,a,M,f,AE,AB,K,Q,AH,W,d,AL,AG,V,J,p,v,AK,x,S,s,y,l,z,AF,e,H,b,O,B,AM,j,R,E,A,AR,AI,AA,AS,AP,u,g,G,o,t,m,AO,w,AT,I,N,T,D,n,AQ,q,k,Y,L,h,AU,r={}.hasOwnProperty,F=[].slice,C=function(AY,AW){for(var AV in AW){if(r.call(AW,AV)){AY[AV]=AW[AV]}}function AX(){this.constructor=AY}AX.prototype=AW.prototype;AY.prototype=new AX();AY.__super__=AW.prototype;return AY},AD=function(AV,AW){return function(){return AV.apply(AW,arguments)}};U={toString:function(){return"Bacon"}};U.version="0.7.42";f=(typeof global!=="undefined"&&global!==null?global:this).Error;h={indexOf:Array.prototype.indexOf?function(AW,AV){return AW.indexOf(AV)}:function(AX,AV){var AY,Aa,AZ,AW;for(AY=AZ=0,AW=AX.length;AZ<AW;AY=++AZ){Aa=AX[AY];if(AV===Aa){return AY}}return -1},indexWhere:function(AW,AZ){var AX,Aa,AY,AV;for(AX=AY=0,AV=AW.length;AY<AV;AX=++AY){Aa=AW[AX];if(AZ(Aa)){return AX}}return -1},head:function(AV){return AV[0]},always:function(AV){return function(){return AV}},negate:function(AV){return function(AW){return !AV(AW)}},empty:function(AV){return AV.length===0},tail:function(AV){return AV.slice(1,AV.length)},filter:function(Aa,AY){var AX,AV,AZ,AW;AX=[];for(AZ=0,AW=AY.length;AZ<AW;AZ++){AV=AY[AZ];if(Aa(AV)){AX.push(AV)}}return AX},map:function(Aa,AY){var AV,AZ,AX,AW;AW=[];for(AZ=0,AX=AY.length;AZ<AX;AZ++){AV=AY[AZ];AW.push(Aa(AV))}return AW},each:function(AV,AY){var AW,AX;for(AW in AV){AX=AV[AW];AY(AW,AX)}return void 0},toArray:function(AV){if(A(AV)){return AV}else{return[AV]}},contains:function(AW,AV){return h.indexOf(AW,AV)!==-1},id:function(AV){return AV},last:function(AV){return AV[AV.length-1]},all:function(AX,AZ){var AV,AY,AW;if(AZ==null){AZ=h.id}for(AY=0,AW=AX.length;AY<AW;AY++){AV=AX[AY];if(!AZ(AV)){return false}}return true},any:function(AX,AZ){var AV,AY,AW;if(AZ==null){AZ=h.id}for(AY=0,AW=AX.length;AY<AW;AY++){AV=AX[AY];if(AZ(AV)){return true}}return false},without:function(AV,AW){return h.filter((function(AX){return AX!==AV}),AW)},remove:function(AV,AW){var AX;AX=h.indexOf(AW,AV);if(AX>=0){return AW.splice(AX,1)}},fold:function(AY,AX,Aa){var AV,AZ,AW;for(AZ=0,AW=AY.length;AZ<AW;AZ++){AV=AY[AZ];AX=Aa(AX,AV)}return AX},flatMap:function(AW,AV){return h.fold(AV,[],(function(AY,AX){return AY.concat(AW(AX))}))},cached:function(AW){var AV;AV=K;return function(){if(AV===K){AV=AW();AW=void 0}return AV}},toString:function(AZ){var AW,AX,AV,AY;try{AT++;if(AZ==null){return"undefined"}else{if(AI(AZ)){return"function"}else{if(A(AZ)){if(AT>5){return"[..]"}return"["+h.map(h.toString,AZ).toString()+"]"}else{if(((AZ!=null?AZ.toString:void 0)!=null)&&AZ.toString!==Object.prototype.toString){return AZ.toString()}else{if(typeof AZ==="object"){if(AT>5){return"{..}"}AX=(function(){var Aa;Aa=[];for(AV in AZ){if(!r.call(AZ,AV)){continue}AY=(function(){try{return AZ[AV]}catch(Ab){AW=Ab;return AW}})();Aa.push(h.toString(AV)+":"+h.toString(AY))}return Aa})();return"{"+AX+"}"}else{return AZ}}}}}}finally{AT--}}};AT=0;U._=h;U.scheduler={setTimeout:function(AV,AW){return setTimeout(AV,AW)},setInterval:function(AW,AV){return setInterval(AW,AV)},clearInterval:function(AV){return clearInterval(AV)},now:function(){return new Date().getTime()}};U.fromBinder=function(AV,AW){if(AW==null){AW=h.id}return new M(H(U,"fromBinder",AV,AW),function(Aa){var Ab,AY,AX,AZ;AZ=false;Ab=false;AY=function(){if(!AZ){if(typeof AX!=="undefined"&&AX!==null){AX();return AZ=true}else{return Ab=true}}};AX=AV(function(){var Ad,Af,Ae,Ah,Ag,Ac;Ad=1<=arguments.length?F.call(arguments,0):[];Ah=AW.apply(this,Ad);if(!(A(Ah)&&h.last(Ah) instanceof a)){Ah=[Ah]}Ae=U.more;for(Ag=0,Ac=Ah.length;Ag<Ac;Ag++){Af=Ah[Ag];Ae=Aa(Af=D(Af));if(Ae===U.noMore||Af.isEnd()){AY();return Ae}}return Ae});if(Ab){AY()}return AY})};U.$={};U.$.asEventStream=function(AW,AV,AX){var AY;if(AI(AV)){AY=[AV,void 0],AX=AY[0],AV=AY[1]}return Y(this.selector||this,"asEventStream",AW,U.fromBinder((function(AZ){return function(Aa){AZ.on(AW,AV,Aa);return function(){return AZ.off(AW,AV,Aa)}}})(this),AX))};if((AU=typeof jQuery!=="undefined"&&jQuery!==null?jQuery:typeof Zepto!=="undefined"&&Zepto!==null?Zepto:void 0)!=null){AU.fn.asEventStream=U.$.asEventStream}U.fromEventTarget=function(Af,Ae,AX){var AV,AZ,Ad,Ac,Ab,Aa,AY,AW;AV=(Ad=(Ac=(Ab=Af.addEventListener)!=null?Ab:Af.addListener)!=null?Ac:Af.bind)!=null?Ad:Af.on;AZ=(Aa=(AY=(AW=Af.removeEventListener)!=null?AW:Af.removeListener)!=null?AY:Af.unbind)!=null?Aa:Af.off;return Y(U,"fromEventTarget",Af,Ae,U.fromBinder(function(Ag){AV.call(Af,Ae,Ag);return function(){return AZ.call(Af,Ae,Ag)}},AX))};U.fromPromise=function(AV,AW){return Y(U,"fromPromise",AV,U.fromBinder(function(AX){AV.then(AX,function(AY){return AX(new AC(AY))});return function(){if(AW){return typeof AV.abort==="function"?AV.abort():void 0}}},(function(AX){return[AX,b()]})))};U.noMore=["<no-more>"];U.more=["<more>"];U.later=function(AV,AW){return Y(U,"later",AV,AW,U.fromPoll(AV,function(){return[AW,b()]}))};U.sequentially=function(AX,AV){var AW;AW=0;return Y(U,"sequentially",AX,AV,U.fromPoll(AX,function(){var AY;AY=AV[AW++];if(AW<AV.length){return AY}else{if(AW===AV.length){return[AY,b()]}else{return b()}}}))};U.repeatedly=function(AX,AV){var AW;AW=0;return Y(U,"repeatedly",AX,AV,U.fromPoll(AX,function(){return AV[AW++%AV.length]}))};U.spy=function(AV){return N.push(AV)};N=[];I=function(AY){var AW,AX,AV;if(N.length){if(!I.running){try{I.running=true;for(AX=0,AV=N.length;AX<AV;AX++){AW=N[AX];AW(AY)}}finally{delete I.running}}}return void 0};L=function(AV){return function(){var AX,AY,AZ,AW;AZ=arguments[0],AX=2<=arguments.length?F.call(arguments,1):[];if(typeof AZ==="object"&&AX.length){AY=AZ;AW=AX[0];AZ=function(){return AY[AW].apply(AY,arguments)};AX=AX.slice(1)}return AV.apply(null,[AZ].concat(F.call(AX)))}};AP=function(AW,AV){return L(function(){var AX,AY,AZ;AY=arguments[0],AX=2<=arguments.length?F.call(arguments,1):[];AZ=w(AV,[function(Aa,Ab){return AY.apply(null,F.call(Aa).concat([Ab]))}]);return Y.apply(null,[U,AW,AY].concat(F.call(AX),[U.combineAsArray(AX).flatMap(AZ)]))})};U.fromCallback=AP("fromCallback",function(){var AV,AW;AW=arguments[0],AV=2<=arguments.length?F.call(arguments,1):[];return U.fromBinder(function(AX){u(AW,AV)(AX);return AO},(function(AX){return[AX,b()]}))});U.fromNodeCallback=AP("fromNodeCallback",function(){var AV,AW;AW=arguments[0],AV=2<=arguments.length?F.call(arguments,1):[];return U.fromBinder(function(AX){u(AW,AV)(AX);return AO},function(AX,AY){if(AX){return[new AC(AX),b()]}return[AY,b()]})});U.fromPoll=function(AV,AW){return Y(U,"fromPoll",AV,AW,U.fromBinder((function(AX){var AY;AY=U.scheduler.setInterval(AX,AV);return function(){return U.scheduler.clearInterval(AY)}}),AW))};U.interval=function(AV,AW){if(AW==null){AW={}}return Y(U,"interval",AV,AW,U.fromPoll(AV,function(){return m(AW)}))};U.constant=function(AV){return new AH(H(U,"constant",AV),function(AW){AW(E(AV));AW(b());return AO})};U.never=function(){return new M(H(U,"never"),function(AV){AV(b());return AO})};U.once=function(AV){return new M(H(U,"once",AV),function(AW){AW(D(AV));AW(b());return AO})};U.fromArray=function(AV){var AW;p(AV);if(!AV.length){return Y(U,"fromArray",AV,U.never())}else{AW=0;return new M(H(U,"fromArray",AV),function(Aa){var AY,AZ,AX;AX=false;AZ=U.more;AY=function(){var Ab;if((AZ!==U.noMore)&&!AX){Ab=AV[AW++];AZ=Aa(D(Ab));if(AZ!==U.noMore){if(AW===AV.length){return Aa(b())}else{return AG.afterTransaction(AY)}}}};AY();return function(){return AX=true}})}};U.mergeAll=function(){var AV;AV=1<=arguments.length?F.call(arguments,0):[];if(A(AV[0])){AV=AV[0]}if(AV.length){return new M(H.apply(null,[U,"mergeAll"].concat(F.call(AV))),function(AZ){var AX,AW,AY;AX=0;AY=function(Aa){return function(Ab){return Aa.dispatcher.subscribe(function(Ad){var Ac;if(Ad.isEnd()){AX++;if(AX===AV.length){return AZ(b())}else{return U.more}}else{Ac=AZ(Ad);if(Ac===U.noMore){Ab()}return Ac}})}};AW=h.map(AY,AV);return l.apply(null,AW)})}else{return U.never()}};U.zipAsArray=function(){var AV;AV=1<=arguments.length?F.call(arguments,0):[];if(A(AV[0])){AV=AV[0]}return Y.apply(null,[U,"zipAsArray"].concat(F.call(AV),[U.zipWith(AV,function(){var AW;AW=1<=arguments.length?F.call(arguments,0):[];return AW})]))};U.zipWith=function(){var AW,AX,AV;AW=arguments[0],AX=2<=arguments.length?F.call(arguments,1):[];if(!AI(AW)){AV=[AW,AX[0]],AX=AV[0],AW=AV[1]}AX=h.map((function(AY){return AY.toEventStream()}),AX);return Y.apply(null,[U,"zipWith",AW].concat(F.call(AX),[U.when(AX,AW)]))};U.groupSimultaneous=function(){var AW,AV,AX;AX=1<=arguments.length?F.call(arguments,0):[];if(AX.length===1&&A(AX[0])){AX=AX[0]}AV=(function(){var Aa,AZ,AY;AY=[];for(Aa=0,AZ=AX.length;Aa<AZ;Aa++){AW=AX[Aa];AY.push(new AJ(AW))}return AY})();return Y.apply(null,[U,"groupSimultaneous"].concat(F.call(AX),[U.when(AV,(function(){var AY;AY=1<=arguments.length?F.call(arguments,0):[];return AY}))]))};U.combineAsArray=function(){var AX,AY,AW,Aa,Ab,AZ,AV;Ab=1<=arguments.length?F.call(arguments,0):[];if(Ab.length===1&&A(Ab[0])){Ab=Ab[0]}for(AX=AZ=0,AV=Ab.length;AZ<AV;AX=++AZ){Aa=Ab[AX];if(!(AA(Aa))){Ab[AX]=U.constant(Aa)}}if(Ab.length){AW=(function(){var Ae,Ad,Ac;Ac=[];for(Ae=0,Ad=Ab.length;Ae<Ad;Ae++){AY=Ab[Ae];Ac.push(new AL(AY,true))}return Ac})();return Y.apply(null,[U,"combineAsArray"].concat(F.call(Ab),[U.when(AW,(function(){var Ac;Ac=1<=arguments.length?F.call(arguments,0):[];return Ac})).toProperty()]))}else{return U.constant([])}};U.onValues=function(){var AW,AX,AV;AX=2<=arguments.length?F.call(arguments,0,AV=arguments.length-1):(AV=0,[]),AW=arguments[AV++];return U.combineAsArray(AX).onValues(AW)};U.combineWith=function(){var AV,AW;AV=arguments[0],AW=2<=arguments.length?F.call(arguments,1):[];return Y.apply(null,[U,"combineWith",AV].concat(F.call(AW),[U.combineAsArray(AW).map(function(AX){return AV.apply(null,AX)})]))};U.combineTemplate=function(Ac){var AX,AY,Ae,Ad,AW,Aa,AV,Ab,AZ,Af;AV=[];Af=[];Aa=function(Ag){return Ag[Ag.length-1]};AZ=function(Ag,Ah,Ai){return Aa(Ag)[Ah]=Ai};AX=function(Ah,Ag){return function(Aj,Ai){return AZ(Aj,Ah,Ai[Ag])}};AW=function(Ag,Ah){return function(Ai){return AZ(Ai,Ag,Ah)}};Ab=function(Ag){if(A(Ag)){return[]}else{return{}}};Ae=function(Ah,Ai){var Aj,Ag;if(AA(Ai)){Af.push(Ai);return AV.push(AX(Ah,Af.length-1))}else{if(Ai===Object(Ai)&&typeof Ai!=="function"&&!(Ai instanceof RegExp)&&!(Ai instanceof Date)){Ag=function(Ak){return function(Al){var Am;Am=Ab(Ai);AZ(Al,Ak,Am);return Al.push(Am)}};Aj=function(Ak){return Ak.pop()};AV.push(Ag(Ah));Ad(Ai);return AV.push(Aj)}else{return AV.push(AW(Ah,Ai))}}};Ad=function(Ag){return h.each(Ag,Ae)};Ad(Ac);AY=function(Aj){var Ai,Al,Ag,Ak,Ah;Ag=Ab(Ac);Ai=[Ag];for(Ak=0,Ah=AV.length;Ak<Ah;Ak++){Al=AV[Ak];Al(Ai,Aj)}return Ag};return Y(U,"combineTemplate",Ac,U.combineAsArray(Af).map(AY))};U.retry=function(AY){var AX,Aa,Ab,AW,AV,AZ;if(!AI(AY.source)){throw new f("'source' option has to be a function")}AZ=AY.source;AW=AY.retries||0;Ab=AY.maxRetries||AW;AX=AY.delay||function(){return 0};Aa=AY.isRetryable||function(){return true};AV=function(Ad){var Ae,Ac;Ac={source:AZ,retries:AW-1,maxRetries:Ab,delay:AX,isRetryable:Aa};Ae=function(){return U.retry(Ac)};return U.later(AX(Ad)).filter(false).concat(U.once().flatMap(Ae))};return Y(U,"retry",AY,AZ().flatMapError(function(Ac){if(Aa(Ac)&&AW>0){return AV({error:Ac,retriesDone:Ab-AW})}else{return U.once(new AC(Ac))}}))};O=0;a=(function(){function AV(){this.id=++O}AV.prototype.isEvent=function(){return true};AV.prototype.isEnd=function(){return false};AV.prototype.isInitial=function(){return false};AV.prototype.isNext=function(){return false};AV.prototype.isError=function(){return false};AV.prototype.hasValue=function(){return false};AV.prototype.filter=function(){return true};AV.prototype.inspect=function(){return this.toString()};AV.prototype.log=function(){return this.toString()};return AV})();AB=(function(AW){C(AV,AW);function AV(AY,AX){AV.__super__.constructor.call(this);if(!AX&&AI(AY)||AY instanceof AV){this.valueF=AY;this.valueInternal=void 0}else{this.valueF=void 0;this.valueInternal=AY}}AV.prototype.isNext=function(){return true};AV.prototype.hasValue=function(){return true};AV.prototype.value=function(){if(this.valueF instanceof AV){this.valueInternal=this.valueF.value();this.valueF=void 0}else{if(this.valueF){this.valueInternal=this.valueF();this.valueF=void 0}}return this.valueInternal};AV.prototype.fmap=function(AZ){var AX,AY;if(this.valueInternal){AY=this.valueInternal;return this.apply(function(){return AZ(AY)})}else{AX=this;return this.apply(function(){return AZ(AX.value())})}};AV.prototype.apply=function(AX){return new AV(AX)};AV.prototype.filter=function(AX){return AX(this.value())};AV.prototype.toString=function(){return h.toString(this.value())};AV.prototype.log=function(){return this.value()};return AV})(a);AE=(function(AW){C(AV,AW);function AV(){return AV.__super__.constructor.apply(this,arguments)}AV.prototype.isInitial=function(){return true};AV.prototype.isNext=function(){return false};AV.prototype.apply=function(AX){return new AV(AX)};AV.prototype.toNext=function(){return new AB(this)};return AV})(AB);c=(function(AV){C(AW,AV);function AW(){return AW.__super__.constructor.apply(this,arguments)}AW.prototype.isEnd=function(){return true};AW.prototype.fmap=function(){return this};AW.prototype.apply=function(){return this};AW.prototype.toString=function(){return"<end>"};return AW})(a);AC=(function(AV){C(AW,AV);function AW(AX){this.error=AX}AW.prototype.isError=function(){return true};AW.prototype.fmap=function(){return this};AW.prototype.apply=function(){return this};AW.prototype.toString=function(){return"<error> "+h.toString(this.error)};return AW})(a);R=0;Q=(function(){function AV(AW){this.id=++R;Y(AW,this);this.initialDesc=this.desc}AV.prototype.subscribe=function(AW){return AG.wrappedSubscribe(this,AW)};AV.prototype.subscribeInternal=function(AW){return this.dispatcher.subscribe(AW)};AV.prototype.onValue=function(){var AW;AW=g(arguments);return this.subscribe(function(AX){if(AX.hasValue()){return AW(AX.value())}})};AV.prototype.onValues=function(AW){return this.onValue(function(AX){return AW.apply(null,AX)})};AV.prototype.onError=function(){var AW;AW=g(arguments);return this.subscribe(function(AX){if(AX.isError()){return AW(AX.error)}})};AV.prototype.onEnd=function(){var AW;AW=g(arguments);return this.subscribe(function(AX){if(AX.isEnd()){return AW()}})};AV.prototype.errors=function(){return Y(this,"errors",this.filter(function(){return false}))};AV.prototype.filter=function(){var AW,AX;AX=arguments[0],AW=2<=arguments.length?F.call(arguments,1):[];return e(this,AX,AW,function(AY){return Y(this,"filter",AY,this.withHandler(function(AZ){if(AZ.filter(AY)){return this.push(AZ)}else{return U.more}}))})};AV.prototype.takeWhile=function(){var AW,AX;AX=arguments[0],AW=2<=arguments.length?F.call(arguments,1):[];return e(this,AX,AW,function(AY){return Y(this,"takeWhile",AY,this.withHandler(function(AZ){if(AZ.filter(AY)){return this.push(AZ)}else{this.push(b());return U.noMore}}))})};AV.prototype.endOnError=function(){var AW,AX;AX=arguments[0],AW=2<=arguments.length?F.call(arguments,1):[];if(AX==null){AX=true}return e(this,AX,AW,function(AY){return Y(this,"endOnError",this.withHandler(function(AZ){if(AZ.isError()&&AY(AZ.error)){this.push(AZ);return this.push(b())}else{return this.push(AZ)}}))})};AV.prototype.take=function(AW){if(AW<=0){return U.never()}return Y(this,"take",AW,this.withHandler(function(AX){if(!AX.hasValue()){return this.push(AX)}else{AW--;if(AW>0){return this.push(AX)}else{if(AW===0){this.push(AX)}this.push(b());return U.noMore}}}))};AV.prototype.map=function(){var AW,AX;AX=arguments[0],AW=2<=arguments.length?F.call(arguments,1):[];if(AX instanceof AH){return AX.sampledBy(this,j)}else{return e(this,AX,AW,function(AY){return Y(this,"map",AY,this.withHandler(function(AZ){return this.push(AZ.fmap(AY))}))})}};AV.prototype.mapError=function(){var AW;AW=g(arguments);return Y(this,"mapError",AW,this.withHandler(function(AX){if(AX.isError()){return this.push(m(AW(AX.error)))}else{return this.push(AX)}}))};AV.prototype.mapEnd=function(){var AW;AW=g(arguments);return Y(this,"mapEnd",AW,this.withHandler(function(AX){if(AX.isEnd()){this.push(m(AW(AX)));this.push(b());return U.noMore}else{return this.push(AX)}}))};AV.prototype.doAction=function(){var AW;AW=g(arguments);return Y(this,"doAction",AW,this.withHandler(function(AX){if(AX.hasValue()){AW(AX.value())}return this.push(AX)}))};AV.prototype.skip=function(AW){return Y(this,"skip",AW,this.withHandler(function(AX){if(!AX.hasValue()){return this.push(AX)}else{if(AW>0){AW--;return U.more}else{return this.push(AX)}}}))};AV.prototype.skipDuplicates=function(AW){if(AW==null){AW=function(AY,AX){return AY===AX}}return Y(this,"skipDuplicates",this.withStateMachine(K,function(AY,AX){if(!AX.hasValue()){return[AY,[AX]]}else{if(AX.isInitial()||AY===K||!AW(AY.get(),AX.value())){return[new d(AX.value()),[AX]]}else{return[AY,[]]}}}))};AV.prototype.skipErrors=function(){return Y(this,"skipErrors",this.withHandler(function(AW){if(AW.isError()){return U.more}else{return this.push(AW)}}))};AV.prototype.withStateMachine=function(AW,AY){var AX;AX=AW;return Y(this,"withStateMachine",AW,AY,this.withHandler(function(Ad){var Ac,Af,Aa,Ag,Ab,Ae,AZ;Ac=AY(AX,Ad);Af=Ac[0],Ag=Ac[1];AX=Af;Ab=U.more;for(Ae=0,AZ=Ag.length;Ae<AZ;Ae++){Aa=Ag[Ae];Ab=this.push(Aa);if(Ab===U.noMore){return Ab}}return Ab}))};AV.prototype.scan=function(AX,AZ){var AY,Aa,AW;AZ=T(AZ);AY=q(AX);AW=(function(Ab){return function(Ag){var Af,Ae,Ad,Ac;Af=false;Ac=AO;Ae=U.more;Ad=function(){if(!Af){return AY.forEach(function(Ah){Af=true;Ae=Ag(new AE(function(){return Ah}));if(Ae===U.noMore){Ac();return Ac=AO}})}};Ac=Ab.dispatcher.subscribe(function(Aj){var Ah,Ai;if(Aj.hasValue()){if(Af&&Aj.isInitial()){return U.more}else{if(!Aj.isInitial()){Ad()}Af=true;Ai=AY.getOrElse(void 0);Ah=AZ(Ai,Aj.value());AY=new d(Ah);return Ag(Aj.apply(function(){return Ah}))}}else{if(Aj.isEnd()){Ae=Ad()}if(Ae!==U.noMore){return Ag(Aj)}}});AG.whenDoneWith(Aa,Ad);return Ac}})(this);return Aa=new AH(H(this,"scan",AX,AZ),AW)};AV.prototype.fold=function(AW,AX){return Y(this,"fold",AW,AX,this.scan(AW,AX).sampledBy(this.filter(false).mapEnd().toProperty()))};AV.prototype.zip=function(AW,AX){if(AX==null){AX=Array}return Y(this,"zip",AW,U.zipWith([this,AW],AX))};AV.prototype.diff=function(AX,AW){AW=T(AW);return Y(this,"diff",AX,AW,this.scan([AX],function(AY,AZ){return[AZ,AW(AY[0],AZ)]}).filter(function(AY){return AY.length===2}).map(function(AY){return AY[1]}))};AV.prototype.flatMap=function(){return AM(this,t(arguments))};AV.prototype.flatMapFirst=function(){return AM(this,t(arguments),true)};AV.prototype.flatMapWithConcurrencyLimit=function(){var AX,AW;AW=arguments[0],AX=2<=arguments.length?F.call(arguments,1):[];return Y.apply(null,[this,"flatMapWithConcurrencyLimit",AW].concat(F.call(AX),[AM(this,t(AX),false,AW)]))};AV.prototype.flatMapLatest=function(){var AW,AX;AW=t(arguments);AX=this.toEventStream();return Y(this,"flatMapLatest",AW,AX.flatMap(function(AY){return o(AW(AY)).takeUntil(AX)}))};AV.prototype.flatMapError=function(AW){return Y(this,"flatMapError",AW,this.mapError(function(AX){return new AC(AX)}).flatMap(function(AX){if(AX instanceof AC){return AW(AX.error)}else{return U.once(AX)}}))};AV.prototype.flatMapConcat=function(){return Y.apply(null,[this,"flatMapConcat"].concat(F.call(arguments),[this.flatMapWithConcurrencyLimit.apply(this,[1].concat(F.call(arguments)))]))};AV.prototype.bufferingThrottle=function(AW){return Y(this,"bufferingThrottle",AW,this.flatMapConcat(function(AX){return U.once(AX).concat(U.later(AW).filter(false))}))};AV.prototype.not=function(){return Y(this,"not",this.map(function(AW){return !AW}))};AV.prototype.log=function(){var AW;AW=1<=arguments.length?F.call(arguments,0):[];this.subscribe(function(AX){return typeof console!=="undefined"&&console!==null?typeof console.log==="function"?console.log.apply(console,F.call(AW).concat([AX.log()])):void 0:void 0});return this};AV.prototype.slidingWindow=function(AX,AW){if(AW==null){AW=0}return Y(this,"slidingWindow",AX,AW,this.scan([],(function(AY,AZ){return AY.concat([AZ]).slice(-AX)})).filter((function(AY){return AY.length>=AW})))};AV.prototype.combine=function(AW,AY){var AX;AX=T(AY);return Y(this,"combine",AW,AY,U.combineAsArray(this,AW).map(function(AZ){return AX(AZ[0],AZ[1])}))};AV.prototype.decode=function(AW){return Y(this,"decode",AW,this.combine(U.combineTemplate(AW),function(AY,AX){return AX[AY]}))};AV.prototype.awaiting=function(AW){return Y(this,"awaiting",AW,U.groupSimultaneous(this,AW).map(function(AX){var AY,AZ;AY=AX[0],AZ=AX[1];return AZ.length===0}).toProperty(false).skipDuplicates())};AV.prototype.name=function(AW){this._name=AW;return this};AV.prototype.withDescription=function(){return H.apply(null,arguments).apply(this)};AV.prototype.toString=function(){if(this._name){return this._name}else{return this.desc.toString()}};AV.prototype.internalDeps=function(){return this.initialDesc.deps()};return AV})();Q.prototype.reduce=Q.prototype.fold;Q.prototype.assign=Q.prototype.onValue;Q.prototype.inspect=Q.prototype.toString;AM=function(AX,Ab,AY,AW){var Aa,AV,AZ;AZ=[AX];Aa=[];AV=new M(H(AX,"flatMap"+(AY?"First":""),Ab),function(Ae){var Ag,Af,Ah,Ac,Ad;Ah=new AN();Ac=[];Ad=function(Ai){var Aj;Aj=o(Ab(Ai.value()));Aa.push(Aj);return Ah.add(function(Al,Ak){return Aj.dispatcher.subscribe(function(An){var Am;if(An.isEnd()){h.remove(Aj,Aa);Af();Ag(Ak);return U.noMore}else{if(An instanceof AE){An=An.toNext()}Am=Ae(An);if(Am===U.noMore){Al()}return Am}})})};Af=function(){var Ai;Ai=Ac.shift();if(Ai){return Ad(Ai)}};Ag=function(Ai){Ai();if(Ah.empty()){return Ae(b())}};Ah.add(function(Aj,Ai){return AX.dispatcher.subscribe(function(Ak){if(Ak.isEnd()){return Ag(Ai)}else{if(Ak.isError()){return Ae(Ak)}else{if(AY&&Ah.count()>1){return U.more}else{if(Ah.unsubscribed){return U.noMore}if(AW&&Ah.count()>AW){return Ac.push(Ak)}else{return Ad(Ak)}}}}})});return Ah.unsubscribe});AV.internalDeps=function(){if(Aa.length){return AZ.concat(Aa)}else{return AZ}};return AV};M=(function(AW){C(AV,AW);function AV(AZ,AX,AY){if(AI(AZ)){AY=AX;AX=AZ;AZ=[]}AV.__super__.constructor.call(this,AZ);AK(AX);this.dispatcher=new Z(AX,AY);I(this)}AV.prototype.delay=function(AX){return Y(this,"delay",AX,this.flatMap(function(AY){return U.later(AX,AY)}))};AV.prototype.debounce=function(AX){return Y(this,"debounce",AX,this.flatMapLatest(function(AY){return U.later(AX,AY)}))};AV.prototype.debounceImmediate=function(AX){return Y(this,"debounceImmediate",AX,this.flatMapFirst(function(AY){return U.once(AY).concat(U.later(AX).filter(false))}))};AV.prototype.throttle=function(AX){return Y(this,"throttle",AX,this.bufferWithTime(AX).map(function(AY){return AY[AY.length-1]}))};AV.prototype.bufferWithTime=function(AX){return Y(this,"bufferWithTime",AX,this.bufferWithTimeOrCount(AX,Number.MAX_VALUE))};AV.prototype.bufferWithCount=function(AX){return Y(this,"bufferWithCount",AX,this.bufferWithTimeOrCount(void 0,AX))};AV.prototype.bufferWithTimeOrCount=function(AX,AY){var AZ;AZ=function(Aa){if(Aa.values.length===AY){return Aa.flush()}else{if(AX!==void 0){return Aa.schedule()}}};return Y(this,"bufferWithTimeOrCount",AX,AY,this.buffer(AX,AZ,AZ))};AV.prototype.buffer=function(AZ,Ab,AY){var AX,Ac,Aa;if(Ab==null){Ab=AO}if(AY==null){AY=AO}AX={scheduled:false,end:void 0,values:[],flush:function(){var Ad;this.scheduled=false;if(this.values.length>0){Ad=this.push(m(this.values));this.values=[];if(this.end!=null){return this.push(this.end)}else{if(Ad!==U.noMore){return AY(this)}}}else{if(this.end!=null){return this.push(this.end)}}},schedule:function(){if(!this.scheduled){this.scheduled=true;return AZ((function(Ad){return function(){return Ad.flush()}})(this))}}};Aa=U.more;if(!AI(AZ)){Ac=AZ;AZ=function(Ad){return U.scheduler.setTimeout(Ad,Ac)}}return Y(this,"buffer",this.withHandler(function(Ad){AX.push=(function(Ae){return function(Af){return Ae.push(Af)}})(this);if(Ad.isError()){Aa=this.push(Ad)}else{if(Ad.isEnd()){AX.end=Ad;if(!AX.scheduled){AX.flush()}}else{AX.values.push(Ad.value());Ab(AX)}}return Aa}))};AV.prototype.merge=function(AX){var AY;v(AX);AY=this;return Y(AY,"merge",AX,U.mergeAll(this,AX))};AV.prototype.toProperty=function(AX){var AY,AZ;AZ=arguments.length===0?K:q(function(){return AX});AY=this.dispatcher;return new AH(H(this,"toProperty",AX),function(Ae){var Ad,Ac,Ab,Aa;Ad=false;Aa=AO;Ac=U.more;Ab=function(){if(!Ad){return AZ.forEach(function(Af){Ad=true;Ac=Ae(new AE(Af));if(Ac===U.noMore){Aa();return Aa=AO}})}};Aa=AY.subscribe(function(Af){if(Af.hasValue()){if(Ad&&Af.isInitial()){return U.more}else{if(!Af.isInitial()){Ab()}Ad=true;AZ=new d(Af);return Ae(Af)}}else{if(Af.isEnd()){Ac=Ab()}if(Ac!==U.noMore){return Ae(Af)}}});Ab();return Aa})};AV.prototype.toEventStream=function(){return this};AV.prototype.sampledBy=function(AX,AY){return Y(this,"sampledBy",AX,AY,this.toProperty().sampledBy(AX,AY))};AV.prototype.concat=function(AX){var AY;AY=this;return new AV(H(AY,"concat",AX),function(Aa){var Ab,AZ;AZ=AO;Ab=AY.dispatcher.subscribe(function(Ac){if(Ac.isEnd()){return AZ=AX.dispatcher.subscribe(Aa)}else{return Aa(Ac)}});return function(){Ab();return AZ()}})};AV.prototype.takeUntil=function(AX){var AY;AY={};return Y(this,"takeUntil",AX,U.groupSimultaneous(this.mapEnd(AY),AX.skipErrors()).withHandler(function(Ac){var Af,Ab,Ae,Ad,Aa,AZ;if(!Ac.hasValue()){return this.push(Ac)}else{AZ=Ac.value(),Af=AZ[0],AX=AZ[1];if(AX.length){return this.push(b())}else{Ab=U.more;for(Ad=0,Aa=Af.length;Ad<Aa;Ad++){Ae=Af[Ad];if(Ae===AY){Ab=this.push(b())}else{Ab=this.push(m(Ae))}}return Ab}}}))};AV.prototype.skipUntil=function(AY){var AX;AX=AY.take(1).map(true).toProperty(false);return Y(this,"skipUntil",AY,this.filter(AX))};AV.prototype.skipWhile=function(){var AX,AZ,AY;AZ=arguments[0],AX=2<=arguments.length?F.call(arguments,1):[];AY=false;return e(this,AZ,AX,function(Aa){return Y(this,"skipWhile",Aa,this.withHandler(function(Ab){if(AY||!Ab.hasValue()||!Aa(Ab.value())){if(Ab.hasValue()){AY=true}return this.push(Ab)}else{return U.more}}))})};AV.prototype.holdWhen=function(Aa){var AY,AX,AZ;AZ=Aa.startWith(false);AX=AZ.filter(function(Ab){return !Ab});AY=AZ.filter(h.id);return Y(this,"holdWhen",Aa,this.filter(false).merge(AZ.flatMapConcat((function(Ab){return function(Ac){if(!Ac){return Ab.takeUntil(AY)}else{return Ab.scan([],(function(Ae,Ad){return Ae.concat(Ad)})).sampledBy(AX).take(1).flatMap(U.fromArray)}}})(this))))};AV.prototype.startWith=function(AX){return Y(this,"startWith",AX,U.once(AX).concat(this))};AV.prototype.withHandler=function(AX){return new AV(H(this,"withHandler",AX),this.dispatcher.subscribe,AX)};return AV})(Q);AH=(function(AV){C(AW,AV);function AW(AZ,AX,AY){if(AI(AZ)){AY=AX;AX=AZ;AZ=[]}AW.__super__.constructor.call(this,AZ);AK(AX);this.dispatcher=new W(this,AX,AY);I(this)}AW.prototype.sampledBy=function(AZ,Ac){var AY,AX,Aa,Ad,Ab;if(Ac!=null){Ac=T(Ac)}else{AY=true;Ac=function(Ae){return Ae.value()}}Ab=new AL(this,false,AY);Aa=new AL(AZ,true,AY);Ad=U.when([Ab,Aa],Ac);AX=AZ instanceof AW?Ad.toProperty():Ad;return Y(this,"sampledBy",AZ,Ac,AX)};AW.prototype.sample=function(AX){return Y(this,"sample",AX,this.sampledBy(U.interval(AX,{})))};AW.prototype.changes=function(){return new M(H(this,"changes"),(function(AX){return function(AY){return AX.dispatcher.subscribe(function(AZ){if(!AZ.isInitial()){return AY(AZ)}})}})(this))};AW.prototype.withHandler=function(AX){return new AW(H(this,"withHandler",AX),this.dispatcher.subscribe,AX)};AW.prototype.toProperty=function(){x(arguments);return this};AW.prototype.toEventStream=function(){return new M(H(this,"toEventStream"),(function(AX){return function(AY){return AX.dispatcher.subscribe(function(AZ){if(AZ.isInitial()){AZ=AZ.toNext()}return AY(AZ)})}})(this))};AW.prototype.and=function(AX){return Y(this,"and",AX,this.combine(AX,function(AY,AZ){return AY&&AZ}))};AW.prototype.or=function(AX){return Y(this,"or",AX,this.combine(AX,function(AY,AZ){return AY||AZ}))};AW.prototype.delay=function(AX){return this.delayChanges("delay",AX,function(AY){return AY.delay(AX)})};AW.prototype.debounce=function(AX){return this.delayChanges("debounce",AX,function(AY){return AY.debounce(AX)})};AW.prototype.throttle=function(AX){return this.delayChanges("throttle",AX,function(AY){return AY.throttle(AX)})};AW.prototype.delayChanges=function(){var AZ,AY,AX;AZ=2<=arguments.length?F.call(arguments,0,AX=arguments.length-1):(AX=0,[]),AY=arguments[AX++];return Y.apply(null,[this].concat(F.call(AZ),[V(this,AY(this.changes()))]))};AW.prototype.takeUntil=function(AY){var AX;AX=this.changes().takeUntil(AY);return Y(this,"takeUntil",AY,V(this,AX))};AW.prototype.startWith=function(AX){return Y(this,"startWith",AX,this.scan(AX,function(AZ,AY){return AY}))};AW.prototype.bufferingThrottle=function(){var AX;return(AX=AW.__super__.bufferingThrottle.apply(this,arguments)).bufferingThrottle.apply(AX,arguments).toProperty()};return AW})(Q);e=function(AZ,AX,AV,AY){var AW;if(AX instanceof AH){AW=AX.sampledBy(AZ,function(Ab,Aa){return[Ab,Aa]});return AY.call(AW,function(Aa){var Ac,Ab;Ac=Aa[0],Ab=Aa[1];return Ac}).map(function(Aa){var Ac,Ab;Ac=Aa[0],Ab=Aa[1];return Ab})}else{AX=u(AX,AV);return AY.call(AZ,AX)}};V=function(AW,AX){var AV;AV=new M(H(AW,"justInitValue"),function(Aa){var AY,AZ;AZ=void 0;AY=AW.dispatcher.subscribe(function(Ab){if(!Ab.isEnd()){AZ=Ab}return U.noMore});AG.whenDoneWith(AV,function(){if(AZ!=null){Aa(AZ)}return Aa(b())});return AY});return AV.concat(AX).toProperty()};Z=(function(){function AV(AW,AX){this._subscribe=AW;this._handleEvent=AX;this.subscribe=AD(this.subscribe,this);this.handleEvent=AD(this.handleEvent,this);this.subscriptions=[];this.queue=[];this.pushing=false;this.ended=false;this.prevError=void 0;this.unsubSrc=void 0}AV.prototype.hasSubscribers=function(){return this.subscriptions.length>0};AV.prototype.removeSub=function(AW){return this.subscriptions=h.without(AW,this.subscriptions)};AV.prototype.push=function(AW){if(AW.isEnd()){this.ended=true}return AG.inTransaction(AW,this,this.pushIt,[AW])};AV.prototype.pushToSubscriptions=function(Aa){var Ac,AZ,AY,AX,Ab,AW;try{AX=this.subscriptions;for(Ab=0,AW=AX.length;Ab<AW;Ab++){AY=AX[Ab];AZ=AY.sink(Aa);if(AZ===U.noMore||Aa.isEnd()){this.removeSub(AY)}}return true}catch(Ad){Ac=Ad;this.pushing=false;this.queue=[];throw Ac}};AV.prototype.pushIt=function(AW){if(!this.pushing){if(AW===this.prevError){return }if(AW.isError()){this.prevError=AW}this.pushing=true;this.pushToSubscriptions(AW);this.pushing=false;while(this.queue.length){AW=this.queue.shift();this.push(AW)}if(this.hasSubscribers()){return U.more}else{this.unsubscribeFromSource();return U.noMore}}else{this.queue.push(AW);return U.more}};AV.prototype.handleEvent=function(AW){if(this._handleEvent){return this._handleEvent(AW)}else{return this.push(AW)}};AV.prototype.unsubscribeFromSource=function(){if(this.unsubSrc){this.unsubSrc()}return this.unsubSrc=void 0};AV.prototype.subscribe=function(AX){var AW;if(this.ended){AX(b());return AO}else{AK(AX);AW={sink:AX};this.subscriptions.push(AW);if(this.subscriptions.length===1){this.unsubSrc=this._subscribe(this.handleEvent);AK(this.unsubSrc)}return(function(AY){return function(){AY.removeSub(AW);if(!AY.hasSubscribers()){return AY.unsubscribeFromSource()}}})(this)}};return AV})();W=(function(AV){C(AW,AV);function AW(AZ,AX,AY){this.property=AZ;this.subscribe=AD(this.subscribe,this);AW.__super__.constructor.call(this,AX,AY);this.current=K;this.currentValueRootId=void 0;this.propertyEnded=false}AW.prototype.push=function(AX){if(AX.isEnd()){this.propertyEnded=true}if(AX.hasValue()){this.current=new d(AX);this.currentValueRootId=AG.currentEventId()}return AW.__super__.push.call(this,AX)};AW.prototype.maybeSubSource=function(AY,AX){if(AX===U.noMore){return AO}else{if(this.propertyEnded){AY(b());return AO}else{return Z.prototype.subscribe.call(this,AY)}}};AW.prototype.subscribe=function(AZ){var Ab,AY,AX,Aa;AY=false;AX=U.more;if(this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)){Ab=AG.currentEventId();Aa=this.currentValueRootId;if(!this.propertyEnded&&Aa&&Ab&&Ab!==Aa){AG.whenDoneWith(this.property,(function(Ac){return function(){if(Ac.currentValueRootId===Aa){return AZ(E(Ac.current.get().value()))}}})(this));return this.maybeSubSource(AZ,AX)}else{AG.inTransaction(void 0,this,(function(){return AX=AZ(E(this.current.get().value()))}),[]);return this.maybeSubSource(AZ,AX)}}else{return this.maybeSubSource(AZ,AX)}};return AW})(Z);P=(function(AV){C(AW,AV);function AW(){this.guardedSink=AD(this.guardedSink,this);this.subscribeAll=AD(this.subscribeAll,this);this.unsubAll=AD(this.unsubAll,this);this.sink=void 0;this.subscriptions=[];this.ended=false;AW.__super__.constructor.call(this,H(U,"Bus"),this.subscribeAll)}AW.prototype.unsubAll=function(){var AZ,Aa,AY,AX;AX=this.subscriptions;for(Aa=0,AY=AX.length;Aa<AY;Aa++){AZ=AX[Aa];if(typeof AZ.unsub==="function"){AZ.unsub()}}return void 0};AW.prototype.subscribeAll=function(AZ){var Aa,Ab,AY,AX;this.sink=AZ;AX=y(this.subscriptions);for(Ab=0,AY=AX.length;Ab<AY;Ab++){Aa=AX[Ab];this.subscribeInput(Aa)}return this.unsubAll};AW.prototype.guardedSink=function(AX){return(function(AY){return function(AZ){if(AZ.isEnd()){AY.unsubscribeInput(AX);return U.noMore}else{return AY.sink(AZ)}}})(this)};AW.prototype.subscribeInput=function(AX){return AX.unsub=AX.input.dispatcher.subscribe(this.guardedSink(AX.input))};AW.prototype.unsubscribeInput=function(AZ){var Aa,Ab,Ac,AY,AX;AX=this.subscriptions;for(Aa=Ac=0,AY=AX.length;Ac<AY;Aa=++Ac){Ab=AX[Aa];if(Ab.input===AZ){if(typeof Ab.unsub==="function"){Ab.unsub()}this.subscriptions.splice(Aa,1);return }}};AW.prototype.plug=function(AX){var AY;S(AX);if(this.ended){return }AY={input:AX};this.subscriptions.push(AY);if((this.sink!=null)){this.subscribeInput(AY)}return(function(AZ){return function(){return AZ.unsubscribeInput(AX)}})(this)};AW.prototype.end=function(){this.ended=true;this.unsubAll();return typeof this.sink==="function"?this.sink(b()):void 0};AW.prototype.push=function(AX){return typeof this.sink==="function"?this.sink(m(AX)):void 0};AW.prototype.error=function(AX){return typeof this.sink==="function"?this.sink(new AC(AX)):void 0};return AW})(M);AL=(function(){function AV(AY,AX,AW){this.obs=AY;this.sync=AX;this.lazy=AW!=null?AW:false;this.queue=[]}AV.prototype.subscribe=function(AW){return this.obs.dispatcher.subscribe(AW)};AV.prototype.toString=function(){return this.obs.toString()};AV.prototype.markEnded=function(){return this.ended=true};AV.prototype.consume=function(){if(this.lazy){return{value:h.always(this.queue[0])}}else{return this.queue[0]}};AV.prototype.push=function(AW){return this.queue=[AW]};AV.prototype.mayHave=function(){return true};AV.prototype.hasAtLeast=function(){return this.queue.length};AV.prototype.flatten=true;return AV})();i=(function(AV){C(AW,AV);function AW(){return AW.__super__.constructor.apply(this,arguments)}AW.prototype.consume=function(){return this.queue.shift()};AW.prototype.push=function(AX){return this.queue.push(AX)};AW.prototype.mayHave=function(AX){return !this.ended||this.queue.length>=AX};AW.prototype.hasAtLeast=function(AX){return this.queue.length>=AX};AW.prototype.flatten=false;return AW})(AL);AJ=(function(AV){C(AW,AV);function AW(AX){AW.__super__.constructor.call(this,AX,true)}AW.prototype.consume=function(){var AX;AX=this.queue;this.queue=[];return{value:function(){return AX}}};AW.prototype.push=function(AX){return this.queue.push(AX.value())};AW.prototype.hasAtLeast=function(){return true};return AW})(AL);AL.isTrigger=function(AV){if(AV instanceof AL){return AV.sync}else{return AV instanceof M}};AL.fromObservable=function(AV){if(AV instanceof AL){return AV}else{if(AV instanceof AH){return new AL(AV,false)}else{return new i(AV,true)}}};H=function(){var AV,AW,AX;AW=arguments[0],AX=arguments[1],AV=3<=arguments.length?F.call(arguments,2):[];if((AW||AX) instanceof X){return AW||AX}else{return new X(AW,AX,AV)}};B=function(AV){if(A(AV)){return h.flatMap(B,AV)}else{if(AA(AV)){return[AV]}else{if(AV instanceof AL){return[AV.obs]}else{return[]}}}};X=(function(){function AV(AX,AY,AW){this.context=AX;this.method=AY;this.args=AW;this.cached=void 0}AV.prototype.deps=function(){return this.cached||(this.cached=B([this.context].concat(this.args)))};AV.prototype.apply=function(AW){AW.desc=this;return AW};AV.prototype.toString=function(){return h.toString(this.context)+"."+h.toString(this.method)+"("+h.map(h.toString,this.args)+")"};return AV})();Y=function(){var AW,AX,AV;AW=2<=arguments.length?F.call(arguments,0,AV=arguments.length-1):(AV=0,[]),AX=arguments[AV++];return H.apply(null,AW).apply(AX)};U.when=function(){var Aj,Ah,Ac,Ab,Ai,AZ,Af,Ae,Ad,AY,An,Ag,AV,Ak,Al,AX,AW,Am,Ao,Aa;if(arguments.length===0){return U.never()}Ai=arguments.length;Al="when: expecting arguments in the form (Observable+,function)+";J(Al,Ai%2===0);AV=[];Ad=[];Ah=0;AY=[];while(Ah<Ai){AY[Ah]=arguments[Ah];AY[Ah+1]=arguments[Ah+1];Ae=h.toArray(arguments[Ah]);Aj=z(arguments[Ah+1]);Af={f:Aj,ixs:[]};Ak=false;for(AX=0,Am=Ae.length;AX<Am;AX++){Ag=Ae[AX];Ac=h.indexOf(AV,Ag);if(!Ak){Ak=AL.isTrigger(Ag)}if(Ac<0){AV.push(Ag);Ac=AV.length-1}Aa=Af.ixs;for(AW=0,Ao=Aa.length;AW<Ao;AW++){Ab=Aa[AW];if(Ab.index===Ac){Ab.count++}}Af.ixs.push({index:Ac,count:1})}J("At least one EventStream required",Ak||(!Ae.length));if(Ae.length>0){Ad.push(Af)}Ah=Ah+2}if(!AV.length){return U.never()}AV=h.map(AL.fromObservable,AV);AZ=(h.any(AV,function(Ap){return Ap.flatten}))&&(AF(h.map((function(Ap){return Ap.obs}),AV)));return An=new M(H.apply(null,[U,"when"].concat(F.call(AY))),function(Aw){var Av,Au,Ap,Ar,At,Aq,As;As=[];Ap=false;Ar=function(Az){var Ay,Ax,A0;A0=Az.ixs;for(Ay=0,Ax=A0.length;Ay<Ax;Ay++){Ah=A0[Ay];if(!AV[Ah.index].hasAtLeast(Ah.count)){return false}}return true};Au=function(Ax){return !Ax.sync||Ax.ended};Av=function(Az){var Ay,Ax,A0;A0=Az.ixs;for(Ay=0,Ax=A0.length;Ay<Ax;Ay++){Ah=A0[Ay];if(!AV[Ah.index].mayHave(Ah.count)){return true}}};At=function(Ax){return !Ax.source.flatten};Aq=function(Ax){return function(Az){var Ay,A1,A0;A1=function(){return AG.whenDoneWith(An,Ay)};A0=function(){var A4,A7,A6,A3,A5,A2;if(As.length>0){A6=U.more;A3=As.pop();for(A5=0,A2=Ad.length;A5<A2;A5++){A7=Ad[A5];if(Ar(A7)){A4=(function(){var A9,BB,BA,A8;BA=A7.ixs;A8=[];for(A9=0,BB=BA.length;A9<BB;A9++){Ah=BA[A9];A8.push(AV[Ah.index].consume())}return A8})();A6=Aw(A3.e.apply(function(){var A9,A8;A8=(function(){var BB,BC,BA;BA=[];for(BB=0,BC=A4.length;BB<BC;BB++){A9=A4[BB];BA.push(A9.value())}return BA})();return A7.f.apply(A7,A8)}));if(As.length){As=h.filter(At,As)}if(A6===U.noMore){return A6}else{return A0()}}}}else{return U.more}};Ay=function(){var A2;A2=A0();if(Ap){Ap=false;if(h.all(AV,Au)||h.all(Ad,Av)){A2=U.noMore;Aw(b())}}if(A2===U.noMore){Az()}return A2};return Ax.subscribe(function(A3){var A2;if(A3.isEnd()){Ap=true;Ax.markEnded();A1()}else{if(A3.isError()){A2=Aw(A3)}else{Ax.push(A3);if(Ax.sync){As.push({source:Ax,e:A3});if(AZ||AG.hasWaiters()){A1()}else{Ay()}}}}if(A2===U.noMore){Az()}return A2||U.more})}};return l.apply(null,(function(){var Az,Ax,Ay;Ay=[];for(Az=0,Ax=AV.length;Az<Ax;Az++){Ag=AV[Az];Ay.push(Aq(Ag))}return Ay})())})};AF=function(AX,AW){var AV;if(AW==null){AW=[]}AV=function(AZ){var AY;if(h.contains(AW,AZ)){return true}else{AY=AZ.internalDeps();if(AY.length){AW.push(AZ);return h.any(AY,AV)}else{AW.push(AZ);return false}}};return h.any(AX,AV)};U.update=function(){var AX,AW,AV,AY;AW=arguments[0],AY=2<=arguments.length?F.call(arguments,1):[];AV=function(AZ){return function(){var Aa;Aa=1<=arguments.length?F.call(arguments,0):[];return function(Ab){return AZ.apply(null,[Ab].concat(Aa))}}};AX=AY.length-1;while(AX>0){if(!(AY[AX] instanceof Function)){AY[AX]=(function(AZ){return function(){return AZ}})(AY[AX])}AY[AX]=AV(AY[AX]);AX=AX-2}return Y.apply(null,[U,"update",AW].concat(F.call(AY),[U.when.apply(U,AY).scan(AW,(function(AZ,Aa){return Aa(AZ)}))]))};l=function(){var AV;AV=1<=arguments.length?F.call(arguments,0):[];return new AN(AV).unsubscribe};AN=(function(){function AV(AX){var AY,AZ,AW;if(AX==null){AX=[]}this.unsubscribe=AD(this.unsubscribe,this);this.unsubscribed=false;this.subscriptions=[];this.starting=[];for(AZ=0,AW=AX.length;AZ<AW;AZ++){AY=AX[AZ];this.add(AY)}}AV.prototype.add=function(AY){var AZ,AX,AW;if(this.unsubscribed){return }AZ=false;AX=AO;this.starting.push(AY);AW=(function(Aa){return function(){if(Aa.unsubscribed){return }AZ=true;Aa.remove(AX);return h.remove(AY,Aa.starting)}})(this);AX=AY(this.unsubscribe,AW);if(!(this.unsubscribed||AZ)){this.subscriptions.push(AX)}h.remove(AY,this.starting);return AX};AV.prototype.remove=function(AW){if(this.unsubscribed){return }if((h.remove(AW,this.subscriptions))!==void 0){return AW()}};AV.prototype.unsubscribe=function(){var AY,AZ,AX,AW;if(this.unsubscribed){return }this.unsubscribed=true;AW=this.subscriptions;for(AZ=0,AX=AW.length;AZ<AX;AZ++){AY=AW[AZ];AY()}this.subscriptions=[];return this.starting=[]};AV.prototype.count=function(){if(this.unsubscribed){return 0}return this.subscriptions.length+this.starting.length};AV.prototype.empty=function(){return this.count()===0};return AV})();U.CompositeUnsubscribe=AN;d=(function(){function AV(AW){this.value=AW}AV.prototype.getOrElse=function(){return this.value};AV.prototype.get=function(){return this.value};AV.prototype.filter=function(AW){if(AW(this.value)){return new AV(this.value)}else{return K}};AV.prototype.map=function(AW){return new AV(AW(this.value))};AV.prototype.forEach=function(AW){return AW(this.value)};AV.prototype.isDefined=true;AV.prototype.toArray=function(){return[this.value]};AV.prototype.inspect=function(){return"Some("+this.value+")"};AV.prototype.toString=function(){return this.inspect()};return AV})();K={getOrElse:function(AV){return AV},filter:function(){return K},map:function(){return K},forEach:function(){},isDefined:false,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}};AG=(function(){var Aa,Ah,AW,AX,Ae,Ai,Af,Ag,Ad,AV,AY,AZ,Ab,Ac;AV=void 0;AY=[];AZ={};Ah=[];AW=0;Aa=function(Aj){if(AV){return Ah.push(Aj)}else{return Aj()}};Ab=function(Al,Aj){var Ak;if(AV){Ak=AZ[Al.id];if(Ak==null){Ak=AZ[Al.id]=[Aj];return AY.push(Al)}else{return Ak.push(Aj)}}else{return Aj()}};Ae=function(){while(AY.length>0){Af(0)}return void 0};Af=function(Al){var An,Ap,Ak,Ao,Am,Aj;Ap=AY[Al];Ak=Ap.id;Ao=AZ[Ak];AY.splice(Al,1);delete AZ[Ak];Ai(Ap);for(Am=0,Aj=Ao.length;Am<Aj;Am++){An=Ao[Am];An()}return void 0};Ai=function(Ao){var Am,An,Ak,Al,Aj;An=Ao.internalDeps();for(Al=0,Aj=An.length;Al<Aj;Al++){Am=An[Al];Ai(Am);if(AZ[Am.id]){Ak=h.indexOf(AY,Am);Af(Ak)}}return void 0};Ad=function(Am,Al,An,Ak){var Ao,Aj;if(AV){return An.apply(Al,Ak)}else{AV=Am;try{Aj=An.apply(Al,Ak);Ae()}finally{AV=void 0;while(AW<Ah.length){Ao=Ah[AW];AW++;Ao()}AW=0;Ah=[]}return Aj}};AX=function(){if(AV){return AV.id}else{return void 0}};Ac=function(Ao,An){var Am,Aj,Al,Ak;Ak=false;Aj=false;Am=function(){return Aj=true};Al=function(){Ak=true;return Am()};Am=Ao.dispatcher.subscribe(function(Ap){return Aa(function(){var Aq;if(!Ak){Aq=An(Ap);if(Aq===U.noMore){return Al()}}})});if(Aj){Am()}return Al};Ag=function(){return AY.length>0};return{whenDoneWith:Ab,hasWaiters:Ag,inTransaction:Ad,currentEventId:AX,wrappedSubscribe:Ac,afterTransaction:Aa}})();U.EventStream=M;U.Property=AH;U.Observable=Q;U.Bus=P;U.Initial=AE;U.Next=AB;U.End=c;U.Error=AC;AO=function(){};AS=function(AW,AV){return AV};j=function(AV,AW){return AV};E=function(AV){return new AE(AV,true)};m=function(AV){return new AB(AV,true)};b=function(){return new c()};D=function(AV){if(AV instanceof a){return AV}else{return m(AV)}};y=function(AV){return AV.slice(0)};J=function(AV,AW){if(!AW){throw new f(AV)}};v=function(AV){if(!(AV instanceof M)){throw new f("not an EventStream : "+AV)}};S=function(AV){if(!(AV instanceof Q)){throw new f("not an Observable : "+AV)}};AK=function(AV){return J("not a function : "+AV,AI(AV))};AI=function(AV){return typeof AV==="function"};A=function(AV){return AV instanceof Array};AA=function(AV){return AV instanceof Q};p=function(AV){if(!A(AV)){throw new f("not an array : "+AV)}};x=function(AV){return J("no arguments supported",AV.length===0)};s=function(AV){if(typeof AV!=="string"){throw new f("not a string : "+AV)}};w=function(AW,AV){return function(){var AX;AX=1<=arguments.length?F.call(arguments,0):[];return AW.apply(null,AV.concat(AX))}};t=function(AV){if(AV.length===1&&AA(AV[0])){return h.always(AV[0])}else{return g(AV)}};g=function(AV){AV=Array.prototype.slice.call(AV);return G.apply(null,AV)};G=L(function(){var AV,AW;AW=arguments[0],AV=2<=arguments.length?F.call(arguments,1):[];if(AI(AW)){if(AV.length){return w(AW,AV)}else{return AW}}else{if(AR(AW)){return n(AW,AV)}else{return h.always(AW)}}});u=function(AW,AV){return G.apply(null,[AW].concat(F.call(AV)))};z=function(AV){if(AI(AV)){return AV}else{return h.always(AV)}};o=function(AV){if(AA(AV)){return AV}else{return U.once(AV)}};AR=function(AV){return(typeof AV==="string")&&AV.length>1&&AV.charAt(0)==="."};U.isFieldKey=AR;n=function(AX,AV){var AW,AY;AY=AX.slice(1).split(".");AW=h.map(k(AV),AY);return function(Ab){var Aa,AZ;for(Aa=0,AZ=AW.length;Aa<AZ;Aa++){AX=AW[Aa];Ab=AX(Ab)}return Ab}};k=function(AV){return function(AW){return function(AY){var AX;if(AY==null){return void 0}else{AX=AY[AW];if(AI(AX)){return AX.apply(AY,AV)}else{return AX}}}}};AQ=function(AV){return AV.slice(1)};T=function(AW){var AV;if(AI(AW)){return AW}else{if(AR(AW)){AV=AQ(AW);return function(AY,AX){return AY[AV](AX)}}else{return J("not a function or a field key: "+AW,false)}}};q=function(AV){if(AV instanceof d||AV===K){return AV}else{return new d(AV)}};if((typeof define!=="undefined"&&define!==null)&&(define.amd!=null)){define([],function(){return U});this.Bacon=U}else{if((typeof module!=="undefined"&&module!==null)&&(module.exports!=null)){module.exports=U;U.Bacon=U}else{this.Bacon=U}}}).call(this);