"),this.body.addClass("jvectormap-legend"),this.params.cssClass&&this.body.addClass(this.params.cssClass),l.vertical?this.map.legendCntVertical.append(this.body):this.map.legendCntHorizontal.append(this.body),this.render()},n.Legend.prototype.render=function(){var l,t,e,a,s=this.series.scale.getTicks(),i=n.$("").addClass("jvectormap-legend-inner");for(this.body.html(""),this.params.title&&this.body.append(n.$("").addClass("jvectormap-legend-title").html(this.params.title)),this.body.append(i),l=0;l").addClass("jvectormap-legend-tick"),e=n.$("").addClass("jvectormap-legend-tick-sample"),this.series.params.attribute){case"fill":n.isImageUrl(s[l].value)?e.css("background","url("+s[l].value+")"):e.css("background",s[l].value);break;case"stroke":e.css("background",s[l].value);break;case"image":e.css("background","url("+s[l].value+") no-repeat center center");break;case"r":n.$("").css({"border-radius":s[l].value,border:this.map.params.markerStyle.initial["stroke-width"]+"px "+this.map.params.markerStyle.initial.stroke+" solid",width:2*s[l].value+"px",height:2*s[l].value+"px",background:this.map.params.markerStyle.initial.fill}).appendTo(e)}t.append(e),a=s[l].label,this.params.labelRender&&(a=this.params.labelRender(a)),t.append(n.$(""+a+"
").addClass("jvectormap-legend-tick-text")),i.append(t)}i.append(n.$("").css("clear","both"))},n.DataSeries=function(l,t,e){var a;(l=l||{}).attribute=l.attribute||"fill",this.elements=t,this.params=l,this.map=e,l.attributes&&this.setAttributes(l.attributes),n.$.isArray(l.scale)?(a="fill"===l.attribute||"stroke"===l.attribute?n.ColorScale:n.NumericScale,this.scale=new a(l.scale,l.normalizeFunction,l.min,l.max)):this.scale=l.scale?new n.OrdinalScale(l.scale):new n.SimpleScale(l.scale),this.values=l.values||{},this.setValues(this.values),this.params.legend&&(this.legend=new n.Legend($.extend({map:this.map,series:this},this.params.legend)))},n.DataSeries.prototype={setAttributes:function(l,t){var e,a=l;if("string"==typeof l)this.elements[l]&&this.elements[l].setStyle(this.params.attribute,t);else for(e in a)this.elements[e]&&this.elements[e].element.setStyle(this.params.attribute,a[e])},setValues:function(l){var t,e,a=-Number.MAX_VALUE,s=Number.MAX_VALUE,i={};if(this.scale instanceof n.OrdinalScale||this.scale instanceof n.SimpleScale)for(e in l)i[e]=l[e]?this.scale.getValue(l[e]):this.elements[e].element.style.initial[this.params.attribute];else{if(void 0===this.params.min||void 0===this.params.max)for(e in l)(t=parseFloat(l[e]))>a&&(a=t),s>t&&(s=t);for(e in void 0===this.params.min?(this.scale.setMin(s),this.params.min=s):this.scale.setMin(this.params.min),void 0===this.params.max?(this.scale.setMax(a),this.params.max=a):this.scale.setMax(this.params.max),l)"indexOf"!=e&&(t=parseFloat(l[e]),i[e]=isNaN(t)?this.elements[e].element.style.initial[this.params.attribute]:this.scale.getValue(t))}this.setAttributes(i),n.$.extend(this.values,l)},clear:function(){var l,t={};for(l in this.values)this.elements[l]&&(t[l]=this.elements[l].element.shape.style.initial[this.params.attribute]);this.setAttributes(t),this.values={}},setScale:function(l){this.scale.setScale(l),this.values&&this.setValues(this.values)},setNormalizeFunction:function(l){this.scale.setNormalizeFunction(l),this.values&&this.setValues(this.values)}},n.Proj={degRad:180/Math.PI,radDeg:Math.PI/180,radius:6381372,sgn:function(l){return l>0?1:0>l?-1:l},mill:function(l,t,e){return{x:this.radius*(t-e)*this.radDeg,y:-this.radius*Math.log(Math.tan((45+.4*l)*this.radDeg))/.8}},mill_inv:function(l,t,e){return{lat:(2.5*Math.atan(Math.exp(.8*t/this.radius))-5*Math.PI/8)*this.degRad,lng:(e*this.radDeg+l/this.radius)*this.degRad}},merc:function(l,t,e){return{x:this.radius*(t-e)*this.radDeg,y:-this.radius*Math.log(Math.tan(Math.PI/4+l*Math.PI/360))}},merc_inv:function(l,t,e){return{lat:(2*Math.atan(Math.exp(t/this.radius))-Math.PI/2)*this.degRad,lng:(e*this.radDeg+l/this.radius)*this.degRad}},aea:function(l,t,e){var a=e*this.radDeg,s=29.5*this.radDeg,i=45.5*this.radDeg,n=l*this.radDeg,r=t*this.radDeg,o=(Math.sin(s)+Math.sin(i))/2,h=Math.cos(s)*Math.cos(s)+2*o*Math.sin(s),c=o*(r-a),p=Math.sqrt(h-2*o*Math.sin(n))/o,m=Math.sqrt(h-2*o*Math.sin(0))/o;return{x:p*Math.sin(c)*this.radius,y:-(m-p*Math.cos(c))*this.radius}},aea_inv:function(l,t,e){var a=l/this.radius,s=t/this.radius,i=e*this.radDeg,n=29.5*this.radDeg,r=45.5*this.radDeg,o=(Math.sin(n)+Math.sin(r))/2,h=Math.cos(n)*Math.cos(n)+2*o*Math.sin(n),c=Math.sqrt(h-2*o*Math.sin(0))/o,p=Math.sqrt(a*a+(c-s)*(c-s)),m=Math.atan(a/(c-s));return{lat:Math.asin((h-p*p*o*o)/(2*o))*this.degRad,lng:(i+m/o)*this.degRad}},lcc:function(l,t,e){var a=e*this.radDeg,s=t*this.radDeg,i=33*this.radDeg,n=45*this.radDeg,r=l*this.radDeg,o=Math.log(Math.cos(i)*(1/Math.cos(n)))/Math.log(Math.tan(Math.PI/4+n/2)*(1/Math.tan(Math.PI/4+i/2))),h=Math.cos(i)*Math.pow(Math.tan(Math.PI/4+i/2),o)/o,c=h*Math.pow(1/Math.tan(Math.PI/4+r/2),o),p=h*Math.pow(1/Math.tan(Math.PI/4+0),o);return{x:c*Math.sin(o*(s-a))*this.radius,y:-(p-c*Math.cos(o*(s-a)))*this.radius}},lcc_inv:function(l,t,e){var a=l/this.radius,s=t/this.radius,i=e*this.radDeg,n=33*this.radDeg,r=45*this.radDeg,o=Math.log(Math.cos(n)*(1/Math.cos(r)))/Math.log(Math.tan(Math.PI/4+r/2)*(1/Math.tan(Math.PI/4+n/2))),h=Math.cos(n)*Math.pow(Math.tan(Math.PI/4+n/2),o)/o,c=h*Math.pow(1/Math.tan(Math.PI/4+0),o),p=this.sgn(o)*Math.sqrt(a*a+(c-s)*(c-s)),m=Math.atan(a/(c-s));return{lat:(2*Math.atan(Math.pow(h/p,1/o))-Math.PI/2)*this.degRad,lng:(i+m/o)*this.degRad}}},n.MapObject=function(){},n.MapObject.prototype.getLabelText=function(l){return this.config.label?"function"==typeof this.config.label.render?this.config.label.render(l):l:null},n.MapObject.prototype.getLabelOffsets=function(l){var t;return this.config.label&&("function"==typeof this.config.label.offsets?t=this.config.label.offsets(l):"object"==i()(this.config.label.offsets)&&(t=this.config.label.offsets[l])),t||[0,0]},n.MapObject.prototype.setHovered=function(l){this.isHovered!==l&&(this.isHovered=l,this.shape.isHovered=l,this.shape.updateStyle(),this.label&&(this.label.isHovered=l,this.label.updateStyle()))},n.MapObject.prototype.setSelected=function(l){this.isSelected!==l&&(this.isSelected=l,this.shape.isSelected=l,this.shape.updateStyle(),this.label&&(this.label.isSelected=l,this.label.updateStyle()),n.$(this.shape).trigger("selected",[l]))},n.MapObject.prototype.setStyle=function(){this.shape.setStyle.apply(this.shape,arguments)},n.MapObject.prototype.remove=function(){this.shape.remove(),this.label&&this.label.remove()},n.Region=function(l){var t,e,a;this.config=l,this.map=this.config.map,this.shape=l.canvas.addPath({d:l.path,"data-code":l.code},l.style,l.canvas.rootElement),this.shape.addClass("jvectormap-region jvectormap-element"),t=this.shape.getBBox(),e=this.getLabelText(l.code),this.config.label&&e&&(a=this.getLabelOffsets(l.code),this.labelX=t.x+t.width/2+a[0],this.labelY=t.y+t.height/2+a[1],this.label=l.canvas.addText({text:e,"text-anchor":"middle","alignment-baseline":"central",x:this.labelX,y:this.labelY,"data-code":l.code},l.labelStyle,l.labelsGroup),this.label.addClass("jvectormap-region jvectormap-element"))},n.inherits(n.Region,n.MapObject),n.Region.prototype.updateLabelPosition=function(){this.label&&this.label.set({x:this.labelX*this.map.scale+this.map.transX*this.map.scale,y:this.labelY*this.map.scale+this.map.transY*this.map.scale})},n.Marker=function(l){var t;this.config=l,this.map=this.config.map,this.isImage=!!this.config.style.initial.image,this.createShape(),t=this.getLabelText(l.index),this.config.label&&t&&(this.offsets=this.getLabelOffsets(l.index),this.labelX=l.cx/this.map.scale-this.map.transX,this.labelY=l.cy/this.map.scale-this.map.transY,this.label=l.canvas.addText({text:t,"data-index":l.index,dy:"0.6ex",x:this.labelX,y:this.labelY},l.labelStyle,l.labelsGroup),this.label.addClass("jvectormap-marker jvectormap-element"))},n.inherits(n.Marker,n.MapObject),n.Marker.prototype.createShape=function(){var l=this;this.shape&&this.shape.remove(),this.shape=this.config.canvas[this.isImage?"addImage":"addCircle"]({"data-index":this.config.index,cx:this.config.cx,cy:this.config.cy},this.config.style,this.config.group),this.shape.addClass("jvectormap-marker jvectormap-element"),this.isImage&&n.$(this.shape.node).on("imageloaded",function(){l.updateLabelPosition()})},n.Marker.prototype.updateLabelPosition=function(){this.label&&this.label.set({x:this.labelX*this.map.scale+this.offsets[0]+this.map.transX*this.map.scale+5+(this.isImage?(this.shape.width||0)/2:this.shape.properties.r),y:this.labelY*this.map.scale+this.map.transY*this.map.scale+this.offsets[1]})},n.Marker.prototype.setStyle=function(l){var t;n.Marker.parentClass.prototype.setStyle.apply(this,arguments),"r"===l&&this.updateLabelPosition(),(t=!!this.shape.get("image"))!=this.isImage&&(this.isImage=t,this.config.style=n.$.extend(!0,{},this.shape.style),this.createShape())},n.Map=function(l){var t,e=this;if(this.params=n.$.extend(!0,{},n.Map.defaultParams,l),!n.Map.maps[this.params.map])throw new Error("Attempt to use map which was not loaded: "+this.params.map);for(t in this.mapData=n.Map.maps[this.params.map],this.markers={},this.regions={},this.regionsColors={},this.regionsData={},this.container=n.$("