// Compiled by ClojureScript 0.0-2138
goog.provide('lt.objs.clients');
goog.require('cljs.core');
goog.require('lt.util.js');
goog.require('clojure.string');
goog.require('clojure.string');
goog.require('lt.objs.notifos');
goog.require('lt.objs.notifos');
goog.require('lt.util.js');
goog.require('lt.object');
goog.require('lt.object');
lt.objs.clients.cs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
lt.objs.clients.__GT_id = (function __GT_id(obj){return lt.object.__GT_id.call(null,obj);
});
lt.objs.clients.client_BANG_ = (function client_BANG_(type){var obj = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.clients","client","lt.objs.clients/client",613325584));lt.object.add_tags.call(null,obj,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [type], null));
cljs.core.swap_BANG_.call(null,lt.objs.clients.cs,cljs.core.assoc,lt.objs.clients.__GT_id.call(null,obj),obj);
return obj;
});
lt.objs.clients.by_id = (function by_id(n){if(cljs.core.truth_(n))
{return cljs.core.deref.call(null,lt.objs.clients.cs).call(null,n);
} else
{return null;
}
});
lt.objs.clients.by_name = (function by_name(n){return cljs.core.first.call(null,cljs.core.filter.call(null,(function (p1__7543_SHARP_){return cljs.core._EQ_.call(null,n,new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,p1__7543_SHARP_)));
}),cljs.core.vals.call(null,cljs.core.deref.call(null,lt.objs.clients.cs))));
});
lt.objs.clients.__GT_name = (function __GT_name(client){if(cljs.core.map_QMARK_.call(null,client))
{return new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(client);
} else
{return client;
}
});
lt.objs.clients.merge_info = (function merge_info(client,info){var map__7545 = info;var map__7545__$1 = ((cljs.core.seq_QMARK_.call(null,map__7545))?cljs.core.apply.call(null,cljs.core.hash_map,map__7545):map__7545);var tags = cljs.core.get.call(null,map__7545__$1,new cljs.core.Keyword(null,"tags","tags",1017456523));var type = cljs.core.get.call(null,map__7545__$1,new cljs.core.Keyword(null,"type","type",1017479852));var commands = cljs.core.get.call(null,map__7545__$1,new cljs.core.Keyword(null,"commands","commands",4706336250));var info__$1 = cljs.core.dissoc.call(null,info,new cljs.core.Keyword(null,"tags","tags",1017456523));lt.object.merge_BANG_.call(null,client,cljs.core.merge.call(null,info__$1,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"commands","commands",4706336250),cljs.core.set.call(null,cljs.core.map.call(null,cljs.core.keyword,commands))], null)));
if(cljs.core.truth_(tags))
{return lt.object.add_tags.call(null,client,tags);
} else
{return null;
}
});
lt.objs.clients.handle_connection_BANG_ = (function handle_connection_BANG_(info){var temp__4090__auto__ = lt.objs.clients.by_id.call(null,new cljs.core.Keyword(null,"client-id","client-id",3404733903).cljs$core$IFn$_invoke$arity$1(info));if(cljs.core.truth_(temp__4090__auto__))
{var client = temp__4090__auto__;lt.objs.clients.merge_info.call(null,client,info);
lt.object.raise.call(null,client,new cljs.core.Keyword(null,"connect","connect",1965255772));
lt.object.raise.call(null,lt.objs.clients.clients,new cljs.core.Keyword(null,"connect","connect",1965255772),client);
return client;
} else
{var c = lt.objs.clients.client_BANG_.call(null,new cljs.core.Keyword(null,"tag","tag",1014018828).cljs$core$IFn$_invoke$arity$1(info));return handle_connection_BANG_.call(null,cljs.core.assoc.call(null,info,new cljs.core.Keyword(null,"client-id","client-id",3404733903),lt.objs.clients.__GT_id.call(null,c)));
}
});
lt.objs.clients.rem_BANG_ = (function rem_BANG_(client){var cname = new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,client));cljs.core.swap_BANG_.call(null,lt.objs.clients.cs,cljs.core.dissoc,lt.objs.clients.__GT_id.call(null,client));
lt.object.raise.call(null,client,new cljs.core.Keyword(null,"disconnect","disconnect",1544309774));
lt.object.destroy_BANG_.call(null,client);
return lt.object.raise.call(null,lt.objs.clients.clients,new cljs.core.Keyword(null,"disconnect","disconnect",1544309774),cname);
});
lt.objs.clients.available_QMARK_ = (function available_QMARK_(client){return lt.objs.clients.by_id.call(null,lt.objs.clients.__GT_id.call(null,client));
});
lt.objs.clients.cb_gc_timeout = ((60 * 60) * 1000);
lt.objs.clients.callbacks = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
lt.objs.clients.cb_id = cljs.core.atom.call(null,-1);
lt.objs.clients.__GT_cb = (function __GT_cb(only_QMARK_,cb){if(cljs.core.truth_((function (){var and__3508__auto__ = only_QMARK_;if(cljs.core.truth_(and__3508__auto__))
{return cb;
} else
{return and__3508__auto__;
}
})()))
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [only_QMARK_,cb], null);
} else
{if(cljs.core.truth_(only_QMARK_))
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,only_QMARK_], null);
} else
{if(new cljs.core.Keyword(null,"else","else",1017020587))
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [only_QMARK_,cb], null);
} else
{return null;
}
}
}
});
lt.objs.clients.store_cb = (function store_cb(cb,id){return cljs.core.swap_BANG_.call(null,lt.objs.clients.callbacks,cljs.core.assoc,id,cb);
});
lt.objs.clients.rem_cb = (function rem_cb(cb){return cljs.core.swap_BANG_.call(null,lt.objs.clients.callbacks,(function (p1__7546_SHARP_){return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.remove.call(null,(function (p__7550){var vec__7551 = p__7550;var k = cljs.core.nth.call(null,vec__7551,0,null);var vec__7552 = cljs.core.nth.call(null,vec__7551,1,null);var _ = cljs.core.nth.call(null,vec__7552,0,null);var v = cljs.core.nth.call(null,vec__7552,1,null);return cljs.core._EQ_.call(null,v,cb);
}),p1__7546_SHARP_));
}));
});
lt.objs.clients.callback_QMARK_ = (function callback_QMARK_(id){if(cljs.core.truth_(id))
{return cljs.core.deref.call(null,lt.objs.clients.callbacks).call(null,id);
} else
{return null;
}
});
lt.objs.clients.call = (function call(id,command,data){var vec__7554 = lt.objs.clients.callback_QMARK_.call(null,id);var only_QMARK_ = cljs.core.nth.call(null,vec__7554,0,null);var obj = cljs.core.nth.call(null,vec__7554,1,null);if(cljs.core.truth_(obj))
{if(cljs.core.fn_QMARK_.call(null,obj))
{obj.call(null,command,data);
} else
{lt.object.raise.call(null,obj,command,data);
}
if((cljs.core.not.call(null,only_QMARK_)) && (!(cljs.core.fn_QMARK_.call(null,obj))))
{return lt.object.raise.call(null,lt.objs.clients.clients,command,data);
} else
{return null;
}
} else
{return null;
}
});
lt.objs.clients.cb__GT_obj = (function cb__GT_obj(id){var vec__7556 = lt.objs.clients.callback_QMARK_.call(null,id);var only_QMARK_ = cljs.core.nth.call(null,vec__7556,0,null);var obj = cljs.core.nth.call(null,vec__7556,1,null);if(cljs.core.truth_(obj))
{if(cljs.core.fn_QMARK_.call(null,obj))
{return null;
} else
{return obj;
}
} else
{return null;
}
});
lt.objs.clients.__GT_message = (function __GT_message(command,data,only_QMARK_,cb){var cb__$1 = ((cljs.core.not.call(null,cb))?lt.objs.clients.clients:cb);var cb_id = ((cljs.core.fn_QMARK_.call(null,cb__$1))?cljs.core.gensym.call(null,"client-cb"):null);var vec__7558 = lt.objs.clients.__GT_cb.call(null,only_QMARK_,cb__$1);var only_QMARK___$1 = cljs.core.nth.call(null,vec__7558,0,null);var cb__$2 = cljs.core.nth.call(null,vec__7558,1,null);var pair = vec__7558;if(cljs.core.truth_(cb__$2))
{lt.objs.clients.store_cb.call(null,pair,cb_id);
} else
{}
return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"cb","cb",1013907409),(function (){var or__3520__auto__ = cb_id;if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return lt.object.__GT_id.call(null,cb__$2);
}
})(),new cljs.core.Keyword(null,"command","command",1964298941),cljs.core.name.call(null,command),new cljs.core.Keyword(null,"data","data",1016980252),data], null);
});
lt.objs.clients.subpath_QMARK_ = (function subpath_QMARK_(root,sub){if(cljs.core.truth_(root))
{return cljs.core._EQ_.call(null,clojure.string.lower_case.call(null,sub).indexOf(clojure.string.lower_case.call(null,root)),0);
} else
{return null;
}
});
lt.objs.clients.discover_STAR_ = (function() {
var discover_STAR_ = null;
var discover_STAR___1 = (function (command){return discover_STAR_.call(null,command,null);
});
var discover_STAR___2 = (function (command,p__7560){var map__7564 = p__7560;var map__7564__$1 = ((cljs.core.seq_QMARK_.call(null,map__7564))?cljs.core.apply.call(null,cljs.core.hash_map,map__7564):map__7564);var path = cljs.core.get.call(null,map__7564__$1,new cljs.core.Keyword(null,"path","path",1017337751));var all = cljs.core.filter.call(null,(function (cur){var map__7565 = (((function (){var G__7566 = cur;if(G__7566)
{var bit__4164__auto__ = (G__7566.cljs$lang$protocol_mask$partition0$ & 32768);if((bit__4164__auto__) || (G__7566.cljs$core$IDeref$))
{return true;
} else
{if((!G__7566.cljs$lang$protocol_mask$partition0$))
{return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IDeref,G__7566);
} else
{return false;
}
}
} else
{return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IDeref,G__7566);
}
})())?cljs.core.deref.call(null,cur):cur);var map__7565__$1 = ((cljs.core.seq_QMARK_.call(null,map__7565))?cljs.core.apply.call(null,cljs.core.hash_map,map__7565):map__7565);var commands = cljs.core.get.call(null,map__7565__$1,new cljs.core.Keyword(null,"commands","commands",4706336250));var dir = cljs.core.get.call(null,map__7565__$1,new cljs.core.Keyword(null,"dir","dir",1014003711));var and__3508__auto__ = (cljs.core.truth_((function (){var and__3508__auto__ = path;if(cljs.core.truth_(and__3508__auto__))
{return dir;
} else
{return and__3508__auto__;
}
})())?lt.objs.clients.subpath_QMARK_.call(null,dir,path):true);if(cljs.core.truth_(and__3508__auto__))
{return cljs.core.get.call(null,commands,command);
} else
{return and__3508__auto__;
}
}),cljs.core.vals.call(null,cljs.core.deref.call(null,lt.objs.clients.cs)));var with_dir = cljs.core.filter.call(null,((function (all){
return (function (p1__7559_SHARP_){return cljs.core.deref.call(null,p1__7559_SHARP_).call(null,new cljs.core.Keyword(null,"dir","dir",1014003711));
});})(all))
,all);if(cljs.core.truth_((function (){var and__3508__auto__ = path;if(cljs.core.truth_(and__3508__auto__))
{return cljs.core.seq.call(null,with_dir);
} else
{return and__3508__auto__;
}
})()))
{return with_dir;
} else
{return all;
}
});
discover_STAR_ = function(command,p__7560){
switch(arguments.length){
case 1:
return discover_STAR___1.call(this,command);
case 2:
return discover_STAR___2.call(this,command,p__7560);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
discover_STAR_.cljs$core$IFn$_invoke$arity$1 = discover_STAR___1;
discover_STAR_.cljs$core$IFn$_invoke$arity$2 = discover_STAR___2;
return discover_STAR_;
})()
;
lt.objs.clients.discover = (function discover(command,info){var vec__7568 = lt.objs.clients.discover_STAR_.call(null,command,info);var found = cljs.core.nth.call(null,vec__7568,0,null);var others = cljs.core.nthnext.call(null,vec__7568,1);var all = vec__7568;if(cljs.core.not.call(null,found))
{return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"none","none",1017291434)], null);
} else
{if(cljs.core.truth_((function (){var and__3508__auto__ = found;if(cljs.core.truth_(and__3508__auto__))
{return cljs.core.not.call(null,cljs.core.seq.call(null,others));
} else
{return and__3508__auto__;
}
})()))
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"found","found",1111526132),found], null);
} else
{if(new cljs.core.Keyword(null,"else","else",1017020587))
{return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"select","select",4402849902),all], null);
} else
{return null;
}
}
}
});
/**
* @param {...*} var_args
*/
lt.objs.clients.send = (function() { 
var send__delegate = function (client,command,p__7569){var vec__7571 = p__7569;var data = cljs.core.nth.call(null,vec__7571,0,null);var only_QMARK_ = cljs.core.nth.call(null,vec__7571,1,null);var cb = cljs.core.nth.call(null,vec__7571,2,null);var message = lt.objs.clients.__GT_message.call(null,command,data,only_QMARK_,cb);return lt.object.raise.call(null,client,new cljs.core.Keyword(null,"try-send!","try-send!",4325864057),message);
};
var send = function (client,command,var_args){
var p__7569 = null;if (arguments.length > 2) {
  p__7569 = cljs.core.array_seq(Array.prototype.slice.call(arguments, 2),0);} 
return send__delegate.call(this,client,command,p__7569);};
send.cljs$lang$maxFixedArity = 2;
send.cljs$lang$applyTo = (function (arglist__7572){
var client = cljs.core.first(arglist__7572);
arglist__7572 = cljs.core.next(arglist__7572);
var command = cljs.core.first(arglist__7572);
var p__7569 = cljs.core.rest(arglist__7572);
return send__delegate(client,command,p__7569);
});
send.cljs$core$IFn$_invoke$arity$variadic = send__delegate;
return send;
})()
;
lt.objs.clients.close_BANG_ = (function close_BANG_(client){lt.objs.clients.send.call(null,client,new cljs.core.Keyword(null,"client.close","client.close",2801102215));
return lt.object.raise.call(null,client,new cljs.core.Keyword(null,"close!","close!",3951350939));
});
lt.objs.clients.cancel_all_BANG_ = (function cancel_all_BANG_(client){return lt.objs.clients.send.call(null,client,new cljs.core.Keyword(null,"client.cancel-all","client.cancel-all",3113005379));
});
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","clients","lt.objs.clients/clients",2829334861),new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"connect","connect",1965255772),new cljs.core.Keyword(null,"disconnect","disconnect",1544309774),new cljs.core.Keyword(null,"message","message",1968829305)], null),new cljs.core.Keyword(null,"behaviors","behaviors",607554515),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword("lt.objs.clients","handle-message","lt.objs.clients/handle-message",943314615),new cljs.core.Keyword("lt.objs.clients","notify-connect","lt.objs.clients/notify-connect",1621214643)], null),new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"clients","clients",1874491770),null], null), null),new cljs.core.Keyword(null,"init","init",1017141378),(function (){return null;
}));
lt.objs.clients.clients = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.clients","clients","lt.objs.clients/clients",2829334861));
lt.objs.clients.__BEH__close_clients_on_closed = (function __BEH__close_clients_on_closed(app){var seq__7579 = cljs.core.seq.call(null,cljs.core.deref.call(null,lt.objs.clients.cs));var chunk__7580 = null;var count__7581 = 0;var i__7582 = 0;while(true){
if((i__7582 < count__7581))
{var vec__7583 = cljs.core._nth.call(null,chunk__7580,i__7582);var _ = cljs.core.nth.call(null,vec__7583,0,null);var c = cljs.core.nth.call(null,vec__7583,1,null);lt.objs.clients.close_BANG_.call(null,c);
{
var G__7585 = seq__7579;
var G__7586 = chunk__7580;
var G__7587 = count__7581;
var G__7588 = (i__7582 + 1);
seq__7579 = G__7585;
chunk__7580 = G__7586;
count__7581 = G__7587;
i__7582 = G__7588;
continue;
}
} else
{var temp__4092__auto__ = cljs.core.seq.call(null,seq__7579);if(temp__4092__auto__)
{var seq__7579__$1 = temp__4092__auto__;if(cljs.core.chunked_seq_QMARK_.call(null,seq__7579__$1))
{var c__4262__auto__ = cljs.core.chunk_first.call(null,seq__7579__$1);{
var G__7589 = cljs.core.chunk_rest.call(null,seq__7579__$1);
var G__7590 = c__4262__auto__;
var G__7591 = cljs.core.count.call(null,c__4262__auto__);
var G__7592 = 0;
seq__7579 = G__7589;
chunk__7580 = G__7590;
count__7581 = G__7591;
i__7582 = G__7592;
continue;
}
} else
{var vec__7584 = cljs.core.first.call(null,seq__7579__$1);var _ = cljs.core.nth.call(null,vec__7584,0,null);var c = cljs.core.nth.call(null,vec__7584,1,null);lt.objs.clients.close_BANG_.call(null,c);
{
var G__7593 = cljs.core.next.call(null,seq__7579__$1);
var G__7594 = null;
var G__7595 = 0;
var G__7596 = 0;
seq__7579 = G__7593;
chunk__7580 = G__7594;
count__7581 = G__7595;
i__7582 = G__7596;
continue;
}
}
} else
{return null;
}
}
break;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","close-clients-on-closed","lt.objs.clients/close-clients-on-closed",637496405),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__close_clients_on_closed,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"closing","closing",1880444967),null], null), null));
lt.objs.clients.__BEH__on_destroy_remove_cb = (function __BEH__on_destroy_remove_cb(this$){return lt.objs.clients.rem_cb.call(null,this$);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","on-destroy-remove-cb","lt.objs.clients/on-destroy-remove-cb",1411509012),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__on_destroy_remove_cb,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"destroy","destroy",2571277164),null], null), null));
lt.objs.clients.__BEH__raise_on_object = (function __BEH__raise_on_object(this$,p__7597){var vec__7599 = p__7597;var id = cljs.core.nth.call(null,vec__7599,0,null);var command = cljs.core.nth.call(null,vec__7599,1,null);var data = cljs.core.nth.call(null,vec__7599,2,null);return lt.object.raise.call(null,lt.object.by_id.call(null,id),cljs.core.keyword.call(null,command),data);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","raise-on-object","lt.objs.clients/raise-on-object",4358681993),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__raise_on_object,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"clients.raise-on-object","clients.raise-on-object",4257665496),null], null), null));
lt.objs.clients.__BEH__handle_message = (function __BEH__handle_message(obj,p__7600){var vec__7602 = p__7600;var cb_id = cljs.core.nth.call(null,vec__7602,0,null);var command = cljs.core.nth.call(null,vec__7602,1,null);var data = cljs.core.nth.call(null,vec__7602,2,null);var msg = vec__7602;if(cljs.core.truth_(lt.objs.clients.callback_QMARK_.call(null,cb_id)))
{return lt.objs.clients.call.call(null,cb_id,cljs.core.keyword.call(null,command),data);
} else
{if(cljs.core.truth_(lt.object.by_id.call(null,cb_id)))
{return lt.object.raise.call(null,lt.object.by_id.call(null,cb_id),cljs.core.keyword.call(null,command),data);
} else
{if(new cljs.core.Keyword(null,"else","else",1017020587))
{return lt.object.raise.call(null,lt.objs.clients.clients,cljs.core.keyword.call(null,command),data);
} else
{return null;
}
}
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","handle-message","lt.objs.clients/handle-message",943314615),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__handle_message,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"message","message",1968829305),null], null), null));
lt.objs.clients.__BEH__notify_connect = (function __BEH__notify_connect(obj,client){return lt.objs.notifos.set_msg_BANG_.call(null,[cljs.core.str("Connected to "),cljs.core.str(new cljs.core.Keyword(null,"name","name",1017277949).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,client)))].join(''));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","notify-connect","lt.objs.clients/notify-connect",1621214643),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__notify_connect,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"connect","connect",1965255772),null], null), null));
lt.objs.clients.placeholder = (function placeholder(){return lt.object.add_tags.call(null,lt.object.create.call(null,new cljs.core.Keyword("lt.objs.clients","client","lt.objs.clients/client",613325584)),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"client.placeholder","client.placeholder",3878144834)], null));
});
lt.objs.clients.placeholder_QMARK_ = (function placeholder_QMARK_(c){return lt.object.has_tag_QMARK_.call(null,c,new cljs.core.Keyword(null,"client.placeholder","client.placeholder",3878144834));
});
lt.objs.clients.swap_client_BANG_ = (function swap_client_BANG_(a,b){var seq__7607_7611 = cljs.core.seq.call(null,new cljs.core.Keyword(null,"queue","queue",1121848451).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,a)));var chunk__7608_7612 = null;var count__7609_7613 = 0;var i__7610_7614 = 0;while(true){
if((i__7610_7614 < count__7609_7613))
{var item_7615 = cljs.core._nth.call(null,chunk__7608_7612,i__7610_7614);lt.object.raise.call(null,b,new cljs.core.Keyword(null,"try-send!","try-send!",4325864057),item_7615);
{
var G__7616 = seq__7607_7611;
var G__7617 = chunk__7608_7612;
var G__7618 = count__7609_7613;
var G__7619 = (i__7610_7614 + 1);
seq__7607_7611 = G__7616;
chunk__7608_7612 = G__7617;
count__7609_7613 = G__7618;
i__7610_7614 = G__7619;
continue;
}
} else
{var temp__4092__auto___7620 = cljs.core.seq.call(null,seq__7607_7611);if(temp__4092__auto___7620)
{var seq__7607_7621__$1 = temp__4092__auto___7620;if(cljs.core.chunked_seq_QMARK_.call(null,seq__7607_7621__$1))
{var c__4262__auto___7622 = cljs.core.chunk_first.call(null,seq__7607_7621__$1);{
var G__7623 = cljs.core.chunk_rest.call(null,seq__7607_7621__$1);
var G__7624 = c__4262__auto___7622;
var G__7625 = cljs.core.count.call(null,c__4262__auto___7622);
var G__7626 = 0;
seq__7607_7611 = G__7623;
chunk__7608_7612 = G__7624;
count__7609_7613 = G__7625;
i__7610_7614 = G__7626;
continue;
}
} else
{var item_7627 = cljs.core.first.call(null,seq__7607_7621__$1);lt.object.raise.call(null,b,new cljs.core.Keyword(null,"try-send!","try-send!",4325864057),item_7627);
{
var G__7628 = cljs.core.next.call(null,seq__7607_7621__$1);
var G__7629 = null;
var G__7630 = 0;
var G__7631 = 0;
seq__7607_7611 = G__7628;
chunk__7608_7612 = G__7629;
count__7609_7613 = G__7630;
i__7610_7614 = G__7631;
continue;
}
}
} else
{}
}
break;
}
return lt.object.raise.call(null,a,new cljs.core.Keyword(null,"swapped","swapped",3497510414),b);
});
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","client","lt.objs.clients/client",613325584),new cljs.core.Keyword(null,"queue","queue",1121848451),cljs.core.PersistentVector.EMPTY,new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"client","client",3951159101),null], null), null));
lt.objs.clients.__BEH__try_send = (function __BEH__try_send(this$,msg){if(cljs.core.truth_(new cljs.core.Keyword(null,"connected","connected",4729661051).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"send!","send!",1123226891),msg);
} else
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"queue!","queue!",4360174754),msg);
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","try-send","lt.objs.clients/try-send",3878204287),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__try_send,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"try-send!","try-send!",4325864057),null], null), null));
lt.objs.clients.__BEH__queue_BANG_ = (function __BEH__queue_BANG_(this$,msg){return lt.object.update_BANG_.call(null,this$,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"queue","queue",1121848451)], null),cljs.core.conj,msg);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","queue!","lt.objs.clients/queue!",1558951525),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__queue_BANG_,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"queue!","queue!",4360174754),null], null), null));
lt.objs.clients.__BEH__on_connect_drain = (function __BEH__on_connect_drain(this$){lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"connected","connected",4729661051),true], null));
var seq__7636_7640 = cljs.core.seq.call(null,new cljs.core.Keyword(null,"queue","queue",1121848451).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));var chunk__7637_7641 = null;var count__7638_7642 = 0;var i__7639_7643 = 0;while(true){
if((i__7639_7643 < count__7638_7642))
{var q_7644 = cljs.core._nth.call(null,chunk__7637_7641,i__7639_7643);lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"send!","send!",1123226891),q_7644);
cljs.core.doall.call(null,cljs.core.range.call(null,10000));
{
var G__7645 = seq__7636_7640;
var G__7646 = chunk__7637_7641;
var G__7647 = count__7638_7642;
var G__7648 = (i__7639_7643 + 1);
seq__7636_7640 = G__7645;
chunk__7637_7641 = G__7646;
count__7638_7642 = G__7647;
i__7639_7643 = G__7648;
continue;
}
} else
{var temp__4092__auto___7649 = cljs.core.seq.call(null,seq__7636_7640);if(temp__4092__auto___7649)
{var seq__7636_7650__$1 = temp__4092__auto___7649;if(cljs.core.chunked_seq_QMARK_.call(null,seq__7636_7650__$1))
{var c__4262__auto___7651 = cljs.core.chunk_first.call(null,seq__7636_7650__$1);{
var G__7652 = cljs.core.chunk_rest.call(null,seq__7636_7650__$1);
var G__7653 = c__4262__auto___7651;
var G__7654 = cljs.core.count.call(null,c__4262__auto___7651);
var G__7655 = 0;
seq__7636_7640 = G__7652;
chunk__7637_7641 = G__7653;
count__7638_7642 = G__7654;
i__7639_7643 = G__7655;
continue;
}
} else
{var q_7656 = cljs.core.first.call(null,seq__7636_7650__$1);lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"send!","send!",1123226891),q_7656);
cljs.core.doall.call(null,cljs.core.range.call(null,10000));
{
var G__7657 = cljs.core.next.call(null,seq__7636_7650__$1);
var G__7658 = null;
var G__7659 = 0;
var G__7660 = 0;
seq__7636_7640 = G__7657;
chunk__7637_7641 = G__7658;
count__7638_7642 = G__7659;
i__7639_7643 = G__7660;
continue;
}
}
} else
{}
}
break;
}
return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"queue","queue",1121848451),cljs.core.PersistentVector.EMPTY], null));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","on-connect-drain","lt.objs.clients/on-connect-drain",776020788),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__on_connect_drain,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"connect","connect",1965255772),null], null), null));
lt.objs.clients.__BEH__remove_placeholder_on_swapped = (function __BEH__remove_placeholder_on_swapped(this$){return lt.object.destroy_BANG_.call(null,this$);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.clients","remove-placeholder-on-swapped","lt.objs.clients/remove-placeholder-on-swapped",1591563750),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.clients.__BEH__remove_placeholder_on_swapped,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"swapped","swapped",3497510414),null], null), null));
