import "./cljs_env.js";
goog.provide('shadow.remote.runtime.shared');
shadow.remote.runtime.shared.init_state = (function shadow$remote$runtime$shared$init_state(client_info){
return new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"extensions","extensions",-1103629196),cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"ops","ops",1237330063),cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"client-info","client-info",1958982504),client_info,new cljs.core.Keyword(null,"call-id-seq","call-id-seq",-1679248218),(0),new cljs.core.Keyword(null,"call-handlers","call-handlers",386605551),cljs.core.PersistentArrayMap.EMPTY], null);
});
shadow.remote.runtime.shared.now = (function shadow$remote$runtime$shared$now(){
return Date.now();
});
shadow.remote.runtime.shared.relay_msg = (function shadow$remote$runtime$shared$relay_msg(runtime,msg){
return shadow.remote.runtime.api.relay_msg(runtime,msg);
});
shadow.remote.runtime.shared.reply = (function shadow$remote$runtime$shared$reply(runtime,p__52196,res){
var map__52197 = p__52196;
var map__52197__$1 = cljs.core.__destructure_map(map__52197);
var call_id = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52197__$1,new cljs.core.Keyword(null,"call-id","call-id",1043012968));
var from = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52197__$1,new cljs.core.Keyword(null,"from","from",1815293044));
var res__$1 = (function (){var G__52198 = res;
var G__52198__$1 = (cljs.core.truth_(call_id)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__52198,new cljs.core.Keyword(null,"call-id","call-id",1043012968),call_id):G__52198);
if(cljs.core.truth_(from)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__52198__$1,new cljs.core.Keyword(null,"to","to",192099007),from);
} else {
return G__52198__$1;
}
})();
return shadow.remote.runtime.api.relay_msg(runtime,res__$1);
});
shadow.remote.runtime.shared.call = (function shadow$remote$runtime$shared$call(var_args){
var G__52205 = arguments.length;
switch (G__52205) {
case 3:
return shadow.remote.runtime.shared.call.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
case 4:
return shadow.remote.runtime.shared.call.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('')));

}
});

(shadow.remote.runtime.shared.call.cljs$core$IFn$_invoke$arity$3 = (function (runtime,msg,handlers){
return shadow.remote.runtime.shared.call.cljs$core$IFn$_invoke$arity$4(runtime,msg,handlers,(0));
}));

(shadow.remote.runtime.shared.call.cljs$core$IFn$_invoke$arity$4 = (function (p__52215,msg,handlers,timeout_after_ms){
var map__52216 = p__52215;
var map__52216__$1 = cljs.core.__destructure_map(map__52216);
var runtime = map__52216__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52216__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var call_id = new cljs.core.Keyword(null,"call-id-seq","call-id-seq",-1679248218).cljs$core$IFn$_invoke$arity$1(cljs.core.deref(state_ref));
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(state_ref,cljs.core.update,new cljs.core.Keyword(null,"call-id-seq","call-id-seq",-1679248218),cljs.core.inc);

cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(state_ref,cljs.core.assoc_in,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"call-handlers","call-handlers",386605551),call_id], null),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"handlers","handlers",79528781),handlers,new cljs.core.Keyword(null,"called-at","called-at",607081160),shadow.remote.runtime.shared.now(),new cljs.core.Keyword(null,"msg","msg",-1386103444),msg,new cljs.core.Keyword(null,"timeout","timeout",-318625318),timeout_after_ms], null));

return shadow.remote.runtime.api.relay_msg(runtime,cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(msg,new cljs.core.Keyword(null,"call-id","call-id",1043012968),call_id));
}));

(shadow.remote.runtime.shared.call.cljs$lang$maxFixedArity = 4);

shadow.remote.runtime.shared.trigger_BANG_ = (function shadow$remote$runtime$shared$trigger_BANG_(var_args){
var args__4835__auto__ = [];
var len__4829__auto___52410 = arguments.length;
var i__4830__auto___52411 = (0);
while(true){
if((i__4830__auto___52411 < len__4829__auto___52410)){
args__4835__auto__.push((arguments[i__4830__auto___52411]));

var G__52414 = (i__4830__auto___52411 + (1));
i__4830__auto___52411 = G__52414;
continue;
} else {
}
break;
}

var argseq__4836__auto__ = ((((2) < args__4835__auto__.length))?(new cljs.core.IndexedSeq(args__4835__auto__.slice((2)),(0),null)):null);
return shadow.remote.runtime.shared.trigger_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__4836__auto__);
});

