UNPKG

highcharts

Version:
13 lines 21.6 kB
!/** * Highcharts JS v12.5.0 (2026-01-12) * Treegraph chart series type * @module highcharts/modules/treegraph * @requires highcharts * @requires highcharts/modules/treemap * * (c) 2010-2026 Highsoft AS * Author: Pawel Lysy Grzegorz Blachlinski * * A commercial license may be required depending on use. * See www.highcharts.com/license */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.SVGRenderer,t._Highcharts.Point,t._Highcharts.Color,t._Highcharts.SVGElement):"function"==typeof define&&define.amd?define("highcharts/modules/treegraph",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry,t.SVGRenderer,t.Point,t.Color,t.SVGElement)}):"object"==typeof exports?exports["highcharts/modules/treegraph"]=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.SVGRenderer,t._Highcharts.Point,t._Highcharts.Color,t._Highcharts.SVGElement):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry,t.Highcharts.SVGRenderer,t.Highcharts.Point,t.Highcharts.Color,t.Highcharts.SVGElement)}("u"<typeof window?this:window,(t,e,i,o,s,l)=>(()=>{"use strict";var r={28:t=>{t.exports=l},260:t=>{t.exports=o},512:t=>{t.exports=e},540:t=>{t.exports=i},620:t=>{t.exports=s},944:e=>{e.exports=t}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={exports:{}};return r[t](i,i.exports,a),i.exports}a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var h={};a.d(h,{default:()=>tu});var d=a(944),p=a.n(d);function c(t){let{x1:e,y1:i,x2:o,y2:s,bendAt:l,width:r=0,inverted:n=!1,radius:a,parentVisible:h}=t;if(h){let t=l??r/2;return f([["M",e,i],["L",e+t*(n?-1:1),i],["L",e+t*(n?-1:1),s],["L",o,s]],a)}return[["M",e,i],["L",e,i],["C",e,i,e,s,e,s],["L",e,s],["C",e,i,e,s,e,s],["L",e,s]]}function f(t,e){let i=[];for(let o=0;o<t.length;o++){let s=t[o][1],l=t[o][2];if("number"==typeof s&&"number"==typeof l)if(0===o)i.push(["M",s,l]);else if(o===t.length-1)i.push(["L",s,l]);else if(e){let r=t[o-1],n=t[o+1];if(r&&n){let t=r[1],o=r[2],a=n[1],h=n[2];if("number"==typeof t&&"number"==typeof a&&"number"==typeof o&&"number"==typeof h&&t!==a&&o!==h){let r=t<a?1:-1,n=o<h?1:-1;i.push(["L",s-r*Math.min(Math.abs(s-t),e),l-n*Math.min(Math.abs(l-o),e)],["C",s,l,s,l,s+r*Math.min(Math.abs(s-a),e),l+n*Math.min(Math.abs(l-h),e)])}}}else i.push(["L",s,l])}return i}var u=a(512),g=a.n(u),v=a(540),b=a.n(v);let{seriesTypes:{treemap:{prototype:{NodeClass:m}}}}=g(),y=class extends m{constructor(){super(...arguments),this.mod=0,this.shift=0,this.change=0,this.children=[],this.preX=0,this.hidden=!1,this.wasVisited=!1,this.collapsed=!1}nextLeft(){return this.getLeftMostChild()||this.thread}nextRight(){return this.getRightMostChild()||this.thread}getAncestor(t,e){return t.ancestor.children[0]===this.children[0]?t.ancestor:e}getLeftMostSibling(){let t=this.getParent();if(t){for(let e of t.children)if(e&&e.point.visible)return e}}hasChildren(){let t=this.children;for(let e=0;e<t.length;e++)if(t[e].point.visible)return!0;return!1}getLeftSibling(){let t=this.getParent();if(t){let e=t.children;for(let t=this.relativeXPosition-1;t>=0;t--)if(e[t]&&e[t].point.visible)return e[t]}}getLeftMostChild(){let t=this.children;for(let e=0;e<t.length;e++)if(t[e].point.visible)return t[e]}getRightMostChild(){let t=this.children;for(let e=t.length-1;e>=0;e--)if(t[e].point.visible)return t[e]}getParent(){return this.parentNode}getFirstChild(){let t=this.children;for(let e=0;e<t.length;e++)if(t[e].point.visible)return t[e]}};var x=a(260),k=a.n(x);let{seriesTypes:{treemap:{prototype:{pointClass:L}}}}=g(),{addEvent:P,fireEvent:C,merge:T}=p();class M extends L{constructor(){super(...arguments),this.dataLabelOnHidden=!0,this.isLink=!1,this.setState=k().prototype.setState}draw(){super.draw.apply(this,arguments);let t=this.graphic;t&&t.animate({visibility:this.visible?"inherit":"hidden"}),this.renderCollapseButton()}renderCollapseButton(){let t=this.series,e=this.graphic&&this.graphic.parentGroup,i=t.mapOptionsToLevel[this.node.level||0]||{},o=T(t.options.collapseButton,i.collapseButton,this.options.collapseButton),{width:s,height:l,shape:r,style:n}=o,a=this.series.chart,h=this.visible&&(this.collapsed||!o.onlyOnHover||"hover"===this.state)?1:0;if(this.shapeArgs)if(this.collapseButtonOptions=o,this.collapseButton)if(this.node.children.length&&o.enabled){let{x:t,y:e}=this.getCollapseBtnPosition(o);this.collapseButton.attr({text:this.collapsed?"+":"-",rotation:90*!!a.inverted,rotationOriginX:s/2,rotationOriginY:l/2,visibility:this.visible?"inherit":"hidden"}).animate({x:t,y:e,opacity:h})}else this.collapseButton.destroy(),delete this.collapseButton;else{if(!this.node.children.length||!o.enabled)return;let{x:t,y:i}=this.getCollapseBtnPosition(o),d=o.fillColor||this.color||"#cccccc";this.collapseButton=a.renderer.label(this.collapsed?"+":"-",t,i,r).attr({height:l-4,width:s-4,padding:2,fill:d,rotation:90*!!a.inverted,rotationOriginX:s/2,rotationOriginY:l/2,stroke:o.lineColor||"#ffffff","stroke-width":o.lineWidth,"text-align":"center",align:"center",zIndex:1,opacity:h,visibility:this.visible?"inherit":"hidden"}).addClass("highcharts-tracker").addClass("highcharts-collapse-button").removeClass("highcharts-no-tooltip").css(T({color:"string"==typeof d?a.renderer.getContrast(d):"#333333"},n)).add(e),this.collapseButton.element.point=this}}toggleCollapse(t){let e=this.series;this.update({collapsed:t??!this.collapsed},!1,void 0,!1),C(e,"toggleCollapse"),e.redraw()}destroy(){this.collapseButton&&(this.collapseButton.destroy(),delete this.collapseButton,this.collapseButton=void 0),this.linkToParent&&(this.linkToParent.destroy(),delete this.linkToParent),super.destroy.apply(this,arguments)}getCollapseBtnPosition(t){let e=this.series.chart.inverted,i=t.width,o=t.height,{x:s=0,y:l=0,width:r=0,height:n=0}=this.shapeArgs||{};return{x:s+t.x+(e?-(.3*o):r+-.3*i),y:l+n/2-o/2+t.y}}}P(M,"mouseOut",function(){let t=this.collapseButton,e=this.collapseButtonOptions;t&&e?.onlyOnHover&&!this.collapsed&&t.animate({opacity:0})}),P(M,"mouseOver",function(){this.collapseButton&&this.visible&&this.collapseButton.animate({opacity:1},this.series.options.states?.hover?.animation)}),P(M,"click",function(){this.toggleCollapse()});var O=a(620),S=a.n(O);let{extend:X,isArray:N,isNumber:w,isObject:B,merge:A,pick:R,relativeLength:H}=p(),W={getColor:function(t,e){let i,o,s,l,r,n,a=e.index,h=e.mapOptionsToLevel,d=e.parentColor,p=e.parentColorIndex,c=e.series,f=e.colors,u=e.siblings,g=c.points,v=c.chart.options.chart;if(t){let b;i=g[t.i],o=h[t.level]||{},i&&o.colorByPoint&&(l=i.index%(f?f.length:v.colorCount),s=f&&f[l]),c.chart.styledMode||(r=R(i&&i.options.color,o&&o.color,s,d&&((b=o&&o.colorVariation)&&"brightness"===b.key&&a&&u?S().parse(d).brighten(b.to*(a/u)).get():d),c.color)),n=R(i&&i.options.colorIndex,o&&o.colorIndex,l,p,e.colorIndex)}return{color:r,colorIndex:n}},getLevelOptions:function(t){let e,i,o,s,l,r,n={};if(B(t))for(s=w(t.from)?t.from:1,r=t.levels,i={},e=B(t.defaults)?t.defaults:{},N(r)&&(i=r.reduce((t,i)=>{let o,l,r;return B(i)&&w(i.level)&&(l=R((r=A({},i)).levelIsConstant,e.levelIsConstant),delete r.levelIsConstant,delete r.level,B(t[o=i.level+(l?0:s-1)])?A(!0,t[o],r):t[o]=r),t},{})),l=w(t.to)?t.to:1,o=0;o<=l;o++)n[o]=A({},e,B(i[o])?i[o]:{});return n},getNodeWidth:function(t,e){let{chart:i,options:o}=t,{nodeDistance:s=0,nodeWidth:l=0}=o,{plotSizeX:r=1}=i;if("auto"===l){if("string"==typeof s&&/%$/.test(s))return r/(e+parseFloat(s)/100*(e-1));let t=Number(s);return(r+t)/(e||1)-t}return H(l,r)},setTreeValues:function t(e,i){let o=i.before,s=i.idRoot,l=i.mapIdToNode[s],r=!1!==i.levelIsConstant,n=i.points[e.i],a=n&&n.options||{},h=[],d=0;e.levelDynamic=e.level-(r?0:l.level),e.name=R(n&&n.name,""),e.visible=s===e.id||!0===i.visible,"function"==typeof o&&(e=o(e,i)),e.children.forEach((o,s)=>{let l=X({},i);X(l,{index:s,siblings:e.children.length,visible:e.visible}),o=t(o,l),h.push(o),o.visible&&(d+=o.val)});let p=R(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 B(t)&&(i=B(t.options)?t.options:{},e=R(t.rootNode,i.rootId,""),B(t.userOptions)&&(t.userOptions.rootId=e),t.rootNode=e),e}},{pick:I,extend:V}=p(),{seriesTypes:{column:{prototype:{pointClass:_}}}}=g(),D=class extends _{constructor(t,e,i,o){super(t,e,i),this.dataLabelOnNull=!0,this.formatPrefix="link",this.isLink=!0,this.node={},this.formatPrefix="link",this.dataLabelOnNull=!0,o&&(this.fromNode=o.node.parentNode.point,this.visible=o.visible,this.toNode=o,this.id=this.toNode.id+"-"+this.fromNode.id)}update(t,e,i,o){let s={id:this.id,formatPrefix:this.formatPrefix};k().prototype.update.call(this,t,!this.isLink&&e,i,o),this.visible=this.toNode.visible,V(this,s),I(e,!0)&&this.series.chart.redraw(i)}};class E{static createDummyNode(t,e,i){let o=new y;return o.id=t.id+"-"+i,o.ancestor=t,o.children.push(e),o.parent=t.id,o.parentNode=t,o.point=e.point,o.level=e.level-i,o.relativeXPosition=e.relativeXPosition,o.visible=e.visible,t.children[e.relativeXPosition]=o,e.oldParentNode=t,e.relativeXPosition=0,e.parentNode=o,e.parent=o.id,o}calculatePositions(t){let e=t.nodeList;this.resetValues(e);let i=t.tree;i&&(this.calculateRelativeX(i,0),this.beforeLayout(e),this.firstWalk(i),this.secondWalk(i,-i.preX),this.afterLayout(e))}beforeLayout(t){for(let e of t)for(let t of e.children)if(t&&t.level-e.level>1){let i=t.level-e.level-1;for(;i>0;)t=E.createDummyNode(e,t,i),i--}}resetValues(t){for(let e of t)e.mod=0,e.ancestor=e,e.shift=0,e.thread=void 0,e.change=0,e.preX=0}calculateRelativeX(t,e){let i=t.children;for(let t=0,e=i.length;t<e;++t)this.calculateRelativeX(i[t],t);t.relativeXPosition=e}firstWalk(t){let e;if(t.hasChildren()){let i=t.getLeftMostChild();for(let e of t.children)this.firstWalk(e),i=this.apportion(e,i);this.executeShifts(t);let o=t.getLeftMostChild(),s=t.getRightMostChild(),l=(o.preX+s.preX)/2;(e=t.getLeftSibling())?(t.preX=e.preX+1,t.mod=t.preX-l):t.preX=l}else(e=t.getLeftSibling())?(t.preX=e.preX+1,t.mod=t.preX):t.preX=0}secondWalk(t,e){for(let i of(t.yPosition=t.preX+e,t.xPosition=t.point?.x??t.level,t.children))this.secondWalk(i,e+t.mod)}executeShifts(t){let e=0,i=0;for(let o=t.children.length-1;o>=0;o--){let s=t.children[o];s.preX+=e,s.mod+=e,i+=s.change,e+=s.shift+i}}apportion(t,e){let i=t.getLeftSibling();if(i){let o=t,s=t,l=i,r=o.getLeftMostSibling(),n=o.mod,a=s.mod,h=l.mod,d=r.mod;for(;l&&l.nextRight()&&o&&o.nextLeft();){l=l.nextRight(),r=r.nextLeft(),o=o.nextLeft(),(s=s.nextRight()).ancestor=t;let i=l.preX+h-(o.preX+n)+1;i>0&&(this.moveSubtree(t.getAncestor(l,e),t,i),n+=i,a+=i),h+=l.mod,n+=o.mod,d+=r.mod,a+=s.mod}l&&l.nextRight()&&!s.nextRight()&&(s.thread=l.nextRight(),s.mod+=h-a),o&&o.nextLeft()&&!r.nextLeft()&&(r.thread=o.nextLeft(),r.mod+=n-d),e=t}return e}moveSubtree(t,e,i){let o=e.relativeXPosition-t.relativeXPosition;e.change-=i/o,e.shift+=i,e.preX+=i,e.mod+=i,t.change+=i/o}afterLayout(t){for(let e of t)e.oldParentNode&&(e.relativeXPosition=e.parentNode.relativeXPosition,e.parent=e.oldParentNode.parent,e.parentNode=e.oldParentNode,e.oldParentNode.children.splice(e.relativeXPosition,1,e),e.oldParentNode=void 0)}}var z=a(28),Y=a.n(z);let{deg2rad:G}=p(),{addEvent:F,merge:j,uniqueKey:$,defined:q,extend:U}=p();function J(t,e){e=j(!0,{enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);let i=this.renderer.url,o=this.text||this,s=o.textPath,{attributes:l,enabled:r}=e;if(t=t||s&&s.path,s&&s.undo(),t&&r){let e=F(o,"afterModifyTree",e=>{if(t&&r){let s=t.attr("id");s||t.attr("id",s=$());let r={x:0,y:0};q(l.dx)&&(r.dx=l.dx,delete l.dx),q(l.dy)&&(r.dy=l.dy,delete l.dy),o.attr(r),this.attr({transform:""}),this.box&&(this.box=this.box.destroy());let n=e.nodes.slice(0);e.nodes.length=0,e.nodes[0]={tagName:"textPath",attributes:U(l,{"text-anchor":l.textAnchor,href:`${i}#${s}`}),children:n}}});o.textPath={path:t,undo:e}}else o.attr({dx:0,dy:0}),delete o.textPath;return this.added&&(o.textCache="",this.renderer.buildText(o)),this}function K(t){let e=t.bBox,i=this.element?.querySelector("textPath");if(i){let t=[],{b:o,h:s}=this.renderer.fontMetrics(this.element),l=s-o,r=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),n=i.innerHTML.replace(r,"").split(/<tspan class="highcharts-br"[^>]*>/),a=n.length,h=(t,e)=>{let{x:s,y:r}=e,n=(i.getRotationOfChar(t)-90)*G,a=Math.cos(n),h=Math.sin(n);return[[s-l*a,r-l*h],[s+o*a,r+o*h]]};for(let e=0,o=0;o<a;o++){let s=n[o].length;for(let l=0;l<s;l+=5)try{let s=e+l+o,[r,n]=h(s,i.getStartPositionOfChar(s));0===l?(t.push(n),t.push(r)):(0===o&&t.unshift(n),o===a-1&&t.push(r))}catch{break}e+=s-1;try{let s=e+o,l=i.getEndPositionOfChar(s),[r,n]=h(s,l);t.unshift(n),t.unshift(r)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}function Q(t){let e=t.labelOptions,i=t.point,o=e[i.formatPrefix+"TextPath"]||e.textPath;o&&!e.useHTML&&(this.setTextPath(i.getDataLabelPath?.(this)||i.graphic,o),i.dataLabelPath&&!o.enabled&&(i.dataLabelPath=i.dataLabelPath.destroy()))}let{getLinkPath:Z}={applyRadius:f,getLinkPath:{default:c,orthogonal:c,straight:function(t){let{x1:e,y1:i,x2:o,y2:s,width:l=0,inverted:r=!1,parentVisible:n}=t;return n?[["M",e,i],["L",e+l*(r?-1:1),s],["L",o,s]]:[["M",e,i],["L",e,s],["L",e,s]]},curved:function(t){let{x1:e,y1:i,x2:o,y2:s,offset:l=0,width:r=0,inverted:n=!1,parentVisible:a}=t;return a?[["M",e,i],["C",e+l,i,e-l+r*(n?-1:1),s,e+r*(n?-1:1),s],["L",o,s]]:[["M",e,i],["C",e,i,e,s,e,s],["L",o,s]]}}},{series:{prototype:tt},seriesTypes:{treemap:te,column:ti}}=g(),{prototype:{symbols:to}}=b(),{getLevelOptions:ts,getNodeWidth:tl}=W,{arrayMax:tr,crisp:tn,extend:ta,merge:th,pick:td,relativeLength:tp,splat:tc}=p();({compose:function(t){F(t,"afterGetBBox",K),F(t,"beforeAddingDataLabel",Q);let e=t.prototype;e.setTextPath||(e.setTextPath=J)}}).compose(Y());class tf extends te{constructor(){super(...arguments),this.nodeList=[],this.links=[]}init(){super.init.apply(this,arguments),this.layoutAlgorythm=new E;let t=this,e=this.chart.labelCollectors;e.some(t=>"collectorFunc"===t.name)||e.push(function(){let e=[];if(t.options.dataLabels&&!tc(t.options.dataLabels)[0].allowOverlap)for(let i of t.links||[])i.dataLabel&&e.push(i.dataLabel);return e})}getLayoutModifiers(){let t=this.chart,e=this,i=t.plotSizeX,o=t.plotSizeY,s=e.options.link?.lineWidth||0,l=tr(this.points.map(t=>t.node.xPosition)),r=1/0,n=-1/0,a=1/0,h=-1/0,d=0,p=0,c=0,f=0;this.points.forEach(t=>{if(this.options.fillSpace&&!t.visible)return;let u=t.node,g=e.mapOptionsToLevel[t.node.level]||{},v=th(this.options.marker,g.marker,t.options.marker),b=v.width??tl(this,l),m=tp(v.radius||0,Math.min(i,o)),y=Math.max(v.lineWidth||0,s),x=v.symbol,k="circle"!==x&&v.height?tp(v.height,o):2*m,L="circle"!==x&&b?tp(b,i):2*m;u.nodeSizeX=L,u.nodeSizeY=k,u.xPosition<=r&&(r=u.xPosition,p=Math.max(L+y,p)),u.xPosition>=n&&(n=u.xPosition,d=Math.max(L+y,d)),u.yPosition<=a&&(a=u.yPosition,f=Math.max(k+y,f)),u.yPosition>=h&&(h=u.yPosition,c=Math.max(k+y,c))});let u=h===a?1:(o-(f+c)/2)/(h-a),g=h===a?o/2:-u*a+f/2,v=n===r?1:(i-(d+d)/2)/(n-r),b=n===r?i/2:-v*r+p/2;return{ax:v,bx:b,ay:u,by:g}}getLinks(){let t=this,e=[];return this.data.forEach(i=>{let o=t.mapOptionsToLevel[i.node.level??0]||{};if(i.node.parent){let s=th(o,i.options);if(!i.linkToParent||i.linkToParent.destroyed){let e=new t.LinkClass(t,s,void 0,i);i.linkToParent=e}else i.collapsed=td(i.collapsed,(this.mapOptionsToLevel[i.node.level]||{}).collapsed),i.linkToParent.visible=i.linkToParent.toNode.visible;i.linkToParent.index=e.push(i.linkToParent)-1}else i.linkToParent&&(t.links.splice(i.linkToParent.index),i.linkToParent.destroy(),delete i.linkToParent)}),e}buildTree(t,e,i,o,s){let l=this.points[e];return i=l?.level??i,super.buildTree.call(this,t,e,i,o,s)}markerAttribs(){return{}}setCollapsedStatus(t,e){let i=t.point;i&&(i.collapsed=td(i.collapsed,(this.mapOptionsToLevel[t.level]||{}).collapsed),i.visible=e,e=!1!==e&&!i.collapsed),t.children.forEach(t=>{this.setCollapsedStatus(t,e)})}drawTracker(){ti.prototype.drawTracker.apply(this,arguments),ti.prototype.drawTracker.call(this,this.links)}translate(){let t=this.options,e=W.updateRootId(this),i;tt.translate.call(this);let o=this.tree=this.getTree();i=this.nodeMap[e],""===e||i&&i.children.length||(this.setRootNode("",!1),e=this.rootNode,i=this.nodeMap[e]),this.mapOptionsToLevel=ts({from:i.level+1,levels:t.levels,to:o.height,defaults:{levelIsConstant:this.options.levelIsConstant,colorByPoint:t.colorByPoint}}),this.setCollapsedStatus(o,!0),this.links=this.getLinks(),this.setTreeValues(o),this.layoutAlgorythm.calculatePositions(this),this.layoutModifier=this.getLayoutModifiers(),this.points.forEach(t=>{this.translateNode(t)}),this.points.forEach(t=>{t.linkToParent&&this.translateLink(t.linkToParent)}),t.colorByPoint||this.setColorRecursive(this.tree)}translateLink(t){let e=t.fromNode,i=t.toNode,o=this.options.link?.lineWidth||0,s=td(this.options.link?.curveFactor,.5),l=i.x!==i.node.level||e.x!==e.node.level,r=td(t.options.link?.type,this.options.link?.type,"default");if(e.shapeArgs&&i.shapeArgs){let n=e.shapeArgs.width||0,a=this.chart.inverted,h=tn((e.shapeArgs.y||0)+(e.shapeArgs.height||0)/2,o),d=tn((i.shapeArgs.y||0)+(i.shapeArgs.height||0)/2,o),p=tn((e.shapeArgs.x||0)+n,o),c=tn(i.shapeArgs.x||0,o);a&&(p-=Math.round(n),c+=Math.round(i.shapeArgs.width||0));let f=i.node.xPosition-e.node.xPosition,u=Math.abs(c-p)+n,g=(l?u:u/f)-n,v=tn((c+p)/2,o),b=tp(t.options.link?.bendAt??this.options.link?.bendAt??"50%",u-n);t.shapeType="path",t.plotX=v,t.plotY=d,t.shapeArgs={d:Z[r]({x1:p,y1:h,x2:c,y2:d,width:g,offset:g*s*(a?-1:1),inverted:a,parentVisible:i.visible,radius:this.options.link?.radius,bendAt:b})},t.dlBox={x:(p+c)/2,y:(h+d)/2,height:o,width:0},t.tooltipPos=a?[(this.chart.plotSizeY||0)-t.dlBox.y,(this.chart.plotSizeX||0)-t.dlBox.x]:[t.dlBox.x,t.dlBox.y]}}drawNodeLabels(t){let e,i,o=this.mapOptionsToLevel;for(let s of t){if(i=o[s.node.level],e={style:{}},i&&i.dataLabels&&(e=th(e,i.dataLabels),this.hasDataLabels=()=>!0),s.shapeArgs&&this.options.dataLabels){let t={},{width:i=0,height:o=0}=s.shapeArgs;this.chart.inverted&&([i,o]=[o,i]),tc(this.options.dataLabels)[0].style?.width||(t.width=`${i}px`),tc(this.options.dataLabels)[0].style?.lineClamp||(t.lineClamp=Math.floor(o/16)),ta(e.style,t),s.dataLabel?.css(t)}s.dlOptions=th(e,s.options.dataLabels)}tt.drawDataLabels.call(this,t)}alignDataLabel(t,e){let i=t.visible;t.visible=!0,super.alignDataLabel.apply(this,arguments),e.animate({opacity:+(!1!==i)},void 0,function(){i||e.hide()}),t.visible=i}drawDataLabels(){this.options.dataLabels&&(this.options.dataLabels=tc(this.options.dataLabels),this.drawNodeLabels(this.points),tt.drawDataLabels.call(this,this.links))}destroy(){if(this.links){for(let t of this.links)t.destroy();this.links.length=0}return tt.destroy.apply(this,arguments)}pointAttribs(t,e){let i=t&&this.mapOptionsToLevel[t.node.level??0]||{},o=t&&t.options,s=i.states&&i.states[e]||{};t&&(t.options.marker=th(this.options.marker,i.marker,t.options.marker));let l=td(s&&s.link&&s.link.color,o&&o.link&&o.link.color,i&&i.link&&i.link.color,this.options.link&&this.options.link.color),r=td(s&&s.link&&s.link.lineWidth,o&&o.link&&o.link.lineWidth,i&&i.link&&i.link.lineWidth,this.options.link&&this.options.link.lineWidth),n=tt.pointAttribs.call(this,t,e);return t&&(t.isLink&&(n.stroke=l,n["stroke-width"]=r,delete n.fill),t.visible||(n.opacity=0)),n}drawPoints(){te.prototype.drawPoints.apply(this,arguments),ti.prototype.drawPoints.call(this,this.links)}translateNode(t){let e=this.chart,{node:i,plotX:o=0}=t,s=e.plotSizeY,l=e.plotSizeX,{ax:r,bx:n,ay:a,by:h}=this.layoutModifier,d=this.isCartesian?e.inverted?l-o:o:r*i.xPosition+n,p=a*i.yPosition+h,c=this.mapOptionsToLevel[i.level]||{},f=th(this.options.marker,c.marker,t.options.marker).symbol,u=i.nodeSizeY,g=i.nodeSizeX,v=this.options.reversed,b=i.x=e.inverted?l-g/2-d:d-g/2,m=i.y=v?p-u/2:s-p-u/2,y=td(t.options.borderRadius,c.borderRadius,this.options.borderRadius),x=to[f||"circle"];if(void 0===x?(t.hasImage=!0,t.shapeType="image",t.imageUrl=f.match(/^url\((.*?)\)$/)[1]):t.shapeType="path",!t.visible&&t.linkToParent){let e=t.linkToParent.fromNode;if(e){let{x:i=0,y:o=0,width:s=0,height:l=0}=e.shapeArgs||{};t.shapeArgs||(t.shapeArgs={}),t.hasImage||ta(t.shapeArgs,{d:x(i,o,s,l,y?{r:y}:void 0)}),ta(t.shapeArgs,{x:i,y:o}),t.plotX=e.plotX,t.plotY=e.plotY}}else t.plotX=b,t.plotY=m,t.shapeArgs={x:b,y:m,width:g,height:u,cursor:t.node.isLeaf?"default":"pointer"},t.hasImage||(t.shapeArgs.d=x(b,m,g,u,y?{r:y}:void 0));t.tooltipPos=e.inverted?[s-m-u/2,l-b-g/2]:[b+g/2,m]}}tf.defaultOptions=th(te.defaultOptions,{reversed:!1,marker:{radius:10,lineWidth:0,symbol:"circle",fillOpacity:1,states:{}},link:{color:"#666666",lineWidth:1,radius:10,cursor:"default",type:"curved"},collapseButton:{onlyOnHover:!0,enabled:!0,lineWidth:1,x:0,y:0,height:18,width:18,shape:"circle",style:{cursor:"pointer",fontWeight:"bold",fontSize:"1em"}},fillSpace:!1,tooltip:{linkFormat:"{point.fromNode.id} → {point.toNode.id}",pointFormat:"{point.id}"},dataLabels:{defer:!0,linkTextPath:{attributes:{startOffset:"50%"}},enabled:!0,linkFormatter:()=>"",pointFormat:void 0,padding:5,style:{textOverflow:"none"}},nodeDistance:30,nodeWidth:void 0}),ta(tf.prototype,{forceDL:!0,pointClass:M,NodeClass:y,LinkClass:D,isCartesian:!1}),g().registerSeriesType("treegraph",tf);let tu=p();return h.default})());