// Compiled by ClojureScript 1.10.520 {}
goog.provide('cljs.core.async');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.protocols');
goog.require('cljs.core.async.impl.channels');
goog.require('cljs.core.async.impl.buffers');
goog.require('cljs.core.async.impl.timers');
goog.require('cljs.core.async.impl.dispatch');
goog.require('cljs.core.async.impl.ioc_helpers');
cljs.core.async.fn_handler = (function cljs$core$async$fn_handler(var_args){
var G__38430 = arguments.length;
switch (G__38430) {
case 1:
return cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$1 = (function (f){
return cljs.core.async.fn_handler.call(null,f,true);
});

cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2 = (function (f,blockable){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async38431 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async38431 = (function (f,blockable,meta38432){
this.f = f;
this.blockable = blockable;
this.meta38432 = meta38432;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async38431.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_38433,meta38432__$1){
var self__ = this;
var _38433__$1 = this;
return (new cljs.core.async.t_cljs$core$async38431(self__.f,self__.blockable,meta38432__$1));
});

cljs.core.async.t_cljs$core$async38431.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_38433){
var self__ = this;
var _38433__$1 = this;
return self__.meta38432;
});

cljs.core.async.t_cljs$core$async38431.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async38431.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
});

cljs.core.async.t_cljs$core$async38431.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.blockable;
});

cljs.core.async.t_cljs$core$async38431.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.f;
});

cljs.core.async.t_cljs$core$async38431.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"blockable","blockable",-28395259,null),new cljs.core.Symbol(null,"meta38432","meta38432",-1493567469,null)], null);
});

cljs.core.async.t_cljs$core$async38431.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async38431.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async38431";

cljs.core.async.t_cljs$core$async38431.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async38431");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async38431.
 */
cljs.core.async.__GT_t_cljs$core$async38431 = (function cljs$core$async$__GT_t_cljs$core$async38431(f__$1,blockable__$1,meta38432){
return (new cljs.core.async.t_cljs$core$async38431(f__$1,blockable__$1,meta38432));
});

}

return (new cljs.core.async.t_cljs$core$async38431(f,blockable,cljs.core.PersistentArrayMap.EMPTY));
});

cljs.core.async.fn_handler.cljs$lang$maxFixedArity = 2;

/**
 * Returns a fixed buffer of size n. When full, puts will block/park.
 */
cljs.core.async.buffer = (function cljs$core$async$buffer(n){
return cljs.core.async.impl.buffers.fixed_buffer.call(null,n);
});
/**
 * Returns a buffer of size n. When full, puts will complete but
 *   val will be dropped (no transfer).
 */
cljs.core.async.dropping_buffer = (function cljs$core$async$dropping_buffer(n){
return cljs.core.async.impl.buffers.dropping_buffer.call(null,n);
});
/**
 * Returns a buffer of size n. When full, puts will complete, and be
 *   buffered, but oldest elements in buffer will be dropped (not
 *   transferred).
 */
cljs.core.async.sliding_buffer = (function cljs$core$async$sliding_buffer(n){
return cljs.core.async.impl.buffers.sliding_buffer.call(null,n);
});
/**
 * Returns true if a channel created with buff will never block. That is to say,
 * puts into this buffer will never cause the buffer to be full. 
 */
cljs.core.async.unblocking_buffer_QMARK_ = (function cljs$core$async$unblocking_buffer_QMARK_(buff){
if((!((buff == null)))){
if(((false) || ((cljs.core.PROTOCOL_SENTINEL === buff.cljs$core$async$impl$protocols$UnblockingBuffer$)))){
return true;
} else {
if((!buff.cljs$lang$protocol_mask$partition$)){
return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.async.impl.protocols.UnblockingBuffer,buff);
} else {
return false;
}
}
} else {
return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.async.impl.protocols.UnblockingBuffer,buff);
}
});
/**
 * Creates a channel with an optional buffer, an optional transducer (like (map f),
 *   (filter p) etc or a composition thereof), and an optional exception handler.
 *   If buf-or-n is a number, will create and use a fixed buffer of that size. If a
 *   transducer is supplied a buffer must be specified. ex-handler must be a
 *   fn of one argument - if an exception occurs during transformation it will be called
 *   with the thrown value as an argument, and any non-nil return value will be placed
 *   in the channel.
 */
cljs.core.async.chan = (function cljs$core$async$chan(var_args){
var G__38437 = arguments.length;
switch (G__38437) {
case 0:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$0();

break;
case 1:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.async.chan.call(null,null);
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf_or_n){
return cljs.core.async.chan.call(null,buf_or_n,null,null);
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$2 = (function (buf_or_n,xform){
return cljs.core.async.chan.call(null,buf_or_n,xform,null);
});

cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3 = (function (buf_or_n,xform,ex_handler){
var buf_or_n__$1 = ((cljs.core._EQ_.call(null,buf_or_n,(0)))?null:buf_or_n);
if(cljs.core.truth_(xform)){
if(cljs.core.truth_(buf_or_n__$1)){
} else {
throw (new Error(["Assert failed: ","buffer must be supplied when transducer is","\n","buf-or-n"].join('')));
}
} else {
}

return cljs.core.async.impl.channels.chan.call(null,((typeof buf_or_n__$1 === 'number')?cljs.core.async.buffer.call(null,buf_or_n__$1):buf_or_n__$1),xform,ex_handler);
});

cljs.core.async.chan.cljs$lang$maxFixedArity = 3;

/**
 * Creates a promise channel with an optional transducer, and an optional
 *   exception-handler. A promise channel can take exactly one value that consumers
 *   will receive. Once full, puts complete but val is dropped (no transfer).
 *   Consumers will block until either a value is placed in the channel or the
 *   channel is closed. See chan for the semantics of xform and ex-handler.
 */
cljs.core.async.promise_chan = (function cljs$core$async$promise_chan(var_args){
var G__38440 = arguments.length;
switch (G__38440) {
case 0:
return cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$0();

break;
case 1:
return cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.async.promise_chan.call(null,null);
});

cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$1 = (function (xform){
return cljs.core.async.promise_chan.call(null,xform,null);
});

cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$2 = (function (xform,ex_handler){
return cljs.core.async.chan.call(null,cljs.core.async.impl.buffers.promise_buffer.call(null),xform,ex_handler);
});

cljs.core.async.promise_chan.cljs$lang$maxFixedArity = 2;

/**
 * Returns a channel that will close after msecs
 */
cljs.core.async.timeout = (function cljs$core$async$timeout(msecs){
return cljs.core.async.impl.timers.timeout.call(null,msecs);
});
/**
 * takes a val from port. Must be called inside a (go ...) block. Will
 *   return nil if closed. Will park if nothing is available.
 *   Returns true unless port is already closed
 */
cljs.core.async._LT__BANG_ = (function cljs$core$async$_LT__BANG_(port){
throw (new Error("<! used not in (go ...) block"));
});
/**
 * Asynchronously takes a val from port, passing to fn1. Will pass nil
 * if closed. If on-caller? (default true) is true, and value is
 * immediately available, will call fn1 on calling thread.
 * Returns nil.
 */
cljs.core.async.take_BANG_ = (function cljs$core$async$take_BANG_(var_args){
var G__38443 = arguments.length;
switch (G__38443) {
case 2:
return cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,fn1){
return cljs.core.async.take_BANG_.call(null,port,fn1,true);
});

cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$3 = (function (port,fn1,on_caller_QMARK_){
var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.fn_handler.call(null,fn1));
if(cljs.core.truth_(ret)){
var val_38445 = cljs.core.deref.call(null,ret);
if(cljs.core.truth_(on_caller_QMARK_)){
fn1.call(null,val_38445);
} else {
cljs.core.async.impl.dispatch.run.call(null,((function (val_38445,ret){
return (function (){
return fn1.call(null,val_38445);
});})(val_38445,ret))
);
}
} else {
}

return null;
});

cljs.core.async.take_BANG_.cljs$lang$maxFixedArity = 3;

cljs.core.async.nop = (function cljs$core$async$nop(_){
return null;
});
cljs.core.async.fhnop = cljs.core.async.fn_handler.call(null,cljs.core.async.nop);
/**
 * puts a val into port. nil values are not allowed. Must be called
 *   inside a (go ...) block. Will park if no buffer space is available.
 *   Returns true unless port is already closed.
 */
cljs.core.async._GT__BANG_ = (function cljs$core$async$_GT__BANG_(port,val){
throw (new Error(">! used not in (go ...) block"));
});
/**
 * Asynchronously puts a val into port, calling fn1 (if supplied) when
 * complete. nil values are not allowed. Will throw if closed. If
 * on-caller? (default true) is true, and the put is immediately
 * accepted, will call fn1 on calling thread.  Returns nil.
 */
cljs.core.async.put_BANG_ = (function cljs$core$async$put_BANG_(var_args){
var G__38447 = arguments.length;
switch (G__38447) {
case 2:
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
case 4:
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,val){
var temp__5718__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fhnop);
if(cljs.core.truth_(temp__5718__auto__)){
var ret = temp__5718__auto__;
return cljs.core.deref.call(null,ret);
} else {
return true;
}
});

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3 = (function (port,val,fn1){
return cljs.core.async.put_BANG_.call(null,port,val,fn1,true);
});

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$4 = (function (port,val,fn1,on_caller_QMARK_){
var temp__5718__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fn_handler.call(null,fn1));
if(cljs.core.truth_(temp__5718__auto__)){
var retb = temp__5718__auto__;
var ret = cljs.core.deref.call(null,retb);
if(cljs.core.truth_(on_caller_QMARK_)){
fn1.call(null,ret);
} else {
cljs.core.async.impl.dispatch.run.call(null,((function (ret,retb,temp__5718__auto__){
return (function (){
return fn1.call(null,ret);
});})(ret,retb,temp__5718__auto__))
);
}

return ret;
} else {
return true;
}
});

cljs.core.async.put_BANG_.cljs$lang$maxFixedArity = 4;

cljs.core.async.close_BANG_ = (function cljs$core$async$close_BANG_(port){
return cljs.core.async.impl.protocols.close_BANG_.call(null,port);
});
cljs.core.async.random_array = (function cljs$core$async$random_array(n){
var a = (new Array(n));
var n__4607__auto___38449 = n;
var x_38450 = (0);
while(true){
if((x_38450 < n__4607__auto___38449)){
(a[x_38450] = (0));

var G__38451 = (x_38450 + (1));
x_38450 = G__38451;
continue;
} else {
}
break;
}

var i = (1);
while(true){
if(cljs.core._EQ_.call(null,i,n)){
return a;
} else {
var j = cljs.core.rand_int.call(null,i);
(a[i] = (a[j]));

(a[j] = i);

var G__38452 = (i + (1));
i = G__38452;
continue;
}
break;
}
});
cljs.core.async.alt_flag = (function cljs$core$async$alt_flag(){
var flag = cljs.core.atom.call(null,true);
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async38453 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async38453 = (function (flag,meta38454){
this.flag = flag;
this.meta38454 = meta38454;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async38453.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (flag){
return (function (_38455,meta38454__$1){
var self__ = this;
var _38455__$1 = this;
return (new cljs.core.async.t_cljs$core$async38453(self__.flag,meta38454__$1));
});})(flag))
;

cljs.core.async.t_cljs$core$async38453.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (flag){
return (function (_38455){
var self__ = this;
var _38455__$1 = this;
return self__.meta38454;
});})(flag))
;

cljs.core.async.t_cljs$core$async38453.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async38453.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = ((function (flag){
return (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.deref.call(null,self__.flag);
});})(flag))
;

cljs.core.async.t_cljs$core$async38453.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = ((function (flag){
return (function (_){
var self__ = this;
var ___$1 = this;
return true;
});})(flag))
;

cljs.core.async.t_cljs$core$async38453.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = ((function (flag){
return (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_.call(null,self__.flag,null);

return true;
});})(flag))
;

cljs.core.async.t_cljs$core$async38453.getBasis = ((function (flag){
return (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"flag","flag",-1565787888,null),new cljs.core.Symbol(null,"meta38454","meta38454",-1062104821,null)], null);
});})(flag))
;

cljs.core.async.t_cljs$core$async38453.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async38453.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async38453";

cljs.core.async.t_cljs$core$async38453.cljs$lang$ctorPrWriter = ((function (flag){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async38453");
});})(flag))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async38453.
 */
cljs.core.async.__GT_t_cljs$core$async38453 = ((function (flag){
return (function cljs$core$async$alt_flag_$___GT_t_cljs$core$async38453(flag__$1,meta38454){
return (new cljs.core.async.t_cljs$core$async38453(flag__$1,meta38454));
});})(flag))
;

}

return (new cljs.core.async.t_cljs$core$async38453(flag,cljs.core.PersistentArrayMap.EMPTY));
});
cljs.core.async.alt_handler = (function cljs$core$async$alt_handler(flag,cb){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async38456 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async38456 = (function (flag,cb,meta38457){
this.flag = flag;
this.cb = cb;
this.meta38457 = meta38457;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async38456.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_38458,meta38457__$1){
var self__ = this;
var _38458__$1 = this;
return (new cljs.core.async.t_cljs$core$async38456(self__.flag,self__.cb,meta38457__$1));
});

cljs.core.async.t_cljs$core$async38456.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_38458){
var self__ = this;
var _38458__$1 = this;
return self__.meta38457;
});

cljs.core.async.t_cljs$core$async38456.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async38456.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.active_QMARK_.call(null,self__.flag);
});

cljs.core.async.t_cljs$core$async38456.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
});

cljs.core.async.t_cljs$core$async38456.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.async.impl.protocols.commit.call(null,self__.flag);

return self__.cb;
});

cljs.core.async.t_cljs$core$async38456.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"flag","flag",-1565787888,null),new cljs.core.Symbol(null,"cb","cb",-2064487928,null),new cljs.core.Symbol(null,"meta38457","meta38457",554063549,null)], null);
});

cljs.core.async.t_cljs$core$async38456.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async38456.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async38456";

cljs.core.async.t_cljs$core$async38456.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async38456");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async38456.
 */
cljs.core.async.__GT_t_cljs$core$async38456 = (function cljs$core$async$alt_handler_$___GT_t_cljs$core$async38456(flag__$1,cb__$1,meta38457){
return (new cljs.core.async.t_cljs$core$async38456(flag__$1,cb__$1,meta38457));
});

}

return (new cljs.core.async.t_cljs$core$async38456(flag,cb,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * returns derefable [val port] if immediate, nil if enqueued
 */
cljs.core.async.do_alts = (function cljs$core$async$do_alts(fret,ports,opts){
var flag = cljs.core.async.alt_flag.call(null);
var n = cljs.core.count.call(null,ports);
var idxs = cljs.core.async.random_array.call(null,n);
var priority = new cljs.core.Keyword(null,"priority","priority",1431093715).cljs$core$IFn$_invoke$arity$1(opts);
var ret = (function (){var i = (0);
while(true){
if((i < n)){
var idx = (cljs.core.truth_(priority)?i:(idxs[i]));
var port = cljs.core.nth.call(null,ports,idx);
var wport = ((cljs.core.vector_QMARK_.call(null,port))?port.call(null,(0)):null);
var vbox = (cljs.core.truth_(wport)?(function (){var val = port.call(null,(1));
return cljs.core.async.impl.protocols.put_BANG_.call(null,wport,val,cljs.core.async.alt_handler.call(null,flag,((function (i,val,idx,port,wport,flag,n,idxs,priority){
return (function (p1__38459_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__38459_SHARP_,wport], null));
});})(i,val,idx,port,wport,flag,n,idxs,priority))
));
})():cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.alt_handler.call(null,flag,((function (i,idx,port,wport,flag,n,idxs,priority){
return (function (p1__38460_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__38460_SHARP_,port], null));
});})(i,idx,port,wport,flag,n,idxs,priority))
)));
if(cljs.core.truth_(vbox)){
return cljs.core.async.impl.channels.box.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref.call(null,vbox),(function (){var or__4131__auto__ = wport;
if(cljs.core.truth_(or__4131__auto__)){
return or__4131__auto__;
} else {
return port;
}
})()], null));
} else {
var G__38461 = (i + (1));
i = G__38461;
continue;
}
} else {
return null;
}
break;
}
})();
var or__4131__auto__ = ret;
if(cljs.core.truth_(or__4131__auto__)){
return or__4131__auto__;
} else {
if(cljs.core.contains_QMARK_.call(null,opts,new cljs.core.Keyword(null,"default","default",-1987822328))){
var temp__5720__auto__ = (function (){var and__4120__auto__ = cljs.core.async.impl.protocols.active_QMARK_.call(null,flag);
if(cljs.core.truth_(and__4120__auto__)){
return cljs.core.async.impl.protocols.commit.call(null,flag);
} else {
return and__4120__auto__;
}
})();
if(cljs.core.truth_(temp__5720__auto__)){
var got = temp__5720__auto__;
return cljs.core.async.impl.channels.box.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"default","default",-1987822328).cljs$core$IFn$_invoke$arity$1(opts),new cljs.core.Keyword(null,"default","default",-1987822328)], null));
} else {
return null;
}
} else {
return null;
}
}
});
/**
 * Completes at most one of several channel operations. Must be called
 * inside a (go ...) block. ports is a vector of channel endpoints,
 * which can be either a channel to take from or a vector of
 *   [channel-to-put-to val-to-put], in any combination. Takes will be
 *   made as if by <!, and puts will be made as if by >!. Unless
 *   the :priority option is true, if more than one port operation is
 *   ready a non-deterministic choice will be made. If no operation is
 *   ready and a :default value is supplied, [default-val :default] will
 *   be returned, otherwise alts! will park until the first operation to
 *   become ready completes. Returns [val port] of the completed
 *   operation, where val is the value taken for takes, and a
 *   boolean (true unless already closed, as per put!) for puts.
 * 
 *   opts are passed as :key val ... Supported options:
 * 
 *   :default val - the value to use if none of the operations are immediately ready
 *   :priority true - (default nil) when true, the operations will be tried in order.
 * 
 *   Note: there is no guarantee that the port exps or val exprs will be
 *   used, nor in what order should they be, so they should not be
 *   depended upon for side effects.
 */
cljs.core.async.alts_BANG_ = (function cljs$core$async$alts_BANG_(var_args){
var args__4736__auto__ = [];
var len__4730__auto___38467 = arguments.length;
var i__4731__auto___38468 = (0);
while(true){
if((i__4731__auto___38468 < len__4730__auto___38467)){
args__4736__auto__.push((arguments[i__4731__auto___38468]));

var G__38469 = (i__4731__auto___38468 + (1));
i__4731__auto___38468 = G__38469;
continue;
} else {
}
break;
}

var argseq__4737__auto__ = ((((1) < args__4736__auto__.length))?(new cljs.core.IndexedSeq(args__4736__auto__.slice((1)),(0),null)):null);
return cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__4737__auto__);
});

cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__38464){
var map__38465 = p__38464;
var map__38465__$1 = (((((!((map__38465 == null))))?(((((map__38465.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__38465.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__38465):map__38465);
var opts = map__38465__$1;
throw (new Error("alts! used not in (go ...) block"));
});

cljs.core.async.alts_BANG_.cljs$lang$maxFixedArity = (1);

/** @this {Function} */
cljs.core.async.alts_BANG_.cljs$lang$applyTo = (function (seq38462){
var G__38463 = cljs.core.first.call(null,seq38462);
var seq38462__$1 = cljs.core.next.call(null,seq38462);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__38463,seq38462__$1);
});

/**
 * Puts a val into port if it's possible to do so immediately.
 *   nil values are not allowed. Never blocks. Returns true if offer succeeds.
 */
cljs.core.async.offer_BANG_ = (function cljs$core$async$offer_BANG_(port,val){
var ret = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fn_handler.call(null,cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref.call(null,ret);
} else {
return null;
}
});
/**
 * Takes a val from port if it's possible to do so immediately.
 *   Never blocks. Returns value if successful, nil otherwise.
 */
cljs.core.async.poll_BANG_ = (function cljs$core$async$poll_BANG_(port){
var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.fn_handler.call(null,cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref.call(null,ret);
} else {
return null;
}
});
/**
 * Takes elements from the from channel and supplies them to the to
 * channel. By default, the to channel will be closed when the from
 * channel closes, but can be determined by the close?  parameter. Will
 * stop consuming the from channel if the to channel closes
 */
cljs.core.async.pipe = (function cljs$core$async$pipe(var_args){
var G__38471 = arguments.length;
switch (G__38471) {
case 2:
return cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$2 = (function (from,to){
return cljs.core.async.pipe.call(null,from,to,true);
});

cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3 = (function (from,to,close_QMARK_){
var c__38370__auto___38517 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___38517){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___38517){
return (function (state_38495){
var state_val_38496 = (state_38495[(1)]);
if((state_val_38496 === (7))){
var inst_38491 = (state_38495[(2)]);
var state_38495__$1 = state_38495;
var statearr_38497_38518 = state_38495__$1;
(statearr_38497_38518[(2)] = inst_38491);

(statearr_38497_38518[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (1))){
var state_38495__$1 = state_38495;
var statearr_38498_38519 = state_38495__$1;
(statearr_38498_38519[(2)] = null);

(statearr_38498_38519[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (4))){
var inst_38474 = (state_38495[(7)]);
var inst_38474__$1 = (state_38495[(2)]);
var inst_38475 = (inst_38474__$1 == null);
var state_38495__$1 = (function (){var statearr_38499 = state_38495;
(statearr_38499[(7)] = inst_38474__$1);

return statearr_38499;
})();
if(cljs.core.truth_(inst_38475)){
var statearr_38500_38520 = state_38495__$1;
(statearr_38500_38520[(1)] = (5));

} else {
var statearr_38501_38521 = state_38495__$1;
(statearr_38501_38521[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (13))){
var state_38495__$1 = state_38495;
var statearr_38502_38522 = state_38495__$1;
(statearr_38502_38522[(2)] = null);

(statearr_38502_38522[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (6))){
var inst_38474 = (state_38495[(7)]);
var state_38495__$1 = state_38495;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_38495__$1,(11),to,inst_38474);
} else {
if((state_val_38496 === (3))){
var inst_38493 = (state_38495[(2)]);
var state_38495__$1 = state_38495;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38495__$1,inst_38493);
} else {
if((state_val_38496 === (12))){
var state_38495__$1 = state_38495;
var statearr_38503_38523 = state_38495__$1;
(statearr_38503_38523[(2)] = null);

(statearr_38503_38523[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (2))){
var state_38495__$1 = state_38495;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38495__$1,(4),from);
} else {
if((state_val_38496 === (11))){
var inst_38484 = (state_38495[(2)]);
var state_38495__$1 = state_38495;
if(cljs.core.truth_(inst_38484)){
var statearr_38504_38524 = state_38495__$1;
(statearr_38504_38524[(1)] = (12));

} else {
var statearr_38505_38525 = state_38495__$1;
(statearr_38505_38525[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (9))){
var state_38495__$1 = state_38495;
var statearr_38506_38526 = state_38495__$1;
(statearr_38506_38526[(2)] = null);

(statearr_38506_38526[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (5))){
var state_38495__$1 = state_38495;
if(cljs.core.truth_(close_QMARK_)){
var statearr_38507_38527 = state_38495__$1;
(statearr_38507_38527[(1)] = (8));

} else {
var statearr_38508_38528 = state_38495__$1;
(statearr_38508_38528[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (14))){
var inst_38489 = (state_38495[(2)]);
var state_38495__$1 = state_38495;
var statearr_38509_38529 = state_38495__$1;
(statearr_38509_38529[(2)] = inst_38489);

(statearr_38509_38529[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (10))){
var inst_38481 = (state_38495[(2)]);
var state_38495__$1 = state_38495;
var statearr_38510_38530 = state_38495__$1;
(statearr_38510_38530[(2)] = inst_38481);

(statearr_38510_38530[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38496 === (8))){
var inst_38478 = cljs.core.async.close_BANG_.call(null,to);
var state_38495__$1 = state_38495;
var statearr_38511_38531 = state_38495__$1;
(statearr_38511_38531[(2)] = inst_38478);

(statearr_38511_38531[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___38517))
;
return ((function (switch__38275__auto__,c__38370__auto___38517){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_38512 = [null,null,null,null,null,null,null,null];
(statearr_38512[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_38512[(1)] = (1));

return statearr_38512;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_38495){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38495);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38513){if((e38513 instanceof Object)){
var ex__38279__auto__ = e38513;
var statearr_38514_38532 = state_38495;
(statearr_38514_38532[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38495);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38513;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38533 = state_38495;
state_38495 = G__38533;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_38495){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_38495);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___38517))
})();
var state__38372__auto__ = (function (){var statearr_38515 = f__38371__auto__.call(null);
(statearr_38515[(6)] = c__38370__auto___38517);

return statearr_38515;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___38517))
);


return to;
});

cljs.core.async.pipe.cljs$lang$maxFixedArity = 3;

cljs.core.async.pipeline_STAR_ = (function cljs$core$async$pipeline_STAR_(n,to,xf,from,close_QMARK_,ex_handler,type){
if((n > (0))){
} else {
throw (new Error("Assert failed: (pos? n)"));
}

var jobs = cljs.core.async.chan.call(null,n);
var results = cljs.core.async.chan.call(null,n);
var process = ((function (jobs,results){
return (function (p__38534){
var vec__38535 = p__38534;
var v = cljs.core.nth.call(null,vec__38535,(0),null);
var p = cljs.core.nth.call(null,vec__38535,(1),null);
var job = vec__38535;
if((job == null)){
cljs.core.async.close_BANG_.call(null,results);

return null;
} else {
var res = cljs.core.async.chan.call(null,(1),xf,ex_handler);
var c__38370__auto___38706 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___38706,res,vec__38535,v,p,job,jobs,results){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___38706,res,vec__38535,v,p,job,jobs,results){
return (function (state_38542){
var state_val_38543 = (state_38542[(1)]);
if((state_val_38543 === (1))){
var state_38542__$1 = state_38542;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_38542__$1,(2),res,v);
} else {
if((state_val_38543 === (2))){
var inst_38539 = (state_38542[(2)]);
var inst_38540 = cljs.core.async.close_BANG_.call(null,res);
var state_38542__$1 = (function (){var statearr_38544 = state_38542;
(statearr_38544[(7)] = inst_38539);

return statearr_38544;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38542__$1,inst_38540);
} else {
return null;
}
}
});})(c__38370__auto___38706,res,vec__38535,v,p,job,jobs,results))
;
return ((function (switch__38275__auto__,c__38370__auto___38706,res,vec__38535,v,p,job,jobs,results){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0 = (function (){
var statearr_38545 = [null,null,null,null,null,null,null,null];
(statearr_38545[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__);

(statearr_38545[(1)] = (1));

return statearr_38545;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1 = (function (state_38542){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38542);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38546){if((e38546 instanceof Object)){
var ex__38279__auto__ = e38546;
var statearr_38547_38707 = state_38542;
(statearr_38547_38707[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38542);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38546;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38708 = state_38542;
state_38542 = G__38708;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = function(state_38542){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1.call(this,state_38542);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___38706,res,vec__38535,v,p,job,jobs,results))
})();
var state__38372__auto__ = (function (){var statearr_38548 = f__38371__auto__.call(null);
(statearr_38548[(6)] = c__38370__auto___38706);

return statearr_38548;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___38706,res,vec__38535,v,p,job,jobs,results))
);


cljs.core.async.put_BANG_.call(null,p,res);

return true;
}
});})(jobs,results))
;
var async = ((function (jobs,results,process){
return (function (p__38549){
var vec__38550 = p__38549;
var v = cljs.core.nth.call(null,vec__38550,(0),null);
var p = cljs.core.nth.call(null,vec__38550,(1),null);
var job = vec__38550;
if((job == null)){
cljs.core.async.close_BANG_.call(null,results);

return null;
} else {
var res = cljs.core.async.chan.call(null,(1));
xf.call(null,v,res);

cljs.core.async.put_BANG_.call(null,p,res);

return true;
}
});})(jobs,results,process))
;
var n__4607__auto___38709 = n;
var __38710 = (0);
while(true){
if((__38710 < n__4607__auto___38709)){
var G__38553_38711 = type;
var G__38553_38712__$1 = (((G__38553_38711 instanceof cljs.core.Keyword))?G__38553_38711.fqn:null);
switch (G__38553_38712__$1) {
case "compute":
var c__38370__auto___38714 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__38710,c__38370__auto___38714,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (__38710,c__38370__auto___38714,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async){
return (function (state_38566){
var state_val_38567 = (state_38566[(1)]);
if((state_val_38567 === (1))){
var state_38566__$1 = state_38566;
var statearr_38568_38715 = state_38566__$1;
(statearr_38568_38715[(2)] = null);

(statearr_38568_38715[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38567 === (2))){
var state_38566__$1 = state_38566;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38566__$1,(4),jobs);
} else {
if((state_val_38567 === (3))){
var inst_38564 = (state_38566[(2)]);
var state_38566__$1 = state_38566;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38566__$1,inst_38564);
} else {
if((state_val_38567 === (4))){
var inst_38556 = (state_38566[(2)]);
var inst_38557 = process.call(null,inst_38556);
var state_38566__$1 = state_38566;
if(cljs.core.truth_(inst_38557)){
var statearr_38569_38716 = state_38566__$1;
(statearr_38569_38716[(1)] = (5));

} else {
var statearr_38570_38717 = state_38566__$1;
(statearr_38570_38717[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38567 === (5))){
var state_38566__$1 = state_38566;
var statearr_38571_38718 = state_38566__$1;
(statearr_38571_38718[(2)] = null);

(statearr_38571_38718[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38567 === (6))){
var state_38566__$1 = state_38566;
var statearr_38572_38719 = state_38566__$1;
(statearr_38572_38719[(2)] = null);

(statearr_38572_38719[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38567 === (7))){
var inst_38562 = (state_38566[(2)]);
var state_38566__$1 = state_38566;
var statearr_38573_38720 = state_38566__$1;
(statearr_38573_38720[(2)] = inst_38562);

(statearr_38573_38720[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__38710,c__38370__auto___38714,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async))
;
return ((function (__38710,switch__38275__auto__,c__38370__auto___38714,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0 = (function (){
var statearr_38574 = [null,null,null,null,null,null,null];
(statearr_38574[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__);

(statearr_38574[(1)] = (1));

return statearr_38574;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1 = (function (state_38566){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38566);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38575){if((e38575 instanceof Object)){
var ex__38279__auto__ = e38575;
var statearr_38576_38721 = state_38566;
(statearr_38576_38721[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38566);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38575;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38722 = state_38566;
state_38566 = G__38722;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = function(state_38566){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1.call(this,state_38566);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__;
})()
;})(__38710,switch__38275__auto__,c__38370__auto___38714,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async))
})();
var state__38372__auto__ = (function (){var statearr_38577 = f__38371__auto__.call(null);
(statearr_38577[(6)] = c__38370__auto___38714);

return statearr_38577;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(__38710,c__38370__auto___38714,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async))
);


break;
case "async":
var c__38370__auto___38723 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__38710,c__38370__auto___38723,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (__38710,c__38370__auto___38723,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async){
return (function (state_38590){
var state_val_38591 = (state_38590[(1)]);
if((state_val_38591 === (1))){
var state_38590__$1 = state_38590;
var statearr_38592_38724 = state_38590__$1;
(statearr_38592_38724[(2)] = null);

(statearr_38592_38724[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38591 === (2))){
var state_38590__$1 = state_38590;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38590__$1,(4),jobs);
} else {
if((state_val_38591 === (3))){
var inst_38588 = (state_38590[(2)]);
var state_38590__$1 = state_38590;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38590__$1,inst_38588);
} else {
if((state_val_38591 === (4))){
var inst_38580 = (state_38590[(2)]);
var inst_38581 = async.call(null,inst_38580);
var state_38590__$1 = state_38590;
if(cljs.core.truth_(inst_38581)){
var statearr_38593_38725 = state_38590__$1;
(statearr_38593_38725[(1)] = (5));

} else {
var statearr_38594_38726 = state_38590__$1;
(statearr_38594_38726[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38591 === (5))){
var state_38590__$1 = state_38590;
var statearr_38595_38727 = state_38590__$1;
(statearr_38595_38727[(2)] = null);

(statearr_38595_38727[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38591 === (6))){
var state_38590__$1 = state_38590;
var statearr_38596_38728 = state_38590__$1;
(statearr_38596_38728[(2)] = null);

(statearr_38596_38728[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38591 === (7))){
var inst_38586 = (state_38590[(2)]);
var state_38590__$1 = state_38590;
var statearr_38597_38729 = state_38590__$1;
(statearr_38597_38729[(2)] = inst_38586);

(statearr_38597_38729[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__38710,c__38370__auto___38723,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async))
;
return ((function (__38710,switch__38275__auto__,c__38370__auto___38723,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0 = (function (){
var statearr_38598 = [null,null,null,null,null,null,null];
(statearr_38598[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__);

(statearr_38598[(1)] = (1));

return statearr_38598;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1 = (function (state_38590){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38590);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38599){if((e38599 instanceof Object)){
var ex__38279__auto__ = e38599;
var statearr_38600_38730 = state_38590;
(statearr_38600_38730[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38590);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38599;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38731 = state_38590;
state_38590 = G__38731;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = function(state_38590){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1.call(this,state_38590);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__;
})()
;})(__38710,switch__38275__auto__,c__38370__auto___38723,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async))
})();
var state__38372__auto__ = (function (){var statearr_38601 = f__38371__auto__.call(null);
(statearr_38601[(6)] = c__38370__auto___38723);

return statearr_38601;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(__38710,c__38370__auto___38723,G__38553_38711,G__38553_38712__$1,n__4607__auto___38709,jobs,results,process,async))
);


break;
default:
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__38553_38712__$1)].join('')));

}

var G__38732 = (__38710 + (1));
__38710 = G__38732;
continue;
} else {
}
break;
}

var c__38370__auto___38733 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___38733,jobs,results,process,async){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___38733,jobs,results,process,async){
return (function (state_38623){
var state_val_38624 = (state_38623[(1)]);
if((state_val_38624 === (7))){
var inst_38619 = (state_38623[(2)]);
var state_38623__$1 = state_38623;
var statearr_38625_38734 = state_38623__$1;
(statearr_38625_38734[(2)] = inst_38619);

(statearr_38625_38734[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38624 === (1))){
var state_38623__$1 = state_38623;
var statearr_38626_38735 = state_38623__$1;
(statearr_38626_38735[(2)] = null);

(statearr_38626_38735[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38624 === (4))){
var inst_38604 = (state_38623[(7)]);
var inst_38604__$1 = (state_38623[(2)]);
var inst_38605 = (inst_38604__$1 == null);
var state_38623__$1 = (function (){var statearr_38627 = state_38623;
(statearr_38627[(7)] = inst_38604__$1);

return statearr_38627;
})();
if(cljs.core.truth_(inst_38605)){
var statearr_38628_38736 = state_38623__$1;
(statearr_38628_38736[(1)] = (5));

} else {
var statearr_38629_38737 = state_38623__$1;
(statearr_38629_38737[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38624 === (6))){
var inst_38609 = (state_38623[(8)]);
var inst_38604 = (state_38623[(7)]);
var inst_38609__$1 = cljs.core.async.chan.call(null,(1));
var inst_38610 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_38611 = [inst_38604,inst_38609__$1];
var inst_38612 = (new cljs.core.PersistentVector(null,2,(5),inst_38610,inst_38611,null));
var state_38623__$1 = (function (){var statearr_38630 = state_38623;
(statearr_38630[(8)] = inst_38609__$1);

return statearr_38630;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_38623__$1,(8),jobs,inst_38612);
} else {
if((state_val_38624 === (3))){
var inst_38621 = (state_38623[(2)]);
var state_38623__$1 = state_38623;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38623__$1,inst_38621);
} else {
if((state_val_38624 === (2))){
var state_38623__$1 = state_38623;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38623__$1,(4),from);
} else {
if((state_val_38624 === (9))){
var inst_38616 = (state_38623[(2)]);
var state_38623__$1 = (function (){var statearr_38631 = state_38623;
(statearr_38631[(9)] = inst_38616);

return statearr_38631;
})();
var statearr_38632_38738 = state_38623__$1;
(statearr_38632_38738[(2)] = null);

(statearr_38632_38738[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38624 === (5))){
var inst_38607 = cljs.core.async.close_BANG_.call(null,jobs);
var state_38623__$1 = state_38623;
var statearr_38633_38739 = state_38623__$1;
(statearr_38633_38739[(2)] = inst_38607);

(statearr_38633_38739[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38624 === (8))){
var inst_38609 = (state_38623[(8)]);
var inst_38614 = (state_38623[(2)]);
var state_38623__$1 = (function (){var statearr_38634 = state_38623;
(statearr_38634[(10)] = inst_38614);

return statearr_38634;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_38623__$1,(9),results,inst_38609);
} else {
return null;
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___38733,jobs,results,process,async))
;
return ((function (switch__38275__auto__,c__38370__auto___38733,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0 = (function (){
var statearr_38635 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_38635[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__);

(statearr_38635[(1)] = (1));

return statearr_38635;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1 = (function (state_38623){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38623);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38636){if((e38636 instanceof Object)){
var ex__38279__auto__ = e38636;
var statearr_38637_38740 = state_38623;
(statearr_38637_38740[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38623);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38636;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38741 = state_38623;
state_38623 = G__38741;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = function(state_38623){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1.call(this,state_38623);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___38733,jobs,results,process,async))
})();
var state__38372__auto__ = (function (){var statearr_38638 = f__38371__auto__.call(null);
(statearr_38638[(6)] = c__38370__auto___38733);

return statearr_38638;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___38733,jobs,results,process,async))
);


var c__38370__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto__,jobs,results,process,async){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto__,jobs,results,process,async){
return (function (state_38676){
var state_val_38677 = (state_38676[(1)]);
if((state_val_38677 === (7))){
var inst_38672 = (state_38676[(2)]);
var state_38676__$1 = state_38676;
var statearr_38678_38742 = state_38676__$1;
(statearr_38678_38742[(2)] = inst_38672);

(statearr_38678_38742[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (20))){
var state_38676__$1 = state_38676;
var statearr_38679_38743 = state_38676__$1;
(statearr_38679_38743[(2)] = null);

(statearr_38679_38743[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (1))){
var state_38676__$1 = state_38676;
var statearr_38680_38744 = state_38676__$1;
(statearr_38680_38744[(2)] = null);

(statearr_38680_38744[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (4))){
var inst_38641 = (state_38676[(7)]);
var inst_38641__$1 = (state_38676[(2)]);
var inst_38642 = (inst_38641__$1 == null);
var state_38676__$1 = (function (){var statearr_38681 = state_38676;
(statearr_38681[(7)] = inst_38641__$1);

return statearr_38681;
})();
if(cljs.core.truth_(inst_38642)){
var statearr_38682_38745 = state_38676__$1;
(statearr_38682_38745[(1)] = (5));

} else {
var statearr_38683_38746 = state_38676__$1;
(statearr_38683_38746[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (15))){
var inst_38654 = (state_38676[(8)]);
var state_38676__$1 = state_38676;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_38676__$1,(18),to,inst_38654);
} else {
if((state_val_38677 === (21))){
var inst_38667 = (state_38676[(2)]);
var state_38676__$1 = state_38676;
var statearr_38684_38747 = state_38676__$1;
(statearr_38684_38747[(2)] = inst_38667);

(statearr_38684_38747[(1)] = (13));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (13))){
var inst_38669 = (state_38676[(2)]);
var state_38676__$1 = (function (){var statearr_38685 = state_38676;
(statearr_38685[(9)] = inst_38669);

return statearr_38685;
})();
var statearr_38686_38748 = state_38676__$1;
(statearr_38686_38748[(2)] = null);

(statearr_38686_38748[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (6))){
var inst_38641 = (state_38676[(7)]);
var state_38676__$1 = state_38676;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38676__$1,(11),inst_38641);
} else {
if((state_val_38677 === (17))){
var inst_38662 = (state_38676[(2)]);
var state_38676__$1 = state_38676;
if(cljs.core.truth_(inst_38662)){
var statearr_38687_38749 = state_38676__$1;
(statearr_38687_38749[(1)] = (19));

} else {
var statearr_38688_38750 = state_38676__$1;
(statearr_38688_38750[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (3))){
var inst_38674 = (state_38676[(2)]);
var state_38676__$1 = state_38676;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38676__$1,inst_38674);
} else {
if((state_val_38677 === (12))){
var inst_38651 = (state_38676[(10)]);
var state_38676__$1 = state_38676;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38676__$1,(14),inst_38651);
} else {
if((state_val_38677 === (2))){
var state_38676__$1 = state_38676;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38676__$1,(4),results);
} else {
if((state_val_38677 === (19))){
var state_38676__$1 = state_38676;
var statearr_38689_38751 = state_38676__$1;
(statearr_38689_38751[(2)] = null);

(statearr_38689_38751[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (11))){
var inst_38651 = (state_38676[(2)]);
var state_38676__$1 = (function (){var statearr_38690 = state_38676;
(statearr_38690[(10)] = inst_38651);

return statearr_38690;
})();
var statearr_38691_38752 = state_38676__$1;
(statearr_38691_38752[(2)] = null);

(statearr_38691_38752[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (9))){
var state_38676__$1 = state_38676;
var statearr_38692_38753 = state_38676__$1;
(statearr_38692_38753[(2)] = null);

(statearr_38692_38753[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (5))){
var state_38676__$1 = state_38676;
if(cljs.core.truth_(close_QMARK_)){
var statearr_38693_38754 = state_38676__$1;
(statearr_38693_38754[(1)] = (8));

} else {
var statearr_38694_38755 = state_38676__$1;
(statearr_38694_38755[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (14))){
var inst_38656 = (state_38676[(11)]);
var inst_38654 = (state_38676[(8)]);
var inst_38654__$1 = (state_38676[(2)]);
var inst_38655 = (inst_38654__$1 == null);
var inst_38656__$1 = cljs.core.not.call(null,inst_38655);
var state_38676__$1 = (function (){var statearr_38695 = state_38676;
(statearr_38695[(11)] = inst_38656__$1);

(statearr_38695[(8)] = inst_38654__$1);

return statearr_38695;
})();
if(inst_38656__$1){
var statearr_38696_38756 = state_38676__$1;
(statearr_38696_38756[(1)] = (15));

} else {
var statearr_38697_38757 = state_38676__$1;
(statearr_38697_38757[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (16))){
var inst_38656 = (state_38676[(11)]);
var state_38676__$1 = state_38676;
var statearr_38698_38758 = state_38676__$1;
(statearr_38698_38758[(2)] = inst_38656);

(statearr_38698_38758[(1)] = (17));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (10))){
var inst_38648 = (state_38676[(2)]);
var state_38676__$1 = state_38676;
var statearr_38699_38759 = state_38676__$1;
(statearr_38699_38759[(2)] = inst_38648);

(statearr_38699_38759[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (18))){
var inst_38659 = (state_38676[(2)]);
var state_38676__$1 = state_38676;
var statearr_38700_38760 = state_38676__$1;
(statearr_38700_38760[(2)] = inst_38659);

(statearr_38700_38760[(1)] = (17));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38677 === (8))){
var inst_38645 = cljs.core.async.close_BANG_.call(null,to);
var state_38676__$1 = state_38676;
var statearr_38701_38761 = state_38676__$1;
(statearr_38701_38761[(2)] = inst_38645);

(statearr_38701_38761[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto__,jobs,results,process,async))
;
return ((function (switch__38275__auto__,c__38370__auto__,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0 = (function (){
var statearr_38702 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_38702[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__);

(statearr_38702[(1)] = (1));

return statearr_38702;
});
var cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1 = (function (state_38676){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38676);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38703){if((e38703 instanceof Object)){
var ex__38279__auto__ = e38703;
var statearr_38704_38762 = state_38676;
(statearr_38704_38762[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38676);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38703;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38763 = state_38676;
state_38676 = G__38763;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__ = function(state_38676){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1.call(this,state_38676);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__38276__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto__,jobs,results,process,async))
})();
var state__38372__auto__ = (function (){var statearr_38705 = f__38371__auto__.call(null);
(statearr_38705[(6)] = c__38370__auto__);

return statearr_38705;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto__,jobs,results,process,async))
);

return c__38370__auto__;
});
/**
 * Takes elements from the from channel and supplies them to the to
 *   channel, subject to the async function af, with parallelism n. af
 *   must be a function of two arguments, the first an input value and
 *   the second a channel on which to place the result(s). af must close!
 *   the channel before returning.  The presumption is that af will
 *   return immediately, having launched some asynchronous operation
 *   whose completion/callback will manipulate the result channel. Outputs
 *   will be returned in order relative to  the inputs. By default, the to
 *   channel will be closed when the from channel closes, but can be
 *   determined by the close?  parameter. Will stop consuming the from
 *   channel if the to channel closes.
 */
cljs.core.async.pipeline_async = (function cljs$core$async$pipeline_async(var_args){
var G__38765 = arguments.length;
switch (G__38765) {
case 4:
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
case 5:
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$5((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]),(arguments[(4)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4 = (function (n,to,af,from){
return cljs.core.async.pipeline_async.call(null,n,to,af,from,true);
});

cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$5 = (function (n,to,af,from,close_QMARK_){
return cljs.core.async.pipeline_STAR_.call(null,n,to,af,from,close_QMARK_,null,new cljs.core.Keyword(null,"async","async",1050769601));
});

cljs.core.async.pipeline_async.cljs$lang$maxFixedArity = 5;

/**
 * Takes elements from the from channel and supplies them to the to
 *   channel, subject to the transducer xf, with parallelism n. Because
 *   it is parallel, the transducer will be applied independently to each
 *   element, not across elements, and may produce zero or more outputs
 *   per input.  Outputs will be returned in order relative to the
 *   inputs. By default, the to channel will be closed when the from
 *   channel closes, but can be determined by the close?  parameter. Will
 *   stop consuming the from channel if the to channel closes.
 * 
 *   Note this is supplied for API compatibility with the Clojure version.
 *   Values of N > 1 will not result in actual concurrency in a
 *   single-threaded runtime.
 */
cljs.core.async.pipeline = (function cljs$core$async$pipeline(var_args){
var G__38768 = arguments.length;
switch (G__38768) {
case 4:
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
case 5:
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$5((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]),(arguments[(4)]));

break;
case 6:
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$6((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]),(arguments[(4)]),(arguments[(5)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$4 = (function (n,to,xf,from){
return cljs.core.async.pipeline.call(null,n,to,xf,from,true);
});

cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$5 = (function (n,to,xf,from,close_QMARK_){
return cljs.core.async.pipeline.call(null,n,to,xf,from,close_QMARK_,null);
});

cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$6 = (function (n,to,xf,from,close_QMARK_,ex_handler){
return cljs.core.async.pipeline_STAR_.call(null,n,to,xf,from,close_QMARK_,ex_handler,new cljs.core.Keyword(null,"compute","compute",1555393130));
});

cljs.core.async.pipeline.cljs$lang$maxFixedArity = 6;

/**
 * Takes a predicate and a source channel and returns a vector of two
 *   channels, the first of which will contain the values for which the
 *   predicate returned true, the second those for which it returned
 *   false.
 * 
 *   The out channels will be unbuffered by default, or two buf-or-ns can
 *   be supplied. The channels will close after the source channel has
 *   closed.
 */
cljs.core.async.split = (function cljs$core$async$split(var_args){
var G__38771 = arguments.length;
switch (G__38771) {
case 2:
return cljs.core.async.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 4:
return cljs.core.async.split.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.split.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.split.call(null,p,ch,null,null);
});

cljs.core.async.split.cljs$core$IFn$_invoke$arity$4 = (function (p,ch,t_buf_or_n,f_buf_or_n){
var tc = cljs.core.async.chan.call(null,t_buf_or_n);
var fc = cljs.core.async.chan.call(null,f_buf_or_n);
var c__38370__auto___38820 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___38820,tc,fc){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___38820,tc,fc){
return (function (state_38797){
var state_val_38798 = (state_38797[(1)]);
if((state_val_38798 === (7))){
var inst_38793 = (state_38797[(2)]);
var state_38797__$1 = state_38797;
var statearr_38799_38821 = state_38797__$1;
(statearr_38799_38821[(2)] = inst_38793);

(statearr_38799_38821[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (1))){
var state_38797__$1 = state_38797;
var statearr_38800_38822 = state_38797__$1;
(statearr_38800_38822[(2)] = null);

(statearr_38800_38822[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (4))){
var inst_38774 = (state_38797[(7)]);
var inst_38774__$1 = (state_38797[(2)]);
var inst_38775 = (inst_38774__$1 == null);
var state_38797__$1 = (function (){var statearr_38801 = state_38797;
(statearr_38801[(7)] = inst_38774__$1);

return statearr_38801;
})();
if(cljs.core.truth_(inst_38775)){
var statearr_38802_38823 = state_38797__$1;
(statearr_38802_38823[(1)] = (5));

} else {
var statearr_38803_38824 = state_38797__$1;
(statearr_38803_38824[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (13))){
var state_38797__$1 = state_38797;
var statearr_38804_38825 = state_38797__$1;
(statearr_38804_38825[(2)] = null);

(statearr_38804_38825[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (6))){
var inst_38774 = (state_38797[(7)]);
var inst_38780 = p.call(null,inst_38774);
var state_38797__$1 = state_38797;
if(cljs.core.truth_(inst_38780)){
var statearr_38805_38826 = state_38797__$1;
(statearr_38805_38826[(1)] = (9));

} else {
var statearr_38806_38827 = state_38797__$1;
(statearr_38806_38827[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (3))){
var inst_38795 = (state_38797[(2)]);
var state_38797__$1 = state_38797;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38797__$1,inst_38795);
} else {
if((state_val_38798 === (12))){
var state_38797__$1 = state_38797;
var statearr_38807_38828 = state_38797__$1;
(statearr_38807_38828[(2)] = null);

(statearr_38807_38828[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (2))){
var state_38797__$1 = state_38797;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38797__$1,(4),ch);
} else {
if((state_val_38798 === (11))){
var inst_38774 = (state_38797[(7)]);
var inst_38784 = (state_38797[(2)]);
var state_38797__$1 = state_38797;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_38797__$1,(8),inst_38784,inst_38774);
} else {
if((state_val_38798 === (9))){
var state_38797__$1 = state_38797;
var statearr_38808_38829 = state_38797__$1;
(statearr_38808_38829[(2)] = tc);

(statearr_38808_38829[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (5))){
var inst_38777 = cljs.core.async.close_BANG_.call(null,tc);
var inst_38778 = cljs.core.async.close_BANG_.call(null,fc);
var state_38797__$1 = (function (){var statearr_38809 = state_38797;
(statearr_38809[(8)] = inst_38777);

return statearr_38809;
})();
var statearr_38810_38830 = state_38797__$1;
(statearr_38810_38830[(2)] = inst_38778);

(statearr_38810_38830[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (14))){
var inst_38791 = (state_38797[(2)]);
var state_38797__$1 = state_38797;
var statearr_38811_38831 = state_38797__$1;
(statearr_38811_38831[(2)] = inst_38791);

(statearr_38811_38831[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (10))){
var state_38797__$1 = state_38797;
var statearr_38812_38832 = state_38797__$1;
(statearr_38812_38832[(2)] = fc);

(statearr_38812_38832[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38798 === (8))){
var inst_38786 = (state_38797[(2)]);
var state_38797__$1 = state_38797;
if(cljs.core.truth_(inst_38786)){
var statearr_38813_38833 = state_38797__$1;
(statearr_38813_38833[(1)] = (12));

} else {
var statearr_38814_38834 = state_38797__$1;
(statearr_38814_38834[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___38820,tc,fc))
;
return ((function (switch__38275__auto__,c__38370__auto___38820,tc,fc){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_38815 = [null,null,null,null,null,null,null,null,null];
(statearr_38815[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_38815[(1)] = (1));

return statearr_38815;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_38797){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38797);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38816){if((e38816 instanceof Object)){
var ex__38279__auto__ = e38816;
var statearr_38817_38835 = state_38797;
(statearr_38817_38835[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38797);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38816;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38836 = state_38797;
state_38797 = G__38836;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_38797){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_38797);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___38820,tc,fc))
})();
var state__38372__auto__ = (function (){var statearr_38818 = f__38371__auto__.call(null);
(statearr_38818[(6)] = c__38370__auto___38820);

return statearr_38818;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___38820,tc,fc))
);


return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [tc,fc], null);
});

cljs.core.async.split.cljs$lang$maxFixedArity = 4;

/**
 * f should be a function of 2 arguments. Returns a channel containing
 *   the single result of applying f to init and the first item from the
 *   channel, then applying f to that result and the 2nd item, etc. If
 *   the channel closes without yielding items, returns init and f is not
 *   called. ch must close before reduce produces a result.
 */
cljs.core.async.reduce = (function cljs$core$async$reduce(f,init,ch){
var c__38370__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto__){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto__){
return (function (state_38857){
var state_val_38858 = (state_38857[(1)]);
if((state_val_38858 === (7))){
var inst_38853 = (state_38857[(2)]);
var state_38857__$1 = state_38857;
var statearr_38859_38877 = state_38857__$1;
(statearr_38859_38877[(2)] = inst_38853);

(statearr_38859_38877[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38858 === (1))){
var inst_38837 = init;
var state_38857__$1 = (function (){var statearr_38860 = state_38857;
(statearr_38860[(7)] = inst_38837);

return statearr_38860;
})();
var statearr_38861_38878 = state_38857__$1;
(statearr_38861_38878[(2)] = null);

(statearr_38861_38878[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38858 === (4))){
var inst_38840 = (state_38857[(8)]);
var inst_38840__$1 = (state_38857[(2)]);
var inst_38841 = (inst_38840__$1 == null);
var state_38857__$1 = (function (){var statearr_38862 = state_38857;
(statearr_38862[(8)] = inst_38840__$1);

return statearr_38862;
})();
if(cljs.core.truth_(inst_38841)){
var statearr_38863_38879 = state_38857__$1;
(statearr_38863_38879[(1)] = (5));

} else {
var statearr_38864_38880 = state_38857__$1;
(statearr_38864_38880[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38858 === (6))){
var inst_38840 = (state_38857[(8)]);
var inst_38844 = (state_38857[(9)]);
var inst_38837 = (state_38857[(7)]);
var inst_38844__$1 = f.call(null,inst_38837,inst_38840);
var inst_38845 = cljs.core.reduced_QMARK_.call(null,inst_38844__$1);
var state_38857__$1 = (function (){var statearr_38865 = state_38857;
(statearr_38865[(9)] = inst_38844__$1);

return statearr_38865;
})();
if(inst_38845){
var statearr_38866_38881 = state_38857__$1;
(statearr_38866_38881[(1)] = (8));

} else {
var statearr_38867_38882 = state_38857__$1;
(statearr_38867_38882[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38858 === (3))){
var inst_38855 = (state_38857[(2)]);
var state_38857__$1 = state_38857;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38857__$1,inst_38855);
} else {
if((state_val_38858 === (2))){
var state_38857__$1 = state_38857;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38857__$1,(4),ch);
} else {
if((state_val_38858 === (9))){
var inst_38844 = (state_38857[(9)]);
var inst_38837 = inst_38844;
var state_38857__$1 = (function (){var statearr_38868 = state_38857;
(statearr_38868[(7)] = inst_38837);

return statearr_38868;
})();
var statearr_38869_38883 = state_38857__$1;
(statearr_38869_38883[(2)] = null);

(statearr_38869_38883[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38858 === (5))){
var inst_38837 = (state_38857[(7)]);
var state_38857__$1 = state_38857;
var statearr_38870_38884 = state_38857__$1;
(statearr_38870_38884[(2)] = inst_38837);

(statearr_38870_38884[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38858 === (10))){
var inst_38851 = (state_38857[(2)]);
var state_38857__$1 = state_38857;
var statearr_38871_38885 = state_38857__$1;
(statearr_38871_38885[(2)] = inst_38851);

(statearr_38871_38885[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38858 === (8))){
var inst_38844 = (state_38857[(9)]);
var inst_38847 = cljs.core.deref.call(null,inst_38844);
var state_38857__$1 = state_38857;
var statearr_38872_38886 = state_38857__$1;
(statearr_38872_38886[(2)] = inst_38847);

(statearr_38872_38886[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto__))
;
return ((function (switch__38275__auto__,c__38370__auto__){
return (function() {
var cljs$core$async$reduce_$_state_machine__38276__auto__ = null;
var cljs$core$async$reduce_$_state_machine__38276__auto____0 = (function (){
var statearr_38873 = [null,null,null,null,null,null,null,null,null,null];
(statearr_38873[(0)] = cljs$core$async$reduce_$_state_machine__38276__auto__);

(statearr_38873[(1)] = (1));

return statearr_38873;
});
var cljs$core$async$reduce_$_state_machine__38276__auto____1 = (function (state_38857){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38857);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38874){if((e38874 instanceof Object)){
var ex__38279__auto__ = e38874;
var statearr_38875_38887 = state_38857;
(statearr_38875_38887[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38857);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38874;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38888 = state_38857;
state_38857 = G__38888;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__38276__auto__ = function(state_38857){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__38276__auto____1.call(this,state_38857);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$reduce_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__38276__auto____0;
cljs$core$async$reduce_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__38276__auto____1;
return cljs$core$async$reduce_$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto__))
})();
var state__38372__auto__ = (function (){var statearr_38876 = f__38371__auto__.call(null);
(statearr_38876[(6)] = c__38370__auto__);

return statearr_38876;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto__))
);

return c__38370__auto__;
});
/**
 * async/reduces a channel with a transformation (xform f).
 *   Returns a channel containing the result.  ch must close before
 *   transduce produces a result.
 */
cljs.core.async.transduce = (function cljs$core$async$transduce(xform,f,init,ch){
var f__$1 = xform.call(null,f);
var c__38370__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto__,f__$1){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto__,f__$1){
return (function (state_38894){
var state_val_38895 = (state_38894[(1)]);
if((state_val_38895 === (1))){
var inst_38889 = cljs.core.async.reduce.call(null,f__$1,init,ch);
var state_38894__$1 = state_38894;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_38894__$1,(2),inst_38889);
} else {
if((state_val_38895 === (2))){
var inst_38891 = (state_38894[(2)]);
var inst_38892 = f__$1.call(null,inst_38891);
var state_38894__$1 = state_38894;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38894__$1,inst_38892);
} else {
return null;
}
}
});})(c__38370__auto__,f__$1))
;
return ((function (switch__38275__auto__,c__38370__auto__,f__$1){
return (function() {
var cljs$core$async$transduce_$_state_machine__38276__auto__ = null;
var cljs$core$async$transduce_$_state_machine__38276__auto____0 = (function (){
var statearr_38896 = [null,null,null,null,null,null,null];
(statearr_38896[(0)] = cljs$core$async$transduce_$_state_machine__38276__auto__);

(statearr_38896[(1)] = (1));

return statearr_38896;
});
var cljs$core$async$transduce_$_state_machine__38276__auto____1 = (function (state_38894){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38894);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38897){if((e38897 instanceof Object)){
var ex__38279__auto__ = e38897;
var statearr_38898_38900 = state_38894;
(statearr_38898_38900[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38894);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38897;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38901 = state_38894;
state_38894 = G__38901;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__38276__auto__ = function(state_38894){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__38276__auto____1.call(this,state_38894);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$transduce_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__38276__auto____0;
cljs$core$async$transduce_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__38276__auto____1;
return cljs$core$async$transduce_$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto__,f__$1))
})();
var state__38372__auto__ = (function (){var statearr_38899 = f__38371__auto__.call(null);
(statearr_38899[(6)] = c__38370__auto__);

return statearr_38899;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto__,f__$1))
);

return c__38370__auto__;
});
/**
 * Puts the contents of coll into the supplied channel.
 * 
 *   By default the channel will be closed after the items are copied,
 *   but can be determined by the close? parameter.
 * 
 *   Returns a channel which will close after the items are copied.
 */
cljs.core.async.onto_chan = (function cljs$core$async$onto_chan(var_args){
var G__38903 = arguments.length;
switch (G__38903) {
case 2:
return cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$2 = (function (ch,coll){
return cljs.core.async.onto_chan.call(null,ch,coll,true);
});

cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
var c__38370__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto__){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto__){
return (function (state_38928){
var state_val_38929 = (state_38928[(1)]);
if((state_val_38929 === (7))){
var inst_38910 = (state_38928[(2)]);
var state_38928__$1 = state_38928;
var statearr_38930_38951 = state_38928__$1;
(statearr_38930_38951[(2)] = inst_38910);

(statearr_38930_38951[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (1))){
var inst_38904 = cljs.core.seq.call(null,coll);
var inst_38905 = inst_38904;
var state_38928__$1 = (function (){var statearr_38931 = state_38928;
(statearr_38931[(7)] = inst_38905);

return statearr_38931;
})();
var statearr_38932_38952 = state_38928__$1;
(statearr_38932_38952[(2)] = null);

(statearr_38932_38952[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (4))){
var inst_38905 = (state_38928[(7)]);
var inst_38908 = cljs.core.first.call(null,inst_38905);
var state_38928__$1 = state_38928;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_38928__$1,(7),ch,inst_38908);
} else {
if((state_val_38929 === (13))){
var inst_38922 = (state_38928[(2)]);
var state_38928__$1 = state_38928;
var statearr_38933_38953 = state_38928__$1;
(statearr_38933_38953[(2)] = inst_38922);

(statearr_38933_38953[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (6))){
var inst_38913 = (state_38928[(2)]);
var state_38928__$1 = state_38928;
if(cljs.core.truth_(inst_38913)){
var statearr_38934_38954 = state_38928__$1;
(statearr_38934_38954[(1)] = (8));

} else {
var statearr_38935_38955 = state_38928__$1;
(statearr_38935_38955[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (3))){
var inst_38926 = (state_38928[(2)]);
var state_38928__$1 = state_38928;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_38928__$1,inst_38926);
} else {
if((state_val_38929 === (12))){
var state_38928__$1 = state_38928;
var statearr_38936_38956 = state_38928__$1;
(statearr_38936_38956[(2)] = null);

(statearr_38936_38956[(1)] = (13));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (2))){
var inst_38905 = (state_38928[(7)]);
var state_38928__$1 = state_38928;
if(cljs.core.truth_(inst_38905)){
var statearr_38937_38957 = state_38928__$1;
(statearr_38937_38957[(1)] = (4));

} else {
var statearr_38938_38958 = state_38928__$1;
(statearr_38938_38958[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (11))){
var inst_38919 = cljs.core.async.close_BANG_.call(null,ch);
var state_38928__$1 = state_38928;
var statearr_38939_38959 = state_38928__$1;
(statearr_38939_38959[(2)] = inst_38919);

(statearr_38939_38959[(1)] = (13));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (9))){
var state_38928__$1 = state_38928;
if(cljs.core.truth_(close_QMARK_)){
var statearr_38940_38960 = state_38928__$1;
(statearr_38940_38960[(1)] = (11));

} else {
var statearr_38941_38961 = state_38928__$1;
(statearr_38941_38961[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (5))){
var inst_38905 = (state_38928[(7)]);
var state_38928__$1 = state_38928;
var statearr_38942_38962 = state_38928__$1;
(statearr_38942_38962[(2)] = inst_38905);

(statearr_38942_38962[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (10))){
var inst_38924 = (state_38928[(2)]);
var state_38928__$1 = state_38928;
var statearr_38943_38963 = state_38928__$1;
(statearr_38943_38963[(2)] = inst_38924);

(statearr_38943_38963[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_38929 === (8))){
var inst_38905 = (state_38928[(7)]);
var inst_38915 = cljs.core.next.call(null,inst_38905);
var inst_38905__$1 = inst_38915;
var state_38928__$1 = (function (){var statearr_38944 = state_38928;
(statearr_38944[(7)] = inst_38905__$1);

return statearr_38944;
})();
var statearr_38945_38964 = state_38928__$1;
(statearr_38945_38964[(2)] = null);

(statearr_38945_38964[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto__))
;
return ((function (switch__38275__auto__,c__38370__auto__){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_38946 = [null,null,null,null,null,null,null,null];
(statearr_38946[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_38946[(1)] = (1));

return statearr_38946;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_38928){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_38928);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e38947){if((e38947 instanceof Object)){
var ex__38279__auto__ = e38947;
var statearr_38948_38965 = state_38928;
(statearr_38948_38965[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_38928);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e38947;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38966 = state_38928;
state_38928 = G__38966;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_38928){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_38928);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto__))
})();
var state__38372__auto__ = (function (){var statearr_38949 = f__38371__auto__.call(null);
(statearr_38949[(6)] = c__38370__auto__);

return statearr_38949;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto__))
);

return c__38370__auto__;
});

cljs.core.async.onto_chan.cljs$lang$maxFixedArity = 3;

/**
 * Creates and returns a channel which contains the contents of coll,
 *   closing when exhausted.
 */
cljs.core.async.to_chan = (function cljs$core$async$to_chan(coll){
var ch = cljs.core.async.chan.call(null,cljs.core.bounded_count.call(null,(100),coll));
cljs.core.async.onto_chan.call(null,ch,coll);

return ch;
});

/**
 * @interface
 */
cljs.core.async.Mux = function(){};

cljs.core.async.muxch_STAR_ = (function cljs$core$async$muxch_STAR_(_){
if((((!((_ == null)))) && ((!((_.cljs$core$async$Mux$muxch_STAR_$arity$1 == null)))))){
return _.cljs$core$async$Mux$muxch_STAR_$arity$1(_);
} else {
var x__4433__auto__ = (((_ == null))?null:_);
var m__4434__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,_);
} else {
var m__4431__auto__ = (cljs.core.async.muxch_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,_);
} else {
throw cljs.core.missing_protocol.call(null,"Mux.muxch*",_);
}
}
}
});


/**
 * @interface
 */
cljs.core.async.Mult = function(){};

cljs.core.async.tap_STAR_ = (function cljs$core$async$tap_STAR_(m,ch,close_QMARK_){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mult$tap_STAR_$arity$3 == null)))))){
return m.cljs$core$async$Mult$tap_STAR_$arity$3(m,ch,close_QMARK_);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m,ch,close_QMARK_);
} else {
var m__4431__auto__ = (cljs.core.async.tap_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m,ch,close_QMARK_);
} else {
throw cljs.core.missing_protocol.call(null,"Mult.tap*",m);
}
}
}
});

cljs.core.async.untap_STAR_ = (function cljs$core$async$untap_STAR_(m,ch){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mult$untap_STAR_$arity$2 == null)))))){
return m.cljs$core$async$Mult$untap_STAR_$arity$2(m,ch);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m,ch);
} else {
var m__4431__auto__ = (cljs.core.async.untap_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Mult.untap*",m);
}
}
}
});

cljs.core.async.untap_all_STAR_ = (function cljs$core$async$untap_all_STAR_(m){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mult$untap_all_STAR_$arity$1 == null)))))){
return m.cljs$core$async$Mult$untap_all_STAR_$arity$1(m);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m);
} else {
var m__4431__auto__ = (cljs.core.async.untap_all_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m);
} else {
throw cljs.core.missing_protocol.call(null,"Mult.untap-all*",m);
}
}
}
});

/**
 * Creates and returns a mult(iple) of the supplied channel. Channels
 *   containing copies of the channel can be created with 'tap', and
 *   detached with 'untap'.
 * 
 *   Each item is distributed to all taps in parallel and synchronously,
 *   i.e. each tap must accept before the next item is distributed. Use
 *   buffering/windowing to prevent slow taps from holding up the mult.
 * 
 *   Items received when there are no taps get dropped.
 * 
 *   If a tap puts to a closed channel, it will be removed from the mult.
 */
cljs.core.async.mult = (function cljs$core$async$mult(ch){
var cs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var m = (function (){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async38967 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.Mult}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.async.Mux}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async38967 = (function (ch,cs,meta38968){
this.ch = ch;
this.cs = cs;
this.meta38968 = meta38968;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs){
return (function (_38969,meta38968__$1){
var self__ = this;
var _38969__$1 = this;
return (new cljs.core.async.t_cljs$core$async38967(self__.ch,self__.cs,meta38968__$1));
});})(cs))
;

cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs){
return (function (_38969){
var self__ = this;
var _38969__$1 = this;
return self__.meta38968;
});})(cs))
;

cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (cs){
return (function (_){
var self__ = this;
var ___$1 = this;
return self__.ch;
});})(cs))
;

cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$async$Mult$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$async$Mult$tap_STAR_$arity$3 = ((function (cs){
return (function (_,ch__$1,close_QMARK_){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.assoc,ch__$1,close_QMARK_);

return null;
});})(cs))
;

cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$async$Mult$untap_STAR_$arity$2 = ((function (cs){
return (function (_,ch__$1){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.dissoc,ch__$1);

return null;
});})(cs))
;

cljs.core.async.t_cljs$core$async38967.prototype.cljs$core$async$Mult$untap_all_STAR_$arity$1 = ((function (cs){
return (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_.call(null,self__.cs,cljs.core.PersistentArrayMap.EMPTY);

return null;
});})(cs))
;

cljs.core.async.t_cljs$core$async38967.getBasis = ((function (cs){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"cs","cs",-117024463,null),new cljs.core.Symbol(null,"meta38968","meta38968",-1027262243,null)], null);
});})(cs))
;

cljs.core.async.t_cljs$core$async38967.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async38967.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async38967";

cljs.core.async.t_cljs$core$async38967.cljs$lang$ctorPrWriter = ((function (cs){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async38967");
});})(cs))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async38967.
 */
cljs.core.async.__GT_t_cljs$core$async38967 = ((function (cs){
return (function cljs$core$async$mult_$___GT_t_cljs$core$async38967(ch__$1,cs__$1,meta38968){
return (new cljs.core.async.t_cljs$core$async38967(ch__$1,cs__$1,meta38968));
});})(cs))
;

}

return (new cljs.core.async.t_cljs$core$async38967(ch,cs,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var dchan = cljs.core.async.chan.call(null,(1));
var dctr = cljs.core.atom.call(null,null);
var done = ((function (cs,m,dchan,dctr){
return (function (_){
if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.call(null,dchan,true);
} else {
return null;
}
});})(cs,m,dchan,dctr))
;
var c__38370__auto___39189 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___39189,cs,m,dchan,dctr,done){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___39189,cs,m,dchan,dctr,done){
return (function (state_39104){
var state_val_39105 = (state_39104[(1)]);
if((state_val_39105 === (7))){
var inst_39100 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39106_39190 = state_39104__$1;
(statearr_39106_39190[(2)] = inst_39100);

(statearr_39106_39190[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (20))){
var inst_39003 = (state_39104[(7)]);
var inst_39015 = cljs.core.first.call(null,inst_39003);
var inst_39016 = cljs.core.nth.call(null,inst_39015,(0),null);
var inst_39017 = cljs.core.nth.call(null,inst_39015,(1),null);
var state_39104__$1 = (function (){var statearr_39107 = state_39104;
(statearr_39107[(8)] = inst_39016);

return statearr_39107;
})();
if(cljs.core.truth_(inst_39017)){
var statearr_39108_39191 = state_39104__$1;
(statearr_39108_39191[(1)] = (22));

} else {
var statearr_39109_39192 = state_39104__$1;
(statearr_39109_39192[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (27))){
var inst_38972 = (state_39104[(9)]);
var inst_39045 = (state_39104[(10)]);
var inst_39052 = (state_39104[(11)]);
var inst_39047 = (state_39104[(12)]);
var inst_39052__$1 = cljs.core._nth.call(null,inst_39045,inst_39047);
var inst_39053 = cljs.core.async.put_BANG_.call(null,inst_39052__$1,inst_38972,done);
var state_39104__$1 = (function (){var statearr_39110 = state_39104;
(statearr_39110[(11)] = inst_39052__$1);

return statearr_39110;
})();
if(cljs.core.truth_(inst_39053)){
var statearr_39111_39193 = state_39104__$1;
(statearr_39111_39193[(1)] = (30));

} else {
var statearr_39112_39194 = state_39104__$1;
(statearr_39112_39194[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (1))){
var state_39104__$1 = state_39104;
var statearr_39113_39195 = state_39104__$1;
(statearr_39113_39195[(2)] = null);

(statearr_39113_39195[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (24))){
var inst_39003 = (state_39104[(7)]);
var inst_39022 = (state_39104[(2)]);
var inst_39023 = cljs.core.next.call(null,inst_39003);
var inst_38981 = inst_39023;
var inst_38982 = null;
var inst_38983 = (0);
var inst_38984 = (0);
var state_39104__$1 = (function (){var statearr_39114 = state_39104;
(statearr_39114[(13)] = inst_38983);

(statearr_39114[(14)] = inst_39022);

(statearr_39114[(15)] = inst_38984);

(statearr_39114[(16)] = inst_38981);

(statearr_39114[(17)] = inst_38982);

return statearr_39114;
})();
var statearr_39115_39196 = state_39104__$1;
(statearr_39115_39196[(2)] = null);

(statearr_39115_39196[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (39))){
var state_39104__$1 = state_39104;
var statearr_39119_39197 = state_39104__$1;
(statearr_39119_39197[(2)] = null);

(statearr_39119_39197[(1)] = (41));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (4))){
var inst_38972 = (state_39104[(9)]);
var inst_38972__$1 = (state_39104[(2)]);
var inst_38973 = (inst_38972__$1 == null);
var state_39104__$1 = (function (){var statearr_39120 = state_39104;
(statearr_39120[(9)] = inst_38972__$1);

return statearr_39120;
})();
if(cljs.core.truth_(inst_38973)){
var statearr_39121_39198 = state_39104__$1;
(statearr_39121_39198[(1)] = (5));

} else {
var statearr_39122_39199 = state_39104__$1;
(statearr_39122_39199[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (15))){
var inst_38983 = (state_39104[(13)]);
var inst_38984 = (state_39104[(15)]);
var inst_38981 = (state_39104[(16)]);
var inst_38982 = (state_39104[(17)]);
var inst_38999 = (state_39104[(2)]);
var inst_39000 = (inst_38984 + (1));
var tmp39116 = inst_38983;
var tmp39117 = inst_38981;
var tmp39118 = inst_38982;
var inst_38981__$1 = tmp39117;
var inst_38982__$1 = tmp39118;
var inst_38983__$1 = tmp39116;
var inst_38984__$1 = inst_39000;
var state_39104__$1 = (function (){var statearr_39123 = state_39104;
(statearr_39123[(13)] = inst_38983__$1);

(statearr_39123[(18)] = inst_38999);

(statearr_39123[(15)] = inst_38984__$1);

(statearr_39123[(16)] = inst_38981__$1);

(statearr_39123[(17)] = inst_38982__$1);

return statearr_39123;
})();
var statearr_39124_39200 = state_39104__$1;
(statearr_39124_39200[(2)] = null);

(statearr_39124_39200[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (21))){
var inst_39026 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39128_39201 = state_39104__$1;
(statearr_39128_39201[(2)] = inst_39026);

(statearr_39128_39201[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (31))){
var inst_39052 = (state_39104[(11)]);
var inst_39056 = done.call(null,null);
var inst_39057 = cljs.core.async.untap_STAR_.call(null,m,inst_39052);
var state_39104__$1 = (function (){var statearr_39129 = state_39104;
(statearr_39129[(19)] = inst_39056);

return statearr_39129;
})();
var statearr_39130_39202 = state_39104__$1;
(statearr_39130_39202[(2)] = inst_39057);

(statearr_39130_39202[(1)] = (32));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (32))){
var inst_39045 = (state_39104[(10)]);
var inst_39046 = (state_39104[(20)]);
var inst_39044 = (state_39104[(21)]);
var inst_39047 = (state_39104[(12)]);
var inst_39059 = (state_39104[(2)]);
var inst_39060 = (inst_39047 + (1));
var tmp39125 = inst_39045;
var tmp39126 = inst_39046;
var tmp39127 = inst_39044;
var inst_39044__$1 = tmp39127;
var inst_39045__$1 = tmp39125;
var inst_39046__$1 = tmp39126;
var inst_39047__$1 = inst_39060;
var state_39104__$1 = (function (){var statearr_39131 = state_39104;
(statearr_39131[(22)] = inst_39059);

(statearr_39131[(10)] = inst_39045__$1);

(statearr_39131[(20)] = inst_39046__$1);

(statearr_39131[(21)] = inst_39044__$1);

(statearr_39131[(12)] = inst_39047__$1);

return statearr_39131;
})();
var statearr_39132_39203 = state_39104__$1;
(statearr_39132_39203[(2)] = null);

(statearr_39132_39203[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (40))){
var inst_39072 = (state_39104[(23)]);
var inst_39076 = done.call(null,null);
var inst_39077 = cljs.core.async.untap_STAR_.call(null,m,inst_39072);
var state_39104__$1 = (function (){var statearr_39133 = state_39104;
(statearr_39133[(24)] = inst_39076);

return statearr_39133;
})();
var statearr_39134_39204 = state_39104__$1;
(statearr_39134_39204[(2)] = inst_39077);

(statearr_39134_39204[(1)] = (41));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (33))){
var inst_39063 = (state_39104[(25)]);
var inst_39065 = cljs.core.chunked_seq_QMARK_.call(null,inst_39063);
var state_39104__$1 = state_39104;
if(inst_39065){
var statearr_39135_39205 = state_39104__$1;
(statearr_39135_39205[(1)] = (36));

} else {
var statearr_39136_39206 = state_39104__$1;
(statearr_39136_39206[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (13))){
var inst_38993 = (state_39104[(26)]);
var inst_38996 = cljs.core.async.close_BANG_.call(null,inst_38993);
var state_39104__$1 = state_39104;
var statearr_39137_39207 = state_39104__$1;
(statearr_39137_39207[(2)] = inst_38996);

(statearr_39137_39207[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (22))){
var inst_39016 = (state_39104[(8)]);
var inst_39019 = cljs.core.async.close_BANG_.call(null,inst_39016);
var state_39104__$1 = state_39104;
var statearr_39138_39208 = state_39104__$1;
(statearr_39138_39208[(2)] = inst_39019);

(statearr_39138_39208[(1)] = (24));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (36))){
var inst_39063 = (state_39104[(25)]);
var inst_39067 = cljs.core.chunk_first.call(null,inst_39063);
var inst_39068 = cljs.core.chunk_rest.call(null,inst_39063);
var inst_39069 = cljs.core.count.call(null,inst_39067);
var inst_39044 = inst_39068;
var inst_39045 = inst_39067;
var inst_39046 = inst_39069;
var inst_39047 = (0);
var state_39104__$1 = (function (){var statearr_39139 = state_39104;
(statearr_39139[(10)] = inst_39045);

(statearr_39139[(20)] = inst_39046);

(statearr_39139[(21)] = inst_39044);

(statearr_39139[(12)] = inst_39047);

return statearr_39139;
})();
var statearr_39140_39209 = state_39104__$1;
(statearr_39140_39209[(2)] = null);

(statearr_39140_39209[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (41))){
var inst_39063 = (state_39104[(25)]);
var inst_39079 = (state_39104[(2)]);
var inst_39080 = cljs.core.next.call(null,inst_39063);
var inst_39044 = inst_39080;
var inst_39045 = null;
var inst_39046 = (0);
var inst_39047 = (0);
var state_39104__$1 = (function (){var statearr_39141 = state_39104;
(statearr_39141[(27)] = inst_39079);

(statearr_39141[(10)] = inst_39045);

(statearr_39141[(20)] = inst_39046);

(statearr_39141[(21)] = inst_39044);

(statearr_39141[(12)] = inst_39047);

return statearr_39141;
})();
var statearr_39142_39210 = state_39104__$1;
(statearr_39142_39210[(2)] = null);

(statearr_39142_39210[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (43))){
var state_39104__$1 = state_39104;
var statearr_39143_39211 = state_39104__$1;
(statearr_39143_39211[(2)] = null);

(statearr_39143_39211[(1)] = (44));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (29))){
var inst_39088 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39144_39212 = state_39104__$1;
(statearr_39144_39212[(2)] = inst_39088);

(statearr_39144_39212[(1)] = (26));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (44))){
var inst_39097 = (state_39104[(2)]);
var state_39104__$1 = (function (){var statearr_39145 = state_39104;
(statearr_39145[(28)] = inst_39097);

return statearr_39145;
})();
var statearr_39146_39213 = state_39104__$1;
(statearr_39146_39213[(2)] = null);

(statearr_39146_39213[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (6))){
var inst_39036 = (state_39104[(29)]);
var inst_39035 = cljs.core.deref.call(null,cs);
var inst_39036__$1 = cljs.core.keys.call(null,inst_39035);
var inst_39037 = cljs.core.count.call(null,inst_39036__$1);
var inst_39038 = cljs.core.reset_BANG_.call(null,dctr,inst_39037);
var inst_39043 = cljs.core.seq.call(null,inst_39036__$1);
var inst_39044 = inst_39043;
var inst_39045 = null;
var inst_39046 = (0);
var inst_39047 = (0);
var state_39104__$1 = (function (){var statearr_39147 = state_39104;
(statearr_39147[(30)] = inst_39038);

(statearr_39147[(10)] = inst_39045);

(statearr_39147[(20)] = inst_39046);

(statearr_39147[(29)] = inst_39036__$1);

(statearr_39147[(21)] = inst_39044);

(statearr_39147[(12)] = inst_39047);

return statearr_39147;
})();
var statearr_39148_39214 = state_39104__$1;
(statearr_39148_39214[(2)] = null);

(statearr_39148_39214[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (28))){
var inst_39063 = (state_39104[(25)]);
var inst_39044 = (state_39104[(21)]);
var inst_39063__$1 = cljs.core.seq.call(null,inst_39044);
var state_39104__$1 = (function (){var statearr_39149 = state_39104;
(statearr_39149[(25)] = inst_39063__$1);

return statearr_39149;
})();
if(inst_39063__$1){
var statearr_39150_39215 = state_39104__$1;
(statearr_39150_39215[(1)] = (33));

} else {
var statearr_39151_39216 = state_39104__$1;
(statearr_39151_39216[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (25))){
var inst_39046 = (state_39104[(20)]);
var inst_39047 = (state_39104[(12)]);
var inst_39049 = (inst_39047 < inst_39046);
var inst_39050 = inst_39049;
var state_39104__$1 = state_39104;
if(cljs.core.truth_(inst_39050)){
var statearr_39152_39217 = state_39104__$1;
(statearr_39152_39217[(1)] = (27));

} else {
var statearr_39153_39218 = state_39104__$1;
(statearr_39153_39218[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (34))){
var state_39104__$1 = state_39104;
var statearr_39154_39219 = state_39104__$1;
(statearr_39154_39219[(2)] = null);

(statearr_39154_39219[(1)] = (35));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (17))){
var state_39104__$1 = state_39104;
var statearr_39155_39220 = state_39104__$1;
(statearr_39155_39220[(2)] = null);

(statearr_39155_39220[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (3))){
var inst_39102 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39104__$1,inst_39102);
} else {
if((state_val_39105 === (12))){
var inst_39031 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39156_39221 = state_39104__$1;
(statearr_39156_39221[(2)] = inst_39031);

(statearr_39156_39221[(1)] = (9));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (2))){
var state_39104__$1 = state_39104;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39104__$1,(4),ch);
} else {
if((state_val_39105 === (23))){
var state_39104__$1 = state_39104;
var statearr_39157_39222 = state_39104__$1;
(statearr_39157_39222[(2)] = null);

(statearr_39157_39222[(1)] = (24));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (35))){
var inst_39086 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39158_39223 = state_39104__$1;
(statearr_39158_39223[(2)] = inst_39086);

(statearr_39158_39223[(1)] = (29));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (19))){
var inst_39003 = (state_39104[(7)]);
var inst_39007 = cljs.core.chunk_first.call(null,inst_39003);
var inst_39008 = cljs.core.chunk_rest.call(null,inst_39003);
var inst_39009 = cljs.core.count.call(null,inst_39007);
var inst_38981 = inst_39008;
var inst_38982 = inst_39007;
var inst_38983 = inst_39009;
var inst_38984 = (0);
var state_39104__$1 = (function (){var statearr_39159 = state_39104;
(statearr_39159[(13)] = inst_38983);

(statearr_39159[(15)] = inst_38984);

(statearr_39159[(16)] = inst_38981);

(statearr_39159[(17)] = inst_38982);

return statearr_39159;
})();
var statearr_39160_39224 = state_39104__$1;
(statearr_39160_39224[(2)] = null);

(statearr_39160_39224[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (11))){
var inst_39003 = (state_39104[(7)]);
var inst_38981 = (state_39104[(16)]);
var inst_39003__$1 = cljs.core.seq.call(null,inst_38981);
var state_39104__$1 = (function (){var statearr_39161 = state_39104;
(statearr_39161[(7)] = inst_39003__$1);

return statearr_39161;
})();
if(inst_39003__$1){
var statearr_39162_39225 = state_39104__$1;
(statearr_39162_39225[(1)] = (16));

} else {
var statearr_39163_39226 = state_39104__$1;
(statearr_39163_39226[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (9))){
var inst_39033 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39164_39227 = state_39104__$1;
(statearr_39164_39227[(2)] = inst_39033);

(statearr_39164_39227[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (5))){
var inst_38979 = cljs.core.deref.call(null,cs);
var inst_38980 = cljs.core.seq.call(null,inst_38979);
var inst_38981 = inst_38980;
var inst_38982 = null;
var inst_38983 = (0);
var inst_38984 = (0);
var state_39104__$1 = (function (){var statearr_39165 = state_39104;
(statearr_39165[(13)] = inst_38983);

(statearr_39165[(15)] = inst_38984);

(statearr_39165[(16)] = inst_38981);

(statearr_39165[(17)] = inst_38982);

return statearr_39165;
})();
var statearr_39166_39228 = state_39104__$1;
(statearr_39166_39228[(2)] = null);

(statearr_39166_39228[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (14))){
var state_39104__$1 = state_39104;
var statearr_39167_39229 = state_39104__$1;
(statearr_39167_39229[(2)] = null);

(statearr_39167_39229[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (45))){
var inst_39094 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39168_39230 = state_39104__$1;
(statearr_39168_39230[(2)] = inst_39094);

(statearr_39168_39230[(1)] = (44));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (26))){
var inst_39036 = (state_39104[(29)]);
var inst_39090 = (state_39104[(2)]);
var inst_39091 = cljs.core.seq.call(null,inst_39036);
var state_39104__$1 = (function (){var statearr_39169 = state_39104;
(statearr_39169[(31)] = inst_39090);

return statearr_39169;
})();
if(inst_39091){
var statearr_39170_39231 = state_39104__$1;
(statearr_39170_39231[(1)] = (42));

} else {
var statearr_39171_39232 = state_39104__$1;
(statearr_39171_39232[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (16))){
var inst_39003 = (state_39104[(7)]);
var inst_39005 = cljs.core.chunked_seq_QMARK_.call(null,inst_39003);
var state_39104__$1 = state_39104;
if(inst_39005){
var statearr_39172_39233 = state_39104__$1;
(statearr_39172_39233[(1)] = (19));

} else {
var statearr_39173_39234 = state_39104__$1;
(statearr_39173_39234[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (38))){
var inst_39083 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39174_39235 = state_39104__$1;
(statearr_39174_39235[(2)] = inst_39083);

(statearr_39174_39235[(1)] = (35));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (30))){
var state_39104__$1 = state_39104;
var statearr_39175_39236 = state_39104__$1;
(statearr_39175_39236[(2)] = null);

(statearr_39175_39236[(1)] = (32));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (10))){
var inst_38984 = (state_39104[(15)]);
var inst_38982 = (state_39104[(17)]);
var inst_38992 = cljs.core._nth.call(null,inst_38982,inst_38984);
var inst_38993 = cljs.core.nth.call(null,inst_38992,(0),null);
var inst_38994 = cljs.core.nth.call(null,inst_38992,(1),null);
var state_39104__$1 = (function (){var statearr_39176 = state_39104;
(statearr_39176[(26)] = inst_38993);

return statearr_39176;
})();
if(cljs.core.truth_(inst_38994)){
var statearr_39177_39237 = state_39104__$1;
(statearr_39177_39237[(1)] = (13));

} else {
var statearr_39178_39238 = state_39104__$1;
(statearr_39178_39238[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (18))){
var inst_39029 = (state_39104[(2)]);
var state_39104__$1 = state_39104;
var statearr_39179_39239 = state_39104__$1;
(statearr_39179_39239[(2)] = inst_39029);

(statearr_39179_39239[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (42))){
var state_39104__$1 = state_39104;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39104__$1,(45),dchan);
} else {
if((state_val_39105 === (37))){
var inst_38972 = (state_39104[(9)]);
var inst_39063 = (state_39104[(25)]);
var inst_39072 = (state_39104[(23)]);
var inst_39072__$1 = cljs.core.first.call(null,inst_39063);
var inst_39073 = cljs.core.async.put_BANG_.call(null,inst_39072__$1,inst_38972,done);
var state_39104__$1 = (function (){var statearr_39180 = state_39104;
(statearr_39180[(23)] = inst_39072__$1);

return statearr_39180;
})();
if(cljs.core.truth_(inst_39073)){
var statearr_39181_39240 = state_39104__$1;
(statearr_39181_39240[(1)] = (39));

} else {
var statearr_39182_39241 = state_39104__$1;
(statearr_39182_39241[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39105 === (8))){
var inst_38983 = (state_39104[(13)]);
var inst_38984 = (state_39104[(15)]);
var inst_38986 = (inst_38984 < inst_38983);
var inst_38987 = inst_38986;
var state_39104__$1 = state_39104;
if(cljs.core.truth_(inst_38987)){
var statearr_39183_39242 = state_39104__$1;
(statearr_39183_39242[(1)] = (10));

} else {
var statearr_39184_39243 = state_39104__$1;
(statearr_39184_39243[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___39189,cs,m,dchan,dctr,done))
;
return ((function (switch__38275__auto__,c__38370__auto___39189,cs,m,dchan,dctr,done){
return (function() {
var cljs$core$async$mult_$_state_machine__38276__auto__ = null;
var cljs$core$async$mult_$_state_machine__38276__auto____0 = (function (){
var statearr_39185 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_39185[(0)] = cljs$core$async$mult_$_state_machine__38276__auto__);

(statearr_39185[(1)] = (1));

return statearr_39185;
});
var cljs$core$async$mult_$_state_machine__38276__auto____1 = (function (state_39104){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39104);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e39186){if((e39186 instanceof Object)){
var ex__38279__auto__ = e39186;
var statearr_39187_39244 = state_39104;
(statearr_39187_39244[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39104);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39186;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39245 = state_39104;
state_39104 = G__39245;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__38276__auto__ = function(state_39104){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__38276__auto____1.call(this,state_39104);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mult_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__38276__auto____0;
cljs$core$async$mult_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__38276__auto____1;
return cljs$core$async$mult_$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___39189,cs,m,dchan,dctr,done))
})();
var state__38372__auto__ = (function (){var statearr_39188 = f__38371__auto__.call(null);
(statearr_39188[(6)] = c__38370__auto___39189);

return statearr_39188;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___39189,cs,m,dchan,dctr,done))
);


return m;
});
/**
 * Copies the mult source onto the supplied channel.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.tap = (function cljs$core$async$tap(var_args){
var G__39247 = arguments.length;
switch (G__39247) {
case 2:
return cljs.core.async.tap.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.tap.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.tap.cljs$core$IFn$_invoke$arity$2 = (function (mult,ch){
return cljs.core.async.tap.call(null,mult,ch,true);
});

cljs.core.async.tap.cljs$core$IFn$_invoke$arity$3 = (function (mult,ch,close_QMARK_){
cljs.core.async.tap_STAR_.call(null,mult,ch,close_QMARK_);

return ch;
});

cljs.core.async.tap.cljs$lang$maxFixedArity = 3;

/**
 * Disconnects a target channel from a mult
 */
cljs.core.async.untap = (function cljs$core$async$untap(mult,ch){
return cljs.core.async.untap_STAR_.call(null,mult,ch);
});
/**
 * Disconnects all target channels from a mult
 */
cljs.core.async.untap_all = (function cljs$core$async$untap_all(mult){
return cljs.core.async.untap_all_STAR_.call(null,mult);
});

/**
 * @interface
 */
cljs.core.async.Mix = function(){};

cljs.core.async.admix_STAR_ = (function cljs$core$async$admix_STAR_(m,ch){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mix$admix_STAR_$arity$2 == null)))))){
return m.cljs$core$async$Mix$admix_STAR_$arity$2(m,ch);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m,ch);
} else {
var m__4431__auto__ = (cljs.core.async.admix_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.admix*",m);
}
}
}
});

cljs.core.async.unmix_STAR_ = (function cljs$core$async$unmix_STAR_(m,ch){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mix$unmix_STAR_$arity$2 == null)))))){
return m.cljs$core$async$Mix$unmix_STAR_$arity$2(m,ch);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m,ch);
} else {
var m__4431__auto__ = (cljs.core.async.unmix_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.unmix*",m);
}
}
}
});

cljs.core.async.unmix_all_STAR_ = (function cljs$core$async$unmix_all_STAR_(m){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mix$unmix_all_STAR_$arity$1 == null)))))){
return m.cljs$core$async$Mix$unmix_all_STAR_$arity$1(m);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m);
} else {
var m__4431__auto__ = (cljs.core.async.unmix_all_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.unmix-all*",m);
}
}
}
});

cljs.core.async.toggle_STAR_ = (function cljs$core$async$toggle_STAR_(m,state_map){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mix$toggle_STAR_$arity$2 == null)))))){
return m.cljs$core$async$Mix$toggle_STAR_$arity$2(m,state_map);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m,state_map);
} else {
var m__4431__auto__ = (cljs.core.async.toggle_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m,state_map);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.toggle*",m);
}
}
}
});

cljs.core.async.solo_mode_STAR_ = (function cljs$core$async$solo_mode_STAR_(m,mode){
if((((!((m == null)))) && ((!((m.cljs$core$async$Mix$solo_mode_STAR_$arity$2 == null)))))){
return m.cljs$core$async$Mix$solo_mode_STAR_$arity$2(m,mode);
} else {
var x__4433__auto__ = (((m == null))?null:m);
var m__4434__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,m,mode);
} else {
var m__4431__auto__ = (cljs.core.async.solo_mode_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,m,mode);
} else {
throw cljs.core.missing_protocol.call(null,"Mix.solo-mode*",m);
}
}
}
});

cljs.core.async.ioc_alts_BANG_ = (function cljs$core$async$ioc_alts_BANG_(var_args){
var args__4736__auto__ = [];
var len__4730__auto___39259 = arguments.length;
var i__4731__auto___39260 = (0);
while(true){
if((i__4731__auto___39260 < len__4730__auto___39259)){
args__4736__auto__.push((arguments[i__4731__auto___39260]));

var G__39261 = (i__4731__auto___39260 + (1));
i__4731__auto___39260 = G__39261;
continue;
} else {
}
break;
}

var argseq__4737__auto__ = ((((3) < args__4736__auto__.length))?(new cljs.core.IndexedSeq(args__4736__auto__.slice((3)),(0),null)):null);
return cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__4737__auto__);
});

cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__39253){
var map__39254 = p__39253;
var map__39254__$1 = (((((!((map__39254 == null))))?(((((map__39254.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__39254.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__39254):map__39254);
var opts = map__39254__$1;
var statearr_39256_39262 = state;
(statearr_39256_39262[(1)] = cont_block);


var temp__5720__auto__ = cljs.core.async.do_alts.call(null,((function (map__39254,map__39254__$1,opts){
return (function (val){
var statearr_39257_39263 = state;
(statearr_39257_39263[(2)] = val);


return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state);
});})(map__39254,map__39254__$1,opts))
,ports,opts);
if(cljs.core.truth_(temp__5720__auto__)){
var cb = temp__5720__auto__;
var statearr_39258_39264 = state;
(statearr_39258_39264[(2)] = cljs.core.deref.call(null,cb));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
});

cljs.core.async.ioc_alts_BANG_.cljs$lang$maxFixedArity = (3);

/** @this {Function} */
cljs.core.async.ioc_alts_BANG_.cljs$lang$applyTo = (function (seq39249){
var G__39250 = cljs.core.first.call(null,seq39249);
var seq39249__$1 = cljs.core.next.call(null,seq39249);
var G__39251 = cljs.core.first.call(null,seq39249__$1);
var seq39249__$2 = cljs.core.next.call(null,seq39249__$1);
var G__39252 = cljs.core.first.call(null,seq39249__$2);
var seq39249__$3 = cljs.core.next.call(null,seq39249__$2);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__39250,G__39251,G__39252,seq39249__$3);
});

/**
 * Creates and returns a mix of one or more input channels which will
 *   be put on the supplied out channel. Input sources can be added to
 *   the mix with 'admix', and removed with 'unmix'. A mix supports
 *   soloing, muting and pausing multiple inputs atomically using
 *   'toggle', and can solo using either muting or pausing as determined
 *   by 'solo-mode'.
 * 
 *   Each channel can have zero or more boolean modes set via 'toggle':
 * 
 *   :solo - when true, only this (ond other soloed) channel(s) will appear
 *        in the mix output channel. :mute and :pause states of soloed
 *        channels are ignored. If solo-mode is :mute, non-soloed
 *        channels are muted, if :pause, non-soloed channels are
 *        paused.
 * 
 *   :mute - muted channels will have their contents consumed but not included in the mix
 *   :pause - paused channels will not have their contents consumed (and thus also not included in the mix)
 */
cljs.core.async.mix = (function cljs$core$async$mix(out){
var cs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var solo_modes = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"pause","pause",-2095325672),null,new cljs.core.Keyword(null,"mute","mute",1151223646),null], null), null);
var attrs = cljs.core.conj.call(null,solo_modes,new cljs.core.Keyword(null,"solo","solo",-316350075));
var solo_mode = cljs.core.atom.call(null,new cljs.core.Keyword(null,"mute","mute",1151223646));
var change = cljs.core.async.chan.call(null);
var changed = ((function (cs,solo_modes,attrs,solo_mode,change){
return (function (){
return cljs.core.async.put_BANG_.call(null,change,true);
});})(cs,solo_modes,attrs,solo_mode,change))
;
var pick = ((function (cs,solo_modes,attrs,solo_mode,change,changed){
return (function (attr,chs){
return cljs.core.reduce_kv.call(null,((function (cs,solo_modes,attrs,solo_mode,change,changed){
return (function (ret,c,v){
if(cljs.core.truth_(attr.call(null,v))){
return cljs.core.conj.call(null,ret,c);
} else {
return ret;
}
});})(cs,solo_modes,attrs,solo_mode,change,changed))
,cljs.core.PersistentHashSet.EMPTY,chs);
});})(cs,solo_modes,attrs,solo_mode,change,changed))
;
var calc_state = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick){
return (function (){
var chs = cljs.core.deref.call(null,cs);
var mode = cljs.core.deref.call(null,solo_mode);
var solos = pick.call(null,new cljs.core.Keyword(null,"solo","solo",-316350075),chs);
var pauses = pick.call(null,new cljs.core.Keyword(null,"pause","pause",-2095325672),chs);
return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"solos","solos",1441458643),solos,new cljs.core.Keyword(null,"mutes","mutes",1068806309),pick.call(null,new cljs.core.Keyword(null,"mute","mute",1151223646),chs),new cljs.core.Keyword(null,"reads","reads",-1215067361),cljs.core.conj.call(null,((((cljs.core._EQ_.call(null,mode,new cljs.core.Keyword(null,"pause","pause",-2095325672))) && ((!(cljs.core.empty_QMARK_.call(null,solos))))))?cljs.core.vec.call(null,solos):cljs.core.vec.call(null,cljs.core.remove.call(null,pauses,cljs.core.keys.call(null,chs)))),change)], null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick))
;
var m = (function (){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async39265 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.async.Mix}
 * @implements {cljs.core.async.Mux}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39265 = (function (change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta39266){
this.change = change;
this.solo_mode = solo_mode;
this.pick = pick;
this.cs = cs;
this.calc_state = calc_state;
this.out = out;
this.changed = changed;
this.solo_modes = solo_modes;
this.attrs = attrs;
this.meta39266 = meta39266;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_39267,meta39266__$1){
var self__ = this;
var _39267__$1 = this;
return (new cljs.core.async.t_cljs$core$async39265(self__.change,self__.solo_mode,self__.pick,self__.cs,self__.calc_state,self__.out,self__.changed,self__.solo_modes,self__.attrs,meta39266__$1));
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_39267){
var self__ = this;
var _39267__$1 = this;
return self__.meta39266;
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_){
var self__ = this;
var ___$1 = this;
return self__.out;
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mix$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mix$admix_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.assoc,ch,cljs.core.PersistentArrayMap.EMPTY);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mix$unmix_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.dissoc,ch);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mix$unmix_all_STAR_$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_.call(null,self__.cs,cljs.core.PersistentArrayMap.EMPTY);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mix$toggle_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,state_map){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.partial.call(null,cljs.core.merge_with,cljs.core.merge),state_map);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.prototype.cljs$core$async$Mix$solo_mode_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_,mode){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(self__.solo_modes.call(null,mode))){
} else {
throw (new Error(["Assert failed: ",["mode must be one of: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(self__.solo_modes)].join(''),"\n","(solo-modes mode)"].join('')));
}

cljs.core.reset_BANG_.call(null,self__.solo_mode,mode);

return self__.changed.call(null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.getBasis = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (){
return new cljs.core.PersistentVector(null, 10, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"change","change",477485025,null),new cljs.core.Symbol(null,"solo-mode","solo-mode",2031788074,null),new cljs.core.Symbol(null,"pick","pick",1300068175,null),new cljs.core.Symbol(null,"cs","cs",-117024463,null),new cljs.core.Symbol(null,"calc-state","calc-state",-349968968,null),new cljs.core.Symbol(null,"out","out",729986010,null),new cljs.core.Symbol(null,"changed","changed",-2083710852,null),new cljs.core.Symbol(null,"solo-modes","solo-modes",882180540,null),new cljs.core.Symbol(null,"attrs","attrs",-450137186,null),new cljs.core.Symbol(null,"meta39266","meta39266",1436953891,null)], null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async39265.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39265.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39265";

cljs.core.async.t_cljs$core$async39265.cljs$lang$ctorPrWriter = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async39265");
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async39265.
 */
cljs.core.async.__GT_t_cljs$core$async39265 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function cljs$core$async$mix_$___GT_t_cljs$core$async39265(change__$1,solo_mode__$1,pick__$1,cs__$1,calc_state__$1,out__$1,changed__$1,solo_modes__$1,attrs__$1,meta39266){
return (new cljs.core.async.t_cljs$core$async39265(change__$1,solo_mode__$1,pick__$1,cs__$1,calc_state__$1,out__$1,changed__$1,solo_modes__$1,attrs__$1,meta39266));
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

}

return (new cljs.core.async.t_cljs$core$async39265(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__38370__auto___39429 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___39429,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___39429,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (state_39369){
var state_val_39370 = (state_39369[(1)]);
if((state_val_39370 === (7))){
var inst_39284 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
var statearr_39371_39430 = state_39369__$1;
(statearr_39371_39430[(2)] = inst_39284);

(statearr_39371_39430[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (20))){
var inst_39296 = (state_39369[(7)]);
var state_39369__$1 = state_39369;
var statearr_39372_39431 = state_39369__$1;
(statearr_39372_39431[(2)] = inst_39296);

(statearr_39372_39431[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (27))){
var state_39369__$1 = state_39369;
var statearr_39373_39432 = state_39369__$1;
(statearr_39373_39432[(2)] = null);

(statearr_39373_39432[(1)] = (28));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (1))){
var inst_39271 = (state_39369[(8)]);
var inst_39271__$1 = calc_state.call(null);
var inst_39273 = (inst_39271__$1 == null);
var inst_39274 = cljs.core.not.call(null,inst_39273);
var state_39369__$1 = (function (){var statearr_39374 = state_39369;
(statearr_39374[(8)] = inst_39271__$1);

return statearr_39374;
})();
if(inst_39274){
var statearr_39375_39433 = state_39369__$1;
(statearr_39375_39433[(1)] = (2));

} else {
var statearr_39376_39434 = state_39369__$1;
(statearr_39376_39434[(1)] = (3));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (24))){
var inst_39320 = (state_39369[(9)]);
var inst_39343 = (state_39369[(10)]);
var inst_39329 = (state_39369[(11)]);
var inst_39343__$1 = inst_39320.call(null,inst_39329);
var state_39369__$1 = (function (){var statearr_39377 = state_39369;
(statearr_39377[(10)] = inst_39343__$1);

return statearr_39377;
})();
if(cljs.core.truth_(inst_39343__$1)){
var statearr_39378_39435 = state_39369__$1;
(statearr_39378_39435[(1)] = (29));

} else {
var statearr_39379_39436 = state_39369__$1;
(statearr_39379_39436[(1)] = (30));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (4))){
var inst_39287 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
if(cljs.core.truth_(inst_39287)){
var statearr_39380_39437 = state_39369__$1;
(statearr_39380_39437[(1)] = (8));

} else {
var statearr_39381_39438 = state_39369__$1;
(statearr_39381_39438[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (15))){
var inst_39314 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
if(cljs.core.truth_(inst_39314)){
var statearr_39382_39439 = state_39369__$1;
(statearr_39382_39439[(1)] = (19));

} else {
var statearr_39383_39440 = state_39369__$1;
(statearr_39383_39440[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (21))){
var inst_39319 = (state_39369[(12)]);
var inst_39319__$1 = (state_39369[(2)]);
var inst_39320 = cljs.core.get.call(null,inst_39319__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_39321 = cljs.core.get.call(null,inst_39319__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_39322 = cljs.core.get.call(null,inst_39319__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_39369__$1 = (function (){var statearr_39384 = state_39369;
(statearr_39384[(9)] = inst_39320);

(statearr_39384[(13)] = inst_39321);

(statearr_39384[(12)] = inst_39319__$1);

return statearr_39384;
})();
return cljs.core.async.ioc_alts_BANG_.call(null,state_39369__$1,(22),inst_39322);
} else {
if((state_val_39370 === (31))){
var inst_39351 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
if(cljs.core.truth_(inst_39351)){
var statearr_39385_39441 = state_39369__$1;
(statearr_39385_39441[(1)] = (32));

} else {
var statearr_39386_39442 = state_39369__$1;
(statearr_39386_39442[(1)] = (33));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (32))){
var inst_39328 = (state_39369[(14)]);
var state_39369__$1 = state_39369;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39369__$1,(35),out,inst_39328);
} else {
if((state_val_39370 === (33))){
var inst_39319 = (state_39369[(12)]);
var inst_39296 = inst_39319;
var state_39369__$1 = (function (){var statearr_39387 = state_39369;
(statearr_39387[(7)] = inst_39296);

return statearr_39387;
})();
var statearr_39388_39443 = state_39369__$1;
(statearr_39388_39443[(2)] = null);

(statearr_39388_39443[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (13))){
var inst_39296 = (state_39369[(7)]);
var inst_39303 = inst_39296.cljs$lang$protocol_mask$partition0$;
var inst_39304 = (inst_39303 & (64));
var inst_39305 = inst_39296.cljs$core$ISeq$;
var inst_39306 = (cljs.core.PROTOCOL_SENTINEL === inst_39305);
var inst_39307 = ((inst_39304) || (inst_39306));
var state_39369__$1 = state_39369;
if(cljs.core.truth_(inst_39307)){
var statearr_39389_39444 = state_39369__$1;
(statearr_39389_39444[(1)] = (16));

} else {
var statearr_39390_39445 = state_39369__$1;
(statearr_39390_39445[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (22))){
var inst_39329 = (state_39369[(11)]);
var inst_39328 = (state_39369[(14)]);
var inst_39327 = (state_39369[(2)]);
var inst_39328__$1 = cljs.core.nth.call(null,inst_39327,(0),null);
var inst_39329__$1 = cljs.core.nth.call(null,inst_39327,(1),null);
var inst_39330 = (inst_39328__$1 == null);
var inst_39331 = cljs.core._EQ_.call(null,inst_39329__$1,change);
var inst_39332 = ((inst_39330) || (inst_39331));
var state_39369__$1 = (function (){var statearr_39391 = state_39369;
(statearr_39391[(11)] = inst_39329__$1);

(statearr_39391[(14)] = inst_39328__$1);

return statearr_39391;
})();
if(cljs.core.truth_(inst_39332)){
var statearr_39392_39446 = state_39369__$1;
(statearr_39392_39446[(1)] = (23));

} else {
var statearr_39393_39447 = state_39369__$1;
(statearr_39393_39447[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (36))){
var inst_39319 = (state_39369[(12)]);
var inst_39296 = inst_39319;
var state_39369__$1 = (function (){var statearr_39394 = state_39369;
(statearr_39394[(7)] = inst_39296);

return statearr_39394;
})();
var statearr_39395_39448 = state_39369__$1;
(statearr_39395_39448[(2)] = null);

(statearr_39395_39448[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (29))){
var inst_39343 = (state_39369[(10)]);
var state_39369__$1 = state_39369;
var statearr_39396_39449 = state_39369__$1;
(statearr_39396_39449[(2)] = inst_39343);

(statearr_39396_39449[(1)] = (31));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (6))){
var state_39369__$1 = state_39369;
var statearr_39397_39450 = state_39369__$1;
(statearr_39397_39450[(2)] = false);

(statearr_39397_39450[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (28))){
var inst_39339 = (state_39369[(2)]);
var inst_39340 = calc_state.call(null);
var inst_39296 = inst_39340;
var state_39369__$1 = (function (){var statearr_39398 = state_39369;
(statearr_39398[(7)] = inst_39296);

(statearr_39398[(15)] = inst_39339);

return statearr_39398;
})();
var statearr_39399_39451 = state_39369__$1;
(statearr_39399_39451[(2)] = null);

(statearr_39399_39451[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (25))){
var inst_39365 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
var statearr_39400_39452 = state_39369__$1;
(statearr_39400_39452[(2)] = inst_39365);

(statearr_39400_39452[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (34))){
var inst_39363 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
var statearr_39401_39453 = state_39369__$1;
(statearr_39401_39453[(2)] = inst_39363);

(statearr_39401_39453[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (17))){
var state_39369__$1 = state_39369;
var statearr_39402_39454 = state_39369__$1;
(statearr_39402_39454[(2)] = false);

(statearr_39402_39454[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (3))){
var state_39369__$1 = state_39369;
var statearr_39403_39455 = state_39369__$1;
(statearr_39403_39455[(2)] = false);

(statearr_39403_39455[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (12))){
var inst_39367 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39369__$1,inst_39367);
} else {
if((state_val_39370 === (2))){
var inst_39271 = (state_39369[(8)]);
var inst_39276 = inst_39271.cljs$lang$protocol_mask$partition0$;
var inst_39277 = (inst_39276 & (64));
var inst_39278 = inst_39271.cljs$core$ISeq$;
var inst_39279 = (cljs.core.PROTOCOL_SENTINEL === inst_39278);
var inst_39280 = ((inst_39277) || (inst_39279));
var state_39369__$1 = state_39369;
if(cljs.core.truth_(inst_39280)){
var statearr_39404_39456 = state_39369__$1;
(statearr_39404_39456[(1)] = (5));

} else {
var statearr_39405_39457 = state_39369__$1;
(statearr_39405_39457[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (23))){
var inst_39328 = (state_39369[(14)]);
var inst_39334 = (inst_39328 == null);
var state_39369__$1 = state_39369;
if(cljs.core.truth_(inst_39334)){
var statearr_39406_39458 = state_39369__$1;
(statearr_39406_39458[(1)] = (26));

} else {
var statearr_39407_39459 = state_39369__$1;
(statearr_39407_39459[(1)] = (27));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (35))){
var inst_39354 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
if(cljs.core.truth_(inst_39354)){
var statearr_39408_39460 = state_39369__$1;
(statearr_39408_39460[(1)] = (36));

} else {
var statearr_39409_39461 = state_39369__$1;
(statearr_39409_39461[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (19))){
var inst_39296 = (state_39369[(7)]);
var inst_39316 = cljs.core.apply.call(null,cljs.core.hash_map,inst_39296);
var state_39369__$1 = state_39369;
var statearr_39410_39462 = state_39369__$1;
(statearr_39410_39462[(2)] = inst_39316);

(statearr_39410_39462[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (11))){
var inst_39296 = (state_39369[(7)]);
var inst_39300 = (inst_39296 == null);
var inst_39301 = cljs.core.not.call(null,inst_39300);
var state_39369__$1 = state_39369;
if(inst_39301){
var statearr_39411_39463 = state_39369__$1;
(statearr_39411_39463[(1)] = (13));

} else {
var statearr_39412_39464 = state_39369__$1;
(statearr_39412_39464[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (9))){
var inst_39271 = (state_39369[(8)]);
var state_39369__$1 = state_39369;
var statearr_39413_39465 = state_39369__$1;
(statearr_39413_39465[(2)] = inst_39271);

(statearr_39413_39465[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (5))){
var state_39369__$1 = state_39369;
var statearr_39414_39466 = state_39369__$1;
(statearr_39414_39466[(2)] = true);

(statearr_39414_39466[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (14))){
var state_39369__$1 = state_39369;
var statearr_39415_39467 = state_39369__$1;
(statearr_39415_39467[(2)] = false);

(statearr_39415_39467[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (26))){
var inst_39329 = (state_39369[(11)]);
var inst_39336 = cljs.core.swap_BANG_.call(null,cs,cljs.core.dissoc,inst_39329);
var state_39369__$1 = state_39369;
var statearr_39416_39468 = state_39369__$1;
(statearr_39416_39468[(2)] = inst_39336);

(statearr_39416_39468[(1)] = (28));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (16))){
var state_39369__$1 = state_39369;
var statearr_39417_39469 = state_39369__$1;
(statearr_39417_39469[(2)] = true);

(statearr_39417_39469[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (38))){
var inst_39359 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
var statearr_39418_39470 = state_39369__$1;
(statearr_39418_39470[(2)] = inst_39359);

(statearr_39418_39470[(1)] = (34));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (30))){
var inst_39320 = (state_39369[(9)]);
var inst_39321 = (state_39369[(13)]);
var inst_39329 = (state_39369[(11)]);
var inst_39346 = cljs.core.empty_QMARK_.call(null,inst_39320);
var inst_39347 = inst_39321.call(null,inst_39329);
var inst_39348 = cljs.core.not.call(null,inst_39347);
var inst_39349 = ((inst_39346) && (inst_39348));
var state_39369__$1 = state_39369;
var statearr_39419_39471 = state_39369__$1;
(statearr_39419_39471[(2)] = inst_39349);

(statearr_39419_39471[(1)] = (31));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (10))){
var inst_39271 = (state_39369[(8)]);
var inst_39292 = (state_39369[(2)]);
var inst_39293 = cljs.core.get.call(null,inst_39292,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_39294 = cljs.core.get.call(null,inst_39292,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_39295 = cljs.core.get.call(null,inst_39292,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_39296 = inst_39271;
var state_39369__$1 = (function (){var statearr_39420 = state_39369;
(statearr_39420[(7)] = inst_39296);

(statearr_39420[(16)] = inst_39294);

(statearr_39420[(17)] = inst_39293);

(statearr_39420[(18)] = inst_39295);

return statearr_39420;
})();
var statearr_39421_39472 = state_39369__$1;
(statearr_39421_39472[(2)] = null);

(statearr_39421_39472[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (18))){
var inst_39311 = (state_39369[(2)]);
var state_39369__$1 = state_39369;
var statearr_39422_39473 = state_39369__$1;
(statearr_39422_39473[(2)] = inst_39311);

(statearr_39422_39473[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (37))){
var state_39369__$1 = state_39369;
var statearr_39423_39474 = state_39369__$1;
(statearr_39423_39474[(2)] = null);

(statearr_39423_39474[(1)] = (38));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39370 === (8))){
var inst_39271 = (state_39369[(8)]);
var inst_39289 = cljs.core.apply.call(null,cljs.core.hash_map,inst_39271);
var state_39369__$1 = state_39369;
var statearr_39424_39475 = state_39369__$1;
(statearr_39424_39475[(2)] = inst_39289);

(statearr_39424_39475[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___39429,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
;
return ((function (switch__38275__auto__,c__38370__auto___39429,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function() {
var cljs$core$async$mix_$_state_machine__38276__auto__ = null;
var cljs$core$async$mix_$_state_machine__38276__auto____0 = (function (){
var statearr_39425 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_39425[(0)] = cljs$core$async$mix_$_state_machine__38276__auto__);

(statearr_39425[(1)] = (1));

return statearr_39425;
});
var cljs$core$async$mix_$_state_machine__38276__auto____1 = (function (state_39369){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39369);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e39426){if((e39426 instanceof Object)){
var ex__38279__auto__ = e39426;
var statearr_39427_39476 = state_39369;
(statearr_39427_39476[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39369);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39426;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39477 = state_39369;
state_39369 = G__39477;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__38276__auto__ = function(state_39369){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__38276__auto____1.call(this,state_39369);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mix_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__38276__auto____0;
cljs$core$async$mix_$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__38276__auto____1;
return cljs$core$async$mix_$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___39429,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
})();
var state__38372__auto__ = (function (){var statearr_39428 = f__38371__auto__.call(null);
(statearr_39428[(6)] = c__38370__auto___39429);

return statearr_39428;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___39429,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
);


return m;
});
/**
 * Adds ch as an input to the mix
 */
cljs.core.async.admix = (function cljs$core$async$admix(mix,ch){
return cljs.core.async.admix_STAR_.call(null,mix,ch);
});
/**
 * Removes ch as an input to the mix
 */
cljs.core.async.unmix = (function cljs$core$async$unmix(mix,ch){
return cljs.core.async.unmix_STAR_.call(null,mix,ch);
});
/**
 * removes all inputs from the mix
 */
cljs.core.async.unmix_all = (function cljs$core$async$unmix_all(mix){
return cljs.core.async.unmix_all_STAR_.call(null,mix);
});
/**
 * Atomically sets the state(s) of one or more channels in a mix. The
 *   state map is a map of channels -> channel-state-map. A
 *   channel-state-map is a map of attrs -> boolean, where attr is one or
 *   more of :mute, :pause or :solo. Any states supplied are merged with
 *   the current state.
 * 
 *   Note that channels can be added to a mix via toggle, which can be
 *   used to add channels in a particular (e.g. paused) state.
 */
cljs.core.async.toggle = (function cljs$core$async$toggle(mix,state_map){
return cljs.core.async.toggle_STAR_.call(null,mix,state_map);
});
/**
 * Sets the solo mode of the mix. mode must be one of :mute or :pause
 */
cljs.core.async.solo_mode = (function cljs$core$async$solo_mode(mix,mode){
return cljs.core.async.solo_mode_STAR_.call(null,mix,mode);
});

/**
 * @interface
 */
cljs.core.async.Pub = function(){};

cljs.core.async.sub_STAR_ = (function cljs$core$async$sub_STAR_(p,v,ch,close_QMARK_){
if((((!((p == null)))) && ((!((p.cljs$core$async$Pub$sub_STAR_$arity$4 == null)))))){
return p.cljs$core$async$Pub$sub_STAR_$arity$4(p,v,ch,close_QMARK_);
} else {
var x__4433__auto__ = (((p == null))?null:p);
var m__4434__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,p,v,ch,close_QMARK_);
} else {
var m__4431__auto__ = (cljs.core.async.sub_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,p,v,ch,close_QMARK_);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.sub*",p);
}
}
}
});

cljs.core.async.unsub_STAR_ = (function cljs$core$async$unsub_STAR_(p,v,ch){
if((((!((p == null)))) && ((!((p.cljs$core$async$Pub$unsub_STAR_$arity$3 == null)))))){
return p.cljs$core$async$Pub$unsub_STAR_$arity$3(p,v,ch);
} else {
var x__4433__auto__ = (((p == null))?null:p);
var m__4434__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,p,v,ch);
} else {
var m__4431__auto__ = (cljs.core.async.unsub_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,p,v,ch);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.unsub*",p);
}
}
}
});

cljs.core.async.unsub_all_STAR_ = (function cljs$core$async$unsub_all_STAR_(var_args){
var G__39479 = arguments.length;
switch (G__39479) {
case 1:
return cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1 = (function (p){
if((((!((p == null)))) && ((!((p.cljs$core$async$Pub$unsub_all_STAR_$arity$1 == null)))))){
return p.cljs$core$async$Pub$unsub_all_STAR_$arity$1(p);
} else {
var x__4433__auto__ = (((p == null))?null:p);
var m__4434__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,p);
} else {
var m__4431__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,p);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.unsub-all*",p);
}
}
}
});

cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$2 = (function (p,v){
if((((!((p == null)))) && ((!((p.cljs$core$async$Pub$unsub_all_STAR_$arity$2 == null)))))){
return p.cljs$core$async$Pub$unsub_all_STAR_$arity$2(p,v);
} else {
var x__4433__auto__ = (((p == null))?null:p);
var m__4434__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__4433__auto__)]);
if((!((m__4434__auto__ == null)))){
return m__4434__auto__.call(null,p,v);
} else {
var m__4431__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__4431__auto__ == null)))){
return m__4431__auto__.call(null,p,v);
} else {
throw cljs.core.missing_protocol.call(null,"Pub.unsub-all*",p);
}
}
}
});

cljs.core.async.unsub_all_STAR_.cljs$lang$maxFixedArity = 2;


/**
 * Creates and returns a pub(lication) of the supplied channel,
 *   partitioned into topics by the topic-fn. topic-fn will be applied to
 *   each value on the channel and the result will determine the 'topic'
 *   on which that value will be put. Channels can be subscribed to
 *   receive copies of topics using 'sub', and unsubscribed using
 *   'unsub'. Each topic will be handled by an internal mult on a
 *   dedicated channel. By default these internal channels are
 *   unbuffered, but a buf-fn can be supplied which, given a topic,
 *   creates a buffer with desired properties.
 * 
 *   Each item is distributed to all subs in parallel and synchronously,
 *   i.e. each sub must accept before the next item is distributed. Use
 *   buffering/windowing to prevent slow subs from holding up the pub.
 * 
 *   Items received when there are no matching subs get dropped.
 * 
 *   Note that if buf-fns are used then each topic is handled
 *   asynchronously, i.e. if a channel is subscribed to more than one
 *   topic it should not expect them to be interleaved identically with
 *   the source.
 */
cljs.core.async.pub = (function cljs$core$async$pub(var_args){
var G__39483 = arguments.length;
switch (G__39483) {
case 2:
return cljs.core.async.pub.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.pub.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.pub.cljs$core$IFn$_invoke$arity$2 = (function (ch,topic_fn){
return cljs.core.async.pub.call(null,ch,topic_fn,cljs.core.constantly.call(null,null));
});

cljs.core.async.pub.cljs$core$IFn$_invoke$arity$3 = (function (ch,topic_fn,buf_fn){
var mults = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var ensure_mult = ((function (mults){
return (function (topic){
var or__4131__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,mults),topic);
if(cljs.core.truth_(or__4131__auto__)){
return or__4131__auto__;
} else {
return cljs.core.get.call(null,cljs.core.swap_BANG_.call(null,mults,((function (or__4131__auto__,mults){
return (function (p1__39481_SHARP_){
if(cljs.core.truth_(p1__39481_SHARP_.call(null,topic))){
return p1__39481_SHARP_;
} else {
return cljs.core.assoc.call(null,p1__39481_SHARP_,topic,cljs.core.async.mult.call(null,cljs.core.async.chan.call(null,buf_fn.call(null,topic))));
}
});})(or__4131__auto__,mults))
),topic);
}
});})(mults))
;
var p = (function (){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async39484 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.Pub}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.async.Mux}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39484 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta39485){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta39485 = meta39485;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (mults,ensure_mult){
return (function (_39486,meta39485__$1){
var self__ = this;
var _39486__$1 = this;
return (new cljs.core.async.t_cljs$core$async39484(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta39485__$1));
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (mults,ensure_mult){
return (function (_39486){
var self__ = this;
var _39486__$1 = this;
return self__.meta39485;
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (mults,ensure_mult){
return (function (_){
var self__ = this;
var ___$1 = this;
return self__.ch;
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$async$Pub$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$async$Pub$sub_STAR_$arity$4 = ((function (mults,ensure_mult){
return (function (p,topic,ch__$1,close_QMARK_){
var self__ = this;
var p__$1 = this;
var m = self__.ensure_mult.call(null,topic);
return cljs.core.async.tap.call(null,m,ch__$1,close_QMARK_);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$async$Pub$unsub_STAR_$arity$3 = ((function (mults,ensure_mult){
return (function (p,topic,ch__$1){
var self__ = this;
var p__$1 = this;
var temp__5720__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,self__.mults),topic);
if(cljs.core.truth_(temp__5720__auto__)){
var m = temp__5720__auto__;
return cljs.core.async.untap.call(null,m,ch__$1);
} else {
return null;
}
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$1 = ((function (mults,ensure_mult){
return (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.reset_BANG_.call(null,self__.mults,cljs.core.PersistentArrayMap.EMPTY);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$2 = ((function (mults,ensure_mult){
return (function (_,topic){
var self__ = this;
var ___$1 = this;
return cljs.core.swap_BANG_.call(null,self__.mults,cljs.core.dissoc,topic);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.getBasis = ((function (mults,ensure_mult){
return (function (){
return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"topic-fn","topic-fn",-862449736,null),new cljs.core.Symbol(null,"buf-fn","buf-fn",-1200281591,null),new cljs.core.Symbol(null,"mults","mults",-461114485,null),new cljs.core.Symbol(null,"ensure-mult","ensure-mult",1796584816,null),new cljs.core.Symbol(null,"meta39485","meta39485",-409404699,null)], null);
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async39484.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39484.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39484";

cljs.core.async.t_cljs$core$async39484.cljs$lang$ctorPrWriter = ((function (mults,ensure_mult){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async39484");
});})(mults,ensure_mult))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async39484.
 */
cljs.core.async.__GT_t_cljs$core$async39484 = ((function (mults,ensure_mult){
return (function cljs$core$async$__GT_t_cljs$core$async39484(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta39485){
return (new cljs.core.async.t_cljs$core$async39484(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta39485));
});})(mults,ensure_mult))
;

}

return (new cljs.core.async.t_cljs$core$async39484(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__38370__auto___39604 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___39604,mults,ensure_mult,p){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___39604,mults,ensure_mult,p){
return (function (state_39558){
var state_val_39559 = (state_39558[(1)]);
if((state_val_39559 === (7))){
var inst_39554 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
var statearr_39560_39605 = state_39558__$1;
(statearr_39560_39605[(2)] = inst_39554);

(statearr_39560_39605[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (20))){
var state_39558__$1 = state_39558;
var statearr_39561_39606 = state_39558__$1;
(statearr_39561_39606[(2)] = null);

(statearr_39561_39606[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (1))){
var state_39558__$1 = state_39558;
var statearr_39562_39607 = state_39558__$1;
(statearr_39562_39607[(2)] = null);

(statearr_39562_39607[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (24))){
var inst_39537 = (state_39558[(7)]);
var inst_39546 = cljs.core.swap_BANG_.call(null,mults,cljs.core.dissoc,inst_39537);
var state_39558__$1 = state_39558;
var statearr_39563_39608 = state_39558__$1;
(statearr_39563_39608[(2)] = inst_39546);

(statearr_39563_39608[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (4))){
var inst_39489 = (state_39558[(8)]);
var inst_39489__$1 = (state_39558[(2)]);
var inst_39490 = (inst_39489__$1 == null);
var state_39558__$1 = (function (){var statearr_39564 = state_39558;
(statearr_39564[(8)] = inst_39489__$1);

return statearr_39564;
})();
if(cljs.core.truth_(inst_39490)){
var statearr_39565_39609 = state_39558__$1;
(statearr_39565_39609[(1)] = (5));

} else {
var statearr_39566_39610 = state_39558__$1;
(statearr_39566_39610[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (15))){
var inst_39531 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
var statearr_39567_39611 = state_39558__$1;
(statearr_39567_39611[(2)] = inst_39531);

(statearr_39567_39611[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (21))){
var inst_39551 = (state_39558[(2)]);
var state_39558__$1 = (function (){var statearr_39568 = state_39558;
(statearr_39568[(9)] = inst_39551);

return statearr_39568;
})();
var statearr_39569_39612 = state_39558__$1;
(statearr_39569_39612[(2)] = null);

(statearr_39569_39612[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (13))){
var inst_39513 = (state_39558[(10)]);
var inst_39515 = cljs.core.chunked_seq_QMARK_.call(null,inst_39513);
var state_39558__$1 = state_39558;
if(inst_39515){
var statearr_39570_39613 = state_39558__$1;
(statearr_39570_39613[(1)] = (16));

} else {
var statearr_39571_39614 = state_39558__$1;
(statearr_39571_39614[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (22))){
var inst_39543 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
if(cljs.core.truth_(inst_39543)){
var statearr_39572_39615 = state_39558__$1;
(statearr_39572_39615[(1)] = (23));

} else {
var statearr_39573_39616 = state_39558__$1;
(statearr_39573_39616[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (6))){
var inst_39537 = (state_39558[(7)]);
var inst_39489 = (state_39558[(8)]);
var inst_39539 = (state_39558[(11)]);
var inst_39537__$1 = topic_fn.call(null,inst_39489);
var inst_39538 = cljs.core.deref.call(null,mults);
var inst_39539__$1 = cljs.core.get.call(null,inst_39538,inst_39537__$1);
var state_39558__$1 = (function (){var statearr_39574 = state_39558;
(statearr_39574[(7)] = inst_39537__$1);

(statearr_39574[(11)] = inst_39539__$1);

return statearr_39574;
})();
if(cljs.core.truth_(inst_39539__$1)){
var statearr_39575_39617 = state_39558__$1;
(statearr_39575_39617[(1)] = (19));

} else {
var statearr_39576_39618 = state_39558__$1;
(statearr_39576_39618[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (25))){
var inst_39548 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
var statearr_39577_39619 = state_39558__$1;
(statearr_39577_39619[(2)] = inst_39548);

(statearr_39577_39619[(1)] = (21));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (17))){
var inst_39513 = (state_39558[(10)]);
var inst_39522 = cljs.core.first.call(null,inst_39513);
var inst_39523 = cljs.core.async.muxch_STAR_.call(null,inst_39522);
var inst_39524 = cljs.core.async.close_BANG_.call(null,inst_39523);
var inst_39525 = cljs.core.next.call(null,inst_39513);
var inst_39499 = inst_39525;
var inst_39500 = null;
var inst_39501 = (0);
var inst_39502 = (0);
var state_39558__$1 = (function (){var statearr_39578 = state_39558;
(statearr_39578[(12)] = inst_39499);

(statearr_39578[(13)] = inst_39524);

(statearr_39578[(14)] = inst_39501);

(statearr_39578[(15)] = inst_39500);

(statearr_39578[(16)] = inst_39502);

return statearr_39578;
})();
var statearr_39579_39620 = state_39558__$1;
(statearr_39579_39620[(2)] = null);

(statearr_39579_39620[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (3))){
var inst_39556 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39558__$1,inst_39556);
} else {
if((state_val_39559 === (12))){
var inst_39533 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
var statearr_39580_39621 = state_39558__$1;
(statearr_39580_39621[(2)] = inst_39533);

(statearr_39580_39621[(1)] = (9));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (2))){
var state_39558__$1 = state_39558;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39558__$1,(4),ch);
} else {
if((state_val_39559 === (23))){
var state_39558__$1 = state_39558;
var statearr_39581_39622 = state_39558__$1;
(statearr_39581_39622[(2)] = null);

(statearr_39581_39622[(1)] = (25));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (19))){
var inst_39489 = (state_39558[(8)]);
var inst_39539 = (state_39558[(11)]);
var inst_39541 = cljs.core.async.muxch_STAR_.call(null,inst_39539);
var state_39558__$1 = state_39558;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39558__$1,(22),inst_39541,inst_39489);
} else {
if((state_val_39559 === (11))){
var inst_39499 = (state_39558[(12)]);
var inst_39513 = (state_39558[(10)]);
var inst_39513__$1 = cljs.core.seq.call(null,inst_39499);
var state_39558__$1 = (function (){var statearr_39582 = state_39558;
(statearr_39582[(10)] = inst_39513__$1);

return statearr_39582;
})();
if(inst_39513__$1){
var statearr_39583_39623 = state_39558__$1;
(statearr_39583_39623[(1)] = (13));

} else {
var statearr_39584_39624 = state_39558__$1;
(statearr_39584_39624[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (9))){
var inst_39535 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
var statearr_39585_39625 = state_39558__$1;
(statearr_39585_39625[(2)] = inst_39535);

(statearr_39585_39625[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (5))){
var inst_39496 = cljs.core.deref.call(null,mults);
var inst_39497 = cljs.core.vals.call(null,inst_39496);
var inst_39498 = cljs.core.seq.call(null,inst_39497);
var inst_39499 = inst_39498;
var inst_39500 = null;
var inst_39501 = (0);
var inst_39502 = (0);
var state_39558__$1 = (function (){var statearr_39586 = state_39558;
(statearr_39586[(12)] = inst_39499);

(statearr_39586[(14)] = inst_39501);

(statearr_39586[(15)] = inst_39500);

(statearr_39586[(16)] = inst_39502);

return statearr_39586;
})();
var statearr_39587_39626 = state_39558__$1;
(statearr_39587_39626[(2)] = null);

(statearr_39587_39626[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (14))){
var state_39558__$1 = state_39558;
var statearr_39591_39627 = state_39558__$1;
(statearr_39591_39627[(2)] = null);

(statearr_39591_39627[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (16))){
var inst_39513 = (state_39558[(10)]);
var inst_39517 = cljs.core.chunk_first.call(null,inst_39513);
var inst_39518 = cljs.core.chunk_rest.call(null,inst_39513);
var inst_39519 = cljs.core.count.call(null,inst_39517);
var inst_39499 = inst_39518;
var inst_39500 = inst_39517;
var inst_39501 = inst_39519;
var inst_39502 = (0);
var state_39558__$1 = (function (){var statearr_39592 = state_39558;
(statearr_39592[(12)] = inst_39499);

(statearr_39592[(14)] = inst_39501);

(statearr_39592[(15)] = inst_39500);

(statearr_39592[(16)] = inst_39502);

return statearr_39592;
})();
var statearr_39593_39628 = state_39558__$1;
(statearr_39593_39628[(2)] = null);

(statearr_39593_39628[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (10))){
var inst_39499 = (state_39558[(12)]);
var inst_39501 = (state_39558[(14)]);
var inst_39500 = (state_39558[(15)]);
var inst_39502 = (state_39558[(16)]);
var inst_39507 = cljs.core._nth.call(null,inst_39500,inst_39502);
var inst_39508 = cljs.core.async.muxch_STAR_.call(null,inst_39507);
var inst_39509 = cljs.core.async.close_BANG_.call(null,inst_39508);
var inst_39510 = (inst_39502 + (1));
var tmp39588 = inst_39499;
var tmp39589 = inst_39501;
var tmp39590 = inst_39500;
var inst_39499__$1 = tmp39588;
var inst_39500__$1 = tmp39590;
var inst_39501__$1 = tmp39589;
var inst_39502__$1 = inst_39510;
var state_39558__$1 = (function (){var statearr_39594 = state_39558;
(statearr_39594[(17)] = inst_39509);

(statearr_39594[(12)] = inst_39499__$1);

(statearr_39594[(14)] = inst_39501__$1);

(statearr_39594[(15)] = inst_39500__$1);

(statearr_39594[(16)] = inst_39502__$1);

return statearr_39594;
})();
var statearr_39595_39629 = state_39558__$1;
(statearr_39595_39629[(2)] = null);

(statearr_39595_39629[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (18))){
var inst_39528 = (state_39558[(2)]);
var state_39558__$1 = state_39558;
var statearr_39596_39630 = state_39558__$1;
(statearr_39596_39630[(2)] = inst_39528);

(statearr_39596_39630[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39559 === (8))){
var inst_39501 = (state_39558[(14)]);
var inst_39502 = (state_39558[(16)]);
var inst_39504 = (inst_39502 < inst_39501);
var inst_39505 = inst_39504;
var state_39558__$1 = state_39558;
if(cljs.core.truth_(inst_39505)){
var statearr_39597_39631 = state_39558__$1;
(statearr_39597_39631[(1)] = (10));

} else {
var statearr_39598_39632 = state_39558__$1;
(statearr_39598_39632[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___39604,mults,ensure_mult,p))
;
return ((function (switch__38275__auto__,c__38370__auto___39604,mults,ensure_mult,p){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_39599 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_39599[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_39599[(1)] = (1));

return statearr_39599;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_39558){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39558);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e39600){if((e39600 instanceof Object)){
var ex__38279__auto__ = e39600;
var statearr_39601_39633 = state_39558;
(statearr_39601_39633[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39558);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39600;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39634 = state_39558;
state_39558 = G__39634;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_39558){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_39558);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___39604,mults,ensure_mult,p))
})();
var state__38372__auto__ = (function (){var statearr_39602 = f__38371__auto__.call(null);
(statearr_39602[(6)] = c__38370__auto___39604);

return statearr_39602;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___39604,mults,ensure_mult,p))
);


return p;
});

cljs.core.async.pub.cljs$lang$maxFixedArity = 3;

/**
 * Subscribes a channel to a topic of a pub.
 * 
 *   By default the channel will be closed when the source closes,
 *   but can be determined by the close? parameter.
 */
cljs.core.async.sub = (function cljs$core$async$sub(var_args){
var G__39636 = arguments.length;
switch (G__39636) {
case 3:
return cljs.core.async.sub.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
case 4:
return cljs.core.async.sub.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.sub.cljs$core$IFn$_invoke$arity$3 = (function (p,topic,ch){
return cljs.core.async.sub.call(null,p,topic,ch,true);
});

cljs.core.async.sub.cljs$core$IFn$_invoke$arity$4 = (function (p,topic,ch,close_QMARK_){
return cljs.core.async.sub_STAR_.call(null,p,topic,ch,close_QMARK_);
});

cljs.core.async.sub.cljs$lang$maxFixedArity = 4;

/**
 * Unsubscribes a channel from a topic of a pub
 */
cljs.core.async.unsub = (function cljs$core$async$unsub(p,topic,ch){
return cljs.core.async.unsub_STAR_.call(null,p,topic,ch);
});
/**
 * Unsubscribes all channels from a pub, or a topic of a pub
 */
cljs.core.async.unsub_all = (function cljs$core$async$unsub_all(var_args){
var G__39639 = arguments.length;
switch (G__39639) {
case 1:
return cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$1 = (function (p){
return cljs.core.async.unsub_all_STAR_.call(null,p);
});

cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$2 = (function (p,topic){
return cljs.core.async.unsub_all_STAR_.call(null,p,topic);
});

cljs.core.async.unsub_all.cljs$lang$maxFixedArity = 2;

/**
 * Takes a function and a collection of source channels, and returns a
 *   channel which contains the values produced by applying f to the set
 *   of first items taken from each source channel, followed by applying
 *   f to the set of second items from each channel, until any one of the
 *   channels is closed, at which point the output channel will be
 *   closed. The returned channel will be unbuffered by default, or a
 *   buf-or-n can be supplied
 */
cljs.core.async.map = (function cljs$core$async$map(var_args){
var G__39642 = arguments.length;
switch (G__39642) {
case 2:
return cljs.core.async.map.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.map.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.map.cljs$core$IFn$_invoke$arity$2 = (function (f,chs){
return cljs.core.async.map.call(null,f,chs,null);
});

cljs.core.async.map.cljs$core$IFn$_invoke$arity$3 = (function (f,chs,buf_or_n){
var chs__$1 = cljs.core.vec.call(null,chs);
var out = cljs.core.async.chan.call(null,buf_or_n);
var cnt = cljs.core.count.call(null,chs__$1);
var rets = cljs.core.object_array.call(null,cnt);
var dchan = cljs.core.async.chan.call(null,(1));
var dctr = cljs.core.atom.call(null,null);
var done = cljs.core.mapv.call(null,((function (chs__$1,out,cnt,rets,dchan,dctr){
return (function (i){
return ((function (chs__$1,out,cnt,rets,dchan,dctr){
return (function (ret){
(rets[i] = ret);

if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.call(null,dchan,rets.slice((0)));
} else {
return null;
}
});
;})(chs__$1,out,cnt,rets,dchan,dctr))
});})(chs__$1,out,cnt,rets,dchan,dctr))
,cljs.core.range.call(null,cnt));
var c__38370__auto___39709 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___39709,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___39709,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (state_39681){
var state_val_39682 = (state_39681[(1)]);
if((state_val_39682 === (7))){
var state_39681__$1 = state_39681;
var statearr_39683_39710 = state_39681__$1;
(statearr_39683_39710[(2)] = null);

(statearr_39683_39710[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (1))){
var state_39681__$1 = state_39681;
var statearr_39684_39711 = state_39681__$1;
(statearr_39684_39711[(2)] = null);

(statearr_39684_39711[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (4))){
var inst_39645 = (state_39681[(7)]);
var inst_39647 = (inst_39645 < cnt);
var state_39681__$1 = state_39681;
if(cljs.core.truth_(inst_39647)){
var statearr_39685_39712 = state_39681__$1;
(statearr_39685_39712[(1)] = (6));

} else {
var statearr_39686_39713 = state_39681__$1;
(statearr_39686_39713[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (15))){
var inst_39677 = (state_39681[(2)]);
var state_39681__$1 = state_39681;
var statearr_39687_39714 = state_39681__$1;
(statearr_39687_39714[(2)] = inst_39677);

(statearr_39687_39714[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (13))){
var inst_39670 = cljs.core.async.close_BANG_.call(null,out);
var state_39681__$1 = state_39681;
var statearr_39688_39715 = state_39681__$1;
(statearr_39688_39715[(2)] = inst_39670);

(statearr_39688_39715[(1)] = (15));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (6))){
var state_39681__$1 = state_39681;
var statearr_39689_39716 = state_39681__$1;
(statearr_39689_39716[(2)] = null);

(statearr_39689_39716[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (3))){
var inst_39679 = (state_39681[(2)]);
var state_39681__$1 = state_39681;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39681__$1,inst_39679);
} else {
if((state_val_39682 === (12))){
var inst_39667 = (state_39681[(8)]);
var inst_39667__$1 = (state_39681[(2)]);
var inst_39668 = cljs.core.some.call(null,cljs.core.nil_QMARK_,inst_39667__$1);
var state_39681__$1 = (function (){var statearr_39690 = state_39681;
(statearr_39690[(8)] = inst_39667__$1);

return statearr_39690;
})();
if(cljs.core.truth_(inst_39668)){
var statearr_39691_39717 = state_39681__$1;
(statearr_39691_39717[(1)] = (13));

} else {
var statearr_39692_39718 = state_39681__$1;
(statearr_39692_39718[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (2))){
var inst_39644 = cljs.core.reset_BANG_.call(null,dctr,cnt);
var inst_39645 = (0);
var state_39681__$1 = (function (){var statearr_39693 = state_39681;
(statearr_39693[(7)] = inst_39645);

(statearr_39693[(9)] = inst_39644);

return statearr_39693;
})();
var statearr_39694_39719 = state_39681__$1;
(statearr_39694_39719[(2)] = null);

(statearr_39694_39719[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (11))){
var inst_39645 = (state_39681[(7)]);
var _ = cljs.core.async.impl.ioc_helpers.add_exception_frame.call(null,state_39681,(10),Object,null,(9));
var inst_39654 = chs__$1.call(null,inst_39645);
var inst_39655 = done.call(null,inst_39645);
var inst_39656 = cljs.core.async.take_BANG_.call(null,inst_39654,inst_39655);
var state_39681__$1 = state_39681;
var statearr_39695_39720 = state_39681__$1;
(statearr_39695_39720[(2)] = inst_39656);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39681__$1);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (9))){
var inst_39645 = (state_39681[(7)]);
var inst_39658 = (state_39681[(2)]);
var inst_39659 = (inst_39645 + (1));
var inst_39645__$1 = inst_39659;
var state_39681__$1 = (function (){var statearr_39696 = state_39681;
(statearr_39696[(7)] = inst_39645__$1);

(statearr_39696[(10)] = inst_39658);

return statearr_39696;
})();
var statearr_39697_39721 = state_39681__$1;
(statearr_39697_39721[(2)] = null);

(statearr_39697_39721[(1)] = (4));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (5))){
var inst_39665 = (state_39681[(2)]);
var state_39681__$1 = (function (){var statearr_39698 = state_39681;
(statearr_39698[(11)] = inst_39665);

return statearr_39698;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39681__$1,(12),dchan);
} else {
if((state_val_39682 === (14))){
var inst_39667 = (state_39681[(8)]);
var inst_39672 = cljs.core.apply.call(null,f,inst_39667);
var state_39681__$1 = state_39681;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39681__$1,(16),out,inst_39672);
} else {
if((state_val_39682 === (16))){
var inst_39674 = (state_39681[(2)]);
var state_39681__$1 = (function (){var statearr_39699 = state_39681;
(statearr_39699[(12)] = inst_39674);

return statearr_39699;
})();
var statearr_39700_39722 = state_39681__$1;
(statearr_39700_39722[(2)] = null);

(statearr_39700_39722[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (10))){
var inst_39649 = (state_39681[(2)]);
var inst_39650 = cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec);
var state_39681__$1 = (function (){var statearr_39701 = state_39681;
(statearr_39701[(13)] = inst_39649);

return statearr_39701;
})();
var statearr_39702_39723 = state_39681__$1;
(statearr_39702_39723[(2)] = inst_39650);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39681__$1);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39682 === (8))){
var inst_39663 = (state_39681[(2)]);
var state_39681__$1 = state_39681;
var statearr_39703_39724 = state_39681__$1;
(statearr_39703_39724[(2)] = inst_39663);

(statearr_39703_39724[(1)] = (5));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___39709,chs__$1,out,cnt,rets,dchan,dctr,done))
;
return ((function (switch__38275__auto__,c__38370__auto___39709,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_39704 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_39704[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_39704[(1)] = (1));

return statearr_39704;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_39681){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39681);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e39705){if((e39705 instanceof Object)){
var ex__38279__auto__ = e39705;
var statearr_39706_39725 = state_39681;
(statearr_39706_39725[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39681);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39705;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39726 = state_39681;
state_39681 = G__39726;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_39681){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_39681);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___39709,chs__$1,out,cnt,rets,dchan,dctr,done))
})();
var state__38372__auto__ = (function (){var statearr_39707 = f__38371__auto__.call(null);
(statearr_39707[(6)] = c__38370__auto___39709);

return statearr_39707;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___39709,chs__$1,out,cnt,rets,dchan,dctr,done))
);


return out;
});

cljs.core.async.map.cljs$lang$maxFixedArity = 3;

/**
 * Takes a collection of source channels and returns a channel which
 *   contains all values taken from them. The returned channel will be
 *   unbuffered by default, or a buf-or-n can be supplied. The channel
 *   will close after all the source channels have closed.
 */
cljs.core.async.merge = (function cljs$core$async$merge(var_args){
var G__39729 = arguments.length;
switch (G__39729) {
case 1:
return cljs.core.async.merge.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.merge.cljs$core$IFn$_invoke$arity$1 = (function (chs){
return cljs.core.async.merge.call(null,chs,null);
});

cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2 = (function (chs,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__38370__auto___39783 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___39783,out){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___39783,out){
return (function (state_39761){
var state_val_39762 = (state_39761[(1)]);
if((state_val_39762 === (7))){
var inst_39741 = (state_39761[(7)]);
var inst_39740 = (state_39761[(8)]);
var inst_39740__$1 = (state_39761[(2)]);
var inst_39741__$1 = cljs.core.nth.call(null,inst_39740__$1,(0),null);
var inst_39742 = cljs.core.nth.call(null,inst_39740__$1,(1),null);
var inst_39743 = (inst_39741__$1 == null);
var state_39761__$1 = (function (){var statearr_39763 = state_39761;
(statearr_39763[(7)] = inst_39741__$1);

(statearr_39763[(8)] = inst_39740__$1);

(statearr_39763[(9)] = inst_39742);

return statearr_39763;
})();
if(cljs.core.truth_(inst_39743)){
var statearr_39764_39784 = state_39761__$1;
(statearr_39764_39784[(1)] = (8));

} else {
var statearr_39765_39785 = state_39761__$1;
(statearr_39765_39785[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39762 === (1))){
var inst_39730 = cljs.core.vec.call(null,chs);
var inst_39731 = inst_39730;
var state_39761__$1 = (function (){var statearr_39766 = state_39761;
(statearr_39766[(10)] = inst_39731);

return statearr_39766;
})();
var statearr_39767_39786 = state_39761__$1;
(statearr_39767_39786[(2)] = null);

(statearr_39767_39786[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39762 === (4))){
var inst_39731 = (state_39761[(10)]);
var state_39761__$1 = state_39761;
return cljs.core.async.ioc_alts_BANG_.call(null,state_39761__$1,(7),inst_39731);
} else {
if((state_val_39762 === (6))){
var inst_39757 = (state_39761[(2)]);
var state_39761__$1 = state_39761;
var statearr_39768_39787 = state_39761__$1;
(statearr_39768_39787[(2)] = inst_39757);

(statearr_39768_39787[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39762 === (3))){
var inst_39759 = (state_39761[(2)]);
var state_39761__$1 = state_39761;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39761__$1,inst_39759);
} else {
if((state_val_39762 === (2))){
var inst_39731 = (state_39761[(10)]);
var inst_39733 = cljs.core.count.call(null,inst_39731);
var inst_39734 = (inst_39733 > (0));
var state_39761__$1 = state_39761;
if(cljs.core.truth_(inst_39734)){
var statearr_39770_39788 = state_39761__$1;
(statearr_39770_39788[(1)] = (4));

} else {
var statearr_39771_39789 = state_39761__$1;
(statearr_39771_39789[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39762 === (11))){
var inst_39731 = (state_39761[(10)]);
var inst_39750 = (state_39761[(2)]);
var tmp39769 = inst_39731;
var inst_39731__$1 = tmp39769;
var state_39761__$1 = (function (){var statearr_39772 = state_39761;
(statearr_39772[(10)] = inst_39731__$1);

(statearr_39772[(11)] = inst_39750);

return statearr_39772;
})();
var statearr_39773_39790 = state_39761__$1;
(statearr_39773_39790[(2)] = null);

(statearr_39773_39790[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39762 === (9))){
var inst_39741 = (state_39761[(7)]);
var state_39761__$1 = state_39761;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39761__$1,(11),out,inst_39741);
} else {
if((state_val_39762 === (5))){
var inst_39755 = cljs.core.async.close_BANG_.call(null,out);
var state_39761__$1 = state_39761;
var statearr_39774_39791 = state_39761__$1;
(statearr_39774_39791[(2)] = inst_39755);

(statearr_39774_39791[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39762 === (10))){
var inst_39753 = (state_39761[(2)]);
var state_39761__$1 = state_39761;
var statearr_39775_39792 = state_39761__$1;
(statearr_39775_39792[(2)] = inst_39753);

(statearr_39775_39792[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39762 === (8))){
var inst_39741 = (state_39761[(7)]);
var inst_39731 = (state_39761[(10)]);
var inst_39740 = (state_39761[(8)]);
var inst_39742 = (state_39761[(9)]);
var inst_39745 = (function (){var cs = inst_39731;
var vec__39736 = inst_39740;
var v = inst_39741;
var c = inst_39742;
return ((function (cs,vec__39736,v,c,inst_39741,inst_39731,inst_39740,inst_39742,state_val_39762,c__38370__auto___39783,out){
return (function (p1__39727_SHARP_){
return cljs.core.not_EQ_.call(null,c,p1__39727_SHARP_);
});
;})(cs,vec__39736,v,c,inst_39741,inst_39731,inst_39740,inst_39742,state_val_39762,c__38370__auto___39783,out))
})();
var inst_39746 = cljs.core.filterv.call(null,inst_39745,inst_39731);
var inst_39731__$1 = inst_39746;
var state_39761__$1 = (function (){var statearr_39776 = state_39761;
(statearr_39776[(10)] = inst_39731__$1);

return statearr_39776;
})();
var statearr_39777_39793 = state_39761__$1;
(statearr_39777_39793[(2)] = null);

(statearr_39777_39793[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___39783,out))
;
return ((function (switch__38275__auto__,c__38370__auto___39783,out){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_39778 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_39778[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_39778[(1)] = (1));

return statearr_39778;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_39761){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39761);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e39779){if((e39779 instanceof Object)){
var ex__38279__auto__ = e39779;
var statearr_39780_39794 = state_39761;
(statearr_39780_39794[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39761);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39779;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39795 = state_39761;
state_39761 = G__39795;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_39761){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_39761);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___39783,out))
})();
var state__38372__auto__ = (function (){var statearr_39781 = f__38371__auto__.call(null);
(statearr_39781[(6)] = c__38370__auto___39783);

return statearr_39781;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___39783,out))
);


return out;
});

cljs.core.async.merge.cljs$lang$maxFixedArity = 2;

/**
 * Returns a channel containing the single (collection) result of the
 *   items taken from the channel conjoined to the supplied
 *   collection. ch must close before into produces a result.
 */
cljs.core.async.into = (function cljs$core$async$into(coll,ch){
return cljs.core.async.reduce.call(null,cljs.core.conj,coll,ch);
});
/**
 * Returns a channel that will return, at most, n items from ch. After n items
 * have been returned, or ch has been closed, the return chanel will close.
 * 
 *   The output channel is unbuffered by default, unless buf-or-n is given.
 */
cljs.core.async.take = (function cljs$core$async$take(var_args){
var G__39797 = arguments.length;
switch (G__39797) {
case 2:
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.take.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.take.call(null,n,ch,null);
});

cljs.core.async.take.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__38370__auto___39842 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___39842,out){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___39842,out){
return (function (state_39821){
var state_val_39822 = (state_39821[(1)]);
if((state_val_39822 === (7))){
var inst_39803 = (state_39821[(7)]);
var inst_39803__$1 = (state_39821[(2)]);
var inst_39804 = (inst_39803__$1 == null);
var inst_39805 = cljs.core.not.call(null,inst_39804);
var state_39821__$1 = (function (){var statearr_39823 = state_39821;
(statearr_39823[(7)] = inst_39803__$1);

return statearr_39823;
})();
if(inst_39805){
var statearr_39824_39843 = state_39821__$1;
(statearr_39824_39843[(1)] = (8));

} else {
var statearr_39825_39844 = state_39821__$1;
(statearr_39825_39844[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (1))){
var inst_39798 = (0);
var state_39821__$1 = (function (){var statearr_39826 = state_39821;
(statearr_39826[(8)] = inst_39798);

return statearr_39826;
})();
var statearr_39827_39845 = state_39821__$1;
(statearr_39827_39845[(2)] = null);

(statearr_39827_39845[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (4))){
var state_39821__$1 = state_39821;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39821__$1,(7),ch);
} else {
if((state_val_39822 === (6))){
var inst_39816 = (state_39821[(2)]);
var state_39821__$1 = state_39821;
var statearr_39828_39846 = state_39821__$1;
(statearr_39828_39846[(2)] = inst_39816);

(statearr_39828_39846[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (3))){
var inst_39818 = (state_39821[(2)]);
var inst_39819 = cljs.core.async.close_BANG_.call(null,out);
var state_39821__$1 = (function (){var statearr_39829 = state_39821;
(statearr_39829[(9)] = inst_39818);

return statearr_39829;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39821__$1,inst_39819);
} else {
if((state_val_39822 === (2))){
var inst_39798 = (state_39821[(8)]);
var inst_39800 = (inst_39798 < n);
var state_39821__$1 = state_39821;
if(cljs.core.truth_(inst_39800)){
var statearr_39830_39847 = state_39821__$1;
(statearr_39830_39847[(1)] = (4));

} else {
var statearr_39831_39848 = state_39821__$1;
(statearr_39831_39848[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (11))){
var inst_39798 = (state_39821[(8)]);
var inst_39808 = (state_39821[(2)]);
var inst_39809 = (inst_39798 + (1));
var inst_39798__$1 = inst_39809;
var state_39821__$1 = (function (){var statearr_39832 = state_39821;
(statearr_39832[(10)] = inst_39808);

(statearr_39832[(8)] = inst_39798__$1);

return statearr_39832;
})();
var statearr_39833_39849 = state_39821__$1;
(statearr_39833_39849[(2)] = null);

(statearr_39833_39849[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (9))){
var state_39821__$1 = state_39821;
var statearr_39834_39850 = state_39821__$1;
(statearr_39834_39850[(2)] = null);

(statearr_39834_39850[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (5))){
var state_39821__$1 = state_39821;
var statearr_39835_39851 = state_39821__$1;
(statearr_39835_39851[(2)] = null);

(statearr_39835_39851[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (10))){
var inst_39813 = (state_39821[(2)]);
var state_39821__$1 = state_39821;
var statearr_39836_39852 = state_39821__$1;
(statearr_39836_39852[(2)] = inst_39813);

(statearr_39836_39852[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39822 === (8))){
var inst_39803 = (state_39821[(7)]);
var state_39821__$1 = state_39821;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39821__$1,(11),out,inst_39803);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___39842,out))
;
return ((function (switch__38275__auto__,c__38370__auto___39842,out){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_39837 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_39837[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_39837[(1)] = (1));

return statearr_39837;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_39821){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39821);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e39838){if((e39838 instanceof Object)){
var ex__38279__auto__ = e39838;
var statearr_39839_39853 = state_39821;
(statearr_39839_39853[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39821);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39838;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39854 = state_39821;
state_39821 = G__39854;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_39821){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_39821);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___39842,out))
})();
var state__38372__auto__ = (function (){var statearr_39840 = f__38371__auto__.call(null);
(statearr_39840[(6)] = c__38370__auto___39842);

return statearr_39840;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___39842,out))
);


return out;
});

cljs.core.async.take.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_LT_ = (function cljs$core$async$map_LT_(f,ch){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async39856 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39856 = (function (f,ch,meta39857){
this.f = f;
this.ch = ch;
this.meta39857 = meta39857;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_39858,meta39857__$1){
var self__ = this;
var _39858__$1 = this;
return (new cljs.core.async.t_cljs$core$async39856(self__.f,self__.ch,meta39857__$1));
});

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_39858){
var self__ = this;
var _39858__$1 = this;
return self__.meta39857;
});

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,(function (){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async39859 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39859 = (function (f,ch,meta39857,_,fn1,meta39860){
this.f = f;
this.ch = ch;
this.meta39857 = meta39857;
this._ = _;
this.fn1 = fn1;
this.meta39860 = meta39860;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async39859.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (___$1){
return (function (_39861,meta39860__$1){
var self__ = this;
var _39861__$1 = this;
return (new cljs.core.async.t_cljs$core$async39859(self__.f,self__.ch,self__.meta39857,self__._,self__.fn1,meta39860__$1));
});})(___$1))
;

cljs.core.async.t_cljs$core$async39859.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (___$1){
return (function (_39861){
var self__ = this;
var _39861__$1 = this;
return self__.meta39860;
});})(___$1))
;

cljs.core.async.t_cljs$core$async39859.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39859.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = ((function (___$1){
return (function (___$1){
var self__ = this;
var ___$2 = this;
return cljs.core.async.impl.protocols.active_QMARK_.call(null,self__.fn1);
});})(___$1))
;

cljs.core.async.t_cljs$core$async39859.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = ((function (___$1){
return (function (___$1){
var self__ = this;
var ___$2 = this;
return true;
});})(___$1))
;

cljs.core.async.t_cljs$core$async39859.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = ((function (___$1){
return (function (___$1){
var self__ = this;
var ___$2 = this;
var f1 = cljs.core.async.impl.protocols.commit.call(null,self__.fn1);
return ((function (f1,___$2,___$1){
return (function (p1__39855_SHARP_){
return f1.call(null,(((p1__39855_SHARP_ == null))?null:self__.f.call(null,p1__39855_SHARP_)));
});
;})(f1,___$2,___$1))
});})(___$1))
;

cljs.core.async.t_cljs$core$async39859.getBasis = ((function (___$1){
return (function (){
return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta39857","meta39857",557754028,null),cljs.core.with_meta(new cljs.core.Symbol(null,"_","_",-1201019570,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol("cljs.core.async","t_cljs$core$async39856","cljs.core.async/t_cljs$core$async39856",-616134641,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta39860","meta39860",-2032918677,null)], null);
});})(___$1))
;

cljs.core.async.t_cljs$core$async39859.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39859.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39859";

cljs.core.async.t_cljs$core$async39859.cljs$lang$ctorPrWriter = ((function (___$1){
return (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async39859");
});})(___$1))
;

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async39859.
 */
cljs.core.async.__GT_t_cljs$core$async39859 = ((function (___$1){
return (function cljs$core$async$map_LT__$___GT_t_cljs$core$async39859(f__$1,ch__$1,meta39857__$1,___$2,fn1__$1,meta39860){
return (new cljs.core.async.t_cljs$core$async39859(f__$1,ch__$1,meta39857__$1,___$2,fn1__$1,meta39860));
});})(___$1))
;

}

return (new cljs.core.async.t_cljs$core$async39859(self__.f,self__.ch,self__.meta39857,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY));
})()
);
if(cljs.core.truth_((function (){var and__4120__auto__ = ret;
if(cljs.core.truth_(and__4120__auto__)){
return (!((cljs.core.deref.call(null,ret) == null)));
} else {
return and__4120__auto__;
}
})())){
return cljs.core.async.impl.channels.box.call(null,self__.f.call(null,cljs.core.deref.call(null,ret)));
} else {
return ret;
}
});

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39856.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1);
});

cljs.core.async.t_cljs$core$async39856.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta39857","meta39857",557754028,null)], null);
});

cljs.core.async.t_cljs$core$async39856.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39856.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39856";

cljs.core.async.t_cljs$core$async39856.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async39856");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async39856.
 */
cljs.core.async.__GT_t_cljs$core$async39856 = (function cljs$core$async$map_LT__$___GT_t_cljs$core$async39856(f__$1,ch__$1,meta39857){
return (new cljs.core.async.t_cljs$core$async39856(f__$1,ch__$1,meta39857));
});

}

return (new cljs.core.async.t_cljs$core$async39856(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_GT_ = (function cljs$core$async$map_GT_(f,ch){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async39862 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39862 = (function (f,ch,meta39863){
this.f = f;
this.ch = ch;
this.meta39863 = meta39863;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_39864,meta39863__$1){
var self__ = this;
var _39864__$1 = this;
return (new cljs.core.async.t_cljs$core$async39862(self__.f,self__.ch,meta39863__$1));
});

cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_39864){
var self__ = this;
var _39864__$1 = this;
return self__.meta39863;
});

cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1);
});

cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39862.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,self__.f.call(null,val),fn1);
});

cljs.core.async.t_cljs$core$async39862.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta39863","meta39863",-685671342,null)], null);
});

cljs.core.async.t_cljs$core$async39862.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39862.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39862";

cljs.core.async.t_cljs$core$async39862.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async39862");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async39862.
 */
cljs.core.async.__GT_t_cljs$core$async39862 = (function cljs$core$async$map_GT__$___GT_t_cljs$core$async39862(f__$1,ch__$1,meta39863){
return (new cljs.core.async.t_cljs$core$async39862(f__$1,ch__$1,meta39863));
});

}

return (new cljs.core.async.t_cljs$core$async39862(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_GT_ = (function cljs$core$async$filter_GT_(p,ch){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.t_cljs$core$async39865 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Channel}
 * @implements {cljs.core.async.impl.protocols.WritePort}
 * @implements {cljs.core.async.impl.protocols.ReadPort}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async39865 = (function (p,ch,meta39866){
this.p = p;
this.ch = ch;
this.meta39866 = meta39866;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_39867,meta39866__$1){
var self__ = this;
var _39867__$1 = this;
return (new cljs.core.async.t_cljs$core$async39865(self__.p,self__.ch,meta39866__$1));
});

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_39867){
var self__ = this;
var _39867__$1 = this;
return self__.meta39866;
});

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch);
});

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){
var self__ = this;
var ___$1 = this;
return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1);
});

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async39865.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(self__.p.call(null,val))){
return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1);
} else {
return cljs.core.async.impl.channels.box.call(null,cljs.core.not.call(null,cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch)));
}
});

cljs.core.async.t_cljs$core$async39865.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"p","p",1791580836,null),new cljs.core.Symbol(null,"ch","ch",1085813622,null),new cljs.core.Symbol(null,"meta39866","meta39866",880715324,null)], null);
});

cljs.core.async.t_cljs$core$async39865.cljs$lang$type = true;

cljs.core.async.t_cljs$core$async39865.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async39865";

cljs.core.async.t_cljs$core$async39865.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"cljs.core.async/t_cljs$core$async39865");
});

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async39865.
 */
cljs.core.async.__GT_t_cljs$core$async39865 = (function cljs$core$async$filter_GT__$___GT_t_cljs$core$async39865(p__$1,ch__$1,meta39866){
return (new cljs.core.async.t_cljs$core$async39865(p__$1,ch__$1,meta39866));
});

}

return (new cljs.core.async.t_cljs$core$async39865(p,ch,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_GT_ = (function cljs$core$async$remove_GT_(p,ch){
return cljs.core.async.filter_GT_.call(null,cljs.core.complement.call(null,p),ch);
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_LT_ = (function cljs$core$async$filter_LT_(var_args){
var G__39869 = arguments.length;
switch (G__39869) {
case 2:
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.filter_LT_.call(null,p,ch,null);
});

cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__38370__auto___39909 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___39909,out){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___39909,out){
return (function (state_39890){
var state_val_39891 = (state_39890[(1)]);
if((state_val_39891 === (7))){
var inst_39886 = (state_39890[(2)]);
var state_39890__$1 = state_39890;
var statearr_39892_39910 = state_39890__$1;
(statearr_39892_39910[(2)] = inst_39886);

(statearr_39892_39910[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (1))){
var state_39890__$1 = state_39890;
var statearr_39893_39911 = state_39890__$1;
(statearr_39893_39911[(2)] = null);

(statearr_39893_39911[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (4))){
var inst_39872 = (state_39890[(7)]);
var inst_39872__$1 = (state_39890[(2)]);
var inst_39873 = (inst_39872__$1 == null);
var state_39890__$1 = (function (){var statearr_39894 = state_39890;
(statearr_39894[(7)] = inst_39872__$1);

return statearr_39894;
})();
if(cljs.core.truth_(inst_39873)){
var statearr_39895_39912 = state_39890__$1;
(statearr_39895_39912[(1)] = (5));

} else {
var statearr_39896_39913 = state_39890__$1;
(statearr_39896_39913[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (6))){
var inst_39872 = (state_39890[(7)]);
var inst_39877 = p.call(null,inst_39872);
var state_39890__$1 = state_39890;
if(cljs.core.truth_(inst_39877)){
var statearr_39897_39914 = state_39890__$1;
(statearr_39897_39914[(1)] = (8));

} else {
var statearr_39898_39915 = state_39890__$1;
(statearr_39898_39915[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (3))){
var inst_39888 = (state_39890[(2)]);
var state_39890__$1 = state_39890;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39890__$1,inst_39888);
} else {
if((state_val_39891 === (2))){
var state_39890__$1 = state_39890;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39890__$1,(4),ch);
} else {
if((state_val_39891 === (11))){
var inst_39880 = (state_39890[(2)]);
var state_39890__$1 = state_39890;
var statearr_39899_39916 = state_39890__$1;
(statearr_39899_39916[(2)] = inst_39880);

(statearr_39899_39916[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (9))){
var state_39890__$1 = state_39890;
var statearr_39900_39917 = state_39890__$1;
(statearr_39900_39917[(2)] = null);

(statearr_39900_39917[(1)] = (10));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (5))){
var inst_39875 = cljs.core.async.close_BANG_.call(null,out);
var state_39890__$1 = state_39890;
var statearr_39901_39918 = state_39890__$1;
(statearr_39901_39918[(2)] = inst_39875);

(statearr_39901_39918[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (10))){
var inst_39883 = (state_39890[(2)]);
var state_39890__$1 = (function (){var statearr_39902 = state_39890;
(statearr_39902[(8)] = inst_39883);

return statearr_39902;
})();
var statearr_39903_39919 = state_39890__$1;
(statearr_39903_39919[(2)] = null);

(statearr_39903_39919[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39891 === (8))){
var inst_39872 = (state_39890[(7)]);
var state_39890__$1 = state_39890;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39890__$1,(11),out,inst_39872);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___39909,out))
;
return ((function (switch__38275__auto__,c__38370__auto___39909,out){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_39904 = [null,null,null,null,null,null,null,null,null];
(statearr_39904[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_39904[(1)] = (1));

return statearr_39904;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_39890){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39890);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e39905){if((e39905 instanceof Object)){
var ex__38279__auto__ = e39905;
var statearr_39906_39920 = state_39890;
(statearr_39906_39920[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39890);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e39905;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__39921 = state_39890;
state_39890 = G__39921;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_39890){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_39890);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___39909,out))
})();
var state__38372__auto__ = (function (){var statearr_39907 = f__38371__auto__.call(null);
(statearr_39907[(6)] = c__38370__auto___39909);

return statearr_39907;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___39909,out))
);


return out;
});

cljs.core.async.filter_LT_.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_LT_ = (function cljs$core$async$remove_LT_(var_args){
var G__39923 = arguments.length;
switch (G__39923) {
case 2:
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.remove_LT_.call(null,p,ch,null);
});

cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3 = (function (p,ch,buf_or_n){
return cljs.core.async.filter_LT_.call(null,cljs.core.complement.call(null,p),ch,buf_or_n);
});

cljs.core.async.remove_LT_.cljs$lang$maxFixedArity = 3;

cljs.core.async.mapcat_STAR_ = (function cljs$core$async$mapcat_STAR_(f,in$,out){
var c__38370__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto__){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto__){
return (function (state_39986){
var state_val_39987 = (state_39986[(1)]);
if((state_val_39987 === (7))){
var inst_39982 = (state_39986[(2)]);
var state_39986__$1 = state_39986;
var statearr_39988_40026 = state_39986__$1;
(statearr_39988_40026[(2)] = inst_39982);

(statearr_39988_40026[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (20))){
var inst_39952 = (state_39986[(7)]);
var inst_39963 = (state_39986[(2)]);
var inst_39964 = cljs.core.next.call(null,inst_39952);
var inst_39938 = inst_39964;
var inst_39939 = null;
var inst_39940 = (0);
var inst_39941 = (0);
var state_39986__$1 = (function (){var statearr_39989 = state_39986;
(statearr_39989[(8)] = inst_39938);

(statearr_39989[(9)] = inst_39941);

(statearr_39989[(10)] = inst_39963);

(statearr_39989[(11)] = inst_39939);

(statearr_39989[(12)] = inst_39940);

return statearr_39989;
})();
var statearr_39990_40027 = state_39986__$1;
(statearr_39990_40027[(2)] = null);

(statearr_39990_40027[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (1))){
var state_39986__$1 = state_39986;
var statearr_39991_40028 = state_39986__$1;
(statearr_39991_40028[(2)] = null);

(statearr_39991_40028[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (4))){
var inst_39927 = (state_39986[(13)]);
var inst_39927__$1 = (state_39986[(2)]);
var inst_39928 = (inst_39927__$1 == null);
var state_39986__$1 = (function (){var statearr_39992 = state_39986;
(statearr_39992[(13)] = inst_39927__$1);

return statearr_39992;
})();
if(cljs.core.truth_(inst_39928)){
var statearr_39993_40029 = state_39986__$1;
(statearr_39993_40029[(1)] = (5));

} else {
var statearr_39994_40030 = state_39986__$1;
(statearr_39994_40030[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (15))){
var state_39986__$1 = state_39986;
var statearr_39998_40031 = state_39986__$1;
(statearr_39998_40031[(2)] = null);

(statearr_39998_40031[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (21))){
var state_39986__$1 = state_39986;
var statearr_39999_40032 = state_39986__$1;
(statearr_39999_40032[(2)] = null);

(statearr_39999_40032[(1)] = (23));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (13))){
var inst_39938 = (state_39986[(8)]);
var inst_39941 = (state_39986[(9)]);
var inst_39939 = (state_39986[(11)]);
var inst_39940 = (state_39986[(12)]);
var inst_39948 = (state_39986[(2)]);
var inst_39949 = (inst_39941 + (1));
var tmp39995 = inst_39938;
var tmp39996 = inst_39939;
var tmp39997 = inst_39940;
var inst_39938__$1 = tmp39995;
var inst_39939__$1 = tmp39996;
var inst_39940__$1 = tmp39997;
var inst_39941__$1 = inst_39949;
var state_39986__$1 = (function (){var statearr_40000 = state_39986;
(statearr_40000[(8)] = inst_39938__$1);

(statearr_40000[(14)] = inst_39948);

(statearr_40000[(9)] = inst_39941__$1);

(statearr_40000[(11)] = inst_39939__$1);

(statearr_40000[(12)] = inst_39940__$1);

return statearr_40000;
})();
var statearr_40001_40033 = state_39986__$1;
(statearr_40001_40033[(2)] = null);

(statearr_40001_40033[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (22))){
var state_39986__$1 = state_39986;
var statearr_40002_40034 = state_39986__$1;
(statearr_40002_40034[(2)] = null);

(statearr_40002_40034[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (6))){
var inst_39927 = (state_39986[(13)]);
var inst_39936 = f.call(null,inst_39927);
var inst_39937 = cljs.core.seq.call(null,inst_39936);
var inst_39938 = inst_39937;
var inst_39939 = null;
var inst_39940 = (0);
var inst_39941 = (0);
var state_39986__$1 = (function (){var statearr_40003 = state_39986;
(statearr_40003[(8)] = inst_39938);

(statearr_40003[(9)] = inst_39941);

(statearr_40003[(11)] = inst_39939);

(statearr_40003[(12)] = inst_39940);

return statearr_40003;
})();
var statearr_40004_40035 = state_39986__$1;
(statearr_40004_40035[(2)] = null);

(statearr_40004_40035[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (17))){
var inst_39952 = (state_39986[(7)]);
var inst_39956 = cljs.core.chunk_first.call(null,inst_39952);
var inst_39957 = cljs.core.chunk_rest.call(null,inst_39952);
var inst_39958 = cljs.core.count.call(null,inst_39956);
var inst_39938 = inst_39957;
var inst_39939 = inst_39956;
var inst_39940 = inst_39958;
var inst_39941 = (0);
var state_39986__$1 = (function (){var statearr_40005 = state_39986;
(statearr_40005[(8)] = inst_39938);

(statearr_40005[(9)] = inst_39941);

(statearr_40005[(11)] = inst_39939);

(statearr_40005[(12)] = inst_39940);

return statearr_40005;
})();
var statearr_40006_40036 = state_39986__$1;
(statearr_40006_40036[(2)] = null);

(statearr_40006_40036[(1)] = (8));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (3))){
var inst_39984 = (state_39986[(2)]);
var state_39986__$1 = state_39986;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_39986__$1,inst_39984);
} else {
if((state_val_39987 === (12))){
var inst_39972 = (state_39986[(2)]);
var state_39986__$1 = state_39986;
var statearr_40007_40037 = state_39986__$1;
(statearr_40007_40037[(2)] = inst_39972);

(statearr_40007_40037[(1)] = (9));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (2))){
var state_39986__$1 = state_39986;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_39986__$1,(4),in$);
} else {
if((state_val_39987 === (23))){
var inst_39980 = (state_39986[(2)]);
var state_39986__$1 = state_39986;
var statearr_40008_40038 = state_39986__$1;
(statearr_40008_40038[(2)] = inst_39980);

(statearr_40008_40038[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (19))){
var inst_39967 = (state_39986[(2)]);
var state_39986__$1 = state_39986;
var statearr_40009_40039 = state_39986__$1;
(statearr_40009_40039[(2)] = inst_39967);

(statearr_40009_40039[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (11))){
var inst_39938 = (state_39986[(8)]);
var inst_39952 = (state_39986[(7)]);
var inst_39952__$1 = cljs.core.seq.call(null,inst_39938);
var state_39986__$1 = (function (){var statearr_40010 = state_39986;
(statearr_40010[(7)] = inst_39952__$1);

return statearr_40010;
})();
if(inst_39952__$1){
var statearr_40011_40040 = state_39986__$1;
(statearr_40011_40040[(1)] = (14));

} else {
var statearr_40012_40041 = state_39986__$1;
(statearr_40012_40041[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (9))){
var inst_39974 = (state_39986[(2)]);
var inst_39975 = cljs.core.async.impl.protocols.closed_QMARK_.call(null,out);
var state_39986__$1 = (function (){var statearr_40013 = state_39986;
(statearr_40013[(15)] = inst_39974);

return statearr_40013;
})();
if(cljs.core.truth_(inst_39975)){
var statearr_40014_40042 = state_39986__$1;
(statearr_40014_40042[(1)] = (21));

} else {
var statearr_40015_40043 = state_39986__$1;
(statearr_40015_40043[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (5))){
var inst_39930 = cljs.core.async.close_BANG_.call(null,out);
var state_39986__$1 = state_39986;
var statearr_40016_40044 = state_39986__$1;
(statearr_40016_40044[(2)] = inst_39930);

(statearr_40016_40044[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (14))){
var inst_39952 = (state_39986[(7)]);
var inst_39954 = cljs.core.chunked_seq_QMARK_.call(null,inst_39952);
var state_39986__$1 = state_39986;
if(inst_39954){
var statearr_40017_40045 = state_39986__$1;
(statearr_40017_40045[(1)] = (17));

} else {
var statearr_40018_40046 = state_39986__$1;
(statearr_40018_40046[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (16))){
var inst_39970 = (state_39986[(2)]);
var state_39986__$1 = state_39986;
var statearr_40019_40047 = state_39986__$1;
(statearr_40019_40047[(2)] = inst_39970);

(statearr_40019_40047[(1)] = (12));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_39987 === (10))){
var inst_39941 = (state_39986[(9)]);
var inst_39939 = (state_39986[(11)]);
var inst_39946 = cljs.core._nth.call(null,inst_39939,inst_39941);
var state_39986__$1 = state_39986;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39986__$1,(13),out,inst_39946);
} else {
if((state_val_39987 === (18))){
var inst_39952 = (state_39986[(7)]);
var inst_39961 = cljs.core.first.call(null,inst_39952);
var state_39986__$1 = state_39986;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_39986__$1,(20),out,inst_39961);
} else {
if((state_val_39987 === (8))){
var inst_39941 = (state_39986[(9)]);
var inst_39940 = (state_39986[(12)]);
var inst_39943 = (inst_39941 < inst_39940);
var inst_39944 = inst_39943;
var state_39986__$1 = state_39986;
if(cljs.core.truth_(inst_39944)){
var statearr_40020_40048 = state_39986__$1;
(statearr_40020_40048[(1)] = (10));

} else {
var statearr_40021_40049 = state_39986__$1;
(statearr_40021_40049[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto__))
;
return ((function (switch__38275__auto__,c__38370__auto__){
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__38276__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__38276__auto____0 = (function (){
var statearr_40022 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_40022[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__38276__auto__);

(statearr_40022[(1)] = (1));

return statearr_40022;
});
var cljs$core$async$mapcat_STAR__$_state_machine__38276__auto____1 = (function (state_39986){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_39986);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e40023){if((e40023 instanceof Object)){
var ex__38279__auto__ = e40023;
var statearr_40024_40050 = state_39986;
(statearr_40024_40050[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_39986);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e40023;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__40051 = state_39986;
state_39986 = G__40051;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__38276__auto__ = function(state_39986){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__38276__auto____1.call(this,state_39986);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mapcat_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__38276__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__38276__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto__))
})();
var state__38372__auto__ = (function (){var statearr_40025 = f__38371__auto__.call(null);
(statearr_40025[(6)] = c__38370__auto__);

return statearr_40025;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto__))
);

return c__38370__auto__;
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_LT_ = (function cljs$core$async$mapcat_LT_(var_args){
var G__40053 = arguments.length;
switch (G__40053) {
case 2:
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2 = (function (f,in$){
return cljs.core.async.mapcat_LT_.call(null,f,in$,null);
});

cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3 = (function (f,in$,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
cljs.core.async.mapcat_STAR_.call(null,f,in$,out);

return out;
});

cljs.core.async.mapcat_LT_.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_GT_ = (function cljs$core$async$mapcat_GT_(var_args){
var G__40056 = arguments.length;
switch (G__40056) {
case 2:
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2 = (function (f,out){
return cljs.core.async.mapcat_GT_.call(null,f,out,null);
});

cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3 = (function (f,out,buf_or_n){
var in$ = cljs.core.async.chan.call(null,buf_or_n);
cljs.core.async.mapcat_STAR_.call(null,f,in$,out);

return in$;
});

cljs.core.async.mapcat_GT_.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.unique = (function cljs$core$async$unique(var_args){
var G__40059 = arguments.length;
switch (G__40059) {
case 1:
return cljs.core.async.unique.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.unique.cljs$core$IFn$_invoke$arity$1 = (function (ch){
return cljs.core.async.unique.call(null,ch,null);
});

cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2 = (function (ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__38370__auto___40106 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___40106,out){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___40106,out){
return (function (state_40083){
var state_val_40084 = (state_40083[(1)]);
if((state_val_40084 === (7))){
var inst_40078 = (state_40083[(2)]);
var state_40083__$1 = state_40083;
var statearr_40085_40107 = state_40083__$1;
(statearr_40085_40107[(2)] = inst_40078);

(statearr_40085_40107[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40084 === (1))){
var inst_40060 = null;
var state_40083__$1 = (function (){var statearr_40086 = state_40083;
(statearr_40086[(7)] = inst_40060);

return statearr_40086;
})();
var statearr_40087_40108 = state_40083__$1;
(statearr_40087_40108[(2)] = null);

(statearr_40087_40108[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40084 === (4))){
var inst_40063 = (state_40083[(8)]);
var inst_40063__$1 = (state_40083[(2)]);
var inst_40064 = (inst_40063__$1 == null);
var inst_40065 = cljs.core.not.call(null,inst_40064);
var state_40083__$1 = (function (){var statearr_40088 = state_40083;
(statearr_40088[(8)] = inst_40063__$1);

return statearr_40088;
})();
if(inst_40065){
var statearr_40089_40109 = state_40083__$1;
(statearr_40089_40109[(1)] = (5));

} else {
var statearr_40090_40110 = state_40083__$1;
(statearr_40090_40110[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40084 === (6))){
var state_40083__$1 = state_40083;
var statearr_40091_40111 = state_40083__$1;
(statearr_40091_40111[(2)] = null);

(statearr_40091_40111[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40084 === (3))){
var inst_40080 = (state_40083[(2)]);
var inst_40081 = cljs.core.async.close_BANG_.call(null,out);
var state_40083__$1 = (function (){var statearr_40092 = state_40083;
(statearr_40092[(9)] = inst_40080);

return statearr_40092;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_40083__$1,inst_40081);
} else {
if((state_val_40084 === (2))){
var state_40083__$1 = state_40083;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_40083__$1,(4),ch);
} else {
if((state_val_40084 === (11))){
var inst_40063 = (state_40083[(8)]);
var inst_40072 = (state_40083[(2)]);
var inst_40060 = inst_40063;
var state_40083__$1 = (function (){var statearr_40093 = state_40083;
(statearr_40093[(10)] = inst_40072);

(statearr_40093[(7)] = inst_40060);

return statearr_40093;
})();
var statearr_40094_40112 = state_40083__$1;
(statearr_40094_40112[(2)] = null);

(statearr_40094_40112[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40084 === (9))){
var inst_40063 = (state_40083[(8)]);
var state_40083__$1 = state_40083;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_40083__$1,(11),out,inst_40063);
} else {
if((state_val_40084 === (5))){
var inst_40060 = (state_40083[(7)]);
var inst_40063 = (state_40083[(8)]);
var inst_40067 = cljs.core._EQ_.call(null,inst_40063,inst_40060);
var state_40083__$1 = state_40083;
if(inst_40067){
var statearr_40096_40113 = state_40083__$1;
(statearr_40096_40113[(1)] = (8));

} else {
var statearr_40097_40114 = state_40083__$1;
(statearr_40097_40114[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40084 === (10))){
var inst_40075 = (state_40083[(2)]);
var state_40083__$1 = state_40083;
var statearr_40098_40115 = state_40083__$1;
(statearr_40098_40115[(2)] = inst_40075);

(statearr_40098_40115[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40084 === (8))){
var inst_40060 = (state_40083[(7)]);
var tmp40095 = inst_40060;
var inst_40060__$1 = tmp40095;
var state_40083__$1 = (function (){var statearr_40099 = state_40083;
(statearr_40099[(7)] = inst_40060__$1);

return statearr_40099;
})();
var statearr_40100_40116 = state_40083__$1;
(statearr_40100_40116[(2)] = null);

(statearr_40100_40116[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___40106,out))
;
return ((function (switch__38275__auto__,c__38370__auto___40106,out){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_40101 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_40101[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_40101[(1)] = (1));

return statearr_40101;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_40083){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_40083);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e40102){if((e40102 instanceof Object)){
var ex__38279__auto__ = e40102;
var statearr_40103_40117 = state_40083;
(statearr_40103_40117[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_40083);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e40102;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__40118 = state_40083;
state_40083 = G__40118;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_40083){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_40083);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___40106,out))
})();
var state__38372__auto__ = (function (){var statearr_40104 = f__38371__auto__.call(null);
(statearr_40104[(6)] = c__38370__auto___40106);

return statearr_40104;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___40106,out))
);


return out;
});

cljs.core.async.unique.cljs$lang$maxFixedArity = 2;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition = (function cljs$core$async$partition(var_args){
var G__40120 = arguments.length;
switch (G__40120) {
case 2:
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.partition.call(null,n,ch,null);
});

cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3 = (function (n,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__38370__auto___40186 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___40186,out){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___40186,out){
return (function (state_40158){
var state_val_40159 = (state_40158[(1)]);
if((state_val_40159 === (7))){
var inst_40154 = (state_40158[(2)]);
var state_40158__$1 = state_40158;
var statearr_40160_40187 = state_40158__$1;
(statearr_40160_40187[(2)] = inst_40154);

(statearr_40160_40187[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (1))){
var inst_40121 = (new Array(n));
var inst_40122 = inst_40121;
var inst_40123 = (0);
var state_40158__$1 = (function (){var statearr_40161 = state_40158;
(statearr_40161[(7)] = inst_40122);

(statearr_40161[(8)] = inst_40123);

return statearr_40161;
})();
var statearr_40162_40188 = state_40158__$1;
(statearr_40162_40188[(2)] = null);

(statearr_40162_40188[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (4))){
var inst_40126 = (state_40158[(9)]);
var inst_40126__$1 = (state_40158[(2)]);
var inst_40127 = (inst_40126__$1 == null);
var inst_40128 = cljs.core.not.call(null,inst_40127);
var state_40158__$1 = (function (){var statearr_40163 = state_40158;
(statearr_40163[(9)] = inst_40126__$1);

return statearr_40163;
})();
if(inst_40128){
var statearr_40164_40189 = state_40158__$1;
(statearr_40164_40189[(1)] = (5));

} else {
var statearr_40165_40190 = state_40158__$1;
(statearr_40165_40190[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (15))){
var inst_40148 = (state_40158[(2)]);
var state_40158__$1 = state_40158;
var statearr_40166_40191 = state_40158__$1;
(statearr_40166_40191[(2)] = inst_40148);

(statearr_40166_40191[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (13))){
var state_40158__$1 = state_40158;
var statearr_40167_40192 = state_40158__$1;
(statearr_40167_40192[(2)] = null);

(statearr_40167_40192[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (6))){
var inst_40123 = (state_40158[(8)]);
var inst_40144 = (inst_40123 > (0));
var state_40158__$1 = state_40158;
if(cljs.core.truth_(inst_40144)){
var statearr_40168_40193 = state_40158__$1;
(statearr_40168_40193[(1)] = (12));

} else {
var statearr_40169_40194 = state_40158__$1;
(statearr_40169_40194[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (3))){
var inst_40156 = (state_40158[(2)]);
var state_40158__$1 = state_40158;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_40158__$1,inst_40156);
} else {
if((state_val_40159 === (12))){
var inst_40122 = (state_40158[(7)]);
var inst_40146 = cljs.core.vec.call(null,inst_40122);
var state_40158__$1 = state_40158;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_40158__$1,(15),out,inst_40146);
} else {
if((state_val_40159 === (2))){
var state_40158__$1 = state_40158;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_40158__$1,(4),ch);
} else {
if((state_val_40159 === (11))){
var inst_40138 = (state_40158[(2)]);
var inst_40139 = (new Array(n));
var inst_40122 = inst_40139;
var inst_40123 = (0);
var state_40158__$1 = (function (){var statearr_40170 = state_40158;
(statearr_40170[(7)] = inst_40122);

(statearr_40170[(10)] = inst_40138);

(statearr_40170[(8)] = inst_40123);

return statearr_40170;
})();
var statearr_40171_40195 = state_40158__$1;
(statearr_40171_40195[(2)] = null);

(statearr_40171_40195[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (9))){
var inst_40122 = (state_40158[(7)]);
var inst_40136 = cljs.core.vec.call(null,inst_40122);
var state_40158__$1 = state_40158;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_40158__$1,(11),out,inst_40136);
} else {
if((state_val_40159 === (5))){
var inst_40122 = (state_40158[(7)]);
var inst_40131 = (state_40158[(11)]);
var inst_40123 = (state_40158[(8)]);
var inst_40126 = (state_40158[(9)]);
var inst_40130 = (inst_40122[inst_40123] = inst_40126);
var inst_40131__$1 = (inst_40123 + (1));
var inst_40132 = (inst_40131__$1 < n);
var state_40158__$1 = (function (){var statearr_40172 = state_40158;
(statearr_40172[(11)] = inst_40131__$1);

(statearr_40172[(12)] = inst_40130);

return statearr_40172;
})();
if(cljs.core.truth_(inst_40132)){
var statearr_40173_40196 = state_40158__$1;
(statearr_40173_40196[(1)] = (8));

} else {
var statearr_40174_40197 = state_40158__$1;
(statearr_40174_40197[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (14))){
var inst_40151 = (state_40158[(2)]);
var inst_40152 = cljs.core.async.close_BANG_.call(null,out);
var state_40158__$1 = (function (){var statearr_40176 = state_40158;
(statearr_40176[(13)] = inst_40151);

return statearr_40176;
})();
var statearr_40177_40198 = state_40158__$1;
(statearr_40177_40198[(2)] = inst_40152);

(statearr_40177_40198[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (10))){
var inst_40142 = (state_40158[(2)]);
var state_40158__$1 = state_40158;
var statearr_40178_40199 = state_40158__$1;
(statearr_40178_40199[(2)] = inst_40142);

(statearr_40178_40199[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40159 === (8))){
var inst_40122 = (state_40158[(7)]);
var inst_40131 = (state_40158[(11)]);
var tmp40175 = inst_40122;
var inst_40122__$1 = tmp40175;
var inst_40123 = inst_40131;
var state_40158__$1 = (function (){var statearr_40179 = state_40158;
(statearr_40179[(7)] = inst_40122__$1);

(statearr_40179[(8)] = inst_40123);

return statearr_40179;
})();
var statearr_40180_40200 = state_40158__$1;
(statearr_40180_40200[(2)] = null);

(statearr_40180_40200[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___40186,out))
;
return ((function (switch__38275__auto__,c__38370__auto___40186,out){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_40181 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_40181[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_40181[(1)] = (1));

return statearr_40181;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_40158){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_40158);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e40182){if((e40182 instanceof Object)){
var ex__38279__auto__ = e40182;
var statearr_40183_40201 = state_40158;
(statearr_40183_40201[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_40158);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e40182;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__40202 = state_40158;
state_40158 = G__40202;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_40158){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_40158);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___40186,out))
})();
var state__38372__auto__ = (function (){var statearr_40184 = f__38371__auto__.call(null);
(statearr_40184[(6)] = c__38370__auto___40186);

return statearr_40184;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___40186,out))
);


return out;
});

cljs.core.async.partition.cljs$lang$maxFixedArity = 3;

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition_by = (function cljs$core$async$partition_by(var_args){
var G__40204 = arguments.length;
switch (G__40204) {
case 2:
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2 = (function (f,ch){
return cljs.core.async.partition_by.call(null,f,ch,null);
});

cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3 = (function (f,ch,buf_or_n){
var out = cljs.core.async.chan.call(null,buf_or_n);
var c__38370__auto___40274 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__38370__auto___40274,out){
return (function (){
var f__38371__auto__ = (function (){var switch__38275__auto__ = ((function (c__38370__auto___40274,out){
return (function (state_40246){
var state_val_40247 = (state_40246[(1)]);
if((state_val_40247 === (7))){
var inst_40242 = (state_40246[(2)]);
var state_40246__$1 = state_40246;
var statearr_40248_40275 = state_40246__$1;
(statearr_40248_40275[(2)] = inst_40242);

(statearr_40248_40275[(1)] = (3));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (1))){
var inst_40205 = [];
var inst_40206 = inst_40205;
var inst_40207 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_40246__$1 = (function (){var statearr_40249 = state_40246;
(statearr_40249[(7)] = inst_40207);

(statearr_40249[(8)] = inst_40206);

return statearr_40249;
})();
var statearr_40250_40276 = state_40246__$1;
(statearr_40250_40276[(2)] = null);

(statearr_40250_40276[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (4))){
var inst_40210 = (state_40246[(9)]);
var inst_40210__$1 = (state_40246[(2)]);
var inst_40211 = (inst_40210__$1 == null);
var inst_40212 = cljs.core.not.call(null,inst_40211);
var state_40246__$1 = (function (){var statearr_40251 = state_40246;
(statearr_40251[(9)] = inst_40210__$1);

return statearr_40251;
})();
if(inst_40212){
var statearr_40252_40277 = state_40246__$1;
(statearr_40252_40277[(1)] = (5));

} else {
var statearr_40253_40278 = state_40246__$1;
(statearr_40253_40278[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (15))){
var inst_40236 = (state_40246[(2)]);
var state_40246__$1 = state_40246;
var statearr_40254_40279 = state_40246__$1;
(statearr_40254_40279[(2)] = inst_40236);

(statearr_40254_40279[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (13))){
var state_40246__$1 = state_40246;
var statearr_40255_40280 = state_40246__$1;
(statearr_40255_40280[(2)] = null);

(statearr_40255_40280[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (6))){
var inst_40206 = (state_40246[(8)]);
var inst_40231 = inst_40206.length;
var inst_40232 = (inst_40231 > (0));
var state_40246__$1 = state_40246;
if(cljs.core.truth_(inst_40232)){
var statearr_40256_40281 = state_40246__$1;
(statearr_40256_40281[(1)] = (12));

} else {
var statearr_40257_40282 = state_40246__$1;
(statearr_40257_40282[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (3))){
var inst_40244 = (state_40246[(2)]);
var state_40246__$1 = state_40246;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_40246__$1,inst_40244);
} else {
if((state_val_40247 === (12))){
var inst_40206 = (state_40246[(8)]);
var inst_40234 = cljs.core.vec.call(null,inst_40206);
var state_40246__$1 = state_40246;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_40246__$1,(15),out,inst_40234);
} else {
if((state_val_40247 === (2))){
var state_40246__$1 = state_40246;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_40246__$1,(4),ch);
} else {
if((state_val_40247 === (11))){
var inst_40214 = (state_40246[(10)]);
var inst_40210 = (state_40246[(9)]);
var inst_40224 = (state_40246[(2)]);
var inst_40225 = [];
var inst_40226 = inst_40225.push(inst_40210);
var inst_40206 = inst_40225;
var inst_40207 = inst_40214;
var state_40246__$1 = (function (){var statearr_40258 = state_40246;
(statearr_40258[(7)] = inst_40207);

(statearr_40258[(8)] = inst_40206);

(statearr_40258[(11)] = inst_40224);

(statearr_40258[(12)] = inst_40226);

return statearr_40258;
})();
var statearr_40259_40283 = state_40246__$1;
(statearr_40259_40283[(2)] = null);

(statearr_40259_40283[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (9))){
var inst_40206 = (state_40246[(8)]);
var inst_40222 = cljs.core.vec.call(null,inst_40206);
var state_40246__$1 = state_40246;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_40246__$1,(11),out,inst_40222);
} else {
if((state_val_40247 === (5))){
var inst_40207 = (state_40246[(7)]);
var inst_40214 = (state_40246[(10)]);
var inst_40210 = (state_40246[(9)]);
var inst_40214__$1 = f.call(null,inst_40210);
var inst_40215 = cljs.core._EQ_.call(null,inst_40214__$1,inst_40207);
var inst_40216 = cljs.core.keyword_identical_QMARK_.call(null,inst_40207,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var inst_40217 = ((inst_40215) || (inst_40216));
var state_40246__$1 = (function (){var statearr_40260 = state_40246;
(statearr_40260[(10)] = inst_40214__$1);

return statearr_40260;
})();
if(cljs.core.truth_(inst_40217)){
var statearr_40261_40284 = state_40246__$1;
(statearr_40261_40284[(1)] = (8));

} else {
var statearr_40262_40285 = state_40246__$1;
(statearr_40262_40285[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (14))){
var inst_40239 = (state_40246[(2)]);
var inst_40240 = cljs.core.async.close_BANG_.call(null,out);
var state_40246__$1 = (function (){var statearr_40264 = state_40246;
(statearr_40264[(13)] = inst_40239);

return statearr_40264;
})();
var statearr_40265_40286 = state_40246__$1;
(statearr_40265_40286[(2)] = inst_40240);

(statearr_40265_40286[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (10))){
var inst_40229 = (state_40246[(2)]);
var state_40246__$1 = state_40246;
var statearr_40266_40287 = state_40246__$1;
(statearr_40266_40287[(2)] = inst_40229);

(statearr_40266_40287[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_40247 === (8))){
var inst_40206 = (state_40246[(8)]);
var inst_40214 = (state_40246[(10)]);
var inst_40210 = (state_40246[(9)]);
var inst_40219 = inst_40206.push(inst_40210);
var tmp40263 = inst_40206;
var inst_40206__$1 = tmp40263;
var inst_40207 = inst_40214;
var state_40246__$1 = (function (){var statearr_40267 = state_40246;
(statearr_40267[(14)] = inst_40219);

(statearr_40267[(7)] = inst_40207);

(statearr_40267[(8)] = inst_40206__$1);

return statearr_40267;
})();
var statearr_40268_40288 = state_40246__$1;
(statearr_40268_40288[(2)] = null);

(statearr_40268_40288[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__38370__auto___40274,out))
;
return ((function (switch__38275__auto__,c__38370__auto___40274,out){
return (function() {
var cljs$core$async$state_machine__38276__auto__ = null;
var cljs$core$async$state_machine__38276__auto____0 = (function (){
var statearr_40269 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_40269[(0)] = cljs$core$async$state_machine__38276__auto__);

(statearr_40269[(1)] = (1));

return statearr_40269;
});
var cljs$core$async$state_machine__38276__auto____1 = (function (state_40246){
while(true){
var ret_value__38277__auto__ = (function (){try{while(true){
var result__38278__auto__ = switch__38275__auto__.call(null,state_40246);
if(cljs.core.keyword_identical_QMARK_.call(null,result__38278__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__38278__auto__;
}
break;
}
}catch (e40270){if((e40270 instanceof Object)){
var ex__38279__auto__ = e40270;
var statearr_40271_40289 = state_40246;
(statearr_40271_40289[(5)] = ex__38279__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_40246);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e40270;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__38277__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__40290 = state_40246;
state_40246 = G__40290;
continue;
} else {
return ret_value__38277__auto__;
}
break;
}
});
cljs$core$async$state_machine__38276__auto__ = function(state_40246){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__38276__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__38276__auto____1.call(this,state_40246);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__38276__auto____0;
cljs$core$async$state_machine__38276__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__38276__auto____1;
return cljs$core$async$state_machine__38276__auto__;
})()
;})(switch__38275__auto__,c__38370__auto___40274,out))
})();
var state__38372__auto__ = (function (){var statearr_40272 = f__38371__auto__.call(null);
(statearr_40272[(6)] = c__38370__auto___40274);

return statearr_40272;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__38372__auto__);
});})(c__38370__auto___40274,out))
);


return out;
});

cljs.core.async.partition_by.cljs$lang$maxFixedArity = 3;

