// Compiled by ClojureScript 0.0-2138
goog.provide('lt.objs.sidebar');
goog.require('cljs.core');
goog.require('lt.util.cljs');
goog.require('crate.binding');
goog.require('lt.util.dom');
goog.require('lt.objs.tabs');
goog.require('lt.util.dom');
goog.require('lt.objs.animations');
goog.require('lt.objs.canvas');
goog.require('lt.util.cljs');
goog.require('lt.objs.command');
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.objs.tabs');
goog.require('lt.objs.command');
lt.objs.sidebar.default_width = 200;
lt.objs.sidebar.vertical_grip = (function vertical_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.vertical-grip","div.vertical-grip",4287455262),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"draggable","draggable",709423359),"true"], null)], null));var seq__13296_13302 = 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,"width!","width!",4520836749),e);
})], null)));var chunk__13297_13303 = null;var count__13298_13304 = 0;var i__13299_13305 = 0;while(true){
if((i__13299_13305 < count__13298_13304))
{var vec__13300_13306 = cljs.core._nth.call(null,chunk__13297_13303,i__13299_13305);var ev__3326__auto___13307 = cljs.core.nth.call(null,vec__13300_13306,0,null);var func__3327__auto___13308 = cljs.core.nth.call(null,vec__13300_13306,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___13307,func__3327__auto___13308);
{
var G__13309 = seq__13296_13302;
var G__13310 = chunk__13297_13303;
var G__13311 = count__13298_13304;
var G__13312 = (i__13299_13305 + 1);
seq__13296_13302 = G__13309;
chunk__13297_13303 = G__13310;
count__13298_13304 = G__13311;
i__13299_13305 = G__13312;
continue;
}
} else
{var temp__4092__auto___13313 = cljs.core.seq.call(null,seq__13296_13302);if(temp__4092__auto___13313)
{var seq__13296_13314__$1 = temp__4092__auto___13313;if(cljs.core.chunked_seq_QMARK_.call(null,seq__13296_13314__$1))
{var c__4262__auto___13315 = cljs.core.chunk_first.call(null,seq__13296_13314__$1);{
var G__13316 = cljs.core.chunk_rest.call(null,seq__13296_13314__$1);
var G__13317 = c__4262__auto___13315;
var G__13318 = cljs.core.count.call(null,c__4262__auto___13315);
var G__13319 = 0;
seq__13296_13302 = G__13316;
chunk__13297_13303 = G__13317;
count__13298_13304 = G__13318;
i__13299_13305 = G__13319;
continue;
}
} else
{var vec__13301_13320 = cljs.core.first.call(null,seq__13296_13314__$1);var ev__3326__auto___13321 = cljs.core.nth.call(null,vec__13301_13320,0,null);var func__3327__auto___13322 = cljs.core.nth.call(null,vec__13301_13320,1,null);lt.util.dom.on.call(null,e__3325__auto__,ev__3326__auto___13321,func__3327__auto___13322);
{
var G__13323 = cljs.core.next.call(null,seq__13296_13314__$1);
var G__13324 = null;
var G__13325 = 0;
var G__13326 = 0;
seq__13296_13302 = G__13323;
chunk__13297_13303 = G__13324;
count__13298_13304 = G__13325;
i__13299_13305 = G__13326;
continue;
}
}
} else
{}
}
break;
}
return e__3325__auto__;
});
lt.objs.sidebar.__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.sidebar","no-anim-on-drag","lt.objs.sidebar/no-anim-on-drag",527757360),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.sidebar.__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.sidebar.__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.sidebar","reanim-on-drop","lt.objs.sidebar/reanim-on-drop",3916270162),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.sidebar.__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.sidebar.__BEH__width_BANG_ = (function __BEH__width_BANG_(this$,e){if(cljs.core._EQ_.call(null,0,e.clientX))
{return null;
} else
{var width = ((cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"side","side",1017434313).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"left","left",1017222009)))?e.clientX:(lt.util.dom.width.call(null,document.body) - e.clientX));lt.object.merge_BANG_.call(null,lt.objs.tabs.multi,new cljs.core.PersistentArrayMap.fromArray([new cljs.core.Keyword(null,"side","side",1017434313).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),width], true, false));
return lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"width","width",1127031096),width,new cljs.core.Keyword(null,"max-width","max-width",3646439311),width], null));
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.sidebar","width!","lt.objs.sidebar/width!",4013537593),new cljs.core.Keyword(null,"throttle","throttle",2497347228),5,new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.sidebar.__BEH__width_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,"width!","width!",4520836749),null], null), null));
lt.objs.sidebar.__BEH__pop_transient = (function __BEH__pop_transient(this$){return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"close!","close!",3951350939));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.sidebar","pop-transient","lt.objs.sidebar/pop-transient",4385987660),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.sidebar.__BEH__pop_transient,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"pop!","pop!",1017351010),null], null), null));
lt.objs.sidebar.__BEH__open_BANG_ = (function __BEH__open_BANG_(this$){lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"width","width",1127031096),new cljs.core.Keyword(null,"max-width","max-width",3646439311).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"open","open",1017321916),true], null));
lt.object.merge_BANG_.call(null,lt.objs.tabs.multi,new cljs.core.PersistentArrayMap.fromArray([new cljs.core.Keyword(null,"side","side",1017434313).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),new cljs.core.Keyword(null,"max-width","max-width",3646439311).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))], true, false));
return lt.util.dom.add_class.call(null,lt.object.__GT_content.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))),new cljs.core.Keyword(null,"active","active",3885920888));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.sidebar","open!","lt.objs.sidebar/open!",3098362197),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.sidebar.__BEH__open_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,"open!","open!",1119852169),null], null), null));
lt.objs.sidebar.__BEH__close_BANG_ = (function __BEH__close_BANG_(this$,no_focus){if(cljs.core.truth_(new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{lt.util.dom.remove_class.call(null,lt.object.__GT_content.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))),new cljs.core.Keyword(null,"active","active",3885920888));
} else
{}
lt.object.merge_BANG_.call(null,lt.objs.tabs.multi,new cljs.core.PersistentArrayMap.fromArray([new cljs.core.Keyword(null,"side","side",1017434313).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),0], true, false));
lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"width","width",1127031096),0,new cljs.core.Keyword(null,"active","active",3885920888),false,new cljs.core.Keyword(null,"open","open",1017321916),false], null));
if(cljs.core.truth_(no_focus))
{return null;
} else
{return lt.objs.command.exec_BANG_.call(null,new cljs.core.Keyword(null,"tabs.focus-active","tabs.focus-active",2001074557));
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.sidebar","close!","lt.objs.sidebar/close!",1365770055),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.sidebar.__BEH__close_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,"close!","close!",3951350939),null], null), null));
lt.objs.sidebar.__BEH__item_toggled = (function __BEH__item_toggled(this$,item,p__13327){var map__13329 = p__13327;var map__13329__$1 = ((cljs.core.seq_QMARK_.call(null,map__13329))?cljs.core.apply.call(null,cljs.core.hash_map,map__13329):map__13329);var soft_QMARK_ = cljs.core.get.call(null,map__13329__$1,new cljs.core.Keyword(null,"soft?","soft?",1123517639));var transient_QMARK_ = cljs.core.get.call(null,map__13329__$1,new cljs.core.Keyword(null,"transient?","transient?",3584270951));var force_QMARK_ = cljs.core.get.call(null,map__13329__$1,new cljs.core.Keyword(null,"force?","force?",4040082982));if(cljs.core.truth_((function (){var and__3508__auto__ = cljs.core.not.call(null,force_QMARK_);if(and__3508__auto__)
{var and__3508__auto____$1 = cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),item);if(and__3508__auto____$1)
{return new cljs.core.Keyword(null,"open","open",1017321916).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$));
} else
{return and__3508__auto____$1;
}
} else
{return and__3508__auto__;
}
})()))
{return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"close!","close!",3951350939));
} else
{if(cljs.core.not_EQ_.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$)),item))
{if(cljs.core.truth_(new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))))
{lt.util.dom.remove_class.call(null,lt.object.__GT_content.call(null,new cljs.core.Keyword(null,"active","active",3885920888).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))),new cljs.core.Keyword(null,"active","active",3885920888));
} else
{}
lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"active","active",3885920888),item], null));
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"open!","open!",1119852169));
if(cljs.core.truth_(soft_QMARK_))
{return null;
} else
{return lt.object.raise.call(null,item,new cljs.core.Keyword(null,"show","show",1017433711));
}
} else
{return null;
}
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.sidebar","item-toggled","lt.objs.sidebar/item-toggled",2718235028),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.sidebar.__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));
lt.objs.sidebar.active_content = (function active_content(active){if(cljs.core.truth_(active))
{return lt.object.__GT_content.call(null,active);
} else
{return null;
}
});
lt.objs.sidebar.__GT_width = (function __GT_width(width){return [cljs.core.str((function (){var or__3520__auto__ = width;if(cljs.core.truth_(or__3520__auto__))
{return or__3520__auto__;
} else
{return 0;
}
})()),cljs.core.str("px")].join('');
});
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.sidebar","sidebar","lt.objs.sidebar/sidebar",2323919354),new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"sidebar","sidebar",3099131598),null], null), null),new cljs.core.Keyword(null,"items","items",1114430258),cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"width","width",1127031096),0,new cljs.core.Keyword(null,"side","side",1017434313),new cljs.core.Keyword(null,"left","left",1017222009),new cljs.core.Keyword(null,"transients","transients",3584271003),cljs.core.List.EMPTY,new cljs.core.Keyword(null,"max-width","max-width",3646439311),lt.objs.sidebar.default_width,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#side","div#side",1313977723),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"style","style",1123684643),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"width","width",1127031096),crate.binding.bound.call(null,crate.binding.subatom.call(null,this$,new cljs.core.Keyword(null,"width","width",1127031096)),lt.objs.sidebar.__GT_width)], null)], null),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.sidebar.active_content)], null),lt.objs.sidebar.vertical_grip.call(null,this$)], null);
}));
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.sidebar","right-bar","lt.objs.sidebar/right-bar",614062976),new cljs.core.Keyword(null,"items","items",1114430258),cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"sidebar","sidebar",3099131598),null], null), null),new cljs.core.Keyword(null,"width","width",1127031096),0,new cljs.core.Keyword(null,"side","side",1017434313),new cljs.core.Keyword(null,"right","right",1122416014),new cljs.core.Keyword(null,"max-width","max-width",3646439311),300,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#right-bar","div#right-bar",961966818),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"style","style",1123684643),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"width","width",1127031096),crate.binding.bound.call(null,crate.binding.subatom.call(null,this$,new cljs.core.Keyword(null,"width","width",1127031096)),lt.objs.sidebar.__GT_width)], null)], null),lt.objs.sidebar.vertical_grip.call(null,this$),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div.content","div.content",3533478798)], null)], null);
}));
lt.objs.sidebar.sidebar = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.sidebar","sidebar","lt.objs.sidebar/sidebar",2323919354));
lt.objs.sidebar.rightbar = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.sidebar","right-bar","lt.objs.sidebar/right-bar",614062976));
lt.objs.canvas.add_BANG_.call(null,lt.objs.sidebar.sidebar);
lt.objs.canvas.add_BANG_.call(null,lt.objs.sidebar.rightbar);
lt.objs.sidebar.add_item = (function add_item(bar,item){lt.object.update_BANG_.call(null,bar,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);
return lt.util.dom.append.call(null,lt.util.dom.$.call(null,new cljs.core.Keyword(null,".content",".content",530331645),lt.object.__GT_content.call(null,bar)),lt.object.__GT_content.call(null,item));
});
lt.objs.command.command.call(null,new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"command","command",1964298941),new cljs.core.Keyword(null,"close-sidebar","close-sidebar",1108494329),new cljs.core.Keyword(null,"desc","desc",1016984067),"Sidebar: close",new cljs.core.Keyword(null,"hidden","hidden",4091384092),true,new cljs.core.Keyword(null,"exec","exec",1017031683),(function (){return lt.object.raise.call(null,lt.objs.sidebar.rightbar,new cljs.core.Keyword(null,"close!","close!",3951350939));
})], null));
