// Compiled by ClojureScript 1.10.520 {:target :nodejs}
goog.provide('weathergen.ipc');
goog.require('cljs.core');
goog.require('weathergen.encoding');
weathergen.ipc.electron = require("electron");
weathergen.ipc.channel = "weathergen-ipc";
if((typeof weathergen !== 'undefined') && (typeof weathergen.ipc !== 'undefined') && (typeof weathergen.ipc.on_message !== 'undefined')){
} else {
weathergen.ipc.on_message = (function (){var method_table__4613__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var prefer_table__4614__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var method_cache__4615__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var cached_hierarchy__4616__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var hierarchy__4617__auto__ = cljs.core.get.call(null,cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"hierarchy","hierarchy",-1053470341),cljs.core.get_global_hierarchy.call(null));
return (new cljs.core.MultiFn(cljs.core.symbol.call(null,"weathergen.ipc","on-message"),((function (method_table__4613__auto__,prefer_table__4614__auto__,method_cache__4615__auto__,cached_hierarchy__4616__auto__,hierarchy__4617__auto__){
return (function() { 
var G__27292__delegate = function (type,event,args){
return type;
};
var G__27292 = function (type,event,var_args){
var args = null;
if (arguments.length > 2) {
var G__27293__i = 0, G__27293__a = new Array(arguments.length -  2);
while (G__27293__i < G__27293__a.length) {G__27293__a[G__27293__i] = arguments[G__27293__i + 2]; ++G__27293__i;}
  args = new cljs.core.IndexedSeq(G__27293__a,0,null);
} 
return G__27292__delegate.call(this,type,event,args);};
G__27292.cljs$lang$maxFixedArity = 2;
G__27292.cljs$lang$applyTo = (function (arglist__27294){
var type = cljs.core.first(arglist__27294);
arglist__27294 = cljs.core.next(arglist__27294);
var event = cljs.core.first(arglist__27294);
var args = cljs.core.rest(arglist__27294);
return G__27292__delegate(type,event,args);
});
G__27292.cljs$core$IFn$_invoke$arity$variadic = G__27292__delegate;
return G__27292;
})()
;})(method_table__4613__auto__,prefer_table__4614__auto__,method_cache__4615__auto__,cached_hierarchy__4616__auto__,hierarchy__4617__auto__))
,new cljs.core.Keyword(null,"default","default",-1987822328),hierarchy__4617__auto__,method_table__4613__auto__,prefer_table__4614__auto__,method_cache__4615__auto__,cached_hierarchy__4616__auto__));
})();
}
/**
 * Sends a message from a renderer process to the main process.
 */
weathergen.ipc.send_to_main = (function weathergen$ipc$send_to_main(var_args){
var args__4736__auto__ = [];
var len__4730__auto___27301 = arguments.length;
var i__4731__auto___27305 = (0);
while(true){
if((i__4731__auto___27305 < len__4730__auto___27301)){
args__4736__auto__.push((arguments[i__4731__auto___27305]));

var G__27307 = (i__4731__auto___27305 + (1));
i__4731__auto___27305 = G__27307;
continue;
} else {
}
break;
}

var argseq__4737__auto__ = ((((1) < args__4736__auto__.length))?(new cljs.core.IndexedSeq(args__4736__auto__.slice((1)),(0),null)):null);
return weathergen.ipc.send_to_main.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__4737__auto__);
});

weathergen.ipc.send_to_main.cljs$core$IFn$_invoke$arity$variadic = (function (type,args){
return cljs.core.apply.call(null,(function (){var G__27296 = weathergen.ipc.electron.ipcRenderer;
return G__27296;
})().send,weathergen.ipc.channel,type,cljs.core.map.call(null,weathergen.encoding.encode,args));
});

weathergen.ipc.send_to_main.cljs$lang$maxFixedArity = (1);

/** @this {Function} */
weathergen.ipc.send_to_main.cljs$lang$applyTo = (function (seq27287){
var G__27288 = cljs.core.first.call(null,seq27287);
var seq27287__$1 = cljs.core.next.call(null,seq27287);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__27288,seq27287__$1);
});

/**
 * Sends a message from the main process to a renderer process.
 */
weathergen.ipc.send_to_renderer = (function weathergen$ipc$send_to_renderer(var_args){
var args__4736__auto__ = [];
var len__4730__auto___27309 = arguments.length;
var i__4731__auto___27310 = (0);
while(true){
if((i__4731__auto___27310 < len__4730__auto___27309)){
args__4736__auto__.push((arguments[i__4731__auto___27310]));

var G__27311 = (i__4731__auto___27310 + (1));
i__4731__auto___27310 = G__27311;
continue;
} else {
}
break;
}

var argseq__4737__auto__ = ((((2) < args__4736__auto__.length))?(new cljs.core.IndexedSeq(args__4736__auto__.slice((2)),(0),null)):null);
return weathergen.ipc.send_to_renderer.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__4737__auto__);
});

weathergen.ipc.send_to_renderer.cljs$core$IFn$_invoke$arity$variadic = (function (window,type,args){
var wc = window.webContents;
var send = wc.send;
return send.apply(wc,cljs.core.clj__GT_js.call(null,cljs.core.into.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [weathergen.ipc.channel,type], null),cljs.core.map.call(null,weathergen.encoding.encode,args))));
});

weathergen.ipc.send_to_renderer.cljs$lang$maxFixedArity = (2);

/** @this {Function} */
weathergen.ipc.send_to_renderer.cljs$lang$applyTo = (function (seq27302){
var G__27303 = cljs.core.first.call(null,seq27302);
var seq27302__$1 = cljs.core.next.call(null,seq27302);
var G__27304 = cljs.core.first.call(null,seq27302__$1);
var seq27302__$2 = cljs.core.next.call(null,seq27302__$1);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__27303,G__27304,seq27302__$2);
});

weathergen.ipc.ipc = ((cljs.core._EQ_.call(null,undefined,weathergen.ipc.electron.ipcMain))?weathergen.ipc.electron.ipcRenderer:weathergen.ipc.electron.ipcMain);
weathergen.ipc.ipc.on(weathergen.ipc.channel,(function() { 
var G__27319__delegate = function (event,p__27312){
var vec__27313 = p__27312;
var seq__27314 = cljs.core.seq.call(null,vec__27313);
var first__27315 = cljs.core.first.call(null,seq__27314);
var seq__27314__$1 = cljs.core.next.call(null,seq__27314);
var type = first__27315;
var args = seq__27314__$1;
return cljs.core.apply.call(null,weathergen.ipc.on_message,type,event,cljs.core.map.call(null,weathergen.encoding.decode,args));
};
var G__27319 = function (event,var_args){
var p__27312 = null;
if (arguments.length > 1) {
var G__27320__i = 0, G__27320__a = new Array(arguments.length -  1);
while (G__27320__i < G__27320__a.length) {G__27320__a[G__27320__i] = arguments[G__27320__i + 1]; ++G__27320__i;}
  p__27312 = new cljs.core.IndexedSeq(G__27320__a,0,null);
} 
return G__27319__delegate.call(this,event,p__27312);};
G__27319.cljs$lang$maxFixedArity = 1;
G__27319.cljs$lang$applyTo = (function (arglist__27321){
var event = cljs.core.first(arglist__27321);
var p__27312 = cljs.core.rest(arglist__27321);
return G__27319__delegate(event,p__27312);
});
G__27319.cljs$core$IFn$_invoke$arity$variadic = G__27319__delegate;
return G__27319;
})()
);
