// Compiled by ClojureScript 1.9.562 {}
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 args40933 = [];
var len__24559__auto___40939 = arguments.length;
var i__24560__auto___40940 = (0);
while(true){
if((i__24560__auto___40940 < len__24559__auto___40939)){
args40933.push((arguments[i__24560__auto___40940]));

var G__40941 = (i__24560__auto___40940 + (1));
i__24560__auto___40940 = G__40941;
continue;
} else {
}
break;
}

var G__40935 = args40933.length;
switch (G__40935) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40933.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.core.async.t_cljs$core$async40936 !== 'undefined'){
} else {

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

cljs.core.async.t_cljs$core$async40936.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_40938){
var self__ = this;
var _40938__$1 = this;
return self__.meta40937;
});

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

cljs.core.async.t_cljs$core$async40936.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$async40936.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$async40936.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$async40936.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,"meta40937","meta40937",2125628688,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async40936.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async40936");
});

cljs.core.async.__GT_t_cljs$core$async40936 = (function cljs$core$async$__GT_t_cljs$core$async40936(f__$1,blockable__$1,meta40937){
return (new cljs.core.async.t_cljs$core$async40936(f__$1,blockable__$1,meta40937));
});

}

return (new cljs.core.async.t_cljs$core$async40936(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 args40945 = [];
var len__24559__auto___40948 = arguments.length;
var i__24560__auto___40949 = (0);
while(true){
if((i__24560__auto___40949 < len__24559__auto___40948)){
args40945.push((arguments[i__24560__auto___40949]));

var G__40950 = (i__24560__auto___40949 + (1));
i__24560__auto___40949 = G__40950;
continue;
} else {
}
break;
}

var G__40947 = args40945.length;
switch (G__40947) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40945.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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Assert failed: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1("buffer must be supplied when transducer is"),cljs.core.str.cljs$core$IFn$_invoke$arity$1("\n"),cljs.core.str.cljs$core$IFn$_invoke$arity$1("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 args40952 = [];
var len__24559__auto___40955 = arguments.length;
var i__24560__auto___40956 = (0);
while(true){
if((i__24560__auto___40956 < len__24559__auto___40955)){
args40952.push((arguments[i__24560__auto___40956]));

var G__40957 = (i__24560__auto___40956 + (1));
i__24560__auto___40956 = G__40957;
continue;
} else {
}
break;
}

var G__40954 = args40952.length;
switch (G__40954) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40952.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 args40959 = [];
var len__24559__auto___40962 = arguments.length;
var i__24560__auto___40963 = (0);
while(true){
if((i__24560__auto___40963 < len__24559__auto___40962)){
args40959.push((arguments[i__24560__auto___40963]));

var G__40964 = (i__24560__auto___40963 + (1));
i__24560__auto___40963 = G__40964;
continue;
} else {
}
break;
}

var G__40961 = args40959.length;
switch (G__40961) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40959.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_40966 = cljs.core.deref.call(null,ret);
if(cljs.core.truth_(on_caller_QMARK_)){
fn1.call(null,val_40966);
} else {
cljs.core.async.impl.dispatch.run.call(null,((function (val_40966,ret){
return (function (){
return fn1.call(null,val_40966);
});})(val_40966,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 fn0 (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 fn0 on calling thread.  Returns nil.
 */
cljs.core.async.put_BANG_ = (function cljs$core$async$put_BANG_(var_args){
var args40967 = [];
var len__24559__auto___40970 = arguments.length;
var i__24560__auto___40971 = (0);
while(true){
if((i__24560__auto___40971 < len__24559__auto___40970)){
args40967.push((arguments[i__24560__auto___40971]));

var G__40972 = (i__24560__auto___40971 + (1));
i__24560__auto___40971 = G__40972;
continue;
} else {
}
break;
}

var G__40969 = args40967.length;
switch (G__40969) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args40967.length)].join('')));

}
});

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,val){
var temp__5276__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fhnop);
if(cljs.core.truth_(temp__5276__auto__)){
var ret = temp__5276__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__5276__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__5276__auto__)){
var retb = temp__5276__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__5276__auto__){
return (function (){
return fn1.call(null,ret);
});})(ret,retb,temp__5276__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__24359__auto___40974 = n;
var x_40975 = (0);
while(true){
if((x_40975 < n__24359__auto___40974)){
(a[x_40975] = (0));

var G__40976 = (x_40975 + (1));
x_40975 = G__40976;
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__40977 = (i + (1));
i = G__40977;
continue;
}
break;
}
});
cljs.core.async.alt_flag = (function cljs$core$async$alt_flag(){
var flag = cljs.core.atom.call(null,true);
if(typeof cljs.core.async.t_cljs$core$async40981 !== 'undefined'){
} else {

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

cljs.core.async.t_cljs$core$async40981.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (flag){
return (function (_40983){
var self__ = this;
var _40983__$1 = this;
return self__.meta40982;
});})(flag))
;

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

cljs.core.async.t_cljs$core$async40981.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$async40981.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$async40981.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$async40981.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,"meta40982","meta40982",-1467078455,null)], null);
});})(flag))
;

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

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

cljs.core.async.t_cljs$core$async40981.cljs$lang$ctorPrWriter = ((function (flag){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async40981");
});})(flag))
;

cljs.core.async.__GT_t_cljs$core$async40981 = ((function (flag){
return (function cljs$core$async$alt_flag_$___GT_t_cljs$core$async40981(flag__$1,meta40982){
return (new cljs.core.async.t_cljs$core$async40981(flag__$1,meta40982));
});})(flag))
;

}

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

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

cljs.core.async.t_cljs$core$async40987.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_40989){
var self__ = this;
var _40989__$1 = this;
return self__.meta40988;
});

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

cljs.core.async.t_cljs$core$async40987.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$async40987.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$async40987.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$async40987.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,"meta40988","meta40988",-1383145682,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async40987.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async40987");
});

cljs.core.async.__GT_t_cljs$core$async40987 = (function cljs$core$async$alt_handler_$___GT_t_cljs$core$async40987(flag__$1,cb__$1,meta40988){
return (new cljs.core.async.t_cljs$core$async40987(flag__$1,cb__$1,meta40988));
});

}

