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__77602,res){
var map__77603 = p__77602;
var map__77603__$1 = cljs.core.__destructure_map(map__77603);
var call_id = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77603__$1,new cljs.core.Keyword(null,"call-id","call-id",1043012968));
var from = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77603__$1,new cljs.core.Keyword(null,"from","from",1815293044));
var res__$1 = (function (){var G__77604 = res;
var G__77604__$1 = (cljs.core.truth_(call_id)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__77604,new cljs.core.Keyword(null,"call-id","call-id",1043012968),call_id):G__77604);
if(cljs.core.truth_(from)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__77604__$1,new cljs.core.Keyword(null,"to","to",192099007),from);
} else {
return G__77604__$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__77607 = arguments.length;
switch (G__77607) {
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__77608,msg,handlers,timeout_after_ms){
var map__77609 = p__77608;
var map__77609__$1 = cljs.core.__destructure_map(map__77609);
var runtime = map__77609__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77609__$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___77886 = arguments.length;
var i__4830__auto___77887 = (0);
while(true){
if((i__4830__auto___77887 < len__4829__auto___77886)){
args__4835__auto__.push((arguments[i__4830__auto___77887]));

var G__77888 = (i__4830__auto___77887 + (1));
i__4830__auto___77887 = G__77888;
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__77694,ev,args){
var map__77695 = p__77694;
var map__77695__$1 = cljs.core.__destructure_map(map__77695);
var runtime = map__77695__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77695__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var seq__77697 = 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__77701 = null;
var count__77702 = (0);
var i__77703 = (0);
while(true){
if((i__77703 < count__77702)){
var ext = chunk__77701.cljs$core$IIndexed$_nth$arity$2(null,i__77703);
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__77889 = seq__77697;
var G__77890 = chunk__77701;
var G__77891 = count__77702;
var G__77892 = (i__77703 + (1));
seq__77697 = G__77889;
chunk__77701 = G__77890;
count__77702 = G__77891;
i__77703 = G__77892;
continue;
} else {
var G__77893 = seq__77697;
var G__77894 = chunk__77701;
var G__77895 = count__77702;
var G__77896 = (i__77703 + (1));
seq__77697 = G__77893;
chunk__77701 = G__77894;
count__77702 = G__77895;
i__77703 = G__77896;
continue;
}
} else {
var temp__5753__auto__ = cljs.core.seq(seq__77697);
if(temp__5753__auto__){
var seq__77697__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__77697__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__77697__$1);
var G__77897 = cljs.core.chunk_rest(seq__77697__$1);
var G__77898 = c__4649__auto__;
var G__77899 = cljs.core.count(c__4649__auto__);
var G__77900 = (0);
seq__77697 = G__77897;
chunk__77701 = G__77898;
count__77702 = G__77899;
i__77703 = G__77900;
continue;
} else {
var ext = cljs.core.first(seq__77697__$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__77901 = cljs.core.next(seq__77697__$1);
var G__77902 = null;
var G__77903 = (0);
var G__77904 = (0);
seq__77697 = G__77901;
chunk__77701 = G__77902;
count__77702 = G__77903;
i__77703 = G__77904;
continue;
} else {
var G__77905 = cljs.core.next(seq__77697__$1);
var G__77906 = null;
var G__77907 = (0);
var G__77908 = (0);
seq__77697 = G__77905;
chunk__77701 = G__77906;
count__77702 = G__77907;
i__77703 = G__77908;
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 (seq77645){
var G__77646 = cljs.core.first(seq77645);
var seq77645__$1 = cljs.core.next(seq77645);
var G__77647 = cljs.core.first(seq77645__$1);
var seq77645__$2 = cljs.core.next(seq77645__$1);
var self__4816__auto__ = this;
return self__4816__auto__.cljs$core$IFn$_invoke$arity$variadic(G__77646,G__77647,seq77645__$2);
}));

shadow.remote.runtime.shared.welcome = (function shadow$remote$runtime$shared$welcome(p__77734,p__77735){
var map__77738 = p__77734;
var map__77738__$1 = cljs.core.__destructure_map(map__77738);
var runtime = map__77738__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77738__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var map__77739 = p__77735;
var map__77739__$1 = cljs.core.__destructure_map(map__77739);
var msg = map__77739__$1;
var client_id = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77739__$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__77750 = cljs.core.deref(state_ref);
var map__77750__$1 = cljs.core.__destructure_map(map__77750);
var client_info = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77750__$1,new cljs.core.Keyword(null,"client-info","client-info",1958982504));
var extensions = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77750__$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__77776){
var map__77777 = p__77776;
var map__77777__$1 = cljs.core.__destructure_map(map__77777);
var runtime = map__77777__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77777__$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__77780,msg){
var map__77781 = p__77780;
var map__77781__$1 = cljs.core.__destructure_map(map__77781);
var runtime = map__77781__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77781__$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__77796,key,p__77797){
var map__77798 = p__77796;
var map__77798__$1 = cljs.core.__destructure_map(map__77798);
var state = map__77798__$1;
var extensions = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77798__$1,new cljs.core.Keyword(null,"extensions","extensions",-1103629196));
var map__77799 = p__77797;
var map__77799__$1 = cljs.core.__destructure_map(map__77799);
var spec = map__77799__$1;
var ops = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77799__$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__77804,key,spec){
var map__77805 = p__77804;
var map__77805__$1 = cljs.core.__destructure_map(map__77805);
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77805__$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__77806_SHARP_){
return shadow.remote.runtime.shared.welcome(runtime,p1__77806_SHARP_);
}),new cljs.core.Keyword(null,"unknown-relay-op","unknown-relay-op",170832753),(function (p1__77807_SHARP_){
return shadow.remote.runtime.shared.unknown_relay_op(p1__77807_SHARP_);
}),new cljs.core.Keyword(null,"unknown-op","unknown-op",1900385996),(function (p1__77808_SHARP_){
return shadow.remote.runtime.shared.unknown_op(p1__77808_SHARP_);
}),new cljs.core.Keyword(null,"ping","ping",-1670114784),(function (p1__77809_SHARP_){
return shadow.remote.runtime.shared.ping(runtime,p1__77809_SHARP_);
}),new cljs.core.Keyword(null,"request-supported-ops","request-supported-ops",-1034994502),(function (p1__77810_SHARP_){
return shadow.remote.runtime.shared.request_supported_ops(runtime,p1__77810_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__77815,key){
var map__77816 = p__77815;
var map__77816__$1 = cljs.core.__destructure_map(map__77816);
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77816__$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__77821,msg){
var map__77822 = p__77821;
var map__77822__$1 = cljs.core.__destructure_map(map__77822);
var runtime = map__77822__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77822__$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__77825,p__77826){
var map__77827 = p__77825;
var map__77827__$1 = cljs.core.__destructure_map(map__77827);
var runtime = map__77827__$1;
var state_ref = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77827__$1,new cljs.core.Keyword(null,"state-ref","state-ref",2127874952));
var map__77828 = p__77826;
var map__77828__$1 = cljs.core.__destructure_map(map__77828);
var msg = map__77828__$1;
var op = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77828__$1,new cljs.core.Keyword(null,"op","op",-1882987955));
var call_id = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77828__$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__77830 = 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__77832 = null;
var count__77833 = (0);
var i__77834 = (0);
while(true){
if((i__77834 < count__77833)){
var map__77851 = chunk__77832.cljs$core$IIndexed$_nth$arity$2(null,i__77834);
var map__77851__$1 = cljs.core.__destructure_map(map__77851);
var on_idle = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77851__$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__77996 = seq__77830;
var G__77997 = chunk__77832;
var G__77998 = count__77833;
var G__77999 = (i__77834 + (1));
seq__77830 = G__77996;
chunk__77832 = G__77997;
count__77833 = G__77998;
i__77834 = G__77999;
continue;
} else {
var G__78000 = seq__77830;
var G__78001 = chunk__77832;
var G__78002 = count__77833;
var G__78003 = (i__77834 + (1));
seq__77830 = G__78000;
chunk__77832 = G__78001;
count__77833 = G__78002;
i__77834 = G__78003;
continue;
}
} else {
var temp__5753__auto__ = cljs.core.seq(seq__77830);
if(temp__5753__auto__){
var seq__77830__$1 = temp__5753__auto__;
if(cljs.core.chunked_seq_QMARK_(seq__77830__$1)){
var c__4649__auto__ = cljs.core.chunk_first(seq__77830__$1);
var G__78005 = cljs.core.chunk_rest(seq__77830__$1);
var G__78006 = c__4649__auto__;
var G__78007 = cljs.core.count(c__4649__auto__);
var G__78008 = (0);
seq__77830 = G__78005;
chunk__77832 = G__78006;
count__77833 = G__78007;
i__77834 = G__78008;
continue;
} else {
var map__77862 = cljs.core.first(seq__77830__$1);
var map__77862__$1 = cljs.core.__destructure_map(map__77862);
var on_idle = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__77862__$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__78011 = cljs.core.next(seq__77830__$1);
var G__78012 = null;
var G__78013 = (0);
var G__78014 = (0);
seq__77830 = G__78011;
chunk__77832 = G__78012;
count__77833 = G__78013;
i__77834 = G__78014;
continue;
} else {
var G__78015 = cljs.core.next(seq__77830__$1);
var G__78016 = null;
var G__78017 = (0);
var G__78018 = (0);
seq__77830 = G__78015;
chunk__77832 = G__78016;
count__77833 = G__78017;
i__77834 = G__78018;
continue;
}
}
} else {
return null;
}
}
break;
}
});

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