(shadow.remote.runtime.shared.trigger_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (p__52225,ev,args){
var map__52226 = p__52225;
var map__52226__$1 = cljs.core.__destructure_map(map__52226);
var runtime = map__52226__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52226__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var seq__52227 = cljs.core.seq(cljs.core.vals(new cljs.core.Keyword(null,"extensions","extensions",-1103629196).cljs$core$IFn$_invoke$arity$1(cljs.core.deref(state_ref))));
var chunk__52230 = null;
var count__52231 = (0);
var i__52232 = (0);
while(true){
if((i__52232 < count__52231)){
var ext = chunk__52230.cljs$core$IIndexed$_nth$arity$2(null,i__52232);
var ev_fn = cljs.core.get.cljs$core$IFn$_invoke$arity$2(ext,ev);
if(cljs.core.truth_(ev_fn)){
cljs.core.apply.cljs$core$IFn$_invoke$arity$2(ev_fn,args);


var G__52423 = seq__52227;
var G__52424 = chunk__52230;
var G__52425 = count__52231;
var G__52426 = (i__52232 + (1));
seq__52227 = G__52423;
chunk__52230 = G__52424;
count__52231 = G__52425;
i__52232 = G__52426;
continue;
} else {
var G__52427 = seq__52227;
var G__52428 = chunk__52230;
var G__52429 = count__52231;
var G__52430 = (i__52232 + (1));
seq__52227 = G__52427;
chunk__52230 = G__52428;
count__52231 = G__52429;
i__52232 = G__52430;
continue;
}
} else {
var temp__5753__auto__ = cljs.core.seq(seq__52227);
if(temp__5753__auto__){
var seq__52227__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__52227__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__52227__$1);
var G__52431 = cljs.core.chunk_rest(seq__52227__$1);
var G__52432 = c__4649__auto__;
var G__52433 = cljs.core.count(c__4649__auto__);
var G__52434 = (0);
seq__52227 = G__52431;
chunk__52230 = G__52432;
count__52231 = G__52433;
i__52232 = G__52434;
continue;
} else {
var ext = cljs.core.first(seq__52227__$1);
var ev_fn = cljs.core.get.cljs$core$IFn$_invoke$arity$2(ext,ev);
if(cljs.core.truth_(ev_fn)){
cljs.core.apply.cljs$core$IFn$_invoke$arity$2(ev_fn,args);


var G__52435 = cljs.core.next(seq__52227__$1);
var G__52436 = null;
var G__52437 = (0);
var G__52438 = (0);
seq__52227 = G__52435;
chunk__52230 = G__52436;
count__52231 = G__52437;
i__52232 = G__52438;
continue;
} else {
var G__52439 = cljs.core.next(seq__52227__$1);
var G__52440 = null;
var G__52441 = (0);
var G__52442 = (0);
seq__52227 = G__52439;
chunk__52230 = G__52440;
count__52231 = G__52441;
i__52232 = G__52442;
continue;
}
}
} else {
return null;
}
}
break;
}
}));

(shadow.remote.runtime.shared.trigger_BANG_.cljs$lang$maxFixedArity = (2));

/** @this {Function} */
(shadow.remote.runtime.shared.trigger_BANG_.cljs$lang$applyTo = (function (seq52218){
var G__52219 = cljs.core.first(seq52218);
var seq52218__$1 = cljs.core.next(seq52218);
var G__52220 = cljs.core.first(seq52218__$1);
var seq52218__$2 = cljs.core.next(seq52218__$1);
var self__4816__auto__ = this;
return self__4816__auto__.cljs$core$IFn$_invoke$arity$variadic(G__52219,G__52220,seq52218__$2);
}));

shadow.remote.runtime.shared.welcome = (function shadow$remote$runtime$shared$welcome(p__52288,p__52289){
var map__52290 = p__52288;
var map__52290__$1 = cljs.core.__destructure_map(map__52290);
var runtime = map__52290__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52290__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var map__52291 = p__52289;
var map__52291__$1 = cljs.core.__destructure_map(map__52291);
var msg = map__52291__$1;
var client_id = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52291__$1,new cljs.core.Keyword(null,"client-id","client-id",-464622140));
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(state_ref,cljs.core.assoc,new cljs.core.Keyword(null,"client-id","client-id",-464622140),client_id);

var map__52293 = cljs.core.deref(state_ref);
var map__52293__$1 = cljs.core.__destructure_map(map__52293);
var client_info = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52293__$1,new cljs.core.Keyword(null,"client-info","client-info",1958982504));
var extensions = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52293__$1,new cljs.core.Keyword(null,"extensions","extensions",-1103629196));
shadow.remote.runtime.shared.relay_msg(runtime,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"op","op",-1882987955),new cljs.core.Keyword(null,"hello","hello",-245025397),new cljs.core.Keyword(null,"client-info","client-info",1958982504),client_info], null));