return (new cljs.core.async.t_cljs$core$async40987(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__40990_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__40990_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__40991_SHARP_){
return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__40991_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__23338__auto__ = wport;
if(cljs.core.truth_(or__23338__auto__)){
return or__23338__auto__;
} else {
return port;
}
})()], null));
} else {
var G__40992 = (i + (1));
i = G__40992;
continue;
}
} else {
return null;
}
break;
}
})();
var or__23338__auto__ = ret;
if(cljs.core.truth_(or__23338__auto__)){
return or__23338__auto__;
} else {
if(cljs.core.contains_QMARK_.call(null,opts,new cljs.core.Keyword(null,"default","default",-1987822328))){
var temp__5278__auto__ = (function (){var and__23326__auto__ = cljs.core.async.impl.protocols.active_QMARK_.call(null,flag);
if(cljs.core.truth_(and__23326__auto__)){
return cljs.core.async.impl.protocols.commit.call(null,flag);
} else {
return and__23326__auto__;
}
})();
if(cljs.core.truth_(temp__5278__auto__)){
var got = temp__5278__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__24566__auto__ = [];
var len__24559__auto___40998 = arguments.length;
var i__24560__auto___40999 = (0);
while(true){
if((i__24560__auto___40999 < len__24559__auto___40998)){
args__24566__auto__.push((arguments[i__24560__auto___40999]));

var G__41000 = (i__24560__auto___40999 + (1));
i__24560__auto___40999 = G__41000;
continue;
} else {
}
break;
}

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

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

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

cljs.core.async.alts_BANG_.cljs$lang$applyTo = (function (seq40993){
var G__40994 = cljs.core.first.call(null,seq40993);
var seq40993__$1 = cljs.core.next.call(null,seq40993);
return cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__40994,seq40993__$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 args41001 = [];
var len__24559__auto___41051 = arguments.length;
var i__24560__auto___41052 = (0);
while(true){
if((i__24560__auto___41052 < len__24559__auto___41051)){
args41001.push((arguments[i__24560__auto___41052]));

var G__41053 = (i__24560__auto___41052 + (1));
i__24560__auto___41052 = G__41053;
continue;
} else {
}
break;
}

var G__41003 = args41001.length;
switch (G__41003) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41001.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__40874__auto___41055 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___41055){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___41055){
return (function (state_41027){
var state_val_41028 = (state_41027[(1)]);
if((state_val_41028 === (7))){
var inst_41023 = (state_41027[(2)]);
var state_41027__$1 = state_41027;
var statearr_41029_41056 = state_41027__$1;
(statearr_41029_41056[(2)] = inst_41023);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (1))){
var state_41027__$1 = state_41027;
var statearr_41030_41057 = state_41027__$1;
(statearr_41030_41057[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (4))){
var inst_41006 = (state_41027[(7)]);
var inst_41006__$1 = (state_41027[(2)]);
var inst_41007 = (inst_41006__$1 == null);
var state_41027__$1 = (function (){var statearr_41031 = state_41027;
(statearr_41031[(7)] = inst_41006__$1);

return statearr_41031;
})();
if(cljs.core.truth_(inst_41007)){
var statearr_41032_41058 = state_41027__$1;
(statearr_41032_41058[(1)] = (5));

} else {
var statearr_41033_41059 = state_41027__$1;
(statearr_41033_41059[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (13))){
var state_41027__$1 = state_41027;
var statearr_41034_41060 = state_41027__$1;
(statearr_41034_41060[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (6))){
var inst_41006 = (state_41027[(7)]);
var state_41027__$1 = state_41027;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41027__$1,(11),to,inst_41006);
} else {
if((state_val_41028 === (3))){
var inst_41025 = (state_41027[(2)]);
var state_41027__$1 = state_41027;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41027__$1,inst_41025);
} else {
if((state_val_41028 === (12))){
var state_41027__$1 = state_41027;
var statearr_41035_41061 = state_41027__$1;
(statearr_41035_41061[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (2))){
var state_41027__$1 = state_41027;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41027__$1,(4),from);
} else {
if((state_val_41028 === (11))){
var inst_41016 = (state_41027[(2)]);
var state_41027__$1 = state_41027;
if(cljs.core.truth_(inst_41016)){
var statearr_41036_41062 = state_41027__$1;
(statearr_41036_41062[(1)] = (12));

} else {
var statearr_41037_41063 = state_41027__$1;
(statearr_41037_41063[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (9))){
var state_41027__$1 = state_41027;
var statearr_41038_41064 = state_41027__$1;
(statearr_41038_41064[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (5))){
var state_41027__$1 = state_41027;
if(cljs.core.truth_(close_QMARK_)){
var statearr_41039_41065 = state_41027__$1;
(statearr_41039_41065[(1)] = (8));

} else {
var statearr_41040_41066 = state_41027__$1;
(statearr_41040_41066[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (14))){
var inst_41021 = (state_41027[(2)]);
var state_41027__$1 = state_41027;
var statearr_41041_41067 = state_41027__$1;
(statearr_41041_41067[(2)] = inst_41021);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (10))){
var inst_41013 = (state_41027[(2)]);
var state_41027__$1 = state_41027;
var statearr_41042_41068 = state_41027__$1;
(statearr_41042_41068[(2)] = inst_41013);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41028 === (8))){
var inst_41010 = cljs.core.async.close_BANG_.call(null,to);
var state_41027__$1 = state_41027;
var statearr_41043_41069 = state_41027__$1;
(statearr_41043_41069[(2)] = inst_41010);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___41055))
;
return ((function (switch__40760__auto__,c__40874__auto___41055){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_41047 = [null,null,null,null,null,null,null,null];
(statearr_41047[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_41047[(1)] = (1));

return statearr_41047;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_41027){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41027);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41048){if((e41048 instanceof Object)){
var ex__40764__auto__ = e41048;
var statearr_41049_41070 = state_41027;
(statearr_41049_41070[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41071 = state_41027;
state_41027 = G__41071;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_41027){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_41027);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___41055))
})();
var state__40876__auto__ = (function (){var statearr_41050 = f__40875__auto__.call(null);
(statearr_41050[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___41055);

return statearr_41050;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___41055))
);


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__41259){
var vec__41260 = p__41259;
var v = cljs.core.nth.call(null,vec__41260,(0),null);
var p = cljs.core.nth.call(null,vec__41260,(1),null);
var job = vec__41260;
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__40874__auto___41446 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___41446,res,vec__41260,v,p,job,jobs,results){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___41446,res,vec__41260,v,p,job,jobs,results){
return (function (state_41267){
var state_val_41268 = (state_41267[(1)]);
if((state_val_41268 === (1))){
var state_41267__$1 = state_41267;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41267__$1,(2),res,v);
} else {
if((state_val_41268 === (2))){
var inst_41264 = (state_41267[(2)]);
var inst_41265 = cljs.core.async.close_BANG_.call(null,res);
var state_41267__$1 = (function (){var statearr_41269 = state_41267;
(statearr_41269[(7)] = inst_41264);

return statearr_41269;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41267__$1,inst_41265);
} else {
return null;
}
}
});})(c__40874__auto___41446,res,vec__41260,v,p,job,jobs,results))
;
return ((function (switch__40760__auto__,c__40874__auto___41446,res,vec__41260,v,p,job,jobs,results){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0 = (function (){
var statearr_41273 = [null,null,null,null,null,null,null,null];
(statearr_41273[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__);

(statearr_41273[(1)] = (1));

return statearr_41273;
});
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1 = (function (state_41267){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41267);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41274){if((e41274 instanceof Object)){
var ex__40764__auto__ = e41274;
var statearr_41275_41447 = state_41267;
(statearr_41275_41447[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41448 = state_41267;
state_41267 = G__41448;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = function(state_41267){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1.call(this,state_41267);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___41446,res,vec__41260,v,p,job,jobs,results))
})();
var state__40876__auto__ = (function (){var statearr_41276 = f__40875__auto__.call(null);
(statearr_41276[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___41446);

return statearr_41276;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___41446,res,vec__41260,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__41277){
var vec__41278 = p__41277;
var v = cljs.core.nth.call(null,vec__41278,(0),null);
var p = cljs.core.nth.call(null,vec__41278,(1),null);
var job = vec__41278;
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__24359__auto___41449 = n;
var __41450 = (0);
while(true){
if((__41450 < n__24359__auto___41449)){
var G__41281_41451 = type;
var G__41281_41452__$1 = (((G__41281_41451 instanceof cljs.core.Keyword))?G__41281_41451.fqn:null);
switch (G__41281_41452__$1) {
case "compute":
var c__40874__auto___41454 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__41450,c__40874__auto___41454,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (__41450,c__40874__auto___41454,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async){
return (function (state_41294){
var state_val_41295 = (state_41294[(1)]);
if((state_val_41295 === (1))){
var state_41294__$1 = state_41294;
var statearr_41296_41455 = state_41294__$1;
(statearr_41296_41455[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41295 === (2))){
var state_41294__$1 = state_41294;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41294__$1,(4),jobs);
} else {
if((state_val_41295 === (3))){
var inst_41292 = (state_41294[(2)]);
var state_41294__$1 = state_41294;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41294__$1,inst_41292);
} else {
if((state_val_41295 === (4))){
var inst_41284 = (state_41294[(2)]);
var inst_41285 = process.call(null,inst_41284);
var state_41294__$1 = state_41294;
if(cljs.core.truth_(inst_41285)){
var statearr_41297_41456 = state_41294__$1;
(statearr_41297_41456[(1)] = (5));

} else {
var statearr_41298_41457 = state_41294__$1;
(statearr_41298_41457[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41295 === (5))){
var state_41294__$1 = state_41294;
var statearr_41299_41458 = state_41294__$1;
(statearr_41299_41458[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41295 === (6))){
var state_41294__$1 = state_41294;
var statearr_41300_41459 = state_41294__$1;
(statearr_41300_41459[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41295 === (7))){
var inst_41290 = (state_41294[(2)]);
var state_41294__$1 = state_41294;
var statearr_41301_41460 = state_41294__$1;
(statearr_41301_41460[(2)] = inst_41290);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__41450,c__40874__auto___41454,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async))
;
return ((function (__41450,switch__40760__auto__,c__40874__auto___41454,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0 = (function (){
var statearr_41305 = [null,null,null,null,null,null,null];
(statearr_41305[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__);

(statearr_41305[(1)] = (1));

return statearr_41305;
});
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1 = (function (state_41294){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41294);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41306){if((e41306 instanceof Object)){
var ex__40764__auto__ = e41306;
var statearr_41307_41461 = state_41294;
(statearr_41307_41461[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41462 = state_41294;
state_41294 = G__41462;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = function(state_41294){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1.call(this,state_41294);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__;
})()
;})(__41450,switch__40760__auto__,c__40874__auto___41454,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async))
})();
var state__40876__auto__ = (function (){var statearr_41308 = f__40875__auto__.call(null);
(statearr_41308[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___41454);

return statearr_41308;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(__41450,c__40874__auto___41454,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async))
);


break;
case "async":
var c__40874__auto___41463 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (__41450,c__40874__auto___41463,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (__41450,c__40874__auto___41463,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async){
return (function (state_41321){
var state_val_41322 = (state_41321[(1)]);
if((state_val_41322 === (1))){
var state_41321__$1 = state_41321;
var statearr_41323_41464 = state_41321__$1;
(statearr_41323_41464[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41322 === (2))){
var state_41321__$1 = state_41321;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41321__$1,(4),jobs);
} else {
if((state_val_41322 === (3))){
var inst_41319 = (state_41321[(2)]);
var state_41321__$1 = state_41321;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41321__$1,inst_41319);
} else {
if((state_val_41322 === (4))){
var inst_41311 = (state_41321[(2)]);
var inst_41312 = async.call(null,inst_41311);
var state_41321__$1 = state_41321;
if(cljs.core.truth_(inst_41312)){
var statearr_41324_41465 = state_41321__$1;
(statearr_41324_41465[(1)] = (5));

} else {
var statearr_41325_41466 = state_41321__$1;
(statearr_41325_41466[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41322 === (5))){
var state_41321__$1 = state_41321;
var statearr_41326_41467 = state_41321__$1;
(statearr_41326_41467[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41322 === (6))){
var state_41321__$1 = state_41321;
var statearr_41327_41468 = state_41321__$1;
(statearr_41327_41468[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41322 === (7))){
var inst_41317 = (state_41321[(2)]);
var state_41321__$1 = state_41321;
var statearr_41328_41469 = state_41321__$1;
(statearr_41328_41469[(2)] = inst_41317);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__41450,c__40874__auto___41463,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async))
;
return ((function (__41450,switch__40760__auto__,c__40874__auto___41463,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0 = (function (){
var statearr_41332 = [null,null,null,null,null,null,null];
(statearr_41332[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__);

(statearr_41332[(1)] = (1));

return statearr_41332;
});
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1 = (function (state_41321){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41321);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41333){if((e41333 instanceof Object)){
var ex__40764__auto__ = e41333;
var statearr_41334_41470 = state_41321;
(statearr_41334_41470[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41471 = state_41321;
state_41321 = G__41471;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = function(state_41321){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1.call(this,state_41321);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__;
})()
;})(__41450,switch__40760__auto__,c__40874__auto___41463,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async))
})();
var state__40876__auto__ = (function (){var statearr_41335 = f__40875__auto__.call(null);
(statearr_41335[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___41463);

return statearr_41335;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(__41450,c__40874__auto___41463,G__41281_41451,G__41281_41452__$1,n__24359__auto___41449,jobs,results,process,async))
);


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

}

var G__41472 = (__41450 + (1));
__41450 = G__41472;
continue;
} else {
}
break;
}

var c__40874__auto___41473 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___41473,jobs,results,process,async){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___41473,jobs,results,process,async){
return (function (state_41357){
var state_val_41358 = (state_41357[(1)]);
if((state_val_41358 === (1))){
var state_41357__$1 = state_41357;
var statearr_41359_41474 = state_41357__$1;
(statearr_41359_41474[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41358 === (2))){
var state_41357__$1 = state_41357;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41357__$1,(4),from);
} else {
if((state_val_41358 === (3))){
var inst_41355 = (state_41357[(2)]);
var state_41357__$1 = state_41357;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41357__$1,inst_41355);
} else {
if((state_val_41358 === (4))){
var inst_41338 = (state_41357[(7)]);
var inst_41338__$1 = (state_41357[(2)]);
var inst_41339 = (inst_41338__$1 == null);
var state_41357__$1 = (function (){var statearr_41360 = state_41357;
(statearr_41360[(7)] = inst_41338__$1);

return statearr_41360;
})();
if(cljs.core.truth_(inst_41339)){
var statearr_41361_41475 = state_41357__$1;
(statearr_41361_41475[(1)] = (5));

} else {
var statearr_41362_41476 = state_41357__$1;
(statearr_41362_41476[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41358 === (5))){
var inst_41341 = cljs.core.async.close_BANG_.call(null,jobs);
var state_41357__$1 = state_41357;
var statearr_41363_41477 = state_41357__$1;
(statearr_41363_41477[(2)] = inst_41341);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41358 === (6))){
var inst_41338 = (state_41357[(7)]);
var inst_41343 = (state_41357[(8)]);
var inst_41343__$1 = cljs.core.async.chan.call(null,(1));
var inst_41344 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_41345 = [inst_41338,inst_41343__$1];
var inst_41346 = (new cljs.core.PersistentVector(null,2,(5),inst_41344,inst_41345,null));
var state_41357__$1 = (function (){var statearr_41364 = state_41357;
(statearr_41364[(8)] = inst_41343__$1);

return statearr_41364;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41357__$1,(8),jobs,inst_41346);
} else {
if((state_val_41358 === (7))){
var inst_41353 = (state_41357[(2)]);
var state_41357__$1 = state_41357;
var statearr_41365_41478 = state_41357__$1;
(statearr_41365_41478[(2)] = inst_41353);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41358 === (8))){
var inst_41343 = (state_41357[(8)]);
var inst_41348 = (state_41357[(2)]);
var state_41357__$1 = (function (){var statearr_41366 = state_41357;
(statearr_41366[(9)] = inst_41348);

return statearr_41366;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41357__$1,(9),results,inst_41343);
} else {
if((state_val_41358 === (9))){
var inst_41350 = (state_41357[(2)]);
var state_41357__$1 = (function (){var statearr_41367 = state_41357;
(statearr_41367[(10)] = inst_41350);

return statearr_41367;
})();
var statearr_41368_41479 = state_41357__$1;
(statearr_41368_41479[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___41473,jobs,results,process,async))
;
return ((function (switch__40760__auto__,c__40874__auto___41473,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0 = (function (){
var statearr_41372 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_41372[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__);

(statearr_41372[(1)] = (1));

return statearr_41372;
});
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1 = (function (state_41357){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41357);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41373){if((e41373 instanceof Object)){
var ex__40764__auto__ = e41373;
var statearr_41374_41480 = state_41357;
(statearr_41374_41480[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41481 = state_41357;
state_41357 = G__41481;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = function(state_41357){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1.call(this,state_41357);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___41473,jobs,results,process,async))
})();
var state__40876__auto__ = (function (){var statearr_41375 = f__40875__auto__.call(null);
(statearr_41375[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___41473);

return statearr_41375;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___41473,jobs,results,process,async))
);


var c__40874__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto__,jobs,results,process,async){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto__,jobs,results,process,async){
return (function (state_41413){
var state_val_41414 = (state_41413[(1)]);
if((state_val_41414 === (7))){
var inst_41409 = (state_41413[(2)]);
var state_41413__$1 = state_41413;
var statearr_41415_41482 = state_41413__$1;
(statearr_41415_41482[(2)] = inst_41409);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (20))){
var state_41413__$1 = state_41413;
var statearr_41416_41483 = state_41413__$1;
(statearr_41416_41483[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (1))){
var state_41413__$1 = state_41413;
var statearr_41417_41484 = state_41413__$1;
(statearr_41417_41484[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (4))){
var inst_41378 = (state_41413[(7)]);
var inst_41378__$1 = (state_41413[(2)]);
var inst_41379 = (inst_41378__$1 == null);
var state_41413__$1 = (function (){var statearr_41418 = state_41413;
(statearr_41418[(7)] = inst_41378__$1);

return statearr_41418;
})();
if(cljs.core.truth_(inst_41379)){
var statearr_41419_41485 = state_41413__$1;
(statearr_41419_41485[(1)] = (5));

} else {
var statearr_41420_41486 = state_41413__$1;
(statearr_41420_41486[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (15))){
var inst_41391 = (state_41413[(8)]);
var state_41413__$1 = state_41413;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41413__$1,(18),to,inst_41391);
} else {
if((state_val_41414 === (21))){
var inst_41404 = (state_41413[(2)]);
var state_41413__$1 = state_41413;
var statearr_41421_41487 = state_41413__$1;
(statearr_41421_41487[(2)] = inst_41404);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (13))){
var inst_41406 = (state_41413[(2)]);
var state_41413__$1 = (function (){var statearr_41422 = state_41413;
(statearr_41422[(9)] = inst_41406);

return statearr_41422;
})();
var statearr_41423_41488 = state_41413__$1;
(statearr_41423_41488[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (6))){
var inst_41378 = (state_41413[(7)]);
var state_41413__$1 = state_41413;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41413__$1,(11),inst_41378);
} else {
if((state_val_41414 === (17))){
var inst_41399 = (state_41413[(2)]);
var state_41413__$1 = state_41413;
if(cljs.core.truth_(inst_41399)){
var statearr_41424_41489 = state_41413__$1;
(statearr_41424_41489[(1)] = (19));

} else {
var statearr_41425_41490 = state_41413__$1;
(statearr_41425_41490[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (3))){
var inst_41411 = (state_41413[(2)]);
var state_41413__$1 = state_41413;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41413__$1,inst_41411);
} else {
if((state_val_41414 === (12))){
var inst_41388 = (state_41413[(10)]);
var state_41413__$1 = state_41413;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41413__$1,(14),inst_41388);
} else {
if((state_val_41414 === (2))){
var state_41413__$1 = state_41413;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41413__$1,(4),results);
} else {
if((state_val_41414 === (19))){
var state_41413__$1 = state_41413;
var statearr_41426_41491 = state_41413__$1;
(statearr_41426_41491[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (11))){
var inst_41388 = (state_41413[(2)]);
var state_41413__$1 = (function (){var statearr_41427 = state_41413;
(statearr_41427[(10)] = inst_41388);

return statearr_41427;
})();
var statearr_41428_41492 = state_41413__$1;
(statearr_41428_41492[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (9))){
var state_41413__$1 = state_41413;
var statearr_41429_41493 = state_41413__$1;
(statearr_41429_41493[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (5))){
var state_41413__$1 = state_41413;
if(cljs.core.truth_(close_QMARK_)){
var statearr_41430_41494 = state_41413__$1;
(statearr_41430_41494[(1)] = (8));

} else {
var statearr_41431_41495 = state_41413__$1;
(statearr_41431_41495[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (14))){
var inst_41393 = (state_41413[(11)]);
var inst_41391 = (state_41413[(8)]);
var inst_41391__$1 = (state_41413[(2)]);
var inst_41392 = (inst_41391__$1 == null);
var inst_41393__$1 = cljs.core.not.call(null,inst_41392);
var state_41413__$1 = (function (){var statearr_41432 = state_41413;
(statearr_41432[(11)] = inst_41393__$1);

(statearr_41432[(8)] = inst_41391__$1);

return statearr_41432;
})();
if(inst_41393__$1){
var statearr_41433_41496 = state_41413__$1;
(statearr_41433_41496[(1)] = (15));

} else {
var statearr_41434_41497 = state_41413__$1;
(statearr_41434_41497[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (16))){
var inst_41393 = (state_41413[(11)]);
var state_41413__$1 = state_41413;
var statearr_41435_41498 = state_41413__$1;
(statearr_41435_41498[(2)] = inst_41393);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (10))){
var inst_41385 = (state_41413[(2)]);
var state_41413__$1 = state_41413;
var statearr_41436_41499 = state_41413__$1;
(statearr_41436_41499[(2)] = inst_41385);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (18))){
var inst_41396 = (state_41413[(2)]);
var state_41413__$1 = state_41413;
var statearr_41437_41500 = state_41413__$1;
(statearr_41437_41500[(2)] = inst_41396);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41414 === (8))){
var inst_41382 = cljs.core.async.close_BANG_.call(null,to);
var state_41413__$1 = state_41413;
var statearr_41438_41501 = state_41413__$1;
(statearr_41438_41501[(2)] = inst_41382);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto__,jobs,results,process,async))
;
return ((function (switch__40760__auto__,c__40874__auto__,jobs,results,process,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0 = (function (){
var statearr_41442 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_41442[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__);

(statearr_41442[(1)] = (1));

return statearr_41442;
});
var cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1 = (function (state_41413){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41413);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41443){if((e41443 instanceof Object)){
var ex__40764__auto__ = e41443;
var statearr_41444_41502 = state_41413;
(statearr_41444_41502[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41503 = state_41413;
state_41413 = G__41503;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__ = function(state_41413){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1.call(this,state_41413);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__40761__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto__,jobs,results,process,async))
})();
var state__40876__auto__ = (function (){var statearr_41445 = f__40875__auto__.call(null);
(statearr_41445[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto__);

return statearr_41445;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto__,jobs,results,process,async))
);

return c__40874__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 args41504 = [];
var len__24559__auto___41507 = arguments.length;
var i__24560__auto___41508 = (0);
while(true){
if((i__24560__auto___41508 < len__24559__auto___41507)){
args41504.push((arguments[i__24560__auto___41508]));

var G__41509 = (i__24560__auto___41508 + (1));
i__24560__auto___41508 = G__41509;
continue;
} else {
}
break;
}

var G__41506 = args41504.length;
switch (G__41506) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41504.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 args41511 = [];
var len__24559__auto___41514 = arguments.length;
var i__24560__auto___41515 = (0);
while(true){
if((i__24560__auto___41515 < len__24559__auto___41514)){
args41511.push((arguments[i__24560__auto___41515]));

var G__41516 = (i__24560__auto___41515 + (1));
i__24560__auto___41515 = G__41516;
continue;
} else {
}
break;
}

var G__41513 = args41511.length;
switch (G__41513) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41511.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 args41518 = [];
var len__24559__auto___41571 = arguments.length;
var i__24560__auto___41572 = (0);
while(true){
if((i__24560__auto___41572 < len__24559__auto___41571)){
args41518.push((arguments[i__24560__auto___41572]));

var G__41573 = (i__24560__auto___41572 + (1));
i__24560__auto___41572 = G__41573;
continue;
} else {
}
break;
}

var G__41520 = args41518.length;
switch (G__41520) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41518.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__40874__auto___41575 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___41575,tc,fc){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___41575,tc,fc){
return (function (state_41546){
var state_val_41547 = (state_41546[(1)]);
if((state_val_41547 === (7))){
var inst_41542 = (state_41546[(2)]);
var state_41546__$1 = state_41546;
var statearr_41548_41576 = state_41546__$1;
(statearr_41548_41576[(2)] = inst_41542);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (1))){
var state_41546__$1 = state_41546;
var statearr_41549_41577 = state_41546__$1;
(statearr_41549_41577[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (4))){
var inst_41523 = (state_41546[(7)]);
var inst_41523__$1 = (state_41546[(2)]);
var inst_41524 = (inst_41523__$1 == null);
var state_41546__$1 = (function (){var statearr_41550 = state_41546;
(statearr_41550[(7)] = inst_41523__$1);

return statearr_41550;
})();
if(cljs.core.truth_(inst_41524)){
var statearr_41551_41578 = state_41546__$1;
(statearr_41551_41578[(1)] = (5));

} else {
var statearr_41552_41579 = state_41546__$1;
(statearr_41552_41579[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (13))){
var state_41546__$1 = state_41546;
var statearr_41553_41580 = state_41546__$1;
(statearr_41553_41580[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (6))){
var inst_41523 = (state_41546[(7)]);
var inst_41529 = p.call(null,inst_41523);
var state_41546__$1 = state_41546;
if(cljs.core.truth_(inst_41529)){
var statearr_41554_41581 = state_41546__$1;
(statearr_41554_41581[(1)] = (9));

} else {
var statearr_41555_41582 = state_41546__$1;
(statearr_41555_41582[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (3))){
var inst_41544 = (state_41546[(2)]);
var state_41546__$1 = state_41546;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41546__$1,inst_41544);
} else {
if((state_val_41547 === (12))){
var state_41546__$1 = state_41546;
var statearr_41556_41583 = state_41546__$1;
(statearr_41556_41583[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (2))){
var state_41546__$1 = state_41546;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41546__$1,(4),ch);
} else {
if((state_val_41547 === (11))){
var inst_41523 = (state_41546[(7)]);
var inst_41533 = (state_41546[(2)]);
var state_41546__$1 = state_41546;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41546__$1,(8),inst_41533,inst_41523);
} else {
if((state_val_41547 === (9))){
var state_41546__$1 = state_41546;
var statearr_41557_41584 = state_41546__$1;
(statearr_41557_41584[(2)] = tc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (5))){
var inst_41526 = cljs.core.async.close_BANG_.call(null,tc);
var inst_41527 = cljs.core.async.close_BANG_.call(null,fc);
var state_41546__$1 = (function (){var statearr_41558 = state_41546;
(statearr_41558[(8)] = inst_41526);

return statearr_41558;
})();
var statearr_41559_41585 = state_41546__$1;
(statearr_41559_41585[(2)] = inst_41527);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (14))){
var inst_41540 = (state_41546[(2)]);
var state_41546__$1 = state_41546;
var statearr_41560_41586 = state_41546__$1;
(statearr_41560_41586[(2)] = inst_41540);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (10))){
var state_41546__$1 = state_41546;
var statearr_41561_41587 = state_41546__$1;
(statearr_41561_41587[(2)] = fc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41547 === (8))){
var inst_41535 = (state_41546[(2)]);
var state_41546__$1 = state_41546;
if(cljs.core.truth_(inst_41535)){
var statearr_41562_41588 = state_41546__$1;
(statearr_41562_41588[(1)] = (12));

} else {
var statearr_41563_41589 = state_41546__$1;
(statearr_41563_41589[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___41575,tc,fc))
;
return ((function (switch__40760__auto__,c__40874__auto___41575,tc,fc){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_41567 = [null,null,null,null,null,null,null,null,null];
(statearr_41567[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_41567[(1)] = (1));

return statearr_41567;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_41546){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41546);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41568){if((e41568 instanceof Object)){
var ex__40764__auto__ = e41568;
var statearr_41569_41590 = state_41546;
(statearr_41569_41590[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41591 = state_41546;
state_41546 = G__41591;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_41546){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_41546);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___41575,tc,fc))
})();
var state__40876__auto__ = (function (){var statearr_41570 = f__40875__auto__.call(null);
(statearr_41570[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___41575);

return statearr_41570;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___41575,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__40874__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto__){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto__){
return (function (state_41655){
var state_val_41656 = (state_41655[(1)]);
if((state_val_41656 === (7))){
var inst_41651 = (state_41655[(2)]);
var state_41655__$1 = state_41655;
var statearr_41657_41678 = state_41655__$1;
(statearr_41657_41678[(2)] = inst_41651);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41656 === (1))){
var inst_41635 = init;
var state_41655__$1 = (function (){var statearr_41658 = state_41655;
(statearr_41658[(7)] = inst_41635);

return statearr_41658;
})();
var statearr_41659_41679 = state_41655__$1;
(statearr_41659_41679[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41656 === (4))){
var inst_41638 = (state_41655[(8)]);
var inst_41638__$1 = (state_41655[(2)]);
var inst_41639 = (inst_41638__$1 == null);
var state_41655__$1 = (function (){var statearr_41660 = state_41655;
(statearr_41660[(8)] = inst_41638__$1);

return statearr_41660;
})();
if(cljs.core.truth_(inst_41639)){
var statearr_41661_41680 = state_41655__$1;
(statearr_41661_41680[(1)] = (5));

} else {
var statearr_41662_41681 = state_41655__$1;
(statearr_41662_41681[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41656 === (6))){
var inst_41635 = (state_41655[(7)]);
var inst_41642 = (state_41655[(9)]);
var inst_41638 = (state_41655[(8)]);
var inst_41642__$1 = f.call(null,inst_41635,inst_41638);
var inst_41643 = cljs.core.reduced_QMARK_.call(null,inst_41642__$1);
var state_41655__$1 = (function (){var statearr_41663 = state_41655;
(statearr_41663[(9)] = inst_41642__$1);

return statearr_41663;
})();
if(inst_41643){
var statearr_41664_41682 = state_41655__$1;
(statearr_41664_41682[(1)] = (8));

} else {
var statearr_41665_41683 = state_41655__$1;
(statearr_41665_41683[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41656 === (3))){
var inst_41653 = (state_41655[(2)]);
var state_41655__$1 = state_41655;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41655__$1,inst_41653);
} else {
if((state_val_41656 === (2))){
var state_41655__$1 = state_41655;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41655__$1,(4),ch);
} else {
if((state_val_41656 === (9))){
var inst_41642 = (state_41655[(9)]);
var inst_41635 = inst_41642;
var state_41655__$1 = (function (){var statearr_41666 = state_41655;
(statearr_41666[(7)] = inst_41635);

return statearr_41666;
})();
var statearr_41667_41684 = state_41655__$1;
(statearr_41667_41684[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41656 === (5))){
var inst_41635 = (state_41655[(7)]);
var state_41655__$1 = state_41655;
var statearr_41668_41685 = state_41655__$1;
(statearr_41668_41685[(2)] = inst_41635);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41656 === (10))){
var inst_41649 = (state_41655[(2)]);
var state_41655__$1 = state_41655;
var statearr_41669_41686 = state_41655__$1;
(statearr_41669_41686[(2)] = inst_41649);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41656 === (8))){
var inst_41642 = (state_41655[(9)]);
var inst_41645 = cljs.core.deref.call(null,inst_41642);
var state_41655__$1 = state_41655;
var statearr_41670_41687 = state_41655__$1;
(statearr_41670_41687[(2)] = inst_41645);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto__))
;
return ((function (switch__40760__auto__,c__40874__auto__){
return (function() {
var cljs$core$async$reduce_$_state_machine__40761__auto__ = null;
var cljs$core$async$reduce_$_state_machine__40761__auto____0 = (function (){
var statearr_41674 = [null,null,null,null,null,null,null,null,null,null];
(statearr_41674[(0)] = cljs$core$async$reduce_$_state_machine__40761__auto__);

(statearr_41674[(1)] = (1));

return statearr_41674;
});
var cljs$core$async$reduce_$_state_machine__40761__auto____1 = (function (state_41655){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41655);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41675){if((e41675 instanceof Object)){
var ex__40764__auto__ = e41675;
var statearr_41676_41688 = state_41655;
(statearr_41676_41688[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41689 = state_41655;
state_41655 = G__41689;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__40761__auto__ = function(state_41655){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__40761__auto____1.call(this,state_41655);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$reduce_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__40761__auto____0;
cljs$core$async$reduce_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__40761__auto____1;
return cljs$core$async$reduce_$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto__))
})();
var state__40876__auto__ = (function (){var statearr_41677 = f__40875__auto__.call(null);
(statearr_41677[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto__);

return statearr_41677;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto__))
);

return c__40874__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__40874__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto__,f__$1){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto__,f__$1){
return (function (state_41709){
var state_val_41710 = (state_41709[(1)]);
if((state_val_41710 === (1))){
var inst_41704 = cljs.core.async.reduce.call(null,f__$1,init,ch);
var state_41709__$1 = state_41709;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_41709__$1,(2),inst_41704);
} else {
if((state_val_41710 === (2))){
var inst_41706 = (state_41709[(2)]);
var inst_41707 = f__$1.call(null,inst_41706);
var state_41709__$1 = state_41709;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41709__$1,inst_41707);
} else {
return null;
}
}
});})(c__40874__auto__,f__$1))
;
return ((function (switch__40760__auto__,c__40874__auto__,f__$1){
return (function() {
var cljs$core$async$transduce_$_state_machine__40761__auto__ = null;
var cljs$core$async$transduce_$_state_machine__40761__auto____0 = (function (){
var statearr_41714 = [null,null,null,null,null,null,null];
(statearr_41714[(0)] = cljs$core$async$transduce_$_state_machine__40761__auto__);

(statearr_41714[(1)] = (1));

return statearr_41714;
});
var cljs$core$async$transduce_$_state_machine__40761__auto____1 = (function (state_41709){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41709);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41715){if((e41715 instanceof Object)){
var ex__40764__auto__ = e41715;
var statearr_41716_41718 = state_41709;
(statearr_41716_41718[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41719 = state_41709;
state_41709 = G__41719;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__40761__auto__ = function(state_41709){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__40761__auto____1.call(this,state_41709);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$transduce_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__40761__auto____0;
cljs$core$async$transduce_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__40761__auto____1;
return cljs$core$async$transduce_$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto__,f__$1))
})();
var state__40876__auto__ = (function (){var statearr_41717 = f__40875__auto__.call(null);
(statearr_41717[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto__);

return statearr_41717;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto__,f__$1))
);

return c__40874__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 args41720 = [];
var len__24559__auto___41772 = arguments.length;
var i__24560__auto___41773 = (0);
while(true){
if((i__24560__auto___41773 < len__24559__auto___41772)){
args41720.push((arguments[i__24560__auto___41773]));

var G__41774 = (i__24560__auto___41773 + (1));
i__24560__auto___41773 = G__41774;
continue;
} else {
}
break;
}

var G__41722 = args41720.length;
switch (G__41722) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args41720.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__40874__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto__){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto__){
return (function (state_41747){
var state_val_41748 = (state_41747[(1)]);
if((state_val_41748 === (7))){
var inst_41729 = (state_41747[(2)]);
var state_41747__$1 = state_41747;
var statearr_41749_41776 = state_41747__$1;
(statearr_41749_41776[(2)] = inst_41729);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (1))){
var inst_41723 = cljs.core.seq.call(null,coll);
var inst_41724 = inst_41723;
var state_41747__$1 = (function (){var statearr_41750 = state_41747;
(statearr_41750[(7)] = inst_41724);

return statearr_41750;
})();
var statearr_41751_41777 = state_41747__$1;
(statearr_41751_41777[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (4))){
var inst_41724 = (state_41747[(7)]);
var inst_41727 = cljs.core.first.call(null,inst_41724);
var state_41747__$1 = state_41747;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_41747__$1,(7),ch,inst_41727);
} else {
if((state_val_41748 === (13))){
var inst_41741 = (state_41747[(2)]);
var state_41747__$1 = state_41747;
var statearr_41752_41778 = state_41747__$1;
(statearr_41752_41778[(2)] = inst_41741);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (6))){
var inst_41732 = (state_41747[(2)]);
var state_41747__$1 = state_41747;
if(cljs.core.truth_(inst_41732)){
var statearr_41753_41779 = state_41747__$1;
(statearr_41753_41779[(1)] = (8));

} else {
var statearr_41754_41780 = state_41747__$1;
(statearr_41754_41780[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (3))){
var inst_41745 = (state_41747[(2)]);
var state_41747__$1 = state_41747;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_41747__$1,inst_41745);
} else {
if((state_val_41748 === (12))){
var state_41747__$1 = state_41747;
var statearr_41755_41781 = state_41747__$1;
(statearr_41755_41781[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (2))){
var inst_41724 = (state_41747[(7)]);
var state_41747__$1 = state_41747;
if(cljs.core.truth_(inst_41724)){
var statearr_41756_41782 = state_41747__$1;
(statearr_41756_41782[(1)] = (4));

} else {
var statearr_41757_41783 = state_41747__$1;
(statearr_41757_41783[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (11))){
var inst_41738 = cljs.core.async.close_BANG_.call(null,ch);
var state_41747__$1 = state_41747;
var statearr_41758_41784 = state_41747__$1;
(statearr_41758_41784[(2)] = inst_41738);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (9))){
var state_41747__$1 = state_41747;
if(cljs.core.truth_(close_QMARK_)){
var statearr_41759_41785 = state_41747__$1;
(statearr_41759_41785[(1)] = (11));

} else {
var statearr_41760_41786 = state_41747__$1;
(statearr_41760_41786[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (5))){
var inst_41724 = (state_41747[(7)]);
var state_41747__$1 = state_41747;
var statearr_41761_41787 = state_41747__$1;
(statearr_41761_41787[(2)] = inst_41724);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (10))){
var inst_41743 = (state_41747[(2)]);
var state_41747__$1 = state_41747;
var statearr_41762_41788 = state_41747__$1;
(statearr_41762_41788[(2)] = inst_41743);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_41748 === (8))){
var inst_41724 = (state_41747[(7)]);
var inst_41734 = cljs.core.next.call(null,inst_41724);
var inst_41724__$1 = inst_41734;
var state_41747__$1 = (function (){var statearr_41763 = state_41747;
(statearr_41763[(7)] = inst_41724__$1);

return statearr_41763;
})();
var statearr_41764_41789 = state_41747__$1;
(statearr_41764_41789[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto__))
;
return ((function (switch__40760__auto__,c__40874__auto__){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_41768 = [null,null,null,null,null,null,null,null];
(statearr_41768[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_41768[(1)] = (1));

return statearr_41768;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_41747){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_41747);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e41769){if((e41769 instanceof Object)){
var ex__40764__auto__ = e41769;
var statearr_41770_41790 = state_41747;
(statearr_41770_41790[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__41791 = state_41747;
state_41747 = G__41791;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_41747){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_41747);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto__))
})();
var state__40876__auto__ = (function (){var statearr_41771 = f__40875__auto__.call(null);
(statearr_41771[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto__);

return statearr_41771;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto__))
);

return c__40874__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__24056__auto__ = (((_ == null))?null:_);
var m__24057__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,_);
} else {
var m__24057__auto____$1 = (cljs.core.async.muxch_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch,close_QMARK_);
} else {
var m__24057__auto____$1 = (cljs.core.async.tap_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.untap_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m);
} else {
var m__24057__auto____$1 = (cljs.core.async.untap_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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.core.async.t_cljs$core$async42017 !== '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$async42017 = (function (ch,cs,meta42018){
this.ch = ch;
this.cs = cs;
this.meta42018 = meta42018;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async42017.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs){
return (function (_42019,meta42018__$1){
var self__ = this;
var _42019__$1 = this;
return (new cljs.core.async.t_cljs$core$async42017(self__.ch,self__.cs,meta42018__$1));
});})(cs))
;

cljs.core.async.t_cljs$core$async42017.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs){
return (function (_42019){
var self__ = this;
var _42019__$1 = this;
return self__.meta42018;
});})(cs))
;

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

cljs.core.async.t_cljs$core$async42017.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$async42017.prototype.cljs$core$async$Mult$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async42017.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$async42017.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$async42017.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$async42017.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,"meta42018","meta42018",1120076820,null)], null);
});})(cs))
;

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

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

cljs.core.async.t_cljs$core$async42017.cljs$lang$ctorPrWriter = ((function (cs){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async42017");
});})(cs))
;

cljs.core.async.__GT_t_cljs$core$async42017 = ((function (cs){
return (function cljs$core$async$mult_$___GT_t_cljs$core$async42017(ch__$1,cs__$1,meta42018){
return (new cljs.core.async.t_cljs$core$async42017(ch__$1,cs__$1,meta42018));
});})(cs))
;

}

return (new cljs.core.async.t_cljs$core$async42017(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__40874__auto___42242 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___42242,cs,m,dchan,dctr,done){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___42242,cs,m,dchan,dctr,done){
return (function (state_42154){
var state_val_42155 = (state_42154[(1)]);
if((state_val_42155 === (7))){
var inst_42150 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42156_42243 = state_42154__$1;
(statearr_42156_42243[(2)] = inst_42150);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (20))){
var inst_42053 = (state_42154[(7)]);
var inst_42065 = cljs.core.first.call(null,inst_42053);
var inst_42066 = cljs.core.nth.call(null,inst_42065,(0),null);
var inst_42067 = cljs.core.nth.call(null,inst_42065,(1),null);
var state_42154__$1 = (function (){var statearr_42157 = state_42154;
(statearr_42157[(8)] = inst_42066);

return statearr_42157;
})();
if(cljs.core.truth_(inst_42067)){
var statearr_42158_42244 = state_42154__$1;
(statearr_42158_42244[(1)] = (22));

} else {
var statearr_42159_42245 = state_42154__$1;
(statearr_42159_42245[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (27))){
var inst_42022 = (state_42154[(9)]);
var inst_42097 = (state_42154[(10)]);
var inst_42095 = (state_42154[(11)]);
var inst_42102 = (state_42154[(12)]);
var inst_42102__$1 = cljs.core._nth.call(null,inst_42095,inst_42097);
var inst_42103 = cljs.core.async.put_BANG_.call(null,inst_42102__$1,inst_42022,done);
var state_42154__$1 = (function (){var statearr_42160 = state_42154;
(statearr_42160[(12)] = inst_42102__$1);

return statearr_42160;
})();
if(cljs.core.truth_(inst_42103)){
var statearr_42161_42246 = state_42154__$1;
(statearr_42161_42246[(1)] = (30));

} else {
var statearr_42162_42247 = state_42154__$1;
(statearr_42162_42247[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (1))){
var state_42154__$1 = state_42154;
var statearr_42163_42248 = state_42154__$1;
(statearr_42163_42248[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (24))){
var inst_42053 = (state_42154[(7)]);
var inst_42072 = (state_42154[(2)]);
var inst_42073 = cljs.core.next.call(null,inst_42053);
var inst_42031 = inst_42073;
var inst_42032 = null;
var inst_42033 = (0);
var inst_42034 = (0);
var state_42154__$1 = (function (){var statearr_42164 = state_42154;
(statearr_42164[(13)] = inst_42034);

(statearr_42164[(14)] = inst_42032);

(statearr_42164[(15)] = inst_42072);

(statearr_42164[(16)] = inst_42033);

(statearr_42164[(17)] = inst_42031);

return statearr_42164;
})();
var statearr_42165_42249 = state_42154__$1;
(statearr_42165_42249[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (39))){
var state_42154__$1 = state_42154;
var statearr_42169_42250 = state_42154__$1;
(statearr_42169_42250[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (4))){
var inst_42022 = (state_42154[(9)]);
var inst_42022__$1 = (state_42154[(2)]);
var inst_42023 = (inst_42022__$1 == null);
var state_42154__$1 = (function (){var statearr_42170 = state_42154;
(statearr_42170[(9)] = inst_42022__$1);

return statearr_42170;
})();
if(cljs.core.truth_(inst_42023)){
var statearr_42171_42251 = state_42154__$1;
(statearr_42171_42251[(1)] = (5));

} else {
var statearr_42172_42252 = state_42154__$1;
(statearr_42172_42252[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (15))){
var inst_42034 = (state_42154[(13)]);
var inst_42032 = (state_42154[(14)]);
var inst_42033 = (state_42154[(16)]);
var inst_42031 = (state_42154[(17)]);
var inst_42049 = (state_42154[(2)]);
var inst_42050 = (inst_42034 + (1));
var tmp42166 = inst_42032;
var tmp42167 = inst_42033;
var tmp42168 = inst_42031;
var inst_42031__$1 = tmp42168;
var inst_42032__$1 = tmp42166;
var inst_42033__$1 = tmp42167;
var inst_42034__$1 = inst_42050;
var state_42154__$1 = (function (){var statearr_42173 = state_42154;
(statearr_42173[(13)] = inst_42034__$1);

(statearr_42173[(14)] = inst_42032__$1);

(statearr_42173[(18)] = inst_42049);

(statearr_42173[(16)] = inst_42033__$1);

(statearr_42173[(17)] = inst_42031__$1);

return statearr_42173;
})();
var statearr_42174_42253 = state_42154__$1;
(statearr_42174_42253[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (21))){
var inst_42076 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42178_42254 = state_42154__$1;
(statearr_42178_42254[(2)] = inst_42076);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (31))){
var inst_42102 = (state_42154[(12)]);
var inst_42106 = done.call(null,null);
var inst_42107 = cljs.core.async.untap_STAR_.call(null,m,inst_42102);
var state_42154__$1 = (function (){var statearr_42179 = state_42154;
(statearr_42179[(19)] = inst_42106);

return statearr_42179;
})();
var statearr_42180_42255 = state_42154__$1;
(statearr_42180_42255[(2)] = inst_42107);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (32))){
var inst_42094 = (state_42154[(20)]);
var inst_42097 = (state_42154[(10)]);
var inst_42095 = (state_42154[(11)]);
var inst_42096 = (state_42154[(21)]);
var inst_42109 = (state_42154[(2)]);
var inst_42110 = (inst_42097 + (1));
var tmp42175 = inst_42094;
var tmp42176 = inst_42095;
var tmp42177 = inst_42096;
var inst_42094__$1 = tmp42175;
var inst_42095__$1 = tmp42176;
var inst_42096__$1 = tmp42177;
var inst_42097__$1 = inst_42110;
var state_42154__$1 = (function (){var statearr_42181 = state_42154;
(statearr_42181[(20)] = inst_42094__$1);

(statearr_42181[(22)] = inst_42109);

(statearr_42181[(10)] = inst_42097__$1);

(statearr_42181[(11)] = inst_42095__$1);

(statearr_42181[(21)] = inst_42096__$1);

return statearr_42181;
})();
var statearr_42182_42256 = state_42154__$1;
(statearr_42182_42256[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (40))){
var inst_42122 = (state_42154[(23)]);
var inst_42126 = done.call(null,null);
var inst_42127 = cljs.core.async.untap_STAR_.call(null,m,inst_42122);
var state_42154__$1 = (function (){var statearr_42183 = state_42154;
(statearr_42183[(24)] = inst_42126);

return statearr_42183;
})();
var statearr_42184_42257 = state_42154__$1;
(statearr_42184_42257[(2)] = inst_42127);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (33))){
var inst_42113 = (state_42154[(25)]);
var inst_42115 = cljs.core.chunked_seq_QMARK_.call(null,inst_42113);
var state_42154__$1 = state_42154;
if(inst_42115){
var statearr_42185_42258 = state_42154__$1;
(statearr_42185_42258[(1)] = (36));

} else {
var statearr_42186_42259 = state_42154__$1;
(statearr_42186_42259[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (13))){
var inst_42043 = (state_42154[(26)]);
var inst_42046 = cljs.core.async.close_BANG_.call(null,inst_42043);
var state_42154__$1 = state_42154;
var statearr_42187_42260 = state_42154__$1;
(statearr_42187_42260[(2)] = inst_42046);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (22))){
var inst_42066 = (state_42154[(8)]);
var inst_42069 = cljs.core.async.close_BANG_.call(null,inst_42066);
var state_42154__$1 = state_42154;
var statearr_42188_42261 = state_42154__$1;
(statearr_42188_42261[(2)] = inst_42069);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (36))){
var inst_42113 = (state_42154[(25)]);
var inst_42117 = cljs.core.chunk_first.call(null,inst_42113);
var inst_42118 = cljs.core.chunk_rest.call(null,inst_42113);
var inst_42119 = cljs.core.count.call(null,inst_42117);
var inst_42094 = inst_42118;
var inst_42095 = inst_42117;
var inst_42096 = inst_42119;
var inst_42097 = (0);
var state_42154__$1 = (function (){var statearr_42189 = state_42154;
(statearr_42189[(20)] = inst_42094);

(statearr_42189[(10)] = inst_42097);

(statearr_42189[(11)] = inst_42095);

(statearr_42189[(21)] = inst_42096);

return statearr_42189;
})();
var statearr_42190_42262 = state_42154__$1;
(statearr_42190_42262[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (41))){
var inst_42113 = (state_42154[(25)]);
var inst_42129 = (state_42154[(2)]);
var inst_42130 = cljs.core.next.call(null,inst_42113);
var inst_42094 = inst_42130;
var inst_42095 = null;
var inst_42096 = (0);
var inst_42097 = (0);
var state_42154__$1 = (function (){var statearr_42191 = state_42154;
(statearr_42191[(20)] = inst_42094);

(statearr_42191[(10)] = inst_42097);

(statearr_42191[(27)] = inst_42129);

(statearr_42191[(11)] = inst_42095);

(statearr_42191[(21)] = inst_42096);

return statearr_42191;
})();
var statearr_42192_42263 = state_42154__$1;
(statearr_42192_42263[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (43))){
var state_42154__$1 = state_42154;
var statearr_42193_42264 = state_42154__$1;
(statearr_42193_42264[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (29))){
var inst_42138 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42194_42265 = state_42154__$1;
(statearr_42194_42265[(2)] = inst_42138);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (44))){
var inst_42147 = (state_42154[(2)]);
var state_42154__$1 = (function (){var statearr_42195 = state_42154;
(statearr_42195[(28)] = inst_42147);

return statearr_42195;
})();
var statearr_42196_42266 = state_42154__$1;
(statearr_42196_42266[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (6))){
var inst_42086 = (state_42154[(29)]);
var inst_42085 = cljs.core.deref.call(null,cs);
var inst_42086__$1 = cljs.core.keys.call(null,inst_42085);
var inst_42087 = cljs.core.count.call(null,inst_42086__$1);
var inst_42088 = cljs.core.reset_BANG_.call(null,dctr,inst_42087);
var inst_42093 = cljs.core.seq.call(null,inst_42086__$1);
var inst_42094 = inst_42093;
var inst_42095 = null;
var inst_42096 = (0);
var inst_42097 = (0);
var state_42154__$1 = (function (){var statearr_42197 = state_42154;
(statearr_42197[(20)] = inst_42094);

(statearr_42197[(10)] = inst_42097);

(statearr_42197[(29)] = inst_42086__$1);

(statearr_42197[(30)] = inst_42088);

(statearr_42197[(11)] = inst_42095);

(statearr_42197[(21)] = inst_42096);

return statearr_42197;
})();
var statearr_42198_42267 = state_42154__$1;
(statearr_42198_42267[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (28))){
var inst_42094 = (state_42154[(20)]);
var inst_42113 = (state_42154[(25)]);
var inst_42113__$1 = cljs.core.seq.call(null,inst_42094);
var state_42154__$1 = (function (){var statearr_42199 = state_42154;
(statearr_42199[(25)] = inst_42113__$1);

return statearr_42199;
})();
if(inst_42113__$1){
var statearr_42200_42268 = state_42154__$1;
(statearr_42200_42268[(1)] = (33));

} else {
var statearr_42201_42269 = state_42154__$1;
(statearr_42201_42269[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (25))){
var inst_42097 = (state_42154[(10)]);
var inst_42096 = (state_42154[(21)]);
var inst_42099 = (inst_42097 < inst_42096);
var inst_42100 = inst_42099;
var state_42154__$1 = state_42154;
if(cljs.core.truth_(inst_42100)){
var statearr_42202_42270 = state_42154__$1;
(statearr_42202_42270[(1)] = (27));

} else {
var statearr_42203_42271 = state_42154__$1;
(statearr_42203_42271[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (34))){
var state_42154__$1 = state_42154;
var statearr_42204_42272 = state_42154__$1;
(statearr_42204_42272[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (17))){
var state_42154__$1 = state_42154;
var statearr_42205_42273 = state_42154__$1;
(statearr_42205_42273[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (3))){
var inst_42152 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_42154__$1,inst_42152);
} else {
if((state_val_42155 === (12))){
var inst_42081 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42206_42274 = state_42154__$1;
(statearr_42206_42274[(2)] = inst_42081);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (35))){
var inst_42136 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42208_42276 = state_42154__$1;
(statearr_42208_42276[(2)] = inst_42136);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (19))){
var inst_42053 = (state_42154[(7)]);
var inst_42057 = cljs.core.chunk_first.call(null,inst_42053);
var inst_42058 = cljs.core.chunk_rest.call(null,inst_42053);
var inst_42059 = cljs.core.count.call(null,inst_42057);
var inst_42031 = inst_42058;
var inst_42032 = inst_42057;
var inst_42033 = inst_42059;
var inst_42034 = (0);
var state_42154__$1 = (function (){var statearr_42209 = state_42154;
(statearr_42209[(13)] = inst_42034);

(statearr_42209[(14)] = inst_42032);

(statearr_42209[(16)] = inst_42033);

(statearr_42209[(17)] = inst_42031);

return statearr_42209;
})();
var statearr_42210_42277 = state_42154__$1;
(statearr_42210_42277[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (11))){
var inst_42031 = (state_42154[(17)]);
var inst_42053 = (state_42154[(7)]);
var inst_42053__$1 = cljs.core.seq.call(null,inst_42031);
var state_42154__$1 = (function (){var statearr_42211 = state_42154;
(statearr_42211[(7)] = inst_42053__$1);

return statearr_42211;
})();
if(inst_42053__$1){
var statearr_42212_42278 = state_42154__$1;
(statearr_42212_42278[(1)] = (16));

} else {
var statearr_42213_42279 = state_42154__$1;
(statearr_42213_42279[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (9))){
var inst_42083 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42214_42280 = state_42154__$1;
(statearr_42214_42280[(2)] = inst_42083);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (5))){
var inst_42029 = cljs.core.deref.call(null,cs);
var inst_42030 = cljs.core.seq.call(null,inst_42029);
var inst_42031 = inst_42030;
var inst_42032 = null;
var inst_42033 = (0);
var inst_42034 = (0);
var state_42154__$1 = (function (){var statearr_42215 = state_42154;
(statearr_42215[(13)] = inst_42034);

(statearr_42215[(14)] = inst_42032);

(statearr_42215[(16)] = inst_42033);

(statearr_42215[(17)] = inst_42031);

return statearr_42215;
})();
var statearr_42216_42281 = state_42154__$1;
(statearr_42216_42281[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (14))){
var state_42154__$1 = state_42154;
var statearr_42217_42282 = state_42154__$1;
(statearr_42217_42282[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (45))){
var inst_42144 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42218_42283 = state_42154__$1;
(statearr_42218_42283[(2)] = inst_42144);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (26))){
var inst_42086 = (state_42154[(29)]);
var inst_42140 = (state_42154[(2)]);
var inst_42141 = cljs.core.seq.call(null,inst_42086);
var state_42154__$1 = (function (){var statearr_42219 = state_42154;
(statearr_42219[(31)] = inst_42140);

return statearr_42219;
})();
if(inst_42141){
var statearr_42220_42284 = state_42154__$1;
(statearr_42220_42284[(1)] = (42));

} else {
var statearr_42221_42285 = state_42154__$1;
(statearr_42221_42285[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (16))){
var inst_42053 = (state_42154[(7)]);
var inst_42055 = cljs.core.chunked_seq_QMARK_.call(null,inst_42053);
var state_42154__$1 = state_42154;
if(inst_42055){
var statearr_42222_42286 = state_42154__$1;
(statearr_42222_42286[(1)] = (19));

} else {
var statearr_42223_42287 = state_42154__$1;
(statearr_42223_42287[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (38))){
var inst_42133 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42224_42288 = state_42154__$1;
(statearr_42224_42288[(2)] = inst_42133);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (30))){
var state_42154__$1 = state_42154;
var statearr_42225_42289 = state_42154__$1;
(statearr_42225_42289[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (10))){
var inst_42034 = (state_42154[(13)]);
var inst_42032 = (state_42154[(14)]);
var inst_42042 = cljs.core._nth.call(null,inst_42032,inst_42034);
var inst_42043 = cljs.core.nth.call(null,inst_42042,(0),null);
var inst_42044 = cljs.core.nth.call(null,inst_42042,(1),null);
var state_42154__$1 = (function (){var statearr_42226 = state_42154;
(statearr_42226[(26)] = inst_42043);

return statearr_42226;
})();
if(cljs.core.truth_(inst_42044)){
var statearr_42227_42290 = state_42154__$1;
(statearr_42227_42290[(1)] = (13));

} else {
var statearr_42228_42291 = state_42154__$1;
(statearr_42228_42291[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (18))){
var inst_42079 = (state_42154[(2)]);
var state_42154__$1 = state_42154;
var statearr_42229_42292 = state_42154__$1;
(statearr_42229_42292[(2)] = inst_42079);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (42))){
var state_42154__$1 = state_42154;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_42154__$1,(45),dchan);
} else {
if((state_val_42155 === (37))){
var inst_42022 = (state_42154[(9)]);
var inst_42113 = (state_42154[(25)]);
var inst_42122 = (state_42154[(23)]);
var inst_42122__$1 = cljs.core.first.call(null,inst_42113);
var inst_42123 = cljs.core.async.put_BANG_.call(null,inst_42122__$1,inst_42022,done);
var state_42154__$1 = (function (){var statearr_42230 = state_42154;
(statearr_42230[(23)] = inst_42122__$1);

return statearr_42230;
})();
if(cljs.core.truth_(inst_42123)){
var statearr_42231_42293 = state_42154__$1;
(statearr_42231_42293[(1)] = (39));

} else {
var statearr_42232_42294 = state_42154__$1;
(statearr_42232_42294[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42155 === (8))){
var inst_42034 = (state_42154[(13)]);
var inst_42033 = (state_42154[(16)]);
var inst_42036 = (inst_42034 < inst_42033);
var inst_42037 = inst_42036;
var state_42154__$1 = state_42154;
if(cljs.core.truth_(inst_42037)){
var statearr_42233_42295 = state_42154__$1;
(statearr_42233_42295[(1)] = (10));

} else {
var statearr_42234_42296 = state_42154__$1;
(statearr_42234_42296[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___42242,cs,m,dchan,dctr,done))
;
return ((function (switch__40760__auto__,c__40874__auto___42242,cs,m,dchan,dctr,done){
return (function() {
var cljs$core$async$mult_$_state_machine__40761__auto__ = null;
var cljs$core$async$mult_$_state_machine__40761__auto____0 = (function (){
var statearr_42238 = [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_42238[(0)] = cljs$core$async$mult_$_state_machine__40761__auto__);

(statearr_42238[(1)] = (1));

return statearr_42238;
});
var cljs$core$async$mult_$_state_machine__40761__auto____1 = (function (state_42154){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_42154);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e42239){if((e42239 instanceof Object)){
var ex__40764__auto__ = e42239;
var statearr_42240_42297 = state_42154;
(statearr_42240_42297[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__42298 = state_42154;
state_42154 = G__42298;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__40761__auto__ = function(state_42154){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__40761__auto____1.call(this,state_42154);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mult_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__40761__auto____0;
cljs$core$async$mult_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__40761__auto____1;
return cljs$core$async$mult_$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___42242,cs,m,dchan,dctr,done))
})();
var state__40876__auto__ = (function (){var statearr_42241 = f__40875__auto__.call(null);
(statearr_42241[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___42242);

return statearr_42241;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___42242,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 args42299 = [];
var len__24559__auto___42302 = arguments.length;
var i__24560__auto___42303 = (0);
while(true){
if((i__24560__auto___42303 < len__24559__auto___42302)){
args42299.push((arguments[i__24560__auto___42303]));

var G__42304 = (i__24560__auto___42303 + (1));
i__24560__auto___42303 = G__42304;
continue;
} else {
}
break;
}

var G__42301 = args42299.length;
switch (G__42301) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args42299.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.admix_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.unmix_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m);
} else {
var m__24057__auto____$1 = (cljs.core.async.unmix_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,state_map);
} else {
var m__24057__auto____$1 = (cljs.core.async.toggle_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((m == null))?null:m);
var m__24057__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,m,mode);
} else {
var m__24057__auto____$1 = (cljs.core.async.solo_mode_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24566__auto__ = [];
var len__24559__auto___42316 = arguments.length;
var i__24560__auto___42317 = (0);
while(true){
if((i__24560__auto___42317 < len__24559__auto___42316)){
args__24566__auto__.push((arguments[i__24560__auto___42317]));

var G__42318 = (i__24560__auto___42317 + (1));
i__24560__auto___42317 = G__42318;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((3) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__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__24567__auto__);
});

cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__42310){
var map__42311 = p__42310;
var map__42311__$1 = ((((!((map__42311 == null)))?((((map__42311.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__42311.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__42311):map__42311);
var opts = map__42311__$1;
var statearr_42313_42319 = state;
(statearr_42313_42319[cljs.core.async.impl.ioc_helpers.STATE_IDX] = cont_block);


var temp__5278__auto__ = cljs.core.async.do_alts.call(null,((function (map__42311,map__42311__$1,opts){
return (function (val){
var statearr_42314_42320 = state;
(statearr_42314_42320[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = val);


return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state);
});})(map__42311,map__42311__$1,opts))
,ports,opts);
if(cljs.core.truth_(temp__5278__auto__)){
var cb = temp__5278__auto__;
var statearr_42315_42321 = state;
(statearr_42315_42321[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = 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);

cljs.core.async.ioc_alts_BANG_.cljs$lang$applyTo = (function (seq42306){
var G__42307 = cljs.core.first.call(null,seq42306);
var seq42306__$1 = cljs.core.next.call(null,seq42306);
var G__42308 = cljs.core.first.call(null,seq42306__$1);
var seq42306__$2 = cljs.core.next.call(null,seq42306__$1);
var G__42309 = cljs.core.first.call(null,seq42306__$2);
var seq42306__$3 = cljs.core.next.call(null,seq42306__$2);
return cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic(G__42307,G__42308,G__42309,seq42306__$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.core.async.t_cljs$core$async42489 !== '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$async42489 = (function (out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,meta42490){
this.out = out;
this.cs = cs;
this.solo_modes = solo_modes;
this.attrs = attrs;
this.solo_mode = solo_mode;
this.change = change;
this.changed = changed;
this.pick = pick;
this.calc_state = calc_state;
this.meta42490 = meta42490;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async42489.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_42491,meta42490__$1){
var self__ = this;
var _42491__$1 = this;
return (new cljs.core.async.t_cljs$core$async42489(self__.out,self__.cs,self__.solo_modes,self__.attrs,self__.solo_mode,self__.change,self__.changed,self__.pick,self__.calc_state,meta42490__$1));
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

cljs.core.async.t_cljs$core$async42489.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (_42491){
var self__ = this;
var _42491__$1 = this;
return self__.meta42490;
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

cljs.core.async.t_cljs$core$async42489.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$async42489.prototype.cljs$core$async$Mix$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async42489.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$async42489.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$async42489.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$async42489.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$async42489.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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Assert failed: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1([cljs.core.str.cljs$core$IFn$_invoke$arity$1("mode must be one of: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(self__.solo_modes)].join('')),cljs.core.str.cljs$core$IFn$_invoke$arity$1("\n"),cljs.core.str.cljs$core$IFn$_invoke$arity$1("(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$async42489.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,"out","out",729986010,null),new cljs.core.Symbol(null,"cs","cs",-117024463,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,"solo-mode","solo-mode",2031788074,null),new cljs.core.Symbol(null,"change","change",477485025,null),new cljs.core.Symbol(null,"changed","changed",-2083710852,null),new cljs.core.Symbol(null,"pick","pick",1300068175,null),new cljs.core.Symbol(null,"calc-state","calc-state",-349968968,null),new cljs.core.Symbol(null,"meta42490","meta42490",-1300793774,null)], null);
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

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

cljs.core.async.t_cljs$core$async42489.cljs$lang$ctorPrWriter = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async42489");
});})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state))
;

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

}

return (new cljs.core.async.t_cljs$core$async42489(out,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__40874__auto___42656 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___42656,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___42656,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function (state_42593){
var state_val_42594 = (state_42593[(1)]);
if((state_val_42594 === (7))){
var inst_42508 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
var statearr_42595_42657 = state_42593__$1;
(statearr_42595_42657[(2)] = inst_42508);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (20))){
var inst_42520 = (state_42593[(7)]);
var state_42593__$1 = state_42593;
var statearr_42596_42658 = state_42593__$1;
(statearr_42596_42658[(2)] = inst_42520);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (27))){
var state_42593__$1 = state_42593;
var statearr_42597_42659 = state_42593__$1;
(statearr_42597_42659[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (1))){
var inst_42495 = (state_42593[(8)]);
var inst_42495__$1 = calc_state.call(null);
var inst_42497 = (inst_42495__$1 == null);
var inst_42498 = cljs.core.not.call(null,inst_42497);
var state_42593__$1 = (function (){var statearr_42598 = state_42593;
(statearr_42598[(8)] = inst_42495__$1);

return statearr_42598;
})();
if(inst_42498){
var statearr_42599_42660 = state_42593__$1;
(statearr_42599_42660[(1)] = (2));

} else {
var statearr_42600_42661 = state_42593__$1;
(statearr_42600_42661[(1)] = (3));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (24))){
var inst_42553 = (state_42593[(9)]);
var inst_42567 = (state_42593[(10)]);
var inst_42544 = (state_42593[(11)]);
var inst_42567__$1 = inst_42544.call(null,inst_42553);
var state_42593__$1 = (function (){var statearr_42601 = state_42593;
(statearr_42601[(10)] = inst_42567__$1);

return statearr_42601;
})();
if(cljs.core.truth_(inst_42567__$1)){
var statearr_42602_42662 = state_42593__$1;
(statearr_42602_42662[(1)] = (29));

} else {
var statearr_42603_42663 = state_42593__$1;
(statearr_42603_42663[(1)] = (30));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (4))){
var inst_42511 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
if(cljs.core.truth_(inst_42511)){
var statearr_42604_42664 = state_42593__$1;
(statearr_42604_42664[(1)] = (8));

} else {
var statearr_42605_42665 = state_42593__$1;
(statearr_42605_42665[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (15))){
var inst_42538 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
if(cljs.core.truth_(inst_42538)){
var statearr_42606_42666 = state_42593__$1;
(statearr_42606_42666[(1)] = (19));

} else {
var statearr_42607_42667 = state_42593__$1;
(statearr_42607_42667[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (21))){
var inst_42543 = (state_42593[(12)]);
var inst_42543__$1 = (state_42593[(2)]);
var inst_42544 = cljs.core.get.call(null,inst_42543__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_42545 = cljs.core.get.call(null,inst_42543__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_42546 = cljs.core.get.call(null,inst_42543__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_42593__$1 = (function (){var statearr_42608 = state_42593;
(statearr_42608[(13)] = inst_42545);

(statearr_42608[(12)] = inst_42543__$1);

(statearr_42608[(11)] = inst_42544);

return statearr_42608;
})();
return cljs.core.async.ioc_alts_BANG_.call(null,state_42593__$1,(22),inst_42546);
} else {
if((state_val_42594 === (31))){
var inst_42575 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
if(cljs.core.truth_(inst_42575)){
var statearr_42609_42668 = state_42593__$1;
(statearr_42609_42668[(1)] = (32));

} else {
var statearr_42610_42669 = state_42593__$1;
(statearr_42610_42669[(1)] = (33));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (32))){
var inst_42552 = (state_42593[(14)]);
var state_42593__$1 = state_42593;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_42593__$1,(35),out,inst_42552);
} else {
if((state_val_42594 === (33))){
var inst_42543 = (state_42593[(12)]);
var inst_42520 = inst_42543;
var state_42593__$1 = (function (){var statearr_42611 = state_42593;
(statearr_42611[(7)] = inst_42520);

return statearr_42611;
})();
var statearr_42612_42670 = state_42593__$1;
(statearr_42612_42670[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (13))){
var inst_42520 = (state_42593[(7)]);
var inst_42527 = inst_42520.cljs$lang$protocol_mask$partition0$;
var inst_42528 = (inst_42527 & (64));
var inst_42529 = inst_42520.cljs$core$ISeq$;
var inst_42530 = (cljs.core.PROTOCOL_SENTINEL === inst_42529);
var inst_42531 = (inst_42528) || (inst_42530);
var state_42593__$1 = state_42593;
if(cljs.core.truth_(inst_42531)){
var statearr_42613_42671 = state_42593__$1;
(statearr_42613_42671[(1)] = (16));

} else {
var statearr_42614_42672 = state_42593__$1;
(statearr_42614_42672[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (22))){
var inst_42553 = (state_42593[(9)]);
var inst_42552 = (state_42593[(14)]);
var inst_42551 = (state_42593[(2)]);
var inst_42552__$1 = cljs.core.nth.call(null,inst_42551,(0),null);
var inst_42553__$1 = cljs.core.nth.call(null,inst_42551,(1),null);
var inst_42554 = (inst_42552__$1 == null);
var inst_42555 = cljs.core._EQ_.call(null,inst_42553__$1,change);
var inst_42556 = (inst_42554) || (inst_42555);
var state_42593__$1 = (function (){var statearr_42615 = state_42593;
(statearr_42615[(9)] = inst_42553__$1);

(statearr_42615[(14)] = inst_42552__$1);

return statearr_42615;
})();
if(cljs.core.truth_(inst_42556)){
var statearr_42616_42673 = state_42593__$1;
(statearr_42616_42673[(1)] = (23));

} else {
var statearr_42617_42674 = state_42593__$1;
(statearr_42617_42674[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (36))){
var inst_42543 = (state_42593[(12)]);
var inst_42520 = inst_42543;
var state_42593__$1 = (function (){var statearr_42618 = state_42593;
(statearr_42618[(7)] = inst_42520);

return statearr_42618;
})();
var statearr_42619_42675 = state_42593__$1;
(statearr_42619_42675[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (29))){
var inst_42567 = (state_42593[(10)]);
var state_42593__$1 = state_42593;
var statearr_42620_42676 = state_42593__$1;
(statearr_42620_42676[(2)] = inst_42567);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (6))){
var state_42593__$1 = state_42593;
var statearr_42621_42677 = state_42593__$1;
(statearr_42621_42677[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (28))){
var inst_42563 = (state_42593[(2)]);
var inst_42564 = calc_state.call(null);
var inst_42520 = inst_42564;
var state_42593__$1 = (function (){var statearr_42622 = state_42593;
(statearr_42622[(15)] = inst_42563);

(statearr_42622[(7)] = inst_42520);

return statearr_42622;
})();
var statearr_42623_42678 = state_42593__$1;
(statearr_42623_42678[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (25))){
var inst_42589 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
var statearr_42624_42679 = state_42593__$1;
(statearr_42624_42679[(2)] = inst_42589);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (34))){
var inst_42587 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
var statearr_42625_42680 = state_42593__$1;
(statearr_42625_42680[(2)] = inst_42587);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (17))){
var state_42593__$1 = state_42593;
var statearr_42626_42681 = state_42593__$1;
(statearr_42626_42681[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (3))){
var state_42593__$1 = state_42593;
var statearr_42627_42682 = state_42593__$1;
(statearr_42627_42682[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (12))){
var inst_42591 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_42593__$1,inst_42591);
} else {
if((state_val_42594 === (2))){
var inst_42495 = (state_42593[(8)]);
var inst_42500 = inst_42495.cljs$lang$protocol_mask$partition0$;
var inst_42501 = (inst_42500 & (64));
var inst_42502 = inst_42495.cljs$core$ISeq$;
var inst_42503 = (cljs.core.PROTOCOL_SENTINEL === inst_42502);
var inst_42504 = (inst_42501) || (inst_42503);
var state_42593__$1 = state_42593;
if(cljs.core.truth_(inst_42504)){
var statearr_42628_42683 = state_42593__$1;
(statearr_42628_42683[(1)] = (5));

} else {
var statearr_42629_42684 = state_42593__$1;
(statearr_42629_42684[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (23))){
var inst_42552 = (state_42593[(14)]);
var inst_42558 = (inst_42552 == null);
var state_42593__$1 = state_42593;
if(cljs.core.truth_(inst_42558)){
var statearr_42630_42685 = state_42593__$1;
(statearr_42630_42685[(1)] = (26));

} else {
var statearr_42631_42686 = state_42593__$1;
(statearr_42631_42686[(1)] = (27));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (35))){
var inst_42578 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
if(cljs.core.truth_(inst_42578)){
var statearr_42632_42687 = state_42593__$1;
(statearr_42632_42687[(1)] = (36));

} else {
var statearr_42633_42688 = state_42593__$1;
(statearr_42633_42688[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (19))){
var inst_42520 = (state_42593[(7)]);
var inst_42540 = cljs.core.apply.call(null,cljs.core.hash_map,inst_42520);
var state_42593__$1 = state_42593;
var statearr_42634_42689 = state_42593__$1;
(statearr_42634_42689[(2)] = inst_42540);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (11))){
var inst_42520 = (state_42593[(7)]);
var inst_42524 = (inst_42520 == null);
var inst_42525 = cljs.core.not.call(null,inst_42524);
var state_42593__$1 = state_42593;
if(inst_42525){
var statearr_42635_42690 = state_42593__$1;
(statearr_42635_42690[(1)] = (13));

} else {
var statearr_42636_42691 = state_42593__$1;
(statearr_42636_42691[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (9))){
var inst_42495 = (state_42593[(8)]);
var state_42593__$1 = state_42593;
var statearr_42637_42692 = state_42593__$1;
(statearr_42637_42692[(2)] = inst_42495);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (5))){
var state_42593__$1 = state_42593;
var statearr_42638_42693 = state_42593__$1;
(statearr_42638_42693[(2)] = true);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (14))){
var state_42593__$1 = state_42593;
var statearr_42639_42694 = state_42593__$1;
(statearr_42639_42694[(2)] = false);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (26))){
var inst_42553 = (state_42593[(9)]);
var inst_42560 = cljs.core.swap_BANG_.call(null,cs,cljs.core.dissoc,inst_42553);
var state_42593__$1 = state_42593;
var statearr_42640_42695 = state_42593__$1;
(statearr_42640_42695[(2)] = inst_42560);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (16))){
var state_42593__$1 = state_42593;
var statearr_42641_42696 = state_42593__$1;
(statearr_42641_42696[(2)] = true);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (38))){
var inst_42583 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
var statearr_42642_42697 = state_42593__$1;
(statearr_42642_42697[(2)] = inst_42583);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (30))){
var inst_42545 = (state_42593[(13)]);
var inst_42553 = (state_42593[(9)]);
var inst_42544 = (state_42593[(11)]);
var inst_42570 = cljs.core.empty_QMARK_.call(null,inst_42544);
var inst_42571 = inst_42545.call(null,inst_42553);
var inst_42572 = cljs.core.not.call(null,inst_42571);
var inst_42573 = (inst_42570) && (inst_42572);
var state_42593__$1 = state_42593;
var statearr_42643_42698 = state_42593__$1;
(statearr_42643_42698[(2)] = inst_42573);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (10))){
var inst_42495 = (state_42593[(8)]);
var inst_42516 = (state_42593[(2)]);
var inst_42517 = cljs.core.get.call(null,inst_42516,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_42518 = cljs.core.get.call(null,inst_42516,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_42519 = cljs.core.get.call(null,inst_42516,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_42520 = inst_42495;
var state_42593__$1 = (function (){var statearr_42644 = state_42593;
(statearr_42644[(16)] = inst_42518);

(statearr_42644[(7)] = inst_42520);

(statearr_42644[(17)] = inst_42519);

(statearr_42644[(18)] = inst_42517);

return statearr_42644;
})();
var statearr_42645_42699 = state_42593__$1;
(statearr_42645_42699[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (18))){
var inst_42535 = (state_42593[(2)]);
var state_42593__$1 = state_42593;
var statearr_42646_42700 = state_42593__$1;
(statearr_42646_42700[(2)] = inst_42535);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (37))){
var state_42593__$1 = state_42593;
var statearr_42647_42701 = state_42593__$1;
(statearr_42647_42701[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42594 === (8))){
var inst_42495 = (state_42593[(8)]);
var inst_42513 = cljs.core.apply.call(null,cljs.core.hash_map,inst_42495);
var state_42593__$1 = state_42593;
var statearr_42648_42702 = state_42593__$1;
(statearr_42648_42702[(2)] = inst_42513);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___42656,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
;
return ((function (switch__40760__auto__,c__40874__auto___42656,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){
return (function() {
var cljs$core$async$mix_$_state_machine__40761__auto__ = null;
var cljs$core$async$mix_$_state_machine__40761__auto____0 = (function (){
var statearr_42652 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_42652[(0)] = cljs$core$async$mix_$_state_machine__40761__auto__);

(statearr_42652[(1)] = (1));

return statearr_42652;
});
var cljs$core$async$mix_$_state_machine__40761__auto____1 = (function (state_42593){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_42593);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e42653){if((e42653 instanceof Object)){
var ex__40764__auto__ = e42653;
var statearr_42654_42703 = state_42593;
(statearr_42654_42703[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__42704 = state_42593;
state_42593 = G__42704;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__40761__auto__ = function(state_42593){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__40761__auto____1.call(this,state_42593);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mix_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__40761__auto____0;
cljs$core$async$mix_$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__40761__auto____1;
return cljs$core$async$mix_$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___42656,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m))
})();
var state__40876__auto__ = (function (){var statearr_42655 = f__40875__auto__.call(null);
(statearr_42655[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___42656);

return statearr_42655;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___42656,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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p,v,ch,close_QMARK_);
} else {
var m__24057__auto____$1 = (cljs.core.async.sub_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p,v,ch);
} else {
var m__24057__auto____$1 = (cljs.core.async.unsub_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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 args42705 = [];
var len__24559__auto___42708 = arguments.length;
var i__24560__auto___42709 = (0);
while(true){
if((i__24560__auto___42709 < len__24559__auto___42708)){
args42705.push((arguments[i__24560__auto___42709]));

var G__42710 = (i__24560__auto___42709 + (1));
i__24560__auto___42709 = G__42710;
continue;
} else {
}
break;
}

var G__42707 = args42705.length;
switch (G__42707) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args42705.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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p);
} else {
var m__24057__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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__24056__auto__ = (((p == null))?null:p);
var m__24057__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__24056__auto__)]);
if(!((m__24057__auto__ == null))){
return m__24057__auto__.call(null,p,v);
} else {
var m__24057__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]);
if(!((m__24057__auto____$1 == null))){
return m__24057__auto____$1.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 args42713 = [];
var len__24559__auto___42838 = arguments.length;
var i__24560__auto___42839 = (0);
while(true){
if((i__24560__auto___42839 < len__24559__auto___42838)){
args42713.push((arguments[i__24560__auto___42839]));

var G__42840 = (i__24560__auto___42839 + (1));
i__24560__auto___42839 = G__42840;
continue;
} else {
}
break;
}

var G__42715 = args42713.length;
switch (G__42715) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args42713.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__23338__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,mults),topic);
if(cljs.core.truth_(or__23338__auto__)){
return or__23338__auto__;
} else {
return cljs.core.get.call(null,cljs.core.swap_BANG_.call(null,mults,((function (or__23338__auto__,mults){
return (function (p1__42712_SHARP_){
if(cljs.core.truth_(p1__42712_SHARP_.call(null,topic))){
return p1__42712_SHARP_;
} else {
return cljs.core.assoc.call(null,p1__42712_SHARP_,topic,cljs.core.async.mult.call(null,cljs.core.async.chan.call(null,buf_fn.call(null,topic))));
}
});})(or__23338__auto__,mults))
),topic);
}
});})(mults))
;
var p = (function (){
if(typeof cljs.core.async.t_cljs$core$async42716 !== '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$async42716 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta42717){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta42717 = meta42717;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async42716.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (mults,ensure_mult){
return (function (_42718,meta42717__$1){
var self__ = this;
var _42718__$1 = this;
return (new cljs.core.async.t_cljs$core$async42716(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta42717__$1));
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async42716.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (mults,ensure_mult){
return (function (_42718){
var self__ = this;
var _42718__$1 = this;
return self__.meta42717;
});})(mults,ensure_mult))
;

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

cljs.core.async.t_cljs$core$async42716.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$async42716.prototype.cljs$core$async$Pub$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async42716.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$async42716.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__5278__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,self__.mults),topic);
if(cljs.core.truth_(temp__5278__auto__)){
var m = temp__5278__auto__;
return cljs.core.async.untap.call(null,m,ch__$1);
} else {
return null;
}
});})(mults,ensure_mult))
;

cljs.core.async.t_cljs$core$async42716.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$async42716.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$async42716.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,"meta42717","meta42717",-1897946694,null)], null);
});})(mults,ensure_mult))
;

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

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

cljs.core.async.t_cljs$core$async42716.cljs$lang$ctorPrWriter = ((function (mults,ensure_mult){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async42716");
});})(mults,ensure_mult))
;

cljs.core.async.__GT_t_cljs$core$async42716 = ((function (mults,ensure_mult){
return (function cljs$core$async$__GT_t_cljs$core$async42716(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta42717){
return (new cljs.core.async.t_cljs$core$async42716(ch__$1,topic_fn__$1,buf_fn__$1,mults__$1,ensure_mult__$1,meta42717));
});})(mults,ensure_mult))
;

}

return (new cljs.core.async.t_cljs$core$async42716(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
})()
;
var c__40874__auto___42842 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___42842,mults,ensure_mult,p){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___42842,mults,ensure_mult,p){
return (function (state_42790){
var state_val_42791 = (state_42790[(1)]);
if((state_val_42791 === (7))){
var inst_42786 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
var statearr_42792_42843 = state_42790__$1;
(statearr_42792_42843[(2)] = inst_42786);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (20))){
var state_42790__$1 = state_42790;
var statearr_42793_42844 = state_42790__$1;
(statearr_42793_42844[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (1))){
var state_42790__$1 = state_42790;
var statearr_42794_42845 = state_42790__$1;
(statearr_42794_42845[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (24))){
var inst_42769 = (state_42790[(7)]);
var inst_42778 = cljs.core.swap_BANG_.call(null,mults,cljs.core.dissoc,inst_42769);
var state_42790__$1 = state_42790;
var statearr_42795_42846 = state_42790__$1;
(statearr_42795_42846[(2)] = inst_42778);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (4))){
var inst_42721 = (state_42790[(8)]);
var inst_42721__$1 = (state_42790[(2)]);
var inst_42722 = (inst_42721__$1 == null);
var state_42790__$1 = (function (){var statearr_42796 = state_42790;
(statearr_42796[(8)] = inst_42721__$1);

return statearr_42796;
})();
if(cljs.core.truth_(inst_42722)){
var statearr_42797_42847 = state_42790__$1;
(statearr_42797_42847[(1)] = (5));

} else {
var statearr_42798_42848 = state_42790__$1;
(statearr_42798_42848[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (15))){
var inst_42763 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
var statearr_42799_42849 = state_42790__$1;
(statearr_42799_42849[(2)] = inst_42763);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (21))){
var inst_42783 = (state_42790[(2)]);
var state_42790__$1 = (function (){var statearr_42800 = state_42790;
(statearr_42800[(9)] = inst_42783);

return statearr_42800;
})();
var statearr_42801_42850 = state_42790__$1;
(statearr_42801_42850[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (13))){
var inst_42745 = (state_42790[(10)]);
var inst_42747 = cljs.core.chunked_seq_QMARK_.call(null,inst_42745);
var state_42790__$1 = state_42790;
if(inst_42747){
var statearr_42802_42851 = state_42790__$1;
(statearr_42802_42851[(1)] = (16));

} else {
var statearr_42803_42852 = state_42790__$1;
(statearr_42803_42852[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (22))){
var inst_42775 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
if(cljs.core.truth_(inst_42775)){
var statearr_42804_42853 = state_42790__$1;
(statearr_42804_42853[(1)] = (23));

} else {
var statearr_42805_42854 = state_42790__$1;
(statearr_42805_42854[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (6))){
var inst_42769 = (state_42790[(7)]);
var inst_42771 = (state_42790[(11)]);
var inst_42721 = (state_42790[(8)]);
var inst_42769__$1 = topic_fn.call(null,inst_42721);
var inst_42770 = cljs.core.deref.call(null,mults);
var inst_42771__$1 = cljs.core.get.call(null,inst_42770,inst_42769__$1);
var state_42790__$1 = (function (){var statearr_42806 = state_42790;
(statearr_42806[(7)] = inst_42769__$1);

(statearr_42806[(11)] = inst_42771__$1);

return statearr_42806;
})();
if(cljs.core.truth_(inst_42771__$1)){
var statearr_42807_42855 = state_42790__$1;
(statearr_42807_42855[(1)] = (19));

} else {
var statearr_42808_42856 = state_42790__$1;
(statearr_42808_42856[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (25))){
var inst_42780 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
var statearr_42809_42857 = state_42790__$1;
(statearr_42809_42857[(2)] = inst_42780);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (17))){
var inst_42745 = (state_42790[(10)]);
var inst_42754 = cljs.core.first.call(null,inst_42745);
var inst_42755 = cljs.core.async.muxch_STAR_.call(null,inst_42754);
var inst_42756 = cljs.core.async.close_BANG_.call(null,inst_42755);
var inst_42757 = cljs.core.next.call(null,inst_42745);
var inst_42731 = inst_42757;
var inst_42732 = null;
var inst_42733 = (0);
var inst_42734 = (0);
var state_42790__$1 = (function (){var statearr_42810 = state_42790;
(statearr_42810[(12)] = inst_42733);

(statearr_42810[(13)] = inst_42756);

(statearr_42810[(14)] = inst_42732);

(statearr_42810[(15)] = inst_42731);

(statearr_42810[(16)] = inst_42734);

return statearr_42810;
})();
var statearr_42811_42858 = state_42790__$1;
(statearr_42811_42858[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (3))){
var inst_42788 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_42790__$1,inst_42788);
} else {
if((state_val_42791 === (12))){
var inst_42765 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
var statearr_42812_42859 = state_42790__$1;
(statearr_42812_42859[(2)] = inst_42765);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (19))){
var inst_42771 = (state_42790[(11)]);
var inst_42721 = (state_42790[(8)]);
var inst_42773 = cljs.core.async.muxch_STAR_.call(null,inst_42771);
var state_42790__$1 = state_42790;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_42790__$1,(22),inst_42773,inst_42721);
} else {
if((state_val_42791 === (11))){
var inst_42745 = (state_42790[(10)]);
var inst_42731 = (state_42790[(15)]);
var inst_42745__$1 = cljs.core.seq.call(null,inst_42731);
var state_42790__$1 = (function (){var statearr_42814 = state_42790;
(statearr_42814[(10)] = inst_42745__$1);

return statearr_42814;
})();
if(inst_42745__$1){
var statearr_42815_42861 = state_42790__$1;
(statearr_42815_42861[(1)] = (13));

} else {
var statearr_42816_42862 = state_42790__$1;
(statearr_42816_42862[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (9))){
var inst_42767 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
var statearr_42817_42863 = state_42790__$1;
(statearr_42817_42863[(2)] = inst_42767);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (5))){
var inst_42728 = cljs.core.deref.call(null,mults);
var inst_42729 = cljs.core.vals.call(null,inst_42728);
var inst_42730 = cljs.core.seq.call(null,inst_42729);
var inst_42731 = inst_42730;
var inst_42732 = null;
var inst_42733 = (0);
var inst_42734 = (0);
var state_42790__$1 = (function (){var statearr_42818 = state_42790;
(statearr_42818[(12)] = inst_42733);

(statearr_42818[(14)] = inst_42732);

(statearr_42818[(15)] = inst_42731);

(statearr_42818[(16)] = inst_42734);

return statearr_42818;
})();
var statearr_42819_42864 = state_42790__$1;
(statearr_42819_42864[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (14))){
var state_42790__$1 = state_42790;
var statearr_42823_42865 = state_42790__$1;
(statearr_42823_42865[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (16))){
var inst_42745 = (state_42790[(10)]);
var inst_42749 = cljs.core.chunk_first.call(null,inst_42745);
var inst_42750 = cljs.core.chunk_rest.call(null,inst_42745);
var inst_42751 = cljs.core.count.call(null,inst_42749);
var inst_42731 = inst_42750;
var inst_42732 = inst_42749;
var inst_42733 = inst_42751;
var inst_42734 = (0);
var state_42790__$1 = (function (){var statearr_42824 = state_42790;
(statearr_42824[(12)] = inst_42733);

(statearr_42824[(14)] = inst_42732);

(statearr_42824[(15)] = inst_42731);

(statearr_42824[(16)] = inst_42734);

return statearr_42824;
})();
var statearr_42825_42866 = state_42790__$1;
(statearr_42825_42866[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (10))){
var inst_42733 = (state_42790[(12)]);
var inst_42732 = (state_42790[(14)]);
var inst_42731 = (state_42790[(15)]);
var inst_42734 = (state_42790[(16)]);
var inst_42739 = cljs.core._nth.call(null,inst_42732,inst_42734);
var inst_42740 = cljs.core.async.muxch_STAR_.call(null,inst_42739);
var inst_42741 = cljs.core.async.close_BANG_.call(null,inst_42740);
var inst_42742 = (inst_42734 + (1));
var tmp42820 = inst_42733;
var tmp42821 = inst_42732;
var tmp42822 = inst_42731;
var inst_42731__$1 = tmp42822;
var inst_42732__$1 = tmp42821;
var inst_42733__$1 = tmp42820;
var inst_42734__$1 = inst_42742;
var state_42790__$1 = (function (){var statearr_42826 = state_42790;
(statearr_42826[(12)] = inst_42733__$1);

(statearr_42826[(14)] = inst_42732__$1);

(statearr_42826[(15)] = inst_42731__$1);

(statearr_42826[(17)] = inst_42741);

(statearr_42826[(16)] = inst_42734__$1);

return statearr_42826;
})();
var statearr_42827_42867 = state_42790__$1;
(statearr_42827_42867[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (18))){
var inst_42760 = (state_42790[(2)]);
var state_42790__$1 = state_42790;
var statearr_42828_42868 = state_42790__$1;
(statearr_42828_42868[(2)] = inst_42760);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42791 === (8))){
var inst_42733 = (state_42790[(12)]);
var inst_42734 = (state_42790[(16)]);
var inst_42736 = (inst_42734 < inst_42733);
var inst_42737 = inst_42736;
var state_42790__$1 = state_42790;
if(cljs.core.truth_(inst_42737)){
var statearr_42829_42869 = state_42790__$1;
(statearr_42829_42869[(1)] = (10));

} else {
var statearr_42830_42870 = state_42790__$1;
(statearr_42830_42870[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___42842,mults,ensure_mult,p))
;
return ((function (switch__40760__auto__,c__40874__auto___42842,mults,ensure_mult,p){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_42834 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_42834[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_42834[(1)] = (1));

return statearr_42834;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_42790){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_42790);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e42835){if((e42835 instanceof Object)){
var ex__40764__auto__ = e42835;
var statearr_42836_42871 = state_42790;
(statearr_42836_42871[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__42872 = state_42790;
state_42790 = G__42872;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_42790){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_42790);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___42842,mults,ensure_mult,p))
})();
var state__40876__auto__ = (function (){var statearr_42837 = f__40875__auto__.call(null);
(statearr_42837[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___42842);

return statearr_42837;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___42842,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 args42873 = [];
var len__24559__auto___42876 = arguments.length;
var i__24560__auto___42877 = (0);
while(true){
if((i__24560__auto___42877 < len__24559__auto___42876)){
args42873.push((arguments[i__24560__auto___42877]));

var G__42878 = (i__24560__auto___42877 + (1));
i__24560__auto___42877 = G__42878;
continue;
} else {
}
break;
}

var G__42875 = args42873.length;
switch (G__42875) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args42873.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 args42880 = [];
var len__24559__auto___42883 = arguments.length;
var i__24560__auto___42884 = (0);
while(true){
if((i__24560__auto___42884 < len__24559__auto___42883)){
args42880.push((arguments[i__24560__auto___42884]));

var G__42885 = (i__24560__auto___42884 + (1));
i__24560__auto___42884 = G__42885;
continue;
} else {
}
break;
}

var G__42882 = args42880.length;
switch (G__42882) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args42880.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 args42887 = [];
var len__24559__auto___42958 = arguments.length;
var i__24560__auto___42959 = (0);
while(true){
if((i__24560__auto___42959 < len__24559__auto___42958)){
args42887.push((arguments[i__24560__auto___42959]));

var G__42960 = (i__24560__auto___42959 + (1));
i__24560__auto___42959 = G__42960;
continue;
} else {
}
break;
}

var G__42889 = args42887.length;
switch (G__42889) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args42887.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__40874__auto___42962 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___42962,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___42962,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function (state_42928){
var state_val_42929 = (state_42928[(1)]);
if((state_val_42929 === (7))){
var state_42928__$1 = state_42928;
var statearr_42930_42963 = state_42928__$1;
(statearr_42930_42963[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (1))){
var state_42928__$1 = state_42928;
var statearr_42931_42964 = state_42928__$1;
(statearr_42931_42964[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (4))){
var inst_42892 = (state_42928[(7)]);
var inst_42894 = (inst_42892 < cnt);
var state_42928__$1 = state_42928;
if(cljs.core.truth_(inst_42894)){
var statearr_42932_42965 = state_42928__$1;
(statearr_42932_42965[(1)] = (6));

} else {
var statearr_42933_42966 = state_42928__$1;
(statearr_42933_42966[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (15))){
var inst_42924 = (state_42928[(2)]);
var state_42928__$1 = state_42928;
var statearr_42934_42967 = state_42928__$1;
(statearr_42934_42967[(2)] = inst_42924);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (13))){
var inst_42917 = cljs.core.async.close_BANG_.call(null,out);
var state_42928__$1 = state_42928;
var statearr_42935_42968 = state_42928__$1;
(statearr_42935_42968[(2)] = inst_42917);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (6))){
var state_42928__$1 = state_42928;
var statearr_42936_42969 = state_42928__$1;
(statearr_42936_42969[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (3))){
var inst_42926 = (state_42928[(2)]);
var state_42928__$1 = state_42928;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_42928__$1,inst_42926);
} else {
if((state_val_42929 === (12))){
var inst_42914 = (state_42928[(8)]);
var inst_42914__$1 = (state_42928[(2)]);
var inst_42915 = cljs.core.some.call(null,cljs.core.nil_QMARK_,inst_42914__$1);
var state_42928__$1 = (function (){var statearr_42937 = state_42928;
(statearr_42937[(8)] = inst_42914__$1);

return statearr_42937;
})();
if(cljs.core.truth_(inst_42915)){
var statearr_42938_42970 = state_42928__$1;
(statearr_42938_42970[(1)] = (13));

} else {
var statearr_42939_42971 = state_42928__$1;
(statearr_42939_42971[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (2))){
var inst_42891 = cljs.core.reset_BANG_.call(null,dctr,cnt);
var inst_42892 = (0);
var state_42928__$1 = (function (){var statearr_42940 = state_42928;
(statearr_42940[(7)] = inst_42892);

(statearr_42940[(9)] = inst_42891);

return statearr_42940;
})();
var statearr_42941_42972 = state_42928__$1;
(statearr_42941_42972[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (11))){
var inst_42892 = (state_42928[(7)]);
var _ = cljs.core.async.impl.ioc_helpers.add_exception_frame.call(null,state_42928,(10),Object,null,(9));
var inst_42901 = chs__$1.call(null,inst_42892);
var inst_42902 = done.call(null,inst_42892);
var inst_42903 = cljs.core.async.take_BANG_.call(null,inst_42901,inst_42902);
var state_42928__$1 = state_42928;
var statearr_42942_42973 = state_42928__$1;
(statearr_42942_42973[(2)] = inst_42903);


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

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (9))){
var inst_42892 = (state_42928[(7)]);
var inst_42905 = (state_42928[(2)]);
var inst_42906 = (inst_42892 + (1));
var inst_42892__$1 = inst_42906;
var state_42928__$1 = (function (){var statearr_42943 = state_42928;
(statearr_42943[(10)] = inst_42905);

(statearr_42943[(7)] = inst_42892__$1);

return statearr_42943;
})();
var statearr_42944_42974 = state_42928__$1;
(statearr_42944_42974[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (5))){
var inst_42912 = (state_42928[(2)]);
var state_42928__$1 = (function (){var statearr_42945 = state_42928;
(statearr_42945[(11)] = inst_42912);

return statearr_42945;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_42928__$1,(12),dchan);
} else {
if((state_val_42929 === (14))){
var inst_42914 = (state_42928[(8)]);
var inst_42919 = cljs.core.apply.call(null,f,inst_42914);
var state_42928__$1 = state_42928;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_42928__$1,(16),out,inst_42919);
} else {
if((state_val_42929 === (16))){
var inst_42921 = (state_42928[(2)]);
var state_42928__$1 = (function (){var statearr_42946 = state_42928;
(statearr_42946[(12)] = inst_42921);

return statearr_42946;
})();
var statearr_42947_42975 = state_42928__$1;
(statearr_42947_42975[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (10))){
var inst_42896 = (state_42928[(2)]);
var inst_42897 = cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec);
var state_42928__$1 = (function (){var statearr_42948 = state_42928;
(statearr_42948[(13)] = inst_42896);

return statearr_42948;
})();
var statearr_42949_42976 = state_42928__$1;
(statearr_42949_42976[(2)] = inst_42897);


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

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_42929 === (8))){
var inst_42910 = (state_42928[(2)]);
var state_42928__$1 = state_42928;
var statearr_42950_42977 = state_42928__$1;
(statearr_42950_42977[(2)] = inst_42910);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___42962,chs__$1,out,cnt,rets,dchan,dctr,done))
;
return ((function (switch__40760__auto__,c__40874__auto___42962,chs__$1,out,cnt,rets,dchan,dctr,done){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_42954 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_42954[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_42954[(1)] = (1));

return statearr_42954;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_42928){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_42928);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e42955){if((e42955 instanceof Object)){
var ex__40764__auto__ = e42955;
var statearr_42956_42978 = state_42928;
(statearr_42956_42978[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__42979 = state_42928;
state_42928 = G__42979;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_42928){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_42928);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___42962,chs__$1,out,cnt,rets,dchan,dctr,done))
})();
var state__40876__auto__ = (function (){var statearr_42957 = f__40875__auto__.call(null);
(statearr_42957[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___42962);

return statearr_42957;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___42962,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 args42981 = [];
var len__24559__auto___43039 = arguments.length;
var i__24560__auto___43040 = (0);
while(true){
if((i__24560__auto___43040 < len__24559__auto___43039)){
args42981.push((arguments[i__24560__auto___43040]));

var G__43041 = (i__24560__auto___43040 + (1));
i__24560__auto___43040 = G__43041;
continue;
} else {
}
break;
}

var G__42983 = args42981.length;
switch (G__42983) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args42981.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__40874__auto___43043 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___43043,out){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___43043,out){
return (function (state_43015){
var state_val_43016 = (state_43015[(1)]);
if((state_val_43016 === (7))){
var inst_42994 = (state_43015[(7)]);
var inst_42995 = (state_43015[(8)]);
var inst_42994__$1 = (state_43015[(2)]);
var inst_42995__$1 = cljs.core.nth.call(null,inst_42994__$1,(0),null);
var inst_42996 = cljs.core.nth.call(null,inst_42994__$1,(1),null);
var inst_42997 = (inst_42995__$1 == null);
var state_43015__$1 = (function (){var statearr_43017 = state_43015;
(statearr_43017[(7)] = inst_42994__$1);

(statearr_43017[(9)] = inst_42996);

(statearr_43017[(8)] = inst_42995__$1);

return statearr_43017;
})();
if(cljs.core.truth_(inst_42997)){
var statearr_43018_43044 = state_43015__$1;
(statearr_43018_43044[(1)] = (8));

} else {
var statearr_43019_43045 = state_43015__$1;
(statearr_43019_43045[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43016 === (1))){
var inst_42984 = cljs.core.vec.call(null,chs);
var inst_42985 = inst_42984;
var state_43015__$1 = (function (){var statearr_43020 = state_43015;
(statearr_43020[(10)] = inst_42985);

return statearr_43020;
})();
var statearr_43021_43046 = state_43015__$1;
(statearr_43021_43046[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43016 === (4))){
var inst_42985 = (state_43015[(10)]);
var state_43015__$1 = state_43015;
return cljs.core.async.ioc_alts_BANG_.call(null,state_43015__$1,(7),inst_42985);
} else {
if((state_val_43016 === (6))){
var inst_43011 = (state_43015[(2)]);
var state_43015__$1 = state_43015;
var statearr_43022_43047 = state_43015__$1;
(statearr_43022_43047[(2)] = inst_43011);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43016 === (3))){
var inst_43013 = (state_43015[(2)]);
var state_43015__$1 = state_43015;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_43015__$1,inst_43013);
} else {
if((state_val_43016 === (2))){
var inst_42985 = (state_43015[(10)]);
var inst_42987 = cljs.core.count.call(null,inst_42985);
var inst_42988 = (inst_42987 > (0));
var state_43015__$1 = state_43015;
if(cljs.core.truth_(inst_42988)){
var statearr_43024_43048 = state_43015__$1;
(statearr_43024_43048[(1)] = (4));

} else {
var statearr_43025_43049 = state_43015__$1;
(statearr_43025_43049[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43016 === (11))){
var inst_42985 = (state_43015[(10)]);
var inst_43004 = (state_43015[(2)]);
var tmp43023 = inst_42985;
var inst_42985__$1 = tmp43023;
var state_43015__$1 = (function (){var statearr_43026 = state_43015;
(statearr_43026[(10)] = inst_42985__$1);

(statearr_43026[(11)] = inst_43004);

return statearr_43026;
})();
var statearr_43027_43050 = state_43015__$1;
(statearr_43027_43050[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43016 === (9))){
var inst_42995 = (state_43015[(8)]);
var state_43015__$1 = state_43015;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43015__$1,(11),out,inst_42995);
} else {
if((state_val_43016 === (5))){
var inst_43009 = cljs.core.async.close_BANG_.call(null,out);
var state_43015__$1 = state_43015;
var statearr_43028_43051 = state_43015__$1;
(statearr_43028_43051[(2)] = inst_43009);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43016 === (10))){
var inst_43007 = (state_43015[(2)]);
var state_43015__$1 = state_43015;
var statearr_43029_43052 = state_43015__$1;
(statearr_43029_43052[(2)] = inst_43007);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43016 === (8))){
var inst_42994 = (state_43015[(7)]);
var inst_42985 = (state_43015[(10)]);
var inst_42996 = (state_43015[(9)]);
var inst_42995 = (state_43015[(8)]);
var inst_42999 = (function (){var cs = inst_42985;
var vec__42990 = inst_42994;
var v = inst_42995;
var c = inst_42996;
return ((function (cs,vec__42990,v,c,inst_42994,inst_42985,inst_42996,inst_42995,state_val_43016,c__40874__auto___43043,out){
return (function (p1__42980_SHARP_){
return cljs.core.not_EQ_.call(null,c,p1__42980_SHARP_);
});
;})(cs,vec__42990,v,c,inst_42994,inst_42985,inst_42996,inst_42995,state_val_43016,c__40874__auto___43043,out))
})();
var inst_43000 = cljs.core.filterv.call(null,inst_42999,inst_42985);
var inst_42985__$1 = inst_43000;
var state_43015__$1 = (function (){var statearr_43030 = state_43015;
(statearr_43030[(10)] = inst_42985__$1);

return statearr_43030;
})();
var statearr_43031_43053 = state_43015__$1;
(statearr_43031_43053[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___43043,out))
;
return ((function (switch__40760__auto__,c__40874__auto___43043,out){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_43035 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_43035[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_43035[(1)] = (1));

return statearr_43035;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_43015){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_43015);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e43036){if((e43036 instanceof Object)){
var ex__40764__auto__ = e43036;
var statearr_43037_43054 = state_43015;
(statearr_43037_43054[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__43055 = state_43015;
state_43015 = G__43055;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_43015){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_43015);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___43043,out))
})();
var state__40876__auto__ = (function (){var statearr_43038 = f__40875__auto__.call(null);
(statearr_43038[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___43043);

return statearr_43038;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___43043,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 args43056 = [];
var len__24559__auto___43105 = arguments.length;
var i__24560__auto___43106 = (0);
while(true){
if((i__24560__auto___43106 < len__24559__auto___43105)){
args43056.push((arguments[i__24560__auto___43106]));

var G__43107 = (i__24560__auto___43106 + (1));
i__24560__auto___43106 = G__43107;
continue;
} else {
}
break;
}

var G__43058 = args43056.length;
switch (G__43058) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43056.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__40874__auto___43109 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___43109,out){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___43109,out){
return (function (state_43082){
var state_val_43083 = (state_43082[(1)]);
if((state_val_43083 === (7))){
var inst_43064 = (state_43082[(7)]);
var inst_43064__$1 = (state_43082[(2)]);
var inst_43065 = (inst_43064__$1 == null);
var inst_43066 = cljs.core.not.call(null,inst_43065);
var state_43082__$1 = (function (){var statearr_43084 = state_43082;
(statearr_43084[(7)] = inst_43064__$1);

return statearr_43084;
})();
if(inst_43066){
var statearr_43085_43110 = state_43082__$1;
(statearr_43085_43110[(1)] = (8));

} else {
var statearr_43086_43111 = state_43082__$1;
(statearr_43086_43111[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (1))){
var inst_43059 = (0);
var state_43082__$1 = (function (){var statearr_43087 = state_43082;
(statearr_43087[(8)] = inst_43059);

return statearr_43087;
})();
var statearr_43088_43112 = state_43082__$1;
(statearr_43088_43112[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (4))){
var state_43082__$1 = state_43082;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_43082__$1,(7),ch);
} else {
if((state_val_43083 === (6))){
var inst_43077 = (state_43082[(2)]);
var state_43082__$1 = state_43082;
var statearr_43089_43113 = state_43082__$1;
(statearr_43089_43113[(2)] = inst_43077);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (3))){
var inst_43079 = (state_43082[(2)]);
var inst_43080 = cljs.core.async.close_BANG_.call(null,out);
var state_43082__$1 = (function (){var statearr_43090 = state_43082;
(statearr_43090[(9)] = inst_43079);

return statearr_43090;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_43082__$1,inst_43080);
} else {
if((state_val_43083 === (2))){
var inst_43059 = (state_43082[(8)]);
var inst_43061 = (inst_43059 < n);
var state_43082__$1 = state_43082;
if(cljs.core.truth_(inst_43061)){
var statearr_43091_43114 = state_43082__$1;
(statearr_43091_43114[(1)] = (4));

} else {
var statearr_43092_43115 = state_43082__$1;
(statearr_43092_43115[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (11))){
var inst_43059 = (state_43082[(8)]);
var inst_43069 = (state_43082[(2)]);
var inst_43070 = (inst_43059 + (1));
var inst_43059__$1 = inst_43070;
var state_43082__$1 = (function (){var statearr_43093 = state_43082;
(statearr_43093[(10)] = inst_43069);

(statearr_43093[(8)] = inst_43059__$1);

return statearr_43093;
})();
var statearr_43094_43116 = state_43082__$1;
(statearr_43094_43116[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (9))){
var state_43082__$1 = state_43082;
var statearr_43095_43117 = state_43082__$1;
(statearr_43095_43117[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (5))){
var state_43082__$1 = state_43082;
var statearr_43096_43118 = state_43082__$1;
(statearr_43096_43118[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (10))){
var inst_43074 = (state_43082[(2)]);
var state_43082__$1 = state_43082;
var statearr_43097_43119 = state_43082__$1;
(statearr_43097_43119[(2)] = inst_43074);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43083 === (8))){
var inst_43064 = (state_43082[(7)]);
var state_43082__$1 = state_43082;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43082__$1,(11),out,inst_43064);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___43109,out))
;
return ((function (switch__40760__auto__,c__40874__auto___43109,out){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_43101 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_43101[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_43101[(1)] = (1));

return statearr_43101;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_43082){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_43082);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e43102){if((e43102 instanceof Object)){
var ex__40764__auto__ = e43102;
var statearr_43103_43120 = state_43082;
(statearr_43103_43120[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__43121 = state_43082;
state_43082 = G__43121;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_43082){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_43082);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___43109,out))
})();
var state__40876__auto__ = (function (){var statearr_43104 = f__40875__auto__.call(null);
(statearr_43104[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___43109);

return statearr_43104;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___43109,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.core.async.t_cljs$core$async43129 !== '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$async43129 = (function (f,ch,meta43130){
this.f = f;
this.ch = ch;
this.meta43130 = meta43130;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async43129.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_43131,meta43130__$1){
var self__ = this;
var _43131__$1 = this;
return (new cljs.core.async.t_cljs$core$async43129(self__.f,self__.ch,meta43130__$1));
});

cljs.core.async.t_cljs$core$async43129.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_43131){
var self__ = this;
var _43131__$1 = this;
return self__.meta43130;
});

cljs.core.async.t_cljs$core$async43129.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43129.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$async43129.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$async43129.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43129.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.core.async.t_cljs$core$async43132 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async43132 = (function (f,ch,meta43130,_,fn1,meta43133){
this.f = f;
this.ch = ch;
this.meta43130 = meta43130;
this._ = _;
this.fn1 = fn1;
this.meta43133 = meta43133;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async43132.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (___$1){
return (function (_43134,meta43133__$1){
var self__ = this;
var _43134__$1 = this;
return (new cljs.core.async.t_cljs$core$async43132(self__.f,self__.ch,self__.meta43130,self__._,self__.fn1,meta43133__$1));
});})(___$1))
;

cljs.core.async.t_cljs$core$async43132.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (___$1){
return (function (_43134){
var self__ = this;
var _43134__$1 = this;
return self__.meta43133;
});})(___$1))
;

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

cljs.core.async.t_cljs$core$async43132.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$async43132.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$async43132.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__43122_SHARP_){
return f1.call(null,(((p1__43122_SHARP_ == null))?null:self__.f.call(null,p1__43122_SHARP_)));
});
;})(f1,___$2,___$1))
});})(___$1))
;

cljs.core.async.t_cljs$core$async43132.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,"meta43130","meta43130",1056327947,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$async43129","cljs.core.async/t_cljs$core$async43129",1790282290,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta43133","meta43133",-1969071316,null)], null);
});})(___$1))
;

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

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

cljs.core.async.t_cljs$core$async43132.cljs$lang$ctorPrWriter = ((function (___$1){
return (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async43132");
});})(___$1))
;

cljs.core.async.__GT_t_cljs$core$async43132 = ((function (___$1){
return (function cljs$core$async$map_LT__$___GT_t_cljs$core$async43132(f__$1,ch__$1,meta43130__$1,___$2,fn1__$1,meta43133){
return (new cljs.core.async.t_cljs$core$async43132(f__$1,ch__$1,meta43130__$1,___$2,fn1__$1,meta43133));
});})(___$1))
;

}

return (new cljs.core.async.t_cljs$core$async43132(self__.f,self__.ch,self__.meta43130,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY));
})()
);
if(cljs.core.truth_((function (){var and__23326__auto__ = ret;
if(cljs.core.truth_(and__23326__auto__)){
return !((cljs.core.deref.call(null,ret) == null));
} else {
return and__23326__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$async43129.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43129.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$async43129.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,"meta43130","meta43130",1056327947,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async43129.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async43129");
});

cljs.core.async.__GT_t_cljs$core$async43129 = (function cljs$core$async$map_LT__$___GT_t_cljs$core$async43129(f__$1,ch__$1,meta43130){
return (new cljs.core.async.t_cljs$core$async43129(f__$1,ch__$1,meta43130));
});

}

return (new cljs.core.async.t_cljs$core$async43129(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.core.async.t_cljs$core$async43138 !== '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$async43138 = (function (f,ch,meta43139){
this.f = f;
this.ch = ch;
this.meta43139 = meta43139;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async43138.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_43140,meta43139__$1){
var self__ = this;
var _43140__$1 = this;
return (new cljs.core.async.t_cljs$core$async43138(self__.f,self__.ch,meta43139__$1));
});

cljs.core.async.t_cljs$core$async43138.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_43140){
var self__ = this;
var _43140__$1 = this;
return self__.meta43139;
});

cljs.core.async.t_cljs$core$async43138.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43138.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$async43138.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43138.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$async43138.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43138.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$async43138.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,"meta43139","meta43139",-93038135,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async43138.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async43138");
});

cljs.core.async.__GT_t_cljs$core$async43138 = (function cljs$core$async$map_GT__$___GT_t_cljs$core$async43138(f__$1,ch__$1,meta43139){
return (new cljs.core.async.t_cljs$core$async43138(f__$1,ch__$1,meta43139));
});

}

return (new cljs.core.async.t_cljs$core$async43138(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.core.async.t_cljs$core$async43144 !== '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$async43144 = (function (p,ch,meta43145){
this.p = p;
this.ch = ch;
this.meta43145 = meta43145;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.t_cljs$core$async43144.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_43146,meta43145__$1){
var self__ = this;
var _43146__$1 = this;
return (new cljs.core.async.t_cljs$core$async43144(self__.p,self__.ch,meta43145__$1));
});

cljs.core.async.t_cljs$core$async43144.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_43146){
var self__ = this;
var _43146__$1 = this;
return self__.meta43145;
});

cljs.core.async.t_cljs$core$async43144.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43144.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$async43144.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$async43144.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43144.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$async43144.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL;

cljs.core.async.t_cljs$core$async43144.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$async43144.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,"meta43145","meta43145",-1551591300,null)], null);
});

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

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

cljs.core.async.t_cljs$core$async43144.cljs$lang$ctorPrWriter = (function (this__23995__auto__,writer__23996__auto__,opt__23997__auto__){
return cljs.core._write.call(null,writer__23996__auto__,"cljs.core.async/t_cljs$core$async43144");
});

cljs.core.async.__GT_t_cljs$core$async43144 = (function cljs$core$async$filter_GT__$___GT_t_cljs$core$async43144(p__$1,ch__$1,meta43145){
return (new cljs.core.async.t_cljs$core$async43144(p__$1,ch__$1,meta43145));
});

}

return (new cljs.core.async.t_cljs$core$async43144(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 args43147 = [];
var len__24559__auto___43191 = arguments.length;
var i__24560__auto___43192 = (0);
while(true){
if((i__24560__auto___43192 < len__24559__auto___43191)){
args43147.push((arguments[i__24560__auto___43192]));

var G__43193 = (i__24560__auto___43192 + (1));
i__24560__auto___43192 = G__43193;
continue;
} else {
}
break;
}

var G__43149 = args43147.length;
switch (G__43149) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43147.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__40874__auto___43195 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___43195,out){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___43195,out){
return (function (state_43170){
var state_val_43171 = (state_43170[(1)]);
if((state_val_43171 === (7))){
var inst_43166 = (state_43170[(2)]);
var state_43170__$1 = state_43170;
var statearr_43172_43196 = state_43170__$1;
(statearr_43172_43196[(2)] = inst_43166);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (1))){
var state_43170__$1 = state_43170;
var statearr_43173_43197 = state_43170__$1;
(statearr_43173_43197[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (4))){
var inst_43152 = (state_43170[(7)]);
var inst_43152__$1 = (state_43170[(2)]);
var inst_43153 = (inst_43152__$1 == null);
var state_43170__$1 = (function (){var statearr_43174 = state_43170;
(statearr_43174[(7)] = inst_43152__$1);

return statearr_43174;
})();
if(cljs.core.truth_(inst_43153)){
var statearr_43175_43198 = state_43170__$1;
(statearr_43175_43198[(1)] = (5));

} else {
var statearr_43176_43199 = state_43170__$1;
(statearr_43176_43199[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (6))){
var inst_43152 = (state_43170[(7)]);
var inst_43157 = p.call(null,inst_43152);
var state_43170__$1 = state_43170;
if(cljs.core.truth_(inst_43157)){
var statearr_43177_43200 = state_43170__$1;
(statearr_43177_43200[(1)] = (8));

} else {
var statearr_43178_43201 = state_43170__$1;
(statearr_43178_43201[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (3))){
var inst_43168 = (state_43170[(2)]);
var state_43170__$1 = state_43170;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_43170__$1,inst_43168);
} else {
if((state_val_43171 === (2))){
var state_43170__$1 = state_43170;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_43170__$1,(4),ch);
} else {
if((state_val_43171 === (11))){
var inst_43160 = (state_43170[(2)]);
var state_43170__$1 = state_43170;
var statearr_43179_43202 = state_43170__$1;
(statearr_43179_43202[(2)] = inst_43160);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (9))){
var state_43170__$1 = state_43170;
var statearr_43180_43203 = state_43170__$1;
(statearr_43180_43203[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (5))){
var inst_43155 = cljs.core.async.close_BANG_.call(null,out);
var state_43170__$1 = state_43170;
var statearr_43181_43204 = state_43170__$1;
(statearr_43181_43204[(2)] = inst_43155);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (10))){
var inst_43163 = (state_43170[(2)]);
var state_43170__$1 = (function (){var statearr_43182 = state_43170;
(statearr_43182[(8)] = inst_43163);

return statearr_43182;
})();
var statearr_43183_43205 = state_43170__$1;
(statearr_43183_43205[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43171 === (8))){
var inst_43152 = (state_43170[(7)]);
var state_43170__$1 = state_43170;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43170__$1,(11),out,inst_43152);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___43195,out))
;
return ((function (switch__40760__auto__,c__40874__auto___43195,out){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_43187 = [null,null,null,null,null,null,null,null,null];
(statearr_43187[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_43187[(1)] = (1));

return statearr_43187;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_43170){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_43170);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e43188){if((e43188 instanceof Object)){
var ex__40764__auto__ = e43188;
var statearr_43189_43206 = state_43170;
(statearr_43189_43206[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__43207 = state_43170;
state_43170 = G__43207;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_43170){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_43170);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___43195,out))
})();
var state__40876__auto__ = (function (){var statearr_43190 = f__40875__auto__.call(null);
(statearr_43190[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___43195);

return statearr_43190;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___43195,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 args43208 = [];
var len__24559__auto___43211 = arguments.length;
var i__24560__auto___43212 = (0);
while(true){
if((i__24560__auto___43212 < len__24559__auto___43211)){
args43208.push((arguments[i__24560__auto___43212]));

var G__43213 = (i__24560__auto___43212 + (1));
i__24560__auto___43212 = G__43213;
continue;
} else {
}
break;
}

var G__43210 = args43208.length;
switch (G__43210) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43208.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__40874__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto__){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto__){
return (function (state_43380){
var state_val_43381 = (state_43380[(1)]);
if((state_val_43381 === (7))){
var inst_43376 = (state_43380[(2)]);
var state_43380__$1 = state_43380;
var statearr_43382_43423 = state_43380__$1;
(statearr_43382_43423[(2)] = inst_43376);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (20))){
var inst_43346 = (state_43380[(7)]);
var inst_43357 = (state_43380[(2)]);
var inst_43358 = cljs.core.next.call(null,inst_43346);
var inst_43332 = inst_43358;
var inst_43333 = null;
var inst_43334 = (0);
var inst_43335 = (0);
var state_43380__$1 = (function (){var statearr_43383 = state_43380;
(statearr_43383[(8)] = inst_43335);

(statearr_43383[(9)] = inst_43334);

(statearr_43383[(10)] = inst_43357);

(statearr_43383[(11)] = inst_43333);

(statearr_43383[(12)] = inst_43332);

return statearr_43383;
})();
var statearr_43384_43424 = state_43380__$1;
(statearr_43384_43424[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (1))){
var state_43380__$1 = state_43380;
var statearr_43385_43425 = state_43380__$1;
(statearr_43385_43425[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (4))){
var inst_43321 = (state_43380[(13)]);
var inst_43321__$1 = (state_43380[(2)]);
var inst_43322 = (inst_43321__$1 == null);
var state_43380__$1 = (function (){var statearr_43386 = state_43380;
(statearr_43386[(13)] = inst_43321__$1);

return statearr_43386;
})();
if(cljs.core.truth_(inst_43322)){
var statearr_43387_43426 = state_43380__$1;
(statearr_43387_43426[(1)] = (5));

} else {
var statearr_43388_43427 = state_43380__$1;
(statearr_43388_43427[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (15))){
var state_43380__$1 = state_43380;
var statearr_43392_43428 = state_43380__$1;
(statearr_43392_43428[(2)] = null);

(statearr_43392_43428[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (21))){
var state_43380__$1 = state_43380;
var statearr_43393_43429 = state_43380__$1;
(statearr_43393_43429[(2)] = null);

(statearr_43393_43429[(1)] = (23));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (13))){
var inst_43335 = (state_43380[(8)]);
var inst_43334 = (state_43380[(9)]);
var inst_43333 = (state_43380[(11)]);
var inst_43332 = (state_43380[(12)]);
var inst_43342 = (state_43380[(2)]);
var inst_43343 = (inst_43335 + (1));
var tmp43389 = inst_43334;
var tmp43390 = inst_43333;
var tmp43391 = inst_43332;
var inst_43332__$1 = tmp43391;
var inst_43333__$1 = tmp43390;
var inst_43334__$1 = tmp43389;
var inst_43335__$1 = inst_43343;
var state_43380__$1 = (function (){var statearr_43394 = state_43380;
(statearr_43394[(8)] = inst_43335__$1);

(statearr_43394[(9)] = inst_43334__$1);

(statearr_43394[(11)] = inst_43333__$1);

(statearr_43394[(14)] = inst_43342);

(statearr_43394[(12)] = inst_43332__$1);

return statearr_43394;
})();
var statearr_43395_43430 = state_43380__$1;
(statearr_43395_43430[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (22))){
var state_43380__$1 = state_43380;
var statearr_43396_43431 = state_43380__$1;
(statearr_43396_43431[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (6))){
var inst_43321 = (state_43380[(13)]);
var inst_43330 = f.call(null,inst_43321);
var inst_43331 = cljs.core.seq.call(null,inst_43330);
var inst_43332 = inst_43331;
var inst_43333 = null;
var inst_43334 = (0);
var inst_43335 = (0);
var state_43380__$1 = (function (){var statearr_43397 = state_43380;
(statearr_43397[(8)] = inst_43335);

(statearr_43397[(9)] = inst_43334);

(statearr_43397[(11)] = inst_43333);

(statearr_43397[(12)] = inst_43332);

return statearr_43397;
})();
var statearr_43398_43432 = state_43380__$1;
(statearr_43398_43432[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (17))){
var inst_43346 = (state_43380[(7)]);
var inst_43350 = cljs.core.chunk_first.call(null,inst_43346);
var inst_43351 = cljs.core.chunk_rest.call(null,inst_43346);
var inst_43352 = cljs.core.count.call(null,inst_43350);
var inst_43332 = inst_43351;
var inst_43333 = inst_43350;
var inst_43334 = inst_43352;
var inst_43335 = (0);
var state_43380__$1 = (function (){var statearr_43399 = state_43380;
(statearr_43399[(8)] = inst_43335);

(statearr_43399[(9)] = inst_43334);

(statearr_43399[(11)] = inst_43333);

(statearr_43399[(12)] = inst_43332);

return statearr_43399;
})();
var statearr_43400_43433 = state_43380__$1;
(statearr_43400_43433[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (3))){
var inst_43378 = (state_43380[(2)]);
var state_43380__$1 = state_43380;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_43380__$1,inst_43378);
} else {
if((state_val_43381 === (12))){
var inst_43366 = (state_43380[(2)]);
var state_43380__$1 = state_43380;
var statearr_43401_43434 = state_43380__$1;
(statearr_43401_43434[(2)] = inst_43366);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (2))){
var state_43380__$1 = state_43380;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_43380__$1,(4),in$);
} else {
if((state_val_43381 === (23))){
var inst_43374 = (state_43380[(2)]);
var state_43380__$1 = state_43380;
var statearr_43402_43435 = state_43380__$1;
(statearr_43402_43435[(2)] = inst_43374);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (19))){
var inst_43361 = (state_43380[(2)]);
var state_43380__$1 = state_43380;
var statearr_43403_43436 = state_43380__$1;
(statearr_43403_43436[(2)] = inst_43361);

(statearr_43403_43436[(1)] = (16));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (11))){
var inst_43346 = (state_43380[(7)]);
var inst_43332 = (state_43380[(12)]);
var inst_43346__$1 = cljs.core.seq.call(null,inst_43332);
var state_43380__$1 = (function (){var statearr_43404 = state_43380;
(statearr_43404[(7)] = inst_43346__$1);

return statearr_43404;
})();
if(inst_43346__$1){
var statearr_43405_43437 = state_43380__$1;
(statearr_43405_43437[(1)] = (14));

} else {
var statearr_43406_43438 = state_43380__$1;
(statearr_43406_43438[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (9))){
var inst_43368 = (state_43380[(2)]);
var inst_43369 = cljs.core.async.impl.protocols.closed_QMARK_.call(null,out);
var state_43380__$1 = (function (){var statearr_43407 = state_43380;
(statearr_43407[(15)] = inst_43368);

return statearr_43407;
})();
if(cljs.core.truth_(inst_43369)){
var statearr_43408_43439 = state_43380__$1;
(statearr_43408_43439[(1)] = (21));

} else {
var statearr_43409_43440 = state_43380__$1;
(statearr_43409_43440[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (5))){
var inst_43324 = cljs.core.async.close_BANG_.call(null,out);
var state_43380__$1 = state_43380;
var statearr_43410_43441 = state_43380__$1;
(statearr_43410_43441[(2)] = inst_43324);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (14))){
var inst_43346 = (state_43380[(7)]);
var inst_43348 = cljs.core.chunked_seq_QMARK_.call(null,inst_43346);
var state_43380__$1 = state_43380;
if(inst_43348){
var statearr_43411_43442 = state_43380__$1;
(statearr_43411_43442[(1)] = (17));

} else {
var statearr_43412_43443 = state_43380__$1;
(statearr_43412_43443[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (16))){
var inst_43364 = (state_43380[(2)]);
var state_43380__$1 = state_43380;
var statearr_43413_43444 = state_43380__$1;
(statearr_43413_43444[(2)] = inst_43364);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43381 === (10))){
var inst_43335 = (state_43380[(8)]);
var inst_43333 = (state_43380[(11)]);
var inst_43340 = cljs.core._nth.call(null,inst_43333,inst_43335);
var state_43380__$1 = state_43380;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43380__$1,(13),out,inst_43340);
} else {
if((state_val_43381 === (18))){
var inst_43346 = (state_43380[(7)]);
var inst_43355 = cljs.core.first.call(null,inst_43346);
var state_43380__$1 = state_43380;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43380__$1,(20),out,inst_43355);
} else {
if((state_val_43381 === (8))){
var inst_43335 = (state_43380[(8)]);
var inst_43334 = (state_43380[(9)]);
var inst_43337 = (inst_43335 < inst_43334);
var inst_43338 = inst_43337;
var state_43380__$1 = state_43380;
if(cljs.core.truth_(inst_43338)){
var statearr_43414_43445 = state_43380__$1;
(statearr_43414_43445[(1)] = (10));

} else {
var statearr_43415_43446 = state_43380__$1;
(statearr_43415_43446[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto__))
;
return ((function (switch__40760__auto__,c__40874__auto__){
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__40761__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__40761__auto____0 = (function (){
var statearr_43419 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_43419[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__40761__auto__);

(statearr_43419[(1)] = (1));

return statearr_43419;
});
var cljs$core$async$mapcat_STAR__$_state_machine__40761__auto____1 = (function (state_43380){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_43380);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e43420){if((e43420 instanceof Object)){
var ex__40764__auto__ = e43420;
var statearr_43421_43447 = state_43380;
(statearr_43421_43447[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__43448 = state_43380;
state_43380 = G__43448;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__40761__auto__ = function(state_43380){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__40761__auto____1.call(this,state_43380);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$mapcat_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__40761__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__40761__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto__))
})();
var state__40876__auto__ = (function (){var statearr_43422 = f__40875__auto__.call(null);
(statearr_43422[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto__);

return statearr_43422;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto__))
);

return c__40874__auto__;
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_LT_ = (function cljs$core$async$mapcat_LT_(var_args){
var args43449 = [];
var len__24559__auto___43452 = arguments.length;
var i__24560__auto___43453 = (0);
while(true){
if((i__24560__auto___43453 < len__24559__auto___43452)){
args43449.push((arguments[i__24560__auto___43453]));

var G__43454 = (i__24560__auto___43453 + (1));
i__24560__auto___43453 = G__43454;
continue;
} else {
}
break;
}

var G__43451 = args43449.length;
switch (G__43451) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43449.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 args43456 = [];
var len__24559__auto___43459 = arguments.length;
var i__24560__auto___43460 = (0);
while(true){
if((i__24560__auto___43460 < len__24559__auto___43459)){
args43456.push((arguments[i__24560__auto___43460]));

var G__43461 = (i__24560__auto___43460 + (1));
i__24560__auto___43460 = G__43461;
continue;
} else {
}
break;
}

var G__43458 = args43456.length;
switch (G__43458) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43456.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 args43463 = [];
var len__24559__auto___43514 = arguments.length;
var i__24560__auto___43515 = (0);
while(true){
if((i__24560__auto___43515 < len__24559__auto___43514)){
args43463.push((arguments[i__24560__auto___43515]));

var G__43516 = (i__24560__auto___43515 + (1));
i__24560__auto___43515 = G__43516;
continue;
} else {
}
break;
}

var G__43465 = args43463.length;
switch (G__43465) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43463.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__40874__auto___43518 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___43518,out){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___43518,out){
return (function (state_43489){
var state_val_43490 = (state_43489[(1)]);
if((state_val_43490 === (7))){
var inst_43484 = (state_43489[(2)]);
var state_43489__$1 = state_43489;
var statearr_43491_43519 = state_43489__$1;
(statearr_43491_43519[(2)] = inst_43484);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43490 === (1))){
var inst_43466 = null;
var state_43489__$1 = (function (){var statearr_43492 = state_43489;
(statearr_43492[(7)] = inst_43466);

return statearr_43492;
})();
var statearr_43493_43520 = state_43489__$1;
(statearr_43493_43520[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43490 === (4))){
var inst_43469 = (state_43489[(8)]);
var inst_43469__$1 = (state_43489[(2)]);
var inst_43470 = (inst_43469__$1 == null);
var inst_43471 = cljs.core.not.call(null,inst_43470);
var state_43489__$1 = (function (){var statearr_43494 = state_43489;
(statearr_43494[(8)] = inst_43469__$1);

return statearr_43494;
})();
if(inst_43471){
var statearr_43495_43521 = state_43489__$1;
(statearr_43495_43521[(1)] = (5));

} else {
var statearr_43496_43522 = state_43489__$1;
(statearr_43496_43522[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43490 === (6))){
var state_43489__$1 = state_43489;
var statearr_43497_43523 = state_43489__$1;
(statearr_43497_43523[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43490 === (3))){
var inst_43486 = (state_43489[(2)]);
var inst_43487 = cljs.core.async.close_BANG_.call(null,out);
var state_43489__$1 = (function (){var statearr_43498 = state_43489;
(statearr_43498[(9)] = inst_43486);

return statearr_43498;
})();
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_43489__$1,inst_43487);
} else {
if((state_val_43490 === (2))){
var state_43489__$1 = state_43489;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_43489__$1,(4),ch);
} else {
if((state_val_43490 === (11))){
var inst_43469 = (state_43489[(8)]);
var inst_43478 = (state_43489[(2)]);
var inst_43466 = inst_43469;
var state_43489__$1 = (function (){var statearr_43499 = state_43489;
(statearr_43499[(10)] = inst_43478);

(statearr_43499[(7)] = inst_43466);

return statearr_43499;
})();
var statearr_43500_43524 = state_43489__$1;
(statearr_43500_43524[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43490 === (9))){
var inst_43469 = (state_43489[(8)]);
var state_43489__$1 = state_43489;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43489__$1,(11),out,inst_43469);
} else {
if((state_val_43490 === (5))){
var inst_43469 = (state_43489[(8)]);
var inst_43466 = (state_43489[(7)]);
var inst_43473 = cljs.core._EQ_.call(null,inst_43469,inst_43466);
var state_43489__$1 = state_43489;
if(inst_43473){
var statearr_43502_43525 = state_43489__$1;
(statearr_43502_43525[(1)] = (8));

} else {
var statearr_43503_43526 = state_43489__$1;
(statearr_43503_43526[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43490 === (10))){
var inst_43481 = (state_43489[(2)]);
var state_43489__$1 = state_43489;
var statearr_43504_43527 = state_43489__$1;
(statearr_43504_43527[(2)] = inst_43481);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43490 === (8))){
var inst_43466 = (state_43489[(7)]);
var tmp43501 = inst_43466;
var inst_43466__$1 = tmp43501;
var state_43489__$1 = (function (){var statearr_43505 = state_43489;
(statearr_43505[(7)] = inst_43466__$1);

return statearr_43505;
})();
var statearr_43506_43528 = state_43489__$1;
(statearr_43506_43528[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___43518,out))
;
return ((function (switch__40760__auto__,c__40874__auto___43518,out){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_43510 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_43510[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_43510[(1)] = (1));

return statearr_43510;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_43489){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_43489);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e43511){if((e43511 instanceof Object)){
var ex__40764__auto__ = e43511;
var statearr_43512_43529 = state_43489;
(statearr_43512_43529[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__43530 = state_43489;
state_43489 = G__43530;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_43489){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_43489);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___43518,out))
})();
var state__40876__auto__ = (function (){var statearr_43513 = f__40875__auto__.call(null);
(statearr_43513[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___43518);

return statearr_43513;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___43518,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 args43531 = [];
var len__24559__auto___43601 = arguments.length;
var i__24560__auto___43602 = (0);
while(true){
if((i__24560__auto___43602 < len__24559__auto___43601)){
args43531.push((arguments[i__24560__auto___43602]));

var G__43603 = (i__24560__auto___43602 + (1));
i__24560__auto___43602 = G__43603;
continue;
} else {
}
break;
}

var G__43533 = args43531.length;
switch (G__43533) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43531.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__40874__auto___43605 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___43605,out){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___43605,out){
return (function (state_43571){
var state_val_43572 = (state_43571[(1)]);
if((state_val_43572 === (7))){
var inst_43567 = (state_43571[(2)]);
var state_43571__$1 = state_43571;
var statearr_43573_43606 = state_43571__$1;
(statearr_43573_43606[(2)] = inst_43567);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (1))){
var inst_43534 = (new Array(n));
var inst_43535 = inst_43534;
var inst_43536 = (0);
var state_43571__$1 = (function (){var statearr_43574 = state_43571;
(statearr_43574[(7)] = inst_43536);

(statearr_43574[(8)] = inst_43535);

return statearr_43574;
})();
var statearr_43575_43607 = state_43571__$1;
(statearr_43575_43607[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (4))){
var inst_43539 = (state_43571[(9)]);
var inst_43539__$1 = (state_43571[(2)]);
var inst_43540 = (inst_43539__$1 == null);
var inst_43541 = cljs.core.not.call(null,inst_43540);
var state_43571__$1 = (function (){var statearr_43576 = state_43571;
(statearr_43576[(9)] = inst_43539__$1);

return statearr_43576;
})();
if(inst_43541){
var statearr_43577_43608 = state_43571__$1;
(statearr_43577_43608[(1)] = (5));

} else {
var statearr_43578_43609 = state_43571__$1;
(statearr_43578_43609[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (15))){
var inst_43561 = (state_43571[(2)]);
var state_43571__$1 = state_43571;
var statearr_43579_43610 = state_43571__$1;
(statearr_43579_43610[(2)] = inst_43561);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (13))){
var state_43571__$1 = state_43571;
var statearr_43580_43611 = state_43571__$1;
(statearr_43580_43611[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (6))){
var inst_43536 = (state_43571[(7)]);
var inst_43557 = (inst_43536 > (0));
var state_43571__$1 = state_43571;
if(cljs.core.truth_(inst_43557)){
var statearr_43581_43612 = state_43571__$1;
(statearr_43581_43612[(1)] = (12));

} else {
var statearr_43582_43613 = state_43571__$1;
(statearr_43582_43613[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (3))){
var inst_43569 = (state_43571[(2)]);
var state_43571__$1 = state_43571;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_43571__$1,inst_43569);
} else {
if((state_val_43572 === (12))){
var inst_43535 = (state_43571[(8)]);
var inst_43559 = cljs.core.vec.call(null,inst_43535);
var state_43571__$1 = state_43571;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43571__$1,(15),out,inst_43559);
} else {
if((state_val_43572 === (2))){
var state_43571__$1 = state_43571;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_43571__$1,(4),ch);
} else {
if((state_val_43572 === (11))){
var inst_43551 = (state_43571[(2)]);
var inst_43552 = (new Array(n));
var inst_43535 = inst_43552;
var inst_43536 = (0);
var state_43571__$1 = (function (){var statearr_43583 = state_43571;
(statearr_43583[(7)] = inst_43536);

(statearr_43583[(10)] = inst_43551);

(statearr_43583[(8)] = inst_43535);

return statearr_43583;
})();
var statearr_43584_43614 = state_43571__$1;
(statearr_43584_43614[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (9))){
var inst_43535 = (state_43571[(8)]);
var inst_43549 = cljs.core.vec.call(null,inst_43535);
var state_43571__$1 = state_43571;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43571__$1,(11),out,inst_43549);
} else {
if((state_val_43572 === (5))){
var inst_43536 = (state_43571[(7)]);
var inst_43535 = (state_43571[(8)]);
var inst_43539 = (state_43571[(9)]);
var inst_43544 = (state_43571[(11)]);
var inst_43543 = (inst_43535[inst_43536] = inst_43539);
var inst_43544__$1 = (inst_43536 + (1));
var inst_43545 = (inst_43544__$1 < n);
var state_43571__$1 = (function (){var statearr_43585 = state_43571;
(statearr_43585[(12)] = inst_43543);

(statearr_43585[(11)] = inst_43544__$1);

return statearr_43585;
})();
if(cljs.core.truth_(inst_43545)){
var statearr_43586_43615 = state_43571__$1;
(statearr_43586_43615[(1)] = (8));

} else {
var statearr_43587_43616 = state_43571__$1;
(statearr_43587_43616[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (14))){
var inst_43564 = (state_43571[(2)]);
var inst_43565 = cljs.core.async.close_BANG_.call(null,out);
var state_43571__$1 = (function (){var statearr_43589 = state_43571;
(statearr_43589[(13)] = inst_43564);

return statearr_43589;
})();
var statearr_43590_43617 = state_43571__$1;
(statearr_43590_43617[(2)] = inst_43565);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (10))){
var inst_43555 = (state_43571[(2)]);
var state_43571__$1 = state_43571;
var statearr_43591_43618 = state_43571__$1;
(statearr_43591_43618[(2)] = inst_43555);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43572 === (8))){
var inst_43535 = (state_43571[(8)]);
var inst_43544 = (state_43571[(11)]);
var tmp43588 = inst_43535;
var inst_43535__$1 = tmp43588;
var inst_43536 = inst_43544;
var state_43571__$1 = (function (){var statearr_43592 = state_43571;
(statearr_43592[(7)] = inst_43536);

(statearr_43592[(8)] = inst_43535__$1);

return statearr_43592;
})();
var statearr_43593_43619 = state_43571__$1;
(statearr_43593_43619[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___43605,out))
;
return ((function (switch__40760__auto__,c__40874__auto___43605,out){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_43597 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_43597[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_43597[(1)] = (1));

return statearr_43597;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_43571){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_43571);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e43598){if((e43598 instanceof Object)){
var ex__40764__auto__ = e43598;
var statearr_43599_43620 = state_43571;
(statearr_43599_43620[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__43621 = state_43571;
state_43571 = G__43621;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_43571){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_43571);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___43605,out))
})();
var state__40876__auto__ = (function (){var statearr_43600 = f__40875__auto__.call(null);
(statearr_43600[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___43605);

return statearr_43600;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___43605,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 args43622 = [];
var len__24559__auto___43696 = arguments.length;
var i__24560__auto___43697 = (0);
while(true){
if((i__24560__auto___43697 < len__24559__auto___43696)){
args43622.push((arguments[i__24560__auto___43697]));

var G__43698 = (i__24560__auto___43697 + (1));
i__24560__auto___43697 = G__43698;
continue;
} else {
}
break;
}

var G__43624 = args43622.length;
switch (G__43624) {
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([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args43622.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__40874__auto___43700 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__40874__auto___43700,out){
return (function (){
var f__40875__auto__ = (function (){var switch__40760__auto__ = ((function (c__40874__auto___43700,out){
return (function (state_43666){
var state_val_43667 = (state_43666[(1)]);
if((state_val_43667 === (7))){
var inst_43662 = (state_43666[(2)]);
var state_43666__$1 = state_43666;
var statearr_43668_43701 = state_43666__$1;
(statearr_43668_43701[(2)] = inst_43662);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (1))){
var inst_43625 = [];
var inst_43626 = inst_43625;
var inst_43627 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_43666__$1 = (function (){var statearr_43669 = state_43666;
(statearr_43669[(7)] = inst_43626);

(statearr_43669[(8)] = inst_43627);

return statearr_43669;
})();
var statearr_43670_43702 = state_43666__$1;
(statearr_43670_43702[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (4))){
var inst_43630 = (state_43666[(9)]);
var inst_43630__$1 = (state_43666[(2)]);
var inst_43631 = (inst_43630__$1 == null);
var inst_43632 = cljs.core.not.call(null,inst_43631);
var state_43666__$1 = (function (){var statearr_43671 = state_43666;
(statearr_43671[(9)] = inst_43630__$1);

return statearr_43671;
})();
if(inst_43632){
var statearr_43672_43703 = state_43666__$1;
(statearr_43672_43703[(1)] = (5));

} else {
var statearr_43673_43704 = state_43666__$1;
(statearr_43673_43704[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (15))){
var inst_43656 = (state_43666[(2)]);
var state_43666__$1 = state_43666;
var statearr_43674_43705 = state_43666__$1;
(statearr_43674_43705[(2)] = inst_43656);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (13))){
var state_43666__$1 = state_43666;
var statearr_43675_43706 = state_43666__$1;
(statearr_43675_43706[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (6))){
var inst_43626 = (state_43666[(7)]);
var inst_43651 = inst_43626.length;
var inst_43652 = (inst_43651 > (0));
var state_43666__$1 = state_43666;
if(cljs.core.truth_(inst_43652)){
var statearr_43676_43707 = state_43666__$1;
(statearr_43676_43707[(1)] = (12));

} else {
var statearr_43677_43708 = state_43666__$1;
(statearr_43677_43708[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (3))){
var inst_43664 = (state_43666[(2)]);
var state_43666__$1 = state_43666;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_43666__$1,inst_43664);
} else {
if((state_val_43667 === (12))){
var inst_43626 = (state_43666[(7)]);
var inst_43654 = cljs.core.vec.call(null,inst_43626);
var state_43666__$1 = state_43666;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43666__$1,(15),out,inst_43654);
} else {
if((state_val_43667 === (2))){
var state_43666__$1 = state_43666;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_43666__$1,(4),ch);
} else {
if((state_val_43667 === (11))){
var inst_43634 = (state_43666[(10)]);
var inst_43630 = (state_43666[(9)]);
var inst_43644 = (state_43666[(2)]);
var inst_43645 = [];
var inst_43646 = inst_43645.push(inst_43630);
var inst_43626 = inst_43645;
var inst_43627 = inst_43634;
var state_43666__$1 = (function (){var statearr_43678 = state_43666;
(statearr_43678[(11)] = inst_43644);

(statearr_43678[(7)] = inst_43626);

(statearr_43678[(8)] = inst_43627);

(statearr_43678[(12)] = inst_43646);

return statearr_43678;
})();
var statearr_43679_43709 = state_43666__$1;
(statearr_43679_43709[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (9))){
var inst_43626 = (state_43666[(7)]);
var inst_43642 = cljs.core.vec.call(null,inst_43626);
var state_43666__$1 = state_43666;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_43666__$1,(11),out,inst_43642);
} else {
if((state_val_43667 === (5))){
var inst_43634 = (state_43666[(10)]);
var inst_43630 = (state_43666[(9)]);
var inst_43627 = (state_43666[(8)]);
var inst_43634__$1 = f.call(null,inst_43630);
var inst_43635 = cljs.core._EQ_.call(null,inst_43634__$1,inst_43627);
var inst_43636 = cljs.core.keyword_identical_QMARK_.call(null,inst_43627,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var inst_43637 = (inst_43635) || (inst_43636);
var state_43666__$1 = (function (){var statearr_43680 = state_43666;
(statearr_43680[(10)] = inst_43634__$1);

return statearr_43680;
})();
if(cljs.core.truth_(inst_43637)){
var statearr_43681_43710 = state_43666__$1;
(statearr_43681_43710[(1)] = (8));

} else {
var statearr_43682_43711 = state_43666__$1;
(statearr_43682_43711[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (14))){
var inst_43659 = (state_43666[(2)]);
var inst_43660 = cljs.core.async.close_BANG_.call(null,out);
var state_43666__$1 = (function (){var statearr_43684 = state_43666;
(statearr_43684[(13)] = inst_43659);

return statearr_43684;
})();
var statearr_43685_43712 = state_43666__$1;
(statearr_43685_43712[(2)] = inst_43660);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (10))){
var inst_43649 = (state_43666[(2)]);
var state_43666__$1 = state_43666;
var statearr_43686_43713 = state_43666__$1;
(statearr_43686_43713[(2)] = inst_43649);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_43667 === (8))){
var inst_43634 = (state_43666[(10)]);
var inst_43630 = (state_43666[(9)]);
var inst_43626 = (state_43666[(7)]);
var inst_43639 = inst_43626.push(inst_43630);
var tmp43683 = inst_43626;
var inst_43626__$1 = tmp43683;
var inst_43627 = inst_43634;
var state_43666__$1 = (function (){var statearr_43687 = state_43666;
(statearr_43687[(14)] = inst_43639);

(statearr_43687[(7)] = inst_43626__$1);

(statearr_43687[(8)] = inst_43627);

return statearr_43687;
})();
var statearr_43688_43714 = state_43666__$1;
(statearr_43688_43714[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__40874__auto___43700,out))
;
return ((function (switch__40760__auto__,c__40874__auto___43700,out){
return (function() {
var cljs$core$async$state_machine__40761__auto__ = null;
var cljs$core$async$state_machine__40761__auto____0 = (function (){
var statearr_43692 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_43692[(0)] = cljs$core$async$state_machine__40761__auto__);

(statearr_43692[(1)] = (1));

return statearr_43692;
});
var cljs$core$async$state_machine__40761__auto____1 = (function (state_43666){
while(true){
var ret_value__40762__auto__ = (function (){try{while(true){
var result__40763__auto__ = switch__40760__auto__.call(null,state_43666);
if(cljs.core.keyword_identical_QMARK_.call(null,result__40763__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__40763__auto__;
}
break;
}
}catch (e43693){if((e43693 instanceof Object)){
var ex__40764__auto__ = e43693;
var statearr_43694_43715 = state_43666;
(statearr_43694_43715[(5)] = ex__40764__auto__);


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

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

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__40762__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__43716 = state_43666;
state_43666 = G__43716;
continue;
} else {
return ret_value__40762__auto__;
}
break;
}
});
cljs$core$async$state_machine__40761__auto__ = function(state_43666){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__40761__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__40761__auto____1.call(this,state_43666);
}
throw(new Error('Invalid arity: ' + (arguments.length - 1)));
};
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__40761__auto____0;
cljs$core$async$state_machine__40761__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__40761__auto____1;
return cljs$core$async$state_machine__40761__auto__;
})()
;})(switch__40760__auto__,c__40874__auto___43700,out))
})();
var state__40876__auto__ = (function (){var statearr_43695 = f__40875__auto__.call(null);
(statearr_43695[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__40874__auto___43700);

return statearr_43695;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__40876__auto__);
});})(c__40874__auto___43700,out))
);


return out;
});

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

