UNPKG

highcharts

Version:
10 lines 26.8 kB
!/** * Highcharts JS v12.1.2 (2024-12-21) * @module highcharts/modules/treemap * @requires highcharts * * (c) 2014-2024 Highsoft AS * Authors: Jon Arild Nygard / Oystein Moseng * * License: www.highcharts.com/license */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.Templating,t._Highcharts.Color,t._Highcharts.SeriesRegistry,t._Highcharts.SVGElement):"function"==typeof define&&define.amd?define("highcharts/modules/treemap",["highcharts/highcharts"],function(t){return e(t,t.Templating,t.Color,t.SeriesRegistry,t.SVGElement)}):"object"==typeof exports?exports["highcharts/modules/treemap"]=e(t._Highcharts,t._Highcharts.Templating,t._Highcharts.Color,t._Highcharts.SeriesRegistry,t._Highcharts.SVGElement):t.Highcharts=e(t.Highcharts,t.Highcharts.Templating,t.Highcharts.Color,t.Highcharts.SeriesRegistry,t.Highcharts.SVGElement)}("undefined"==typeof window?this:window,(t,e,i,o,s)=>(()=>{"use strict";var r,l,n={620:t=>{t.exports=i},28:t=>{t.exports=s},512:t=>{t.exports=o},984:t=>{t.exports=e},944:e=>{e.exports=t}},a={};function h(t){var e=a[t];if(void 0!==e)return e.exports;var i=a[t]={exports:{}};return n[t](i,i.exports,h),i.exports}h.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return h.d(e,{a:e}),e},h.d=(t,e)=>{for(var i in e)h.o(e,i)&&!h.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},h.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var d={};h.d(d,{default:()=>tI});var p=h(944),u=h.n(p);let c={lang:{mainBreadcrumb:"Main"},options:{buttonTheme:{fill:"none",height:18,padding:2,"stroke-width":0,zIndex:7,states:{select:{fill:"none"}},style:{color:"#334eff"}},buttonSpacing:5,floating:!1,format:void 0,relativeTo:"plotBox",rtl:!1,position:{align:"left",verticalAlign:"top",x:0,y:void 0},separator:{text:"/",style:{color:"#666666",fontSize:"0.8em"}},showFullPath:!0,style:{},useHTML:!1,zIndex:7}};var g=h(984);let{format:v}=h.n(g)(),{composed:m}=u(),{addEvent:b,defined:f,extend:y,fireEvent:x,isString:T,merge:w,objectEach:L,pick:B,pushUnique:A}=u();function P(){if(this.breadcrumbs){let t=this.resetZoomButton&&this.resetZoomButton.getBBox(),e=this.breadcrumbs.options;t&&"right"===e.position.align&&"plotBox"===e.relativeTo&&this.breadcrumbs.alignBreadcrumbsGroup(-t.width-e.buttonSpacing)}}function S(){this.breadcrumbs&&(this.breadcrumbs.destroy(),this.breadcrumbs=void 0)}function C(){let t=this.breadcrumbs;if(t&&!t.options.floating&&t.level){let e=t.options,i=e.buttonTheme,o=(i.height||0)+2*(i.padding||0)+e.buttonSpacing,s=e.position.verticalAlign;"bottom"===s?(this.marginBottom=(this.marginBottom||0)+o,t.yOffset=o):"middle"!==s?(this.plotTop+=o,t.yOffset=-o):t.yOffset=void 0}}function O(){this.breadcrumbs&&this.breadcrumbs.redraw()}function N(t){!0===t.resetSelection&&this.breadcrumbs&&this.breadcrumbs.alignBreadcrumbsGroup()}class R{static compose(t,e){A(m,"Breadcrumbs")&&(b(t,"destroy",S),b(t,"afterShowResetZoom",P),b(t,"getMargins",C),b(t,"redraw",O),b(t,"selection",N),y(e.lang,c.lang))}constructor(t,e){this.elementList={},this.isDirty=!0,this.level=0,this.list=[];let i=w(t.options.drilldown&&t.options.drilldown.drillUpButton,R.defaultOptions,t.options.navigation&&t.options.navigation.breadcrumbs,e);this.chart=t,this.options=i||{}}updateProperties(t){this.setList(t),this.setLevel(),this.isDirty=!0}setList(t){this.list=t}setLevel(){this.level=this.list.length&&this.list.length-1}getLevel(){return this.level}getButtonText(t){let e=this.chart,i=this.options,o=e.options.lang,s=B(i.format,i.showFullPath?"{level.name}":"← {level.name}"),r=o&&B(o.drillUpText,o.mainBreadcrumb),l=i.formatter&&i.formatter(t)||v(s,{level:t.levelOptions},e)||"";return(T(l)&&!l.length||"← "===l)&&f(r)&&(l=i.showFullPath?r:"← "+r),l}redraw(){this.isDirty&&this.render(),this.group&&this.group.align(),this.isDirty=!1}render(){let t=this.chart,e=this.options;!this.group&&e&&(this.group=t.renderer.g("breadcrumbs-group").addClass("highcharts-no-tooltip highcharts-breadcrumbs").attr({zIndex:e.zIndex}).add()),e.showFullPath?this.renderFullPathButtons():this.renderSingleButton(),this.alignBreadcrumbsGroup()}renderFullPathButtons(){this.destroySingleButton(),this.resetElementListState(),this.updateListElements(),this.destroyListElements()}renderSingleButton(){let t=this.chart,e=this.list,i=this.options.buttonSpacing;this.destroyListElements();let o=this.group?this.group.getBBox().width:i,s=e[e.length-2];!t.drillUpButton&&this.level>0?t.drillUpButton=this.renderButton(s,o,i):t.drillUpButton&&(this.level>0?this.updateSingleButton():this.destroySingleButton())}alignBreadcrumbsGroup(t){if(this.group){let e=this.options,i=e.buttonTheme,o=e.position,s="chart"===e.relativeTo||"spacingBox"===e.relativeTo?void 0:"plotBox",r=this.group.getBBox(),l=2*(i.padding||0)+e.buttonSpacing;o.width=r.width+l,o.height=r.height+l;let n=w(o);t&&(n.x+=t),this.options.rtl&&(n.x+=o.width),n.y=B(n.y,this.yOffset,0),this.group.align(n,!0,s)}}renderButton(t,e,i){let o=this,s=this.chart,r=o.options,l=w(r.buttonTheme),n=s.renderer.button(o.getButtonText(t),e,i,function(e){let i;let s=r.events&&r.events.click;s&&(i=s.call(o,e,t)),!1!==i&&(r.showFullPath?e.newLevel=t.level:e.newLevel=o.level-1,x(o,"up",e))},l).addClass("highcharts-breadcrumbs-button").add(o.group);return s.styledMode||n.attr(r.style),n}renderSeparator(t,e){let i=this.chart,o=this.options.separator,s=i.renderer.label(o.text,t,e,void 0,void 0,void 0,!1).addClass("highcharts-breadcrumbs-separator").add(this.group);return i.styledMode||s.css(o.style),s}update(t){w(!0,this.options,t),this.destroy(),this.isDirty=!0}updateSingleButton(){let t=this.chart,e=this.list[this.level-1];t.drillUpButton&&t.drillUpButton.attr({text:this.getButtonText(e)})}destroy(){this.destroySingleButton(),this.destroyListElements(!0),this.group&&this.group.destroy(),this.group=void 0}destroyListElements(t){let e=this.elementList;L(e,(i,o)=>{(t||!e[o].updated)&&((i=e[o]).button&&i.button.destroy(),i.separator&&i.separator.destroy(),delete i.button,delete i.separator,delete e[o])}),t&&(this.elementList={})}destroySingleButton(){this.chart.drillUpButton&&(this.chart.drillUpButton.destroy(),this.chart.drillUpButton=void 0)}resetElementListState(){L(this.elementList,t=>{t.updated=!1})}updateListElements(){let t=this.elementList,e=this.options.buttonSpacing,i=this.list,o=this.options.rtl,s=o?-1:1,r=function(t,e){return s*t.getBBox().width+s*e},l=function(t,e,i){t.translate(e-t.getBBox().width,i)},n=this.group?r(this.group,e):e,a,h;for(let d=0,p=i.length;d<p;++d){let u,c;let g=d===p-1;t[(h=i[d]).level]?(u=(a=t[h.level]).button,a.separator||g?a.separator&&g&&(a.separator.destroy(),delete a.separator):(n+=s*e,a.separator=this.renderSeparator(n,e),o&&l(a.separator,n,e),n+=r(a.separator,e)),t[h.level].updated=!0):(u=this.renderButton(h,n,e),o&&l(u,n,e),n+=r(u,e),g||(c=this.renderSeparator(n,e),o&&l(c,n,e),n+=r(c,e)),t[h.level]={button:u,separator:c,updated:!0}),u&&u.setState(g?2:0)}}}R.defaultOptions=c.options;var M=h(620),I=h.n(M),D=h(512),G=h.n(D),H=h(28),U=h.n(H);let{column:{prototype:k}}=G().seriesTypes,{addEvent:E,defined:W}=u();!function(t){function e(t){let e=this.series,i=e.chart.renderer;this.moveToTopOnHover&&this.graphic&&(e.stateMarkerGraphic||(e.stateMarkerGraphic=new(U())(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:""}))}t.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))}},t.seriesMembers={colorKey:"value",axisTypes:["xAxis","yAxis","colorAxis"],parallelArrays:["x","y","value"],pointArrayMap:["value"],trackerGroups:["group","markerGroup","dataLabelsGroup"],colorAttribs:function(t){let e={};return W(t.color)&&(!t.state||"normal"===t.state)&&(e[this.colorProp||"fill"]=t.color),e},pointAttribs:k.pointAttribs},t.compose=function(t){return E(t.prototype.pointClass,"afterSetState",e),t}}(r||(r={}));let V=r,F=class{constructor(t,e,i,o){this.height=t,this.width=e,this.plot=o,this.direction=i,this.startDirection=i,this.total=0,this.nW=0,this.lW=0,this.nH=0,this.lH=0,this.elArr=[],this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(t,e){return Math.max(t/e,e/t)}}}addElement(t){this.lP.total=this.elArr[this.elArr.length-1],this.total=this.total+t,0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH)),this.elArr.push(t)}reset(){this.nW=0,this.lW=0,this.elArr=[],this.total=0}},z={draw:function(t,e){let{animatableAttribs:i,onComplete:o,css:s,renderer:r}=e,l=t.series&&t.series.chart.hasRendered?void 0:t.series&&t.series.options.animation,n=t.graphic;if(e.attribs={...e.attribs,class:t.getClassName()},t.shouldDraw())n||(n="text"===e.shapeType?r.text():"image"===e.shapeType?r.image(e.imageUrl||"").attr(e.shapeArgs||{}):r[e.shapeType](e.shapeArgs||{}),t.graphic=n,n.add(e.group)),s&&n.css(s),n.attr(e.attribs).animate(i,!e.isNew&&l,o);else if(n){let e=()=>{t.graphic=n=n&&n.destroy(),"function"==typeof o&&o()};Object.keys(i).length?n.animate(i,void 0,()=>e()):e()}}},{pie:{prototype:{pointClass:_}},scatter:{prototype:{pointClass:j}}}=G().seriesTypes,{extend:$,isNumber:K,pick:Y}=u();class Z extends j{constructor(){super(...arguments),this.groupedPointsAmount=0,this.shapeType="rect"}draw(t){z.draw(this,t)}getClassName(){let t=this.series,e=t.options,i=super.getClassName();return this.node.level<=t.nodeMap[t.rootNode].level&&this.node.children.length?i+=" highcharts-above-level":this.node.isGroup||this.node.isLeaf||t.nodeMap[t.rootNode].isGroup||Y(e.interactByLeaf,!e.allowTraversingTree)?this.node.isGroup||this.node.isLeaf||t.nodeMap[t.rootNode].isGroup||(i+=" highcharts-internal-node"):i+=" highcharts-internal-node-interactive",i}isValid(){return!!(this.id||K(this.value))}setState(t){super.setState.apply(this,arguments),this.graphic&&this.graphic.attr({zIndex:"hover"===t?1:0})}shouldDraw(){return K(this.plotY)&&null!==this.y}}$(Z.prototype,{setVisible:_.prototype.setVisible});let{isString:q}=u(),X={allowTraversingTree:!1,animationLimit:250,borderRadius:0,showInLegend:!1,marker:void 0,colorByPoint:!1,dataLabels:{defer:!1,enabled:!0,formatter:function(){let t=this&&this.point?this.point:{};return q(t.name)?t.name:""},inside:!0,padding:2,verticalAlign:"middle",style:{textOverflow:"ellipsis"}},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}<br/>",clusterFormat:"+ {point.groupedPointsAmount} more...<br/>"},ignoreHiddenPoint:!0,layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,traverseUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,colorKey:"colorValue",opacity:.15,states:{hover:{borderColor:"#999999",brightness:G().seriesTypes.heatmap?0:.1,halo:!1,opacity:.75,shadow:!1}},legendSymbol:"rectangle",traverseToLeaf:!1,cluster:{className:void 0,color:void 0,enabled:!1,pixelWidth:void 0,pixelHeight:void 0,name:void 0,reductionFactor:void 0,minimumClusterSize:5,layoutAlgorithm:{distance:0,gridSize:0,kmeansThreshold:0},marker:{lineWidth:0,radius:0}}};(l||(l={})).recursive=function t(e,i,o){let s=i.call(o||this,e);!1!==s&&t(s,i,o)};let J=l,{extend:Q,isArray:tt,isNumber:te,isObject:ti,merge:to,pick:ts,relativeLength:tr}=u(),{parse:tl}=I(),{composed:tn,noop:ta}=u(),{column:th,scatter:td}=G().seriesTypes,{getColor:tp,getLevelOptions:tu,updateRootId:tc}={getColor:function(t,e){let i,o,s,r,l,n;let a=e.index,h=e.mapOptionsToLevel,d=e.parentColor,p=e.parentColorIndex,u=e.series,c=e.colors,g=e.siblings,v=u.points,m=u.chart.options.chart;return t&&(i=v[t.i],o=h[t.level]||{},i&&o.colorByPoint&&(r=i.index%(c?c.length:m.colorCount),s=c&&c[r]),u.chart.styledMode||(l=ts(i&&i.options.color,o&&o.color,s,d&&(t=>{let e=o&&o.colorVariation;return e&&"brightness"===e.key&&a&&g?I().parse(t).brighten(e.to*(a/g)).get():t})(d),u.color)),n=ts(i&&i.options.colorIndex,o&&o.colorIndex,r,p,e.colorIndex)),{color:l,colorIndex:n}},getLevelOptions:function(t){let e,i,o,s,r,l;let n={};if(ti(t))for(s=te(t.from)?t.from:1,l=t.levels,i={},e=ti(t.defaults)?t.defaults:{},tt(l)&&(i=l.reduce((t,i)=>{let o,r,l;return ti(i)&&te(i.level)&&(r=ts((l=to({},i)).levelIsConstant,e.levelIsConstant),delete l.levelIsConstant,delete l.level,ti(t[o=i.level+(r?0:s-1)])?to(!0,t[o],l):t[o]=l),t},{})),r=te(t.to)?t.to:1,o=0;o<=r;o++)n[o]=to({},e,ti(i[o])?i[o]:{});return n},getNodeWidth:function(t,e){let{chart:i,options:o}=t,{nodeDistance:s=0,nodeWidth:r=0}=o,{plotSizeX:l=1}=i;if("auto"===r){if("string"==typeof s&&/%$/.test(s))return l/(e+parseFloat(s)/100*(e-1));let t=Number(s);return(l+t)/(e||1)-t}return tr(r,l)},setTreeValues:function t(e,i){let o=i.before,s=i.idRoot,r=i.mapIdToNode[s],l=!1!==i.levelIsConstant,n=i.points[e.i],a=n&&n.options||{},h=[],d=0;e.levelDynamic=e.level-(l?0:r.level),e.name=ts(n&&n.name,""),e.visible=s===e.id||!0===i.visible,"function"==typeof o&&(e=o(e,i)),e.children.forEach((o,s)=>{let r=Q({},i);Q(r,{index:s,siblings:e.children.length,visible:e.visible}),o=t(o,r),h.push(o),o.visible&&(d+=o.val)});let p=ts(a.value,d);return e.visible=p>=0&&(d>0||e.visible),e.children=h,e.childrenTotal=d,e.isLeaf=e.visible&&!d,e.val=p,e},updateRootId:function(t){let e,i;return ti(t)&&(i=ti(t.options)?t.options:{},e=ts(t.rootNode,i.rootId,""),ti(t.userOptions)&&(t.userOptions.rootId=e),t.rootNode=e),e}},{addEvent:tg,correctFloat:tv,crisp:tm,defined:tb,error:tf,extend:ty,fireEvent:tx,isArray:tT,isObject:tw,isString:tL,merge:tB,pick:tA,pushUnique:tP,splat:tS,stableSort:tC}=u(),tO=!1;function tN(){let t;let e=this.xAxis,i=this.yAxis;e&&i&&(this.is("treemap")?(t={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,minPadding:0,max:100,maxPadding:0,startOnTick:!1,title:void 0,tickPositions:[]},ty(i.options,t),ty(e.options,t),tO=!0):tO&&(i.setOptions(i.userOptions),e.setOptions(e.userOptions),tO=!1))}class tR extends td{static compose(t){tP(tn,"TreemapSeries")&&tg(t,"afterBindAxes",tN)}algorithmCalcPoints(t,e,i,o){let s=i.plot,r=i.elArr.length-1,l,n,a,h,d=i.lW,p=i.lH,u,c=0;for(let t of(e?(d=i.nW,p=i.nH):u=i.elArr[r],i.elArr))(e||c<r)&&(0===i.direction?(l=s.x,n=s.y,h=t/(a=d)):(l=s.x,n=s.y,a=t/(h=p)),o.push({x:l,y:n,width:a,height:tv(h)}),0===i.direction?s.y=s.y+h:s.x=s.x+a),c+=1;i.reset(),0===i.direction?i.width=i.width-d:i.height=i.height-p,s.y=s.parent.y+(s.parent.height-i.height),s.x=s.parent.x+(s.parent.width-i.width),t&&(i.direction=1-i.direction),e||i.addElement(u)}algorithmFill(t,e,i){let o=[],s,r=e.direction,l=e.x,n=e.y,a=e.width,h=e.height,d,p,u,c;for(let g of i)s=e.width*e.height*(g.val/e.val),d=l,p=n,0===r?(a-=u=s/(c=h),l+=u):(h-=c=s/(u=a),n+=c),o.push({x:d,y:p,width:u,height:c,direction:0,val:0}),t&&(r=1-r);return o}algorithmLowAspectRatio(t,e,i){let o=[],s={x:e.x,y:e.y,parent:e},r=e.direction,l=i.length-1,n=new F(e.height,e.width,r,s),a,h=0;for(let r of i)a=e.width*e.height*(r.val/e.val),n.addElement(a),n.lP.nR>n.lP.lR&&this.algorithmCalcPoints(t,!1,n,o,s),h===l&&this.algorithmCalcPoints(t,!0,n,o,s),++h;return o}alignDataLabel(t,e,i){th.prototype.alignDataLabel.apply(this,arguments),t.dataLabel&&t.dataLabel.attr({zIndex:(t.node.zIndex||0)+1})}applyTreeGrouping(){let t=this,e=t.parentList||{},{cluster:i}=t.options,o=i?.minimumClusterSize||5;if(i?.enabled){let s={},r=t=>{if(t?.point?.shapeArgs){let{width:e=0,height:o=0}=t.point.shapeArgs,{pixelWidth:r=0,pixelHeight:l=0}=i,n=tb(l),a=l?r*l:r*r;(e<r||o<(n?l:r)||e*o<a)&&!t.isGroup&&tb(t.parent)&&(s[t.parent]||(s[t.parent]=[]),s[t.parent].push(t))}t?.children.forEach(t=>{r(t)})};for(let l in r(t.tree),s)s[l]&&s[l].length>o&&s[l].forEach(o=>{let s=e[l].indexOf(o.i);if(-1!==s){e[l].splice(s,1);let r=`highcharts-grouped-treemap-points-${o.parent||"root"}`,n=t.points.find(t=>t.id===r);if(!n){let o=t.pointClass,s=t.points.length;ty(n=new o(t,{className:i.className,color:i.color,id:r,index:s,isGroup:!0,value:0}),{formatPrefix:"cluster"}),t.points.push(n),e[l].push(s),e[r]=[]}let a=n.groupedPointsAmount+1,h=t.points[n.index].options.value||0,d=i.name||`+ ${a}`;t.points[n.index].groupedPointsAmount=a,t.points[n.index].options.value=h+(o.point.value||0),t.points[n.index].name=d,e[r].push(o.point.index)}});t.nodeMap={},t.nodeList=[],t.parentList=e;let l=t.buildTree("",-1,0,t.parentList);t.translate(l)}}calculateChildrenAreas(t,e){let i=this.options,o=this.mapOptionsToLevel[t.level+1],s=tA(o?.layoutAlgorithm&&this[o?.layoutAlgorithm]&&o.layoutAlgorithm,this.options.layoutAlgorithm),r=i.alternateStartingDirection,l=t.children.filter(e=>t.isGroup||!e.ignore);if(!s)return;let n=[];o&&o.layoutStartingDirection&&(e.direction="vertical"===o.layoutStartingDirection?0:1),n=this[s](e,l);let a=-1;for(let t of l){let i=n[++a];t.values=tB(i,{val:t.childrenTotal,direction:r?1-e.direction:e.direction}),t.pointValues=tB(i,{x:i.x/this.axisRatio,y:100-i.y-i.height,width:i.width/this.axisRatio}),t.children.length&&this.calculateChildrenAreas(t,t.values)}}createList(t){let e=this.chart,i=e.breadcrumbs,o=[];if(i){let i=0;o.push({level:i,levelOptions:e.series[0]});let s=t.target.nodeMap[t.newRootId],r=[];for(;s.parent||""===s.parent;)r.push(s),s=t.target.nodeMap[s.parent];for(let t of r.reverse())o.push({level:++i,levelOptions:t});o.length<=1&&(o.length=0)}return o}drawDataLabels(){let t,e;let i=this.mapOptionsToLevel,o=this.points.filter(function(t){return t.node.visible||tb(t.dataLabel)}),s=tS(this.options.dataLabels||{})[0]?.padding;for(let r of o){if(e=i[r.node.level],t={style:{}},(!r.node.isLeaf&&!r.node.isGroup||r.node.isGroup&&r.node.level<=this.nodeMap[this.rootNode].level)&&(t.enabled=!1),e&&e.dataLabels&&(t=tB(t,e.dataLabels),this.hasDataLabels=()=>!0),r.shapeArgs){let e={width:(r.shapeArgs.width||0)-2*(t.padding||s||0)+"px",lineClamp:Math.floor((r.shapeArgs.height||0)/16)};ty(t.style,e),r.dataLabel?.css(e)}r.dlOptions=tB(t,r.options.dataLabels)}super.drawDataLabels(o)}drawPoints(t=this.points){let e=this.chart,i=e.renderer,o=e.styledMode,s=this.options,r=o?{}:s.shadow,l=s.borderRadius,n=e.pointCount<s.animationLimit,a=s.allowTraversingTree;for(let e of t){let t=e.node.levelDynamic,h={},d={},p={},u="level-group-"+e.node.level,c=!!e.graphic,g=n&&c,v=e.shapeArgs;e.shouldDraw()&&(e.isInside=!0,l&&(d.r=l),tB(!0,g?h:d,c?v:{},o?{}:this.pointAttribs(e,e.selected?"select":void 0)),this.colorAttribs&&o&&ty(p,this.colorAttribs(e)),this[u]||(this[u]=i.g(u).attr({zIndex:1e3-(t||0)}).add(this.group),this[u].survive=!0)),e.draw({animatableAttribs:h,attribs:d,css:p,group:this[u],imageUrl:e.imageUrl,renderer:i,shadow:r,shapeArgs:v,shapeType:e.shapeType}),a&&e.graphic&&(e.drillId=s.interactByLeaf?this.drillToByLeaf(e):this.drillToByGroup(e))}}drillToByGroup(t){let e=!1;return(!t.node.isLeaf||t.node.isGroup)&&t.node.level-this.nodeMap[this.rootNode].level==1&&(e=t.id),e}drillToByLeaf(t){let{traverseToLeaf:e}=t.series.options,i=!1,o;if(t.node.parent!==this.rootNode&&t.node.isLeaf){if(e)i=t.id;else for(o=t.node;!i;)void 0!==o.parent&&(o=this.nodeMap[o.parent]),o.parent===this.rootNode&&(i=o.id)}return i}drillToNode(t,e){tf(32,!1,void 0,{"treemap.drillToNode":"use treemap.setRootNode"}),this.setRootNode(t,e)}drillUp(){let t=this.nodeMap[this.rootNode];t&&tL(t.parent)&&this.setRootNode(t.parent,!0,{trigger:"traverseUpButton"})}getExtremes(){let{dataMin:t,dataMax:e}=super.getExtremes(this.colorValueData);return this.valueMin=t,this.valueMax=e,super.getExtremes()}getListOfParents(t,e){let i=tT(t)?t:[],o=tT(e)?e:[],s=i.reduce(function(t,e,i){let o=tA(e.parent,"");return void 0===t[o]&&(t[o]=[]),t[o].push(i),t},{"":[]});for(let t of Object.keys(s)){let e=s[t];if(""!==t&&-1===o.indexOf(t)){for(let t of e)s[""].push(t);delete s[t]}}return s}getTree(){let t=this.data.map(function(t){return t.id});return this.parentList=this.getListOfParents(this.data,t),this.nodeMap={},this.nodeList=[],this.buildTree("",-1,0,this.parentList||{})}buildTree(t,e,i,o,s){let r=[],l=this.points[e],n=0,a;for(let e of o[t]||[])n=Math.max((a=this.buildTree(this.points[e].id,e,i+1,o,t)).height+1,n),r.push(a);let h=new this.NodeClass().init(t,e,r,n,i,this,s);for(let t of r)t.parentNode=h;return this.nodeMap[h.id]=h,this.nodeList.push(h),l&&(l.node=h,h.point=l),h}hasData(){return!!this.dataTable.rowCount}init(t,e){let i=this,o=tB(e.drillUpButton,e.breadcrumbs),s=tg(i,"setOptions",t=>{let e=t.userOptions;tb(e.allowDrillToNode)&&!tb(e.allowTraversingTree)&&(e.allowTraversingTree=e.allowDrillToNode,delete e.allowDrillToNode),tb(e.drillUpButton)&&!tb(e.traverseUpButton)&&(e.traverseUpButton=e.drillUpButton,delete e.drillUpButton)});super.init(t,e),delete i.opacity,i.eventsToUnbind.push(s),i.options.allowTraversingTree&&(i.eventsToUnbind.push(tg(i,"click",i.onClickDrillToNode)),i.eventsToUnbind.push(tg(i,"setRootNode",function(t){let e=i.chart;e.breadcrumbs&&e.breadcrumbs.updateProperties(i.createList(t))})),i.eventsToUnbind.push(tg(i,"update",function(t,e){let i=this.chart.breadcrumbs;i&&t.options.breadcrumbs&&i.update(t.options.breadcrumbs)})),i.eventsToUnbind.push(tg(i,"destroy",function(t){let e=this.chart;e.breadcrumbs&&!t.keepEventsForUpdate&&(e.breadcrumbs.destroy(),e.breadcrumbs=void 0)}))),t.breadcrumbs||(t.breadcrumbs=new R(t,o)),i.eventsToUnbind.push(tg(t.breadcrumbs,"up",function(t){let e=this.level-t.newLevel;for(let t=0;t<e;t++)i.drillUp()}))}onClickDrillToNode(t){let e=t.point,i=e&&e.drillId;tL(i)&&(e.setState(""),this.setRootNode(i,!0,{trigger:"click"}))}pointAttribs(t,e){let i;let o=tw(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},s=t&&o[t.node.level]||{},r=this.options,l=e&&r.states&&r.states[e]||{},n=t&&t.getClassName()||"",a={stroke:t&&t.borderColor||s.borderColor||l.borderColor||r.borderColor,"stroke-width":tA(t&&t.borderWidth,s.borderWidth,l.borderWidth,r.borderWidth),dashstyle:t&&t.borderDashStyle||s.borderDashStyle||l.borderDashStyle||r.borderDashStyle,fill:t&&t.color||this.color};return -1!==n.indexOf("highcharts-above-level")?(a.fill="none",a["stroke-width"]=0):-1!==n.indexOf("highcharts-internal-node-interactive")?(i=tA(l.opacity,r.opacity),a.fill=tl(a.fill).setOpacity(i).get(),a.cursor="pointer"):-1!==n.indexOf("highcharts-internal-node")?a.fill="none":e&&(a.fill=tl(a.fill).brighten(l.brightness).get()),a}setColorRecursive(t,e,i,o,s){let r=this&&this.chart,l=r&&r.options&&r.options.colors;if(t){let r=tp(t,{colors:l,index:o,mapOptionsToLevel:this.mapOptionsToLevel,parentColor:e,parentColorIndex:i,series:this,siblings:s}),n=this.points[t.i];n&&(n.color=r.color,n.colorIndex=r.colorIndex);let a=-1;for(let e of t.children||[])this.setColorRecursive(e,r.color,r.colorIndex,++a,t.children.length)}}setPointValues(){let t=this,{points:e,xAxis:i,yAxis:o}=t,s=t.chart.styledMode,r=e=>s?0:t.pointAttribs(e)["stroke-width"]||0;for(let t of e){let{pointValues:e,visible:s}=t.node;if(e&&s){let{height:s,width:l,x:n,y:a}=e,h=r(t),d=tm(i.toPixels(n,!0),h,!0),p=tm(i.toPixels(n+l,!0),h,!0),u=tm(o.toPixels(a,!0),h,!0),c=tm(o.toPixels(a+s,!0),h,!0),g={x:Math.min(d,p),y:Math.min(u,c),width:Math.abs(p-d),height:Math.abs(c-u)};t.plotX=g.x+g.width/2,t.plotY=g.y+g.height/2,t.shapeArgs=g}else delete t.plotX,delete t.plotY}}setRootNode(t,e,i){tx(this,"setRootNode",ty({newRootId:t,previousRootId:this.rootNode,redraw:tA(e,!0),series:this},i),function(t){let e=t.series;e.idPreviousRoot=t.previousRootId,e.rootNode=t.newRootId,e.isDirty=!0,t.redraw&&e.chart.redraw()})}setState(t){this.options.inactiveOtherPoints=!0,super.setState(t,!1),this.options.inactiveOtherPoints=!1}setTreeValues(t){let e=this.options,i=this.rootNode,o=this.nodeMap[i],s="boolean"!=typeof e.levelIsConstant||e.levelIsConstant,r=[],l=this.points[t.i],n=0;for(let e of t.children)e=this.setTreeValues(e),r.push(e),e.ignore||(n+=e.val);tC(r,(t,e)=>(t.sortIndex||0)-(e.sortIndex||0));let a=tA(l&&l.options.value,n);return l&&(l.value=a),l?.isGroup&&e.cluster?.reductionFactor&&(a/=e.cluster.reductionFactor),t.parentNode?.point?.isGroup&&this.rootNode!==t.parent&&(t.visible=!1),ty(t,{children:r,childrenTotal:n,ignore:!(tA(l&&l.visible,!0)&&a>0),isLeaf:t.visible&&!n,isGroup:l?.isGroup,levelDynamic:t.level-(s?0:o.level),name:tA(l&&l.name,""),sortIndex:tA(l&&l.sortIndex,-a),val:a}),t}sliceAndDice(t,e){return this.algorithmFill(!0,t,e)}squarified(t,e){return this.algorithmLowAspectRatio(!0,t,e)}strip(t,e){return this.algorithmLowAspectRatio(!1,t,e)}stripes(t,e){return this.algorithmFill(!1,t,e)}translate(t){let e=this,i=e.options,o=!t,s=tc(e),r,l,n,a;t||s.startsWith("highcharts-grouped-treemap-points-")||((this.points||[]).forEach(t=>{t.isGroup&&t.destroy()}),super.translate(),t=e.getTree()),e.tree=t=t||e.tree,r=e.nodeMap[s],""===s||r||(e.setRootNode("",!1),s=e.rootNode,r=e.nodeMap[s]),r.point?.isGroup||(e.mapOptionsToLevel=tu({from:r.level+1,levels:i.levels,to:t.height,defaults:{levelIsConstant:e.options.levelIsConstant,colorByPoint:i.colorByPoint}})),J.recursive(e.nodeMap[e.rootNode],t=>{let i=t.parent,o=!1;return t.visible=!0,(i||""===i)&&(o=e.nodeMap[i]),o}),J.recursive(e.nodeMap[e.rootNode].children,t=>{let e=!1;for(let i of t)i.visible=!0,i.children.length&&(e=(e||[]).concat(i.children));return e}),e.setTreeValues(t),e.axisRatio=e.xAxis.len/e.yAxis.len,e.nodeMap[""].pointValues=l={x:0,y:0,width:100,height:100},e.nodeMap[""].values=n=tB(l,{width:l.width*e.axisRatio,direction:"vertical"===i.layoutStartingDirection?0:1,val:t.val}),e.calculateChildrenAreas(t,n),e.colorAxis||i.colorByPoint||e.setColorRecursive(e.tree),i.allowTraversingTree&&r.pointValues&&(a=r.pointValues,e.xAxis.setExtremes(a.x,a.x+a.width,!1),e.yAxis.setExtremes(a.y,a.y+a.height,!1),e.xAxis.setScale(),e.yAxis.setScale()),e.setPointValues(),o&&e.applyTreeGrouping()}}tR.defaultOptions=tB(td.defaultOptions,X),ty(tR.prototype,{buildKDTree:ta,colorAttribs:V.seriesMembers.colorAttribs,colorKey:"colorValue",directTouch:!0,getExtremesFromAll:!0,getSymbol:ta,optionalAxis:"colorAxis",parallelArrays:["x","y","value","colorValue"],pointArrayMap:["value","colorValue"],pointClass:Z,NodeClass:class{constructor(){this.childrenTotal=0,this.visible=!1}init(t,e,i,o,s,r,l){return this.id=t,this.i=e,this.children=i,this.height=o,this.level=s,this.series=r,this.parent=l,this}},trackerGroups:["group","dataLabelsGroup"],utils:J}),V.compose(tR),G().registerSeriesType("treemap",tR);let tM=u();tM.Breadcrumbs=tM.Breadcrumbs||R,tM.Breadcrumbs.compose(tM.Chart,tM.defaultOptions),tR.compose(tM.Series);let tI=u();return d.default})());