/**
 * Highmaps JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/tilemap
 * @requires highcharts
 * @requires highcharts/modules/map
 *
 * Tilemap module
 *
 * (c) 2010-2026 Highsoft AS
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,o={};o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var n=o.n(i);let s=t.default.SeriesRegistry;var r=o.n(s);let a=t.default.Color;var l=o.n(a);let{doc:p,win:h}=n();function c(t,e,o,i={}){let s="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let r=s.hcEvents;n().Point&&t instanceof n().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let a=t.addEventListener;a&&a.call(t,e,o,!!n().supportsPassiveEvents&&{passive:void 0===i.passive?-1!==e.indexOf("touch"):i.passive,capture:!1}),r[e]||(r[e]=[]);let l={fn:o,order:"number"==typeof i.order?i.order:1/0};return r[e].push(l),r[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,o){function i(e,o){let i=t.removeEventListener;i&&i.call(t,e,o,!1)}function n(o){let n,s;t.nodeName&&(e?(n={})[e]=!0:n=o,b(n,function(t,e){if(o[e])for(s=o[e].length;s--;)i(e,o[e][s].fn)}))}let s="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(s,"hcEvents")){let t=s.hcEvents;if(e){let s=t[e]||[];o?(t[e]=s.filter(function(t){return o!==t.fn}),i(e,o)):(n(t),t[e]=[])}else n(t),delete s.hcEvents}}(t,e,o)}}function d(t,e,o){return t>e?t<o?t:o:e}function u(t,e){let o;for(o in t||(t={}),e)t[o]=e[o];return t}function f(t){return x(t)&&"number"==typeof t.nodeType}function y(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function x(t,e){return!!t&&"object"==typeof t&&(!e||!y(t))}function g(t,...e){let o,i=[t,...e],n={},s=function(t,e){return"object"!=typeof t&&(t={}),b(e,function(o,i){if("__proto__"!==i&&"constructor"!==i){let n;!x(o,!0)||(n=o?.constructor,x(o,!0)&&!f(o)&&n?.name&&"Object"!==n.name)||f(o)?t[i]=e[i]:t[i]=s(t[i]||{},o)}}),t};!0===t&&(n=i[1],i=Array.prototype.slice.call(i,2));let r=i.length;for(o=0;o<r;o++)n=s(n,i[o]);return n}function b(t,e,o){for(let i in t)Object.hasOwnProperty.call(t,i)&&e.call(o||t[i],t[i],i,t)}function m(){let t=arguments,e=t.length;for(let o=0;o<e;o++){let e=t[o];if(null!=e)return e}}Array.prototype.find;let{parse:A}=l();!function(t){let e;function o(){let{userOptions:t}=this;if(this.colorAxis=[],t.colorAxis){var o;t.colorAxis=y(o=t.colorAxis)?o:[o],t.colorAxis.map(t=>new e(this,t))}}function i(t){let e=this.chart.colorAxis||[],o=e=>{let o=t.allItems.indexOf(e);-1!==o&&(this.destroyItem(t.allItems[o]),t.allItems.splice(o,1))},i=[],n,s;for(e.forEach(function(t){n=t.options,n?.showInLegend&&(n.dataClasses&&n.visible?i=i.concat(t.getDataClassLegendSymbols()):n.visible&&i.push(t),t.series.forEach(function(t){(!t.options.showInLegend||n.dataClasses)&&("point"===t.options.legendType?t.points.forEach(function(t){o(t)}):o(t))}))}),s=i.length;s--;)t.allItems.unshift(i[s])}function n(t){t.visible&&t.item.legendColor&&t.item.legendItem.symbol.attr({fill:t.item.legendColor})}function s(t){this.chart.colorAxis?.forEach(e=>{e.update({},t.redraw)})}function r(){(this.chart.colorAxis?.length||this.colorAttribs)&&this.translateColors()}function a(){let t=this.axisTypes;t?-1===t.indexOf("colorAxis")&&t.push("colorAxis"):this.axisTypes=["colorAxis"]}function l(t){let e=this,o=t?"show":"hide";e.visible=e.options.visible=!!t,["graphic","dataLabel"].forEach(function(t){e[t]&&e[t][o]()}),this.series.buildKDTree()}function p(){let t=this,e=this.getPointsCollection(),o=this.options.nullColor,i=this.colorAxis,n=this.colorKey;e.forEach(e=>{let s=e.getNestedProperty(n),r=e.options.color||(e.isNull||null===e.value?o:i&&void 0!==s?i.toColor(s,e):e.color||t.color);r&&e.color!==r&&(e.color=r,"point"===t.options.legendType&&e.legendItem&&e.legendItem.label&&t.chart.legend.colorizeItem(e,e.visible))})}function h(){this.elem.attr("fill",A(this.start).tweenTo(A(this.end),this.pos),void 0,!0)}function d(){this.elem.attr("stroke",A(this.start).tweenTo(A(this.end),this.pos),void 0,!0)}t.compose=function(t,f,y,x,b){var A;let P,v=f.prototype,M=y.prototype,L=b.prototype;v.collectionsWithUpdate.includes("colorAxis")||(e=t,v.collectionsWithUpdate.push("colorAxis"),v.collectionsWithInit.colorAxis=[v.addColorAxis],c(f,"afterCreateAxes",o),P=(A=f).prototype.createAxis,A.prototype.createAxis=function(t,o){if("colorAxis"!==t)return P.apply(this,arguments);let i=new e(this,g(o.axis,{index:this[t].length,isX:!1}));return this.isDirtyLegend=!0,this.axes.forEach(t=>{t.series=[]}),this.series.forEach(t=>{t.bindAxes(),t.isDirtyData=!0}),m(o.redraw,!0)&&this.redraw(o.animation),i},M.fillSetter=h,M.strokeSetter=d,c(x,"afterGetAllItems",i),c(x,"afterColorizeItem",n),c(x,"afterUpdate",s),u(L,{optionalAxis:"colorAxis",translateColors:p}),u(L.pointClass.prototype,{setVisible:l}),c(b,"afterTranslate",r,{order:1}),c(b,"bindAxes",a))},t.pointSetVisible=l}(e||(e={}));let P=e,{series:{prototype:{pointClass:v}},seriesTypes:{heatmap:{prototype:{pointClass:M}}}}=r();class L extends M{haloPath(){return this.series.tileShape.haloPath.apply(this,arguments)}}u(L.prototype,{setState:v.prototype.setState,setVisible:P.pointSetVisible});let{noop:S}=n(),{heatmap:C,scatter:T}=r().seriesTypes;function E(t,e,o){let i=t.options;return{xPad:-((i.colsize||1)/e),yPad:-((i.rowsize||1)/o)}}let w={hexagon:{alignDataLabel:T.prototype.alignDataLabel,getSeriesPadding:function(t){return E(t,3,2)},haloPath:function(t){if(!t)return[];let e=this.tileEdges;return[["M",e.x2-t,e.y1+t],["L",e.x3+t,e.y1+t],["L",e.x4+1.5*t,e.y2],["L",e.x3+t,e.y3-t],["L",e.x2-t,e.y3-t],["L",e.x1-1.5*t,e.y2],["Z"]]},translate:function(){let t,e=this.options,o=this.xAxis,i=this.yAxis,n=e.pointPadding||0,s=(e.colsize||1)/3,r=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let a=d(Math.floor(o.len-o.translate(e.x-2*s,0,1,0,1)),-o.len,2*o.len),l=d(Math.floor(o.len-o.translate(e.x-s,0,1,0,1)),-o.len,2*o.len),p=d(Math.floor(o.len-o.translate(e.x+s,0,1,0,1)),-o.len,2*o.len),h=d(Math.floor(o.len-o.translate(e.x+2*s,0,1,0,1)),-o.len,2*o.len),c=d(Math.floor(i.translate(e.y-r,0,1,0,1)),-i.len,2*i.len),u=d(Math.floor(i.translate(e.y,0,1,0,1)),-i.len,2*i.len),f=d(Math.floor(i.translate(e.y+r,0,1,0,1)),-i.len,2*i.len),y=e.pointPadding??n,x=y*Math.abs(l-a)/Math.abs(f-u),g=o.reversed?-x:x,b=o.reversed?-y:y,m=i.reversed?-y:y;e.x%2&&(t=t||Math.round(Math.abs(f-c)/2)*(i.reversed?-1:1),c+=t,u+=t,f+=t),e.plotX=e.clientX=(l+p)/2,e.plotY=u,e.tileEdges={x1:a+=g+b,x2:l+=b,x3:p-=b,x4:h-=g+b,y1:c-=m,y2:u,y3:f+=m},e.shapeType="path",e.shapeArgs={d:[["M",l,c],["L",p,c],["L",h,u],["L",p,f],["L",l,f],["L",a,u],["Z"]]}}this.translateColors()}},diamond:{alignDataLabel:T.prototype.alignDataLabel,getSeriesPadding:function(t){return E(t,2,2)},haloPath:function(t){if(!t)return[];let e=this.tileEdges;return[["M",e.x2,e.y1+t],["L",e.x3+t,e.y2],["L",e.x2,e.y3-t],["L",e.x1-t,e.y2],["Z"]]},translate:function(){let t,e=this.options,o=this.xAxis,i=this.yAxis,n=e.pointPadding||0,s=e.colsize||1,r=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let a=d(Math.round(o.len-o.translate(e.x-s,0,1,0,0)),-o.len,2*o.len),l=d(Math.round(o.len-o.translate(e.x+s,0,1,0,0)),-o.len,2*o.len),p=d(Math.round(i.translate(e.y-r,0,1,0,0)),-i.len,2*i.len),h=d(Math.round(i.translate(e.y,0,1,0,0)),-i.len,2*i.len),c=d(Math.round(i.translate(e.y+r,0,1,0,0)),-i.len,2*i.len),u=d(Math.round(o.len-o.translate(e.x,0,1,0,0)),-o.len,2*o.len),f=m(e.pointPadding,n),y=f*Math.abs(u-a)/Math.abs(c-h),x=o.reversed?-y:y,g=i.reversed?-f:f;e.x%2&&(t=Math.abs(c-p)/2*(i.reversed?-1:1),p+=t,h+=t,c+=t),e.plotX=e.clientX=u,e.plotY=h,e.tileEdges={x1:a+=x,x2:u,x3:l-=x,y1:p-=g,y2:h,y3:c+=g},e.shapeType="path",e.shapeArgs={d:[["M",u,p],["L",l,h],["L",u,c],["L",a,h],["Z"]]}}this.translateColors()}},circle:{alignDataLabel:T.prototype.alignDataLabel,getSeriesPadding:function(t){return E(t,2,2)},haloPath:function(t){return T.prototype.pointClass.prototype.haloPath.call(this,t+(t&&this.radius))},translate:function(){let t=this.options,e=this.xAxis,o=this.yAxis,i=t.pointPadding||0,n=(t.rowsize||1)/2,s=t.colsize||1,r,a,l,p,h=!1;for(let t of(this.generatePoints(),this.points)){let c=d(Math.round(e.len-e.translate(t.x,0,1,0,0)),-e.len,2*e.len),u=i,f=!1,y=d(Math.round(o.translate(t.y,0,1,0,0)),-o.len,2*o.len);void 0!==t.pointPadding&&(u=t.pointPadding,f=!0,h=!0),(!p||h)&&(l=Math.floor(Math.sqrt((r=Math.abs(d(Math.floor(e.len-e.translate(t.x+s,0,1,0,0)),-e.len,2*e.len)-c))*r+(a=Math.abs(d(Math.floor(o.translate(t.y+n,0,1,0,0)),-o.len,2*o.len)-y))*a)/2),p=Math.min(r,l,a)-u,h&&!f&&(h=!1)),t.x%2&&(y+=a*(o.reversed?-1:1)),t.plotX=t.clientX=c,t.plotY=y,t.radius=p,t.shapeType="circle",t.shapeArgs={x:c,y:y,r:p}}this.translateColors()}},square:{alignDataLabel:C.prototype.alignDataLabel,translate:C.prototype.translate,getSeriesPadding:S,haloPath:C.prototype.pointClass.prototype.haloPath}},{composed:O,noop:I}=n(),{column:D,heatmap:j,scatter:z}=r().seriesTypes;function X(){if(this.recomputingForTilemap||"colorAxis"===this.coll)return;let t=this,e=t.series.map(function(e){return e.getSeriesPixelPadding&&e.getSeriesPixelPadding(t)}).reduce(function(t,e){return(t&&t.padding)>(e&&e.padding)?t:e},void 0)||{padding:0,axisLengthFactor:1},o=Math.round(e.padding*e.axisLengthFactor);e.padding&&(t.len-=o,t.recomputingForTilemap=!0,t.setAxisTranslation(),delete t.recomputingForTilemap,t.minPixelPadding+=e.padding,t.len+=o)}class k extends j{static compose(t){0>O.indexOf("TilemapSeries")&&O.push("TilemapSeries")&&c(t,"afterSetAxisTranslation",X)}alignDataLabel(){return this.tileShape.alignDataLabel.apply(this,arguments)}drawPoints(){for(let t of(D.prototype.drawPoints.call(this),this.points))t.graphic&&t.graphic[this.chart.styledMode?"css":"animate"](this.colorAttribs(t))}getSeriesPixelPadding(t){let e=t.isXAxis,o=this.tileShape.getSeriesPadding(this);if(!o)return{padding:0,axisLengthFactor:1};let i=Math.round(t.translate(e?2*o.xPad:o.yPad,0,1,0,1)),n=Math.round(t.translate(e?o.xPad:0,0,1,0,1));return{padding:(t.single?Math.abs(i-n)/2:Math.abs(i-n))||0,axisLengthFactor:e?2:1.1}}setOptions(){let t=super.setOptions.apply(this,arguments);return this.tileShape=w[t.tileShape],t}translate(){return this.tileShape.translate.apply(this,arguments)}}k.defaultOptions=g(j.defaultOptions,{marker:null,states:{hover:{halo:{enabled:!0,size:2,opacity:.5,attributes:{zIndex:3}}}},pointPadding:2,tileShape:"hexagon"}),u(k.prototype,{getSymbol:I,markerAttribs:z.prototype.markerAttribs,pointAttribs:D.prototype.pointAttribs,pointClass:L}),r().registerSeriesType("tilemap",k);let F=n();k.compose(F.Axis);let _=n();export{_ as default};