// Compiled by ClojureScript 1.9.229 {}
goog.provide('swinging_needle_meter.swinging_needle_meter');
goog.require('cljs.core');
goog.require('clojure.string');
goog.require('re_com.core');
goog.require('re_com.box');
goog.require('re_com.util');
goog.require('re_com.validate');
goog.require('reagent.core');
goog.require('swinging_needle_meter.utils');
swinging_needle_meter.swinging_needle_meter.swinging_needle_args_desc = new cljs.core.PersistentVector(null, 22, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"model","model",331153215),new cljs.core.Keyword(null,"required","required",1807647006),true,new cljs.core.Keyword(null,"type","type",1174270348),"double | atom",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),re_com.validate.number_or_string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"current value of the variable being watched. A number between 0 and 100"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"setpoint","setpoint",749640023),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"double | atom",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),re_com.validate.number_or_string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"current setpoint for the variable being watched, if any. A number between 0 and 100"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"width","width",-384071477),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"integer",new cljs.core.Keyword(null,"default","default",-1987822328),"300",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.integer_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"a CSS width"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"height","height",1025178622),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"integer",new cljs.core.Keyword(null,"default","default",-1987822328),"200",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.integer_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"a CSS height"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"min-value","min-value",-1119123315),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"double",new cljs.core.Keyword(null,"default","default",-1987822328),(0),new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.number_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"the minimum value model can take"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"max-value","max-value",687805168),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"double",new cljs.core.Keyword(null,"default","default",-1987822328),(100),new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.number_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"the maximum value model can take"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"warn-value","warn-value",188022914),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"double",new cljs.core.Keyword(null,"default","default",-1987822328),(80),new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.number_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"the maximum safe value model can take"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"tolerance","tolerance",406811818),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"double",new cljs.core.Keyword(null,"default","default",-1987822328),(3),new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.number_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"the amount by which model can differ from setpoint and still be considered acceptable"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"class","class",-2030961996),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, for the top-level SVG element"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"alarm-class","alarm-class",-237513865),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-warning",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, applied to the frame in an alarm condition"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"cursor-class","cursor-class",-1307141687),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-cursor",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, for the cursor"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"frame-class","frame-class",-1416443328),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-frame",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, for the frame"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"hub-class","hub-class",1546469457),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-hub",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, for the hub"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"needle-class","needle-class",-50852220),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-needle",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, for the needle"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"scale-class","scale-class",787441037),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-scale",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, for the scale"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"redzone-class","redzone-class",214162240),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-redzone",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, for the redzone"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"target-class","target-class",-955367984),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"snm-target",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated, , applied to the frame in an on-target condition"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"unit","unit",375175175),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"Unit to show after the value"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"default","default",-1987822328),"meter",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"Element id for this instance of the meter"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"gradations","gradations",1411381107),new cljs.core.Keyword(null,"reduired","reduired",78055068),false,new cljs.core.Keyword(null,"type","type",1174270348),"integer",new cljs.core.Keyword(null,"default","default",-1987822328),(5),new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.integer_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"Number of gradations to show on the scale, not counting the point."], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"style","style",-496642736),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"CSS style map",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),re_com.validate.css_style_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS styles to add or override"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"attr","attr",-604132353),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"HTML attr map",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),re_com.validate.html_attr_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 9, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),"HTML attributes, like ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":on-mouse-move"], null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"br","br",934104792)], null),"No ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":class"], null)," or ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":style"], null),"allowed"], null)], null)], null);
swinging_needle_meter.swinging_needle_meter.full_scale_deflection = (140);
/**
 * Return the linear deflection of a needle given this `value` on the
 *   range `min-value`...`max-value`.
 */
