goog.provide('cljs.core.async');
goog.scope(function(){
  cljs.core.async.goog$module$goog$array = goog.module.get('goog.array');
});

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

(cljs.core.async.t_cljs$core$async22742.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_22744){
var self__ = this;
var _22744__$1 = this;
return self__.meta22743;
}));

(cljs.core.async.t_cljs$core$async22742.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async22742.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$async22742.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$async22742.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$async22742.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,"meta22743","meta22743",-204130493,null)], null);
}));

(cljs.core.async.t_cljs$core$async22742.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async22742.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async22742");

(cljs.core.async.t_cljs$core$async22742.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async22742");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async22742.
 */
cljs.core.async.__GT_t_cljs$core$async22742 = (function cljs$core$async$__GT_t_cljs$core$async22742(f,blockable,meta22743){
return (new cljs.core.async.t_cljs$core$async22742(f,blockable,meta22743));
});


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

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

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

}
});

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

(cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2 = (function (f,blockable){
return (new cljs.core.async.t_cljs$core$async22742(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(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(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(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_(cljs.core.async.impl.protocols.UnblockingBuffer,buff);
} else {
return false;
}
}
} else {
return cljs.core.native_satisfies_QMARK_(cljs.core.async.impl.protocols.UnblockingBuffer,buff);
}
});
/**
 * Creates a channel with an optional buffer, an optional transducer (like (map f),
 *   (filter p) etc or a composition thereof), and an optional exception handler.
 *   If buf-or-n is a number, will create and use a fixed buffer of that size. If a
 *   transducer is supplied a buffer must be specified. ex-handler must be a
 *   fn of one argument - if an exception occurs during transformation it will be called
 *   with the thrown value as an argument, and any non-nil return value will be placed
 *   in the channel.
 */
cljs.core.async.chan = (function cljs$core$async$chan(var_args){
var G__22764 = arguments.length;
switch (G__22764) {
case 0:
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$0();

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

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

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

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

}
});

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

(cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf_or_n){
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$3(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_.cljs$core$IFn$_invoke$arity$2(buf_or_n,(0)))?null:buf_or_n);
if(cljs.core.truth_(xform)){
if(cljs.core.truth_(buf_or_n__$1)){
} else {
throw (new Error(["Assert failed: ","buffer must be supplied when transducer is","\n","buf-or-n"].join('')));
}
} else {
}

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

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

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

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

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

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

}
});

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

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

(cljs.core.async.promise_chan.cljs$core$IFn$_invoke$arity$2 = (function (xform,ex_handler){
return cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3(cljs.core.async.impl.buffers.promise_buffer(),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(msecs);
});
/**
 * takes a val from port. Must be called inside a (go ...) block. Will
 *   return nil if closed. Will park if nothing is available.
 *   Returns true unless port is already closed
 */
cljs.core.async._LT__BANG_ = (function cljs$core$async$_LT__BANG_(port){
throw (new Error("<! used not in (go ...) block"));
});
/**
 * Asynchronously takes a val from port, passing to fn1. Will pass nil
 * if closed. If on-caller? (default true) is true, and value is
 * immediately available, will call fn1 on calling thread.
 * Returns nil.
 */
cljs.core.async.take_BANG_ = (function cljs$core$async$take_BANG_(var_args){
var G__22787 = arguments.length;
switch (G__22787) {
case 2:
return cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

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

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

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

}
});

(cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (port,val){
var temp__5802__auto__ = cljs.core.async.impl.protocols.put_BANG_(port,val,cljs.core.async.fhnop);
if(cljs.core.truth_(temp__5802__auto__)){
var ret = temp__5802__auto__;
return cljs.core.deref(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_.cljs$core$IFn$_invoke$arity$4(port,val,fn1,true);
}));

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

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_(port);
});
cljs.core.async.random_array = (function cljs$core$async$random_array(n){
var a = (new Array(n));
var n__5593__auto___26906 = n;
var x_26907 = (0);
while(true){
if((x_26907 < n__5593__auto___26906)){
(a[x_26907] = x_26907);

var G__26908 = (x_26907 + (1));
x_26907 = G__26908;
continue;
} else {
}
break;
}

cljs.core.async.goog$module$goog$array.shuffle(a);

return a;
});

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

(cljs.core.async.t_cljs$core$async22843.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_22845){
var self__ = this;
var _22845__$1 = this;
return self__.meta22844;
}));

(cljs.core.async.t_cljs$core$async22843.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async22843.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$async22843.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_(self__.flag,null);

return true;
}));

(cljs.core.async.t_cljs$core$async22843.getBasis = (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,"meta22844","meta22844",1623195629,null)], null);
}));

(cljs.core.async.t_cljs$core$async22843.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async22843.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async22843");

(cljs.core.async.t_cljs$core$async22843.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async22843");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async22843.
 */
cljs.core.async.__GT_t_cljs$core$async22843 = (function cljs$core$async$__GT_t_cljs$core$async22843(flag,meta22844){
return (new cljs.core.async.t_cljs$core$async22843(flag,meta22844));
});


cljs.core.async.alt_flag = (function cljs$core$async$alt_flag(){
var flag = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(true);
return (new cljs.core.async.t_cljs$core$async22843(flag,cljs.core.PersistentArrayMap.EMPTY));
});

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

(cljs.core.async.t_cljs$core$async22857.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_22859){
var self__ = this;
var _22859__$1 = this;
return self__.meta22858;
}));

(cljs.core.async.t_cljs$core$async22857.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async22857.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_(self__.flag);
}));

(cljs.core.async.t_cljs$core$async22857.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$async22857.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.async.impl.protocols.commit(self__.flag);

return self__.cb;
}));

(cljs.core.async.t_cljs$core$async22857.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,"meta22858","meta22858",464649069,null)], null);
}));

(cljs.core.async.t_cljs$core$async22857.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async22857.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async22857");

(cljs.core.async.t_cljs$core$async22857.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async22857");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async22857.
 */
cljs.core.async.__GT_t_cljs$core$async22857 = (function cljs$core$async$__GT_t_cljs$core$async22857(flag,cb,meta22858){
return (new cljs.core.async.t_cljs$core$async22857(flag,cb,meta22858));
});


cljs.core.async.alt_handler = (function cljs$core$async$alt_handler(flag,cb){
return (new cljs.core.async.t_cljs$core$async22857(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){
if((cljs.core.count(ports) > (0))){
} else {
throw (new Error(["Assert failed: ","alts must have at least one channel operation","\n","(pos? (count ports))"].join('')));
}

var flag = cljs.core.async.alt_flag();
var n = cljs.core.count(ports);
var idxs = cljs.core.async.random_array(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.cljs$core$IFn$_invoke$arity$2(ports,idx);
var wport = ((cljs.core.vector_QMARK_(port))?(port.cljs$core$IFn$_invoke$arity$1 ? port.cljs$core$IFn$_invoke$arity$1((0)) : port.call(null, (0))):null);
var vbox = (cljs.core.truth_(wport)?(function (){var val = (port.cljs$core$IFn$_invoke$arity$1 ? port.cljs$core$IFn$_invoke$arity$1((1)) : port.call(null, (1)));
return cljs.core.async.impl.protocols.put_BANG_(wport,val,cljs.core.async.alt_handler(flag,((function (i,val,idx,port,wport,flag,n,idxs,priority){
return (function (p1__22885_SHARP_){
var G__22903 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__22885_SHARP_,wport], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__22903) : fret.call(null, G__22903));
});})(i,val,idx,port,wport,flag,n,idxs,priority))
));
})():cljs.core.async.impl.protocols.take_BANG_(port,cljs.core.async.alt_handler(flag,((function (i,idx,port,wport,flag,n,idxs,priority){
return (function (p1__22886_SHARP_){
var G__22906 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__22886_SHARP_,port], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__22906) : fret.call(null, G__22906));
});})(i,idx,port,wport,flag,n,idxs,priority))
)));
if(cljs.core.truth_(vbox)){
return cljs.core.async.impl.channels.box(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref(vbox),(function (){var or__5002__auto__ = wport;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return port;
}
})()], null));
} else {
var G__26918 = (i + (1));
i = G__26918;
continue;
}
} else {
return null;
}
break;
}
})();
var or__5002__auto__ = ret;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
if(cljs.core.contains_QMARK_(opts,new cljs.core.Keyword(null,"default","default",-1987822328))){
var temp__5804__auto__ = (function (){var and__5000__auto__ = flag.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null, );
if(cljs.core.truth_(and__5000__auto__)){
return flag.cljs$core$async$impl$protocols$Handler$commit$arity$1(null, );
} else {
return and__5000__auto__;
}
})();
if(cljs.core.truth_(temp__5804__auto__)){
var got = temp__5804__auto__;
return cljs.core.async.impl.channels.box(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__5732__auto__ = [];
var len__5726__auto___26919 = arguments.length;
var i__5727__auto___26920 = (0);
while(true){
if((i__5727__auto___26920 < len__5726__auto___26919)){
args__5732__auto__.push((arguments[i__5727__auto___26920]));

var G__26921 = (i__5727__auto___26920 + (1));
i__5727__auto___26920 = G__26921;
continue;
} else {
}
break;
}

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

(cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__22933){
var map__22934 = p__22933;
var map__22934__$1 = cljs.core.__destructure_map(map__22934);
var opts = map__22934__$1;
throw (new Error("alts! used not in (go ...) block"));
}));

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

