!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).jsVectorMap=e()}(this,(function(){"use strict";var t=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var i=Object.prototype.toString.call(t);return"[object RegExp]"===i||"[object Date]"===i||function(t){return t instanceof Node}(t)||function(t){return t.$$typeof===e}(t)}(t)};var e="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(t,e){return!1!==e.clone&&e.isMergeableObject(t)?o((i=t,Array.isArray(i)?[]:{}),t,e):t;var i}function s(t,e,s){return t.concat(e).map((function(t){return i(t,s)}))}function n(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return t.propertyIsEnumerable(e)})):[]}(t))}function r(t,e){try{return e in t}catch(t){return!1}}function a(t,e,s){var a={};return s.isMergeableObject(t)&&n(t).forEach((function(e){a[e]=i(t[e],s)})),n(e).forEach((function(n){(function(t,e){return r(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,n)||(r(t,n)&&s.isMergeableObject(e[n])?a[n]=function(t,e){if(!e.customMerge)return o;var i=e.customMerge(t);return"function"==typeof i?i:o}(n,s)(t[n],e[n],s):a[n]=i(e[n],s))})),a}var o=function(e,n,r){(r=r||{}).arrayMerge=r.arrayMerge||s,r.isMergeableObject=r.isMergeableObject||t,r.cloneUnlessOtherwiseSpecified=i;var o=Array.isArray(n);return o===Array.isArray(e)?o?r.arrayMerge(e,n,r):a(e,n,r):i(n,r)},h=function(t){return"object"==typeof t&&void 0!==t.nodeType?t:"string"==typeof t?document.querySelector(t):null},l=function(t,e,i,s){void 0===s&&(s=!1);var n=document.createElement(t);return i&&(n[s?"innerHTML":"textContent"]=i),e&&(n.className=e),n},c=function(t){t.parentNode.removeChild(t)},u=function(t,e,i){return void 0===i&&(i=!1),i?o(t,e):Object.assign(t,e)},p=function(t,e){return t.toLowerCase()+":to:"+e.toLowerCase()},d=function(t,e){Object.assign(t.prototype,e)},f={},m=1,g={on:function(t,e,i,s){void 0===s&&(s={});var n="jvm:"+e+"::"+m++;f[n]={selector:t,handler:i},i._uid=n,t.addEventListener(e,i,s)},delegate:function(t,e,i,s){(e=e.split(" ")).forEach((function(e){g.on(t,e,(function(t){var e=t.target;e.matches(i)&&s.call(e,t)}))}))},off:function(t,e,i){var s=e.split(":")[1];t.removeEventListener(s,i),delete f[i._uid]},flush:function(){Object.keys(f).forEach((function(t){g.off(f[t].selector,t,f[t].handler)}))},getEventRegistry:function(){return f}};var v={onLoaded:"map:loaded",onViewportChange:"viewport:changed",onRegionClick:"region:clicked",onMarkerClick:"marker:clicked",onRegionSelected:"region:selected",onMarkerSelected:"marker:selected",onRegionTooltipShow:"region.tooltip:show",onMarkerTooltipShow:"marker.tooltip:show",onDestroyed:"map:destroyed"},_=function(t,e,i){var s=h(e),n=-1===s.getAttribute("class").indexOf("jvm-region")?"marker":"region",r="region"===n,a=r?s.getAttribute("data-code"):s.getAttribute("data-index"),o=r?v.onRegionSelected:v.onMarkerSelected;return i&&(o=r?v.onRegionTooltipShow:v.onMarkerTooltipShow),{type:n,code:a,event:o,element:r?t.regions[a].element:t._markers[a].element,tooltipText:r?t._mapData.paths[a].name||"":t._markers[a].config.name||""}};function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i=t.length?{done:!0}:{done:!1,value:t[s++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function w(){return w=Object.assign?Object.assign.bind():function(t){for(var e=1;e>10||1),n=i.container.getBoundingClientRect(),r=t.pageX-n.left-window.scrollX,a=t.pageY-n.top-window.scrollY,o=Math.pow(1+s.params.zoomOnScrollSpeed/1e3,-1.5*e);s.tooltip&&s._tooltip.hide(),s._setScale(s.scale*o,r,a),t.preventDefault()}))},_setupElementEvents:function(){var t,e,i,s=this,n=this.container;g.on(n,"mousemove",(function(s){Math.abs(t-s.pageX)+Math.abs(e-s.pageY)>2&&(i=!0)})),g.delegate(n,"mousedown",".jvm-element",(function(s){t=s.pageX,e=s.pageY,i=!1})),g.delegate(n,"mouseover mouseout",".jvm-element",(function(t){var e=_(s,this,!0),i=s.params.showTooltip;"mouseover"===t.type?(e.element.hover(!0),i&&(s._tooltip.text(e.tooltipText),s._emit(e.event,[t,s._tooltip,e.code]),t.defaultPrevented||s._tooltip.show())):(e.element.hover(!1),i&&s._tooltip.hide())})),g.delegate(n,"mouseup",".jvm-element",(function(t){var e=_(s,this);if(!i&&("region"===e.type&&s.params.regionsSelectable||"marker"===e.type&&s.params.markersSelectable)){var n=e.element;s.params[e.type+"sSelectableOne"]&&("region"===e.type?s.clearSelectedRegions():s.clearSelectedMarkers()),e.element.isSelected?n.select(!1):n.select(!0),s._emit(e.event,[e.code,n.isSelected,"region"===e.type?s.getSelectedRegions():s.getSelectedMarkers()])}})),g.delegate(n,"click",".jvm-element",(function(t){var e=_(s,this),i=e.type,n=e.code;s._emit("region"===i?v.onRegionClick:v.onMarkerClick,[t,n])}))},_setupZoomButtons:function(){var t=this,e=this.params.zoomInButton,i=this.params.zoomOutButton,s=function(t){return"string"==typeof t?document.querySelector(t):t},n=e?s(e):l("div","jvm-zoom-btn jvm-zoomin","+",!0),r=i?s(i):l("div","jvm-zoom-btn jvm-zoomout","−",!0);e||this.container.appendChild(n),i||this.container.appendChild(r);var a=function(e){return void 0===e&&(e=!0),function(){return t._setScale(e?t.scale*t.params.zoomStep:t.scale/t.params.zoomStep,t._width/2,t._height/2,!1,t.params.zoomAnimate)}};g.on(n,"click",a()),g.on(r,"click",a(!1))},_setupContainerTouchEvents:function(){var t,e,i,s,n,r,a,o=this,h=function(h){var l,c,u,p,d=h.touches;if("touchstart"==h.type&&(a=0),1==d.length){var f;if(1==a)u=o.transX,p=o.transY,o.transX-=(i-d[0].pageX)/o.scale,o.transY-=(s-d[0].pageY)/o.scale,null==(f=o._tooltip)||f.hide(),o._applyTransform(),u==o.transX&&p==o.transY||h.preventDefault();i=d[0].pageX,s=d[0].pageY}else if(2==d.length)if(2==a){var m;c=Math.sqrt(Math.pow(d[0].pageX-d[1].pageX,2)+Math.pow(d[0].pageY-d[1].pageY,2))/e,o._setScale(t*c,n,r),null==(m=o._tooltip)||m.hide(),h.preventDefault()}else{var g=o.container.getBoundingClientRect();l={top:g.top+window.scrollY,left:g.left+window.scrollX},n=d[0].pageX>d[1].pageX?d[1].pageX+(d[0].pageX-d[1].pageX)/2:d[0].pageX+(d[1].pageX-d[0].pageX)/2,r=d[0].pageY>d[1].pageY?d[1].pageY+(d[0].pageY-d[1].pageY)/2:d[0].pageY+(d[1].pageY-d[0].pageY)/2,n-=l.left,r-=l.top,t=o.scale,e=Math.sqrt(Math.pow(d[0].pageX-d[1].pageX,2)+Math.pow(d[0].pageY-d[1].pageY,2))}a=d.length};g.on(o.container,"touchstart",h),g.on(o.container,"touchmove",h)},_createRegions:function(){for(var t in this._regionLabelsGroup=this._regionLabelsGroup||this.canvas.createGroup("jvm-regions-labels-group"),this._mapData.paths){var e=new O({map:this,code:t,path:this._mapData.paths[t].path,style:u({},this.params.regionStyle),labelStyle:this.params.regionLabelStyle,labelsGroup:this._regionLabelsGroup,label:this.params.labels&&this.params.labels.regions});this.regions[t]={config:this._mapData.paths[t],element:e}}},_createLines:function(t){var e=!1,i=!1,s=this.params.lineStyle,n=s.curvature,r=M(s,X);for(var a in t){for(var o=t[a],h=0,l=Object.values(this._markers);he?this.transY=e:this.transYt?this.transX=t:this.transXthis._defaultWidth/this._defaultHeight?(this._baseScale=this._height/this._defaultHeight,this._baseTransX=Math.abs(this._width-this._defaultWidth*this._baseScale)/(2*this._baseScale)):(this._baseScale=this._width/this._defaultWidth,this._baseTransY=Math.abs(this._height-this._defaultHeight*this._baseScale)/(2*this._baseScale)),this.scale*=this._baseScale/t,this.transX*=this._baseScale/t,this.transY*=this._baseScale/t},_setScale:function(t,e,i,s,n){var r,a,o,h,l,c,u,p,d,f,m=this,g=0,_=Math.abs(Math.round(60*(t-this.scale)/Math.max(t,this.scale)));t>this.params.zoomMax*this._baseScale?t=this.params.zoomMax*this._baseScale:t0?(o=this.scale,h=(t-o)/_,l=this.transX*this.scale,u=this.transY*this.scale,c=(d*t-l)/_,p=(f*t-u)/_,a=setInterval((function(){g+=1,m.scale=o+h*g,m.transX=(l+c*g)/m.scale,m.transY=(u+p*g)/m.scale,m._applyTransform(),g==_&&(clearInterval(a),m._emit(v.onViewportChange,[m.scale,m.transX,m.transY]))}),10)):(this.transX=d,this.transY=f,this.scale=t,this._applyTransform(),this._emit(v.onViewportChange,[this.scale,this.transX,this.transY]))},setFocus:function(t){var e=this;void 0===t&&(t={});var i,s=[];if(t.region?s.push(t.region):t.regions&&(s=t.regions),s.length)return s.forEach((function(t){if(e.regions[t]){var s=e.regions[t].element.shape.getBBox();s&&(i=void 0===i?s:{x:Math.min(i.x,s.x),y:Math.min(i.y,s.y),width:Math.max(i.x+i.width,s.x+s.width)-Math.min(i.x,s.x),height:Math.max(i.y+i.height,s.y+s.height)-Math.min(i.y,s.y)})}})),this._setScale(Math.min(this._width/i.width,this._height/i.height),-(i.x+i.width/2),-(i.y+i.height/2),!0,t.animate);if(t.coords){var n=this.coordsToPoint(t.coords[0],t.coords[1]),r=this.transX-n.x/this.scale,a=this.transY-n.y/this.scale;return this._setScale(t.scale*this._baseScale,r,a,!0,t.animate)}},updateSize:function(){this._width=this.container.offsetWidth,this._height=this.container.offsetHeight,this._resize(),this.canvas.setSize(this._width,this._height),this._applyTransform()},coordsToPoint:function(t,e){var i=st.maps[this.params.map].projection,s=H[i.type](t,e,i.centralMeridian),n=s.x,r=s.y,a=this.getInsetForPoint(n,r);if(!a)return!1;var o=a.bbox;return n=(n-o[0].x)/(o[1].x-o[0].x)*a.width*this.scale,r=(r-o[0].y)/(o[1].y-o[0].y)*a.height*this.scale,{x:n+this.transX*this.scale+a.left*this.scale,y:r+this.transY*this.scale+a.top*this.scale}},getInsetForPoint:function(t,e){for(var i=st.maps[this.params.map].insets,s=0;sr.x&&tr.y&&ethis.max&&(this.max=e),e-1)})),!0)},e.removeLines=function(t){var e=this;(t=Array.isArray(t)?t.map((function(t){return p(t.from,t.to)})):this._getLinesAsUids()).forEach((function(t){e._lines[t].dispose(),delete e._lines[t]}))},e.removeLine=function(t,e){console.warn("`removeLine` method is deprecated, please use `removeLines` instead.");var i=p(t,e);this._lines.hasOwnProperty(i)&&(this._lines[i].element.remove(),delete this._lines[i])},e.reset=function(){for(var t in this.series)for(var e=0;e