swinging_needle_meter.swinging_needle_meter.deflection = (function swinging_needle_meter$swinging_needle_meter$deflection(value,min_value,max_value){
var range = (max_value - min_value);
var zero_offset = (((0) - min_value) / range);
var limited = (function (){var x__25468__auto__ = (function (){var x__25461__auto__ = (zero_offset + (value / range));
var y__25462__auto__ = (0);
return ((x__25461__auto__ > y__25462__auto__) ? x__25461__auto__ : y__25462__auto__);
})();
var y__25469__auto__ = (1);
return ((x__25468__auto__ < y__25469__auto__) ? x__25468__auto__ : y__25469__auto__);
})();
return ((limited - 0.5) * swinging_needle_meter.swinging_needle_meter.full_scale_deflection);
});
/**
 * Return, as a map with keys :x. :y, the cartesian coordinates at the point
 * `radius` distance at `theta` (degrees) angle from a point at
 * cartesian coordinates `cx`, `cy`.
 */
swinging_needle_meter.swinging_needle_meter.polar_to_cartesian = (function swinging_needle_meter$swinging_needle_meter$polar_to_cartesian(cx,cy,radius,theta){
var in_radians = (((theta - (90)) * (Math["PI"])) / 180.0);
return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"x","x",2099068185),(cx + (radius * Math.cos(in_radians))),new cljs.core.Keyword(null,"y","y",-1757859776),(cy + (radius * Math.sin(in_radians)))], null);
});
/**
 * Return as a string an SVG path definition describing an arc centred
 * at `cx`, cy` starting at `start-angle` and ending at `end-angle` (both
 * angles in degrees).
 */
swinging_needle_meter.swinging_needle_meter.describe_arc = (function swinging_needle_meter$swinging_needle_meter$describe_arc(cx,cy,radius,start_angle,end_angle){
var start = swinging_needle_meter.swinging_needle_meter.polar_to_cartesian.call(null,cx,cy,radius,start_angle);
var end = swinging_needle_meter.swinging_needle_meter.polar_to_cartesian.call(null,cx,cy,radius,end_angle);
var large_arc_QMARK_ = ((((end_angle - start_angle) <= (180)))?(0):(1));
var sweep = (((end_angle > start_angle))?(1):(0));
return clojure.string.join.call(null," ",new cljs.core.PersistentVector(null, 11, 5, cljs.core.PersistentVector.EMPTY_NODE, ["M",new cljs.core.Keyword(null,"x","x",2099068185).cljs$core$IFn$_invoke$arity$1(start),new cljs.core.Keyword(null,"y","y",-1757859776).cljs$core$IFn$_invoke$arity$1(start),"A",radius,radius,(0),large_arc_QMARK_,sweep,new cljs.core.Keyword(null,"x","x",2099068185).cljs$core$IFn$_invoke$arity$1(end),new cljs.core.Keyword(null,"y","y",-1757859776).cljs$core$IFn$_invoke$arity$1(end)], null));
});
/**
 * If this arg is a floating point number, format it to a reasonable width; else return it.
 */
swinging_needle_meter.swinging_needle_meter.as_label = (function swinging_needle_meter$swinging_needle_meter$as_label(arg){
if((typeof arg === 'number') && (!(cljs.core.integer_QMARK_.call(null,arg)))){
return arg.toFixed((2));
} else {
return arg;
}
});
/**
 * Return as a string an SVG path definition describing a radial stroke from a center
 *   at `cx`, cy` starting at `min-radius` and extending to `max-radius`.
 */
swinging_needle_meter.swinging_needle_meter.gradation = (function swinging_needle_meter$swinging_needle_meter$gradation(cx,cy,min_radius,max_radius,angle,label){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"g","g",1738089905),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"class","class",-2030961996),"snm-gradation",new cljs.core.Keyword(null,"transform","transform",1381301764),clojure.string.join.call(null," ",new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, ["rotate(",angle,cx,cy,")"], null))], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"path","path",-188191168),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"d","d",1972142424),clojure.string.join.call(null," ",new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, ["M",cx,(cy - (min_radius + ((max_radius - min_radius) * 0.333))),"L",cx,(cy - max_radius)], null))], null)], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"text","text",-1790561697),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"text-anchor","text-anchor",585613696),"middle",new cljs.core.Keyword(null,"x","x",2099068185),cx,new cljs.core.Keyword(null,"y","y",-1757859776),(cy - min_radius)], null),swinging_needle_meter.swinging_needle_meter.as_label.call(null,label)], null)], null);
});
/**
 * return the argument, as a string, with 'mm' appended
 */
