From 4641d4351fb8b200cbc08852c1541dc23fece148 Mon Sep 17 00:00:00 2001 From: neveldo Date: Thu, 8 Mar 2018 16:31:04 +0100 Subject: [PATCH] Update minified assets --- js/jquery.mapael.min.js | 3 ++- js/maps/world_countries.min.js | 11 ++++++----- js/maps/world_countries_miller.min.js | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/js/jquery.mapael.min.js b/js/jquery.mapael.min.js index 1c143e5..f8ba1e0 100644 --- a/js/jquery.mapael.min.js +++ b/js/jquery.mapael.min.js @@ -1 +1,2 @@ -!function(a){"object"==typeof exports?module.exports=a(require("jquery"),require("raphael"),require("jquery-mousewheel")):"function"==typeof define&&define.amd?define(["jquery","raphael","mousewheel"],a):a(jQuery,Raphael,jQuery.fn.mousewheel)}(function(a,b,c,d){"use strict";var e=function(b,c){var d=this;d.container=b,d.$container=a(b),d.options=d.extendDefaultOptions(c),d.zoomTO=0,d.zoomCenterX=0,d.zoomCenterY=0,d.previousPinchDist=0,d.zoomData={zoomLevel:0,zoomX:0,zoomY:0,panX:0,panY:0},d.resizeTO=0,d.panning=!1,d.panningTO=0,d.animationIntervalID=null,d.$map=a("."+d.options.map.cssClass,d.container),d.initialMapHTMLContent=d.$map.html(),d.createdLegends={},d.$tooltip={},d.paper={},d.areas={},d.plots={},d.links={},d.mapConf={},d.init()};return e.prototype={version:"2.1.0",init:function(){var c=this;if(""===c.options.map.cssClass||0===a("."+c.options.map.cssClass,c.container).length)throw new Error("The map class `"+c.options.map.cssClass+"` doesn't exists");if(c.$tooltip=a("
").addClass(c.options.map.tooltip.cssClass).css("display","none"),c.$map.empty().append(c.$tooltip),a.mapael&&a.mapael.maps&&a.mapael.maps[c.options.map.name])c.mapConf=a.mapael.maps[c.options.map.name];else{if(!(a.fn.mapael&&a.fn.mapael.maps&&a.fn.mapael.maps[c.options.map.name]))throw new Error("Unknown map '"+c.options.map.name+"'");c.mapConf=a.fn.mapael.maps[c.options.map.name],window.console&&window.console.warn&&window.console.warn("Extending $.fn.mapael is deprecated (map '"+c.options.map.name+"')")}if(c.paper=new b(c.$map[0],c.mapConf.width,c.mapConf.height),c.isRaphaelBBoxBugPresent()===!0)throw c.destroy(),new Error("Can't get boundary box for text (is your container hidden? See #135)");c.$container.addClass("mapael"),c.options.map.tooltip.css&&c.$tooltip.css(c.options.map.tooltip.css),c.paper.setViewBox(0,0,c.mapConf.width,c.mapConf.height,!1),c.options.map.width?(c.paper.setSize(c.options.map.width,c.mapConf.height*(c.options.map.width/c.mapConf.width)),c.createLegends("plot",c.plots,c.options.map.width/c.mapConf.width)):c.handleMapResizing(),a.each(c.mapConf.elems,function(a){var b=c.getElemOptions(c.options.map.defaultArea,c.options.areas[a]?c.options.areas[a]:{},c.options.legend.area);c.areas[a]={mapElem:c.paper.path(c.mapConf.elems[a]).attr(b.attrs)}}),c.options.map.beforeInit&&c.options.map.beforeInit(c.$container,c.paper,c.options),a.each(c.mapConf.elems,function(a){var b=c.getElemOptions(c.options.map.defaultArea,c.options.areas[a]?c.options.areas[a]:{},c.options.legend.area);c.initElem(c.areas[a],b,a)}),c.links=c.drawLinksCollection(c.options.links),a.each(c.options.plots,function(a){c.plots[a]=c.drawPlot(a)}),c.$container.on("zoom.mapael",function(a,b){c.onZoomEvent(a,b)}),c.options.map.zoom.enabled&&c.initZoom(c.mapConf.width,c.mapConf.height,c.options.map.zoom),c.options.map.zoom.init!==d&&(c.options.map.zoom.init.animDuration===d&&(c.options.map.zoom.init.animDuration=0),c.$container.trigger("zoom",c.options.map.zoom.init)),c.createLegends("area",c.areas,1),c.$container.on("update.mapael",function(a,b){c.onUpdateEvent(a,b)}),c.$container.on("showElementsInRange.mapael",function(a,b){c.onShowElementsInRange(a,b)}),c.options.map.afterInit&&c.options.map.afterInit(c.$container,c.paper,c.areas,c.plots,c.options),a(c.paper.desc).append(" and Mapael "+c.version+" (https://www.vincentbroute.fr/mapael/)")},destroy:function(){var b=this;b.$container.off(".mapael"),b.$map.off(".mapael"),b.onResizeEvent&&a(window).off("resize.mapael",b.onResizeEvent),b.$map.empty(),b.$map.html(b.initialMapHTMLContent);for(var c in b.createdLegends)b.createdLegends[c].container.empty(),b.createdLegends[c].container.html(b.createdLegends[c].initialHTMLContent);b.$container.removeClass("mapael"),b.$container.removeData("mapael"),b.container=d,b.$container=d,b.options=d,b.paper=d,b.$map=d,b.$tooltip=d,b.mapConf=d,b.areas=d,b.plots=d,b.links=d},handleMapResizing:function(){var b=this;b.onResizeEvent=function(){clearTimeout(b.resizeTO),b.resizeTO=setTimeout(function(){b.$map.trigger("resizeEnd")},150)},a(window).on("resize.mapael",b.onResizeEvent),b.$map.on("resizeEnd.mapael",function(a,c){var d=b.$map.width();if(b.paper.width!=d){var e=d/b.mapConf.width;b.paper.setSize(d,b.mapConf.height*e),(c||b.options.legend.redrawOnResize)&&b.createLegends("plot",b.plots,e)}}).trigger("resizeEnd",[!0])},extendDefaultOptions:function(b){return b=a.extend(!0,{},e.prototype.defaultOptions,b),a.each(["area","plot"],function(c,d){if(a.isArray(b.legend[d]))for(var f=0;f").addClass(c.cssClass).html(c.content).attr("title",c.title);e.on("click.mapael",j[b]),f.$map.append(e)}),f.options.map.zoom.mousewheel&&f.$map.on("mousewheel.mapael",function(a){var b=a.deltaY>0?1:-1,c=f.mapPagePositionToXY(a.pageX,a.pageY);f.$container.trigger("zoom",{fixedCenter:!0,level:f.zoomData.zoomLevel+b,x:c.x,y:c.y}),a.preventDefault()}),f.options.map.zoom.touch&&(f.$map.on("touchstart.mapael",function(a){2===a.originalEvent.touches.length&&(f.zoomCenterX=(a.originalEvent.touches[0].pageX+a.originalEvent.touches[1].pageX)/2,f.zoomCenterY=(a.originalEvent.touches[0].pageY+a.originalEvent.touches[1].pageY)/2,f.previousPinchDist=Math.sqrt(Math.pow(a.originalEvent.touches[1].pageX-a.originalEvent.touches[0].pageX,2)+Math.pow(a.originalEvent.touches[1].pageY-a.originalEvent.touches[0].pageY,2)))}),f.$map.on("touchmove.mapael",function(a){var b=0,c=0;if(2===a.originalEvent.touches.length){if(b=Math.sqrt(Math.pow(a.originalEvent.touches[1].pageX-a.originalEvent.touches[0].pageX,2)+Math.pow(a.originalEvent.touches[1].pageY-a.originalEvent.touches[0].pageY,2)),Math.abs(b-f.previousPinchDist)>15){var d=f.mapPagePositionToXY(f.zoomCenterX,f.zoomCenterY);c=(b-f.previousPinchDist)/Math.abs(b-f.previousPinchDist),f.$container.trigger("zoom",{fixedCenter:!0,level:f.zoomData.zoomLevel+c,x:d.x,y:d.y}),f.previousPinchDist=b}return!1}})),f.$map.on("dragstart",function(){return!1}),a("body").on("mouseup.mapael"+(e.touch?" touchend.mapael":""),function(){g=!1,setTimeout(function(){f.panning=!1},50)}),f.$map.on("mousedown.mapael"+(e.touch?" touchstart.mapael":""),function(a){a.pageX!==d?(g=!0,h=a.pageX,i=a.pageY):1===a.originalEvent.touches.length&&(g=!0,h=a.originalEvent.touches[0].pageX,i=a.originalEvent.touches[0].pageY)}).on("mousemove.mapael"+(e.touch?" touchmove.mapael":""),function(j){var k=f.zoomData.zoomLevel,l=0,m=0;if(j.pageX!==d?(l=j.pageX,m=j.pageY):1===j.originalEvent.touches.length?(l=j.originalEvent.touches[0].pageX,m=j.originalEvent.touches[0].pageY):g=!1,g&&0!==k){var n=(h-l)/(1+k*e.step)*(b/f.paper.width),o=(i-m)/(1+k*e.step)*(c/f.paper.height),p=Math.min(Math.max(0,f.paper._viewBox[0]+n),b-f.paper._viewBox[2]),q=Math.min(Math.max(0,f.paper._viewBox[1]+o),c-f.paper._viewBox[3]);return(Math.abs(n)>5||Math.abs(o)>5)&&(a.extend(f.zoomData,{panX:p,panY:q,zoomX:p+f.paper._viewBox[2]/2,zoomY:q+f.paper._viewBox[3]/2}),f.paper.setViewBox(p,q,f.paper._viewBox[2],f.paper._viewBox[3]),clearTimeout(f.panningTO),f.panningTO=setTimeout(function(){f.$map.trigger("afterPanning",{x1:p,y1:q,x2:p+f.paper._viewBox[2],y2:q+f.paper._viewBox[3]})},150),h=l,i=m,f.panning=!0),!1}})},mapPagePositionToXY:function(a,b){var c=this,d=c.$map.offset(),e=c.options.map.width?c.mapConf.width/c.options.map.width:c.mapConf.width/c.$map.width(),f=1/(1+c.zoomData.zoomLevel*c.options.map.zoom.step);return{x:f*e*(a-d.left)+c.zoomData.panX,y:f*e*(b-d.top)+c.zoomData.panY}},onZoomEvent:function(b,c){var e=this,f=e.zoomData.zoomLevel,g=0,h=0,i=1+e.zoomData.zoomLevel*e.options.map.zoom.step,j=0,k=c.animDuration!==d?c.animDuration:e.options.map.zoom.animDuration,l=0,m=0,n={};c.level!==d&&(f="string"==typeof c.level?"+"===c.level.slice(0,1)||"-"===c.level.slice(0,1)?e.zoomData.zoomLevel+parseInt(c.level):parseInt(c.level):c.level<0?e.zoomData.zoomLevel+c.level:c.level,f=Math.min(Math.max(f,e.options.map.zoom.minLevel),e.options.map.zoom.maxLevel)),j=1+f*e.options.map.zoom.step,c.latitude!==d&&c.longitude!==d&&(n=e.mapConf.getCoords(c.latitude,c.longitude),c.x=n.x,c.y=n.y),c.x===d&&(c.x=e.paper._viewBox[0]+e.paper._viewBox[2]/2),c.y===d&&(c.y=e.paper._viewBox[1]+e.paper._viewBox[3]/2),0===f?(g=0,h=0):c.fixedCenter!==d&&c.fixedCenter===!0?(l=e.zoomData.panX+(c.x-e.zoomData.panX)*(j-i)/j,m=e.zoomData.panY+(c.y-e.zoomData.panY)*(j-i)/j,g=Math.min(Math.max(0,l),e.mapConf.width-e.mapConf.width/j),h=Math.min(Math.max(0,m),e.mapConf.height-e.mapConf.height/j)):(g=Math.min(Math.max(0,c.x-e.mapConf.width/j/2),e.mapConf.width-e.mapConf.width/j),h=Math.min(Math.max(0,c.y-e.mapConf.height/j/2),e.mapConf.height-e.mapConf.height/j)),j==i&&g==e.zoomData.panX&&h==e.zoomData.panY||(k>0?e.animateViewBox(g,h,e.mapConf.width/j,e.mapConf.height/j,k,e.options.map.zoom.animEasing):(e.paper.setViewBox(g,h,e.mapConf.width/j,e.mapConf.height/j),clearTimeout(e.zoomTO),e.zoomTO=setTimeout(function(){e.$map.trigger("afterZoom",{x1:g,y1:h,x2:g+e.mapConf.width/j,y2:h+e.mapConf.height/j})},150)),a.extend(e.zoomData,{zoomLevel:f,panX:g,panY:h,zoomX:g+e.paper._viewBox[2]/2,zoomY:h+e.paper._viewBox[3]/2}))},onShowElementsInRange:function(a,b){var c=this;b.animDuration===d&&(b.animDuration=0),b.hiddenOpacity===d&&(b.hiddenOpacity=.3),b.ranges&&b.ranges.area&&c.showElemByRange(b.ranges.area,c.areas,b.hiddenOpacity,b.animDuration),b.ranges&&b.ranges.plot&&c.showElemByRange(b.ranges.plot,c.plots,b.hiddenOpacity,b.animDuration),b.ranges&&b.ranges.link&&c.showElemByRange(b.ranges.link,c.links,b.hiddenOpacity,b.animDuration),b.afterShowRange&&b.afterShowRange()},showElemByRange:function(b,c,e,f){var g=this,h={};b.min===d&&b.max===d||(b={0:b}),a.each(b,function(f){var g=b[f];if(g.min===d&&g.max===d)return!0;a.each(c,function(a){var b=c[a].value;if("object"!=typeof b&&(b=[b]),b[f]===d)return!0;g.min!==d&&b[f]g.max?h[a]=e:h[a]=1})}),a.each(h,function(a){g.setElementOpacity(c[a],h[a],f)})},setElementOpacity:function(a,b,c){b>0&&(a.mapElem.show(),a.textElem&&a.textElem.show()),c>0?(a.mapElem.animate({opacity:b},c,"linear",function(){0===b&&a.mapElem.hide()}),a.textElem&&a.textElem.animate({opacity:b},c,"linear",function(){0===b&&a.textElem.hide()})):(a.mapElem.attr({opacity:b}),0===b&&a.mapElem.hide(),a.textElem&&(a.textElem.attr({opacity:b}),0===b&&a.textElem.hide()))},onUpdateEvent:function(b,c){var e=this;if("object"==typeof c){var f=0,g=c.animDuration?c.animDuration:0,h=function(a){e.unsetHover(a.mapElem,a.textElem),g>0?(a.mapElem.animate({opacity:0},g,"linear",function(){a.mapElem.remove()}),a.textElem&&a.textElem.animate({opacity:0},g,"linear",function(){a.textElem.remove()})):(a.mapElem.remove(),a.textElem&&a.textElem.remove())},i=function(a){a.mapElem.attr({opacity:0}),a.textElem&&a.textElem.attr({opacity:0}),e.setElementOpacity(a,a.mapElem.originalAttrs.opacity!==d?a.mapElem.originalAttrs.opacity:1,g)};if("object"==typeof c.mapOptions&&(c.replaceOptions===!0?e.options=e.extendDefaultOptions(c.mapOptions):a.extend(!0,e.options,c.mapOptions),c.mapOptions.areas===d&&c.mapOptions.plots===d&&c.mapOptions.legend===d||a("[data-type='elem']",e.$container).each(function(b,c){"1"===a(c).attr("data-hidden")&&a(c).trigger("click",[!1,g])})),"object"==typeof c.deletePlotKeys)for(;f0&&i(e.plots[a]))}),"object"==typeof c.newLinks){var j=e.drawLinksCollection(c.newLinks);a.extend(e.links,j),a.extend(e.options.links,c.newLinks),g>0&&a.each(j,function(a){i(j[a])})}if(a.each(e.areas,function(a){if("object"==typeof c.mapOptions&&("object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultArea||"object"==typeof c.mapOptions.areas&&"object"==typeof c.mapOptions.areas[a]||"object"==typeof c.mapOptions.legend&&"object"==typeof c.mapOptions.legend.area)||c.replaceOptions===!0){var b=e.getElemOptions(e.options.map.defaultArea,e.options.areas[a]?e.options.areas[a]:{},e.options.legend.area);e.updateElem(b,e.areas[a],g)}}),a.each(e.plots,function(a){if("object"==typeof c.mapOptions&&("object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultPlot||"object"==typeof c.mapOptions.plots&&"object"==typeof c.mapOptions.plots[a]||"object"==typeof c.mapOptions.legend&&"object"==typeof c.mapOptions.legend.plot)||c.replaceOptions===!0){var b=e.getElemOptions(e.options.map.defaultPlot,e.options.plots[a]?e.options.plots[a]:{},e.options.legend.plot);"square"==b.type?(b.attrs.width=b.size,b.attrs.height=b.size,b.attrs.x=e.plots[a].mapElem.attrs.x-(b.size-e.plots[a].mapElem.attrs.width)/2,b.attrs.y=e.plots[a].mapElem.attrs.y-(b.size-e.plots[a].mapElem.attrs.height)/2):"image"==b.type?(b.attrs.width=b.width,b.attrs.height=b.height,b.attrs.x=e.plots[a].mapElem.attrs.x-(b.width-e.plots[a].mapElem.attrs.width)/2,b.attrs.y=e.plots[a].mapElem.attrs.y-(b.height-e.plots[a].mapElem.attrs.height)/2):"svg"==b.type?b.attrs.transform!==d&&(b.attrs.transform=e.plots[a].mapElem.baseTransform+b.attrs.transform):b.attrs.r=b.size/2,e.updateElem(b,e.plots[a],g)}}),a.each(e.links,function(a){if("object"==typeof c.mapOptions&&("object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultLink||"object"==typeof c.mapOptions.links&&"object"==typeof c.mapOptions.links[a])||c.replaceOptions===!0){var b=e.getElemOptions(e.options.map.defaultLink,e.options.links[a]?e.options.links[a]:{},{});e.updateElem(b,e.links[a],g)}}),c.mapOptions&&("object"==typeof c.mapOptions.legend||"object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultArea||"object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultPlot)&&(a("[data-type='elem']",e.$container).each(function(b,c){"1"===a(c).attr("data-hidden")&&a(c).trigger("click",[!1,g])}),e.createLegends("area",e.areas,1),e.options.map.width?e.createLegends("plot",e.plots,e.options.map.width/e.mapConf.width):e.createLegends("plot",e.plots,e.$map.width()/e.mapConf.width)),"object"==typeof c.setLegendElemsState)a.each(c.setLegendElemsState,function(b,c){var f=e.$container.find("."+b)[0];f!==d&&a("[data-type='elem']",f).each(function(b,d){("0"===a(d).attr("data-hidden")&&"hide"===c||"1"===a(d).attr("data-hidden")&&"show"===c)&&a(d).trigger("click",[!1,g])})});else{var k="hide"===c.setLegendElemsState?"hide":"show";a("[data-type='elem']",e.$container).each(function(b,c){("0"===a(c).attr("data-hidden")&&"hide"===k||"1"===a(c).attr("data-hidden")&&"show"===k)&&a(c).trigger("click",[!1,g])})}c.afterUpdate&&c.afterUpdate(e.$container,e.paper,e.areas,e.plots,e.options)}},drawLinksCollection:function(b){var c=this,e={},f={},g={},h={},i={};return a.each(b,function(a){var j=c.getElemOptions(c.options.map.defaultLink,b[a],{});e="string"==typeof b[a].between[0]?c.options.plots[b[a].between[0]]:b[a].between[0],f="string"==typeof b[a].between[1]?c.options.plots[b[a].between[1]]:b[a].between[1],e.latitude!==d&&e.longitude!==d?g=c.mapConf.getCoords(e.latitude,e.longitude):(g.x=e.x,g.y=e.y),f.latitude!==d&&f.longitude!==d?h=c.mapConf.getCoords(f.latitude,f.longitude):(h.x=f.x,h.y=f.y),i[a]=c.drawLink(a,g.x,g.y,h.x,h.y,j)}),i},drawLink:function(a,b,c,d,e,f){var g=this,h={},i=(b+d)/2,j=(c+e)/2,k=-1/((e-c)/(d-b)),l=j-k*i,m=Math.sqrt((d-b)*(d-b)+(e-c)*(e-c)),n=1+k*k,o=-2*i+2*k*l-2*k*j,p=i*i+l*l-l*j-j*l+j*j-f.factor*m*(f.factor*m),q=o*o-4*n*p,r=0,s=0;return f.factor>0?(r=(-o+Math.sqrt(q))/(2*n),s=k*r+l):(r=(-o-Math.sqrt(q))/(2*n),s=k*r+l),h.mapElem=g.paper.path("m "+b+","+c+" C "+r+","+s+" "+d+","+e+" "+d+","+e).attr(f.attrs),g.initElem(h,f,a),h},isAttrsChanged:function(a,b){for(var c in b)if(void 0===a[c]||b[c]!==a[c])return!0;return!1},updateElem:function(a,b,c){var e,f,g,h,i=this;a.value!==d&&(b.value=a.value),a.toFront===!0&&b.mapElem.toFront(),b.textElem&&(a.text!==d&&a.text.content!==d&&a.text.content!=b.textElem.attrs.text&&b.textElem.attr({text:a.text.content}),e=b.mapElem.getBBox(),(a.size||a.width&&a.height)&&("image"==a.type||"svg"==a.type?(g=(a.width-e.width)/2,h=(a.height-e.height)/2):(g=(a.size-e.width)/2,h=(a.size-e.height)/2),e.x-=g,e.x2+=g,e.y-=h,e.y2+=h),f=i.getTextPosition(e,a.text.position,a.text.margin),f.x==b.textElem.attrs.x&&f.y==b.textElem.attrs.y||(c>0?(b.textElem.attr({"text-anchor":f.textAnchor}),b.textElem.animate({x:f.x,y:f.y},c)):b.textElem.attr({x:f.x,y:f.y,"text-anchor":f.textAnchor})),i.setHoverOptions(b.textElem,a.text.attrs,a.text.attrsHover),c>0?b.textElem.animate(a.text.attrs,c):b.textElem.attr(a.text.attrs)),i.setHoverOptions(b.mapElem,a.attrs,a.attrsHover),i.isAttrsChanged(b.mapElem.attrs,a.attrs)&&(c>0?b.mapElem.animate(a.attrs,c):b.mapElem.attr(a.attrs)),"svg"==a.type&&(e===d&&(e=b.mapElem.getBBox()),b.mapElem.transform("m"+a.width/b.mapElem.originalWidth+",0,0,"+a.height/b.mapElem.originalHeight+","+e.x+","+e.y)),a.tooltip&&(b.mapElem.tooltip===d&&(i.setTooltip(b.mapElem),b.textElem&&i.setTooltip(b.textElem)),b.mapElem.tooltip=a.tooltip,b.textElem&&(b.textElem.tooltip=a.tooltip)),a.href!==d&&(b.mapElem.href===d&&(i.setHref(b.mapElem),b.textElem&&i.setHref(b.textElem)),b.mapElem.href=a.href,b.mapElem.target=a.target,b.textElem&&(b.textElem.href=a.href,b.textElem.target=a.target))},drawPlot:function(a){var b=this,c={},e={},f=b.getElemOptions(b.options.map.defaultPlot,b.options.plots[a]?b.options.plots[a]:{},b.options.legend.plot);if(f.x!==d&&f.y!==d)e={x:f.x,y:f.y};else if(f.plotsOn!==d&&b.areas[f.plotsOn].mapElem!==d){var g=b.areas[f.plotsOn].mapElem,h=g.getBBox(),i=Math.floor(h.x+h.width/2),j=Math.floor(h.y+h.height/2);e={x:i,y:j}}else e=b.mapConf.getCoords(f.latitude,f.longitude);return"square"==f.type?c={mapElem:b.paper.rect(e.x-f.size/2,e.y-f.size/2,f.size,f.size).attr(f.attrs)}:"image"==f.type?c={mapElem:b.paper.image(f.url,e.x-f.width/2,e.y-f.height/2,f.width,f.height).attr(f.attrs)}:"svg"==f.type?(f.attrs.transform===d&&(f.attrs.transform=""),c={mapElem:b.paper.path(f.path)},c.mapElem.originalWidth=c.mapElem.getBBox().width,c.mapElem.originalHeight=c.mapElem.getBBox().height,c.mapElem.baseTransform="m"+f.width/c.mapElem.originalWidth+",0,0,"+f.height/c.mapElem.originalHeight+","+(e.x-f.width/2)+","+(e.y-f.height/2),f.attrs.transform=c.mapElem.baseTransform+f.attrs.transform,c.mapElem.attr(f.attrs)):c={mapElem:b.paper.circle(e.x,e.y,f.size/2).attr(f.attrs)},b.initElem(c,f,a),c},setHref:function(b){var c=this;b.attr({cursor:"pointer"}),a(b.node).on("click.mapael",function(){!c.panning&&b.href&&window.open(b.href,b.target)})},setTooltip:function(b){var c=this,e=0,f=c.$tooltip.attr("class"),g=function(a,d){var e=10,f=20;"object"==typeof b.tooltip.offset&&(void 0!==b.tooltip.offset.left&&(e=b.tooltip.offset.left),void 0!==b.tooltip.offset.top&&(f=b.tooltip.offset.top));var g={left:Math.min(c.$map.width()-c.$tooltip.outerWidth()-5,a-c.$map.offset().left+e),top:Math.min(c.$map.height()-c.$tooltip.outerHeight()-5,d-c.$map.offset().top+f)};"object"==typeof b.tooltip.overflow&&(b.tooltip.overflow.right===!0&&(g.left=a-c.$map.offset().left+10),selem.tooltip.overflow.bottom===!0&&(g.top=d-c.$map.offset().top+20)),c.$tooltip.css(g)};a(b.node).on("mouseover.mapael",function(a){e=setTimeout(function(){if(c.$tooltip.attr("class",f),b.tooltip!==d){if(b.tooltip.content!==d){var e="function"==typeof b.tooltip.content?b.tooltip.content(b):b.tooltip.content;c.$tooltip.html(e).css("display","block")}b.tooltip.cssClass!==d&&c.$tooltip.addClass(b.tooltip.cssClass)}g(a.pageX,a.pageY)},120)}).on("mouseout.mapael",function(){clearTimeout(e),c.$tooltip.css("display","none")}).on("mousemove.mapael",function(a){g(a.pageX,a.pageY)})},setEventHandlers:function(b,c,d,e){var f=this;a.each(c.eventHandlers,function(g){!function(g){a(d.node).on(g,function(a){f.panning||c.eventHandlers[g](a,b,d,e,c)}),e&&a(e.node).on(g,function(a){f.panning||c.eventHandlers[g](a,b,d,e,c)})}(g)})},drawLegend:function(c,e,f,g,h){var i=this,j={},k={},l=0,m=0,n=null,o={},p={},q={},r=0,s=0,t=0,u=0,v=[],w=0;for(j=a("."+c.cssClass,i.$container),void 0===i.createdLegends[c.cssClass]&&(i.createdLegends[c.cssClass]={container:j,initialHTMLContent:j.html()}),j.empty(),k=new b(j.get(0)),a(k.canvas).attr({"data-type":e,"data-index":h}),m=l=0,c.title&&""!==c.title&&(n=k.text(c.marginLeftTitle,0,c.title).attr(c.titleAttrs),n.attr({y:.5*n.getBBox().height}),l=c.marginLeftTitle+n.getBBox().width,m+=c.marginBottomTitle+n.getBBox().height),r=0,w=c.slices.length;r0?e.animate({opacity:.5},l):e.attr({opacity:.5}):l>0?e.animate({opacity:1},l):e.attr({opacity:1}),a.each(g,function(e){var f=g[e].mapElem.data("hidden-by");f===d&&(f={}),m=a.isArray(g[e].value)?g[e].value[h]:g[e].value,i.getLegendSlice(m,b)===c&&function(c){"0"===n?(f[h]=!0,i.setElementOpacity(g[c],b.hideElemsOnClick.opacity,l)):(delete f[h],a.isEmptyObject(f)&&i.setElementOpacity(g[c],g[c].mapElem.originalAttrs.opacity!==d?g[c].mapElem.originalAttrs.opacity:1,l)),g[c].mapElem.data("hidden-by",f)}(e)}),a(f.node).attr(o),a(e.node).attr(o),k!==d&&k!==!0||b.exclusive===d||b.exclusive!==!0||a("[data-type='elem'][data-hidden=0]",i.$container).each(function(){a(this).attr("data-index")!==a(f.node).attr("data-index")&&a(this).trigger("click",!1)})};a(e.node).on("click.mapael",j),a(f.node).on("click.mapael",j),c.clicked!==d&&c.clicked===!0&&a(f.node).trigger("click",!1)},createLegends:function(b,c,d){var e=this,f=e.options.legend[b];a.isArray(e.options.legend[b])||(f=[e.options.legend[b]]);for(var g=0;g0&&e.drawLegend(f[g],b,c,d,g)}},setHoverOptions:function(c,d,e){"SVG"!=b.type&&delete e.transform,c.attrsHover=e,c.attrsHover.transform?c.originalAttrs=a.extend({transform:"s1"},d):c.originalAttrs=d},setHover:function(b,c){var d=this,e={},f={},g=0,h=0,i=function(){clearTimeout(h),g=setTimeout(function(){d.elemHover(b,c)},120)},j=function(){clearTimeout(g),h=setTimeout(function(){d.elemOut(b,c)},120)};e=a(b.node),e.on("mouseover.mapael",i),e.on("mouseout.mapael",j),c&&(f=a(c.node),f.on("mouseover.mapael",i),a(c.node).on("mouseout.mapael",j))},unsetHover:function(b,c){a(b.node).off(".mapael"),c&&a(c.node).off(".mapael")},elemHover:function(a,b){var c=this;a.attrsHover.animDuration>0?a.animate(a.attrsHover,a.attrsHover.animDuration):a.attr(a.attrsHover),b&&(b.attrsHover.animDuration>0?b.animate(b.attrsHover,b.attrsHover.animDuration):b.attr(b.attrsHover)),c.paper.safari&&c.paper.safari()},elemOut:function(a,b){var c=this;a.attrsHover.animDuration>0?a.animate(a.originalAttrs,a.attrsHover.animDuration):a.attr(a.originalAttrs),b&&(b.attrsHover.animDuration>0?b.animate(b.originalAttrs,b.attrsHover.animDuration):b.attr(b.originalAttrs)),c.paper.safari&&c.paper.safari()},getElemOptions:function(b,c,e){var f=this,g=a.extend(!0,{},b,c);if(g.value!==d)if(a.isArray(e))for(var h=0,i=e.length;h=b.slices[c].min)&&(b.slices[c].max===d||a<=b.slices[c].max))return b.slices[c];return{}},animateViewBox:function(a,c,d,e,f,g){var h,i=this,j=i.paper._viewBox?i.paper._viewBox[0]:0,k=a-j,l=i.paper._viewBox?i.paper._viewBox[1]:0,m=c-l,n=i.paper._viewBox?i.paper._viewBox[2]:i.paper.width,o=d-n,p=i.paper._viewBox?i.paper._viewBox[3]:i.paper.height,q=e-p,r=f/25,s=0;g=g||"linear",h=b.easing_formulas[g],clearInterval(i.animationIntervalID),i.animationIntervalID=setInterval(function(){var b=s/r;i.paper.setViewBox(j+k*h(b),l+m*h(b),n+o*h(b),p+q*h(b),!1),s++>=r&&(clearInterval(i.animationIntervalID),clearTimeout(i.zoomTO),i.zoomTO=setTimeout(function(){i.$map.trigger("afterZoom",{x1:a,y1:c,x2:a+d,y2:c+e})},150))},25)},isRaphaelBBoxBugPresent:function(){var a=this,b=a.paper.text(-50,-50,"TEST"),c=b.getBBox();return b.remove(),0===c.width&&0===c.height},defaultOptions:{map:{cssClass:"map",tooltip:{cssClass:"mapTooltip"},defaultArea:{attrs:{fill:"#343434",stroke:"#5d5d5d","stroke-width":1,"stroke-linejoin":"round"},attrsHover:{fill:"#f38a03",animDuration:300},text:{position:"inner",margin:10,attrs:{"font-size":15,fill:"#c7c7c7"},attrsHover:{fill:"#eaeaea",animDuration:300}},target:"_self",cssClass:"area"},defaultPlot:{type:"circle",size:15,attrs:{fill:"#0088db",stroke:"#fff","stroke-width":0,"stroke-linejoin":"round"},attrsHover:{"stroke-width":3,animDuration:300},text:{position:"right",margin:10,attrs:{"font-size":15,fill:"#c7c7c7"},attrsHover:{fill:"#eaeaea",animDuration:300}},target:"_self",cssClass:"plot"},defaultLink:{factor:.5,attrs:{stroke:"#0088db","stroke-width":2},attrsHover:{animDuration:300},text:{position:"inner",margin:10,attrs:{"font-size":15,fill:"#c7c7c7"},attrsHover:{fill:"#eaeaea",animDuration:300}},target:"_self",cssClass:"link"},zoom:{enabled:!1,minLevel:0,maxLevel:10,step:.25,mousewheel:!0,touch:!0,animDuration:200,animEasing:"linear",buttons:{reset:{cssClass:"zoomButton zoomReset",content:"•",title:"Reset zoom"},in:{cssClass:"zoomButton zoomIn",content:"+",title:"Zoom in"},out:{cssClass:"zoomButton zoomOut",content:"−",title:"Zoom out"}}}},legend:{redrawOnResize:!0,area:[],plot:[]},areas:{},plots:{},links:{}},legendDefaultOptions:{area:{cssClass:"areaLegend",display:!0,marginLeft:10,marginLeftTitle:5,marginBottomTitle:10,marginLeftLabel:10,marginBottom:10,titleAttrs:{"font-size":16,fill:"#343434","text-anchor":"start"},labelAttrs:{"font-size":12,fill:"#343434","text-anchor":"start"},labelAttrsHover:{fill:"#787878",animDuration:300},hideElemsOnClick:{enabled:!0,opacity:.2,animDuration:300},slices:[],mode:"vertical"},plot:{cssClass:"plotLegend",display:!0,marginLeft:10,marginLeftTitle:5,marginBottomTitle:10,marginLeftLabel:10,marginBottom:10,titleAttrs:{"font-size":16,fill:"#343434","text-anchor":"start"},labelAttrs:{"font-size":12,fill:"#343434","text-anchor":"start"},labelAttrsHover:{fill:"#787878",animDuration:300},hideElemsOnClick:{enabled:!0,opacity:.2,animDuration:300},slices:[],mode:"vertical"}}},a.mapael===d&&(a.mapael=e),a.fn.mapael=function(b){return this.each(function(){a.data(this,"mapael")&&a.data(this,"mapael").destroy(),a.data(this,"mapael",new e(this,b))})},e}); \ No newline at end of file +!function(a){"object"==typeof exports?module.exports=a(require("jquery"),require("raphael"),require("jquery-mousewheel")):"function"==typeof define&&define.amd?define(["jquery","raphael","mousewheel"],a):a(jQuery,Raphael,jQuery.fn.mousewheel)}(function(a,b,c,d){"use strict";var e=function(b,c){var d=this;d.container=b,d.$container=a(b),d.options=d.extendDefaultOptions(c),d.zoomTO=0,d.zoomCenterX=0,d.zoomCenterY=0,d.previousPinchDist=0,d.zoomData={zoomLevel:0,zoomX:0,zoomY:0,panX:0,panY:0},d.currentViewBox={x:0,y:0,w:0,h:0},d.panning=!1,d.zoomAnimID=null,d.zoomAnimStartTime=null,d.zoomAnimCVBTarget=null,d.$map=a("."+d.options.map.cssClass,d.container),d.initialMapHTMLContent=d.$map.html(),d.$tooltip={},d.paper={},d.areas={},d.plots={},d.links={},d.legends={},d.mapConf={},d.customEventHandlers={},d.init()};return e.prototype={MouseOverFilteringTO:120,panningFilteringTO:150,panningEndFilteringTO:50,zoomFilteringTO:150,resizeFilteringTO:150,init:function(){var c=this;if(""===c.options.map.cssClass||0===a("."+c.options.map.cssClass,c.container).length)throw new Error("The map class `"+c.options.map.cssClass+"` doesn't exists");if(c.$tooltip=a("
").addClass(c.options.map.tooltip.cssClass).css("display","none"),c.$map.empty().append(c.$tooltip),a.mapael&&a.mapael.maps&&a.mapael.maps[c.options.map.name])c.mapConf=a.mapael.maps[c.options.map.name];else{if(!(a.fn.mapael&&a.fn.mapael.maps&&a.fn.mapael.maps[c.options.map.name]))throw new Error("Unknown map '"+c.options.map.name+"'");c.mapConf=a.fn.mapael.maps[c.options.map.name],window.console&&window.console.warn&&window.console.warn("Extending $.fn.mapael is deprecated (map '"+c.options.map.name+"')")}if(c.paper=new b(c.$map[0],c.mapConf.width,c.mapConf.height),!0===c.isRaphaelBBoxBugPresent())throw c.destroy(),new Error("Can't get boundary box for text (is your container hidden? See #135)");c.$container.addClass("mapael"),c.options.map.tooltip.css&&c.$tooltip.css(c.options.map.tooltip.css),c.setViewBox(0,0,c.mapConf.width,c.mapConf.height),c.options.map.width?c.paper.setSize(c.options.map.width,c.mapConf.height*(c.options.map.width/c.mapConf.width)):c.initResponsiveSize(),a.each(c.mapConf.elems,function(a){c.areas[a]={},c.areas[a].options=c.getElemOptions(c.options.map.defaultArea,c.options.areas[a]?c.options.areas[a]:{},c.options.legend.area),c.areas[a].mapElem=c.paper.path(c.mapConf.elems[a])}),c.options.map.beforeInit&&c.options.map.beforeInit(c.$container,c.paper,c.options),a.each(c.mapConf.elems,function(a){c.initElem(a,"area",c.areas[a])}),c.links=c.drawLinksCollection(c.options.links),a.each(c.options.plots,function(a){c.plots[a]=c.drawPlot(a)}),c.$container.on("zoom.mapael",function(a,b){c.onZoomEvent(a,b)}),c.options.map.zoom.enabled&&c.initZoom(c.mapConf.width,c.mapConf.height,c.options.map.zoom),c.options.map.zoom.init!==d&&(c.options.map.zoom.init.animDuration===d&&(c.options.map.zoom.init.animDuration=0),c.$container.trigger("zoom",c.options.map.zoom.init)),c.createLegends("area",c.areas,1),c.createLegends("plot",c.plots,c.paper.width/c.mapConf.width),c.$container.on("update.mapael",function(a,b){c.onUpdateEvent(a,b)}),c.$container.on("showElementsInRange.mapael",function(a,b){c.onShowElementsInRange(a,b)}),c.initDelegatedMapEvents(),c.initDelegatedCustomEvents(),c.options.map.afterInit&&c.options.map.afterInit(c.$container,c.paper,c.areas,c.plots,c.options),a(c.paper.desc).append(" and Mapael "+c.version+" (https://www.vincentbroute.fr/mapael/)")},destroy:function(){var b=this;b.$container.off(".mapael"),b.$map.off(".mapael"),b.onResizeEvent&&a(window).off("resize.mapael",b.onResizeEvent),b.$map.empty(),b.$map.html(b.initialMapHTMLContent),a.each(b.legends,function(c){a.each(b.legends[c],function(a){var d=b.legends[c][a];d.container.empty(),d.container.html(d.initialHTMLContent)})}),b.$container.removeClass("mapael"),b.$container.removeData("mapael"),b.container=d,b.$container=d,b.options=d,b.paper=d,b.$map=d,b.$tooltip=d,b.mapConf=d,b.areas=d,b.plots=d,b.links=d,b.customEventHandlers=d},initResponsiveSize:function(){var b=this,c=null,d=function(a){var c=b.$map.width();if(b.paper.width!==c){var d=c/b.mapConf.width;b.paper.setSize(c,b.mapConf.height*d),!0!==a&&b.options.legend.redrawOnResize&&b.createLegends("plot",b.plots,d)}};b.onResizeEvent=function(){clearTimeout(c),c=setTimeout(function(){d()},b.resizeFilteringTO)},a(window).on("resize.mapael",b.onResizeEvent),d(!0)},extendDefaultOptions:function(b){return b=a.extend(!0,{},e.prototype.defaultOptions,b),a.each(["area","plot"],function(c,d){if(a.isArray(b.legend[d]))for(var f=0;f").addClass(c.cssClass).html(c.content).attr("title",c.title);e.on("click.mapael",j[b]),f.$map.append(e)}),f.options.map.zoom.mousewheel&&f.$map.on("mousewheel.mapael",function(a){var b=a.deltaY>0?1:-1,c=f.mapPagePositionToXY(a.pageX,a.pageY);f.$container.trigger("zoom",{fixedCenter:!0,level:f.zoomData.zoomLevel+b,x:c.x,y:c.y}),a.preventDefault()}),f.options.map.zoom.touch&&(f.$map.on("touchstart.mapael",function(a){2===a.originalEvent.touches.length&&(f.zoomCenterX=(a.originalEvent.touches[0].pageX+a.originalEvent.touches[1].pageX)/2,f.zoomCenterY=(a.originalEvent.touches[0].pageY+a.originalEvent.touches[1].pageY)/2,f.previousPinchDist=Math.sqrt(Math.pow(a.originalEvent.touches[1].pageX-a.originalEvent.touches[0].pageX,2)+Math.pow(a.originalEvent.touches[1].pageY-a.originalEvent.touches[0].pageY,2)))}),f.$map.on("touchmove.mapael",function(a){var b=0,c=0;if(2===a.originalEvent.touches.length){if(b=Math.sqrt(Math.pow(a.originalEvent.touches[1].pageX-a.originalEvent.touches[0].pageX,2)+Math.pow(a.originalEvent.touches[1].pageY-a.originalEvent.touches[0].pageY,2)),Math.abs(b-f.previousPinchDist)>15){var d=f.mapPagePositionToXY(f.zoomCenterX,f.zoomCenterY);c=(b-f.previousPinchDist)/Math.abs(b-f.previousPinchDist),f.$container.trigger("zoom",{fixedCenter:!0,level:f.zoomData.zoomLevel+c,x:d.x,y:d.y}),f.previousPinchDist=b}return!1}})),f.$map.on("dragstart",function(){return!1});var k=null,l=null;a("body").on("mouseup.mapael"+(e.touch?" touchend.mapael":""),function(){g=!1,clearTimeout(k),clearTimeout(l),k=setTimeout(function(){f.panning=!1},f.panningEndFilteringTO)}),f.$map.on("mousedown.mapael"+(e.touch?" touchstart.mapael":""),function(a){clearTimeout(k),clearTimeout(l),a.pageX!==d?(g=!0,h=a.pageX,i=a.pageY):1===a.originalEvent.touches.length&&(g=!0,h=a.originalEvent.touches[0].pageX,i=a.originalEvent.touches[0].pageY)}).on("mousemove.mapael"+(e.touch?" touchmove.mapael":""),function(j){var m=f.zoomData.zoomLevel,n=0,o=0;if(clearTimeout(k),clearTimeout(l),j.pageX!==d?(n=j.pageX,o=j.pageY):1===j.originalEvent.touches.length?(n=j.originalEvent.touches[0].pageX,o=j.originalEvent.touches[0].pageY):g=!1,g&&0!==m){var p=(h-n)/(1+m*e.step)*(b/f.paper.width),q=(i-o)/(1+m*e.step)*(c/f.paper.height),r=Math.min(Math.max(0,f.currentViewBox.x+p),b-f.currentViewBox.w),s=Math.min(Math.max(0,f.currentViewBox.y+q),c-f.currentViewBox.h);return(Math.abs(p)>5||Math.abs(q)>5)&&(a.extend(f.zoomData,{panX:r,panY:s,zoomX:r+f.currentViewBox.w/2,zoomY:s+f.currentViewBox.h/2}),f.setViewBox(r,s,f.currentViewBox.w,f.currentViewBox.h),l=setTimeout(function(){f.$map.trigger("afterPanning",{x1:r,y1:s,x2:r+f.currentViewBox.w,y2:s+f.currentViewBox.h})},f.panningFilteringTO),h=n,i=o,f.panning=!0),!1}})},mapPagePositionToXY:function(a,b){var c=this,d=c.$map.offset(),e=c.options.map.width?c.mapConf.width/c.options.map.width:c.mapConf.width/c.$map.width(),f=1/(1+c.zoomData.zoomLevel*c.options.map.zoom.step);return{x:f*e*(a-d.left)+c.zoomData.panX,y:f*e*(b-d.top)+c.zoomData.panY}},onZoomEvent:function(b,c){var e,f,g,h,i,j=this,k=j.zoomData.zoomLevel,l=1+j.zoomData.zoomLevel*j.options.map.zoom.step,m=c.animDuration!==d?c.animDuration:j.options.map.zoom.animDuration;if(c.area!==d){if(j.areas[c.area]===d)throw new Error("Unknown area '"+c.area+"'");var n=c.areaMargin!==d?c.areaMargin:10,o=j.areas[c.area].mapElem.getBBox(),p=o.width+2*n,q=o.height+2*n;c.x=o.cx,c.y=o.cy,k=Math.min(Math.floor((j.mapConf.width/p-1)/j.options.map.zoom.step),Math.floor((j.mapConf.height/q-1)/j.options.map.zoom.step))}else if(c.level!==d&&(k="string"==typeof c.level?"+"===c.level.slice(0,1)||"-"===c.level.slice(0,1)?j.zoomData.zoomLevel+parseInt(c.level,10):parseInt(c.level,10):c.level<0?j.zoomData.zoomLevel+c.level:c.level),c.plot!==d){if(j.plots[c.plot]===d)throw new Error("Unknown plot '"+c.plot+"'");c.x=j.plots[c.plot].coords.x,c.y=j.plots[c.plot].coords.y}else{if(c.latitude!==d&&c.longitude!==d){var r=j.mapConf.getCoords(c.latitude,c.longitude);c.x=r.x,c.y=r.y}c.x===d&&(c.x=j.currentViewBox.x+j.currentViewBox.w/2),c.y===d&&(c.y=j.currentViewBox.y+j.currentViewBox.h/2)}k=Math.min(Math.max(k,j.options.map.zoom.minLevel),j.options.map.zoom.maxLevel),i=1+k*j.options.map.zoom.step,g=j.mapConf.width/i,h=j.mapConf.height/i,0===k?(e=0,f=0):(c.fixedCenter!==d&&!0===c.fixedCenter?(e=j.zoomData.panX+(c.x-j.zoomData.panX)*(i-l)/i,f=j.zoomData.panY+(c.y-j.zoomData.panY)*(i-l)/i):(e=c.x-g/2,f=c.y-h/2),e=Math.min(Math.max(0,e),j.mapConf.width-g),f=Math.min(Math.max(0,f),j.mapConf.height-h)),i===l&&e===j.zoomData.panX&&f===j.zoomData.panY||(m>0?j.animateViewBox(e,f,g,h,m,j.options.map.zoom.animEasing):(j.setViewBox(e,f,g,h),clearTimeout(j.zoomTO),j.zoomTO=setTimeout(function(){j.$map.trigger("afterZoom",{x1:e,y1:f,x2:e+g,y2:f+h})},j.zoomFilteringTO)),a.extend(j.zoomData,{zoomLevel:k,panX:e,panY:f,zoomX:e+g/2,zoomY:f+h/2}))},onShowElementsInRange:function(a,b){var c=this;b.animDuration===d&&(b.animDuration=0),b.hiddenOpacity===d&&(b.hiddenOpacity=.3),b.ranges&&b.ranges.area&&c.showElemByRange(b.ranges.area,c.areas,b.hiddenOpacity,b.animDuration),b.ranges&&b.ranges.plot&&c.showElemByRange(b.ranges.plot,c.plots,b.hiddenOpacity,b.animDuration),b.ranges&&b.ranges.link&&c.showElemByRange(b.ranges.link,c.links,b.hiddenOpacity,b.animDuration),b.afterShowRange&&b.afterShowRange()},showElemByRange:function(b,c,e,f){var g=this,h={};b.min===d&&b.max===d||(b={0:b}),a.each(b,function(f){var g=b[f];if(g.min===d&&g.max===d)return!0;a.each(c,function(a){var b=c[a].options.value;if("object"!=typeof b&&(b=[b]),b[f]===d)return!0;g.min!==d&&b[f]g.max?h[a]=e:h[a]=1})}),a.each(h,function(a){g.setElementOpacity(c[a],h[a],f)})},setElementOpacity:function(a,b,c){var d=this;b>0&&(a.mapElem.show(),a.textElem&&a.textElem.show()),d.animate(a.mapElem,{opacity:b},c,function(){0===b&&a.mapElem.hide()}),d.animate(a.textElem,{opacity:b},c,function(){0===b&&a.textElem.hide()})},onUpdateEvent:function(b,c){var e=this;if("object"==typeof c){var f=0,g=c.animDuration?c.animDuration:0,h=function(a){e.animate(a.mapElem,{opacity:0},g,function(){a.mapElem.remove()}),e.animate(a.textElem,{opacity:0},g,function(){a.textElem.remove()})},i=function(a){a.mapElem.attr({opacity:0}),a.textElem&&a.textElem.attr({opacity:0}),e.setElementOpacity(a,a.mapElem.originalAttrs.opacity!==d?a.mapElem.originalAttrs.opacity:1,g)};if("object"==typeof c.mapOptions&&(!0===c.replaceOptions?e.options=e.extendDefaultOptions(c.mapOptions):a.extend(!0,e.options,c.mapOptions),c.mapOptions.areas===d&&c.mapOptions.plots===d&&c.mapOptions.legend===d||a("[data-type='legend-elem']",e.$container).each(function(b,c){"1"===a(c).attr("data-hidden")&&a(c).trigger("click",{hideOtherElems:!1,animDuration:g})})),"object"==typeof c.deletePlotKeys)for(;f0&&i(e.plots[a]))}),"object"==typeof c.newLinks){var j=e.drawLinksCollection(c.newLinks);a.extend(e.links,j),a.extend(e.options.links,c.newLinks),g>0&&a.each(j,function(a){i(j[a])})}if(a.each(e.areas,function(a){("object"==typeof c.mapOptions&&("object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultArea||"object"==typeof c.mapOptions.areas&&"object"==typeof c.mapOptions.areas[a]||"object"==typeof c.mapOptions.legend&&"object"==typeof c.mapOptions.legend.area)||!0===c.replaceOptions)&&(e.areas[a].options=e.getElemOptions(e.options.map.defaultArea,e.options.areas[a]?e.options.areas[a]:{},e.options.legend.area),e.updateElem(e.areas[a],g))}),a.each(e.plots,function(a){("object"==typeof c.mapOptions&&("object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultPlot||"object"==typeof c.mapOptions.plots&&"object"==typeof c.mapOptions.plots[a]||"object"==typeof c.mapOptions.legend&&"object"==typeof c.mapOptions.legend.plot)||!0===c.replaceOptions)&&(e.plots[a].options=e.getElemOptions(e.options.map.defaultPlot,e.options.plots[a]?e.options.plots[a]:{},e.options.legend.plot),e.setPlotCoords(e.plots[a]),e.setPlotAttributes(e.plots[a]),e.updateElem(e.plots[a],g))}),a.each(e.links,function(a){("object"==typeof c.mapOptions&&("object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultLink||"object"==typeof c.mapOptions.links&&"object"==typeof c.mapOptions.links[a])||!0===c.replaceOptions)&&(e.links[a].options=e.getElemOptions(e.options.map.defaultLink,e.options.links[a]?e.options.links[a]:{},{}),e.updateElem(e.links[a],g))}),c.mapOptions&&("object"==typeof c.mapOptions.legend||"object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultArea||"object"==typeof c.mapOptions.map&&"object"==typeof c.mapOptions.map.defaultPlot)&&(a("[data-type='legend-elem']",e.$container).each(function(b,c){"1"===a(c).attr("data-hidden")&&a(c).trigger("click",{hideOtherElems:!1,animDuration:g})}),e.createLegends("area",e.areas,1),e.options.map.width?e.createLegends("plot",e.plots,e.options.map.width/e.mapConf.width):e.createLegends("plot",e.plots,e.$map.width()/e.mapConf.width)),"object"==typeof c.setLegendElemsState)a.each(c.setLegendElemsState,function(b,c){var f=e.$container.find("."+b)[0];f!==d&&a("[data-type='legend-elem']",f).each(function(b,d){("0"===a(d).attr("data-hidden")&&"hide"===c||"1"===a(d).attr("data-hidden")&&"show"===c)&&a(d).trigger("click",{hideOtherElems:!1,animDuration:g})})});else{var k="hide"===c.setLegendElemsState?"hide":"show";a("[data-type='legend-elem']",e.$container).each(function(b,c){("0"===a(c).attr("data-hidden")&&"hide"===k||"1"===a(c).attr("data-hidden")&&"show"===k)&&a(c).trigger("click",{hideOtherElems:!1,animDuration:g})})}e.initDelegatedCustomEvents(),c.afterUpdate&&c.afterUpdate(e.$container,e.paper,e.areas,e.plots,e.options,e.links)}},setPlotCoords:function(a){var b=this;if(a.options.x!==d&&a.options.y!==d)a.coords={x:a.options.x,y:a.options.y};else if(a.options.plotsOn!==d&&b.areas[a.options.plotsOn]!==d){var c=b.areas[a.options.plotsOn].mapElem.getBBox();a.coords={x:c.cx,y:c.cy}}else a.coords=b.mapConf.getCoords(a.options.latitude,a.options.longitude)},setPlotAttributes:function(a){"square"===a.options.type?(a.options.attrs.width=a.options.size,a.options.attrs.height=a.options.size,a.options.attrs.x=a.coords.x-a.options.size/2,a.options.attrs.y=a.coords.y-a.options.size/2):"image"===a.options.type?(a.options.attrs.src=a.options.url,a.options.attrs.width=a.options.width,a.options.attrs.height=a.options.height,a.options.attrs.x=a.coords.x-a.options.width/2,a.options.attrs.y=a.coords.y-a.options.height/2):"svg"===a.options.type?(a.options.attrs.path=a.options.path,a.options.attrs.transform===d&&(a.options.attrs.transform=""),a.mapElem.originalBBox===d&&(a.mapElem.originalBBox=a.mapElem.getBBox()),a.mapElem.baseTransform="m"+a.options.width/a.mapElem.originalBBox.width+",0,0,"+a.options.height/a.mapElem.originalBBox.height+","+(a.coords.x-a.options.width/2)+","+(a.coords.y-a.options.height/2),a.options.attrs.transform=a.mapElem.baseTransform+a.options.attrs.transform):(a.options.attrs.x=a.coords.x,a.options.attrs.y=a.coords.y,a.options.attrs.r=a.options.size/2)},drawLinksCollection:function(b){var c=this,e={},f={},g={},h={},i={};return a.each(b,function(a){var j=c.getElemOptions(c.options.map.defaultLink,b[a],{});if(e="string"==typeof b[a].between[0]?c.options.plots[b[a].between[0]]:b[a].between[0],f="string"==typeof b[a].between[1]?c.options.plots[b[a].between[1]]:b[a].between[1],e.plotsOn!==d&&c.areas[e.plotsOn]!==d){var k=c.areas[e.plotsOn].mapElem.getBBox();g={x:k.cx,y:k.cy}}else e.latitude!==d&&e.longitude!==d?g=c.mapConf.getCoords(e.latitude,e.longitude):(g.x=e.x,g.y=e.y);if(f.plotsOn!==d&&c.areas[f.plotsOn]!==d){var l=c.areas[f.plotsOn].mapElem.getBBox();h={x:l.cx,y:l.cy}}else f.latitude!==d&&f.longitude!==d?h=c.mapConf.getCoords(f.latitude,f.longitude):(h.x=f.x,h.y=f.y);i[a]=c.drawLink(a,g.x,g.y,h.x,h.y,j)}),i},drawLink:function(a,b,c,d,e,f){var g=this,h={options:f},i=(b+d)/2,j=(c+e)/2,k=-1/((e-c)/(d-b)),l=j-k*i,m=Math.sqrt((d-b)*(d-b)+(e-c)*(e-c)),n=1+k*k,o=-2*i+2*k*l-2*k*j,p=i*i+l*l-l*j-j*l+j*j-f.factor*m*(f.factor*m),q=o*o-4*n*p,r=0,s=0;return f.factor>0?(r=(-o+Math.sqrt(q))/(2*n),s=k*r+l):(r=(-o-Math.sqrt(q))/(2*n),s=k*r+l),h.mapElem=g.paper.path("m "+b+","+c+" C "+r+","+s+" "+d+","+e+" "+d+","+e),g.initElem(a,"link",h),h},isAttrsChanged:function(a,b){for(var c in b)if(b.hasOwnProperty(c)&&void 0===a[c]||b[c]!==a[c])return!0;return!1},updateElem:function(b,c){var e,f,g,h=this;if(!0===b.options.toFront&&b.mapElem.toFront(),b.options.href!==d?(b.options.attrs.cursor="pointer",b.options.text&&(b.options.text.attrs.cursor="pointer")):"pointer"===b.mapElem.attrs.cursor&&(b.options.attrs.cursor="auto",b.options.text&&(b.options.text.attrs.cursor="auto")),b.textElem){b.options.text.attrs.text=b.options.text.content,e=b.mapElem.getBBox(),(b.options.size||b.options.width&&b.options.height)&&("image"===b.options.type||"svg"===b.options.type?(f=(b.options.width-e.width)/2,g=(b.options.height-e.height)/2):(f=(b.options.size-e.width)/2,g=(b.options.size-e.height)/2),e.x-=f,e.x2+=f,e.y-=g,e.y2+=g);var i=h.getTextPosition(e,b.options.text.position,b.options.text.margin);b.options.text.attrs.x=i.x,b.options.text.attrs.y=i.y,b.options.text.attrs["text-anchor"]=i.textAnchor,h.setHoverOptions(b.textElem,b.options.text.attrs,b.options.text.attrsHover),h.isAttrsChanged(b.textElem.attrs,b.options.text.attrs)&&h.animate(b.textElem,b.options.text.attrs,c)}h.setHoverOptions(b.mapElem,b.options.attrs,b.options.attrsHover),h.isAttrsChanged(b.mapElem.attrs,b.options.attrs)&&h.animate(b.mapElem,b.options.attrs,c),b.options.cssClass!==d&&a(b.mapElem.node).removeClass().addClass(b.options.cssClass)},drawPlot:function(a){var b=this,c={};return c.options=b.getElemOptions(b.options.map.defaultPlot,b.options.plots[a]?b.options.plots[a]:{},b.options.legend.plot),b.setPlotCoords(c),"svg"===c.options.type&&(c.mapElem=b.paper.path(c.options.path)),b.setPlotAttributes(c),"square"===c.options.type?c.mapElem=b.paper.rect(c.options.attrs.x,c.options.attrs.y,c.options.attrs.width,c.options.attrs.height):"image"===c.options.type?c.mapElem=b.paper.image(c.options.attrs.src,c.options.attrs.x,c.options.attrs.y,c.options.attrs.width,c.options.attrs.height):"svg"===c.options.type||(c.mapElem=b.paper.circle(c.options.attrs.x,c.options.attrs.y,c.options.attrs.r)),b.initElem(a,"plot",c),c},setEventHandlers:function(b,c,e){var f=this;a.each(e.options.eventHandlers,function(a){f.customEventHandlers[a]===d&&(f.customEventHandlers[a]={}),f.customEventHandlers[a][c]===d&&(f.customEventHandlers[a][c]={}),f.customEventHandlers[a][c][b]=e})},drawLegend:function(c,e,f,g,h){var i=this,j={},k={},l=0,m=0,n=null,o=null,p={},q=0,r=0,s=0,t=0,u=[];j=a("."+c.cssClass,i.$container);var v=j.html();for(j.empty(),k=new b(j.get(0)),a(k.canvas).attr({"data-legend-type":e,"data-legend-id":h}),m=l=0,c.title&&""!==c.title&&(n=k.text(c.marginLeftTitle,0,c.title).attr(c.titleAttrs),o=n.getBBox(),n.attr({y:.5*o.height}),l=c.marginLeftTitle+o.width,m+=c.marginBottomTitle+o.height),q=0;q0&&""!==f[g].cssClass&&0!==a("."+f[g].cssClass,e.$container).length&&(e.legends[b][g]=e.drawLegend(f[g],b,c,d,g))},setHoverOptions:function(c,d,e){"SVG"!==b.type&&delete e.transform,c.attrsHover=e,c.attrsHover.transform?c.originalAttrs=a.extend({transform:"s1"},d):c.originalAttrs=d},elemEnter:function(a){var b=this;if(a!==d){if(a.mapElem!==d&&b.animate(a.mapElem,a.mapElem.attrsHover,a.mapElem.attrsHover.animDuration),a.textElem!==d&&b.animate(a.textElem,a.textElem.attrsHover,a.textElem.attrsHover.animDuration),a.options&&a.options.tooltip!==d){var c="";b.$tooltip.removeClass().addClass(b.options.map.tooltip.cssClass),a.options.tooltip.content!==d&&(c="function"==typeof a.options.tooltip.content?a.options.tooltip.content(a.mapElem):a.options.tooltip.content),a.options.tooltip.cssClass!==d&&b.$tooltip.addClass(a.options.tooltip.cssClass),b.$tooltip.html(c).css("display","block")}a.mapElem===d&&a.textElem===d||b.paper.safari&&b.paper.safari()}},elemHover:function(a,b){var c=this;if(a!==d&&a.options.tooltip!==d){var e=b.pageX,f=b.pageY,g=10,h=20;"object"==typeof a.options.tooltip.offset&&(void 0!==a.options.tooltip.offset.left&&(g=a.options.tooltip.offset.left),void 0!==a.options.tooltip.offset.top&&(h=a.options.tooltip.offset.top));var i={left:Math.min(c.$map.width()-c.$tooltip.outerWidth()-5,e-c.$map.offset().left+g),top:Math.min(c.$map.height()-c.$tooltip.outerHeight()-5,f-c.$map.offset().top+h)};"object"==typeof a.options.tooltip.overflow&&(!0===a.options.tooltip.overflow.right&&(i.left=e-c.$map.offset().left+10),!0===a.options.tooltip.overflow.bottom&&(i.top=f-c.$map.offset().top+20)),c.$tooltip.css(i)}},elemOut:function(a){var b=this;a!==d&&(a.mapElem!==d&&b.animate(a.mapElem,a.mapElem.originalAttrs,a.mapElem.attrsHover.animDuration),a.textElem!==d&&b.animate(a.textElem,a.textElem.originalAttrs,a.textElem.attrsHover.animDuration),a.options&&a.options.tooltip!==d&&b.$tooltip.css({display:"none",top:-1e3,left:-1e3}),a.mapElem===d&&a.textElem===d||b.paper.safari&&b.paper.safari())},elemClick:function(a){var b=this;a!==d&&(b.panning||a.options.href===d||window.open(a.options.href,a.options.target))},getElemOptions:function(b,c,e){var f=this,g=a.extend(!0,{},b,c);if(g.value!==d)if(a.isArray(e))for(var h=0;h=b.slices[c].min)&&(b.slices[c].max===d||a<=b.slices[c].max))return b.slices[c];return{}},animateViewBox:function(a,c,d,e,f,g){var h=this,i=h.currentViewBox.x,j=a-i,k=h.currentViewBox.y,l=c-k,m=h.currentViewBox.w,n=d-m,o=h.currentViewBox.h,p=e-o;h.zoomAnimCVBTarget||(h.zoomAnimCVBTarget={x:a,y:c,w:d,h:e});var q=m>d?"in":"out",r=b.easing_formulas[g||"linear"],s=f-2*f/100,t=h.zoomAnimStartTime;h.zoomAnimStartTime=(new Date).getTime();var u=function(){h.cancelAnimationFrame(h.zoomAnimID);var b=(new Date).getTime()-h.zoomAnimStartTime;if(bh.currentViewBox.w||wd)||h.setViewBox(g,v,w,x),h.zoomAnimID=h.requestAnimationFrame(u)}else h.zoomAnimStartTime=null,h.zoomAnimCVBTarget=null,h.currentViewBox.w!==d&&h.setViewBox(a,c,d,e),h.$map.trigger("afterZoom",{x1:a,y1:c,x2:a+d,y2:c+e})};u()}, +requestAnimationFrame:function(a){return this._requestAnimationFrameFn.call(window,a)},cancelAnimationFrame:function(a){this._cancelAnimationFrameFn.call(window,a)},_requestAnimationFrameFn:function(){var a=function(){var b=(new Date).getTime();return function(c){var d=(new Date).getTime();if(!(d-b>16))return setTimeout(function(){a(c)},0);b=d,c(d)}}();return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||a}(),_cancelAnimationFrameFn:function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.mozCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame||window.oCancelRequestAnimationFrame||clearTimeout}(),setViewBox:function(a,b,c,d){var e=this;e.currentViewBox.x=a,e.currentViewBox.y=b,e.currentViewBox.w=c,e.currentViewBox.h=d,e.paper.setViewBox(a,b,c,d,!1)},_nonAnimatedAttrs:["arrow-end","arrow-start","gradient","class","cursor","text-anchor","font","font-family","font-style","font-weight","letter-spacing","src","href","target","title","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit"],animate:function(a,b,c,e){var f=this;if(a)if(c>0){for(var g={},h=0;h