// Compiled by ClojureScript 1.10.520 {}
goog.provide('weathergen.ui.layers.acmi');
goog.require('cljs.core');
goog.require('clojure.set');
goog.require('clojure.string');
goog.require('hoplon.core');
goog.require('hoplon.svg');
goog.require('javelin.core');
goog.require('lsobot.acmi');
goog.require('weathergen.coordinates');
goog.require('weathergen.falcon.files.mission');
goog.require('weathergen.filesystem');
goog.require('weathergen.ui.buttons');
goog.require('weathergen.ui.common');
goog.require('weathergen.ui.grids');
weathergen.ui.layers.acmi.electron = require("electron");
weathergen.ui.layers.acmi.load_acmi = (function weathergen$ui$layers$acmi$load_acmi(acmis){
var vec__35451 = weathergen.ui.layers.acmi.electron.remote.dialog.showOpenDialog(cljs.core.clj__GT_js.call(null,new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"title","title",636505583),"Select an ACMI file",new cljs.core.Keyword(null,"properties","properties",685819552),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, ["openFile"], null),new cljs.core.Keyword(null,"filters","filters",974726919),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"name","name",1843675177),"ACMI",new cljs.core.Keyword(null,"extensions","extensions",-1103629196),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, ["acmi"], null)], null)], null)], null)));
var path = cljs.core.nth.call(null,vec__35451,(0),null);
if(cljs.core.truth_(path)){
var data = lsobot.acmi.read_acmi.call(null,weathergen.filesystem.file_text.call(null,path));
return cljs.core.swap_BANG_.call(null,acmis,cljs.core.assoc,path,data);
} else {
return null;
}
});
weathergen.ui.layers.acmi.overlay = (function weathergen$ui$layers$acmi$overlay(mission,p__35454){
var map__35455 = p__35454;
var map__35455__$1 = (((((!((map__35455 == null))))?(((((map__35455.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35455.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35455):map__35455);
var state = map__35455__$1;
var suppress_bullseye_info_box_QMARK_ = cljs.core.get.call(null,map__35455__$1,new cljs.core.Keyword(null,"suppress-bullseye-info-box?","suppress-bullseye-info-box?",-1654633798));
var map_zoom = cljs.core.get.call(null,map__35455__$1,new cljs.core.Keyword(null,"map-zoom","map-zoom",1543291337));
var acmis = cljs.core.get.call(null,map__35455__$1,new cljs.core.Keyword(null,"acmis","acmis",-658811979));
return hoplon.svg.g.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"ACMI layer",weathergen.ui.common.keyed_loop_tpl_STAR_.call(null,acmis,cljs.core.key,((function (map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (item__15894__auto__){
var vec__35463 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (p__35466){
var vec__35467 = p__35466;
var path = cljs.core.nth.call(null,vec__35467,(0),null);
var _ = cljs.core.nth.call(null,vec__35467,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [path,_], null);
});})(map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,item__15894__auto__));
var path = cljs.core.nth.call(null,vec__35463,(0),null);
var _ = cljs.core.nth.call(null,vec__35463,(1),null);
var data = weathergen.ui.common.map_lens.call(null,acmis,path);
var frame = javelin.core.formula.call(null,((function (data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (data__$1){
return cljs.core.last.call(null,new cljs.core.Keyword("lsobot.acmi","frames","lsobot.acmi/frames",1165126782).cljs$core$IFn$_invoke$arity$1(data__$1));
});})(data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,data);
var entities = javelin.core.formula.call(null,((function (frame,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (frame__$1){
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.filter.call(null,((function (frame,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (p__35470){
var vec__35471 = p__35470;
var entity_id = cljs.core.nth.call(null,vec__35471,(0),null);
var entity = cljs.core.nth.call(null,vec__35471,(1),null);
return cljs.core.empty_QMARK_.call(null,clojure.set.intersection.call(null,new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 3, ["Weapon",null,"Air",null,"Decoy",null], null), null),new cljs.core.Keyword("lsobot.acmi","object-type","lsobot.acmi/object-type",-1018781700).cljs$core$IFn$_invoke$arity$1(entity)));
});})(frame,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
,new cljs.core.Keyword("lsobot.acmi","entities","lsobot.acmi/entities",1464472374).cljs$core$IFn$_invoke$arity$1(frame__$1)));
});})(frame,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,frame);
var aspect_ratio = 2.8;
var width = 0.4;
var height = (width * aspect_ratio);
var tip_size = 3.5;
var tip_entity = javelin.core.cell.call(null,null);
hoplon.core.do_watch.call(null,tip_entity,((function (frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (___$1,n){
return cljs.core.reset_BANG_.call(null,suppress_bullseye_info_box_QMARK_,n);
});})(frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
);

return hoplon.svg.g.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),path,new cljs.core.Keyword(null,"entities","entities",1940967403),javelin.core.formula.call(null,((function (frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35475,G__35474){
return G__35474.call(null,G__35475);
});})(frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,entities,cljs.core.count),hoplon.svg.g.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"entities",weathergen.ui.common.keyed_loop_tpl_STAR_.call(null,entities,cljs.core.key,((function (frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (item__15894__auto____$1){
var vec__35482 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (p__35485){
var vec__35486 = p__35485;
var entity_id = cljs.core.nth.call(null,vec__35486,(0),null);
var ___$1 = cljs.core.nth.call(null,vec__35486,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [___$1,entity_id], null);
});})(frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,item__15894__auto____$1));
var ___$1 = cljs.core.nth.call(null,vec__35482,(0),null);
var entity_id = cljs.core.nth.call(null,vec__35482,(1),null);
var entity = weathergen.ui.common.map_lens.call(null,entities,entity_id);
var coords = javelin.core.formula.call(null,((function (entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (mission__$1,entity__$1){
var map__35489 = entity__$1;
var map__35489__$1 = (((((!((map__35489 == null))))?(((((map__35489.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35489.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35489):map__35489);
var u = cljs.core.get.call(null,map__35489__$1,new cljs.core.Keyword("lsobot.acmi","u","lsobot.acmi/u",-2031949174));
var v = cljs.core.get.call(null,map__35489__$1,new cljs.core.Keyword("lsobot.acmi","v","lsobot.acmi/v",855883566));
return weathergen.coordinates.acmi__GT_weather.call(null,mission__$1,u,v);
});})(entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,mission,entity);
return hoplon.svg.g.call(null,new cljs.core.Keyword(null,"transform","transform",1381301764),javelin.core.formula.call(null,((function (coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (coords__$1,map_zoom__$1){
var map__35491 = coords__$1;
var map__35491__$1 = (((((!((map__35491 == null))))?(((((map__35491.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35491.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35491):map__35491);
var x = cljs.core.get.call(null,map__35491__$1,new cljs.core.Keyword(null,"x","x",2099068185));
var y = cljs.core.get.call(null,map__35491__$1,new cljs.core.Keyword(null,"y","y",-1757859776));
return weathergen.ui.common.svg_xform_combine.call(null,weathergen.ui.common.svg_translate.call(null,x,y),weathergen.ui.common.svg_scale.call(null,(1.0 / map_zoom__$1)));
});})(coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,coords,map_zoom),hoplon.svg.rect.call(null,new cljs.core.Keyword(null,"transform","transform",1381301764),javelin.core.formula.call(null,((function (coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (entity__$1){
return weathergen.ui.common.svg_rotate.call(null,new cljs.core.Keyword("lsobot.acmi","heading","lsobot.acmi/heading",1518406858).cljs$core$IFn$_invoke$arity$2(entity__$1,(90)));
});})(coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,entity),new cljs.core.Keyword(null,"mouseenter","mouseenter",-1792413560),((function (coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
return cljs.core.reset_BANG_.call(null,tip_entity,cljs.core.deref.call(null,entity_id));
});})(coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
,new cljs.core.Keyword(null,"mouseleave","mouseleave",531566580),((function (coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
return cljs.core.reset_BANG_.call(null,tip_entity,null);
});})(coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
,new cljs.core.Keyword(null,"x","x",2099068185),(width / (-2)),new cljs.core.Keyword(null,"y","y",-1757859776),(height / (-2)),new cljs.core.Keyword(null,"width","width",-384071477),width,new cljs.core.Keyword(null,"height","height",1025178622),height,new cljs.core.Keyword(null,"fill","fill",883462889),javelin.core.formula.call(null,((function (coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35493,G__35494){
return G__35493.call(null,(function (){var or__4131__auto__ = new cljs.core.Keyword("lsobot.acmi","color","lsobot.acmi/color",-369571990).cljs$core$IFn$_invoke$arity$1(G__35494);
if(cljs.core.truth_(or__4131__auto__)){
return or__4131__auto__;
} else {
return "black";
}
})());
});})(coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,clojure.string.lower_case,entity),new cljs.core.Keyword(null,"stroke","stroke",1741823555),"black",new cljs.core.Keyword(null,"stroke-width","stroke-width",716836435),javelin.core.formula.call(null,((function (coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35496,G__35497,G__35495,G__35498){
return ((G__35495 / (25)) * (cljs.core.truth_(G__35496.call(null,G__35497,G__35498))?(2):(1)));
});})(coords,entity,vec__35482,___$1,entity_id,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,cljs.core._EQ_,tip_entity,width,entity_id)));
});})(frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
)),hoplon.svg.g.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),javelin.core.formula.call(null,((function (frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35499){
return ["Tooltip: tip entity ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__35499)].join('');
});})(frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,tip_entity),(function (){var con__30287__auto__ = (new cljs.core.Delay(((function (frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
var entity = javelin.core.formula.call(null,((function (frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35500,G__35502,G__35501){
return G__35500.call(null,G__35501,G__35502);
});})(frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,cljs.core.get,tip_entity,entities);
var coords = javelin.core.formula.call(null,((function (entity,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (mission__$1,entity__$1){
if(cljs.core.truth_(entity__$1)){
var map__35503 = entity__$1;
var map__35503__$1 = (((((!((map__35503 == null))))?(((((map__35503.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35503.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35503):map__35503);
var u = cljs.core.get.call(null,map__35503__$1,new cljs.core.Keyword("lsobot.acmi","u","lsobot.acmi/u",-2031949174));
var v = cljs.core.get.call(null,map__35503__$1,new cljs.core.Keyword("lsobot.acmi","v","lsobot.acmi/v",855883566));
return weathergen.coordinates.acmi__GT_weather.call(null,mission__$1,u,v);
} else {
return null;
}
});})(entity,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,mission,entity);
return hoplon.svg.g.call(null,new cljs.core.Keyword(null,"debug","debug",-1608172596),"Tooltip",new cljs.core.Keyword(null,"transform","transform",1381301764),javelin.core.formula.call(null,((function (entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (coords__$1,map_zoom__$1){
var map__35505 = coords__$1;
var map__35505__$1 = (((((!((map__35505 == null))))?(((((map__35505.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35505.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35505):map__35505);
var x = cljs.core.get.call(null,map__35505__$1,new cljs.core.Keyword(null,"x","x",2099068185));
var y = cljs.core.get.call(null,map__35505__$1,new cljs.core.Keyword(null,"y","y",-1757859776));
return weathergen.ui.common.svg_xform_combine.call(null,weathergen.ui.common.svg_translate.call(null,x,y),weathergen.ui.common.svg_scale.call(null,(1.0 / map_zoom__$1)));
});})(entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,coords,map_zoom),(function (){var G__35507 = javelin.core.cell.call(null,(0));
var G__35508 = javelin.core.cell.call(null,(0));
var w = javelin.core.cell.call(null,(0));
var h = javelin.core.cell.call(null,(0));
var t = hoplon.svg.text.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"pointer-events","pointer-events",-1053858853),"none"], null),new cljs.core.Keyword(null,"x","x",2099068185),(0),new cljs.core.Keyword(null,"y","y",-1757859776),(0),javelin.core.formula.call(null,((function (G__35507,G__35508,w,h,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35509){
return new cljs.core.Keyword("lsobot.acmi","name","lsobot.acmi/name",298845436).cljs$core$IFn$_invoke$arity$1(G__35509);
});})(G__35507,G__35508,w,h,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,entity));
var update_bbox__15859__auto__ = ((function (G__35507,G__35508,w,h,t,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
return javelin.core.dosync_STAR_.call(null,((function (G__35507,G__35508,w,h,t,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
var bb__15860__auto__ = t.getBBox();
if(cljs.core.truth_(bb__15860__auto__.x)){
cljs.core.reset_BANG_.call(null,G__35507,bb__15860__auto__.x);

cljs.core.reset_BANG_.call(null,G__35508,bb__15860__auto__.y);

cljs.core.reset_BANG_.call(null,w,bb__15860__auto__.width);

return cljs.core.reset_BANG_.call(null,h,bb__15860__auto__.height);
} else {
return null;
}
});})(G__35507,G__35508,w,h,t,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
);
});})(G__35507,G__35508,w,h,t,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
;
setTimeout(((function (G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
return update_bbox__15859__auto__.call(null);
});})(G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
,(0));

var temp__5720__auto___35516 = entity;
if(cljs.core.truth_(temp__5720__auto___35516)){
var w__15861__auto___35517 = temp__5720__auto___35516;
cljs.core.add_watch.call(null,w__15861__auto___35517,cljs.core.keyword.call(null,cljs.core.gensym.call(null)),((function (w__15861__auto___35517,temp__5720__auto___35516,G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (___$1,___$2,___$3,___$4){
return setTimeout(((function (w__15861__auto___35517,temp__5720__auto___35516,G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
return update_bbox__15859__auto__.call(null);
});})(w__15861__auto___35517,temp__5720__auto___35516,G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
,(0));
});})(w__15861__auto___35517,temp__5720__auto___35516,G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
);
} else {
}

return hoplon.svg.g.call(null,new cljs.core.Keyword(null,"transform","transform",1381301764),weathergen.ui.common.svg_scale.call(null,0.06),hoplon.svg.rect.call(null,new cljs.core.Keyword(null,"css","css",1135045163),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"pointer-events","pointer-events",-1053858853),"none"], null),new cljs.core.Keyword(null,"x","x",2099068185),javelin.core.formula.call(null,((function (G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35510){
return (G__35510 * -0.05);
});})(G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,w),new cljs.core.Keyword(null,"y","y",-1757859776),javelin.core.formula.call(null,((function (G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35511){
return (- (0.8 * G__35511));
});})(G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,h),new cljs.core.Keyword(null,"width","width",-384071477),javelin.core.formula.call(null,((function (G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35512){
return (G__35512 * 1.1);
});})(G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,w),new cljs.core.Keyword(null,"height","height",1025178622),h,new cljs.core.Keyword(null,"fill","fill",883462889),javelin.core.formula.call(null,((function (G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (G__35514,G__35515,G__35513){
return G__35513.call(null,G__35514.call(null,(function (){var or__4131__auto__ = new cljs.core.Keyword("lsobot.acmi","color","lsobot.acmi/color",-369571990).cljs$core$IFn$_invoke$arity$1(G__35515);
if(cljs.core.truth_(or__4131__auto__)){
return or__4131__auto__;
} else {
return "black";
}
})()),(40));
});})(G__35507,G__35508,w,h,t,update_bbox__15859__auto__,entity,coords,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
).call(null,clojure.string.lower_case,entity,weathergen.ui.common.lighten),new cljs.core.Keyword(null,"opacity","opacity",397153780),0.8,new cljs.core.Keyword(null,"stroke","stroke",1741823555),"black",new cljs.core.Keyword(null,"stroke-width","stroke-width",716836435),(width / (50))),t);
})());
});})(frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
,null));
var alt__30288__auto__ = (new cljs.core.Delay(((function (con__30287__auto__,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (){
return null;
});})(con__30287__auto__,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
,null));
var tpl__30289__auto__ = ((function (con__30287__auto__,alt__30288__auto__,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis){
return (function (p__30290__auto__){
return cljs.core.deref.call(null,(function (){var or__4131__auto__ = (cljs.core.truth_(p__30290__auto__)?con__30287__auto__:alt__30288__auto__);
if(cljs.core.truth_(or__4131__auto__)){
return or__4131__auto__;
} else {
return cljs.core.atom.call(null,null);
}
})());
});})(con__30287__auto__,alt__30288__auto__,frame,entities,aspect_ratio,width,height,tip_size,tip_entity,data,vec__35463,path,_,map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
;
return javelin.core.formula.call(null,tpl__30289__auto__).call(null,tip_entity);
})()));
});})(map__35455,map__35455__$1,state,suppress_bullseye_info_box_QMARK_,map_zoom,acmis))
));
});
weathergen.ui.layers.acmi.controls = (function weathergen$ui$layers$acmi$controls(mission,p__35518){
var map__35519 = p__35518;
var map__35519__$1 = (((((!((map__35519 == null))))?(((((map__35519.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35519.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35519):map__35519);
var state = map__35519__$1;
var acmis = cljs.core.get.call(null,map__35519__$1,new cljs.core.Keyword(null,"acmis","acmis",-658811979));
var current_t = javelin.core.cell.call(null,(0));
var max_t = javelin.core.cell.call(null,(0));
return hoplon.core.div.call(null,weathergen.ui.common.control_section.call(null,new cljs.core.Keyword(null,"title","title",636505583),"ACMI Import",weathergen.ui.buttons.a_button.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (current_t,max_t,map__35519,map__35519__$1,state,acmis){
return (function (_){
return javelin.core.dosync_STAR_.call(null,((function (current_t,max_t,map__35519,map__35519__$1,state,acmis){
return (function (){
weathergen.ui.layers.acmi.load_acmi.call(null,acmis);

cljs.core.reset_BANG_.call(null,current_t,new cljs.core.Keyword("lsobot.acmi","t","lsobot.acmi/t",1347958254).cljs$core$IFn$_invoke$arity$1(cljs.core.last.call(null,new cljs.core.Keyword("lsobot.acmi","frames","lsobot.acmi/frames",1165126782).cljs$core$IFn$_invoke$arity$1(cljs.core.val.call(null,cljs.core.first.call(null,cljs.core.deref.call(null,acmis)))))));

return cljs.core.reset_BANG_.call(null,max_t,cljs.core.deref.call(null,current_t));
});})(current_t,max_t,map__35519,map__35519__$1,state,acmis))
);
});})(current_t,max_t,map__35519,map__35519__$1,state,acmis))
,new cljs.core.Keyword(null,"disabled?","disabled?",-1523234181),javelin.core.formula.call(null,((function (current_t,max_t,map__35519,map__35519__$1,state,acmis){
return (function (G__35522,G__35521,G__35523){
return G__35521.call(null,G__35522.call(null,G__35523));
});})(current_t,max_t,map__35519,map__35519__$1,state,acmis))
).call(null,cljs.core.empty_QMARK_,cljs.core.not,acmis),"Load ACMI"),weathergen.ui.buttons.a_button.call(null,new cljs.core.Keyword(null,"click","click",1912301393),((function (current_t,max_t,map__35519,map__35519__$1,state,acmis){
return (function (_){
return cljs.core.reset_BANG_.call(null,acmis,cljs.core.PersistentArrayMap.EMPTY);
});})(current_t,max_t,map__35519,map__35519__$1,state,acmis))
,"Clear"),weathergen.ui.common.keyed_loop_tpl_STAR_.call(null,acmis,cljs.core.key,((function (current_t,max_t,map__35519,map__35519__$1,state,acmis){
return (function (item__15894__auto__){
var vec__35530 = javelin.core.cell_map.call(null,cljs.core.identity,javelin.core.formula.call(null,((function (current_t,max_t,map__35519,map__35519__$1,state,acmis){
return (function (p__35533){
var vec__35534 = p__35533;
var path = cljs.core.nth.call(null,vec__35534,(0),null);
var _ = cljs.core.nth.call(null,vec__35534,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [path,_], null);
});})(current_t,max_t,map__35519,map__35519__$1,state,acmis))
).call(null,item__15894__auto__));
var path = cljs.core.nth.call(null,vec__35530,(0),null);
var _ = cljs.core.nth.call(null,vec__35530,(1),null);
var data = weathergen.ui.common.map_lens.call(null,acmis,path);
return hoplon.core.div.call(null,javelin.core.formula.call(null,((function (data,vec__35530,path,_,current_t,max_t,map__35519,map__35519__$1,state,acmis){
return (function (G__35540,G__35537,G__35539,G__35538){
if(cljs.core.truth_(G__35537)){
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__35538.call(null,G__35537))," (",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__35539.call(null,new cljs.core.Keyword("lsobot.acmi","frames","lsobot.acmi/frames",1165126782).cljs$core$IFn$_invoke$arity$1(G__35540)))," frames)"].join('');
} else {
return null;
}
});})(data,vec__35530,path,_,current_t,max_t,map__35519,map__35519__$1,state,acmis))
).call(null,data,path,cljs.core.count,weathergen.filesystem.basename),weathergen.ui.common.validating_edit.call(null,new cljs.core.Keyword(null,"conform","conform",1846236460),weathergen.ui.common.conform_nonnegative_float,new cljs.core.Keyword(null,"fmt","fmt",332300772),cljs.core.str,new cljs.core.Keyword(null,"source","source",-433931539),current_t));
});})(current_t,max_t,map__35519,map__35519__$1,state,acmis))
)));
});
weathergen.ui.layers.acmi.create = (function weathergen$ui$layers$acmi$create(mission,p__35541){
var map__35542 = p__35541;
var map__35542__$1 = (((((!((map__35542 == null))))?(((((map__35542.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__35542.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__35542):map__35542);
var state = map__35542__$1;
var map_zoom = cljs.core.get.call(null,map__35542__$1,new cljs.core.Keyword(null,"map-zoom","map-zoom",1543291337));
var state_STAR_ = cljs.core.assoc.call(null,state,new cljs.core.Keyword(null,"acmis","acmis",-658811979),javelin.core.cell.call(null,cljs.core.PersistentArrayMap.EMPTY));
return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"controls-fn","controls-fn",-807620277),((function (state_STAR_,map__35542,map__35542__$1,state,map_zoom){
return (function (){
return weathergen.ui.layers.acmi.controls.call(null,mission,state_STAR_);
});})(state_STAR_,map__35542,map__35542__$1,state,map_zoom))
,new cljs.core.Keyword(null,"overlay-fn","overlay-fn",1005125217),((function (state_STAR_,map__35542,map__35542__$1,state,map_zoom){
return (function (){
return weathergen.ui.layers.acmi.overlay.call(null,mission,state_STAR_);
});})(state_STAR_,map__35542,map__35542__$1,state,map_zoom))
,new cljs.core.Keyword(null,"state","state",-1988618099),state_STAR_], null);
});