swinging_needle_meter.swinging_needle_meter.as_mm = (function swinging_needle_meter$swinging_needle_meter$as_mm(arg){
return [cljs.core.str(arg),cljs.core.str("mm")].join('');
});
/**
 * Render an SVG swinging needle meter
 */
swinging_needle_meter.swinging_needle_meter.swinging_needle_meter = (function swinging_needle_meter$swinging_needle_meter$swinging_needle_meter(var_args){
var args__26212__auto__ = [];
var len__26205__auto___32590 = arguments.length;
var i__26206__auto___32591 = (0);
while(true){
if((i__26206__auto___32591 < len__26205__auto___32590)){
args__26212__auto__.push((arguments[i__26206__auto___32591]));

var G__32592 = (i__26206__auto___32591 + (1));
i__26206__auto___32591 = G__32592;
continue;
} else {
}
break;
}

var argseq__26213__auto__ = ((((0) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((0)),(0),null)):null);
return swinging_needle_meter.swinging_needle_meter.swinging_needle_meter.cljs$core$IFn$_invoke$arity$variadic(argseq__26213__auto__);
});

swinging_needle_meter.swinging_needle_meter.swinging_needle_meter.cljs$core$IFn$_invoke$arity$variadic = (function (p__32587){
var map__32588 = p__32587;
var map__32588__$1 = ((((!((map__32588 == null)))?((((map__32588.cljs$lang$protocol_mask$partition0$ & (64))) || (map__32588.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__32588):map__32588);
var args = map__32588__$1;
var height = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"height","height",1025178622),(200));
var model = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"model","model",331153215));
var attr = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"attr","attr",-604132353));
var frame_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"frame-class","frame-class",-1416443328),"snm-frame");
var redzone_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"redzone-class","redzone-class",214162240),"snm-redzone");
var warn_value = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"warn-value","warn-value",188022914),(80));
var needle_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"needle-class","needle-class",-50852220),"snm-needle");
var unit = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"unit","unit",375175175));
var cursor_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"cursor-class","cursor-class",-1307141687),"snm-cursor");
var tolerance = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"tolerance","tolerance",406811818),(3));
var width = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"width","width",-384071477),(300));
var min_value = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"min-value","min-value",-1119123315),(0));
var scale_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"scale-class","scale-class",787441037),"snm-scale");
var target_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"target-class","target-class",-955367984),"snm-target");
var max_value = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"max-value","max-value",687805168),(100));
var style = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"style","style",-496642736));
var hub_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"hub-class","hub-class",1546469457),"snm-hub");
var gradations = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"gradations","gradations",1411381107),(5));
var id = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"id","id",-1388402092),"meter");
var class$ = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"class","class",-2030961996));
var alarm_class = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"alarm-class","alarm-class",-237513865),"snm-warning");
var setpoint = cljs.core.get.call(null,map__32588__$1,new cljs.core.Keyword(null,"setpoint","setpoint",749640023));
if(cljs.core.truth_(((!(goog.DEBUG))?true:re_com.validate.validate_args.call(null,re_com.validate.extract_arg_data.call(null,swinging_needle_meter.swinging_needle_meter.swinging_needle_args_desc),args,"swinging-needle")))){
} else {
throw (new Error("Assert failed: (validate-args-macro swinging-needle-args-desc args \"swinging-needle\")"));
}

