// Compiled by ClojureScript 0.0-2138
goog.provide('lt.objs.bottombar');
goog.require('cljs.core');
goog.require('lt.util.style');
goog.require('lt.util.cljs');
goog.require('crate.binding');
goog.require('lt.objs.tabs');
goog.require('lt.objs.animations');
goog.require('lt.objs.canvas');
goog.require('lt.util.cljs');
goog.require('lt.objs.animations');
goog.require('crate.binding');
goog.require('lt.objs.canvas');
goog.require('lt.object');
goog.require('lt.object');
goog.require('lt.util.style');
goog.require('lt.objs.tabs');
lt.objs.bottombar.min_height = 30;
lt.objs.bottombar.default_height = 130;
lt.objs.bottombar.horizontal_grip = (function horizontal_grip(this$){var e__3325__auto__ = crate.core.html.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.horizontal-grip","div.horizontal-grip",642788208),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"draggable","draggable",709423359),"true"], null)], null));var seq__6084_6090 = cljs.core.seq.call(null,cljs.core.partition.call(null,2,new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"dragstart","dragstart",721070880),(function (e){return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"start-drag","start-drag",3689081649));
}),new cljs.core.Keyword(null,"dragend","dragend",2926432921),(function (e){return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"end-drag","end-drag",2692811352));
}),new cljs.core.Keyword(null,"drag","drag",1016996006),(function (e){return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"height!","height!",1816692556),e);
})], null)));var chunk__6085_6091 = null;var count__6086_6092 = 0;var i__6087_6093 = 0;while(true){
if((i__6087_6093 < count__6086_6092))
{var vec__6088_6094 = cljs.core._nth.call(null,chunk__6085_6091,i__6087_6093);var ev__3326__auto___6095 = cljs.core.nth.call(null,vec__6088_6094,0,null);var func__3327__auto___6096 = cljs.core.nth.call(null,vec__6088_6094,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___6095,func__3327__auto___6096);
{
var G__6097 = seq__6084_6090;
var G__6098 = chunk__6085_6091;
var G__6099 = count__6086_6092;
var G__6100 = (i__6087_6093 + 1);
seq__6084_6090 = G__6097;
chunk__6085_6091 = G__6098;
count__6086_6092 = G__6099;
i__6087_6093 = G__6100;
continue;
}
} else
{var temp__4092__auto___6101 = cljs.core.seq.call(null,seq__6084_6090);if(temp__4092__auto___6101)
{var seq__6084_6102__$1 = temp__4092__auto___6101;if(cljs.core.chunked_seq_QMARK_.call(null,seq__6084_6102__$1))
{var c__4262__auto___6103 = cljs.core.chunk_first.call(null,seq__6084_6102__$1);{
var G__6104 = cljs.core.chunk_rest.call(null,seq__6084_6102__$1);
var G__6105 = c__4262__auto___6103;
var G__6106 = cljs.core.count.call(null,c__4262__auto___6103);
var G__6107 = 0;
seq__6084_6090 = G__6104;
chunk__6085_6091 = G__6105;
count__6086_6092 = G__6106;
i__6087_6093 = G__6107;
continue;
}
} else
{var vec__6089_6108 = cljs.core.first.call(null,seq__6084_6102__$1);var ev__3326__auto___6109 = cljs.core.nth.call(null,vec__6089_6108,0,null);var func__3327__auto___6110 = cljs.core.nth.call(null,vec__6089_6108,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___6109,func__3327__auto___6110);
{
var G__6111 = cljs.core.next.call(null,seq__6084_6102__$1);
var G__6112 = null;
var G__6113 = 0;
var G__6114 = 0;
seq__6084_6090 = G__6111;
chunk__6085_6091 = G__6112;
count__6086_6092 = G__6113;
i__6087_6093 = G__6114;
continue;
}
}
} else
{}
}
break;
}
return e__3325__auto__;
});
lt.objs.bottombar.active_content = (function active_content(active){if(cljs.core.truth_(active))
{return lt.object.__GT_content.call(null,active);
} else
{return null;
}
});
lt.objs.bottombar.active_QMARK_ = (function active_QMARK_(item){return cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.bottombar.bottombar)),item);
});
lt.objs.bottombar.__GT_active_class = (function __GT_active_class(p__6115){var map__6117 = p__6115;var map__6117__$1 = ((cljs.core.seq_QMARK_.call(null,map__6117))?cljs.core.apply.call(null,cljs.core.hash_map,map__6117):map__6117);var active = cljs.core.get.call(null,map__6117__$1,new cljs.core.Keyword(null,"active","active",3885920888));if(cljs.core.truth_(active))
{return "open";
} else
{return "closed";
}
});
lt.objs.bottombar.add_item = (function add_item(item){return lt.object.update_BANG_.call(null,lt.objs.bottombar.bottombar,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"items","items",1114430258)], null),cljs.core.assoc,new cljs.core.Keyword(null,"order","order",1119910592).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,item)),item);
});
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","bottombar","lt.objs.bottombar/bottombar",1537782029),new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"bottombar","bottombar",3453493626),null], null), null),new cljs.core.Keyword(null,"items","items",1114430258),cljs.core.sorted_map_by.call(null,cljs.core._GT_),new cljs.core.Keyword(null,"height","height",4087841945),0,new cljs.core.Keyword(null,"max-height","max-height",585117986),lt.objs.bottombar.default_height,new cljs.core.Keyword(null,"init","init",1017141378),(function (this$){return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div#bottombar","div#bottombar",676879368),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"class","class",1108647146),crate.binding.bound.call(null,this$,lt.objs.bottombar.__GT_active_class),new cljs.core.Keyword(null,"style","style",1123684643),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"left","left",1017222009),crate.binding.bound.call(null,crate.binding.subatom.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"left","left",1017222009)),lt.util.style.__GT_px),new cljs.core.Keyword(null,"right","right",1122416014),crate.binding.bound.call(null,crate.binding.subatom.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"right","right",1122416014)),lt.util.style.__GT_px),new cljs.core.Keyword(null,"height","height",4087841945),crate.binding.bound.call(null,crate.binding.subatom.call(null,this$,new cljs.core.Keyword(null,"height","height",4087841945)),lt.util.style.__GT_px)], null)], null),lt.objs.bottombar.horizontal_grip.call(null,this$),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.content","div.content",3533478798),crate.binding.bound.call(null,crate.binding.subatom.call(null,this$,new cljs.core.Keyword(null,"active","active",3885920888)),lt.objs.bottombar.active_content)], null)], null);
}));
lt.objs.bottombar.bottombar = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.bottombar","bottombar","lt.objs.bottombar/bottombar",1537782029));
lt.objs.canvas.add_BANG_.call(null,lt.objs.bottombar.bottombar);
lt.objs.bottombar.__BEH__no_anim_on_drag = (function __BEH__no_anim_on_drag(this$){return lt.objs.animations.off.call(null);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","no-anim-on-drag","lt.objs.bottombar/no-anim-on-drag",685212711),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__no_anim_on_drag,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"start-drag","start-drag",3689081649),null], null), null));
lt.objs.bottombar.__BEH__reanim_on_drop = (function __BEH__reanim_on_drop(this$){return lt.objs.animations.on.call(null);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","reanim-on-drop","lt.objs.bottombar/reanim-on-drop",2397266689),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__reanim_on_drop,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"end-drag","end-drag",2692811352),null], null), null));
lt.objs.bottombar.__BEH__height_BANG_ = (function __BEH__height_BANG_(this$,e){if(cljs.core._EQ_.call(null,0,e.clientY))
{return null;
} else
{var win_height = window.innerHeight;var height = (function (){var x__3827__auto__ = (win_height - e.clientY);var y__3828__auto__ = lt.objs.bottombar.min_height;return ((x__3827__auto__ > y__3828__auto__) ? x__3827__auto__ : y__3828__auto__);
})();lt.object.raise.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"bottom!","bottom!",1083481800),(height - new cljs.core.Keyword(null,"height","height",4087841945).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))));
return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"height","height",4087841945),height,new cljs.core.Keyword(null,"max-height","max-height",585117986),height], null));
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","height!","lt.objs.bottombar/height!",3122217663),new cljs.core.Keyword(null,"throttle","throttle",2497347228),16,new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__height_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,"height!","height!",1816692556),null], null), null));
lt.objs.bottombar.__BEH__show_item = (function __BEH__show_item(this$,item){if(cljs.core.not_EQ_.call(null,item,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"active","active",3885920888),item,new cljs.core.Keyword(null,"height","height",4087841945),new cljs.core.Keyword(null,"max-height","max-height",585117986).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))], null));
return lt.object.raise.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"bottom!","bottom!",1083481800),new cljs.core.Keyword(null,"max-height","max-height",585117986).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","show-item","lt.objs.bottombar/show-item",1162331896),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__show_item,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"show!","show!",1123317814),null], null), null));
lt.objs.bottombar.__BEH__hide_item = (function __BEH__hide_item(this$,item,force_QMARK_){if(cljs.core.truth_((function (){var or__3520__auto__ = cljs.core._EQ_.call(null,item,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));if(or__3520__auto__)
{return or__3520__auto__;
} else
{return force_QMARK_;
}
})()))
{lt.object.raise.call(null,lt.objs.tabs.multi,new cljs.core.Keyword(null,"bottom!","bottom!",1083481800),(- new cljs.core.Keyword(null,"max-height","max-height",585117986).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))));
return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"active","active",3885920888),null,new cljs.core.Keyword(null,"height","height",4087841945),0], null));
} else
{return null;
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","hide-item","lt.objs.bottombar/hide-item",3118213019),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__hide_item,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"hide!","hide!",1113177745),null], null), null));
lt.objs.bottombar.__BEH__item_toggled = (function __BEH__item_toggled(this$,item,force_QMARK_){if(cljs.core.truth_((function (){var or__3520__auto__ = cljs.core.not_EQ_.call(null,item,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)));if(or__3520__auto__)
{return or__3520__auto__;
} else
{return force_QMARK_;
}
})()))
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"show!","show!",1123317814),item);
} else
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"hide!","hide!",1113177745),item);
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.bottombar","item-toggled","lt.objs.bottombar/item-toggled",2840037827),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.bottombar.__BEH__item_toggled,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"toggle","toggle",4440567494),null], null), null));