return shadow.remote.runtime.shared.trigger_BANG_(runtime,new cljs.core.Keyword(null,"on-welcome","on-welcome",1895317125));
});
shadow.remote.runtime.shared.ping = (function shadow$remote$runtime$shared$ping(runtime,msg){
return shadow.remote.runtime.shared.reply(runtime,msg,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"op","op",-1882987955),new cljs.core.Keyword(null,"pong","pong",-172484958)], null));
});
shadow.remote.runtime.shared.get_client_id = (function shadow$remote$runtime$shared$get_client_id(p__52298){
var map__52299 = p__52298;
var map__52299__$1 = cljs.core.__destructure_map(map__52299);
var runtime = map__52299__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52299__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var or__4223__auto__ = new cljs.core.Keyword(null,"client-id","client-id",-464622140).cljs$core$IFn$_invoke$arity$1(cljs.core.deref(state_ref));
if(cljs.core.truth_(or__4223__auto__)){
return or__4223__auto__;
} else {
throw cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2("runtime has no assigned runtime-id",new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"runtime","runtime",-1331573996),runtime], null));
}
});
shadow.remote.runtime.shared.request_supported_ops = (function shadow$remote$runtime$shared$request_supported_ops(p__52304,msg){
var map__52305 = p__52304;
var map__52305__$1 = cljs.core.__destructure_map(map__52305);
var runtime = map__52305__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52305__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
return shadow.remote.runtime.shared.reply(runtime,msg,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"op","op",-1882987955),new cljs.core.Keyword(null,"supported-ops","supported-ops",337914702),new cljs.core.Keyword(null,"ops","ops",1237330063),cljs.core.disj.cljs$core$IFn$_invoke$arity$variadic(cljs.core.set(cljs.core.keys(new cljs.core.Keyword(null,"ops","ops",1237330063).cljs$core$IFn$_invoke$arity$1(cljs.core.deref(state_ref)))),new cljs.core.Keyword(null,"welcome","welcome",-578152123),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"unknown-relay-op","unknown-relay-op",170832753),new cljs.core.Keyword(null,"unknown-op","unknown-op",1900385996),new cljs.core.Keyword(null,"request-supported-ops","request-supported-ops",-1034994502),new cljs.core.Keyword(null,"tool-disconnect","tool-disconnect",189103996)], 0))], null));
});
shadow.remote.runtime.shared.unknown_relay_op = (function shadow$remote$runtime$shared$unknown_relay_op(msg){
return console.warn("unknown-relay-op",msg);
});
shadow.remote.runtime.shared.unknown_op = (function shadow$remote$runtime$shared$unknown_op(msg){
return console.warn("unknown-op",msg);
});
shadow.remote.runtime.shared.add_extension_STAR_ = (function shadow$remote$runtime$shared$add_extension_STAR_(p__52310,key,p__52311){
var map__52312 = p__52310;
var map__52312__$1 = cljs.core.__destructure_map(map__52312);
var state = map__52312__$1;
var extensions = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52312__$1,new cljs.core.Keyword(null,"extensions","extensions",-1103629196));
var map__52313 = p__52311;
var map__52313__$1 = cljs.core.__destructure_map(map__52313);
var spec = map__52313__$1;
var ops = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52313__$1,new cljs.core.Keyword(null,"ops","ops",1237330063));
if(cljs.core.contains_QMARK_(extensions,key)){
throw cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2("extension already registered",new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"key","key",-1516042587),key,new cljs.core.Keyword(null,"spec","spec",347520401),spec], null));
} else {
}

return cljs.core.reduce_kv((function (state__$1,op_kw,op_handler){
if(cljs.core.truth_(cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(state__$1,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"ops","ops",1237330063),op_kw], null)))){
throw cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2("op already registered",new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"key","key",-1516042587),key,new cljs.core.Keyword(null,"op","op",-1882987955),op_kw], null));
} else {
}