var model__$1 = re_com.util.deref_or_value.call(null,model);
var setpoint__$1 = re_com.util.deref_or_value.call(null,setpoint);
var mid_point_deflection = (swinging_needle_meter.swinging_needle_meter.full_scale_deflection / (2));
var cx = (width / (2));
var cy = (height * 0.9);
var needle_length = (height * 0.75);
var scale_radius = (height * 0.7);
var gradation_inner = (height * 0.55);
return new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.core.box,new cljs.core.Keyword(null,"align","align",1964212802),new cljs.core.Keyword(null,"start","start",-355208981),new cljs.core.Keyword(null,"child","child",623967545),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"div","div",1057191632),cljs.core.merge.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"class","class",-2030961996),[cljs.core.str("swinging-needle  "),cljs.core.str(class$),cljs.core.str(" "),cljs.core.str([cljs.core.str(((((min_value < model__$1)) && ((model__$1 < warn_value)))?"":[cljs.core.str(" "),cljs.core.str(alarm_class)].join(''))),cljs.core.str(((((setpoint__$1 > min_value)) && ((swinging_needle_meter.utils.abs.call(null,(model__$1 - setpoint__$1)) < tolerance)))?[cljs.core.str(" "),cljs.core.str(target_class)].join(''):""))].join(''))].join(''),new cljs.core.Keyword(null,"style","style",-496642736),cljs.core.merge.call(null,re_com.box.flex_child_style.call(null,"none"),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"width","width",-384071477),width,new cljs.core.Keyword(null,"height","height",1025178622),height], null),style)], null),attr),new cljs.core.PersistentVector(null, 10, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"svg","svg",856789142),cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"y","y",-1757859776),new cljs.core.Keyword(null,"xmlSpace","xmlSpace",-52614622),new cljs.core.Keyword(null,"overflow","overflow",2058931880),new cljs.core.Keyword(null,"width","width",-384071477),new cljs.core.Keyword(null,"id","id",-1388402092),new cljs.core.Keyword(null,"class","class",-2030961996),new cljs.core.Keyword(null,"x","x",2099068185),new cljs.core.Keyword(null,"version","version",425292698),new cljs.core.Keyword(null,"viewBox","viewBox",-469489477),new cljs.core.Keyword(null,"height","height",1025178622)],["0px","preserve","visible",[cljs.core.str(width),cljs.core.str("px")].join(''),id,[cljs.core.str("snm-meter "),cljs.core.str(class$)].join(''),"0px","1.1",clojure.string.join.call(null," ",new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(0),width,height], null)),[cljs.core.str(height),cljs.core.str("px")].join('')]),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"text","text",-1790561697),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"text-anchor","text-anchor",585613696),"middle",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),"100",new cljs.core.Keyword(null,"id","id",-1388402092),[cljs.core.str(id),cljs.core.str("-current-value")].join(''),new cljs.core.Keyword(null,"class","class",-2030961996),"snm-value"], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"tspan","tspan",-1557853197),[cljs.core.str(swinging_needle_meter.swinging_needle_meter.as_label.call(null,model__$1)),cljs.core.str((cljs.core.truth_(unit)?" ":null)),cljs.core.str(unit)].join('')], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"path","path",-188191168),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"class","class",-2030961996),scale_class,new cljs.core.Keyword(null,"id","id",-1388402092),[cljs.core.str(id),cljs.core.str("-scale")].join(''),new cljs.core.Keyword(null,"d","d",1972142424),swinging_needle_meter.swinging_needle_meter.describe_arc.call(null,cx,cy,scale_radius,swinging_needle_meter.swinging_needle_meter.deflection.call(null,min_value,min_value,max_value),swinging_needle_meter.swinging_needle_meter.deflection.call(null,max_value,min_value,max_value))], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"path","path",-188191168),new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"class","class",-2030961996),redzone_class,new cljs.core.Keyword(null,"id","id",-1388402092),[cljs.core.str(id),cljs.core.str("-redzone")].join(''),new cljs.core.Keyword(null,"d","d",1972142424),swinging_needle_meter.swinging_needle_meter.describe_arc.call(null,cx,cy,scale_radius,swinging_needle_meter.swinging_needle_meter.deflection.call(null,warn_value,min_value,max_value),swinging_needle_meter.swinging_needle_meter.deflection.call(null,max_value,min_value,max_value))], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"path","path",-188191168),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"class","class",-2030961996),cursor_class,new cljs.core.Keyword(null,"id","id",-1388402092),[cljs.core.str(id),cljs.core.str("-cursor")].join(''),new cljs.core.Keyword(null,"d","d",1972142424),[cljs.core.str("M "),cljs.core.str(cx),cljs.core.str(","),cljs.core.str((cy - needle_length)),cljs.core.str(" "),cljs.core.str(cx),cljs.core.str(","),cljs.core.str(cy)].join(''),new cljs.core.Keyword(null,"visibility","visibility",1338380893),(((typeof setpoint__$1 === 'number') && ((setpoint__$1 > min_value)))?"visible":"hidden"),new cljs.core.Keyword(null,"transform","transform",1381301764),[cljs.core.str("rotate( "),cljs.core.str(swinging_needle_meter.swinging_needle_meter.deflection.call(null,setpoint__$1,min_value,max_value)),cljs.core.str(","),cljs.core.str(cx),cljs.core.str(","),cljs.core.str(cy),cljs.core.str(")")].join('')], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"path","path",-188191168),new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"class","class",-2030961996),needle_class,new cljs.core.Keyword(null,"id","id",-1388402092),[cljs.core.str(id),cljs.core.str("-needle")].join(''),new cljs.core.Keyword(null,"d","d",1972142424),[cljs.core.str("M "),cljs.core.str(cx),cljs.core.str(","),cljs.core.str((cy - needle_length)),cljs.core.str(" "),cljs.core.str(cx),cljs.core.str(","),cljs.core.str(cy)].join(''),new cljs.core.Keyword(null,"transform","transform",1381301764),[cljs.core.str("rotate( "),cljs.core.str(swinging_needle_meter.swinging_needle_meter.deflection.call(null,model__$1,min_value,max_value)),cljs.core.str(","),cljs.core.str(cx),cljs.core.str(","),cljs.core.str(cy),cljs.core.str(")")].join('')], null)], null),(((gradations > (0)))?cljs.core.apply.call(null,cljs.core.vector,cljs.core.cons.call(null,new cljs.core.Keyword(null,"g","g",1738089905),cljs.core.map.call(null,((function (model__$1,setpoint__$1,mid_point_deflection,cx,cy,needle_length,scale_radius,gradation_inner,map__32588,map__32588__$1,args,height,model,attr,frame_class,redzone_class,warn_value,needle_class,unit,cursor_class,tolerance,width,min_value,scale_class,target_class,max_value,style,hub_class,gradations,id,class$,alarm_class,setpoint){
return (function (p1__32585_SHARP_){
var value = (min_value + (((max_value - min_value) / gradations) * p1__32585_SHARP_));
return swinging_needle_meter.swinging_needle_meter.gradation.call(null,cx,cy,gradation_inner,needle_length,swinging_needle_meter.swinging_needle_meter.deflection.call(null,value,min_value,max_value),value);
});})(model__$1,setpoint__$1,mid_point_deflection,cx,cy,needle_length,scale_radius,gradation_inner,map__32588,map__32588__$1,args,height,model,attr,frame_class,redzone_class,warn_value,needle_class,unit,cursor_class,tolerance,width,min_value,scale_class,target_class,max_value,style,hub_class,gradations,id,class$,alarm_class,setpoint))
,cljs.core.range.call(null,(0),(gradations + (1)))))):null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"rect","rect",-108902628),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"class","class",-2030961996),frame_class,new cljs.core.Keyword(null,"id","id",-1388402092),[cljs.core.str(id),cljs.core.str("-frame")].join(''),new cljs.core.Keyword(null,"x","x",2099068185),(width * 0.05),new cljs.core.Keyword(null,"y","y",-1757859776),(height * .05),new cljs.core.Keyword(null,"height","height",1025178622),cy,new cljs.core.Keyword(null,"width","width",-384071477),(width * 0.9)], null)], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"circle","circle",1903212362),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"class","class",-2030961996),hub_class,new cljs.core.Keyword(null,"id","id",-1388402092),[cljs.core.str(id),cljs.core.str("-hub")].join(''),new cljs.core.Keyword(null,"r","r",-471384190),(height / (10)),new cljs.core.Keyword(null,"cx","cx",1272694324),cx,new cljs.core.Keyword(null,"cy","cy",755331060),cy], null)], null)], null)], null)], null);
});

swinging_needle_meter.swinging_needle_meter.swinging_needle_meter.cljs$lang$maxFixedArity = (0);

swinging_needle_meter.swinging_needle_meter.swinging_needle_meter.cljs$lang$applyTo = (function (seq32586){
return swinging_needle_meter.swinging_needle_meter.swinging_needle_meter.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq32586));
});


//# sourceMappingURL=swinging_needle_meter.js.map?rel=1603199197477