highcharts
Version:
JavaScript charting framework
13 lines • 72.9 kB
JavaScript
let t;/**
* Highmaps JS v13.0.1 (2026-08-17)
* @module highcharts/modules/map
* @requires highcharts
*
* Highmaps as a plugin for Highcharts or Highcharts Stock.
*
* (c) 2011-2026 Highsoft AS
* Author: Torstein Hønsi
*
* A commercial license may be required depending on use,
* see www.highcharts.com/license
*/import*as e from"../highcharts.js";import"./coloraxis.js";let i={};i.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{if(Array.isArray(e))for(var o=0;o<e.length;){var s=e[o++],r=e[o++];i.o(t,s)?0===r&&o++:0===r?Object.defineProperty(t,s,{enumerable:!0,value:e[o++]}):Object.defineProperty(t,s,{enumerable:!0,get:r})}else for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let o=e.default;var s,r,a,n,l,h,p,d,c=i.n(o);let u={lang:{zoomIn:"Zoom in",zoomOut:"Zoom out"},mapNavigation:{buttonOptions:{alignTo:"plotBox",align:"left",verticalAlign:"top",x:0,width:18,height:18,padding:5,style:{color:"var(--highcharts-neutral-color-60)",fontSize:"1em",fontWeight:"bold"},theme:{fill:"var(--highcharts-background-color)",stroke:"var(--highcharts-neutral-color-10)","stroke-width":1,"text-align":"center"}},buttons:{zoomIn:{onclick:function(){this.mapZoom(.5)},text:"+",y:0},zoomOut:{onclick:function(){this.mapZoom(2)},text:"-",y:28}},mouseWheelSensitivity:1.1}};!function(t){let e,i=0;function s(t){let e=this.chart;t=this.normalize(t),e.options.mapNavigation.enableDoubleClickZoomTo?e.pointer.inClass(t.target,"highcharts-tracker")&&e.hoverPoint&&e.hoverPoint.zoomTo():e.isInsidePlot(t.chartX-e.plotLeft,t.chartY-e.plotTop)&&e.mapZoom(.5,void 0,void 0,t.chartX,t.chartY)}function r(t){let s=this.chart;t=this.normalize(t);let r=(0,o.defined)(t.wheelDelta)&&-t.wheelDelta/120||t.deltaY||t.detail;Math.abs(r)>=1&&(i+=Math.abs(r),e&&(0,o.internalClearTimeout)(e),e=setTimeout(()=>{i=0},50)),i<10&&s.isInsidePlot(t.chartX-s.plotLeft,t.chartY-s.plotTop)&&s.mapView&&s.mapView.zoomBy(-((s.options.mapNavigation.mouseWheelSensitivity-1)*r),void 0,[t.chartX,t.chartY],!(1>Math.abs(r))&&void 0)}function a(t,e,i){let s=this.chart;if(e=t.call(this,e,i),s&&s.mapView){let t=s.mapView.pixelsToLonLat({x:e.chartX-s.plotLeft,y:e.chartY-s.plotTop});t&&(0,o.extend)(e,t)}return e}function n(t){let e=this.chart.options.mapNavigation;e&&(0,o.pick)(e.enableTouchZoom,e.enabled)&&(this.chart.zooming.pinchType="xy"),t.apply(this,[].slice.call(arguments,1))}t.compose=function(t){let e=t.prototype;e.onContainerDblClick||((0,o.extend)(e,{onContainerDblClick:s,onContainerMouseWheel:r}),(0,o.wrap)(e,"normalize",a),(0,o.wrap)(e,"zoomOption",n))}}(n||(n={}));let m=n;function g(e,i,o,s,r){if(r){let t=r?.r||0;r.brBoxY=i-t,r.brBoxHeight=s+t}return t.roundedRect(e,i,o,s,r)}function b(e,i,o,s,r){if(r){let t=r?.r||0;r.brBoxHeight=s+t}return t.roundedRect(e,i,o,s,r)}let f=function(e){(t=e.prototype.symbols).bottombutton=g,t.topbutton=b},{setOptions:y}=c(),{composed:x}=c();function M(t){t&&(t.preventDefault?.(),t.stopPropagation?.(),t.cancelBubble=!0)}class v{static compose(t,e,i){m.compose(e),f(i),(0,o.pushUnique)(x,"Map.Navigation")&&((0,o.addEvent)(t,"beforeRender",function(){this.mapNavigation=new v(this),this.mapNavigation.update()}),y(u))}constructor(t){this.chart=t,this.navButtons=[]}update(t){let e=this,i=e.chart,s=e.navButtons,r=function(t){this.handler.call(i,t),M(t)},a=i.options.mapNavigation;for(t&&(a=i.options.mapNavigation=(0,o.merge)(i.options.mapNavigation,t));s.length;)s.pop()?.destroy();!i.renderer.forExport&&(0,o.pick)(a.enableButtons,a.enabled)&&(e.navButtonsGroup||(e.navButtonsGroup=i.renderer.g().attr({zIndex:7}).add()),(0,o.objectEach)(a.buttons,(t,n)=>{let l={padding:(t=(0,o.merge)(a.buttonOptions,t)).padding};!i.styledMode&&t.theme&&((0,o.extend)(l,t.theme),l.style=(0,o.merge)(t.theme.style,t.style));let{text:h,width:p=0,height:d=0,padding:c=0}=t,u=i.renderer.button("+"!==h&&"-"!==h&&h||"",0,0,r,l,void 0,void 0,void 0,"zoomIn"===n?"topbutton":"bottombutton").addClass("highcharts-map-navigation highcharts-"+({zoomIn:"zoom-in",zoomOut:"zoom-out"})[n]).attr({width:p,height:d,title:i.options.lang[n],zIndex:5}).add(e.navButtonsGroup);if("+"===h||"-"===h){let e=p+1,o=[["M",c+3,c+d/2],["L",c+e-3,c+d/2]];"+"===h&&o.push(["M",c+e/2,c+3],["L",c+e/2,c+d-3]),i.renderer.path(o).addClass("highcharts-button-symbol").attr(i.styledMode?{}:{stroke:t.style?.color,"stroke-width":3,"stroke-linecap":"round"}).add(u)}if(u.handler=t.onclick,(0,o.addEvent)(u.element,"dblclick",M),s.push(u),(0,o.extend)(t,{width:u.width,height:2*(u.height||0)}),i.hasLoaded)u.align(t,!1,t.alignTo);else{let e=(0,o.addEvent)(i,"load",()=>{u.element&&u.align(t,!1,t.alignTo),e()})}}),i.hasLoaded||(0,o.addEvent)(i,"render",function(){let t=i.exporting?.group?.getBBox();if(t){let i=e.navButtonsGroup.getBBox();if(!(i.x>=t.x+t.width||i.x+i.width<=t.x||i.y>=t.y+t.height||i.y+i.height<=t.y)){let o=-i.y-i.height+t.y-5,s=t.y+t.height-i.y+5,r=a.buttonOptions&&a.buttonOptions.verticalAlign;e.navButtonsGroup.attr({translateY:"bottom"===r?o:s})}}})),this.updateEvents(a)}updateEvents(t){let e=this.chart;(0,o.pick)(t.enableDoubleClickZoom,t.enabled)||t.enableDoubleClickZoomTo?this.unbindDblClick=this.unbindDblClick||(0,o.addEvent)(e.container,"dblclick",function(t){e.pointer.onContainerDblClick(t)}):this.unbindDblClick&&(this.unbindDblClick=this.unbindDblClick()),(0,o.pick)(t.enableMouseWheelZoom,t.enabled)?this.unbindMouseWheel=this.unbindMouseWheel||(0,o.addEvent)(e.container,"wheel",function(t){if(!e.pointer.inClass(t.target,"highcharts-no-mousewheel")){let i=e.mapView?.zoom;e.pointer.onContainerMouseWheel(t),i!==e.mapView?.zoom&&M(t)}return!1}):this.unbindMouseWheel&&(this.unbindMouseWheel=this.unbindMouseWheel())}}let w=e.default.SeriesRegistry;var T=i.n(w);let P=e.default.SVGElement;var C=i.n(P);let{column:{prototype:j}}=T().seriesTypes;var k=l||(l={});function L(t){let e=this.series,i=e.chart.renderer;this.moveToTopOnHover&&this.graphic&&(e.stateMarkerGraphic||(e.stateMarkerGraphic=new(C())(i,"use").css({pointerEvents:"none"}).add(this.graphic.parentGroup)),t?.state==="hover"?(this.graphic.attr({id:this.id}),e.stateMarkerGraphic.attr({href:`${i.url}#${this.id}`,visibility:"visible"})):e.stateMarkerGraphic.attr({href:""}))}k.pointMembers={dataLabelOnNull:!0,moveToTopOnHover:!0,isValid:function(){return null!==this.value&&this.value!==1/0&&this.value!==-1/0&&(void 0===this.value||!isNaN(this.value))}},k.seriesMembers={colorKey:"value",axisTypes:["xAxis","yAxis","colorAxis"],parallelArrays:["x","y","value"],pointArrayMap:["value"],trackerGroups:["group","markerGroup","dataLabelsGroup"],colorAttribs:function(t){let e={};return(0,o.defined)(t.color)&&(!t.state||"normal"===t.state)&&(e[this.colorProp||"fill"]=t.color),e},pointAttribs:j.pointAttribs},k.compose=function(t){let e=t.prototype.pointClass;return(0,o.addEvent)(e,"afterSetState",L),t};let A=l,{deg2rad:z}=c();(s=h||(h={})).getCenter=function(){let t=this.options,e=this.chart,i=2*(t.slicedOffset||0),s=e.plotWidth-2*i,r=e.plotHeight-2*i,a=t.center,n=Math.min(s,r),l=t.thickness,h,p=t.size,d=t.innerSize||0,c,u;"string"==typeof p&&(p=parseFloat(p)),"string"==typeof d&&(d=parseFloat(d));let m=[(0,o.pick)(a?.[0],"50%"),(0,o.pick)(a?.[1],"50%"),(0,o.pick)(p&&p<0?void 0:t.size,"100%"),(0,o.pick)(d&&d<0?void 0:t.innerSize||0,"0%")];for(c=0;c<4;++c)u=m[c],h=c<2||2===c&&/%$/.test(u),m[c]=(0,o.relativeLength)(u,[s,r,n,m[2]][c])+(h?i:0);return m[3]>m[2]&&(m[3]=m[2]),(0,o.isNumber)(l)&&2*l<m[2]&&l>0&&(m[3]=m[2]-2*l),(0,o.fireEvent)(this,"afterGetCenter",{positions:m}),m},s.getStartAndEndRadians=function(t,e){let i=(0,o.isNumber)(t)?t:0,s=(0,o.isNumber)(e)&&e>i&&e-i<360?e:i+360;return{start:z*(i+-90),end:z*(s+-90)}};let E=h,{setLength:N,splice:B}={convertToNumber:function(t,e){switch(typeof t){case"boolean":return+!!t;case"number":return isNaN(t)&&!e?null:t;default:return isNaN(t=parseFloat(`${t??""}`))&&!e?null:t}},setLength:function(t,e,i){return Array.isArray(t)?(t.length=e,t):t[i?"subarray":"slice"](0,e)},splice:function(t,e,i,o,s=[]){if(Array.isArray(t))return Array.isArray(s)||(s=Array.from(s)),{removed:t.splice(e,i,...s),array:t};let r=Object.getPrototypeOf(t).constructor,a=t[o?"subarray":"slice"](e,e+i),n=new r(t.length-i+s.length);return n.set(t.subarray(0,e),0),n.set(s,e),n.set(t.subarray(e+i),e+s.length),{removed:a,array:n}}},S=class{constructor(t={}){this.isDataTable=!0,this.autoId=!t.id,this.columns={},this.id=t.id||(0,o.uniqueKey)(),this.rowCount=0,this.versionTag=(0,o.uniqueKey)();let e=0;(0,o.objectEach)(t.columns||{},(t,i)=>{this.columns[i]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,(0,o.objectEach)(this.columns,(e,i)=>{e.length!==t&&(this.columns[i]=N(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let i=0;(0,o.objectEach)(this.columns,(o,s)=>{this.columns[s]=B(o,t,e).array,i=o.length}),this.rowCount=i}(0,o.fireEvent)(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=(0,o.uniqueKey)()}getColumn(t,e){return this.columns[t]}getColumns(t,e){return(t||Object.keys(this.columns)).reduce((t,e)=>(t[e]=this.columns[e],t),{})}getRowObject(t,e){let i={},o=this.columns;for(let s of(e??(e=Object.keys(this.columns)),e))i[s]=o[s]?.[t];return i}setColumn(t,e=[],i=0,o){this.setColumns({[t]:e},i,o)}setColumns(t,e,i){let s=this.rowCount;(0,o.objectEach)(t,(t,e)=>{this.columns[e]=t.slice(),s=t.length}),this.applyRowCount(s),i?.silent||((0,o.fireEvent)(this,"afterSetColumns"),this.versionTag=(0,o.uniqueKey)())}setRow(t,e=this.rowCount,i,s){var r;let{columns:a}=this,n=i?this.rowCount+1:e+1,l=Object.keys(t);if(s?.addColumns!==!1)for(let t=0,e=l.length;t<e;t++)a[r=l[t]]||(a[r]=Array(this.rowCount));(0,o.objectEach)(a,(o,s)=>{o&&(i?o=B(o,e,0,!0,[t[s]]).array:o[e]=s in t?t[s]:o[e],a[s]=o)}),this.applyRowCount(Math.max(n,this.rowCount)),s?.silent||((0,o.fireEvent)(this,"afterSetRows",{rowIndex:e}),this.versionTag=(0,o.uniqueKey)())}getModified(){return this.modified||this}},O=e.default.Chart;var D=i.n(O);let I=e.default.SVGRenderer;var V=i.n(I);let{getOptions:R}=c();class X extends D(){init(t,e){let i=R().credits,s=(0,o.merge)({chart:{panning:{enabled:!0,type:"xy"},type:"map"},credits:{mapText:(0,o.pick)(i.mapText,' \xa9 <a href="{geojson.copyrightUrl}">{geojson.copyrightShort}</a>'),mapTextFull:(0,o.pick)(i.mapTextFull,"{geojson.copyright}")},mapView:{},tooltip:{followTouchMove:!1}},t);super.init(s,e)}mapZoom(t,e,i,s,r){this.mapView&&((0,o.isNumber)(t)&&(t=Math.log(t)/Math.log(.5)),this.mapView.zoomBy(t,(0,o.isNumber)(e)&&(0,o.isNumber)(i)?this.mapView.projection.inverse([e,i]):void 0,(0,o.isNumber)(s)&&(0,o.isNumber)(r)?[s,r]:void 0))}update(t){t.chart&&"map"in t.chart&&this.mapView?.recommendMapView(this,[t.chart.map,...(this.options.series||[]).map(t=>t.mapData)],!0),super.update.apply(this,arguments)}}(r=X||(X={})).maps={},r.mapChart=function(t,e,i){let o=new r(t,e,i);return o.promise||o},r.splitPath=function(t){let e;return e="string"==typeof t?(t=t.replace(/([A-Z])/gi," $1 ").replace(/^\s*/,"").replace(/\s*$/,"")).split(/[ ,;]+/).map(t=>/[A-Z]/i.test(t)?t:parseFloat(t)):t,V().prototype.pathToSegments(e)};let G=X,F={boundsFromPath:function(t){let e=-Number.MAX_VALUE,i=Number.MAX_VALUE,o=-Number.MAX_VALUE,s=Number.MAX_VALUE,r;if(t.forEach(t=>{let a=t[t.length-2],n=t[t.length-1];"number"==typeof a&&"number"==typeof n&&(i=Math.min(i,a),e=Math.max(e,a),s=Math.min(s,n),o=Math.max(o,n),r=!0)}),r)return{x1:i,y1:s,x2:e,y2:o}}},{boundsFromPath:Y}=F,U=T().seriesTypes.scatter.prototype.pointClass;class Z extends U{static getProjectedPath(t,e){return t.projectedPath||(e&&t.geometry?(e.hasCoordinates=!0,t.projectedPath=e.path(t.geometry)):t.projectedPath=t.path),t.projectedPath||[]}applyOptions(t,e,i){let s=this.series,r=super.applyOptions(t,e,i),a=s.joinBy;if(s.mapData&&s.mapMap){let t=a[1],e=super.getNestedProperty(t),i=void 0!==e&&s.mapMap[e];i?(0,o.extend)(r,{...i,name:r.name??i.name}):-1!==s.pointArrayMap.indexOf("value")&&(r.value=r.value||null)}return r}getProjectedBounds(t){let e=Y(Z.getProjectedPath(this,t)),i=this.properties,s=this.series.chart.mapView;if(e){let r=i?.["hc-middle-lon"],a=i?.["hc-middle-lat"];if(s&&(0,o.isNumber)(r)&&(0,o.isNumber)(a)){let i=t.forward([r,a]);e.midX=i[0],e.midY=i[1]}else{let t=i?.["hc-middle-x"],s=i?.["hc-middle-y"];e.midX=e.x1+(e.x2-e.x1)*(0,o.pick)(this.middleX,(0,o.isNumber)(t)?t:.5);let r=(0,o.pick)(this.middleY,(0,o.isNumber)(s)?s:.5);this.geometry||(r=1-r),e.midY=e.y2-(e.y2-e.y1)*r}return e}}onMouseOver(t){(0,o.internalClearTimeout)(this.colorInterval),!this.isNull&&this.visible||this.series.options.nullInteraction?super.onMouseOver.call(this,t):this.series.onMouseOut()}setVisible(t){this.visible=this.options.visible=!!t,this.dataLabel&&this.dataLabel[t?"show":"hide"](),this.graphic&&this.graphic.attr(this.series.pointAttribs(this))}zoomTo(t){let e=this.series.chart,i=e.mapView,s=this.bounds;if(i&&s){let r=(0,o.isNumber)(this.insetIndex)&&i.insets[this.insetIndex];if(r){let t=r.projectedUnitsToPixels({x:s.x1,y:s.y1}),e=r.projectedUnitsToPixels({x:s.x2,y:s.y2}),o=i.pixelsToProjectedUnits({x:t.x,y:t.y}),a=i.pixelsToProjectedUnits({x:e.x,y:e.y});s={x1:o.x,y1:o.y,x2:a.x,y2:a.y}}i.fitToBounds(s,void 0,!1),this.series.isDirty=!0,e.redraw(t)}}}(0,o.extend)(Z.prototype,{dataLabelOnNull:A.pointMembers.dataLabelOnNull,moveToTopOnHover:A.pointMembers.moveToTopOnHover,isValid:A.pointMembers.isValid});let W={center:[0,0],fitToGeometry:void 0,maxZoom:void 0,padding:0,projection:{name:void 0,parallels:void 0,rotation:void 0},zoom:void 0,insetOptions:{borderColor:"var(--highcharts-neutral-color-20)",borderWidth:1,padding:"10%",relativeTo:"mapBoundingBox",units:"percent"}},H=e.default.Templating;var _=i.n(H);let{win:q}=c(),{format:K}=_();!function(t){function e(t){return this.mapView?.lonLatToProjectedUnits(t)}function i(t){return this.mapView?.projectedUnitsToLonLat(t)}function s(t,e){let i=this.options.chart.proj4||q.proj4;if(!i)return void(0,o.error)(21,!1,this);let{jsonmarginX:s=0,jsonmarginY:r=0,jsonres:a=1,scale:n=1,xoffset:l=0,xpan:h=0,yoffset:p=0,ypan:d=0}=e,c=i(e.crs,[t.lon,t.lat]),u=e.cosAngle||e.rotation&&Math.cos(e.rotation),m=e.sinAngle||e.rotation&&Math.sin(e.rotation),g=e.rotation?[c[0]*u+c[1]*m,-c[0]*m+c[1]*u]:c;return{x:((g[0]-l)*n+h)*a+s,y:-(((p-g[1])*n+d)*a-r)}}function r(t,e){let i=this.options.chart.proj4||q.proj4;if(!i)return void(0,o.error)(21,!1,this);if(null===t.y)return;let{jsonmarginX:s=0,jsonmarginY:r=0,jsonres:a=1,scale:n=1,xoffset:l=0,xpan:h=0,yoffset:p=0,ypan:d=0}=e,c={x:((t.x-s)/a-h)/n+l,y:((t.y-r)/a+d)/n+p},u=e.cosAngle||e.rotation&&Math.cos(e.rotation),m=e.sinAngle||e.rotation&&Math.sin(e.rotation),g=i(e.crs,"WGS84",e.rotation?{x:c.x*u+-(c.y*m),y:c.x*m+c.y*u}:c);return{lat:g.y,lon:g.x}}function a(t,e){e||(e=Object.keys(t.objects)[0]);let i=t.objects[e];if(i["hc-decoded-geojson"]&&i["hc-decoded-geojson"].title===t.title)return i["hc-decoded-geojson"];let o=t.arcs;if(t.transform){let e,i,s,r=t.arcs,{scale:a,translate:n}=t.transform;o=[];for(let t=0,l=r.length;t<l;++t){let l=r[t];o.push(e=[]),i=0,s=0;for(let t=0,o=l.length;t<o;++t)e.push([(i+=l[t][0])*a[0]+n[0],(s+=l[t][1])*a[1]+n[1]])}}let s=t=>"number"==typeof t[0]?t.reduce((t,e,i)=>{let s=e<0?o[~e]:o[e];return e<0?(s=s.slice(0,0===i?s.length:s.length-1)).reverse():i&&(s=s.slice(1)),t.concat(s)},[]):t.map(s),r=i.geometries,a=[];for(let t=0,e=r.length;t<e;++t)a.push({type:"Feature",properties:r[t].properties,geometry:{type:r[t].type,coordinates:r[t].coordinates||s(r[t].arcs)}});let n={type:"FeatureCollection",copyright:t.copyright,copyrightShort:t.copyrightShort,copyrightUrl:t.copyrightUrl,features:a,"hc-recommended-mapview":i["hc-recommended-mapview"],bbox:t.bbox,title:t.title};return i["hc-decoded-geojson"]=n,n}function n(t,e){e=(0,o.merge)(!0,this.options.credits,e),t.call(this,e),this.credits&&this.mapCreditsFull&&this.credits.attr({title:this.mapCreditsFull})}t.compose=function(t){let a=t.prototype;a.transformFromLatLon||(a.fromLatLonToPoint=e,a.fromPointToLatLon=i,a.transformFromLatLon=s,a.transformToLatLon=r,(0,o.wrap)(a,"addCredits",n))},t.geojson=function(t,e="map",i){let s=[],r="Topology"===t.type?a(t):t,n=r.features;for(let t=0,i=n.length;t<i;++t){let i,r=n[t],a=r.geometry||{},l=a.type,h=a.coordinates,p=r.properties;if(("map"===e||"mapbubble"===e)&&("Polygon"===l||"MultiPolygon"===l)||"mapline"===e&&("LineString"===l||"MultiLineString"===l)?h.length&&(i={geometry:{coordinates:h,type:l}}):"mappoint"===e&&"Point"===l&&h.length&&(i={geometry:{coordinates:h,type:l}}),i){let t=p&&(p.name||p.NAME),e=p&&p.lon,r=p&&p.lat;s.push((0,o.extend)(i,{lat:"number"==typeof r?r:void 0,lon:"number"==typeof e?e:void 0,name:"string"==typeof t?t:void 0,properties:p}))}}return i&&r.copyrightShort&&(i.chart.mapCredits=K(i.chart.options.credits?.mapText,{geojson:r}),i.chart.mapCreditsFull=K(i.chart.options.credits?.mapTextFull,{geojson:r})),s},t.topo2geo=a}(p||(p={}));let $=p;(a=d||(d={})).getCenterOfPoints=function(t){let e=t.reduce((t,e)=>(t.x+=e.x,t.y+=e.y,t),{x:0,y:0});return{x:e.x/t.length,y:e.y/t.length}},a.getDistanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},a.getAngleBetweenPoints=function(t,e){return Math.atan2(e.x-t.x,e.y-t.y)},a.pointInPolygon=function({x:t,y:e},i){let o=i.length,s,r,a=!1;for(s=0,r=o-1;s<o;r=s++){let[o,n]=i[s],[l,h]=i[r];n>e!=h>e&&t<(l-o)*(e-n)/(h-n)+o&&(a=!a)}return a};let J=d;function Q(t,e,i=!0){let o=e[e.length-1],s,r,a,n=t;for(let t=0;t<e.length;t++){let l=n;s=e[t],n=[],r=i?l[l.length-1]:l[0];for(let t=0;t<l.length;t++)tt(o,s,a=l[t])?(tt(o,s,r)||n.push(te(o,s,r,a)),n.push(a)):tt(o,s,r)&&n.push(te(o,s,r,a)),r=a;o=s}return n}function tt(t,e,i){return(e[0]-t[0])*(i[1]-t[1])>(e[1]-t[1])*(i[0]-t[0])}function te(t,e,i,o){let s=[t[0]-e[0],t[1]-e[1]],r=[i[0]-o[0],i[1]-o[1]],a=t[0]*e[1]-t[1]*e[0],n=i[0]*o[1]-i[1]*o[0],l=1/(s[0]*r[1]-s[1]*r[0]),h=[(a*r[0]-n*s[0])*l,(a*r[1]-n*s[1])*l];return h.isIntersection=!0,h}let ti=Math.sign||(t=>0===t?0:t>0?1:-1),to=Math.PI/180,ts=Math.PI/2,tr=t=>Math.tan((ts+t)/2),ta=class{constructor(t){let e=(t.parallels||[]).map(t=>t*to),i=e[0]||0,o=e[1]??i,s=Math.cos(i);"object"==typeof t.projectedBounds&&(this.projectedBounds=t.projectedBounds);let r=i===o?Math.sin(i):Math.log(s/Math.cos(o))/Math.log(tr(o)/tr(i));1e-10>Math.abs(r)&&(r=1e-10*(ti(r)||1)),this.n=r,this.c=s*Math.pow(tr(i),r)/r}forward(t){let{c:e,n:i,projectedBounds:o}=this,s=t[0]*to,r=t[1]*to;e>0?r<-ts+1e-6&&(r=-ts+1e-6):r>ts-1e-6&&(r=ts-1e-6);let a=e/Math.pow(tr(r),i),n=a*Math.sin(i*s)*63.78137,l=(e-a*Math.cos(i*s))*63.78137,h=[n,l];return o&&(n<o.x1||n>o.x2||l<o.y1||l>o.y2)&&(h.outside=!0),h}inverse(t){let{c:e,n:i}=this,o=t[0]/63.78137,s=e-t[1]/63.78137,r=ti(i)*Math.sqrt(o*o+s*s),a=Math.atan2(o,Math.abs(s))*ti(s);return s*i<0&&(a-=Math.PI*ti(o)*ti(s)),[a/i/to,(2*Math.atan(Math.pow(e/r,1/i))-ts)/to]}},tn=Math.sqrt(3)/2,tl=class{constructor(){this.bounds={x1:-200.37508342789243,x2:200.37508342789243,y1:-97.52595454902263,y2:97.52595454902263}}forward(t){let e=Math.PI/180,i=Math.asin(tn*Math.sin(t[1]*e)),o=i*i,s=o*o*o;return[t[0]*e*Math.cos(i)*74.03120656864502/(tn*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))),74.03120656864502*i*(1.340264+-.081106*o+s*(893e-6+.003796*o))]}inverse(t){let e=t[0]/74.03120656864502,i=t[1]/74.03120656864502,o=180/Math.PI,s=i,r,a,n,l;for(let t=0;t<12&&(a=(r=s*s)*r*r,n=s*(1.340264+-.081106*r+a*(893e-6+.003796*r))-i,s-=l=n/(1.340264+-.24331799999999998*r+a*(.0062510000000000005+.034164*r)),!(1e-9>Math.abs(l)));++t);a=(r=s*s)*r*r;let h=o*tn*e*(1.340264+-.24331799999999998*r+a*(.0062510000000000005+.034164*r))/Math.cos(s),p=o*Math.asin(Math.sin(s)/tn);return Math.abs(h)>180?[NaN,NaN]:[h,p]}},th=Math.PI/4,tp=Math.PI/180,td=class{constructor(){this.bounds={x1:-200.37508342789243,x2:200.37508342789243,y1:-146.91480769173063,y2:146.91480769173063}}forward(t){return[t[0]*tp*63.78137,79.7267125*Math.log(Math.tan(th+.4*t[1]*tp))]}inverse(t){return[t[0]/63.78137/tp,2.5*(Math.atan(Math.exp(.8*(t[1]/63.78137)))-th)/tp]}},tc=Math.PI/180,tu=class{constructor(){this.antimeridianCutting=!1,this.bounds={x1:-63.78460826781007,x2:63.78460826781007,y1:-63.78460826781007,y2:63.78460826781007}}forward(t){let e=t[0],i=t[1]*tc,o=[Math.cos(i)*Math.sin(e*tc)*63.78460826781007,63.78460826781007*Math.sin(i)];return(e<-90||e>90)&&(o.outside=!0),o}inverse(t){let e=t[0]/63.78460826781007,i=t[1]/63.78460826781007,o=Math.sqrt(e*e+i*i),s=Math.asin(o),r=Math.sin(s);return[Math.atan2(e*r,o*Math.cos(s))/tc,Math.asin(o&&i*r/o)/tc]}},tm=Math.PI/180,tg=class{constructor(){this.bounds={x1:-200.37508342789243,x2:200.37508342789243,y1:-200.3750834278071,y2:200.3750834278071},this.maxLatitude=85.0511287798}forward(t){let e=Math.sin(t[1]*tm),i=[63.78137*t[0]*tm,63.78137*Math.log((1+e)/(1-e))/2];return Math.abs(t[1])>this.maxLatitude&&(i.outside=!0),i}inverse(t){return[t[0]/(63.78137*tm),(2*Math.atan(Math.exp(t[1]/63.78137))-Math.PI/2)/tm]}},{clipLineString:tb,clipPolygon:tf}={clipLineString:function(t,e){let i=[],o=Q(t,e,!1);for(let t=1;t<o.length;t++)o[t].isIntersection&&o[t-1].isIntersection&&(i.push(o.splice(0,t)),t=0),t===o.length-1&&i.push(o);return i},clipPolygon:Q},ty=2*Math.PI/360,tx=t=>(t<-180&&(t+=360),t>180&&(t-=360),t),tM=t=>(1-Math.cos(t))/2;class tv{static add(t,e){tv.registry[t]=e}static distance(t,e){let i,o,s,r,a,{atan2:n,sqrt:l}=Math,h=(i=Math.cos,o=t[1]*ty,s=t[0]*ty,r=e[1]*ty,a=e[0]*ty,tM(r-o)+i(o)*i(r)*tM(a-s));return 6371e3*(2*n(l(h),l(1-h)))}static geodesic(t,e,i,o=5e5){let{atan2:s,cos:r,sin:a,sqrt:n}=Math,l=tv.distance,h=t[1]*ty,p=t[0]*ty,d=e[1]*ty,c=e[0]*ty,u=r(h)*r(p),m=r(d)*r(c),g=r(h)*a(p),b=r(d)*a(c),f=a(h),y=a(d),x=l(t,e),M=x/6371e3,v=a(M),w=Math.round(x/o),T=[];if(i&&T.push(t),w>1){let t=1/w;for(let e=t;e<.999;e+=t){let t=a((1-e)*M)/v,i=a(e*M)/v,o=t*u+i*m,r=t*g+i*b,l=s(t*f+i*y,n(o*o+r*r)),h=s(r,o);T.push([h/ty,l/ty])}}return i&&T.push(e),T}static insertGeodesics(t){let e=t.length-1;for(;e--;)if(Math.max(Math.abs(t[e][0]-t[e+1][0]),Math.abs(t[e][1]-t[e+1][1]))>10){let i=tv.geodesic(t[e],t[e+1]);i.length&&t.splice(e+1,0,...i)}}static toString(t){let{name:e,rotation:i}=t||{};return[e,i&&i.join(",")].join(";")}constructor(t={}){this.hasCoordinates=!1,this.hasGeoProjection=!1,this.maxLatitude=90,this.options=t;let{name:e,projectedBounds:i,rotation:o}=t;this.rotator=o?this.getRotator(o):void 0;let s=e?tv.registry[e]:void 0;s&&(this.def=new s(t));let{def:r,rotator:a}=this;r&&(this.maxLatitude=r.maxLatitude||90,this.hasGeoProjection=!0),a&&r?(this.forward=t=>r.forward(a.forward(t)),this.inverse=t=>a.inverse(r.inverse(t))):r?(this.forward=t=>r.forward(t),this.inverse=t=>r.inverse(t)):a&&(this.forward=a.forward,this.inverse=a.inverse),this.bounds="world"===i?r&&r.bounds:i}lineIntersectsBounds(t){let{x1:e,x2:i,y1:o,y2:s}=this.bounds||{},r=(t,e,i)=>{let[o,s]=t,r=+!e;if("number"==typeof i&&o[e]>=i!=s[e]>=i){let t=(i-o[e])/(s[e]-o[e]),a=o[r]+t*(s[r]-o[r]);return e?[a,i]:[i,a]}},a,n=t[0];return(a=r(t,0,e))?(n=a,t[1]=a):(a=r(t,0,i))&&(n=a,t[1]=a),(a=r(t,1,o))?n=a:(a=r(t,1,s))&&(n=a),n}getRotator(t){let e=t[0]*ty,i=(t[1]||0)*ty,o=(t[2]||0)*ty,s=Math.cos(i),r=Math.sin(i),a=Math.cos(o),n=Math.sin(o);if(0!==e||0!==i||0!==o)return{forward:t=>{let i=t[0]*ty+e,o=t[1]*ty,l=Math.cos(o),h=Math.cos(i)*l,p=Math.sin(i)*l,d=Math.sin(o),c=d*s+h*r;return[Math.atan2(p*a-c*n,h*s-d*r)/ty,Math.asin(c*a+p*n)/ty]},inverse:t=>{let i=t[0]*ty,o=t[1]*ty,l=Math.cos(o),h=Math.cos(i)*l,p=Math.sin(i)*l,d=Math.sin(o),c=d*a-p*n;return[(Math.atan2(p*a+d*n,h*s+c*r)-e)/ty,Math.asin(c*s-h*r)/ty]}}}forward(t){return t}inverse(t){return t}cutOnAntimeridian(t,e){let i,s=[],r=[t];for(let i=0,r=t.length;i<r;++i){let r=t[i],a=t[i-1];if(!i){if(!e)continue;a=t[t.length-1]}let n=a[0],l=r[0];if((n<-90||n>90)&&(l<-90||l>90)&&n>0!=l>0){let t=(0,o.clamp)((180-(n+360)%360)/((l+360)%360-(n+360)%360),0,1),e=a[1]+t*(r[1]-a[1]);s.push({i,lat:e,direction:n<0?1:-1,previousLonLat:a,lonLat:r})}}if(s.length)if(e){s.length%2==1&&(i=s.slice().sort((t,e)=>Math.abs(e.lat)-Math.abs(t.lat))[0],(0,o.erase)(s,i));let e=s.length-2;for(;e>=0;){let i=s[e].i,o=tx(180+1e-6*s[e].direction),a=tx(180-1e-6*s[e].direction),n=t.splice(i,s[e+1].i-i,...tv.geodesic([o,s[e].lat],[o,s[e+1].lat],!0));n.push(...tv.geodesic([a,s[e+1].lat],[a,s[e].lat],!0)),r.push(n),e-=2}if(i)for(let t=0;t<r.length;t++){let{direction:e,lat:o}=i,s=r[t],a=s.indexOf(i.lonLat);if(a>-1){let t=(o<0?-1:1)*this.maxLatitude,r=tx(180+1e-6*e),n=tx(180-1e-6*e),l=tv.geodesic([r,o],[r,t],!0);for(let i=r+120*e;i>-180&&i<180;i+=120*e)l.push([i,t]);l.push(...tv.geodesic([n,t],[n,i.lat],!0)),s.splice(a,0,...l);break}}}else{let e=s.length;for(;e--;){let i=s[e].i,o=t.splice(i,t.length,[tx(180+1e-6*s[e].direction),s[e].lat]);o.unshift([tx(180-1e-6*s[e].direction),s[e].lat]),r.push(o)}}return r}path(t){let e,{bounds:i,def:o,rotator:s}=this,r=[],a="Polygon"===t.type||"MultiPolygon"===t.type,n=this.hasGeoProjection,l=!o||!1!==o.antimeridianCutting,h=l?s:void 0,p=l&&o||this;i&&(e=[[i.x1,i.y1],[i.x2,i.y1],[i.x2,i.y2],[i.x1,i.y2]]);let d=t=>{let o=t.map(t=>{if(l){h&&(t=h.forward(t));let e=t[0];1e-6>Math.abs(e-180)&&(e=e<180?179.999999:180.000001),t=[e,t[1]]}return t}),s=[o];n&&(tv.insertGeodesics(o),l&&(s=this.cutOnAntimeridian(o,a))),s.forEach(t=>{let o,s;if(t.length<2)return;let h=!1,d=!1,c=t=>{h?r.push(["L",t[0],t[1]]):(r.push(["M",t[0],t[1]]),h=!0)},u=!1,m=!1,g=t.map(t=>{let e=p.forward(t);return e.outside?u=!0:m=!0,e[1]===1/0?e[1]=1e10:e[1]===-1/0&&(e[1]=-1e10),e});if(l){if(a&&g.push(g[0]),u){if(!m)return;if(e){if(a)g=tf(g,e);else if(i)return void tb(g,e).forEach(t=>{h=!1,t.forEach(c)})}}g.forEach(c)}else for(let e=0;e<g.length;e++){let i=t[e],r=g[e];r.outside?d=!0:(a&&!o&&(o=i,t.push(i),g.push(r)),d&&s&&(a&&n?tv.geodesic(s,i).forEach(t=>c(p.forward(t))):h=!1),c(r),s=i,d=!1)}})};return"LineString"===t.type?d(t.coordinates):"MultiLineString"===t.type?t.coordinates.forEach(t=>d(t)):"Polygon"===t.type?(t.coordinates.forEach(t=>d(t)),r.length&&r.push(["Z"])):"MultiPolygon"===t.type&&(t.coordinates.forEach(t=>{t.forEach(t=>d(t))}),r.length&&r.push(["Z"])),r}}tv.registry={EqualEarth:tl,LambertConformalConic:ta,Miller:td,Orthographic:tu,WebMercator:tg};let{composed:tw}=c(),{pointInPolygon:tT}=J,{topo2geo:tP}=$,{boundsFromPath:tC}=F,tj={};function tk(t,e){let{width:i,height:o}=e;return Math.log(400.979322/Math.max((t.x2-t.x1)/(i/256),(t.y2-t.y1)/(o/256)))/Math.log(2)}function tL(t){t.seriesOptions.mapData&&this.mapView?.recommendMapView(this,[this.options.chart.map,t.seriesOptions.mapData],this.options.drilldown?.mapZooming)}class tA{static compose(t){(0,o.pushUnique)(tw,"MapView")&&(tj=t.maps,(0,o.addEvent)(t,"afterInit",function(){this.mapView=new tA(this,this.options.mapView)},{order:0}),(0,o.addEvent)(t,"addSeriesAsDrilldown",tL),(0,o.addEvent)(t,"afterDrillUp",tL))}static compositeBounds(t){if(t.length)return t.slice(1).reduce((t,e)=>(t.x1=Math.min(t.x1,e.x1),t.y1=Math.min(t.y1,e.y1),t.x2=Math.max(t.x2,e.x2),t.y2=Math.max(t.y2,e.y2),t),(0,o.merge)(t[0]))}static mergeInsets(t,e){let i=t=>{let e={};return t.forEach((t,i)=>{e[t&&t.id||`i${i}`]=t}),e},s=(0,o.merge)(i(t),i(e));return Object.keys(s).map(t=>s[t])}constructor(t,e){this.allowTransformAnimation=!0,this.eventsToUnbind=[],this.insets=[],this.padding=[0,0,0,0],this.recommendedMapView={},this instanceof tz||this.recommendMapView(t,[t.options.chart.map,...(t.options.series||[]).map(t=>t.mapData)]),this.userOptions=e||{};let i=(0,o.merge)(W,this.recommendedMapView,e),s=this.recommendedMapView?.insets,r=e&&e.insets;s&&r&&(i.insets=tA.mergeInsets(s,r)),this.chart=t,this.center=i.center,this.options=i,this.projection=new tv(i.projection),this.playingField=t.plotBox,this.zoom=i.zoom||0,this.minZoom=i.minZoom,this.createInsets(),this.eventsToUnbind.push((0,o.addEvent)(t,"afterSetChartSize",()=>{this.playingField=this.getField(),(void 0===this.minZoom||this.minZoom===this.zoom)&&(this.fitToBounds(void 0,void 0,!1),!this.chart.hasRendered&&(0,o.isNumber)(this.userOptions.zoom)&&(this.zoom=this.userOptions.zoom),this.userOptions.center&&(0,o.merge)(!0,this.center,this.userOptions.center))})),this.setUpEvents()}createInsets(){let t=this.options,e=t.insets;e&&e.forEach(e=>{let i=new tz(this,(0,o.merge)(t.insetOptions,e));this.insets.push(i)})}fitToBounds(t,e,i=!0,s){let r=t||this.getProjectedBounds();if(r){let a=(0,o.pick)(e,t?0:this.options.padding),n=this.getField(!1),l=(0,o.isArray)(a)?a:[a,a,a,a];this.padding=[(0,o.relativeLength)(l[0],n.height),(0,o.relativeLength)(l[1],n.width),(0,o.relativeLength)(l[2],n.height),(0,o.relativeLength)(l[3],n.width)],this.playingField=this.getField();let h=tk(r,this.playingField);t||(this.minZoom=h);let p=this.projection.inverse([(r.x2+r.x1)/2,(r.y2+r.y1)/2]);this.setView(p,h,i,s)}}getField(t=!0){let e=t?this.padding:[0,0,0,0];return{x:e[3],y:e[0],width:this.chart.plotWidth-e[1]-e[3],height:this.chart.plotHeight-e[0]-e[2]}}getGeoMap(t){if((0,o.isString)(t))return tj[t]&&"Topology"===tj[t].type?tP(tj[t]):tj[t];if((0,o.isObject)(t,!0)){if("FeatureCollection"===t.type)return t;if("Topology"===t.type)return tP(t)}}getMapBBox(){let t=this.getProjectedBounds(),e=this.getScale();if(t){let i=this.padding,o=this.projectedUnitsToPixels({x:t.x1,y:t.y2});return{width:(t.x2-t.x1)*e+i[1]+i[3],height:(t.y2-t.y1)*e+i[0]+i[2],x:o.x-i[3],y:o.y-i[0]}}}getProjectedBounds(){let t=this.projection,e=this.chart.series.reduce((t,e)=>{let i=e.getProjectedBounds&&e.getProjectedBounds();return i&&!1!==e.options.affectsMapView&&t.push(i),t},[]),i=this.options.fitToGeometry;if(i){if(!this.fitToGeometryCache)if("MultiPoint"===i.type){let e=i.coordinates.map(e=>t.forward(e)),o=e.map(t=>t[0]),s=e.map(t=>t[1]);this.fitToGeometryCache={x1:Math.min.apply(0,o),x2:Math.max.apply(0,o),y1:Math.min.apply(0,s),y2:Math.max.apply(0,s)}}else this.fitToGeometryCache=tC(t.path(i));return this.fitToGeometryCache}return this.projection.bounds||tA.compositeBounds(e)}getScale(){return 256/400.979322*Math.pow(2,this.zoom)}getSVGTransform(){let{x:t,y:e,width:i,height:o}=this.playingField,s=this.projection.forward(this.center),r=this.projection.hasCoordinates?-1:1,a=this.getScale(),n=a*r,l=t+i/2-s[0]*a,h=e+o/2-s[1]*n;return{scaleX:a,scaleY:n,translateX:l,translateY:h}}lonLatToPixels(t){let e=this.lonLatToProjectedUnits(t);if(e)return this.projectedUnitsToPixels(e)}lonLatToProjectedUnits(t){let e=this.chart,i=e.mapTransforms;if(i){for(let o in i)if(Object.hasOwnProperty.call(i,o)&&i[o].hitZone){let s=e.transformFromLatLon(t,i[o]);if(s&&tT(s,i[o].hitZone.coordinates[0]))return s}return e.transformFromLatLon(t,i.default)}for(let e of this.insets)if(e.options.geoBounds&&tT({x:t.lon,y:t.lat},e.options.geoBounds.coordinates[0])){let i=e.projection.forward([t.lon,t.lat]),o=e.projectedUnitsToPixels({x:i[0],y:i[1]});return this.pixelsToProjectedUnits(o)}let o=this.projection.forward([t.lon,t.lat]);if(!o.outside)return{x:o[0],y:o[1]}}pixelsToLonLat(t){return this.projectedUnitsToLonLat(this.pixelsToProjectedUnits(t))}pixelsToProjectedUnits(t){let{x:e,y:i}=t,o=this.getScale(),s=this.projection.forward(this.center),r=this.playingField,a=r.x+r.width/2,n=r.y+r.height/2;return{x:s[0]+(e-a)/o,y:s[1]-(i-n)/o}}projectedUnitsToLonLat(t){let e=this.chart,i=e.mapTransforms;if(i){for(let o in i)if(Object.hasOwnProperty.call(i,o)&&i[o].hitZone&&tT(t,i[o].hitZone.coordinates[0]))return e.transformToLatLon(t,i[o]);return e.transformToLatLon(t,i.default)}let o=this.projectedUnitsToPixels(t);for(let t of this.insets)if(t.hitZone&&tT(o,t.hitZone.coordinates[0])){let e=t.pixelsToProjectedUnits(o),i=t.projection.inverse([e.x,e.y]);return{lon:i[0],lat:i[1]}}let s=this.projection.inverse([t.x,t.y]);return{lon:s[0],lat:s[1]}}projectedUnitsToPixels(t){let e=this.getScale(),i=this.projection.forward(this.center),o=this.playingField,s=o.x+o.width/2,r=o.y+o.height/2;return{x:s-e*(i[0]-t.x),y:r+e*(i[1]-t.y)}}recommendMapView(t,e,i=!1){this.recommendedMapView={};let s=e.map(t=>this.getGeoMap(t)),r=[];s.forEach(t=>{if(t&&(Object.keys(this.recommendedMapView).length||(this.recommendedMapView=t["hc-recommended-mapview"]||{}),t.bbox)){let[e,i,o,s]=t.bbox;r.push({x1:e,y1:i,x2:o,y2:s})}});let a=r.length&&tA.compositeBounds(r);(0,o.fireEvent)(this,"onRecommendMapView",{geoBounds:a,chart:t},function(){if(a&&this.recommendedMapView){if(!this.recommendedMapView.projection){let{x1:t,y1:e,x2:i,y2:o}=a;this.recommendedMapView.projection=i-t>180&&o-e>90?{name:"EqualEarth",parallels:[0,0],rotation:[0]}:{name:"LambertConformalConic",parallels:[e,o],rotation:[-(t+i)/2]}}this.recommendedMapView.insets||(this.recommendedMapView.insets=void 0)}}),this.geoMap=s[0],i&&t.hasRendered&&!t.userOptions.mapView?.projection&&this.recommendedMapView&&this.update(this.recommendedMapView)}redraw(t){this.chart.series.forEach(t=>{t.useMapGeometry&&(t.isDirty=!0)}),this.chart.redraw(t)}setView(t,e,i=!0,s){t&&(this.center=t),"number"==typeof e&&("number"==typeof this.minZoom&&(e=Math.max(e,this.minZoom)),"number"==typeof this.options.maxZoom&&(e=Math.min(e,this.options.maxZoom)),(0,o.isNumber)(e)&&(this.zoom=e));let r=this.getProjectedBounds();if(r){let t=this.projection.forward(this.center),{x:e,y:i,width:o,height:s}=this.playingField,a=this.getScale(),n=this.projectedUnitsToPixels({x:r.x1,y:r.y1}),l=this.projectedUnitsToPixels({x:r.x2,y:r.y2}),h=[(r.x1+r.x2)/2,(r.y1+r.y2)/2];if(!this.chart.series.some(t=>t.isDrilling)){let r=n.x,p=l.y,d=l.x,c=n.y;d-r<o?t[0]=h[0]:r<e&&d<e+o?t[0]+=Math.max(r-e,d-o-e)/a:d>e+o&&r>e&&(t[0]+=Math.min(d-o-e,r-e)/a),c-p<s?t[1]=h[1]:p<i&&c<i+s?t[1]-=Math.max(p-i,c-s-i)/a:c>i+s&&p>i&&(t[1]-=Math.min(c-s-i,p-i)/a),this.center=this.projection.inverse(t)}this.insets.forEach(t=>{t.options.field&&(t.hitZone=t.getHitZone(),t.playingField=t.getField())}),this.render()}(0,o.fireEvent)(this,"afterSetView"),i&&this.redraw(s)}setUpEvents(){let t,e,i,{chart:s}=this,r=r=>{let{lastTouches:a,pinchDown:n}=s.pointer,l=this.projection,h=r.touches,{mouseDownX:p,mouseDownY:d}=s,c=0;if(n?.length===1?(p=n[0].chartX,d=n[0].chartY):n?.length===2&&(p=(n[0].chartX+n[1].chartX)/2,d=(n[0].chartY+n[1].chartY)/2),h?.length===2&&a&&(c=Math.log(Math.sqrt(Math.pow(a[0].chartX-a[1].chartX,2)+Math.pow(a[0].chartY-a[1].chartY,2))/Math.sqrt(Math.pow(h[0].chartX-h[1].chartX,2)+Math.pow(h[0].chartY-h[1].chartY,2)))/Math.log(.5)),(0,o.isNumber)(p)&&(0,o.isNumber)(d)){let a=`${p},${d}`,{chartX:n,chartY:u}=r.originalEvent;h?.length===2&&(n=(h[0].chartX+h[1].chartX)/2,u=(h[0].chartY+h[1].chartY)/2),a!==e&&(e=a,t=this.projection.forward(this.center),i=(this.projection.options.rotation||[0,0]).slice());let m=l.def&&l.def.bounds,g=m&&tk(m,this.playingField)||-1/0;if("Orthographic"===l.options.name&&2>(h?.length||0)&&(this.minZoom||1/0)<1.3*g){let t=440/(this.getScale()*Math.min(s.plotWidth,s.plotHeight));if(i){let e=(p-n)*t-i[0],r=(0,o.clamp)(-i[1]-(d-u)*t,-80,80),a=this.zoom;this.update({projection:{rotation:[-e,-r]}},!1),this.fitToBounds(void 0,void 0,!1),this.zoom=a,s.redraw(!1)}}else if((0,o.isNumber)(n)&&(0,o.isNumber)(u)){let e=this.getScale(),i=this.projection.hasCoordinates?1:-1,o=this.projection.inverse([t[0]+(p-n)/e,t[1]-(d-u)/e*i]);isNaN(o[0]+o[1])||this.zoomBy(c,o,void 0,!1)}r.preventDefault()}};(0,o.addEvent)(s,"pan",r),(0,o.addEvent)(s,"touchpan",r),(0,o.addEvent)(s,"selection",t=>{if(t.resetSelection)this.zoomBy();else{let e=t.x-s.plotLeft,i=t.y-s.plotTop,{y:o,x:r}=this.pixelsToProjectedUnits({x:e,y:i}),{y:a,x:n}=this.pixelsToProjectedUnits({x:e+t.width,y:i+t.height});this.fitToBounds({x1:r,y1:o,x2:n,y2:a},void 0,!0,!t.originalEvent.touches&&void 0),/^touch/.test(t.originalEvent.type)||s.showResetZoom(),t.preventDefault()}})}render(){let t=this.chart;this.group?this.groupClipRect&&this.groupClipRect.animate(t.plotBox):(this.groupClipRect=t.renderer.clipRect(t.plotBox),this.group=t.renderer.g("map-view").attr({zIndex:4}).clip(this.groupClipRect).add())}update(t,e=!0,i){let s=t.projection,r=s&&tv.toString(s)!==tv.toString(this.options.projection),a=!1;(0,o.merge)(!0,this.userOptions,t),(0,o.merge)(!0,this.options,t),"insets"in t&&(this.insets.forEach(t=>t.destroy()),this.insets.length=0,a=!0),(r||"fitToGeometry"in t)&&delete this.fitToGeometryCache,(r||a)&&(this.chart.series.forEach(t=>{let e=t.transformGroups;if(t.clearBounds&&t.clearBounds(),t.isDirty=!0,t.isDirtyData=!0,a&&e)for(;e.length>1;){let t=e.pop();t&&t.destroy()}}),r&&(this.projection=new tv(this.options.projection)),a&&this.createInsets(),!t.center&&Object.hasOwnProperty.call(t,"zoom")&&!(0,o.isNumber)(t.zoom)&&this.fitToBounds(void 0,void 0,!1)),t.center||(0,o.isNumber)(t.zoom)?this.setView(this.options.center,t.zoom,!1):"fitToGeometry"in t&&this.fitToBounds(void 0,void 0,!1),e&&this.redraw(i)}zoomBy(t,e,i,o){let s=this.chart,r=this.projection.forward(this.center);if("number"==typeof t){let a,n,l,h=this.zoom+t;if(i){let[t,e]=i,o=this.getScale(),a=t-s.plotLeft-s.plotWidth/2,h=e-s.plotTop-s.plotHeight/2;n=r[0]+a/o,l=r[1]+h/o}if("number"==typeof n&&"number"==typeof l){let t=1-Math.pow(2,this.zoom)/Math.pow(2,h),e=r[0]-n,i=r[1]-l;r[0]-=e*t,r[1]+=i*t,a=this.projection.inverse(r)}this.setView(e||a,h,void 0,o)}else this.fitToBounds(void 0,void 0,void 0,o)}}class tz extends tA{constructor(t,e){if(super(t.chart,e),this.id=e.id,this.mapView=t,this.options=(0,o.merge)({center:[0,0]},t.options.insetOptions,e),this.allBounds=[],this.options.geoBounds){let e=t.projection.path(this.options.geoBounds);this.geoBoundsProjectedBox=tC(e),this.geoBoundsProjectedPolygon=e.map(t=>[t[1]||0,t[2]||0])}}getField(t=!0){let e=this.hitZone;if(e){let i=t?this.padding:[0,0,0,0],s=e.coordinates[0],r=s.map(t=>t[0]),a=s.map(t=>t[1]),n=Math.min.apply(0,r)+i[3],l=Math.max.apply(0,r)-i[1],h=Math.min.apply(0,a)+i[0],p=Math.max.apply(0,a)-i[2];if((0,o.isNumber)(n)&&(0,o.isNumber)(h))return{x:n,y:h,width:l-n,height:p-h}}return super.getField.call(this,t)}getHitZone(){let{chart:t,mapView:e,options:i}=this,{coordinates:s}=i.field||{};if(s){let r=s[0];if("percent"===i.units){let s="mapBoundingBox"===i.relativeTo&&e.getMapBBox()||(0,o.merge)(t.plotBox,{x:0,y:0});r=r.map(t=>[(0,o.relativeLength)(`${t[0]}%`,s.width,s.x),(0,o.relativeLength)(`${t[1]}%`,s.height,s.y)])}return{type:"Polygon",coordinates:[r]}}}getProjectedBounds(){return tA.compositeBounds(this.allBounds)}isInside(t){let{geoBoundsProjectedBox:e,geoBoundsProjectedPolygon:i}=this;return!!(e&&t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2&&i&&tT(t,i))}render(){let{chart:t,mapView:e,options:i}=this,s=i.borderPath||i.field;if(s&&e.group){let r=!0;this.border||(this.border=t.renderer.path().addClass("highcharts-mapview-inset-border").add(e.group),r=!1),t.styledMode||this.border.attr({stroke:i.borderColor,"stroke-width":i.borderWidth});let a=this.border.strokeWidth(),n="mapBoundingBox"===i.relativeTo&&e.getMapBBox()||e.playingField,l=(s.coordinates||[]).reduce((e,s)=>s.reduce((e,s,r)=>{let[l,h]=s;return"percent"===i.units&&(l=t.plotLeft+(0,o.relativeLength)(`${l}%`,n.width,n.x),h=t.plotTop+(0,o.relativeLength)(`${h}%`,n.height,n.y)),l=(0,o.crisp)(l,a),h=(0,o.crisp)(h,a),e.push(0===r?["M",l,h]:["L",l,h]),e},e),[]);this.border[r?"animate":"attr"]({d:l})}}destroy(){this.border&&(this.border=this.border.destroy()),this.eventsToUnbind.forEach(t=>t())}setUpEvents(){}}let{noop:tE}=c(),{splitPath:tN}=G,{column:tB,scatter:tS}=T().seriesTypes;class tO extends tS{constructor(){super(...arguments),this.tupleKey="hc-key"}animate(t){let{chart:e,group:i}=this,s=(0,o.animObject)(this.options.animation);t?i.attr({translateX:e.plotLeft+e.plotWidth/2,translateY:e.plotTop+e.plotHeight/2,scaleX:.001,scaleY:.001}):i.animate({translateX:e.plotLeft,translateY:e.plotTop,scaleX:1,scaleY:1},s)}clearBounds(){this.points.forEach(t=>{delete t.bounds,delete t.insetIndex,delete t.projectedPath}),delete this.bounds}doFullTranslate(){return!!(this.isDirtyData||this.chart.isResizing||!this.hasRendered)}drawMapDataLabels(){super.drawDataLabels(),this.dataLabelsGroups?.forEach(t=>t?.clip(this.chart.clipRect))}drawPoints(){let t=this,{chart:e,group:i,transformGroups:s=[]}=this,{mapView:r,renderer:a}=e;if(r){this.transformGroups=s,s[0]||(s[0]=a.g().add(i));for(let t=0,e=r.insets.length;t<e;++t)s[t+1]||s.push(a.g().add(i));this.doFullTranslate()&&(this.points.forEach(t=>{let{graphic:e}=t;t.group=s["number"==typeof t.insetIndex?t.insetIndex+1:0],e&&e.parentGroup!==t.group&&e.add(t.group)}),tB.prototype.drawPoints.apply(this),this.points.forEach(i=>{let s=i.graphic;if(s){let r=s.animate,a="";i.name&&(a+="highcharts-name-"+i.name.replace(/ /g,"-").toLowerCase()),i.properties?.["hc-key"]&&(a+=" highcharts-key-"+i.properties["hc-key"].toString().toLowerCase()),a&&s.addClass(a),e.styledMode&&s.css(this.pointAttribs(i,i.selected&&"select"||void 0)),s.attr({visibility:!i.visible&&(i.visible||i.isNull)?"hidden":"inherit"}),s.animate=function(i,a,n){let l=(0,o.isNumber)(i["stroke-width"])&&!(0,o.isNumber)(s["stroke-width"]),h=(0,o.isNumber)(s["stroke-width"])&&!(0,o.isNumber)(i["stroke-width"]);if(l||h){let r=(0,o.pick)(t.getStrokeWidth(t.options),1)/(e.mapView?.getScale()||1);l&&(s["stroke-width"]=r),h&&(i["stroke-width"]=r)}return r.call(s,i,a,h?function(){s.element.removeAttribute("stroke-width"),delete s["stroke-width"],n&&n.apply(this,arguments)}:n)}}})),s.forEach((i,s)=>{let n=(0===s?r:r.insets[s-1]).getSVGTransform(),l=(0,o.pick)(this.getStrokeWidth(this.options),1),h=n.scaleX,p=n.scaleY>0?1:-1,d=e=>{(t.points||[]).forEach(t=>{let i,o=t.graphic;o?.["stroke-width"]&&(i=this.getStrokeWidth(t.options))&&o.attr({"stroke-width":i/e})})};if(a.globalAnimation&&e.hasRendered&&r.allowTransformAnimation){let t=Number(i.attr("translateX")),e=Number(i.attr("translateY")),s=Number(i.attr("scaleX")),r=(o,r)=>{let a=s+(h-s)*r.pos;i.attr({translateX:t+(n.translateX-t)*r.pos,translateY:e+(n.translateY-e)*r.pos,scaleX:a,scaleY:a*p,"stroke-width":l/a}),d(a)},c=(0,o.merge)((0,o.animObject)(a.globalAnimation)),u=c.step;c.step=function(){u&&u.apply(this,arguments),r.apply(this,arguments)},i.attr({animator:0}).animate({animator:1},c,(function(){"boolean"!=typeof a.globalAnimation&&a.globalAnimation.complete&&a.globalAnimation.complete({applyDrilldown:!0}),(0,o.fireEvent)(this,"mapZoomComplete")}).bind(this))}else(0,o.stop)(i),i.attr((0,o.merge)(n,{"stroke-width":l/h})),d(h)}),this.isDrilling||this.drawMapDataLabels()}}getProjectedBounds(){if(!this.bounds&&this.chart.mapView){let{insets:t,projection:e}=this.chart.mapView,i=[];(this.points||[]).forEach(s=>{if(s.path||s.geometry){if("string"==typeof s.path?s.path=tN(s.path):(0,o.isArray)(s.path)&&"M"===s.path[0]&&(s.path=this.chart.renderer.pathToSegments(s.path)),!s.bounds){let i=s.getProjectedBounds(e);if(i){s.labelrank=(0,o.pick)(s.labelrank,(i.x2-i.x1)*(i.y2-i.y1));let{midX:e,midY:r}=i;if(t&&(0,o.isNumber)(e)&&(0,o.isNumber)(r)){let a=(0,o.find)(t,t=>t.isInside({x:e,y:r}));a&&(delete s.projectedPath,(i=s.getProjectedBounds(a.projection))&&a.allBounds.push(i),s.insetIndex=t.indexOf(a))}s.bounds=i}}s.bounds&&void 0===s.insetIndex&&i.push(s.bounds)}}),this.bounds=tA.compositeBounds(i)}return this.bounds}getStrokeWidth(t){let e=this.pointAttrToOptions;return t[e?.["stroke-width"]||"borderWidth"]}hasData(){return!!this.dataTable.getModified().rowCount}pointAttribs(t,e){let{mapView:i,styledMode:s}=(t?.series||this).chart,r=s&&t?this.colorAttribs(t):tB.prototype.pointAttribs.call(this,t,e),a=this.getStrokeWidth(t?.options||{});if(e){let i=(0,o.merge)(this.options.states?.[e],t?.options.states?.[e]||{}),s=this.getStrokeWidth(i);(0,o.defined)(s)&&(a=s),r.stroke=i.borderColor??t?.color}a&&i&&(a/=i.getScale());let n=this.getStrokeWidth(this.options);return r.dashstyle&&i&&(0,o.isNumber)(n)&&(a=n/i.getScale()),t?.visible===!1&&(r.fill=this.options.nullColor),t?.isNull&&this.options.nullInteraction&&(r.opacity=1),(0,o.defined)(a)?r["stroke-width"]=a:delete r["stroke-width"],r["stroke-linecap"]=r["stroke-linejoin"]=this.options.linecap,r}matchPoints(){return!this.hasProcessedDataTable&&super.matchPoints.apply(this,arguments)}setData(t,e=!0,i,o){delete this.bounds,super.setData(t,!1,void 0,o),this.processData(),this.generatePoints(),e&&this.chart.redraw(i)}getDataColumnKeys(){return this.pointArrayMap}processData(){let t,e,i,s=this.options,r=this.dataTable,a=this.chart,n=a.options.chart,l=this.joinBy,h=[],p={},d=this.chart.mapView,u=d&&((0,o.isObject)(s.mapData,!0)?d.getGeoMap(s.mapData):d.geoMap),m=a.mapTransforms=n.mapTransforms||u?.["hc-transform"]||a.mapTransforms,g=new S;if(this.hasProcessedDataTable=!0,m&&(0,o.objectEach)(m,t=>{t.rotation&&(t.cosAngle=Math.cos(t.rotation),t.sinAngle=Math.sin(t.rotation))}),(0,o.isArray)(s.mapData)?i=s.mapData:u?.type==="FeatureCollection"&&(this.mapTitle=u.title,i=c().geojson(u,this.type,this)),Object.entries(r.columns).forEach(([t,e])=>{g.setColumn(t,e)}),"_i"===l[0]&&g.setColumn("_i",Array.from({length:g.rowCount},(t,e)=>e)),i){this.mapData=i,this.mapMap={};for(let o=0;o<i.length;o++)e=(t=i[o]).properties,t._i=o,l[0]&&e&&e[l[0]]&&(t[l[0]]=e[l[0]]),p[t[l[0]]]=t;if(this.mapMap=p,l[1]){let t=l[1];for(let e=0;e<g.rowCount;e++){let i="_i"===t?e:(0,o.getNestedProperty)(t,g.getRowObject(e));p[i]&&h.push(p[i])}}if(s.allAreas){let t="|"+h.map(function(t){return t&&t[l[0]]}).join("|")+"|";i.forEach(e=>{l[0]&&-1!==t.indexOf("|"+e[l[0]]+"|")||g.setRow((0,o.merge)(e,{value:null}))})}}this.dataTable.modified=g}setOptions(t){let e=super.setOptions(t),i=e.joinBy;return null===e.joinBy&&(i="_i"),i&&(this.joinBy=(0,o.splat)(i),this.joinBy[1]||(this.joinBy[1]=this.joinBy[0])),e}translate(){let t=this.doFullTranslate(),e=this.chart.mapView,i=e?.projection;if(this.chart.hasRendered&&(this.isDirtyData||!this.hasRendered)&&(this.processData(),this.generatePoints(),delete this.bounds,!e||e.userOptions.center||(0,o.isNumber)(e.userOptions.zoom)||e.zoom!==e.minZoom?this.getProjectedBounds():e.fitToBounds(void 0,void 0,!1)),e){let s=e.getSVGTransform();this.points.forEach(r=>{let a=(0,o.isNumber)(r.insetIndex)&&e.insets[r.insetIndex].getSVGTransform()||s;a&&r.bounds&&(0,o.isNumber)(r.bounds.midX)&&(0,o.isNumber)(r.bounds.midY)&&(r.plotX=r.bounds.midX*a.scaleX+a.translateX,r.plotY=r.bounds.midY*a.scaleY+a.translateY),t&&(r.shapeType="path",r.shapeArgs={d:Z.getProjectedPath(r,i)}),!r.hiddenInDataClass&&(r.projectedPath&&!r.projectedPath.length?r.setVisible(!1):r.visible||r.setVisible(!0))})}(0,o.fireEvent)(this,"afterTranslate")}update(t){t.mapData&&this.chart.mapView?.recommendMapView(this.chart,[this.chart.options.chart.map,...(this.chart.options.series||[]).map((e,i)=>i===this._i?t.mapData:e.mapData)],!0),super.update.apply(this,arguments)}}tO.defaultOptions=(0,o.merge)(tS.defaultOptions,{affectsMapView:!0,animation:!1,dataLabels:{crop:!1,distance:0,formatter:function(){let{numberFormatter:t}=this.series.chart,{value:e}=this.point;return(0,o.isNumber)(e)?t(e,-1):this.point.name||""},inside:!0,overflow:!1,padding:[0,2],verticalAlign:"middle"},linecap:"round",marker:null,nullColor:"var(--highcharts-neutral-color-3)",stickyTracking:!1,tooltip:{followPointer:!0,pointFormat:"{point.name}: {point.value}<br/>"},turboThreshold:0,allAreas:!0,borderColor:"var(--highcharts-neutral-color-20)",borderWidth:1,joinBy:"hc-key",states:{hover:{halo:void 0,borderColor:"var(--highcharts-neutral-color-60)",borderWidth:2},normal:{animation:!0},select:{color:"var(--highcharts-neutral-color-20)"}},legendSymbol:"rectangle"}),(0,o.extend)(tO.prototype,{type:"map",axisTypes:A.seriesMembers.axisTypes,colorAttribs:A.seriesMembers.colorAttribs,colorKey:A.seriesMembers.colorKey,directTouch:!0,drawDataLabels:tE,drawGraph:tE,forceDL:!0,getCenter:E.getCenter,getExtremesFromAll:!0,getSymbol:tE,isCartesian:!1,parallelArrays:A.seriesMembers.parallelArrays,pointArrayMap:A.seriesMembers.pointArrayMap,pointClass:Z,preserveAspectRatio:!0,searchPoint:tE,trackerGroups:A.seriesMembers.trackerGroups,useMapGeometry:!0}),A.compose(tO),T().registerSeriesType("map",tO);let tD=tO;class tI extends tD{pointAttribs(t,e){let i=super.pointAttribs(t,e);return i.fill=this.options.fillColor,i}}tI.defaultOptions=(0,o.merge)(tD.defaultOptions,{lineWidth:1,fillColor:"none",legendSymbol:"lineMarker"}),(0,o.extend)(tI.prototype,{type:"mapline",colorProp:"stroke",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth"}}),T().registerSeriesType("mapline",tI);let{scatter:tV}=T().seriesTypes;class tR extends tV.prototype.pointClass{isValid(){return!!(this.options.geometry||(0,o.isNumber)(this.x)&&(0,o.isNumber)(this.y)||(0,o.isNumber)(this.options.lon)&&(0,o.isNumber)(this.options.lat))}}i.d({},{});let{noop:tX}=c(),{map:tG,scatter:tF}=T().seriesTypes;class tY extends tF{constructor(){super(...arguments),this.clearBounds=tG.prototype.clearBounds}drawDataLabels(){super.drawDataLabels(),this.dataLabelsGroups?.forEach(t=>{t?.clip(this.chart.clipRect)})}projectPoint(t){let e=this.chart.mapView;if(e){let{geometry:i,lon:s,lat:r}=t,a=i&&"Point"===i.type&&i.coordinates;if((0,o.isNumber)(s)&&(0,o.isNumber)(r)&&(a=[s,r]),a)return e.lonLatToProjectedUnits({lon:a[0],lat:a[1]})}}translate(){let t=this.chart.mapView;if(this.generatePoints(),this.getProjectedBounds&&this.isDirtyData&&(delete this.bounds,this.getProjectedBounds()),t){let e=t.getSVGTransform(),{hasCoordinates:i}=t.projection;this.points.forEach(s=>{let r,{x:a,y:n}=s,l=(0,o.isNumber)(s.insetIndex)&&t.insets[s.insetIndex].getSVGTransform()||e,h=this.projectPoint(s.options)||s.properties&&this.projectPoint(s.properties);if(h?(a=h.x,n=h.y):s.bounds&&(a=s.bounds.midX,n=s.bounds.midY,l&&(0,o.isNumber)(a)&&(0,o.isNumber)(n)&&(s.plotX=a*l.scaleX+l.translateX,s.plotY=n*l.scaleY+l.translateY,r=!0)),(0,o.isNumber)(a)&&(0,o.isNumber)(n)){if(!r){let e=t.projectedUnitsToPixels({x:a,y:n});s.plotX=e.x,s.plotY=i?e.y:this.chart.plotHeight-e.y}}else s.y=s.plotX=s.plotY=void 0;s.isInside=this.isPointInside(s),s.zone=this.zones.length?s.getZone():void 0})}(0,o.fireEvent)(this,"afterTranslate")}}tY.defaultOptions=(0,o.merge)(tF.defaultOptions,{dataLabels:{crop:!1,defer:!1,enabled:!0,formatter:function(){return this.point.name},overflow:!1,style:{color:"var(--highcharts-neutral-color-100)"}},legendSymbol:"lineMarker",stickyTracking:!0,tooltip:{pointFormat:"{#if point.name}{point.name}{else}L