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$async35176 = (function (f,blockable,meta35177){
this.f = f;
this.blockable = blockable;
this.meta35177 = meta35177;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async35176.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_35178,meta35177__$1){
var self__ = this;
var _35178__$1 = this;
return (new cljs.core.async.t_cljs$core$async35176(self__.f,self__.blockable,meta35177__$1));
}));

(cljs.core.async.t_cljs$core$async35176.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_35178){
var self__ = this;
var _35178__$1 = this;
return self__.meta35177;
}));

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

(cljs.core.async.t_cljs$core$async35176.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$async35176.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$async35176.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$async35176.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,"meta35177","meta35177",-2044814494,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async35176.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async35176");
}));

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


cljs.core.async.fn_handler = (function cljs$core$async$fn_handler(var_args){
var G__35172 = arguments.length;
switch (G__35172) {
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$async35176(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__35209 = arguments.length;
switch (G__35209) {
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, then return the value (or nil) forever. 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__35225 = arguments.length;
switch (G__35225) {
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__35246 = arguments.length;
switch (G__35246) {
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_37436 = 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_37436) : fn1.call(null,val_37436));
} else {
cljs.core.async.impl.dispatch.run((function (){
return (fn1.cljs$core$IFn$_invoke$arity$1 ? fn1.cljs$core$IFn$_invoke$arity$1(val_37436) : fn1.call(null,val_37436));
}));
}
} 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__35255 = arguments.length;
switch (G__35255) {
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__5616__auto___37448 = n;
var x_37449 = (0);
while(true){
if((x_37449 < n__5616__auto___37448)){
(a[x_37449] = x_37449);

var G__37450 = (x_37449 + (1));
x_37449 = G__37450;
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$async35260 = (function (flag,meta35261){
this.flag = flag;
this.meta35261 = meta35261;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async35260.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_35262,meta35261__$1){
var self__ = this;
var _35262__$1 = this;
return (new cljs.core.async.t_cljs$core$async35260(self__.flag,meta35261__$1));
}));

(cljs.core.async.t_cljs$core$async35260.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_35262){
var self__ = this;
var _35262__$1 = this;
return self__.meta35261;
}));

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

(cljs.core.async.t_cljs$core$async35260.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$async35260.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$async35260.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$async35260.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,"meta35261","meta35261",115400980,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async35260.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async35260");
}));

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


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$async35260(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$async35267 = (function (flag,cb,meta35268){
this.flag = flag;
this.cb = cb;
this.meta35268 = meta35268;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async35267.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_35269,meta35268__$1){
var self__ = this;
var _35269__$1 = this;
return (new cljs.core.async.t_cljs$core$async35267(self__.flag,self__.cb,meta35268__$1));
}));

(cljs.core.async.t_cljs$core$async35267.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_35269){
var self__ = this;
var _35269__$1 = this;
return self__.meta35268;
}));

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

(cljs.core.async.t_cljs$core$async35267.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$async35267.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$async35267.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$async35267.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,"meta35268","meta35268",-1492302514,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async35267.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async35267");
}));

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