return cljs.core.assoc_in(state__$1,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"ops","ops",1237330063),op_kw], null),op_handler);
}),cljs.core.assoc_in(state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"extensions","extensions",-1103629196),key], null),spec),ops);
});
shadow.remote.runtime.shared.add_extension = (function shadow$remote$runtime$shared$add_extension(p__52322,key,spec){
var map__52323 = p__52322;
var map__52323__$1 = cljs.core.__destructure_map(map__52323);
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52323__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(state_ref,shadow.remote.runtime.shared.add_extension_STAR_,key,spec);
});
shadow.remote.runtime.shared.add_defaults = (function shadow$remote$runtime$shared$add_defaults(runtime){
return shadow.remote.runtime.shared.add_extension(runtime,new cljs.core.Keyword("shadow.remote.runtime.shared","defaults","shadow.remote.runtime.shared/defaults",-1821257543),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"ops","ops",1237330063),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"welcome","welcome",-578152123),(function (p1__52325_SHARP_){
return shadow.remote.runtime.shared.welcome(runtime,p1__52325_SHARP_);
}),new cljs.core.Keyword(null,"unknown-relay-op","unknown-relay-op",170832753),(function (p1__52326_SHARP_){
return shadow.remote.runtime.shared.unknown_relay_op(p1__52326_SHARP_);
}),new cljs.core.Keyword(null,"unknown-op","unknown-op",1900385996),(function (p1__52327_SHARP_){
return shadow.remote.runtime.shared.unknown_op(p1__52327_SHARP_);
}),new cljs.core.Keyword(null,"ping","ping",-1670114784),(function (p1__52328_SHARP_){
return shadow.remote.runtime.shared.ping(runtime,p1__52328_SHARP_);
}),new cljs.core.Keyword(null,"request-supported-ops","request-supported-ops",-1034994502),(function (p1__52329_SHARP_){
return shadow.remote.runtime.shared.request_supported_ops(runtime,p1__52329_SHARP_);
})], null)], null));
});
shadow.remote.runtime.shared.del_extension_STAR_ = (function shadow$remote$runtime$shared$del_extension_STAR_(state,key){
var ext = cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"extensions","extensions",-1103629196),key], null));
if(cljs.core.not(ext)){
return state;
} else {
return cljs.core.reduce_kv((function (state__$1,op_kw,op_handler){
return cljs.core.update_in.cljs$core$IFn$_invoke$arity$4(state__$1,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"ops","ops",1237330063)], null),cljs.core.dissoc,op_kw);
}),cljs.core.update.cljs$core$IFn$_invoke$arity$4(state,new cljs.core.Keyword(null,"extensions","extensions",-1103629196),cljs.core.dissoc,key),new cljs.core.Keyword(null,"ops","ops",1237330063).cljs$core$IFn$_invoke$arity$1(ext));
}
});
shadow.remote.runtime.shared.del_extension = (function shadow$remote$runtime$shared$del_extension(p__52335,key){
var map__52336 = p__52335;
var map__52336__$1 = cljs.core.__destructure_map(map__52336);
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52336__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(state_ref,shadow.remote.runtime.shared.del_extension_STAR_,key);
});
shadow.remote.runtime.shared.unhandled_call_result = (function shadow$remote$runtime$shared$unhandled_call_result(call_config,msg){
return console.warn("unhandled call result",msg,call_config);
});
shadow.remote.runtime.shared.unhandled_client_not_found = (function shadow$remote$runtime$shared$unhandled_client_not_found(p__52337,msg){
var map__52338 = p__52337;
var map__52338__$1 = cljs.core.__destructure_map(map__52338);
var runtime = map__52338__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52338__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
return shadow.remote.runtime.shared.trigger_BANG_.cljs$core$IFn$_invoke$arity$variadic(runtime,new cljs.core.Keyword(null,"on-client-not-found","on-client-not-found",-642452849),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([msg], 0));
});
shadow.remote.runtime.shared.reply_unknown_op = (function shadow$remote$runtime$shared$reply_unknown_op(runtime,msg){
return shadow.remote.runtime.shared.reply(runtime,msg,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"op","op",-1882987955),new cljs.core.Keyword(null,"unknown-op","unknown-op",1900385996),new cljs.core.Keyword(null,"msg","msg",-1386103444),msg], null));
});
shadow.remote.runtime.shared.process = (function shadow$remote$runtime$shared$process(p__52339,p__52340){
var map__52341 = p__52339;
var map__52341__$1 = cljs.core.__destructure_map(map__52341);
var runtime = map__52341__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52341__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var map__52342 = p__52340;
var map__52342__$1 = cljs.core.__destructure_map(map__52342);
var msg = map__52342__$1;
var op = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52342__$1,new cljs.core.Keyword(null,"op","op",-1882987955));
var call_id = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52342__$1,new cljs.core.Keyword(null,"call-id","call-id",1043012968));
var state = cljs.core.deref(state_ref);
var op_handler = cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"ops","ops",1237330063),op], null));
if(cljs.core.truth_(call_id)){
var cfg = cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"call-handlers","call-handlers",386605551),call_id], null));
var call_handler = cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(cfg,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"handlers","handlers",79528781),op], null));
if(cljs.core.truth_(call_handler)){
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$variadic(state_ref,cljs.core.update,new cljs.core.Keyword(null,"call-handlers","call-handlers",386605551),cljs.core.dissoc,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([call_id], 0));

return (call_handler.cljs$core$IFn$_invoke$arity$1 ? call_handler.cljs$core$IFn$_invoke$arity$1(msg) : call_handler.call(null,msg));
} else {
if(cljs.core.truth_(op_handler)){
return (op_handler.cljs$core$IFn$_invoke$arity$1 ? op_handler.cljs$core$IFn$_invoke$arity$1(msg) : op_handler.call(null,msg));
} else {
return shadow.remote.runtime.shared.unhandled_call_result(cfg,msg);

}
}
} else {
if(cljs.core.truth_(op_handler)){
return (op_handler.cljs$core$IFn$_invoke$arity$1 ? op_handler.cljs$core$IFn$_invoke$arity$1(msg) : op_handler.call(null,msg));
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"client-not-found","client-not-found",-1754042614),op)){
return shadow.remote.runtime.shared.unhandled_client_not_found(runtime,msg);
} else {
return shadow.remote.runtime.shared.reply_unknown_op(runtime,msg);

}
}
}
});
shadow.remote.runtime.shared.run_on_idle = (function shadow$remote$runtime$shared$run_on_idle(state_ref){
var seq__52343 = cljs.core.seq(cljs.core.vals(new cljs.core.Keyword(null,"extensions","extensions",-1103629196).cljs$core$IFn$_invoke$arity$1(cljs.core.deref(state_ref))));
var chunk__52345 = null;
var count__52346 = (0);
var i__52347 = (0);
while(true){
if((i__52347 < count__52346)){
var map__52351 = chunk__52345.cljs$core$IIndexed$_nth$arity$2(null,i__52347);
var map__52351__$1 = cljs.core.__destructure_map(map__52351);
var on_idle = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52351__$1,new cljs.core.Keyword(null,"on-idle","on-idle",2044706602));
if(cljs.core.truth_(on_idle)){
(on_idle.cljs$core$IFn$_invoke$arity$0 ? on_idle.cljs$core$IFn$_invoke$arity$0() : on_idle.call(null));


var G__52532 = seq__52343;
var G__52533 = chunk__52345;
var G__52534 = count__52346;
var G__52535 = (i__52347 + (1));
seq__52343 = G__52532;
chunk__52345 = G__52533;
count__52346 = G__52534;
i__52347 = G__52535;
continue;
} else {
var G__52536 = seq__52343;
var G__52537 = chunk__52345;
var G__52538 = count__52346;
var G__52539 = (i__52347 + (1));
seq__52343 = G__52536;
chunk__52345 = G__52537;
count__52346 = G__52538;
i__52347 = G__52539;
continue;
}
} else {
var temp__5753__auto__ = cljs.core.seq(seq__52343);
if(temp__5753__auto__){
var seq__52343__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__52343__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__52343__$1);
var G__52540 = cljs.core.chunk_rest(seq__52343__$1);
var G__52541 = c__4649__auto__;
var G__52542 = cljs.core.count(c__4649__auto__);
var G__52543 = (0);
seq__52343 = G__52540;
chunk__52345 = G__52541;
count__52346 = G__52542;
i__52347 = G__52543;
continue;
} else {
var map__52352 = cljs.core.first(seq__52343__$1);
var map__52352__$1 = cljs.core.__destructure_map(map__52352);
var on_idle = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__52352__$1,new cljs.core.Keyword(null,"on-idle","on-idle",2044706602));
if(cljs.core.truth_(on_idle)){
(on_idle.cljs$core$IFn$_invoke$arity$0 ? on_idle.cljs$core$IFn$_invoke$arity$0() : on_idle.call(null));


var G__52544 = cljs.core.next(seq__52343__$1);
var G__52545 = null;
var G__52546 = (0);
var G__52547 = (0);
seq__52343 = G__52544;
chunk__52345 = G__52545;
count__52346 = G__52546;
i__52347 = G__52547;
continue;
} else {
var G__52548 = cljs.core.next(seq__52343__$1);
var G__52549 = null;
var G__52550 = (0);
var G__52551 = (0);
seq__52343 = G__52548;
chunk__52345 = G__52549;
count__52346 = G__52550;
i__52347 = G__52551;
continue;
}
}
} else {
return null;
}
}
break;
}
});

//# sourceMappingURL=shadow.remote.runtime.shared.js.map
