// Compiled by ClojureScript 1.10.520 {}
goog.provide('weathergen.ui.tabs');
goog.require('cljs.core');
goog.require('weathergen.ui.common');
goog.require('hoplon.core');
goog.require('javelin.core');
/**
 * Renders a tab control. `selected` is a cell containing the ID of
 *   the currently selected tab. `tabs` is a vector of maps describing
 *   the tabs.
 * 
 *   `:tab-background` - background color of tabs
 * 
 *   Keys include:
 * 
 *   `:id` - Unique ID for the tab.
 *   `:title` - Title for the tab.
 *   `:ui` - Content for the tab.
 *   `:hidden?` - A cell for whether the tab is hidden or not
 *   
 * @param {...*} var_args
 */
weathergen.ui.tabs.tabs = (function() { 
var weathergen$ui$tabs$tabs__delegate = function (args__30233__auto__){
var vec__35851 = hoplon.core.parse_args.call(null,args__30233__auto__);
var attrs = cljs.core.nth.call(null,vec__35851,(0),null);
var _ = cljs.core.nth.call(null,vec__35851,(1),null);
var map__35854 = attrs;
var map__35854__$1 = (((((!((map__35854 == null))))?(((((map__35854.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35854.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35854):map__35854);
var tab_background = cljs.core.get.call(null,map__35854__$1,new cljs.core.Keyword(null,"tab-background","tab-background",-2049748774));
var selected = cljs.core.get.call(null,map__35854__$1,new cljs.core.Keyword(null,"selected","selected",574897764));
var tabs = cljs.core.get.call(null,map__35854__$1,new cljs.core.Keyword(null,"tabs","tabs",-779855354));
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"tab-background","tab-background",-2049748774),new cljs.core.Keyword(null,"selected","selected",574897764),new cljs.core.Keyword(null,"tabs","tabs",-779855354));
var seq__35856_35890 = cljs.core.seq.call(null,tabs);
var chunk__35857_35891 = null;
var count__35858_35892 = (0);
var i__35859_35893 = (0);
while(true){
if((i__35859_35893 < count__35858_35892)){
var map__35864_35894 = cljs.core._nth.call(null,chunk__35857_35891,i__35859_35893);
var map__35864_35895__$1 = (((((!((map__35864_35894 == null))))?(((((map__35864_35894.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35864_35894.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35864_35894):map__35864_35894);
var id_35896 = cljs.core.get.call(null,map__35864_35895__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var hidden_QMARK__35897 = cljs.core.get.call(null,map__35864_35895__$1,new cljs.core.Keyword(null,"hidden?","hidden?",1339691380));
if(cljs.core.truth_(hidden_QMARK__35897)){
cljs.core.add_watch.call(null,hidden_QMARK__35897,cljs.core.gensym.call(null),((function (seq__35856_35890,chunk__35857_35891,count__35858_35892,i__35859_35893,map__35864_35894,map__35864_35895__$1,id_35896,hidden_QMARK__35897,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (___$1,___$2,___$3,n){
if(cljs.core.truth_((function (){var and__4120__auto__ = n;
if(cljs.core.truth_(and__4120__auto__)){
return cljs.core._EQ_.call(null,id_35896,cljs.core.deref.call(null,selected));
} else {
return and__4120__auto__;
}
})())){
return cljs.core.reset_BANG_.call(null,selected,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,tabs)));
} else {
return null;
}
});})(seq__35856_35890,chunk__35857_35891,count__35858_35892,i__35859_35893,map__35864_35894,map__35864_35895__$1,id_35896,hidden_QMARK__35897,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
);
} else {
}


var G__35898 = seq__35856_35890;
var G__35899 = chunk__35857_35891;
var G__35900 = count__35858_35892;
var G__35901 = (i__35859_35893 + (1));
seq__35856_35890 = G__35898;
chunk__35857_35891 = G__35899;
count__35858_35892 = G__35900;
i__35859_35893 = G__35901;
continue;
} else {
var temp__5720__auto___35902 = cljs.core.seq.call(null,seq__35856_35890);
if(temp__5720__auto___35902){
var seq__35856_35903__$1 = temp__5720__auto___35902;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__35856_35903__$1)){
var c__4550__auto___35904 = cljs.core.chunk_first.call(null,seq__35856_35903__$1);
var G__35905 = cljs.core.chunk_rest.call(null,seq__35856_35903__$1);
var G__35906 = c__4550__auto___35904;
var G__35907 = cljs.core.count.call(null,c__4550__auto___35904);
var G__35908 = (0);
seq__35856_35890 = G__35905;
chunk__35857_35891 = G__35906;
count__35858_35892 = G__35907;
i__35859_35893 = G__35908;
continue;
} else {
var map__35866_35909 = cljs.core.first.call(null,seq__35856_35903__$1);
var map__35866_35910__$1 = (((((!((map__35866_35909 == null))))?(((((map__35866_35909.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35866_35909.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35866_35909):map__35866_35909);
var id_35911 = cljs.core.get.call(null,map__35866_35910__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var hidden_QMARK__35912 = cljs.core.get.call(null,map__35866_35910__$1,new cljs.core.Keyword(null,"hidden?","hidden?",1339691380));
if(cljs.core.truth_(hidden_QMARK__35912)){
cljs.core.add_watch.call(null,hidden_QMARK__35912,cljs.core.gensym.call(null),((function (seq__35856_35890,chunk__35857_35891,count__35858_35892,i__35859_35893,map__35866_35909,map__35866_35910__$1,id_35911,hidden_QMARK__35912,seq__35856_35903__$1,temp__5720__auto___35902,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (___$1,___$2,___$3,n){
if(cljs.core.truth_((function (){var and__4120__auto__ = n;
if(cljs.core.truth_(and__4120__auto__)){
return cljs.core._EQ_.call(null,id_35911,cljs.core.deref.call(null,selected));
} else {
return and__4120__auto__;
}
})())){
return cljs.core.reset_BANG_.call(null,selected,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(cljs.core.first.call(null,tabs)));
} else {
return null;
}
});})(seq__35856_35890,chunk__35857_35891,count__35858_35892,i__35859_35893,map__35866_35909,map__35866_35910__$1,id_35911,hidden_QMARK__35912,seq__35856_35903__$1,temp__5720__auto___35902,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
);
} else {
}


var G__35913 = cljs.core.next.call(null,seq__35856_35903__$1);
var G__35914 = null;
var G__35915 = (0);
var G__35916 = (0);
seq__35856_35890 = G__35913;
chunk__35857_35891 = G__35914;
count__35858_35892 = G__35915;
i__35859_35893 = G__35916;
continue;
}
} else {
}
}
break;
}

return hoplon.core.div.call(null,hoplon.core.div.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"buttons and spacer",new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"position","position",-2011731912),"sticky",new cljs.core.Keyword(null,"top","top",-1856271961),(0),new cljs.core.Keyword(null,"background","background",-863952629),tab_background,new cljs.core.Keyword(null,"z-index","z-index",1892827090),(100)], null),hoplon.core.div.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"tab buttons",new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"border-bottom-width","border-bottom-width",-1417262769),weathergen.ui.common.px.call(null,(1)),new cljs.core.Keyword(null,"border-bottom-style","border-bottom-style",925668932),"solid",new cljs.core.Keyword(null,"border-bottom-color","border-bottom-color",-208763333),"lightgray"], null),(function (){var iter__4523__auto__ = ((function (map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function weathergen$ui$tabs$tabs_$_iter__35868(s__35869){
return (new cljs.core.LazySeq(null,((function (map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (){
var s__35869__$1 = s__35869;
while(true){
var temp__5720__auto__ = cljs.core.seq.call(null,s__35869__$1);
if(temp__5720__auto__){
var s__35869__$2 = temp__5720__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__35869__$2)){
var c__4521__auto__ = cljs.core.chunk_first.call(null,s__35869__$2);
var size__4522__auto__ = cljs.core.count.call(null,c__4521__auto__);
var b__35871 = cljs.core.chunk_buffer.call(null,size__4522__auto__);
if((function (){var i__35870 = (0);
while(true){
if((i__35870 < size__4522__auto__)){
var map__35872 = cljs.core._nth.call(null,c__4521__auto__,i__35870);
var map__35872__$1 = (((((!((map__35872 == null))))?(((((map__35872.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35872.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35872):map__35872);
var title = cljs.core.get.call(null,map__35872__$1,new cljs.core.Keyword(null,"title","title",636505583));
var id = cljs.core.get.call(null,map__35872__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var hidden_QMARK_ = cljs.core.get.call(null,map__35872__$1,new cljs.core.Keyword(null,"hidden?","hidden?",1339691380));
cljs.core.chunk_append.call(null,b__35871,hoplon.core.div.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (i__35870,map__35872,map__35872__$1,title,id,hidden_QMARK_,c__4521__auto__,size__4522__auto__,b__35871,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (){
return cljs.core.reset_BANG_.call(null,selected,id);
});})(i__35870,map__35872,map__35872__$1,title,id,hidden_QMARK_,c__4521__auto__,size__4522__auto__,b__35871,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (i__35870,map__35872,map__35872__$1,title,id,hidden_QMARK_,c__4521__auto__,size__4522__auto__,b__35871,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (selected__$1,hidden_QMARK___$1){
var selected_QMARK_ = cljs.core._EQ_.call(null,selected__$1,id);
return cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"border-style","border-style",-485574304),new cljs.core.Keyword(null,"border-bottom-style","border-bottom-style",925668932),new cljs.core.Keyword(null,"color","color",1011675173),new cljs.core.Keyword(null,"font-size","font-size",-1847940346),new cljs.core.Keyword(null,"border-top-right-radius","border-top-right-radius",1678770792),new cljs.core.Keyword(null,"background","background",-863952629),new cljs.core.Keyword(null,"cursor","cursor",1011937484),new cljs.core.Keyword(null,"border-top-left-radius","border-top-left-radius",1361811342),new cljs.core.Keyword(null,"border-width","border-width",-1512605390),new cljs.core.Keyword(null,"padding","padding",1660304693),new cljs.core.Keyword(null,"border-color","border-color",-2059162761),new cljs.core.Keyword(null,"display","display",242065432),new cljs.core.Keyword(null,"user-select","user-select",-346451650)],["solid","none",((cljs.core._EQ_.call(null,selected__$1,id))?"white":"#737373"),weathergen.ui.common.pct.call(null,(120)),weathergen.ui.common.px.call(null,(5)),((selected_QMARK_)?"black":null),"pointer",weathergen.ui.common.px.call(null,(5)),weathergen.ui.common.px.call(null,(1)),weathergen.ui.common.px.call(null,(0),(10),(3),(10)),((selected_QMARK_)?"black":"lightgray"),(cljs.core.truth_(hidden_QMARK___$1)?"none":"inline-block"),"none"]);
});})(i__35870,map__35872,map__35872__$1,title,id,hidden_QMARK_,c__4521__auto__,size__4522__auto__,b__35871,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
).call(null,selected,hidden_QMARK_),title));

var G__35917 = (i__35870 + (1));
i__35870 = G__35917;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35871),weathergen$ui$tabs$tabs_$_iter__35868.call(null,cljs.core.chunk_rest.call(null,s__35869__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35871),null);
}
} else {
var map__35874 = cljs.core.first.call(null,s__35869__$2);
var map__35874__$1 = (((((!((map__35874 == null))))?(((((map__35874.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35874.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35874):map__35874);
var title = cljs.core.get.call(null,map__35874__$1,new cljs.core.Keyword(null,"title","title",636505583));
var id = cljs.core.get.call(null,map__35874__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var hidden_QMARK_ = cljs.core.get.call(null,map__35874__$1,new cljs.core.Keyword(null,"hidden?","hidden?",1339691380));
return cljs.core.cons.call(null,hoplon.core.div.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (map__35874,map__35874__$1,title,id,hidden_QMARK_,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (){
return cljs.core.reset_BANG_.call(null,selected,id);
});})(map__35874,map__35874__$1,title,id,hidden_QMARK_,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (map__35874,map__35874__$1,title,id,hidden_QMARK_,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (selected__$1,hidden_QMARK___$1){
var selected_QMARK_ = cljs.core._EQ_.call(null,selected__$1,id);
return cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"border-style","border-style",-485574304),new cljs.core.Keyword(null,"border-bottom-style","border-bottom-style",925668932),new cljs.core.Keyword(null,"color","color",1011675173),new cljs.core.Keyword(null,"font-size","font-size",-1847940346),new cljs.core.Keyword(null,"border-top-right-radius","border-top-right-radius",1678770792),new cljs.core.Keyword(null,"background","background",-863952629),new cljs.core.Keyword(null,"cursor","cursor",1011937484),new cljs.core.Keyword(null,"border-top-left-radius","border-top-left-radius",1361811342),new cljs.core.Keyword(null,"border-width","border-width",-1512605390),new cljs.core.Keyword(null,"padding","padding",1660304693),new cljs.core.Keyword(null,"border-color","border-color",-2059162761),new cljs.core.Keyword(null,"display","display",242065432),new cljs.core.Keyword(null,"user-select","user-select",-346451650)],["solid","none",((cljs.core._EQ_.call(null,selected__$1,id))?"white":"#737373"),weathergen.ui.common.pct.call(null,(120)),weathergen.ui.common.px.call(null,(5)),((selected_QMARK_)?"black":null),"pointer",weathergen.ui.common.px.call(null,(5)),weathergen.ui.common.px.call(null,(1)),weathergen.ui.common.px.call(null,(0),(10),(3),(10)),((selected_QMARK_)?"black":"lightgray"),(cljs.core.truth_(hidden_QMARK___$1)?"none":"inline-block"),"none"]);
});})(map__35874,map__35874__$1,title,id,hidden_QMARK_,s__35869__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
).call(null,selected,hidden_QMARK_),title),weathergen$ui$tabs$tabs_$_iter__35868.call(null,cljs.core.rest.call(null,s__35869__$2)));
}
} else {
return null;
}
break;
}
});})(map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
,null,null));
});})(map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
;
return iter__4523__auto__.call(null,tabs);
})()),hoplon.core.div.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"spacer",new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"background","background",-863952629),tab_background,new cljs.core.Keyword(null,"height","height",1025178622),weathergen.ui.common.px.call(null,(3))], null))),(function (){var iter__4523__auto__ = ((function (map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function weathergen$ui$tabs$tabs_$_iter__35876(s__35877){
return (new cljs.core.LazySeq(null,((function (map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (){
var s__35877__$1 = s__35877;
while(true){
var temp__5720__auto__ = cljs.core.seq.call(null,s__35877__$1);
if(temp__5720__auto__){
var s__35877__$2 = temp__5720__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__35877__$2)){
var c__4521__auto__ = cljs.core.chunk_first.call(null,s__35877__$2);
var size__4522__auto__ = cljs.core.count.call(null,c__4521__auto__);
var b__35879 = cljs.core.chunk_buffer.call(null,size__4522__auto__);
if((function (){var i__35878 = (0);
while(true){
if((i__35878 < size__4522__auto__)){
var map__35880 = cljs.core._nth.call(null,c__4521__auto__,i__35878);
var map__35880__$1 = (((((!((map__35880 == null))))?(((((map__35880.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35880.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35880):map__35880);
var id = cljs.core.get.call(null,map__35880__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var ui = cljs.core.get.call(null,map__35880__$1,new cljs.core.Keyword(null,"ui","ui",-469653645));
cljs.core.chunk_append.call(null,b__35879,hoplon.core.div.call(null,new cljs.core.Keyword(null,"toggle","toggle",1291842030),javelin.core.formula.call(null,((function (i__35878,map__35880,map__35880__$1,id,ui,c__4521__auto__,size__4522__auto__,b__35879,s__35877__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (G__35882,G__35884,G__35883){
return G__35882.call(null,G__35883,G__35884);
});})(i__35878,map__35880,map__35880__$1,id,ui,c__4521__auto__,size__4522__auto__,b__35879,s__35877__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
).call(null,cljs.core._EQ_,selected,id),ui));

var G__35918 = (i__35878 + (1));
i__35878 = G__35918;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35879),weathergen$ui$tabs$tabs_$_iter__35876.call(null,cljs.core.chunk_rest.call(null,s__35877__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__35879),null);
}
} else {
var map__35885 = cljs.core.first.call(null,s__35877__$2);
var map__35885__$1 = (((((!((map__35885 == null))))?(((((map__35885.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35885.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35885):map__35885);
var id = cljs.core.get.call(null,map__35885__$1,new cljs.core.Keyword(null,"id","id",-1388402092));
var ui = cljs.core.get.call(null,map__35885__$1,new cljs.core.Keyword(null,"ui","ui",-469653645));
return cljs.core.cons.call(null,hoplon.core.div.call(null,new cljs.core.Keyword(null,"toggle","toggle",1291842030),javelin.core.formula.call(null,((function (map__35885,map__35885__$1,id,ui,s__35877__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_){
return (function (G__35887,G__35889,G__35888){
return G__35887.call(null,G__35888,G__35889);
});})(map__35885,map__35885__$1,id,ui,s__35877__$2,temp__5720__auto__,map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
).call(null,cljs.core._EQ_,selected,id),ui),weathergen$ui$tabs$tabs_$_iter__35876.call(null,cljs.core.rest.call(null,s__35877__$2)));
}
} else {
return null;
}
break;
}
});})(map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
,null,null));
});})(map__35854,map__35854__$1,tab_background,selected,tabs,attrs__$1,vec__35851,attrs,_))
;
return iter__4523__auto__.call(null,tabs);
})());
};
var weathergen$ui$tabs$tabs = function (var_args){
var args__30233__auto__ = null;
if (arguments.length > 0) {
var G__35919__i = 0, G__35919__a = new Array(arguments.length -  0);
while (G__35919__i < G__35919__a.length) {G__35919__a[G__35919__i] = arguments[G__35919__i + 0]; ++G__35919__i;}
  args__30233__auto__ = new cljs.core.IndexedSeq(G__35919__a,0,null);
} 
return weathergen$ui$tabs$tabs__delegate.call(this,args__30233__auto__);};
weathergen$ui$tabs$tabs.cljs$lang$maxFixedArity = 0;
weathergen$ui$tabs$tabs.cljs$lang$applyTo = (function (arglist__35920){
var args__30233__auto__ = cljs.core.seq(arglist__35920);
return weathergen$ui$tabs$tabs__delegate(args__30233__auto__);
});
weathergen$ui$tabs$tabs.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$tabs$tabs__delegate;
return weathergen$ui$tabs$tabs;
})()
;
/**
 * Renders a tab control like `tabs`, but allows for dynamic tabs. Attributes:
 * 
 *   `data` - a cell containing one item per tab.
 *   `key-fn` - function from item in `data` to a unique, immutable key for it.
 *   `value` - the value of `key-fn` for the currently displayed tab
 *   `formatter` - A function from a cell of one item in `data` to UI for that item.
 *   `title-formatter` - A function from a cell of one item in `data` to UI for the title.
 *   `tab-background` - the background color of tabs.
 * @param {...*} var_args
 */
weathergen.ui.tabs.tabs2 = (function() { 
var weathergen$ui$tabs$tabs2__delegate = function (args__30233__auto__){
var vec__35922 = hoplon.core.parse_args.call(null,args__30233__auto__);
var attrs = cljs.core.nth.call(null,vec__35922,(0),null);
var _ = cljs.core.nth.call(null,vec__35922,(1),null);
var map__35925 = attrs;
var map__35925__$1 = (((((!((map__35925 == null))))?(((((map__35925.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35925.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35925):map__35925);
var tab_background = cljs.core.get.call(null,map__35925__$1,new cljs.core.Keyword(null,"tab-background","tab-background",-2049748774));
var data = cljs.core.get.call(null,map__35925__$1,new cljs.core.Keyword(null,"data","data",-232669377));
var title_formatter = cljs.core.get.call(null,map__35925__$1,new cljs.core.Keyword(null,"title-formatter","title-formatter",1874480681));
var formatter = cljs.core.get.call(null,map__35925__$1,new cljs.core.Keyword(null,"formatter","formatter",-483008823));
var value = cljs.core.get.call(null,map__35925__$1,new cljs.core.Keyword(null,"value","value",305978217));
var key_fn = cljs.core.get.call(null,map__35925__$1,new cljs.core.Keyword(null,"key-fn","key-fn",-636154479));
var attrs__$1 = cljs.core.dissoc.call(null,attrs,new cljs.core.Keyword(null,"data","data",-232669377),new cljs.core.Keyword(null,"key-fn","key-fn",-636154479),new cljs.core.Keyword(null,"value","value",305978217),new cljs.core.Keyword(null,"formatter","formatter",-483008823),new cljs.core.Keyword(null,"title-formatter","title-formatter",1874480681),new cljs.core.Keyword(null,"tab-background","tab-background",-2049748774));
cljs.core.add_watch.call(null,data,cljs.core.gensym.call(null),((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (___$1,___$2,o,n){
if(cljs.core.truth_(cljs.core.some.call(null,((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (p1__35921_SHARP_){
return cljs.core._EQ_.call(null,cljs.core.deref.call(null,value),key_fn.call(null,p1__35921_SHARP_));
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
,n))){
return null;
} else {
return cljs.core.reset_BANG_.call(null,value,key_fn.call(null,cljs.core.first.call(null,n)));
}
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
);

return hoplon.core.div.call(null,hoplon.core.div.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"buttons and spacer",new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"position","position",-2011731912),"sticky",new cljs.core.Keyword(null,"top","top",-1856271961),(0),new cljs.core.Keyword(null,"background","background",-863952629),tab_background,new cljs.core.Keyword(null,"z-index","z-index",1892827090),(100)], null),hoplon.core.div.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"tab buttons",new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"border-bottom-width","border-bottom-width",-1417262769),weathergen.ui.common.px.call(null,(1)),new cljs.core.Keyword(null,"border-bottom-style","border-bottom-style",925668932),"solid",new cljs.core.Keyword(null,"border-bottom-color","border-bottom-color",-208763333),"lightgray"], null),weathergen.ui.common.keyed_loop_tpl_STAR_.call(null,data,key_fn,((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (item,id){
return hoplon.core.div.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (e){
var current = cljs.core.set.call(null,cljs.core.map.call(null,key_fn,cljs.core.deref.call(null,data)));
if(cljs.core.truth_(current.call(null,id))){
return cljs.core.reset_BANG_.call(null,value,id);
} else {
return null;
}
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (item__$1,value__$1){
var id__$1 = key_fn.call(null,item__$1);
var selected_QMARK_ = cljs.core._EQ_.call(null,value__$1,id__$1);
return cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"border-style","border-style",-485574304),new cljs.core.Keyword(null,"border-bottom-style","border-bottom-style",925668932),new cljs.core.Keyword(null,"color","color",1011675173),new cljs.core.Keyword(null,"font-size","font-size",-1847940346),new cljs.core.Keyword(null,"border-top-right-radius","border-top-right-radius",1678770792),new cljs.core.Keyword(null,"background","background",-863952629),new cljs.core.Keyword(null,"cursor","cursor",1011937484),new cljs.core.Keyword(null,"border-top-left-radius","border-top-left-radius",1361811342),new cljs.core.Keyword(null,"border-width","border-width",-1512605390),new cljs.core.Keyword(null,"padding","padding",1660304693),new cljs.core.Keyword(null,"border-color","border-color",-2059162761),new cljs.core.Keyword(null,"display","display",242065432)],["solid","none",((cljs.core._EQ_.call(null,value__$1,id__$1))?"white":"#737373"),weathergen.ui.common.pct.call(null,(120)),weathergen.ui.common.px.call(null,(5)),((selected_QMARK_)?"black":null),"pointer",weathergen.ui.common.px.call(null,(5)),weathergen.ui.common.px.call(null,(1)),weathergen.ui.common.px.call(null,(0),(10),(3),(10)),((selected_QMARK_)?"black":"lightgray"),"inline-block"]);
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
).call(null,item,value),title_formatter.call(null,item,id,javelin.core.formula.call(null,((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (G__35927,G__35928,G__35929){
return G__35927.call(null,G__35928,G__35929);
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
).call(null,cljs.core._EQ_,value,id)));
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
)),hoplon.core.div.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"spacer",new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"background","background",-863952629),tab_background,new cljs.core.Keyword(null,"height","height",1025178622),weathergen.ui.common.px.call(null,(3))], null))),weathergen.ui.common.keyed_loop_tpl_STAR_.call(null,data,key_fn,((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (item,id){
return hoplon.core.div.call(null,new cljs.core.Keyword(null,"css","css",1135045163),javelin.core.formula.call(null,((function (map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_){
return (function (item__$1,value__$1){
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"display","display",242065432),((cljs.core.not_EQ_.call(null,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(item__$1),value__$1))?"none":null)], null);
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
).call(null,item,value),formatter.call(null,item,id));
});})(map__35925,map__35925__$1,tab_background,data,title_formatter,formatter,value,key_fn,attrs__$1,vec__35922,attrs,_))
));
};
var weathergen$ui$tabs$tabs2 = function (var_args){
var args__30233__auto__ = null;
if (arguments.length > 0) {
var G__35930__i = 0, G__35930__a = new Array(arguments.length -  0);
while (G__35930__i < G__35930__a.length) {G__35930__a[G__35930__i] = arguments[G__35930__i + 0]; ++G__35930__i;}
  args__30233__auto__ = new cljs.core.IndexedSeq(G__35930__a,0,null);
} 
return weathergen$ui$tabs$tabs2__delegate.call(this,args__30233__auto__);};
weathergen$ui$tabs$tabs2.cljs$lang$maxFixedArity = 0;
weathergen$ui$tabs$tabs2.cljs$lang$applyTo = (function (arglist__35931){
var args__30233__auto__ = cljs.core.seq(arglist__35931);
return weathergen$ui$tabs$tabs2__delegate(args__30233__auto__);
});
weathergen$ui$tabs$tabs2.cljs$core$IFn$_invoke$arity$variadic = weathergen$ui$tabs$tabs2__delegate;
return weathergen$ui$tabs$tabs2;
})()
;