cljs.core.async.alt_handler = (function cljs$core$async$alt_handler(flag,cb){
return (new cljs.core.async.t_cljs$core$async35267(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 ports__$1 = cljs.core.vec(ports);
var n = cljs.core.count(ports__$1);
var _ = (function (){var i = (0);
while(true){
if((i < n)){
var port_37453 = cljs.core.nth.cljs$core$IFn$_invoke$arity$2(ports__$1,i);
if(cljs.core.vector_QMARK_(port_37453)){
if((!(((port_37453.cljs$core$IFn$_invoke$arity$1 ? port_37453.cljs$core$IFn$_invoke$arity$1((1)) : port_37453.call(null,(1))) == null)))){
} else {
throw (new Error(["Assert failed: ","can't put nil on channel","\n","(some? (port 1))"].join('')));
}
} else {
}

var G__37459 = (i + (1));
i = G__37459;
continue;
} else {
return null;
}
break;
}
})();
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__$1,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,ports__$1,n,_,idxs,priority){
return (function (p1__35272_SHARP_){
var G__35275 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__35272_SHARP_,wport], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__35275) : fret.call(null,G__35275));
});})(i,val,idx,port,wport,flag,ports__$1,n,_,idxs,priority))
));
})():cljs.core.async.impl.protocols.take_BANG_(port,cljs.core.async.alt_handler(flag,((function (i,idx,port,wport,flag,ports__$1,n,_,idxs,priority){
return (function (p1__35273_SHARP_){
var G__35276 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__35273_SHARP_,port], null);
return (fret.cljs$core$IFn$_invoke$arity$1 ? fret.cljs$core$IFn$_invoke$arity$1(G__35276) : fret.call(null,G__35276));
});})(i,idx,port,wport,flag,ports__$1,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__5025__auto__ = wport;
if(cljs.core.truth_(or__5025__auto__)){
return or__5025__auto__;
} else {
return port;
}
})()], null));
} else {
var G__37460 = (i + (1));
i = G__37460;
continue;
}
} else {
return null;
}
break;
}
})();
var or__5025__auto__ = ret;
if(cljs.core.truth_(or__5025__auto__)){
return or__5025__auto__;
} else {
if(cljs.core.contains_QMARK_(opts,new cljs.core.Keyword(null,"default","default",-1987822328))){
var temp__5804__auto__ = (function (){var and__5023__auto__ = flag.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
if(cljs.core.truth_(and__5023__auto__)){
return flag.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
} else {
return and__5023__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__5755__auto__ = [];
var len__5749__auto___37461 = arguments.length;
var i__5750__auto___37462 = (0);
while(true){
if((i__5750__auto___37462 < len__5749__auto___37461)){
args__5755__auto__.push((arguments[i__5750__auto___37462]));

var G__37463 = (i__5750__auto___37462 + (1));
i__5750__auto___37462 = G__37463;
continue;
} else {
}
break;
}

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

(cljs.core.async.alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ports,p__35280){
var map__35281 = p__35280;
var map__35281__$1 = cljs.core.__destructure_map(map__35281);
var opts = map__35281__$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 (seq35278){
var G__35279 = cljs.core.first(seq35278);
var seq35278__$1 = cljs.core.next(seq35278);
var self__5734__auto__ = this;
return self__5734__auto__.cljs$core$IFn$_invoke$arity$variadic(G__35279,seq35278__$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__35285 = arguments.length;
switch (G__35285) {
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__35079__auto___37469 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35338){
var state_val_35341 = (state_35338[(1)]);
if((state_val_35341 === (7))){
var inst_35332 = (state_35338[(2)]);
var state_35338__$1 = state_35338;
var statearr_35364_37470 = state_35338__$1;
(statearr_35364_37470[(2)] = inst_35332);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (1))){
var state_35338__$1 = state_35338;
var statearr_35366_37471 = state_35338__$1;
(statearr_35366_37471[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (4))){
var inst_35291 = (state_35338[(7)]);
var inst_35291__$1 = (state_35338[(2)]);
var inst_35293 = (inst_35291__$1 == null);
var state_35338__$1 = (function (){var statearr_35388 = state_35338;
(statearr_35388[(7)] = inst_35291__$1);

return statearr_35388;
})();
if(cljs.core.truth_(inst_35293)){
var statearr_35389_37472 = state_35338__$1;
(statearr_35389_37472[(1)] = (5));

} else {
var statearr_35390_37473 = state_35338__$1;
(statearr_35390_37473[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (13))){
var state_35338__$1 = state_35338;
var statearr_35412_37478 = state_35338__$1;
(statearr_35412_37478[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (6))){
var inst_35291 = (state_35338[(7)]);
var state_35338__$1 = state_35338;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_35338__$1,(11),to,inst_35291);
} else {
if((state_val_35341 === (3))){
var inst_35334 = (state_35338[(2)]);
var state_35338__$1 = state_35338;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35338__$1,inst_35334);
} else {
if((state_val_35341 === (12))){
var state_35338__$1 = state_35338;
var statearr_35414_37482 = state_35338__$1;
(statearr_35414_37482[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (2))){
var state_35338__$1 = state_35338;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35338__$1,(4),from);
} else {
if((state_val_35341 === (11))){
var inst_35325 = (state_35338[(2)]);
var state_35338__$1 = state_35338;
if(cljs.core.truth_(inst_35325)){
var statearr_35417_37486 = state_35338__$1;
(statearr_35417_37486[(1)] = (12));

} else {
var statearr_35418_37487 = state_35338__$1;
(statearr_35418_37487[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (9))){
var state_35338__$1 = state_35338;
var statearr_35419_37488 = state_35338__$1;
(statearr_35419_37488[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (5))){
var state_35338__$1 = state_35338;
if(cljs.core.truth_(close_QMARK_)){
var statearr_35420_37490 = state_35338__$1;
(statearr_35420_37490[(1)] = (8));

} else {
var statearr_35421_37491 = state_35338__$1;
(statearr_35421_37491[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (14))){
var inst_35330 = (state_35338[(2)]);
var state_35338__$1 = state_35338;
var statearr_35422_37492 = state_35338__$1;
(statearr_35422_37492[(2)] = inst_35330);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (10))){
var inst_35322 = (state_35338[(2)]);
var state_35338__$1 = state_35338;
var statearr_35423_37494 = state_35338__$1;
(statearr_35423_37494[(2)] = inst_35322);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35341 === (8))){
var inst_35306 = cljs.core.async.close_BANG_(to);
var state_35338__$1 = state_35338;
var statearr_35429_37495 = state_35338__$1;
(statearr_35429_37495[(2)] = inst_35306);

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


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

(statearr_35438[(1)] = (1));

return statearr_35438;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_35338){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35338);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35439){var ex__34863__auto__ = e35439;
var statearr_35440_37496 = state_35338;
(statearr_35440_37496[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37498 = state_35338;
state_35338 = G__37498;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_35338){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_35338);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35443 = f__35080__auto__();
(statearr_35443[(6)] = c__35079__auto___37469);

return statearr_35443;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__35446){
var vec__35447 = p__35446;
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__35447,(0),null);
var p = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__35447,(1),null);
var job = vec__35447;
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__35079__auto___37502 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35454){
var state_val_35455 = (state_35454[(1)]);
if((state_val_35455 === (1))){
var state_35454__$1 = state_35454;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_35454__$1,(2),res,v);
} else {
if((state_val_35455 === (2))){
var inst_35451 = (state_35454[(2)]);
var inst_35452 = cljs.core.async.close_BANG_(res);
var state_35454__$1 = (function (){var statearr_35457 = state_35454;
(statearr_35457[(7)] = inst_35451);

return statearr_35457;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_35454__$1,inst_35452);
} else {
return null;
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0 = (function (){
var statearr_35458 = [null,null,null,null,null,null,null,null];
(statearr_35458[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__);

(statearr_35458[(1)] = (1));

return statearr_35458;
});
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1 = (function (state_35454){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35454);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35459){var ex__34863__auto__ = e35459;
var statearr_35460_37503 = state_35454;
(statearr_35460_37503[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37505 = state_35454;
state_35454 = G__37505;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = function(state_35454){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1.call(this,state_35454);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35463 = f__35080__auto__();
(statearr_35463[(6)] = c__35079__auto___37502);

return statearr_35463;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));


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

return true;
}
});
var async = (function (p__35464){
var vec__35465 = p__35464;
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__35465,(0),null);
var p = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__35465,(1),null);
var job = vec__35465;
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__5616__auto___37506 = n;
var __37507 = (0);
while(true){
if((__37507 < n__5616__auto___37506)){
var G__35468_37508 = type;
var G__35468_37509__$1 = (((G__35468_37508 instanceof cljs.core.Keyword))?G__35468_37508.fqn:null);
switch (G__35468_37509__$1) {
case "compute":
var c__35079__auto___37511 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__37507,c__35079__auto___37511,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async){
return (function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = ((function (__37507,c__35079__auto___37511,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async){
return (function (state_35482){
var state_val_35483 = (state_35482[(1)]);
if((state_val_35483 === (1))){
var state_35482__$1 = state_35482;
var statearr_35484_37512 = state_35482__$1;
(statearr_35484_37512[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35483 === (2))){
var state_35482__$1 = state_35482;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35482__$1,(4),jobs);
} else {
if((state_val_35483 === (3))){
var inst_35480 = (state_35482[(2)]);
var state_35482__$1 = state_35482;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35482__$1,inst_35480);
} else {
if((state_val_35483 === (4))){
var inst_35472 = (state_35482[(2)]);
var inst_35473 = process__$1(inst_35472);
var state_35482__$1 = state_35482;
if(cljs.core.truth_(inst_35473)){
var statearr_35486_37513 = state_35482__$1;
(statearr_35486_37513[(1)] = (5));

} else {
var statearr_35487_37514 = state_35482__$1;
(statearr_35487_37514[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35483 === (5))){
var state_35482__$1 = state_35482;
var statearr_35488_37515 = state_35482__$1;
(statearr_35488_37515[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35483 === (6))){
var state_35482__$1 = state_35482;
var statearr_35489_37517 = state_35482__$1;
(statearr_35489_37517[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35483 === (7))){
var inst_35478 = (state_35482[(2)]);
var state_35482__$1 = state_35482;
var statearr_35490_37518 = state_35482__$1;
(statearr_35490_37518[(2)] = inst_35478);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__37507,c__35079__auto___37511,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async))
;
return ((function (__37507,switch__34859__auto__,c__35079__auto___37511,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0 = (function (){
var statearr_35491 = [null,null,null,null,null,null,null];
(statearr_35491[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__);

(statearr_35491[(1)] = (1));

return statearr_35491;
});
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1 = (function (state_35482){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35482);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35492){var ex__34863__auto__ = e35492;
var statearr_35493_37519 = state_35482;
(statearr_35493_37519[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37521 = state_35482;
state_35482 = G__37521;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = function(state_35482){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1.call(this,state_35482);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__;
})()
;})(__37507,switch__34859__auto__,c__35079__auto___37511,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async))
})();
var state__35081__auto__ = (function (){var statearr_35496 = f__35080__auto__();
(statearr_35496[(6)] = c__35079__auto___37511);

return statearr_35496;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
});})(__37507,c__35079__auto___37511,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async))
);


break;
case "async":
var c__35079__auto___37522 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run(((function (__37507,c__35079__auto___37522,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async){
return (function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = ((function (__37507,c__35079__auto___37522,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async){
return (function (state_35509){
var state_val_35510 = (state_35509[(1)]);
if((state_val_35510 === (1))){
var state_35509__$1 = state_35509;
var statearr_35511_37524 = state_35509__$1;
(statearr_35511_37524[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35510 === (2))){
var state_35509__$1 = state_35509;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35509__$1,(4),jobs);
} else {
if((state_val_35510 === (3))){
var inst_35507 = (state_35509[(2)]);
var state_35509__$1 = state_35509;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35509__$1,inst_35507);
} else {
if((state_val_35510 === (4))){
var inst_35499 = (state_35509[(2)]);
var inst_35500 = async(inst_35499);
var state_35509__$1 = state_35509;
if(cljs.core.truth_(inst_35500)){
var statearr_35513_37525 = state_35509__$1;
(statearr_35513_37525[(1)] = (5));

} else {
var statearr_35514_37526 = state_35509__$1;
(statearr_35514_37526[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35510 === (5))){
var state_35509__$1 = state_35509;
var statearr_35515_37528 = state_35509__$1;
(statearr_35515_37528[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35510 === (6))){
var state_35509__$1 = state_35509;
var statearr_35516_37529 = state_35509__$1;
(statearr_35516_37529[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35510 === (7))){
var inst_35505 = (state_35509[(2)]);
var state_35509__$1 = state_35509;
var statearr_35517_37530 = state_35509__$1;
(statearr_35517_37530[(2)] = inst_35505);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(__37507,c__35079__auto___37522,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async))
;
return ((function (__37507,switch__34859__auto__,c__35079__auto___37522,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async){
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0 = (function (){
var statearr_35518 = [null,null,null,null,null,null,null];
(statearr_35518[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__);

(statearr_35518[(1)] = (1));

return statearr_35518;
});
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1 = (function (state_35509){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35509);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35520){var ex__34863__auto__ = e35520;
var statearr_35521_37531 = state_35509;
(statearr_35521_37531[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37533 = state_35509;
state_35509 = G__37533;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = function(state_35509){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1.call(this,state_35509);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__;
})()
;})(__37507,switch__34859__auto__,c__35079__auto___37522,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async))
})();
var state__35081__auto__ = (function (){var statearr_35523 = f__35080__auto__();
(statearr_35523[(6)] = c__35079__auto___37522);

return statearr_35523;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
});})(__37507,c__35079__auto___37522,G__35468_37508,G__35468_37509__$1,n__5616__auto___37506,jobs,results,process__$1,async))
);


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

}

var G__37534 = (__37507 + (1));
__37507 = G__37534;
continue;
} else {
}
break;
}

var c__35079__auto___37535 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35546){
var state_val_35547 = (state_35546[(1)]);
if((state_val_35547 === (7))){
var inst_35542 = (state_35546[(2)]);
var state_35546__$1 = state_35546;
var statearr_35548_37536 = state_35546__$1;
(statearr_35548_37536[(2)] = inst_35542);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35547 === (1))){
var state_35546__$1 = state_35546;
var statearr_35549_37537 = state_35546__$1;
(statearr_35549_37537[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35547 === (4))){
var inst_35526 = (state_35546[(7)]);
var inst_35526__$1 = (state_35546[(2)]);
var inst_35527 = (inst_35526__$1 == null);
var state_35546__$1 = (function (){var statearr_35551 = state_35546;
(statearr_35551[(7)] = inst_35526__$1);

return statearr_35551;
})();
if(cljs.core.truth_(inst_35527)){
var statearr_35552_37538 = state_35546__$1;
(statearr_35552_37538[(1)] = (5));

} else {
var statearr_35553_37539 = state_35546__$1;
(statearr_35553_37539[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35547 === (6))){
var inst_35526 = (state_35546[(7)]);
var inst_35531 = (state_35546[(8)]);
var inst_35531__$1 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
var inst_35533 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_35534 = [inst_35526,inst_35531__$1];
var inst_35535 = (new cljs.core.PersistentVector(null,2,(5),inst_35533,inst_35534,null));
var state_35546__$1 = (function (){var statearr_35554 = state_35546;
(statearr_35554[(8)] = inst_35531__$1);

return statearr_35554;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_35546__$1,(8),jobs,inst_35535);
} else {
if((state_val_35547 === (3))){
var inst_35544 = (state_35546[(2)]);
var state_35546__$1 = state_35546;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35546__$1,inst_35544);
} else {
if((state_val_35547 === (2))){
var state_35546__$1 = state_35546;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35546__$1,(4),from);
} else {
if((state_val_35547 === (9))){
var inst_35539 = (state_35546[(2)]);
var state_35546__$1 = (function (){var statearr_35555 = state_35546;
(statearr_35555[(9)] = inst_35539);

return statearr_35555;
})();
var statearr_35556_37541 = state_35546__$1;
(statearr_35556_37541[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35547 === (5))){
var inst_35529 = cljs.core.async.close_BANG_(jobs);
var state_35546__$1 = state_35546;
var statearr_35558_37542 = state_35546__$1;
(statearr_35558_37542[(2)] = inst_35529);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35547 === (8))){
var inst_35531 = (state_35546[(8)]);
var inst_35537 = (state_35546[(2)]);
var state_35546__$1 = (function (){var statearr_35559 = state_35546;
(statearr_35559[(10)] = inst_35537);

return statearr_35559;
})();
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_35546__$1,(9),results,inst_35531);
} else {
return null;
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = null;
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0 = (function (){
var statearr_35560 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_35560[(0)] = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__);

(statearr_35560[(1)] = (1));

return statearr_35560;
});
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1 = (function (state_35546){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35546);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35561){var ex__34863__auto__ = e35561;
var statearr_35562_37547 = state_35546;
(statearr_35562_37547[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37549 = state_35546;
state_35546 = G__37549;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = function(state_35546){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1.call(this,state_35546);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35564 = f__35080__auto__();
(statearr_35564[(6)] = c__35079__auto___37535);

return statearr_35564;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));


var c__35079__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35603){
var state_val_35604 = (state_35603[(1)]);
if((state_val_35604 === (7))){
var inst_35599 = (state_35603[(2)]);
var state_35603__$1 = state_35603;
var statearr_35607_37550 = state_35603__$1;
(statearr_35607_37550[(2)] = inst_35599);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (20))){
var state_35603__$1 = state_35603;
var statearr_35608_37551 = state_35603__$1;
(statearr_35608_37551[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (1))){
var state_35603__$1 = state_35603;
var statearr_35609_37552 = state_35603__$1;
(statearr_35609_37552[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (4))){
var inst_35568 = (state_35603[(7)]);
var inst_35568__$1 = (state_35603[(2)]);
var inst_35569 = (inst_35568__$1 == null);
var state_35603__$1 = (function (){var statearr_35610 = state_35603;
(statearr_35610[(7)] = inst_35568__$1);

return statearr_35610;
})();
if(cljs.core.truth_(inst_35569)){
var statearr_35611_37557 = state_35603__$1;
(statearr_35611_37557[(1)] = (5));

} else {
var statearr_35612_37558 = state_35603__$1;
(statearr_35612_37558[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (15))){
var inst_35581 = (state_35603[(8)]);
var state_35603__$1 = state_35603;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_35603__$1,(18),to,inst_35581);
} else {
if((state_val_35604 === (21))){
var inst_35594 = (state_35603[(2)]);
var state_35603__$1 = state_35603;
var statearr_35613_37560 = state_35603__$1;
(statearr_35613_37560[(2)] = inst_35594);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (13))){
var inst_35596 = (state_35603[(2)]);
var state_35603__$1 = (function (){var statearr_35614 = state_35603;
(statearr_35614[(9)] = inst_35596);

return statearr_35614;
})();
var statearr_35615_37561 = state_35603__$1;
(statearr_35615_37561[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (6))){
var inst_35568 = (state_35603[(7)]);
var state_35603__$1 = state_35603;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35603__$1,(11),inst_35568);
} else {
if((state_val_35604 === (17))){
var inst_35589 = (state_35603[(2)]);
var state_35603__$1 = state_35603;
if(cljs.core.truth_(inst_35589)){
var statearr_35618_37562 = state_35603__$1;
(statearr_35618_37562[(1)] = (19));

} else {
var statearr_35619_37563 = state_35603__$1;
(statearr_35619_37563[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (3))){
var inst_35601 = (state_35603[(2)]);
var state_35603__$1 = state_35603;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35603__$1,inst_35601);
} else {
if((state_val_35604 === (12))){
var inst_35578 = (state_35603[(10)]);
var state_35603__$1 = state_35603;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35603__$1,(14),inst_35578);
} else {
if((state_val_35604 === (2))){
var state_35603__$1 = state_35603;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35603__$1,(4),results);
} else {
if((state_val_35604 === (19))){
var state_35603__$1 = state_35603;
var statearr_35620_37564 = state_35603__$1;
(statearr_35620_37564[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (11))){
var inst_35578 = (state_35603[(2)]);
var state_35603__$1 = (function (){var statearr_35621 = state_35603;
(statearr_35621[(10)] = inst_35578);

return statearr_35621;
})();
var statearr_35622_37565 = state_35603__$1;
(statearr_35622_37565[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (9))){
var state_35603__$1 = state_35603;
var statearr_35623_37567 = state_35603__$1;
(statearr_35623_37567[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (5))){
var state_35603__$1 = state_35603;
if(cljs.core.truth_(close_QMARK_)){
var statearr_35624_37568 = state_35603__$1;
(statearr_35624_37568[(1)] = (8));

} else {
var statearr_35625_37569 = state_35603__$1;
(statearr_35625_37569[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (14))){
var inst_35581 = (state_35603[(8)]);
var inst_35583 = (state_35603[(11)]);
var inst_35581__$1 = (state_35603[(2)]);
var inst_35582 = (inst_35581__$1 == null);
var inst_35583__$1 = cljs.core.not(inst_35582);
var state_35603__$1 = (function (){var statearr_35626 = state_35603;
(statearr_35626[(8)] = inst_35581__$1);

(statearr_35626[(11)] = inst_35583__$1);

return statearr_35626;
})();
if(inst_35583__$1){
var statearr_35627_37570 = state_35603__$1;
(statearr_35627_37570[(1)] = (15));

} else {
var statearr_35628_37571 = state_35603__$1;
(statearr_35628_37571[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (16))){
var inst_35583 = (state_35603[(11)]);
var state_35603__$1 = state_35603;
var statearr_35629_37572 = state_35603__$1;
(statearr_35629_37572[(2)] = inst_35583);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (10))){
var inst_35575 = (state_35603[(2)]);
var state_35603__$1 = state_35603;
var statearr_35631_37573 = state_35603__$1;
(statearr_35631_37573[(2)] = inst_35575);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (18))){
var inst_35586 = (state_35603[(2)]);
var state_35603__$1 = state_35603;
var statearr_35633_37574 = state_35603__$1;
(statearr_35633_37574[(2)] = inst_35586);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35604 === (8))){
var inst_35572 = cljs.core.async.close_BANG_(to);
var state_35603__$1 = state_35603;
var statearr_35634_37575 = state_35603__$1;
(statearr_35634_37575[(2)] = inst_35572);

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


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

(statearr_35635[(1)] = (1));

return statearr_35635;
});
var cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1 = (function (state_35603){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35603);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35636){var ex__34863__auto__ = e35636;
var statearr_35637_37578 = state_35603;
(statearr_35637_37578[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37581 = state_35603;
state_35603 = G__37581;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__ = function(state_35603){
switch(arguments.length){
case 0:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1.call(this,state_35603);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____0;
cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$pipeline_STAR__$_state_machine__34860__auto____1;
return cljs$core$async$pipeline_STAR__$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35639 = f__35080__auto__();
(statearr_35639[(6)] = c__35079__auto__);

return statearr_35639;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));

return c__35079__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__35641 = arguments.length;
switch (G__35641) {
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__35652 = arguments.length;
switch (G__35652) {
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__35666 = arguments.length;
switch (G__35666) {
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__35079__auto___37596 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35705){
var state_val_35706 = (state_35705[(1)]);
if((state_val_35706 === (7))){
var inst_35700 = (state_35705[(2)]);
var state_35705__$1 = state_35705;
var statearr_35711_37597 = state_35705__$1;
(statearr_35711_37597[(2)] = inst_35700);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (1))){
var state_35705__$1 = state_35705;
var statearr_35714_37598 = state_35705__$1;
(statearr_35714_37598[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (4))){
var inst_35677 = (state_35705[(7)]);
var inst_35677__$1 = (state_35705[(2)]);
var inst_35679 = (inst_35677__$1 == null);
var state_35705__$1 = (function (){var statearr_35716 = state_35705;
(statearr_35716[(7)] = inst_35677__$1);

return statearr_35716;
})();
if(cljs.core.truth_(inst_35679)){
var statearr_35718_37599 = state_35705__$1;
(statearr_35718_37599[(1)] = (5));

} else {
var statearr_35719_37600 = state_35705__$1;
(statearr_35719_37600[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (13))){
var state_35705__$1 = state_35705;
var statearr_35723_37601 = state_35705__$1;
(statearr_35723_37601[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (6))){
var inst_35677 = (state_35705[(7)]);
var inst_35686 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_35677) : p.call(null,inst_35677));
var state_35705__$1 = state_35705;
if(cljs.core.truth_(inst_35686)){
var statearr_35725_37602 = state_35705__$1;
(statearr_35725_37602[(1)] = (9));

} else {
var statearr_35726_37603 = state_35705__$1;
(statearr_35726_37603[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (3))){
var inst_35702 = (state_35705[(2)]);
var state_35705__$1 = state_35705;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35705__$1,inst_35702);
} else {
if((state_val_35706 === (12))){
var state_35705__$1 = state_35705;
var statearr_35731_37604 = state_35705__$1;
(statearr_35731_37604[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (2))){
var state_35705__$1 = state_35705;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35705__$1,(4),ch);
} else {
if((state_val_35706 === (11))){
var inst_35677 = (state_35705[(7)]);
var inst_35690 = (state_35705[(2)]);
var state_35705__$1 = state_35705;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_35705__$1,(8),inst_35690,inst_35677);
} else {
if((state_val_35706 === (9))){
var state_35705__$1 = state_35705;
var statearr_35736_37605 = state_35705__$1;
(statearr_35736_37605[(2)] = tc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (5))){
var inst_35681 = cljs.core.async.close_BANG_(tc);
var inst_35682 = cljs.core.async.close_BANG_(fc);
var state_35705__$1 = (function (){var statearr_35740 = state_35705;
(statearr_35740[(8)] = inst_35681);

return statearr_35740;
})();
var statearr_35741_37606 = state_35705__$1;
(statearr_35741_37606[(2)] = inst_35682);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (14))){
var inst_35698 = (state_35705[(2)]);
var state_35705__$1 = state_35705;
var statearr_35743_37607 = state_35705__$1;
(statearr_35743_37607[(2)] = inst_35698);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (10))){
var state_35705__$1 = state_35705;
var statearr_35747_37611 = state_35705__$1;
(statearr_35747_37611[(2)] = fc);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35706 === (8))){
var inst_35693 = (state_35705[(2)]);
var state_35705__$1 = state_35705;
if(cljs.core.truth_(inst_35693)){
var statearr_35749_37612 = state_35705__$1;
(statearr_35749_37612[(1)] = (12));

} else {
var statearr_35750_37613 = state_35705__$1;
(statearr_35750_37613[(1)] = (13));

}

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

(statearr_35755[(1)] = (1));

return statearr_35755;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_35705){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35705);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35758){var ex__34863__auto__ = e35758;
var statearr_35760_37616 = state_35705;
(statearr_35760_37616[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37618 = state_35705;
state_35705 = G__37618;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_35705){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_35705);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35766 = f__35080__auto__();
(statearr_35766[(6)] = c__35079__auto___37596);

return statearr_35766;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__35079__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35797){
var state_val_35798 = (state_35797[(1)]);
if((state_val_35798 === (7))){
var inst_35792 = (state_35797[(2)]);
var state_35797__$1 = state_35797;
var statearr_35803_37619 = state_35797__$1;
(statearr_35803_37619[(2)] = inst_35792);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35798 === (1))){
var inst_35772 = init;
var inst_35773 = inst_35772;
var state_35797__$1 = (function (){var statearr_35807 = state_35797;
(statearr_35807[(7)] = inst_35773);

return statearr_35807;
})();
var statearr_35808_37620 = state_35797__$1;
(statearr_35808_37620[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35798 === (4))){
var inst_35776 = (state_35797[(8)]);
var inst_35776__$1 = (state_35797[(2)]);
var inst_35779 = (inst_35776__$1 == null);
var state_35797__$1 = (function (){var statearr_35810 = state_35797;
(statearr_35810[(8)] = inst_35776__$1);

return statearr_35810;
})();
if(cljs.core.truth_(inst_35779)){
var statearr_35813_37625 = state_35797__$1;
(statearr_35813_37625[(1)] = (5));

} else {
var statearr_35815_37626 = state_35797__$1;
(statearr_35815_37626[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35798 === (6))){
var inst_35773 = (state_35797[(7)]);
var inst_35776 = (state_35797[(8)]);
var inst_35783 = (state_35797[(9)]);
var inst_35783__$1 = (f.cljs$core$IFn$_invoke$arity$2 ? f.cljs$core$IFn$_invoke$arity$2(inst_35773,inst_35776) : f.call(null,inst_35773,inst_35776));
var inst_35784 = cljs.core.reduced_QMARK_(inst_35783__$1);
var state_35797__$1 = (function (){var statearr_35817 = state_35797;
(statearr_35817[(9)] = inst_35783__$1);

return statearr_35817;
})();
if(inst_35784){
var statearr_35820_37627 = state_35797__$1;
(statearr_35820_37627[(1)] = (8));

} else {
var statearr_35822_37628 = state_35797__$1;
(statearr_35822_37628[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35798 === (3))){
var inst_35794 = (state_35797[(2)]);
var state_35797__$1 = state_35797;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35797__$1,inst_35794);
} else {
if((state_val_35798 === (2))){
var state_35797__$1 = state_35797;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35797__$1,(4),ch);
} else {
if((state_val_35798 === (9))){
var inst_35783 = (state_35797[(9)]);
var inst_35773 = inst_35783;
var state_35797__$1 = (function (){var statearr_35827 = state_35797;
(statearr_35827[(7)] = inst_35773);

return statearr_35827;
})();
var statearr_35828_37629 = state_35797__$1;
(statearr_35828_37629[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35798 === (5))){
var inst_35773 = (state_35797[(7)]);
var state_35797__$1 = state_35797;
var statearr_35830_37630 = state_35797__$1;
(statearr_35830_37630[(2)] = inst_35773);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35798 === (10))){
var inst_35790 = (state_35797[(2)]);
var state_35797__$1 = state_35797;
var statearr_35834_37631 = state_35797__$1;
(statearr_35834_37631[(2)] = inst_35790);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35798 === (8))){
var inst_35783 = (state_35797[(9)]);
var inst_35786 = cljs.core.deref(inst_35783);
var state_35797__$1 = state_35797;
var statearr_35835_37632 = state_35797__$1;
(statearr_35835_37632[(2)] = inst_35786);

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


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

(statearr_35837[(1)] = (1));

return statearr_35837;
});
var cljs$core$async$reduce_$_state_machine__34860__auto____1 = (function (state_35797){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35797);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35841){var ex__34863__auto__ = e35841;
var statearr_35842_37633 = state_35797;
(statearr_35842_37633[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37635 = state_35797;
state_35797 = G__37635;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$reduce_$_state_machine__34860__auto__ = function(state_35797){
switch(arguments.length){
case 0:
return cljs$core$async$reduce_$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$reduce_$_state_machine__34860__auto____1.call(this,state_35797);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$reduce_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$reduce_$_state_machine__34860__auto____0;
cljs$core$async$reduce_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$reduce_$_state_machine__34860__auto____1;
return cljs$core$async$reduce_$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35848 = f__35080__auto__();
(statearr_35848[(6)] = c__35079__auto__);

return statearr_35848;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));

return c__35079__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__35079__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35863){
var state_val_35864 = (state_35863[(1)]);
if((state_val_35864 === (1))){
var inst_35855 = cljs.core.async.reduce(f__$1,init,ch);
var state_35863__$1 = state_35863;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_35863__$1,(2),inst_35855);
} else {
if((state_val_35864 === (2))){
var inst_35858 = (state_35863[(2)]);
var inst_35860 = (f__$1.cljs$core$IFn$_invoke$arity$1 ? f__$1.cljs$core$IFn$_invoke$arity$1(inst_35858) : f__$1.call(null,inst_35858));
var state_35863__$1 = state_35863;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35863__$1,inst_35860);
} else {
return null;
}
}
});
return (function() {
var cljs$core$async$transduce_$_state_machine__34860__auto__ = null;
var cljs$core$async$transduce_$_state_machine__34860__auto____0 = (function (){
var statearr_35874 = [null,null,null,null,null,null,null];
(statearr_35874[(0)] = cljs$core$async$transduce_$_state_machine__34860__auto__);

(statearr_35874[(1)] = (1));

return statearr_35874;
});
var cljs$core$async$transduce_$_state_machine__34860__auto____1 = (function (state_35863){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35863);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35876){var ex__34863__auto__ = e35876;
var statearr_35878_37636 = state_35863;
(statearr_35878_37636[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37638 = state_35863;
state_35863 = G__37638;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$transduce_$_state_machine__34860__auto__ = function(state_35863){
switch(arguments.length){
case 0:
return cljs$core$async$transduce_$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$transduce_$_state_machine__34860__auto____1.call(this,state_35863);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$transduce_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$transduce_$_state_machine__34860__auto____0;
cljs$core$async$transduce_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$transduce_$_state_machine__34860__auto____1;
return cljs$core$async$transduce_$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35887 = f__35080__auto__();
(statearr_35887[(6)] = c__35079__auto__);

return statearr_35887;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));

return c__35079__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__35893 = arguments.length;
switch (G__35893) {
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__35079__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_35930){
var state_val_35931 = (state_35930[(1)]);
if((state_val_35931 === (7))){
var inst_35908 = (state_35930[(2)]);
var state_35930__$1 = state_35930;
var statearr_35937_37640 = state_35930__$1;
(statearr_35937_37640[(2)] = inst_35908);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (1))){
var inst_35899 = cljs.core.seq(coll);
var inst_35900 = inst_35899;
var state_35930__$1 = (function (){var statearr_35942 = state_35930;
(statearr_35942[(7)] = inst_35900);

return statearr_35942;
})();
var statearr_35943_37641 = state_35930__$1;
(statearr_35943_37641[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (4))){
var inst_35900 = (state_35930[(7)]);
var inst_35906 = cljs.core.first(inst_35900);
var state_35930__$1 = state_35930;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_35930__$1,(7),ch,inst_35906);
} else {
if((state_val_35931 === (13))){
var inst_35921 = (state_35930[(2)]);
var state_35930__$1 = state_35930;
var statearr_35951_37642 = state_35930__$1;
(statearr_35951_37642[(2)] = inst_35921);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (6))){
var inst_35911 = (state_35930[(2)]);
var state_35930__$1 = state_35930;
if(cljs.core.truth_(inst_35911)){
var statearr_35953_37647 = state_35930__$1;
(statearr_35953_37647[(1)] = (8));

} else {
var statearr_35955_37648 = state_35930__$1;
(statearr_35955_37648[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (3))){
var inst_35925 = (state_35930[(2)]);
var state_35930__$1 = state_35930;
return cljs.core.async.impl.ioc_helpers.return_chan(state_35930__$1,inst_35925);
} else {
if((state_val_35931 === (12))){
var state_35930__$1 = state_35930;
var statearr_35959_37649 = state_35930__$1;
(statearr_35959_37649[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (2))){
var inst_35900 = (state_35930[(7)]);
var state_35930__$1 = state_35930;
if(cljs.core.truth_(inst_35900)){
var statearr_35963_37650 = state_35930__$1;
(statearr_35963_37650[(1)] = (4));

} else {
var statearr_35964_37651 = state_35930__$1;
(statearr_35964_37651[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (11))){
var inst_35918 = cljs.core.async.close_BANG_(ch);
var state_35930__$1 = state_35930;
var statearr_35968_37652 = state_35930__$1;
(statearr_35968_37652[(2)] = inst_35918);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (9))){
var state_35930__$1 = state_35930;
if(cljs.core.truth_(close_QMARK_)){
var statearr_35970_37653 = state_35930__$1;
(statearr_35970_37653[(1)] = (11));

} else {
var statearr_35971_37654 = state_35930__$1;
(statearr_35971_37654[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (5))){
var inst_35900 = (state_35930[(7)]);
var state_35930__$1 = state_35930;
var statearr_35973_37655 = state_35930__$1;
(statearr_35973_37655[(2)] = inst_35900);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (10))){
var inst_35923 = (state_35930[(2)]);
var state_35930__$1 = state_35930;
var statearr_35974_37660 = state_35930__$1;
(statearr_35974_37660[(2)] = inst_35923);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_35931 === (8))){
var inst_35900 = (state_35930[(7)]);
var inst_35913 = cljs.core.next(inst_35900);
var inst_35900__$1 = inst_35913;
var state_35930__$1 = (function (){var statearr_35975 = state_35930;
(statearr_35975[(7)] = inst_35900__$1);

return statearr_35975;
})();
var statearr_35976_37661 = state_35930__$1;
(statearr_35976_37661[(2)] = null);

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


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

(statearr_35977[(1)] = (1));

return statearr_35977;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_35930){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_35930);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e35978){var ex__34863__auto__ = e35978;
var statearr_35979_37662 = state_35930;
(statearr_35979_37662[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37664 = state_35930;
state_35930 = G__37664;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_35930){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_35930);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_35981 = f__35080__auto__();
(statearr_35981[(6)] = c__35079__auto__);

return statearr_35981;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));

return c__35079__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__35983 = arguments.length;
switch (G__35983) {
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_37672 = (function (_){
var x__5373__auto__ = (((_ == null))?null:_);
var m__5374__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$1(_) : m__5374__auto__.call(null,_));
} else {
var m__5372__auto__ = (cljs.core.async.muxch_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$1(_) : m__5372__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_37672(_);
}
});


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

var cljs$core$async$Mult$tap_STAR_$dyn_37673 = (function (m,ch,close_QMARK_){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$3(m,ch,close_QMARK_) : m__5374__auto__.call(null,m,ch,close_QMARK_));
} else {
var m__5372__auto__ = (cljs.core.async.tap_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$3(m,ch,close_QMARK_) : m__5372__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_37673(m,ch,close_QMARK_);
}
});

var cljs$core$async$Mult$untap_STAR_$dyn_37674 = (function (m,ch){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5374__auto__.call(null,m,ch));
} else {
var m__5372__auto__ = (cljs.core.async.untap_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5372__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_37674(m,ch);
}
});

var cljs$core$async$Mult$untap_all_STAR_$dyn_37675 = (function (m){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5374__auto__.call(null,m));
} else {
var m__5372__auto__ = (cljs.core.async.untap_all_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5372__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_37675(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$async35986 = (function (ch,cs,meta35987){
this.ch = ch;
this.cs = cs;
this.meta35987 = meta35987;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async35986.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_35988,meta35987__$1){
var self__ = this;
var _35988__$1 = this;
return (new cljs.core.async.t_cljs$core$async35986(self__.ch,self__.cs,meta35987__$1));
}));

(cljs.core.async.t_cljs$core$async35986.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_35988){
var self__ = this;
var _35988__$1 = this;
return self__.meta35987;
}));

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

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

(cljs.core.async.t_cljs$core$async35986.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$async35986.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$async35986.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$async35986.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,"meta35987","meta35987",-1305665044,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async35986.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async35986");
}));

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


/**
 * 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$async35986(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__35079__auto___37680 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_36153){
var state_val_36154 = (state_36153[(1)]);
if((state_val_36154 === (7))){
var inst_36148 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36162_37681 = state_36153__$1;
(statearr_36162_37681[(2)] = inst_36148);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (20))){
var inst_36041 = (state_36153[(7)]);
var inst_36056 = cljs.core.first(inst_36041);
var inst_36058 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36056,(0),null);
var inst_36059 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36056,(1),null);
var state_36153__$1 = (function (){var statearr_36164 = state_36153;
(statearr_36164[(8)] = inst_36058);

return statearr_36164;
})();
if(cljs.core.truth_(inst_36059)){
var statearr_36165_37682 = state_36153__$1;
(statearr_36165_37682[(1)] = (22));

} else {
var statearr_36166_37683 = state_36153__$1;
(statearr_36166_37683[(1)] = (23));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (27))){
var inst_36091 = (state_36153[(9)]);
var inst_36093 = (state_36153[(10)]);
var inst_36098 = (state_36153[(11)]);
var inst_36002 = (state_36153[(12)]);
var inst_36098__$1 = cljs.core._nth(inst_36091,inst_36093);
var inst_36099 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_36098__$1,inst_36002,done);
var state_36153__$1 = (function (){var statearr_36167 = state_36153;
(statearr_36167[(11)] = inst_36098__$1);

return statearr_36167;
})();
if(cljs.core.truth_(inst_36099)){
var statearr_36171_37684 = state_36153__$1;
(statearr_36171_37684[(1)] = (30));

} else {
var statearr_36172_37685 = state_36153__$1;
(statearr_36172_37685[(1)] = (31));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (1))){
var state_36153__$1 = state_36153;
var statearr_36174_37686 = state_36153__$1;
(statearr_36174_37686[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (24))){
var inst_36041 = (state_36153[(7)]);
var inst_36064 = (state_36153[(2)]);
var inst_36065 = cljs.core.next(inst_36041);
var inst_36011 = inst_36065;
var inst_36012 = null;
var inst_36013 = (0);
var inst_36014 = (0);
var state_36153__$1 = (function (){var statearr_36178 = state_36153;
(statearr_36178[(13)] = inst_36064);

(statearr_36178[(14)] = inst_36011);

(statearr_36178[(15)] = inst_36012);

(statearr_36178[(16)] = inst_36013);

(statearr_36178[(17)] = inst_36014);

return statearr_36178;
})();
var statearr_36180_37687 = state_36153__$1;
(statearr_36180_37687[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (39))){
var state_36153__$1 = state_36153;
var statearr_36188_37688 = state_36153__$1;
(statearr_36188_37688[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (4))){
var inst_36002 = (state_36153[(12)]);
var inst_36002__$1 = (state_36153[(2)]);
var inst_36003 = (inst_36002__$1 == null);
var state_36153__$1 = (function (){var statearr_36189 = state_36153;
(statearr_36189[(12)] = inst_36002__$1);

return statearr_36189;
})();
if(cljs.core.truth_(inst_36003)){
var statearr_36190_37689 = state_36153__$1;
(statearr_36190_37689[(1)] = (5));

} else {
var statearr_36192_37690 = state_36153__$1;
(statearr_36192_37690[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (15))){
var inst_36014 = (state_36153[(17)]);
var inst_36011 = (state_36153[(14)]);
var inst_36012 = (state_36153[(15)]);
var inst_36013 = (state_36153[(16)]);
var inst_36036 = (state_36153[(2)]);
var inst_36037 = (inst_36014 + (1));
var tmp36181 = inst_36012;
var tmp36182 = inst_36013;
var tmp36183 = inst_36011;
var inst_36011__$1 = tmp36183;
var inst_36012__$1 = tmp36181;
var inst_36013__$1 = tmp36182;
var inst_36014__$1 = inst_36037;
var state_36153__$1 = (function (){var statearr_36193 = state_36153;
(statearr_36193[(18)] = inst_36036);

(statearr_36193[(14)] = inst_36011__$1);

(statearr_36193[(15)] = inst_36012__$1);

(statearr_36193[(16)] = inst_36013__$1);

(statearr_36193[(17)] = inst_36014__$1);

return statearr_36193;
})();
var statearr_36194_37694 = state_36153__$1;
(statearr_36194_37694[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (21))){
var inst_36068 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36198_37695 = state_36153__$1;
(statearr_36198_37695[(2)] = inst_36068);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (31))){
var inst_36098 = (state_36153[(11)]);
var inst_36102 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null,inst_36098);
var state_36153__$1 = state_36153;
var statearr_36206_37699 = state_36153__$1;
(statearr_36206_37699[(2)] = inst_36102);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (32))){
var inst_36093 = (state_36153[(10)]);
var inst_36090 = (state_36153[(19)]);
var inst_36091 = (state_36153[(9)]);
var inst_36092 = (state_36153[(20)]);
var inst_36104 = (state_36153[(2)]);
var inst_36105 = (inst_36093 + (1));
var tmp36195 = inst_36092;
var tmp36196 = inst_36091;
var tmp36197 = inst_36090;
var inst_36090__$1 = tmp36197;
var inst_36091__$1 = tmp36196;
var inst_36092__$1 = tmp36195;
var inst_36093__$1 = inst_36105;
var state_36153__$1 = (function (){var statearr_36208 = state_36153;
(statearr_36208[(21)] = inst_36104);

(statearr_36208[(19)] = inst_36090__$1);

(statearr_36208[(9)] = inst_36091__$1);

(statearr_36208[(20)] = inst_36092__$1);

(statearr_36208[(10)] = inst_36093__$1);

return statearr_36208;
})();
var statearr_36212_37700 = state_36153__$1;
(statearr_36212_37700[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (40))){
var inst_36121 = (state_36153[(22)]);
var inst_36125 = m.cljs$core$async$Mult$untap_STAR_$arity$2(null,inst_36121);
var state_36153__$1 = state_36153;
var statearr_36214_37701 = state_36153__$1;
(statearr_36214_37701[(2)] = inst_36125);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (33))){
var inst_36111 = (state_36153[(23)]);
var inst_36113 = cljs.core.chunked_seq_QMARK_(inst_36111);
var state_36153__$1 = state_36153;
if(inst_36113){
var statearr_36218_37702 = state_36153__$1;
(statearr_36218_37702[(1)] = (36));

} else {
var statearr_36219_37703 = state_36153__$1;
(statearr_36219_37703[(1)] = (37));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (13))){
var inst_36027 = (state_36153[(24)]);
var inst_36033 = cljs.core.async.close_BANG_(inst_36027);
var state_36153__$1 = state_36153;
var statearr_36221_37704 = state_36153__$1;
(statearr_36221_37704[(2)] = inst_36033);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (22))){
var inst_36058 = (state_36153[(8)]);
var inst_36061 = cljs.core.async.close_BANG_(inst_36058);
var state_36153__$1 = state_36153;
var statearr_36222_37705 = state_36153__$1;
(statearr_36222_37705[(2)] = inst_36061);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (36))){
var inst_36111 = (state_36153[(23)]);
var inst_36116 = cljs.core.chunk_first(inst_36111);
var inst_36117 = cljs.core.chunk_rest(inst_36111);
var inst_36118 = cljs.core.count(inst_36116);
var inst_36090 = inst_36117;
var inst_36091 = inst_36116;
var inst_36092 = inst_36118;
var inst_36093 = (0);
var state_36153__$1 = (function (){var statearr_36227 = state_36153;
(statearr_36227[(19)] = inst_36090);

(statearr_36227[(9)] = inst_36091);

(statearr_36227[(20)] = inst_36092);

(statearr_36227[(10)] = inst_36093);

return statearr_36227;
})();
var statearr_36228_37706 = state_36153__$1;
(statearr_36228_37706[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (41))){
var inst_36111 = (state_36153[(23)]);
var inst_36127 = (state_36153[(2)]);
var inst_36128 = cljs.core.next(inst_36111);
var inst_36090 = inst_36128;
var inst_36091 = null;
var inst_36092 = (0);
var inst_36093 = (0);
var state_36153__$1 = (function (){var statearr_36229 = state_36153;
(statearr_36229[(25)] = inst_36127);

(statearr_36229[(19)] = inst_36090);

(statearr_36229[(9)] = inst_36091);

(statearr_36229[(20)] = inst_36092);

(statearr_36229[(10)] = inst_36093);

return statearr_36229;
})();
var statearr_36231_37707 = state_36153__$1;
(statearr_36231_37707[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (43))){
var state_36153__$1 = state_36153;
var statearr_36232_37708 = state_36153__$1;
(statearr_36232_37708[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (29))){
var inst_36136 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36233_37709 = state_36153__$1;
(statearr_36233_37709[(2)] = inst_36136);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (44))){
var inst_36145 = (state_36153[(2)]);
var state_36153__$1 = (function (){var statearr_36238 = state_36153;
(statearr_36238[(26)] = inst_36145);

return statearr_36238;
})();
var statearr_36239_37710 = state_36153__$1;
(statearr_36239_37710[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (6))){
var inst_36078 = (state_36153[(27)]);
var inst_36077 = cljs.core.deref(cs);
var inst_36078__$1 = cljs.core.keys(inst_36077);
var inst_36082 = cljs.core.count(inst_36078__$1);
var inst_36083 = cljs.core.reset_BANG_(dctr,inst_36082);
var inst_36088 = cljs.core.seq(inst_36078__$1);
var inst_36090 = inst_36088;
var inst_36091 = null;
var inst_36092 = (0);
var inst_36093 = (0);
var state_36153__$1 = (function (){var statearr_36244 = state_36153;
(statearr_36244[(27)] = inst_36078__$1);

(statearr_36244[(28)] = inst_36083);

(statearr_36244[(19)] = inst_36090);

(statearr_36244[(9)] = inst_36091);

(statearr_36244[(20)] = inst_36092);

(statearr_36244[(10)] = inst_36093);

return statearr_36244;
})();
var statearr_36245_37711 = state_36153__$1;
(statearr_36245_37711[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (28))){
var inst_36090 = (state_36153[(19)]);
var inst_36111 = (state_36153[(23)]);
var inst_36111__$1 = cljs.core.seq(inst_36090);
var state_36153__$1 = (function (){var statearr_36246 = state_36153;
(statearr_36246[(23)] = inst_36111__$1);

return statearr_36246;
})();
if(inst_36111__$1){
var statearr_36250_37712 = state_36153__$1;
(statearr_36250_37712[(1)] = (33));

} else {
var statearr_36251_37713 = state_36153__$1;
(statearr_36251_37713[(1)] = (34));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (25))){
var inst_36093 = (state_36153[(10)]);
var inst_36092 = (state_36153[(20)]);
var inst_36095 = (inst_36093 < inst_36092);
var inst_36096 = inst_36095;
var state_36153__$1 = state_36153;
if(cljs.core.truth_(inst_36096)){
var statearr_36253_37714 = state_36153__$1;
(statearr_36253_37714[(1)] = (27));

} else {
var statearr_36254_37715 = state_36153__$1;
(statearr_36254_37715[(1)] = (28));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (34))){
var state_36153__$1 = state_36153;
var statearr_36258_37716 = state_36153__$1;
(statearr_36258_37716[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (17))){
var state_36153__$1 = state_36153;
var statearr_36260_37717 = state_36153__$1;
(statearr_36260_37717[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (3))){
var inst_36150 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
return cljs.core.async.impl.ioc_helpers.return_chan(state_36153__$1,inst_36150);
} else {
if((state_val_36154 === (12))){
var inst_36073 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36261_37718 = state_36153__$1;
(statearr_36261_37718[(2)] = inst_36073);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (35))){
var inst_36134 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36267_37720 = state_36153__$1;
(statearr_36267_37720[(2)] = inst_36134);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (19))){
var inst_36041 = (state_36153[(7)]);
var inst_36045 = cljs.core.chunk_first(inst_36041);
var inst_36049 = cljs.core.chunk_rest(inst_36041);
var inst_36050 = cljs.core.count(inst_36045);
var inst_36011 = inst_36049;
var inst_36012 = inst_36045;
var inst_36013 = inst_36050;
var inst_36014 = (0);
var state_36153__$1 = (function (){var statearr_36268 = state_36153;
(statearr_36268[(14)] = inst_36011);

(statearr_36268[(15)] = inst_36012);

(statearr_36268[(16)] = inst_36013);

(statearr_36268[(17)] = inst_36014);

return statearr_36268;
})();
var statearr_36269_37721 = state_36153__$1;
(statearr_36269_37721[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (11))){
var inst_36011 = (state_36153[(14)]);
var inst_36041 = (state_36153[(7)]);
var inst_36041__$1 = cljs.core.seq(inst_36011);
var state_36153__$1 = (function (){var statearr_36270 = state_36153;
(statearr_36270[(7)] = inst_36041__$1);

return statearr_36270;
})();
if(inst_36041__$1){
var statearr_36271_37723 = state_36153__$1;
(statearr_36271_37723[(1)] = (16));

} else {
var statearr_36272_37724 = state_36153__$1;
(statearr_36272_37724[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (9))){
var inst_36075 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36273_37725 = state_36153__$1;
(statearr_36273_37725[(2)] = inst_36075);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (5))){
var inst_36009 = cljs.core.deref(cs);
var inst_36010 = cljs.core.seq(inst_36009);
var inst_36011 = inst_36010;
var inst_36012 = null;
var inst_36013 = (0);
var inst_36014 = (0);
var state_36153__$1 = (function (){var statearr_36278 = state_36153;
(statearr_36278[(14)] = inst_36011);

(statearr_36278[(15)] = inst_36012);

(statearr_36278[(16)] = inst_36013);

(statearr_36278[(17)] = inst_36014);

return statearr_36278;
})();
var statearr_36279_37728 = state_36153__$1;
(statearr_36279_37728[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (14))){
var state_36153__$1 = state_36153;
var statearr_36280_37731 = state_36153__$1;
(statearr_36280_37731[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (45))){
var inst_36142 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36282_37732 = state_36153__$1;
(statearr_36282_37732[(2)] = inst_36142);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (26))){
var inst_36078 = (state_36153[(27)]);
var inst_36138 = (state_36153[(2)]);
var inst_36139 = cljs.core.seq(inst_36078);
var state_36153__$1 = (function (){var statearr_36283 = state_36153;
(statearr_36283[(29)] = inst_36138);

return statearr_36283;
})();
if(inst_36139){
var statearr_36284_37733 = state_36153__$1;
(statearr_36284_37733[(1)] = (42));

} else {
var statearr_36285_37734 = state_36153__$1;
(statearr_36285_37734[(1)] = (43));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (16))){
var inst_36041 = (state_36153[(7)]);
var inst_36043 = cljs.core.chunked_seq_QMARK_(inst_36041);
var state_36153__$1 = state_36153;
if(inst_36043){
var statearr_36286_37736 = state_36153__$1;
(statearr_36286_37736[(1)] = (19));

} else {
var statearr_36287_37737 = state_36153__$1;
(statearr_36287_37737[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (38))){
var inst_36131 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36288_37739 = state_36153__$1;
(statearr_36288_37739[(2)] = inst_36131);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (30))){
var state_36153__$1 = state_36153;
var statearr_36289_37740 = state_36153__$1;
(statearr_36289_37740[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (10))){
var inst_36012 = (state_36153[(15)]);
var inst_36014 = (state_36153[(17)]);
var inst_36026 = cljs.core._nth(inst_36012,inst_36014);
var inst_36027 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36026,(0),null);
var inst_36028 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36026,(1),null);
var state_36153__$1 = (function (){var statearr_36292 = state_36153;
(statearr_36292[(24)] = inst_36027);

return statearr_36292;
})();
if(cljs.core.truth_(inst_36028)){
var statearr_36293_37741 = state_36153__$1;
(statearr_36293_37741[(1)] = (13));

} else {
var statearr_36294_37742 = state_36153__$1;
(statearr_36294_37742[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (18))){
var inst_36071 = (state_36153[(2)]);
var state_36153__$1 = state_36153;
var statearr_36295_37743 = state_36153__$1;
(statearr_36295_37743[(2)] = inst_36071);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (42))){
var state_36153__$1 = state_36153;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_36153__$1,(45),dchan);
} else {
if((state_val_36154 === (37))){
var inst_36111 = (state_36153[(23)]);
var inst_36121 = (state_36153[(22)]);
var inst_36002 = (state_36153[(12)]);
var inst_36121__$1 = cljs.core.first(inst_36111);
var inst_36122 = cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$3(inst_36121__$1,inst_36002,done);
var state_36153__$1 = (function (){var statearr_36296 = state_36153;
(statearr_36296[(22)] = inst_36121__$1);

return statearr_36296;
})();
if(cljs.core.truth_(inst_36122)){
var statearr_36297_37744 = state_36153__$1;
(statearr_36297_37744[(1)] = (39));

} else {
var statearr_36298_37745 = state_36153__$1;
(statearr_36298_37745[(1)] = (40));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36154 === (8))){
var inst_36014 = (state_36153[(17)]);
var inst_36013 = (state_36153[(16)]);
var inst_36017 = (inst_36014 < inst_36013);
var inst_36021 = inst_36017;
var state_36153__$1 = state_36153;
if(cljs.core.truth_(inst_36021)){
var statearr_36299_37746 = state_36153__$1;
(statearr_36299_37746[(1)] = (10));

} else {
var statearr_36300_37747 = state_36153__$1;
(statearr_36300_37747[(1)] = (11));

}

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

(statearr_36301[(1)] = (1));

return statearr_36301;
});
var cljs$core$async$mult_$_state_machine__34860__auto____1 = (function (state_36153){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_36153);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e36302){var ex__34863__auto__ = e36302;
var statearr_36303_37748 = state_36153;
(statearr_36303_37748[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37754 = state_36153;
state_36153 = G__37754;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$mult_$_state_machine__34860__auto__ = function(state_36153){
switch(arguments.length){
case 0:
return cljs$core$async$mult_$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$mult_$_state_machine__34860__auto____1.call(this,state_36153);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mult_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mult_$_state_machine__34860__auto____0;
cljs$core$async$mult_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mult_$_state_machine__34860__auto____1;
return cljs$core$async$mult_$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_36305 = f__35080__auto__();
(statearr_36305[(6)] = c__35079__auto___37680);

return statearr_36305;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__36307 = arguments.length;
switch (G__36307) {
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_37759 = (function (m,ch){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5374__auto__.call(null,m,ch));
} else {
var m__5372__auto__ = (cljs.core.async.admix_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5372__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_37759(m,ch);
}
});

var cljs$core$async$Mix$unmix_STAR_$dyn_37760 = (function (m,ch){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5374__auto__.call(null,m,ch));
} else {
var m__5372__auto__ = (cljs.core.async.unmix_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$2(m,ch) : m__5372__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_37760(m,ch);
}
});

var cljs$core$async$Mix$unmix_all_STAR_$dyn_37761 = (function (m){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5374__auto__.call(null,m));
} else {
var m__5372__auto__ = (cljs.core.async.unmix_all_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$1(m) : m__5372__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_37761(m);
}
});

var cljs$core$async$Mix$toggle_STAR_$dyn_37766 = (function (m,state_map){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$2(m,state_map) : m__5374__auto__.call(null,m,state_map));
} else {
var m__5372__auto__ = (cljs.core.async.toggle_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$2(m,state_map) : m__5372__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_37766(m,state_map);
}
});

var cljs$core$async$Mix$solo_mode_STAR_$dyn_37770 = (function (m,mode){
var x__5373__auto__ = (((m == null))?null:m);
var m__5374__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$2(m,mode) : m__5374__auto__.call(null,m,mode));
} else {
var m__5372__auto__ = (cljs.core.async.solo_mode_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$2(m,mode) : m__5372__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_37770(m,mode);
}
});

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

var G__37777 = (i__5750__auto___37776 + (1));
i__5750__auto___37776 = G__37777;
continue;
} else {
}
break;
}

var argseq__5756__auto__ = ((((3) < args__5755__auto__.length))?(new cljs.core.IndexedSeq(args__5755__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__5756__auto__);
});

(cljs.core.async.ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (state,cont_block,ports,p__36318){
var map__36319 = p__36318;
var map__36319__$1 = cljs.core.__destructure_map(map__36319);
var opts = map__36319__$1;
var statearr_36320_37778 = state;
(statearr_36320_37778[(1)] = cont_block);


var temp__5804__auto__ = cljs.core.async.do_alts((function (val){
var statearr_36321_37779 = state;
(statearr_36321_37779[(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_36322_37780 = state;
(statearr_36322_37780[(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 (seq36314){
var G__36315 = cljs.core.first(seq36314);
var seq36314__$1 = cljs.core.next(seq36314);
var G__36316 = cljs.core.first(seq36314__$1);
var seq36314__$2 = cljs.core.next(seq36314__$1);
var G__36317 = cljs.core.first(seq36314__$2);
var seq36314__$3 = cljs.core.next(seq36314__$2);
var self__5734__auto__ = this;
return self__5734__auto__.cljs$core$IFn$_invoke$arity$variadic(G__36315,G__36316,G__36317,seq36314__$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$async36330 = (function (change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta36331){
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.meta36331 = meta36331;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async36330.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_36332,meta36331__$1){
var self__ = this;
var _36332__$1 = this;
return (new cljs.core.async.t_cljs$core$async36330(self__.change,self__.solo_mode,self__.pick,self__.cs,self__.calc_state,self__.out,self__.changed,self__.solo_modes,self__.attrs,meta36331__$1));
}));

(cljs.core.async.t_cljs$core$async36330.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_36332){
var self__ = this;
var _36332__$1 = this;
return self__.meta36331;
}));

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

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

(cljs.core.async.t_cljs$core$async36330.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$async36330.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$async36330.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$async36330.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$async36330.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$async36330.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,"meta36331","meta36331",758452791,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async36330.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async36330");
}));

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


/**
 * 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.seq(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$async36330(change,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,cljs.core.PersistentArrayMap.EMPTY));
var c__35079__auto___37787 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_36433){
var state_val_36434 = (state_36433[(1)]);
if((state_val_36434 === (7))){
var inst_36386 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
if(cljs.core.truth_(inst_36386)){
var statearr_36438_37788 = state_36433__$1;
(statearr_36438_37788[(1)] = (8));

} else {
var statearr_36439_37789 = state_36433__$1;
(statearr_36439_37789[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (20))){
var inst_36373 = (state_36433[(7)]);
var state_36433__$1 = state_36433;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_36433__$1,(23),out,inst_36373);
} else {
if((state_val_36434 === (1))){
var inst_36343 = calc_state();
var inst_36344 = cljs.core.__destructure_map(inst_36343);
var inst_36352 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_36344,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_36353 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_36344,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_36354 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_36344,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var inst_36358 = inst_36343;
var state_36433__$1 = (function (){var statearr_36443 = state_36433;
(statearr_36443[(8)] = inst_36352);

(statearr_36443[(9)] = inst_36353);

(statearr_36443[(10)] = inst_36354);

(statearr_36443[(11)] = inst_36358);

return statearr_36443;
})();
var statearr_36444_37791 = state_36433__$1;
(statearr_36444_37791[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (24))){
var inst_36364 = (state_36433[(12)]);
var inst_36358 = inst_36364;
var state_36433__$1 = (function (){var statearr_36445 = state_36433;
(statearr_36445[(11)] = inst_36358);

return statearr_36445;
})();
var statearr_36446_37793 = state_36433__$1;
(statearr_36446_37793[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (4))){
var inst_36373 = (state_36433[(7)]);
var inst_36381 = (state_36433[(13)]);
var inst_36372 = (state_36433[(2)]);
var inst_36373__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36372,(0),null);
var inst_36380 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36372,(1),null);
var inst_36381__$1 = (inst_36373__$1 == null);
var state_36433__$1 = (function (){var statearr_36447 = state_36433;
(statearr_36447[(7)] = inst_36373__$1);

(statearr_36447[(14)] = inst_36380);

(statearr_36447[(13)] = inst_36381__$1);

return statearr_36447;
})();
if(cljs.core.truth_(inst_36381__$1)){
var statearr_36448_37794 = state_36433__$1;
(statearr_36448_37794[(1)] = (5));

} else {
var statearr_36449_37795 = state_36433__$1;
(statearr_36449_37795[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (15))){
var inst_36365 = (state_36433[(15)]);
var inst_36400 = (state_36433[(16)]);
var inst_36400__$1 = cljs.core.empty_QMARK_(inst_36365);
var state_36433__$1 = (function (){var statearr_36450 = state_36433;
(statearr_36450[(16)] = inst_36400__$1);

return statearr_36450;
})();
if(inst_36400__$1){
var statearr_36451_37800 = state_36433__$1;
(statearr_36451_37800[(1)] = (17));

} else {
var statearr_36452_37801 = state_36433__$1;
(statearr_36452_37801[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (21))){
var inst_36364 = (state_36433[(12)]);
var inst_36358 = inst_36364;
var state_36433__$1 = (function (){var statearr_36453 = state_36433;
(statearr_36453[(11)] = inst_36358);

return statearr_36453;
})();
var statearr_36454_37802 = state_36433__$1;
(statearr_36454_37802[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (13))){
var inst_36393 = (state_36433[(2)]);
var inst_36394 = calc_state();
var inst_36358 = inst_36394;
var state_36433__$1 = (function (){var statearr_36459 = state_36433;
(statearr_36459[(17)] = inst_36393);

(statearr_36459[(11)] = inst_36358);

return statearr_36459;
})();
var statearr_36460_37804 = state_36433__$1;
(statearr_36460_37804[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (22))){
var inst_36420 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
var statearr_36461_37805 = state_36433__$1;
(statearr_36461_37805[(2)] = inst_36420);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (6))){
var inst_36380 = (state_36433[(14)]);
var inst_36384 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_36380,change);
var state_36433__$1 = state_36433;
var statearr_36462_37807 = state_36433__$1;
(statearr_36462_37807[(2)] = inst_36384);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (25))){
var state_36433__$1 = state_36433;
var statearr_36463_37808 = state_36433__$1;
(statearr_36463_37808[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (17))){
var inst_36366 = (state_36433[(18)]);
var inst_36380 = (state_36433[(14)]);
var inst_36402 = (inst_36366.cljs$core$IFn$_invoke$arity$1 ? inst_36366.cljs$core$IFn$_invoke$arity$1(inst_36380) : inst_36366.call(null,inst_36380));
var inst_36403 = cljs.core.not(inst_36402);
var state_36433__$1 = state_36433;
var statearr_36464_37814 = state_36433__$1;
(statearr_36464_37814[(2)] = inst_36403);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (3))){
var inst_36424 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
return cljs.core.async.impl.ioc_helpers.return_chan(state_36433__$1,inst_36424);
} else {
if((state_val_36434 === (12))){
var state_36433__$1 = state_36433;
var statearr_36465_37815 = state_36433__$1;
(statearr_36465_37815[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (2))){
var inst_36358 = (state_36433[(11)]);
var inst_36364 = (state_36433[(12)]);
var inst_36364__$1 = cljs.core.__destructure_map(inst_36358);
var inst_36365 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_36364__$1,new cljs.core.Keyword(null,"solos","solos",1441458643));
var inst_36366 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_36364__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309));
var inst_36367 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_36364__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361));
var state_36433__$1 = (function (){var statearr_36466 = state_36433;
(statearr_36466[(12)] = inst_36364__$1);

(statearr_36466[(15)] = inst_36365);

(statearr_36466[(18)] = inst_36366);

return statearr_36466;
})();
return cljs.core.async.ioc_alts_BANG_(state_36433__$1,(4),inst_36367);
} else {
if((state_val_36434 === (23))){
var inst_36411 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
if(cljs.core.truth_(inst_36411)){
var statearr_36467_37817 = state_36433__$1;
(statearr_36467_37817[(1)] = (24));

} else {
var statearr_36468_37818 = state_36433__$1;
(statearr_36468_37818[(1)] = (25));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (19))){
var inst_36406 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
var statearr_36469_37819 = state_36433__$1;
(statearr_36469_37819[(2)] = inst_36406);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (11))){
var inst_36380 = (state_36433[(14)]);
var inst_36390 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(cs,cljs.core.dissoc,inst_36380);
var state_36433__$1 = state_36433;
var statearr_36470_37821 = state_36433__$1;
(statearr_36470_37821[(2)] = inst_36390);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (9))){
var inst_36365 = (state_36433[(15)]);
var inst_36380 = (state_36433[(14)]);
var inst_36397 = (state_36433[(19)]);
var inst_36397__$1 = (inst_36365.cljs$core$IFn$_invoke$arity$1 ? inst_36365.cljs$core$IFn$_invoke$arity$1(inst_36380) : inst_36365.call(null,inst_36380));
var state_36433__$1 = (function (){var statearr_36472 = state_36433;
(statearr_36472[(19)] = inst_36397__$1);

return statearr_36472;
})();
if(cljs.core.truth_(inst_36397__$1)){
var statearr_36476_37822 = state_36433__$1;
(statearr_36476_37822[(1)] = (14));

} else {
var statearr_36477_37824 = state_36433__$1;
(statearr_36477_37824[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (5))){
var inst_36381 = (state_36433[(13)]);
var state_36433__$1 = state_36433;
var statearr_36478_37825 = state_36433__$1;
(statearr_36478_37825[(2)] = inst_36381);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (14))){
var inst_36397 = (state_36433[(19)]);
var state_36433__$1 = state_36433;
var statearr_36479_37826 = state_36433__$1;
(statearr_36479_37826[(2)] = inst_36397);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (26))){
var inst_36416 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
var statearr_36480_37827 = state_36433__$1;
(statearr_36480_37827[(2)] = inst_36416);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (16))){
var inst_36408 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
if(cljs.core.truth_(inst_36408)){
var statearr_36481_37829 = state_36433__$1;
(statearr_36481_37829[(1)] = (20));

} else {
var statearr_36484_37830 = state_36433__$1;
(statearr_36484_37830[(1)] = (21));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (10))){
var inst_36422 = (state_36433[(2)]);
var state_36433__$1 = state_36433;
var statearr_36485_37831 = state_36433__$1;
(statearr_36485_37831[(2)] = inst_36422);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (18))){
var inst_36400 = (state_36433[(16)]);
var state_36433__$1 = state_36433;
var statearr_36486_37832 = state_36433__$1;
(statearr_36486_37832[(2)] = inst_36400);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36434 === (8))){
var inst_36373 = (state_36433[(7)]);
var inst_36388 = (inst_36373 == null);
var state_36433__$1 = state_36433;
if(cljs.core.truth_(inst_36388)){
var statearr_36488_37833 = state_36433__$1;
(statearr_36488_37833[(1)] = (11));

} else {
var statearr_36489_37834 = state_36433__$1;
(statearr_36489_37834[(1)] = (12));

}

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

(statearr_36491[(1)] = (1));

return statearr_36491;
});
var cljs$core$async$mix_$_state_machine__34860__auto____1 = (function (state_36433){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_36433);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e36492){var ex__34863__auto__ = e36492;
var statearr_36493_37835 = state_36433;
(statearr_36493_37835[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37839 = state_36433;
state_36433 = G__37839;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$mix_$_state_machine__34860__auto__ = function(state_36433){
switch(arguments.length){
case 0:
return cljs$core$async$mix_$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$mix_$_state_machine__34860__auto____1.call(this,state_36433);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mix_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mix_$_state_machine__34860__auto____0;
cljs$core$async$mix_$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mix_$_state_machine__34860__auto____1;
return cljs$core$async$mix_$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_36495 = f__35080__auto__();
(statearr_36495[(6)] = c__35079__auto___37787);

return statearr_36495;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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_37840 = (function (p,v,ch,close_QMARK_){
var x__5373__auto__ = (((p == null))?null:p);
var m__5374__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$4 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$4(p,v,ch,close_QMARK_) : m__5374__auto__.call(null,p,v,ch,close_QMARK_));
} else {
var m__5372__auto__ = (cljs.core.async.sub_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$4 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$4(p,v,ch,close_QMARK_) : m__5372__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_37840(p,v,ch,close_QMARK_);
}
});

var cljs$core$async$Pub$unsub_STAR_$dyn_37845 = (function (p,v,ch){
var x__5373__auto__ = (((p == null))?null:p);
var m__5374__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$3(p,v,ch) : m__5374__auto__.call(null,p,v,ch));
} else {
var m__5372__auto__ = (cljs.core.async.unsub_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$3(p,v,ch) : m__5372__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_37845(p,v,ch);
}
});

var cljs$core$async$Pub$unsub_all_STAR_$dyn_37852 = (function() {
var G__37853 = null;
var G__37853__1 = (function (p){
var x__5373__auto__ = (((p == null))?null:p);
var m__5374__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5374__auto__.call(null,p));
} else {
var m__5372__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$1(p) : m__5372__auto__.call(null,p));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
var G__37853__2 = (function (p,v){
var x__5373__auto__ = (((p == null))?null:p);
var m__5374__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__5373__auto__)]);
if((!((m__5374__auto__ == null)))){
return (m__5374__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5374__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5374__auto__.call(null,p,v));
} else {
var m__5372__auto__ = (cljs.core.async.unsub_all_STAR_["_"]);
if((!((m__5372__auto__ == null)))){
return (m__5372__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5372__auto__.cljs$core$IFn$_invoke$arity$2(p,v) : m__5372__auto__.call(null,p,v));
} else {
throw cljs.core.missing_protocol("Pub.unsub-all*",p);
}
}
});
G__37853 = function(p,v){
switch(arguments.length){
case 1:
return G__37853__1.call(this,p);
case 2:
return G__37853__2.call(this,p,v);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__37853.cljs$core$IFn$_invoke$arity$1 = G__37853__1;
G__37853.cljs$core$IFn$_invoke$arity$2 = G__37853__2;
return G__37853;
})()
;
cljs.core.async.unsub_all_STAR_ = (function cljs$core$async$unsub_all_STAR_(var_args){
var G__36504 = arguments.length;
switch (G__36504) {
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_37852(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_37852(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$async36514 = (function (ch,topic_fn,buf_fn,mults,ensure_mult,meta36515){
this.ch = ch;
this.topic_fn = topic_fn;
this.buf_fn = buf_fn;
this.mults = mults;
this.ensure_mult = ensure_mult;
this.meta36515 = meta36515;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async36514.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_36516,meta36515__$1){
var self__ = this;
var _36516__$1 = this;
return (new cljs.core.async.t_cljs$core$async36514(self__.ch,self__.topic_fn,self__.buf_fn,self__.mults,self__.ensure_mult,meta36515__$1));
}));

(cljs.core.async.t_cljs$core$async36514.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_36516){
var self__ = this;
var _36516__$1 = this;
return self__.meta36515;
}));

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

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

(cljs.core.async.t_cljs$core$async36514.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$async36514.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$async36514.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$async36514.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$async36514.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,"meta36515","meta36515",261971247,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async36514.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async36514");
}));

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


/**
 * 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__36507 = arguments.length;
switch (G__36507) {
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__5025__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(mults),topic);
if(cljs.core.truth_(or__5025__auto__)){
return or__5025__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__36505_SHARP_){
if(cljs.core.truth_((p1__36505_SHARP_.cljs$core$IFn$_invoke$arity$1 ? p1__36505_SHARP_.cljs$core$IFn$_invoke$arity$1(topic) : p1__36505_SHARP_.call(null,topic)))){
return p1__36505_SHARP_;
} else {
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(p1__36505_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$async36514(ch,topic_fn,buf_fn,mults,ensure_mult,cljs.core.PersistentArrayMap.EMPTY));
var c__35079__auto___37868 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_36594){
var state_val_36595 = (state_36594[(1)]);
if((state_val_36595 === (7))){
var inst_36590 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
var statearr_36596_37869 = state_36594__$1;
(statearr_36596_37869[(2)] = inst_36590);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (20))){
var state_36594__$1 = state_36594;
var statearr_36597_37870 = state_36594__$1;
(statearr_36597_37870[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (1))){
var state_36594__$1 = state_36594;
var statearr_36599_37872 = state_36594__$1;
(statearr_36599_37872[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (24))){
var inst_36573 = (state_36594[(7)]);
var inst_36582 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(mults,cljs.core.dissoc,inst_36573);
var state_36594__$1 = state_36594;
var statearr_36603_37874 = state_36594__$1;
(statearr_36603_37874[(2)] = inst_36582);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (4))){
var inst_36525 = (state_36594[(8)]);
var inst_36525__$1 = (state_36594[(2)]);
var inst_36526 = (inst_36525__$1 == null);
var state_36594__$1 = (function (){var statearr_36604 = state_36594;
(statearr_36604[(8)] = inst_36525__$1);

return statearr_36604;
})();
if(cljs.core.truth_(inst_36526)){
var statearr_36605_37879 = state_36594__$1;
(statearr_36605_37879[(1)] = (5));

} else {
var statearr_36606_37880 = state_36594__$1;
(statearr_36606_37880[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (15))){
var inst_36567 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
var statearr_36607_37881 = state_36594__$1;
(statearr_36607_37881[(2)] = inst_36567);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (21))){
var inst_36587 = (state_36594[(2)]);
var state_36594__$1 = (function (){var statearr_36608 = state_36594;
(statearr_36608[(9)] = inst_36587);

return statearr_36608;
})();
var statearr_36610_37882 = state_36594__$1;
(statearr_36610_37882[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (13))){
var inst_36549 = (state_36594[(10)]);
var inst_36551 = cljs.core.chunked_seq_QMARK_(inst_36549);
var state_36594__$1 = state_36594;
if(inst_36551){
var statearr_36614_37883 = state_36594__$1;
(statearr_36614_37883[(1)] = (16));

} else {
var statearr_36615_37884 = state_36594__$1;
(statearr_36615_37884[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (22))){
var inst_36579 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
if(cljs.core.truth_(inst_36579)){
var statearr_36616_37885 = state_36594__$1;
(statearr_36616_37885[(1)] = (23));

} else {
var statearr_36617_37886 = state_36594__$1;
(statearr_36617_37886[(1)] = (24));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (6))){
var inst_36525 = (state_36594[(8)]);
var inst_36573 = (state_36594[(7)]);
var inst_36575 = (state_36594[(11)]);
var inst_36573__$1 = (topic_fn.cljs$core$IFn$_invoke$arity$1 ? topic_fn.cljs$core$IFn$_invoke$arity$1(inst_36525) : topic_fn.call(null,inst_36525));
var inst_36574 = cljs.core.deref(mults);
var inst_36575__$1 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(inst_36574,inst_36573__$1);
var state_36594__$1 = (function (){var statearr_36618 = state_36594;
(statearr_36618[(7)] = inst_36573__$1);

(statearr_36618[(11)] = inst_36575__$1);

return statearr_36618;
})();
if(cljs.core.truth_(inst_36575__$1)){
var statearr_36619_37891 = state_36594__$1;
(statearr_36619_37891[(1)] = (19));

} else {
var statearr_36620_37896 = state_36594__$1;
(statearr_36620_37896[(1)] = (20));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (25))){
var inst_36584 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
var statearr_36621_37911 = state_36594__$1;
(statearr_36621_37911[(2)] = inst_36584);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (17))){
var inst_36549 = (state_36594[(10)]);
var inst_36558 = cljs.core.first(inst_36549);
var inst_36559 = cljs.core.async.muxch_STAR_(inst_36558);
var inst_36560 = cljs.core.async.close_BANG_(inst_36559);
var inst_36561 = cljs.core.next(inst_36549);
var inst_36535 = inst_36561;
var inst_36536 = null;
var inst_36537 = (0);
var inst_36538 = (0);
var state_36594__$1 = (function (){var statearr_36622 = state_36594;
(statearr_36622[(12)] = inst_36560);

(statearr_36622[(13)] = inst_36535);

(statearr_36622[(14)] = inst_36536);

(statearr_36622[(15)] = inst_36537);

(statearr_36622[(16)] = inst_36538);

return statearr_36622;
})();
var statearr_36623_37912 = state_36594__$1;
(statearr_36623_37912[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (3))){
var inst_36592 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
return cljs.core.async.impl.ioc_helpers.return_chan(state_36594__$1,inst_36592);
} else {
if((state_val_36595 === (12))){
var inst_36569 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
var statearr_36624_37917 = state_36594__$1;
(statearr_36624_37917[(2)] = inst_36569);

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


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

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (19))){
var inst_36575 = (state_36594[(11)]);
var inst_36525 = (state_36594[(8)]);
var inst_36577 = cljs.core.async.muxch_STAR_(inst_36575);
var state_36594__$1 = state_36594;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_36594__$1,(22),inst_36577,inst_36525);
} else {
if((state_val_36595 === (11))){
var inst_36535 = (state_36594[(13)]);
var inst_36549 = (state_36594[(10)]);
var inst_36549__$1 = cljs.core.seq(inst_36535);
var state_36594__$1 = (function (){var statearr_36626 = state_36594;
(statearr_36626[(10)] = inst_36549__$1);

return statearr_36626;
})();
if(inst_36549__$1){
var statearr_36627_37926 = state_36594__$1;
(statearr_36627_37926[(1)] = (13));

} else {
var statearr_36628_37927 = state_36594__$1;
(statearr_36628_37927[(1)] = (14));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (9))){
var inst_36571 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
var statearr_36630_37932 = state_36594__$1;
(statearr_36630_37932[(2)] = inst_36571);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (5))){
var inst_36532 = cljs.core.deref(mults);
var inst_36533 = cljs.core.vals(inst_36532);
var inst_36534 = cljs.core.seq(inst_36533);
var inst_36535 = inst_36534;
var inst_36536 = null;
var inst_36537 = (0);
var inst_36538 = (0);
var state_36594__$1 = (function (){var statearr_36632 = state_36594;
(statearr_36632[(13)] = inst_36535);

(statearr_36632[(14)] = inst_36536);

(statearr_36632[(15)] = inst_36537);

(statearr_36632[(16)] = inst_36538);

return statearr_36632;
})();
var statearr_36633_37944 = state_36594__$1;
(statearr_36633_37944[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (14))){
var state_36594__$1 = state_36594;
var statearr_36637_37945 = state_36594__$1;
(statearr_36637_37945[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (16))){
var inst_36549 = (state_36594[(10)]);
var inst_36553 = cljs.core.chunk_first(inst_36549);
var inst_36554 = cljs.core.chunk_rest(inst_36549);
var inst_36555 = cljs.core.count(inst_36553);
var inst_36535 = inst_36554;
var inst_36536 = inst_36553;
var inst_36537 = inst_36555;
var inst_36538 = (0);
var state_36594__$1 = (function (){var statearr_36638 = state_36594;
(statearr_36638[(13)] = inst_36535);

(statearr_36638[(14)] = inst_36536);

(statearr_36638[(15)] = inst_36537);

(statearr_36638[(16)] = inst_36538);

return statearr_36638;
})();
var statearr_36639_37956 = state_36594__$1;
(statearr_36639_37956[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (10))){
var inst_36536 = (state_36594[(14)]);
var inst_36538 = (state_36594[(16)]);
var inst_36535 = (state_36594[(13)]);
var inst_36537 = (state_36594[(15)]);
var inst_36543 = cljs.core._nth(inst_36536,inst_36538);
var inst_36544 = cljs.core.async.muxch_STAR_(inst_36543);
var inst_36545 = cljs.core.async.close_BANG_(inst_36544);
var inst_36546 = (inst_36538 + (1));
var tmp36634 = inst_36535;
var tmp36635 = inst_36537;
var tmp36636 = inst_36536;
var inst_36535__$1 = tmp36634;
var inst_36536__$1 = tmp36636;
var inst_36537__$1 = tmp36635;
var inst_36538__$1 = inst_36546;
var state_36594__$1 = (function (){var statearr_36643 = state_36594;
(statearr_36643[(17)] = inst_36545);

(statearr_36643[(13)] = inst_36535__$1);

(statearr_36643[(14)] = inst_36536__$1);

(statearr_36643[(15)] = inst_36537__$1);

(statearr_36643[(16)] = inst_36538__$1);

return statearr_36643;
})();
var statearr_36644_37971 = state_36594__$1;
(statearr_36644_37971[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (18))){
var inst_36564 = (state_36594[(2)]);
var state_36594__$1 = state_36594;
var statearr_36645_37972 = state_36594__$1;
(statearr_36645_37972[(2)] = inst_36564);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36595 === (8))){
var inst_36538 = (state_36594[(16)]);
var inst_36537 = (state_36594[(15)]);
var inst_36540 = (inst_36538 < inst_36537);
var inst_36541 = inst_36540;
var state_36594__$1 = state_36594;
if(cljs.core.truth_(inst_36541)){
var statearr_36646_37980 = state_36594__$1;
(statearr_36646_37980[(1)] = (10));

} else {
var statearr_36647_37981 = state_36594__$1;
(statearr_36647_37981[(1)] = (11));

}

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

(statearr_36648[(1)] = (1));

return statearr_36648;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_36594){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_36594);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e36649){var ex__34863__auto__ = e36649;
var statearr_36650_37988 = state_36594;
(statearr_36650_37988[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__37999 = state_36594;
state_36594 = G__37999;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_36594){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_36594);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_36652 = f__35080__auto__();
(statearr_36652[(6)] = c__35079__auto___37868);

return statearr_36652;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__36654 = arguments.length;
switch (G__36654) {
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__36656 = arguments.length;
switch (G__36656) {
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__36658 = arguments.length;
switch (G__36658) {
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__35079__auto___38022 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_36701){
var state_val_36702 = (state_36701[(1)]);
if((state_val_36702 === (7))){
var state_36701__$1 = state_36701;
var statearr_36703_38023 = state_36701__$1;
(statearr_36703_38023[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (1))){
var state_36701__$1 = state_36701;
var statearr_36704_38025 = state_36701__$1;
(statearr_36704_38025[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (4))){
var inst_36662 = (state_36701[(7)]);
var inst_36661 = (state_36701[(8)]);
var inst_36664 = (inst_36662 < inst_36661);
var state_36701__$1 = state_36701;
if(cljs.core.truth_(inst_36664)){
var statearr_36706_38029 = state_36701__$1;
(statearr_36706_38029[(1)] = (6));

} else {
var statearr_36707_38030 = state_36701__$1;
(statearr_36707_38030[(1)] = (7));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (15))){
var inst_36687 = (state_36701[(9)]);
var inst_36692 = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(f,inst_36687);
var state_36701__$1 = state_36701;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_36701__$1,(17),out,inst_36692);
} else {
if((state_val_36702 === (13))){
var inst_36687 = (state_36701[(9)]);
var inst_36687__$1 = (state_36701[(2)]);
var inst_36688 = cljs.core.some(cljs.core.nil_QMARK_,inst_36687__$1);
var state_36701__$1 = (function (){var statearr_36708 = state_36701;
(statearr_36708[(9)] = inst_36687__$1);

return statearr_36708;
})();
if(cljs.core.truth_(inst_36688)){
var statearr_36709_38032 = state_36701__$1;
(statearr_36709_38032[(1)] = (14));

} else {
var statearr_36710_38033 = state_36701__$1;
(statearr_36710_38033[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (6))){
var state_36701__$1 = state_36701;
var statearr_36711_38034 = state_36701__$1;
(statearr_36711_38034[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (17))){
var inst_36694 = (state_36701[(2)]);
var state_36701__$1 = (function (){var statearr_36713 = state_36701;
(statearr_36713[(10)] = inst_36694);

return statearr_36713;
})();
var statearr_36714_38035 = state_36701__$1;
(statearr_36714_38035[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (3))){
var inst_36699 = (state_36701[(2)]);
var state_36701__$1 = state_36701;
return cljs.core.async.impl.ioc_helpers.return_chan(state_36701__$1,inst_36699);
} else {
if((state_val_36702 === (12))){
var _ = (function (){var statearr_36718 = state_36701;
(statearr_36718[(4)] = cljs.core.rest((state_36701[(4)])));

return statearr_36718;
})();
var state_36701__$1 = state_36701;
var ex36712 = (state_36701__$1[(2)]);
var statearr_36719_38037 = state_36701__$1;
(statearr_36719_38037[(5)] = ex36712);


if((ex36712 instanceof Object)){
var statearr_36720_38038 = state_36701__$1;
(statearr_36720_38038[(1)] = (11));

(statearr_36720_38038[(5)] = null);

} else {
throw ex36712;

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (2))){
var inst_36660 = cljs.core.reset_BANG_(dctr,cnt);
var inst_36661 = cnt;
var inst_36662 = (0);
var state_36701__$1 = (function (){var statearr_36721 = state_36701;
(statearr_36721[(11)] = inst_36660);

(statearr_36721[(8)] = inst_36661);

(statearr_36721[(7)] = inst_36662);

return statearr_36721;
})();
var statearr_36722_38040 = state_36701__$1;
(statearr_36722_38040[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (11))){
var inst_36666 = (state_36701[(2)]);
var inst_36667 = cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(dctr,cljs.core.dec);
var state_36701__$1 = (function (){var statearr_36727 = state_36701;
(statearr_36727[(12)] = inst_36666);

return statearr_36727;
})();
var statearr_36728_38043 = state_36701__$1;
(statearr_36728_38043[(2)] = inst_36667);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (9))){
var inst_36662 = (state_36701[(7)]);
var _ = (function (){var statearr_36729 = state_36701;
(statearr_36729[(4)] = cljs.core.cons((12),(state_36701[(4)])));

return statearr_36729;
})();
var inst_36673 = (chs__$1.cljs$core$IFn$_invoke$arity$1 ? chs__$1.cljs$core$IFn$_invoke$arity$1(inst_36662) : chs__$1.call(null,inst_36662));
var inst_36674 = (done.cljs$core$IFn$_invoke$arity$1 ? done.cljs$core$IFn$_invoke$arity$1(inst_36662) : done.call(null,inst_36662));
var inst_36675 = cljs.core.async.take_BANG_.cljs$core$IFn$_invoke$arity$2(inst_36673,inst_36674);
var ___$1 = (function (){var statearr_36730 = state_36701;
(statearr_36730[(4)] = cljs.core.rest((state_36701[(4)])));

return statearr_36730;
})();
var state_36701__$1 = state_36701;
var statearr_36731_38045 = state_36701__$1;
(statearr_36731_38045[(2)] = inst_36675);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (5))){
var inst_36685 = (state_36701[(2)]);
var state_36701__$1 = (function (){var statearr_36732 = state_36701;
(statearr_36732[(13)] = inst_36685);

return statearr_36732;
})();
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_36701__$1,(13),dchan);
} else {
if((state_val_36702 === (14))){
var inst_36690 = cljs.core.async.close_BANG_(out);
var state_36701__$1 = state_36701;
var statearr_36733_38048 = state_36701__$1;
(statearr_36733_38048[(2)] = inst_36690);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (16))){
var inst_36697 = (state_36701[(2)]);
var state_36701__$1 = state_36701;
var statearr_36734_38049 = state_36701__$1;
(statearr_36734_38049[(2)] = inst_36697);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (10))){
var inst_36662 = (state_36701[(7)]);
var inst_36678 = (state_36701[(2)]);
var inst_36679 = (inst_36662 + (1));
var inst_36662__$1 = inst_36679;
var state_36701__$1 = (function (){var statearr_36735 = state_36701;
(statearr_36735[(14)] = inst_36678);

(statearr_36735[(7)] = inst_36662__$1);

return statearr_36735;
})();
var statearr_36736_38051 = state_36701__$1;
(statearr_36736_38051[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36702 === (8))){
var inst_36683 = (state_36701[(2)]);
var state_36701__$1 = state_36701;
var statearr_36737_38053 = state_36701__$1;
(statearr_36737_38053[(2)] = inst_36683);

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


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

(statearr_36738[(1)] = (1));

return statearr_36738;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_36701){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_36701);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e36739){var ex__34863__auto__ = e36739;
var statearr_36740_38057 = state_36701;
(statearr_36740_38057[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38060 = state_36701;
state_36701 = G__38060;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_36701){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_36701);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_36742 = f__35080__auto__();
(statearr_36742[(6)] = c__35079__auto___38022);

return statearr_36742;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__36745 = arguments.length;
switch (G__36745) {
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__35079__auto___38067 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_36797){
var state_val_36798 = (state_36797[(1)]);
if((state_val_36798 === (7))){
var inst_36770 = (state_36797[(7)]);
var inst_36771 = (state_36797[(8)]);
var inst_36770__$1 = (state_36797[(2)]);
var inst_36771__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36770__$1,(0),null);
var inst_36772 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(inst_36770__$1,(1),null);
var inst_36779 = (inst_36771__$1 == null);
var state_36797__$1 = (function (){var statearr_36799 = state_36797;
(statearr_36799[(7)] = inst_36770__$1);

(statearr_36799[(8)] = inst_36771__$1);

(statearr_36799[(9)] = inst_36772);

return statearr_36799;
})();
if(cljs.core.truth_(inst_36779)){
var statearr_36800_38068 = state_36797__$1;
(statearr_36800_38068[(1)] = (8));

} else {
var statearr_36807_38069 = state_36797__$1;
(statearr_36807_38069[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36798 === (1))){
var inst_36760 = cljs.core.vec(chs);
var inst_36761 = inst_36760;
var state_36797__$1 = (function (){var statearr_36816 = state_36797;
(statearr_36816[(10)] = inst_36761);

return statearr_36816;
})();
var statearr_36817_38073 = state_36797__$1;
(statearr_36817_38073[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36798 === (4))){
var inst_36761 = (state_36797[(10)]);
var state_36797__$1 = state_36797;
return cljs.core.async.ioc_alts_BANG_(state_36797__$1,(7),inst_36761);
} else {
if((state_val_36798 === (6))){
var inst_36793 = (state_36797[(2)]);
var state_36797__$1 = state_36797;
var statearr_36824_38074 = state_36797__$1;
(statearr_36824_38074[(2)] = inst_36793);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36798 === (3))){
var inst_36795 = (state_36797[(2)]);
var state_36797__$1 = state_36797;
return cljs.core.async.impl.ioc_helpers.return_chan(state_36797__$1,inst_36795);
} else {
if((state_val_36798 === (2))){
var inst_36761 = (state_36797[(10)]);
var inst_36763 = cljs.core.count(inst_36761);
var inst_36764 = (inst_36763 > (0));
var state_36797__$1 = state_36797;
if(cljs.core.truth_(inst_36764)){
var statearr_36826_38076 = state_36797__$1;
(statearr_36826_38076[(1)] = (4));

} else {
var statearr_36827_38077 = state_36797__$1;
(statearr_36827_38077[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36798 === (11))){
var inst_36761 = (state_36797[(10)]);
var inst_36786 = (state_36797[(2)]);
var tmp36825 = inst_36761;
var inst_36761__$1 = tmp36825;
var state_36797__$1 = (function (){var statearr_36830 = state_36797;
(statearr_36830[(11)] = inst_36786);

(statearr_36830[(10)] = inst_36761__$1);

return statearr_36830;
})();
var statearr_36831_38081 = state_36797__$1;
(statearr_36831_38081[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36798 === (9))){
var inst_36771 = (state_36797[(8)]);
var state_36797__$1 = state_36797;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_36797__$1,(11),out,inst_36771);
} else {
if((state_val_36798 === (5))){
var inst_36791 = cljs.core.async.close_BANG_(out);
var state_36797__$1 = state_36797;
var statearr_36833_38084 = state_36797__$1;
(statearr_36833_38084[(2)] = inst_36791);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36798 === (10))){
var inst_36789 = (state_36797[(2)]);
var state_36797__$1 = state_36797;
var statearr_36834_38085 = state_36797__$1;
(statearr_36834_38085[(2)] = inst_36789);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36798 === (8))){
var inst_36761 = (state_36797[(10)]);
var inst_36770 = (state_36797[(7)]);
var inst_36771 = (state_36797[(8)]);
var inst_36772 = (state_36797[(9)]);
var inst_36781 = (function (){var cs = inst_36761;
var vec__36766 = inst_36770;
var v = inst_36771;
var c = inst_36772;
return (function (p1__36743_SHARP_){
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(c,p1__36743_SHARP_);
});
})();
var inst_36782 = cljs.core.filterv(inst_36781,inst_36761);
var inst_36761__$1 = inst_36782;
var state_36797__$1 = (function (){var statearr_36835 = state_36797;
(statearr_36835[(10)] = inst_36761__$1);

return statearr_36835;
})();
var statearr_36836_38090 = state_36797__$1;
(statearr_36836_38090[(2)] = null);

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


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

(statearr_36837[(1)] = (1));

return statearr_36837;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_36797){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_36797);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e36841){var ex__34863__auto__ = e36841;
var statearr_36842_38091 = state_36797;
(statearr_36842_38091[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38093 = state_36797;
state_36797 = G__38093;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_36797){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_36797);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_36844 = f__35080__auto__();
(statearr_36844[(6)] = c__35079__auto___38067);

return statearr_36844;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__36846 = arguments.length;
switch (G__36846) {
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__35079__auto___38096 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_36870){
var state_val_36871 = (state_36870[(1)]);
if((state_val_36871 === (7))){
var inst_36852 = (state_36870[(7)]);
var inst_36852__$1 = (state_36870[(2)]);
var inst_36853 = (inst_36852__$1 == null);
var inst_36854 = cljs.core.not(inst_36853);
var state_36870__$1 = (function (){var statearr_36872 = state_36870;
(statearr_36872[(7)] = inst_36852__$1);

return statearr_36872;
})();
if(inst_36854){
var statearr_36873_38099 = state_36870__$1;
(statearr_36873_38099[(1)] = (8));

} else {
var statearr_36874_38100 = state_36870__$1;
(statearr_36874_38100[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (1))){
var inst_36847 = (0);
var state_36870__$1 = (function (){var statearr_36875 = state_36870;
(statearr_36875[(8)] = inst_36847);

return statearr_36875;
})();
var statearr_36876_38102 = state_36870__$1;
(statearr_36876_38102[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (4))){
var state_36870__$1 = state_36870;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_36870__$1,(7),ch);
} else {
if((state_val_36871 === (6))){
var inst_36865 = (state_36870[(2)]);
var state_36870__$1 = state_36870;
var statearr_36877_38104 = state_36870__$1;
(statearr_36877_38104[(2)] = inst_36865);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (3))){
var inst_36867 = (state_36870[(2)]);
var inst_36868 = cljs.core.async.close_BANG_(out);
var state_36870__$1 = (function (){var statearr_36878 = state_36870;
(statearr_36878[(9)] = inst_36867);

return statearr_36878;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_36870__$1,inst_36868);
} else {
if((state_val_36871 === (2))){
var inst_36847 = (state_36870[(8)]);
var inst_36849 = (inst_36847 < n);
var state_36870__$1 = state_36870;
if(cljs.core.truth_(inst_36849)){
var statearr_36879_38106 = state_36870__$1;
(statearr_36879_38106[(1)] = (4));

} else {
var statearr_36880_38107 = state_36870__$1;
(statearr_36880_38107[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (11))){
var inst_36847 = (state_36870[(8)]);
var inst_36857 = (state_36870[(2)]);
var inst_36858 = (inst_36847 + (1));
var inst_36847__$1 = inst_36858;
var state_36870__$1 = (function (){var statearr_36881 = state_36870;
(statearr_36881[(10)] = inst_36857);

(statearr_36881[(8)] = inst_36847__$1);

return statearr_36881;
})();
var statearr_36882_38108 = state_36870__$1;
(statearr_36882_38108[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (9))){
var state_36870__$1 = state_36870;
var statearr_36883_38109 = state_36870__$1;
(statearr_36883_38109[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (5))){
var state_36870__$1 = state_36870;
var statearr_36884_38110 = state_36870__$1;
(statearr_36884_38110[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (10))){
var inst_36862 = (state_36870[(2)]);
var state_36870__$1 = state_36870;
var statearr_36885_38111 = state_36870__$1;
(statearr_36885_38111[(2)] = inst_36862);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36871 === (8))){
var inst_36852 = (state_36870[(7)]);
var state_36870__$1 = state_36870;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_36870__$1,(11),out,inst_36852);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__34860__auto__ = null;
var cljs$core$async$state_machine__34860__auto____0 = (function (){
var statearr_36886 = [null,null,null,null,null,null,null,null,null,null,null];
(statearr_36886[(0)] = cljs$core$async$state_machine__34860__auto__);

(statearr_36886[(1)] = (1));

return statearr_36886;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_36870){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_36870);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e36887){var ex__34863__auto__ = e36887;
var statearr_36888_38112 = state_36870;
(statearr_36888_38112[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38114 = state_36870;
state_36870 = G__38114;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_36870){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_36870);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_36890 = f__35080__auto__();
(statearr_36890[(6)] = c__35079__auto___38096);

return statearr_36890;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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$async36906 = (function (f,ch,meta36893,_,fn1,meta36907){
this.f = f;
this.ch = ch;
this.meta36893 = meta36893;
this._ = _;
this.fn1 = fn1;
this.meta36907 = meta36907;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async36906.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_36908,meta36907__$1){
var self__ = this;
var _36908__$1 = this;
return (new cljs.core.async.t_cljs$core$async36906(self__.f,self__.ch,self__.meta36893,self__._,self__.fn1,meta36907__$1));
}));

(cljs.core.async.t_cljs$core$async36906.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_36908){
var self__ = this;
var _36908__$1 = this;
return self__.meta36907;
}));

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

(cljs.core.async.t_cljs$core$async36906.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$async36906.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$async36906.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__36891_SHARP_){
var G__36909 = (((p1__36891_SHARP_ == null))?null:(self__.f.cljs$core$IFn$_invoke$arity$1 ? self__.f.cljs$core$IFn$_invoke$arity$1(p1__36891_SHARP_) : self__.f.call(null,p1__36891_SHARP_)));
return (f1.cljs$core$IFn$_invoke$arity$1 ? f1.cljs$core$IFn$_invoke$arity$1(G__36909) : f1.call(null,G__36909));
});
}));

(cljs.core.async.t_cljs$core$async36906.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,"meta36893","meta36893",1644643400,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$async36892","cljs.core.async/t_cljs$core$async36892",1188604439,null)], null)),new cljs.core.Symbol(null,"fn1","fn1",895834444,null),new cljs.core.Symbol(null,"meta36907","meta36907",-1964132794,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async36906.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async36906");
}));

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



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

(cljs.core.async.t_cljs$core$async36892.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_36894){
var self__ = this;
var _36894__$1 = this;
return self__.meta36893;
}));

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

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

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

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

(cljs.core.async.t_cljs$core$async36892.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$async36892.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,"meta36893","meta36893",1644643400,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async36892.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async36892");
}));

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


/**
 * 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$async36892(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$async36911 = (function (f,ch,meta36912){
this.f = f;
this.ch = ch;
this.meta36912 = meta36912;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async36911.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_36913,meta36912__$1){
var self__ = this;
var _36913__$1 = this;
return (new cljs.core.async.t_cljs$core$async36911(self__.f,self__.ch,meta36912__$1));
}));

(cljs.core.async.t_cljs$core$async36911.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_36913){
var self__ = this;
var _36913__$1 = this;
return self__.meta36912;
}));

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

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

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

(cljs.core.async.t_cljs$core$async36911.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$async36911.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,"meta36912","meta36912",-676745208,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async36911.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async36911");
}));

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


/**
 * 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$async36911(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$async36914 = (function (p,ch,meta36915){
this.p = p;
this.ch = ch;
this.meta36915 = meta36915;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.t_cljs$core$async36914.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_36916,meta36915__$1){
var self__ = this;
var _36916__$1 = this;
return (new cljs.core.async.t_cljs$core$async36914(self__.p,self__.ch,meta36915__$1));
}));

(cljs.core.async.t_cljs$core$async36914.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_36916){
var self__ = this;
var _36916__$1 = this;
return self__.meta36915;
}));

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

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

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

(cljs.core.async.t_cljs$core$async36914.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$async36914.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,"meta36915","meta36915",1295117489,null)], null);
}));

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

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

(cljs.core.async.t_cljs$core$async36914.cljs$lang$ctorPrWriter = (function (this__5310__auto__,writer__5311__auto__,opt__5312__auto__){
return cljs.core._write(writer__5311__auto__,"cljs.core.async/t_cljs$core$async36914");
}));

/**
 * Positional factory function for cljs.core.async/t_cljs$core$async36914.
 */
cljs.core.async.__GT_t_cljs$core$async36914 = (function cljs$core$async$__GT_t_cljs$core$async36914(p,ch,meta36915){
return (new cljs.core.async.t_cljs$core$async36914(p,ch,meta36915));
});


/**
 * 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$async36914(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__36920 = arguments.length;
switch (G__36920) {
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__35079__auto___38149 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_36945){
var state_val_36946 = (state_36945[(1)]);
if((state_val_36946 === (7))){
var inst_36941 = (state_36945[(2)]);
var state_36945__$1 = state_36945;
var statearr_36947_38150 = state_36945__$1;
(statearr_36947_38150[(2)] = inst_36941);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (1))){
var state_36945__$1 = state_36945;
var statearr_36950_38151 = state_36945__$1;
(statearr_36950_38151[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (4))){
var inst_36926 = (state_36945[(7)]);
var inst_36926__$1 = (state_36945[(2)]);
var inst_36927 = (inst_36926__$1 == null);
var state_36945__$1 = (function (){var statearr_36951 = state_36945;
(statearr_36951[(7)] = inst_36926__$1);

return statearr_36951;
})();
if(cljs.core.truth_(inst_36927)){
var statearr_36952_38157 = state_36945__$1;
(statearr_36952_38157[(1)] = (5));

} else {
var statearr_36953_38158 = state_36945__$1;
(statearr_36953_38158[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (6))){
var inst_36926 = (state_36945[(7)]);
var inst_36931 = (p.cljs$core$IFn$_invoke$arity$1 ? p.cljs$core$IFn$_invoke$arity$1(inst_36926) : p.call(null,inst_36926));
var state_36945__$1 = state_36945;
if(cljs.core.truth_(inst_36931)){
var statearr_36954_38159 = state_36945__$1;
(statearr_36954_38159[(1)] = (8));

} else {
var statearr_36955_38160 = state_36945__$1;
(statearr_36955_38160[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (3))){
var inst_36943 = (state_36945[(2)]);
var state_36945__$1 = state_36945;
return cljs.core.async.impl.ioc_helpers.return_chan(state_36945__$1,inst_36943);
} else {
if((state_val_36946 === (2))){
var state_36945__$1 = state_36945;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_36945__$1,(4),ch);
} else {
if((state_val_36946 === (11))){
var inst_36935 = (state_36945[(2)]);
var state_36945__$1 = state_36945;
var statearr_36956_38165 = state_36945__$1;
(statearr_36956_38165[(2)] = inst_36935);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (9))){
var state_36945__$1 = state_36945;
var statearr_36957_38168 = state_36945__$1;
(statearr_36957_38168[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (5))){
var inst_36929 = cljs.core.async.close_BANG_(out);
var state_36945__$1 = state_36945;
var statearr_36958_38169 = state_36945__$1;
(statearr_36958_38169[(2)] = inst_36929);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (10))){
var inst_36938 = (state_36945[(2)]);
var state_36945__$1 = (function (){var statearr_36959 = state_36945;
(statearr_36959[(8)] = inst_36938);

return statearr_36959;
})();
var statearr_36960_38170 = state_36945__$1;
(statearr_36960_38170[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_36946 === (8))){
var inst_36926 = (state_36945[(7)]);
var state_36945__$1 = state_36945;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_36945__$1,(11),out,inst_36926);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$state_machine__34860__auto__ = null;
var cljs$core$async$state_machine__34860__auto____0 = (function (){
var statearr_36961 = [null,null,null,null,null,null,null,null,null];
(statearr_36961[(0)] = cljs$core$async$state_machine__34860__auto__);

(statearr_36961[(1)] = (1));

return statearr_36961;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_36945){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_36945);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e36962){var ex__34863__auto__ = e36962;
var statearr_36963_38171 = state_36945;
(statearr_36963_38171[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38174 = state_36945;
state_36945 = G__38174;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_36945){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_36945);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_36965 = f__35080__auto__();
(statearr_36965[(6)] = c__35079__auto___38149);

return statearr_36965;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__36970 = arguments.length;
switch (G__36970) {
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__35079__auto__ = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_37052){
var state_val_37053 = (state_37052[(1)]);
if((state_val_37053 === (7))){
var inst_37041 = (state_37052[(2)]);
var state_37052__$1 = state_37052;
var statearr_37057_38191 = state_37052__$1;
(statearr_37057_38191[(2)] = inst_37041);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (20))){
var inst_37011 = (state_37052[(7)]);
var inst_37022 = (state_37052[(2)]);
var inst_37023 = cljs.core.next(inst_37011);
var inst_36987 = inst_37023;
var inst_36988 = null;
var inst_36989 = (0);
var inst_36990 = (0);
var state_37052__$1 = (function (){var statearr_37058 = state_37052;
(statearr_37058[(8)] = inst_37022);

(statearr_37058[(9)] = inst_36987);

(statearr_37058[(10)] = inst_36988);

(statearr_37058[(11)] = inst_36989);

(statearr_37058[(12)] = inst_36990);

return statearr_37058;
})();
var statearr_37062_38203 = state_37052__$1;
(statearr_37062_38203[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (1))){
var state_37052__$1 = state_37052;
var statearr_37070_38205 = state_37052__$1;
(statearr_37070_38205[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (4))){
var inst_36973 = (state_37052[(13)]);
var inst_36973__$1 = (state_37052[(2)]);
var inst_36974 = (inst_36973__$1 == null);
var state_37052__$1 = (function (){var statearr_37071 = state_37052;
(statearr_37071[(13)] = inst_36973__$1);

return statearr_37071;
})();
if(cljs.core.truth_(inst_36974)){
var statearr_37075_38207 = state_37052__$1;
(statearr_37075_38207[(1)] = (5));

} else {
var statearr_37076_38208 = state_37052__$1;
(statearr_37076_38208[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (15))){
var state_37052__$1 = state_37052;
var statearr_37084_38209 = state_37052__$1;
(statearr_37084_38209[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (21))){
var state_37052__$1 = state_37052;
var statearr_37085_38210 = state_37052__$1;
(statearr_37085_38210[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (13))){
var inst_36990 = (state_37052[(12)]);
var inst_36987 = (state_37052[(9)]);
var inst_36988 = (state_37052[(10)]);
var inst_36989 = (state_37052[(11)]);
var inst_37004 = (state_37052[(2)]);
var inst_37005 = (inst_36990 + (1));
var tmp37081 = inst_36987;
var tmp37082 = inst_36988;
var tmp37083 = inst_36989;
var inst_36987__$1 = tmp37081;
var inst_36988__$1 = tmp37082;
var inst_36989__$1 = tmp37083;
var inst_36990__$1 = inst_37005;
var state_37052__$1 = (function (){var statearr_37086 = state_37052;
(statearr_37086[(14)] = inst_37004);

(statearr_37086[(9)] = inst_36987__$1);

(statearr_37086[(10)] = inst_36988__$1);

(statearr_37086[(11)] = inst_36989__$1);

(statearr_37086[(12)] = inst_36990__$1);

return statearr_37086;
})();
var statearr_37089_38215 = state_37052__$1;
(statearr_37089_38215[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (22))){
var state_37052__$1 = state_37052;
var statearr_37090_38226 = state_37052__$1;
(statearr_37090_38226[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (6))){
var inst_36973 = (state_37052[(13)]);
var inst_36985 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_36973) : f.call(null,inst_36973));
var inst_36986 = cljs.core.seq(inst_36985);
var inst_36987 = inst_36986;
var inst_36988 = null;
var inst_36989 = (0);
var inst_36990 = (0);
var state_37052__$1 = (function (){var statearr_37091 = state_37052;
(statearr_37091[(9)] = inst_36987);

(statearr_37091[(10)] = inst_36988);

(statearr_37091[(11)] = inst_36989);

(statearr_37091[(12)] = inst_36990);

return statearr_37091;
})();
var statearr_37092_38232 = state_37052__$1;
(statearr_37092_38232[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (17))){
var inst_37011 = (state_37052[(7)]);
var inst_37015 = cljs.core.chunk_first(inst_37011);
var inst_37016 = cljs.core.chunk_rest(inst_37011);
var inst_37017 = cljs.core.count(inst_37015);
var inst_36987 = inst_37016;
var inst_36988 = inst_37015;
var inst_36989 = inst_37017;
var inst_36990 = (0);
var state_37052__$1 = (function (){var statearr_37093 = state_37052;
(statearr_37093[(9)] = inst_36987);

(statearr_37093[(10)] = inst_36988);

(statearr_37093[(11)] = inst_36989);

(statearr_37093[(12)] = inst_36990);

return statearr_37093;
})();
var statearr_37094_38246 = state_37052__$1;
(statearr_37094_38246[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (3))){
var inst_37043 = (state_37052[(2)]);
var state_37052__$1 = state_37052;
return cljs.core.async.impl.ioc_helpers.return_chan(state_37052__$1,inst_37043);
} else {
if((state_val_37053 === (12))){
var inst_37031 = (state_37052[(2)]);
var state_37052__$1 = state_37052;
var statearr_37095_38247 = state_37052__$1;
(statearr_37095_38247[(2)] = inst_37031);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (2))){
var state_37052__$1 = state_37052;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_37052__$1,(4),in$);
} else {
if((state_val_37053 === (23))){
var inst_37039 = (state_37052[(2)]);
var state_37052__$1 = state_37052;
var statearr_37096_38252 = state_37052__$1;
(statearr_37096_38252[(2)] = inst_37039);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (19))){
var inst_37026 = (state_37052[(2)]);
var state_37052__$1 = state_37052;
var statearr_37097_38253 = state_37052__$1;
(statearr_37097_38253[(2)] = inst_37026);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (11))){
var inst_36987 = (state_37052[(9)]);
var inst_37011 = (state_37052[(7)]);
var inst_37011__$1 = cljs.core.seq(inst_36987);
var state_37052__$1 = (function (){var statearr_37098 = state_37052;
(statearr_37098[(7)] = inst_37011__$1);

return statearr_37098;
})();
if(inst_37011__$1){
var statearr_37099_38255 = state_37052__$1;
(statearr_37099_38255[(1)] = (14));

} else {
var statearr_37100_38256 = state_37052__$1;
(statearr_37100_38256[(1)] = (15));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (9))){
var inst_37033 = (state_37052[(2)]);
var inst_37034 = cljs.core.async.impl.protocols.closed_QMARK_(out);
var state_37052__$1 = (function (){var statearr_37101 = state_37052;
(statearr_37101[(15)] = inst_37033);

return statearr_37101;
})();
if(cljs.core.truth_(inst_37034)){
var statearr_37102_38266 = state_37052__$1;
(statearr_37102_38266[(1)] = (21));

} else {
var statearr_37103_38267 = state_37052__$1;
(statearr_37103_38267[(1)] = (22));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (5))){
var inst_36976 = cljs.core.async.close_BANG_(out);
var state_37052__$1 = state_37052;
var statearr_37104_38268 = state_37052__$1;
(statearr_37104_38268[(2)] = inst_36976);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (14))){
var inst_37011 = (state_37052[(7)]);
var inst_37013 = cljs.core.chunked_seq_QMARK_(inst_37011);
var state_37052__$1 = state_37052;
if(inst_37013){
var statearr_37105_38274 = state_37052__$1;
(statearr_37105_38274[(1)] = (17));

} else {
var statearr_37106_38275 = state_37052__$1;
(statearr_37106_38275[(1)] = (18));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (16))){
var inst_37029 = (state_37052[(2)]);
var state_37052__$1 = state_37052;
var statearr_37107_38277 = state_37052__$1;
(statearr_37107_38277[(2)] = inst_37029);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37053 === (10))){
var inst_36988 = (state_37052[(10)]);
var inst_36990 = (state_37052[(12)]);
var inst_37002 = cljs.core._nth(inst_36988,inst_36990);
var state_37052__$1 = state_37052;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_37052__$1,(13),out,inst_37002);
} else {
if((state_val_37053 === (18))){
var inst_37011 = (state_37052[(7)]);
var inst_37020 = cljs.core.first(inst_37011);
var state_37052__$1 = state_37052;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_37052__$1,(20),out,inst_37020);
} else {
if((state_val_37053 === (8))){
var inst_36990 = (state_37052[(12)]);
var inst_36989 = (state_37052[(11)]);
var inst_36996 = (inst_36990 < inst_36989);
var inst_36997 = inst_36996;
var state_37052__$1 = state_37052;
if(cljs.core.truth_(inst_36997)){
var statearr_37108_38283 = state_37052__$1;
(statearr_37108_38283[(1)] = (10));

} else {
var statearr_37109_38284 = state_37052__$1;
(statearr_37109_38284[(1)] = (11));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});
return (function() {
var cljs$core$async$mapcat_STAR__$_state_machine__34860__auto__ = null;
var cljs$core$async$mapcat_STAR__$_state_machine__34860__auto____0 = (function (){
var statearr_37110 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_37110[(0)] = cljs$core$async$mapcat_STAR__$_state_machine__34860__auto__);

(statearr_37110[(1)] = (1));

return statearr_37110;
});
var cljs$core$async$mapcat_STAR__$_state_machine__34860__auto____1 = (function (state_37052){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_37052);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e37111){var ex__34863__auto__ = e37111;
var statearr_37112_38285 = state_37052;
(statearr_37112_38285[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38288 = state_37052;
state_37052 = G__38288;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$mapcat_STAR__$_state_machine__34860__auto__ = function(state_37052){
switch(arguments.length){
case 0:
return cljs$core$async$mapcat_STAR__$_state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$mapcat_STAR__$_state_machine__34860__auto____1.call(this,state_37052);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$mapcat_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$mapcat_STAR__$_state_machine__34860__auto____0;
cljs$core$async$mapcat_STAR__$_state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$mapcat_STAR__$_state_machine__34860__auto____1;
return cljs$core$async$mapcat_STAR__$_state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_37114 = f__35080__auto__();
(statearr_37114[(6)] = c__35079__auto__);

return statearr_37114;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));

return c__35079__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__37118 = arguments.length;
switch (G__37118) {
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__37131 = arguments.length;
switch (G__37131) {
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__37135 = arguments.length;
switch (G__37135) {
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__35079__auto___38297 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_37159){
var state_val_37160 = (state_37159[(1)]);
if((state_val_37160 === (7))){
var inst_37154 = (state_37159[(2)]);
var state_37159__$1 = state_37159;
var statearr_37161_38298 = state_37159__$1;
(statearr_37161_38298[(2)] = inst_37154);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37160 === (1))){
var inst_37136 = null;
var state_37159__$1 = (function (){var statearr_37162 = state_37159;
(statearr_37162[(7)] = inst_37136);

return statearr_37162;
})();
var statearr_37163_38303 = state_37159__$1;
(statearr_37163_38303[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37160 === (4))){
var inst_37139 = (state_37159[(8)]);
var inst_37139__$1 = (state_37159[(2)]);
var inst_37140 = (inst_37139__$1 == null);
var inst_37141 = cljs.core.not(inst_37140);
var state_37159__$1 = (function (){var statearr_37164 = state_37159;
(statearr_37164[(8)] = inst_37139__$1);

return statearr_37164;
})();
if(inst_37141){
var statearr_37165_38307 = state_37159__$1;
(statearr_37165_38307[(1)] = (5));

} else {
var statearr_37166_38308 = state_37159__$1;
(statearr_37166_38308[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37160 === (6))){
var state_37159__$1 = state_37159;
var statearr_37167_38309 = state_37159__$1;
(statearr_37167_38309[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37160 === (3))){
var inst_37156 = (state_37159[(2)]);
var inst_37157 = cljs.core.async.close_BANG_(out);
var state_37159__$1 = (function (){var statearr_37168 = state_37159;
(statearr_37168[(9)] = inst_37156);

return statearr_37168;
})();
return cljs.core.async.impl.ioc_helpers.return_chan(state_37159__$1,inst_37157);
} else {
if((state_val_37160 === (2))){
var state_37159__$1 = state_37159;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_37159__$1,(4),ch);
} else {
if((state_val_37160 === (11))){
var inst_37139 = (state_37159[(8)]);
var inst_37148 = (state_37159[(2)]);
var inst_37136 = inst_37139;
var state_37159__$1 = (function (){var statearr_37171 = state_37159;
(statearr_37171[(10)] = inst_37148);

(statearr_37171[(7)] = inst_37136);

return statearr_37171;
})();
var statearr_37172_38310 = state_37159__$1;
(statearr_37172_38310[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37160 === (9))){
var inst_37139 = (state_37159[(8)]);
var state_37159__$1 = state_37159;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_37159__$1,(11),out,inst_37139);
} else {
if((state_val_37160 === (5))){
var inst_37139 = (state_37159[(8)]);
var inst_37136 = (state_37159[(7)]);
var inst_37143 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_37139,inst_37136);
var state_37159__$1 = state_37159;
if(inst_37143){
var statearr_37175_38315 = state_37159__$1;
(statearr_37175_38315[(1)] = (8));

} else {
var statearr_37176_38316 = state_37159__$1;
(statearr_37176_38316[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37160 === (10))){
var inst_37151 = (state_37159[(2)]);
var state_37159__$1 = state_37159;
var statearr_37177_38317 = state_37159__$1;
(statearr_37177_38317[(2)] = inst_37151);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37160 === (8))){
var inst_37136 = (state_37159[(7)]);
var tmp37173 = inst_37136;
var inst_37136__$1 = tmp37173;
var state_37159__$1 = (function (){var statearr_37178 = state_37159;
(statearr_37178[(7)] = inst_37136__$1);

return statearr_37178;
})();
var statearr_37179_38319 = state_37159__$1;
(statearr_37179_38319[(2)] = null);

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


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

(statearr_37180[(1)] = (1));

return statearr_37180;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_37159){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_37159);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e37181){var ex__34863__auto__ = e37181;
var statearr_37182_38320 = state_37159;
(statearr_37182_38320[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38322 = state_37159;
state_37159 = G__38322;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_37159){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_37159);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_37193 = f__35080__auto__();
(statearr_37193[(6)] = c__35079__auto___38297);

return statearr_37193;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__37196 = arguments.length;
switch (G__37196) {
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__35079__auto___38326 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_37234){
var state_val_37235 = (state_37234[(1)]);
if((state_val_37235 === (7))){
var inst_37230 = (state_37234[(2)]);
var state_37234__$1 = state_37234;
var statearr_37236_38327 = state_37234__$1;
(statearr_37236_38327[(2)] = inst_37230);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (1))){
var inst_37197 = (new Array(n));
var inst_37198 = inst_37197;
var inst_37199 = (0);
var state_37234__$1 = (function (){var statearr_37237 = state_37234;
(statearr_37237[(7)] = inst_37198);

(statearr_37237[(8)] = inst_37199);

return statearr_37237;
})();
var statearr_37240_38328 = state_37234__$1;
(statearr_37240_38328[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (4))){
var inst_37202 = (state_37234[(9)]);
var inst_37202__$1 = (state_37234[(2)]);
var inst_37203 = (inst_37202__$1 == null);
var inst_37204 = cljs.core.not(inst_37203);
var state_37234__$1 = (function (){var statearr_37241 = state_37234;
(statearr_37241[(9)] = inst_37202__$1);

return statearr_37241;
})();
if(inst_37204){
var statearr_37242_38329 = state_37234__$1;
(statearr_37242_38329[(1)] = (5));

} else {
var statearr_37243_38330 = state_37234__$1;
(statearr_37243_38330[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (15))){
var inst_37224 = (state_37234[(2)]);
var state_37234__$1 = state_37234;
var statearr_37244_38333 = state_37234__$1;
(statearr_37244_38333[(2)] = inst_37224);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (13))){
var state_37234__$1 = state_37234;
var statearr_37246_38334 = state_37234__$1;
(statearr_37246_38334[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (6))){
var inst_37199 = (state_37234[(8)]);
var inst_37220 = (inst_37199 > (0));
var state_37234__$1 = state_37234;
if(cljs.core.truth_(inst_37220)){
var statearr_37247_38335 = state_37234__$1;
(statearr_37247_38335[(1)] = (12));

} else {
var statearr_37249_38336 = state_37234__$1;
(statearr_37249_38336[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (3))){
var inst_37232 = (state_37234[(2)]);
var state_37234__$1 = state_37234;
return cljs.core.async.impl.ioc_helpers.return_chan(state_37234__$1,inst_37232);
} else {
if((state_val_37235 === (12))){
var inst_37198 = (state_37234[(7)]);
var inst_37222 = cljs.core.vec(inst_37198);
var state_37234__$1 = state_37234;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_37234__$1,(15),out,inst_37222);
} else {
if((state_val_37235 === (2))){
var state_37234__$1 = state_37234;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_37234__$1,(4),ch);
} else {
if((state_val_37235 === (11))){
var inst_37214 = (state_37234[(2)]);
var inst_37215 = (new Array(n));
var inst_37198 = inst_37215;
var inst_37199 = (0);
var state_37234__$1 = (function (){var statearr_37250 = state_37234;
(statearr_37250[(10)] = inst_37214);

(statearr_37250[(7)] = inst_37198);

(statearr_37250[(8)] = inst_37199);

return statearr_37250;
})();
var statearr_37251_38338 = state_37234__$1;
(statearr_37251_38338[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (9))){
var inst_37198 = (state_37234[(7)]);
var inst_37212 = cljs.core.vec(inst_37198);
var state_37234__$1 = state_37234;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_37234__$1,(11),out,inst_37212);
} else {
if((state_val_37235 === (5))){
var inst_37198 = (state_37234[(7)]);
var inst_37199 = (state_37234[(8)]);
var inst_37202 = (state_37234[(9)]);
var inst_37207 = (state_37234[(11)]);
var inst_37206 = (inst_37198[inst_37199] = inst_37202);
var inst_37207__$1 = (inst_37199 + (1));
var inst_37208 = (inst_37207__$1 < n);
var state_37234__$1 = (function (){var statearr_37252 = state_37234;
(statearr_37252[(12)] = inst_37206);

(statearr_37252[(11)] = inst_37207__$1);

return statearr_37252;
})();
if(cljs.core.truth_(inst_37208)){
var statearr_37253_38343 = state_37234__$1;
(statearr_37253_38343[(1)] = (8));

} else {
var statearr_37254_38344 = state_37234__$1;
(statearr_37254_38344[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (14))){
var inst_37227 = (state_37234[(2)]);
var inst_37228 = cljs.core.async.close_BANG_(out);
var state_37234__$1 = (function (){var statearr_37256 = state_37234;
(statearr_37256[(13)] = inst_37227);

return statearr_37256;
})();
var statearr_37257_38345 = state_37234__$1;
(statearr_37257_38345[(2)] = inst_37228);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (10))){
var inst_37218 = (state_37234[(2)]);
var state_37234__$1 = state_37234;
var statearr_37265_38346 = state_37234__$1;
(statearr_37265_38346[(2)] = inst_37218);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37235 === (8))){
var inst_37198 = (state_37234[(7)]);
var inst_37207 = (state_37234[(11)]);
var tmp37255 = inst_37198;
var inst_37198__$1 = tmp37255;
var inst_37199 = inst_37207;
var state_37234__$1 = (function (){var statearr_37266 = state_37234;
(statearr_37266[(7)] = inst_37198__$1);

(statearr_37266[(8)] = inst_37199);

return statearr_37266;
})();
var statearr_37267_38351 = state_37234__$1;
(statearr_37267_38351[(2)] = null);

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


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

(statearr_37269[(1)] = (1));

return statearr_37269;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_37234){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_37234);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e37270){var ex__34863__auto__ = e37270;
var statearr_37271_38352 = state_37234;
(statearr_37271_38352[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38354 = state_37234;
state_37234 = G__38354;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_37234){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_37234);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_37282 = f__35080__auto__();
(statearr_37282[(6)] = c__35079__auto___38326);

return statearr_37282;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__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__37288 = arguments.length;
switch (G__37288) {
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__35079__auto___38363 = cljs.core.async.chan.cljs$core$IFn$_invoke$arity$1((1));
cljs.core.async.impl.dispatch.run((function (){
var f__35080__auto__ = (function (){var switch__34859__auto__ = (function (state_37348){
var state_val_37349 = (state_37348[(1)]);
if((state_val_37349 === (7))){
var inst_37344 = (state_37348[(2)]);
var state_37348__$1 = state_37348;
var statearr_37351_38364 = state_37348__$1;
(statearr_37351_38364[(2)] = inst_37344);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (1))){
var inst_37297 = [];
var inst_37298 = inst_37297;
var inst_37299 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
var state_37348__$1 = (function (){var statearr_37352 = state_37348;
(statearr_37352[(7)] = inst_37298);

(statearr_37352[(8)] = inst_37299);

return statearr_37352;
})();
var statearr_37356_38365 = state_37348__$1;
(statearr_37356_38365[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (4))){
var inst_37302 = (state_37348[(9)]);
var inst_37302__$1 = (state_37348[(2)]);
var inst_37303 = (inst_37302__$1 == null);
var inst_37304 = cljs.core.not(inst_37303);
var state_37348__$1 = (function (){var statearr_37358 = state_37348;
(statearr_37358[(9)] = inst_37302__$1);

return statearr_37358;
})();
if(inst_37304){
var statearr_37359_38366 = state_37348__$1;
(statearr_37359_38366[(1)] = (5));

} else {
var statearr_37360_38367 = state_37348__$1;
(statearr_37360_38367[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (15))){
var inst_37298 = (state_37348[(7)]);
var inst_37334 = cljs.core.vec(inst_37298);
var state_37348__$1 = state_37348;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_37348__$1,(18),out,inst_37334);
} else {
if((state_val_37349 === (13))){
var inst_37326 = (state_37348[(2)]);
var state_37348__$1 = state_37348;
var statearr_37361_38368 = state_37348__$1;
(statearr_37361_38368[(2)] = inst_37326);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (6))){
var inst_37298 = (state_37348[(7)]);
var inst_37331 = inst_37298.length;
var inst_37332 = (inst_37331 > (0));
var state_37348__$1 = state_37348;
if(cljs.core.truth_(inst_37332)){
var statearr_37362_38369 = state_37348__$1;
(statearr_37362_38369[(1)] = (15));

} else {
var statearr_37363_38370 = state_37348__$1;
(statearr_37363_38370[(1)] = (16));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (17))){
var inst_37341 = (state_37348[(2)]);
var inst_37342 = cljs.core.async.close_BANG_(out);
var state_37348__$1 = (function (){var statearr_37364 = state_37348;
(statearr_37364[(10)] = inst_37341);

return statearr_37364;
})();
var statearr_37365_38371 = state_37348__$1;
(statearr_37365_38371[(2)] = inst_37342);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (3))){
var inst_37346 = (state_37348[(2)]);
var state_37348__$1 = state_37348;
return cljs.core.async.impl.ioc_helpers.return_chan(state_37348__$1,inst_37346);
} else {
if((state_val_37349 === (12))){
var inst_37298 = (state_37348[(7)]);
var inst_37319 = cljs.core.vec(inst_37298);
var state_37348__$1 = state_37348;
return cljs.core.async.impl.ioc_helpers.put_BANG_(state_37348__$1,(14),out,inst_37319);
} else {
if((state_val_37349 === (2))){
var state_37348__$1 = state_37348;
return cljs.core.async.impl.ioc_helpers.take_BANG_(state_37348__$1,(4),ch);
} else {
if((state_val_37349 === (11))){
var inst_37298 = (state_37348[(7)]);
var inst_37302 = (state_37348[(9)]);
var inst_37306 = (state_37348[(11)]);
var inst_37316 = inst_37298.push(inst_37302);
var tmp37367 = inst_37298;
var inst_37298__$1 = tmp37367;
var inst_37299 = inst_37306;
var state_37348__$1 = (function (){var statearr_37375 = state_37348;
(statearr_37375[(12)] = inst_37316);

(statearr_37375[(7)] = inst_37298__$1);

(statearr_37375[(8)] = inst_37299);

return statearr_37375;
})();
var statearr_37376_38373 = state_37348__$1;
(statearr_37376_38373[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (9))){
var inst_37299 = (state_37348[(8)]);
var inst_37310 = cljs.core.keyword_identical_QMARK_(inst_37299,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123));
var state_37348__$1 = state_37348;
var statearr_37378_38374 = state_37348__$1;
(statearr_37378_38374[(2)] = inst_37310);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (5))){
var inst_37302 = (state_37348[(9)]);
var inst_37306 = (state_37348[(11)]);
var inst_37299 = (state_37348[(8)]);
var inst_37307 = (state_37348[(13)]);
var inst_37306__$1 = (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(inst_37302) : f.call(null,inst_37302));
var inst_37307__$1 = cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(inst_37306__$1,inst_37299);
var state_37348__$1 = (function (){var statearr_37379 = state_37348;
(statearr_37379[(11)] = inst_37306__$1);

(statearr_37379[(13)] = inst_37307__$1);

return statearr_37379;
})();
if(inst_37307__$1){
var statearr_37380_38379 = state_37348__$1;
(statearr_37380_38379[(1)] = (8));

} else {
var statearr_37381_38381 = state_37348__$1;
(statearr_37381_38381[(1)] = (9));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (14))){
var inst_37302 = (state_37348[(9)]);
var inst_37306 = (state_37348[(11)]);
var inst_37321 = (state_37348[(2)]);
var inst_37322 = [];
var inst_37323 = inst_37322.push(inst_37302);
var inst_37298 = inst_37322;
var inst_37299 = inst_37306;
var state_37348__$1 = (function (){var statearr_37382 = state_37348;
(statearr_37382[(14)] = inst_37321);

(statearr_37382[(15)] = inst_37323);

(statearr_37382[(7)] = inst_37298);

(statearr_37382[(8)] = inst_37299);

return statearr_37382;
})();
var statearr_37383_38388 = state_37348__$1;
(statearr_37383_38388[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (16))){
var state_37348__$1 = state_37348;
var statearr_37384_38390 = state_37348__$1;
(statearr_37384_38390[(2)] = null);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (10))){
var inst_37313 = (state_37348[(2)]);
var state_37348__$1 = state_37348;
if(cljs.core.truth_(inst_37313)){
var statearr_37387_38391 = state_37348__$1;
(statearr_37387_38391[(1)] = (11));

} else {
var statearr_37388_38392 = state_37348__$1;
(statearr_37388_38392[(1)] = (12));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (18))){
var inst_37336 = (state_37348[(2)]);
var state_37348__$1 = state_37348;
var statearr_37389_38393 = state_37348__$1;
(statearr_37389_38393[(2)] = inst_37336);

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


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_37349 === (8))){
var inst_37307 = (state_37348[(13)]);
var state_37348__$1 = state_37348;
var statearr_37392_38395 = state_37348__$1;
(statearr_37392_38395[(2)] = inst_37307);

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


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

(statearr_37393[(1)] = (1));

return statearr_37393;
});
var cljs$core$async$state_machine__34860__auto____1 = (function (state_37348){
while(true){
var ret_value__34861__auto__ = (function (){try{while(true){
var result__34862__auto__ = switch__34859__auto__(state_37348);
if(cljs.core.keyword_identical_QMARK_(result__34862__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__34862__auto__;
}
break;
}
}catch (e37394){var ex__34863__auto__ = e37394;
var statearr_37395_38402 = state_37348;
(statearr_37395_38402[(2)] = ex__34863__auto__);


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

} else {
throw ex__34863__auto__;
}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
}})();
if(cljs.core.keyword_identical_QMARK_(ret_value__34861__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__38404 = state_37348;
state_37348 = G__38404;
continue;
} else {
return ret_value__34861__auto__;
}
break;
}
});
cljs$core$async$state_machine__34860__auto__ = function(state_37348){
switch(arguments.length){
case 0:
return cljs$core$async$state_machine__34860__auto____0.call(this);
case 1:
return cljs$core$async$state_machine__34860__auto____1.call(this,state_37348);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$0 = cljs$core$async$state_machine__34860__auto____0;
cljs$core$async$state_machine__34860__auto__.cljs$core$IFn$_invoke$arity$1 = cljs$core$async$state_machine__34860__auto____1;
return cljs$core$async$state_machine__34860__auto__;
})()
})();
var state__35081__auto__ = (function (){var statearr_37399 = f__35080__auto__();
(statearr_37399[(6)] = c__35079__auto___38363);

return statearr_37399;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state__35081__auto__);
}));


return out;
}));

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


//# sourceMappingURL=cljs.core.async.js.map
