// Compiled by ClojureScript 0.0-2138
goog.provide('lt.objs.workspace');
goog.require('cljs.core');
goog.require('lt.util.js');
goog.require('lt.util.cljs');
goog.require('lt.objs.app');
goog.require('lt.objs.files');
goog.require('lt.util.js');
goog.require('lt.objs.cache');
goog.require('cljs.reader');
goog.require('lt.objs.notifos');
goog.require('lt.objs.notifos');
goog.require('lt.util.cljs');
goog.require('lt.objs.command');
goog.require('lt.objs.files');
goog.require('lt.objs.app');
goog.require('lt.util.load');
goog.require('lt.object');
goog.require('cljs.reader');
goog.require('lt.object');
goog.require('lt.util.load');
goog.require('lt.objs.console');
goog.require('lt.objs.console');
goog.require('lt.objs.cache');
goog.require('lt.objs.command');
lt.objs.workspace.fs = require("fs");
lt.objs.workspace.max_depth = 10;
lt.objs.workspace.watch_interval = 1000;
lt.object.object_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","workspace","lt.objs.workspace/workspace",619438026),new cljs.core.Keyword(null,"tags","tags",1017456523),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"workspace","workspace",2122768391),null], null), null),new cljs.core.Keyword(null,"files","files",1111338473),cljs.core.PersistentVector.EMPTY,new cljs.core.Keyword(null,"folders","folders",4625622327),cljs.core.PersistentVector.EMPTY,new cljs.core.Keyword(null,"watches","watches",2139868463),cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"ws-behaviors","ws-behaviors",2339346978),"",new cljs.core.Keyword(null,"init","init",1017141378),(function (this$){return null;
}));
lt.objs.workspace.current_ws = lt.object.create.call(null,new cljs.core.Keyword("lt.objs.workspace","workspace","lt.objs.workspace/workspace",619438026));
lt.objs.workspace.unwatch = (function unwatch(watches,path,recursive_QMARK_){if(cljs.core.truth_(watches))
{var removes = ((cljs.core.coll_QMARK_.call(null,path))?path:((cljs.core.not.call(null,recursive_QMARK_))?new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [path], null):((new cljs.core.Keyword(null,"else","else",1017020587))?cljs.core.filter.call(null,(function (p1__13993_SHARP_){return (p1__13993_SHARP_.indexOf(path) > -1);
}),cljs.core.keys.call(null,watches)):null)));var seq__14000_14006 = cljs.core.seq.call(null,cljs.core.map.call(null,watches,removes));var chunk__14002_14007 = null;var count__14003_14008 = 0;var i__14004_14009 = 0;while(true){
if((i__14004_14009 < count__14003_14008))
{var r_14010 = cljs.core._nth.call(null,chunk__14002_14007,i__14004_14009);if(cljs.core.truth_((function (){var and__3508__auto__ = r_14010;if(cljs.core.truth_(and__3508__auto__))
{return new cljs.core.Keyword(null,"close","close",1108660586).cljs$core$IFn$_invoke$arity$1(r_14010);
} else
{return and__3508__auto__;
}
})()))
{new cljs.core.Keyword(null,"close","close",1108660586).cljs$core$IFn$_invoke$arity$1(r_14010).call(null);
{
var G__14011 = seq__14000_14006;
var G__14012 = chunk__14002_14007;
var G__14013 = count__14003_14008;
var G__14014 = (i__14004_14009 + 1);
seq__14000_14006 = G__14011;
chunk__14002_14007 = G__14012;
count__14003_14008 = G__14013;
i__14004_14009 = G__14014;
continue;
}
} else
{{
var G__14015 = seq__14000_14006;
var G__14016 = chunk__14002_14007;
var G__14017 = count__14003_14008;
var G__14018 = (i__14004_14009 + 1);
seq__14000_14006 = G__14015;
chunk__14002_14007 = G__14016;
count__14003_14008 = G__14017;
i__14004_14009 = G__14018;
continue;
}
}
} else
{var temp__4092__auto___14019 = cljs.core.seq.call(null,seq__14000_14006);if(temp__4092__auto___14019)
{var seq__14000_14020__$1 = temp__4092__auto___14019;if(cljs.core.chunked_seq_QMARK_.call(null,seq__14000_14020__$1))
{var c__4262__auto___14021 = cljs.core.chunk_first.call(null,seq__14000_14020__$1);{
var G__14022 = cljs.core.chunk_rest.call(null,seq__14000_14020__$1);
var G__14023 = c__4262__auto___14021;
var G__14024 = cljs.core.count.call(null,c__4262__auto___14021);
var G__14025 = 0;
seq__14000_14006 = G__14022;
chunk__14002_14007 = G__14023;
count__14003_14008 = G__14024;
i__14004_14009 = G__14025;
continue;
}
} else
{var r_14026 = cljs.core.first.call(null,seq__14000_14020__$1);if(cljs.core.truth_((function (){var and__3508__auto__ = r_14026;if(cljs.core.truth_(and__3508__auto__))
{return new cljs.core.Keyword(null,"close","close",1108660586).cljs$core$IFn$_invoke$arity$1(r_14026);
} else
{return and__3508__auto__;
}
})()))
{new cljs.core.Keyword(null,"close","close",1108660586).cljs$core$IFn$_invoke$arity$1(r_14026).call(null);
{
var G__14027 = cljs.core.next.call(null,seq__14000_14020__$1);
var G__14028 = null;
var G__14029 = 0;
var G__14030 = 0;
seq__14000_14006 = G__14027;
chunk__14002_14007 = G__14028;
count__14003_14008 = G__14029;
i__14004_14009 = G__14030;
continue;
}
} else
{{
var G__14031 = cljs.core.next.call(null,seq__14000_14020__$1);
var G__14032 = null;
var G__14033 = 0;
var G__14034 = 0;
seq__14000_14006 = G__14031;
chunk__14002_14007 = G__14032;
count__14003_14008 = G__14033;
i__14004_14009 = G__14034;
continue;
}
}
}
} else
{}
}
break;
}
return cljs.core.apply.call(null,cljs.core.dissoc,watches,removes);
} else
{return null;
}
});
lt.objs.workspace.unwatch_BANG_ = (function() {
var unwatch_BANG_ = null;
var unwatch_BANG___1 = (function (path){return unwatch_BANG_.call(null,path,false);
});
var unwatch_BANG___2 = (function (path,recursive_QMARK_){return lt.object.merge_BANG_.call(null,lt.objs.workspace.current_ws,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"watches","watches",2139868463),lt.objs.workspace.unwatch.call(null,new cljs.core.Keyword(null,"watches","watches",2139868463).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.workspace.current_ws)),path,recursive_QMARK_)], null));
});
unwatch_BANG_ = function(path,recursive_QMARK_){
switch(arguments.length){
case 1:
return unwatch_BANG___1.call(this,path);
case 2:
return unwatch_BANG___2.call(this,path,recursive_QMARK_);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
unwatch_BANG_.cljs$core$IFn$_invoke$arity$1 = unwatch_BANG___1;
unwatch_BANG_.cljs$core$IFn$_invoke$arity$2 = unwatch_BANG___2;
return unwatch_BANG_;
})()
;
lt.objs.workspace.alert_file = (function alert_file(path){return (function (cur,prev){if(cljs.core.truth_(lt.objs.workspace.fs.existsSync(path)))
{return lt.object.raise.call(null,lt.objs.workspace.current_ws,new cljs.core.Keyword(null,"watched.update","watched.update",1262966907),path,cur);
} else
{lt.objs.workspace.unwatch_BANG_.call(null,path);
return lt.object.raise.call(null,lt.objs.workspace.current_ws,new cljs.core.Keyword(null,"watched.delete","watched.delete",766354781),path);
}
});
});
lt.objs.workspace.file__GT_watch = (function file__GT_watch(path){var alert = lt.objs.workspace.alert_file.call(null,path);return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"path","path",1017337751),path,new cljs.core.Keyword(null,"alert","alert",1106803918),alert,new cljs.core.Keyword(null,"close","close",1108660586),(function (){return lt.objs.workspace.fs.unwatchFile(path,alert);
})], null);
});
lt.objs.workspace.watch_BANG_ = (function() {
var watch_BANG_ = null;
var watch_BANG___1 = (function (path){return watch_BANG_.call(null,cljs.core.transient$.call(null,cljs.core.PersistentArrayMap.EMPTY),path,null);
});
var watch_BANG___2 = (function (path,recursive_QMARK_){return watch_BANG_.call(null,cljs.core.transient$.call(null,cljs.core.PersistentArrayMap.EMPTY),path,recursive_QMARK_);
});
var watch_BANG___3 = (function (results,path,recursive_QMARK_){var seq__14047_14059 = cljs.core.seq.call(null,((cljs.core.coll_QMARK_.call(null,path))?path:new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [path], null)));var chunk__14048_14060 = null;var count__14049_14061 = 0;var i__14050_14062 = 0;while(true){
if((i__14050_14062 < count__14049_14061))
{var path_14063__$1 = cljs.core._nth.call(null,chunk__14048_14060,i__14050_14062);if(cljs.core.truth_(cljs.core.re_seq.call(null,lt.objs.files.ignore_pattern,path_14063__$1)))
{} else
{if(cljs.core.truth_(lt.objs.files.dir_QMARK_.call(null,path_14063__$1)))
{var recursive_QMARK__14064__$1 = ((cljs.core.not.call(null,recursive_QMARK_))?0:((typeof recursive_QMARK_ === 'number')?(recursive_QMARK_ - 1):((new cljs.core.Keyword(null,"else","else",1017020587))?lt.objs.workspace.max_depth:null)));var watch_14065 = lt.objs.workspace.folder__GT_watch.call(null,path_14063__$1);if(cljs.core.truth_(cljs.core.get.call(null,new cljs.core.Keyword(null,"watches","watches",2139868463).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.workspace.current_ws)),path_14063__$1)))
{} else
{cljs.core.assoc_BANG_.call(null,results,path_14063__$1,watch_14065);
lt.objs.workspace.fs.watchFile(path_14063__$1,(function (){var obj14052 = {"interval":lt.objs.workspace.watch_interval,"persistent":false};return obj14052;
})(),new cljs.core.Keyword(null,"alert","alert",1106803918).cljs$core$IFn$_invoke$arity$1(watch_14065));
}
if((recursive_QMARK__14064__$1 > -1))
{watch_BANG_.call(null,results,lt.objs.files.full_path_ls.call(null,path_14063__$1),recursive_QMARK__14064__$1);
} else
{}
} else
{if((cljs.core.not.call(null,cljs.core.get.call(null,new cljs.core.Keyword(null,"watches","watches",2139868463).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.workspace.current_ws)),path_14063__$1))) && (cljs.core.not.call(null,cljs.core.get.call(null,results,path_14063__$1))))
{var watch_14066 = lt.objs.workspace.file__GT_watch.call(null,path_14063__$1);cljs.core.assoc_BANG_.call(null,results,path_14063__$1,watch_14066);
lt.objs.workspace.fs.watchFile(path_14063__$1,(function (){var obj14054 = {"interval":lt.objs.workspace.watch_interval,"persistent":false};return obj14054;
})(),new cljs.core.Keyword(null,"alert","alert",1106803918).cljs$core$IFn$_invoke$arity$1(watch_14066));
} else
{}
}
}
{
var G__14067 = seq__14047_14059;
var G__14068 = chunk__14048_14060;
var G__14069 = count__14049_14061;
var G__14070 = (i__14050_14062 + 1);
seq__14047_14059 = G__14067;
chunk__14048_14060 = G__14068;
count__14049_14061 = G__14069;
i__14050_14062 = G__14070;
continue;
}
} else
{var temp__4092__auto___14071 = cljs.core.seq.call(null,seq__14047_14059);if(temp__4092__auto___14071)
{var seq__14047_14072__$1 = temp__4092__auto___14071;if(cljs.core.chunked_seq_QMARK_.call(null,seq__14047_14072__$1))
{var c__4262__auto___14073 = cljs.core.chunk_first.call(null,seq__14047_14072__$1);{
var G__14074 = cljs.core.chunk_rest.call(null,seq__14047_14072__$1);
var G__14075 = c__4262__auto___14073;
var G__14076 = cljs.core.count.call(null,c__4262__auto___14073);
var G__14077 = 0;
seq__14047_14059 = G__14074;
chunk__14048_14060 = G__14075;
count__14049_14061 = G__14076;
i__14050_14062 = G__14077;
continue;
}
} else
{var path_14078__$1 = cljs.core.first.call(null,seq__14047_14072__$1);if(cljs.core.truth_(cljs.core.re_seq.call(null,lt.objs.files.ignore_pattern,path_14078__$1)))
{} else
{if(cljs.core.truth_(lt.objs.files.dir_QMARK_.call(null,path_14078__$1)))
{var recursive_QMARK__14079__$1 = ((cljs.core.not.call(null,recursive_QMARK_))?0:((typeof recursive_QMARK_ === 'number')?(recursive_QMARK_ - 1):((new cljs.core.Keyword(null,"else","else",1017020587))?lt.objs.workspace.max_depth:null)));var watch_14080 = lt.objs.workspace.folder__GT_watch.call(null,path_14078__$1);if(cljs.core.truth_(cljs.core.get.call(null,new cljs.core.Keyword(null,"watches","watches",2139868463).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.workspace.current_ws)),path_14078__$1)))
{} else
{cljs.core.assoc_BANG_.call(null,results,path_14078__$1,watch_14080);
lt.objs.workspace.fs.watchFile(path_14078__$1,(function (){var obj14056 = {"interval":lt.objs.workspace.watch_interval,"persistent":false};return obj14056;
})(),new cljs.core.Keyword(null,"alert","alert",1106803918).cljs$core$IFn$_invoke$arity$1(watch_14080));
}
if((recursive_QMARK__14079__$1 > -1))
{watch_BANG_.call(null,results,lt.objs.files.full_path_ls.call(null,path_14078__$1),recursive_QMARK__14079__$1);
} else
{}
} else
{if((cljs.core.not.call(null,cljs.core.get.call(null,new cljs.core.Keyword(null,"watches","watches",2139868463).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.workspace.current_ws)),path_14078__$1))) && (cljs.core.not.call(null,cljs.core.get.call(null,results,path_14078__$1))))
{var watch_14081 = lt.objs.workspace.file__GT_watch.call(null,path_14078__$1);cljs.core.assoc_BANG_.call(null,results,path_14078__$1,watch_14081);
lt.objs.workspace.fs.watchFile(path_14078__$1,(function (){var obj14058 = {"interval":lt.objs.workspace.watch_interval,"persistent":false};return obj14058;
})(),new cljs.core.Keyword(null,"alert","alert",1106803918).cljs$core$IFn$_invoke$arity$1(watch_14081));
} else
{}
}
}
{
var G__14082 = cljs.core.next.call(null,seq__14047_14072__$1);
var G__14083 = null;
var G__14084 = 0;
var G__14085 = 0;
seq__14047_14059 = G__14082;
chunk__14048_14060 = G__14083;
count__14049_14061 = G__14084;
i__14050_14062 = G__14085;
continue;
}
}
} else
{}
}
break;
}
if(typeof recursive_QMARK_ === 'number')
{return null;
} else
{return lt.object.update_BANG_.call(null,lt.objs.workspace.current_ws,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"watches","watches",2139868463)], null),cljs.core.merge,cljs.core.persistent_BANG_.call(null,results));
}
});
watch_BANG_ = function(results,path,recursive_QMARK_){
switch(arguments.length){
case 1:
return watch_BANG___1.call(this,results);
case 2:
return watch_BANG___2.call(this,results,path);
case 3:
return watch_BANG___3.call(this,results,path,recursive_QMARK_);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
watch_BANG_.cljs$core$IFn$_invoke$arity$1 = watch_BANG___1;
watch_BANG_.cljs$core$IFn$_invoke$arity$2 = watch_BANG___2;
watch_BANG_.cljs$core$IFn$_invoke$arity$3 = watch_BANG___3;
return watch_BANG_;
})()
;
lt.objs.workspace.alert_folder = (function alert_folder(path){return (function (cur,prev){if(cljs.core.truth_(lt.objs.workspace.fs.existsSync(path)))
{var watches = new cljs.core.Keyword(null,"watches","watches",2139868463).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.workspace.current_ws));var neue = cljs.core.first.call(null,cljs.core.filter.call(null,((function (watches){
return (function (p1__14086_SHARP_){return (cljs.core.not.call(null,cljs.core.get.call(null,watches,p1__14086_SHARP_))) && (cljs.core.not.call(null,cljs.core.re_seq.call(null,lt.objs.files.ignore_pattern,p1__14086_SHARP_)));
});})(watches))
,lt.objs.files.full_path_ls.call(null,path)));if(cljs.core.truth_(neue))
{lt.objs.workspace.watch_BANG_.call(null,neue);
return lt.object.raise.call(null,lt.objs.workspace.current_ws,new cljs.core.Keyword(null,"watched.create","watched.create",749519022),neue,lt.objs.workspace.fs.statSync(neue));
} else
{return null;
}
} else
{lt.objs.workspace.unwatch_BANG_.call(null,path,new cljs.core.Keyword(null,"recursive","recursive",2179684260));
return lt.object.raise.call(null,lt.objs.workspace.current_ws,new cljs.core.Keyword(null,"watched.delete","watched.delete",766354781),path);
}
});
});
lt.objs.workspace.folder__GT_watch = (function folder__GT_watch(path){var alert = lt.objs.workspace.alert_folder.call(null,path);return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"path","path",1017337751),path,new cljs.core.Keyword(null,"alert","alert",1106803918),alert,new cljs.core.Keyword(null,"close","close",1108660586),(function (){return lt.objs.workspace.fs.unwatchFile(path,alert);
})], null);
});
lt.objs.workspace.stop_watching = (function stop_watching(ws){return lt.objs.workspace.unwatch_BANG_.call(null,cljs.core.keys.call(null,new cljs.core.Keyword(null,"watches","watches",2139868463).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,ws))));
});
lt.objs.workspace.watch_workspace = (function watch_workspace(ws){lt.objs.workspace.stop_watching.call(null,ws);
return lt.objs.workspace.watch_BANG_.call(null,lt.object.raise_reduce.call(null,ws,new cljs.core.Keyword(null,"watch-paths+","watch-paths+",2265407277),cljs.core.PersistentVector.EMPTY));
});
lt.objs.workspace.workspace_cache_path = lt.objs.files.join.call(null,lt.objs.cache.cache_path,"workspace");
lt.objs.workspace.files_and_folders = (function files_and_folders(path){return cljs.core.reduce.call(null,(function (res,cur){var dir_QMARK_ = lt.objs.files.dir_QMARK_.call(null,cur);if(cljs.core.truth_(cljs.core.re_seq.call(null,lt.objs.files.ignore_pattern,[cljs.core.str(lt.objs.files.basename.call(null,cur)),cljs.core.str((cljs.core.truth_(dir_QMARK_)?lt.objs.files.separator:null))].join(''))))
{return res;
} else
{if(cljs.core.truth_(dir_QMARK_))
{return cljs.core.update_in.call(null,res,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"folders","folders",4625622327)], null),cljs.core.conj,cur);
} else
{return cljs.core.update_in.call(null,res,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"files","files",1111338473)], null),cljs.core.conj,cur);
}
}
}),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"folders","folders",4625622327),cljs.core.PersistentVector.EMPTY,new cljs.core.Keyword(null,"files","files",1111338473),cljs.core.PersistentVector.EMPTY], null),lt.objs.files.full_path_ls.call(null,path));
});
lt.objs.workspace.serialize = (function serialize(ws){return cljs.core.select_keys.call(null,ws,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"files","files",1111338473),new cljs.core.Keyword(null,"folders","folders",4625622327),new cljs.core.Keyword(null,"ws-behaviors","ws-behaviors",2339346978)], null));
});
lt.objs.workspace.reconstitute = (function reconstitute(ws,v){return lt.object.raise.call(null,ws,new cljs.core.Keyword(null,"set!","set!",1017430897),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"files","files",1111338473),new cljs.core.Keyword(null,"files","files",1111338473).cljs$core$IFn$_invoke$arity$1(v),new cljs.core.Keyword(null,"folders","folders",4625622327),cljs.core.filter.call(null,lt.objs.files.exists_QMARK_,new cljs.core.Keyword(null,"folders","folders",4625622327).cljs$core$IFn$_invoke$arity$1(v)),new cljs.core.Keyword(null,"ws-behaviors","ws-behaviors",2339346978),new cljs.core.Keyword(null,"ws-behaviors","ws-behaviors",2339346978).cljs$core$IFn$_invoke$arity$1(v)], null));
});
lt.objs.workspace.add_BANG_ = (function add_BANG_(ws,k,v){return lt.object.update_BANG_.call(null,ws,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [k], null),cljs.core.conj,v);
});
lt.objs.workspace.remove_BANG_ = (function remove_BANG_(ws,k,v){return lt.object.update_BANG_.call(null,ws,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [k], null),(function (p1__14087_SHARP_){return cljs.core.vec.call(null,cljs.core.remove.call(null,cljs.core.PersistentHashSet.fromArray([v], true),p1__14087_SHARP_));
}));
});
lt.objs.workspace.new_cached_file = (function new_cached_file(){return [cljs.core.str(lt.util.js.now.call(null)),cljs.core.str(".clj")].join('');
});
lt.objs.workspace.file__GT_ws = (function file__GT_ws(file){return cljs.core.assoc.call(null,cljs.reader.read_string.call(null,new cljs.core.Keyword(null,"content","content",1965434859).cljs$core$IFn$_invoke$arity$1(lt.objs.files.open_sync.call(null,file))),new cljs.core.Keyword(null,"path","path",1017337751),file);
});
lt.objs.workspace.save = (function save(ws,file){lt.objs.files.save.call(null,lt.objs.files.join.call(null,lt.objs.workspace.workspace_cache_path,file),cljs.core.pr_str.call(null,lt.objs.workspace.serialize.call(null,cljs.core.deref.call(null,ws))));
return lt.object.raise.call(null,ws,new cljs.core.Keyword(null,"save","save",1017427183));
});
lt.objs.workspace.open = (function open(ws,file){var loc = ((!((file.indexOf(lt.objs.files.separator) > -1)))?lt.objs.files.join.call(null,lt.objs.workspace.workspace_cache_path,file):file);lt.object.merge_BANG_.call(null,ws,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"file","file",1017047278),lt.objs.workspace.new_cached_file.call(null)], null));
try{lt.objs.workspace.reconstitute.call(null,ws,lt.objs.workspace.file__GT_ws.call(null,loc));
lt.objs.workspace.save.call(null,ws,new cljs.core.Keyword(null,"file","file",1017047278).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,ws)));
return lt.objs.files.delete_BANG_.call(null,loc);
}catch (e14089){var e = e14089;return lt.objs.console.error.call(null,e);
}});
lt.objs.workspace.cached = (function cached(){return cljs.core.filter.call(null,(function (p1__14090_SHARP_){return (p1__14090_SHARP_.indexOf(".clj") > -1);
}),lt.objs.files.full_path_ls.call(null,lt.objs.workspace.workspace_cache_path));
});
lt.objs.workspace.all = (function all(){var fs = cljs.core.sort.call(null,cljs.core._GT_,lt.objs.workspace.cached.call(null));var seq__14095_14099 = cljs.core.seq.call(null,cljs.core.drop.call(null,20,fs));var chunk__14096_14100 = null;var count__14097_14101 = 0;var i__14098_14102 = 0;while(true){
if((i__14098_14102 < count__14097_14101))
{var file_14103 = cljs.core._nth.call(null,chunk__14096_14100,i__14098_14102);lt.objs.files.delete_BANG_.call(null,file_14103);
{
var G__14104 = seq__14095_14099;
var G__14105 = chunk__14096_14100;
var G__14106 = count__14097_14101;
var G__14107 = (i__14098_14102 + 1);
seq__14095_14099 = G__14104;
chunk__14096_14100 = G__14105;
count__14097_14101 = G__14106;
i__14098_14102 = G__14107;
continue;
}
} else
{var temp__4092__auto___14108 = cljs.core.seq.call(null,seq__14095_14099);if(temp__4092__auto___14108)
{var seq__14095_14109__$1 = temp__4092__auto___14108;if(cljs.core.chunked_seq_QMARK_.call(null,seq__14095_14109__$1))
{var c__4262__auto___14110 = cljs.core.chunk_first.call(null,seq__14095_14109__$1);{
var G__14111 = cljs.core.chunk_rest.call(null,seq__14095_14109__$1);
var G__14112 = c__4262__auto___14110;
var G__14113 = cljs.core.count.call(null,c__4262__auto___14110);
var G__14114 = 0;
seq__14095_14099 = G__14111;
chunk__14096_14100 = G__14112;
count__14097_14101 = G__14113;
i__14098_14102 = G__14114;
continue;
}
} else
{var file_14115 = cljs.core.first.call(null,seq__14095_14109__$1);lt.objs.files.delete_BANG_.call(null,file_14115);
{
var G__14116 = cljs.core.next.call(null,seq__14095_14109__$1);
var G__14117 = null;
var G__14118 = 0;
var G__14119 = 0;
seq__14095_14099 = G__14116;
chunk__14096_14100 = G__14117;
count__14097_14101 = G__14118;
i__14098_14102 = G__14119;
continue;
}
}
} else
{}
}
break;
}
return cljs.core.map.call(null,lt.objs.workspace.file__GT_ws,cljs.core.take.call(null,20,fs));
});
lt.objs.workspace.ws_empty_QMARK_ = (function ws_empty_QMARK_(ws){return !((cljs.core.seq.call(null,new cljs.core.Keyword(null,"files","files",1111338473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,ws)))) || (cljs.core.seq.call(null,new cljs.core.Keyword(null,"folders","folders",4625622327).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,ws)))));
});
lt.objs.workspace.__BEH__serialize_workspace = (function __BEH__serialize_workspace(this$){if(cljs.core.truth_(cljs.core.deref.call(null,this$).call(null,new cljs.core.Keyword(null,"file","file",1017047278))))
{} else
{lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"file","file",1017047278),lt.objs.workspace.new_cached_file.call(null)], null));
}
if(cljs.core.truth_((function (){var and__3508__auto__ = cljs.core.deref.call(null,this$).call(null,new cljs.core.Keyword(null,"initialized?","initialized?",613820253));if(cljs.core.truth_(and__3508__auto__))
{return !(lt.objs.workspace.ws_empty_QMARK_.call(null,this$));
} else
{return and__3508__auto__;
}
})()))
{return lt.objs.workspace.save.call(null,this$,new cljs.core.Keyword(null,"file","file",1017047278).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.workspace","serialize-workspace","lt.objs.workspace/serialize-workspace",966599259),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__serialize_workspace,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"serialize!","serialize!",4710885555),null,new cljs.core.Keyword(null,"updated","updated",779473965),null], null), null));
lt.objs.workspace.__BEH__reconstitute_last_workspace = (function __BEH__reconstitute_last_workspace(app){if((lt.objs.app.first_window_QMARK_.call(null)) && (cljs.core.not.call(null,new cljs.core.Keyword(null,"initialized","initialized",2247924294).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,lt.objs.workspace.current_ws)))))
{var temp__4092__auto___14120 = cljs.core.first.call(null,lt.objs.workspace.all.call(null));if(cljs.core.truth_(temp__4092__auto___14120))
{var ws_14121 = temp__4092__auto___14120;lt.objs.workspace.open.call(null,lt.objs.workspace.current_ws,lt.objs.files.basename.call(null,new cljs.core.Keyword(null,"path","path",1017337751).cljs$core$IFn$_invoke$arity$1(ws_14121)));
} else
{}
} else
{}
return lt.object.merge_BANG_.call(null,lt.objs.workspace.current_ws,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"initialized?","initialized?",613820253),true], null));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","reconstitute-last-workspace","lt.objs.workspace/reconstitute-last-workspace",3568425507),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__reconstitute_last_workspace,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"post-init","post-init",2970371471),null], null), null));
lt.objs.workspace.__BEH__new_BANG_ = (function __BEH__new_BANG_(this$){lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"file","file",1017047278),lt.objs.workspace.new_cached_file.call(null)], null));
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"clear!","clear!",3951036134));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","new!","lt.objs.workspace/new!",1591819718),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__new_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,"new!","new!",1017282035),null], null), null));
lt.objs.workspace.__BEH__add_file_BANG_ = (function __BEH__add_file_BANG_(this$,f){if(!(cljs.core.contains_QMARK_.call(null,cljs.core.set.call(null,new cljs.core.Keyword(null,"files","files",1111338473).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))),f)))
{lt.objs.workspace.add_BANG_.call(null,this$,new cljs.core.Keyword(null,"files","files",1111338473),f);
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"add","add",1014000659),f);
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"updated","updated",779473965));
} else
{return lt.objs.notifos.set_msg_BANG_.call(null,"This file is already in your workspace.",new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"class","class",1108647146),"error"], null));
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","add-file!","lt.objs.workspace/add-file!",2702786158),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__add_file_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,"add.file!","add.file!",4237252106),null], null), null));
lt.objs.workspace.__BEH__add_folder_BANG_ = (function __BEH__add_folder_BANG_(this$,f){if(!(cljs.core.contains_QMARK_.call(null,cljs.core.set.call(null,new cljs.core.Keyword(null,"folders","folders",4625622327).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,this$))),f)))
{lt.objs.workspace.add_BANG_.call(null,this$,new cljs.core.Keyword(null,"folders","folders",4625622327),f);
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"add","add",1014000659),f);
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"updated","updated",779473965));
} else
{return lt.objs.notifos.set_msg_BANG_.call(null,"This folder is already in your workspace.",new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"class","class",1108647146),"error"], null));
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","add-folder!","lt.objs.workspace/add-folder!",3399790716),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__add_folder_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,"add.folder!","add.folder!",2151595160),null], null), null));
lt.objs.workspace.__BEH__remove_file_BANG_ = (function __BEH__remove_file_BANG_(this$,f){lt.objs.workspace.remove_BANG_.call(null,this$,new cljs.core.Keyword(null,"files","files",1111338473),f);
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"remove","remove",4374260726),f);
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"updated","updated",779473965));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","remove-file!","lt.objs.workspace/remove-file!",4736710351),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__remove_file_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,"remove.file!","remove.file!",3382976429),null], null), null));
lt.objs.workspace.__BEH__remove_folder_BANG_ = (function __BEH__remove_folder_BANG_(this$,f){lt.objs.workspace.remove_BANG_.call(null,this$,new cljs.core.Keyword(null,"folders","folders",4625622327),f);
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"remove","remove",4374260726),f);
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"updated","updated",779473965));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","remove-folder!","lt.objs.workspace/remove-folder!",2848800157),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__remove_folder_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,"remove.folder!","remove.folder!",1531423099),null], null), null));
lt.objs.workspace.__BEH__rename_BANG_ = (function __BEH__rename_BANG_(this$,f,neue){var key = (cljs.core.truth_(lt.objs.files.file_QMARK_.call(null,f))?new cljs.core.Keyword(null,"files","files",1111338473):new cljs.core.Keyword(null,"folders","folders",4625622327));lt.objs.workspace.remove_BANG_.call(null,this$,key,f);
lt.objs.workspace.add_BANG_.call(null,this$,key,neue);
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"rename","rename",4374276784),f,neue);
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"updated","updated",779473965));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","rename!","lt.objs.workspace/rename!",535270440),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__rename_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,"rename!","rename!",2106237973),null], null), null));
lt.objs.workspace.__BEH__clear_BANG_ = (function __BEH__clear_BANG_(this$){var old = cljs.core.deref.call(null,this$);lt.object.merge_BANG_.call(null,this$,new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"files","files",1111338473),cljs.core.PersistentVector.EMPTY,new cljs.core.Keyword(null,"folders","folders",4625622327),cljs.core.PersistentVector.EMPTY,new cljs.core.Keyword(null,"ws-behaviors","ws-behaviors",2339346978),""], null));
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"set","set",1014018004),old);
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"updated","updated",779473965));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","clear!","lt.objs.workspace/clear!",2982360823),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__clear_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,"clear!","clear!",3951036134),null], null), null));
lt.objs.workspace.__BEH__set_BANG_ = (function __BEH__set_BANG_(this$,fs){var old = cljs.core.deref.call(null,this$);lt.object.merge_BANG_.call(null,this$,fs);
lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"set","set",1014018004),old);
return lt.object.raise.call(null,this$,new cljs.core.Keyword(null,"updated","updated",779473965));
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","set!","lt.objs.workspace/set!",1594750020),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__set_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,"set!","set!",1017430897),null], null), null));
lt.objs.workspace.__BEH__watch_on_set = (function __BEH__watch_on_set(this$){return lt.objs.workspace.watch_workspace.call(null,this$);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","watch-on-set","lt.objs.workspace/watch-on-set",1548262069),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__watch_on_set,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"set","set",1014018004),null], null), null));
lt.objs.workspace.__BEH__stop_watch_on_close = (function __BEH__stop_watch_on_close(app){return lt.objs.workspace.stop_watching.call(null,lt.objs.workspace.current_ws);
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","stop-watch-on-close","lt.objs.workspace/stop-watch-on-close",2718554488),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__stop_watch_on_close,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"close","close",1108660586),null,new cljs.core.Keyword(null,"refresh","refresh",2099349069),null], null), null));
lt.objs.workspace.__BEH__init_workspace_cache_dir = (function __BEH__init_workspace_cache_dir(app){if(cljs.core.truth_(lt.objs.files.exists_QMARK_.call(null,lt.objs.workspace.workspace_cache_path)))
{return null;
} else
{return lt.objs.files.mkdir.call(null,lt.objs.workspace.workspace_cache_path);
}
});
lt.object.behavior_STAR_.call(null,new cljs.core.Keyword("lt.objs.workspace","init-workspace-cache-dir","lt.objs.workspace/init-workspace-cache-dir",1768943762),new cljs.core.Keyword(null,"reaction","reaction",4441361819),lt.objs.workspace.__BEH__init_workspace_cache_dir,new cljs.core.Keyword(null,"triggers","triggers",2516997421),new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"init","init",1017141378),null], null), null));
lt.objs.command.command.call(null,new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"command","command",1964298941),new cljs.core.Keyword(null,"workspace.new","workspace.new",2700812345),new cljs.core.Keyword(null,"desc","desc",1016984067),"Workspace: Create new workspace",new cljs.core.Keyword(null,"exec","exec",1017031683),(function (){return lt.object.raise.call(null,lt.objs.workspace.current_ws,new cljs.core.Keyword(null,"new!","new!",1017282035));
})], null));
