/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/highcharts-tree@0.1.5-alpha.7/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},__assign.apply(this,arguments)},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});var Tree_1=__importDefault(require("./Tree")),SHAPE_OFFSET=3,NODE_WIDTH_OFFSET=2*SHAPE_OFFSET;exports.default=function(t){var e=t.version.split(".")[0],o=t.seriesType,n=t.seriesTypes,r=t.each,i=t.merge;o("tree","pie",{config:{horizontal:!0,disableToggle:!1,node:{width:200,height:0,marginX:20,marginY:20,textColor:"#454d59",backgroundColor:"#f2f2f2",backgroundColorToggle:"#cccccc",title:{marginTop:4,marginDown:4},padding:{x:1.5,y:1.5},content:{align:"left"},hover:{backgroundColor:"#d6d6d6",backgroundColorToggle:"#cccccc"},border:{width:3,color:"#919191"},dataFormatter:function(t){return t.toLocaleString()}},row:{height:20,line:2},tooltip:{enabled:!1,backgroundColor:"rgba(0,0,0,0.6)",borderRadius:"3px",textColor:"#fff",width:0,tooltipFormatter:function(t){return t.content.title+(t.content.data?"<br>"+t.content.data.join("<br>"):"")}},connector:{color:"#bcbcbc",width:4},legend:{enabled:!0,nodeWidth:20,marginX:10,marginY:25}}},{init:function(){var e=this;t.addEvent(t.Chart,"redraw",(function(t){t.target===e.chart&&(e._skipTranslate?e._skipTranslate=!1:(e._tree.build(),e.translate()))})),t.addEvent(t.Chart,"destroy",(function(o){var n=o.target;n===e.chart&&(t.removeEvent(n,"redraw"),t.removeEvent(n,"destroy"))})),n.pie.prototype.init.apply(this,arguments);var o=this.options.data;null!=o&&void 0!==o.tree&&null!==o.tree&&(this._config=i({},this.options.config,this.chart.userOptions.chart.config),this._tree=Tree_1.default.getTree({tree:this._tree,data:this.options.data.tree,horizontal:this._config.horizontal}))},translate:function(){var t=this,o=this.options.data,n=this.chart.renderer,i=this._config;i.node.height=i.node.height||this._treeComputedNodeHeight||0;var d=this.chart.options.colors,a=0,l=0,h=this._elements,s=n.styledMode?{titleCss:{},textCss:{},tooltipStr:{style:"",class:'class="highcharts-tree-node-tooltip-inner"'},tooltipAttr:{class:"highcharts-tree-node-tooltip"},boxAttr:{zIndex:0},connectorAttr:{class:"highcharts-tree-connector"}}:{titleCss:{pointerEvents:"none",fontSize:"14px",color:i.node.textColor,fontWeight:"bold",textAlign:"center"},textCss:{fontSize:"13px",color:i.node.textColor,textOverflow:"ellipsis",pointerEvents:"none"},tooltipStr:{style:"border-radius: "+i.tooltip.borderRadius+";\nbackground-color: "+i.tooltip.backgroundColor+";\ncolor: "+i.tooltip.textColor+";\nfont-size: 12px;\nwhite-space: initial;\nword-break: break-word;",class:""},tooltipAttr:{opacity:0},boxAttr:{zIndex:0,stroke:i.node.border.color,"stroke-width":i.node.border.width},connectorAttr:{"stroke-width":i.connector.width,stroke:i.connector.color}};h||(this._elements=h=[]);var c=function(o){var g={x:o.x*(i.node.width+i.node.marginX)+i.node.border.width/2,y:o.y*(i.node.height+i.node.marginY)+t._titleOffsetY,w:i.node.width,h:i.node.height},p=n.label(o.item.content.title,g.x+i.node.padding.x,g.y+i.node.padding.y+i.node.title.marginTop,"rect",void 0,void 0,void 0,void 0,"tree-node-title").attr({zIndex:1}).add();p.css(__assign({},s.titleCss,{width:g.w-NODE_WIDTH_OFFSET-2*i.node.padding.x,textOverflow:"ellipsis"})),p.attr({x:g.x+g.w/2-p.width/2}),h.push(p);var u=i.legend.enabled?i.legend.nodeWidth:0,f=p.height+i.node.title.marginTop+i.node.title.marginDown;if(o.item.content.data)for(var x=0;x<o.item.content.data.length;x++){i.legend.enabled&&h.push(n.rect(g.x+i.node.padding.x,g.y+f+i.row.height*x,i.legend.nodeWidth,i.row.height).css({pointerEvents:"none"}).attr(n.styledMode?{class:"highcharts-tree-legend-"+x,zIndex:1}:{fill:d[x],zIndex:1}));var w=i.node.dataFormatter(o.item.content.data[x],x),v=i.node.content.align,_=g.w-u-NODE_WIDTH_OFFSET-2*i.node.padding.x,b="center"===v?void 0:_,m=n.label(w,g.x+u+i.node.padding.x,g.y+f+i.row.height*x,"rect",void 0,void 0,void 0,void 0,"tree-node-data").attr({zIndex:1,width:b}).add();m.css(__assign({},s.textCss,{width:b})),"center"===v&&m.attr({x:g.x+g.w/2-m.width/2}),h.push(m)}var y=!1;if((void 0===i.node.height||null===i.node.height||i.node.height<1)&&(i.node.height=g.h=f+i.row.line*i.row.height+i.node.padding.y,t._treeComputedNodeHeight=i.node.height,y=!0),o===t._tree.root){var C=t.chart.userOptions.chart,T=C.width,k=C.height;if(!T||!k){var E=!1,O=t._tree.root.width*(i.node.width+i.node.marginX)+i.node.width+i.node.border.width,M=t._tree.root.height*(i.node.height+i.node.marginY)+i.node.height+i.legend.marginY+i.row.height+t._titleOffsetY;if(T||O===t.chart.chartWidth||(E=!0,t.chart.renderTo.style.width=O+"px"),k||M===t.chart.chartHeight||(E=!0,t.chart.renderTo.style.height=M+"px"),E)return y=!1,t._elements=h,t._skipTranslate=!0,t.chart.setSize(O,M,!1),!1}}if(y)return t.translate(),!1;var S=null;if(i.tooltip.enabled){var z=g.x+g.w,A=i.tooltip.width||g.w;z+A>t.chart.chartWidth&&(z=g.x-A);var F="\nmin-height: "+g.h+"px;\nmargin-left: -"+SHAPE_OFFSET+"px;\nmargin-top: -"+SHAPE_OFFSET+"px;\nwidth: "+A+"px;"+s.tooltipStr.style;S=n.label("<div\n"+s.tooltipStr.class+'\nstyle="'+F+'">'+i.tooltip.tooltipFormatter(o.item)+"</div>",z,g.y,"rect",void 0,void 0,!0).css({pointerEvents:"none"}).attr(__assign({},s.tooltipAttr,{zIndex:5})).add(),h.push(S)}var Y=n.rect(g.x,g.y,g.w,g.h,3).css({cursor:o.children.length<1?"default":"pointer"}).attr(__assign({},s.boxAttr,{id:o.item.id},n.styledMode?{class:"highcharts-tree-box"+(o.toggle?"":" fold")}:{fill:o.toggle?i.node.backgroundColor:i.node.backgroundColorToggle})).on("mouseover",(function(){n.styledMode?S&&S.attr({class:"highcharts-tree-node-tooltip hover"}):(e>5?Y.animate({fill:o.toggle?i.node.hover.backgroundColor:i.node.hover.backgroundColorToggle},{duration:300}):Y.attr({fill:o.toggle?i.node.hover.backgroundColor:i.node.hover.backgroundColorToggle}),S&&S.animate({opacity:1},{duration:300}))})).on("mouseout",(function(){n.styledMode?S&&S.attr({class:"highcharts-tree-node-tooltip"}):(e>5?Y.animate({fill:o.toggle?i.node.backgroundColor:i.node.backgroundColorToggle},{duration:300}):Y.attr({fill:o.toggle?i.node.backgroundColor:i.node.backgroundColorToggle}),S&&S.animate({opacity:0},{duration:300}))}));if(h.push(Y),o.children.length>0&&!i.disableToggle&&Y.on("click",(function(){o.toggle=!o.toggle,t._tree.build(),t.translate()})),null!=o.parent&&(i.horizontal?h.push(n.path(["M",g.x+g.w/2,g.y,"L",g.x+g.w/2,g.y-i.node.marginY/2-i.connector.width/2]).attr(s.connectorAttr)):h.push(n.path(["M",g.x,g.y+g.h/2,"L",g.x-i.node.marginX/2-i.connector.width/2,g.y+g.h/2]).attr(s.connectorAttr))),o.toggle){if(o.children.length>0)if(i.horizontal){var I={x:g.x+g.w/2,y:g.y+g.h};if(h.push(n.path(["M",I.x,I.y,"L",I.x,I.y+i.node.marginY/2]).attr(s.connectorAttr)),o.children.length>1){var W=i.node.width+i.node.marginX,D=I.y+i.node.marginY/2;h.push(n.path(["M",o.getRightMostChild().x*W+i.node.width/2-i.connector.width/2+i.node.border.width/2,D,"L",o.getLeftMostChild().x*W+i.node.width/2+i.connector.width/2+i.node.border.width/2,D]).attr(s.connectorAttr))}}else{var H={x:g.x+g.w,y:g.y+g.h/2};if(h.push(n.path(["M",H.x,H.y,"L",H.x+i.node.marginX/2,H.y]).attr(s.connectorAttr)),o.children.length>1){var L=i.node.height+i.node.marginY,X=H.x+i.node.marginX/2;h.push(n.path(["M",X,o.getRightMostChild().y*L+i.node.height/2-i.connector.width/2+i.node.border.width/2+t._titleOffsetY,"L",X,o.getLeftMostChild().y*L+i.node.height/2-i.connector.width/2+i.node.border.width/2+t._titleOffsetY]).attr(s.connectorAttr))}}r(o.children,c)}return a=Math.max(a,g.x+g.w),l=Math.max(l,g.y+g.h),!0};if(r(h,(function(t){t.destroy()})),this._elements=h=[],null==o||void 0===o.tree||null===o.tree)h.push(n.label("Invalid data.",0,0).css({fontSize:"14px",color:"#EE0000",fontWeight:"bold"}));else{if(this._titleOffsetY=0,this.chart.title){var g=this.chart.title.getBBox();this._titleOffsetY=g.y+g.height+this.chart.options.title.margin}if(!c(this._tree.root))return;if(i.legend.enabled)for(var p=o.legends||[],u=0,f=0;f<Math.min(p.length,i.row.line);f++){h.push(n.rect(u+i.legend.marginX,l+i.legend.marginY,i.legend.nodeWidth,i.row.height).attr(n.styledMode?{class:"highcharts-tree-legend-"+f}:{fill:d[f]})),u+=i.legend.nodeWidth+5;var x=n.label(p[f].text,u+i.legend.marginX,l+i.legend.marginY).css(n.styledMode?{}:{fontSize:"14px",color:i.node.textColor,fontWeight:"bold"}).attr(n.styledMode?{class:"highcharts-tree-legend-text",zIndex:1}:{zIndex:1}).add();h.push(x),u+=x.width+30}}r(h,(function(t){t.added||t.add()})),this._elements=h},animate:function(){},drawPoints:function(){},drawDataLabels:function(){}})};
//# sourceMappingURL=/sm/1d9900d46d4a19dd4e695820b3fba4de6ee85a5877511cb0ec1a6e3576562e72.map