/** @this {Function} */
(cljs.core.async.alts_BANG_.cljs$lang$applyTo = (function (seq22923){
var G__22924 = cljs.core.first(seq22923);
var seq22923__$1 = cljs.core.next(seq22923);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__22924,seq22923__$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_(port,val,cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2(cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref(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_(port,cljs.core.async.fn_handler.cljs$core$IFn$_invoke$arity$2(cljs.core.async.nop,false));
if(cljs.core.truth_(ret)){
return cljs.core.deref(ret);
} else {
return null;
}
});
/**
 * Takes elements from the from channel and supplies them to the to
 * channel. By default, the to channel will be closed when the from
 * channel closes, but can be determined by the close?  parameter. Will
 * stop consuming the from channel if the to channel closes
 */
cljs.core.async.pipe = (function cljs$core$async$pipe(var_args){
var G__22949 = arguments.length;
switch (G__22949) {
case 2:
return cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.pipe.cljs$core$IFn$_invoke$arity$3 = (function (from,to,close_QMARK_){
var c__22634__auto___26930 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_23007){
var state_val_23009 = (state_23007[(1)]);
if((state_val_23009 === (7))){
var inst_23000 = (state_23007[(2)]);
var state_23007__$1 = state_23007;
var statearr_23022_26932 = state_23007__$1;
(statearr_23022_26932[(2)] = inst_23000);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (1))){
var state_23007__$1 = state_23007;
var statearr_23023_26934 = state_23007__$1;
(statearr_23023_26934[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (4))){
var inst_22978 = (state_23007[(7)]);
var inst_22978__$1 = (state_23007[(2)]);
var inst_22982 = (inst_22978__$1 == null);
var state_23007__$1 = (function (){var statearr_23027 = state_23007;
(statearr_23027[(7)] = inst_22978__$1);

return statearr_23027;
})();
if(cljs.core.truth_(inst_22982)){
var statearr_23029_26940 = state_23007__$1;
(statearr_23029_26940[(1)] = (5));

} else {
var statearr_23030_26941 = state_23007__$1;
(statearr_23030_26941[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (13))){
var state_23007__$1 = state_23007;
var statearr_23034_26942 = state_23007__$1;
(statearr_23034_26942[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (6))){
var inst_22978 = (state_23007[(7)]);
var state_23007__$1 = state_23007;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_23007__$1,(11),to,inst_22978);
} else {
if((state_val_23009 === (3))){
var inst_23005 = (state_23007[(2)]);
var state_23007__$1 = state_23007;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23007__$1,inst_23005);
} else {
if((state_val_23009 === (12))){
var state_23007__$1 = state_23007;
var statearr_23039_26944 = state_23007__$1;
(statearr_23039_26944[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (2))){
var state_23007__$1 = state_23007;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23007__$1,(4),from);
} else {
if((state_val_23009 === (11))){
var inst_22993 = (state_23007[(2)]);
var state_23007__$1 = state_23007;
if(cljs.core.truth_(inst_22993)){
var statearr_23041_26953 = state_23007__$1;
(statearr_23041_26953[(1)] = (12));

} else {
var statearr_23042_26954 = state_23007__$1;
(statearr_23042_26954[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (9))){
var state_23007__$1 = state_23007;
var statearr_23046_26955 = state_23007__$1;
(statearr_23046_26955[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (5))){
var state_23007__$1 = state_23007;
if(cljs.core.truth_(close_QMARK_)){
var statearr_23048_26957 = state_23007__$1;
(statearr_23048_26957[(1)] = (8));

} else {
var statearr_23049_26958 = state_23007__$1;
(statearr_23049_26958[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (14))){
var inst_22998 = (state_23007[(2)]);
var state_23007__$1 = state_23007;
var statearr_23051_26959 = state_23007__$1;
(statearr_23051_26959[(2)] = inst_22998);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (10))){
var inst_22989 = (state_23007[(2)]);
var state_23007__$1 = state_23007;
var statearr_23054_26960 = state_23007__$1;
(statearr_23054_26960[(2)] = inst_22989);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23009 === (8))){
var inst_22985 = cljs.core.async.close_BANG_(to);
var state_23007__$1 = state_23007;
var statearr_23056_26964 = state_23007__$1;
(statearr_23056_26964[(2)] = inst_22985);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_23061 = [null,null,null,null,null,null,null,null];
(statearr_23061[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_23061[(1)] = (1));

return statearr_23061;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_23007){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23007);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23065){var ex__21558__auto__ = e23065;
var statearr_23066_26966 = state_23007;
(statearr_23066_26966[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23007[(4)]))){
var statearr_23067_26967 = state_23007;
(statearr_23067_26967[(1)] = cljs.core.first((state_23007[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26968 = state_23007;
state_23007 = G__26968;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_23007){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_23007);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_23077 = f__22635__auto__();
(statearr_23077[(6)] = c__22634__auto___26930);

return statearr_23077;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


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.cljs$core$IFn$_invoke$arity$1(n);
var results = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(n);
var process__$1 = (function (p__23094){
var vec__23096 = p__23094;
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23096,(0),null);
var p = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23096,(1),null);
var job = vec__23096;
if((job == null)){
cljs.core.async.close_BANG_(results);

return null;
} else {
var res = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$3((1),xf,ex_handler);
var c__22634__auto___26975 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_23112){
var state_val_23113 = (state_23112[(1)]);
if((state_val_23113 === (1))){
var state_23112__$1 = state_23112;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_23112__$1,(2),res,v);
} else {
if((state_val_23113 === (2))){
var inst_23106 = (state_23112[(2)]);
var inst_23107 = cljs.core.async.close_BANG_(res);
var state_23112__$1 = (function (){var statearr_23125 = state_23112;
(statearr_23125[(7)] = inst_23106);

return statearr_23125;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_23112__$1,inst_23107);
} else {
return null;
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0 = (function (){
var statearr_23128 = [null,null,null,null,null,null,null,null];
(statearr_23128[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__);

(statearr_23128[(1)] = (1));

return statearr_23128;
});
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1 = (function (state_23112){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23112);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23135){var ex__21558__auto__ = e23135;
var statearr_23136_26984 = state_23112;
(statearr_23136_26984[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23112[(4)]))){
var statearr_23137_26985 = state_23112;
(statearr_23137_26985[(1)] = cljs.core.first((state_23112[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__26987 = state_23112;
state_23112 = G__26987;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = function(state_23112){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1.call(this,state_23112);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_23140 = f__22635__auto__();
(statearr_23140[(6)] = c__22634__auto___26975);

return statearr_23140;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(p,res);

return true;
}
});
var async = (function (p__23145){
var vec__23147 = p__23145;
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23147,(0),null);
var p = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__23147,(1),null);
var job = vec__23147;
if((job == null)){
cljs.core.async.close_BANG_(results);

return null;
} else {
var res = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
(xf.cljs$core$IFn$_invoke$arity$2 ? xf.cljs$core$IFn$_invoke$arity$2(v,res) : xf.call(null, v,res));

cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(p,res);

return true;
}
});
var n__5593__auto___26994 = n;
var __26995 = (0);
while(true){
if((__26995 < n__5593__auto___26994)){
var G__23153_26996 = type;
var G__23153_26997__$1 = (((G__23153_26996 instanceof cljs.core.Keyword))?G__23153_26996.fqn:null);
switch (G__23153_26997__$1) {
case "compute":
var c__22634__auto___26999 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__26995,c__22634__auto___26999,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async){
return (function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = ((function (__26995,c__22634__auto___26999,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async){
return (function (state_23178){
var state_val_23179 = (state_23178[(1)]);
if((state_val_23179 === (1))){
var state_23178__$1 = state_23178;
var statearr_23184_27002 = state_23178__$1;
(statearr_23184_27002[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23179 === (2))){
var state_23178__$1 = state_23178;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23178__$1,(4),jobs);
} else {
if((state_val_23179 === (3))){
var inst_23176 = (state_23178[(2)]);
var state_23178__$1 = state_23178;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23178__$1,inst_23176);
} else {
if((state_val_23179 === (4))){
var inst_23160 = (state_23178[(2)]);
var inst_23167 = process__$1(inst_23160);
var state_23178__$1 = state_23178;
if(cljs.core.truth_(inst_23167)){
var statearr_23196_27005 = state_23178__$1;
(statearr_23196_27005[(1)] = (5));

} else {
var statearr_23197_27006 = state_23178__$1;
(statearr_23197_27006[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23179 === (5))){
var state_23178__$1 = state_23178;
var statearr_23199_27007 = state_23178__$1;
(statearr_23199_27007[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23179 === (6))){
var state_23178__$1 = state_23178;
var statearr_23201_27008 = state_23178__$1;
(statearr_23201_27008[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23179 === (7))){
var inst_23173 = (state_23178[(2)]);
var state_23178__$1 = state_23178;
var statearr_23204_27009 = state_23178__$1;
(statearr_23204_27009[(2)] = inst_23173);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__26995,c__22634__auto___26999,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async))
;
return ((function (__26995,switch__21554__auto__,c__22634__auto___26999,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0 = (function (){
var statearr_23206 = [null,null,null,null,null,null,null];
(statearr_23206[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__);

(statearr_23206[(1)] = (1));

return statearr_23206;
});
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1 = (function (state_23178){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23178);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23208){var ex__21558__auto__ = e23208;
var statearr_23209_27012 = state_23178;
(statearr_23209_27012[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23178[(4)]))){
var statearr_23210_27015 = state_23178;
(statearr_23210_27015[(1)] = cljs.core.first((state_23178[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27017 = state_23178;
state_23178 = G__27017;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = function(state_23178){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1.call(this,state_23178);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__;
})()
;})(__26995,switch__21554__auto__,c__22634__auto___26999,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async))
})();
var state__22636__auto__ = (function (){var statearr_23217 = f__22635__auto__();
(statearr_23217[(6)] = c__22634__auto___26999);

return statearr_23217;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
});})(__26995,c__22634__auto___26999,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async))
);


break;
case "async":
var c__22634__auto___27018 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__26995,c__22634__auto___27018,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async){
return (function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = ((function (__26995,c__22634__auto___27018,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async){
return (function (state_23234){
var state_val_23235 = (state_23234[(1)]);
if((state_val_23235 === (1))){
var state_23234__$1 = state_23234;
var statearr_23251_27019 = state_23234__$1;
(statearr_23251_27019[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23235 === (2))){
var state_23234__$1 = state_23234;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23234__$1,(4),jobs);
} else {
if((state_val_23235 === (3))){
var inst_23232 = (state_23234[(2)]);
var state_23234__$1 = state_23234;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23234__$1,inst_23232);
} else {
if((state_val_23235 === (4))){
var inst_23222 = (state_23234[(2)]);
var inst_23223 = async(inst_23222);
var state_23234__$1 = state_23234;
if(cljs.core.truth_(inst_23223)){
var statearr_23255_27024 = state_23234__$1;
(statearr_23255_27024[(1)] = (5));

} else {
var statearr_23257_27025 = state_23234__$1;
(statearr_23257_27025[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23235 === (5))){
var state_23234__$1 = state_23234;
var statearr_23258_27028 = state_23234__$1;
(statearr_23258_27028[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23235 === (6))){
var state_23234__$1 = state_23234;
var statearr_23263_27033 = state_23234__$1;
(statearr_23263_27033[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23235 === (7))){
var inst_23229 = (state_23234[(2)]);
var state_23234__$1 = state_23234;
var statearr_23265_27034 = state_23234__$1;
(statearr_23265_27034[(2)] = inst_23229);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__26995,c__22634__auto___27018,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async))
;
return ((function (__26995,switch__21554__auto__,c__22634__auto___27018,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0 = (function (){
var statearr_23267 = [null,null,null,null,null,null,null];
(statearr_23267[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__);

(statearr_23267[(1)] = (1));

return statearr_23267;
});
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1 = (function (state_23234){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23234);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23269){var ex__21558__auto__ = e23269;
var statearr_23271_27041 = state_23234;
(statearr_23271_27041[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23234[(4)]))){
var statearr_23273_27042 = state_23234;
(statearr_23273_27042[(1)] = cljs.core.first((state_23234[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27044 = state_23234;
state_23234 = G__27044;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = function(state_23234){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1.call(this,state_23234);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__;
})()
;})(__26995,switch__21554__auto__,c__22634__auto___27018,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async))
})();
var state__22636__auto__ = (function (){var statearr_23275 = f__22635__auto__();
(statearr_23275[(6)] = c__22634__auto___27018);

return statearr_23275;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
});})(__26995,c__22634__auto___27018,G__23153_26996,G__23153_26997__$1,n__5593__auto___26994,jobs,results,process__$1,async))
);


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

}

var G__27047 = (__26995 + (1));
__26995 = G__27047;
continue;
} else {
}
break;
}

var c__22634__auto___27048 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_23312){
var state_val_23313 = (state_23312[(1)]);
if((state_val_23313 === (7))){
var inst_23308 = (state_23312[(2)]);
var state_23312__$1 = state_23312;
var statearr_23321_27051 = state_23312__$1;
(statearr_23321_27051[(2)] = inst_23308);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23313 === (1))){
var state_23312__$1 = state_23312;
var statearr_23324_27053 = state_23312__$1;
(statearr_23324_27053[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23313 === (4))){
var inst_23288 = (state_23312[(7)]);
var inst_23288__$1 = (state_23312[(2)]);
var inst_23289 = (inst_23288__$1 == null);
var state_23312__$1 = (function (){var statearr_23326 = state_23312;
(statearr_23326[(7)] = inst_23288__$1);

return statearr_23326;
})();
if(cljs.core.truth_(inst_23289)){
var statearr_23327_27054 = state_23312__$1;
(statearr_23327_27054[(1)] = (5));

} else {
var statearr_23331_27055 = state_23312__$1;
(statearr_23331_27055[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23313 === (6))){
var inst_23288 = (state_23312[(7)]);
var inst_23293 = (state_23312[(8)]);
var inst_23293__$1 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var inst_23298 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_23299 = [inst_23288,inst_23293__$1];
var inst_23300 = (new cljs.core.PersistentVector(null,2,(5),inst_23298,inst_23299,null));
var state_23312__$1 = (function (){var statearr_23339 = state_23312;
(statearr_23339[(8)] = inst_23293__$1);

return statearr_23339;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_23312__$1,(8),jobs,inst_23300);
} else {
if((state_val_23313 === (3))){
var inst_23310 = (state_23312[(2)]);
var state_23312__$1 = state_23312;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23312__$1,inst_23310);
} else {
if((state_val_23313 === (2))){
var state_23312__$1 = state_23312;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23312__$1,(4),from);
} else {
if((state_val_23313 === (9))){
var inst_23305 = (state_23312[(2)]);
var state_23312__$1 = (function (){var statearr_23343 = state_23312;
(statearr_23343[(9)] = inst_23305);

return statearr_23343;
})();
var statearr_23344_27062 = state_23312__$1;
(statearr_23344_27062[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23313 === (5))){
var inst_23291 = cljs.core.async.close_BANG_(jobs);
var state_23312__$1 = state_23312;
var statearr_23346_27064 = state_23312__$1;
(statearr_23346_27064[(2)] = inst_23291);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23313 === (8))){
var inst_23293 = (state_23312[(8)]);
var inst_23302 = (state_23312[(2)]);
var state_23312__$1 = (function (){var statearr_23348 = state_23312;
(statearr_23348[(10)] = inst_23302);

return statearr_23348;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_23312__$1,(9),results,inst_23293);
} else {
return null;
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0 = (function (){
var statearr_23349 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_23349[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__);

(statearr_23349[(1)] = (1));

return statearr_23349;
});
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1 = (function (state_23312){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23312);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23351){var ex__21558__auto__ = e23351;
var statearr_23352_27078 = state_23312;
(statearr_23352_27078[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23312[(4)]))){
var statearr_23354_27084 = state_23312;
(statearr_23354_27084[(1)] = cljs.core.first((state_23312[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27088 = state_23312;
state_23312 = G__27088;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = function(state_23312){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1.call(this,state_23312);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_23357 = f__22635__auto__();
(statearr_23357[(6)] = c__22634__auto___27048);

return statearr_23357;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


var c__22634__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_23399){
var state_val_23400 = (state_23399[(1)]);
if((state_val_23400 === (7))){
var inst_23395 = (state_23399[(2)]);
var state_23399__$1 = state_23399;
var statearr_23401_27107 = state_23399__$1;
(statearr_23401_27107[(2)] = inst_23395);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (20))){
var state_23399__$1 = state_23399;
var statearr_23404_27115 = state_23399__$1;
(statearr_23404_27115[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (1))){
var state_23399__$1 = state_23399;
var statearr_23405_27120 = state_23399__$1;
(statearr_23405_27120[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (4))){
var inst_23360 = (state_23399[(7)]);
var inst_23360__$1 = (state_23399[(2)]);
var inst_23361 = (inst_23360__$1 == null);
var state_23399__$1 = (function (){var statearr_23407 = state_23399;
(statearr_23407[(7)] = inst_23360__$1);

return statearr_23407;
})();
if(cljs.core.truth_(inst_23361)){
var statearr_23408_27122 = state_23399__$1;
(statearr_23408_27122[(1)] = (5));

} else {
var statearr_23409_27123 = state_23399__$1;
(statearr_23409_27123[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (15))){
var inst_23377 = (state_23399[(8)]);
var state_23399__$1 = state_23399;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_23399__$1,(18),to,inst_23377);
} else {
if((state_val_23400 === (21))){
var inst_23390 = (state_23399[(2)]);
var state_23399__$1 = state_23399;
var statearr_23417_27124 = state_23399__$1;
(statearr_23417_27124[(2)] = inst_23390);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (13))){
var inst_23392 = (state_23399[(2)]);
var state_23399__$1 = (function (){var statearr_23419 = state_23399;
(statearr_23419[(9)] = inst_23392);

return statearr_23419;
})();
var statearr_23420_27130 = state_23399__$1;
(statearr_23420_27130[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (6))){
var inst_23360 = (state_23399[(7)]);
var state_23399__$1 = state_23399;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23399__$1,(11),inst_23360);
} else {
if((state_val_23400 === (17))){
var inst_23385 = (state_23399[(2)]);
var state_23399__$1 = state_23399;
if(cljs.core.truth_(inst_23385)){
var statearr_23421_27134 = state_23399__$1;
(statearr_23421_27134[(1)] = (19));

} else {
var statearr_23422_27135 = state_23399__$1;
(statearr_23422_27135[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (3))){
var inst_23397 = (state_23399[(2)]);
var state_23399__$1 = state_23399;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23399__$1,inst_23397);
} else {
if((state_val_23400 === (12))){
var inst_23374 = (state_23399[(10)]);
var state_23399__$1 = state_23399;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23399__$1,(14),inst_23374);
} else {
if((state_val_23400 === (2))){
var state_23399__$1 = state_23399;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23399__$1,(4),results);
} else {
if((state_val_23400 === (19))){
var state_23399__$1 = state_23399;
var statearr_23429_27136 = state_23399__$1;
(statearr_23429_27136[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (11))){
var inst_23374 = (state_23399[(2)]);
var state_23399__$1 = (function (){var statearr_23430 = state_23399;
(statearr_23430[(10)] = inst_23374);

return statearr_23430;
})();
var statearr_23431_27143 = state_23399__$1;
(statearr_23431_27143[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (9))){
var state_23399__$1 = state_23399;
var statearr_23433_27144 = state_23399__$1;
(statearr_23433_27144[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (5))){
var state_23399__$1 = state_23399;
if(cljs.core.truth_(close_QMARK_)){
var statearr_23439_27145 = state_23399__$1;
(statearr_23439_27145[(1)] = (8));

} else {
var statearr_23440_27146 = state_23399__$1;
(statearr_23440_27146[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (14))){
var inst_23379 = (state_23399[(11)]);
var inst_23377 = (state_23399[(8)]);
var inst_23377__$1 = (state_23399[(2)]);
var inst_23378 = (inst_23377__$1 == null);
var inst_23379__$1 = cljs.core.not(inst_23378);
var state_23399__$1 = (function (){var statearr_23449 = state_23399;
(statearr_23449[(11)] = inst_23379__$1);

(statearr_23449[(8)] = inst_23377__$1);

return statearr_23449;
})();
if(inst_23379__$1){
var statearr_23451_27151 = state_23399__$1;
(statearr_23451_27151[(1)] = (15));

} else {
var statearr_23452_27152 = state_23399__$1;
(statearr_23452_27152[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (16))){
var inst_23379 = (state_23399[(11)]);
var state_23399__$1 = state_23399;
var statearr_23453_27153 = state_23399__$1;
(statearr_23453_27153[(2)] = inst_23379);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (10))){
var inst_23370 = (state_23399[(2)]);
var state_23399__$1 = state_23399;
var statearr_23456_27154 = state_23399__$1;
(statearr_23456_27154[(2)] = inst_23370);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (18))){
var inst_23382 = (state_23399[(2)]);
var state_23399__$1 = state_23399;
var statearr_23463_27156 = state_23399__$1;
(statearr_23463_27156[(2)] = inst_23382);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23400 === (8))){
var inst_23367 = cljs.core.async.close_BANG_(to);
var state_23399__$1 = state_23399;
var statearr_23468_27159 = state_23399__$1;
(statearr_23468_27159[(2)] = inst_23367);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0 = (function (){
var statearr_23474 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_23474[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__);

(statearr_23474[(1)] = (1));

return statearr_23474;
});
var cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1 = (function (state_23399){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23399);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23480){var ex__21558__auto__ = e23480;
var statearr_23481_27164 = state_23399;
(statearr_23481_27164[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23399[(4)]))){
var statearr_23482_27166 = state_23399;
(statearr_23482_27166[(1)] = cljs.core.first((state_23399[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27170 = state_23399;
state_23399 = G__27170;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__ = function(state_23399){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1.call(this,state_23399);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__21555__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_23489 = f__22635__auto__();
(statearr_23489[(6)] = c__22634__auto__);

return statearr_23489;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));

return c__22634__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). The
 *   presumption is that af will return immediately, having launched some
 *   asynchronous operation whose completion/callback will put results on
 *   the channel, then close! it. 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. See also pipeline, pipeline-blocking.
 */
cljs.core.async.pipeline_async = (function cljs$core$async$pipeline_async(var_args){
var G__23499 = arguments.length;
switch (G__23499) {
case 4:
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));

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

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

}
});

(cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$4 = (function (n,to,af,from){
return cljs.core.async.pipeline_async.cljs$core$IFn$_invoke$arity$5(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_(n,to,af,from,close_QMARK_,null,new cljs.core.Keyword(null,"async","async",1050769601));
}));

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

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

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

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

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

}
});

(cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$4 = (function (n,to,xf,from){
return cljs.core.async.pipeline.cljs$core$IFn$_invoke$arity$5(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.cljs$core$IFn$_invoke$arity$6(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_(n,to,xf,from,close_QMARK_,ex_handler,new cljs.core.Keyword(null,"compute","compute",1555393130));
}));

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

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

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

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

}
});

(cljs.core.async.split.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.split.cljs$core$IFn$_invoke$arity$4(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.cljs$core$IFn$_invoke$arity$1(t_buf_or_n);
var fc = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(f_buf_or_n);
var c__22634__auto___27190 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_23614){
var state_val_23615 = (state_23614[(1)]);
if((state_val_23615 === (7))){
var inst_23607 = (state_23614[(2)]);
var state_23614__$1 = state_23614;
var statearr_23624_27191 = state_23614__$1;
(statearr_23624_27191[(2)] = inst_23607);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (1))){
var state_23614__$1 = state_23614;
var statearr_23631_27192 = state_23614__$1;
(statearr_23631_27192[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (4))){
var inst_23572 = (state_23614[(7)]);
var inst_23572__$1 = (state_23614[(2)]);
var inst_23573 = (inst_23572__$1 == null);
var state_23614__$1 = (function (){var statearr_23640 = state_23614;
(statearr_23640[(7)] = inst_23572__$1);

return statearr_23640;
})();
if(cljs.core.truth_(inst_23573)){
var statearr_23646_27198 = state_23614__$1;
(statearr_23646_27198[(1)] = (5));

} else {
var statearr_23647_27199 = state_23614__$1;
(statearr_23647_27199[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (13))){
var state_23614__$1 = state_23614;
var statearr_23650_27200 = state_23614__$1;
(statearr_23650_27200[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (6))){
var inst_23572 = (state_23614[(7)]);
var inst_23587 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_23572) : p.call(null, inst_23572));
var state_23614__$1 = state_23614;
if(cljs.core.truth_(inst_23587)){
var statearr_23662_27202 = state_23614__$1;
(statearr_23662_27202[(1)] = (9));

} else {
var statearr_23667_27203 = state_23614__$1;
(statearr_23667_27203[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (3))){
var inst_23610 = (state_23614[(2)]);
var state_23614__$1 = state_23614;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23614__$1,inst_23610);
} else {
if((state_val_23615 === (12))){
var state_23614__$1 = state_23614;
var statearr_23678_27205 = state_23614__$1;
(statearr_23678_27205[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (2))){
var state_23614__$1 = state_23614;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23614__$1,(4),ch);
} else {
if((state_val_23615 === (11))){
var inst_23572 = (state_23614[(7)]);
var inst_23596 = (state_23614[(2)]);
var state_23614__$1 = state_23614;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_23614__$1,(8),inst_23596,inst_23572);
} else {
if((state_val_23615 === (9))){
var state_23614__$1 = state_23614;
var statearr_23683_27207 = state_23614__$1;
(statearr_23683_27207[(2)] = tc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (5))){
var inst_23584 = cljs.core.async.close_BANG_(tc);
var inst_23585 = cljs.core.async.close_BANG_(fc);
var state_23614__$1 = (function (){var statearr_23690 = state_23614;
(statearr_23690[(8)] = inst_23584);

return statearr_23690;
})();
var statearr_23692_27208 = state_23614__$1;
(statearr_23692_27208[(2)] = inst_23585);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (14))){
var inst_23605 = (state_23614[(2)]);
var state_23614__$1 = state_23614;
var statearr_23700_27210 = state_23614__$1;
(statearr_23700_27210[(2)] = inst_23605);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (10))){
var state_23614__$1 = state_23614;
var statearr_23701_27211 = state_23614__$1;
(statearr_23701_27211[(2)] = fc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23615 === (8))){
var inst_23599 = (state_23614[(2)]);
var state_23614__$1 = state_23614;
if(cljs.core.truth_(inst_23599)){
var statearr_23706_27222 = state_23614__$1;
(statearr_23706_27222[(1)] = (12));

} else {
var statearr_23707_27225 = state_23614__$1;
(statearr_23707_27225[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_23714 = [null,null,null,null,null,null,null,null,null];
(statearr_23714[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_23714[(1)] = (1));

return statearr_23714;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_23614){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23614);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23716){var ex__21558__auto__ = e23716;
var statearr_23717_27226 = state_23614;
(statearr_23717_27226[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23614[(4)]))){
var statearr_23718_27227 = state_23614;
(statearr_23718_27227[(1)] = cljs.core.first((state_23614[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27228 = state_23614;
state_23614 = G__27228;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_23614){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_23614);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_23730 = f__22635__auto__();
(statearr_23730[(6)] = c__22634__auto___27190);

return statearr_23730;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


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__22634__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_23771){
var state_val_23776 = (state_23771[(1)]);
if((state_val_23776 === (7))){
var inst_23765 = (state_23771[(2)]);
var state_23771__$1 = state_23771;
var statearr_23807_27233 = state_23771__$1;
(statearr_23807_27233[(2)] = inst_23765);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23776 === (1))){
var inst_23736 = init;
var inst_23737 = inst_23736;
var state_23771__$1 = (function (){var statearr_23818 = state_23771;
(statearr_23818[(7)] = inst_23737);

return statearr_23818;
})();
var statearr_23820_27234 = state_23771__$1;
(statearr_23820_27234[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23776 === (4))){
var inst_23743 = (state_23771[(8)]);
var inst_23743__$1 = (state_23771[(2)]);
var inst_23744 = (inst_23743__$1 == null);
var state_23771__$1 = (function (){var statearr_23835 = state_23771;
(statearr_23835[(8)] = inst_23743__$1);

return statearr_23835;
})();
if(cljs.core.truth_(inst_23744)){
var statearr_23836_27236 = state_23771__$1;
(statearr_23836_27236[(1)] = (5));

} else {
var statearr_23838_27237 = state_23771__$1;
(statearr_23838_27237[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23776 === (6))){
var inst_23748 = (state_23771[(9)]);
var inst_23737 = (state_23771[(7)]);
var inst_23743 = (state_23771[(8)]);
var inst_23748__$1 = (f.cljs$core$IFn$_invoke$arity$2 ? f.cljs$core$IFn$_invoke$arity$2(inst_23737,inst_23743) : f.call(null, inst_23737,inst_23743));
var inst_23751 = cljs.core.reduced_QMARK_(inst_23748__$1);
var state_23771__$1 = (function (){var statearr_23855 = state_23771;
(statearr_23855[(9)] = inst_23748__$1);

return statearr_23855;
})();
if(inst_23751){
var statearr_23858_27238 = state_23771__$1;
(statearr_23858_27238[(1)] = (8));

} else {
var statearr_23865_27239 = state_23771__$1;
(statearr_23865_27239[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23776 === (3))){
var inst_23767 = (state_23771[(2)]);
var state_23771__$1 = state_23771;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23771__$1,inst_23767);
} else {
if((state_val_23776 === (2))){
var state_23771__$1 = state_23771;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23771__$1,(4),ch);
} else {
if((state_val_23776 === (9))){
var inst_23748 = (state_23771[(9)]);
var inst_23737 = inst_23748;
var state_23771__$1 = (function (){var statearr_23876 = state_23771;
(statearr_23876[(7)] = inst_23737);

return statearr_23876;
})();
var statearr_23877_27243 = state_23771__$1;
(statearr_23877_27243[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23776 === (5))){
var inst_23737 = (state_23771[(7)]);
var state_23771__$1 = state_23771;
var statearr_23878_27244 = state_23771__$1;
(statearr_23878_27244[(2)] = inst_23737);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23776 === (10))){
var inst_23763 = (state_23771[(2)]);
var state_23771__$1 = state_23771;
var statearr_23879_27245 = state_23771__$1;
(statearr_23879_27245[(2)] = inst_23763);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_23776 === (8))){
var inst_23748 = (state_23771[(9)]);
var inst_23759 = cljs.core.deref(inst_23748);
var state_23771__$1 = state_23771;
var statearr_23888_27246 = state_23771__$1;
(statearr_23888_27246[(2)] = inst_23759);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$reduce_$_state_machine__21555__auto__ = null;
var cljs$core$async$reduce_$_state_machine__21555__auto____0 = (function (){
var statearr_23897 = [null,null,null,null,null,null,null,null,null,null];
(statearr_23897[(0)] = cljs$core$async$reduce_$_state_machine__21555__auto__);

(statearr_23897[(1)] = (1));

return statearr_23897;
});
var cljs$core$async$reduce_$_state_machine__21555__auto____1 = (function (state_23771){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23771);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23899){var ex__21558__auto__ = e23899;
var statearr_23900_27248 = state_23771;
(statearr_23900_27248[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23771[(4)]))){
var statearr_23902_27249 = state_23771;
(statearr_23902_27249[(1)] = cljs.core.first((state_23771[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27250 = state_23771;
state_23771 = G__27250;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__21555__auto__ = function(state_23771){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__21555__auto____1.call(this,state_23771);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$reduce_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__21555__auto____0;
cljs$core$async$reduce_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__21555__auto____1;
return cljs$core$async$reduce_$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_23903 = f__22635__auto__();
(statearr_23903[(6)] = c__22634__auto__);

return statearr_23903;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));

return c__22634__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.cljs$core$IFn$_invoke$arity$1 ? xform.cljs$core$IFn$_invoke$arity$1(f) : xform.call(null, f));
var c__22634__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_23917){
var state_val_23918 = (state_23917[(1)]);
if((state_val_23918 === (1))){
var inst_23910 = cljs.core.async.reduce(f__$1,init,ch);
var state_23917__$1 = state_23917;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_23917__$1,(2),inst_23910);
} else {
if((state_val_23918 === (2))){
var inst_23912 = (state_23917[(2)]);
var inst_23913 = (f__$1.cljs$core$IFn$_invoke$arity$1 ? f__$1.cljs$core$IFn$_invoke$arity$1(inst_23912) : f__$1.call(null, inst_23912));
var state_23917__$1 = state_23917;
return cljs.core.async.impl.ioc_helpers.return_chan(state_23917__$1,inst_23913);
} else {
return null;
}
}
});
return (function() {
var cljs$core$async$transduce_$_state_machine__21555__auto__ = null;
var cljs$core$async$transduce_$_state_machine__21555__auto____0 = (function (){
var statearr_23933 = [null,null,null,null,null,null,null];
(statearr_23933[(0)] = cljs$core$async$transduce_$_state_machine__21555__auto__);

(statearr_23933[(1)] = (1));

return statearr_23933;
});
var cljs$core$async$transduce_$_state_machine__21555__auto____1 = (function (state_23917){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_23917);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e23941){var ex__21558__auto__ = e23941;
var statearr_23943_27252 = state_23917;
(statearr_23943_27252[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_23917[(4)]))){
var statearr_23948_27253 = state_23917;
(statearr_23948_27253[(1)] = cljs.core.first((state_23917[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27254 = state_23917;
state_23917 = G__27254;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__21555__auto__ = function(state_23917){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__21555__auto____1.call(this,state_23917);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$transduce_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__21555__auto____0;
cljs$core$async$transduce_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__21555__auto____1;
return cljs$core$async$transduce_$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_23957 = f__22635__auto__();
(statearr_23957[(6)] = c__22634__auto__);

return statearr_23957;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));

return c__22634__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_BANG_ = (function cljs$core$async$onto_chan_BANG_(var_args){
var G__23977 = arguments.length;
switch (G__23977) {
case 2:
return cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
var c__22634__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_24007){
var state_val_24008 = (state_24007[(1)]);
if((state_val_24008 === (7))){
var inst_23987 = (state_24007[(2)]);
var state_24007__$1 = state_24007;
var statearr_24026_27257 = state_24007__$1;
(statearr_24026_27257[(2)] = inst_23987);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (1))){
var inst_23981 = cljs.core.seq(coll);
var inst_23982 = inst_23981;
var state_24007__$1 = (function (){var statearr_24030 = state_24007;
(statearr_24030[(7)] = inst_23982);

return statearr_24030;
})();
var statearr_24032_27259 = state_24007__$1;
(statearr_24032_27259[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (4))){
var inst_23982 = (state_24007[(7)]);
var inst_23985 = cljs.core.first(inst_23982);
var state_24007__$1 = state_24007;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_24007__$1,(7),ch,inst_23985);
} else {
if((state_val_24008 === (13))){
var inst_23999 = (state_24007[(2)]);
var state_24007__$1 = state_24007;
var statearr_24035_27260 = state_24007__$1;
(statearr_24035_27260[(2)] = inst_23999);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (6))){
var inst_23990 = (state_24007[(2)]);
var state_24007__$1 = state_24007;
if(cljs.core.truth_(inst_23990)){
var statearr_24039_27261 = state_24007__$1;
(statearr_24039_27261[(1)] = (8));

} else {
var statearr_24040_27263 = state_24007__$1;
(statearr_24040_27263[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (3))){
var inst_24004 = (state_24007[(2)]);
var state_24007__$1 = state_24007;
return cljs.core.async.impl.ioc_helpers.return_chan(state_24007__$1,inst_24004);
} else {
if((state_val_24008 === (12))){
var state_24007__$1 = state_24007;
var statearr_24045_27264 = state_24007__$1;
(statearr_24045_27264[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (2))){
var inst_23982 = (state_24007[(7)]);
var state_24007__$1 = state_24007;
if(cljs.core.truth_(inst_23982)){
var statearr_24050_27265 = state_24007__$1;
(statearr_24050_27265[(1)] = (4));

} else {
var statearr_24051_27266 = state_24007__$1;
(statearr_24051_27266[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (11))){
var inst_23996 = cljs.core.async.close_BANG_(ch);
var state_24007__$1 = state_24007;
var statearr_24053_27268 = state_24007__$1;
(statearr_24053_27268[(2)] = inst_23996);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (9))){
var state_24007__$1 = state_24007;
if(cljs.core.truth_(close_QMARK_)){
var statearr_24055_27271 = state_24007__$1;
(statearr_24055_27271[(1)] = (11));

} else {
var statearr_24056_27272 = state_24007__$1;
(statearr_24056_27272[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (5))){
var inst_23982 = (state_24007[(7)]);
var state_24007__$1 = state_24007;
var statearr_24058_27273 = state_24007__$1;
(statearr_24058_27273[(2)] = inst_23982);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (10))){
var inst_24001 = (state_24007[(2)]);
var state_24007__$1 = state_24007;
var statearr_24062_27276 = state_24007__$1;
(statearr_24062_27276[(2)] = inst_24001);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24008 === (8))){
var inst_23982 = (state_24007[(7)]);
var inst_23992 = cljs.core.next(inst_23982);
var inst_23982__$1 = inst_23992;
var state_24007__$1 = (function (){var statearr_24069 = state_24007;
(statearr_24069[(7)] = inst_23982__$1);

return statearr_24069;
})();
var statearr_24070_27278 = state_24007__$1;
(statearr_24070_27278[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_24072 = [null,null,null,null,null,null,null,null];
(statearr_24072[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_24072[(1)] = (1));

return statearr_24072;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_24007){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_24007);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e24074){var ex__21558__auto__ = e24074;
var statearr_24075_27283 = state_24007;
(statearr_24075_27283[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_24007[(4)]))){
var statearr_24078_27285 = state_24007;
(statearr_24078_27285[(1)] = cljs.core.first((state_24007[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27287 = state_24007;
state_24007 = G__27287;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_24007){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_24007);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_24085 = f__22635__auto__();
(statearr_24085[(6)] = c__22634__auto__);

return statearr_24085;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));

return c__22634__auto__;
}));

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

/**
 * Creates and returns a channel which contains the contents of coll,
 *   closing when exhausted.
 */
cljs.core.async.to_chan_BANG_ = (function cljs$core$async$to_chan_BANG_(coll){
var ch = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(cljs.core.bounded_count((100),coll));
cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$2(ch,coll);

return ch;
});
/**
 * Deprecated - use onto-chan!
 */
cljs.core.async.onto_chan = (function cljs$core$async$onto_chan(var_args){
var G__24096 = arguments.length;
switch (G__24096) {
case 2:
return cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

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

(cljs.core.async.onto_chan.cljs$core$IFn$_invoke$arity$3 = (function (ch,coll,close_QMARK_){
return cljs.core.async.onto_chan_BANG_.cljs$core$IFn$_invoke$arity$3(ch,coll,close_QMARK_);
}));

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

/**
 * Deprecated - use to-chan!
 */
cljs.core.async.to_chan = (function cljs$core$async$to_chan(coll){
return cljs.core.async.to_chan_BANG_(coll);
});

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

var cljs$core$async$Mux$muxch_STAR_$dyn_27291 = (function (_){
var x__5350__auto__ = (((_ == null))?null:_);
var m__5351__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(_) : m__5351__auto__.call(null, _));
} else {
var m__5349__auto__ = (cljs.core.async.muxch_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(_) : m__5349__auto__.call(null, _));
} else {
throw cljs.core.missing_protocol("Mux.muxch*",_);
}
}
});
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 {
return cljs$core$async$Mux$muxch_STAR_$dyn_27291(_);
}
});


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

var cljs$core$async$Mult$tap_STAR_$dyn_27302 = (function (m,ch,close_QMARK_){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$3(m,ch,close_QMARK_) : m__5351__auto__.call(null, m,ch,close_QMARK_));
} else {
var m__5349__auto__ = (cljs.core.async.tap_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$3(m,ch,close_QMARK_) : m__5349__auto__.call(null, m,ch,close_QMARK_));
} else {
throw cljs.core.missing_protocol("Mult.tap*",m);
}
}
});
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 {
return cljs$core$async$Mult$tap_STAR_$dyn_27302(m,ch,close_QMARK_);
}
});

var cljs$core$async$Mult$untap_STAR_$dyn_27303 = (function (m,ch){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5351__auto__.call(null, m,ch));
} else {
var m__5349__auto__ = (cljs.core.async.untap_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5349__auto__.call(null, m,ch));
} else {
throw cljs.core.missing_protocol("Mult.untap*",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 {
return cljs$core$async$Mult$untap_STAR_$dyn_27303(m,ch);
}
});

var cljs$core$async$Mult$untap_all_STAR_$dyn_27316 = (function (m){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5351__auto__.call(null, m));
} else {
var m__5349__auto__ = (cljs.core.async.untap_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5349__auto__.call(null, m));
} else {
throw cljs.core.missing_protocol("Mult.untap-all*",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 {
return cljs$core$async$Mult$untap_all_STAR_$dyn_27316(m);
}
});


/**
* @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$async24186 = (function (ch,cs,meta24187){
this.ch = ch;
this.cs = cs;
this.meta24187 = meta24187;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async24186.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_24188,meta24187__$1){
var self__ = this;
var _24188__$1 = this;
return (new cljs.core.async.t_cljs$core$async24186(self__.ch,self__.cs,meta24187__$1));
}));

(cljs.core.async.t_cljs$core$async24186.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_24188){
var self__ = this;
var _24188__$1 = this;
return self__.meta24187;
}));

(cljs.core.async.t_cljs$core$async24186.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async24186.prototype.cljs$core$async$Mult$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async24186.prototype.cljs$core$async$Mult$tap_STAR_$arity$3 = (function (_,ch__$1,close_QMARK_){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(self__.cs,cljs.core.assoc,ch__$1,close_QMARK_);

return null;
}));

(cljs.core.async.t_cljs$core$async24186.prototype.cljs$core$async$Mult$untap_STAR_$arity$2 = (function (_,ch__$1){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.cs,cljs.core.dissoc,ch__$1);

return null;
}));

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

return null;
}));

(cljs.core.async.t_cljs$core$async24186.getBasis = (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,"meta24187","meta24187",-88470828,null)], null);
}));

(cljs.core.async.t_cljs$core$async24186.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async24186.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async24186");

(cljs.core.async.t_cljs$core$async24186.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async24186");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async24186.
 */
cljs.core.async.__GT_t_cljs$core$async24186 = (function cljs$core$async$__GT_t_cljs$core$async24186(ch,cs,meta24187){
return (new cljs.core.async.t_cljs$core$async24186(ch,cs,meta24187));
});


/**
 * 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.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var m = (new cljs.core.async.t_cljs$core$async24186(ch,cs,cljs.core.PersistentArrayMap.EMPTY));
var dchan = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var dctr = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
var done = (function (_){
if((cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(dchan,true);
} else {
return null;
}
});
var c__22634__auto___27320 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_24501){
var state_val_24505 = (state_24501[(1)]);
if((state_val_24505 === (7))){
var inst_24495 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24514_27321 = state_24501__$1;
(statearr_24514_27321[(2)] = inst_24495);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (20))){
var inst_24341 = (state_24501[(7)]);
var inst_24371 = cljs.core.first(inst_24341);
var inst_24389 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_24371,(0),null);
var inst_24397 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_24371,(1),null);
var state_24501__$1 = (function (){var statearr_24519 = state_24501;
(statearr_24519[(8)] = inst_24389);

return statearr_24519;
})();
if(cljs.core.truth_(inst_24397)){
var statearr_24520_27322 = state_24501__$1;
(statearr_24520_27322[(1)] = (22));

} else {
var statearr_24521_27323 = state_24501__$1;
(statearr_24521_27323[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (27))){
var inst_24268 = (state_24501[(9)]);
var inst_24437 = (state_24501[(10)]);
var inst_24435 = (state_24501[(11)]);
var inst_24442 = (state_24501[(12)]);
var inst_24442__$1 = cljs.core._nth(inst_24435,inst_24437);
var inst_24444 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_24442__$1,inst_24268,done);
var state_24501__$1 = (function (){var statearr_24524 = state_24501;
(statearr_24524[(12)] = inst_24442__$1);

return statearr_24524;
})();
if(cljs.core.truth_(inst_24444)){
var statearr_24526_27324 = state_24501__$1;
(statearr_24526_27324[(1)] = (30));

} else {
var statearr_24527_27325 = state_24501__$1;
(statearr_24527_27325[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (1))){
var state_24501__$1 = state_24501;
var statearr_24530_27326 = state_24501__$1;
(statearr_24530_27326[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (24))){
var inst_24341 = (state_24501[(7)]);
var inst_24412 = (state_24501[(2)]);
var inst_24413 = cljs.core.next(inst_24341);
var inst_24287 = inst_24413;
var inst_24288 = null;
var inst_24289 = (0);
var inst_24290 = (0);
var state_24501__$1 = (function (){var statearr_24536 = state_24501;
(statearr_24536[(13)] = inst_24289);

(statearr_24536[(14)] = inst_24290);

(statearr_24536[(15)] = inst_24288);

(statearr_24536[(16)] = inst_24287);

(statearr_24536[(17)] = inst_24412);

return statearr_24536;
})();
var statearr_24537_27331 = state_24501__$1;
(statearr_24537_27331[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (39))){
var state_24501__$1 = state_24501;
var statearr_24546_27332 = state_24501__$1;
(statearr_24546_27332[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (4))){
var inst_24268 = (state_24501[(9)]);
var inst_24268__$1 = (state_24501[(2)]);
var inst_24273 = (inst_24268__$1 == null);
var state_24501__$1 = (function (){var statearr_24549 = state_24501;
(statearr_24549[(9)] = inst_24268__$1);

return statearr_24549;
})();
if(cljs.core.truth_(inst_24273)){
var statearr_24550_27337 = state_24501__$1;
(statearr_24550_27337[(1)] = (5));

} else {
var statearr_24551_27338 = state_24501__$1;
(statearr_24551_27338[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (15))){
var inst_24289 = (state_24501[(13)]);
var inst_24290 = (state_24501[(14)]);
var inst_24288 = (state_24501[(15)]);
var inst_24287 = (state_24501[(16)]);
var inst_24326 = (state_24501[(2)]);
var inst_24330 = (inst_24290 + (1));
var tmp24541 = inst_24289;
var tmp24542 = inst_24288;
var tmp24543 = inst_24287;
var inst_24287__$1 = tmp24543;
var inst_24288__$1 = tmp24542;
var inst_24289__$1 = tmp24541;
var inst_24290__$1 = inst_24330;
var state_24501__$1 = (function (){var statearr_24552 = state_24501;
(statearr_24552[(13)] = inst_24289__$1);

(statearr_24552[(14)] = inst_24290__$1);

(statearr_24552[(15)] = inst_24288__$1);

(statearr_24552[(18)] = inst_24326);

(statearr_24552[(16)] = inst_24287__$1);

return statearr_24552;
})();
var statearr_24553_27344 = state_24501__$1;
(statearr_24553_27344[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (21))){
var inst_24416 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24557_27349 = state_24501__$1;
(statearr_24557_27349[(2)] = inst_24416);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (31))){
var inst_24442 = (state_24501[(12)]);
var inst_24448 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null, inst_24442);
var state_24501__$1 = state_24501;
var statearr_24561_27350 = state_24501__$1;
(statearr_24561_27350[(2)] = inst_24448);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (32))){
var inst_24437 = (state_24501[(10)]);
var inst_24435 = (state_24501[(11)]);
var inst_24436 = (state_24501[(19)]);
var inst_24434 = (state_24501[(20)]);
var inst_24451 = (state_24501[(2)]);
var inst_24452 = (inst_24437 + (1));
var tmp24554 = inst_24435;
var tmp24555 = inst_24436;
var tmp24556 = inst_24434;
var inst_24434__$1 = tmp24556;
var inst_24435__$1 = tmp24554;
var inst_24436__$1 = tmp24555;
var inst_24437__$1 = inst_24452;
var state_24501__$1 = (function (){var statearr_24563 = state_24501;
(statearr_24563[(10)] = inst_24437__$1);

(statearr_24563[(11)] = inst_24435__$1);

(statearr_24563[(19)] = inst_24436__$1);

(statearr_24563[(21)] = inst_24451);

(statearr_24563[(20)] = inst_24434__$1);

return statearr_24563;
})();
var statearr_24564_27353 = state_24501__$1;
(statearr_24564_27353[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (40))){
var inst_24466 = (state_24501[(22)]);
var inst_24470 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null, inst_24466);
var state_24501__$1 = state_24501;
var statearr_24566_27354 = state_24501__$1;
(statearr_24566_27354[(2)] = inst_24470);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (33))){
var inst_24455 = (state_24501[(23)]);
var inst_24457 = cljs.core.chunked_seq_QMARK_(inst_24455);
var state_24501__$1 = state_24501;
if(inst_24457){
var statearr_24575_27355 = state_24501__$1;
(statearr_24575_27355[(1)] = (36));

} else {
var statearr_24576_27356 = state_24501__$1;
(statearr_24576_27356[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (13))){
var inst_24315 = (state_24501[(24)]);
var inst_24323 = cljs.core.async.close_BANG_(inst_24315);
var state_24501__$1 = state_24501;
var statearr_24577_27360 = state_24501__$1;
(statearr_24577_27360[(2)] = inst_24323);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (22))){
var inst_24389 = (state_24501[(8)]);
var inst_24409 = cljs.core.async.close_BANG_(inst_24389);
var state_24501__$1 = state_24501;
var statearr_24578_27361 = state_24501__$1;
(statearr_24578_27361[(2)] = inst_24409);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (36))){
var inst_24455 = (state_24501[(23)]);
var inst_24460 = cljs.core.chunk_first(inst_24455);
var inst_24461 = cljs.core.chunk_rest(inst_24455);
var inst_24462 = cljs.core.count(inst_24460);
var inst_24434 = inst_24461;
var inst_24435 = inst_24460;
var inst_24436 = inst_24462;
var inst_24437 = (0);
var state_24501__$1 = (function (){var statearr_24587 = state_24501;
(statearr_24587[(10)] = inst_24437);

(statearr_24587[(11)] = inst_24435);

(statearr_24587[(19)] = inst_24436);

(statearr_24587[(20)] = inst_24434);

return statearr_24587;
})();
var statearr_24588_27362 = state_24501__$1;
(statearr_24588_27362[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (41))){
var inst_24455 = (state_24501[(23)]);
var inst_24472 = (state_24501[(2)]);
var inst_24473 = cljs.core.next(inst_24455);
var inst_24434 = inst_24473;
var inst_24435 = null;
var inst_24436 = (0);
var inst_24437 = (0);
var state_24501__$1 = (function (){var statearr_24591 = state_24501;
(statearr_24591[(25)] = inst_24472);

(statearr_24591[(10)] = inst_24437);

(statearr_24591[(11)] = inst_24435);

(statearr_24591[(19)] = inst_24436);

(statearr_24591[(20)] = inst_24434);

return statearr_24591;
})();
var statearr_24592_27363 = state_24501__$1;
(statearr_24592_27363[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (43))){
var state_24501__$1 = state_24501;
var statearr_24594_27364 = state_24501__$1;
(statearr_24594_27364[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (29))){
var inst_24481 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24597_27369 = state_24501__$1;
(statearr_24597_27369[(2)] = inst_24481);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (44))){
var inst_24492 = (state_24501[(2)]);
var state_24501__$1 = (function (){var statearr_24603 = state_24501;
(statearr_24603[(26)] = inst_24492);

return statearr_24603;
})();
var statearr_24604_27370 = state_24501__$1;
(statearr_24604_27370[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (6))){
var inst_24426 = (state_24501[(27)]);
var inst_24425 = cljs.core.deref(cs);
var inst_24426__$1 = cljs.core.keys(inst_24425);
var inst_24427 = cljs.core.count(inst_24426__$1);
var inst_24428 = cljs.core.reset_BANG_(dctr,inst_24427);
var inst_24433 = cljs.core.seq(inst_24426__$1);
var inst_24434 = inst_24433;
var inst_24435 = null;
var inst_24436 = (0);
var inst_24437 = (0);
var state_24501__$1 = (function (){var statearr_24606 = state_24501;
(statearr_24606[(28)] = inst_24428);

(statearr_24606[(10)] = inst_24437);

(statearr_24606[(11)] = inst_24435);

(statearr_24606[(19)] = inst_24436);

(statearr_24606[(27)] = inst_24426__$1);

(statearr_24606[(20)] = inst_24434);

return statearr_24606;
})();
var statearr_24608_27371 = state_24501__$1;
(statearr_24608_27371[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (28))){
var inst_24455 = (state_24501[(23)]);
var inst_24434 = (state_24501[(20)]);
var inst_24455__$1 = cljs.core.seq(inst_24434);
var state_24501__$1 = (function (){var statearr_24609 = state_24501;
(statearr_24609[(23)] = inst_24455__$1);

return statearr_24609;
})();
if(inst_24455__$1){
var statearr_24610_27372 = state_24501__$1;
(statearr_24610_27372[(1)] = (33));

} else {
var statearr_24612_27374 = state_24501__$1;
(statearr_24612_27374[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (25))){
var inst_24437 = (state_24501[(10)]);
var inst_24436 = (state_24501[(19)]);
var inst_24439 = (inst_24437 < inst_24436);
var inst_24440 = inst_24439;
var state_24501__$1 = state_24501;
if(cljs.core.truth_(inst_24440)){
var statearr_24615_27378 = state_24501__$1;
(statearr_24615_27378[(1)] = (27));

} else {
var statearr_24618_27379 = state_24501__$1;
(statearr_24618_27379[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (34))){
var state_24501__$1 = state_24501;
var statearr_24620_27380 = state_24501__$1;
(statearr_24620_27380[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (17))){
var state_24501__$1 = state_24501;
var statearr_24623_27381 = state_24501__$1;
(statearr_24623_27381[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (3))){
var inst_24497 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
return cljs.core.async.impl.ioc_helpers.return_chan(state_24501__$1,inst_24497);
} else {
if((state_val_24505 === (12))){
var inst_24421 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24628_27382 = state_24501__$1;
(statearr_24628_27382[(2)] = inst_24421);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (2))){
var state_24501__$1 = state_24501;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_24501__$1,(4),ch);
} else {
if((state_val_24505 === (23))){
var state_24501__$1 = state_24501;
var statearr_24630_27383 = state_24501__$1;
(statearr_24630_27383[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (35))){
var inst_24479 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24631_27384 = state_24501__$1;
(statearr_24631_27384[(2)] = inst_24479);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (19))){
var inst_24341 = (state_24501[(7)]);
var inst_24352 = cljs.core.chunk_first(inst_24341);
var inst_24353 = cljs.core.chunk_rest(inst_24341);
var inst_24355 = cljs.core.count(inst_24352);
var inst_24287 = inst_24353;
var inst_24288 = inst_24352;
var inst_24289 = inst_24355;
var inst_24290 = (0);
var state_24501__$1 = (function (){var statearr_24635 = state_24501;
(statearr_24635[(13)] = inst_24289);

(statearr_24635[(14)] = inst_24290);

(statearr_24635[(15)] = inst_24288);

(statearr_24635[(16)] = inst_24287);

return statearr_24635;
})();
var statearr_24637_27385 = state_24501__$1;
(statearr_24637_27385[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (11))){
var inst_24341 = (state_24501[(7)]);
var inst_24287 = (state_24501[(16)]);
var inst_24341__$1 = cljs.core.seq(inst_24287);
var state_24501__$1 = (function (){var statearr_24640 = state_24501;
(statearr_24640[(7)] = inst_24341__$1);

return statearr_24640;
})();
if(inst_24341__$1){
var statearr_24641_27386 = state_24501__$1;
(statearr_24641_27386[(1)] = (16));

} else {
var statearr_24645_27387 = state_24501__$1;
(statearr_24645_27387[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (9))){
var inst_24423 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24646_27388 = state_24501__$1;
(statearr_24646_27388[(2)] = inst_24423);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (5))){
var inst_24284 = cljs.core.deref(cs);
var inst_24285 = cljs.core.seq(inst_24284);
var inst_24287 = inst_24285;
var inst_24288 = null;
var inst_24289 = (0);
var inst_24290 = (0);
var state_24501__$1 = (function (){var statearr_24648 = state_24501;
(statearr_24648[(13)] = inst_24289);

(statearr_24648[(14)] = inst_24290);

(statearr_24648[(15)] = inst_24288);

(statearr_24648[(16)] = inst_24287);

return statearr_24648;
})();
var statearr_24652_27393 = state_24501__$1;
(statearr_24652_27393[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (14))){
var state_24501__$1 = state_24501;
var statearr_24653_27394 = state_24501__$1;
(statearr_24653_27394[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (45))){
var inst_24488 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24654_27395 = state_24501__$1;
(statearr_24654_27395[(2)] = inst_24488);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (26))){
var inst_24426 = (state_24501[(27)]);
var inst_24483 = (state_24501[(2)]);
var inst_24484 = cljs.core.seq(inst_24426);
var state_24501__$1 = (function (){var statearr_24655 = state_24501;
(statearr_24655[(29)] = inst_24483);

return statearr_24655;
})();
if(inst_24484){
var statearr_24656_27396 = state_24501__$1;
(statearr_24656_27396[(1)] = (42));

} else {
var statearr_24657_27397 = state_24501__$1;
(statearr_24657_27397[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (16))){
var inst_24341 = (state_24501[(7)]);
var inst_24345 = cljs.core.chunked_seq_QMARK_(inst_24341);
var state_24501__$1 = state_24501;
if(inst_24345){
var statearr_24658_27400 = state_24501__$1;
(statearr_24658_27400[(1)] = (19));

} else {
var statearr_24659_27404 = state_24501__$1;
(statearr_24659_27404[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (38))){
var inst_24476 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24661_27405 = state_24501__$1;
(statearr_24661_27405[(2)] = inst_24476);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (30))){
var state_24501__$1 = state_24501;
var statearr_24662_27406 = state_24501__$1;
(statearr_24662_27406[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (10))){
var inst_24290 = (state_24501[(14)]);
var inst_24288 = (state_24501[(15)]);
var inst_24311 = cljs.core._nth(inst_24288,inst_24290);
var inst_24315 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_24311,(0),null);
var inst_24316 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_24311,(1),null);
var state_24501__$1 = (function (){var statearr_24667 = state_24501;
(statearr_24667[(24)] = inst_24315);

return statearr_24667;
})();
if(cljs.core.truth_(inst_24316)){
var statearr_24669_27407 = state_24501__$1;
(statearr_24669_27407[(1)] = (13));

} else {
var statearr_24672_27408 = state_24501__$1;
(statearr_24672_27408[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (18))){
var inst_24419 = (state_24501[(2)]);
var state_24501__$1 = state_24501;
var statearr_24673_27410 = state_24501__$1;
(statearr_24673_27410[(2)] = inst_24419);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (42))){
var state_24501__$1 = state_24501;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_24501__$1,(45),dchan);
} else {
if((state_val_24505 === (37))){
var inst_24466 = (state_24501[(22)]);
var inst_24268 = (state_24501[(9)]);
var inst_24455 = (state_24501[(23)]);
var inst_24466__$1 = cljs.core.first(inst_24455);
var inst_24467 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_24466__$1,inst_24268,done);
var state_24501__$1 = (function (){var statearr_24674 = state_24501;
(statearr_24674[(22)] = inst_24466__$1);

return statearr_24674;
})();
if(cljs.core.truth_(inst_24467)){
var statearr_24675_27413 = state_24501__$1;
(statearr_24675_27413[(1)] = (39));

} else {
var statearr_24676_27414 = state_24501__$1;
(statearr_24676_27414[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24505 === (8))){
var inst_24289 = (state_24501[(13)]);
var inst_24290 = (state_24501[(14)]);
var inst_24300 = (inst_24290 < inst_24289);
var inst_24301 = inst_24300;
var state_24501__$1 = state_24501;
if(cljs.core.truth_(inst_24301)){
var statearr_24677_27415 = state_24501__$1;
(statearr_24677_27415[(1)] = (10));

} else {
var statearr_24678_27416 = state_24501__$1;
(statearr_24678_27416[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mult_$_state_machine__21555__auto__ = null;
var cljs$core$async$mult_$_state_machine__21555__auto____0 = (function (){
var statearr_24679 = [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_24679[(0)] = cljs$core$async$mult_$_state_machine__21555__auto__);

(statearr_24679[(1)] = (1));

return statearr_24679;
});
var cljs$core$async$mult_$_state_machine__21555__auto____1 = (function (state_24501){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_24501);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e24682){var ex__21558__auto__ = e24682;
var statearr_24684_27417 = state_24501;
(statearr_24684_27417[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_24501[(4)]))){
var statearr_24685_27418 = state_24501;
(statearr_24685_27418[(1)] = cljs.core.first((state_24501[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27419 = state_24501;
state_24501 = G__27419;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__21555__auto__ = function(state_24501){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__21555__auto____1.call(this,state_24501);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mult_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__21555__auto____0;
cljs$core$async$mult_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__21555__auto____1;
return cljs$core$async$mult_$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_24690 = f__22635__auto__();
(statearr_24690[(6)] = c__22634__auto___27320);

return statearr_24690;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


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

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

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

}
});

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

(cljs.core.async.tap.cljs$core$IFn$_invoke$arity$3 = (function (mult,ch,close_QMARK_){
cljs.core.async.tap_STAR_(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_(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_(mult);
});

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

var cljs$core$async$Mix$admix_STAR_$dyn_27430 = (function (m,ch){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5351__auto__.call(null, m,ch));
} else {
var m__5349__auto__ = (cljs.core.async.admix_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5349__auto__.call(null, m,ch));
} else {
throw cljs.core.missing_protocol("Mix.admix*",m);
}
}
});
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 {
return cljs$core$async$Mix$admix_STAR_$dyn_27430(m,ch);
}
});

var cljs$core$async$Mix$unmix_STAR_$dyn_27431 = (function (m,ch){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5351__auto__.call(null, m,ch));
} else {
var m__5349__auto__ = (cljs.core.async.unmix_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5349__auto__.call(null, m,ch));
} else {
throw cljs.core.missing_protocol("Mix.unmix*",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 {
return cljs$core$async$Mix$unmix_STAR_$dyn_27431(m,ch);
}
});

var cljs$core$async$Mix$unmix_all_STAR_$dyn_27433 = (function (m){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5351__auto__.call(null, m));
} else {
var m__5349__auto__ = (cljs.core.async.unmix_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5349__auto__.call(null, m));
} else {
throw cljs.core.missing_protocol("Mix.unmix-all*",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 {
return cljs$core$async$Mix$unmix_all_STAR_$dyn_27433(m);
}
});

var cljs$core$async$Mix$toggle_STAR_$dyn_27438 = (function (m,state_map){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,state_map) : m__5351__auto__.call(null, m,state_map));
} else {
var m__5349__auto__ = (cljs.core.async.toggle_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,state_map) : m__5349__auto__.call(null, m,state_map));
} else {
throw cljs.core.missing_protocol("Mix.toggle*",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 {
return cljs$core$async$Mix$toggle_STAR_$dyn_27438(m,state_map);
}
});

var cljs$core$async$Mix$solo_mode_STAR_$dyn_27439 = (function (m,mode){
var x__5350__auto__ = (((m == null))?null:m);
var m__5351__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(m,mode) : m__5351__auto__.call(null, m,mode));
} else {
var m__5349__auto__ = (cljs.core.async.solo_mode_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(m,mode) : m__5349__auto__.call(null, m,mode));
} else {
throw cljs.core.missing_protocol("Mix.solo-mode*",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 {
return cljs$core$async$Mix$solo_mode_STAR_$dyn_27439(m,mode);
}
});

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

var G__27442 = (i__5727__auto___27441 + (1));
i__5727__auto___27441 = G__27442;
continue;
} else {
}
break;
}

var argseq__5733__auto__ = ((((3) < args__5732__auto__.length))?(new cljs.core.IndexedSeq(args__5732__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__5733__auto__);
});

(cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__24737){
var map__24738 = p__24737;
var map__24738__$1 = cljs.core.__destructure_map(map__24738);
var opts = map__24738__$1;
var statearr_24739_27444 = state;
(statearr_24739_27444[(1)] = cont_block);


var temp__5804__auto__ = cljs.core.async.do_alts((function (val){
var statearr_24741_27445 = state;
(statearr_24741_27445[(2)] = val);


return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
}),ports,opts);
if(cljs.core.truth_(temp__5804__auto__)){
var cb = temp__5804__auto__;
var statearr_24742_27449 = state;
(statearr_24742_27449[(2)] = cljs.core.deref(cb));


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

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

/** @this {Function} */
(cljs.core.async.ioc_alts_BANG_.cljs$lang$applyTo = (function (seq24730){
var G__24731 = cljs.core.first(seq24730);
var seq24730__$1 = cljs.core.next(seq24730);
var G__24732 = cljs.core.first(seq24730__$1);
var seq24730__$2 = cljs.core.next(seq24730__$1);
var G__24733 = cljs.core.first(seq24730__$2);
var seq24730__$3 = cljs.core.next(seq24730__$2);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__24731,G__24732,G__24733,seq24730__$3);
}));


/**
* @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$async24757 = (function (change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta24758){
this.change = change;
this.solo_mode = solo_mode;
this.pick = pick;
this.cs = cs;
this.calc_state = calc_state;
this.out = out;
this.changed = changed;
this.solo_modes = solo_modes;
this.attrs = attrs;
this.meta24758 = meta24758;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_24759,meta24758__$1){
var self__ = this;
var _24759__$1 = this;
return (new cljs.core.async.t_cljs$core$async24757(self__.change,self__.solo_mode,self__.pick,self__.cs,self__.calc_state,self__.out,self__.changed,self__.solo_modes,self__.attrs,meta24758__$1));
}));

(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_24759){
var self__ = this;
var _24759__$1 = this;
return self__.meta24758;
}));

(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$async$Mix$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$async$Mix$admix_STAR_$arity$2 = (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(self__.cs,cljs.core.assoc,ch,cljs.core.PersistentArrayMap.EMPTY);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null, ));
}));

(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$async$Mix$unmix_STAR_$arity$2 = (function (_,ch){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.cs,cljs.core.dissoc,ch);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null, ));
}));

(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$async$Mix$unmix_all_STAR_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
cljs.core.reset_BANG_(self__.cs,cljs.core.PersistentArrayMap.EMPTY);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null, ));
}));

(cljs.core.async.t_cljs$core$async24757.prototype.cljs$core$async$Mix$toggle_STAR_$arity$2 = (function (_,state_map){
var self__ = this;
var ___$1 = this;
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.cs,cljs.core.partial.cljs$core$IFn$_invoke$arity$2(cljs.core.merge_with,cljs.core.merge),state_map);

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null, ));
}));

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

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

return (self__.changed.cljs$core$IFn$_invoke$arity$0 ? self__.changed.cljs$core$IFn$_invoke$arity$0() : self__.changed.call(null, ));
}));

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

(cljs.core.async.t_cljs$core$async24757.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async24757.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async24757");

(cljs.core.async.t_cljs$core$async24757.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async24757");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async24757.
 */
cljs.core.async.__GT_t_cljs$core$async24757 = (function cljs$core$async$__GT_t_cljs$core$async24757(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta24758){
return (new cljs.core.async.t_cljs$core$async24757(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta24758));
});


/**
 * 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.cljs$core$IFn$_invoke$arity$1(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.cljs$core$IFn$_invoke$arity$2(solo_modes,new cljs.core.Keyword(null,"solo","solo",-316350075));
var solo_mode = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"mute","mute",1151223646));
var change = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(cljs.core.async.sliding_buffer((1)));
var changed = (function (){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(change,true);
});
var pick = (function (attr,chs){
return cljs.core.reduce_kv((function (ret,c,v){
if(cljs.core.truth_((attr.cljs$core$IFn$_invoke$arity$1 ? attr.cljs$core$IFn$_invoke$arity$1(v) : attr.call(null, v)))){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(ret,c);
} else {
return ret;
}
}),cljs.core.PersistentHashSet.EMPTY,chs);
});
var calc_state = (function (){
var chs = cljs.core.deref(cs);
var mode = cljs.core.deref(solo_mode);
var solos = pick(new cljs.core.Keyword(null,"solo","solo",-316350075),chs);
var pauses = pick(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(new cljs.core.Keyword(null,"mute","mute",1151223646),chs),new cljs.core.Keyword(null,"reads","reads",-1215067361),cljs.core.conj.cljs$core$IFn$_invoke$arity$2(((((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(mode,new cljs.core.Keyword(null,"pause","pause",-2095325672))) && ((!(cljs.core.empty_QMARK_(solos))))))?cljs.core.vec(solos):cljs.core.vec(cljs.core.remove.cljs$core$IFn$_invoke$arity$2(pauses,cljs.core.keys(chs)))),change)], null);
});
var m = (new cljs.core.async.t_cljs$core$async24757(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,cljs.core.PersistentArrayMap.EMPTY));
var c__22634__auto___27465 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_24890){
var state_val_24891 = (state_24890[(1)]);
if((state_val_24891 === (7))){
var inst_24844 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
if(cljs.core.truth_(inst_24844)){
var statearr_24892_27466 = state_24890__$1;
(statearr_24892_27466[(1)] = (8));

} else {
var statearr_24893_27467 = state_24890__$1;
(statearr_24893_27467[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (20))){
var inst_24834 = (state_24890[(7)]);
var state_24890__$1 = state_24890;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_24890__$1,(23),out,inst_24834);
} else {
if((state_val_24891 === (1))){
var inst_24805 = calc_state();
var inst_24807 = cljs.core.__destructure_map(inst_24805);
var inst_24808 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_24807,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_24810 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_24807,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_24811 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_24807,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_24812 = inst_24805;
var state_24890__$1 = (function (){var statearr_24894 = state_24890;
(statearr_24894[(8)] = inst_24812);

(statearr_24894[(9)] = inst_24810);

(statearr_24894[(10)] = inst_24808);

(statearr_24894[(11)] = inst_24811);

return statearr_24894;
})();
var statearr_24895_27474 = state_24890__$1;
(statearr_24895_27474[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (24))){
var inst_24822 = (state_24890[(12)]);
var inst_24812 = inst_24822;
var state_24890__$1 = (function (){var statearr_24897 = state_24890;
(statearr_24897[(8)] = inst_24812);

return statearr_24897;
})();
var statearr_24898_27478 = state_24890__$1;
(statearr_24898_27478[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (4))){
var inst_24839 = (state_24890[(13)]);
var inst_24834 = (state_24890[(7)]);
var inst_24833 = (state_24890[(2)]);
var inst_24834__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_24833,(0),null);
var inst_24835 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_24833,(1),null);
var inst_24839__$1 = (inst_24834__$1 == null);
var state_24890__$1 = (function (){var statearr_24902 = state_24890;
(statearr_24902[(13)] = inst_24839__$1);

(statearr_24902[(14)] = inst_24835);

(statearr_24902[(7)] = inst_24834__$1);

return statearr_24902;
})();
if(cljs.core.truth_(inst_24839__$1)){
var statearr_24903_27479 = state_24890__$1;
(statearr_24903_27479[(1)] = (5));

} else {
var statearr_24904_27480 = state_24890__$1;
(statearr_24904_27480[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (15))){
var inst_24858 = (state_24890[(15)]);
var inst_24823 = (state_24890[(16)]);
var inst_24858__$1 = cljs.core.empty_QMARK_(inst_24823);
var state_24890__$1 = (function (){var statearr_24910 = state_24890;
(statearr_24910[(15)] = inst_24858__$1);

return statearr_24910;
})();
if(inst_24858__$1){
var statearr_24912_27481 = state_24890__$1;
(statearr_24912_27481[(1)] = (17));

} else {
var statearr_24913_27482 = state_24890__$1;
(statearr_24913_27482[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (21))){
var inst_24822 = (state_24890[(12)]);
var inst_24812 = inst_24822;
var state_24890__$1 = (function (){var statearr_24914 = state_24890;
(statearr_24914[(8)] = inst_24812);

return statearr_24914;
})();
var statearr_24915_27483 = state_24890__$1;
(statearr_24915_27483[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (13))){
var inst_24851 = (state_24890[(2)]);
var inst_24852 = calc_state();
var inst_24812 = inst_24852;
var state_24890__$1 = (function (){var statearr_24916 = state_24890;
(statearr_24916[(8)] = inst_24812);

(statearr_24916[(17)] = inst_24851);

return statearr_24916;
})();
var statearr_24917_27484 = state_24890__$1;
(statearr_24917_27484[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (22))){
var inst_24878 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
var statearr_24919_27485 = state_24890__$1;
(statearr_24919_27485[(2)] = inst_24878);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (6))){
var inst_24835 = (state_24890[(14)]);
var inst_24842 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_24835,change);
var state_24890__$1 = state_24890;
var statearr_24920_27486 = state_24890__$1;
(statearr_24920_27486[(2)] = inst_24842);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (25))){
var state_24890__$1 = state_24890;
var statearr_24921_27489 = state_24890__$1;
(statearr_24921_27489[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (17))){
var inst_24835 = (state_24890[(14)]);
var inst_24824 = (state_24890[(18)]);
var inst_24860 = (inst_24824.cljs$core$IFn$_invoke$arity$1 ? inst_24824.cljs$core$IFn$_invoke$arity$1(inst_24835) : inst_24824.call(null, inst_24835));
var inst_24861 = cljs.core.not(inst_24860);
var state_24890__$1 = state_24890;
var statearr_24923_27491 = state_24890__$1;
(statearr_24923_27491[(2)] = inst_24861);

(statearr_24923_27491[(1)] = (19));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (3))){
var inst_24882 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
return cljs.core.async.impl.ioc_helpers.return_chan(state_24890__$1,inst_24882);
} else {
if((state_val_24891 === (12))){
var state_24890__$1 = state_24890;
var statearr_24926_27492 = state_24890__$1;
(statearr_24926_27492[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (2))){
var inst_24812 = (state_24890[(8)]);
var inst_24822 = (state_24890[(12)]);
var inst_24822__$1 = cljs.core.__destructure_map(inst_24812);
var inst_24823 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_24822__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_24824 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_24822__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_24825 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_24822__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_24890__$1 = (function (){var statearr_24927 = state_24890;
(statearr_24927[(12)] = inst_24822__$1);

(statearr_24927[(18)] = inst_24824);

(statearr_24927[(16)] = inst_24823);

return statearr_24927;
})();
return cljs.core.async.ioc_alts_BANG_(state_24890__$1,(4),inst_24825);
} else {
if((state_val_24891 === (23))){
var inst_24869 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
if(cljs.core.truth_(inst_24869)){
var statearr_24928_27496 = state_24890__$1;
(statearr_24928_27496[(1)] = (24));

} else {
var statearr_24929_27497 = state_24890__$1;
(statearr_24929_27497[(1)] = (25));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (19))){
var inst_24864 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
var statearr_24930_27498 = state_24890__$1;
(statearr_24930_27498[(2)] = inst_24864);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (11))){
var inst_24835 = (state_24890[(14)]);
var inst_24848 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(cs,cljs.core.dissoc,inst_24835);
var state_24890__$1 = state_24890;
var statearr_24931_27499 = state_24890__$1;
(statearr_24931_27499[(2)] = inst_24848);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (9))){
var inst_24835 = (state_24890[(14)]);
var inst_24855 = (state_24890[(19)]);
var inst_24823 = (state_24890[(16)]);
var inst_24855__$1 = (inst_24823.cljs$core$IFn$_invoke$arity$1 ? inst_24823.cljs$core$IFn$_invoke$arity$1(inst_24835) : inst_24823.call(null, inst_24835));
var state_24890__$1 = (function (){var statearr_24932 = state_24890;
(statearr_24932[(19)] = inst_24855__$1);

return statearr_24932;
})();
if(cljs.core.truth_(inst_24855__$1)){
var statearr_24933_27500 = state_24890__$1;
(statearr_24933_27500[(1)] = (14));

} else {
var statearr_24935_27501 = state_24890__$1;
(statearr_24935_27501[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (5))){
var inst_24839 = (state_24890[(13)]);
var state_24890__$1 = state_24890;
var statearr_24936_27502 = state_24890__$1;
(statearr_24936_27502[(2)] = inst_24839);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (14))){
var inst_24855 = (state_24890[(19)]);
var state_24890__$1 = state_24890;
var statearr_24938_27503 = state_24890__$1;
(statearr_24938_27503[(2)] = inst_24855);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (26))){
var inst_24874 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
var statearr_24942_27505 = state_24890__$1;
(statearr_24942_27505[(2)] = inst_24874);

(statearr_24942_27505[(1)] = (22));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (16))){
var inst_24866 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
if(cljs.core.truth_(inst_24866)){
var statearr_24943_27506 = state_24890__$1;
(statearr_24943_27506[(1)] = (20));

} else {
var statearr_24944_27507 = state_24890__$1;
(statearr_24944_27507[(1)] = (21));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (10))){
var inst_24880 = (state_24890[(2)]);
var state_24890__$1 = state_24890;
var statearr_24947_27508 = state_24890__$1;
(statearr_24947_27508[(2)] = inst_24880);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (18))){
var inst_24858 = (state_24890[(15)]);
var state_24890__$1 = state_24890;
var statearr_24954_27509 = state_24890__$1;
(statearr_24954_27509[(2)] = inst_24858);

(statearr_24954_27509[(1)] = (19));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_24891 === (8))){
var inst_24834 = (state_24890[(7)]);
var inst_24846 = (inst_24834 == null);
var state_24890__$1 = state_24890;
if(cljs.core.truth_(inst_24846)){
var statearr_24955_27510 = state_24890__$1;
(statearr_24955_27510[(1)] = (11));

} else {
var statearr_24956_27511 = state_24890__$1;
(statearr_24956_27511[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mix_$_state_machine__21555__auto__ = null;
var cljs$core$async$mix_$_state_machine__21555__auto____0 = (function (){
var statearr_24960 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_24960[(0)] = cljs$core$async$mix_$_state_machine__21555__auto__);

(statearr_24960[(1)] = (1));

return statearr_24960;
});
var cljs$core$async$mix_$_state_machine__21555__auto____1 = (function (state_24890){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_24890);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e24962){var ex__21558__auto__ = e24962;
var statearr_24963_27513 = state_24890;
(statearr_24963_27513[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_24890[(4)]))){
var statearr_24965_27514 = state_24890;
(statearr_24965_27514[(1)] = cljs.core.first((state_24890[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27515 = state_24890;
state_24890 = G__27515;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__21555__auto__ = function(state_24890){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__21555__auto____1.call(this,state_24890);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mix_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__21555__auto____0;
cljs$core$async$mix_$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__21555__auto____1;
return cljs$core$async$mix_$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_24966 = f__22635__auto__();
(statearr_24966[(6)] = c__22634__auto___27465);

return statearr_24966;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


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_(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_(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_(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_(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_(mix,mode);
});

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

var cljs$core$async$Pub$sub_STAR_$dyn_27525 = (function (p,v,ch,close_QMARK_){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$4 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$4(p,v,ch,close_QMARK_) : m__5351__auto__.call(null, p,v,ch,close_QMARK_));
} else {
var m__5349__auto__ = (cljs.core.async.sub_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$4 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$4(p,v,ch,close_QMARK_) : m__5349__auto__.call(null, p,v,ch,close_QMARK_));
} else {
throw cljs.core.missing_protocol("Pub.sub*",p);
}
}
});
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 {
return cljs$core$async$Pub$sub_STAR_$dyn_27525(p,v,ch,close_QMARK_);
}
});

var cljs$core$async$Pub$unsub_STAR_$dyn_27528 = (function (p,v,ch){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$3(p,v,ch) : m__5351__auto__.call(null, p,v,ch));
} else {
var m__5349__auto__ = (cljs.core.async.unsub_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$3(p,v,ch) : m__5349__auto__.call(null, p,v,ch));
} else {
throw cljs.core.missing_protocol("Pub.unsub*",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 {
return cljs$core$async$Pub$unsub_STAR_$dyn_27528(p,v,ch);
}
});

var cljs$core$async$Pub$unsub_all_STAR_$dyn_27530 = (function() {
var G__27531 = null;
var G__27531__1 = (function (p){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5351__auto__.call(null, p));
} else {
var m__5349__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5349__auto__.call(null, p));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
var G__27531__2 = (function (p,v){
var x__5350__auto__ = (((p == null))?null:p);
var m__5351__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5351__auto__.call(null, p,v));
} else {
var m__5349__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5349__auto__.call(null, p,v));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
G__27531 = function(p,v){
switch(arguments.length){
case 1:
return G__27531__1.call(this,p);
case 2:
return G__27531__2.call(this,p,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__27531.cljs$core$IFn$_invoke$arity$1 = G__27531__1;
G__27531.cljs$core$IFn$_invoke$arity$2 = G__27531__2;
return G__27531;
})()
;
cljs.core.async.unsub_all_STAR_ = (function cljs$core$async$unsub_all_STAR_(var_args){
var G__24982 = arguments.length;
switch (G__24982) {
case 1:
return cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

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

}
});

(cljs.core.async.unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1 = (function (p){
if((((!((p == null)))) && ((!((p.cljs$core$async$Pub$unsub_all_STAR_$arity$1 == null)))))){
return p.cljs$core$async$Pub$unsub_all_STAR_$arity$1(p);
} else {
return cljs$core$async$Pub$unsub_all_STAR_$dyn_27530(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 {
return cljs$core$async$Pub$unsub_all_STAR_$dyn_27530(p,v);
}
}));

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



/**
* @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$async24994 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta24995){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta24995 = meta24995;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async24994.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_24996,meta24995__$1){
var self__ = this;
var _24996__$1 = this;
return (new cljs.core.async.t_cljs$core$async24994(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta24995__$1));
}));

(cljs.core.async.t_cljs$core$async24994.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_24996){
var self__ = this;
var _24996__$1 = this;
return self__.meta24995;
}));

(cljs.core.async.t_cljs$core$async24994.prototype.cljs$core$async$Mux$ = cljs.core.PROTOCOL_SENTINEL);

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

(cljs.core.async.t_cljs$core$async24994.prototype.cljs$core$async$Pub$ = cljs.core.PROTOCOL_SENTINEL);

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

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

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

(cljs.core.async.t_cljs$core$async24994.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$2 = (function (_,topic){
var self__ = this;
var ___$1 = this;
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(self__.mults,cljs.core.dissoc,topic);
}));

(cljs.core.async.t_cljs$core$async24994.getBasis = (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,"meta24995","meta24995",-1489634401,null)], null);
}));

(cljs.core.async.t_cljs$core$async24994.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async24994.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async24994");

(cljs.core.async.t_cljs$core$async24994.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async24994");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async24994.
 */
cljs.core.async.__GT_t_cljs$core$async24994 = (function cljs$core$async$__GT_t_cljs$core$async24994(ch,topic_fn,buf_fn,mults,ensure_mult,meta24995){
return (new cljs.core.async.t_cljs$core$async24994(ch,topic_fn,buf_fn,mults,ensure_mult,meta24995));
});


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

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

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

}
});

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

(cljs.core.async.pub.cljs$core$IFn$_invoke$arity$3 = (function (ch,topic_fn,buf_fn){
var mults = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
var ensure_mult = (function (topic){
var or__5002__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(mults),topic);
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(mults,(function (p1__24990_SHARP_){
if(cljs.core.truth_((p1__24990_SHARP_.cljs$core$IFn$_invoke$arity$1 ? p1__24990_SHARP_.cljs$core$IFn$_invoke$arity$1(topic) : p1__24990_SHARP_.call(null, topic)))){
return p1__24990_SHARP_;
} else {
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(p1__24990_SHARP_,topic,cljs.core.async.mult(cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((buf_fn.cljs$core$IFn$_invoke$arity$1 ? buf_fn.cljs$core$IFn$_invoke$arity$1(topic) : buf_fn.call(null, topic)))));
}
})),topic);
}
});
var p = (new cljs.core.async.t_cljs$core$async24994(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
var c__22634__auto___27555 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_25123){
var state_val_25124 = (state_25123[(1)]);
if((state_val_25124 === (7))){
var inst_25109 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
var statearr_25135_27556 = state_25123__$1;
(statearr_25135_27556[(2)] = inst_25109);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (20))){
var state_25123__$1 = state_25123;
var statearr_25136_27557 = state_25123__$1;
(statearr_25136_27557[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (1))){
var state_25123__$1 = state_25123;
var statearr_25145_27558 = state_25123__$1;
(statearr_25145_27558[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (24))){
var inst_25092 = (state_25123[(7)]);
var inst_25101 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(mults,cljs.core.dissoc,inst_25092);
var state_25123__$1 = state_25123;
var statearr_25150_27559 = state_25123__$1;
(statearr_25150_27559[(2)] = inst_25101);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (4))){
var inst_25015 = (state_25123[(8)]);
var inst_25015__$1 = (state_25123[(2)]);
var inst_25016 = (inst_25015__$1 == null);
var state_25123__$1 = (function (){var statearr_25151 = state_25123;
(statearr_25151[(8)] = inst_25015__$1);

return statearr_25151;
})();
if(cljs.core.truth_(inst_25016)){
var statearr_25159_27560 = state_25123__$1;
(statearr_25159_27560[(1)] = (5));

} else {
var statearr_25160_27561 = state_25123__$1;
(statearr_25160_27561[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (15))){
var inst_25083 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
var statearr_25169_27564 = state_25123__$1;
(statearr_25169_27564[(2)] = inst_25083);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (21))){
var inst_25106 = (state_25123[(2)]);
var state_25123__$1 = (function (){var statearr_25170 = state_25123;
(statearr_25170[(9)] = inst_25106);

return statearr_25170;
})();
var statearr_25171_27566 = state_25123__$1;
(statearr_25171_27566[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (13))){
var inst_25040 = (state_25123[(10)]);
var inst_25048 = cljs.core.chunked_seq_QMARK_(inst_25040);
var state_25123__$1 = state_25123;
if(inst_25048){
var statearr_25174_27567 = state_25123__$1;
(statearr_25174_27567[(1)] = (16));

} else {
var statearr_25175_27568 = state_25123__$1;
(statearr_25175_27568[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (22))){
var inst_25098 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
if(cljs.core.truth_(inst_25098)){
var statearr_25182_27569 = state_25123__$1;
(statearr_25182_27569[(1)] = (23));

} else {
var statearr_25183_27570 = state_25123__$1;
(statearr_25183_27570[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (6))){
var inst_25092 = (state_25123[(7)]);
var inst_25094 = (state_25123[(11)]);
var inst_25015 = (state_25123[(8)]);
var inst_25092__$1 = (topic_fn.cljs$core$IFn$_invoke$arity$1 ? topic_fn.cljs$core$IFn$_invoke$arity$1(inst_25015) : topic_fn.call(null, inst_25015));
var inst_25093 = cljs.core.deref(mults);
var inst_25094__$1 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_25093,inst_25092__$1);
var state_25123__$1 = (function (){var statearr_25185 = state_25123;
(statearr_25185[(7)] = inst_25092__$1);

(statearr_25185[(11)] = inst_25094__$1);

return statearr_25185;
})();
if(cljs.core.truth_(inst_25094__$1)){
var statearr_25186_27575 = state_25123__$1;
(statearr_25186_27575[(1)] = (19));

} else {
var statearr_25187_27576 = state_25123__$1;
(statearr_25187_27576[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (25))){
var inst_25103 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
var statearr_25188_27577 = state_25123__$1;
(statearr_25188_27577[(2)] = inst_25103);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (17))){
var inst_25040 = (state_25123[(10)]);
var inst_25067 = cljs.core.first(inst_25040);
var inst_25072 = cljs.core.async.muxch_STAR_(inst_25067);
var inst_25073 = cljs.core.async.close_BANG_(inst_25072);
var inst_25077 = cljs.core.next(inst_25040);
var inst_25026 = inst_25077;
var inst_25027 = null;
var inst_25028 = (0);
var inst_25029 = (0);
var state_25123__$1 = (function (){var statearr_25193 = state_25123;
(statearr_25193[(12)] = inst_25028);

(statearr_25193[(13)] = inst_25029);

(statearr_25193[(14)] = inst_25073);

(statearr_25193[(15)] = inst_25026);

(statearr_25193[(16)] = inst_25027);

return statearr_25193;
})();
var statearr_25194_27578 = state_25123__$1;
(statearr_25194_27578[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (3))){
var inst_25111 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
return cljs.core.async.impl.ioc_helpers.return_chan(state_25123__$1,inst_25111);
} else {
if((state_val_25124 === (12))){
var inst_25085 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
var statearr_25195_27580 = state_25123__$1;
(statearr_25195_27580[(2)] = inst_25085);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (2))){
var state_25123__$1 = state_25123;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_25123__$1,(4),ch);
} else {
if((state_val_25124 === (23))){
var state_25123__$1 = state_25123;
var statearr_25201_27584 = state_25123__$1;
(statearr_25201_27584[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (19))){
var inst_25094 = (state_25123[(11)]);
var inst_25015 = (state_25123[(8)]);
var inst_25096 = cljs.core.async.muxch_STAR_(inst_25094);
var state_25123__$1 = state_25123;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_25123__$1,(22),inst_25096,inst_25015);
} else {
if((state_val_25124 === (11))){
var inst_25040 = (state_25123[(10)]);
var inst_25026 = (state_25123[(15)]);
var inst_25040__$1 = cljs.core.seq(inst_25026);
var state_25123__$1 = (function (){var statearr_25203 = state_25123;
(statearr_25203[(10)] = inst_25040__$1);

return statearr_25203;
})();
if(inst_25040__$1){
var statearr_25206_27585 = state_25123__$1;
(statearr_25206_27585[(1)] = (13));

} else {
var statearr_25207_27586 = state_25123__$1;
(statearr_25207_27586[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (9))){
var inst_25087 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
var statearr_25208_27587 = state_25123__$1;
(statearr_25208_27587[(2)] = inst_25087);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (5))){
var inst_25023 = cljs.core.deref(mults);
var inst_25024 = cljs.core.vals(inst_25023);
var inst_25025 = cljs.core.seq(inst_25024);
var inst_25026 = inst_25025;
var inst_25027 = null;
var inst_25028 = (0);
var inst_25029 = (0);
var state_25123__$1 = (function (){var statearr_25218 = state_25123;
(statearr_25218[(12)] = inst_25028);

(statearr_25218[(13)] = inst_25029);

(statearr_25218[(15)] = inst_25026);

(statearr_25218[(16)] = inst_25027);

return statearr_25218;
})();
var statearr_25221_27591 = state_25123__$1;
(statearr_25221_27591[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (14))){
var state_25123__$1 = state_25123;
var statearr_25236_27592 = state_25123__$1;
(statearr_25236_27592[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (16))){
var inst_25040 = (state_25123[(10)]);
var inst_25059 = cljs.core.chunk_first(inst_25040);
var inst_25063 = cljs.core.chunk_rest(inst_25040);
var inst_25064 = cljs.core.count(inst_25059);
var inst_25026 = inst_25063;
var inst_25027 = inst_25059;
var inst_25028 = inst_25064;
var inst_25029 = (0);
var state_25123__$1 = (function (){var statearr_25240 = state_25123;
(statearr_25240[(12)] = inst_25028);

(statearr_25240[(13)] = inst_25029);

(statearr_25240[(15)] = inst_25026);

(statearr_25240[(16)] = inst_25027);

return statearr_25240;
})();
var statearr_25243_27593 = state_25123__$1;
(statearr_25243_27593[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (10))){
var inst_25028 = (state_25123[(12)]);
var inst_25029 = (state_25123[(13)]);
var inst_25026 = (state_25123[(15)]);
var inst_25027 = (state_25123[(16)]);
var inst_25034 = cljs.core._nth(inst_25027,inst_25029);
var inst_25035 = cljs.core.async.muxch_STAR_(inst_25034);
var inst_25036 = cljs.core.async.close_BANG_(inst_25035);
var inst_25037 = (inst_25029 + (1));
var tmp25223 = inst_25028;
var tmp25224 = inst_25026;
var tmp25225 = inst_25027;
var inst_25026__$1 = tmp25224;
var inst_25027__$1 = tmp25225;
var inst_25028__$1 = tmp25223;
var inst_25029__$1 = inst_25037;
var state_25123__$1 = (function (){var statearr_25250 = state_25123;
(statearr_25250[(12)] = inst_25028__$1);

(statearr_25250[(13)] = inst_25029__$1);

(statearr_25250[(15)] = inst_25026__$1);

(statearr_25250[(16)] = inst_25027__$1);

(statearr_25250[(17)] = inst_25036);

return statearr_25250;
})();
var statearr_25254_27598 = state_25123__$1;
(statearr_25254_27598[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (18))){
var inst_25080 = (state_25123[(2)]);
var state_25123__$1 = state_25123;
var statearr_25259_27600 = state_25123__$1;
(statearr_25259_27600[(2)] = inst_25080);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25124 === (8))){
var inst_25028 = (state_25123[(12)]);
var inst_25029 = (state_25123[(13)]);
var inst_25031 = (inst_25029 < inst_25028);
var inst_25032 = inst_25031;
var state_25123__$1 = state_25123;
if(cljs.core.truth_(inst_25032)){
var statearr_25264_27601 = state_25123__$1;
(statearr_25264_27601[(1)] = (10));

} else {
var statearr_25265_27602 = state_25123__$1;
(statearr_25265_27602[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_25268 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_25268[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_25268[(1)] = (1));

return statearr_25268;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_25123){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_25123);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e25272){var ex__21558__auto__ = e25272;
var statearr_25273_27603 = state_25123;
(statearr_25273_27603[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_25123[(4)]))){
var statearr_25274_27607 = state_25123;
(statearr_25274_27607[(1)] = cljs.core.first((state_25123[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27608 = state_25123;
state_25123 = G__27608;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_25123){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_25123);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_25276 = f__22635__auto__();
(statearr_25276[(6)] = c__22634__auto___27555);

return statearr_25276;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


return p;
}));

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

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

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

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

}
});

(cljs.core.async.sub.cljs$core$IFn$_invoke$arity$3 = (function (p,topic,ch){
return cljs.core.async.sub.cljs$core$IFn$_invoke$arity$4(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_(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_(p,topic,ch);
});
/**
 * Unsubscribes all channels from a pub, or a topic of a pub
 */
cljs.core.async.unsub_all = (function cljs$core$async$unsub_all(var_args){
var G__25288 = arguments.length;
switch (G__25288) {
case 1:
return cljs.core.async.unsub_all.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

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

}
});

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

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

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

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

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

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

}
});

(cljs.core.async.map.cljs$core$IFn$_invoke$arity$2 = (function (f,chs){
return cljs.core.async.map.cljs$core$IFn$_invoke$arity$3(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(chs);
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var cnt = cljs.core.count(chs__$1);
var rets = cljs.core.object_array.cljs$core$IFn$_invoke$arity$1(cnt);
var dchan = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var dctr = cljs.core.atom.cljs$core$IFn$_invoke$arity$1(null);
var done = cljs.core.mapv.cljs$core$IFn$_invoke$arity$2((function (i){
return (function (ret){
(rets[i] = ret);

if((cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec) === (0))){
return cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2(dchan,rets.slice((0)));
} else {
return null;
}
});
}),cljs.core.range.cljs$core$IFn$_invoke$arity$1(cnt));
if((cnt === (0))){
cljs.core.async.close_BANG_(out);
} else {
var c__22634__auto___27625 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_25387){
var state_val_25388 = (state_25387[(1)]);
if((state_val_25388 === (7))){
var state_25387__$1 = state_25387;
var statearr_25390_27626 = state_25387__$1;
(statearr_25390_27626[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (1))){
var state_25387__$1 = state_25387;
var statearr_25392_27627 = state_25387__$1;
(statearr_25392_27627[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (4))){
var inst_25318 = (state_25387[(7)]);
var inst_25317 = (state_25387[(8)]);
var inst_25320 = (inst_25318 < inst_25317);
var state_25387__$1 = state_25387;
if(cljs.core.truth_(inst_25320)){
var statearr_25393_27628 = state_25387__$1;
(statearr_25393_27628[(1)] = (6));

} else {
var statearr_25394_27629 = state_25387__$1;
(statearr_25394_27629[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (15))){
var inst_25365 = (state_25387[(9)]);
var inst_25370 = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(f,inst_25365);
var state_25387__$1 = state_25387;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_25387__$1,(17),out,inst_25370);
} else {
if((state_val_25388 === (13))){
var inst_25365 = (state_25387[(9)]);
var inst_25365__$1 = (state_25387[(2)]);
var inst_25366 = cljs.core.some(cljs.core.nil_QMARK_,inst_25365__$1);
var state_25387__$1 = (function (){var statearr_25395 = state_25387;
(statearr_25395[(9)] = inst_25365__$1);

return statearr_25395;
})();
if(cljs.core.truth_(inst_25366)){
var statearr_25396_27631 = state_25387__$1;
(statearr_25396_27631[(1)] = (14));

} else {
var statearr_25397_27632 = state_25387__$1;
(statearr_25397_27632[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (6))){
var state_25387__$1 = state_25387;
var statearr_25398_27633 = state_25387__$1;
(statearr_25398_27633[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (17))){
var inst_25372 = (state_25387[(2)]);
var state_25387__$1 = (function (){var statearr_25413 = state_25387;
(statearr_25413[(10)] = inst_25372);

return statearr_25413;
})();
var statearr_25414_27634 = state_25387__$1;
(statearr_25414_27634[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (3))){
var inst_25381 = (state_25387[(2)]);
var state_25387__$1 = state_25387;
return cljs.core.async.impl.ioc_helpers.return_chan(state_25387__$1,inst_25381);
} else {
if((state_val_25388 === (12))){
var _ = (function (){var statearr_25416 = state_25387;
(statearr_25416[(4)] = cljs.core.rest((state_25387[(4)])));

return statearr_25416;
})();
var state_25387__$1 = state_25387;
var ex25412 = (state_25387__$1[(2)]);
var statearr_25417_27635 = state_25387__$1;
(statearr_25417_27635[(5)] = ex25412);


if((ex25412 instanceof Object)){
var statearr_25427_27636 = state_25387__$1;
(statearr_25427_27636[(1)] = (11));

(statearr_25427_27636[(5)] = null);

} else {
throw ex25412;

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (2))){
var inst_25316 = cljs.core.reset_BANG_(dctr,cnt);
var inst_25317 = cnt;
var inst_25318 = (0);
var state_25387__$1 = (function (){var statearr_25442 = state_25387;
(statearr_25442[(11)] = inst_25316);

(statearr_25442[(7)] = inst_25318);

(statearr_25442[(8)] = inst_25317);

return statearr_25442;
})();
var statearr_25447_27638 = state_25387__$1;
(statearr_25447_27638[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (11))){
var inst_25341 = (state_25387[(2)]);
var inst_25342 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec);
var state_25387__$1 = (function (){var statearr_25451 = state_25387;
(statearr_25451[(12)] = inst_25341);

return statearr_25451;
})();
var statearr_25452_27639 = state_25387__$1;
(statearr_25452_27639[(2)] = inst_25342);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (9))){
var inst_25318 = (state_25387[(7)]);
var _ = (function (){var statearr_25454 = state_25387;
(statearr_25454[(4)] = cljs.core.cons((12),(state_25387[(4)])));

return statearr_25454;
})();
var inst_25348 = (chs__$1.cljs$core$IFn$_invoke$arity$1 ? chs__$1.cljs$core$IFn$_invoke$arity$1(inst_25318) : chs__$1.call(null, inst_25318));
var inst_25352 = (done.cljs$core$IFn$_invoke$arity$1 ? done.cljs$core$IFn$_invoke$arity$1(inst_25318) : done.call(null, inst_25318));
var inst_25353 = cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2(inst_25348,inst_25352);
var ___$1 = (function (){var statearr_25455 = state_25387;
(statearr_25455[(4)] = cljs.core.rest((state_25387[(4)])));

return statearr_25455;
})();
var state_25387__$1 = state_25387;
var statearr_25456_27640 = state_25387__$1;
(statearr_25456_27640[(2)] = inst_25353);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (5))){
var inst_25363 = (state_25387[(2)]);
var state_25387__$1 = (function (){var statearr_25467 = state_25387;
(statearr_25467[(13)] = inst_25363);

return statearr_25467;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_25387__$1,(13),dchan);
} else {
if((state_val_25388 === (14))){
var inst_25368 = cljs.core.async.close_BANG_(out);
var state_25387__$1 = state_25387;
var statearr_25470_27645 = state_25387__$1;
(statearr_25470_27645[(2)] = inst_25368);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (16))){
var inst_25377 = (state_25387[(2)]);
var state_25387__$1 = state_25387;
var statearr_25476_27646 = state_25387__$1;
(statearr_25476_27646[(2)] = inst_25377);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (10))){
var inst_25318 = (state_25387[(7)]);
var inst_25356 = (state_25387[(2)]);
var inst_25357 = (inst_25318 + (1));
var inst_25318__$1 = inst_25357;
var state_25387__$1 = (function (){var statearr_25477 = state_25387;
(statearr_25477[(14)] = inst_25356);

(statearr_25477[(7)] = inst_25318__$1);

return statearr_25477;
})();
var statearr_25478_27647 = state_25387__$1;
(statearr_25478_27647[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25388 === (8))){
var inst_25361 = (state_25387[(2)]);
var state_25387__$1 = state_25387;
var statearr_25479_27648 = state_25387__$1;
(statearr_25479_27648[(2)] = inst_25361);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_25481 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_25481[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_25481[(1)] = (1));

return statearr_25481;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_25387){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_25387);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e25485){var ex__21558__auto__ = e25485;
var statearr_25487_27649 = state_25387;
(statearr_25487_27649[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_25387[(4)]))){
var statearr_25488_27650 = state_25387;
(statearr_25488_27650[(1)] = cljs.core.first((state_25387[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27651 = state_25387;
state_25387 = G__27651;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_25387){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_25387);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_25492 = f__22635__auto__();
(statearr_25492[(6)] = c__22634__auto___27625);

return statearr_25492;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));

}

return out;
}));

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

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

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

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

}
});

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

(cljs.core.async.merge.cljs$core$IFn$_invoke$arity$2 = (function (chs,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__22634__auto___27653 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_25555){
var state_val_25556 = (state_25555[(1)]);
if((state_val_25556 === (7))){
var inst_25530 = (state_25555[(7)]);
var inst_25531 = (state_25555[(8)]);
var inst_25530__$1 = (state_25555[(2)]);
var inst_25531__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_25530__$1,(0),null);
var inst_25532 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_25530__$1,(1),null);
var inst_25533 = (inst_25531__$1 == null);
var state_25555__$1 = (function (){var statearr_25563 = state_25555;
(statearr_25563[(9)] = inst_25532);

(statearr_25563[(7)] = inst_25530__$1);

(statearr_25563[(8)] = inst_25531__$1);

return statearr_25563;
})();
if(cljs.core.truth_(inst_25533)){
var statearr_25565_27654 = state_25555__$1;
(statearr_25565_27654[(1)] = (8));

} else {
var statearr_25566_27655 = state_25555__$1;
(statearr_25566_27655[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25556 === (1))){
var inst_25514 = cljs.core.vec(chs);
var inst_25515 = inst_25514;
var state_25555__$1 = (function (){var statearr_25567 = state_25555;
(statearr_25567[(10)] = inst_25515);

return statearr_25567;
})();
var statearr_25568_27656 = state_25555__$1;
(statearr_25568_27656[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25556 === (4))){
var inst_25515 = (state_25555[(10)]);
var state_25555__$1 = state_25555;
return cljs.core.async.ioc_alts_BANG_(state_25555__$1,(7),inst_25515);
} else {
if((state_val_25556 === (6))){
var inst_25549 = (state_25555[(2)]);
var state_25555__$1 = state_25555;
var statearr_25575_27657 = state_25555__$1;
(statearr_25575_27657[(2)] = inst_25549);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25556 === (3))){
var inst_25551 = (state_25555[(2)]);
var state_25555__$1 = state_25555;
return cljs.core.async.impl.ioc_helpers.return_chan(state_25555__$1,inst_25551);
} else {
if((state_val_25556 === (2))){
var inst_25515 = (state_25555[(10)]);
var inst_25517 = cljs.core.count(inst_25515);
var inst_25518 = (inst_25517 > (0));
var state_25555__$1 = state_25555;
if(cljs.core.truth_(inst_25518)){
var statearr_25582_27658 = state_25555__$1;
(statearr_25582_27658[(1)] = (4));

} else {
var statearr_25583_27659 = state_25555__$1;
(statearr_25583_27659[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25556 === (11))){
var inst_25515 = (state_25555[(10)]);
var inst_25542 = (state_25555[(2)]);
var tmp25576 = inst_25515;
var inst_25515__$1 = tmp25576;
var state_25555__$1 = (function (){var statearr_25586 = state_25555;
(statearr_25586[(11)] = inst_25542);

(statearr_25586[(10)] = inst_25515__$1);

return statearr_25586;
})();
var statearr_25587_27660 = state_25555__$1;
(statearr_25587_27660[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25556 === (9))){
var inst_25531 = (state_25555[(8)]);
var state_25555__$1 = state_25555;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_25555__$1,(11),out,inst_25531);
} else {
if((state_val_25556 === (5))){
var inst_25547 = cljs.core.async.close_BANG_(out);
var state_25555__$1 = state_25555;
var statearr_25595_27661 = state_25555__$1;
(statearr_25595_27661[(2)] = inst_25547);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25556 === (10))){
var inst_25545 = (state_25555[(2)]);
var state_25555__$1 = state_25555;
var statearr_25599_27662 = state_25555__$1;
(statearr_25599_27662[(2)] = inst_25545);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25556 === (8))){
var inst_25532 = (state_25555[(9)]);
var inst_25530 = (state_25555[(7)]);
var inst_25531 = (state_25555[(8)]);
var inst_25515 = (state_25555[(10)]);
var inst_25537 = (function (){var cs = inst_25515;
var vec__25520 = inst_25530;
var v = inst_25531;
var c = inst_25532;
return (function (p1__25494_SHARP_){
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(c,p1__25494_SHARP_);
});
})();
var inst_25538 = cljs.core.filterv(inst_25537,inst_25515);
var inst_25515__$1 = inst_25538;
var state_25555__$1 = (function (){var statearr_25619 = state_25555;
(statearr_25619[(10)] = inst_25515__$1);

return statearr_25619;
})();
var statearr_25620_27663 = state_25555__$1;
(statearr_25620_27663[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_25621 = [null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_25621[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_25621[(1)] = (1));

return statearr_25621;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_25555){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_25555);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e25622){var ex__21558__auto__ = e25622;
var statearr_25623_27665 = state_25555;
(statearr_25623_27665[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_25555[(4)]))){
var statearr_25630_27666 = state_25555;
(statearr_25630_27666[(1)] = cljs.core.first((state_25555[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27668 = state_25555;
state_25555 = G__27668;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_25555){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_25555);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_25631 = f__22635__auto__();
(statearr_25631[(6)] = c__22634__auto___27653);

return statearr_25631;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


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(cljs.core.conj,coll,ch);
});
/**
 * Returns a channel that will return, at most, n items from ch. After n items
 * have been returned, or ch has been closed, the return chanel will close.
 * 
 *   The output channel is unbuffered by default, unless buf-or-n is given.
 */
cljs.core.async.take = (function cljs$core$async$take(var_args){
var G__25646 = arguments.length;
switch (G__25646) {
case 2:
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.take.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.take.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__22634__auto___27670 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_25688){
var state_val_25689 = (state_25688[(1)]);
if((state_val_25689 === (7))){
var inst_25662 = (state_25688[(7)]);
var inst_25662__$1 = (state_25688[(2)]);
var inst_25663 = (inst_25662__$1 == null);
var inst_25664 = cljs.core.not(inst_25663);
var state_25688__$1 = (function (){var statearr_25697 = state_25688;
(statearr_25697[(7)] = inst_25662__$1);

return statearr_25697;
})();
if(inst_25664){
var statearr_25698_27671 = state_25688__$1;
(statearr_25698_27671[(1)] = (8));

} else {
var statearr_25699_27672 = state_25688__$1;
(statearr_25699_27672[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (1))){
var inst_25655 = (0);
var state_25688__$1 = (function (){var statearr_25700 = state_25688;
(statearr_25700[(8)] = inst_25655);

return statearr_25700;
})();
var statearr_25701_27673 = state_25688__$1;
(statearr_25701_27673[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (4))){
var state_25688__$1 = state_25688;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_25688__$1,(7),ch);
} else {
if((state_val_25689 === (6))){
var inst_25678 = (state_25688[(2)]);
var state_25688__$1 = state_25688;
var statearr_25709_27674 = state_25688__$1;
(statearr_25709_27674[(2)] = inst_25678);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (3))){
var inst_25680 = (state_25688[(2)]);
var inst_25681 = cljs.core.async.close_BANG_(out);
var state_25688__$1 = (function (){var statearr_25710 = state_25688;
(statearr_25710[(9)] = inst_25680);

return statearr_25710;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_25688__$1,inst_25681);
} else {
if((state_val_25689 === (2))){
var inst_25655 = (state_25688[(8)]);
var inst_25658 = (inst_25655 < n);
var state_25688__$1 = state_25688;
if(cljs.core.truth_(inst_25658)){
var statearr_25715_27677 = state_25688__$1;
(statearr_25715_27677[(1)] = (4));

} else {
var statearr_25719_27678 = state_25688__$1;
(statearr_25719_27678[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (11))){
var inst_25655 = (state_25688[(8)]);
var inst_25670 = (state_25688[(2)]);
var inst_25671 = (inst_25655 + (1));
var inst_25655__$1 = inst_25671;
var state_25688__$1 = (function (){var statearr_25722 = state_25688;
(statearr_25722[(8)] = inst_25655__$1);

(statearr_25722[(10)] = inst_25670);

return statearr_25722;
})();
var statearr_25728_27679 = state_25688__$1;
(statearr_25728_27679[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (9))){
var state_25688__$1 = state_25688;
var statearr_25730_27680 = state_25688__$1;
(statearr_25730_27680[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (5))){
var state_25688__$1 = state_25688;
var statearr_25731_27681 = state_25688__$1;
(statearr_25731_27681[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (10))){
var inst_25675 = (state_25688[(2)]);
var state_25688__$1 = state_25688;
var statearr_25732_27682 = state_25688__$1;
(statearr_25732_27682[(2)] = inst_25675);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25689 === (8))){
var inst_25662 = (state_25688[(7)]);
var state_25688__$1 = state_25688;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_25688__$1,(11),out,inst_25662);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_25745 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_25745[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_25745[(1)] = (1));

return statearr_25745;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_25688){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_25688);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e25746){var ex__21558__auto__ = e25746;
var statearr_25747_27684 = state_25688;
(statearr_25747_27684[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_25688[(4)]))){
var statearr_25749_27685 = state_25688;
(statearr_25749_27685[(1)] = cljs.core.first((state_25688[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27686 = state_25688;
state_25688 = G__27686;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_25688){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_25688);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_25753 = f__22635__auto__();
(statearr_25753[(6)] = c__22634__auto___27670);

return statearr_25753;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


return out;
}));

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


/**
* @constructor
 * @implements {cljs.core.async.impl.protocols.Handler}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
cljs.core.async.t_cljs$core$async25771 = (function (f,ch,meta25763,_,fn1,meta25772){
this.f = f;
this.ch = ch;
this.meta25763 = meta25763;
this._ = _;
this.fn1 = fn1;
this.meta25772 = meta25772;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async25771.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_25773,meta25772__$1){
var self__ = this;
var _25773__$1 = this;
return (new cljs.core.async.t_cljs$core$async25771(self__.f,self__.ch,self__.meta25763,self__._,self__.fn1,meta25772__$1));
}));

(cljs.core.async.t_cljs$core$async25771.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_25773){
var self__ = this;
var _25773__$1 = this;
return self__.meta25772;
}));

(cljs.core.async.t_cljs$core$async25771.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);

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

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

(cljs.core.async.t_cljs$core$async25771.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (___$1){
var self__ = this;
var ___$2 = this;
var f1 = cljs.core.async.impl.protocols.commit(self__.fn1);
return (function (p1__25754_SHARP_){
var G__25781 = (((p1__25754_SHARP_ == null))?null:(self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(p1__25754_SHARP_) : self__.f.call(null, p1__25754_SHARP_)));
return (f1.cljs$core$IFn$_invoke$arity$1 ? f1.cljs$core$IFn$_invoke$arity$1(G__25781) : f1.call(null, G__25781));
});
}));

(cljs.core.async.t_cljs$core$async25771.getBasis = (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,"meta25763","meta25763",-454238064,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$async25762","cljs.core.async/t_cljs$core$async25762",-1599690578,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta25772","meta25772",-2082129957,null)], null);
}));

(cljs.core.async.t_cljs$core$async25771.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async25771.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async25771");

(cljs.core.async.t_cljs$core$async25771.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async25771");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async25771.
 */
cljs.core.async.__GT_t_cljs$core$async25771 = (function cljs$core$async$__GT_t_cljs$core$async25771(f,ch,meta25763,_,fn1,meta25772){
return (new cljs.core.async.t_cljs$core$async25771(f,ch,meta25763,_,fn1,meta25772));
});



/**
* @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$async25762 = (function (f,ch,meta25763){
this.f = f;
this.ch = ch;
this.meta25763 = meta25763;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async25762.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_25764,meta25763__$1){
var self__ = this;
var _25764__$1 = this;
return (new cljs.core.async.t_cljs$core$async25762(self__.f,self__.ch,meta25763__$1));
}));

(cljs.core.async.t_cljs$core$async25762.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_25764){
var self__ = this;
var _25764__$1 = this;
return self__.meta25763;
}));

(cljs.core.async.t_cljs$core$async25762.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25762.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async25762.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async25762.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25762.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_(self__.ch,(new cljs.core.async.t_cljs$core$async25771(self__.f,self__.ch,self__.meta25763,___$1,fn1,cljs.core.PersistentArrayMap.EMPTY)));
if(cljs.core.truth_((function (){var and__5000__auto__ = ret;
if(cljs.core.truth_(and__5000__auto__)){
return (!((cljs.core.deref(ret) == null)));
} else {
return and__5000__auto__;
}
})())){
return cljs.core.async.impl.channels.box((function (){var G__25788 = cljs.core.deref(ret);
return (self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(G__25788) : self__.f.call(null, G__25788));
})());
} else {
return ret;
}
}));

(cljs.core.async.t_cljs$core$async25762.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25762.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_(self__.ch,val,fn1);
}));

(cljs.core.async.t_cljs$core$async25762.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,"meta25763","meta25763",-454238064,null)], null);
}));

(cljs.core.async.t_cljs$core$async25762.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async25762.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async25762");

(cljs.core.async.t_cljs$core$async25762.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async25762");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async25762.
 */
cljs.core.async.__GT_t_cljs$core$async25762 = (function cljs$core$async$__GT_t_cljs$core$async25762(f,ch,meta25763){
return (new cljs.core.async.t_cljs$core$async25762(f,ch,meta25763));
});


/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_LT_ = (function cljs$core$async$map_LT_(f,ch){
return (new cljs.core.async.t_cljs$core$async25762(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});

/**
* @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$async25792 = (function (f,ch,meta25793){
this.f = f;
this.ch = ch;
this.meta25793 = meta25793;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async25792.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_25794,meta25793__$1){
var self__ = this;
var _25794__$1 = this;
return (new cljs.core.async.t_cljs$core$async25792(self__.f,self__.ch,meta25793__$1));
}));

(cljs.core.async.t_cljs$core$async25792.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_25794){
var self__ = this;
var _25794__$1 = this;
return self__.meta25793;
}));

(cljs.core.async.t_cljs$core$async25792.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25792.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async25792.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25792.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_(self__.ch,fn1);
}));

(cljs.core.async.t_cljs$core$async25792.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25792.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_(self__.ch,(self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(val) : self__.f.call(null, val)),fn1);
}));

(cljs.core.async.t_cljs$core$async25792.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,"meta25793","meta25793",-879877987,null)], null);
}));

(cljs.core.async.t_cljs$core$async25792.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async25792.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async25792");

(cljs.core.async.t_cljs$core$async25792.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async25792");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async25792.
 */
cljs.core.async.__GT_t_cljs$core$async25792 = (function cljs$core$async$__GT_t_cljs$core$async25792(f,ch,meta25793){
return (new cljs.core.async.t_cljs$core$async25792(f,ch,meta25793));
});


/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.map_GT_ = (function cljs$core$async$map_GT_(f,ch){
return (new cljs.core.async.t_cljs$core$async25792(f,ch,cljs.core.PersistentArrayMap.EMPTY));
});

/**
* @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$async25803 = (function (p,ch,meta25804){
this.p = p;
this.ch = ch;
this.meta25804 = meta25804;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async25803.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_25805,meta25804__$1){
var self__ = this;
var _25805__$1 = this;
return (new cljs.core.async.t_cljs$core$async25803(self__.p,self__.ch,meta25804__$1));
}));

(cljs.core.async.t_cljs$core$async25803.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_25805){
var self__ = this;
var _25805__$1 = this;
return self__.meta25804;
}));

(cljs.core.async.t_cljs$core$async25803.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25803.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async25803.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_(self__.ch);
}));

(cljs.core.async.t_cljs$core$async25803.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25803.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_(self__.ch,fn1);
}));

(cljs.core.async.t_cljs$core$async25803.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);

(cljs.core.async.t_cljs$core$async25803.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.cljs$core$IFn$_invoke$arity$1 ? self__.p.cljs$core$IFn$_invoke$arity$1(val) : self__.p.call(null, val)))){
return cljs.core.async.impl.protocols.put_BANG_(self__.ch,val,fn1);
} else {
return cljs.core.async.impl.channels.box(cljs.core.not(cljs.core.async.impl.protocols.closed_QMARK_(self__.ch)));
}
}));

(cljs.core.async.t_cljs$core$async25803.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,"meta25804","meta25804",-1169325572,null)], null);
}));

(cljs.core.async.t_cljs$core$async25803.cljs$lang$type = true);

(cljs.core.async.t_cljs$core$async25803.cljs$lang$ctorStr = "cljs.core.async/t_cljs$core$async25803");

(cljs.core.async.t_cljs$core$async25803.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async/t_cljs$core$async25803");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async25803.
 */
cljs.core.async.__GT_t_cljs$core$async25803 = (function cljs$core$async$__GT_t_cljs$core$async25803(p,ch,meta25804){
return (new cljs.core.async.t_cljs$core$async25803(p,ch,meta25804));
});


/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_GT_ = (function cljs$core$async$filter_GT_(p,ch){
return (new cljs.core.async.t_cljs$core$async25803(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_(cljs.core.complement(p),ch);
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.filter_LT_ = (function cljs$core$async$filter_LT_(var_args){
var G__25836 = arguments.length;
switch (G__25836) {
case 2:
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.filter_LT_.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__22634__auto___27691 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_25880){
var state_val_25881 = (state_25880[(1)]);
if((state_val_25881 === (7))){
var inst_25875 = (state_25880[(2)]);
var state_25880__$1 = state_25880;
var statearr_25887_27692 = state_25880__$1;
(statearr_25887_27692[(2)] = inst_25875);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (1))){
var state_25880__$1 = state_25880;
var statearr_25888_27693 = state_25880__$1;
(statearr_25888_27693[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (4))){
var inst_25859 = (state_25880[(7)]);
var inst_25859__$1 = (state_25880[(2)]);
var inst_25860 = (inst_25859__$1 == null);
var state_25880__$1 = (function (){var statearr_25892 = state_25880;
(statearr_25892[(7)] = inst_25859__$1);

return statearr_25892;
})();
if(cljs.core.truth_(inst_25860)){
var statearr_25893_27694 = state_25880__$1;
(statearr_25893_27694[(1)] = (5));

} else {
var statearr_25895_27695 = state_25880__$1;
(statearr_25895_27695[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (6))){
var inst_25859 = (state_25880[(7)]);
var inst_25864 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_25859) : p.call(null, inst_25859));
var state_25880__$1 = state_25880;
if(cljs.core.truth_(inst_25864)){
var statearr_25899_27696 = state_25880__$1;
(statearr_25899_27696[(1)] = (8));

} else {
var statearr_25902_27698 = state_25880__$1;
(statearr_25902_27698[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (3))){
var inst_25878 = (state_25880[(2)]);
var state_25880__$1 = state_25880;
return cljs.core.async.impl.ioc_helpers.return_chan(state_25880__$1,inst_25878);
} else {
if((state_val_25881 === (2))){
var state_25880__$1 = state_25880;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_25880__$1,(4),ch);
} else {
if((state_val_25881 === (11))){
var inst_25868 = (state_25880[(2)]);
var state_25880__$1 = state_25880;
var statearr_25908_27699 = state_25880__$1;
(statearr_25908_27699[(2)] = inst_25868);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (9))){
var state_25880__$1 = state_25880;
var statearr_25911_27700 = state_25880__$1;
(statearr_25911_27700[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (5))){
var inst_25862 = cljs.core.async.close_BANG_(out);
var state_25880__$1 = state_25880;
var statearr_25914_27705 = state_25880__$1;
(statearr_25914_27705[(2)] = inst_25862);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (10))){
var inst_25872 = (state_25880[(2)]);
var state_25880__$1 = (function (){var statearr_25916 = state_25880;
(statearr_25916[(8)] = inst_25872);

return statearr_25916;
})();
var statearr_25917_27706 = state_25880__$1;
(statearr_25917_27706[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_25881 === (8))){
var inst_25859 = (state_25880[(7)]);
var state_25880__$1 = state_25880;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_25880__$1,(11),out,inst_25859);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_25919 = [null,null,null,null,null,null,null,null,null];
(statearr_25919[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_25919[(1)] = (1));

return statearr_25919;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_25880){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_25880);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e25920){var ex__21558__auto__ = e25920;
var statearr_25921_27714 = state_25880;
(statearr_25921_27714[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_25880[(4)]))){
var statearr_25922_27715 = state_25880;
(statearr_25922_27715[(1)] = cljs.core.first((state_25880[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27716 = state_25880;
state_25880 = G__27716;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_25880){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_25880);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_25924 = f__22635__auto__();
(statearr_25924[(6)] = c__22634__auto___27691);

return statearr_25924;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


return out;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.remove_LT_ = (function cljs$core$async$remove_LT_(var_args){
var G__25926 = arguments.length;
switch (G__25926) {
case 2:
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$2 = (function (p,ch){
return cljs.core.async.remove_LT_.cljs$core$IFn$_invoke$arity$3(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_.cljs$core$IFn$_invoke$arity$3(cljs.core.complement(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__22634__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_26003){
var state_val_26004 = (state_26003[(1)]);
if((state_val_26004 === (7))){
var inst_25998 = (state_26003[(2)]);
var state_26003__$1 = state_26003;
var statearr_26011_27722 = state_26003__$1;
(statearr_26011_27722[(2)] = inst_25998);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (20))){
var inst_25963 = (state_26003[(7)]);
var inst_25977 = (state_26003[(2)]);
var inst_25978 = cljs.core.next(inst_25963);
var inst_25949 = inst_25978;
var inst_25950 = null;
var inst_25951 = (0);
var inst_25952 = (0);
var state_26003__$1 = (function (){var statearr_26012 = state_26003;
(statearr_26012[(8)] = inst_25951);

(statearr_26012[(9)] = inst_25952);

(statearr_26012[(10)] = inst_25949);

(statearr_26012[(11)] = inst_25977);

(statearr_26012[(12)] = inst_25950);

return statearr_26012;
})();
var statearr_26017_27726 = state_26003__$1;
(statearr_26017_27726[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (1))){
var state_26003__$1 = state_26003;
var statearr_26018_27727 = state_26003__$1;
(statearr_26018_27727[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (4))){
var inst_25938 = (state_26003[(13)]);
var inst_25938__$1 = (state_26003[(2)]);
var inst_25939 = (inst_25938__$1 == null);
var state_26003__$1 = (function (){var statearr_26027 = state_26003;
(statearr_26027[(13)] = inst_25938__$1);

return statearr_26027;
})();
if(cljs.core.truth_(inst_25939)){
var statearr_26032_27728 = state_26003__$1;
(statearr_26032_27728[(1)] = (5));

} else {
var statearr_26033_27729 = state_26003__$1;
(statearr_26033_27729[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (15))){
var state_26003__$1 = state_26003;
var statearr_26040_27730 = state_26003__$1;
(statearr_26040_27730[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (21))){
var state_26003__$1 = state_26003;
var statearr_26041_27731 = state_26003__$1;
(statearr_26041_27731[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (13))){
var inst_25951 = (state_26003[(8)]);
var inst_25952 = (state_26003[(9)]);
var inst_25949 = (state_26003[(10)]);
var inst_25950 = (state_26003[(12)]);
var inst_25959 = (state_26003[(2)]);
var inst_25960 = (inst_25952 + (1));
var tmp26037 = inst_25951;
var tmp26038 = inst_25949;
var tmp26039 = inst_25950;
var inst_25949__$1 = tmp26038;
var inst_25950__$1 = tmp26039;
var inst_25951__$1 = tmp26037;
var inst_25952__$1 = inst_25960;
var state_26003__$1 = (function (){var statearr_26042 = state_26003;
(statearr_26042[(14)] = inst_25959);

(statearr_26042[(8)] = inst_25951__$1);

(statearr_26042[(9)] = inst_25952__$1);

(statearr_26042[(10)] = inst_25949__$1);

(statearr_26042[(12)] = inst_25950__$1);

return statearr_26042;
})();
var statearr_26053_27736 = state_26003__$1;
(statearr_26053_27736[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (22))){
var state_26003__$1 = state_26003;
var statearr_26066_27737 = state_26003__$1;
(statearr_26066_27737[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (6))){
var inst_25938 = (state_26003[(13)]);
var inst_25947 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_25938) : f.call(null, inst_25938));
var inst_25948 = cljs.core.seq(inst_25947);
var inst_25949 = inst_25948;
var inst_25950 = null;
var inst_25951 = (0);
var inst_25952 = (0);
var state_26003__$1 = (function (){var statearr_26079 = state_26003;
(statearr_26079[(8)] = inst_25951);

(statearr_26079[(9)] = inst_25952);

(statearr_26079[(10)] = inst_25949);

(statearr_26079[(12)] = inst_25950);

return statearr_26079;
})();
var statearr_26082_27738 = state_26003__$1;
(statearr_26082_27738[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (17))){
var inst_25963 = (state_26003[(7)]);
var inst_25969 = cljs.core.chunk_first(inst_25963);
var inst_25971 = cljs.core.chunk_rest(inst_25963);
var inst_25972 = cljs.core.count(inst_25969);
var inst_25949 = inst_25971;
var inst_25950 = inst_25969;
var inst_25951 = inst_25972;
var inst_25952 = (0);
var state_26003__$1 = (function (){var statearr_26094 = state_26003;
(statearr_26094[(8)] = inst_25951);

(statearr_26094[(9)] = inst_25952);

(statearr_26094[(10)] = inst_25949);

(statearr_26094[(12)] = inst_25950);

return statearr_26094;
})();
var statearr_26100_27740 = state_26003__$1;
(statearr_26100_27740[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (3))){
var inst_26001 = (state_26003[(2)]);
var state_26003__$1 = state_26003;
return cljs.core.async.impl.ioc_helpers.return_chan(state_26003__$1,inst_26001);
} else {
if((state_val_26004 === (12))){
var inst_25986 = (state_26003[(2)]);
var state_26003__$1 = state_26003;
var statearr_26103_27742 = state_26003__$1;
(statearr_26103_27742[(2)] = inst_25986);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (2))){
var state_26003__$1 = state_26003;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_26003__$1,(4),in$);
} else {
if((state_val_26004 === (23))){
var inst_25996 = (state_26003[(2)]);
var state_26003__$1 = state_26003;
var statearr_26104_27747 = state_26003__$1;
(statearr_26104_27747[(2)] = inst_25996);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (19))){
var inst_25981 = (state_26003[(2)]);
var state_26003__$1 = state_26003;
var statearr_26105_27749 = state_26003__$1;
(statearr_26105_27749[(2)] = inst_25981);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (11))){
var inst_25963 = (state_26003[(7)]);
var inst_25949 = (state_26003[(10)]);
var inst_25963__$1 = cljs.core.seq(inst_25949);
var state_26003__$1 = (function (){var statearr_26110 = state_26003;
(statearr_26110[(7)] = inst_25963__$1);

return statearr_26110;
})();
if(inst_25963__$1){
var statearr_26115_27750 = state_26003__$1;
(statearr_26115_27750[(1)] = (14));

} else {
var statearr_26117_27751 = state_26003__$1;
(statearr_26117_27751[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (9))){
var inst_25988 = (state_26003[(2)]);
var inst_25989 = cljs.core.async.impl.protocols.closed_QMARK_(out);
var state_26003__$1 = (function (){var statearr_26123 = state_26003;
(statearr_26123[(15)] = inst_25988);

return statearr_26123;
})();
if(cljs.core.truth_(inst_25989)){
var statearr_26124_27752 = state_26003__$1;
(statearr_26124_27752[(1)] = (21));

} else {
var statearr_26126_27753 = state_26003__$1;
(statearr_26126_27753[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (5))){
var inst_25941 = cljs.core.async.close_BANG_(out);
var state_26003__$1 = state_26003;
var statearr_26127_27754 = state_26003__$1;
(statearr_26127_27754[(2)] = inst_25941);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (14))){
var inst_25963 = (state_26003[(7)]);
var inst_25966 = cljs.core.chunked_seq_QMARK_(inst_25963);
var state_26003__$1 = state_26003;
if(inst_25966){
var statearr_26128_27755 = state_26003__$1;
(statearr_26128_27755[(1)] = (17));

} else {
var statearr_26129_27756 = state_26003__$1;
(statearr_26129_27756[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (16))){
var inst_25984 = (state_26003[(2)]);
var state_26003__$1 = state_26003;
var statearr_26130_27757 = state_26003__$1;
(statearr_26130_27757[(2)] = inst_25984);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26004 === (10))){
var inst_25952 = (state_26003[(9)]);
var inst_25950 = (state_26003[(12)]);
var inst_25957 = cljs.core._nth(inst_25950,inst_25952);
var state_26003__$1 = state_26003;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_26003__$1,(13),out,inst_25957);
} else {
if((state_val_26004 === (18))){
var inst_25963 = (state_26003[(7)]);
var inst_25975 = cljs.core.first(inst_25963);
var state_26003__$1 = state_26003;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_26003__$1,(20),out,inst_25975);
} else {
if((state_val_26004 === (8))){
var inst_25951 = (state_26003[(8)]);
var inst_25952 = (state_26003[(9)]);
var inst_25954 = (inst_25952 < inst_25951);
var inst_25955 = inst_25954;
var state_26003__$1 = state_26003;
if(cljs.core.truth_(inst_25955)){
var statearr_26132_27759 = state_26003__$1;
(statearr_26132_27759[(1)] = (10));

} else {
var statearr_26133_27760 = state_26003__$1;
(statearr_26133_27760[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__21555__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__21555__auto____0 = (function (){
var statearr_26134 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_26134[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__21555__auto__);

(statearr_26134[(1)] = (1));

return statearr_26134;
});
var cljs$core$async$mapcat_STAR__$_state_machine__21555__auto____1 = (function (state_26003){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_26003);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e26140){var ex__21558__auto__ = e26140;
var statearr_26141_27764 = state_26003;
(statearr_26141_27764[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_26003[(4)]))){
var statearr_26142_27765 = state_26003;
(statearr_26142_27765[(1)] = cljs.core.first((state_26003[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27766 = state_26003;
state_26003 = G__27766;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__21555__auto__ = function(state_26003){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__21555__auto____1.call(this,state_26003);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mapcat_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__21555__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__21555__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_26149 = f__22635__auto__();
(statearr_26149[(6)] = c__22634__auto__);

return statearr_26149;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));

return c__22634__auto__;
});
/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_LT_ = (function cljs$core$async$mapcat_LT_(var_args){
var G__26157 = arguments.length;
switch (G__26157) {
case 2:
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$2 = (function (f,in$){
return cljs.core.async.mapcat_LT_.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
cljs.core.async.mapcat_STAR_(f,in$,out);

return out;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.mapcat_GT_ = (function cljs$core$async$mapcat_GT_(var_args){
var G__26170 = arguments.length;
switch (G__26170) {
case 2:
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$2 = (function (f,out){
return cljs.core.async.mapcat_GT_.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
cljs.core.async.mapcat_STAR_(f,in$,out);

return in$;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.unique = (function cljs$core$async$unique(var_args){
var G__26183 = arguments.length;
switch (G__26183) {
case 1:
return cljs.core.async.unique.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

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

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

}
});

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

(cljs.core.async.unique.cljs$core$IFn$_invoke$arity$2 = (function (ch,buf_or_n){
var out = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__22634__auto___27773 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_26214){
var state_val_26215 = (state_26214[(1)]);
if((state_val_26215 === (7))){
var inst_26206 = (state_26214[(2)]);
var state_26214__$1 = state_26214;
var statearr_26224_27774 = state_26214__$1;
(statearr_26224_27774[(2)] = inst_26206);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26215 === (1))){
var inst_26188 = null;
var state_26214__$1 = (function (){var statearr_26225 = state_26214;
(statearr_26225[(7)] = inst_26188);

return statearr_26225;
})();
var statearr_26226_27779 = state_26214__$1;
(statearr_26226_27779[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26215 === (4))){
var inst_26191 = (state_26214[(8)]);
var inst_26191__$1 = (state_26214[(2)]);
var inst_26192 = (inst_26191__$1 == null);
var inst_26193 = cljs.core.not(inst_26192);
var state_26214__$1 = (function (){var statearr_26228 = state_26214;
(statearr_26228[(8)] = inst_26191__$1);

return statearr_26228;
})();
if(inst_26193){
var statearr_26229_27780 = state_26214__$1;
(statearr_26229_27780[(1)] = (5));

} else {
var statearr_26230_27781 = state_26214__$1;
(statearr_26230_27781[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26215 === (6))){
var state_26214__$1 = state_26214;
var statearr_26231_27782 = state_26214__$1;
(statearr_26231_27782[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26215 === (3))){
var inst_26211 = (state_26214[(2)]);
var inst_26212 = cljs.core.async.close_BANG_(out);
var state_26214__$1 = (function (){var statearr_26232 = state_26214;
(statearr_26232[(9)] = inst_26211);

return statearr_26232;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_26214__$1,inst_26212);
} else {
if((state_val_26215 === (2))){
var state_26214__$1 = state_26214;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_26214__$1,(4),ch);
} else {
if((state_val_26215 === (11))){
var inst_26191 = (state_26214[(8)]);
var inst_26200 = (state_26214[(2)]);
var inst_26188 = inst_26191;
var state_26214__$1 = (function (){var statearr_26234 = state_26214;
(statearr_26234[(10)] = inst_26200);

(statearr_26234[(7)] = inst_26188);

return statearr_26234;
})();
var statearr_26235_27786 = state_26214__$1;
(statearr_26235_27786[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26215 === (9))){
var inst_26191 = (state_26214[(8)]);
var state_26214__$1 = state_26214;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_26214__$1,(11),out,inst_26191);
} else {
if((state_val_26215 === (5))){
var inst_26191 = (state_26214[(8)]);
var inst_26188 = (state_26214[(7)]);
var inst_26195 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_26191,inst_26188);
var state_26214__$1 = state_26214;
if(inst_26195){
var statearr_26238_27787 = state_26214__$1;
(statearr_26238_27787[(1)] = (8));

} else {
var statearr_26239_27788 = state_26214__$1;
(statearr_26239_27788[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26215 === (10))){
var inst_26203 = (state_26214[(2)]);
var state_26214__$1 = state_26214;
var statearr_26241_27790 = state_26214__$1;
(statearr_26241_27790[(2)] = inst_26203);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26215 === (8))){
var inst_26188 = (state_26214[(7)]);
var tmp26236 = inst_26188;
var inst_26188__$1 = tmp26236;
var state_26214__$1 = (function (){var statearr_26242 = state_26214;
(statearr_26242[(7)] = inst_26188__$1);

return statearr_26242;
})();
var statearr_26243_27793 = state_26214__$1;
(statearr_26243_27793[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_26244 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_26244[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_26244[(1)] = (1));

return statearr_26244;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_26214){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_26214);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e26246){var ex__21558__auto__ = e26246;
var statearr_26247_27794 = state_26214;
(statearr_26247_27794[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_26214[(4)]))){
var statearr_26248_27795 = state_26214;
(statearr_26248_27795[(1)] = cljs.core.first((state_26214[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27796 = state_26214;
state_26214 = G__27796;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_26214){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_26214);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_26250 = f__22635__auto__();
(statearr_26250[(6)] = c__22634__auto___27773);

return statearr_26250;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


return out;
}));

(cljs.core.async.unique.cljs$lang$maxFixedArity = 2);

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition = (function cljs$core$async$partition(var_args){
var G__26255 = arguments.length;
switch (G__26255) {
case 2:
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.partition.cljs$core$IFn$_invoke$arity$2 = (function (n,ch){
return cljs.core.async.partition.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__22634__auto___27799 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_26305){
var state_val_26306 = (state_26305[(1)]);
if((state_val_26306 === (7))){
var inst_26300 = (state_26305[(2)]);
var state_26305__$1 = state_26305;
var statearr_26309_27804 = state_26305__$1;
(statearr_26309_27804[(2)] = inst_26300);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (1))){
var inst_26265 = (new Array(n));
var inst_26266 = inst_26265;
var inst_26267 = (0);
var state_26305__$1 = (function (){var statearr_26314 = state_26305;
(statearr_26314[(7)] = inst_26266);

(statearr_26314[(8)] = inst_26267);

return statearr_26314;
})();
var statearr_26315_27806 = state_26305__$1;
(statearr_26315_27806[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (4))){
var inst_26270 = (state_26305[(9)]);
var inst_26270__$1 = (state_26305[(2)]);
var inst_26271 = (inst_26270__$1 == null);
var inst_26272 = cljs.core.not(inst_26271);
var state_26305__$1 = (function (){var statearr_26318 = state_26305;
(statearr_26318[(9)] = inst_26270__$1);

return statearr_26318;
})();
if(inst_26272){
var statearr_26319_27810 = state_26305__$1;
(statearr_26319_27810[(1)] = (5));

} else {
var statearr_26320_27812 = state_26305__$1;
(statearr_26320_27812[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (15))){
var inst_26294 = (state_26305[(2)]);
var state_26305__$1 = state_26305;
var statearr_26327_27815 = state_26305__$1;
(statearr_26327_27815[(2)] = inst_26294);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (13))){
var state_26305__$1 = state_26305;
var statearr_26329_27816 = state_26305__$1;
(statearr_26329_27816[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (6))){
var inst_26267 = (state_26305[(8)]);
var inst_26290 = (inst_26267 > (0));
var state_26305__$1 = state_26305;
if(cljs.core.truth_(inst_26290)){
var statearr_26330_27819 = state_26305__$1;
(statearr_26330_27819[(1)] = (12));

} else {
var statearr_26331_27820 = state_26305__$1;
(statearr_26331_27820[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (3))){
var inst_26302 = (state_26305[(2)]);
var state_26305__$1 = state_26305;
return cljs.core.async.impl.ioc_helpers.return_chan(state_26305__$1,inst_26302);
} else {
if((state_val_26306 === (12))){
var inst_26266 = (state_26305[(7)]);
var inst_26292 = cljs.core.vec(inst_26266);
var state_26305__$1 = state_26305;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_26305__$1,(15),out,inst_26292);
} else {
if((state_val_26306 === (2))){
var state_26305__$1 = state_26305;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_26305__$1,(4),ch);
} else {
if((state_val_26306 === (11))){
var inst_26282 = (state_26305[(2)]);
var inst_26284 = (new Array(n));
var inst_26266 = inst_26284;
var inst_26267 = (0);
var state_26305__$1 = (function (){var statearr_26334 = state_26305;
(statearr_26334[(10)] = inst_26282);

(statearr_26334[(7)] = inst_26266);

(statearr_26334[(8)] = inst_26267);

return statearr_26334;
})();
var statearr_26338_27821 = state_26305__$1;
(statearr_26338_27821[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (9))){
var inst_26266 = (state_26305[(7)]);
var inst_26280 = cljs.core.vec(inst_26266);
var state_26305__$1 = state_26305;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_26305__$1,(11),out,inst_26280);
} else {
if((state_val_26306 === (5))){
var inst_26275 = (state_26305[(11)]);
var inst_26270 = (state_26305[(9)]);
var inst_26266 = (state_26305[(7)]);
var inst_26267 = (state_26305[(8)]);
var inst_26274 = (inst_26266[inst_26267] = inst_26270);
var inst_26275__$1 = (inst_26267 + (1));
var inst_26276 = (inst_26275__$1 < n);
var state_26305__$1 = (function (){var statearr_26342 = state_26305;
(statearr_26342[(11)] = inst_26275__$1);

(statearr_26342[(12)] = inst_26274);

return statearr_26342;
})();
if(cljs.core.truth_(inst_26276)){
var statearr_26343_27827 = state_26305__$1;
(statearr_26343_27827[(1)] = (8));

} else {
var statearr_26344_27828 = state_26305__$1;
(statearr_26344_27828[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (14))){
var inst_26297 = (state_26305[(2)]);
var inst_26298 = cljs.core.async.close_BANG_(out);
var state_26305__$1 = (function (){var statearr_26347 = state_26305;
(statearr_26347[(13)] = inst_26297);

return statearr_26347;
})();
var statearr_26349_27829 = state_26305__$1;
(statearr_26349_27829[(2)] = inst_26298);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (10))){
var inst_26287 = (state_26305[(2)]);
var state_26305__$1 = state_26305;
var statearr_26350_27830 = state_26305__$1;
(statearr_26350_27830[(2)] = inst_26287);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26306 === (8))){
var inst_26275 = (state_26305[(11)]);
var inst_26266 = (state_26305[(7)]);
var tmp26345 = inst_26266;
var inst_26266__$1 = tmp26345;
var inst_26267 = inst_26275;
var state_26305__$1 = (function (){var statearr_26351 = state_26305;
(statearr_26351[(7)] = inst_26266__$1);

(statearr_26351[(8)] = inst_26267);

return statearr_26351;
})();
var statearr_26352_27831 = state_26305__$1;
(statearr_26352_27831[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_26360 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_26360[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_26360[(1)] = (1));

return statearr_26360;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_26305){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_26305);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e26382){var ex__21558__auto__ = e26382;
var statearr_26386_27837 = state_26305;
(statearr_26386_27837[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_26305[(4)]))){
var statearr_26387_27838 = state_26305;
(statearr_26387_27838[(1)] = cljs.core.first((state_26305[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27839 = state_26305;
state_26305 = G__27839;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_26305){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_26305);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_26395 = f__22635__auto__();
(statearr_26395[(6)] = c__22634__auto___27799);

return statearr_26395;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


return out;
}));

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

/**
 * Deprecated - this function will be removed. Use transducer instead
 */
cljs.core.async.partition_by = (function cljs$core$async$partition_by(var_args){
var G__26420 = arguments.length;
switch (G__26420) {
case 2:
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

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

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

}
});

(cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$2 = (function (f,ch){
return cljs.core.async.partition_by.cljs$core$IFn$_invoke$arity$3(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.cljs$core$IFn$_invoke$arity$1(buf_or_n);
var c__22634__auto___27842 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__22635__auto__ = (function (){var switch__21554__auto__ = (function (state_26535){
var state_val_26536 = (state_26535[(1)]);
if((state_val_26536 === (7))){
var inst_26527 = (state_26535[(2)]);
var state_26535__$1 = state_26535;
var statearr_26542_27844 = state_26535__$1;
(statearr_26542_27844[(2)] = inst_26527);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (1))){
var inst_26454 = [];
var inst_26455 = inst_26454;
var inst_26456 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_26535__$1 = (function (){var statearr_26544 = state_26535;
(statearr_26544[(7)] = inst_26456);

(statearr_26544[(8)] = inst_26455);

return statearr_26544;
})();
var statearr_26545_27845 = state_26535__$1;
(statearr_26545_27845[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (4))){
var inst_26464 = (state_26535[(9)]);
var inst_26464__$1 = (state_26535[(2)]);
var inst_26466 = (inst_26464__$1 == null);
var inst_26468 = cljs.core.not(inst_26466);
var state_26535__$1 = (function (){var statearr_26547 = state_26535;
(statearr_26547[(9)] = inst_26464__$1);

return statearr_26547;
})();
if(inst_26468){
var statearr_26548_27846 = state_26535__$1;
(statearr_26548_27846[(1)] = (5));

} else {
var statearr_26549_27847 = state_26535__$1;
(statearr_26549_27847[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (15))){
var inst_26455 = (state_26535[(8)]);
var inst_26518 = cljs.core.vec(inst_26455);
var state_26535__$1 = state_26535;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_26535__$1,(18),out,inst_26518);
} else {
if((state_val_26536 === (13))){
var inst_26511 = (state_26535[(2)]);
var state_26535__$1 = state_26535;
var statearr_26555_27850 = state_26535__$1;
(statearr_26555_27850[(2)] = inst_26511);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (6))){
var inst_26455 = (state_26535[(8)]);
var inst_26513 = inst_26455.length;
var inst_26514 = (inst_26513 > (0));
var state_26535__$1 = state_26535;
if(cljs.core.truth_(inst_26514)){
var statearr_26560_27851 = state_26535__$1;
(statearr_26560_27851[(1)] = (15));

} else {
var statearr_26563_27852 = state_26535__$1;
(statearr_26563_27852[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (17))){
var inst_26524 = (state_26535[(2)]);
var inst_26525 = cljs.core.async.close_BANG_(out);
var state_26535__$1 = (function (){var statearr_26566 = state_26535;
(statearr_26566[(10)] = inst_26524);

return statearr_26566;
})();
var statearr_26569_27853 = state_26535__$1;
(statearr_26569_27853[(2)] = inst_26525);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (3))){
var inst_26529 = (state_26535[(2)]);
var state_26535__$1 = state_26535;
return cljs.core.async.impl.ioc_helpers.return_chan(state_26535__$1,inst_26529);
} else {
if((state_val_26536 === (12))){
var inst_26455 = (state_26535[(8)]);
var inst_26498 = cljs.core.vec(inst_26455);
var state_26535__$1 = state_26535;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_26535__$1,(14),out,inst_26498);
} else {
if((state_val_26536 === (2))){
var state_26535__$1 = state_26535;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_26535__$1,(4),ch);
} else {
if((state_val_26536 === (11))){
var inst_26464 = (state_26535[(9)]);
var inst_26455 = (state_26535[(8)]);
var inst_26474 = (state_26535[(11)]);
var inst_26490 = inst_26455.push(inst_26464);
var tmp26572 = inst_26455;
var inst_26455__$1 = tmp26572;
var inst_26456 = inst_26474;
var state_26535__$1 = (function (){var statearr_26585 = state_26535;
(statearr_26585[(12)] = inst_26490);

(statearr_26585[(7)] = inst_26456);

(statearr_26585[(8)] = inst_26455__$1);

return statearr_26585;
})();
var statearr_26587_27855 = state_26535__$1;
(statearr_26587_27855[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (9))){
var inst_26456 = (state_26535[(7)]);
var inst_26486 = cljs.core.keyword_identical_QMARK_(inst_26456,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var state_26535__$1 = state_26535;
var statearr_26595_27860 = state_26535__$1;
(statearr_26595_27860[(2)] = inst_26486);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (5))){
var inst_26479 = (state_26535[(13)]);
var inst_26464 = (state_26535[(9)]);
var inst_26456 = (state_26535[(7)]);
var inst_26474 = (state_26535[(11)]);
var inst_26474__$1 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_26464) : f.call(null, inst_26464));
var inst_26479__$1 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_26474__$1,inst_26456);
var state_26535__$1 = (function (){var statearr_26601 = state_26535;
(statearr_26601[(13)] = inst_26479__$1);

(statearr_26601[(11)] = inst_26474__$1);

return statearr_26601;
})();
if(inst_26479__$1){
var statearr_26604_27863 = state_26535__$1;
(statearr_26604_27863[(1)] = (8));

} else {
var statearr_26606_27864 = state_26535__$1;
(statearr_26606_27864[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (14))){
var inst_26464 = (state_26535[(9)]);
var inst_26474 = (state_26535[(11)]);
var inst_26500 = (state_26535[(2)]);
var inst_26506 = [];
var inst_26507 = inst_26506.push(inst_26464);
var inst_26455 = inst_26506;
var inst_26456 = inst_26474;
var state_26535__$1 = (function (){var statearr_26610 = state_26535;
(statearr_26610[(14)] = inst_26507);

(statearr_26610[(15)] = inst_26500);

(statearr_26610[(7)] = inst_26456);

(statearr_26610[(8)] = inst_26455);

return statearr_26610;
})();
var statearr_26621_27865 = state_26535__$1;
(statearr_26621_27865[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (16))){
var state_26535__$1 = state_26535;
var statearr_26635_27870 = state_26535__$1;
(statearr_26635_27870[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (10))){
var inst_26488 = (state_26535[(2)]);
var state_26535__$1 = state_26535;
if(cljs.core.truth_(inst_26488)){
var statearr_26644_27873 = state_26535__$1;
(statearr_26644_27873[(1)] = (11));

} else {
var statearr_26646_27874 = state_26535__$1;
(statearr_26646_27874[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (18))){
var inst_26520 = (state_26535[(2)]);
var state_26535__$1 = state_26535;
var statearr_26648_27875 = state_26535__$1;
(statearr_26648_27875[(2)] = inst_26520);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_26536 === (8))){
var inst_26479 = (state_26535[(13)]);
var state_26535__$1 = state_26535;
var statearr_26651_27876 = state_26535__$1;
(statearr_26651_27876[(2)] = inst_26479);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__21555__auto__ = null;
var cljs$core$async$state_machine__21555__auto____0 = (function (){
var statearr_26654 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_26654[(0)] = cljs$core$async$state_machine__21555__auto__);

(statearr_26654[(1)] = (1));

return statearr_26654;
});
var cljs$core$async$state_machine__21555__auto____1 = (function (state_26535){
while(true){
var ret_value__21556__auto__ = (function (){try{while(true){
var result__21557__auto__ = switch__21554__auto__(state_26535);
if(cljs.core.keyword_identical_QMARK_(result__21557__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__21557__auto__;
}
break;
}
}catch (e26656){var ex__21558__auto__ = e26656;
var statearr_26657_27877 = state_26535;
(statearr_26657_27877[(2)] = ex__21558__auto__);


if(cljs.core.seq((state_26535[(4)]))){
var statearr_26658_27878 = state_26535;
(statearr_26658_27878[(1)] = cljs.core.first((state_26535[(4)])));

} else {
throw ex__21558__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__21556__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__27879 = state_26535;
state_26535 = G__27879;
continue;
} else {
return ret_value__21556__auto__;
}
break;
}
});
cljs$core$async$state_machine__21555__auto__ = function(state_26535){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__21555__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__21555__auto____1.call(this,state_26535);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__21555__auto____0;
cljs$core$async$state_machine__21555__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__21555__auto____1;
return cljs$core$async$state_machine__21555__auto__;
})()
})();
var state__22636__auto__ = (function (){var statearr_26673 = f__22635__auto__();
(statearr_26673[(6)] = c__22634__auto___27842);

return statearr_26673;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__22636__auto__);
}));


return out;
}));

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


//# sourceMappingURL=cljs.core.async.js.map
