billboard.js 3.18.0-next.1 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +650 -199
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +10 -9
- package/dist/billboard.pkgd.js +2390 -1724
- package/dist/billboard.pkgd.min.js +22 -21
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +352 -36
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +352 -36
- package/dist/plugin/billboardjs-plugin-stanford.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-tableview.js +352 -36
- package/dist/plugin/billboardjs-plugin-tableview.min.js +6 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +352 -36
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1743 -1528
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2094 -1563
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2095 -1564
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2096 -1565
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2097 -1566
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/billboard.js +889 -242
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +420 -28
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +16 -16
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/convert.ts +8 -7
- package/src/ChartInternal/data/data.ts +38 -3
- package/src/ChartInternal/interactions/drag.ts +53 -42
- package/src/ChartInternal/interactions/zoom.ts +23 -19
- package/src/ChartInternal/internals/color.ts +4 -4
- package/src/ChartInternal/internals/domain.ts +9 -4
- package/src/ChartInternal/internals/format.ts +3 -3
- package/src/ChartInternal/internals/grid.ts +10 -10
- package/src/ChartInternal/internals/legend.ts +78 -17
- package/src/ChartInternal/internals/text.ts +37 -8
- package/src/ChartInternal/internals/text.util.ts +19 -0
- package/src/ChartInternal/internals/title.ts +3 -3
- package/src/ChartInternal/internals/tooltip.ts +11 -9
- package/src/ChartInternal/shape/arc.ts +15 -15
- package/src/ChartInternal/shape/bar.ts +5 -4
- package/src/ChartInternal/shape/funnel.ts +17 -17
- package/src/ChartInternal/shape/line.ts +5 -6
- package/src/ChartInternal/shape/point.common.ts +23 -5
- package/src/ChartInternal/shape/radar.ts +2 -2
- package/src/ChartInternal/shape/shape.ts +21 -3
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/legend.ts +2 -0
- package/src/config/Options/common/point.ts +1 -0
- package/src/config/Options/common/tooltip.ts +4 -1
- package/src/config/Store/State.ts +11 -1
- package/src/module/Cache.ts +26 -1
- package/src/module/sanitize.ts +471 -0
- package/src/module/util.ts +192 -131
package/dist/billboard.min.js
CHANGED
|
@@ -5,29 +5,30 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.18.0
|
|
9
|
-
*/(function(gt,Jt){if(typeof exports=="object"&&typeof module=="object")module.exports=Jt(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if(typeof define=="function"&&define.amd)define(["d3-axis","d3-brush","d3-drag","d3-dsv","d3-ease","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],Jt);else{var _e=typeof exports=="object"?Jt(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):Jt(gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3);for(var me in _e)(typeof exports=="object"?exports:gt)[me]=_e[me]}})(this,function(es,gt,Jt,_e,me,Zi,qi,Ki,Ji,Qi,tn,en,sn){return(function(){"use strict";var nn=[,,(function(z){z.exports=Ji}),(function(z){z.exports=tn}),(function(z){z.exports=gt}),(function(z){z.exports=_e}),(function(z){z.exports=Jt}),(function(z){z.exports=Ki}),(function(z){z.exports=en}),(function(z){z.exports=Qi}),(function(z){z.exports=sn}),(function(z){z.exports=es}),(function(z){z.exports=me}),(function(z){z.exports=qi}),(function(z){z.exports=Zi})],ss={};function Z(z){var mt=ss[z];if(mt!==void 0)return mt.exports;var R=ss[z]={exports:{}};return nn[z](R,R.exports,Z),R.exports}(function(){Z.d=function(z,mt){for(var R in mt)Z.o(mt,R)&&!Z.o(z,R)&&Object.defineProperty(z,R,{enumerable:!0,get:mt[R]})}})(),(function(){Z.o=function(z,mt){return Object.prototype.hasOwnProperty.call(z,mt)}})(),(function(){Z.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})}})();var Oe={};return(function(){Z.r(Oe),Z.d(Oe,{bb:function(){return Wi},default:function(){return Wi}});var z={};Z.r(z),Z.d(z,{selection:function(){return js},subchart:function(){return Hs},zoom:function(){return Ws}});var mt={};Z.r(mt),Z.d(mt,{area:function(){return Ri},areaLineRange:function(){return Ci},areaSpline:function(){return Li},areaSplineRange:function(){return ki},areaStep:function(){return Pi},areaStepRange:function(){return Ei},bar:function(){return Ni},bubble:function(){return Gi},candlestick:function(){return Vi},donut:function(){return zi},funnel:function(){return ji},gauge:function(){return Fi},line:function(){return Oi},pie:function(){return Mi},polar:function(){return Xi},radar:function(){return Bi},scatter:function(){return Yi},spline:function(){return Ii},step:function(){return Di},treemap:function(){return Hi}});var R=Z(2),ye=Z(3),an=Object.defineProperty,is=Object.getOwnPropertySymbols,on=Object.prototype.hasOwnProperty,rn=Object.prototype.propertyIsEnumerable,ns=(e,t,s)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,q=(e,t)=>{for(var s in t||(t={}))on.call(t,s)&&ns(e,s,t[s]);if(is)for(var s of is(t))rn.call(t,s)&&ns(e,s,t[s]);return e};const D={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},X={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},$e={area:"bb-area",areas:"bb-areas"},ot={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},yt={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},Lt={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},ft={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Ie={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Gt={dragarea:"bb-dragarea",INCLUDED:"_included_"},ue={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},$t={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},H={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},kt={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},St={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},K={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},st={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},zt={level:"bb-level",levels:"bb-levels"},as={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},he={region:"bb-region",regions:"bb-regions"},Q={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},it={shape:"bb-shape",shapes:"bb-shapes"},os={brush:"bb-brush",subchart:"bb-subchart"},rt={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},be={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},rs={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},De={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var G=q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q({},D),X),$e),ot),yt),Lt),ft),Ie),Gt),$t),H),kt),St),K),ue),st),as),he),Q),it),os),rt),be),rs),De),ln={boost_useCssRule:!1,boost_useWorker:!1},cn={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},dn={legend_contents_bindto:void 0,legend_contents_template:"<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_format:void 0,legend_padding:0,legend_position:"bottom",legend_show:!0,legend_tooltip:!1,legend_usePoint:!1},un={bindto:"#chart",background:{},clipPath:!0,svg_classname:void 0,size_width:void 0,size_height:void 0,padding:!0,padding_mode:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,resize_auto:!0,resize_timer:!0,onclick:void 0,onover:void 0,onout:void 0,onresize:void 0,onresized:void 0,onbeforeinit:void 0,oninit:void 0,onafterinit:void 0,onrendered:void 0,transition_duration:250,plugins:[],render:{},regions:[]},hn={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},gn={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:void 0,tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:()=>{},tooltip_onhide:()=>{},tooltip_onshown:()=>{},tooltip_onhidden:()=>{},tooltip_order:null},fn={data_x:void 0,data_idConverter:e=>e,data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_groupsZeroAs:"positive",data_color:void 0,data_colors:{},data_labels:{},data_labels_backgroundColors:void 0,data_labels_colors:void 0,data_labels_position:{},data_labels_imgUrl:void 0,data_hide:!1,data_filter:void 0,data_onclick:()=>{},data_onover:()=>{},data_onout:()=>{},data_onshown:void 0,data_onhidden:void 0,data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},pn={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},ve=Z(4);function xn(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof global=="object"&&global!==null&&global.Object===Object&&global||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function _n(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",s=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",i=a=>setTimeout(a,1),n=a=>clearTimeout(a);return[t?e.requestAnimationFrame:i,t?e.cancelAnimationFrame:n,s?e.requestIdleCallback:i,s?e.cancelIdleCallback:n]}const j=xn(),lt=j==null?void 0:j.document,[mn,il,ls,nl]=_n(j);var yn=Object.defineProperty,cs=Object.getOwnPropertySymbols,$n=Object.prototype.hasOwnProperty,bn=Object.prototype.propertyIsEnumerable,ds=(e,t,s)=>t in e?yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,us=(e,t)=>{for(var s in t||(t={}))$n.call(t,s)&&ds(e,s,t[s]);if(cs)for(var s of cs(t))bn.call(t,s)&&ds(e,s,t[s]);return e};const M=e=>e||e===0,k=e=>typeof e=="function",B=e=>typeof e=="string",I=e=>typeof e=="number",nt=e=>typeof e=="undefined",W=e=>typeof e!="undefined",ze=e=>typeof e=="boolean",vn=e=>Math.ceil(e/10)*10,Te=e=>Math.ceil(e)+.5,Vt=e=>e[1]-e[0],bt=e=>typeof e=="object",Tn=e=>{for(const t in e)return!1;return!0},vt=e=>nt(e)||e===null||B(e)&&e.length===0||bt(e)&&!(e instanceof Date)&&Tn(e)||I(e)&&isNaN(e),at=e=>!vt(e),V=e=>Array.isArray(e),N=e=>e&&!(e!=null&&e.nodeType)&&bt(e)&&!V(e);function Ft(e,t,s){return W(e[t])?e[t]:s}function An(e,t){let s=!1;return Object.keys(e).forEach(i=>e[i]===t&&(s=!0)),s}function J(e,t,...s){const i=k(e);return i&&e.call(t,...s),i}function Ae(e,t){let s=0;const i=function(...n){!--s&&t.apply(this,...n)};"duration"in e?e.each(()=>++s).on("end",i):(++s,e.call(i))}const hs="script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex",Fe={tags:new RegExp(`<(${hs})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${hs})\\s*>)?`,"gi"),eventHandlers:/[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,dangerousURIs:/(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi};function Pt(e){if(!B(e)||!e||e.indexOf("<")===-1)return e;let t=e,s;do s=t,t=t.replace(Fe.tags,"").replace(Fe.eventHandlers,"").replace(Fe.dangerousURIs,'$1=""');while(t!==s);return t}function Qt(e,t,s=[-1,1],i=!1){if(!(!e||!B(t)))if(t.indexOf(`
|
|
8
|
+
* @version 3.18.0
|
|
9
|
+
*/(function(ft,Kt){if(typeof exports=="object"&&typeof module=="object")module.exports=Kt(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if(typeof define=="function"&&define.amd)define(["d3-axis","d3-brush","d3-drag","d3-dsv","d3-ease","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],Kt);else{var _e=typeof exports=="object"?Kt(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):Kt(ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3,ft.d3);for(var me in _e)(typeof exports=="object"?exports:ft)[me]=_e[me]}})(this,function(ss,ft,Kt,_e,me,nn,an,on,rn,ln,cn,dn,un){return(function(){"use strict";var hn=[,,(function(z){z.exports=rn}),(function(z){z.exports=cn}),(function(z){z.exports=ft}),(function(z){z.exports=_e}),(function(z){z.exports=Kt}),(function(z){z.exports=on}),(function(z){z.exports=dn}),(function(z){z.exports=ln}),(function(z){z.exports=un}),(function(z){z.exports=ss}),(function(z){z.exports=me}),(function(z){z.exports=an}),(function(z){z.exports=nn})],is={};function Z(z){var mt=is[z];if(mt!==void 0)return mt.exports;var R=is[z]={exports:{}};return hn[z](R,R.exports,Z),R.exports}(function(){Z.d=function(z,mt){for(var R in mt)Z.o(mt,R)&&!Z.o(z,R)&&Object.defineProperty(z,R,{enumerable:!0,get:mt[R]})}})(),(function(){Z.o=function(z,mt){return Object.prototype.hasOwnProperty.call(z,mt)}})(),(function(){Z.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})}})();var Oe={};return(function(){Z.r(Oe),Z.d(Oe,{bb:function(){return en},default:function(){return en}});var z={};Z.r(z),Z.d(z,{selection:function(){return Qs},subchart:function(){return ti},zoom:function(){return ei}});var mt={};Z.r(mt),Z.d(mt,{area:function(){return Di},areaLineRange:function(){return zi},areaSpline:function(){return Mi},areaSplineRange:function(){return Xi},areaStep:function(){return Bi},areaStepRange:function(){return Fi},bar:function(){return Zi},bubble:function(){return qi},candlestick:function(){return Ki},donut:function(){return Yi},funnel:function(){return Qi},gauge:function(){return ji},line:function(){return Ni},pie:function(){return Wi},polar:function(){return Hi},radar:function(){return Ui},scatter:function(){return Ji},spline:function(){return Gi},step:function(){return Vi},treemap:function(){return tn}});var R=Z(2),ye=Z(3),gn=Object.defineProperty,ns=Object.getOwnPropertySymbols,fn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,as=(e,t,s)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,q=(e,t)=>{for(var s in t||(t={}))fn.call(t,s)&&as(e,s,t[s]);if(ns)for(var s of ns(t))pn.call(t,s)&&as(e,s,t[s]);return e};const D={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},X={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},$e={area:"bb-area",areas:"bb-areas"},rt={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},yt={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},Lt={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},pt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Ie={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Gt={dragarea:"bb-dragarea",INCLUDED:"_included_"},ue={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},$t={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},W={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},kt={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},St={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},K={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},st={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},Dt={level:"bb-level",levels:"bb-levels"},os={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},he={region:"bb-region",regions:"bb-regions"},Q={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},it={shape:"bb-shape",shapes:"bb-shapes"},rs={brush:"bb-brush",subchart:"bb-subchart"},lt={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},be={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},ls={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},De={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var V=q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q(q({},D),X),$e),rt),yt),Lt),pt),Ie),Gt),$t),W),kt),St),K),ue),st),os),he),Q),it),rs),lt),be),ls),De),xn={boost_useCssRule:!1,boost_useWorker:!1},_n={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},mn={legend_contents_bindto:void 0,legend_contents_template:"<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_format:void 0,legend_padding:0,legend_position:"bottom",legend_show:!0,legend_tooltip:!1,legend_usePoint:!1},yn={bindto:"#chart",background:{},clipPath:!0,svg_classname:void 0,size_width:void 0,size_height:void 0,padding:!0,padding_mode:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,resize_auto:!0,resize_timer:!0,onclick:void 0,onover:void 0,onout:void 0,onresize:void 0,onresized:void 0,onbeforeinit:void 0,oninit:void 0,onafterinit:void 0,onrendered:void 0,transition_duration:250,plugins:[],render:{},regions:[]},$n={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},bn={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:void 0,tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:()=>{},tooltip_onhide:()=>{},tooltip_onshown:()=>{},tooltip_onhidden:()=>{},tooltip_order:null},vn={data_x:void 0,data_idConverter:e=>e,data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_groupsZeroAs:"positive",data_color:void 0,data_colors:{},data_labels:{},data_labels_backgroundColors:void 0,data_labels_colors:void 0,data_labels_position:{},data_labels_imgUrl:void 0,data_hide:!1,data_filter:void 0,data_onclick:()=>{},data_onover:()=>{},data_onout:()=>{},data_onshown:void 0,data_onhidden:void 0,data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},Tn={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},ve=Z(4);function An(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof global=="object"&&global!==null&&global.Object===Object&&global||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function wn(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",s=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",i=a=>setTimeout(a,1),n=a=>clearTimeout(a);return[t?e.requestAnimationFrame:i,t?e.cancelAnimationFrame:n,s?e.requestIdleCallback:i,s?e.cancelIdleCallback:n]}const B=An(),ct=B==null?void 0:B.document,[Sn,Rl,cs,Cl]=wn(B),Rn=new Set(["span","div","p","br","b","i","em","strong","u","s","sub","sup","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","hr","pre","code","blockquote","a","img","svg","g","path","circle","ellipse","rect","line","polyline","polygon","text","tspan","textPath","use","defs","symbol","clipPath","mask","linearGradient","radialGradient","stop","pattern","marker","title","desc"]),ds=new Set(["class","id","style","title","lang","dir","href","src","alt","width","height","colspan","rowspan","scope","headers","d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","dx","dy","viewBox","preserveAspectRatio","transform","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternTransform","marker-start","marker-mid","marker-end","markerWidth","markerHeight","refX","refY","xlink:href"]),Cn=new Set(["http:","https:","mailto:"]),En=new Set(["href","src","xlink:href"]),Ln=/^<\/?([a-zA-Z][a-zA-Z0-9]*)/,kn=/^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/,Pn=/^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/,us=/([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,hs=/url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi,On=["expression(","behavior:","binding:","@import","@charset","-moz-binding:"];function ze(e){return e.replace(/:/gi,":").replace(/&newline;/gi,`
|
|
10
|
+
`).replace(/&tab;/gi," ").replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&#(\d+);/gi,(t,s)=>String.fromCharCode(parseInt(s,10))).replace(/&#x([0-9a-f]+);/gi,(t,s)=>String.fromCharCode(parseInt(s,16)))}function gs(e){const s=ze(e).trim().replace(/[\s\u0000-\u001f]/g,"").toLowerCase();if(!s||s.startsWith("#")||s.startsWith("/")||s.startsWith("./")||s.startsWith("../")||!s.includes(":"))return!0;const i=s.indexOf(":");if(i>0){const n=s.substring(0,i+1);return Cn.has(n)}return!1}function In(e){const s=ze(e).replace(/[\u0000-\u001f]/g,"");hs.lastIndex=0;let i;for(;(i=hs.exec(s))!==null;)if(!gs(i[1]))return null;const n=s.toLowerCase().replace(/\s/g,"");for(const a of On)if(n.includes(a))return null;return e}const Dn={'"':""","'":"'","`":"`"},zn=/["'`]/g;function Fe(e){return e.replace(zn,t=>Dn[t])}function Fn(e,t,s=!1){if(En.has(e))return gs(t)?s?Fe(t):t:null;if(e==="style"){const n=In(t);return n===null?null:s?Fe(n):n}const i=ze(t).toLowerCase().replace(/\s/g,"");return/\bon\w+=/.test(i)?null:s?Fe(t):t}function Mn(e){const t=e.match(Ln);return t?t[1].toLowerCase():null}function Xn(e){const t=Mn(e);return t!==null&&Rn.has(t)}function Bn(e){const t=e.match(kn);if(t)return`</${t[1].toLowerCase()}>`;const s=e.match(Pn);if(!s)return"";const[,i,n,a]=s,o=i.toLowerCase(),r=[];us.lastIndex=0;let l;for(;(l=us.exec(n))!==null;){const d=l[1].toLowerCase(),h=l[2],g=l[3],f=l[4];if(d.startsWith("on"))continue;let p,_;if(h!==void 0)p=h,_='"';else if(g!==void 0)p=g,_="'";else if(f!==void 0)p=f,_='"';else{ds.has(d)&&r.push(d);continue}if(ds.has(d)){const m=Fn(d,p,f!==void 0);m!==null&&r.push(`${d}=${_}${m}${_}`)}}const c=r.length>0?` ${r.join(" ")}`:"";return`<${o}${c}${a?"/>":">"}`}function Jt(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|[^<>\s]+>/g,t=>t.startsWith("<!--")?"":t.startsWith("<")?Xn(t)?Bn(t):t.replace(/</g,"<"):t.slice(0,-1)+">")}var Nn=Object.defineProperty,fs=Object.getOwnPropertySymbols,Gn=Object.prototype.hasOwnProperty,Vn=Object.prototype.propertyIsEnumerable,ps=(e,t,s)=>t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,xs=(e,t)=>{for(var s in t||(t={}))Gn.call(t,s)&&ps(e,s,t[s]);if(fs)for(var s of fs(t))Vn.call(t,s)&&ps(e,s,t[s]);return e};function _s(e,t,s=!1){const i=n=>n[e?"getBoundingClientRect":"getBBox"]();return s?i(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=i(t):t.rect}function ms(e,t){for(let s=0;s<e.length;s++){const i=e[s];i&&t(i,s)}}const M=e=>e||e===0,k=e=>typeof e=="function",N=e=>typeof e=="string",I=e=>typeof e=="number",nt=e=>typeof e=="undefined",H=e=>typeof e!="undefined",Me=e=>typeof e=="boolean",Yn=e=>Math.ceil(e/10)*10,Te=e=>Math.ceil(e)+.5,Vt=e=>e[1]-e[0],bt=e=>typeof e=="object",jn=e=>{for(const t in e)return!1;return!0},vt=e=>nt(e)||e===null||N(e)&&e.length===0||bt(e)&&!(e instanceof Date)&&jn(e)||I(e)&&isNaN(e),ot=e=>!vt(e),Y=e=>Array.isArray(e),G=e=>e&&!(e!=null&&e.nodeType)&&bt(e)&&!Y(e);function zt(e,t,s){return H(e[t])?e[t]:s}function Wn(e,t){let s=!1;return Object.keys(e).forEach(i=>e[i]===t&&(s=!0)),s}function J(e,t,...s){const i=k(e);return i&&e.call(t,...s),i}function Ae(e,t){let s=0;const i=function(...n){!--s&&t.apply(this,...n)};"duration"in e?e.each(()=>++s).on("end",i):(++s,e.call(i))}function Qt(e,t,s=[-1,1],i=!1){if(!(!e||!N(t)))if(t.indexOf(`
|
|
10
11
|
`)===-1)e.text(t);else{const n=[e.text(),t].map(a=>a.replace(/[\s\n]/g,""));if(n[0]!==n[1]){const a=t.split(`
|
|
11
|
-
`),o=i?a.length-1:1;e.html(""),a.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?s[0]*o:s[1]}em`).text(r)})}}}function gs(e){const{x:t,y:s,width:i,height:n}=e.getBBox();return[{x:t,y:s+n},{x:t,y:s},{x:t+i,y:s},{x:t+i,y:s+n}]}function fs(e){const{width:t,height:s}=ct(e),i=gs(e),n=i[0].x,a=Math.min(i[0].y,i[1].y);return{x:n,y:a,width:t,height:s}}function Tt(e,t){var s;const i=e&&((s=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:s[0]);let n=[0,0];try{n=(0,R.pointer)(i||e,t)}catch(a){}return n.map(a=>isNaN(a)?0:a)}function ps(e){const{event:t,$el:s}=e,i=s.subchart.main||s.main;let n;return t&&t.type==="brush"?n=t.selection:i&&(n=i.select(".bb-brush").node())&&(n=(0,ve.brushSelection)(n)),n}function xs(e,t,s=!1){const i=n=>n[e?"getBoundingClientRect":"getBBox"]();return s?i(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=i(t):t.rect}function ct(e,t=!1){return xs(!0,e,t)}function Yt(e,t=!1){return xs(!1,e,t)}function Ct(e=!0,t=0,s=1e4){const i=j.crypto||j.msCrypto,n=i?t+i.getRandomValues(new Uint32Array(1))[0]%(s-t+1):Math.floor(Math.random()*(s-t)+t);return e?String(n):n}function Me(e,t,s,i,n){if(s>i)return-1;const a=Math.floor((s+i)/2);let{x:o,w:r=0}=e[a];return n&&(o=e[a].y,r=e[a].h),t>=o&&t<=o+r?a:t<o?Me(e,t,s,a-1,n):Me(e,t,a+1,i,n)}function _s(e){const t=ps(e);return t?t[0]===t[1]:!0}function wn(...e){const t=s=>{if(N(s)&&s.constructor){const i=new s.constructor;for(const n in s)i[n]=t(s[n]);return i}return s};return e.map(s=>t(s)).reduce((s,i)=>us(us({},s),i))}function dt(e={},t){V(t)&&t.forEach(s=>dt(e,s));for(const s in t)/^\d+$/.test(s)||s in e||(e[s]=t[s]);return e}const pt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Sn(e,t="-"){return e.split(t).map((s,i)=>i?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():s.toLowerCase()).join("")}const jt=e=>[].slice.call(e);function Rn(e,t,s){const{rootSelector:i="",sheet:n}=e,o=`${i} ${(r=>r.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${s.join(";")}}`;return n[n.insertRule?"insertRule":"addRule"](o,n.cssRules.length)}function Cn(e){let t=[];return e.forEach(s=>{var i;try{s.cssRules&&s.cssRules.length&&(t=t.concat(jt(s.cssRules)))}catch(n){(i=j.console)==null||i.warn(`Error while reading rules from ${s.href}: ${n.toString()}`)}}),t}function ms(e){var t,s,i,n,a,o;return{x:((s=(t=j.pageXOffset)!=null?t:j.scrollX)!=null?s:0)+((i=e.scrollLeft)!=null?i:0),y:((a=(n=j.pageYOffset)!=null?n:j.scrollY)!=null?a:0)+((o=e.scrollTop)!=null?o:0)}}function we(e,t=0,s=0,i=!0){const n=new DOMPoint(t,s),a=e.getScreenCTM(),o=n.matrixTransform(i?a==null?void 0:a.inverse():a);if(i===!1){const r=ct(e);o.x-=r.x,o.y-=r.y}return o}function ys(e){const t=e?e.transform:null,s=t&&t.baseVal;return s&&s.numberOfItems?s.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Xe(e){const t=e[0]instanceof Date,s=(t?e.map(Number):e).filter((i,n,a)=>a.indexOf(i)===n);return t?s.map(i=>new Date(i)):s}function $s(e){return e&&e.length?e.reduce((t,s)=>t.concat(s)):[]}function te(e,...t){if(!t.length||t.length===1&&!t[0])return e;const s=t.shift();return N(e)&&N(s)&&Object.keys(s).forEach(i=>{if(!/^(__proto__|constructor|prototype)$/i.test(i)){const n=s[i];N(n)?(!e[i]&&(e[i]={}),e[i]=te(e[i],n)):e[i]=V(n)?n.concat():n}}),te(e,...t)}function ee(e,t=!0){let s;return e[0]instanceof Date?s=t?(i,n)=>i-n:(i,n)=>n-i:t&&!e.every(isNaN)?s=(i,n)=>i-n:t||(s=(i,n)=>i>n&&-1||i<n&&1||i===n&&0),e.concat().sort(s)}function Rt(e,t){let s=t.filter(i=>at(i));return s.length?I(s[0])?s=Math[e](...s):s[0]instanceof Date&&(s=ee(s,e==="min")[0]):s=void 0,s}const Se=(e,t,s=1)=>{const i=[],n=Math.max(0,Math.ceil((t-e)/s))|0;for(let a=e;a<n;a++)i.push(e+a*s);return i},En={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,s,i=e())=>{t.dispatchEvent(new MouseEvent(s,i))}}catch(t){return(s,i,n=e())=>{const a=lt.createEvent("MouseEvent");a.initMouseEvent(i,n.bubbles,n.cancelable,j,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),s.dispatchEvent(a)}}})(),touch:(e,t,s)=>{const i=new Touch(te({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},s));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}};function ge(e,t){let s=e;for(const i in t)s=s.replace(new RegExp(`{=${i}}`,"g"),t[i]);return Pt(s)}function At(e){var t;let s;if(e instanceof Date)s=e;else if(B(e)){const{config:i,format:n}=this;s=(t=n.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else I(e)&&!isNaN(e)&&(s=new Date(+e));return(!s||isNaN(+s))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),s}function Be(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function Ln(e,t,s=!1){const i=!!e.node;let n=!1;for(const[a,o]of Object.entries(t))if(n=i?e.style(a)===o:e.style[a]===o,s===!1&&n)break;return n}function fe(){var e,t;return((e=lt)==null?void 0:e.hidden)===!1||((t=lt)==null?void 0:t.visibilityState)==="visible"}function kn(e,t){const{DocumentTouch:s,matchMedia:i,navigator:n}=j,a=i==null?void 0:i("(pointer:coarse)").matches;let o=!1;if(t)if(n&&"maxTouchPoints"in n)o=n.maxTouchPoints>0;else if("ontouchmove"in j||s&< instanceof s)o=!0;else if(a)o=!0;else{const l=n.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!a&&(i==null?void 0:i("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function bs(e,t){t()===!1?mn(()=>bs(e,t)):e()}function Pn(e){if(N(e)&&!B(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(B(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[s,i=s,n=s,a=i]=t;return{top:s,right:i,bottom:n,left:a}}var On=Object.defineProperty,vs=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,Dn=Object.prototype.propertyIsEnumerable,Ne=(e,t,s)=>t in e?On(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ts=(e,t)=>{for(var s in t||(t={}))In.call(t,s)&&Ne(e,s,t[s]);if(vs)for(var s of vs(t))Dn.call(t,s)&&Ne(e,s,t[s]);return e},zn=(e,t,s)=>Ne(e,typeof t!="symbol"?t+"":t,s);const As=class Ui{static setOptions(t){this.data=t.reduce((s,i)=>Ts(Ts({},s),i),this.data)}constructor(){return wn(un,ln,fn,cn,pn,dn,hn,gn,Ui.data)}};zn(As,"data",{});let Ht=As;class Fn{constructor(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX:null},axisTooltip:{x:null,y:null,y2:null},defs:null,tooltip:null,legend:null,title:null,subchart:{main:null,bar:null,line:null,area:null},arcs:null,bar:null,candlestick:null,line:null,area:null,circle:null,radar:null,text:null,grid:{main:null,x:null,y:null},gridLines:{main:null,x:null,y:null},region:{main:null,list:null},eventRect:null,zoomResetBtn:null}}}class Mn{constructor(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasFunnel:!1,hasRadar:!1,hasTreemap:!1,cssRule:{},current:{domain:void 0,width:0,height:0,dataMax:0,maxTickSize:{x:{width:0,height:0,ticks:[],clipPath:0,domain:""},y:{width:0,height:0,domain:""},y2:{width:0,height:0,domain:""}},types:[],needle:void 0,zoomDomain:null},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,eventReceiver:{currentIdx:-1,rect:{},data:[],coords:[]},axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},event:null,dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,redrawing:!1,resizing:!1,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:[],hiddenLegendIds:[],focusedTargetIds:[],defocusedTargetIds:[],radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null}}}}const ws={element:Fn,state:Mn};class Xn{constructor(){Object.keys(ws).forEach(t=>{this[t]=new ws[t]})}getStore(t){return this[t]}}var Bn=Object.defineProperty,Nn=(e,t,s)=>t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Gn=(e,t,s)=>Nn(e,typeof t!="symbol"?t+"":t,s);const xt={bubbleBaseLength:"$baseLength",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",legendItemTextBox:"legendItemTextBox",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect"};class Vn{constructor(){Gn(this,"cache",{})}add(t,s,i=!1){return this.cache[t]=i?this.cloneTarget(s):s,this.cache[t]}remove(t){(B(t)?[t]:t).forEach(s=>delete this.cache[s])}get(t,s=!1){if(s&&Array.isArray(t)){const i=[];for(let n=0,a;a=t[n];n++)a in this.cache&&i.push(this.cloneTarget(this.cache[a]));return i}else{const i=this.cache[t];return M(i)?i:null}}reset(t){const s=this;for(const i in s.cache)(t||/^\$/.test(i))&&(s.cache[i]=null)}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(s=>({x:s.x,value:s.value,id:s.id}))}}}const L={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",AREA_STEP_RANGE:"area-step-range",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",FUNNEL:"funnel",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},Ge={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",AREA_STEP_RANGE:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",FUNNEL:"initFunnel",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},Mt={Area:[L.AREA,L.AREA_SPLINE,L.AREA_SPLINE_RANGE,L.AREA_LINE_RANGE,L.AREA_STEP,L.AREA_STEP_RANGE],AreaRange:[L.AREA_SPLINE_RANGE,L.AREA_LINE_RANGE,L.AREA_STEP_RANGE],Arc:[L.PIE,L.DONUT,L.GAUGE,L.POLAR,L.RADAR],Line:[L.LINE,L.SPLINE,L.AREA,L.AREA_SPLINE,L.AREA_SPLINE_RANGE,L.AREA_LINE_RANGE,L.STEP,L.AREA_STEP,L.AREA_STEP_RANGE],Step:[L.STEP,L.AREA_STEP,L.AREA_STEP_RANGE],Spline:[L.SPLINE,L.AREA_SPLINE,L.AREA_SPLINE_RANGE]};function Yn(e){const t=e,{config:s}=t;let i="";if(vt(s.data_type||s.data_types)&&!t[Ge.LINE])i="line";else for(const n in Ge){const a=L[n];if(t.hasType(a)&&!t[Ge[n]]){i=a;break}}i&&jn(`Please, make sure if %c${Sn(i)}`,"module has been imported and specified correctly.","https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality")}function jn(e,t,s){var i;const n="[billboard.js]";if((i=j.console)==null?void 0:i.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${n} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),s&&console.info("%c\u2139\uFE0F","font-size:15px",s)}throw Error(`${n} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const{setTimeout:Hn,clearTimeout:Wn}=j;function Un(e){const t=[];let s;const i=function(){i.clear(),e===!1?ls(()=>{t.forEach(n=>n())},{timeout:200}):s=Hn(()=>{t.forEach(n=>n())},I(e)?e:200)};return i.clear=()=>{s&&(Wn(s),s=null)},i.add=n=>t.push(n),i.remove=n=>t.splice(t.indexOf(n),1),i}function Ss(){let e=[];const t=function(s,i){function n(){var a;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(a=l.empty)!=null&&a.call(l)){o++;continue}if(fe()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}bs(()=>{i==null||i()},n)};return t.add=function(s){V(s)?e=e.concat(s):e.push(s)},t}const Ve={};function Zn(e,t){var s;const i=e.toString(),n=i.replace(/(function|[\s\W\n])/g,"").substring(0,15);return n in Ve||(Ve[n]=new j.Blob([`${(s=t==null?void 0:t.map(String).join(";"))!=null?s:""}
|
|
12
|
+
`),o=i?a.length-1:1;e.html(""),a.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?s[0]*o:s[1]}em`).text(r)})}}}function ys(e){const{x:t,y:s,width:i,height:n}=e.getBBox();return[{x:t,y:s+n},{x:t,y:s},{x:t+i,y:s},{x:t+i,y:s+n}]}function $s(e){const{width:t,height:s}=dt(e),i=ys(e),n=i[0].x,a=Math.min(i[0].y,i[1].y);return{x:n,y:a,width:t,height:s}}function Tt(e,t){var s;const i=e&&((s=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:s[0]);let n=[0,0];try{n=(0,R.pointer)(i||e,t)}catch(a){}return n.map(a=>isNaN(a)?0:a)}function bs(e){const{event:t,$el:s}=e,i=s.subchart.main||s.main;let n;return t&&t.type==="brush"?n=t.selection:i&&(n=i.select(".bb-brush").node())&&(n=(0,ve.brushSelection)(n)),n}function dt(e,t=!1){return _s(!0,e,t)}function Ft(e,t=!1){return _s(!1,e,t)}function Ct(e=!0,t=0,s=1e4){const i=B.crypto||B.msCrypto,n=i?t+i.getRandomValues(new Uint32Array(1))[0]%(s-t+1):Math.floor(Math.random()*(s-t)+t);return e?String(n):n}function Xe(e,t,s,i,n){if(s>i)return-1;const a=Math.floor((s+i)/2);let{x:o,w:r=0}=e[a];return n&&(o=e[a].y,r=e[a].h),t>=o&&t<=o+r?a:t<o?Xe(e,t,s,a-1,n):Xe(e,t,a+1,i,n)}function vs(e){const t=bs(e);return t?t[0]===t[1]:!0}function Hn(...e){const t=s=>{if(G(s)&&s.constructor){const i=new s.constructor;for(const n in s)i[n]=t(s[n]);return i}return s};return e.map(s=>t(s)).reduce((s,i)=>xs(xs({},s),i))}function ut(e={},t){Y(t)&&t.forEach(s=>ut(e,s));for(const s in t)/^\d+$/.test(s)||s in e||(e[s]=t[s]);return e}const xt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Un(e,t="-"){return e.split(t).map((s,i)=>i?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():s.toLowerCase()).join("")}const Yt=e=>[].slice.call(e);function Zn(e,t,s){const{rootSelector:i="",sheet:n}=e,o=`${i} ${(r=>r.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${s.join(";")}}`;return n[n.insertRule?"insertRule":"addRule"](o,n.cssRules.length)}function qn(e){let t=[];return e.forEach(s=>{var i;try{s.cssRules&&s.cssRules.length&&(t=t.concat(Yt(s.cssRules)))}catch(n){(i=B.console)==null||i.warn(`Error while reading rules from ${s.href}: ${n.toString()}`)}}),t}function Ts(e){var t,s,i,n,a,o;return{x:((s=(t=B.pageXOffset)!=null?t:B.scrollX)!=null?s:0)+((i=e.scrollLeft)!=null?i:0),y:((a=(n=B.pageYOffset)!=null?n:B.scrollY)!=null?a:0)+((o=e.scrollTop)!=null?o:0)}}function we(e,t=0,s=0,i=!0){const n=new DOMPoint(t,s),a=e.getScreenCTM(),o=n.matrixTransform(i?a==null?void 0:a.inverse():a);if(i===!1){const r=dt(e);o.x-=r.x,o.y-=r.y}return o}function As(e){const t=e?e.transform:null,s=t&&t.baseVal;return s&&s.numberOfItems?s.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Be(e){const t=e[0]instanceof Date,s=(t?e.map(Number):e).filter((i,n,a)=>a.indexOf(i)===n);return t?s.map(i=>new Date(i)):s}function ws(e){return e&&e.length?e.reduce((t,s)=>t.concat(s)):[]}function te(e,...t){if(!t.length||t.length===1&&!t[0])return e;const s=t.shift();return G(e)&&G(s)&&Object.keys(s).forEach(i=>{if(!/^(__proto__|constructor|prototype)$/i.test(i)){const n=s[i];G(n)?(!e[i]&&(e[i]={}),e[i]=te(e[i],n)):e[i]=Y(n)?n.concat():n}}),te(e,...t)}function ee(e,t=!0){let s;return e[0]instanceof Date?s=t?(i,n)=>i-n:(i,n)=>n-i:t&&!e.every(isNaN)?s=(i,n)=>i-n:t||(s=(i,n)=>i>n&&-1||i<n&&1||i===n&&0),e.concat().sort(s)}function Rt(e,t){let s=t.filter(i=>ot(i));return s.length?I(s[0])?s=Math[e](...s):s[0]instanceof Date&&(s=ee(s,e==="min")[0]):s=void 0,s}const Se=(e,t,s=1)=>{const i=[],n=Math.max(0,Math.ceil((t-e)/s))|0;for(let a=e;a<n;a++)i.push(e+a*s);return i},Kn={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,s,i=e())=>{t.dispatchEvent(new MouseEvent(s,i))}}catch(t){return(s,i,n=e())=>{const a=ct.createEvent("MouseEvent");a.initMouseEvent(i,n.bubbles,n.cancelable,B,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),s.dispatchEvent(a)}}})(),touch:(e,t,s)=>{const i=new Touch(te({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},s));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}};function ge(e,t){let s=e;for(const i in t)s=s.replace(new RegExp(`{=${i}}`,"g"),t[i]);return Jt(s)}function At(e){var t;let s;if(e instanceof Date)s=e;else if(N(e)){const{config:i,format:n}=this;s=(t=n.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else I(e)&&!isNaN(e)&&(s=new Date(+e));return(!s||isNaN(+s))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),s}function Ne(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function Jn(e,t,s=!1){const i=!!e.node;let n=!1;for(const[a,o]of Object.entries(t))if(n=i?e.style(a)===o:e.style[a]===o,s===!1&&n)break;return n}function fe(){var e,t;return((e=ct)==null?void 0:e.hidden)===!1||((t=ct)==null?void 0:t.visibilityState)==="visible"}function Qn(e,t){const{DocumentTouch:s,matchMedia:i,navigator:n}=B,a=i==null?void 0:i("(pointer:coarse)").matches;let o=!1;if(t)if(n&&"maxTouchPoints"in n)o=n.maxTouchPoints>0;else if("ontouchmove"in B||s&&ct instanceof s)o=!0;else if(a)o=!0;else{const l=n.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!a&&(i==null?void 0:i("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function Ss(e,t){t()===!1?Sn(()=>Ss(e,t)):e()}function ta(e){if(G(e)&&!N(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(N(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[s,i=s,n=s,a=i]=t;return{top:s,right:i,bottom:n,left:a}}function Rs(e,t){e.pendingRaf!==null?(B.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=B.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=B.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}function Cs(e,t=(s=>s)){const s=new Set;return ms(e,(i,n)=>{s.add(t(i,n))}),s}function Es(e,t,s=(i=>i)){const i=new Map;return ms(e,(n,a)=>{i.set(t(n,a),s(n,a))}),i}var ea=Object.defineProperty,Ls=Object.getOwnPropertySymbols,sa=Object.prototype.hasOwnProperty,ia=Object.prototype.propertyIsEnumerable,Ge=(e,t,s)=>t in e?ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ks=(e,t)=>{for(var s in t||(t={}))sa.call(t,s)&&Ge(e,s,t[s]);if(Ls)for(var s of Ls(t))ia.call(t,s)&&Ge(e,s,t[s]);return e},na=(e,t,s)=>Ge(e,typeof t!="symbol"?t+"":t,s);const Ps=class sn{static setOptions(t){this.data=t.reduce((s,i)=>ks(ks({},s),i),this.data)}constructor(){return Hn(yn,xn,vn,_n,Tn,mn,$n,bn,sn.data)}};na(Ps,"data",{});let jt=Ps;class aa{constructor(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX:null},axisTooltip:{x:null,y:null,y2:null},defs:null,tooltip:null,legend:null,title:null,subchart:{main:null,bar:null,line:null,area:null},arcs:null,bar:null,candlestick:null,line:null,area:null,circle:null,radar:null,text:null,grid:{main:null,x:null,y:null},gridLines:{main:null,x:null,y:null},region:{main:null,list:null},eventRect:null,zoomResetBtn:null}}}class oa{constructor(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasFunnel:!1,hasRadar:!1,hasTreemap:!1,cssRule:{},loading:void 0,domain:void 0,current:{domain:void 0,width:0,height:0,dataMax:0,maxTickSize:{x:{width:0,height:0,ticks:[],clipPath:0,domain:""},y:{width:0,height:0,domain:""},y2:{width:0,height:0,domain:""}},types:[],needle:void 0,zoomDomain:null},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,eventReceiver:{currentIdx:-1,rect:{},data:[],coords:[]},axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},event:null,dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,redrawing:!1,resizing:!1,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:[],hiddenLegendIds:[],focusedTargetIds:[],defocusedTargetIds:[],radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null},pendingRaf:null,rafBatchQueue:[]}}}const Os={element:aa,state:oa};class ra{constructor(){Object.keys(Os).forEach(t=>{this[t]=new Os[t]})}getStore(t){return this[t]}}var la=Object.defineProperty,ca=(e,t,s)=>t in e?la(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,da=(e,t,s)=>ca(e,typeof t!="symbol"?t+"":t,s);const at={bubbleBaseLength:"$baseLength",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",domainMinMax:"$domainMinMax",filteredTargets:"$filteredTargets",filteredNullish:"$filteredNullish",visibilityChecksum:"visibilityChecksum",legendItemTextBox:"legendItemTextBox",legendItemMap:"$legendItemMap",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect",shapeOffset:"$shapeOffset"};class ua{constructor(){da(this,"cache",{})}add(t,s,i=!1){return this.cache[t]=i?this.cloneTarget(s):s,this.cache[t]}remove(t){(N(t)?[t]:t).forEach(s=>delete this.cache[s])}get(t,s=!1){if(s&&Array.isArray(t)){const i=[];for(let n=0,a;a=t[n];n++)a in this.cache&&i.push(this.cloneTarget(this.cache[a]));return i}else{const i=this.cache[t];return M(i)?i:null}}has(t){return t in this.cache&&this.cache[t]!==null}getKeys(){return Object.keys(this.cache)}reset(t){const s=this;for(const i in s.cache)(t||/^\$/.test(i))&&(s.cache[i]=null)}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(s=>({x:s.x,value:s.value,id:s.id}))}}}const L={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",AREA_STEP_RANGE:"area-step-range",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",FUNNEL:"funnel",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},Ve={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",AREA_STEP_RANGE:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",FUNNEL:"initFunnel",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},Mt={Area:[L.AREA,L.AREA_SPLINE,L.AREA_SPLINE_RANGE,L.AREA_LINE_RANGE,L.AREA_STEP,L.AREA_STEP_RANGE],AreaRange:[L.AREA_SPLINE_RANGE,L.AREA_LINE_RANGE,L.AREA_STEP_RANGE],Arc:[L.PIE,L.DONUT,L.GAUGE,L.POLAR,L.RADAR],Line:[L.LINE,L.SPLINE,L.AREA,L.AREA_SPLINE,L.AREA_SPLINE_RANGE,L.AREA_LINE_RANGE,L.STEP,L.AREA_STEP,L.AREA_STEP_RANGE],Step:[L.STEP,L.AREA_STEP,L.AREA_STEP_RANGE],Spline:[L.SPLINE,L.AREA_SPLINE,L.AREA_SPLINE_RANGE]};function ha(e){const t=e,{config:s}=t;let i="";if(vt(s.data_type||s.data_types)&&!t[Ve.LINE])i="line";else for(const n in Ve){const a=L[n];if(t.hasType(a)&&!t[Ve[n]]){i=a;break}}i&&ga(`Please, make sure if %c${Un(i)}`,"module has been imported and specified correctly.","https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality")}function ga(e,t,s){var i;const n="[billboard.js]";if((i=B.console)==null?void 0:i.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${n} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),s&&console.info("%c\u2139\uFE0F","font-size:15px",s)}throw Error(`${n} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const{setTimeout:fa,clearTimeout:pa}=B;function xa(e){const t=[];let s;const i=function(){i.clear(),e===!1?cs(()=>{t.forEach(n=>n())},{timeout:200}):s=fa(()=>{t.forEach(n=>n())},I(e)?e:200)};return i.clear=()=>{s&&(pa(s),s=null)},i.add=n=>t.push(n),i.remove=n=>t.splice(t.indexOf(n),1),i}function Is(){let e=[];const t=function(s,i){function n(){var a;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(a=l.empty)!=null&&a.call(l)){o++;continue}if(fe()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}Ss(()=>{i==null||i()},n)};return t.add=function(s){Y(s)?e=e.concat(s):e.push(s)},t}const Ye={};function _a(e,t){var s;const i=e.toString(),n=i.replace(/(function|[\s\W\n])/g,"").substring(0,15);return n in Ye||(Ye[n]=new B.Blob([`${(s=t==null?void 0:t.map(String).join(";"))!=null?s:""}
|
|
12
13
|
|
|
13
14
|
self.onmessage=function({data}) {
|
|
14
15
|
const result = (${i}).apply(null, data);
|
|
15
16
|
self.postMessage(result);
|
|
16
|
-
};`],{type:"text/javascript"})),j.URL.createObjectURL(Ve[n])}function qn(e){const t=new j.Worker(e);return t.onerror=function(s){console.error?console.error(s):console.log(s)},t}function Ye(e=!0,t,s,i){let n=function(...a){const o=t(...a);s(o)};if(j.Worker&&e){const a=Zn(t,i),o=qn(a);n=function(...r){o.postMessage(r),o.onmessage=function(l){return j.URL.revokeObjectURL(a),s(l.data)}}}return n}var Re=Z(5);function je(e){const t=[];return e.forEach(function(s,i){const n=s[0];s.forEach(function(a,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof a=="undefined")throw new Error(`Source data is missing a component at (${i}, ${o})!`);t[o-1][n]=a}})}),t}function He(e){const t=e[0],s=[];return e.forEach(function(i,n){if(n>0){const a={};i.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${n}, ${r})!`);a[t[r]]=o}),s.push(a)}}),s}function Rs(e,t){const s=[];let i,n;if(Array.isArray(e)){const a=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let u=o;return c.some(function(d){return!(u=u&&d in u?u[d]:void 0)}),u};t.x?i=t.value.concat(t.x):i=t.value,s.push(i),e.forEach(function(o){const r=i.map(function(l){let c=a(o,l);return typeof c=="undefined"&&(c=null),c});s.push(r)}),n=He(s)}else Object.keys(e).forEach(function(a){var o;const r=e[a].concat();(o=r.unshift)==null||o.call(r,a),s.push(r)}),n=je(s);return n}function Kn(e,t="csv",s,i,n){const a=new XMLHttpRequest,o={csv:Jn,tsv:Qn,json:Rs};a.open("GET",e),s&&Object.keys(s).forEach(function(r){a.setRequestHeader(r,s[r])}),a.onreadystatechange=function(){if(a.readyState===4)if(a.status===200){const r=a.responseText;r&&n.call(this,o[t](t==="json"?JSON.parse(r):r,i))}else throw new Error(`${e}: Something went wrong loading!`)},a.send()}function Cs(e,t){const s=e.rows(t);let i;return s.length===1?(i=[{}],s[0].forEach(n=>{i[0][n]=null})):i=e.parse(t),i}function Jn(e){return Cs({rows:Re.csvParseRows,parse:Re.csvParse},e)}function Qn(e){return Cs({rows:Re.tsvParseRows,parse:Re.tsvParse},e)}function Es(e,t){const s=e||(t==null?void 0:t.data_keys);return s!=null&&s.x&&(t.data_x=s.x),s}function ta(e,t,s){const i=this,{config:n}=i;let a;e.forEach(o=>{const r=i.getXKey(o);if(s.customX||s.timeSeries?s.xs.indexOf(r)>=0?a=(s.appendXs&&i.data.xs[o]||[]).concat(t.map((l,c)=>{const u=M(l[r]);return u?i.generateTargetX(u,o,c):!1}).filter(l=>l!==!1)):n.data_x?a=this.getOtherTargetXs():at(n.data_xs)&&(a=i.getXValuesOfXKey(r,i.data.targets)):a=t.map((l,c)=>c),a)i.data.xs[o]=a;else throw new Error(`x is not defined for id = "${o}".`)})}var ea={convertData(e,t){const{config:s}=this,i=a=>a!=null&&a.length&&!vt(a[0])?s.boost_useWorker:!1;let n=e;if(e.bindto&&(n={},["url","mimeType","headers","keys","json","keys","rows","columns"].forEach(a=>{const o=`data_${a}`;o in e&&(n[a]=e[o])})),n.url&&t)Kn(n.url,n.mimeType,n.headers,Es(n.keys,s),t);else if(n.json)Ye(i(n.json),Rs,t,[je,He])(n.json,Es(n.keys,s));else if(n.rows)Ye(i(n.rows),He,t)(n.rows);else if(n.columns)Ye(i(n.columns),je,t)(n.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const s=this,{axis:i,config:n,state:a}=s,o=n.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((h,g)=>(s.isX.call(s,g)?h.xs.push(g):s.isNotX.call(s,g)&&h.ids.push(g),h),{ids:[],xs:[]}):{ids:[],xs:[]},u={appendXs:t,xs:c,idConverter:n.data_idConverter.bind(s.api),categorized:i==null?void 0:i.isCategorized(),timeSeries:i==null?void 0:i.isTimeSeries(),customX:i==null?void 0:i.isCustomX()};ta.bind(s)(l,e,u);const d=l.map((h,g)=>{const f=n.data_idConverter.bind(s.api)(h),p=s.getXKey(h),_=u.customX&&u.categorized,x=_&&(()=>{const $=new Set(n.axis_x_categories);return e.every(v=>$.has(v.x))})(),m=e.__append__,y=p===null&&m?s.api.data.values(h).length:0;return{id:f,id_org:h,values:e.map(($,v)=>{const b=$[p];let T=$[h],C;return T=T!==null&&!isNaN(T)&&!N(T)?+T:V(T)||N(T)?T:null,(_||a.hasRadar)&&g===0&&!nt(b)?(!x&&g===0&&v===0&&!m&&(n.axis_x_categories=[]),C=n.axis_x_categories.indexOf(b),C===-1&&(C=n.axis_x_categories.length,n.axis_x_categories.push(b))):C=s.generateTargetX(b,h,y+v),(nt(T)||s.data.xs[h].length<=v)&&(C=void 0),{x:C,value:T,id:f,index:-1}}).filter($=>W($.x))}});if(d.forEach(h=>{var g;n.data_xSort&&(h.values=h.values.sort((f,p)=>{const _=f.x||f.x===0?f.x:1/0,x=p.x||p.x===0?p.x:1/0;return _-x})),h.values.forEach((f,p)=>f.index=p),(g=s.data.xs[h.id])==null||g.sort((f,p)=>f-p)}),a.hasNegativeValue=s.hasNegativeValueInTargets(d),a.hasPositiveValue=s.hasPositiveValueInTargets(d),o&&s.isValidChartType(o)){const h=s.mapToIds(d).filter(g=>!(g in n.data_types)||!s.isValidChartType(n.data_types[g]));s.setTargetType(h,o)}return d.forEach(h=>s.cache.add(h.id_org,h,!0)),d}},sa={isX(e){const t=this,{config:s}=t,i=s.data_x&&e===s.data_x,n=at(s.data_xs)&&An(s.data_xs,e);return i||n},isNotX(e){return!this.isX(e)},isStackNormalized(){const{config:e}=this;return!!((e.data_stack_normalize===!0||bt(e.data_stack_normalize))&&e.data_groups.length)},isStackNormalizedPerGroup(){var e;const{config:t}=this;return!!(bt(t.data_stack_normalize)&&((e=t.data_stack_normalize)!=null&&e.perGroup)&&t.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(s=>s.indexOf(e)>=0&&s.length>1):t.length>0},hasAxisGroupedData(e){const t=this,{axis:s}=t;return t.data.targets.filter(a=>s.getId(a.id)===e).map(a=>a.id).some(a=>t.isGrouped(a))},getXKey(e){const t=this,{config:s}=t;return s.data_x?s.data_x:at(s.data_xs)?s.data_xs[e]:null},getXValuesOfXKey(e,t){const s=this,i=t&&at(t)?s.mapToIds(t):[];let n;return i.forEach(a=>{s.getXKey(a)===e&&(n=s.data.xs[a])}),n},getIndexByX(e,t){const s=this;return t?t.indexOf(B(e)?e:+e):(s.filterByX(s.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const s=this;return e in s.data.xs&&s.data.xs[e]&&M(s.data.xs[e][t])?s.data.xs[e][t]:t},getOtherTargetXs(){const e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},getOtherTargetX(e){const t=this.getOtherTargetXs();return t&&e<t.length?t[e]:null},addXs(e){const t=this,{config:s}=t;Object.keys(e).forEach(i=>{s.data_xs[i]=e[i]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(at(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:s}=t;let i;return e&&(i=s.data_names[e.id],e.name=i!==void 0?i:e.id),e},getAllValuesOnIndex(e,t=!1){const s=this;let i=s.filterTargetsToShow(s.data.targets).map(n=>s.addName(s.getValueOnIndex(n.values,e)));return t&&(i=i.filter(n=>n&&"value"in n&&M(n.value))),i},getValueOnIndex(e,t){const s=e.filter(i=>i.index===t);return s.length?s[0]:null},updateTargetX(e,t){const s=this;e.forEach(i=>{i.values.forEach((n,a)=>{n.x=s.generateTargetX(t[a],i.id,a)}),s.data.xs[i.id]=t})},updateTargetXs(e,t){const s=this;e.forEach(i=>{t[i.id]&&s.updateTargetX([i],t[i.id])})},generateTargetX(e,t,s){const i=this,{axis:n}=i;let a=n!=null&&n.isCategorized()?s:e||s;if(n!=null&&n.isTimeSeries()){const o=At.bind(i);a=o(e||i.getXValue(t,s))}else n!=null&&n.isCustomX()&&!(n!=null&&n.isCategorized())&&(a=M(e)?+e:i.getXValue(t,s));return a},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return W(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return W(t)?t:null},getBaseValue(e){const t=this,{hasAxis:s}=t.state;let{value:i}=e;return i&&s&&(t.isAreaRangeType(e)?i=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(i=t.getBubbleZData(i,"y"))),i},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let s,i;return(e||this.data.targets.map(n=>n.values)).forEach((n,a)=>{const o=n.map(t).filter(I);s=Math.min(a?s:1/0,...o),i=Math.max(a?i:-1/0,...o)}),{min:s,max:i}},getMinMaxData(){const e=this,t=xt.dataMinMax;let s=e.cache.get(t);if(!s){const i=e.data.targets.map(c=>c.values),n=e.getMinMaxValue(i);let a=[],o=[];const{min:r,max:l}=n;i.forEach(c=>{const u=e.getFilteredDataByValue(c,r),d=e.getFilteredDataByValue(c,l);u.length&&(a=a.concat(u)),d.length&&(o=o.concat(d))}),e.cache.add(t,s={min:a,max:o})}return s},getTotalPerIndex(e){const t=this,{config:s}=t,i=e?`${xt.dataTotalPerIndex}-${e}`:xt.dataTotalPerIndex;let n=t.cache.get(i);if((t.config.data_groups.length||t.isStackNormalized())&&!n){n=[];let{targets:a}=t.data;if(t.isStackNormalizedPerGroup()&&e){const o=s.data_groups.find(r=>r.indexOf(e)>=0);if(o)a=a.filter(r=>o.indexOf(r.id)>=0);else return null}a.forEach(o=>{o.values.forEach((r,l)=>{n[l]||(n[l]=0),n[l]+=~~r.value})}),t.cache.add(i,n)}return n},getTotalDataSum(e){const t=this,s=xt.dataTotalSum;let i=t.cache.get(s);return I(i)||(i=t.data.targets.reduce((n,a)=>n+a.values.reduce((o,r)=>{var l;return o+((l=r.value)!=null?l:0)},0),0),t.cache.add(s,i)),e&&(i-=t.getHiddenTotalDataSum()),i},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:s}}=e;let i=0;return s.length&&(i=t.data.values.bind(t)(s).reduce((n,a)=>n+a)),i},getFilteredDataByValue(e,t){return e.filter(s=>this.getBaseValue(s)===t)},getMaxDataCount(){return Math.max(...this.data.targets.map(e=>e.values.length),0)},getMaxDataCountTarget(){let e=this.filterTargetsToShow()||[];const t=e.length,s=this.config.axis_x_inverted;return t>1?(e=e.map(i=>i.values).reduce((i,n)=>i.concat(n)).map(i=>i.x),e=ee(Xe(e)).map((i,n,a)=>({x:i,index:s?a.length-n-1:n}))):t&&(e=e[0].values.concat()),e},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?V(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const s=this.mapToIds(e);for(let i=0,n;n=s[i];i++)if(n===t)return!0;return!1},isTargetToShow(e){return this.state.hiddenTargetIds.indexOf(e)<0},isLegendToShow(e){return this.state.hiddenLegendIds.indexOf(e)<0},filterTargetsToShow(e){const t=this;return(e||t.data.targets).filter(s=>t.isTargetToShow(s.id))},mapTargetsToUniqueXs(e){const t=this,{axis:s}=t;let i=[];return e!=null&&e.length&&(i=Xe($s(e.map(n=>n.values.map(a=>+a.x)))),i=s!=null&&s.isTimeSeries()?i.map(n=>new Date(+n)):i.map(Number)),ee(i)},addTargetIds(e,t){const{state:s}=this;(V(t)?t:[t]).forEach(n=>{s[e].indexOf(n)<0&&s[e].push(n)})},removeTargetIds(e,t){const{state:s}=this;(V(t)?t:[t]).forEach(n=>{const a=s[e].indexOf(n);a>=0&&s[e].splice(a,1)})},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:s}=t.state,i={},n=t.isMultipleX(),a=n?t.mapTargetsToUniqueXs(e).map(o=>B(o)?o:+o):null;return e.forEach(o=>{const r=[];o.values.filter(({value:l})=>M(l)||l===null).forEach(l=>{let{value:c}=l;c!==null&&t.isCandlestickType(l)&&(c=V(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),V(c)?r.push(...c):N(c)&&"high"in c?r.push(...Object.values(c)):t.isBubbleZType(l)?r.push(s&&t.getBubbleZData(c,"y")):n?r[t.getIndexByX(l.x,a)]=c:r.push(c)}),i[o.id]=r}),i},checkValueInTargets(e,t){return Object.keys(e).some(s=>e[s].values.some(i=>t(i.value)))},hasMultiTargets(){return this.filterTargetsToShow().length>1},hasNegativeValueInTargets(e){return this.checkValueInTargets(e,t=>t<0)},hasPositiveValueInTargets(e){return this.checkValueInTargets(e,t=>t>0)},orderTargets(e){const t=this,s=[...e],i=t.getSortCompareFn();return i&&s.sort(i),s},getSortCompareFn(e=!1){const t=this,{config:s}=t,i=s.data_order,n=/asc/i.test(i),a=/desc/i.test(i);let o;if(n||a){const r=(c,u)=>c+Math.abs(u.value),l=c=>I(c)?c:"values"in c?c.values.reduce(r,0):c.value;o=(c,u)=>{const d=l(c),h=l(u);return e?n?d-h:h-d:n?h-d:d-h}}else k(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return $s(e.map(s=>s.values)).filter(s=>s.x-t===0)},filterNullish(e){const t=s=>M(s.value);return e&&e.filter(s=>"value"in s?t(s):s.values.some(t))},filterRemoveNull(e){return e.filter(t=>M(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(s=>({id:s.id,id_org:s.id_org,values:s.values.filter(i=>t[0]<=i.x&&i.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return ze(e)&&e||bt(e)&&at(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:s,config:i,state:{hasRadar:n,inputType:a,eventReceiver:{coords:o,rect:r}}}=t;let l;if(n){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const u=(0,R.select)(c).datum();l=u&&Object.keys(u).length===1?u.index:void 0}else{const c=i.axis_rotated,u=ms(s.chart.node()),d=a==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?d.clientY+u.y:d.clientX+u.x;if(Be(s.svg)){const g=[h,0];c&&g.reverse(),h=we(s.eventRect.node(),...g)[c?"y":"x"]}else h-=c?r.top:r.left;l=Me(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,s){var i;const n=this,a=1.3;return((i=n.getTextRect([e,t].map(o=>n.dataLabelFormat()(o))))==null?void 0:i.map(o=>o[s]*a))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const s=e[t].x,i=[];let n;for(n=t-1;n>=0&&s===e[n].x;n--)i.push(e[n]);for(n=t;n<e.length&&s===e[n].x;n++)i.push(e[n]);return i},findClosestFromTargets(e,t){const s=this,i=e.map(n=>s.findClosest(n.values,t));return s.findClosest(i,t)},findClosest(e,t){const s=this,{$el:{main:i}}=s,n=e.filter(r=>r&&M(r.value));let a,o;return n.filter(r=>s.isBarType(r.id)||s.isCandlestickType(r.id)).forEach(r=>{const l=s.isBarType(r.id)?`.${yt.chartBar}.${D.target}${s.getTargetSelectorSuffix(r.id)} .${yt.bar}-${r.index}`:`.${Lt.chartCandlestick}.${D.target}${s.getTargetSelectorSuffix(r.id)} .${Lt.candlestick}-${r.index} path`;!o&&s.isWithinBar(i.select(l).node())&&(o=r)}),n.filter(r=>!s.isBarType(r.id)&&!s.isCandlestickType(r.id)).forEach(r=>{const l=s.dist(r,t);a=s.getPointSensitivity(r),l<a&&(a=l,o=r)}),o},dist(e,t){const s=this,{config:{axis_rotated:i},scale:n}=s,a=+i,o=+!i,r=s.circleY(e,e.index),l=(n.zoom||n.x)(e.x);return Math.sqrt(Math.pow(l-t[a],2)+Math.pow(r-t[o],2))},convertValuesToStep(e){const t=this,{axis:s,config:i}=t,n=i.line_step_type,a=s?s.isCategorized():!1,o=V(e)?e.concat():[e];if(!(a||/step\-(after|before)/.test(n)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:u}=r;o.unshift({x:--u,value:r.value,id:c}),a&&n==="step-after"&&o.unshift({x:--u,value:r.value,id:c}),u=l.x,o.push({x:++u,value:l.value,id:c}),a&&n==="step-before"&&o.push({x:++u,value:l.value,id:c})}return o},convertValuesToRange(e){const t=V(e)?e.concat():[e],s=[];return t.forEach(i=>{const{x:n,id:a}=i;s.push({x:n,id:a,value:i.value[0]}),s.push({x:n,id:a,value:i.value[2]})}),s},updateDataAttributes(e,t){const s=this,{config:i}=s,n=i[`data_${e}`];return nt(t)||(Object.keys(t).forEach(a=>{n[a]=t[a]}),s.redraw({withLegend:!0})),n},getRangedData(e,t="",s="areaRange"){const i=e==null?void 0:e.value;if(V(i)){if(s==="bar")return i.reduce((n,a)=>a-n);{const n={areaRange:["high","mid","low"],candlestick:["open","high","low","close","volume"]}[s].indexOf(t);return n>=0&&i?i[n]:void 0}}else if(i&&t)return i[t];return i},setRatioForGroupedData(e){const t=this,{config:s}=t;if(s.data_groups.length&&e.some(i=>t.isGrouped(i.id))){const i=n=>t.getRatio("index",n,!0);e.forEach(n=>{"values"in n?n.values.forEach(i):i(n)})}},getRatio(e,t,s=!1){const i=this,{config:n,state:a}=i,o=i.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(i.pie.padAngle()())r=t.value/i.getTotalDataSum(!0);else{const l=n.gauge_fullCircle?i.getArcLength():i.getStartingAngle()*-2,c=i.hasType("gauge")?l:Math.PI*2;r=(t.endAngle-t.startAngle)/c}else if(e==="index"){const l=o.data.values.bind(o),{hiddenTargetIds:c}=a;let u=this.getTotalPerIndex(i.isStackNormalizedPerGroup()?t.id:void 0);if(u===null)return r;if(c.length){let h=c;if(i.isStackNormalizedPerGroup()&&t.id){const g=n.data_groups.find(f=>f.indexOf(t.id)>=0);g&&(h=h.filter(f=>g.indexOf(f)>=0))}if(h.length){let g=l(h,!1);g.length&&(g=g.reduce((f,p)=>f.map((_,x)=>~~_+p[x])),u=u.map((f,p)=>f-g[p]))}}const d=u[t.index];t.ratio=I(t.value)&&u&&d?t.value/d:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/a.current.dataMax*n.radar_size_ratio;else if(e==="bar"){const c=i.getYScaleById.bind(i)(t.id).domain().reduce((u,d)=>d-u);r=c===0?0:Math.abs(i.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=i.getTotalDataSum(!0));return s&&r?r*100:r},updateDataIndexByX(e){const t=this,s=e.reduce((i,n,a)=>(i[Number(n.x)]=a,i),{});t.data.targets.forEach(i=>{i.values.forEach((n,a)=>{let o=s[Number(n.x)];o===void 0&&(o=a),n.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(N(e.value)&&("z"in e.value||"y"in e.value)||V(e.value)&&e.value.length>=2)},isBarRangeType(e){const t=this,{value:s}=e;return t.isBarType(e)&&V(s)&&s.length>=2&&s.every(I)},getDataById(e){var t;const s=this.cache.get(e)||this.api.data(e);return(t=s==null?void 0:s[0])!=null?t:s}};function Ls(e,t=!1){const s=this,{api:i}=s;t&&s.api.flush(!0),e==null||e.call(i)}var ia={load(e,t){const s=this,{axis:i,data:n,org:a,scale:o}=s,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;c&&(t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(u=>{var d;const h=((d=t.types)==null?void 0:d[u.id])||t.type;s.setTargetType(u.id,h)}),n.targets.forEach(u=>{for(let d=0;d<c.length;d++)if(u.id===c[d].id){u.values=r?u.values.concat(c[d].values):c[d].values,c.splice(d,1);break}}),n.targets=n.targets.concat(c)),s.updateTargets(n.targets),o.zoom&&(l.x=i.isCategorized()?o.x.orgScale():(a.xScale||o.x).copy(),l.domain=s.getXDomain(n.targets),l.x.domain(l.domain),l.currentDomain=s.zoom.getDomain(),s.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,s.$el.eventRect.property("__zoom",null))),s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(a.xDomain=l.domain,a.xScale=l.x,i.isCategorized()&&(l.currentDomain=s.getZoomDomainValue(l.currentDomain),a.xDomain=s.getZoomDomainValue(a.xDomain),a.xScale=l.x.domain(a.xDomain)),s.updateCurrentZoomTransform(l.x,l.currentDomain)):a.xScale&&a.xScale.domain(a.xDomain),s.updateTypesElements(),Ls.call(s,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(),t.convertData(e,s=>{const i=e.data||s;e.append&&(i.__append__=!0),i&&t.load(t.convertDataToTargets.call(t,i),e)}))},unload(e,t){var s;const i=this,{state:n,$el:a,$T:o}=i,r=!!((s=i.hasLegendDefsPoint)!=null&&s.call(i));let l=t,c=e;if(i.cache.reset(),l||(l=()=>{}),c=c.filter(d=>i.hasTarget(i.data.targets,d)),!c||c.length===0){l();return}c.forEach(d=>{var h;const g=i.getTargetSelectorSuffix(d);n.withoutFadeIn[d]=!1,a.legend&&a.legend.selectAll(`.${H.legendItem}${g}`).remove(),i.data.targets=i.data.targets.filter(f=>f.id!==d),r&&((h=a.defs)==null||h.select(`#${i.getDefsPointId(g)}`).remove())}),n.hasFunnel&&i.updateFunnel(i.data.targets),n.hasTreemap&&i.updateTargetsForTreemap(i.data.targets),i.updateTypesElements();const u=a.svg.selectAll(c.map(d=>i.selectorTarget(d)));o(u).style("opacity","0").remove().call(Ae,l)}},ks=Z(6),na={setExpand(e,t,s){const i=this,{config:n,$el:{circle:a}}=i;a&&n.point_focus_expand_enabled&&i.expandCircles(e,t,s),i.expandBarTypeShapes(!0,e,t,s)},expandBarTypeShapes(e=!0,t,s,i){const n=this;["bar","candlestick"].filter(a=>n.$el[a]).forEach(a=>{i&&n.$el[a].classed(D.EXPANDED,!1),n.getShapeByIndex(a,t,s).classed(D.EXPANDED,e)})},setOverOut(e,t){const s=this,{config:i,state:{hasFunnel:n,hasRadar:a,hasTreemap:o},$el:{main:r}}=s,l=N(t);if(l||t!==-1){const c=i[e?"data_onover":"data_onout"].bind(s.api);if(i.color_onover&&s.setOverColor(e,t,l),l){const u=s.getTargetSelectorSuffix(t.id),d=n||o?`${D.target+u} .${it.shape}`:X.arc+u;c(t,r.select(`.${d}`).node())}else if(i.tooltip_grouped)e&&(a&&s.isPointFocusOnly()?s.showCircleFocus(s.getAllValuesOnIndex(t,!0)):s.setExpand(t,null,!0)),!s.isMultipleX()&&r.selectAll(`.${it.shape}-${t}`).each(function(u){c(u,this)});else{const u=s.cache.get(xt.setOverOut)||[],d=r.selectAll(`.${it.shape}-${t}`).filter(function(g){return s.isWithinShape(this,g)}),h=d.filter(function(){return u.every(g=>g!==this)});if(!e||d.empty()||u.length===h.size()&&h.nodes().every((g,f)=>g!==u[f]))for(;u.length;){const g=u.pop();i.data_onout.bind(s.api)((0,R.select)(g).datum(),g)}h.each(function(){e&&(c((0,R.select)(this).datum(),this),u.push(this))}),s.cache.add(xt.setOverOut,u)}}},callOverOutForTouch(e){const t=this,s=t.cache.get(xt.callOverOutForTouch);(N(e)&&s?e.id!==s.id:e!==s)&&((s||I(s))&&t.setOverOut(!1,s),(e||I(e))&&t.setOverOut(!0,e),t.cache.add(xt.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:s}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,ks.drag)().on("drag",function(i){s.event=i,e.drag(Tt(i,this))}).on("start",function(i){s.event=i,e.dragstart(Tt(i,this))}).on("end",i=>{s.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,s){var i,n,a;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:u,hasRadar:d,hasTreemap:h},$el:{eventRect:g,funnel:f,radar:p,svg:_,treemap:x}}=o;let m=(a=(n=(u||h)&&l.rect||d&&p.axes.select(`.${ot.axis}-${t} text`)||g||((i=o.getArcElementByIdOrIndex)==null?void 0:i.call(o,t)))==null?void 0:n.node)==null?void 0:a.call(n);if(m){const y=o.isMultipleX(),$=r.axis_rotated;let{width:v,left:b,top:T}=ct(m);if(c&&!d&&!y){const A=l.coords[t];A?(v=A.w,b+=A.x,T+=A.y):(v=0,b=0,T=0)}let C=b+(s?s[0]:0)+(y||$?0:v/2),w=T+(s?s[1]:0)+($?4:0);if(Be(_)){const A=we(o.$el.eventRect.node(),C,w,!1);C=A.x,w=A.y}const S={screenX:C,screenY:w,clientX:C,clientY:w,bubbles:d};(u||h)&&(m=(f!=null?f:x).node()),En[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,S)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{eventRect:t,zoomResetBtn:s}}=e;t==null||t.on(".zoom wheel.zoom .drag",null),s==null||s.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:s,eventRect:i,legend:n,region:a,svg:o,treemap:r},brush:l}=t,c=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,i,a==null?void 0:a.list,l==null?void 0:l.getSelection(),s==null?void 0:s.selectAll("path"),n==null?void 0:n.selectAll("g"),r].forEach(u=>u==null?void 0:u.on(c,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},aa={categoryName(e){var t;const{axis_x_categories:s}=this.config;return(t=s==null?void 0:s[e])!=null?t:e}},oa={generateClass(e,t){return` ${e} ${e+this.getTargetSelectorSuffix(t)}`},getClass(e,t){const s=/s$/.test(e),i=/^(area|arc|line|funnel|treemap)s?$/.test(e),n=s?"id":"index";return a=>{const o=a.data||a;return((t?this.generateClass(G[s?"shapes":"shape"],o[n]):"")+this.generateClass(G[e],o[i?"id":n])).trim()}},getChartClass(e){return t=>G[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],s=[];return function(i){var n;const a=i.id||((n=i.data)==null?void 0:n.id)||i;return s.indexOf(a)<0&&s.push(a),t[s.indexOf(a)%t.length]}},classRegion(e,t){return`${this.generateClass(G.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let s="";return t&&(s=` ${G.target}-${t}`),this.generateClass(G.target,e)+s},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.indexOf(e.id)>=0?G.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.indexOf(e.id)>=0?G.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-")},selectorTarget(e,t="",s=""){const i=this.getTargetSelectorSuffix(e);return`${t}.${G.target+i} ${s}, ${t}.${G.circles+i} ${s}`},selectorTargets(e,t){const s=e||[];return s.length?s.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${G.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}},Xt=Z(7);const ra=(e,t,s)=>{const i=(0,R.select)(e.cloneNode(!0));return i.attr("id",s).insert("rect",":first-child").attr("width",i.attr("width")).attr("height",i.attr("height")).style("fill",t),{id:s,node:i.node()}};function la(e){const t=xt.colorPattern,{body:s}=lt;let i=s[t];if(!i){const a=e.classed(Ie.colorPattern,!0).style("background-image");e.classed(Ie.colorPattern,!1),a.indexOf(";")>-1&&(i=a.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),s[t]=i)}return i}const ca=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var da={generateColor(){const e=this,{$el:t,config:s}=e,i=[],n=s.area_linearGradient||s.bar_linearGradient||s.point_radialGradient;let a=at(s.color_pattern)?s.color_pattern:(0,Xt.scaleOrdinal)(la(t.chart)||ca).range();const o=a;if(k(s.color_tiles)){const r=s.color_tiles.bind(e.api)(),l=a.map((c,u)=>{const d=c.replace(/[#\(\)\s,]/g,""),h=`${e.state.datetimeId}-pattern-${d}-${u}`;return ra(r[u%r.length],c,h)});a=l.map(c=>`url(#${c.id})`),e.patterns=l}return function(r){var l;const c=s.data_colors,u=s.data_color,d=r.id||((l=r.data)==null?void 0:l.id)||r,h=e.isTypeOf(d,["line","spline","step"])||!s.data_types[d];let g;if(k(c[d])?g=c[d].bind(e.api)(r):c[d]?g=c[d]:(i.indexOf(d)<0&&i.push(d),g=h?o[i.indexOf(d)%o.length]:a[i.indexOf(d)%a.length],c[d]=g),g=k(u)?u.call(e.api,g,r):g,n){const f=e.$el.defs.selectAll(`[id$='-gradient${e.getTargetSelectorSuffix(d)}'] stop`);let p;f.each(function(_,x){p=x===0?this.style.stopColor:this.style.stopColor===p}),p===!0&&f.attr("stop-color",g)}return g}},generateLevelColor(){const e=this,{config:t}=e,s=t.color_pattern,i=t.color_threshold,n=i.unit==="value",a=i.max||100,o=i.values&&i.values.length?i.values:[];return at(i)?function(r){const l=n?r:r*100/a;let c=s[s.length-1];for(let u=0,d=o.length;u<d;u++)if(l<=o[u]){c=s[u];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const s=this,{$el:{defs:i},state:n}=s;if(e){let a=[];B(e)?a.push(""):N(e)?a=Object.keys(e):k(e)&&(a=s.mapToTargetIds()),a.forEach(o=>{const r=`${n.datetimeId}-labels-bg${s.getTargetSelectorSuffix(o)}${B(e)?s.getTargetSelectorSuffix(e):""}`,l=Pt(o===""?e:(e==null?void 0:e[o])||"");i.select(`#${r}`).empty()&&i.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r).html(`<feFlood flood-color="${l}" />
|
|
17
|
-
<feComposite in="SourceGraphic" />`)})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:s},state:{datetimeId:i},$el:{defs:n}}=e;s.forEach(a=>{const o=`${i}-gradient${e.getTargetSelectorSuffix(a.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(a)&&"area"||e.isBarType(a)&&"bar";if((r||l)&&n.select(`#${o}`).empty()){const c=e.color(a),u={defs:null,stops:[]};if(r){const{cx:d=.3,cy:h=.3,r:g=.7,stops:f=[[.1,c,0],[.9,c,1]]}=r;u.stops=f,u.defs=n.append("radialGradient").attr("id",`${o}`).attr("cx",d).attr("cy",h).attr("r",g)}else{const d=t.axis_rotated,{x:h=d?[1,0]:[0,0],y:g=d?[0,0]:[0,1],stops:f=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];u.stops=f,u.defs=n.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",g[0]).attr("y2",g[1])}u.stops.forEach(d=>{const[h,g,f]=d,p=k(g)?g.bind(e.api)(a.id):g;u.defs&&u.defs.append("stop").attr("offset",h).attr("stop-color",p||c).attr("stop-opacity",f)})}})},setOverColor(e,t){const s=this,{config:i,$el:{main:n}}=s,a=i.color_onover;let o=e?a:s.color;N(o)?o=({id:r})=>r in a?a[r]:s.color(r):B(o)?o=()=>a:k(a)&&(o=o.bind(s.api)),n.selectAll(N(t)?`.${X.arc}${s.getTargetSelectorSuffix(t.id)}`:`.${it.shape}-${t}`).style("fill",o)}},ua={getYDomainMinMax(e,t){const s=this,{axis:i,config:n}=s,a=t==="min",o=n.data_groups,r=s.mapToIds(e),l=s.getValuesAsIdKeyed(e);if(o.length>0){const c=s[`has${a?"Negative":"Positive"}ValueInTargets`](e);o.forEach(u=>{const d=u.filter(h=>r.indexOf(h)>=0);if(d.length){const h=d[0],g=i.getId(h);c&&l[h]&&(l[h]=l[h].map(f=>(a?f<0:f>0)?f:0)),d.filter((f,p)=>p>0).forEach(f=>{if(l[f]){const p=i.getId(f);l[f].forEach((_,x)=>{const m=+_,y=a?m>0:m<0;p===g&&!(c&&y)&&(l[h][x]+=m)})}})}})}return Rt(t,Object.keys(l).map(c=>Rt(t,l[c])))},isHiddenTargetWithYDomain(e){const t=this;return t.state.hiddenTargetIds.some(s=>t.axis.getId(s)===e)},getYDomain(e,t,s){const i=this,{axis:n,config:a,scale:o}=i,r=`axis_${t}`;if(i.isStackNormalized()&&e.filter(O=>n.getId(O.id)===t).map(O=>O.id).some(O=>i.isGrouped(O)))return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(S=>n.getId(S.id)===t),u=s?i.filterByXDomain(c,s):c;if(u.length===0)return i.isHiddenTargetWithYDomain(t)?o[t].domain():t==="y2"?o.y.domain():i.getYDomain(e,"y2",s);const d=a[`${r}_min`],h=a[`${r}_max`],g=a[`${r}_center`],f=a[`${r}_inverted`],p=i.hasDataLabel()&&a.axis_rotated,_=i.hasDataLabel()&&!a.axis_rotated;let x=i.getYDomainMinMax(u,"min"),m=i.getYDomainMinMax(u,"max"),y=[L.BAR,L.BUBBLE,L.SCATTER,...Mt.Line].some(S=>{const A=S.indexOf("area")>-1?"area":S;return i.hasType(S,u,!0)&&a[`${A}_zerobased`]});x=M(d)?d:M(h)?x<=h?x:h-10:x,m=M(h)?h:M(d)?d<=m?m:d+10:m,isNaN(x)&&(x=0),isNaN(m)&&(m=x),x===m&&(x<0?m=0:x=0);const $=x>=0&&m>=0,v=x<=0&&m<=0;(M(d)&&$||M(h)&&v)&&(y=!1),y&&($&&(x=0),v&&(m=0));const b=Math.abs(m-x);let T={top:b*.1,bottom:b*.1};if(W(g)){const S=Math.max(Math.abs(x),Math.abs(m));m=g+S,x=g-S}if(p){const S=Vt(o.y.range()),A=i.getDataLabelLength(x,m,"width").map(O=>{const E=O/S;return isFinite(E)?E:0});["bottom","top"].forEach((O,E)=>{T[O]+=b*(A[E]/(1-A[0]-A[1]))})}else if(_){const S=i.getDataLabelLength(x,m,"height");["bottom","top"].forEach((A,O)=>{T[A]+=i.convertPixelToScale("y",S[O],b)})}T=i.getResettedPadding(T);const C=a[`${r}_padding`];at(C)&&["bottom","top"].forEach(S=>{T[S]=n.getPadding(C,S,T[S],b)}),y&&($&&(T.bottom=x),v&&(T.top=-m));const w=l?[x,m].map(S=>S<0?0:S):[x-T.bottom,m+T.top];return f?w.reverse():w},getXDomainMinMax(e,t){var s;const i=this,n=i.config[`axis_x_${t}`],a=Rt(t,e.map(r=>Rt(t,r.values.map(l=>l.x))));let o=N(n)?n.value:n;return o=W(o)&&((s=i.axis)!=null&&s.isTimeSeries())?At.bind(this)(o):o,N(n)&&n.fit&&(t==="min"&&o<a||t==="max"&&o>a)&&(o=void 0),W(o)?o:a},getXDomainPadding(e,t){const s=this,{axis:i,config:n}=s,a=n.axis_x_padding,o=i.isTimeSeries()&&t,r=Vt(e);let l;if(i.isCategorized()||o)l=0;else if(s.hasType("bar")){const d=s.getMaxDataCount();l=d>1?r/(d-1)/2:.5}else l=s.getResettedPadding(r*.01);let{left:c=l,right:u=l}=I(a)?{left:a,right:a}:a;if(a.unit==="px"){const d=Math.abs(r+r*.2);c=i.getPadding(a,"left",l,d),u=i.getPadding(a,"right",l,d)}else{const d=r+c+u;if(o&&d){const h=r/t/d;c=c/d/h,u=u/d/h}}return{left:c,right:u}},getXDomain(e){const t=this,{axis:s,config:i,scale:{x:n}}=t,a=i.axis_x_inverted,o=[t.getXDomainMinMax(e,"min"),t.getXDomainMinMax(e,"max")];let[r=0,l=0]=o;if(n.type!=="log"){const c=s.isCategorized(),u=s.isTimeSeries(),d=t.getXDomainPadding(o);let[h,g]=o;h-g===0&&!c&&(u?(h=new Date(h.getTime()*.5),g=new Date(g.getTime()*1.5)):(h=h===0?1:h*.5,g=g===0?-1:g*1.5)),(h||h===0)&&(r=u?new Date(h.getTime()-d.left):h-d.left),(g||g===0)&&(l=u?new Date(g.getTime()+d.right):g+d.right)}return a?[l,r]:[r,l]},updateXDomain(e,t,s,i,n){var a;const o=this,{config:r,org:l,scale:{x:c,subX:u}}=o,d=r.zoom_enabled;if(s&&(c.domain(n||ee(o.getXDomain(e),!r.axis_x_inverted)),l.xDomain=c.domain(),u.domain(c.domain()),(a=o.brush)==null||a.scale(u)),t){const h=n||!o.brush||_s(o)?l.xDomain:ps(o).map(u.invert);c.domain(h)}return(s||t)&&d&&o.zoom.updateScaleExtent(),i&&c.domain(o.trimXDomain(c.orgDomain())),c.domain()},trimXDomain(e){const t=this,s=t.config.axis_x_inverted,i=t.getZoomDomain(),[n,a]=i;return(s?e[0]>=n:e[0]<=n)&&(e[1]=+e[1]+(n-e[0]),e[0]=n),(s?e[1]<=a:e[1]>=a)&&(e[0]=+e[0]-(e[1]-a),e[1]=a),e},getZoomDomain(e="zoom",t=!1){const s=this,{config:i,scale:n,org:a}=s;let[o,r]=t&&n[e]?n[e].domain():a.xDomain;return e==="zoom"&&(W(i.zoom_x_min)&&(o=Rt("min",[o,i.zoom_x_min])),W(i.zoom_x_max)&&(r=Rt("max",[r,i.zoom_x_max]))),[o,r]},getZoomDomainValue(e){const t=this,{config:s,axis:i}=t;if(i.isCategorized()&&Array.isArray(e)){const n=s.axis_x_inverted;return e.map((o,r)=>Number(o)+(r===0?+n:+!n))}return e},convertPixelToScale(e,t,s){const i=this,{config:n,state:a}=i,o=n.axis_rotated;let r;return e==="x"?r=o?"height":"width":r=o?"width":"height",s*(t/a[r])},withinRange(e,t=[0,0],s){const n=this.config.axis_x_inverted,[a,o]=s;if(Array.isArray(e)){const r=[...e];if(n&&r.reverse(),r[0]<r[1])return e.every((l,c)=>(c===0?n?+l<=a:+l>=a:n?+l>=o:+l<=o)&&!e.every((u,d)=>u===t[d]))}return!1}};function Ps(e,t,s){const{config:i}=e,n=`axis_${t}_tick_format`;return(i[n]?i[n]:e.defaultValueFormat).call(e.api,s)}var ha={yFormat(e){return Ps(this,"y",e)},y2Format(e){return Ps(this,"y2",e)},getDefaultValueFormat(){const e=this,{defaultArcValueFormat:t,yFormat:s,y2Format:i}=e,n=e.hasArcType(null,["gauge","polar","radar"]);return function(a,o,r){return(n?t:e.axis&&e.axis.getId(r)==="y2"?i:s).call(e,a,o)}},defaultValueFormat(e){return V(e)?e.join("~"):M(e)?+e:""},defaultArcValueFormat(e,t){return`${(t*100).toFixed(1)}%`},defaultPolarValueFormat(e){return`${e}`},dataLabelFormat(e){const t=this,s=t.config.data_labels,i=a=>{let r=a;return V(a)?r=a.join("~"):N(a)&&(r=Object.values(a).join("~")),r};let n=i;return k(s.format)?n=s.format:bt(s.format)&&(s.format[e]?n=s.format[e]===!0?i:s.format[e]:n=()=>""),n.bind(t.api)}};function Ce(e){const t=this,s=t.getDataById(e);return t.levelColor?t.levelColor(s.values[0].value):t.color(s)}function We(e,t=!0){var s;const{config:i}=this;let n=(s=i.data_names[e])!=null?s:e;return t&&k(i.legend_format)&&(n=i.legend_format(n,e!==n?e:void 0)),n}var ga={initLegend(){const e=this,{config:t,$el:s}=e;e.legendItemTextBox={},e.state.legendHasRendered=!1,t.legend_show?(t.legend_contents_bindto||(s.legend=e.$el.svg.append("g").classed(H.legend,!0).attr("transform",e.getTranslate("legend"))),e.updateLegend()):e.state.hiddenLegendIds=e.mapToIds(e.data.targets)},updateLegend(e,t,s){var i;const n=this,{config:a,state:o,scale:r,$el:l}=n,c=t||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=Ft(c,"withTransition",!0),c.withTransitionForTransform=Ft(c,"withTransitionForTransform",!0),a.legend_contents_bindto&&a.legend_contents_template?n.updateLegendTemplate():o.hasTreemap||n.updateLegendElement(e||n.mapToIds(n.data.targets),c,s),(i=l.legend)==null||i.selectAll(`.${H.legendItem}`).classed(H.legendItemHidden,function(u){const d=!n.isTargetToShow(u);return d&&(this.style.opacity=null),d}),n.updateScales(!1,!r.zoom),n.updateSvgSize(),n.transformAll(c.withTransitionForTransform,s),o.legendHasRendered=!0},updateLegendTemplate(){const e=this,{config:t,$el:s}=e,i=(0,R.select)(t.legend_contents_bindto),n=t.legend_contents_template;if(!i.empty()){const a=e.mapToIds(e.data.targets),o=[];let r="";a.forEach(c=>{const u=k(n)?Pt(n.call(e.api,c,e.color(c),e.api.data(c)[0].values)):ge(n,{COLOR:e.color(c),TITLE:c});u&&(o.push(c),r+=u)});const l=i.html(r).selectAll(function(){return this.childNodes}).data(o);e.setLegendItem(l),s.legend=i}},updateSizeForLegend(e){const t=this,{config:s,state:{isLegendTop:i,isLegendLeft:n,isLegendRight:a,isLegendInset:o,current:r}}=t,{width:l,height:c}=e,u={top:i?t.getCurrentPaddingByDirection("top")+s.legend_inset_y+5.5:r.height-c-t.getCurrentPaddingByDirection("bottom")-s.legend_inset_y,left:n?t.getCurrentPaddingByDirection("left")+s.legend_inset_x+.5:r.width-l-t.getCurrentPaddingByDirection("right")-s.legend_inset_x+.5};t.state.margin3={top:a?0:o?u.top:r.height-c,right:NaN,bottom:0,left:a?r.width-l:o?u.left:0}},transformLegend(e){const t=this,{$el:{legend:s},$T:i}=t;i(s,e).attr("transform",t.getTranslate("legend"))},updateLegendStep(e){this.state.legendStep=e},updateLegendItemWidth(e){this.state.legendItemWidth=e},updateLegendItemHeight(e){this.state.legendItemHeight=e},updateLegendItemColor(e,t){const{legend:s}=this.$el;s&&s.select(`.${H.legendItem}-${e} line`).style("stroke",t)},getLegendWidth(){const e=this,{current:{width:t},isLegendRight:s,isLegendInset:i,legendItemWidth:n,legendStep:a}=e.state;return e.config.legend_show?s||i?n*(a+1):t:0},getLegendHeight(){var e;const t=this,{current:s,isLegendRight:i,legendItemHeight:n,legendStep:a}=t.state,o=((e=t.config.padding)==null?void 0:e.mode)==="fit";return t.config.legend_show?i?s.height:Math.max(o?10:20,n)*(a+1):0},opacityForUnfocusedLegend(e){return e.classed(H.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const s=this,{$el:{legend:i},$T:n}=s,a=s.mapToTargetIds(e);i&&n(i.selectAll(`.${H.legendItem}`).filter(o=>a.indexOf(o)>=0).classed(K.legendItemFocused,t)).style("opacity",function(){return t?null:s.opacityForUnfocusedLegend.call(s,(0,R.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:s}=e;t&&s(t.selectAll(`.${H.legendItem}`).classed(K.legendItemFocused,!1)).style("opacity",null)},showLegend(e){const t=this,{config:s,$el:i,$T:n}=t;s.legend_show||(s.legend_show=!0,i.legend?i.legend.style("visibility",null):t.initLegend(),!t.state.legendHasRendered&&t.updateLegend()),t.removeHiddenLegendIds(e),n(i.legend.selectAll(t.selectorLegends(e)).style("visibility",null)).style("opacity",null)},hideLegend(e){const t=this,{config:s,$el:{legend:i}}=t;s.legend_show&&vt(e)&&(s.legend_show=!1,i.style("visibility","hidden")),t.addHiddenLegendIds(e),i.selectAll(t.selectorLegends(e)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(e,t){const s=this,{cache:i,state:n}=s;let a;const o=xt.legendItemTextBox;return e&&(a=!n.redrawing&&i.get(o)||{},a[e]||(a[e]=s.getTextRect(t,H.legendItem),i.add(o,a)),a=a[e]),a},setLegendItem(e){const t=this,{$el:s,api:i,config:n,state:a}=t,o=a.inputType==="touch",r=t.hasType("gauge"),l=n.boost_useCssRule,c=n.legend_item_interaction;e.attr("class",function(u){const d=(0,R.select)(this);return(!d.empty()&&d.attr("class")||"")+t.generateClass(H.legendItem,u)}).style("visibility",u=>t.isLegendToShow(u)?null:"hidden"),n.interaction_enabled&&(l&&[[`.${H.legendItem}`,"cursor:pointer"],[`.${H.legendItem} text`,"pointer-events:none"],[`.${H.legendItemPoint} text`,"pointer-events:none"],[`.${H.legendItemTile}`,"pointer-events:none"],[`.${H.legendItemEvent}`,"fill-opacity:0"]].forEach(u=>{const[d,h]=u;t.setCssRule(!1,d,[h])(s.legend)}),e.on(c.dblclick?"dblclick":"click",c||k(n.legend_item_onclick)?function(u,d){if(!J(n.legend_item_onclick,i,d,!a.hiddenTargetIds.includes(d))){const{altKey:h,target:g,type:f}=u;f==="dblclick"||h?a.hiddenTargetIds.length&&g.parentNode.getAttribute("class").indexOf(H.legendItemHidden)===-1?i.show():(i.hide(),i.show(d)):(i.toggle(d),(0,R.select)(this).classed(K.legendItemFocused,!1))}o&&t.hideTooltip()}:null),!o&&e.on("mouseout",c||k(n.legend_item_onout)?function(u,d){J(n.legend_item_onout,i,d,!a.hiddenTargetIds.includes(d))||((0,R.select)(this).classed(K.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${$t.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||k(n.legend_item_onover)?function(u,d){J(n.legend_item_onover,i,d,!a.hiddenTargetIds.includes(d))||((0,R.select)(this).classed(K.legendItemFocused,!0),r&&t.markOverlapped(d,t,`.${$t.gaugeValue}`),!a.transiting&&t.isTargetToShow(d)&&i.focus(d))}:null),!e.empty()&&e.on("click mouseout mouseover")&&e.style("cursor",t.getStylePropValue("pointer")))},updateLegendElement(e,t){const s=this,{config:i,state:n,$el:{legend:a},$T:o}=s,l=i.legend_item_tile_type!=="circle",c=i.legend_item_tile_r,u={width:l?i.legend_item_tile_width:c*2,height:l?i.legend_item_tile_height:c*2},d={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:u.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let g,f,p;const _=e.filter(b=>!W(i.data_names[b])||i.data_names[b]!==null),x=t.withTransition,m=s.getUpdateLegendPositions(_,d,h);n.isLegendInset&&(d.step=i.legend_inset_step?i.legend_inset_step:_.length,s.updateLegendStep(d.step)),n.isLegendRight?(g=b=>d.max.width*h.steps[b],f=b=>h.margins[h.steps[b]]+h.offsets[b]):n.isLegendInset?(g=b=>d.max.width*h.steps[b]+10,f=b=>h.margins[h.steps[b]]+h.offsets[b]):(g=b=>h.margins[h.steps[b]]+h.offsets[b],f=b=>d.max.height*h.steps[b]);const y={xText:(b,T)=>g(b,T)+4+u.width,xRect:(b,T)=>g(b,T),x1Tile:(b,T)=>g(b,T)-2,x2Tile:(b,T)=>g(b,T)-2+u.width,yText:(b,T)=>f(b,T)+9,yRect:(b,T)=>f(b,T)-5,yTile:(b,T)=>f(b,T)+4};s.generateLegendItem(_,u,m,y),p=a.select(`.${H.legendBackground} rect`),n.isLegendInset&&d.max.width>0&&p.size()===0&&(p=a.insert("g",`.${H.legendItem}`).attr("class",H.legendBackground).append("rect")),i.legend_tooltip&&a.selectAll("title").data(_).text(b=>We.bind(s)(b,!1));const $=a.selectAll("text").data(_).text(b=>We.bind(s)(b)).each(function(b,T){m(this,b,T)});o($,x).attr("x",y.xText).attr("y",y.yText);const v=a.selectAll(`rect.${H.legendItemEvent}`).data(_);o(v,x).attr("width",b=>h.widths[b]).attr("height",b=>h.heights[b]).attr("x",y.xRect).attr("y",y.yRect),s.updateLegendItemPos(_,x,y),p&&o(p,x).attr("height",s.getLegendHeight()-12).attr("width",d.max.width*(d.step+1)+10),s.updateLegendItemWidth(d.max.width),s.updateLegendItemHeight(d.max.height),s.updateLegendStep(d.step)},getUpdateLegendPositions(e,t,s){const i=this,{config:n,state:a}=i,o=a.isLegendRight||a.isLegendInset;return function(r,l,c){const u=c===0,d=c===e.length-1,h=i.getLegendItemTextBox(l,r),g=h.width+t.tileWidth+(d&&!o?0:t.padding.right)+n.legend_padding,f=h.height+t.padding.top,p=o?f:g,_=o?i.getLegendHeight():i.getLegendWidth();let x;const m=function($,v){v||(x=(_-t.totalLength-p)/2,x<t.posMin&&(x=(_-p)/2,t.totalLength=0,t.step++)),s.steps[$]=t.step,s.margins[t.step]=a.isLegendInset?10:x,s.offsets[$]=t.totalLength,t.totalLength+=p};if(u&&(t.totalLength=0,t.step=0,t.max.width=0,t.max.height=0),n.legend_show&&!i.isLegendToShow(l)){s.widths[l]=0,s.heights[l]=0,s.steps[l]=0,s.offsets[l]=0;return}s.widths[l]=g,s.heights[l]=f,(!t.max.width||g>=t.max.width)&&(t.max.width=g),(!t.max.height||f>=t.max.height)&&(t.max.height=f);const y=o?t.max.height:t.max.width;n.legend_equally?(Object.keys(s.widths).forEach($=>s.widths[$]=t.max.width),Object.keys(s.heights).forEach($=>s.heights[$]=t.max.height),x=(_-y*e.length)/2,x<t.posMin?(t.totalLength=0,t.step=0,e.forEach($=>m($))):m(l,!0)):m(l)}},generateLegendItem(e,t,s,i){const n=this,{config:a,state:o,$el:{legend:r}}=n,l=a.legend_usePoint,c=a.legend_item_tile_r,u=a.legend_item_tile_type,d=u!=="circle",h=o.isLegendRight||o.isLegendInset,g=-200,f=r.selectAll(`.${H.legendItem}`).data(e).enter().append("g");if(n.setLegendItem(f),a.legend_tooltip&&f.append("title").text(p=>p),f.append("text").text(p=>We.bind(n)(p)).each(function(p,_){s(this,p,_)}).style("pointer-events",n.getStylePropValue("none")).attr("x",h?i.xText:g).attr("y",h?g:i.yText),f.append("rect").attr("class",H.legendItemEvent).style("fill-opacity",n.getStylePropValue("0")).attr("x",h?i.xRect:g).attr("y",h?g:i.yRect),l){const p=[];f.append(_=>{const x=at(a.point_pattern)?a.point_pattern:[a.point_type];p.indexOf(_)===-1&&p.push(_);let m=x[p.indexOf(_)%x.length];return m==="rectangle"&&(m="rect"),lt.createElementNS(R.namespaces.svg,"hasValidPointType"in n&&n.hasValidPointType(m)?m:"use")}).attr("class",H.legendItemPoint).style("fill",Ce.bind(n)).style("pointer-events",n.getStylePropValue("none")).attr("href",(_,x,m)=>{const $=m[x].nodeName.toLowerCase(),v=n.getTargetSelectorSuffix(_);return $==="use"?`#${o.datetimeId}-point${v}`:void 0})}else f.append(d?"line":u).attr("class",H.legendItemTile).style("stroke",Ce.bind(n)).style("pointer-events",n.getStylePropValue("none")).call(p=>{u==="circle"?p.attr("r",c).style("fill",Ce.bind(n)).attr("cx",h?i.x2Tile:g).attr("cy",h?g:i.yTile):d&&p.attr("stroke-width",t.height).attr("x1",h?i.x1Tile:g).attr("y1",h?g:i.yTile).attr("x2",h?i.x2Tile:g).attr("y2",h?g:i.yTile)})},updateLegendItemPos(e,t,s){const i=this,{config:n,$el:{legend:a},$T:o}=i,r=n.legend_usePoint,l=n.legend_item_tile_type,c=l!=="circle";if(r){const u=a.selectAll(`.${H.legendItemPoint}`).data(e);o(u,t).each(function(){const d=this.nodeName.toLowerCase(),h=n.point_r;let g="x",f="y",p=2,_=2.5,x=null,m=null,y=null;if(d==="circle"){const $=h*.2;g="cx",f="cy",x=h+$,p=h*2,_=-$}else if(d==="rect"){const $=h*2.5;m=$,y=$,_=3}(0,R.select)(this).attr(g,$=>s.x1Tile($)+p).attr(f,$=>s.yTile($)-_).attr("r",x).attr("width",m).attr("height",y)})}else{const u=a.selectAll(`.${H.legendItemTile}`).data(e);o(u,t).style("stroke",Ce.bind(i)).call(d=>{l==="circle"?d.attr("cx",h=>{const g=s.x2Tile(h);return g-(g-s.x1Tile(h))/2}).attr("cy",s.yTile):c&&d.attr("x1",s.x1Tile).attr("y1",s.yTile).attr("x2",s.x2Tile).attr("y2",s.yTile)})}}},fa=Z(8),pa={redraw(e={}){var t,s,i,n;const a=this,{config:o,state:r,$el:l}=a,{main:c,treemap:u}=l;r.redrawing=!0;const d=a.filterTargetsToShow(a.data.targets),{flow:h,initializing:g}=e,f=a.getWithOption(e),p=f.Transition?o.transition_duration:0,_=f.TransitionForExit?p:0,x=f.TransitionForAxis?p:0,m=(t=a.axis)==null?void 0:t.generateTransitions(x);a.updateSizes(g),f.Legend&&o.legend_show?(e.withTransition=!!p,!u&&a.updateLegend(a.mapToIds(a.data.targets),e,m)):f.Dimension&&a.updateDimension(!0),o.data_empty_label_text&&c.select(`text.${rt.text}.${D.empty}`).attr("x",r.width/2).attr("y",r.height/2).text(o.data_empty_label_text).style("display",d.length?"none":null),r.hasAxis?(a.axis.redrawAxis(d,f,m,h,g),a.hasGrid()&&a.updateGrid(),o.regions.length&&a.updateRegion(),["bar","candlestick","line","area"].forEach(y=>{const $=pt(y);(/^(line|area)$/.test(y)&&a.hasTypeOf($)||a.hasType(y))&&a[`update${$}`](f.TransitionForExit)}),l.text&&c.selectAll(`.${Q.selectedCircles}`).filter(a.isBarType.bind(a)).selectAll("circle").remove(),o.interaction_enabled&&!h&&f.EventRect&&(a.redrawEventRect(),(s=a.bindZoomEvent)==null||s.call(a))):(l.arcs&&a.redrawArc(p,_,f.Transform),l.radar&&a.redrawRadar(),l.polar&&a.redrawPolar(),l.funnel&&a.redrawFunnel(),u&&a.updateTreemap(_)),!r.resizing&&!u&&(a.hasPointType()||r.hasRadar)?a.updateCircle():(i=a.hasLegendDefsPoint)!=null&&i.call(a)&&a.data.targets.forEach(a.point("create",this)),a.hasDataLabel()&&!a.hasArcType(null,["radar"])&&a.updateText(),(n=a.redrawTitle)==null||n.call(a),g&&a.updateTypesElements(),a.generateRedrawList(d,h,p,f.Subchart),a.updateTooltipOnRedraw(),a.callPluginHook("$redraw",e,p)},generateRedrawList(e,t,s,i){const n=this,{config:a,state:o}=n,r=n.getDrawShape();o.hasAxis&&a.subchart_show&&n.redrawSubchart(i,s,r);const l=t&&n.generateFlow({targets:e,flow:t,duration:t.duration,shape:r,xv:n.xv.bind(n)}),c=(s||l)&&fe(),u=n.getRedrawList(r,t,l,c),d=()=>{l&&l(),o.redrawing=!1,J(a.onrendered,n.api)};if(d)if(c&&u.length){const h=Ss();(0,fa.transition)().duration(s).each(()=>{u.reduce((g,f)=>g.concat(f),[]).forEach(g=>h.add(g))}).call(h,d)}else o.transiting||d();n.mapToIds(n.data.targets).forEach(h=>{o.withoutFadeIn[h]=!0})},getRedrawList(e,t,s,i){const n=this,{config:a,state:{hasAxis:o,hasRadar:r,hasTreemap:l},$el:{grid:c}}=n,{cx:u,cy:d,xForText:h,yForText:g}=e.pos,f=[];return o&&((a.grid_x_lines.length||a.grid_y_lines.length)&&f.push(n.redrawGrid(i)),a.regions.length&&f.push(n.redrawRegion(i)),Object.keys(e.type).forEach(p=>{const _=pt(p),x=e.type[p];(/^(area|line)$/.test(p)&&n.hasTypeOf(_)||n.hasType(p))&&f.push(n[`redraw${_}`](x,i))}),!t&&c.main&&f.push(n.updateGridFocus())),(!n.hasArcType()||r)&&at(a.data_labels)&&a.data_labels!==!1&&f.push(n.redrawText(h,g,t,i)),(n.hasPointType()||r)&&!n.isPointFocusOnly()&&n.redrawCircle&&f.push(n.redrawCircle(u,d,i,s)),l&&f.push(n.redrawTreemap(i)),f},updateAndRedraw(e={}){const t=this,{config:s,state:i}=t;let n;e.withTransition=Ft(e,"withTransition",!0),e.withTransform=Ft(e,"withTransform",!1),e.withLegend=Ft(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=Ft(e,"withTransitionForTransform",e.withTransition),e.withLegend&&s.legend_show||(i.hasAxis&&(n=t.axis.generateTransitions(e.withTransitionForAxis?s.transition_duration:0)),t.updateScales(),t.updateSvgSize(),t.transformAll(e.withTransitionForTransform,n)),t.redraw(e,n)}};function Wt(e="linear",t,s){const i={linear:Xt.scaleLinear,log:Xt.scaleSymlog,_log:Xt.scaleLog,time:Xt.scaleTime,utc:Xt.scaleUtc}[e]();return i.type=e,/_?log/.test(e)&&i.clamp(!0),i.range([t!=null?t:0,s!=null?s:1])}var xa={getXScale(e,t,s,i){const n=this,a=n.state.loading!=="append"&&n.scale.zoom||Wt(n.axis.getAxisType("x"),e,t);return n.getCustomizedXScale(s?a.domain(s):a,i)},getYScale(e,t,s,i){const a=Wt(this.axis.getAxisType(e),t,s);return i&&a.domain(i),a},getYScaleById(e,t=!1){var s;const i=((s=this.axis)==null?void 0:s.getId(e))==="y2",n=t?i?"subY2":"subY":i?"y2":"y";return this.scale[n]},getCustomizedXScale(e,t){const s=this,i=t||(()=>s.axis.x.tickOffset()),n=s.config.axis_x_inverted,a=function(o){return e(o)+i()};for(const o in e)a[o]=e[o];return a.orgDomain=()=>e.domain(),a.orgScale=()=>e,s.axis.isCategorized()&&(a.domain=function(o){let r=o;return arguments.length?(e.domain(r),a):(r=this.orgDomain(),n?[r[0]+1,r[1]]:[r[0],r[1]+1])}),a},updateScales(e,t=!0){var s,i;const n=this,{axis:a,config:o,format:r,org:l,scale:c,state:{current:u,width:d,height:h,width2:g,height2:f,hasAxis:p,hasTreemap:_}}=n;if(p){const x=o.axis_rotated,m=n.getResettedPadding(1),y={x:x?m:0,y:x?0:h,subX:x?1:0,subY:x?0:f},$={x:x?h:d,y:x?d:m,subX:x?h:d,subY:x?g:1},v=t&&((s=c.x)==null?void 0:s.orgDomain()),b=t&&l.xDomain;c.x=n.getXScale(y.x,$.x,v,()=>a.x.tickOffset()),c.subX=n.getXScale(y.x,$.x,b,T=>{var C;return T%1?0:((C=a.subX)!=null?C:a.x).tickOffset()}),r.xAxisTick=a.getXAxisTickFormat(),r.subXAxisTick=a.getXAxisTickFormat(!0),a.setAxis("x",c.x,o.axis_x_tick_outer,e),o.subchart_show&&a.setAxis("subX",c.subX,o.axis_x_tick_outer,e),c.y=n.getYScale("y",y.y,$.y,c.y?c.y.domain():o.axis_y_default),c.subY=n.getYScale("y",y.subY,$.subY,c.subY?c.subY.domain():o.axis_y_default),a.setAxis("y",c.y,o.axis_y_tick_outer,e),o.axis_y2_show&&(c.y2=n.getYScale("y2",y.y,$.y,c.y2?c.y2.domain():o.axis_y2_default),c.subY2=n.getYScale("y2",y.subY,$.subY,c.subY2?c.subY2.domain():o.axis_y2_default),a.setAxis("y2",c.y2,o.axis_y2_tick_outer,e))}else if(_){const x=n.getCurrentPadding();c.x=(0,Xt.scaleLinear)().rangeRound([x.left,u.width-x.right]),c.y=(0,Xt.scaleLinear)().rangeRound([x.top,u.height-x.bottom])}else(i=n.updateArc)==null||i.call(n)},xx(e){const t=this,{config:s,scale:{x:i,zoom:n}}=t,a=s.zoom_enabled&&n?n:i;return e?a(M(e.x)?e.x:e):null},xv(e){const t=this,{axis:s,config:i,scale:{x:n,zoom:a}}=t,o=i.zoom_enabled&&a?a:n;let r=t.getBaseValue(e);return s.isTimeSeries()?r=At.call(t,r):s.isCategorized()&&B(r)&&(r=i.axis_x_categories.indexOf(r)),o(r)},yv(e){const t=this,{scale:{y:s,y2:i}}=t;return(e.axis&&e.axis==="y2"?i:s)(t.getBaseValue(e))},subxx(e){return e?this.scale.subX(e.x):null}},_a={setContainerSize(){const e=this,{state:t}=e;t.current.width=e.getCurrentWidth(),t.current.height=e.getCurrentHeight()},getCurrentWidth(){const e=this;return e.config.size_width||e.getParentWidth()},getCurrentHeight(){const e=this,{config:t}=e,s=t.size_height||e.getParentHeight();return s>0?s:320/(e.hasType("gauge")&&!t.gauge_fullCircle?2:1)},getParentRectValue(e){const t=`offset${pt(e)}`;let s=this.$el.chart.node(),i=0;for(;i<30&&s&&s.tagName!=="BODY";){try{i=ct(s,!0)[e]}catch(a){t in s&&(i=s[t])}s=s.parentNode}const n=lt.body[t];return i>n&&(i=n),i},getParentWidth(){return this.getParentRectValue("width")},getParentHeight(){const e=this.$el.chart.style("height");let t=0;return e&&(t=/px$/.test(e)?parseInt(e,10):this.getParentRectValue("height")),t},getSvgLeft(e){const t=this,{config:s,state:{hasAxis:i},$el:n}=t,a=s.axis_rotated,o=a||!a&&!s.axis_y_inner,r=a?ot.axisX:ot.axisY,l=n.main.select(`.${r}`).node(),c=i&&s[`axis_${a?"x":"y"}_label`];let u=0;if(i&&(B(c)||B(c.text)||/^inner-/.test(c==null?void 0:c.position))){const p=n.main.select(`.${r}-label`);p.empty()||(u=ct(p.node()).left)}const d=l&&o?ct(l,!e):{right:0},h=ct(n.chart.node(),!e).left+u,g=t.hasArcType(),f=d.right-h-(g?0:t.getCurrentPaddingByDirection("left",e));return f>0?f:0},updateDimension(e){var t;const s=this,{config:i,state:{hasAxis:n},$el:a}=s;n&&!e&&s.axis.x&&i.axis_rotated&&((t=s.axis.subX)==null||t.create(a.axis.subX)),s.updateScales(e),s.updateSvgSize(),s.transformAll(!1)},updateSvgSize(){const e=this,{config:t,state:{clip:s,current:i,hasAxis:n,width:a,height:o},$el:{svg:r}}=e;if(t.resize_auto==="viewBox"?r.attr("viewBox",`0 0 ${i.width} ${i.height}`):r.attr("width",i.width).attr("height",i.height),n){const l=r.select(`.${os.brush} .overlay`),c={width:0,height:0};l.size()&&(c.width=+l.attr("width"),c.height=+l.attr("height")),r.selectAll([`#${s.id}`,`#${s.idGrid}`]).select("rect").attr("width",a).attr("height",o),r.select(`#${s.idXAxis}`).select("rect").call(e.setXAxisClipPath.bind(e)),r.select(`#${s.idYAxis}`).select("rect").call(e.setYAxisClipPath.bind(e)),s.idSubchart&&r.select(`#${s.idSubchart}`).select("rect").attr("width",a).attr("height",c.height)}},getCurrentPaddingByDirection(e,t=!1,s=!1){var i;const n=this,{config:a,$el:o,state:{hasAxis:r}}=n,l=a.axis_rotated,c=((i=a.padding)==null?void 0:i.mode)==="fit",u=I(a[`padding_${e}`])?a[`padding_${e}`]:void 0,d=r?{top:l?"y2":null,bottom:l?"y":"x",left:l?"x":"y",right:l?null:"y2"}[e]:null,h=/^(left|right)$/.test(e),g=d&&a[`axis_${d}_inner`],f=d&&a[`axis_${d}_show`],p=d?a[`axis_${d}_axes`].length:0;let _=d?h?n.getAxisWidthByAxisId(d,t):n.getHorizontalAxisHeight(d):0;const x=20;let m=0;!c&&h&&(_=vn(_));let y=r&&h&&(g||nt(u)&&!f)?0:c?(f?_:0)+(u!=null?u:0):nt(u)?_:u;return h&&r?(d&&(c||g)&&a[`axis_${d}_label`].text&&(y+=n.axis.getAxisLabelPosition(d).isOuter?x:0),e==="right"?(y+=l?!c&&nt(u)?10:2:!f||g?c?2:1:0,y+=s?n.axis.getXAxisTickTextY2Overflow(x):0):e==="left"&&l&&nt(u)&&(y=a.axis_x_show?c?_:Math.max(_,40):1)):e==="top"?(o.title&&o.title.node()&&(y+=n.getTitlePadding()),m=l&&!g?p:0):e==="bottom"&&r&&l&&!f&&(y+=1),y+_*p-m},getCurrentPadding(e=!1){const t=this,[s,i,n,a]=["top","bottom","left","right"].map(o=>t.getCurrentPaddingByDirection(o,null,e));return{top:s,bottom:i,left:n,right:a}},getResettedPadding(e){const t=this,{config:s}=t,i=I(e);let n=i?0:{};return s.padding===!1?!i&&Object.keys(e).forEach(a=>{n[a]=!vt(s.data_labels)&&s.data_labels!==!1&&a==="top"?e[a]:0}):n=e,n},updateSizes(e){var t,s,i,n,a;const o=this,{config:r,state:l,$el:{legend:c}}=o,u=r.axis_rotated,d=o.hasArcType()||l.hasFunnel||l.hasTreemap,h=((t=r.padding)==null?void 0:t.mode)==="fit";!e&&o.setContainerSize();const g={width:c?o.getLegendWidth():0,height:c?o.getLegendHeight():0};!d&&r.axis_x_show&&r.axis_x_tick_autorotate&&o.updateXAxisTickClip();const f={right:r.legend_show&&l.isLegendRight?o.getLegendWidth()+(h?0:20):0,bottom:!r.legend_show||l.isLegendRight||l.isLegendInset?0:g.height},p=u||d?0:o.getHorizontalAxisHeight("x"),_=r.subchart_axis_x_show&&r.subchart_axis_x_tick_text_show?p:30,x=r.subchart_show&&!d?r.subchart_size_height+_:0,m=o.hasType("gauge")&&r.arc_needle_show&&!r.gauge_fullCircle&&!r.gauge_label_show?10:0,y=o.getCurrentPadding(!0);if(l.margin=!d&&u?{top:y.top,right:d?0:y.right+f.right,bottom:f.bottom+y.bottom,left:x+(d?0:y.left)}:{top:(h?0:4)+y.top,right:d?0:y.right+f.right,bottom:m+x+f.bottom+y.bottom,left:d?0:y.left},l.margin=o.getResettedPadding(l.margin),l.margin2=u?{top:l.margin.top,right:NaN,bottom:20+f.bottom,left:o.state.rotatedPadding.left}:{top:l.current.height-x-f.bottom,right:NaN,bottom:_+f.bottom,left:l.margin.left},l.margin3={top:0,right:NaN,bottom:0,left:0},(s=o.updateSizeForLegend)==null||s.call(o,g),l.width=l.current.width-l.margin.left-l.margin.right,l.height=l.current.height-l.margin.top-l.margin.bottom,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l.width2=u?l.margin.left-l.rotatedPadding.left-l.rotatedPadding.right:l.width,l.height2=u?l.height:l.current.height-l.margin2.top-l.margin2.bottom,l.width2<0&&(l.width2=0),l.height2<0&&(l.height2=0),o.hasArcType()){const $=o.hasType("gauge"),v=r.legend_show&&l.isLegendRight,b=(i=l.hasRadar&&o.cache.get(xt.radarTextWidth))!=null?i:0;l.arcWidth=l.width-(v?g.width+10:0)-b,l.arcHeight=l.height-(v&&!$?0:10),(n=r.arc_rangeText_values)!=null&&n.length&&($?(l.arcWidth-=25,l.arcHeight-=10,l.margin.left+=10):(l.arcHeight-=20,l.margin.top+=10)),$&&!r.gauge_fullCircle&&(l.arcHeight+=l.height-o.getPaddingBottomForGauge()),(a=o.updateRadius)==null||a.call(o)}l.isLegendRight&&d&&(l.margin3.left=l.arcWidth/2+l.radiusExpanded*1.1)}},ma={setCssRule(e,t,s,i){const n=this,{config:a,state:{cssRule:o,style:r}}=n;return a.boost_useCssRule?l=>{l.each(c=>{const u=i&&(i==null?void 0:i.call(n,c)),d=`${e?`.${it.shapes+n.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[d]),n.state.cssRule[d]=Rn(r,d,s.filter(Boolean).map(h=>B(u)&&h.indexOf(":")===-1?`${h}: ${u}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:k(e)?e.bind(this):e}};function ya(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function $a(e,t,s,i,n){var a;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=I(r)&&r<0||l&&!((a=o.getCandlestickData(e))!=null&&a._isUp);let{x:u,y:d}=t;const h=4,g=h*2;return i?s==="start"?(u+=c?0:g,d+=h):s==="middle"?(u+=g,d-=g):s==="end"&&(c&&(u-=g),d+=h):(s==="start"?(u+=h,c&&(d+=g*2)):s==="middle"?d-=g:s==="end"&&(u-=h,c&&(d+=g*2)),n&&(d+=c?-17:l?13:7)),{x:u,y:d}}function Os(e,t){var s;const i=this.config.data_labels_position,{id:n,index:a,value:o}=e;return(s=k(i)?i.bind(this.api)(t,o,n,a,this.$el.text):(n in i?i[n]:i)[t])!=null?s:0}function ba(e,t,s){var i,n;const a=this,{config:o,$T:r}=a,l=o.axis_rotated,{border:{padding:c="3 5",radius:u=10,stroke:d="#000",strokeWidth:h=1,fill:g="none"}}=o.data_labels,f=Pn(c),p=o.data_labels.border!==!0,_=Yt(e);let x=(0,R.select)(e.previousElementSibling);(x.empty()||((i=x.node())==null?void 0:i.tagName)!=="rect"||!((n=x.attr("class"))!=null&&n.includes(s)))&&(x=(0,R.select)(e.parentNode).insert("rect",()=>e).attr("class",`${rt.textBorderRect} ${s}`).attr("width",_.width+(p?f.left+f.right:0)).attr("height",_.height+(p?f.top+f.bottom:0)),p&&x.style("fill",g).style("stroke",d).style("stroke-width",`${h}px`).attr("rx",u).attr("ry",u)),r(x).attr("x",t.x-(p?f.left:0)-(l?0:_.width/2)).attr("y",t.y-(p?f.top:0)-_.height/4*3.2)}function Ue(e=0,t){const s=this,{config:i}=s,n=i[`${t}_label_threshold`]||0;return e>=n}function Is(){const e=this,{$el:{text:t},config:s}=e;(e.state.arcWidth?e.getArcLabelConfig("image"):s.data_labels.image)&&t.filter(function(){const n=this.previousElementSibling;return n?n.tagName!=="image"||!n.classList.contains(rt.textLabelImage):!0}).each(function(n){var a,o,r,l;const{url:c,width:u,height:d,pos:h}=va.call(e,n);if(c){const g=(0,R.select)(this.parentNode);g==null||g.insert("image",`${(o=(a=this.getAttribute("class"))==null?void 0:a.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",f=>ge(c,{ID:"id"in f?f.id:f.data.id})).attr("class",rt.textLabelImage).style("pointer-events","none").attr("width",u).attr("height",d).attr("transform",h?`translate(${(r=h.x)!=null?r:0} ${(l=h.y)!=null?l:0})`:null)}})}function va(e){var t;const s=this,{config:i,state:n}=s,a=n.arcWidth?s.getArcLabelConfig("image"):i.data_labels.image;if(k(a))return(t=a.call(s.api,e.value,e.id,e.index))!=null?t:{url:"",width:0,height:0,pos:{x:0,y:0}};if(a){const{url:o="",width:r=0,height:l=0,pos:c}=a;return{url:o,width:r,height:l,pos:c}}return null}function Ds(e,t){var s;const i=this,{config:n,state:{arcWidth:a,hasTreemap:o}}=i,r=n.axis_rotated,l=(0,R.select)(e.previousElementSibling),c=u=>{var d;const h=u.style.opacity!=="0"&&u.style.fillOpacity!=="0";return(a?u.textContent:h)&&((d=this.previousElementSibling)==null?void 0:d.tagName)!=="image"};if(!l.empty()&&((s=l.node())==null?void 0:s.tagName)==="image"){const u=ct(e),d=+l.attr("width")/2,h=+l.attr("height")/2;let g=t.x-d,f=t.y-h-u.height/2;r?t.x+=d:(o&&(g=-d,f=-(h*2+u.height)),i.hasType("pie")||i.hasType("polar")||(t.y+=h)),i.$T(l).style("opacity",c(e)?null:"0").attr("x",g).attr("y",f)}}var Ta={opacityForText(e){const t=this;return t.isBarType(e)&&!Ue.call(t,Math.abs(t.getRatio("bar",e)),"bar")?"0":t.hasDataLabel?null:"0"},initText(){const{$el:e}=this;e.main.select(`.${D.chart}`).append("g").attr("class",rt.chartTexts).style("pointer-events",e.funnel||e.treemap?"none":null)},updateTargetsForText(e){const t=this,s=t.getChartClass("Text"),i=t.getClass("texts","id"),n=t.classFocus.bind(t);t.$el.main.select(`.${rt.chartTexts}`).selectAll(`.${rt.chartText}`).data(t.filterNullish(e)).attr("class",r=>`${s(r)}${n(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",s).call(t.setCssRule(!0,` .${rt.text}`,["fill","pointer-events:none"],t.updateTextColor)).append("g").attr("class",i)},updateText(){const e=this,{$el:t,$T:s,config:i,axis:n}=e,a=e.getClass("text","index"),o=i.data_labels.centered,r=t.main.selectAll(`.${rt.texts}`).selectAll(`.${rt.text}`).data(e.labelishData.bind(e));s(r.exit()).style("fill-opacity","0").remove(),t.text=r.enter().append("text").merge(r).attr("class",a).attr("text-anchor",l=>{let u=i[`axis_${n==null?void 0:n.getId(l.id)}_inverted`]?l.value>0:l.value<0;if(e.isCandlestickType(l)){const d=e.getCandlestickData(l);u=!(d!=null&&d._isUp)}else if(e.isTreemapType(l))return o?"middle":"start";return i.axis_rotated?u?"end":"start":"middle"}).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each(function(l,c,u){const d=(0,R.select)(this);let{value:h}=l;if(e.isBubbleZType(l))h=e.getBubbleZData(h,"z");else if(e.isCandlestickType(l)){const g=e.getCandlestickData(l);g&&(h=g.close)}h=e.isTreemapType(l)?e.treemapDataLabelFormat(l)(d):e.dataLabelFormat(l.id)(h,l.id,l.index,u),I(h)?this.textContent=h:Qt(d,h,void 0,!0)}),Is.call(e)},updateTextColor(e){const t=this,{config:s}=t,i=s.data_labels_colors,n=t.isArcType(e)&&!t.isRadarType(e)||t.isFunnelType(e)||t.isTreemapType(e)?null:t.color(e);let a;if(B(i))a=i;else if(N(i)){const{id:o}=e.data||e;a=i[o]}else k(i)&&(a=i.bind(t.api)(n,e));if(t.isCandlestickType(e)&&!k(i)){const o=t.getCandlestickData(e);if(!(o!=null&&o._isUp)){const r=s.candlestick_color_down;a=N(r)?r[e.id]:r}}return a||n},updateTextBGColor(e,t){const s=this,{$el:{defs:i}}=s;let n="";if(t){const a=B(t)?"":s.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=i.select(["filter[id*='labels-bg","']"].join(a));if(o.size()&&(n=`url(#${o.attr("id")})`),k(t)){s.generateTextBGColorFilter(t);const r=s.color(e),l=t.bind(s.api)(r,e);l?o.select("feFlood").attr("flood-color",l):n=""}}return n||null},redrawText(e,t,s,i){const n=this,{$T:a,axis:o,config:r,state:{hasTreemap:l}}=n,c=Ct(!0),u=r.axis_rotated,d=r.data_labels.rotate,h=ya(d),g=d?`rotate(${d})`:"";return n.$el.text.style("fill",n.getStylePropValue(n.updateTextColor)).attr("filter",f=>n.updateTextBGColor.bind(n)(f,r.data_labels_backgroundColors)).style("fill-opacity",s?0:n.opacityForText.bind(n)).each(function(f,p){const _=a(l&&this.childElementCount?this.parentNode:this,!!(i&&(this.getAttribute("x")||this.getAttribute("transform"))),c),x=r[`axis_${o==null?void 0:o.getId(f.id)}_inverted`];let m={x:e.bind(this)(f,p),y:t.bind(this)(f,p)};d&&(m=$a.bind(n)(f,m,h,u,x),_.attr("text-anchor",h)),Ds.call(n,this,m),this.childElementCount||d?_.attr("transform",`translate(${m.x} ${m.y}) ${g}`):_.attr("x",m.x).attr("y",m.y),r.data_labels.border&&ba.call(n,_.node(),m,`${rt.textBorderRect}-${p}`)}),!0},getTextRect(e,t){var s,i;const n=this;let a,o,r;Array.isArray(e)?a=`${xt.textRect}-${e.join("_")}`:(o=(i=(s=e.node)==null?void 0:s.call(e))!=null?i:e,/text/i.test(o.tagName)||(o=o.querySelector("text")),r=o.textContent,a=`${xt.textRect}-${r.replace(/\W/g,"_")}`);const l=n.cache.get(a)||[];return l.length===0&&((n.$el.svg||n.$el.chart.select("svg")).selectAll(`.${D.dummy}`).data(r?[r]:e).enter().append("text").style("visibility","hidden").style("font",o?(0,R.select)(o).style("font"):null).classed(t||D.dummy,!0).text(c=>c).each(function(c,u){l[u]=ct(this)}).remove(),n.cache.add(a,l)),l.length>1?l:l[0]},generateXYForText(e,t){const s=this,{state:{hasRadar:i,hasFunnel:n,hasTreemap:a}}=s,o=Object.keys(e),r={},l=t?s.getXForText:s.getYForText;return n&&o.push("funnel"),i&&o.push("radar"),a&&o.push("treemap"),o.forEach(c=>{r[c]=s[`generateGet${pt(c)}Points`](e[c],!1)}),function(c,u){const d=s.isAreaType(c)&&"area"||s.isBarType(c)&&"bar"||s.isCandlestickType(c)&&"candlestick"||s.isFunnelType(c)&&"funnel"||s.isRadarType(c)&&"radar"||s.isTreemapType(c)&&"treemap"||"line";return l.call(s,r[d](c,u),c,this)}},getCenteredTextPos(e,t,s,i){const n=this,{config:a}=n,o=a.axis_rotated,r=n.isBarType(e),l=n.isTreemapType(e);if(a.data_labels.centered&&(r||l)){const c=Yt(s);if(r){const u=n.getRangedData(e,null,"bar")>=0;if(o){const d=(u?t[1][1]-t[0][1]:t[0][1]-t[1][1])/2+c.width/2;return u?-d-3:d+2}else{const d=(u?t[0][1]-t[1][1]:t[1][1]-t[0][1])/2+c.height/2;return u?d:-d-2}}else if(l)return i==="x"?(t[1][0]-t[0][0])/2:(t[1][1]-t[0][1])/2-c.y-c.height/2}return 0},getXForText(e,t,s){var i;const n=this,{config:a}=n,o=a.axis_rotated,r=n.isFunnelType(t),l=n.isTreemapType(t);let c=e?e[0][0]:0;if(n.isCandlestickType(t))o?c=(i=n.getCandlestickData(t))!=null&&i._isUp?e[2][2]+4:e[2][1]-4:c+=(e[1][0]-c)/2;else if(r)c+=n.state.current.width/2;else if(l)c+=a.data_labels.centered?0:5;else if(o){const u=a[`axis_${n.axis.getId(t.id)}_inverted`],d=n.isBarType(t)?4:6,h=t.value;c=e[2][1],u?c-=d*(h>0?1:-1):c+=d*(h<0?-1:1)}else c=n.hasType("bar")?(e[2][0]+e[0][0])/2:c;return(o||l)&&(c+=n.getCenteredTextPos(t,e,s,"x")),c+Os.call(this,t,"x")},getYForText(e,t,s){const i=this,{axis:n,config:a,state:o}=i,r=a.axis_rotated,l=a[`axis_${n==null?void 0:n.getId(t.id)}_inverted`],c=i.isBarType(t),u=i.isFunnelType(t),d=i.isTreemapType(t),h=a.point_r,g=ct(s);let{value:f}=t,p=3,_;if(i.isCandlestickType(t))f=i.getCandlestickData(t),r?(_=e[0][0],_+=(e[1][0]-_)/2+p):(_=f&&f._isUp?e[2][2]-p:e[2][1]+p*4,l&&(_+=15*(f._isUp?1:-1)));else if(u)_=e?e[0][1]+(e[1][1]-e[0][1])/2+g.height/2-3:0;else if(d)_=e[0][1]+(a.data_labels.centered?0:g.height+5);else if(r)_=(e[0][0]+e[2][0]+g.height*.6)/2;else if(_=e[2][1],I(h)&&h>5&&(i.isLineType(t)||i.isScatterType(t))&&(p+=a.point_r/2.3),f<0||f===0&&!o.hasPositiveValue&&o.hasNegativeValue)_+=l?c?-3:-5:g.height+(c?-p:p);else{let x=-p*2;c?x=-p:i.isBubbleType(t)&&(x=p),l&&(x=c?10:15),_+=x}return(!r||d)&&(_+=i.getCenteredTextPos(t,e,s,"y")),_+Os.call(this,t,"y")},markOverlapped(e,t,s){const i=t.$el.arcs.selectAll(s),n=i.filter(l=>l.data.id!==e),a=i.filter(l=>l.data.id===e),o=ys(a.node()),r=(l,c)=>Math.sqrt(Math.pow(l,2)+Math.pow(c,2));a.node()&&n.each(function(){const l=ys(this),c=(0,R.select)(this),u=r(o.e,o.f)>r(l.e,l.f)?a:c,d=Math.ceil(Math.abs(o.e-l.e))<Math.ceil(u.node().getComputedTextLength()),h=Math.ceil(Math.abs(o.f-l.f))<parseInt(a.style("font-size"),10);c.classed(rt.TextOverlapping,d&&h)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,R.selectAll)([this,this.previousSibling]).classed(rt.TextOverlapping,!1)})}};function zs(e="left",t){const s=I(t);let i;return e.indexOf("center")>-1?i=s?t/2:"middle":e.indexOf("right")>-1?i=s?t:"end":i=s?0:"start",i}var Aa={initTitle(){const e=this,{config:t,$el:s}=e;if(t.title_text){s.title=s.svg.append("g");const i=s.title.append("text").style("text-anchor",zs(t.title_position)).attr("class",rt.title);Qt(i,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:s},$el:{title:i}}=e;if(i){const n=zs(t.title_position,s.width),a=(t.title_padding.top||0)+e.getTextRect(e.$el.title,rt.title).height;i.attr("transform",`translate(${n}, ${a})`)}},getTitlePadding(){const e=this,{$el:{title:t},config:s}=e;return(s.title_padding.top||0)+(t?e.getTextRect(t,rt.title).height:0)+(s.title_padding.bottom||0)}},wa={initTooltip(){const e=this,{config:t,$el:s}=e;s.tooltip=(0,R.select)(t.tooltip_contents.bindto),s.tooltip.empty()&&(s.tooltip=s.chart.append("div").attr("class",be.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.bindTooltipResizePos()},initShowTooltip(){var e;const t=this,{config:s,$el:i,state:{hasAxis:n,hasRadar:a}}=t;if(s.tooltip_init_show){const o=!(n||a);(e=t.axis)!=null&&e.isTimeSeries()&&B(s.tooltip_init_x)&&(s.tooltip_init_x=At.call(t,s.tooltip_init_x)),t.api.tooltip.show({data:{[o?"index":"x"]:s.tooltip_init_x}});const r=s.tooltip_init_position;if(!s.tooltip_contents.bindto&&!vt(r)){const{top:l=0,left:c=50}=r;i.tooltip.style("top",B(l)?l:`${l}px`).style("left",B(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:s,config:i}=t;return k(i.tooltip_contents)?i.tooltip_contents.bind(s)(...e):t.getTooltipContent(...e)},getTooltipContent(e,t,s,i){var n;const a=this,{api:o,config:r,state:l,$el:c}=a,[u,d,h]=["title","name","value"].map(E=>{const P=r[`tooltip_format_${E}`];return k(P)?P.bind(o):P}),g=(...E)=>Pt((u||t)(...E)),f=(...E)=>Pt((d||(P=>P))(...E)),p=(E,P,F,U)=>{let Y=h;return Y||(l.hasTreemap||a.isStackNormalized()&&(!a.isStackNormalizedPerGroup()||a.isGrouped(F))?Y=(ut,et)=>`${(et*100).toFixed(2)}%`:Y=s),Pt(Y(E,P,F,U))},_=r.tooltip_order,x=E=>a.axis&&a.isBubbleZType(E)?a.getBubbleZData(E.value,"z"):a.getBaseValue(E),m=a.levelColor?E=>a.levelColor(E.value):E=>i(E),y=r.tooltip_contents,$=y.template,v=a.mapToTargetIds();if(_===null&&r.data_groups.length){const E=a.orderTargets(a.data.targets).map(P=>P.id).reverse();e.sort((P,F)=>{let U=P?P.value:null,Y=F?F.value:null;return U>0&&Y>0&&(U=P.id?E.indexOf(P.id):null,Y=F.id?E.indexOf(F.id):null),U-Y})}else if(/^(asc|desc)$/.test(_)){const E=_==="asc";e.sort((P,F)=>{const U=P?x(P):null,Y=F?x(F):null;return E?U-Y:Y-U})}else k(_)&&e.sort(_.bind(o));const b=a.getTooltipContentTemplate($),T=e.length;let C,w,S,A,O;for(O=0;O<T;O++)if(w=e[O],!(!w||!(x(w)||x(w)===0))){if(nt(C)){const E=(l.hasAxis||l.hasRadar)&&g(w.x);C=ge(b[0],{CLASS_TOOLTIP:be.tooltip,TITLE:M(E)?$?E:`<tr><th colspan="2">${E}</th></tr>`:""})}if(!w.ratio&&c.arcs&&(S=["arc",a.$el.arcs.select(`path.${X.arc}-${w.id}`).data()[0]],w.ratio=a.getRatio(...S)),S=[w.ratio,w.id,w.index],a.isAreaRangeType(w)){const[E,P]=["high","low"].map(U=>p(a.getRangedData(w,U),...S));A=`<b>Mid:</b> ${p(x(w),...S)} <b>High:</b> ${E} <b>Low:</b> ${P}`}else if(a.isCandlestickType(w)){const[E,P,F,U,Y]=["open","high","low","close","volume"].map(ut=>a.getRangedData(w,ut,"candlestick")?p(a.getRangedData(w,ut,"candlestick"),...S):void 0);A=`<b>Open:</b> ${E} <b>High:</b> ${P} <b>Low:</b> ${F} <b>Close:</b> ${U}${Y?` <b>Volume:</b> ${Y}`:""}`}else if(a.isBarRangeType(w)){const{value:E,id:P,index:F}=w;A=`${p(E,void 0,P,F)}`}else A=p(x(w),...S);if(A!==void 0){if(w.name===null)continue;const E=f((n=w.name)!=null?n:w.id,...S),P=m(w),F={CLASS_TOOLTIP_NAME:be.tooltipName+a.getTargetSelectorSuffix(w.id),COLOR:$||!a.patterns?P:`<svg><rect style="fill:${P}" width="10" height="10"></rect></svg>`,NAME:E,VALUE:A};if($&&N(y.text)){const U=v.indexOf(w.id);Object.keys(y.text).forEach(Y=>{F[Y]=y.text[Y][U]})}C+=ge(b[1],F)}}return`${C}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
|
|
17
|
+
};`],{type:"text/javascript"})),B.URL.createObjectURL(Ye[n])}function ma(e){const t=new B.Worker(e);return t.onerror=function(s){console.error?console.error(s):console.log(s)},t}function je(e=!0,t,s,i){let n=function(...a){const o=t(...a);s(o)};if(B.Worker&&e){const a=_a(t,i),o=ma(a);n=function(...r){o.postMessage(r),o.onmessage=function(l){return B.URL.revokeObjectURL(a),s(l.data)}}}return n}var Re=Z(5);function We(e){const t=[];return e.forEach(function(s,i){const n=s[0];s.forEach(function(a,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof a=="undefined")throw new Error(`Source data is missing a component at (${i}, ${o})!`);t[o-1][n]=a}})}),t}function He(e){const t=e[0],s=[];return e.forEach(function(i,n){if(n>0){const a={};i.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${n}, ${r})!`);a[t[r]]=o}),s.push(a)}}),s}function Ds(e,t){const s=[];let i,n;if(Array.isArray(e)){const a=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let u=o;return c.some(function(d){return!(u=u&&d in u?u[d]:void 0)}),u};t.x?i=t.value.concat(t.x):i=t.value,s.push(i),e.forEach(function(o){const r=i.map(function(l){let c=a(o,l);return typeof c=="undefined"&&(c=null),c});s.push(r)}),n=He(s)}else Object.keys(e).forEach(function(a){var o;const r=e[a].concat();(o=r.unshift)==null||o.call(r,a),s.push(r)}),n=We(s);return n}function ya(e,t="csv",s,i,n){const a=new XMLHttpRequest,o={csv:$a,tsv:ba,json:Ds};a.open("GET",e),s&&Object.keys(s).forEach(function(r){a.setRequestHeader(r,s[r])}),a.onreadystatechange=function(){if(a.readyState===4)if(a.status===200){const r=a.responseText;r&&n.call(this,o[t](t==="json"?JSON.parse(r):r,i))}else throw new Error(`${e}: Something went wrong loading!`)},a.send()}function zs(e,t){const s=e.rows(t);let i;return s.length===1?(i=[{}],s[0].forEach(n=>{i[0][n]=null})):i=e.parse(t),i}function $a(e){return zs({rows:Re.csvParseRows,parse:Re.csvParse},e)}function ba(e){return zs({rows:Re.tsvParseRows,parse:Re.tsvParse},e)}function Fs(e,t){const s=e||(t==null?void 0:t.data_keys);return s!=null&&s.x&&(t.data_x=s.x),s}function va(e,t,s){const i=this,{config:n}=i;let a;e.forEach(o=>{const r=i.getXKey(o);if(s.customX||s.timeSeries?s.xs.indexOf(r)>=0?a=(s.appendXs&&i.data.xs[o]||[]).concat(t.map((l,c)=>{const u=M(l[r]);return u?i.generateTargetX(u,o,c):!1}).filter(l=>l!==!1)):n.data_x?a=this.getOtherTargetXs():ot(n.data_xs)&&(a=i.getXValuesOfXKey(r,i.data.targets)):a=t.map((l,c)=>c),a)i.data.xs[o]=a;else throw new Error(`x is not defined for id = "${o}".`)})}var Ta={convertData(e,t){const{config:s}=this,i=a=>a!=null&&a.length&&!vt(a[0])?s.boost_useWorker:!1;let n=e;if(e.bindto&&(n={},["url","mimeType","headers","keys","json","keys","rows","columns"].forEach(a=>{const o=`data_${a}`;o in e&&(n[a]=e[o])})),n.url&&t)ya(n.url,n.mimeType,n.headers,Fs(n.keys,s),t);else if(n.json)je(i(n.json),Ds,t,[We,He])(n.json,Fs(n.keys,s));else if(n.rows)je(i(n.rows),He,t)(n.rows);else if(n.columns)je(i(n.columns),We,t)(n.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const s=this,{axis:i,config:n,state:a}=s,o=n.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((h,g)=>(s.isX.call(s,g)?h.xs.push(g):s.isNotX.call(s,g)&&h.ids.push(g),h),{ids:[],xs:[]}):{ids:[],xs:[]},u={appendXs:t,xs:c,idConverter:n.data_idConverter.bind(s.api),categorized:i==null?void 0:i.isCategorized(),timeSeries:i==null?void 0:i.isTimeSeries(),customX:i==null?void 0:i.isCustomX()};va.bind(s)(l,e,u);const d=l.map((h,g)=>{const f=n.data_idConverter.bind(s.api)(h),p=s.getXKey(h),_=u.customX&&u.categorized,x=_&&(()=>{const $=Cs(n.axis_x_categories);return e.every(v=>$.has(v.x))})(),m=e.__append__,y=p===null&&m?s.api.data.values(h).length:0;return{id:f,id_org:h,values:e.map(($,v)=>{const b=$[p];let T=$[h],C;return T=T!==null&&!isNaN(T)&&!G(T)?+T:Y(T)||G(T)?T:null,(_||a.hasRadar)&&g===0&&!nt(b)?(!x&&g===0&&v===0&&!m&&(n.axis_x_categories=[]),C=n.axis_x_categories.indexOf(b),C===-1&&(C=n.axis_x_categories.length,n.axis_x_categories.push(b))):C=s.generateTargetX(b,h,y+v),(nt(T)||s.data.xs[h].length<=v)&&(C=void 0),{x:C,value:T,id:f,index:-1}}).filter($=>H($.x))}});if(d.forEach(h=>{var g;n.data_xSort&&(h.values=h.values.sort((f,p)=>{const _=f.x||f.x===0?f.x:1/0,x=p.x||p.x===0?p.x:1/0;return _-x})),h.values.forEach((f,p)=>f.index=p),(g=s.data.xs[h.id])==null||g.sort((f,p)=>f-p)}),a.hasNegativeValue=s.hasNegativeValueInTargets(d),a.hasPositiveValue=s.hasPositiveValueInTargets(d),o&&s.isValidChartType(o)){const h=s.mapToIds(d).filter(g=>!(g in n.data_types)||!s.isValidChartType(n.data_types[g]));s.setTargetType(h,o)}return d.forEach(h=>s.cache.add(h.id_org,h,!0)),d}},Aa={isX(e){const t=this,{config:s}=t,i=s.data_x&&e===s.data_x,n=ot(s.data_xs)&&Wn(s.data_xs,e);return i||n},isNotX(e){return!this.isX(e)},isStackNormalized(){const{config:e}=this;return!!((e.data_stack_normalize===!0||bt(e.data_stack_normalize))&&e.data_groups.length)},isStackNormalizedPerGroup(){var e;const{config:t}=this;return!!(bt(t.data_stack_normalize)&&((e=t.data_stack_normalize)!=null&&e.perGroup)&&t.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(s=>s.indexOf(e)>=0&&s.length>1):t.length>0},hasAxisGroupedData(e){const t=this,{axis:s}=t;return t.data.targets.filter(a=>s.getId(a.id)===e).map(a=>a.id).some(a=>t.isGrouped(a))},getXKey(e){const t=this,{config:s}=t;return s.data_x?s.data_x:ot(s.data_xs)?s.data_xs[e]:null},getXValuesOfXKey(e,t){const s=this,i=t&&ot(t)?s.mapToIds(t):[];let n;return i.forEach(a=>{s.getXKey(a)===e&&(n=s.data.xs[a])}),n},getIndexByX(e,t){const s=this;return t?t.indexOf(N(e)?e:+e):(s.filterByX(s.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const s=this;return e in s.data.xs&&s.data.xs[e]&&M(s.data.xs[e][t])?s.data.xs[e][t]:t},getOtherTargetXs(){const e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},getOtherTargetX(e){const t=this.getOtherTargetXs();return t&&e<t.length?t[e]:null},addXs(e){const t=this,{config:s}=t;Object.keys(e).forEach(i=>{s.data_xs[i]=e[i]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(ot(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:s}=t;let i;return e&&(i=s.data_names[e.id],e.name=i!==void 0?i:e.id),e},getAllValuesOnIndex(e,t=!1){const s=this;let i=s.filterTargetsToShow(s.data.targets).map(n=>s.addName(s.getValueOnIndex(n.values,e)));return t&&(i=i.filter(n=>n&&"value"in n&&M(n.value))),i},getValueOnIndex(e,t){const s=e.filter(i=>i.index===t);return s.length?s[0]:null},updateTargetX(e,t){const s=this;e.forEach(i=>{i.values.forEach((n,a)=>{n.x=s.generateTargetX(t[a],i.id,a)}),s.data.xs[i.id]=t})},updateTargetXs(e,t){const s=this;e.forEach(i=>{t[i.id]&&s.updateTargetX([i],t[i.id])})},generateTargetX(e,t,s){const i=this,{axis:n}=i;let a=n!=null&&n.isCategorized()?s:e||s;if(n!=null&&n.isTimeSeries()){const o=At.bind(i);a=o(e||i.getXValue(t,s))}else n!=null&&n.isCustomX()&&!(n!=null&&n.isCategorized())&&(a=M(e)?+e:i.getXValue(t,s));return a},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return H(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return H(t)?t:null},getBaseValue(e){const t=this,{hasAxis:s}=t.state;let{value:i}=e;return i&&s&&(t.isAreaRangeType(e)?i=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(i=t.getBubbleZData(i,"y"))),i},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let s,i;return(e||this.data.targets.map(n=>n.values)).forEach((n,a)=>{const o=n.map(t).filter(I);s=Math.min(a?s:1/0,...o),i=Math.max(a?i:-1/0,...o)}),{min:s,max:i}},getMinMaxData(){const e=this,t=at.dataMinMax;let s=e.cache.get(t);if(!s){const i=e.data.targets.map(c=>c.values),n=e.getMinMaxValue(i);let a=[],o=[];const{min:r,max:l}=n;i.forEach(c=>{const u=e.getFilteredDataByValue(c,r),d=e.getFilteredDataByValue(c,l);u.length&&(a=a.concat(u)),d.length&&(o=o.concat(d))}),e.cache.add(t,s={min:a,max:o})}return s},getTotalPerIndex(e){const t=this,{config:s}=t,i=e?`${at.dataTotalPerIndex}-${e}`:at.dataTotalPerIndex;let n=t.cache.get(i);if((t.config.data_groups.length||t.isStackNormalized())&&!n){n=[];let{targets:a}=t.data;if(t.isStackNormalizedPerGroup()&&e){const o=s.data_groups.find(r=>r.indexOf(e)>=0);if(o)a=a.filter(r=>o.indexOf(r.id)>=0);else return null}a.forEach(o=>{o.values.forEach((r,l)=>{n[l]||(n[l]=0),n[l]+=~~r.value})}),t.cache.add(i,n)}return n},getTotalDataSum(e){const t=this,s=at.dataTotalSum;let i=t.cache.get(s);return I(i)||(i=t.data.targets.reduce((n,a)=>n+a.values.reduce((o,r)=>{var l;return o+((l=r.value)!=null?l:0)},0),0),t.cache.add(s,i)),e&&(i-=t.getHiddenTotalDataSum()),i},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:s}}=e;let i=0;return s.length&&(i=t.data.values.bind(t)(s).reduce((n,a)=>n+a)),i},getFilteredDataByValue(e,t){return e.filter(s=>this.getBaseValue(s)===t)},getMaxDataCount(){return Math.max(...this.data.targets.map(e=>e.values.length),0)},getMaxDataCountTarget(){let e=this.filterTargetsToShow()||[];const t=e.length,s=this.config.axis_x_inverted;return t>1?(e=e.map(i=>i.values).reduce((i,n)=>i.concat(n)).map(i=>i.x),e=ee(Be(e)).map((i,n,a)=>({x:i,index:s?a.length-n-1:n}))):t&&(e=e[0].values.concat()),e},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?Y(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const s=this.mapToIds(e);for(let i=0,n;n=s[i];i++)if(n===t)return!0;return!1},isTargetToShow(e){return this.state.hiddenTargetIds.indexOf(e)<0},isLegendToShow(e){return this.state.hiddenLegendIds.indexOf(e)<0},filterTargetsToShow(e){const t=this;if(!e){const{cache:s,data:i,state:n}=t,a=at.filteredTargets,o=n.hiddenTargetIds.join(","),r=s.get(at.visibilityChecksum);if(o!==r&&(s.remove(a),s.add(at.visibilityChecksum,o)),s.has(a))return s.get(a);const l=i.targets.filter(c=>t.isTargetToShow(c.id));return s.add(a,l),l}return e.filter(s=>t.isTargetToShow(s.id))},mapTargetsToUniqueXs(e){const t=this,{axis:s}=t;let i=[];return e!=null&&e.length&&(i=Be(ws(e.map(n=>n.values.map(a=>+a.x)))),i=s!=null&&s.isTimeSeries()?i.map(n=>new Date(+n)):i.map(Number)),ee(i)},addTargetIds(e,t){const{state:s}=this;(Y(t)?t:[t]).forEach(n=>{s[e].indexOf(n)<0&&s[e].push(n)})},removeTargetIds(e,t){const{state:s}=this;(Y(t)?t:[t]).forEach(n=>{const a=s[e].indexOf(n);a>=0&&s[e].splice(a,1)})},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:s}=t.state,i={},n=t.isMultipleX(),a=n?t.mapTargetsToUniqueXs(e).map(r=>N(r)?r:+r):null,o=a?new Map(a.map((r,l)=>[r,l])):null;return e.forEach(r=>{const l=[];r.values.filter(({value:c})=>M(c)||c===null).forEach(c=>{let{value:u}=c;if(u!==null&&t.isCandlestickType(c)&&(u=Y(u)?u.slice(0,4):[u.open,u.high,u.low,u.close]),Y(u))l.push(...u);else if(G(u)&&"high"in u)l.push(...Object.values(u));else if(t.isBubbleZType(c))l.push(s&&t.getBubbleZData(u,"y"));else if(n&&o){const d=N(c.x)?c.x:+c.x,h=o.get(d);h!==void 0&&(l[h]=u)}else l.push(u)}),i[r.id]=l}),i},checkValueInTargets(e,t){return Object.keys(e).some(s=>e[s].values.some(i=>t(i.value)))},hasMultiTargets(){return this.filterTargetsToShow().length>1},hasNegativeValueInTargets(e){return this.checkValueInTargets(e,t=>t<0)},hasPositiveValueInTargets(e){return this.checkValueInTargets(e,t=>t>0)},orderTargets(e){const t=this,s=[...e],i=t.getSortCompareFn();return i&&s.sort(i),s},getSortCompareFn(e=!1){const t=this,{config:s}=t,i=s.data_order,n=/asc/i.test(i),a=/desc/i.test(i);let o;if(n||a){const r=(c,u)=>c+Math.abs(u.value),l=c=>I(c)?c:"values"in c?c.values.reduce(r,0):c.value;o=(c,u)=>{const d=l(c),h=l(u);return e?n?d-h:h-d:n?h-d:d-h}}else k(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return ws(e.map(s=>s.values)).filter(s=>s.x-t===0)},filterNullish(e){const t=s=>M(s.value);return e&&e.filter(s=>"value"in s?t(s):s.values.some(t))},filterRemoveNull(e){return e.filter(t=>M(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(s=>({id:s.id,id_org:s.id_org,values:s.values.filter(i=>t[0]<=i.x&&i.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return Me(e)&&e||bt(e)&&ot(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:s,config:i,state:{hasRadar:n,inputType:a,eventReceiver:{coords:o,rect:r}}}=t;let l;if(n){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const u=(0,R.select)(c).datum();l=u&&Object.keys(u).length===1?u.index:void 0}else{const c=i.axis_rotated,u=Ts(s.chart.node()),d=a==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?d.clientY+u.y:d.clientX+u.x;if(Ne(s.svg)){const g=[h,0];c&&g.reverse(),h=we(s.eventRect.node(),...g)[c?"y":"x"]}else h-=c?r.top:r.left;l=Xe(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,s){var i;const n=this,a=1.3;return((i=n.getTextRect([e,t].map(o=>n.dataLabelFormat()(o))))==null?void 0:i.map(o=>o[s]*a))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const s=e[t].x,i=[];let n;for(n=t-1;n>=0&&s===e[n].x;n--)i.push(e[n]);for(n=t;n<e.length&&s===e[n].x;n++)i.push(e[n]);return i},findClosestFromTargets(e,t){const s=this,i=e.map(n=>s.findClosest(n.values,t));return s.findClosest(i,t)},findClosest(e,t){const s=this,{$el:{main:i}}=s,n=e.filter(r=>r&&M(r.value));let a,o;return n.filter(r=>s.isBarType(r.id)||s.isCandlestickType(r.id)).forEach(r=>{const l=s.isBarType(r.id)?`.${yt.chartBar}.${D.target}${s.getTargetSelectorSuffix(r.id)} .${yt.bar}-${r.index}`:`.${Lt.chartCandlestick}.${D.target}${s.getTargetSelectorSuffix(r.id)} .${Lt.candlestick}-${r.index} path`;!o&&s.isWithinBar(i.select(l).node())&&(o=r)}),n.filter(r=>!s.isBarType(r.id)&&!s.isCandlestickType(r.id)).forEach(r=>{const l=s.dist(r,t);a=s.getPointSensitivity(r),l<a&&(a=l,o=r)}),o},dist(e,t){const s=this,{config:{axis_rotated:i},scale:n}=s,a=+i,o=+!i,r=s.circleY(e,e.index),l=(n.zoom||n.x)(e.x);return Math.sqrt(Math.pow(l-t[a],2)+Math.pow(r-t[o],2))},convertValuesToStep(e){const t=this,{axis:s,config:i}=t,n=i.line_step_type,a=s?s.isCategorized():!1,o=Y(e)?e.concat():[e];if(!(a||/step\-(after|before)/.test(n)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:u}=r;o.unshift({x:--u,value:r.value,id:c}),a&&n==="step-after"&&o.unshift({x:--u,value:r.value,id:c}),u=l.x,o.push({x:++u,value:l.value,id:c}),a&&n==="step-before"&&o.push({x:++u,value:l.value,id:c})}return o},convertValuesToRange(e){const t=Y(e)?e.concat():[e],s=[];return t.forEach(i=>{const{x:n,id:a}=i;s.push({x:n,id:a,value:i.value[0]}),s.push({x:n,id:a,value:i.value[2]})}),s},updateDataAttributes(e,t){const s=this,{config:i}=s,n=i[`data_${e}`];return nt(t)||(Object.keys(t).forEach(a=>{n[a]=t[a]}),s.redraw({withLegend:!0})),n},getRangedData(e,t="",s="areaRange"){const i=e==null?void 0:e.value;if(Y(i)){if(s==="bar")return i.reduce((n,a)=>a-n);{const n={areaRange:["high","mid","low"],candlestick:["open","high","low","close","volume"]}[s].indexOf(t);return n>=0&&i?i[n]:void 0}}else if(i&&t)return i[t];return i},setRatioForGroupedData(e){const t=this,{config:s}=t;if(s.data_groups.length&&e.some(i=>t.isGrouped(i.id))){const i=n=>t.getRatio("index",n,!0);e.forEach(n=>{"values"in n?n.values.forEach(i):i(n)})}},getRatio(e,t,s=!1){const i=this,{config:n,state:a}=i,o=i.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(i.pie.padAngle()())r=t.value/i.getTotalDataSum(!0);else{const l=n.gauge_fullCircle?i.getArcLength():i.getStartingAngle()*-2,c=i.hasType("gauge")?l:Math.PI*2;r=(t.endAngle-t.startAngle)/c}else if(e==="index"){const l=o.data.values.bind(o),{hiddenTargetIds:c}=a;let u=this.getTotalPerIndex(i.isStackNormalizedPerGroup()?t.id:void 0);if(u===null)return r;if(c.length){let h=c;if(i.isStackNormalizedPerGroup()&&t.id){const g=n.data_groups.find(f=>f.indexOf(t.id)>=0);g&&(h=h.filter(f=>g.indexOf(f)>=0))}if(h.length){let g=l(h,!1);g.length&&(g=g.reduce((f,p)=>f.map((_,x)=>~~_+p[x])),u=u.map((f,p)=>f-g[p]))}}const d=u[t.index];t.ratio=I(t.value)&&u&&d?t.value/d:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/a.current.dataMax*n.radar_size_ratio;else if(e==="bar"){const c=i.getYScaleById.bind(i)(t.id).domain().reduce((u,d)=>d-u);r=c===0?0:Math.abs(i.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=i.getTotalDataSum(!0));return s&&r?r*100:r},updateDataIndexByX(e){const t=this,s=e.reduce((i,n,a)=>(i[Number(n.x)]=a,i),{});t.data.targets.forEach(i=>{i.values.forEach((n,a)=>{let o=s[Number(n.x)];o===void 0&&(o=a),n.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(G(e.value)&&("z"in e.value||"y"in e.value)||Y(e.value)&&e.value.length>=2)},isBarRangeType(e){const t=this,{value:s}=e;return t.isBarType(e)&&Y(s)&&s.length>=2&&s.every(I)},getDataById(e){var t;const s=this.cache.get(e)||this.api.data(e);return(t=s==null?void 0:s[0])!=null?t:s}};function Ms(e,t=!1){const s=this,{api:i}=s;t&&s.api.flush(!0),e==null||e.call(i)}var wa={load(e,t){const s=this,{axis:i,data:n,org:a,scale:o}=s,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;c&&(t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(u=>{var d;const h=((d=t.types)==null?void 0:d[u.id])||t.type;s.setTargetType(u.id,h)}),n.targets.forEach(u=>{for(let d=0;d<c.length;d++)if(u.id===c[d].id){u.values=r?u.values.concat(c[d].values):c[d].values,c.splice(d,1);break}}),n.targets=n.targets.concat(c)),s.updateTargets(n.targets),o.zoom&&(l.x=i.isCategorized()?o.x.orgScale():(a.xScale||o.x).copy(),l.domain=s.getXDomain(n.targets),l.x.domain(l.domain),l.currentDomain=s.zoom.getDomain(),s.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,s.$el.eventRect.property("__zoom",null))),s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(a.xDomain=l.domain,a.xScale=l.x,i.isCategorized()&&(l.currentDomain=s.getZoomDomainValue(l.currentDomain),a.xDomain=s.getZoomDomainValue(a.xDomain),a.xScale=l.x.domain(a.xDomain)),s.updateCurrentZoomTransform(l.x,l.currentDomain)):a.xScale&&a.xScale.domain(a.xDomain),s.updateTypesElements(),Ms.call(s,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(),t.convertData(e,s=>{const i=e.data||s;e.append&&(i.__append__=!0),i&&t.load(t.convertDataToTargets.call(t,i),e)}))},unload(e,t){var s;const i=this,{state:n,$el:a,$T:o}=i,r=!!((s=i.hasLegendDefsPoint)!=null&&s.call(i));let l=t,c=e;if(i.cache.reset(),l||(l=()=>{}),c=c.filter(d=>i.hasTarget(i.data.targets,d)),!c||c.length===0){l();return}c.forEach(d=>{var h;const g=i.getTargetSelectorSuffix(d);n.withoutFadeIn[d]=!1,a.legend&&a.legend.selectAll(`.${W.legendItem}${g}`).remove(),i.data.targets=i.data.targets.filter(f=>f.id!==d),r&&((h=a.defs)==null||h.select(`#${i.getDefsPointId(g)}`).remove())}),n.hasFunnel&&i.updateFunnel(i.data.targets),n.hasTreemap&&i.updateTargetsForTreemap(i.data.targets),i.updateTypesElements();const u=a.svg.selectAll(c.map(d=>i.selectorTarget(d)));o(u).style("opacity","0").remove().call(Ae,l)}},Xs=Z(6),Sa={setExpand(e,t,s){const i=this,{config:n,$el:{circle:a}}=i;a&&n.point_focus_expand_enabled&&i.expandCircles(e,t,s),i.expandBarTypeShapes(!0,e,t,s)},expandBarTypeShapes(e=!0,t,s,i){const n=this;["bar","candlestick"].filter(a=>n.$el[a]).forEach(a=>{i&&n.$el[a].classed(D.EXPANDED,!1),n.getShapeByIndex(a,t,s).classed(D.EXPANDED,e)})},setOverOut(e,t){const s=this,{config:i,state:{hasFunnel:n,hasRadar:a,hasTreemap:o},$el:{main:r}}=s,l=G(t);if(l||t!==-1){const c=i[e?"data_onover":"data_onout"].bind(s.api);if(i.color_onover&&s.setOverColor(e,t,l),l){const u=s.getTargetSelectorSuffix(t.id),d=n||o?`${D.target+u} .${it.shape}`:X.arc+u;c(t,r.select(`.${d}`).node())}else if(i.tooltip_grouped)e&&(a&&s.isPointFocusOnly()?s.showCircleFocus(s.getAllValuesOnIndex(t,!0)):s.setExpand(t,null,!0)),!s.isMultipleX()&&r.selectAll(`.${it.shape}-${t}`).each(function(u){c(u,this)});else{const u=s.cache.get(at.setOverOut)||[],d=r.selectAll(`.${it.shape}-${t}`).filter(function(g){return s.isWithinShape(this,g)}),h=d.filter(function(){return u.every(g=>g!==this)});if(!e||d.empty()||u.length===h.size()&&h.nodes().every((g,f)=>g!==u[f]))for(;u.length;){const g=u.pop();i.data_onout.bind(s.api)((0,R.select)(g).datum(),g)}h.each(function(){e&&(c((0,R.select)(this).datum(),this),u.push(this))}),s.cache.add(at.setOverOut,u)}}},callOverOutForTouch(e){const t=this,s=t.cache.get(at.callOverOutForTouch);(G(e)&&s?e.id!==s.id:e!==s)&&((s||I(s))&&t.setOverOut(!1,s),(e||I(e))&&t.setOverOut(!0,e),t.cache.add(at.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:s}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,Xs.drag)().on("drag",function(i){s.event=i,e.drag(Tt(i,this))}).on("start",function(i){s.event=i,e.dragstart(Tt(i,this))}).on("end",i=>{s.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,s){var i,n,a;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:u,hasRadar:d,hasTreemap:h},$el:{eventRect:g,funnel:f,radar:p,svg:_,treemap:x}}=o;let m=(a=(n=(u||h)&&l.rect||d&&p.axes.select(`.${rt.axis}-${t} text`)||g||((i=o.getArcElementByIdOrIndex)==null?void 0:i.call(o,t)))==null?void 0:n.node)==null?void 0:a.call(n);if(m){const y=o.isMultipleX(),$=r.axis_rotated;let{width:v,left:b,top:T}=dt(m);if(c&&!d&&!y){const w=l.coords[t];w?(v=w.w,b+=w.x,T+=w.y):(v=0,b=0,T=0)}let C=b+(s?s[0]:0)+(y||$?0:v/2),S=T+(s?s[1]:0)+($?4:0);if(Ne(_)){const w=we(o.$el.eventRect.node(),C,S,!1);C=w.x,S=w.y}const A={screenX:C,screenY:S,clientX:C,clientY:S,bubbles:d};(u||h)&&(m=(f!=null?f:x).node()),Kn[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,A)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{eventRect:t,zoomResetBtn:s}}=e;t==null||t.on(".zoom wheel.zoom .drag",null),s==null||s.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:s,eventRect:i,legend:n,region:a,svg:o,treemap:r},brush:l}=t,c=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,i,a==null?void 0:a.list,l==null?void 0:l.getSelection(),s==null?void 0:s.selectAll("path"),n==null?void 0:n.selectAll("g"),r].forEach(u=>u==null?void 0:u.on(c,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},Ra={categoryName(e){var t;const{axis_x_categories:s}=this.config;return(t=s==null?void 0:s[e])!=null?t:e}},Ca={generateClass(e,t){return` ${e} ${e+this.getTargetSelectorSuffix(t)}`},getClass(e,t){const s=/s$/.test(e),i=/^(area|arc|line|funnel|treemap)s?$/.test(e),n=s?"id":"index";return a=>{const o=a.data||a;return((t?this.generateClass(V[s?"shapes":"shape"],o[n]):"")+this.generateClass(V[e],o[i?"id":n])).trim()}},getChartClass(e){return t=>V[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],s=[];return function(i){var n;const a=i.id||((n=i.data)==null?void 0:n.id)||i;return s.indexOf(a)<0&&s.push(a),t[s.indexOf(a)%t.length]}},classRegion(e,t){return`${this.generateClass(V.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let s="";return t&&(s=` ${V.target}-${t}`),this.generateClass(V.target,e)+s},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.indexOf(e.id)>=0?V.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.indexOf(e.id)>=0?V.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-")},selectorTarget(e,t="",s=""){const i=this.getTargetSelectorSuffix(e);return`${t}.${V.target+i} ${s}, ${t}.${V.circles+i} ${s}`},selectorTargets(e,t){const s=e||[];return s.length?s.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${V.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}},Xt=Z(7);const Ea=(e,t,s)=>{const i=(0,R.select)(e.cloneNode(!0));return i.attr("id",s).insert("rect",":first-child").attr("width",i.attr("width")).attr("height",i.attr("height")).style("fill",t),{id:s,node:i.node()}};function La(e){const t=at.colorPattern,{body:s}=ct;let i=s[t];if(!i){const a=e.classed(Ie.colorPattern,!0).style("background-image");e.classed(Ie.colorPattern,!1),a.indexOf(";")>-1&&(i=a.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),s[t]=i)}return i}const ka=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Pa={generateColor(){const e=this,{$el:t,config:s}=e,i=[],n=s.area_linearGradient||s.bar_linearGradient||s.point_radialGradient;let a=ot(s.color_pattern)?s.color_pattern:(0,Xt.scaleOrdinal)(La(t.chart)||ka).range();const o=a;if(k(s.color_tiles)){const r=s.color_tiles.bind(e.api)(),l=a.map((c,u)=>{const d=c.replace(/[#\(\)\s,]/g,""),h=`${e.state.datetimeId}-pattern-${d}-${u}`;return Ea(r[u%r.length],c,h)});a=l.map(c=>`url(#${c.id})`),e.patterns=l}return function(r){var l;const c=s.data_colors,u=s.data_color,d=r.id||((l=r.data)==null?void 0:l.id)||r,h=e.isTypeOf(d,["line","spline","step"])||!s.data_types[d];let g;if(k(c[d])?g=c[d].bind(e.api)(r):c[d]?g=c[d]:(i.indexOf(d)<0&&i.push(d),g=h?o[i.indexOf(d)%o.length]:a[i.indexOf(d)%a.length],c[d]=g),g=k(u)?u.call(e.api,g,r):g,n){const f=e.$el.defs.selectAll(`[id$='-gradient${e.getTargetSelectorSuffix(d)}'] stop`);let p;f.each(function(_,x){p=x===0?this.style.stopColor:this.style.stopColor===p}),p===!0&&f.attr("stop-color",g)}return g}},generateLevelColor(){const e=this,{config:t}=e,s=t.color_pattern,i=t.color_threshold,n=i.unit==="value",a=i.max||100,o=i.values&&i.values.length?i.values:[];return ot(i)?function(r){const l=n?r:r*100/a;let c=s[s.length-1];for(let u=0,d=o.length;u<d;u++)if(l<=o[u]){c=s[u];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const s=this,{$el:{defs:i},state:n}=s;if(e){let a=[];N(e)?a.push(""):G(e)?a=Object.keys(e):k(e)&&(a=s.mapToTargetIds()),a.forEach(o=>{const r=`${n.datetimeId}-labels-bg${s.getTargetSelectorSuffix(o)}${N(e)?s.getTargetSelectorSuffix(e):""}`,l=Jt(o===""?e:(e==null?void 0:e[o])||"");i.select(`#${r}`).empty()&&i.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r).html(`<feFlood flood-color="${l}" />
|
|
18
|
+
<feComposite in="SourceGraphic" />`)})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:s},state:{datetimeId:i},$el:{defs:n}}=e;s.forEach(a=>{const o=`${i}-gradient${e.getTargetSelectorSuffix(a.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(a)&&"area"||e.isBarType(a)&&"bar";if((r||l)&&n.select(`#${o}`).empty()){const c=e.color(a),u={defs:null,stops:[]};if(r){const{cx:d=.3,cy:h=.3,r:g=.7,stops:f=[[.1,c,0],[.9,c,1]]}=r;u.stops=f,u.defs=n.append("radialGradient").attr("id",`${o}`).attr("cx",d).attr("cy",h).attr("r",g)}else{const d=t.axis_rotated,{x:h=d?[1,0]:[0,0],y:g=d?[0,0]:[0,1],stops:f=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];u.stops=f,u.defs=n.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",g[0]).attr("y2",g[1])}u.stops.forEach(d=>{const[h,g,f]=d,p=k(g)?g.bind(e.api)(a.id):g;u.defs&&u.defs.append("stop").attr("offset",h).attr("stop-color",p||c).attr("stop-opacity",f)})}})},setOverColor(e,t){const s=this,{config:i,$el:{main:n}}=s,a=i.color_onover;let o=e?a:s.color;G(o)?o=({id:r})=>r in a?a[r]:s.color(r):N(o)?o=()=>a:k(a)&&(o=o.bind(s.api)),n.selectAll(G(t)?`.${X.arc}${s.getTargetSelectorSuffix(t.id)}`:`.${it.shape}-${t}`).style("fill",o)}},Oa={getYDomainMinMax(e,t){const s=this,{axis:i,config:n}=s,a=t==="min",o=n.data_groups,r=s.mapToIds(e),l=Cs(r),c=s.getValuesAsIdKeyed(e);if(o.length>0){const u=s[`has${a?"Negative":"Positive"}ValueInTargets`](e),d=new Map(r.map(h=>[h,i.getId(h)]));o.forEach(h=>{const g=h.filter(f=>l.has(f));if(g.length){const f=g[0],p=d.get(f);u&&c[f]&&(c[f]=c[f].map(_=>(a?_<0:_>0)?_:0)),g.filter((_,x)=>x>0).forEach(_=>{if(c[_]){const x=d.get(_);c[_].forEach((m,y)=>{const $=+m,v=a?$>0:$<0;x===p&&!(u&&v)&&(c[f][y]+=$)})}})}})}return Rt(t,Object.keys(c).map(u=>Rt(t,c[u])))},isHiddenTargetWithYDomain(e){const t=this;return t.state.hiddenTargetIds.some(s=>t.axis.getId(s)===e)},getYDomain(e,t,s){const i=this,{axis:n,config:a,scale:o}=i,r=`axis_${t}`;if(i.isStackNormalized()&&e.filter(O=>n.getId(O.id)===t).map(O=>O.id).some(O=>i.isGrouped(O)))return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(A=>n.getId(A.id)===t),u=s?i.filterByXDomain(c,s):c;if(u.length===0)return i.isHiddenTargetWithYDomain(t)?o[t].domain():t==="y2"?o.y.domain():i.getYDomain(e,"y2",s);const d=a[`${r}_min`],h=a[`${r}_max`],g=a[`${r}_center`],f=a[`${r}_inverted`],p=i.hasDataLabel()&&a.axis_rotated,_=i.hasDataLabel()&&!a.axis_rotated;let x=i.getYDomainMinMax(u,"min"),m=i.getYDomainMinMax(u,"max"),y=[L.BAR,L.BUBBLE,L.SCATTER,...Mt.Line].some(A=>{const w=A.indexOf("area")>-1?"area":A;return i.hasType(A,u,!0)&&a[`${w}_zerobased`]});x=M(d)?d:M(h)?x<=h?x:h-10:x,m=M(h)?h:M(d)?d<=m?m:d+10:m,isNaN(x)&&(x=0),isNaN(m)&&(m=x),x===m&&(x<0?m=0:x=0);const $=x>=0&&m>=0,v=x<=0&&m<=0;(M(d)&&$||M(h)&&v)&&(y=!1),y&&($&&(x=0),v&&(m=0));const b=Math.abs(m-x);let T={top:b*.1,bottom:b*.1};if(H(g)){const A=Math.max(Math.abs(x),Math.abs(m));m=g+A,x=g-A}if(p){const A=Vt(o.y.range()),w=i.getDataLabelLength(x,m,"width").map(O=>{const E=O/A;return isFinite(E)?E:0});["bottom","top"].forEach((O,E)=>{T[O]+=b*(w[E]/(1-w[0]-w[1]))})}else if(_){const A=i.getDataLabelLength(x,m,"height");["bottom","top"].forEach((w,O)=>{T[w]+=i.convertPixelToScale("y",A[O],b)})}T=i.getResettedPadding(T);const C=a[`${r}_padding`];ot(C)&&["bottom","top"].forEach(A=>{T[A]=n.getPadding(C,A,T[A],b)}),y&&($&&(T.bottom=x),v&&(T.top=-m));const S=l?[x,m].map(A=>A<0?0:A):[x-T.bottom,m+T.top];return f?S.reverse():S},getXDomainMinMax(e,t){var s;const i=this,n=i.config[`axis_x_${t}`],a=Rt(t,e.map(r=>Rt(t,r.values.map(l=>l.x))));let o=G(n)?n.value:n;return o=H(o)&&((s=i.axis)!=null&&s.isTimeSeries())?At.bind(this)(o):o,G(n)&&n.fit&&(t==="min"&&o<a||t==="max"&&o>a)&&(o=void 0),H(o)?o:a},getXDomainPadding(e,t){const s=this,{axis:i,config:n}=s,a=n.axis_x_padding,o=i.isTimeSeries()&&t,r=Vt(e);let l;if(i.isCategorized()||o)l=0;else if(s.hasType("bar")){const d=s.getMaxDataCount();l=d>1?r/(d-1)/2:.5}else l=s.getResettedPadding(r*.01);let{left:c=l,right:u=l}=I(a)?{left:a,right:a}:a;if(a.unit==="px"){const d=Math.abs(r+r*.2);c=i.getPadding(a,"left",l,d),u=i.getPadding(a,"right",l,d)}else{const d=r+c+u;if(o&&d){const h=r/t/d;c=c/d/h,u=u/d/h}}return{left:c,right:u}},getXDomain(e){const t=this,{axis:s,config:i,scale:{x:n}}=t,a=i.axis_x_inverted,o=[t.getXDomainMinMax(e,"min"),t.getXDomainMinMax(e,"max")];let[r=0,l=0]=o;if(n.type!=="log"){const c=s.isCategorized(),u=s.isTimeSeries(),d=t.getXDomainPadding(o);let[h,g]=o;h-g===0&&!c&&(u?(h=new Date(h.getTime()*.5),g=new Date(g.getTime()*1.5)):(h=h===0?1:h*.5,g=g===0?-1:g*1.5)),(h||h===0)&&(r=u?new Date(h.getTime()-d.left):h-d.left),(g||g===0)&&(l=u?new Date(g.getTime()+d.right):g+d.right)}return a?[l,r]:[r,l]},updateXDomain(e,t,s,i,n){var a;const o=this,{config:r,org:l,scale:{x:c,subX:u}}=o,d=r.zoom_enabled;if(s&&(c.domain(n||ee(o.getXDomain(e),!r.axis_x_inverted)),l.xDomain=c.domain(),u.domain(c.domain()),(a=o.brush)==null||a.scale(u)),t){const h=n||!o.brush||vs(o)?l.xDomain:bs(o).map(u.invert);c.domain(h)}return(s||t)&&d&&o.zoom.updateScaleExtent(),i&&c.domain(o.trimXDomain(c.orgDomain())),c.domain()},trimXDomain(e){const t=this,s=t.config.axis_x_inverted,i=t.getZoomDomain(),[n,a]=i;return(s?e[0]>=n:e[0]<=n)&&(e[1]=+e[1]+(n-e[0]),e[0]=n),(s?e[1]<=a:e[1]>=a)&&(e[0]=+e[0]-(e[1]-a),e[1]=a),e},getZoomDomain(e="zoom",t=!1){const s=this,{config:i,scale:n,org:a}=s;let[o,r]=t&&n[e]?n[e].domain():a.xDomain;return e==="zoom"&&(H(i.zoom_x_min)&&(o=Rt("min",[o,i.zoom_x_min])),H(i.zoom_x_max)&&(r=Rt("max",[r,i.zoom_x_max]))),[o,r]},getZoomDomainValue(e){const t=this,{config:s,axis:i}=t;if(i.isCategorized()&&Array.isArray(e)){const n=s.axis_x_inverted;return e.map((o,r)=>Number(o)+(r===0?+n:+!n))}return e},convertPixelToScale(e,t,s){const i=this,{config:n,state:a}=i,o=n.axis_rotated;let r;return e==="x"?r=o?"height":"width":r=o?"width":"height",s*(t/a[r])},withinRange(e,t=[0,0],s){const n=this.config.axis_x_inverted,[a,o]=s;if(Array.isArray(e)){const r=[...e];if(n&&r.reverse(),r[0]<r[1])return e.every((l,c)=>(c===0?n?+l<=a:+l>=a:n?+l>=o:+l<=o)&&!e.every((u,d)=>u===t[d]))}return!1}};function Bs(e,t,s){const{config:i}=e,n=`axis_${t}_tick_format`;return(i[n]?i[n]:e.defaultValueFormat).call(e.api,s)}var Ia={yFormat(e){return Bs(this,"y",e)},y2Format(e){return Bs(this,"y2",e)},getDefaultValueFormat(){const e=this,{defaultArcValueFormat:t,yFormat:s,y2Format:i}=e,n=e.hasArcType(null,["gauge","polar","radar"]);return function(a,o,r){return(n?t:e.axis&&e.axis.getId(r)==="y2"?i:s).call(e,a,o)}},defaultValueFormat(e){return Y(e)?e.join("~"):M(e)?+e:""},defaultArcValueFormat(e,t){return`${(t*100).toFixed(1)}%`},defaultPolarValueFormat(e){return`${e}`},dataLabelFormat(e){const t=this,s=t.config.data_labels,i=a=>{let r=a;return Y(a)?r=a.join("~"):G(a)&&(r=Object.values(a).join("~")),r};let n=i;return k(s.format)?n=s.format:bt(s.format)&&(s.format[e]?n=s.format[e]===!0?i:s.format[e]:n=()=>""),n.bind(t.api)}};function Ce(e){const t=this,s=t.getDataById(e);return t.levelColor?t.levelColor(s.values[0].value):t.color(s)}function Ue(e,t=!0){var s;const{config:i}=this;let n=(s=i.data_names[e])!=null?s:e;return t&&k(i.legend_format)&&(n=i.legend_format(n,e!==n?e:void 0)),n}function Da(e,t){if(!t||t.empty())return;const s=[];t.each(function(n){s.push({id:n,node:this})});const i=Es(s,n=>n.id,n=>n.node);e.cache.add(at.legendItemMap,i)}var za={initLegend(){const e=this,{config:t,$el:s}=e;e.legendItemTextBox={},e.state.legendHasRendered=!1,t.legend_show?(t.legend_contents_bindto||(s.legend=e.$el.svg.append("g").classed(W.legend,!0).attr("transform",e.getTranslate("legend"))),e.updateLegend()):e.state.hiddenLegendIds=e.mapToIds(e.data.targets)},updateLegend(e,t,s){var i;const n=this,{config:a,state:o,scale:r,$el:l}=n,c=t||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=zt(c,"withTransition",!0),c.withTransitionForTransform=zt(c,"withTransitionForTransform",!0),a.legend_contents_bindto&&a.legend_contents_template?n.updateLegendTemplate():o.hasTreemap||n.updateLegendElement(e||n.mapToIds(n.data.targets),c,s),(i=l.legend)==null||i.selectAll(`.${W.legendItem}`).classed(W.legendItemHidden,function(u){const d=!n.isTargetToShow(u);return d&&(this.style.opacity=null),d}),n.updateScales(!1,!r.zoom),n.updateSvgSize(),n.transformAll(c.withTransitionForTransform,s),o.legendHasRendered=!0},updateLegendTemplate(){const e=this,{config:t,$el:s}=e,i=(0,R.select)(t.legend_contents_bindto),n=t.legend_contents_template;if(!i.empty()){const a=e.mapToIds(e.data.targets),o=[];let r="";a.forEach(c=>{const u=k(n)?Jt(n.call(e.api,c,e.color(c),e.api.data(c)[0].values)):ge(n,{COLOR:e.color(c),TITLE:c});u&&(o.push(c),r+=u)});const l=i.html(r).selectAll(function(){return this.childNodes}).data(o);e.setLegendItem(l),s.legend=i}},updateSizeForLegend(e){const t=this,{config:s,state:{isLegendTop:i,isLegendLeft:n,isLegendRight:a,isLegendInset:o,current:r}}=t,{width:l,height:c}=e,u={top:i?t.getCurrentPaddingByDirection("top")+s.legend_inset_y+5.5:r.height-c-t.getCurrentPaddingByDirection("bottom")-s.legend_inset_y,left:n?t.getCurrentPaddingByDirection("left")+s.legend_inset_x+.5:r.width-l-t.getCurrentPaddingByDirection("right")-s.legend_inset_x+.5};t.state.margin3={top:a?0:o?u.top:r.height-c,right:NaN,bottom:0,left:a?r.width-l:o?u.left:0}},transformLegend(e){const t=this,{$el:{legend:s},$T:i}=t;i(s,e).attr("transform",t.getTranslate("legend"))},updateLegendStep(e){this.state.legendStep=e},updateLegendItemWidth(e){this.state.legendItemWidth=e},updateLegendItemHeight(e){this.state.legendItemHeight=e},updateLegendItemColor(e,t){const s=this,{legend:i}=s.$el;if(i){const n=s.getLegendItemById(e);n&&(0,R.select)(n).select("line").style("stroke",t)}},getLegendWidth(){const e=this,{current:{width:t},isLegendRight:s,isLegendInset:i,legendItemWidth:n,legendStep:a}=e.state;return e.config.legend_show?s||i?n*(a+1):t:0},getLegendHeight(){var e;const t=this,{current:s,isLegendRight:i,legendItemHeight:n,legendStep:a}=t.state,o=((e=t.config.padding)==null?void 0:e.mode)==="fit";return t.config.legend_show?i?s.height:Math.max(o?10:20,n)*(a+1):0},opacityForUnfocusedLegend(e){return e.classed(W.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const s=this,{$el:{legend:i},$T:n}=s,a=s.mapToTargetIds(e);i&&n(i.selectAll(`.${W.legendItem}`).filter(o=>a.indexOf(o)>=0).classed(K.legendItemFocused,t)).style("opacity",function(){return t?null:s.opacityForUnfocusedLegend.call(s,(0,R.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:s}=e;t&&s(t.selectAll(`.${W.legendItem}`).classed(K.legendItemFocused,!1)).style("opacity",null)},showLegend(e){const t=this,{config:s,$el:i,$T:n}=t;s.legend_show||(s.legend_show=!0,i.legend?i.legend.style("visibility",null):t.initLegend(),!t.state.legendHasRendered&&t.updateLegend()),t.removeHiddenLegendIds(e),n(i.legend.selectAll(t.selectorLegends(e)).style("visibility",null)).style("opacity",null)},hideLegend(e){const t=this,{config:s,$el:{legend:i}}=t;s.legend_show&&vt(e)&&(s.legend_show=!1,i.style("visibility","hidden")),t.addHiddenLegendIds(e),i.selectAll(t.selectorLegends(e)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(e,t){const s=this,{cache:i,state:n}=s;let a;const o=at.legendItemTextBox;return e&&(a=!n.redrawing&&i.get(o)||{},a[e]||(a[e]=s.getTextRect(t,W.legendItem),i.add(o,a)),a=a[e]),a},setLegendItem(e){const t=this,{$el:s,api:i,config:n,state:a}=t,o=a.inputType==="touch",r=t.hasType("gauge"),l=n.boost_useCssRule,c=n.legend_item_interaction;e.attr("class",function(u){const d=(0,R.select)(this);return(!d.empty()&&d.attr("class")||"")+t.generateClass(W.legendItem,u)}).style("visibility",u=>t.isLegendToShow(u)?null:"hidden"),n.interaction_enabled&&(l&&[[`.${W.legendItem}`,"cursor:pointer"],[`.${W.legendItem} text`,"pointer-events:none"],[`.${W.legendItemPoint} text`,"pointer-events:none"],[`.${W.legendItemTile}`,"pointer-events:none"],[`.${W.legendItemEvent}`,"fill-opacity:0"]].forEach(u=>{const[d,h]=u;t.setCssRule(!1,d,[h])(s.legend)}),e.on(c.dblclick?"dblclick":"click",c||k(n.legend_item_onclick)?function(u,d){if(!J(n.legend_item_onclick,i,d,!a.hiddenTargetIds.includes(d))){const{altKey:h,target:g,type:f}=u;f==="dblclick"||h?a.hiddenTargetIds.length&&g.parentNode.getAttribute("class").indexOf(W.legendItemHidden)===-1?i.show():(i.hide(),i.show(d)):(i.toggle(d),(0,R.select)(this).classed(K.legendItemFocused,!1))}o&&t.hideTooltip()}:null),!o&&e.on("mouseout",c||k(n.legend_item_onout)?function(u,d){J(n.legend_item_onout,i,d,!a.hiddenTargetIds.includes(d))||((0,R.select)(this).classed(K.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${$t.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||k(n.legend_item_onover)?function(u,d){J(n.legend_item_onover,i,d,!a.hiddenTargetIds.includes(d))||((0,R.select)(this).classed(K.legendItemFocused,!0),r&&t.markOverlapped(d,t,`.${$t.gaugeValue}`),!a.transiting&&t.isTargetToShow(d)&&i.focus(d))}:null),!e.empty()&&e.on("click mouseout mouseover")&&e.style("cursor",t.getStylePropValue("pointer"))),Da(t,e)},getLegendItemById(e){var t;const s=this,i=s.cache.get(at.legendItemMap);if(i&&i instanceof Map)return i.get(e)||null;const n=(t=s.$el.legend)==null?void 0:t.selectAll(`.${W.legendItem}`).filter(a=>a===e);return(n==null?void 0:n.node())||null},updateLegendElement(e,t){const s=this,{config:i,state:n,$el:{legend:a},$T:o}=s,l=i.legend_item_tile_type!=="circle",c=i.legend_item_tile_r,u={width:l?i.legend_item_tile_width:c*2,height:l?i.legend_item_tile_height:c*2},d={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:u.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let g,f,p;const _=e.filter(b=>!H(i.data_names[b])||i.data_names[b]!==null),x=t.withTransition,m=s.getUpdateLegendPositions(_,d,h);n.isLegendInset&&(d.step=i.legend_inset_step?i.legend_inset_step:_.length,s.updateLegendStep(d.step)),n.isLegendRight?(g=b=>d.max.width*h.steps[b],f=b=>h.margins[h.steps[b]]+h.offsets[b]):n.isLegendInset?(g=b=>d.max.width*h.steps[b]+10,f=b=>h.margins[h.steps[b]]+h.offsets[b]):(g=b=>h.margins[h.steps[b]]+h.offsets[b],f=b=>d.max.height*h.steps[b]);const y={xText:(b,T)=>g(b,T)+4+u.width,xRect:(b,T)=>g(b,T),x1Tile:(b,T)=>g(b,T)-2,x2Tile:(b,T)=>g(b,T)-2+u.width,yText:(b,T)=>f(b,T)+9,yRect:(b,T)=>f(b,T)-5,yTile:(b,T)=>f(b,T)+4};s.generateLegendItem(_,u,m,y),p=a.select(`.${W.legendBackground} rect`),n.isLegendInset&&d.max.width>0&&p.size()===0&&(p=a.insert("g",`.${W.legendItem}`).attr("class",W.legendBackground).append("rect")),i.legend_tooltip&&a.selectAll("title").data(_).text(b=>Ue.bind(s)(b,!1));const $=a.selectAll("text").data(_).text(b=>Ue.bind(s)(b)).each(function(b,T){m(this,b,T)});o($,x).attr("x",y.xText).attr("y",y.yText);const v=a.selectAll(`rect.${W.legendItemEvent}`).data(_);o(v,x).attr("width",b=>h.widths[b]).attr("height",b=>h.heights[b]).attr("x",y.xRect).attr("y",y.yRect),s.updateLegendItemPos(_,x,y),p&&o(p,x).attr("height",s.getLegendHeight()-12).attr("width",d.max.width*(d.step+1)+10),s.updateLegendItemWidth(d.max.width),s.updateLegendItemHeight(d.max.height),s.updateLegendStep(d.step)},getUpdateLegendPositions(e,t,s){const i=this,{config:n,state:a}=i,o=a.isLegendRight||a.isLegendInset;return function(r,l,c){const u=c===0,d=c===e.length-1,h=i.getLegendItemTextBox(l,r),g=h.width+t.tileWidth+(d&&!o?0:t.padding.right)+n.legend_padding,f=h.height+t.padding.top,p=o?f:g,_=o?i.getLegendHeight():i.getLegendWidth();let x;const m=function($,v){v||(x=(_-t.totalLength-p)/2,x<t.posMin&&(x=(_-p)/2,t.totalLength=0,t.step++)),s.steps[$]=t.step,s.margins[t.step]=a.isLegendInset?10:x,s.offsets[$]=t.totalLength,t.totalLength+=p};if(u&&(t.totalLength=0,t.step=0,t.max.width=0,t.max.height=0),n.legend_show&&!i.isLegendToShow(l)){s.widths[l]=0,s.heights[l]=0,s.steps[l]=0,s.offsets[l]=0;return}s.widths[l]=g,s.heights[l]=f,(!t.max.width||g>=t.max.width)&&(t.max.width=g),(!t.max.height||f>=t.max.height)&&(t.max.height=f);const y=o?t.max.height:t.max.width;n.legend_equally?(Object.keys(s.widths).forEach($=>s.widths[$]=t.max.width),Object.keys(s.heights).forEach($=>s.heights[$]=t.max.height),x=(_-y*e.length)/2,x<t.posMin?(t.totalLength=0,t.step=0,e.forEach($=>m($))):m(l,!0)):m(l)}},generateLegendItem(e,t,s,i){const n=this,{config:a,state:o,$el:{legend:r}}=n,l=a.legend_usePoint,c=a.legend_item_tile_r,u=a.legend_item_tile_type,d=u!=="circle",h=o.isLegendRight||o.isLegendInset,g=-200,f=r.selectAll(`.${W.legendItem}`).data(e).enter().append("g");if(n.setLegendItem(f),a.legend_tooltip&&f.append("title").text(p=>p),f.append("text").text(p=>Ue.bind(n)(p)).each(function(p,_){s(this,p,_)}).style("pointer-events",n.getStylePropValue("none")).attr("x",h?i.xText:g).attr("y",h?g:i.yText),f.append("rect").attr("class",W.legendItemEvent).style("fill-opacity",n.getStylePropValue("0")).attr("x",h?i.xRect:g).attr("y",h?g:i.yRect),l){const p=[],_=n.getValidPointPattern();f.append(x=>{p.indexOf(x)===-1&&p.push(x);let m=_[p.indexOf(x)%_.length];return m==="rectangle"&&(m="rect"),ct.createElementNS(R.namespaces.svg,"hasValidPointType"in n&&n.hasValidPointType(m)?m:"use")}).attr("class",W.legendItemPoint).style("fill",Ce.bind(n)).style("pointer-events",n.getStylePropValue("none")).attr("href",(x,m,y)=>{const v=y[m].nodeName.toLowerCase(),b=n.getTargetSelectorSuffix(x);return v==="use"?`#${o.datetimeId}-point${b}`:void 0})}else f.append(d?"line":u).attr("class",W.legendItemTile).style("stroke",Ce.bind(n)).style("pointer-events",n.getStylePropValue("none")).call(p=>{u==="circle"?p.attr("r",c).style("fill",Ce.bind(n)).attr("cx",h?i.x2Tile:g).attr("cy",h?g:i.yTile):d&&p.attr("stroke-width",t.height).attr("x1",h?i.x1Tile:g).attr("y1",h?g:i.yTile).attr("x2",h?i.x2Tile:g).attr("y2",h?g:i.yTile)})},updateLegendItemPos(e,t,s){const i=this,{config:n,$el:{legend:a},$T:o}=i,r=n.legend_usePoint,l=n.legend_item_tile_type,c=l!=="circle";if(r){const u=a.selectAll(`.${W.legendItemPoint}`).data(e);o(u,t).each(function(){const d=this.nodeName.toLowerCase(),h=n.point_r;let g="x",f="y",p=2,_=2.5,x=null,m=null,y=null;if(d==="circle"){const $=h*.2;g="cx",f="cy",x=h+$,p=h*2,_=-$}else if(d==="rect"){const $=h*2.5;m=$,y=$,_=3}(0,R.select)(this).attr(g,$=>s.x1Tile($)+p).attr(f,$=>s.yTile($)-_).attr("r",x).attr("width",m).attr("height",y)})}else{const u=a.selectAll(`.${W.legendItemTile}`).data(e);o(u,t).style("stroke",Ce.bind(i)).call(d=>{l==="circle"?d.attr("cx",h=>{const g=s.x2Tile(h);return g-(g-s.x1Tile(h))/2}).attr("cy",s.yTile):c&&d.attr("x1",s.x1Tile).attr("y1",s.yTile).attr("x2",s.x2Tile).attr("y2",s.yTile)})}}},Fa=Z(8),Ma={redraw(e={}){var t,s,i,n;const a=this,{config:o,state:r,$el:l}=a,{main:c,treemap:u}=l;r.redrawing=!0;const d=a.filterTargetsToShow(a.data.targets),{flow:h,initializing:g}=e,f=a.getWithOption(e),p=f.Transition?o.transition_duration:0,_=f.TransitionForExit?p:0,x=f.TransitionForAxis?p:0,m=(t=a.axis)==null?void 0:t.generateTransitions(x);a.updateSizes(g),f.Legend&&o.legend_show?(e.withTransition=!!p,!u&&a.updateLegend(a.mapToIds(a.data.targets),e,m)):f.Dimension&&a.updateDimension(!0),o.data_empty_label_text&&c.select(`text.${lt.text}.${D.empty}`).attr("x",r.width/2).attr("y",r.height/2).text(o.data_empty_label_text).style("display",d.length?"none":null),r.hasAxis?(a.axis.redrawAxis(d,f,m,h,g),a.hasGrid()&&a.updateGrid(),o.regions.length&&a.updateRegion(),["bar","candlestick","line","area"].forEach(y=>{const $=xt(y);(/^(line|area)$/.test(y)&&a.hasTypeOf($)||a.hasType(y))&&a[`update${$}`](f.TransitionForExit)}),l.text&&c.selectAll(`.${Q.selectedCircles}`).filter(a.isBarType.bind(a)).selectAll("circle").remove(),o.interaction_enabled&&!h&&f.EventRect&&(a.redrawEventRect(),(s=a.bindZoomEvent)==null||s.call(a))):(l.arcs&&a.redrawArc(p,_,f.Transform),l.radar&&a.redrawRadar(),l.polar&&a.redrawPolar(),l.funnel&&a.redrawFunnel(),u&&a.updateTreemap(_)),!r.resizing&&!u&&(a.hasPointType()||r.hasRadar)?a.updateCircle():(i=a.hasLegendDefsPoint)!=null&&i.call(a)&&a.data.targets.forEach(a.point("create",this)),a.hasDataLabel()&&!a.hasArcType(null,["radar"])&&a.updateText(),(n=a.redrawTitle)==null||n.call(a),g&&a.updateTypesElements(),a.generateRedrawList(d,h,p,f.Subchart),a.updateTooltipOnRedraw(),a.callPluginHook("$redraw",e,p)},generateRedrawList(e,t,s,i){const n=this,{config:a,state:o}=n,r=n.getDrawShape();o.hasAxis&&a.subchart_show&&n.redrawSubchart(i,s,r);const l=t&&n.generateFlow({targets:e,flow:t,duration:t.duration,shape:r,xv:n.xv.bind(n)}),c=(s||l)&&fe(),u=n.getRedrawList(r,t,l,c),d=()=>{l&&l(),o.redrawing=!1,J(a.onrendered,n.api)};if(d)if(c&&u.length){const h=Is();(0,Fa.transition)().duration(s).each(()=>{u.reduce((g,f)=>g.concat(f),[]).forEach(g=>h.add(g))}).call(h,d)}else o.transiting||d();n.mapToIds(n.data.targets).forEach(h=>{o.withoutFadeIn[h]=!0})},getRedrawList(e,t,s,i){const n=this,{config:a,state:{hasAxis:o,hasRadar:r,hasTreemap:l},$el:{grid:c}}=n,{cx:u,cy:d,xForText:h,yForText:g}=e.pos,f=[];return o&&((a.grid_x_lines.length||a.grid_y_lines.length)&&f.push(n.redrawGrid(i)),a.regions.length&&f.push(n.redrawRegion(i)),Object.keys(e.type).forEach(p=>{const _=xt(p),x=e.type[p];(/^(area|line)$/.test(p)&&n.hasTypeOf(_)||n.hasType(p))&&f.push(n[`redraw${_}`](x,i))}),!t&&c.main&&f.push(n.updateGridFocus())),(!n.hasArcType()||r)&&ot(a.data_labels)&&a.data_labels!==!1&&f.push(n.redrawText(h,g,t,i)),(n.hasPointType()||r)&&!n.isPointFocusOnly()&&n.redrawCircle&&f.push(n.redrawCircle(u,d,i,s)),l&&f.push(n.redrawTreemap(i)),f},updateAndRedraw(e={}){const t=this,{config:s,state:i}=t;let n;e.withTransition=zt(e,"withTransition",!0),e.withTransform=zt(e,"withTransform",!1),e.withLegend=zt(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=zt(e,"withTransitionForTransform",e.withTransition),e.withLegend&&s.legend_show||(i.hasAxis&&(n=t.axis.generateTransitions(e.withTransitionForAxis?s.transition_duration:0)),t.updateScales(),t.updateSvgSize(),t.transformAll(e.withTransitionForTransform,n)),t.redraw(e,n)}};function Wt(e="linear",t,s){const i={linear:Xt.scaleLinear,log:Xt.scaleSymlog,_log:Xt.scaleLog,time:Xt.scaleTime,utc:Xt.scaleUtc}[e]();return i.type=e,/_?log/.test(e)&&i.clamp(!0),i.range([t!=null?t:0,s!=null?s:1])}var Xa={getXScale(e,t,s,i){const n=this,a=n.state.loading!=="append"&&n.scale.zoom||Wt(n.axis.getAxisType("x"),e,t);return n.getCustomizedXScale(s?a.domain(s):a,i)},getYScale(e,t,s,i){const a=Wt(this.axis.getAxisType(e),t,s);return i&&a.domain(i),a},getYScaleById(e,t=!1){var s;const i=((s=this.axis)==null?void 0:s.getId(e))==="y2",n=t?i?"subY2":"subY":i?"y2":"y";return this.scale[n]},getCustomizedXScale(e,t){const s=this,i=t||(()=>s.axis.x.tickOffset()),n=s.config.axis_x_inverted,a=function(o){return e(o)+i()};for(const o in e)a[o]=e[o];return a.orgDomain=()=>e.domain(),a.orgScale=()=>e,s.axis.isCategorized()&&(a.domain=function(o){let r=o;return arguments.length?(e.domain(r),a):(r=this.orgDomain(),n?[r[0]+1,r[1]]:[r[0],r[1]+1])}),a},updateScales(e,t=!0){var s,i;const n=this,{axis:a,config:o,format:r,org:l,scale:c,state:{current:u,width:d,height:h,width2:g,height2:f,hasAxis:p,hasTreemap:_}}=n;if(p){const x=o.axis_rotated,m=n.getResettedPadding(1),y={x:x?m:0,y:x?0:h,subX:x?1:0,subY:x?0:f},$={x:x?h:d,y:x?d:m,subX:x?h:d,subY:x?g:1},v=t&&((s=c.x)==null?void 0:s.orgDomain()),b=t&&l.xDomain;c.x=n.getXScale(y.x,$.x,v,()=>a.x.tickOffset()),c.subX=n.getXScale(y.x,$.x,b,T=>{var C;return T%1?0:((C=a.subX)!=null?C:a.x).tickOffset()}),r.xAxisTick=a.getXAxisTickFormat(),r.subXAxisTick=a.getXAxisTickFormat(!0),a.setAxis("x",c.x,o.axis_x_tick_outer,e),o.subchart_show&&a.setAxis("subX",c.subX,o.axis_x_tick_outer,e),c.y=n.getYScale("y",y.y,$.y,c.y?c.y.domain():o.axis_y_default),c.subY=n.getYScale("y",y.subY,$.subY,c.subY?c.subY.domain():o.axis_y_default),a.setAxis("y",c.y,o.axis_y_tick_outer,e),o.axis_y2_show&&(c.y2=n.getYScale("y2",y.y,$.y,c.y2?c.y2.domain():o.axis_y2_default),c.subY2=n.getYScale("y2",y.subY,$.subY,c.subY2?c.subY2.domain():o.axis_y2_default),a.setAxis("y2",c.y2,o.axis_y2_tick_outer,e))}else if(_){const x=n.getCurrentPadding();c.x=(0,Xt.scaleLinear)().rangeRound([x.left,u.width-x.right]),c.y=(0,Xt.scaleLinear)().rangeRound([x.top,u.height-x.bottom])}else(i=n.updateArc)==null||i.call(n)},xx(e){const t=this,{config:s,scale:{x:i,zoom:n}}=t,a=s.zoom_enabled&&n?n:i;return e?a(M(e.x)?e.x:e):null},xv(e){const t=this,{axis:s,config:i,scale:{x:n,zoom:a}}=t,o=i.zoom_enabled&&a?a:n;let r=t.getBaseValue(e);return s.isTimeSeries()?r=At.call(t,r):s.isCategorized()&&N(r)&&(r=i.axis_x_categories.indexOf(r)),o(r)},yv(e){const t=this,{scale:{y:s,y2:i}}=t;return(e.axis&&e.axis==="y2"?i:s)(t.getBaseValue(e))},subxx(e){return e?this.scale.subX(e.x):null}},Ba={setContainerSize(){const e=this,{state:t}=e;t.current.width=e.getCurrentWidth(),t.current.height=e.getCurrentHeight()},getCurrentWidth(){const e=this;return e.config.size_width||e.getParentWidth()},getCurrentHeight(){const e=this,{config:t}=e,s=t.size_height||e.getParentHeight();return s>0?s:320/(e.hasType("gauge")&&!t.gauge_fullCircle?2:1)},getParentRectValue(e){const t=`offset${xt(e)}`;let s=this.$el.chart.node(),i=0;for(;i<30&&s&&s.tagName!=="BODY";){try{i=dt(s,!0)[e]}catch(a){t in s&&(i=s[t])}s=s.parentNode}const n=ct.body[t];return i>n&&(i=n),i},getParentWidth(){return this.getParentRectValue("width")},getParentHeight(){const e=this.$el.chart.style("height");let t=0;return e&&(t=/px$/.test(e)?parseInt(e,10):this.getParentRectValue("height")),t},getSvgLeft(e){const t=this,{config:s,state:{hasAxis:i},$el:n}=t,a=s.axis_rotated,o=a||!a&&!s.axis_y_inner,r=a?rt.axisX:rt.axisY,l=n.main.select(`.${r}`).node(),c=i&&s[`axis_${a?"x":"y"}_label`];let u=0;if(i&&(N(c)||N(c.text)||/^inner-/.test(c==null?void 0:c.position))){const p=n.main.select(`.${r}-label`);p.empty()||(u=dt(p.node()).left)}const d=l&&o?dt(l,!e):{right:0},h=dt(n.chart.node(),!e).left+u,g=t.hasArcType(),f=d.right-h-(g?0:t.getCurrentPaddingByDirection("left",e));return f>0?f:0},updateDimension(e){var t;const s=this,{config:i,state:{hasAxis:n},$el:a}=s;n&&!e&&s.axis.x&&i.axis_rotated&&((t=s.axis.subX)==null||t.create(a.axis.subX)),s.updateScales(e),s.updateSvgSize(),s.transformAll(!1)},updateSvgSize(){const e=this,{config:t,state:{clip:s,current:i,hasAxis:n,width:a,height:o},$el:{svg:r}}=e;if(t.resize_auto==="viewBox"?r.attr("viewBox",`0 0 ${i.width} ${i.height}`):r.attr("width",i.width).attr("height",i.height),n){const l=r.select(`.${rs.brush} .overlay`),c={width:0,height:0};l.size()&&(c.width=+l.attr("width"),c.height=+l.attr("height")),r.selectAll([`#${s.id}`,`#${s.idGrid}`]).select("rect").attr("width",a).attr("height",o),r.select(`#${s.idXAxis}`).select("rect").call(e.setXAxisClipPath.bind(e)),r.select(`#${s.idYAxis}`).select("rect").call(e.setYAxisClipPath.bind(e)),s.idSubchart&&r.select(`#${s.idSubchart}`).select("rect").attr("width",a).attr("height",c.height)}},getCurrentPaddingByDirection(e,t=!1,s=!1){var i;const n=this,{config:a,$el:o,state:{hasAxis:r}}=n,l=a.axis_rotated,c=((i=a.padding)==null?void 0:i.mode)==="fit",u=I(a[`padding_${e}`])?a[`padding_${e}`]:void 0,d=r?{top:l?"y2":null,bottom:l?"y":"x",left:l?"x":"y",right:l?null:"y2"}[e]:null,h=/^(left|right)$/.test(e),g=d&&a[`axis_${d}_inner`],f=d&&a[`axis_${d}_show`],p=d?a[`axis_${d}_axes`].length:0;let _=d?h?n.getAxisWidthByAxisId(d,t):n.getHorizontalAxisHeight(d):0;const x=20;let m=0;!c&&h&&(_=Yn(_));let y=r&&h&&(g||nt(u)&&!f)?0:c?(f?_:0)+(u!=null?u:0):nt(u)?_:u;return h&&r?(d&&(c||g)&&a[`axis_${d}_label`].text&&(y+=n.axis.getAxisLabelPosition(d).isOuter?x:0),e==="right"?(y+=l?!c&&nt(u)?10:2:!f||g?c?2:1:0,y+=s?n.axis.getXAxisTickTextY2Overflow(x):0):e==="left"&&l&&nt(u)&&(y=a.axis_x_show?c?_:Math.max(_,40):1)):e==="top"?(o.title&&o.title.node()&&(y+=n.getTitlePadding()),m=l&&!g?p:0):e==="bottom"&&r&&l&&!f&&(y+=1),y+_*p-m},getCurrentPadding(e=!1){const t=this,[s,i,n,a]=["top","bottom","left","right"].map(o=>t.getCurrentPaddingByDirection(o,null,e));return{top:s,bottom:i,left:n,right:a}},getResettedPadding(e){const t=this,{config:s}=t,i=I(e);let n=i?0:{};return s.padding===!1?!i&&Object.keys(e).forEach(a=>{n[a]=!vt(s.data_labels)&&s.data_labels!==!1&&a==="top"?e[a]:0}):n=e,n},updateSizes(e){var t,s,i,n,a;const o=this,{config:r,state:l,$el:{legend:c}}=o,u=r.axis_rotated,d=o.hasArcType()||l.hasFunnel||l.hasTreemap,h=((t=r.padding)==null?void 0:t.mode)==="fit";!e&&o.setContainerSize();const g={width:c?o.getLegendWidth():0,height:c?o.getLegendHeight():0};!d&&r.axis_x_show&&r.axis_x_tick_autorotate&&o.updateXAxisTickClip();const f={right:r.legend_show&&l.isLegendRight?o.getLegendWidth()+(h?0:20):0,bottom:!r.legend_show||l.isLegendRight||l.isLegendInset?0:g.height},p=u||d?0:o.getHorizontalAxisHeight("x"),_=r.subchart_axis_x_show&&r.subchart_axis_x_tick_text_show?p:30,x=r.subchart_show&&!d?r.subchart_size_height+_:0,m=o.hasType("gauge")&&r.arc_needle_show&&!r.gauge_fullCircle&&!r.gauge_label_show?10:0,y=o.getCurrentPadding(!0);if(l.margin=!d&&u?{top:y.top,right:d?0:y.right+f.right,bottom:f.bottom+y.bottom,left:x+(d?0:y.left)}:{top:(h?0:4)+y.top,right:d?0:y.right+f.right,bottom:m+x+f.bottom+y.bottom,left:d?0:y.left},l.margin=o.getResettedPadding(l.margin),l.margin2=u?{top:l.margin.top,right:NaN,bottom:20+f.bottom,left:o.state.rotatedPadding.left}:{top:l.current.height-x-f.bottom,right:NaN,bottom:_+f.bottom,left:l.margin.left},l.margin3={top:0,right:NaN,bottom:0,left:0},(s=o.updateSizeForLegend)==null||s.call(o,g),l.width=l.current.width-l.margin.left-l.margin.right,l.height=l.current.height-l.margin.top-l.margin.bottom,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l.width2=u?l.margin.left-l.rotatedPadding.left-l.rotatedPadding.right:l.width,l.height2=u?l.height:l.current.height-l.margin2.top-l.margin2.bottom,l.width2<0&&(l.width2=0),l.height2<0&&(l.height2=0),o.hasArcType()){const $=o.hasType("gauge"),v=r.legend_show&&l.isLegendRight,b=(i=l.hasRadar&&o.cache.get(at.radarTextWidth))!=null?i:0;l.arcWidth=l.width-(v?g.width+10:0)-b,l.arcHeight=l.height-(v&&!$?0:10),(n=r.arc_rangeText_values)!=null&&n.length&&($?(l.arcWidth-=25,l.arcHeight-=10,l.margin.left+=10):(l.arcHeight-=20,l.margin.top+=10)),$&&!r.gauge_fullCircle&&(l.arcHeight+=l.height-o.getPaddingBottomForGauge()),(a=o.updateRadius)==null||a.call(o)}l.isLegendRight&&d&&(l.margin3.left=l.arcWidth/2+l.radiusExpanded*1.1)}},Na={setCssRule(e,t,s,i){const n=this,{config:a,state:{cssRule:o,style:r}}=n;return a.boost_useCssRule?l=>{l.each(c=>{const u=i&&(i==null?void 0:i.call(n,c)),d=`${e?`.${it.shapes+n.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[d]),n.state.cssRule[d]=Zn(r,d,s.filter(Boolean).map(h=>N(u)&&h.indexOf(":")===-1?`${h}: ${u}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:k(e)?e.bind(this):e}};function Ga(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function Va(e,t,s,i,n){var a;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=I(r)&&r<0||l&&!((a=o.getCandlestickData(e))!=null&&a._isUp);let{x:u,y:d}=t;const h=4,g=h*2;return i?s==="start"?(u+=c?0:g,d+=h):s==="middle"?(u+=g,d-=g):s==="end"&&(c&&(u-=g),d+=h):(s==="start"?(u+=h,c&&(d+=g*2)):s==="middle"?d-=g:s==="end"&&(u-=h,c&&(d+=g*2)),n&&(d+=c?-17:l?13:7)),{x:u,y:d}}function Ns(e,t){var s;const i=this.config.data_labels_position,{id:n,index:a,value:o}=e;return(s=k(i)?i.bind(this.api)(t,o,n,a,this.$el.text):(n in i?i[n]:i)[t])!=null?s:0}function Ya(e,t,s){var i,n;const a=this,{config:o,$T:r}=a,l=o.axis_rotated,{border:{padding:c="3 5",radius:u=10,stroke:d="#000",strokeWidth:h=1,fill:g="none"}}=o.data_labels,f=ta(c),p=o.data_labels.border!==!0,_=Ft(e);let x=(0,R.select)(e.previousElementSibling);(x.empty()||((i=x.node())==null?void 0:i.tagName)!=="rect"||!((n=x.attr("class"))!=null&&n.includes(s)))&&(x=(0,R.select)(e.parentNode).insert("rect",()=>e).attr("class",`${lt.textBorderRect} ${s}`).attr("width",_.width+(p?f.left+f.right:0)).attr("height",_.height+(p?f.top+f.bottom:0)),p&&x.style("fill",g).style("stroke",d).style("stroke-width",`${h}px`).attr("rx",u).attr("ry",u)),r(x).attr("x",t.x-(p?f.left:0)-(l?0:_.width/2)).attr("y",t.y-(p?f.top:0)-_.height/4*3.2)}function Ze(e=0,t){const s=this,{config:i}=s,n=i[`${t}_label_threshold`]||0;return e>=n}function Gs(){const e=this,{$el:{text:t},config:s}=e;(e.state.arcWidth?e.getArcLabelConfig("image"):s.data_labels.image)&&t.filter(function(){const n=this.previousElementSibling;return n?n.tagName!=="image"||!n.classList.contains(lt.textLabelImage):!0}).each(function(n){var a,o,r,l;const{url:c,width:u,height:d,pos:h}=ja.call(e,n);if(c){const g=(0,R.select)(this.parentNode);g==null||g.insert("image",`${(o=(a=this.getAttribute("class"))==null?void 0:a.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",f=>ge(c,{ID:"id"in f?f.id:f.data.id})).attr("class",lt.textLabelImage).style("pointer-events","none").attr("width",u).attr("height",d).attr("transform",h?`translate(${(r=h.x)!=null?r:0} ${(l=h.y)!=null?l:0})`:null)}})}function ja(e){var t;const s=this,{config:i,state:n}=s,a=n.arcWidth?s.getArcLabelConfig("image"):i.data_labels.image;if(k(a))return(t=a.call(s.api,e.value,e.id,e.index))!=null?t:{url:"",width:0,height:0,pos:{x:0,y:0}};if(a){const{url:o="",width:r=0,height:l=0,pos:c}=a;return{url:o,width:r,height:l,pos:c}}return null}function Vs(e,t){var s;const i=this,{config:n,state:{arcWidth:a,hasTreemap:o}}=i,r=n.axis_rotated,l=(0,R.select)(e.previousElementSibling),c=u=>{var d;const h=u.style.opacity!=="0"&&u.style.fillOpacity!=="0";return(a?u.textContent:h)&&((d=this.previousElementSibling)==null?void 0:d.tagName)!=="image"};if(!l.empty()&&((s=l.node())==null?void 0:s.tagName)==="image"){const u=dt(e),d=+l.attr("width")/2,h=+l.attr("height")/2;let g=t.x-d,f=t.y-h-u.height/2;r?t.x+=d:(o&&(g=-d,f=-(h*2+u.height)),i.hasType("pie")||i.hasType("polar")||(t.y+=h)),i.$T(l).style("opacity",c(e)?null:"0").attr("x",g).attr("y",f)}}function Wa(e){return Es(e,t=>t,t=>Ft(t))}var Ha={opacityForText(e){const t=this;return t.isBarType(e)&&!Ze.call(t,Math.abs(t.getRatio("bar",e)),"bar")?"0":t.hasDataLabel?null:"0"},initText(){const{$el:e}=this;e.main.select(`.${D.chart}`).append("g").attr("class",lt.chartTexts).style("pointer-events",e.funnel||e.treemap?"none":null)},updateTargetsForText(e){const t=this,s=t.getChartClass("Text"),i=t.getClass("texts","id"),n=t.classFocus.bind(t);t.$el.main.select(`.${lt.chartTexts}`).selectAll(`.${lt.chartText}`).data(t.filterNullish(e)).attr("class",r=>`${s(r)}${n(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",s).call(t.setCssRule(!0,` .${lt.text}`,["fill","pointer-events:none"],t.updateTextColor)).append("g").attr("class",i)},updateText(){const e=this,{$el:t,$T:s,config:i,axis:n}=e,a=e.getClass("text","index"),o=i.data_labels.centered,r=t.main.selectAll(`.${lt.texts}`).selectAll(`.${lt.text}`).data(e.labelishData.bind(e));s(r.exit()).style("fill-opacity","0").remove(),t.text=r.enter().append("text").merge(r).attr("class",a).attr("text-anchor",l=>{let u=i[`axis_${n==null?void 0:n.getId(l.id)}_inverted`]?l.value>0:l.value<0;if(e.isCandlestickType(l)){const d=e.getCandlestickData(l);u=!(d!=null&&d._isUp)}else if(e.isTreemapType(l))return o?"middle":"start";return i.axis_rotated?u?"end":"start":"middle"}).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each(function(l,c,u){const d=(0,R.select)(this);let{value:h}=l;if(e.isBubbleZType(l))h=e.getBubbleZData(h,"z");else if(e.isCandlestickType(l)){const g=e.getCandlestickData(l);g&&(h=g.close)}h=e.isTreemapType(l)?e.treemapDataLabelFormat(l)(d):e.dataLabelFormat(l.id)(h,l.id,l.index,u),I(h)?this.textContent=h:Qt(d,h,void 0,!0)}),Gs.call(e)},updateTextColor(e){const t=this,{config:s}=t,i=s.data_labels_colors,n=t.isArcType(e)&&!t.isRadarType(e)||t.isFunnelType(e)||t.isTreemapType(e)?null:t.color(e);let a;if(N(i))a=i;else if(G(i)){const{id:o}=e.data||e;a=i[o]}else k(i)&&(a=i.bind(t.api)(n,e));if(t.isCandlestickType(e)&&!k(i)){const o=t.getCandlestickData(e);if(!(o!=null&&o._isUp)){const r=s.candlestick_color_down;a=G(r)?r[e.id]:r}}return a||n},updateTextBGColor(e,t){const s=this,{$el:{defs:i}}=s;let n="";if(t){const a=N(t)?"":s.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=i.select(["filter[id*='labels-bg","']"].join(a));if(o.size()&&(n=`url(#${o.attr("id")})`),k(t)){s.generateTextBGColorFilter(t);const r=s.color(e),l=t.bind(s.api)(r,e);l?o.select("feFlood").attr("flood-color",l):n=""}}return n||null},redrawText(e,t,s,i){const n=this,{$T:a,axis:o,config:r,state:{hasTreemap:l}}=n,c=Ct(!0),u=r.axis_rotated,d=r.data_labels.rotate,h=Ga(d),g=d?`rotate(${d})`:"";let f=new Map;if(r.data_labels.centered){const p=[];n.$el.text.each(function(_){(n.isBarType(_)||n.isTreemapType(_))&&p.push(this)}),p.length>0&&(f=Wa(p))}return n.$el.text.style("fill",n.getStylePropValue(n.updateTextColor)).attr("filter",p=>n.updateTextBGColor.bind(n)(p,r.data_labels_backgroundColors)).style("fill-opacity",s?0:n.opacityForText.bind(n)).each(function(p,_){const x=f.get(this),m=a(l&&this.childElementCount?this.parentNode:this,!!(i&&(this.getAttribute("x")||this.getAttribute("transform"))),c),y=r[`axis_${o==null?void 0:o.getId(p.id)}_inverted`];let $={x:e.bind(this)(p,_,x),y:t.bind(this)(p,_,x)};d&&($=Va.bind(n)(p,$,h,u,y),m.attr("text-anchor",h)),Vs.call(n,this,$),this.childElementCount||d?m.attr("transform",`translate(${$.x} ${$.y}) ${g}`):m.attr("x",$.x).attr("y",$.y),r.data_labels.border&&Ya.call(n,m.node(),$,`${lt.textBorderRect}-${_}`)}),!0},getTextRect(e,t){var s,i;const n=this;let a,o,r;Array.isArray(e)?a=`${at.textRect}-${e.join("_")}`:(o=(i=(s=e.node)==null?void 0:s.call(e))!=null?i:e,/text/i.test(o.tagName)||(o=o.querySelector("text")),r=o.textContent,a=`${at.textRect}-${r.replace(/\W/g,"_")}`);const l=n.cache.get(a)||[];return l.length===0&&((n.$el.svg||n.$el.chart.select("svg")).selectAll(`.${D.dummy}`).data(r?[r]:e).enter().append("text").style("visibility","hidden").style("font",o?(0,R.select)(o).style("font"):null).classed(t||D.dummy,!0).text(c=>c).each(function(c,u){l[u]=dt(this)}).remove(),n.cache.add(a,l)),l.length>1?l:l[0]},generateXYForText(e,t){const s=this,{state:{hasRadar:i,hasFunnel:n,hasTreemap:a}}=s,o=Object.keys(e),r={},l=t?s.getXForText:s.getYForText;return n&&o.push("funnel"),i&&o.push("radar"),a&&o.push("treemap"),o.forEach(c=>{r[c]=s[`generateGet${xt(c)}Points`](e[c],!1)}),function(c,u){const d=s.isAreaType(c)&&"area"||s.isBarType(c)&&"bar"||s.isCandlestickType(c)&&"candlestick"||s.isFunnelType(c)&&"funnel"||s.isRadarType(c)&&"radar"||s.isTreemapType(c)&&"treemap"||"line";return l.call(s,r[d](c,u),c,this)}},getCenteredTextPos(e,t,s,i,n){const a=this,{config:o}=a,r=o.axis_rotated,l=a.isBarType(e),c=a.isTreemapType(e);if(o.data_labels.centered&&(l||c)){const u=n||Ft(s);if(l){const d=a.getRangedData(e,null,"bar")>=0;if(r){const h=(d?t[1][1]-t[0][1]:t[0][1]-t[1][1])/2+u.width/2;return d?-h-3:h+2}else{const h=(d?t[0][1]-t[1][1]:t[1][1]-t[0][1])/2+u.height/2;return d?h:-h-2}}else if(c)return i==="x"?(t[1][0]-t[0][0])/2:(t[1][1]-t[0][1])/2-u.y-u.height/2}return 0},getXForText(e,t,s,i){var n;const a=this,{config:o}=a,r=o.axis_rotated,l=a.isFunnelType(t),c=a.isTreemapType(t);let u=e?e[0][0]:0;if(a.isCandlestickType(t))r?u=(n=a.getCandlestickData(t))!=null&&n._isUp?e[2][2]+4:e[2][1]-4:u+=(e[1][0]-u)/2;else if(l)u+=a.state.current.width/2;else if(c)u+=o.data_labels.centered?0:5;else if(r){const d=o[`axis_${a.axis.getId(t.id)}_inverted`],h=a.isBarType(t)?4:6,g=t.value;u=e[2][1],d?u-=h*(g>0?1:-1):u+=h*(g<0?-1:1)}else u=a.hasType("bar")?(e[2][0]+e[0][0])/2:u;return(r||c)&&(u+=a.getCenteredTextPos(t,e,s,"x",i)),u+Ns.call(this,t,"x")},getYForText(e,t,s,i){const n=this,{axis:a,config:o,state:r}=n,l=o.axis_rotated,c=o[`axis_${a==null?void 0:a.getId(t.id)}_inverted`],u=n.isBarType(t),d=n.isFunnelType(t),h=n.isTreemapType(t),g=o.point_r,f=dt(s);let{value:p}=t,_=3,x;if(n.isCandlestickType(t))p=n.getCandlestickData(t),l?(x=e[0][0],x+=(e[1][0]-x)/2+_):(x=p&&p._isUp?e[2][2]-_:e[2][1]+_*4,c&&(x+=15*(p._isUp?1:-1)));else if(d)x=e?e[0][1]+(e[1][1]-e[0][1])/2+f.height/2-3:0;else if(h)x=e[0][1]+(o.data_labels.centered?0:f.height+5);else if(l)x=(e[0][0]+e[2][0]+f.height*.6)/2;else if(x=e[2][1],I(g)&&g>5&&(n.isLineType(t)||n.isScatterType(t))&&(_+=o.point_r/2.3),p<0||p===0&&!r.hasPositiveValue&&r.hasNegativeValue)x+=c?u?-3:-5:f.height+(u?-_:_);else{let m=-_*2;u?m=-_:n.isBubbleType(t)&&(m=_),c&&(m=u?10:15),x+=m}return(!l||h)&&(x+=n.getCenteredTextPos(t,e,s,"y",i)),x+Ns.call(this,t,"y")},markOverlapped(e,t,s){const i=t.$el.arcs.selectAll(s),n=i.filter(l=>l.data.id!==e),a=i.filter(l=>l.data.id===e),o=As(a.node()),r=(l,c)=>Math.sqrt(Math.pow(l,2)+Math.pow(c,2));a.node()&&n.each(function(){const l=As(this),c=(0,R.select)(this),u=r(o.e,o.f)>r(l.e,l.f)?a:c,d=Math.ceil(Math.abs(o.e-l.e))<Math.ceil(u.node().getComputedTextLength()),h=Math.ceil(Math.abs(o.f-l.f))<parseInt(a.style("font-size"),10);c.classed(lt.TextOverlapping,d&&h)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,R.selectAll)([this,this.previousSibling]).classed(lt.TextOverlapping,!1)})}};function Ys(e="left",t){const s=I(t);let i;return e.indexOf("center")>-1?i=s?t/2:"middle":e.indexOf("right")>-1?i=s?t:"end":i=s?0:"start",i}var Ua={initTitle(){const e=this,{config:t,$el:s}=e;if(t.title_text){s.title=s.svg.append("g");const i=s.title.append("text").style("text-anchor",Ys(t.title_position)).attr("class",lt.title);Qt(i,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:s},$el:{title:i}}=e;if(i){const n=Ys(t.title_position,s.width),a=(t.title_padding.top||0)+e.getTextRect(e.$el.title,lt.title).height;i.attr("transform",`translate(${n}, ${a})`)}},getTitlePadding(){const e=this,{$el:{title:t},config:s}=e;return(s.title_padding.top||0)+(t?e.getTextRect(t,lt.title).height:0)+(s.title_padding.bottom||0)}},Za={initTooltip(){const e=this,{config:t,$el:s}=e;s.tooltip=(0,R.select)(t.tooltip_contents.bindto),s.tooltip.empty()&&(s.tooltip=s.chart.append("div").attr("class",be.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.bindTooltipResizePos()},initShowTooltip(){var e;const t=this,{config:s,$el:i,state:{hasAxis:n,hasRadar:a}}=t;if(s.tooltip_init_show){const o=!(n||a);(e=t.axis)!=null&&e.isTimeSeries()&&N(s.tooltip_init_x)&&(s.tooltip_init_x=At.call(t,s.tooltip_init_x)),t.api.tooltip.show({data:{[o?"index":"x"]:s.tooltip_init_x}});const r=s.tooltip_init_position;if(!s.tooltip_contents.bindto&&!vt(r)){const{top:l=0,left:c=50}=r;i.tooltip.style("top",N(l)?l:`${l}px`).style("left",N(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:s,config:i}=t;return Jt(k(i.tooltip_contents)?i.tooltip_contents.bind(s)(...e):t.getTooltipContent(...e))},getTooltipContent(e,t,s,i){var n;const a=this,{api:o,config:r,state:l,$el:c}=a,[u,d,h]=["title","name","value"].map(E=>{const P=r[`tooltip_format_${E}`];return k(P)?P.bind(o):P}),g=(...E)=>(u||t)(...E),f=(...E)=>(d||(P=>P))(...E),p=(E,P,F,U)=>{let j=h;return j||(l.hasTreemap||a.isStackNormalized()&&(!a.isStackNormalizedPerGroup()||a.isGrouped(F))?j=(ht,et)=>`${(et*100).toFixed(2)}%`:j=s),j(E,P,F,U)},_=r.tooltip_order,x=E=>a.axis&&a.isBubbleZType(E)?a.getBubbleZData(E.value,"z"):a.getBaseValue(E),m=a.levelColor?E=>a.levelColor(E.value):E=>i(E),y=r.tooltip_contents,$=y.template,v=a.mapToTargetIds();if(_===null&&r.data_groups.length){const E=a.orderTargets(a.data.targets).map(P=>P.id).reverse();e.sort((P,F)=>{let U=P?P.value:null,j=F?F.value:null;return U>0&&j>0&&(U=P.id?E.indexOf(P.id):null,j=F.id?E.indexOf(F.id):null),U-j})}else if(/^(asc|desc)$/.test(_)){const E=_==="asc";e.sort((P,F)=>{const U=P?x(P):null,j=F?x(F):null;return E?U-j:j-U})}else k(_)&&e.sort(_.bind(o));const b=a.getTooltipContentTemplate($),T=e.length;let C,S,A,w,O;for(O=0;O<T;O++)if(S=e[O],!(!S||!(x(S)||x(S)===0))){if(nt(C)){const E=(l.hasAxis||l.hasRadar)&&g(S.x);C=ge(b[0],{CLASS_TOOLTIP:be.tooltip,TITLE:M(E)?$?E:`<tr><th colspan="2">${E}</th></tr>`:""})}if(!S.ratio&&c.arcs&&(A=["arc",a.$el.arcs.select(`path.${X.arc}-${S.id}`).data()[0]],S.ratio=a.getRatio(...A)),A=[S.ratio,S.id,S.index],a.isAreaRangeType(S)){const[E,P]=["high","low"].map(U=>p(a.getRangedData(S,U),...A));w=`<b>Mid:</b> ${p(x(S),...A)} <b>High:</b> ${E} <b>Low:</b> ${P}`}else if(a.isCandlestickType(S)){const[E,P,F,U,j]=["open","high","low","close","volume"].map(ht=>a.getRangedData(S,ht,"candlestick")?p(a.getRangedData(S,ht,"candlestick"),...A):void 0);w=`<b>Open:</b> ${E} <b>High:</b> ${P} <b>Low:</b> ${F} <b>Close:</b> ${U}${j?` <b>Volume:</b> ${j}`:""}`}else if(a.isBarRangeType(S)){const{value:E,id:P,index:F}=S;w=`${p(E,void 0,P,F)}`}else w=p(x(S),...A);if(w!==void 0){if(S.name===null)continue;const E=f((n=S.name)!=null?n:S.id,...A),P=m(S),F={CLASS_TOOLTIP_NAME:be.tooltipName+a.getTargetSelectorSuffix(S.id),COLOR:$||!a.patterns?P:`<svg><rect style="fill:${P}" width="10" height="10"></rect></svg>`,NAME:E,VALUE:w};if($&&G(y.text)){const U=v.indexOf(S.id);Object.keys(y.text).forEach(j=>{F[j]=y.text[j][U]})}C+=ge(b[1],F)}}return`${C}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
|
|
18
19
|
{=TITLE}
|
|
19
20
|
{{<tr class="{=CLASS_TOOLTIP_NAME}">
|
|
20
21
|
<td class="name">${this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>'}{=NAME}</td>
|
|
21
22
|
<td class="value">{=VALUE}</td>
|
|
22
23
|
</tr>}}
|
|
23
|
-
</tbody></table>`).replace(/(\r?\n|\t)/g,"").split(/{{(.*)}}/)},setTooltipPosition(e,t){var s,i;const n=this,{config:a,scale:o,state:r,$el:{eventRect:l,tooltip:c,svg:u}}=n,{bindto:d}=a.tooltip_contents,h=a.axis_rotated,g=c==null?void 0:c.datum();if(!d&&g){const f=e!=null?e:JSON.parse(g.current),[p,_]=Tt(r.event,t!=null?t:l==null?void 0:l.node()),x={x:p,y:_};if(r.hasAxis&&o.x&&g&&"x"in g){const v=(b=0,T,C="y")=>{var w;const S=o[T?(w=n.axis)==null?void 0:w.getId(T):C];return S?S(b)+(h?r.margin.left:r.margin.top):0};x.xAxis=o.x(g.x)+(a.tooltip_position?h?r.margin.top:r.margin.left:0),f.length===1?x.yAxis=v(f[0].value,f[0].id):x.yAxis=v}const{width:m=0,height:y=0}=g,$=(i=(s=a.tooltip_position)==null?void 0:s.bind(n.api)(f,m,y,l==null?void 0:l.node(),x))!=null?i:Be(u)?n.getTooltipPositionViewBox.bind(n)(m,y,x):n.getTooltipPosition.bind(n)(m,y,x);["top","left"].forEach(v=>{const b=$[v];c.style(v,`${b}px`),v==="left"&&!g.xPosInPercent&&(g.xPosInPercent=b/r.current.width*100)})}},getTooltipPositionViewBox(e,t,s){var i,n;const a=this,{$el:{eventRect:o,svg:r},config:l,state:c}=a,u=l.axis_rotated,d=a.hasArcType()||c.hasFunnel||c.hasTreemap,h=(n=(i=d?r:o)==null?void 0:i.node())!=null?n:c.event.target;let{x:g,y:f}=s;c.hasAxis&&(g=u?g:s.xAxis,f=u?s.xAxis:f);const p=we(h,g,f,!1),_=ct(h),x=we(h,20,0,!1).x;let m=p.y,y=p.x+e/2+x;return d&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(y-=e/2+x,m+=t):(m+=_.height/2,y+=_.width/2-(e-x))),y+e>_.width&&(y=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:y}},getTooltipPosition(e,t,s){var i,n,a;const o=this,{config:r,scale:l,state:c}=o,{width:u,height:d,current:h,hasFunnel:g,hasRadar:f,hasTreemap:p,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,y=r.axis_rotated,$=o.hasArcType(),v=o.getSvgLeft(!0);let b=v+h.width-o.getCurrentPaddingByDirection("right");const T=20;let{x:C,y:w}=s;if(f)C+=C>=u/2?15:-(e+15),w+=15;else if($){if(x!=="touch"){let O=(n=(i=o.getTitlePadding)==null?void 0:i.call(o))!=null?n:0;O&&m&&((a=r.arc_rangeText_values)!=null&&a.length)&&(O+=10),C+=(u-(_?o.getLegendWidth():0))/2,w+=(m?d:d/2+t)+O}}else if(g||p)w+=t;else{const A={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};y?(C+=v+A.left+T,w=A.top+s.xAxis+T,b-=v):(C=v+A.left+T+(l.zoom?C:s.xAxis),w+=A.top-5)}if(C+e+15>b&&(C-=e+(g||p||$?0:y?T*2:38)),w+t>h.height){const A=p?t+10:30;w-=m?t*1.5:t+A}const S={top:w,left:C};return Object.keys(S).forEach(A=>{S[A]<0&&(S[A]=0)}),S},showTooltip(e,t){const s=this,{config:i,$el:{tooltip:n}}=s,a=e.filter(l=>l&&M(s.getBaseValue(l)));if(!n||a.length===0||!i.tooltip_show)return;let o=n.datum();const r=JSON.stringify(e);if(!o||o.current!==r){const{index:l,x:c}=e.concat().sort()[0];J(i.tooltip_onshow,s.api,e),n.html(Pt(s.getTooltipHTML(e,s.axis?s.axis.getXAxisTickFormat():s.categoryName.bind(s),s.getDefaultValueFormat(),s.color))).style("display",null).style("visibility",null).datum(o={index:l,x:c,current:r,width:n.property("offsetWidth"),height:n.property("offsetHeight")}),J(i.tooltip_onshown,s.api,e),s._handleLinkedCharts(!0,l)}s.setTooltipPosition(a,t)},bindTooltipResizePos(){const e=this,{resizeFunction:t,state:s,$el:{tooltip:i}}=e;t.add(()=>{if(i.style("display")==="block"){const{current:n}=s,{width:a,xPosInPercent:o}=i.datum();let r=n.width/100*o;const l=n.width-(r+a);l<0&&(r+=l),i.style("left",`${r}px`)}})},hideTooltip(e){var t;const s=this,{api:i,config:n,$el:{tooltip:a}}=s;if(a&&a.style("display")!=="none"&&(!n.tooltip_doNotHide||e)){const o=JSON.parse((t=a.datum().current)!=null?t:{});J(n.tooltip_onhide,i,o),a.style("display","none").datum(null),J(n.tooltip_onhidden,i,o)}},_handleLinkedCharts(e,t){const s=this,{charts:i,config:n,state:{event:a}}=s;if(a!=null&&a.isTrusted&&n.tooltip_linked&&i.length>1){const o=n.tooltip_linked_name;i.filter(r=>r!==s.api).forEach(r=>{const{config:l,$el:c}=r.internal,u=l.tooltip_linked,d=l.tooltip_linked_name,h=lt.body.contains(c.chart.node());if(u&&o===d&&h){const g=c.tooltip.data()[0],f=t!==(g==null?void 0:g.index);try{r.tooltip[e&&f?"show":"hide"]({index:t})}catch(p){}}})}},updateTooltipOnRedraw(e,t){var s;const i=this,{config:n,$el:{eventRect:a,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:u,hasTreemap:d}}=i;if((r==null?void 0:r.style("display"))==="block"&&l){const h=e!=null?e:(s=u?o:a)==null?void 0:s.node();if(c||u)if(i.isMultipleX())i.selectRectForMultipleXs(h,!1);else{const g=t!=null?t:i.getDataIndexFromEvent(l);t===-1?i.api.tooltip.hide():(i.selectRectForSingle(h,g),i.setExpand(g,null,!0))}else{const{clientX:g,clientY:f}=l;setTimeout(()=>{let p=[g,f].every(Number.isFinite)&<.elementFromPoint(g,f);const _=p&&(0,R.select)(p).datum();if(_){const x=i.hasArcType()?i.convertToArcData(i.updateAngle(_)):_==null?void 0:_.data;d&&(p=o.node()),x&&i.showTooltip([x],p)}else i.api.tooltip.hide()},n.transition_duration)}}}},Sa={getTranslate(e,t=0){var s;const i=this,{config:n,state:a}=i,o=n.axis_rotated;let r=0,l,c;if(t&&/^(x|y2?)$/.test(e)&&(r=i.getAxisSize(e)*t),e==="main")l=Te(a.margin.left),c=Te(a.margin.top);else if(e==="context")l=Te(a.margin2.left),c=Te(a.margin2.top);else if(e==="legend")l=a.margin3.left,c=a.margin3.top;else if(e==="x")l=o?-r:0,c=o?0:a.height+r;else if(e==="y")l=o?0:-r,c=o?a.height+r:0;else if(e==="y2")l=o?0:a.width+r,c=o?-r-1:0;else if(e==="subX")l=0,c=o?0:a.height2;else if(e==="arc")l=a.arcWidth/2,c=a.arcHeight/2,(s=n.arc_rangeText_values)!=null&&s.length&&(c+=5+(i.hasType("gauge")&&n.title_text?10:0));else if(e==="polar")l=a.arcWidth/2,c=a.arcHeight/2;else if(e==="radar"){const[u,d]=i.getRadarSize();l=a.width/2-u,c=a.height/2-d}return`translate(${l}, ${c})`},transformMain(e,t){const s=this,{$el:{main:i},$T:n}=s,a=t!=null&&t.axisX?t.axisX:n(i.select(`.${ot.axisX}`),e),o=t!=null&&t.axisY?t.axisY:n(i.select(`.${ot.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:n(i.select(`.${ot.axisY2}`),e);n(i,e).attr("transform",s.getTranslate("main")),a.attr("transform",s.getTranslate("x")),o.attr("transform",s.getTranslate("y")),r.attr("transform",s.getTranslate("y2")),i.select(`.${X.chartArcs}`).attr("transform",s.getTranslate("arc"))},transformAll(e,t){const s=this,{config:i,state:{hasAxis:n,hasFunnel:a,hasTreemap:o},$el:r}=s;!a&&!o&&s.transformMain(e,t),n&&i.subchart_show&&s.transformContext(e,t),r.legend&&s.transformLegend(e)}},Ra={isValidChartType(e){return!!(e&&Object.values(L).indexOf(e)>-1)},setTargetType(e,t){const s=this,{config:i,state:{withoutFadeIn:n}}=s;s.mapToTargetIds(e).forEach(a=>{n[a]=t===i.data_types[a],i.data_types[a]=t}),e||(i.data_type=t)},updateTypesElements(){const e=this,{state:{current:t}}=e;Object.keys(L).forEach(s=>{const i=L[s],n=e.hasType(i,null,!0),a=t.types.indexOf(i);a===-1&&n?t.types.push(i):a>-1&&!n&&t.types.splice(a,1)}),e.setChartElements()},hasType(e,t,s=!1){var i;const n=this,{config:a,state:{current:o}}=n,r=a.data_types,l=t||n.data.targets;let c=!1;return!s&&((i=o.types)==null?void 0:i.indexOf(e))>-1?c=!0:l!=null&&l.length?l.forEach(u=>{const d=r[u.id];(d===e||!d&&e==="line")&&(c=!0)}):Object.keys(r).length?Object.keys(r).forEach(u=>{r[u]===e&&(c=!0)}):c=a.data_type===e,c},hasTypeOf(e,t,s=[]){return e in Mt?!Mt[e].filter(i=>s.indexOf(i)===-1).every(i=>!this.hasType(i,t)):!1},isTypeOf(e,t){var s;const i=B(e)?e:e.id,n=this.config&&(((s=this.config.data_types)==null?void 0:s[i])||this.config.data_type);return V(t)?t.indexOf(n)>=0:n===t},hasPointType(){const e=this;return e.hasTypeOf("Line")||e.hasType("bubble")||e.hasType("scatter")},hasArcType(e,t){return this.hasTypeOf("Arc",e,t)},hasMultiArcGauge(){return this.hasType("gauge")&&this.config.gauge_type==="multi"},isLineType(e){const t=B(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,Mt.Line)},isStepType(e){return this.isTypeOf(e,Mt.Step)},isSplineType(e){return this.isTypeOf(e,Mt.Spline)},isAreaType(e){return this.isTypeOf(e,Mt.Area)},isAreaRangeType(e){return this.isTypeOf(e,Mt.AreaRange)},isBarType(e){return this.isTypeOf(e,"bar")},isBubbleType(e){return this.isTypeOf(e,"bubble")},isCandlestickType(e){return this.isTypeOf(e,"candlestick")},isScatterType(e){return this.isTypeOf(e,"scatter")},isTreemapType(e){return this.isTypeOf(e,"treemap")},isPieType(e){return this.isTypeOf(e,"pie")},isFunnelType(e){return this.isTypeOf(e,"funnel")},isGaugeType(e){return this.isTypeOf(e,"gauge")},isDonutType(e){return this.isTypeOf(e,"donut")},isPolarType(e){return this.isTypeOf(e,"polar")},isRadarType(e){return this.isTypeOf(e,"radar")},isArcType(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)||this.isPolarType(e)||this.isRadarType(e)},isCirclePoint(e){const{config:t}=this,s=t.point_pattern;let i=!1;return(e==null?void 0:e.tagName)==="circle"?i=!0:i=t.point_type==="circle"&&(!s||V(s)&&s.length===0),i},lineData(e){return this.isLineType(e)?[e]:[]},arcData(e){return this.isArcType(e.data)?[e]:[]},labelishData(e){return this.isBarType(e)||this.isLineType(e)||this.isScatterType(e)||this.isBubbleType(e)||this.isCandlestickType(e)||this.isFunnelType(e)||this.isRadarType(e)||this.isTreemapType(e)?e.values.filter(t=>I(t.value)||!!t.value):[]},barLineBubbleData(e){return this.isBarType(e)||this.isLineType(e)||this.isBubbleType(e)?e.values:[]},isInterpolationType(e){return["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"].indexOf(e)>=0}},tt=Z(9);function Ca(e){const t=this;let s;return t.isLineType(e)?s=t.generateGetLinePoints(t.getShapeIndices(t.isLineType)):t.isBarType(e)&&(s=t.generateGetBarPoints(t.getShapeIndices(t.isBarType))),s}var Ea={getDrawShape(){const e=this,t=e.config.axis_rotated,{hasRadar:s,hasTreemap:i}=e.state,n={type:{},indices:{},pos:{}};if(!i&&["bar","candlestick","line","area"].forEach(a=>{const o=pt(/^(bubble|scatter)$/.test(a)?"line":a);if(e.hasType(a)||e.hasTypeOf(o)||a==="line"&&(e.hasType("bubble")||e.hasType("scatter"))){const r=e.getShapeIndices(e[`is${o}Type`]),l=e[`generateDraw${o}`];n.indices[a]=r,n.type[a]=l?l.bind(e)(r,!1):void 0}}),!e.hasArcType()||s||i){let a,o;i||(a=s?e.radarCircleX:t?e.circleY:e.circleX,o=s?e.radarCircleY:t?e.circleX:e.circleY),n.pos={xForText:e.generateXYForText(n.indices,!0),yForText:e.generateXYForText(n.indices,!1),cx:(a||function(){}).bind(e),cy:(o||function(){}).bind(e)}}return n},getShapeIndices(e){const t=this,{config:s}=t,i=s.data_xs,n=at(i),a={};let o=n?{}:0;return n&&Xe(Object.keys(i).map(r=>i[r])).forEach(r=>{o[r]=0,a[r]={}}),t.filterTargetsToShow(t.data.targets.filter(e,t)).forEach(r=>{var l;const c=r.id in i?i[r.id]:"",u=c?a[c]:a;for(let d=0,h;h=s.data_groups[d];d++)if(!(h.indexOf(r.id)<0))for(let g=0,f;f=h[g];g++){if(f in u){u[r.id]=u[f];break}r.id!==f&&c&&(u[f]=(l=u[r.id])!=null?l:o[c])}nt(u[r.id])&&(u[r.id]=c?o[c]++:o++,u.__max__=(c?o[c]:o)-1)}),a},getIndices(e,t,s){const i=this,{data_xs:n,bar_indices_removeNull:a}=i.config,{id:o,index:r}=t;if(i.isBarType(o)&&a){const l={};return i.getAllValuesOnIndex(r,!0).forEach((c,u)=>{l[c.id]=u,l.__max__=u}),l}return at(n)?e[n[o]]:e},getIndicesMax(e){return at(this.config.data_xs)?Object.keys(e).map(t=>e[t].__max__||0).reduce((t,s)=>t+s):e.__max__},getShapeX(e,t,s){const i=this,{config:n,scale:a}=i,o=s?a.subX:a.zoom||a.x,r=n.bar_overlap,l=n.bar_padding,c=(d,h)=>d+h,u=bt(e)&&(e._$total.length?e._$total.reduce(c)/2:0);return d=>{const h=i.getIndices(t,d,"getShapeX"),g=d.id in h?h[d.id]:0,f=(h.__max__||0)+1;let p=0;if(at(d.x)){const _=o(d.x,!0);if(u){const x=e[d.id]||e._$width;p=r?_-x/2:_-x+e._$total.slice(0,g+1).reduce(c)-u}else p=_-(I(e)?e:e._$width)*(f/2-(r?1:g))}return e&&p&&f>1&&l&&(g&&(p+=l*g),f>2?p-=(f-1)*l/2:f===2&&(p-=l/2)),p}},getShapeY(e){const t=this,s=t.isStackNormalized();return i=>{let{value:n}=i;return I(i)?n=i:t.isAreaRangeType(i)?n=t.getBaseValue(i,"mid"):s?n=t.getRatio("index",i,!0):t.isBubbleZType(i)?n=t.getBubbleZData(i.value,"y"):t.isBarRangeType(i)&&(n=n[1]),t.getYScaleById(i.id,e)(n)}},getShapeYMin(e){const t=this,s=t.axis.getId(e),i=t.scale[s],[n]=i.domain(),a=t.config[`axis_${s}_inverted`];return!t.isGrouped(e)&&!a&&n>0?n:0},getShapeOffsetData(e){const t=this,s=t.orderTargets(t.filterTargetsToShow(t.data.targets.filter(e,t))),i=t.isStackNormalized(),n=s.map(o=>{let r=o.values;const l={};t.isStepType(o)&&(r=t.convertValuesToStep(r));const c=r.reduce((u,d)=>{const h=Number(d.x);return u[h]=d,l[h]=i?t.getRatio("index",d,!0):d.value,u},{});return{id:o.id,rowValues:r,rowValueMapByXValue:c,values:l}});return{indexMapByTargetId:s.reduce((o,{id:r},l)=>(o[r]=l,o),{}),shapeOffsetTargets:n}},getShapeOffset(e,t,s){const i=this,{shapeOffsetTargets:n,indexMapByTargetId:a}=i.getShapeOffsetData(e),o=i.config.data_groupsZeroAs;return(r,l)=>{const{id:c,value:u,x:d}=r,h=i.getIndices(t,r),g=i.getYScaleById(c,s);if(i.isBarRangeType(r))return g(u[0]);const f=Number(d),p=g(o==="zero"?0:i.getShapeYMin(c));let _=p;return n.filter(x=>x.id!==c&&h[x.id]===h[c]).forEach(x=>{const{id:m,rowValueMapByXValue:y,rowValues:$,values:v}=x;if(a[m]<a[c]){const b=v[f];let T=$[l];(!T||Number(T.x)!==f)&&(T=y[f]),(T==null?void 0:T.value)*u>=0&&I(b)&&(u!==0||o==="positive"&&b>0||o==="negative"&&b<0)&&(_+=g(b)-p)}}),_}},circleY(e,t){const s=this,i=e.id;let n;return s.isGrouped(i)&&(n=Ca.bind(s)(e)),n?n(e,t)[0][1]:s.getYScaleById(i)(s.getBaseValue(e))},getBarW(e,t,s){var i,n,a,o,r;const l=this,{config:c,org:u,scale:d,state:h}=l,g=l.getMaxDataCount(),f=e==="bar"&&((i=c.data_groups)==null?void 0:i.length),p=`${e}_width`,{k:_}=(a=(n=l.getZoomTransform)==null?void 0:n.call(l))!=null?a:{k:1},x=[(o=c.axis_x_min)!=null?o:u.xDomain[0],(r=c.axis_x_max)!=null?r:u.xDomain[1]].map(l.axis.isTimeSeries()?At.bind(l):Number);let m=t.tickInterval(g);if(d.zoom&&!l.axis.isCategorized()&&_>1){const v=x.every((b,T)=>b===u.xDomain[T]);m=u.xDomain.map((b,T)=>{const C=v?b:b-Math.abs(x[T]);return d.zoom(C)}).reduce((b,T)=>Math.abs(b)+T)/g}const y=v=>{const b=v?c[p][v]:c[p],T=v?b.ratio:c[`${p}_ratio`],C=v?b.max:c[`${p}_max`],w=I(b)?b:k(b)?b.call(l,h.width,s,g):s?m*T/s:0;return C&&w>C?C:w};let $=y();return!f&&bt(c[p])&&($={_$width:$,_$total:[]},l.filterTargetsToShow(l.data.targets).forEach(v=>{c[p][v.id]&&($[v.id]=y(v.id),$._$total.push($[v.id]||$._$width))})),$},getShapeByIndex(e,t,s){const i=this,{$el:n}=i,a=M(t)?`-${t}`:"";let o=n[e];return o&&!o.empty()?o=o.filter(r=>s?r.id===s:!0).filter(r=>M(t)?r.index===t:!0):o=(s?n.main.selectAll(`.${G[`${e}s`]}${i.getTargetSelectorSuffix(s)}`):n.main).selectAll(`.${G[e]}${a}`),o},isWithinShape(e,t){var s;const i=this,n=(0,R.select)(e);let a;return i.isTargetToShow(t.id)?(s=i.hasValidPointType)!=null&&s.call(i,e.nodeName)?a=i.isStepType(t)?i.isWithinStep(e,i.getYScaleById(t.id)(i.getBaseValue(t))):i.isWithinCircle(e,i.isBubbleType(t)?i.pointSelectR(t)*1.5:0):e.nodeName==="path"&&(a=n.classed(G.bar)?i.isWithinBar(e):!0):a=!1,a},getInterpolate(e){const s=this.getInterpolateType(e);return{basis:tt.curveBasis,"basis-closed":tt.curveBasisClosed,"basis-open":tt.curveBasisOpen,bundle:tt.curveBundle,cardinal:tt.curveCardinal,"cardinal-closed":tt.curveCardinalClosed,"cardinal-open":tt.curveCardinalOpen,"catmull-rom":tt.curveCatmullRom,"catmull-rom-closed":tt.curveCatmullRomClosed,"catmull-rom-open":tt.curveCatmullRomOpen,"monotone-x":tt.curveMonotoneX,"monotone-y":tt.curveMonotoneY,natural:tt.curveNatural,"linear-closed":tt.curveLinearClosed,linear:tt.curveLinear,step:tt.curveStep,"step-after":tt.curveStepAfter,"step-before":tt.curveStepBefore}[s]},getInterpolateType(e){const t=this,{config:s}=t,i=s.spline_interpolation_type,n=t.isInterpolationType(i)?i:"cardinal";return t.isSplineType(e)?n:t.isStepType(e)?s.line_step_type:"linear"},isWithinBar(e){const t=Tt(this.state.event,e),s=gs(e),[i,n]=s,a=Math.min(i.x,n.x),o=Math.min(i.y,n.y),r=this.config.bar_sensitivity,{width:l,height:c}=Yt(e,!0),u=a-r,d=a+l+r,h=o+c+r,g=o-r;return u<t[0]&&t[0]<d&&g<t[1]&&t[1]<h}},La=Object.defineProperty,ka=(e,t,s)=>t in e?La(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,_t=(e,t,s)=>ka(e,typeof t!="symbol"?t+"":t,s);class Ut{constructor(t){_t(this,"api"),_t(this,"config"),_t(this,"cache"),_t(this,"$el"),_t(this,"state"),_t(this,"charts"),_t(this,"data",{xs:{},targets:[]}),_t(this,"axis"),_t(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),_t(this,"org",{xScale:null,xDomain:null}),_t(this,"color"),_t(this,"patterns"),_t(this,"levelColor"),_t(this,"point"),_t(this,"brush"),_t(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const s=this;s.api=t,s.config=new Ht,s.cache=new Vn;const i=new Xn;s.$el=i.getStore("element"),s.state=i.getStore("state"),s.$T=s.$T.bind(s)}$T(t,s,i){const{config:n,state:a}=this,o=n.transition_duration,r=n.subchart_show;let l=t;return l&&("tagName"in l&&(l=(0,R.select)(l)),l=(s!==!1&&o||s)&&(!a.zooming||a.dragging)&&!a.resizing&&a.rendered&&!r?l.transition(i).duration(o):l),l}beforeInit(){const t=this;t.callPluginHook("$beforeInit"),J(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),J(t.config.onafterinit,t.api)}init(){const t=this,{config:s,state:i,$el:n}=t,{boost_useCssRule:a,bindto:o}=s;Yn(t);const r=t.hasArcType();if(i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasFunnel=!i.hasAxis&&t.hasType("funnel"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!r&&!i.hasFunnel&&!i.hasTreemap,i.datetimeId=`bb-${+new Date*Ct()}`,a){const c=lt.createElement("style");c.type="text/css",lt.head.appendChild(c),i.style={rootSelctor:`.${i.datetimeId}`,sheet:c.sheet},n.style=c}const l={element:o,classname:"bb"};N(o)&&(l.element=o.element||"#chart",l.classname=o.classname||l.classname),n.chart=k(l.element.node)?o.element:(0,R.select)(l.element||[]),n.chart.empty()&&(n.chart=(0,R.select)(lt.body.appendChild(lt.createElement("div")))),n.chart.html("").classed(l.classname,!0).classed(i.datetimeId,a).style("position","relative"),t.initParams(),t.initToRender()}initToRender(t){const s=this,{config:i,state:n,$el:{chart:a}}=s,o=()=>Ln(a,{display:"none",visibility:"hidden"}),r=i.render.lazy===!1?!1:i.render.lazy||o(),l=j.MutationObserver;r&&l&&i.render.observe!==!1&&!t&&new l((c,u)=>{o()||(u.disconnect(),!n.rendered&&s.initToRender(!0))}).observe(a.node(),{attributes:!0,attributeFilter:["class","style"]}),(!r||t)&&s.convertData(i,c=>{s.initWithData(c),s.afterInit()})}initParams(){var t;const s=this,{config:i,format:n,state:a}=s;if(s.color=s.generateColor(),s.levelColor=s.generateLevelColor(),i.padding===!1&&(i.axis_x_show=!1,i.axis_y_show=!1,i.axis_y2_show=!1,i.subchart_show=!1),(s.hasPointType()||(t=s.hasLegendDefsPoint)!=null&&t.call(s))&&(s.point=s.generatePoint()),a.hasAxis){s.initClip(),n.extraLineClasses=s.generateExtraLineClass(),n.dataTime=i.data_xLocaltime?ye.timeParse:ye.utcParse,n.axisTime=i.axis_x_localtime?ye.timeFormat:ye.utcFormat;const c=i.zoom_enabled&&i.zoom_type==="drag";n.defaultAxisTime=u=>{const{x:d,zoom:h}=s.scale,g=c?h:h&&d.orgDomain().toString()!==h.domain().toString(),f=u.getMilliseconds()&&".%L"||u.getSeconds()&&".:%S"||u.getMinutes()&&"%I:%M"||u.getHours()&&"%I %p"||u.getDate()!==1&&"%b %d"||g&&u.getDate()===1&&"%b'%y"||u.getMonth()&&"%-m/%-d"||"%Y";return n.axisTime(f)(u)}}const{legend_position:o,legend_inset_anchor:r,axis_rotated:l}=i;a.isLegendRight=o==="right",a.isLegendInset=o==="inset",a.isLegendTop=r==="top-left"||r==="top-right",a.isLegendLeft=r==="top-left"||r==="bottom-left",a.rotatedPadding.top=s.getResettedPadding(a.rotatedPadding.top),a.rotatedPadding.right=l&&!i.axis_x_show?0:30,a.inputType=kn(i.interaction_inputType_mouse,i.interaction_inputType_touch)}initWithData(t){var s,i,n;const a=this,{config:o,scale:r,state:l,$el:c,org:u}=a,{hasAxis:d,hasFunnel:h,hasTreemap:g}=l,f=o.interaction_enabled,p=a.hasType("polar"),_=o.data_labels_backgroundColors;if(d&&(a.axis=a.getAxisInstance(),o.zoom_enabled&&a.initZoom()),a.data.xs={},a.data.targets=a.convertDataToTargets(t),o.data_filter&&(a.data.targets=a.data.targets.filter(o.data_filter.bind(a.api))),o.data_hide&&a.addHiddenTargetIds(o.data_hide===!0?a.mapToIds(a.data.targets):o.data_hide),o.legend_hide&&a.addHiddenLegendIds(o.legend_hide===!0?a.mapToIds(a.data.targets):o.legend_hide),a.updateSizes(),a.updateScales(!0),d){const{x:y,y:$,y2:v,subX:b,subY:T,subY2:C}=r;y&&(y.domain(ee(a.getXDomain(a.data.targets),!o.axis_x_inverted)),b.domain(y.domain()),u.xDomain=y.domain()),$&&($.domain(a.getYDomain(a.data.targets,"y")),T.domain($.domain())),v&&(v.domain(a.getYDomain(a.data.targets,"y2")),C&&C.domain(v.domain()))}if(c.svg=c.chart.append("svg").style("overflow","hidden").style("display","block"),f&&l.inputType){const y=l.inputType==="touch",{onclick:$,onover:v,onout:b}=o;c.svg.on("click",($==null?void 0:$.bind(a.api))||null).on(y?"touchstart":"mouseenter",(v==null?void 0:v.bind(a.api))||null,y?{passive:!0}:void 0).on(y?"touchend":"mouseleave",(b==null?void 0:b.bind(a.api))||null)}o.svg_classname&&c.svg.attr("class",o.svg_classname);const x=k(o.color_tiles)&&a.patterns;(d||x||p||g||_||(s=a.hasLegendDefsPoint)!=null&&s.call(a))&&(c.defs=c.svg.append("defs"),d&&["id","idXAxis","idYAxis","idY2Axis","idGrid"].forEach(y=>{a.appendClip(c.defs,l.clip[y])}),a.generateTextBGColorFilter(_),x&&a.patterns.forEach(y=>c.defs.append(()=>y.node))),a.updateSvgSize(),a.bindResize();const m=c.svg.append("g").classed(D.main,!0).attr("transform",h||g?null:a.getTranslate("main"));if(c.main=m,o.subchart_show&&a.initSubchart(),o.tooltip_show&&a.initTooltip(),o.title_text&&a.initTitle(),!g&&o.legend_show&&a.initLegend(),o.data_empty_label_text&&m.append("text").attr("class",`${rt.text} ${D.empty}`).attr("text-anchor","middle").attr("dominant-baseline","middle"),d&&(o.regions.length&&a.initRegion(),!o.clipPath&&a.axis.init()),m.append("g").classed(D.chart,!0).attr("clip-path",d?l.clip.path:null),a.callPluginHook("$init"),a.initChartElements(),d&&(f&&((i=a.initEventRect)==null||i.call(a)),a.initGrid(),o.clipPath&&((n=a.axis)==null||n.init())),a.updateTargets(a.data.targets),a.updateDimension(),J(o.oninit,a.api),a.setBackground(),a.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),o.data_onmin||o.data_onmax){const y=a.getMinMaxData();J(o.data_onmin,a.api,y.min),J(o.data_onmax,a.api,y.max)}o.tooltip_show&&a.initShowTooltip(),l.rendered=!0}initChartElements(){const t=this,{hasAxis:s,hasRadar:i,hasTreemap:n}=t.state,a=[];if(s){const o=["bar","bubble","candlestick","line"];t.config.bar_front&&o.push(o.shift());for(const r of o){const l=pt(r);(r==="line"&&t.hasTypeOf(l)||t.hasType(r))&&a.push(l)}}else if(n)a.push("Treemap");else if(t.hasType("funnel"))a.push("Funnel");else{const o=t.hasType("polar"),r=t.hasType("gauge");i||a.push("Arc","Pie"),r?a.push("Gauge"):i?a.push("Radar"):o&&a.push("Polar")}for(const o of a)t[`init${o}`]();at(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()}setChartElements(){const t=this,{$el:{chart:s,svg:i,defs:n,main:a,tooltip:o,legend:r,title:l,grid:c,needle:u,arcs:d,circle:h,bar:g,candlestick:f,line:p,area:_,text:x}}=t;t.api.$={chart:s,svg:i,defs:n,main:a,tooltip:o,legend:r,title:l,grid:c,arc:d,circles:h,bar:{bars:g},candlestick:f,line:{lines:p,areas:_},needle:u,text:{texts:x}}}setBackground(){const t=this,{config:{background:s},state:i,$el:{svg:n}}=t;if(at(s)){const a=n.select("g").insert(s.imgUrl?"image":"rect",":first-child");s.imgUrl?a.attr("href",s.imgUrl):s.color&&a.style("fill",s.color).attr("clip-path",i.clip.path),a.attr("class",s.class||null).attr("width","100%").attr("height","100%")}}updateTargets(t){var s,i;const n=this,{hasAxis:a,hasFunnel:o,hasRadar:r,hasTreemap:l}=n.state,c=d=>n[`updateTargetsFor${d}`](t.filter(n[`is${d}Type`].bind(n)));if(n.updateTargetsForText(t),a){const d=["bar","candlestick","line"];for(const h of d){const g=pt(h);(h==="line"&&n.hasTypeOf(g)||n.hasType(h))&&c(g)}(s=n.updateTargetsForSubchart)==null||s.call(n,t)}else if(n.hasArcType(t)){let d="Arc";r?d="Radar":n.hasType("polar")&&(d="Polar"),c(d)}else o?c("Funnel"):l&&c("Treemap");const u=n.hasType("bubble")||n.hasType("scatter");u&&((i=n.updateTargetForCircle)==null||i.call(n)),n.filterTargetsToShowAtInit(u)}filterTargetsToShowAtInit(t=!1){const s=this,{$el:{svg:i},$T:n}=s;let a=`.${D.target}`;t&&(a+=`, .${ft.chartCircles} > .${ft.circles}`),n(i.selectAll(a).filter(o=>s.isTargetToShow(o.id))).style("opacity",null)}getWithOption(t){const s={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};for(const[i,n]of Object.entries(s)){const a=B(n)?s[n]:n;s[i]=Ft(t,`with${i}`,a)}return s}initialOpacity(t){const s=this,{withoutFadeIn:i}=s.state;return s.getBaseValue(t)!==null&&i[t.id]?null:"0"}bindResize(){const t=this,{$el:s,config:i,state:n}=t,a=Un(i.resize_timer),{resize_auto:o}=i,r=[];r.push(()=>J(i.onresize,t.api)),/^(true|parent)$/.test(o)&&r.push(()=>{n.resizing=!0,i.legend_show&&(t.updateSizes(),t.updateLegend()),t.api.flush(!1)}),r.push(()=>{J(i.onresized,t.api),n.resizing=!1}),r.forEach(l=>a.add(l)),t.resizeFunction=a,o==="parent"?(t.resizeFunction.resizeObserver=new ResizeObserver(t.resizeFunction.bind(t))).observe(s.chart.node().parentNode):j.addEventListener("resize",t.resizeFunction)}callPluginHook(t,...s){this.config.plugins.forEach(i=>{t==="$beforeInit"&&(i.$$=this,this.api.plugins.push(i)),i[t](...s)})}}dt(Ut.prototype,[ea,sa,ia,aa,oa,da,ua,na,ha,ga,pa,xa,Ea,_a,ma,Ta,Aa,wa,Sa,Ra]);function Pa(e){const t=this.config;let s,i,n;const a=()=>{const o=i.shift();if(o&&s&&bt(s)&&o in s)return s=s[o],a();if(!o)return s};Object.keys(t).forEach(o=>{s=e,i=o.split("_"),n=a(),W(n)&&(t[o]=n)}),this.api&&(this.state.orgConfig=e)}var Oa={resize(e){const t=this.internal,{config:s,state:i}=t;i.rendered&&(s.size_width=e?e.width:null,s.size_height=e?e.height:null,i.resizing=!0,this.flush(!1),t.resizeFunction())},flush(e){var t,s;const i=this.internal,{state:n,$el:{zoomResetBtn:a}}=i;n.rendered?(n.resizing?(t=i.brush)==null||t.updateResize():(s=i.axis)==null||s.setOrient(),a==null||a.style("display","none"),i.scale.zoom&&(n.current.zoomDomain=i.scale.zoom.domain()),i.scale.zoom=null,e?i.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):i.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1}),!n.resizing&&i.brush&&(i.brush.getSelection().call(i.brush.move),i.unselectRect()),n.current.zoomDomain&&(i.api.zoom(n.current.zoomDomain),n.current.zoomDomain=null)):i.initToRender(!0)},destroy(){var e;const t=this.internal,{$el:{chart:s,style:i,svg:n}}=t;if(at(t)){t.callPluginHook("$willDestroy"),t.charts.splice(t.charts.indexOf(this),1),t.unbindAllEvents(),n.select("*").interrupt(),t.resizeFunction.clear(),(e=t.resizeFunction.resizeObserver)==null||e.disconnect(),j.removeEventListener("resize",t.resizeFunction),s.classed("bb",!1).style("position",null).selectChildren().remove(),i&&i.parentNode.removeChild(i),Object.keys(this).forEach(a=>{a==="internal"&&Object.keys(t).forEach(o=>{t[o]=null}),this[a]=null,delete this[a]});for(const a in this)this[a]=()=>{}}return null},config(e,t,s){const i=this.internal,{config:n,state:a}=i,o=e==null?void 0:e.replace(/\./g,"_");let r;return e&&o in n?W(t)?(n[o]=t,r=t,s&&this.flush()):r=n[o]:(arguments.length===0||vt(e))&&(r=a.orgConfig),r}},Ia={color(e){return this.internal.color(e)}};const Fs=function(e){const{targets:t}=this.internal.data;if(!nt(e)){const s=V(e)?e:[e];return t.filter(i=>s.some(n=>n===i.id))}return t};dt(Fs,{shown:function(e){return this.internal.filterTargetsToShow(this.data(e))},values:function(e,t=!0){let s=null;if(e){const i=this.data(e);V(i)&&(s=[],i.forEach(n=>{const a=n.values.map(o=>o.value);t?s=s.concat(a):s.push(a)}))}return s},names:function(e){return this.internal.updateDataAttributes("names",e)},colors:function(e){return this.internal.updateDataAttributes("colors",e)},axes:function(e){return this.internal.updateDataAttributes("axes",e)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});var Da={data:Fs};const za=e=>{var t,s;return(s=(t=j).btoa)==null?void 0:s.call(t,encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(i,n)=>String.fromCharCode(+`0x${n}`)))};function Fa(e,t,s){const{width:i,height:n}=t||s,a=new XMLSerializer,o=e.cloneNode(!0),r=Cn(jt(lt.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",R.namespaces.xhtml),o.style.margin="0",o.style.padding="0",t.preserveFontStyle&&o.querySelectorAll("text").forEach(h=>{h.innerHTML=""});const l=a.serializeToString(o),c=lt.createElement("style");c.appendChild(lt.createTextNode(r.join(`
|
|
24
|
+
</tbody></table>`).replace(/(\r?\n|\t)/g,"").split(/{{(.*)}}/)},setTooltipPosition(e,t){var s,i;const n=this,{config:a,scale:o,state:r,$el:{eventRect:l,tooltip:c,svg:u}}=n,{bindto:d}=a.tooltip_contents,h=a.axis_rotated,g=c==null?void 0:c.datum();if(!d&&g){const f=e!=null?e:JSON.parse(g.current),[p,_]=Tt(r.event,t!=null?t:l==null?void 0:l.node()),x={x:p,y:_};if(r.hasAxis&&o.x&&g&&"x"in g){const v=(b=0,T,C="y")=>{var S;const A=o[T?(S=n.axis)==null?void 0:S.getId(T):C];return A?A(b)+(h?r.margin.left:r.margin.top):0};x.xAxis=o.x(g.x)+(a.tooltip_position?h?r.margin.top:r.margin.left:0),f.length===1?x.yAxis=v(f[0].value,f[0].id):x.yAxis=v}const{width:m=0,height:y=0}=g,$=(i=(s=a.tooltip_position)==null?void 0:s.bind(n.api)(f,m,y,l==null?void 0:l.node(),x))!=null?i:Ne(u)?n.getTooltipPositionViewBox.bind(n)(m,y,x):n.getTooltipPosition.bind(n)(m,y,x);["top","left"].forEach(v=>{const b=$[v];c.style(v,`${b}px`),v==="left"&&!g.xPosInPercent&&(g.xPosInPercent=b/r.current.width*100)})}},getTooltipPositionViewBox(e,t,s){var i,n;const a=this,{$el:{eventRect:o,svg:r},config:l,state:c}=a,u=l.axis_rotated,d=a.hasArcType()||c.hasFunnel||c.hasTreemap,h=(n=(i=d?r:o)==null?void 0:i.node())!=null?n:c.event.target;let{x:g,y:f}=s;c.hasAxis&&(g=u?g:s.xAxis,f=u?s.xAxis:f);const p=we(h,g,f,!1),_=dt(h),x=we(h,20,0,!1).x;let m=p.y,y=p.x+e/2+x;return d&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(y-=e/2+x,m+=t):(m+=_.height/2,y+=_.width/2-(e-x))),y+e>_.width&&(y=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:y}},getTooltipPosition(e,t,s){var i,n,a;const o=this,{config:r,scale:l,state:c}=o,{width:u,height:d,current:h,hasFunnel:g,hasRadar:f,hasTreemap:p,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,y=r.axis_rotated,$=o.hasArcType(),v=o.getSvgLeft(!0);let b=v+h.width-o.getCurrentPaddingByDirection("right");const T=20;let{x:C,y:S}=s;if(f)C+=C>=u/2?15:-(e+15),S+=15;else if($){if(x!=="touch"){let O=(n=(i=o.getTitlePadding)==null?void 0:i.call(o))!=null?n:0;O&&m&&((a=r.arc_rangeText_values)!=null&&a.length)&&(O+=10),C+=(u-(_?o.getLegendWidth():0))/2,S+=(m?d:d/2+t)+O}}else if(g||p)S+=t;else{const w={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};y?(C+=v+w.left+T,S=w.top+s.xAxis+T,b-=v):(C=v+w.left+T+(l.zoom?C:s.xAxis),S+=w.top-5)}if(C+e+15>b&&(C-=e+(g||p||$?0:y?T*2:38)),S+t>h.height){const w=p?t+10:30;S-=m?t*1.5:t+w}const A={top:S,left:C};return Object.keys(A).forEach(w=>{A[w]<0&&(A[w]=0)}),A},showTooltip(e,t){const s=this,{config:i,$el:{tooltip:n}}=s,a=e.filter(l=>l&&M(s.getBaseValue(l)));if(!n||a.length===0||!i.tooltip_show)return;let o=n.datum();const r=JSON.stringify(e);if(!o||o.current!==r){const{index:l,x:c}=e.concat().sort()[0];J(i.tooltip_onshow,s.api,e),n.html(s.getTooltipHTML(e,s.axis?s.axis.getXAxisTickFormat():s.categoryName.bind(s),s.getDefaultValueFormat(),s.color)).style("display",null).style("visibility",null).datum(o={index:l,x:c,current:r,width:n.property("offsetWidth"),height:n.property("offsetHeight")}),J(i.tooltip_onshown,s.api,e),s._handleLinkedCharts(!0,l)}s.setTooltipPosition(a,t)},bindTooltipResizePos(){const e=this,{resizeFunction:t,state:s,$el:{tooltip:i}}=e;t.add(()=>{if(i.style("display")==="block"){const{current:n}=s,{width:a,xPosInPercent:o}=i.datum();let r=n.width/100*o;const l=n.width-(r+a);l<0&&(r+=l),i.style("left",`${r}px`)}})},hideTooltip(e){var t;const s=this,{api:i,config:n,$el:{tooltip:a}}=s;if(a&&a.style("display")!=="none"&&(!n.tooltip_doNotHide||e)){const o=JSON.parse((t=a.datum().current)!=null?t:{});J(n.tooltip_onhide,i,o),a.style("display","none").datum(null),J(n.tooltip_onhidden,i,o)}},_handleLinkedCharts(e,t){const s=this,{charts:i,config:n,state:{event:a}}=s;if(a!=null&&a.isTrusted&&n.tooltip_linked&&i.length>1){const o=n.tooltip_linked_name;i.filter(r=>r!==s.api).forEach(r=>{const{config:l,$el:c}=r.internal,u=l.tooltip_linked,d=l.tooltip_linked_name,h=ct.body.contains(c.chart.node());if(u&&o===d&&h){const g=c.tooltip.data()[0],f=t!==(g==null?void 0:g.index);try{r.tooltip[e&&f?"show":"hide"]({index:t})}catch(p){}}})}},updateTooltipOnRedraw(e,t){var s;const i=this,{config:n,$el:{eventRect:a,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:u,hasTreemap:d}}=i;if((r==null?void 0:r.style("display"))==="block"&&l){const h=e!=null?e:(s=u?o:a)==null?void 0:s.node();if(c||u)if(i.isMultipleX())i.selectRectForMultipleXs(h,!1);else{const g=t!=null?t:i.getDataIndexFromEvent(l);t===-1?i.api.tooltip.hide():(i.selectRectForSingle(h,g),i.setExpand(g,null,!0))}else{const{clientX:g,clientY:f}=l;setTimeout(()=>{let p=[g,f].every(Number.isFinite)&&ct.elementFromPoint(g,f);const _=p&&(0,R.select)(p).datum();if(_){const x=i.hasArcType()?i.convertToArcData(i.updateAngle(_)):_==null?void 0:_.data;d&&(p=o.node()),x&&i.showTooltip([x],p)}else i.api.tooltip.hide()},n.transition_duration)}}}},qa={getTranslate(e,t=0){var s;const i=this,{config:n,state:a}=i,o=n.axis_rotated;let r=0,l,c;if(t&&/^(x|y2?)$/.test(e)&&(r=i.getAxisSize(e)*t),e==="main")l=Te(a.margin.left),c=Te(a.margin.top);else if(e==="context")l=Te(a.margin2.left),c=Te(a.margin2.top);else if(e==="legend")l=a.margin3.left,c=a.margin3.top;else if(e==="x")l=o?-r:0,c=o?0:a.height+r;else if(e==="y")l=o?0:-r,c=o?a.height+r:0;else if(e==="y2")l=o?0:a.width+r,c=o?-r-1:0;else if(e==="subX")l=0,c=o?0:a.height2;else if(e==="arc")l=a.arcWidth/2,c=a.arcHeight/2,(s=n.arc_rangeText_values)!=null&&s.length&&(c+=5+(i.hasType("gauge")&&n.title_text?10:0));else if(e==="polar")l=a.arcWidth/2,c=a.arcHeight/2;else if(e==="radar"){const[u,d]=i.getRadarSize();l=a.width/2-u,c=a.height/2-d}return`translate(${l}, ${c})`},transformMain(e,t){const s=this,{$el:{main:i},$T:n}=s,a=t!=null&&t.axisX?t.axisX:n(i.select(`.${rt.axisX}`),e),o=t!=null&&t.axisY?t.axisY:n(i.select(`.${rt.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:n(i.select(`.${rt.axisY2}`),e);n(i,e).attr("transform",s.getTranslate("main")),a.attr("transform",s.getTranslate("x")),o.attr("transform",s.getTranslate("y")),r.attr("transform",s.getTranslate("y2")),i.select(`.${X.chartArcs}`).attr("transform",s.getTranslate("arc"))},transformAll(e,t){const s=this,{config:i,state:{hasAxis:n,hasFunnel:a,hasTreemap:o},$el:r}=s;!a&&!o&&s.transformMain(e,t),n&&i.subchart_show&&s.transformContext(e,t),r.legend&&s.transformLegend(e)}},Ka={isValidChartType(e){return!!(e&&Object.values(L).indexOf(e)>-1)},setTargetType(e,t){const s=this,{config:i,state:{withoutFadeIn:n}}=s;s.mapToTargetIds(e).forEach(a=>{n[a]=t===i.data_types[a],i.data_types[a]=t}),e||(i.data_type=t)},updateTypesElements(){const e=this,{state:{current:t}}=e;Object.keys(L).forEach(s=>{const i=L[s],n=e.hasType(i,null,!0),a=t.types.indexOf(i);a===-1&&n?t.types.push(i):a>-1&&!n&&t.types.splice(a,1)}),e.setChartElements()},hasType(e,t,s=!1){var i;const n=this,{config:a,state:{current:o}}=n,r=a.data_types,l=t||n.data.targets;let c=!1;return!s&&((i=o.types)==null?void 0:i.indexOf(e))>-1?c=!0:l!=null&&l.length?l.forEach(u=>{const d=r[u.id];(d===e||!d&&e==="line")&&(c=!0)}):Object.keys(r).length?Object.keys(r).forEach(u=>{r[u]===e&&(c=!0)}):c=a.data_type===e,c},hasTypeOf(e,t,s=[]){return e in Mt?!Mt[e].filter(i=>s.indexOf(i)===-1).every(i=>!this.hasType(i,t)):!1},isTypeOf(e,t){var s;const i=N(e)?e:e.id,n=this.config&&(((s=this.config.data_types)==null?void 0:s[i])||this.config.data_type);return Y(t)?t.indexOf(n)>=0:n===t},hasPointType(){const e=this;return e.hasTypeOf("Line")||e.hasType("bubble")||e.hasType("scatter")},hasArcType(e,t){return this.hasTypeOf("Arc",e,t)},hasMultiArcGauge(){return this.hasType("gauge")&&this.config.gauge_type==="multi"},isLineType(e){const t=N(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,Mt.Line)},isStepType(e){return this.isTypeOf(e,Mt.Step)},isSplineType(e){return this.isTypeOf(e,Mt.Spline)},isAreaType(e){return this.isTypeOf(e,Mt.Area)},isAreaRangeType(e){return this.isTypeOf(e,Mt.AreaRange)},isBarType(e){return this.isTypeOf(e,"bar")},isBubbleType(e){return this.isTypeOf(e,"bubble")},isCandlestickType(e){return this.isTypeOf(e,"candlestick")},isScatterType(e){return this.isTypeOf(e,"scatter")},isTreemapType(e){return this.isTypeOf(e,"treemap")},isPieType(e){return this.isTypeOf(e,"pie")},isFunnelType(e){return this.isTypeOf(e,"funnel")},isGaugeType(e){return this.isTypeOf(e,"gauge")},isDonutType(e){return this.isTypeOf(e,"donut")},isPolarType(e){return this.isTypeOf(e,"polar")},isRadarType(e){return this.isTypeOf(e,"radar")},isArcType(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)||this.isPolarType(e)||this.isRadarType(e)},isCirclePoint(e){const{config:t}=this,s=t.point_pattern;let i=!1;return(e==null?void 0:e.tagName)==="circle"?i=!0:i=t.point_type==="circle"&&(!s||Y(s)&&s.length===0),i},lineData(e){return this.isLineType(e)?[e]:[]},arcData(e){return this.isArcType(e.data)?[e]:[]},labelishData(e){return this.isBarType(e)||this.isLineType(e)||this.isScatterType(e)||this.isBubbleType(e)||this.isCandlestickType(e)||this.isFunnelType(e)||this.isRadarType(e)||this.isTreemapType(e)?e.values.filter(t=>I(t.value)||!!t.value):[]},barLineBubbleData(e){return this.isBarType(e)||this.isLineType(e)||this.isBubbleType(e)?e.values:[]},isInterpolationType(e){return["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"].indexOf(e)>=0}},tt=Z(9);function Ja(e){const t=this;let s;return t.isLineType(e)?s=t.generateGetLinePoints(t.getShapeIndices(t.isLineType)):t.isBarType(e)&&(s=t.generateGetBarPoints(t.getShapeIndices(t.isBarType))),s}var Qa={getDrawShape(){const e=this,t=e.config.axis_rotated,{hasRadar:s,hasTreemap:i}=e.state,n={type:{},indices:{},pos:{}};if(!i&&["bar","candlestick","line","area"].forEach(a=>{const o=xt(/^(bubble|scatter)$/.test(a)?"line":a);if(e.hasType(a)||e.hasTypeOf(o)||a==="line"&&(e.hasType("bubble")||e.hasType("scatter"))){const r=e.getShapeIndices(e[`is${o}Type`]),l=e[`generateDraw${o}`];n.indices[a]=r,n.type[a]=l?l.bind(e)(r,!1):void 0}}),!e.hasArcType()||s||i){let a,o;i||(a=s?e.radarCircleX:t?e.circleY:e.circleX,o=s?e.radarCircleY:t?e.circleX:e.circleY),n.pos={xForText:e.generateXYForText(n.indices,!0),yForText:e.generateXYForText(n.indices,!1),cx:(a||function(){}).bind(e),cy:(o||function(){}).bind(e)}}return n},getShapeIndices(e){const t=this,{config:s}=t,i=s.data_xs,n=ot(i),a={};let o=n?{}:0;return n&&Be(Object.keys(i).map(r=>i[r])).forEach(r=>{o[r]=0,a[r]={}}),t.filterTargetsToShow(t.data.targets.filter(e,t)).forEach(r=>{var l;const c=r.id in i?i[r.id]:"",u=c?a[c]:a;for(let d=0,h;h=s.data_groups[d];d++)if(!(h.indexOf(r.id)<0))for(let g=0,f;f=h[g];g++){if(f in u){u[r.id]=u[f];break}r.id!==f&&c&&(u[f]=(l=u[r.id])!=null?l:o[c])}nt(u[r.id])&&(u[r.id]=c?o[c]++:o++,u.__max__=(c?o[c]:o)-1)}),a},getIndices(e,t,s){const i=this,{data_xs:n,bar_indices_removeNull:a}=i.config,{id:o,index:r}=t;if(i.isBarType(o)&&a){const l={};return i.getAllValuesOnIndex(r,!0).forEach((c,u)=>{l[c.id]=u,l.__max__=u}),l}return ot(n)?e[n[o]]:e},getIndicesMax(e){return ot(this.config.data_xs)?Object.keys(e).map(t=>e[t].__max__||0).reduce((t,s)=>t+s):e.__max__},getShapeX(e,t,s){const i=this,{config:n,scale:a}=i,o=s?a.subX:a.zoom||a.x,r=n.bar_overlap,l=n.bar_padding,c=(d,h)=>d+h,u=bt(e)&&(e._$total.length?e._$total.reduce(c)/2:0);return d=>{const h=i.getIndices(t,d,"getShapeX"),g=d.id in h?h[d.id]:0,f=(h.__max__||0)+1;let p=0;if(ot(d.x)){const _=o(d.x,!0);if(u){const x=e[d.id]||e._$width;p=r?_-x/2:_-x+e._$total.slice(0,g+1).reduce(c)-u}else p=_-(I(e)?e:e._$width)*(f/2-(r?1:g))}return e&&p&&f>1&&l&&(g&&(p+=l*g),f>2?p-=(f-1)*l/2:f===2&&(p-=l/2)),p}},getShapeY(e){const t=this,s=t.isStackNormalized();return i=>{let{value:n}=i;return I(i)?n=i:t.isAreaRangeType(i)?n=t.getBaseValue(i,"mid"):s?n=t.getRatio("index",i,!0):t.isBubbleZType(i)?n=t.getBubbleZData(i.value,"y"):t.isBarRangeType(i)&&(n=n[1]),t.getYScaleById(i.id,e)(n)}},getShapeYMin(e){const t=this,s=t.axis.getId(e),i=t.scale[s],[n]=i.domain(),a=t.config[`axis_${s}_inverted`];return!t.isGrouped(e)&&!a&&n>0?n:0},getShapeOffsetData(e){const t=this,s=t.orderTargets(t.filterTargetsToShow(t.data.targets.filter(e,t))),i=s.map(u=>u.id).join("_"),n=`${at.shapeOffset}_${i}`,a=t.cache.get(n);if(a)return a;const o=t.isStackNormalized(),r=s.map(u=>{let d=u.values;const h={};t.isStepType(u)&&(d=t.convertValuesToStep(d));const g=d.reduce((f,p)=>{const _=Number(p.x);return f[_]=p,h[_]=o?t.getRatio("index",p,!0):p.value,f},{});return{id:u.id,rowValues:d,rowValueMapByXValue:g,values:h}}),c={indexMapByTargetId:s.reduce((u,{id:d},h)=>(u[d]=h,u),{}),shapeOffsetTargets:r};return t.cache.add(n,c),c},getShapeOffset(e,t,s){const i=this,{shapeOffsetTargets:n,indexMapByTargetId:a}=i.getShapeOffsetData(e),o=i.config.data_groupsZeroAs;return(r,l)=>{const{id:c,value:u,x:d}=r,h=i.getIndices(t,r),g=i.getYScaleById(c,s);if(i.isBarRangeType(r))return g(u[0]);const f=Number(d),p=g(o==="zero"?0:i.getShapeYMin(c));let _=p;return n.filter(x=>x.id!==c&&h[x.id]===h[c]).forEach(x=>{const{id:m,rowValueMapByXValue:y,rowValues:$,values:v}=x;if(a[m]<a[c]){const b=v[f];let T=$[l];(!T||Number(T.x)!==f)&&(T=y[f]),(T==null?void 0:T.value)*u>=0&&I(b)&&(u!==0||o==="positive"&&b>0||o==="negative"&&b<0)&&(_+=g(b)-p)}}),_}},circleY(e,t){const s=this,i=e.id;let n;return s.isGrouped(i)&&(n=Ja.bind(s)(e)),n?n(e,t)[0][1]:s.getYScaleById(i)(s.getBaseValue(e))},getBarW(e,t,s){var i,n,a,o,r;const l=this,{config:c,org:u,scale:d,state:h}=l,g=l.getMaxDataCount(),f=e==="bar"&&((i=c.data_groups)==null?void 0:i.length),p=`${e}_width`,{k:_}=(a=(n=l.getZoomTransform)==null?void 0:n.call(l))!=null?a:{k:1},x=[(o=c.axis_x_min)!=null?o:u.xDomain[0],(r=c.axis_x_max)!=null?r:u.xDomain[1]].map(l.axis.isTimeSeries()?At.bind(l):Number);let m=t.tickInterval(g);if(d.zoom&&!l.axis.isCategorized()&&_>1){const v=x.every((b,T)=>b===u.xDomain[T]);m=u.xDomain.map((b,T)=>{const C=v?b:b-Math.abs(x[T]);return d.zoom(C)}).reduce((b,T)=>Math.abs(b)+T)/g}const y=v=>{const b=v?c[p][v]:c[p],T=v?b.ratio:c[`${p}_ratio`],C=v?b.max:c[`${p}_max`],S=I(b)?b:k(b)?b.call(l,h.width,s,g):s?m*T/s:0;return C&&S>C?C:S};let $=y();return!f&&bt(c[p])&&($={_$width:$,_$total:[]},l.filterTargetsToShow(l.data.targets).forEach(v=>{c[p][v.id]&&($[v.id]=y(v.id),$._$total.push($[v.id]||$._$width))})),$},getShapeByIndex(e,t,s){const i=this,{$el:n}=i,a=M(t)?`-${t}`:"";let o=n[e];return o&&!o.empty()?o=o.filter(r=>s?r.id===s:!0).filter(r=>M(t)?r.index===t:!0):o=(s?n.main.selectAll(`.${V[`${e}s`]}${i.getTargetSelectorSuffix(s)}`):n.main).selectAll(`.${V[e]}${a}`),o},isWithinShape(e,t){var s;const i=this,n=(0,R.select)(e);let a;return i.isTargetToShow(t.id)?(s=i.hasValidPointType)!=null&&s.call(i,e.nodeName)?a=i.isStepType(t)?i.isWithinStep(e,i.getYScaleById(t.id)(i.getBaseValue(t))):i.isWithinCircle(e,i.isBubbleType(t)?i.pointSelectR(t)*1.5:0):e.nodeName==="path"&&(a=n.classed(V.bar)?i.isWithinBar(e):!0):a=!1,a},getInterpolate(e){const s=this.getInterpolateType(e);return{basis:tt.curveBasis,"basis-closed":tt.curveBasisClosed,"basis-open":tt.curveBasisOpen,bundle:tt.curveBundle,cardinal:tt.curveCardinal,"cardinal-closed":tt.curveCardinalClosed,"cardinal-open":tt.curveCardinalOpen,"catmull-rom":tt.curveCatmullRom,"catmull-rom-closed":tt.curveCatmullRomClosed,"catmull-rom-open":tt.curveCatmullRomOpen,"monotone-x":tt.curveMonotoneX,"monotone-y":tt.curveMonotoneY,natural:tt.curveNatural,"linear-closed":tt.curveLinearClosed,linear:tt.curveLinear,step:tt.curveStep,"step-after":tt.curveStepAfter,"step-before":tt.curveStepBefore}[s]},getInterpolateType(e){const t=this,{config:s}=t,i=s.spline_interpolation_type,n=t.isInterpolationType(i)?i:"cardinal";return t.isSplineType(e)?n:t.isStepType(e)?s.line_step_type:"linear"},isWithinBar(e){const t=Tt(this.state.event,e),s=ys(e),[i,n]=s,a=Math.min(i.x,n.x),o=Math.min(i.y,n.y),r=this.config.bar_sensitivity,{width:l,height:c}=Ft(e,!0),u=a-r,d=a+l+r,h=o+c+r,g=o-r;return u<t[0]&&t[0]<d&&g<t[1]&&t[1]<h}},to=Object.defineProperty,eo=(e,t,s)=>t in e?to(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,_t=(e,t,s)=>eo(e,typeof t!="symbol"?t+"":t,s);class Ht{constructor(t){_t(this,"api"),_t(this,"config"),_t(this,"cache"),_t(this,"$el"),_t(this,"state"),_t(this,"charts"),_t(this,"data",{xs:{},targets:[]}),_t(this,"axis"),_t(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),_t(this,"org",{xScale:null,xDomain:null}),_t(this,"color"),_t(this,"patterns"),_t(this,"levelColor"),_t(this,"point"),_t(this,"brush"),_t(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const s=this;s.api=t,s.config=new jt,s.cache=new ua;const i=new ra;s.$el=i.getStore("element"),s.state=i.getStore("state"),s.$T=s.$T.bind(s)}$T(t,s,i){const{config:n,state:a}=this,o=n.transition_duration,r=n.subchart_show;let l=t;return l&&("tagName"in l&&(l=(0,R.select)(l)),l=(s!==!1&&o||s)&&(!a.zooming||a.dragging)&&!a.resizing&&a.rendered&&!r?l.transition(i).duration(o):l),l}beforeInit(){const t=this;t.callPluginHook("$beforeInit"),J(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),J(t.config.onafterinit,t.api)}init(){const t=this,{config:s,state:i,$el:n}=t,{boost_useCssRule:a,bindto:o}=s;ha(t);const r=t.hasArcType();if(i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasFunnel=!i.hasAxis&&t.hasType("funnel"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!r&&!i.hasFunnel&&!i.hasTreemap,i.datetimeId=`bb-${+new Date*Ct()}`,a){const c=ct.createElement("style");c.type="text/css",ct.head.appendChild(c),i.style={rootSelctor:`.${i.datetimeId}`,sheet:c.sheet},n.style=c}const l={element:o,classname:"bb"};G(o)&&(l.element=o.element||"#chart",l.classname=o.classname||l.classname),n.chart=k(l.element.node)?o.element:(0,R.select)(l.element||[]),n.chart.empty()&&(n.chart=(0,R.select)(ct.body.appendChild(ct.createElement("div")))),n.chart.html("").classed(l.classname,!0).classed(i.datetimeId,a).style("position","relative"),t.initParams(),t.initToRender()}initToRender(t){const s=this,{config:i,state:n,$el:{chart:a}}=s,o=()=>Jn(a,{display:"none",visibility:"hidden"}),r=i.render.lazy===!1?!1:i.render.lazy||o(),l=B.MutationObserver;r&&l&&i.render.observe!==!1&&!t&&new l((c,u)=>{o()||(u.disconnect(),!n.rendered&&s.initToRender(!0))}).observe(a.node(),{attributes:!0,attributeFilter:["class","style"]}),(!r||t)&&s.convertData(i,c=>{s.initWithData(c),s.afterInit()})}initParams(){var t;const s=this,{config:i,format:n,state:a}=s;if(s.color=s.generateColor(),s.levelColor=s.generateLevelColor(),i.padding===!1&&(i.axis_x_show=!1,i.axis_y_show=!1,i.axis_y2_show=!1,i.subchart_show=!1),(s.hasPointType()||(t=s.hasLegendDefsPoint)!=null&&t.call(s))&&(s.point=s.generatePoint()),a.hasAxis){s.initClip(),n.extraLineClasses=s.generateExtraLineClass(),n.dataTime=i.data_xLocaltime?ye.timeParse:ye.utcParse,n.axisTime=i.axis_x_localtime?ye.timeFormat:ye.utcFormat;const c=i.zoom_enabled&&i.zoom_type==="drag";n.defaultAxisTime=u=>{const{x:d,zoom:h}=s.scale,g=c?h:h&&d.orgDomain().toString()!==h.domain().toString(),f=u.getMilliseconds()&&".%L"||u.getSeconds()&&".:%S"||u.getMinutes()&&"%I:%M"||u.getHours()&&"%I %p"||u.getDate()!==1&&"%b %d"||g&&u.getDate()===1&&"%b'%y"||u.getMonth()&&"%-m/%-d"||"%Y";return n.axisTime(f)(u)}}const{legend_position:o,legend_inset_anchor:r,axis_rotated:l}=i;a.isLegendRight=o==="right",a.isLegendInset=o==="inset",a.isLegendTop=r==="top-left"||r==="top-right",a.isLegendLeft=r==="top-left"||r==="bottom-left",a.rotatedPadding.top=s.getResettedPadding(a.rotatedPadding.top),a.rotatedPadding.right=l&&!i.axis_x_show?0:30,a.inputType=Qn(i.interaction_inputType_mouse,i.interaction_inputType_touch)}initWithData(t){var s,i,n;const a=this,{config:o,scale:r,state:l,$el:c,org:u}=a,{hasAxis:d,hasFunnel:h,hasTreemap:g}=l,f=o.interaction_enabled,p=a.hasType("polar"),_=o.data_labels_backgroundColors;if(d&&(a.axis=a.getAxisInstance(),o.zoom_enabled&&a.initZoom()),a.data.xs={},a.data.targets=a.convertDataToTargets(t),o.data_filter&&(a.data.targets=a.data.targets.filter(o.data_filter.bind(a.api))),o.data_hide&&a.addHiddenTargetIds(o.data_hide===!0?a.mapToIds(a.data.targets):o.data_hide),o.legend_hide&&a.addHiddenLegendIds(o.legend_hide===!0?a.mapToIds(a.data.targets):o.legend_hide),a.updateSizes(),a.updateScales(!0),d){const{x:y,y:$,y2:v,subX:b,subY:T,subY2:C}=r;y&&(y.domain(ee(a.getXDomain(a.data.targets),!o.axis_x_inverted)),b.domain(y.domain()),u.xDomain=y.domain()),$&&($.domain(a.getYDomain(a.data.targets,"y")),T.domain($.domain())),v&&(v.domain(a.getYDomain(a.data.targets,"y2")),C&&C.domain(v.domain()))}if(c.svg=c.chart.append("svg").style("overflow","hidden").style("display","block"),f&&l.inputType){const y=l.inputType==="touch",{onclick:$,onover:v,onout:b}=o;c.svg.on("click",($==null?void 0:$.bind(a.api))||null).on(y?"touchstart":"mouseenter",(v==null?void 0:v.bind(a.api))||null,y?{passive:!0}:void 0).on(y?"touchend":"mouseleave",(b==null?void 0:b.bind(a.api))||null)}o.svg_classname&&c.svg.attr("class",o.svg_classname);const x=k(o.color_tiles)&&a.patterns;(d||x||p||g||_||(s=a.hasLegendDefsPoint)!=null&&s.call(a))&&(c.defs=c.svg.append("defs"),d&&["id","idXAxis","idYAxis","idGrid"].forEach(y=>{a.appendClip(c.defs,l.clip[y])}),a.generateTextBGColorFilter(_),x&&a.patterns.forEach(y=>c.defs.append(()=>y.node))),a.updateSvgSize(),a.bindResize();const m=c.svg.append("g").classed(D.main,!0).attr("transform",h||g?null:a.getTranslate("main"));if(c.main=m,o.subchart_show&&a.initSubchart(),o.tooltip_show&&a.initTooltip(),o.title_text&&a.initTitle(),!g&&o.legend_show&&a.initLegend(),o.data_empty_label_text&&m.append("text").attr("class",`${lt.text} ${D.empty}`).attr("text-anchor","middle").attr("dominant-baseline","middle"),d&&(o.regions.length&&a.initRegion(),!o.clipPath&&a.axis.init()),m.append("g").classed(D.chart,!0).attr("clip-path",d?l.clip.path:null),a.callPluginHook("$init"),a.initChartElements(),d&&(f&&((i=a.initEventRect)==null||i.call(a)),a.initGrid(),o.clipPath&&((n=a.axis)==null||n.init())),a.updateTargets(a.data.targets),a.updateDimension(),J(o.oninit,a.api),a.setBackground(),a.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),o.data_onmin||o.data_onmax){const y=a.getMinMaxData();J(o.data_onmin,a.api,y.min),J(o.data_onmax,a.api,y.max)}o.tooltip_show&&a.initShowTooltip(),l.rendered=!0}initChartElements(){const t=this,{hasAxis:s,hasRadar:i,hasTreemap:n}=t.state,a=[];if(s){const o=["bar","bubble","candlestick","line"];t.config.bar_front&&o.push(o.shift());for(const r of o){const l=xt(r);(r==="line"&&t.hasTypeOf(l)||t.hasType(r))&&a.push(l)}}else if(n)a.push("Treemap");else if(t.hasType("funnel"))a.push("Funnel");else{const o=t.hasType("polar"),r=t.hasType("gauge");i||a.push("Arc","Pie"),r?a.push("Gauge"):i?a.push("Radar"):o&&a.push("Polar")}for(const o of a)t[`init${o}`]();ot(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()}setChartElements(){const t=this,{$el:{chart:s,svg:i,defs:n,main:a,tooltip:o,legend:r,title:l,grid:c,needle:u,arcs:d,circle:h,bar:g,candlestick:f,line:p,area:_,text:x}}=t;t.api.$={chart:s,svg:i,defs:n,main:a,tooltip:o,legend:r,title:l,grid:c,arc:d,circles:h,bar:{bars:g},candlestick:f,line:{lines:p,areas:_},needle:u,text:{texts:x}}}setBackground(){const t=this,{config:{background:s},state:i,$el:{svg:n}}=t;if(ot(s)){const a=n.select("g").insert(s.imgUrl?"image":"rect",":first-child");s.imgUrl?a.attr("href",s.imgUrl):s.color&&a.style("fill",s.color).attr("clip-path",i.clip.path),a.attr("class",s.class||null).attr("width","100%").attr("height","100%")}}updateTargets(t){var s,i;const n=this,{hasAxis:a,hasFunnel:o,hasRadar:r,hasTreemap:l}=n.state,c=d=>n[`updateTargetsFor${d}`](t.filter(n[`is${d}Type`].bind(n)));if(n.updateTargetsForText(t),a){const d=["bar","candlestick","line"];for(const h of d){const g=xt(h);(h==="line"&&n.hasTypeOf(g)||n.hasType(h))&&c(g)}(s=n.updateTargetsForSubchart)==null||s.call(n,t)}else if(n.hasArcType(t)){let d="Arc";r?d="Radar":n.hasType("polar")&&(d="Polar"),c(d)}else o?c("Funnel"):l&&c("Treemap");const u=n.hasType("bubble")||n.hasType("scatter");u&&((i=n.updateTargetForCircle)==null||i.call(n)),n.filterTargetsToShowAtInit(u)}filterTargetsToShowAtInit(t=!1){const s=this,{$el:{svg:i},$T:n}=s;let a=`.${D.target}`;t&&(a+=`, .${pt.chartCircles} > .${pt.circles}`),n(i.selectAll(a).filter(o=>s.isTargetToShow(o.id))).style("opacity",null)}getWithOption(t){const s={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};for(const[i,n]of Object.entries(s)){const a=N(n)?s[n]:n;s[i]=zt(t,`with${i}`,a)}return s}initialOpacity(t){const s=this,{withoutFadeIn:i}=s.state;return s.getBaseValue(t)!==null&&i[t.id]?null:"0"}bindResize(){const t=this,{$el:s,config:i,state:n}=t,a=xa(i.resize_timer),{resize_auto:o}=i,r=[];r.push(()=>J(i.onresize,t.api)),/^(true|parent)$/.test(o)&&r.push(()=>{n.resizing=!0,i.legend_show&&(t.updateSizes(),t.updateLegend()),t.api.flush(!1)}),r.push(()=>{J(i.onresized,t.api),n.resizing=!1}),r.forEach(l=>a.add(l)),t.resizeFunction=a,o==="parent"?(t.resizeFunction.resizeObserver=new ResizeObserver(t.resizeFunction.bind(t))).observe(s.chart.node().parentNode):B.addEventListener("resize",t.resizeFunction)}callPluginHook(t,...s){this.config.plugins.forEach(i=>{t==="$beforeInit"&&(i.$$=this,this.api.plugins.push(i)),i[t](...s)})}}ut(Ht.prototype,[Ta,Aa,wa,Ra,Ca,Pa,Oa,Sa,Ia,za,Ma,Xa,Qa,Ba,Na,Ha,Ua,Za,qa,Ka]);function so(e){const t=this.config;let s,i,n;const a=()=>{const o=i.shift();if(o&&s&&bt(s)&&o in s)return s=s[o],a();if(!o)return s};Object.keys(t).forEach(o=>{s=e,i=o.split("_"),n=a(),H(n)&&(t[o]=n)}),this.api&&(this.state.orgConfig=e)}var io={resize(e){const t=this.internal,{config:s,state:i}=t;i.rendered&&(s.size_width=e?e.width:null,s.size_height=e?e.height:null,i.resizing=!0,this.flush(!1),t.resizeFunction())},flush(e){var t,s;const i=this.internal,{state:n,$el:{zoomResetBtn:a}}=i;n.rendered?(n.resizing?(t=i.brush)==null||t.updateResize():(s=i.axis)==null||s.setOrient(),a==null||a.style("display","none"),i.scale.zoom&&(n.current.zoomDomain=i.scale.zoom.domain()),i.scale.zoom=null,e?i.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):i.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1}),!n.resizing&&i.brush&&(i.brush.getSelection().call(i.brush.move),i.unselectRect()),n.current.zoomDomain&&(i.api.zoom(n.current.zoomDomain),n.current.zoomDomain=null)):i.initToRender(!0)},destroy(){var e;const t=this.internal,{$el:{chart:s,style:i,svg:n}}=t;if(ot(t)){t.callPluginHook("$willDestroy"),t.charts.splice(t.charts.indexOf(this),1),t.unbindAllEvents(),n.select("*").interrupt(),t.resizeFunction.clear(),(e=t.resizeFunction.resizeObserver)==null||e.disconnect(),B.removeEventListener("resize",t.resizeFunction),s.classed("bb",!1).style("position",null).selectChildren().remove(),i&&i.parentNode.removeChild(i),Object.keys(this).forEach(a=>{a==="internal"&&Object.keys(t).forEach(o=>{t[o]=null}),this[a]=null,delete this[a]});for(const a in this)this[a]=()=>{}}return null},config(e,t,s){const i=this.internal,{config:n,state:a}=i,o=e==null?void 0:e.replace(/\./g,"_");let r;return e&&o in n?H(t)?(n[o]=t,r=t,s&&this.flush()):r=n[o]:(arguments.length===0||vt(e))&&(r=a.orgConfig),r}},no={color(e){return this.internal.color(e)}};const js=function(e){const{targets:t}=this.internal.data;if(!nt(e)){const s=Y(e)?e:[e];return t.filter(i=>s.some(n=>n===i.id))}return t};ut(js,{shown:function(e){return this.internal.filterTargetsToShow(this.data(e))},values:function(e,t=!0){let s=null;if(e){const i=this.data(e);Y(i)&&(s=[],i.forEach(n=>{const a=n.values.map(o=>o.value);t?s=s.concat(a):s.push(a)}))}return s},names:function(e){return this.internal.updateDataAttributes("names",e)},colors:function(e){return this.internal.updateDataAttributes("colors",e)},axes:function(e){return this.internal.updateDataAttributes("axes",e)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});var ao={data:js};const oo=e=>{var t,s;return(s=(t=B).btoa)==null?void 0:s.call(t,encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(i,n)=>String.fromCharCode(+`0x${n}`)))};function ro(e,t,s){const{width:i,height:n}=t||s,a=new XMLSerializer,o=e.cloneNode(!0),r=qn(Yt(ct.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",R.namespaces.xhtml),o.style.margin="0",o.style.padding="0",t.preserveFontStyle&&o.querySelectorAll("text").forEach(h=>{h.innerHTML=""});const l=a.serializeToString(o),c=ct.createElement("style");c.appendChild(ct.createTextNode(r.join(`
|
|
24
25
|
`)));const u=a.serializeToString(c),d=`<svg xmlns="${R.namespaces.svg}" width="${i}" height="${n}"
|
|
25
26
|
viewBox="0 0 ${s.width} ${s.height}"
|
|
26
27
|
preserveAspectRatio="${(t==null?void 0:t.preserveAspectRatio)===!1?"none":"xMinYMid meet"}">
|
|
27
28
|
<foreignObject width="100%" height="100%">
|
|
28
29
|
${u}
|
|
29
30
|
${l.replace(/(url\()[^#]+/g,"$1")}
|
|
30
|
-
</foreignObject></svg>`;return`data:image/svg+xml;base64,${za(d)}`}function Ma(e,t){const{top:s,left:i}=t,{x:n,y:a}=Yt(e,!0),{a:o,b:r,c:l,d:c,e:u,f:d}=e.getScreenCTM(),{width:h,height:g}=ct(e,!0);return{x:o*n+l*a+u-i,y:r*n+c*a+d-s+(g-Math.round(g/4)),width:h,height:g}}function Xa(e){const{left:t,top:s}=ct(e),i=a=>a.textContent||a.childElementCount,n=[];return jt(e.querySelectorAll("text")).filter(i).forEach(a=>{const o=r=>{const{fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}=j.getComputedStyle(r),{x:g,y:f,width:p,height:_}=Ma(r,{left:t,top:s});return{[r.textContent]:{x:g,y:f,width:p,height:_,fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}}};if(a.childElementCount>1){const r=[];return jt(a.querySelectorAll("tspan")).filter(i).forEach(l=>{n.push(o(l))}),r}else n.push(o(a))}),n}function Ba(e,t){t.forEach(s=>{Object.keys(s).forEach(i=>{const{x:n,y:a,width:o,height:r,fill:l,fontFamily:c,fontSize:u,transform:d}=s[i];if(e.save(),e.font=`${u} ${c}`,e.fillStyle=l,d==="none")e.fillText(i,n,a);else{const h=d.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(g=>+g==0)?(h.push(n+o-o/4),h.push(a-r+r/3)):(h.push(n),h.push(a)),e.transform(...h),e.fillText(i,0,0)}e.restore()})})}var Na={export(e,t){const s=this.internal,{state:i,$el:{chart:n,svg:a}}=s,{width:o,height:r}=i.current,l=te(Object.create(null),{width:o,height:r,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e),c=Fa(n.node(),l,{width:o,height:r}),u=l.preserveFontStyle?Xa(a.node()):[];if(t&&k(t)){const d=new Image;d.crossOrigin="Anonymous",d.onload=()=>{const h=lt.createElement("canvas"),g=h.getContext("2d");h.width=l.width||o,h.height=l.height||r,g.drawImage(d,0,0),u.length&&(Ba(g,u),u.length=0),t.bind(this)(h.toDataURL(l.mimeType))},d.src=c}return c}},Ga={focus(e){const t=this.internal,{state:s}=t,i=t.mapToTargetIds(e),n=t.$el.svg.selectAll(t.selectorTargets(i.filter(t.isTargetToShow,t)));this.revert(),this.defocus(),n.classed(K.focused,!0).classed(K.defocused,!1),t.hasArcType()&&!s.hasRadar&&(t.expandArc(i),t.hasType("gauge")&&t.markOverlapped(e,t,`.${$t.gaugeValue}`)),t.toggleFocusLegend(i,!0),s.focusedTargetIds=i,s.defocusedTargetIds=s.defocusedTargetIds.filter(a=>i.indexOf(a)<0)},defocus(e){const t=this.internal,{state:s}=t,i=t.mapToTargetIds(e);t.$el.svg.selectAll(t.selectorTargets(i.filter(t.isTargetToShow,t))).classed(K.focused,!1).classed(K.defocused,!0),t.hasArcType(null,["polar"])&&(t.unexpandArc(i),t.hasType("gauge")&&t.undoMarkOverlapped(t,`.${$t.gaugeValue}`)),t.toggleFocusLegend(i,!1),s.focusedTargetIds=s.focusedTargetIds.filter(a=>i.indexOf(a)<0),s.defocusedTargetIds=i},revert(e){const t=this.internal,{config:s,state:i,$el:n}=t,a=t.mapToTargetIds(e);n.svg.selectAll(t.selectorTargets(a)).classed(K.focused,!1).classed(K.defocused,!1),t.hasArcType(null,["polar"])&&t.unexpandArc(a),s.legend_show&&(t.showLegend(a.filter(t.isLegendToShow.bind(t))),n.legend.selectAll(t.selectorLegends(a)).filter(function(){return(0,R.select)(this).classed(K.legendItemFocused)}).classed(K.legendItemFocused,!1)),i.focusedTargetIds=[],i.defocusedTargetIds=[]}},Va={legend:{show:function(e){const t=this.internal;t.showLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})},hide:function(e){const t=this.internal;t.hideLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})}}},Ya={load(e){const t=this.internal,{config:s}=t;e.xs&&t.addXs(e.xs),"names"in e&&this.data.names(e.names),"classes"in e&&Object.keys(e.classes).forEach(i=>{s.data_classes[i]=e.classes[i]}),"categories"in e&&t.axis.isCategorized()&&(s.axis_x_categories=e.categories),"axes"in e&&Object.keys(e.axes).forEach(i=>{s.data_axes[i]=e.axes[i]}),"colors"in e&&Object.keys(e.colors).forEach(i=>{s.data_colors[i]=e.colors[i]}),"unload"in e&&e.unload!==!1?t.unload(t.mapToTargetIds(e.unload===!0?null:e.unload),()=>{ls(()=>t.loadFromArgs(e))}):t.loadFromArgs(e)},unload(e){const t=this.internal;let s=e||{};vt(s)&&this.tooltip.hide(),V(s)?s={ids:s}:B(s)&&(s={ids:[s]});const i=t.mapToTargetIds(s.ids);t.unload(i,()=>{t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.cache.remove(i),Ls.call(t,s.done,s.resizeAfter)})}};function Ms(e,t,s){const i=this.internal,n=i.mapToTargetIds(t),a=i.state.hiddenTargetIds.map(l=>n.indexOf(l)>-1&&l).filter(Boolean);i.state.toggling=!0,i[`${e?"remove":"add"}HiddenTargetIds`](n);const o=i.$el.svg.selectAll(i.selectorTargets(n)),r=e?null:"0";e&&a.length&&(o.style("display",null),J(i.config.data_onshown,this,a)),i.$T(o).style("opacity",r,"important").call(Ae,()=>{var l;!e&&a.length===0&&(o.style("display","none"),J((l=i.config)==null?void 0:l.data_onhidden,this,n)),o.style("opacity",r)}),s.withLegend&&i[`${e?"show":"hide"}Legend`](n),i.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),i.state.toggling=!1}var ja={show(e,t={}){Ms.call(this,!0,e,t)},hide(e,t={}){Ms.call(this,!1,e,t)},toggle(e,t={}){const s=this.internal,i={show:[],hide:[]};s.mapToTargetIds(e).forEach(n=>i[s.isTargetToShow(n)?"hide":"show"].push(n)),i.show.length&&this.show(i.show,t),i.hide.length&&setTimeout(()=>this.hide(i.hide,t),0)}},Ha={tooltip:{show:function(e){var t,s,i;const n=this.internal,{$el:a,config:o,state:{eventReceiver:r,hasFunnel:l,hasTreemap:c,inputType:u}}=n;let d,h;if(e.mouse&&(h=e.mouse),e.data){const{data:g}=e,f=(t=n.getYScaleById(g.id))==null?void 0:t(g.value);if((l||c)&&g.id){const p=n.selectorTarget(g.id,void 0,`.${it.shape}`);r.rect=a.main.select(p)}else n.isMultipleX()?h=[n.xx(g),f]:(o.tooltip_grouped||(h=[0,f]),d=(i=g.index)!=null?i:n.hasArcType()&&g.id?(s=n.getArcElementByIdOrIndex(g.id))==null?void 0:s.datum().index:n.getIndexByX(g.x))}else W(e.x)?d=n.getIndexByX(e.x):W(e.index)&&(d=e.index);(u==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(g=>{n.dispatchEvent(g,d,h)})},hide:function(){var e,t,s;const i=this.internal,{state:{inputType:n},$el:{tooltip:a}}=i,o=a==null?void 0:a.datum();if(o){const{index:r}=JSON.parse(o.current)[0];(n==="mouse"?["mouseout"]:["touchend"]).forEach(l=>{i.dispatchEvent(l,r)})}n==="touch"&&i.callOverOutForTouch(),i.hideTooltip(!0),(e=i.hideGridFocus)==null||e.call(i),(t=i.unexpandCircles)==null||t.call(i),(s=i.expandBarTypeShapes)==null||s.call(i,!1)}}},Wa=Object.defineProperty,Ua=(e,t,s)=>t in e?Wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Xs=(e,t,s)=>Ua(e,typeof t!="symbol"?t+"":t,s);class Bt{constructor(t){Xs(this,"plugins",[]),Xs(this,"internal");const s=new Ut(this);this.internal=s,(function i(n,a,o){Object.keys(n).forEach(r=>{const l=k(n[r]),c=a!==o,u=at(n[r]),d=u&&Object.keys(n[r]).length>0;l&&(!c&&d||c)?a[r]=n[r].bind(o):u&&!l?a[r]={}:a[r]=n[r],d&&i(n[r],a[r],o)})})(Bt.prototype,this,this),Pa.call(s,t),s.beforeInit(),s.init()}}dt(Bt.prototype,[Oa,Ia,Da,Na,Ga,Va,Ya,ja,Ha]);function Bs(e=!1,t,s,i){const n=this,{config:a,$el:{main:o}}=n,r=a.data_selection_grouped,l=a.data_selection_isselectable.bind(n.api);a.data_selection_enabled&&o.selectAll(`.${it.shapes}`).selectAll(`.${it.shape}`).each(function(c){const u=(0,R.select)(this),{id:d,index:h}=c.data?c.data:c,g=n.getToggle(this,c).bind(n),f=r||!t||t.indexOf(d)>=0,p=!s||s.indexOf(h)>=0,_=u.classed(Q.SELECTED);u.classed(kt.line)||u.classed($e.area)||(e?f&&p&&l(c)&&!_?g(!0,u.classed(Q.SELECTED,!0),c,h):W(i)&&i&&_&&g(!1,u.classed(Q.SELECTED,!1),c,h):f&&p&&l(c)&&_&&g(!1,u.classed(Q.SELECTED,!1),c,h))})}var Za={selected(e){const t=this.internal,s=[];return t.$el.main.selectAll(`.${it.shapes+t.getTargetSelectorSuffix(e)}`).selectAll(`.${it.shape}`).filter(function(){return(0,R.select)(this).classed(Q.SELECTED)}).each(i=>s.push(i)),s},select(e,t,s){const i=this.internal;Bs.bind(i)(!0,e,t,s)},unselect(e,t){const s=this.internal;Bs.bind(s)(!1,e,t)}};const Ns=function(e){var t;const s=this.internal,{axis:i,brush:n,config:a,scale:{x:o,subX:r},state:l}=s;let c;return a.subchart_show&&(c=e,Array.isArray(c)?(i.isTimeSeries()&&(c=c.map(d=>At.bind(s)(d))),s.withinRange(c,s.getZoomDomain("subX",!0),s.getZoomDomain("subX"))&&(l.domain=c,n.move(n.getSelection(),c.map(r)))):c=(t=l.domain)!=null?t:o.orgDomain()),c};dt(Ns,{show(){var e,t;const s=this.internal,{$el:{subchart:i},config:n}=s,a=n.subchart_show;if(!a){s.unbindZoomEvent(),n.subchart_show=!a,!i.main&&s.initSubchart();let o=i.main.selectAll(`.${D.target}`);s.data.targets.length!==o.size()&&(s.updateSizes(),s.updateTargetsForSubchart(s.data.targets),o=(e=i.main)==null?void 0:e.selectAll(`.${D.target}`)),o==null||o.style("opacity",null),(t=i.main)==null||t.style("display",null),this.resize()}},hide(){const e=this.internal,{$el:{subchart:{main:t}},config:s}=e;s.subchart_show&&(t==null?void 0:t.style("display"))!=="none"&&(s.subchart_show=!1,t.style("display","none"),this.resize())},toggle(){const e=this.internal,{config:t}=e;this.subchart[t.subchart_show?"hide":"show"]()},reset(){const e=this.internal,{brush:t}=e;t.clear(t.getSelection())}});var qa={subchart:Ns},Et=Z(10);const Gs=function(e){var t;const s=this.internal,{axis:i,config:n,org:a,scale:o,state:r}=s,l=i.isCategorized();let c;if(n.zoom_enabled)if(c=e,Array.isArray(c)){if(i.isTimeSeries()&&(c=c.map(d=>At.bind(s)(d))),s.withinRange(c,s.getZoomDomain("zoom",!0),s.getZoomDomain("zoom"))){if(r.domain=c,c=s.getZoomDomainValue(c),s.api.tooltip.hide(),n.subchart_show){const d=o.zoom||o.x;s.brush.getSelection().call(s.brush.move,c.map(d))}else{const d=l?o.x.orgScale():a.xScale||o.x;s.updateCurrentZoomTransform(d,c)}s.setZoomResetButton()}}else c=s.zoom.getDomain();return(t=r.domain)!=null?t:c};dt(Gs,{enable(e){const t=this.internal,{config:s}=t;/^(drag|wheel)$/.test(e)&&(s.zoom_type=e),s.zoom_enabled=!!e,t.zoom?e===!1&&t.bindZoomEvent(!1):(t.initZoom(),t.bindZoomEvent()),t.updateAndRedraw()},max(e){const t=this.internal,{config:s,org:{xDomain:i}}=t;return(e===0||e)&&(s.zoom_x_max=Rt("max",[i[1],e])),s.zoom_x_max},min(e){const t=this.internal,{config:s,org:{xDomain:i}}=t;return(e===0||e)&&(s.zoom_x_min=Rt("min",[i[0],e])),s.zoom_x_min},range(e){const t=this.zoom;if(N(e)){const{min:s,max:i}=e;W(s)&&t.min(s),W(i)&&t.max(i)}return{min:t.min(),max:t.max()}}});var Ka={zoom:Gs,unzoom(){const e=this.internal,{config:t,$el:{eventRect:s,zoomResetBtn:i},scale:{zoom:n},state:a}=e;n&&(t.subchart_show?e.brush.getSelection().call(e.brush.move,null):e.zoom.updateTransformScale(Et.zoomIdentity),e.updateZoom(!0),i==null||i.style("display","none"),(0,Et.zoomTransform)(s.node())!==Et.zoomIdentity&&e.zoom.transform(s,Et.zoomIdentity),a.domain=void 0)}},Ja={initBrush(){const e=this,{config:t,scale:s,$el:{subchart:i},state:n}=e,a=t.axis_rotated,o=t.subchart_size_height;let r,l,c;e.brush=(a?(0,ve.brushY)():(0,ve.brushX)()).handleSize(5),e.brush.on("start brush end",u=>{const{selection:d,sourceEvent:h,target:g,type:f}=u;f==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?d:null),/(start|brush)/.test(f)&&(f==="brush"&&h&&n.domain&&(l==null||l.forEach((p,_)=>{p!==d[_]&&(n.domain[_]=s.x.orgDomain()[_])})),e.redrawForBrush(f!=="start")),f==="end"&&(r=s.x.orgDomain()),g!=null&&g.handle&&(d===null?e.brush.handle.attr("display","none"):e.brush.handle.attr("display",null).attr("transform",(p,_)=>{const x=[d[_],o/2];return`translate(${a?x.reverse():x})`}))}),e.brush.updateResize=function(){c&&clearTimeout(c),c=setTimeout(()=>{const u=this.getSelection();r&&(0,ve.brushSelection)(u.node())&&this.move(u,r.map(s.subX.orgScale()))},0)},e.brush.update=function(){var u;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((u=i.main)==null||u.select(`.${G.brush}`).call(this)),this},e.brush.scale=function(u){const d=t.subchart_size_height;let h=e.axis.getExtent();!h&&u.range?h=[[0,0],[u.range()[1],d]]:V(h)&&(h=h.map((g,f)=>[g,f>0?d:f])),a&&h[1].reverse(),this.extent(h),this.update()},e.brush.getSelection=()=>i.main?i.main.select(`.${G.brush}`):(0,R.select)([])},initSubchart(){const e=this,{config:t,state:{clip:s,hasAxis:i},$el:{defs:n,svg:a,subchart:o,axis:r}}=e;if(!i)return;const l=t.subchart_show?null:"hidden",c=`${s.id}-subchart`,u=e.getClipPath(c);s.idSubchart=c,e.appendClip(n,c),e.initBrush(),o.main=a.append("g").classed(G.subchart,!0).attr("transform",e.getTranslate("context"));const{main:d}=o;d.style("visibility",l),d.append("g").attr("clip-path",u).attr("class",G.chart),["bar","line","bubble","candlestick","scatter"].forEach(g=>{const f=pt(/^(bubble|scatter)$/.test(g)?"circle":g);if(e.hasType(g)||e.hasTypeOf(f)){const p=d.select(`.${G.chart}`),_=G[`chart${f}s`];p.select(`.${_}`).empty()&&p.append("g").attr("class",_)}});const h=d.append("g").attr("clip-path",u).attr("class",G.brush).call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),r.subX=d.append("g").attr("class",G.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",t.axis_rotated?"":s.pathXAxis).style("visibility",t.subchart_axis_x_show?l:"hidden")},addBrushHandle(e){const t=this,{config:s}=t,i=s.axis_rotated,n=s.subchart_init_range,a="handle--custom",o=i?["M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z","M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"]:["M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z","M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"];t.brush.handle=e.selectAll(`.${a}`).data(i?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",a).attr("cursor",`${i?"ns":"ew"}-resize`).attr("d",r=>o[+/[se]/.test(r.type)]).attr("display",n?null:"none")},updateTargetsForSubchart(e){const t=this,{config:s,state:i,$el:{subchart:{main:n}}}=t;s.subchart_show&&(["bar","line","bubble","candlestick","scatter"].filter(a=>t.hasType(a)||t.hasTypeOf(pt(a))).forEach(a=>{const o=/^(bubble|scatter)$/.test(a),r=pt(o?"circle":a),l=t.getChartClass(r,!0),c=t.getClass(o?"circles":`${a}s`,!0),u=n.select(`.${G[`chart${`${r}s`}`]}`);if(o){const d=u.selectAll(`.${G.circles}`).data(e.filter(t[`is${pt(a)}Type`].bind(t))).attr("class",c);d.exit().remove(),d.enter().append("g").attr("class",c)}else{const d=u.selectAll(`.${G[`chart${r}`]}`).attr("class",l).data(e.filter(t[`is${r}Type`].bind(t))),h=d.enter().append("g").style("opacity","0").attr("class",l).append("g").attr("class",c);d.exit().remove(),a==="line"&&t.hasTypeOf("Area")&&h.append("g").attr("class",t.getClass("areas",!0))}}),n.selectAll(`.${G.brush} rect`).attr(s.axis_rotated?"width":"height",s.axis_rotated?i.width2:i.height2))},redrawSubchart(e,t,s){var i;const n=this,{config:a,$el:{subchart:{main:o}},state:r}=n,l=!!t;if(o.style("visibility",a.subchart_show?null:"hidden"),a.subchart_show&&(((i=r.event)==null?void 0:i.type)==="zoom"&&n.brush.update(),e)){const c=a.subchart_init_range;if(!_s(n)&&n.brush.update(),Object.keys(s.type).forEach(u=>{const d=pt(u),h=n[`generateDraw${d}`](s.indices[u],!0);n[`update${d}`](l,!0),n[`redraw${d}`](h,l,!0)}),n.hasType("bubble")||n.hasType("scatter")){const{cx:u}=s.pos,d=n.updateCircleY(!0);n.updateCircle(!0),n.redrawCircle(u,d,l,void 0,!0)}!r.rendered&&c&&(r.domain=c,n.brush.move(n.brush.getSelection(),c.map(n.scale.x)))}},redrawForBrush(e=!0){var t;const s=this,{config:{subchart_onbrush:i,zoom_rescale:n},scale:a,state:o}=s;s.redraw({withTransition:!1,withY:n,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e&&o.rendered&&i.bind(s.api)((t=o.domain)!=null?t:a.x.orgDomain())},transformContext(e,t){const s=this,{$el:{subchart:i},$T:n}=s,a=t!=null&&t.axisSubX?t.axisSubX:n(i.main.select(`.${G.axisX}`),e);i.main.attr("transform",s.getTranslate("context")),a.attr("transform",s.getTranslate("subX"))}},Qa={initZoom(){const e=this;e.scale.zoom=null,e.generateZoom(),e.config.zoom_type==="drag"&&e.initZoomBehaviour()},bindZoomEvent(e=!0){const t=this,{config:s}=t;s.zoom_enabled&&e?!s.subchart_show&&t.bindZoomOnEventRect():e===!1&&(t.api.unzoom(),t.unbindZoomEvent())},generateZoom(){const e=this,{config:t,org:s,scale:i}=e,n=(0,Et.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));n.orgScaleExtent=()=>{const a=t.zoom_extent||[1,10];return[a[0],Math.max(e.getMaxDataCount()/a[1],a[1])]},n.updateScaleExtent=function(){const a=Vt(e.scale.x.orgDomain())/Vt(e.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*a,o[1]*a]),this},n.updateTransformScale=(a,o)=>{var r;const l=t.axis_rotated;(r=s.xScale)==null||r.range(i.x.range());const c=a[l?"rescaleY":"rescaleX"](s.xScale||i.x);if(c.domain().some(h=>/(Invalid Date|NaN)/.test(h.toString())))return;const u=e.trimXDomain(c.domain()),d=t.zoom_rescale;if(c.domain(u,s.xDomain),o){const h=c(i.x.domain()[0]),g=l?a.x:h,f=l?h:a.y;e.$el.eventRect.property("__zoom",Et.zoomIdentity.translate(g,f).scale(a.k))}e.state.xTickOffset||(e.state.xTickOffset=e.axis.x.tickOffset()),i.zoom=e.getCustomizedXScale(c),e.axis.x.scale(i.zoom),d?(!s.xScale&&(s.xScale=i.x.copy()),i.x.domain(u)):s.xScale&&(i.x.domain(s.xScale.domain()),s.xScale=null)},n.getDomain=()=>{const a=i[i.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(a[1]-=2),a},e.zoom=n},onZoomStart(e){const t=this,{sourceEvent:s}=e;s&&(t.zoom.startEvent=s,t.state.zooming=!0,J(t.config.zoom_onzoomstart,t.api,e))},onZoom(e){var t;const s=this,{config:i,scale:n,state:a,org:o}=s,{sourceEvent:r}=e,l=(e==null?void 0:e.transform)===Et.zoomIdentity;if(!i.zoom_enabled||s.filterTargetsToShow(s.data.targets).length===0||!n.zoom&&(r==null?void 0:r.type.indexOf("touch"))>-1&&(r==null?void 0:r.touches.length)===1)return;e.sourceEvent&&(a.zooming=!0,a.domain=void 0);const c=(r==null?void 0:r.type)==="mousemove",u=(r==null?void 0:r.wheelDelta)<0,{transform:d}=e;!c&&u&&n.x.domain().every((g,f)=>g!==o.xDomain[f])&&n.x.domain(o.xDomain),s.zoom.updateTransformScale(d,i.zoom_type==="wheel"&&r);const h=i.transition_duration>0&&!i.subchart_show&&(a.dragging||l||!e.sourceEvent);s.redraw({withTransition:h,withY:i.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),s.state.cancelClick=c,!l&&J(i.zoom_onzoom,s.api,(t=s.state.domain)!=null?t:s.zoom.getDomain())},onZoomEnd(e){var t,s;const i=this,{config:n,state:a}=i;let{startEvent:o}=i.zoom,r=e==null?void 0:e.sourceEvent;const l=(e==null?void 0:e.transform)===Et.zoomIdentity;(o==null?void 0:o.type.indexOf("touch"))>-1&&(o=o.changedTouches[0],r=(t=r==null?void 0:r.changedTouches)==null?void 0:t[0]),!(n.zoom_type==="drag"&&r&&o.clientX===r.clientX&&o.clientY===r.clientY)&&(a.zooming=!1,i.redrawEventRect(),i.updateZoom(),!l&&(r||a.dragging)&&J(n.zoom_onzoomend,i.api,(s=i.state.domain)!=null?s:i.zoom.getDomain()))},updateZoom(e){const t=this,{subX:s,x:i,zoom:n}=t.scale;if(n){const a=n.domain(),o=s.domain(),r=.015,l=t.config.axis_x_inverted?(a[0]>=o[0]||a[0]+r>=o[0])&&(o[1]>=a[1]||o[1]>=a[1]+r):(a[0]<=o[0]||a[0]-r<=o[0])&&(o[1]<=a[1]||o[1]<=a[1]-r);(e||l)&&(t.axis.x.scale(s),i.domain(s.orgDomain()),t.scale.zoom=null)}},updateCurrentZoomTransform(e,t){const s=this,{$el:{eventRect:i},config:n}=s,a=n.axis_rotated,o=[-e(t[0]),0],r=Et.zoomIdentity.scale(e.range()[1]/(e(t[1])-e(t[0]))).translate(...a?o.reverse():o);i.call(s.zoom.transform,r)},bindZoomOnEventRect(){var e;const t=this,{config:s,$el:{eventRect:i,svg:n}}=t,a=s.zoom_type==="drag"?t.zoomBehaviour:t.zoom;j.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((e=j.navigator)==null?void 0:e.userAgent)&&n.on("wheel",()=>{}),i==null||i.call(a).on("dblclick.zoom",null)},initZoomBehaviour(){const e=this,{config:t,state:s}=e,i=t.axis_rotated;let n=0,a=0,o,r;const l={axis:i?"y":"x",attr:i?"height":"width",index:i?1:0};e.zoomBehaviour=(0,ks.drag)().clickDistance(4).on("start",function(c){r=e.scale.zoom?null:e.axis.getExtent(),s.event=c,e.setDragStatus(!0),e.unselectRect(),o||(o=e.$el.main.append("rect").attr("clip-path",s.clip.path).attr("class",De.zoomBrush).attr("width",i?s.width:0).attr("height",i?0:s.height)),n=Tt(c,this)[l.index],r&&(n<r[0]?n=r[0]:n>r[1]&&(n=r[1])),a=n,o.attr(l.axis,n).attr(l.attr,0),e.onZoomStart(c)}).on("drag",function(c){a=Tt(c,this)[l.index],r&&(a>r[1]?a=r[1]:a<r[0]&&(a=r[0])),o.attr(l.axis,Math.min(n,a)).attr(l.attr,Math.abs(a-n))}).on("end",c=>{const u=e.scale.zoom||e.scale.x;s.event=c,o.attr(l.axis,0).attr(l.attr,0),n>a&&([n,a]=[a,n]),n<0&&(a+=Math.abs(n),n=0),n!==a&&e.api.zoom([n,a].map(d=>u.invert(d))),e.setDragStatus(!1)})},setZoomResetButton(){const e=this,{config:t,$el:s}=e,i=t.zoom_resetButton;i&&t.zoom_type==="drag"&&(s.zoomResetBtn?s.zoomResetBtn.style("display",null):s.zoomResetBtn=e.$el.chart.append("div").classed(D.button,!0).append("span").on("click",function(){k(i.onclick)&&i.onclick.bind(e.api)(this),e.api.unzoom()}).classed(De.buttonZoomReset,!0).text(i.text||"Reset Zoom"))},getZoomTransform(){const e=this,{$el:{eventRect:t}}=e;return t!=null&&t.node()?(0,Et.zoomTransform)(t.node()):{k:1}}},to={drag(e){const t=this,{config:s,state:i,$el:{main:n}}=t,a=s.data_selection_grouped,o=s.interaction_enabled&&s.data_selection_isselectable;if(t.hasArcType()||!s.data_selection_enabled||s.zoom_enabled&&!t.zoom.altDomain||!s.data_selection_multiple)return;const[r,l]=i.dragStart||[0,0],[c,u]=e,d=Math.min(r,c),h=Math.max(r,c),g=a?i.margin.top:Math.min(l,u),f=a?i.height:Math.max(l,u);n.select(`.${Gt.dragarea}`).attr("x",d).attr("y",g).attr("width",h-d).attr("height",f-g),n.selectAll(`.${it.shapes}`).selectAll(`.${it.shape}`).filter(p=>o==null?void 0:o.bind(t.api)(p)).each(function(p,_){const x=(0,R.select)(this),m=x.classed(Q.SELECTED),y=x.classed(Gt.INCLUDED);let $=!1,v;if(x.classed(ft.circle)){const b=+x.attr("cx")*1,T=+x.attr("cy")*1;v=t.togglePoint,$=d<b&&b<h&&g<T&&T<f}else if(x.classed(yt.bar)){const{x:b,y:T,width:C,height:w}=fs(this);v=t.togglePath,$=!(h<b||b+C<d)&&!(f<T||T+w<g)}else return;$^y&&(x.classed(Gt.INCLUDED,!y),x.classed(Q.SELECTED,!m),v.call(t,!m,x,p,_))})},dragstart(e){const t=this,{config:s,state:i,$el:{main:n}}=t;t.hasArcType()||!s.data_selection_enabled||(i.dragStart=e,n.select(`.${D.chart}`).append("rect").attr("class",Gt.dragarea).style("opacity","0.1"),t.setDragStatus(!0))},dragend(){const e=this,{config:t,$el:{main:s},$T:i}=e;e.hasArcType()||!t.data_selection_enabled||(i(s.select(`.${Gt.dragarea}`)).style("opacity","0").remove(),s.selectAll(`.${it.shape}`).classed(Gt.INCLUDED,!1),e.setDragStatus(!1))}},eo=Object.defineProperty,so=Object.defineProperties,io=Object.getOwnPropertyDescriptors,Vs=Object.getOwnPropertySymbols,no=Object.prototype.hasOwnProperty,ao=Object.prototype.propertyIsEnumerable,Ys=(e,t,s)=>t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,oo=(e,t)=>{for(var s in t||(t={}))no.call(t,s)&&Ys(e,s,t[s]);if(Vs)for(var s of Vs(t))ao.call(t,s)&&Ys(e,s,t[s]);return e},ro=(e,t)=>so(e,io(t)),lo=ro(oo({},to),{selectPoint(e,t,s){const i=this,{config:n,$el:{main:a},$T:o}=i,r=n.axis_rotated,l=(r?i.circleY:i.circleX).bind(i),c=(r?i.circleX:i.circleY).bind(i),u=i.pointSelectR.bind(i);J(n.data_onselected,i.api,t,e.node()),o(a.select(`.${Q.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${Q.selectedCircle}-${s}`).data([t]).enter().append("circle").attr("class",()=>i.generateClass(Q.selectedCircle,s)).attr("cx",l).attr("cy",c).attr("stroke",i.color).attr("r",d=>i.pointSelectR(d)*1.4)).attr("r",u)},unselectPoint(e,t,s){const i=this,{config:n,$el:{main:a},$T:o}=i;J(n.data_onunselected,i.api,t,e==null?void 0:e.node()),o(a.select(`.${Q.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${Q.selectedCircle}-${s}`)).attr("r",0).remove()},togglePoint(e,t,s,i){this[`${e?"":"un"}selectPoint`](t,s,i)},selectPath(e,t){const s=this,{config:i}=s;J(i.data_onselected,s.api,t,e.node()),i.interaction_brighten&&e.style("filter","brightness(1.25)")},unselectPath(e,t){const s=this,{config:i}=s;J(i.data_onunselected,s.api,t,e.node()),i.interaction_brighten&&e.style("filter",null)},togglePath(e,t,s,i){this[`${e?"":"un"}selectPath`](t,s,i)},getToggle(e,t){const s=this;return e.nodeName==="path"?s.togglePath:s.isStepType(t)?()=>{}:s.togglePoint},toggleShape(e,t,s){var i;const n=this,{config:a,$el:{main:o}}=n;if(a.data_selection_enabled&&a.data_selection_isselectable.bind(n.api)(t)){const r=(0,R.select)(e),l=r.classed(Q.SELECTED),c=n.getToggle(e,t).bind(n);let u;if(!a.data_selection_multiple){const d=(i=n.isPointFocusOnly)==null?void 0:i.call(n);let h=`.${d?Q.selectedCircles:it.shapes}`;a.data_selection_grouped&&(h+=n.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(d?`.${Q.selectedCircle}`:`.${it.shape}.${Q.SELECTED}`).classed(Q.SELECTED,!1).each(function(g){const f=(0,R.select)(this);u=f,c(!1,f,g,g.index)})}(!u||u.node()!==r.node())&&(r.classed(Q.SELECTED,!l),c(!l,r,t,s))}}}),co={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:()=>!0,data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:()=>{},data_onunselected:()=>{}},uo={subchart_show:!1,subchart_showHandle:!1,subchart_size_height:60,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:()=>{}},ho={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0};let js=()=>(dt(Ut.prototype,lo),dt(Bt.prototype,Za),Ht.setOptions([co]),(js=()=>!0)()),Hs=()=>(dt(Ut.prototype,Ja),dt(Bt.prototype,qa),Ht.setOptions([uo]),(Hs=()=>!0)()),Ws=()=>(dt(Ut.prototype,Qa),dt(Bt.prototype,Ka),Ht.setOptions([ho]),(Ws=()=>!0)());function Us(e,t,s){const{config:i}=e,n=(a,o)=>{const r=I(o)?o:o===!1?void 0:null;r!==null&&(i[`axis_${a}_${t}`]=r)};W(s)&&(bt(s)?Object.keys(s).forEach(a=>{n(a,s[a])}):(I(s)||s===!1)&&["y","y2"].forEach(a=>{n(a,s)}),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function Zs(e,t){const{config:s}=e;return{x:s[`axis_x_${t}`],y:s[`axis_y_${t}`],y2:s[`axis_y2_${t}`]}}var go={axis:{labels:function(e){const t=this.internal;let s;return e&&(Object.keys(e).forEach(i=>{t.axis.setLabelText(i,e[i])}),t.axis.updateLabels()),["x","y","y2"].forEach(i=>{const n=t.axis.getLabelText(i);n&&(!s&&(s={}),s[i]=n)}),s},min:function(e){const t=this.internal;return M(e)||e===!1?Us(t,"min",e):Zs(t,"min")},max:function(e){const t=this.internal;return M(e)||e===!1?Us(t,"max",e):Zs(t,"max")},range:function(e){const{axis:t}=this;if(arguments.length){const{min:s,max:i}=e;W(i)&&t.max(i),W(s)&&t.min(s)}else return{max:t.max(),min:t.min()}}}},fo={category(e,t){const s=this.internal,{config:i}=s;return arguments.length>1&&(i.axis_x_categories[e]=t,s.redraw()),i.axis_x_categories[e]},categories(e){const t=this.internal,{config:s}=t;if(!e||!Array.isArray(e)){const i=s.axis_x_categories;return vt(i)?Object.values(t.data.xs)[0]:i}return s.axis_x_categories=e,t.redraw(),s.axis_x_categories}},po={flow(e){const t=this.internal;let s;(e.json||e.rows||e.columns)&&t.convertData(e,n=>{s=n,i()});function i(){let n,a=0,o=0,r,l;if(t.state.redrawing||!s||!fe())return;const c=[],u=t.getMaxDataCount(),d=t.convertDataToTargets(s,!0),h=t.axis.isTimeSeries();t.data.targets.forEach(p=>{let _=!1;for(let x=0;x<d.length;x++)if(p.id===d[x].id){_=!0,p.values[p.values.length-1]&&(o=p.values[p.values.length-1].index+1),a=d[x].values.length;for(let m=0;m<a;m++)d[x].values[m].index=o+m,h||(d[x].values[m].x=o+m);p.values=p.values.concat(d[x].values),d.splice(x,1);break}!_&&c.push(p.id)}),t.data.targets.forEach(p=>{for(let _=0;_<c.length;_++)if(p.id===c[_]){o=p.values[p.values.length-1].index+1;for(let x=0;x<a;x++)p.values.push({id:p.id,index:o+x,x:h?t.getOtherTargetX(o+x):o+x,value:null})}}),t.data.targets.length&&d.forEach(p=>{const _=[];for(let x=t.data.targets[0].values[0].index;x<o;x++)_.push({id:p.id,index:x,x:h?t.getOtherTargetX(x):x,value:null});p.values.forEach(x=>{x.index+=o,h||(x.x+=o)}),p.values=_.concat(p.values)}),t.data.targets=t.data.targets.concat(d);const g=t.data.targets[0],f=g.values[0];W(e.to)?(a=0,l=h?At.call(t,e.to):e.to,g.values.forEach(p=>{p.x<l&&a++})):W(e.length)&&(a=e.length),u?u===1&&h&&(r=(g.values[g.values.length-1].x-f.x)/2,n=[new Date(+f.x-r),new Date(+f.x+r)]):(h?r=g.values.length>1?g.values[g.values.length-1].x-f.x:f.x-t.getXDomain(t.data.targets)[0]:r=1,n=[f.x-r,f.x]),n&&t.updateXDomain(null,!0,!0,!1,n),t.updateTargets(t.data.targets),t.redraw({flow:{index:f.index,length:a,duration:M(e.duration)?e.duration:t.config.transition_duration,done:e.done,orgDataCount:u},withLegend:!0,withTransition:u>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}};function Ze(e,t){const s=this.internal,{config:i}=s,n=i.transition_duration&&fe(),a=`grid_${t}_lines`;return e&&(i[a]=e,s.updateGrid(),s.redrawGrid(n)),i[a]}function qs(e,t){const s=`grid_${t}_lines`;return Ze.bind(this)(this.internal.config[s].concat(e||[]),t)}function Ks(e,t){this.internal.removeGridLines(e,t)}const Js=function(e){return Ze.bind(this)(e,"x")};dt(Js,{add(e){return qs.bind(this)(e,"x")},remove(e){return Ks.bind(this)(e,!0)}});const Qs=function(e){return Ze.bind(this)(e,"y")};dt(Qs,{add(e){return qs.bind(this)(e,"y")},remove(e){return Ks.bind(this)(e,!1)}});var xo={xgrids:Js,ygrids:Qs},_o={groups(e){const t=this.internal,{config:s}=t;return nt(e)||(s.data_groups=e,t.redraw()),s.data_groups}};function ti(e,t=!1){const s=this.internal,{config:i}=s,n=i.transition_duration&&fe();return e?(i.regions=t?i.regions.concat(e):e,s.updateRegion(),s.redrawRegion(n),t?i.regions:e):i.regions}const ei=function(e){return ti.bind(this)(e)};dt(ei,{add:function(e){return ti.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:s,$T:i}=t,n=e||{},a=Ft(n,"classes",[he.region]);let o=t.$el.main.select(`.${he.regions}`).selectAll(a.map(r=>`.${r}`));return i(o).style("opacity","0").remove(),o=s.regions,Object.keys(n).length?(o=o.filter(r=>{let l=!1;return r.class?(r.class.split(" ").forEach(c=>{a.indexOf(c)>=0&&(l=!0)}),!l):!0}),s.regions=o):s.regions=[],o}});var mo={regions:ei},yo={x(e){const t=this.internal,{axis:s,data:i}=t,n=s.isCustomX()&&s.isCategorized();return V(e)&&(n?this.categories(e):(t.updateTargetX(i.targets,e),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),n?this.categories():i.xs},xs(e){const t=this.internal;return N(e)&&(t.updateTargetXs(t.data.targets,e),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},se=Z(11),$o=Object.defineProperty,bo=(e,t,s)=>t in e?$o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ee=(e,t,s)=>bo(e,typeof t!="symbol"?t+"":t,s);class vo{constructor(t){Ee(this,"owner"),Ee(this,"config"),Ee(this,"scale"),Ee(this,"charSize",{});const s=Wt(),{config:i,params:n}=t;this.owner=t,this.config=i,this.scale=s,(i.noTransition||!n.config.transition_duration)&&(i.withoutTransition=!0),i.range=this.scaleExtent((n.orgXScale||s).range())}getSizeFor1Char(t,s,i=!0){const n={w:5.5,h:11.5};return this.charSize[t]&&i?this.charSize[t]:(!s.empty()&&s.text("0").call(a=>{try{const{width:o,height:r}=Yt(a.node(),!0);o&&r&&(n.w=o,n.h=r)}finally{a.text("")}}),this.charSize[t]=n,n)}getTickTransformSetter(t){const{config:s}=this,i=t==="x"?n=>`translate(${n+s.tickOffset},0)`:n=>`translate(0,${n})`;return(n,a)=>{n.attr("transform",o=>{const r=a(o);return M(o)?i(r):null})}}scaleExtent(t){const s=t[0],i=t[t.length-1];return s<i?[s,i]:[i,s]}generateTicks(t,s){const{tickStepSize:i}=this.owner.params,[n,a]=t.domain();let o=[];if(s&&i){let r=Math.round(n);for(;r<=a;)o.push(r),r+=i}else if(t.ticks){const{tickArguments:r}=this.config;if(t.type==="log"&&!r){const l=Wt("_log").domain([n>0?n:1,a]).range(t.range());o=l.ticks();for(let c=a.toFixed().length;o.length>15;c--)o=l.ticks(c);o.splice(0,1,n),o.splice(o.length-1,1,a)}else o=t.ticks(...this.config.tickArguments||[]);o=o.map(l=>B(l)&&I(l)&&!isNaN(l)&&Math.round(l*10)/10||l)}return o}copyScale(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t}textFormatted(t){const s=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+String(t).replace(/0+\d$/,""):t,n=s?s(i):i;return W(n)?n:""}transitionise(t){const{config:s}=this;let i=t;if(s.withoutTransition)i=t.interrupt();else if(s.transition||!this.owner.params.noTransition)try{i=t.transition(s.transition)}catch(n){}return i}}var To=Object.defineProperty,Ao=(e,t,s)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,pe=(e,t,s)=>Ao(e,typeof t!="symbol"?t+"":t,s);class wo{constructor(t={}){pe(this,"helper"),pe(this,"config"),pe(this,"params"),pe(this,"g"),pe(this,"generatedTicks");const s={innerTickSize:6,outerTickSize:t.outerTick?6:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:9,tickOffset:0,tickPadding:3,tickValues:null,transition:null,noTransition:t.noTransition};s.tickLength=Math.max(s.innerTickSize,0)+s.tickPadding,this.config=s,this.params=t,this.helper=new vo(this)}create(t){const s=this,{config:i,helper:n,params:a}=s,{scale:o}=n,{orient:r}=i,l=this.splitTickText.bind(s),c=/^(left|right)$/.test(r),u=/^(top|bottom)$/.test(r),d=n.getTickTransformSetter(u?"x":"y"),h=d===n.axisX?"y":"x",g=/^(top|left)$/.test(r)?-1:1,f=a.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():n.scaleExtent((a.orgXScale||o).range());const{innerTickSize:p,tickLength:_,range:x}=i,m=a.id,y=m&&/^(x|y|y2)$/.test(m)?a.config[`axis_${m}_tick_text_position`]:{x:0,y:0},$=m==="subX"?"subchart_axis_x":`axis_${m}`,v=a.config[`${$}_show`],b={tick:v?a.config[`${$}_tick_show`]:!1,text:v?a.config[`${$}_tick_text_show`]:!1},T=a.config.axis_evalTextSize;let C;t.each(function(){const w=(0,R.select)(this);let S=this.__chart__||o,A=n.copyScale();C=w,this.__chart__=A,i.tickOffset=a.isCategory?(A(1)-A(0))/2:0;const O=w.selectAll(".domain").data([0]);if(O.enter().append("path").attr("class","domain").merge(O).attr("d",()=>{const E=i.outerTickSize*g;return u?`M${x[0]},${E}V0H${x[1]}V${E}`:`M${E},${x[0]}H0V${x[1]}H${E}`}),b.tick||b.text){const E=i.tickValues||n.generateTicks(A,c||a.config.axis_rotated);s.generatedTicks=E;let P=w.selectAll(".tick").data(E,A);const F=P.enter().insert("g",".domain").attr("class","tick"),U=P.exit().remove();P=F.merge(P),b.tick&&F.append("line"),b.text&&F.append("text");const Y=P.select("text"),ut=[];let et={w:0,h:0};k(T)&&(et=T.bind(s.params.owner.api)(Y.node(),m),this.classList.contains(D.dummy)&&(this.sizeFor1Char=et)),(!et||et.w===0||et.h===0)&&(et=s.helper.getSizeFor1Char(r,Y,!!T));let wt=Y.selectAll("tspan").data((ht,Nt)=>{const qt=a.tickMultiline?l(ht,A,E,c,et.w):V(n.textFormatted(ht))?n.textFormatted(ht).concat():[n.textFormatted(ht)];return ut[Nt]=qt.length,qt.map(Kt=>({index:Nt,splitted:Kt}))});wt.exit().remove(),wt=wt.enter().append("tspan").merge(wt).text(ht=>ht.splitted),wt.attr("x",u?0:_*g).attr("dx",(()=>{let ht=0;return/(top|bottom)/.test(r)&&f&&(ht=8*Math.sin(Math.PI*(f/180))*(r==="top"?-1:1)),ht+(y.x||0)})()).attr("dy",(ht,Nt)=>{const qt=".71em";let Kt=0;return r!=="top"&&(Kt=et.h,Nt===0&&(Kt=c?-((ut[ht.index]-1)*(et.h/2)-3):y.y===0?qt:0)),I(Kt)&&y.y?Kt+y.y:Kt||qt});const de=P.select("line"),xe=P.select("text");if(F.select("line").attr(`${h}2`,p*g),F.select("text").attr(h,_*g),s.setTickLineTextPosition(de,xe,et),a.tickTitle){const ht=xe.select("title");(ht.empty()?xe.append("title"):ht).text(Nt=>a.tickTitle[Nt])}if(A.bandwidth){const ht=A,Nt=ht.bandwidth()/2;S=qt=>ht(qt)+Nt,A=S}else S.bandwidth?S=A:d(U,A);P=a.owner.state.flowing?n.transitionise(P):a.owner.$T(P),d(F,S),d(P.style("opacity",null),A)}}),this.g=C}getGeneratedTicks(t){var s;const i=((s=this.generatedTicks)==null?void 0:s.length)-1;let n=this.generatedTicks;if(i>t){const a=Math.round(i/t+.1);n=this.generatedTicks.map((o,r)=>r%a===0?o:null).filter(o=>o!==null).splice(0,t)}return n}getTickXY(){const{config:t}=this,s={x:0,y:0};return this.params.isCategory&&(s.x=t.tickCentered?0:t.tickOffset,s.y=t.tickCentered?t.tickOffset:0),s}getTickSize(t){const{scale:s}=this.helper,{config:i}=this,{innerTickSize:n,range:a}=i,o=s(t)+(i.tickCentered?0:i.tickOffset);return a[0]<o&&o<a[1]?n:0}setTickLineTextPosition(t,s,i){const n=this.getTickXY(),{innerTickSize:a,orient:o,tickLength:r,tickOffset:l}=this.config,c=this.params.id,u=this.params.tickTextRotate,d=6,h=i.h/2-d,g=y=>{const $=["start","end"];return o==="top"&&$.reverse(),y?$[y>0?0:1]:"middle"},f=y=>y?`rotate(${y})`:null,p=y=>{const $=y/(o==="bottom"?15:23);return y?11.5-2.5*$*(y>0?1:-1):r},{config:{axis_rotated:_,axis_x_tick_text_inner:x}}=this.params.owner,m=this.params.config[`axis_${c}_tick_inner`];switch(o){case"bottom":t.attr("x1",n.x).attr("x2",n.x).attr("y2",y=>this.getTickSize.bind(this)(y)*(m?-1:1)),s.attr("x",0).attr("y",p(u)).style("text-anchor",g(u)).style("text-anchor",(y,$,{length:v})=>!_&&$===0&&(x===!0||x.first)?"start":!_&&$===v-1&&(x===!0||x.last)?"end":g(u)).attr("transform",f(u));break;case"top":t.attr("x2",0).attr("y2",m?a:-a),s.attr("x",0).attr("y",-(p(u)+h+d)).style("text-anchor",g(u)).attr("transform",f(u));break;case"left":t.attr("x2",m?a:-a).attr("y1",n.y).attr("y2",n.y),s.attr("x",-r).attr("y",l+(_?h/4:h)).style("text-anchor","end");break;case"right":t.attr("x2",m?-a:a).attr("y2",0),s.attr("x",r).attr("y",h).style("text-anchor","start")}}splitTickText(t,s,i,n,a){const{params:o}=this,r=this.helper.textFormatted(t),l=B(r)&&r.indexOf(`
|
|
31
|
+
</foreignObject></svg>`;return`data:image/svg+xml;base64,${oo(d)}`}function lo(e,t){const{top:s,left:i}=t,{x:n,y:a}=Ft(e,!0),{a:o,b:r,c:l,d:c,e:u,f:d}=e.getScreenCTM(),{width:h,height:g}=dt(e,!0);return{x:o*n+l*a+u-i,y:r*n+c*a+d-s+(g-Math.round(g/4)),width:h,height:g}}function co(e){const{left:t,top:s}=dt(e),i=a=>a.textContent||a.childElementCount,n=[];return Yt(e.querySelectorAll("text")).filter(i).forEach(a=>{const o=r=>{const{fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}=B.getComputedStyle(r),{x:g,y:f,width:p,height:_}=lo(r,{left:t,top:s});return{[r.textContent]:{x:g,y:f,width:p,height:_,fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}}};if(a.childElementCount>1){const r=[];return Yt(a.querySelectorAll("tspan")).filter(i).forEach(l=>{n.push(o(l))}),r}else n.push(o(a))}),n}function uo(e,t){t.forEach(s=>{Object.keys(s).forEach(i=>{const{x:n,y:a,width:o,height:r,fill:l,fontFamily:c,fontSize:u,transform:d}=s[i];if(e.save(),e.font=`${u} ${c}`,e.fillStyle=l,d==="none")e.fillText(i,n,a);else{const h=d.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(g=>+g==0)?(h.push(n+o-o/4),h.push(a-r+r/3)):(h.push(n),h.push(a)),e.transform(...h),e.fillText(i,0,0)}e.restore()})})}var ho={export(e,t){const s=this.internal,{state:i,$el:{chart:n,svg:a}}=s,{width:o,height:r}=i.current,l=te(Object.create(null),{width:o,height:r,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e),c=ro(n.node(),l,{width:o,height:r}),u=l.preserveFontStyle?co(a.node()):[];if(t&&k(t)){const d=new Image;d.crossOrigin="Anonymous",d.onload=()=>{const h=ct.createElement("canvas"),g=h.getContext("2d");h.width=l.width||o,h.height=l.height||r,g.drawImage(d,0,0),u.length&&(uo(g,u),u.length=0),t.bind(this)(h.toDataURL(l.mimeType))},d.src=c}return c}},go={focus(e){const t=this.internal,{state:s}=t,i=t.mapToTargetIds(e),n=t.$el.svg.selectAll(t.selectorTargets(i.filter(t.isTargetToShow,t)));this.revert(),this.defocus(),n.classed(K.focused,!0).classed(K.defocused,!1),t.hasArcType()&&!s.hasRadar&&(t.expandArc(i),t.hasType("gauge")&&t.markOverlapped(e,t,`.${$t.gaugeValue}`)),t.toggleFocusLegend(i,!0),s.focusedTargetIds=i,s.defocusedTargetIds=s.defocusedTargetIds.filter(a=>i.indexOf(a)<0)},defocus(e){const t=this.internal,{state:s}=t,i=t.mapToTargetIds(e);t.$el.svg.selectAll(t.selectorTargets(i.filter(t.isTargetToShow,t))).classed(K.focused,!1).classed(K.defocused,!0),t.hasArcType(null,["polar"])&&(t.unexpandArc(i),t.hasType("gauge")&&t.undoMarkOverlapped(t,`.${$t.gaugeValue}`)),t.toggleFocusLegend(i,!1),s.focusedTargetIds=s.focusedTargetIds.filter(a=>i.indexOf(a)<0),s.defocusedTargetIds=i},revert(e){const t=this.internal,{config:s,state:i,$el:n}=t,a=t.mapToTargetIds(e);n.svg.selectAll(t.selectorTargets(a)).classed(K.focused,!1).classed(K.defocused,!1),t.hasArcType(null,["polar"])&&t.unexpandArc(a),s.legend_show&&(t.showLegend(a.filter(t.isLegendToShow.bind(t))),n.legend.selectAll(t.selectorLegends(a)).filter(function(){return(0,R.select)(this).classed(K.legendItemFocused)}).classed(K.legendItemFocused,!1)),i.focusedTargetIds=[],i.defocusedTargetIds=[]}},fo={legend:{show:function(e){const t=this.internal;t.showLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})},hide:function(e){const t=this.internal;t.hideLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})}}},po={load(e){const t=this.internal,{config:s}=t;e.xs&&t.addXs(e.xs),"names"in e&&this.data.names(e.names),"classes"in e&&Object.keys(e.classes).forEach(i=>{s.data_classes[i]=e.classes[i]}),"categories"in e&&t.axis.isCategorized()&&(s.axis_x_categories=e.categories),"axes"in e&&Object.keys(e.axes).forEach(i=>{s.data_axes[i]=e.axes[i]}),"colors"in e&&Object.keys(e.colors).forEach(i=>{s.data_colors[i]=e.colors[i]}),"unload"in e&&e.unload!==!1?t.unload(t.mapToTargetIds(e.unload===!0?null:e.unload),()=>{cs(()=>t.loadFromArgs(e))}):t.loadFromArgs(e)},unload(e){const t=this.internal;let s=e||{};vt(s)&&this.tooltip.hide(),Y(s)?s={ids:s}:N(s)&&(s={ids:[s]});const i=t.mapToTargetIds(s.ids);t.unload(i,()=>{t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.cache.remove(i),Ms.call(t,s.done,s.resizeAfter)})}};function Ws(e,t,s){const i=this.internal,n=i.mapToTargetIds(t),a=i.state.hiddenTargetIds.map(l=>n.indexOf(l)>-1&&l).filter(Boolean);i.state.toggling=!0,i[`${e?"remove":"add"}HiddenTargetIds`](n);const o=i.$el.svg.selectAll(i.selectorTargets(n)),r=e?null:"0";e&&a.length&&(o.style("display",null),J(i.config.data_onshown,this,a)),i.$T(o).style("opacity",r,"important").call(Ae,()=>{var l;!e&&a.length===0&&(o.style("display","none"),J((l=i.config)==null?void 0:l.data_onhidden,this,n)),o.style("opacity",r)}),s.withLegend&&i[`${e?"show":"hide"}Legend`](n),i.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),i.state.toggling=!1}var xo={show(e,t={}){Ws.call(this,!0,e,t)},hide(e,t={}){Ws.call(this,!1,e,t)},toggle(e,t={}){const s=this.internal,i={show:[],hide:[]};s.mapToTargetIds(e).forEach(n=>i[s.isTargetToShow(n)?"hide":"show"].push(n)),i.show.length&&this.show(i.show,t),i.hide.length&&setTimeout(()=>this.hide(i.hide,t),0)}},_o={tooltip:{show:function(e){var t,s,i;const n=this.internal,{$el:a,config:o,state:{eventReceiver:r,hasFunnel:l,hasTreemap:c,inputType:u}}=n;let d,h;if(e.mouse&&(h=e.mouse),e.data){const{data:g}=e,f=(t=n.getYScaleById(g.id))==null?void 0:t(g.value);if((l||c)&&g.id){const p=n.selectorTarget(g.id,void 0,`.${it.shape}`);r.rect=a.main.select(p)}else n.isMultipleX()?h=[n.xx(g),f]:(o.tooltip_grouped||(h=[0,f]),d=(i=g.index)!=null?i:n.hasArcType()&&g.id?(s=n.getArcElementByIdOrIndex(g.id))==null?void 0:s.datum().index:n.getIndexByX(g.x))}else H(e.x)?d=n.getIndexByX(e.x):H(e.index)&&(d=e.index);(u==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(g=>{n.dispatchEvent(g,d,h)})},hide:function(){var e,t,s;const i=this.internal,{state:{inputType:n},$el:{tooltip:a}}=i,o=a==null?void 0:a.datum();if(o){const{index:r}=JSON.parse(o.current)[0];(n==="mouse"?["mouseout"]:["touchend"]).forEach(l=>{i.dispatchEvent(l,r)})}n==="touch"&&i.callOverOutForTouch(),i.hideTooltip(!0),(e=i.hideGridFocus)==null||e.call(i),(t=i.unexpandCircles)==null||t.call(i),(s=i.expandBarTypeShapes)==null||s.call(i,!1)}}},mo=Object.defineProperty,yo=(e,t,s)=>t in e?mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Hs=(e,t,s)=>yo(e,typeof t!="symbol"?t+"":t,s);class Bt{constructor(t){Hs(this,"plugins",[]),Hs(this,"internal");const s=new Ht(this);this.internal=s,(function i(n,a,o){Object.keys(n).forEach(r=>{const l=k(n[r]),c=a!==o,u=ot(n[r]),d=u&&Object.keys(n[r]).length>0;l&&(!c&&d||c)?a[r]=n[r].bind(o):u&&!l?a[r]={}:a[r]=n[r],d&&i(n[r],a[r],o)})})(Bt.prototype,this,this),so.call(s,t),s.beforeInit(),s.init()}}ut(Bt.prototype,[io,no,ao,ho,go,fo,po,xo,_o]);function Us(e=!1,t,s,i){const n=this,{config:a,$el:{main:o}}=n,r=a.data_selection_grouped,l=a.data_selection_isselectable.bind(n.api);a.data_selection_enabled&&o.selectAll(`.${it.shapes}`).selectAll(`.${it.shape}`).each(function(c){const u=(0,R.select)(this),{id:d,index:h}=c.data?c.data:c,g=n.getToggle(this,c).bind(n),f=r||!t||t.indexOf(d)>=0,p=!s||s.indexOf(h)>=0,_=u.classed(Q.SELECTED);u.classed(kt.line)||u.classed($e.area)||(e?f&&p&&l(c)&&!_?g(!0,u.classed(Q.SELECTED,!0),c,h):H(i)&&i&&_&&g(!1,u.classed(Q.SELECTED,!1),c,h):f&&p&&l(c)&&_&&g(!1,u.classed(Q.SELECTED,!1),c,h))})}var $o={selected(e){const t=this.internal,s=[];return t.$el.main.selectAll(`.${it.shapes+t.getTargetSelectorSuffix(e)}`).selectAll(`.${it.shape}`).filter(function(){return(0,R.select)(this).classed(Q.SELECTED)}).each(i=>s.push(i)),s},select(e,t,s){const i=this.internal;Us.bind(i)(!0,e,t,s)},unselect(e,t){const s=this.internal;Us.bind(s)(!1,e,t)}};const Zs=function(e){var t;const s=this.internal,{axis:i,brush:n,config:a,scale:{x:o,subX:r},state:l}=s;let c;return a.subchart_show&&(c=e,Array.isArray(c)?(i.isTimeSeries()&&(c=c.map(d=>At.bind(s)(d))),s.withinRange(c,s.getZoomDomain("subX",!0),s.getZoomDomain("subX"))&&(l.domain=c,n.move(n.getSelection(),c.map(r)))):c=(t=l.domain)!=null?t:o.orgDomain()),c};ut(Zs,{show(){var e,t;const s=this.internal,{$el:{subchart:i},config:n}=s,a=n.subchart_show;if(!a){s.unbindZoomEvent(),n.subchart_show=!a,!i.main&&s.initSubchart();let o=i.main.selectAll(`.${D.target}`);s.data.targets.length!==o.size()&&(s.updateSizes(),s.updateTargetsForSubchart(s.data.targets),o=(e=i.main)==null?void 0:e.selectAll(`.${D.target}`)),o==null||o.style("opacity",null),(t=i.main)==null||t.style("display",null),this.resize()}},hide(){const e=this.internal,{$el:{subchart:{main:t}},config:s}=e;s.subchart_show&&(t==null?void 0:t.style("display"))!=="none"&&(s.subchart_show=!1,t.style("display","none"),this.resize())},toggle(){const e=this.internal,{config:t}=e;this.subchart[t.subchart_show?"hide":"show"]()},reset(){const e=this.internal,{brush:t}=e;t.clear(t.getSelection())}});var bo={subchart:Zs},Et=Z(10);const qs=function(e){var t;const s=this.internal,{axis:i,config:n,org:a,scale:o,state:r}=s,l=i.isCategorized();let c;if(n.zoom_enabled)if(c=e,Array.isArray(c)){if(i.isTimeSeries()&&(c=c.map(d=>At.bind(s)(d))),s.withinRange(c,s.getZoomDomain("zoom",!0),s.getZoomDomain("zoom"))){if(r.domain=c,c=s.getZoomDomainValue(c),s.api.tooltip.hide(),n.subchart_show){const d=o.zoom||o.x;s.brush.getSelection().call(s.brush.move,c.map(d))}else{const d=l?o.x.orgScale():a.xScale||o.x;s.updateCurrentZoomTransform(d,c)}s.setZoomResetButton()}}else c=s.zoom.getDomain();return(t=r.domain)!=null?t:c};ut(qs,{enable(e){const t=this.internal,{config:s}=t;/^(drag|wheel)$/.test(e)&&(s.zoom_type=e),s.zoom_enabled=!!e,t.zoom?e===!1&&t.bindZoomEvent(!1):(t.initZoom(),t.bindZoomEvent()),t.updateAndRedraw()},max(e){const t=this.internal,{config:s,org:{xDomain:i}}=t;return(e===0||e)&&(s.zoom_x_max=Rt("max",[i[1],e])),s.zoom_x_max},min(e){const t=this.internal,{config:s,org:{xDomain:i}}=t;return(e===0||e)&&(s.zoom_x_min=Rt("min",[i[0],e])),s.zoom_x_min},range(e){const t=this.zoom;if(G(e)){const{min:s,max:i}=e;H(s)&&t.min(s),H(i)&&t.max(i)}return{min:t.min(),max:t.max()}}});var vo={zoom:qs,unzoom(){const e=this.internal,{config:t,$el:{eventRect:s,zoomResetBtn:i},scale:{zoom:n},state:a}=e;n&&(t.subchart_show?e.brush.getSelection().call(e.brush.move,null):e.zoom.updateTransformScale(Et.zoomIdentity),e.updateZoom(!0),i==null||i.style("display","none"),(0,Et.zoomTransform)(s.node())!==Et.zoomIdentity&&e.zoom.transform(s,Et.zoomIdentity),a.domain=void 0)}},To={initBrush(){const e=this,{config:t,scale:s,$el:{subchart:i},state:n}=e,a=t.axis_rotated,o=t.subchart_size_height;let r,l,c;e.brush=(a?(0,ve.brushY)():(0,ve.brushX)()).handleSize(5),e.brush.on("start brush end",u=>{const{selection:d,sourceEvent:h,target:g,type:f}=u;f==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?d:null),/(start|brush)/.test(f)&&(f==="brush"&&h&&n.domain&&(l==null||l.forEach((p,_)=>{p!==d[_]&&(n.domain[_]=s.x.orgDomain()[_])})),e.redrawForBrush(f!=="start")),f==="end"&&(r=s.x.orgDomain()),g!=null&&g.handle&&(d===null?e.brush.handle.attr("display","none"):e.brush.handle.attr("display",null).attr("transform",(p,_)=>{const x=[d[_],o/2];return`translate(${a?x.reverse():x})`}))}),e.brush.updateResize=function(){c&&clearTimeout(c),c=setTimeout(()=>{const u=this.getSelection();r&&(0,ve.brushSelection)(u.node())&&this.move(u,r.map(s.subX.orgScale()))},0)},e.brush.update=function(){var u;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((u=i.main)==null||u.select(`.${V.brush}`).call(this)),this},e.brush.scale=function(u){const d=t.subchart_size_height;let h=e.axis.getExtent();!h&&u.range?h=[[0,0],[u.range()[1],d]]:Y(h)&&(h=h.map((g,f)=>[g,f>0?d:f])),a&&h[1].reverse(),this.extent(h),this.update()},e.brush.getSelection=()=>i.main?i.main.select(`.${V.brush}`):(0,R.select)([])},initSubchart(){const e=this,{config:t,state:{clip:s,hasAxis:i},$el:{defs:n,svg:a,subchart:o,axis:r}}=e;if(!i)return;const l=t.subchart_show?null:"hidden",c=`${s.id}-subchart`,u=e.getClipPath(c);s.idSubchart=c,e.appendClip(n,c),e.initBrush(),o.main=a.append("g").classed(V.subchart,!0).attr("transform",e.getTranslate("context"));const{main:d}=o;d.style("visibility",l),d.append("g").attr("clip-path",u).attr("class",V.chart),["bar","line","bubble","candlestick","scatter"].forEach(g=>{const f=xt(/^(bubble|scatter)$/.test(g)?"circle":g);if(e.hasType(g)||e.hasTypeOf(f)){const p=d.select(`.${V.chart}`),_=V[`chart${f}s`];p.select(`.${_}`).empty()&&p.append("g").attr("class",_)}});const h=d.append("g").attr("clip-path",u).attr("class",V.brush).call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),r.subX=d.append("g").attr("class",V.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",t.axis_rotated?"":s.pathXAxis).style("visibility",t.subchart_axis_x_show?l:"hidden")},addBrushHandle(e){const t=this,{config:s}=t,i=s.axis_rotated,n=s.subchart_init_range,a="handle--custom",o=i?["M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z","M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"]:["M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z","M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"];t.brush.handle=e.selectAll(`.${a}`).data(i?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",a).attr("cursor",`${i?"ns":"ew"}-resize`).attr("d",r=>o[+/[se]/.test(r.type)]).attr("display",n?null:"none")},updateTargetsForSubchart(e){const t=this,{config:s,state:i,$el:{subchart:{main:n}}}=t;s.subchart_show&&(["bar","line","bubble","candlestick","scatter"].filter(a=>t.hasType(a)||t.hasTypeOf(xt(a))).forEach(a=>{const o=/^(bubble|scatter)$/.test(a),r=xt(o?"circle":a),l=t.getChartClass(r,!0),c=t.getClass(o?"circles":`${a}s`,!0),u=n.select(`.${V[`chart${`${r}s`}`]}`);if(o){const d=u.selectAll(`.${V.circles}`).data(e.filter(t[`is${xt(a)}Type`].bind(t))).attr("class",c);d.exit().remove(),d.enter().append("g").attr("class",c)}else{const d=u.selectAll(`.${V[`chart${r}`]}`).attr("class",l).data(e.filter(t[`is${r}Type`].bind(t))),h=d.enter().append("g").style("opacity","0").attr("class",l).append("g").attr("class",c);d.exit().remove(),a==="line"&&t.hasTypeOf("Area")&&h.append("g").attr("class",t.getClass("areas",!0))}}),n.selectAll(`.${V.brush} rect`).attr(s.axis_rotated?"width":"height",s.axis_rotated?i.width2:i.height2))},redrawSubchart(e,t,s){var i;const n=this,{config:a,$el:{subchart:{main:o}},state:r}=n,l=!!t;if(o.style("visibility",a.subchart_show?null:"hidden"),a.subchart_show&&(((i=r.event)==null?void 0:i.type)==="zoom"&&n.brush.update(),e)){const c=a.subchart_init_range;if(!vs(n)&&n.brush.update(),Object.keys(s.type).forEach(u=>{const d=xt(u),h=n[`generateDraw${d}`](s.indices[u],!0);n[`update${d}`](l,!0),n[`redraw${d}`](h,l,!0)}),n.hasType("bubble")||n.hasType("scatter")){const{cx:u}=s.pos,d=n.updateCircleY(!0);n.updateCircle(!0),n.redrawCircle(u,d,l,void 0,!0)}!r.rendered&&c&&(r.domain=c,n.brush.move(n.brush.getSelection(),c.map(n.scale.x)))}},redrawForBrush(e=!0){var t;const s=this,{config:{subchart_onbrush:i,zoom_rescale:n},scale:a,state:o}=s;s.redraw({withTransition:!1,withY:n,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e&&o.rendered&&i.bind(s.api)((t=o.domain)!=null?t:a.x.orgDomain())},transformContext(e,t){const s=this,{$el:{subchart:i},$T:n}=s,a=t!=null&&t.axisSubX?t.axisSubX:n(i.main.select(`.${V.axisX}`),e);i.main.attr("transform",s.getTranslate("context")),a.attr("transform",s.getTranslate("subX"))}},Ao={initZoom(){const e=this;e.scale.zoom=null,e.generateZoom(),e.config.zoom_type==="drag"&&e.initZoomBehaviour()},bindZoomEvent(e=!0){const t=this,{config:s}=t;s.zoom_enabled&&e?!s.subchart_show&&t.bindZoomOnEventRect():e===!1&&(t.api.unzoom(),t.unbindZoomEvent())},generateZoom(){const e=this,{config:t,org:s,scale:i}=e,n=(0,Et.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));n.orgScaleExtent=()=>{const a=t.zoom_extent||[1,10];return[a[0],Math.max(e.getMaxDataCount()/a[1],a[1])]},n.updateScaleExtent=function(){const a=Vt(e.scale.x.orgDomain())/Vt(e.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*a,o[1]*a]),this},n.updateTransformScale=(a,o)=>{var r;const l=t.axis_rotated;(r=s.xScale)==null||r.range(i.x.range());const c=a[l?"rescaleY":"rescaleX"](s.xScale||i.x);if(c.domain().some(h=>/(Invalid Date|NaN)/.test(h.toString())))return;const u=e.trimXDomain(c.domain()),d=t.zoom_rescale;if(c.domain(u,s.xDomain),o){const h=c(i.x.domain()[0]),g=l?a.x:h,f=l?h:a.y;e.$el.eventRect.property("__zoom",Et.zoomIdentity.translate(g,f).scale(a.k))}i.zoom=e.getCustomizedXScale(c),e.axis.x.scale(i.zoom),d?(!s.xScale&&(s.xScale=i.x.copy()),i.x.domain(u)):s.xScale&&(i.x.domain(s.xScale.domain()),s.xScale=null)},n.getDomain=()=>{const a=i[i.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(a[1]-=2),a},e.zoom=n},onZoomStart(e){const t=this,{sourceEvent:s}=e;s&&(t.zoom.startEvent=s,t.state.zooming=!0,J(t.config.zoom_onzoomstart,t.api,e))},onZoom(e){const t=this,{config:s,scale:i,state:n,org:a}=t,{sourceEvent:o}=e,r=(e==null?void 0:e.transform)===Et.zoomIdentity;if(!s.zoom_enabled||t.filterTargetsToShow(t.data.targets).length===0||!i.zoom&&(o==null?void 0:o.type.indexOf("touch"))>-1&&(o==null?void 0:o.touches.length)===1)return;e.sourceEvent&&(n.zooming=!0,n.domain=void 0);const l=(o==null?void 0:o.type)==="mousemove",c=(o==null?void 0:o.wheelDelta)<0,{transform:u}=e;!l&&c&&i.x.domain().every((f,p)=>f!==a.xDomain[p])&&i.x.domain(a.xDomain),t.zoom.updateTransformScale(u,s.zoom_type==="wheel"&&o);const d=s.transition_duration>0&&!s.subchart_show&&(n.dragging||r||!e.sourceEvent),h=o&&l&&s.zoom_type!=="wheel",g=()=>{var f;t.redraw({withTransition:d,withY:s.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.state.cancelClick=l,!r&&J(s.zoom_onzoom,t.api,(f=t.state.domain)!=null?f:t.zoom.getDomain())};h?Rs(t.state,g):g()},onZoomEnd(e){var t,s;const i=this,{config:n,state:a}=i;let{startEvent:o}=i.zoom,r=e==null?void 0:e.sourceEvent;const l=(e==null?void 0:e.transform)===Et.zoomIdentity;(o==null?void 0:o.type.indexOf("touch"))>-1&&(o=o.changedTouches[0],r=(t=r==null?void 0:r.changedTouches)==null?void 0:t[0]),!(n.zoom_type==="drag"&&r&&o.clientX===r.clientX&&o.clientY===r.clientY)&&(a.zooming=!1,i.redrawEventRect(),i.updateZoom(),!l&&(r||a.dragging)&&J(n.zoom_onzoomend,i.api,(s=i.state.domain)!=null?s:i.zoom.getDomain()))},updateZoom(e){const t=this,{subX:s,x:i,zoom:n}=t.scale;if(n){const a=n.domain(),o=s.domain(),r=.015,l=t.config.axis_x_inverted?(a[0]>=o[0]||a[0]+r>=o[0])&&(o[1]>=a[1]||o[1]>=a[1]+r):(a[0]<=o[0]||a[0]-r<=o[0])&&(o[1]<=a[1]||o[1]<=a[1]-r);(e||l)&&(t.axis.x.scale(s),i.domain(s.orgDomain()),t.scale.zoom=null)}},updateCurrentZoomTransform(e,t){const s=this,{$el:{eventRect:i},config:n}=s,a=n.axis_rotated,o=[-e(t[0]),0],r=Et.zoomIdentity.scale(e.range()[1]/(e(t[1])-e(t[0]))).translate(...a?o.reverse():o);i.call(s.zoom.transform,r)},bindZoomOnEventRect(){var e;const t=this,{config:s,$el:{eventRect:i,svg:n}}=t,a=s.zoom_type==="drag"?t.zoomBehaviour:t.zoom;B.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((e=B.navigator)==null?void 0:e.userAgent)&&n.on("wheel",()=>{}),i==null||i.call(a).on("dblclick.zoom",null)},initZoomBehaviour(){const e=this,{config:t,state:s}=e,i=t.axis_rotated;let n=0,a=0,o,r;const l={axis:i?"y":"x",attr:i?"height":"width",index:i?1:0};e.zoomBehaviour=(0,Xs.drag)().clickDistance(4).on("start",function(c){r=e.scale.zoom?null:e.axis.getExtent(),s.event=c,e.setDragStatus(!0),e.unselectRect(),o||(o=e.$el.main.append("rect").attr("clip-path",s.clip.path).attr("class",De.zoomBrush).attr("width",i?s.width:0).attr("height",i?0:s.height)),n=Tt(c,this)[l.index],r&&(n<r[0]?n=r[0]:n>r[1]&&(n=r[1])),a=n,o.attr(l.axis,n).attr(l.attr,0),e.onZoomStart(c)}).on("drag",function(c){a=Tt(c,this)[l.index],r&&(a>r[1]?a=r[1]:a<r[0]&&(a=r[0])),o.attr(l.axis,Math.min(n,a)).attr(l.attr,Math.abs(a-n))}).on("end",c=>{const u=e.scale.zoom||e.scale.x;s.event=c,o.attr(l.axis,0).attr(l.attr,0),n>a&&([n,a]=[a,n]),n<0&&(a+=Math.abs(n),n=0),n!==a&&e.api.zoom([n,a].map(d=>u.invert(d))),e.setDragStatus(!1)})},setZoomResetButton(){const e=this,{config:t,$el:s}=e,i=t.zoom_resetButton;i&&t.zoom_type==="drag"&&(s.zoomResetBtn?s.zoomResetBtn.style("display",null):s.zoomResetBtn=e.$el.chart.append("div").classed(D.button,!0).append("span").on("click",function(){k(i.onclick)&&i.onclick.bind(e.api)(this),e.api.unzoom()}).classed(De.buttonZoomReset,!0).text(i.text||"Reset Zoom"))},getZoomTransform(){const e=this,{$el:{eventRect:t}}=e;return t!=null&&t.node()?(0,Et.zoomTransform)(t.node()):{k:1}}},wo={drag(e){const t=this,{config:s,state:i,$el:{main:n}}=t,a=s.data_selection_grouped,o=s.interaction_enabled&&s.data_selection_isselectable;if(t.hasArcType()||!s.data_selection_enabled||s.zoom_enabled&&!t.zoom.altDomain||!s.data_selection_multiple)return;const[r,l]=i.dragStart||[0,0],[c,u]=e,d=Math.min(r,c),h=Math.max(r,c),g=a?i.margin.top:Math.min(l,u),f=a?i.height:Math.max(l,u),p=()=>{!t||!t.$el||!t.$el.main||(n.select(`.${Gt.dragarea}`).attr("x",d).attr("y",g).attr("width",h-d).attr("height",f-g),n.selectAll(`.${it.shapes}`).selectAll(`.${it.shape}`).filter(_=>o==null?void 0:o.bind(t.api)(_)).each(function(_,x){const m=(0,R.select)(this),y=m.classed(Q.SELECTED),$=m.classed(Gt.INCLUDED);let v=!1,b;if(m.classed(pt.circle)){const T=+m.attr("cx")*1,C=+m.attr("cy")*1;b=t.togglePoint,v=d<T&&T<h&&g<C&&C<f}else if(m.classed(yt.bar)){const{x:T,y:C,width:S,height:A}=$s(this);b=t.togglePath,v=!(h<T||T+S<d)&&!(f<C||C+A<g)}else return;v^$&&(m.classed(Gt.INCLUDED,!$),m.classed(Q.SELECTED,!y),b.call(t,!y,m,_,x))}))};Rs(t.state,p)},dragstart(e){const t=this,{config:s,state:i,$el:{main:n}}=t;t.hasArcType()||!s.data_selection_enabled||(i.dragStart=e,n.select(`.${D.chart}`).append("rect").attr("class",Gt.dragarea).style("opacity","0.1"),t.setDragStatus(!0))},dragend(){const e=this,{config:t,$el:{main:s},$T:i}=e;e.hasArcType()||!t.data_selection_enabled||(i(s.select(`.${Gt.dragarea}`)).style("opacity","0").remove(),s.selectAll(`.${it.shape}`).classed(Gt.INCLUDED,!1),e.setDragStatus(!1))}},So=Object.defineProperty,Ro=Object.defineProperties,Co=Object.getOwnPropertyDescriptors,Ks=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,Lo=Object.prototype.propertyIsEnumerable,Js=(e,t,s)=>t in e?So(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ko=(e,t)=>{for(var s in t||(t={}))Eo.call(t,s)&&Js(e,s,t[s]);if(Ks)for(var s of Ks(t))Lo.call(t,s)&&Js(e,s,t[s]);return e},Po=(e,t)=>Ro(e,Co(t)),Oo=Po(ko({},wo),{selectPoint(e,t,s){const i=this,{config:n,$el:{main:a},$T:o}=i,r=n.axis_rotated,l=(r?i.circleY:i.circleX).bind(i),c=(r?i.circleX:i.circleY).bind(i),u=i.pointSelectR.bind(i);J(n.data_onselected,i.api,t,e.node()),o(a.select(`.${Q.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${Q.selectedCircle}-${s}`).data([t]).enter().append("circle").attr("class",()=>i.generateClass(Q.selectedCircle,s)).attr("cx",l).attr("cy",c).attr("stroke",i.color).attr("r",d=>i.pointSelectR(d)*1.4)).attr("r",u)},unselectPoint(e,t,s){const i=this,{config:n,$el:{main:a},$T:o}=i;J(n.data_onunselected,i.api,t,e==null?void 0:e.node()),o(a.select(`.${Q.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${Q.selectedCircle}-${s}`)).attr("r",0).remove()},togglePoint(e,t,s,i){this[`${e?"":"un"}selectPoint`](t,s,i)},selectPath(e,t){const s=this,{config:i}=s;J(i.data_onselected,s.api,t,e.node()),i.interaction_brighten&&e.style("filter","brightness(1.25)")},unselectPath(e,t){const s=this,{config:i}=s;J(i.data_onunselected,s.api,t,e.node()),i.interaction_brighten&&e.style("filter",null)},togglePath(e,t,s,i){this[`${e?"":"un"}selectPath`](t,s,i)},getToggle(e,t){const s=this;return e.nodeName==="path"?s.togglePath:s.isStepType(t)?()=>{}:s.togglePoint},toggleShape(e,t,s){var i;const n=this,{config:a,$el:{main:o}}=n;if(a.data_selection_enabled&&a.data_selection_isselectable.bind(n.api)(t)){const r=(0,R.select)(e),l=r.classed(Q.SELECTED),c=n.getToggle(e,t).bind(n);let u;if(!a.data_selection_multiple){const d=(i=n.isPointFocusOnly)==null?void 0:i.call(n);let h=`.${d?Q.selectedCircles:it.shapes}`;a.data_selection_grouped&&(h+=n.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(d?`.${Q.selectedCircle}`:`.${it.shape}.${Q.SELECTED}`).classed(Q.SELECTED,!1).each(function(g){const f=(0,R.select)(this);u=f,c(!1,f,g,g.index)})}(!u||u.node()!==r.node())&&(r.classed(Q.SELECTED,!l),c(!l,r,t,s))}}}),Io={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:()=>!0,data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:()=>{},data_onunselected:()=>{}},Do={subchart_show:!1,subchart_showHandle:!1,subchart_size_height:60,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:()=>{}},zo={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0};let Qs=()=>(ut(Ht.prototype,Oo),ut(Bt.prototype,$o),jt.setOptions([Io]),(Qs=()=>!0)()),ti=()=>(ut(Ht.prototype,To),ut(Bt.prototype,bo),jt.setOptions([Do]),(ti=()=>!0)()),ei=()=>(ut(Ht.prototype,Ao),ut(Bt.prototype,vo),jt.setOptions([zo]),(ei=()=>!0)());function si(e,t,s){const{config:i}=e,n=(a,o)=>{const r=I(o)?o:o===!1?void 0:null;r!==null&&(i[`axis_${a}_${t}`]=r)};H(s)&&(bt(s)?Object.keys(s).forEach(a=>{n(a,s[a])}):(I(s)||s===!1)&&["y","y2"].forEach(a=>{n(a,s)}),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function ii(e,t){const{config:s}=e;return{x:s[`axis_x_${t}`],y:s[`axis_y_${t}`],y2:s[`axis_y2_${t}`]}}var Fo={axis:{labels:function(e){const t=this.internal;let s;return e&&(Object.keys(e).forEach(i=>{t.axis.setLabelText(i,e[i])}),t.axis.updateLabels()),["x","y","y2"].forEach(i=>{const n=t.axis.getLabelText(i);n&&(!s&&(s={}),s[i]=n)}),s},min:function(e){const t=this.internal;return M(e)||e===!1?si(t,"min",e):ii(t,"min")},max:function(e){const t=this.internal;return M(e)||e===!1?si(t,"max",e):ii(t,"max")},range:function(e){const{axis:t}=this;if(arguments.length){const{min:s,max:i}=e;H(i)&&t.max(i),H(s)&&t.min(s)}else return{max:t.max(),min:t.min()}}}},Mo={category(e,t){const s=this.internal,{config:i}=s;return arguments.length>1&&(i.axis_x_categories[e]=t,s.redraw()),i.axis_x_categories[e]},categories(e){const t=this.internal,{config:s}=t;if(!e||!Array.isArray(e)){const i=s.axis_x_categories;return vt(i)?Object.values(t.data.xs)[0]:i}return s.axis_x_categories=e,t.redraw(),s.axis_x_categories}},Xo={flow(e){const t=this.internal;let s;(e.json||e.rows||e.columns)&&t.convertData(e,n=>{s=n,i()});function i(){let n,a=0,o=0,r,l;if(t.state.redrawing||!s||!fe())return;const c=[],u=t.getMaxDataCount(),d=t.convertDataToTargets(s,!0),h=t.axis.isTimeSeries();t.data.targets.forEach(p=>{let _=!1;for(let x=0;x<d.length;x++)if(p.id===d[x].id){_=!0,p.values[p.values.length-1]&&(o=p.values[p.values.length-1].index+1),a=d[x].values.length;for(let m=0;m<a;m++)d[x].values[m].index=o+m,h||(d[x].values[m].x=o+m);p.values=p.values.concat(d[x].values),d.splice(x,1);break}!_&&c.push(p.id)}),t.data.targets.forEach(p=>{for(let _=0;_<c.length;_++)if(p.id===c[_]){o=p.values[p.values.length-1].index+1;for(let x=0;x<a;x++)p.values.push({id:p.id,index:o+x,x:h?t.getOtherTargetX(o+x):o+x,value:null})}}),t.data.targets.length&&d.forEach(p=>{const _=[];for(let x=t.data.targets[0].values[0].index;x<o;x++)_.push({id:p.id,index:x,x:h?t.getOtherTargetX(x):x,value:null});p.values.forEach(x=>{x.index+=o,h||(x.x+=o)}),p.values=_.concat(p.values)}),t.data.targets=t.data.targets.concat(d);const g=t.data.targets[0],f=g.values[0];H(e.to)?(a=0,l=h?At.call(t,e.to):e.to,g.values.forEach(p=>{p.x<l&&a++})):H(e.length)&&(a=e.length),u?u===1&&h&&(r=(g.values[g.values.length-1].x-f.x)/2,n=[new Date(+f.x-r),new Date(+f.x+r)]):(h?r=g.values.length>1?g.values[g.values.length-1].x-f.x:f.x-t.getXDomain(t.data.targets)[0]:r=1,n=[f.x-r,f.x]),n&&t.updateXDomain(null,!0,!0,!1,n),t.updateTargets(t.data.targets),t.redraw({flow:{index:f.index,length:a,duration:M(e.duration)?e.duration:t.config.transition_duration,done:e.done,orgDataCount:u},withLegend:!0,withTransition:u>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}};function qe(e,t){const s=this.internal,{config:i}=s,n=i.transition_duration&&fe(),a=`grid_${t}_lines`;return e&&(i[a]=e,s.updateGrid(),s.redrawGrid(n)),i[a]}function ni(e,t){const s=`grid_${t}_lines`;return qe.bind(this)(this.internal.config[s].concat(e||[]),t)}function ai(e,t){this.internal.removeGridLines(e,t)}const oi=function(e){return qe.bind(this)(e,"x")};ut(oi,{add(e){return ni.bind(this)(e,"x")},remove(e){return ai.bind(this)(e,!0)}});const ri=function(e){return qe.bind(this)(e,"y")};ut(ri,{add(e){return ni.bind(this)(e,"y")},remove(e){return ai.bind(this)(e,!1)}});var Bo={xgrids:oi,ygrids:ri},No={groups(e){const t=this.internal,{config:s}=t;return nt(e)||(s.data_groups=e,t.redraw()),s.data_groups}};function li(e,t=!1){const s=this.internal,{config:i}=s,n=i.transition_duration&&fe();return e?(i.regions=t?i.regions.concat(e):e,s.updateRegion(),s.redrawRegion(n),t?i.regions:e):i.regions}const ci=function(e){return li.bind(this)(e)};ut(ci,{add:function(e){return li.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:s,$T:i}=t,n=e||{},a=zt(n,"classes",[he.region]);let o=t.$el.main.select(`.${he.regions}`).selectAll(a.map(r=>`.${r}`));return i(o).style("opacity","0").remove(),o=s.regions,Object.keys(n).length?(o=o.filter(r=>{let l=!1;return r.class?(r.class.split(" ").forEach(c=>{a.indexOf(c)>=0&&(l=!0)}),!l):!0}),s.regions=o):s.regions=[],o}});var Go={regions:ci},Vo={x(e){const t=this.internal,{axis:s,data:i}=t,n=s.isCustomX()&&s.isCategorized();return Y(e)&&(n?this.categories(e):(t.updateTargetX(i.targets,e),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),n?this.categories():i.xs},xs(e){const t=this.internal;return G(e)&&(t.updateTargetXs(t.data.targets,e),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},se=Z(11),Yo=Object.defineProperty,jo=(e,t,s)=>t in e?Yo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ee=(e,t,s)=>jo(e,typeof t!="symbol"?t+"":t,s);class Wo{constructor(t){Ee(this,"owner"),Ee(this,"config"),Ee(this,"scale"),Ee(this,"charSize",{});const s=Wt(),{config:i,params:n}=t;this.owner=t,this.config=i,this.scale=s,(i.noTransition||!n.config.transition_duration)&&(i.withoutTransition=!0),i.range=this.scaleExtent((n.orgXScale||s).range())}getSizeFor1Char(t,s,i=!0){const n={w:5.5,h:11.5};return this.charSize[t]&&i?this.charSize[t]:(!s.empty()&&s.text("0").call(a=>{try{const{width:o,height:r}=Ft(a.node(),!0);o&&r&&(n.w=o,n.h=r)}finally{a.text("")}}),this.charSize[t]=n,n)}getTickTransformSetter(t){const{config:s}=this,i=t==="x"?n=>`translate(${n+s.tickOffset},0)`:n=>`translate(0,${n})`;return(n,a)=>{n.attr("transform",o=>{const r=a(o);return M(o)?i(r):null})}}scaleExtent(t){const s=t[0],i=t[t.length-1];return s<i?[s,i]:[i,s]}generateTicks(t,s){const{tickStepSize:i}=this.owner.params,[n,a]=t.domain();let o=[];if(s&&i){let r=Math.round(n);for(;r<=a;)o.push(r),r+=i}else if(t.ticks){const{tickArguments:r}=this.config;if(t.type==="log"&&!r){const l=Wt("_log").domain([n>0?n:1,a]).range(t.range());o=l.ticks();for(let c=a.toFixed().length;o.length>15;c--)o=l.ticks(c);o.splice(0,1,n),o.splice(o.length-1,1,a)}else o=t.ticks(...this.config.tickArguments||[]);o=o.map(l=>N(l)&&I(l)&&!isNaN(l)&&Math.round(l*10)/10||l)}return o}copyScale(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t}textFormatted(t){const s=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+String(t).replace(/0+\d$/,""):t,n=s?s(i):i;return H(n)?n:""}transitionise(t){const{config:s}=this;let i=t;if(s.withoutTransition)i=t.interrupt();else if(s.transition||!this.owner.params.noTransition)try{i=t.transition(s.transition)}catch(n){}return i}}var Ho=Object.defineProperty,Uo=(e,t,s)=>t in e?Ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,pe=(e,t,s)=>Uo(e,typeof t!="symbol"?t+"":t,s);class Zo{constructor(t={}){pe(this,"helper"),pe(this,"config"),pe(this,"params"),pe(this,"g"),pe(this,"generatedTicks");const s={innerTickSize:6,outerTickSize:t.outerTick?6:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:9,tickOffset:0,tickPadding:3,tickValues:null,transition:null,noTransition:t.noTransition};s.tickLength=Math.max(s.innerTickSize,0)+s.tickPadding,this.config=s,this.params=t,this.helper=new Wo(this)}create(t){const s=this,{config:i,helper:n,params:a}=s,{scale:o}=n,{orient:r}=i,l=this.splitTickText.bind(s),c=/^(left|right)$/.test(r),u=/^(top|bottom)$/.test(r),d=n.getTickTransformSetter(u?"x":"y"),h=d===n.axisX?"y":"x",g=/^(top|left)$/.test(r)?-1:1,f=a.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():n.scaleExtent((a.orgXScale||o).range());const{innerTickSize:p,tickLength:_,range:x}=i,m=a.id,y=m&&/^(x|y|y2)$/.test(m)?a.config[`axis_${m}_tick_text_position`]:{x:0,y:0},$=m==="subX"?"subchart_axis_x":`axis_${m}`,v=a.config[`${$}_show`],b={tick:v?a.config[`${$}_tick_show`]:!1,text:v?a.config[`${$}_tick_text_show`]:!1},T=a.config.axis_evalTextSize;let C;t.each(function(){const S=(0,R.select)(this);let A=this.__chart__||o,w=n.copyScale();C=S,this.__chart__=w,i.tickOffset=a.isCategory?(w(1)-w(0))/2:0;const O=S.selectAll(".domain").data([0]);if(O.enter().append("path").attr("class","domain").merge(O).attr("d",()=>{const E=i.outerTickSize*g;return u?`M${x[0]},${E}V0H${x[1]}V${E}`:`M${E},${x[0]}H0V${x[1]}H${E}`}),b.tick||b.text){const E=i.tickValues||n.generateTicks(w,c||a.config.axis_rotated);s.generatedTicks=E;let P=S.selectAll(".tick").data(E,w);const F=P.enter().insert("g",".domain").attr("class","tick"),U=P.exit().remove();P=F.merge(P),b.tick&&F.append("line"),b.text&&F.append("text");const j=P.select("text"),ht=[];let et={w:0,h:0};k(T)&&(et=T.bind(s.params.owner.api)(j.node(),m),this.classList.contains(D.dummy)&&(this.sizeFor1Char=et)),(!et||et.w===0||et.h===0)&&(et=s.helper.getSizeFor1Char(r,j,!!T));let wt=j.selectAll("tspan").data((gt,Nt)=>{const Zt=a.tickMultiline?l(gt,w,E,c,et.w):Y(n.textFormatted(gt))?n.textFormatted(gt).concat():[n.textFormatted(gt)];return ht[Nt]=Zt.length,Zt.map(qt=>({index:Nt,splitted:qt}))});wt.exit().remove(),wt=wt.enter().append("tspan").merge(wt).text(gt=>gt.splitted),wt.attr("x",u?0:_*g).attr("dx",(()=>{let gt=0;return/(top|bottom)/.test(r)&&f&&(gt=8*Math.sin(Math.PI*(f/180))*(r==="top"?-1:1)),gt+(y.x||0)})()).attr("dy",(gt,Nt)=>{const Zt=".71em";let qt=0;return r!=="top"&&(qt=et.h,Nt===0&&(qt=c?-((ht[gt.index]-1)*(et.h/2)-3):y.y===0?Zt:0)),I(qt)&&y.y?qt+y.y:qt||Zt});const de=P.select("line"),xe=P.select("text");if(F.select("line").attr(`${h}2`,p*g),F.select("text").attr(h,_*g),s.setTickLineTextPosition(de,xe,et),a.tickTitle){const gt=xe.select("title");(gt.empty()?xe.append("title"):gt).text(Nt=>a.tickTitle[Nt])}if(w.bandwidth){const gt=w,Nt=gt.bandwidth()/2;A=Zt=>gt(Zt)+Nt,w=A}else A.bandwidth?A=w:d(U,w);P=a.owner.state.flowing?n.transitionise(P):a.owner.$T(P),d(F,A),d(P.style("opacity",null),w)}}),this.g=C}getGeneratedTicks(t){var s;const i=((s=this.generatedTicks)==null?void 0:s.length)-1;let n=this.generatedTicks;if(i>t){const a=Math.round(i/t+.1);n=this.generatedTicks.map((o,r)=>r%a===0?o:null).filter(o=>o!==null).splice(0,t)}return n}getTickXY(){const{config:t}=this,s={x:0,y:0};return this.params.isCategory&&(s.x=t.tickCentered?0:t.tickOffset,s.y=t.tickCentered?t.tickOffset:0),s}getTickSize(t){const{scale:s}=this.helper,{config:i}=this,{innerTickSize:n,range:a}=i,o=s(t)+(i.tickCentered?0:i.tickOffset);return a[0]<o&&o<a[1]?n:0}setTickLineTextPosition(t,s,i){const n=this.getTickXY(),{innerTickSize:a,orient:o,tickLength:r,tickOffset:l}=this.config,c=this.params.id,u=this.params.tickTextRotate,d=6,h=i.h/2-d,g=y=>{const $=["start","end"];return o==="top"&&$.reverse(),y?$[y>0?0:1]:"middle"},f=y=>y?`rotate(${y})`:null,p=y=>{const $=y/(o==="bottom"?15:23);return y?11.5-2.5*$*(y>0?1:-1):r},{config:{axis_rotated:_,axis_x_tick_text_inner:x}}=this.params.owner,m=this.params.config[`axis_${c}_tick_inner`];switch(o){case"bottom":t.attr("x1",n.x).attr("x2",n.x).attr("y2",y=>this.getTickSize.bind(this)(y)*(m?-1:1)),s.attr("x",0).attr("y",p(u)).style("text-anchor",g(u)).style("text-anchor",(y,$,{length:v})=>!_&&$===0&&(x===!0||x.first)?"start":!_&&$===v-1&&(x===!0||x.last)?"end":g(u)).attr("transform",f(u));break;case"top":t.attr("x2",0).attr("y2",m?a:-a),s.attr("x",0).attr("y",-(p(u)+h+d)).style("text-anchor",g(u)).attr("transform",f(u));break;case"left":t.attr("x2",m?a:-a).attr("y1",n.y).attr("y2",n.y),s.attr("x",-r).attr("y",l+(_?h/4:h)).style("text-anchor","end");break;case"right":t.attr("x2",m?-a:a).attr("y2",0),s.attr("x",r).attr("y",h).style("text-anchor","start")}}splitTickText(t,s,i,n,a){const{params:o}=this,r=this.helper.textFormatted(t),l=N(r)&&r.indexOf(`
|
|
31
32
|
`)>-1?r.split(`
|
|
32
|
-
`):[];if(l.length)return l;if(V(r))return r;let c=o.tickWidth;(!c||c<=0)&&(c=n?95:o.isCategory?(o.isInverted?s(i[0])-s(i[1]):s(i[1])-s(i[0]))-12:110);function u(d,h){let g,f,p;for(let _=1;_<h.length;_++)if(h.charAt(_)===" "&&(f=_),g=h.substr(0,_+1),p=a*g.length,c<p)return u(d.concat(h.substr(0,f||_)),h.slice(f?f+1:_));return d.concat(h)}return u(l,String(r))}scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?String(t):"bottom",this):this.config.orient}tickFormat(t){const{config:s}=this;return arguments.length?(s.tickFormat=t,this):s.tickFormat}tickCentered(t){const{config:s}=this;return arguments.length?(s.tickCentered=t,this):s.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(t){var s;const{outerTickSize:i,tickOffset:n,tickValues:a}=this.config;let o;if(this.params.isCategory)o=n*2;else{const r=(s=this.params.owner.scale.zoom)!=null?s:this.helper.scale;o=(this.g.select("path.domain").node().getTotalLength()-i*2)/(t||this.g.selectAll("line").size());const c=a?a.map((u,d,h)=>{const g=d+1;return g<h.length?r(h[g])-r(u):null}).filter(Boolean):[];o=Math.min(...c,o)}return o===1/0?0:o}ticks(...t){const{config:s}=this;return t.length?(s.tickArguments=jt(t),this):s.tickArguments}tickCulling(t){const{config:s}=this;return arguments.length?(s.tickCulling=t,this):s.tickCulling}tickValues(t){const{config:s}=this;if(k(t))s.tickValues=()=>t(this.helper.scale.domain());else{if(!arguments.length)return s.tickValues;s.tickValues=t}return this}setTransition(t){return this.config.transition=t,this}}var So=Object.defineProperty,Ro=(e,t,s)=>t in e?So(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ot=(e,t,s)=>Ro(e,typeof t!="symbol"?t+"":t,s),Co={getAxisInstance:function(){return this.axis||new Eo(this)}};class Eo{constructor(t){Ot(this,"owner"),Ot(this,"x"),Ot(this,"subX"),Ot(this,"y"),Ot(this,"y2"),Ot(this,"axesList",{}),Ot(this,"tick",{x:null,y:null,y2:null}),Ot(this,"xs",[]),Ot(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${ot.axis} ${ot[`axis${pt(t)}`]}`}isHorizontal(t,s){const i=t.config.axis_rotated;return s?i:!i}isCategorized(){const{config:t,state:s}=this.owner;return t.axis_x_type.indexOf("category")>=0||s.hasRadar}isCustomX(){const{config:t}=this.owner;return!this.isTimeSeries()&&(t.data_x||at(t.data_xs))}isTimeSeries(t="x"){return this.owner.config[`axis_${t}_type`]==="timeseries"}isLog(t="x"){return this.owner.config[`axis_${t}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(t="x"){let s="linear";return this.isTimeSeries(t)?s=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(s="log"),s}getExtent(){const t=this.owner,{config:s,scale:i}=t;let n=s.axis_x_extent;if(n){if(k(n))n=n.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(this.isTimeSeries()&&n.every(isNaN)){const a=At.bind(t);n=n.map(o=>i.subX(a(o)))}}return n}init(){const t=this.owner,{config:s,$el:{main:i,axis:n},state:{clip:a}}=t,o=["x","y"];s.axis_y2_show&&o.push("y2"),o.forEach(r=>{const l=this.getAxisClassName(r);n[r]=i.append("g").attr("class",l).attr("clip-path",()=>{let c=null;return r==="x"?c=a.pathXAxis:r==="y"&&(c=a.pathYAxis),c}).attr("transform",t.getTranslate(r)).style("visibility",s[`axis_${r}_show`]?null:"hidden"),this.generateAxes(r)})}setOrient(){const t=this.owner,{axis_rotated:s,axis_y_inner:i,axis_y2_inner:n}=t.config;this.orient={x:s?"left":"bottom",y:s?i?"top":"bottom":i?"right":"left",y2:s?n?"bottom":"top":n?"left":"right",subX:s?"left":"bottom"}}generateAxes(t){const s=this.owner,{config:i}=s,n=[],a=i[`axis_${t}_axes`],o=i.axis_rotated;let r;t==="x"?r=o?se.axisLeft:se.axisBottom:t==="y"?r=o?se.axisBottom:se.axisLeft:t==="y2"&&(r=o?se.axisTop:se.axisRight),a.length&&a.forEach(l=>{const c=l.tick||{},u=s.scale[t].copy();l.domain&&u.domain(l.domain),n.push(r(u).ticks(c.count).tickFormat(k(c.format)?c.format.bind(s.api):(d=>d)).tickValues(c.values).tickSizeOuter(c.outer===!1?0:6))}),this.axesList[t]=n}updateAxes(){const t=this.owner,{config:s,$el:{main:i},$T:n}=t;Object.keys(this.axesList).forEach(a=>{const o=s[`axis_${a}_axes`],r=t.scale[a].copy(),l=r.range();this.axesList[a].forEach((c,u)=>{const d=c.scale().range();l.every((f,p)=>f===d[p])||c.scale().range(l);const h=`${this.getAxisClassName(a)}-${u+1}`;let g=i.select(`.${h.replace(/\s/,".")}`);g.empty()?g=i.append("g").attr("class",h).style("visibility",s[`axis_${a}_show`]?null:"hidden").call(c):(o[u].domain&&r.domain(o[u].domain),n(g).call(c.scale(r))),g.attr("transform",t.getTranslate(a,u+1))})})}setAxis(t,s,i,n){const a=this.owner;t!=="subX"&&(this.tick[t]=this.getTickValues(t)),this[t]=this.getAxis(t,s,i,t==="x"&&(a.scale.zoom||a.config.subchart_show||a.state.resizing)?!0:n)}getAxis(t,s,i,n,a){const o=this.owner,{config:r}=o,l=/^(x|subX)$/.test(t),c=l?"x":t,u=l&&this.isCategorized(),d=this.orient[t],h=a?0:o.getAxisTickRotate(c);let g;if(l)g=t==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const m=r[`axis_${t}_tick_format`];k(m)&&(g=m.bind(o.api))}let f=this.tick[c];const p=te({outerTick:i,noTransition:n,config:r,id:t,tickTextRotate:h,owner:o},l&&{isCategory:u,isInverted:r.axis_x_inverted,tickMultiline:r.axis_x_tick_multiline,tickWidth:r.axis_x_tick_width,tickTitle:u&&r.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new wo(p).scale(l&&o.scale.zoom||s).orient(d);if(l&&this.isTimeSeries()&&f&&!k(f)){const m=At.bind(o);f=f.map(y=>m(y))}else!l&&this.isTimeSeriesY()&&(_.ticks(r.axis_y_tick_time_value),f=null);f&&_.tickValues(f),_.tickFormat(g||!l&&o.isStackNormalized()&&o.hasAxisGroupedData(t)&&(m=>`${m}%`)),u&&(_.tickCentered(r.axis_x_tick_centered),vt(r.axis_x_tick_culling)&&(r.axis_x_tick_culling=!1));const x=r[`axis_${c}_tick_count`];return x&&_.ticks(x),_}updateXAxisTickValues(t,s){var i;const n=this.owner,{config:a}=n,o=a.axis_x_tick_fit;let r=a.axis_x_tick_count,l;return(o||r&&o)&&(l=n.mapTargetsToUniqueXs(t),this.isCategorized()&&r>l.length&&(r=l.length),l=this.generateTickValues(l,r,this.isTimeSeries())),s?s.tickValues(l):this.x&&(this.x.tickValues(l),(i=this.subX)==null||i.tickValues(l)),l}getId(t){const{config:s,scale:i}=this.owner;let n=s.data_axes[t];return(!n||!i[n])&&(n="y"),n}getXAxisTickFormat(t){const s=this.owner,{config:i,format:n}=s,a=t&&i.subchart_axis_x_tick_format||i.axis_x_tick_format,o=this.isTimeSeries(),r=this.isCategorized();let l;return a?k(a)?l=a.bind(s.api):o&&(l=c=>c?n.axisTime(a)(c):""):l=o?n.defaultAxisTime:r?s.categoryName:c=>c<0?c.toFixed(0):c,k(l)?c=>l.apply(s,r?[c,s.categoryName(c)]:[c]):l}getTickValues(t){const s=this.owner,i=s.config[`axis_${t}_tick_values`],n=s[`${t}Axis`];return(k(i)?i.call(s.api):i)||(n?n.tickValues():void 0)}getLabelOptionByAxisId(t){return this.owner.config[`axis_${t}_label`]}getLabelText(t){const s=this.getLabelOptionByAxisId(t);return B(s)?s:s?s.text:null}setLabelText(t,s){const i=this.owner,{config:n}=i,a=this.getLabelOptionByAxisId(t);B(a)?n[`axis_${t}_label`]=s:a&&(a.text=s)}getLabelPosition(t,s){const i=this.owner.config.axis_rotated,n=this.getLabelOptionByAxisId(t),a=bt(n)&&n.position?n.position:s[+!i],o=r=>!!~a.indexOf(r);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}}getAxisLabelPosition(t){return this.getLabelPosition(t,t==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}getLabelPositionById(t){return this.getAxisLabelPosition(t)}xForAxisLabel(t){const s=this.owner,{state:{width:i,height:n}}=s,a=this.getAxisLabelPosition(t);let o=a.isMiddle?-n/2:0;return this.isHorizontal(s,t!=="x")?o=a.isLeft?0:a.isCenter?i/2:i:a.isBottom&&(o=-n),o}textAnchorForAxisLabel(t){const s=this.owner,i=this.getAxisLabelPosition(t);let n=i.isMiddle?"middle":"end";return this.isHorizontal(s,t!=="x")?n=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(n="start"),n}dxForAxisLabel(t){const s=this.owner,i=this.getAxisLabelPosition(t);let n=i.isBottom?"0.5em":"0";return this.isHorizontal(s,t!=="x")?n=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(n="-0.5em"),n}dyForAxisLabel(t){const s=this.owner,{config:i}=s,n=i.axis_rotated,a=this.getAxisLabelPosition(t).isInner,o=i[`axis_${t}_tick_rotate`]?s.getHorizontalAxisHeight(t):0,{width:r}=this.getMaxTickSize(t);let l;if(t==="x"){const c=i.axis_x_height;n?l=a?"1.2em":-25-r:a?l="-0.5em":c?l=c-10:o?l=o-10:l="3em"}else l={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],n?a?l=l[0]:o?l=o*(t==="y2"?-1:1)-l[1]:l=l[2]:l=a?l[3]:(l[4]+(i[`axis_${t}_inner`]?0:r+l[4]))*(t==="y"?-1:1);return l}getMaxTickSize(t,s){const i=this.owner,{config:n,state:{current:a,resizing:o},$el:{svg:r,chart:l}}=i,c=a.maxTickSize[t],u=`axis_${t}`,d={width:0,height:0};if(o||s||!n[`${u}_show`]||c.width>0&&i.filterTargetsToShow().length===0)return c;if(r){const h=/^y2?$/.test(t),g=i.filterTargetsToShow(i.data.targets),f=i.scale[t].copy().domain(i[`get${h?"Y":"X"}Domain`](g,t)),p=f.domain(),_=p[0]===p[1]&&p.every(w=>w>0),x=V(c.domain)&&c.domain[0]===c.domain[1]&&c.domain.every(w=>w>0);if(_||x)return c.size;c.domain=p,h||c.ticks.splice(0);const m=this.getAxis(t,f,!1,!1,!0),y=n[`${u}_tick_rotate`],$=n[`${u}_tick_count`];!n[`${u}_tick_values`]&&$&&m.tickValues(this.generateTickValues(p,$,h?this.isTimeSeriesY():this.isTimeSeries())),!h&&this.updateXAxisTickValues(g,m);const b=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),T=b.append("g").attr("class",`${ot[`axis${pt(t)}`]} ${D.dummy}`);m.create(T);const{sizeFor1Char:C}=T.node();b.selectAll("text").attr("transform",I(y)?`rotate(${y})`:null).each(function(w,S){const{width:A,height:O}=C?{width:this.textContent.length*C.w,height:C.h}:ct(this,!0);d.width=Math.max(d.width,A),d.height=Math.max(d.height,O),h||(c.ticks[S]=A)}),b.remove()}return Object.keys(d).forEach(h=>{d[h]>0&&(c[h]=d[h])}),c}getXAxisTickTextY2Overflow(t){const s=this.owner,{axis:i,config:n,state:{current:a,isLegendRight:o,legendItemWidth:r}}=s,l=s.getAxisTickRotate("x"),c=l>0&&l<90;if((i.isCategorized()||i.isTimeSeries())&&n.axis_x_tick_fit&&(!n.axis_x_tick_culling||vt(n.axis_x_tick_culling))&&!n.axis_x_tick_multiline&&c){const u=n.axis_y2_show&&a.maxTickSize.y2.width||0,d=o&&r||0,h=a.width-s.getCurrentPaddingByDirection("left"),g=this.getXAxisTickMaxOverflow(l,h-t)-u-d,f=Math.max(0,g)+t;return Math.min(f,h/2)}return 0}getXAxisTickMaxOverflow(t,s){const i=this.owner,{axis:n,config:a,state:o}=i,r=n.isTimeSeries(),l=o.current.maxTickSize.x.ticks,c=l.length,{left:u,right:d}=o.axis.x.padding;let h=0;const g=c-(r&&a.axis_x_tick_fit?.5:0);for(let _=0;_<c;_++){const x=_+1,m=Math.cos(Math.PI*t/180)*l[_],y=x-(r?1:.5)+u;if(y<=0)continue;const v=(s-m)/y,b=g-x,T=d*v,C=b*v+T,w=m-v/2-C;h=Math.max(h,w)}const f=i.filterTargetsToShow(i.data.targets);let p=0;if(!r&&a.axis_x_tick_count<=f.length&&f[0].values.length){const _=Wt(i.axis.getAxisType("x"),0,s-h).domain([u*-1,i.getXDomainMax(i.data.targets)+1+d]);p=(_(1)-_(0))/2}return h+p}updateLabels(t){const s=this.owner,{config:i,$el:{main:n},$T:a}=s,o=i.axis_rotated;["x","y","y2"].forEach(r=>{const l=this.getLabelText(r),c=`axis${pt(r)}`,u=ot[`${c}Label`];if(l){let d=n.select(`text.${u}`);d.empty()&&(d=n.select(`g.${ot[c]}`).insert("text",":first-child").attr("class",u).attr("transform",["rotate(-90)",null][r==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(r))),a(d,t).attr("x",()=>this.xForAxisLabel(r)).attr("dx",()=>this.dxForAxisLabel(r)).attr("dy",()=>this.dyForAxisLabel(r)).text(l)}})}getPadding(t,s,i,n){const a=I(t)?t:t[s];return M(a)?this.owner.convertPixelToScale(/(bottom|top)/.test(s)?"y":"x",a,n):i}generateTickValues(t,s,i){let n=t;if(s){const a=k(s)?s():s;if(a===1)n=[t[0]];else if(a===2)n=[t[0],t[t.length-1]];else if(a>2){const o=this.isCategorized(),r=a-2,l=t[0],c=t[t.length-1],u=(c-l)/(r+1);let d;n=[l];for(let h=0;h<r;h++)d=+l+u*(h+1),n.push(i?new Date(d):o?Math.round(d):d);n.push(c)}}return i||(n=n.sort((a,o)=>a-o)),n}generateTransitions(t){const s=this.owner,{$el:{axis:i},$T:n}=s,[a,o,r,l]=["x","y","y2","subX"].map(c=>n(i[c],t));return{axisX:a,axisY:o,axisY2:r,axisSubX:l}}redraw(t,s,i){const n=this.owner,{config:a,state:o,$el:r}=n,l=s?"0":null;["x","y","y2","subX"].forEach(c=>{const u=this[c],d=r.axis[c];u&&d&&(!i&&!a.transition_duration&&(u.config.withoutTransition=!0),d.style("opacity",l),u.create(t[`axis${pt(c)}`]))}),this.updateAxes(),!o.rendered&&a.axis_tooltip&&this.setAxisTooltip()}redrawAxis(t,s,i,n,a){var o,r,l;const c=this.owner,{config:u,scale:d,$el:h}=c,g=!!d.zoom;let f;!g&&this.isCategorized()&&t.length===0&&d.x.domain([0,h.axis.x.selectAll(".tick").size()]),d.x&&t.length?(!g&&c.updateXDomain(t,s.UpdateXDomain,s.UpdateOrgXDomain,s.TrimXDomain),u.axis_x_tick_values||this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),(o=this.subX)==null||o.tickValues([])),u.zoom_rescale&&!n&&(f=d.x.orgDomain()),["y","y2"].forEach(p=>{const _=`axis_${p}_`,x=d[p];if(x){const m=u[`${_}tick_values`],y=u[`${_}tick_count`];if(x.domain(c.getYDomain(t,p,f)),!m&&y){const $=c.axis[p],v=x.domain();$.tickValues(this.generateTickValues(v,v.every(b=>b===0)?1:y,this.isTimeSeriesY()))}}}),this.redraw(i,c.hasArcType(),a),this.updateLabels(s.Transition),(s.UpdateXDomain||s.UpdateXAxis||s.Y)&&t.length&&this.setCulling(),s.Y&&((r=d.subY)==null||r.domain(c.getYDomain(t,"y")),(l=d.subY2)==null||l.domain(c.getYDomain(t,"y2")))}setCulling(){const t=this.owner,{config:s,state:{clip:i,current:n},$el:a}=t;["subX","x","y","y2"].forEach(o=>{const r=a.axis[o],c=`axis_${o==="subX"?"x":o}_tick_culling`,u=s[c];if(r&&u){const d=r.selectAll(".tick"),h=ee(d.data(),!s[`${c}_reverse`]),g=h.length,f=s[`${c}_max`],p=s[`${c}_lines`];let _;if(g){for(let x=1;x<g;x++)if(g/x<f){_=x;break}d.each(function(x){const m=p?this.querySelector("text"):this;m&&(m.style.display=h.indexOf(x)%_?"none":null)})}else d.style("display",null);if(o==="x"){const x=n.maxTickSize.x.clipPath?i.pathXAxisTickTexts:null;a.svg.selectAll(`.${ot.axisX} .tick text`).attr("clip-path",x)}}})}setAxisTooltip(){var t;const s=this.owner,{config:{axis_rotated:i,axis_tooltip:n},$el:{axis:a,axisTooltip:o}}=s,r=(t=n.backgroundColor)!=null?t:"black";s.generateTextBGColorFilter(r,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(l=>{var c,u,d;if(B(r)||r[l])if(o[l]=(c=a[l])==null?void 0:c.append("text").classed(ot[`axis${l.toUpperCase()}Tooltip`],!0).attr("filter",s.updateTextBGColor({id:l},r)),i){const h=l==="x"?"x":"y",g=l==="y"?"1.15em":l==="x"?"-0.3em":"-0.4em";(u=o[l])==null||u.attr(h,g).attr(`d${l==="x"?"y":"x"}`,l==="x"?"0.4em":"-1.3em").style("text-anchor",l==="x"?"end":null)}else{const h=l==="x"?"y":"x",g=l==="x"?"1.15em":`${l==="y"?"-":""}0.4em`;(d=o[l])==null||d.attr(h,g).attr(`d${l==="x"?"x":"y"}`,l==="x"?"-1em":"0.3em").style("text-anchor",l==="y"?"end":null)}})}}var Lo={initEventRect(){this.$el.main.select(`.${D.chart}`).append("g").attr("class",St.eventRects).style("fill-opacity","0")},redrawEventRect(){var e;const t=this,{config:s,state:i,$el:n}=t,a=t.isMultipleX(),o=s.axis_x_inverted;if(n.eventRect)t.updateEventRect(n.eventRect,!0);else if(t.data.targets.length){const l=t.$el.main.select(`.${St.eventRects}`).style("cursor",s.zoom_enabled&&s.zoom_type!=="drag"?s.axis_rotated?"ns-resize":"ew-resize":null).classed(St.eventRectsMultiple,a).classed(St.eventRectsSingle,!a).selectAll(`.${St.eventRect}`).data([0]).enter().append("rect");t.updateEventRect(l),t.updateEventType(l),l.call(t.getDraggableSelection()),n.eventRect=l,t.state.inputType==="touch"&&!n.svg.on("touchstart.eventRect")&&!t.hasArcType()&&t.bindTouchOnEventRect(),i.rendered&&t.updateEventRect(n.eventRect,!0)}if(!a){const r=t.getMaxDataCountTarget();(!s.data_xSort||o)&&r.sort((l,c)=>o?c.x-l.x:l.x-c.x),t.updateDataIndexByX(r),t.updateXs(r),(e=t.updatePointClass)==null||e.call(t,!0),i.eventReceiver.data=r}t.updateEventRectData()},bindTouchOnEventRect(){const e=this,{config:t,state:s,$el:{eventRect:i,svg:n}}=e,a=g=>{if(e.isMultipleX())e.selectRectForMultipleXs(g);else{const f=e.getDataIndexFromEvent(s.event);e.callOverOutForTouch(f),f===-1?e.unselectRect():e.selectRectForSingle(g,f)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=ze(r)&&r||!1,c=!isNaN(r)&&r||null;let u;const d=!l&&c===null,h=g=>{const f=g.type,_=g.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];f==="touchstart"?l?g.preventDefault():c!==null&&(u=_):f==="touchmove"&&(l||u===!0||c!==null&&Math.abs(u-_)>=c)&&(u=!0,g.preventDefault())};i.on("touchstart",g=>{s.event=g,e.updateEventRect()},{passive:d}).on("touchstart.eventRect touchmove.eventRect",g=>{if(s.event=g,!i.empty()&&i.classed(St.eventRect)){if(s.dragging||s.flowing||e.hasArcType()||g.touches.length>1)return;h(g),a(i.node())}else o()},{passive:d}).on("touchend.eventRect",g=>{s.event=g,!i.empty()&&i.classed(St.eventRect)&&(e.hasArcType()||!e.toggleShape||s.cancelClick)&&s.cancelClick&&(s.cancelClick=!1)},{passive:d}),n.on("touchstart",g=>{s.event=g;const{target:f}=g;f&&f!==i.node()&&o()},{passive:d})},updateEventRect(e,t=!1){const s=this,{state:i,$el:n}=s,{eventReceiver:a,width:o,height:r,rendered:l,resizing:c}=i,u=e||n.eventRect,d=()=>{if(a){const h=ms(n.chart.node());a.rect=ct(u.node(),!0).toJSON(),a.rect.top+=h.y,a.rect.left+=h.x}};(!l||c||t)&&(u.attr("x",0).attr("y",0).attr("width",o).attr("height",r),(!l||t)&&u.classed(St.eventRect,!0)),d()},updateEventType(e){const t=this,s=ze(e),i=s?t.$el.eventRect:e,n=s?e!==(i==null?void 0:i.datum().multipleX):!1;i&&(n&&(i==null||i.on("mouseover mousemove mouseout click",null)),t.isMultipleX()?t.generateEventRectsForMultipleXs(i):t.generateEventRectsForSingleX(i))},updateEventRectData(){const e=this,{config:t,scale:s,state:i}=e,n=s.zoom||s.x,a=t.axis_rotated,o=e.isMultipleX();let r,l,c,u;if(e.updateEventType(o),o)r=0,l=0,c=i.width,u=i.height;else{let g,f;if(e.axis.isCategorized())g=e.getEventRectWidth(),f=p=>n(p.x)-g/2;else{const p=({index:_})=>({prev:e.getPrevX(_),next:e.getNextX(_)});g=_=>{const x=p(_),m=n.domain();let y;return x.prev===null&&x.next===null?y=a?i.height:i.width:x.prev===null?y=(n(x.next)+n(_.x))/2:x.next===null?y=n(m[1])-(n(x.prev)+n(_.x))/2:(Object.keys(x).forEach(($,v)=>{var b;x[$]=(b=x[$])!=null?b:m[v]}),y=Math.max(0,(n(x.next)-n(x.prev))/2)),y},f=_=>{const x=p(_);let m;return x.prev===null&&x.next===null?m=0:x.prev===null?m=n(n.domain()[0]):m=(n(_.x)+n(x.prev))/2,m}}r=a?0:f,l=a?f:0,c=a?i.width:g,u=a?g:i.height}const{eventReceiver:d}=i,h=(g,f)=>k(g)?g(f):g;d.coords.splice(d.data.length),d.data.forEach((g,f)=>{d.coords[f]={x:h(r,g),y:h(l,g),w:h(c,g),h:h(u,g)}})},selectRectForSingle(e,t){var s,i;const n=this,{config:a,$el:{main:o,circle:r}}=n,l=a.data_selection_enabled,c=a.data_selection_grouped,u=a.data_selection_isselectable,d=a.tooltip_grouped,h=n.getAllValuesOnIndex(t);if(d&&(n.showTooltip(h,e),(s=n.showGridFocus)==null||s.call(n,h),!l||c))return;!r&&o.selectAll(`.${D.EXPANDED}:not(.${it.shape}-${t})`).classed(D.EXPANDED,!1);const g=o.selectAll(`.${it.shape}-${t}`).classed(D.EXPANDED,!0).style("cursor",u?"pointer":null).filter(function(f){return n.isWithinShape(this,f)});g.empty()&&!d&&a.interaction_onout&&((i=n.hideGridFocus)==null||i.call(n),n.hideTooltip(),!c&&n.setExpand(t)),g.call(f=>{var p,_;const x=f.data();l&&(c||u!=null&&u.bind(n.api)(x))&&(e.style.cursor="pointer"),d||(n.showTooltip(x,e),(p=n.showGridFocus)==null||p.call(n,x),(_=n.unexpandCircles)==null||_.call(n),f.each(m=>n.setExpand(t,m.id)))})},selectRectForMultipleXs(e,t=!0){const s=this,{config:i,state:n}=s,a=s.filterTargetsToShow(s.data.targets);if(n.dragging||s.hasArcType(a))return;const o=Tt(n.event,e),r=s.findClosestFromTargets(a,o);if(t&&n.mouseover&&(!r||r.id!==n.mouseover.id)&&(i.data_onout.call(s.api,n.mouseover),n.mouseover=void 0),!r){s.unselectRect();return}const c=(s.isBubbleType(r)||s.isScatterType(r)||!i.tooltip_grouped?[r]:s.filterByX(a,r.x)).map(d=>s.addName(d));s.showTooltip(c,e),s.setExpand(r.index,r.id,!0),s.showGridFocus(c);const u=s.dist(r,o);(s.isBarType(r.id)||u<s.getPointSensitivity(r))&&(s.$el.svg.select(`.${St.eventRect}`).style("cursor","pointer"),t&&(!n.mouseover||n.mouseover.x!==r.x||n.mouseover.id!==r.id)&&(i.data_onover.call(s.api,r),n.mouseover=r))},unselectRect(){const e=this,{$el:{circle:t,tooltip:s}}=e;e.$el.svg.select(`.${St.eventRect}`).style("cursor",null),e.hideGridFocus(),s&&(e.hideTooltip(),e._handleLinkedCharts(!1)),t&&!e.isPointFocusOnly()&&e.unexpandCircles(),e.expandBarTypeShapes(!1)},generateEventRectsForSingleX(e){const t=this,{config:s,state:i}=t,{eventReceiver:n}=i,a=e.style("cursor",s.data_selection_enabled&&s.data_selection_grouped?"pointer":null).on("click",function(o){i.event=o;const{currentIdx:r,data:l}=n,c=l[r===-1?t.getDataIndexFromEvent(o):r];t.clickHandlerForSingleX.bind(this)(c,t)}).datum({multipleX:!1});if(i.inputType==="mouse"){const o=r=>{const l=r?t.getDataIndexFromEvent(r):n.currentIdx;return l>-1?n.data[l]:null};a.on("mouseover",r=>{i.event=r,t.updateEventRect(),Object.values(t.$el.axisTooltip).forEach(l=>l==null?void 0:l.style("display",null))}).on("mousemove",function(r){const l=o(r);if(i.event=r,!l)return;let{index:c}=l;const u=s.line_step_type;if(s.line_step_tooltipMatch&&t.hasType("step")&&/^step\-(before|after)$/.test(u)){const h=t.scale.zoom||t.scale.x,g=t.axis.xs[c],f=h.invert(Tt(r,this)[0]);u==="step-after"&&f<g?c-=1:u==="step-before"&&f>g&&(c+=1)}t.showAxisGridFocus();const d=s.tooltip_grouped&&c===n.currentIdx;if(i.dragging||i.flowing||t.hasArcType()||d){s.tooltip_show&&d&&t.setTooltipPosition();return}c!==n.currentIdx&&(t.setOverOut(!1,n.currentIdx),n.currentIdx=c),c===-1?t.unselectRect():t.selectRectForSingle(this,c),t.setOverOut(c!==-1,c)}).on("mouseout",r=>{i.event=r,!(!s||t.hasArcType()||n.currentIdx===-1||!s.interaction_onout)&&(t.hideAxisGridFocus(),t.unselectRect(),t.setOverOut(!1,n.currentIdx),n.currentIdx=-1)})}return a},clickHandlerForSingleX(e,t){const s=t,{config:i,state:n,$el:{main:a}}=s;if(!e||s.hasArcType()||n.cancelClick){n.cancelClick&&(n.cancelClick=!1);return}const{index:o}=e;a.selectAll(`.${it.shape}-${o}`).each(function(r){var l;(i.data_selection_grouped||s.isWithinShape(this,r))&&((l=s.toggleShape)==null||l.call(s,this,r,o),i.data_onclick.bind(s.api)(r,this))})},generateEventRectsForMultipleXs(e){const t=this,{config:s,state:i}=t;e.on("click",function(n){i.event=n,t.clickHandlerForMultipleXS.bind(this)(t)}).datum({multipleX:!0}),i.inputType==="mouse"&&e.on("mouseover mousemove",function(n){i.event=n,t.selectRectForMultipleXs(this)}).on("mouseout",n=>{i.event=n,!(!t.config||t.hasArcType()||!s.interaction_onout)&&t.unselectRect()})},clickHandlerForMultipleXS(e){const t=e,{config:s,state:i}=t,n=t.filterTargetsToShow(t.data.targets);if(t.hasArcType(n))return;const a=Tt(i.event,this),o=t.findClosestFromTargets(n,a),r=t.getPointSensitivity(o);o&&(t.isBarType(o.id)||t.dist(o,a)<r)&&t.$el.main.selectAll(`.${it.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${it.shape}-${o.index}`).each(function(){var l;(s.data_selection_grouped||t.isWithinShape(this,o))&&((l=t.toggleShape)==null||l.call(t,this,o,o.index),s.data_onclick.bind(t.api)(o,this))})}},ko=Z(12),Po={generateFlow(e){const t=this,{data:s,state:i,$el:n}=t;return function(){const a=e.flow.length;i.flowing=!0,s.targets.forEach(r=>{r.values.splice(0,a)}),t.updateXGrid&&t.updateXGrid(!0);const o={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(r=>{const l=r.split(".");let c=n[l[0]];c&&l.length>1&&(c=c[l[1]]),c!=null&&c.size()&&(o[r]=c)}),t.hideGridFocus(),t.setFlowList(o,e)}},setFlowList(e,t){const s=this,{flow:i,targets:n}=t,{duration:a=t.duration,index:o,length:r,orgDataCount:l}=i,c=s.getFlowTransform(n,l,o,r),u=Ss();let d;u.add(Object.keys(e).map(h=>(d=e[h].transition().ease(ko.easeLinear).duration(a),h==="axis.x"?d=d.call(g=>{s.axis.x.setTransition(g).create(g)}):h==="region.list"?d=d.filter(s.isRegionOnX).attr("transform",c):d=d.attr("transform",c),d))),d.call(u,()=>{s.cleanUpFlow(e,t)})},cleanUpFlow(e,t){const s=this,{config:i,state:n,$el:{svg:a}}=s,o=i.axis_rotated,{flow:r,shape:l,xv:c}=t,{cx:u,cy:d,xForText:h,yForText:g}=l.pos,{done:f=()=>{},length:p}=r;p&&(["circle","text","shape","eventRect"].forEach(_=>{const x=[];for(let m=0;m<p;m++)x.push(`.${G[_]}-${m}`);a.selectAll(`.${G[`${_}s`]}`).selectAll(x).remove()}),a.select(`.${G.xgrid}`).remove()),Object.keys(e).forEach(_=>{const x=e[_];if(_!=="axis.x"&&x.attr("transform",null),_==="grid.x")x.attr(n.xgridAttr);else if(_==="gridLines.x")x.attr("x1",o?0:c).attr("x2",o?n.width:c),x.select("text").attr("x",o?n.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(_))x.attr("d",l.type[_]);else if(_==="text")x.attr("x",h).attr("y",g).style("fill-opacity",s.opacityForText.bind(s));else if(_==="circle")if(s.isCirclePoint())x.attr("cx",u).attr("cy",d);else{const m=$=>u($)-i.point_r,y=$=>d($)-i.point_r;x.attr("x",m).attr("y",y)}else _==="region.list"&&x.select("rect").filter(s.isRegionOnX).attr("x",s.regionX.bind(s)).attr("width",s.regionWidth.bind(s))}),i.interaction_enabled&&s.redrawEventRect(),f.call(s.api),n.flowing=!1},getFlowTransform(e,t,s,i){const n=this,{data:a,scale:{x:o}}=n,r=a.targets[0].values;let l=n.getValueOnIndex(r,s),c=n.getValueOnIndex(r,s+i),u;const d=o.domain(),h=n.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?u=o(d[0])-o(h[0]):u=n.axis.isTimeSeries()?o(d[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?u=o(d[0])-o(h[0]):n.axis.isTimeSeries()?(l=n.getValueOnIndex(r,0),c=n.getValueOnIndex(r,r.length-1),u=o(l.x)-o(c.x)):u=Vt(h)/2;const g=Vt(d)/Vt(h);return`translate(${u},0) scale(${g},1)`}},Oo={initClip(){const e=this,{clip:t,datetimeId:s}=e.state;t.id=`${s}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:s}=t;return!s.clipPath&&/-clip$/.test(e)||!s.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!s.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+a+10:i.bottom)+20,c=o?-(1+r):-(r-1),u=-15,d=o?i.left+20:n+10+r;e.attr("x",c).attr("y",u).attr("width",d).attr("height",l)},setYAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=s.axis_y_inner,c=l&&!o?s.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),u=-(o?20:i.top),d=(o?n+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+a)+10;e.attr("x",c).attr("y",u).attr("width",d).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:s,xAxisHeight:i},$el:{defs:n}}=e,a=e.getHorizontalAxisHeight("x");if(n&&!s.idXAxisTickTexts){const o=`${s.id}-xaxisticktexts`;e.appendClip(n,o),s.pathXAxisTickTexts=e.getClipPath(s.idXAxisTickTexts),s.idXAxisTickTexts=o}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&a!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=a},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:s}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const n=Math.sin(Math.PI/180*Math.abs(i));s.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/n}else s.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:s},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",s.maxTickSize.x.clipPath).attr("height",30)}};const Io=e=>M(e.position)||"end",Do=e=>e.position==="start"?4:e.position==="middle"?0:-4;function si(e,t,s){return i=>{let n=e?0:t;return i.position==="start"?n=e?-s:0:i.position==="middle"&&(n=(e?-s:t)/2),n}}function ii(e,t){t==="grid"&&e.each(function(){const s=(0,R.select)(this);["x1","x2","y1","y2"].forEach(i=>s.attr(i,+s.attr(i)))})}var zo={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:s},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${D.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",s.pathGrid).attr("class",`${st.grid} ${st.gridLines}`),i.gridLines.main.append("g").attr("class",st.xgridLines),i.gridLines.main.append("g").attr("class",st.ygridLines),i.gridLines.x=(0,R.selectAll)([]))},updateXGrid(e){const t=this,{config:s,scale:i,state:n,$el:{main:a,grid:o}}=t,r=s.axis_rotated,l=t.generateGridData(s.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,u=d=>(i.zoom||i.x)(d)+c*(r?-1:1);n.xgridAttr=r?{x1:0,x2:n.width,y1:u,y2:u}:{x1:u,x2:u,y1:0,y2:n.height},o.x=a.select(`.${st.xgrids}`).selectAll(`.${st.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",st.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,R.select)(this);Object.keys(n.xgridAttr).forEach(h=>{d.attr(h,n.xgridAttr[h]).style("opacity",()=>d.attr(r?"y1":"x1")===(r?n.height:0)?"0":null)})})},updateYGrid(){const e=this,{axis:t,config:s,scale:i,state:n,$el:{grid:a,main:o}}=e,r=s.axis_rotated,l=u=>i.y(u),c=t.y.getGeneratedTicks(s.grid_y_ticks)||e.scale.y.ticks(s.grid_y_ticks);a.y=o.select(`.${st.ygrids}`).selectAll(`.${st.ygrid}`).data(c),a.y.exit().remove(),a.y=a.y.enter().append("line").attr("class",st.ygrid).merge(a.y),a.y.attr("x1",r?l:0).attr("x2",r?l:n.width).attr("y1",r?0:l).attr("y2",r?n.height:l),ii(a.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:s}}=e;!s.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:s,$el:{gridLines:i,main:n},$T:a}=t,o=s.axis_rotated,r=e==="x";s[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=n.select(`.${st[`${e}gridLines`]}`).selectAll(`.${st[`${e}gridLine`]}`).data(s[`grid_${e}_lines`]);a(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(u){const d=(0,R.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),a(l.attr("class",u=>`${st[`${e}gridLine`]} ${u.class||""}`.trim()).select("text").attr("text-anchor",Io).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",Do).attr("dy",-5)).text(function(u){var d;return(d=u.text)!=null?d:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:s},state:{width:i,height:n},$el:{gridLines:a},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=a.x.select("line"),u=a.x.select("text"),d=a.y.select("line"),h=a.y.select("text");return c=o(c,e).attr("x1",s?0:r).attr("x2",s?i:r).attr("y1",s?r:0).attr("y2",s?r:n),u=o(u,e).attr("x",si(!s,i,n)).attr("y",r),d=o(d,e).attr("x1",s?l:0).attr("x2",s?l:i).attr("y1",s?0:l).attr("y2",s?n:l),h=o(h,e).attr("x",si(s,i,n)).attr("y",l),[c.style("opacity",null),u.style("opacity",null),d.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:{clip:s},$el:i}=e,n=t.grid_front,a=`.${n&&i.gridLines.main?st.gridLines:D.chart}${n?" + *":""}`,o=i.main.insert("g",a).attr("clip-path",s.pathGrid).attr("class",st.grid);if(i.grid.main=o,t.grid_x_show&&o.append("g").attr("class",st.xgrids),t.grid_y_show&&o.append("g").attr("class",st.ygrids),t.axis_tooltip){const r=o.append("g").attr("class","bb-axis-tooltip");r.append("line").attr("class","bb-axis-tooltip-x"),r.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(o.append("g").attr("class",K.xgridFocus).append("line").attr("class",K.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&o.append("g").attr("class",K.ygridFocus).append("line").attr("class",K.ygridFocus))},showAxisGridFocus(){var e,t;const s=this,{config:i,format:n,state:{event:a,width:o,height:r}}=s,l=i.axis_rotated,[c,u]=Tt(a,(e=s.$el.eventRect)==null?void 0:e.node()),d={x:c,y:u};for(const[h,g]of Object.entries(s.$el.axisTooltip)){const f=h==="x"&&!l||h!=="x"&&l?"x":"y",p=d[f];let _=(t=s.scale[h])==null?void 0:t.invert(p);_&&(_=h==="x"&&s.axis.isTimeSeries()?n.xAxisTick(_):_==null?void 0:_.toFixed(2),g==null||g.attr(f,p).text(_))}s.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,g){const f=(0,R.select)(this);g===0?f.attr("x1",c).attr("x2",c).attr("y1",g?0:r).attr("y2",g?r:0):f.attr("x1",g?0:o).attr("x2",g?o:0).attr("y1",u).attr("y2",u)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll(`line.${ot.axisTooltipX}, line.${ot.axisTooltipY}`).style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const s=this,{config:i,state:{width:n,height:a}}=s,o=i.axis_rotated,r=s.$el.main.selectAll(`line.${K.xgridFocus}, line.${K.ygridFocus}`),l=(e||[r.datum()]).filter(d=>d&&M(s.getBaseValue(d)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&s.hasType("bubble")||s.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,u=s.xx.bind(s);r.style("visibility",null).data(l.concat(l)).each(function(d){const h=(0,R.select)(this),g={x:u(d),y:s.getYScaleById(d.id)(d.value)};let f;if(h.classed(K.xgridFocus))f=o?[null,g.x,c?g.y:n,g.x]:[g.x,c?g.y:null,g.x,a];else{const p=s.axis.getId(d.id)==="y2";f=o?[g.y,c&&!p?g.x:null,g.y,c&&p?g.x:a]:[c&&p?g.x:null,g.y,c&&!p?g.x:n,g.y]}["x1","y1","x2","y2"].forEach((p,_)=>h.attr(p,f[_]))}),ii(r,"grid"),(t=s.showCircleFocus)==null||t.call(s,e)},hideGridFocus(){var e;const t=this,{state:{inputType:s,resizing:i},$el:{main:n}}=t;(s==="mouse"||!i)&&(n.selectAll(`line.${K.xgridFocus}, line.${K.ygridFocus}`).style("visibility","hidden"),(e=t.hideCircleFocus)==null||e.call(t))},updateGridFocus(){var e;const t=this,{state:{inputType:s,width:i,height:n,resizing:a},$el:{grid:o}}=t,r=o.main.select(`line.${K.xgridFocus}`);if(s==="touch")r.empty()?a&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:n)}return!0},generateGridData(e,t){const s=this,i=s.$el.main.select(`.${ot.axisX}`).selectAll(".tick").size();let n=[];if(e==="year"){const a=s.getXDomain(),[o,r]=a.map(l=>l.getFullYear());for(let l=o;l<=r;l++)n.push(new Date(`${l}-01-01 00:00:00`))}else n=t.ticks(10),n.length>i&&(n=n.filter(a=>String(a).indexOf(".")<0));return n},getGridFilterToRemove(e){return e?t=>{let s=!1;return(V(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(s=!0)}),s}:()=>!0},removeGridLines(e,t){const s=this,{config:i,$T:n}=s,a=s.getGridFilterToRemove(e),o=u=>!a(u),r=t?st.xgridLines:st.ygridLines,l=t?st.xgridLine:st.ygridLine;n(s.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(a)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},Fo={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",he.regions)},updateRegion(){const e=this,{config:t,$el:{region:s},$T:i}=e;s.main||e.initRegion(),s.main.style("visibility",e.hasArcType()?"hidden":null);const n=s.main.selectAll(`.${he.region}`).data(t.regions);i(n.exit()).style("opacity","0").remove();const a=n.enter().append("g");a.append("rect").style("fill-opacity","0"),s.list=a.merge(n).attr("class",e.classRegion.bind(e)),s.list.each(function(o){var r;(0,R.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,R.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:s},$T:i}=t,n=t.regionX.bind(t),a=t.regionY.bind(t),o=["width","height"];let r=s.list.select("rect"),l=s.list.selectAll("text");return r=i(r,e).attr("x",n).attr("y",a).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),l=i(l,e).text(c=>{var u;return(u=c.label)==null?void 0:u.text}).attr("transform",({label:c})=>c.rotated?" rotate(-90)":null).attr("transform",function(c){var u;const{x:d=0,y:h=0,center:g=!1,rotated:f=!1}=(u=c.label)!=null?u:{},p=this.previousElementSibling,_={x:0,y:0};return B(g)&&["x","y"].forEach((x,m)=>{g.indexOf(x)>-1&&(_[x]=(+p.getAttribute(o[m])-ct(this)[o[m]])/2)}),`translate(${n(c)+_.x+d}, ${a(c)+_.y+h})${f?" rotate(-90)":""}`}).attr("text-anchor",({label:c})=>c!=null&&c.rotated?"end":null).attr("dy","1em").style("fill",({label:c})=>{var u;return(u=c==null?void 0:c.color)!=null?u:null}),[r.style("fill-opacity",c=>M(c.opacity)?c.opacity:null).on("end",function(){(0,R.select)(this.parentNode).selectAll("rect:not([x])").remove()}),l.style("opacity",null)]},regionX(e){return this.getRegionSize("x",e)},regionY(e){return this.getRegionSize("y",e)},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},getRegionSize(e,t){const s=this,{config:i,scale:n,state:a}=s,o=i.axis_rotated,r=/(x|y|y2)/.test(e),l=r?e==="x":e==="width",c=!r&&s[l?"regionX":"regionY"](t);let u=r?"start":"end",d=r?0:a[e],h;if(t.axis==="y"||t.axis==="y2"?(!r&&!l?u="start":r&&!l&&(u="end"),(l?o:!o)&&u in t&&(h=n[t.axis])):(l?!o:o)&&u in t&&(h=n.zoom||n.x),h){let g=0;d=t[u],s.axis.isTimeSeries(t.axis)?d=At.call(s,d):/(x|width)/.test(e)&&s.axis.isCategorized()&&isNaN(d)&&(d=i.axis_x_categories.indexOf(d),g=s.axis.x.tickOffset()*(u==="start"?-1:1)),d=h(d)+g}return r?d:d<c?0:d-c},isRegionOnX(e){return!e.axis||e.axis==="x"}},Mo={getAxisSize(e){const t=this,s=t.config.axis_rotated;return s&&e==="x"||!s&&/y2?/.test(e)?t.getAxisWidthByAxisId(e,!0):t.getHorizontalAxisHeight(e)},getAxisWidthByAxisId(e,t){var s,i;const n=this;if(n.axis){const a=(s=n.axis)==null?void 0:s.getLabelPositionById(e),{width:o}=n.axis.getMaxTickSize(e,t),r=o===0?.5:0;return o+(((i=n.config.padding)==null?void 0:i.mode)==="fit"?a.isInner?10+r:10:a.isInner?20+r:40)}else return 40},getHorizontalAxisHeight(e){var t,s;const i=this,{config:n,state:a}=i,{rotatedPadding:o,isLegendRight:r,isLegendInset:l}=a,c=n.axis_rotated,u=((t=n.padding)==null?void 0:t.mode)==="fit",d=n[`axis_${e}_inner`],h=n[`axis_${e}_label`].text,g=13;let f=((s=n.padding)==null?void 0:s.mode)==="fit"?d&&!h?e==="y"?1:0:20:30;if(e==="x"&&!n.axis_x_show)return 8;if(e==="x"&&I(n.axis_x_height))return n.axis_x_height;if(e==="y"&&!n.axis_y_show)return n.legend_show&&!r&&!l?10:1;if(e==="y2"&&!n.axis_y2_show)return u?0:o.top;const p=i.axis.getMaxTickSize(e),_=Math.abs(n.axis_x_tick_rotate)>0&&(!n.axis_x_tick_autorotate||i.needToRotateXAxisTickTexts());return(n.axis_x_tick_multiline||_)&&p.height>g&&(f+=p.height-g),f+(i.axis.getLabelPositionById(e).isInner?0:10)+(e==="y2"&&!c?-10:0)},getEventRectWidth(){const e=this,{config:t,axis:s}=e,i=t.axis_x_inverted,n=s.x.tickInterval();return Math.max(0,i?Math.abs(n):n)},getAxisTickRotate(e){const t=this,{axis:s,config:i,state:n,$el:a}=t;let o=i[`axis_${e}_tick_rotate`];if(e==="x"){const r=s.isCategorized()||s.isTimeSeries();if(i.axis_x_tick_fit&&r){const l=i.axis_x_tick_count,c=n.current.maxTickSize.x.ticks.length;let u=0;if(l?u=l>c?c:l:c&&(u=c),u!==n.axis.x.tickCount){const{targets:d}=t.data;n.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(d,"min"),t.getXDomainMinMax(d,"max")],u)}n.axis.x.tickCount=u}a.svg&&i.axis_x_tick_autorotate&&i.axis_x_tick_fit&&!i.axis_x_tick_multiline&&!i.axis_x_tick_culling&&r&&(o=t.needToRotateXAxisTickTexts()?i.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const e=this,{state:{axis:t,current:s,isLegendRight:i,legendItemWidth:n}}=e,a=i&&n,o=s.width-a-e.getCurrentPaddingByDirection("left")-e.getCurrentPaddingByDirection("right"),r=t.x.tickCount+t.x.padding.left+t.x.padding.right,{width:l}=e.axis.getMaxTickSize("x"),c=r?o/r:0;return l>c}},Xo={axis_x_clipPath:!0,axis_x_show:!0,axis_x_forceAsSingle:!1,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_culling_lines:!0,axis_x_tick_culling_reverse:!1,axis_x_tick_count:void 0,axis_x_tick_inner:!1,axis_x_tick_show:!0,axis_x_tick_text_show:!0,axis_x_tick_text_inner:!1,axis_x_tick_text_position:{x:0,y:0},axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_autorotate:!1,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_tick_tooltip:!1,axis_x_max:void 0,axis_x_min:void 0,axis_x_inverted:!1,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_x_axes:[]},Bo={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_culling_reverse:!1,axis_y_tick_inner:!1,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},No={axis_y2_clipPath:!0,axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_culling_reverse:!1,axis_y2_tick_inner:!1,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]},Go=Object.defineProperty,ni=Object.getOwnPropertySymbols,Vo=Object.prototype.hasOwnProperty,Yo=Object.prototype.propertyIsEnumerable,ai=(e,t,s)=>t in e?Go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,qe=(e,t)=>{for(var s in t||(t={}))Vo.call(t,s)&&ai(e,s,t[s]);if(ni)for(var s of ni(t))Yo.call(t,s)&&ai(e,s,t[s]);return e},jo=qe(qe(qe({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},Xo),Bo),No),Ho={grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:void 0,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0},Wo={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const Uo=[go,fo,po,xo,_o,mo,yo],oi={axis:Co,clip:Oo,eventrect:Lo,flow:Po,grid:zo,region:Fo,sizeAxis:Mo},ri={optDataAxis:Wo,optAxis:jo,optGrid:Ho};var li=Z(13);const Zo=15,ci=20,di=.35;function qo(e=!1){const t=this;return["donut","pie","polar","gauge"].find(s=>t.hasType(s)&&!(s==="gauge"&&e&&t.hasMultiArcGauge()))}function ui(){const e=this,{config:t}=e,s=qo.call(e,!0),i=s&&t[`${s}_label_line`],n=bt(i),a=(l,c,u)=>u,o={show:i===!0||n&&(i==null?void 0:i.show)!==!1,distance:n&&(i==null?void 0:i.distance)||ci};if(i===!0)return{chartType:s,line:o,text:{formatter:a}};if(!n)return{chartType:s,line:{show:!1,distance:ci},text:{formatter:null}};let r=a;return k(i.text)?r=i.text:i.text===!1&&(r=null),{chartType:s,line:o,text:{formatter:r}}}function Ko(e,t){const s=this,{state:i}=s,n=s.updateAngle(e);if(!n)return null;let{outerRadius:a}=s.getRadius(e),o=a;s.hasType("polar")&&(o=s.getPolarOuterRadius(e,a),a=i.radius);let r=(n.startAngle+n.endAngle)/2;Math.abs(n.endAngle-n.startAngle-2*Math.PI)<.01&&(r=Math.PI/2);const c=Math.sin(r),u=-Math.cos(r),d={x:c*o,y:u*o},h=a+Zo,g={x:c*h,y:u*h},f=c>=0,p={x:g.x+t*(f?1:-1),y:g.y};return{startPoint:d,breakPoint:g,endPoint:p,isRight:f,midAngle:r}}function hi(){return ui.call(this).line.show}function Jo(e){const t=this,{$el:{arcs:s},$T:i}=t,{line:n,text:a}=ui.call(t),o=n.distance;let r=null;s.selectAll(`.${X.chartArc}`).each(function(l){var c,u,d;const h=(0,R.select)(this),g=Ko.call(t,l,o),{ratio:f,meetsThreshold:p,updated:_}=(c=l._cache)!=null?c:{};if(!_||!g)return;const x=t.isTargetToShow(l.data.id)&&p,{startPoint:m,breakPoint:y,endPoint:$,isRight:v}=g,b=`${m.x},${m.y} ${y.x},${y.y} ${$.x},${$.y}`;if(n.show){let C=h.select(`.${X.arcLabelLine}`);C.empty()&&(C=h.append("polyline").attr("class",X.arcLabelLine)),i(C,e).attr("points",b).style("stroke",t.color(l.data)).style("opacity",x?null:"0")}let T=h.select(`.${X.arcLabelLineText}`);if(T.empty()&&(T=h.append("text").attr("class",X.arcLabelLineText).style("pointer-events","none")),x){const{value:C}=_,{id:w}=l.data,S=((d=(u=a.formatter)!=null?u:t.getArcLabelConfig("format"))!=null?d:t.defaultArcValueFormat)(C,f,w).toString();Qt(T,S,[-1,1],!1);const A={x:$.x+5*(v?1:-1),y:$.y};T.style("text-anchor",v?"start":"end");const O=T.node(),E=O==null?void 0:O.querySelectorAll("tspan");if(r===null&&(r=parseFloat(j.getComputedStyle(O).fontSize)||12),E&&E.length>1){const F=(E.length-3)/2;A.y+=(-F+di)*r}else A.y+=di*r;i(T,e).attr("transform",`translate(${A.x},${A.y})`).style("opacity",null).style("fill",t.updateTextColor.bind(t)(l))}else i(T,e).style("opacity","0")})}var Qo=Object.defineProperty,tr=Object.defineProperties,er=Object.getOwnPropertyDescriptors,gi=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,fi=(e,t,s)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,nr=(e,t)=>{for(var s in t||(t={}))sr.call(t,s)&&fi(e,s,t[s]);if(gi)for(var s of gi(t))ir.call(t,s)&&fi(e,s,t[s]);return e},ar=(e,t)=>tr(e,er(t));function or(e){return["donut","pie","polar","gauge"].find(t=>e.hasType(t))}function rr(e,t,s,i){var n,a;const{config:o,state:{radiusExpanded:r}}=e,l=s.endAngle-Math.PI/2,c=Math.sin(l),u={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const d=o.arc_rangeText_position;if(d){const h=o.arc_rangeText_values,g=k(d)?d(h[t.index]):d;u.x+=(n=g==null?void 0:g.x)!=null?n:0,u.y+=(a=g==null?void 0:g.y)!=null?a:0}}return u}function lr(e,t,s,i){const{config:n}=e,a=or(e);let o=a?n[`${a}_label_ratio`]:void 0;if(o)o=k(o)?o.bind(e.api)(t,s,i):o;else{const d=36/s,h=d>.375;o=s&&i?(h?1.175-d:.8)*s/i:0}return o}function cr(e,t,s){let{outerRadius:i}=e.getRadius(t);e.hasType("polar")&&(i=e.getPolarOuterRadius(t,i));const[n,a]=e.svgArc.centroid(s).map(l=>isNaN(l)?0:l),o=Math.sqrt(n*n+a*a),r=lr(e,t,i,o);return{pos:{x:n,y:a},ratio:r}}function pi(e=0){const t=this,{config:s,state:i}=t,n=t.hasMultiArcGauge(),a=i.gaugeArcWidth/t.filterTargetsToShow(t.data.targets).length,o=e?Math.min(i.radiusExpanded*e-i.radius,a*.8-(1-e)*100):0;return{inner(r){const{innerRadius:l}=t.getRadius(r);return n?i.radius-a*(r.index+1):I(l)?l:0},outer(r){const{outerRadius:l}=t.getRadius(r);let c;if(n)c=i.radius-a*r.index+o;else if(t.hasType("polar")&&!e)c=t.getPolarOuterRadius(r,l);else if(c=l,e){let{radiusExpanded:u}=i;i.radius!==l&&(u-=Math.abs(i.radius-l)),c=u*e}return c},corner(r,l){const{arc_cornerRadius_ratio:c=0,arc_cornerRadius:u=0}=s,{data:{id:d},value:h}=r;let g=0;return c?g=c*l:g=I(u)?u:u.call(t.api,d,h,l),g}}}function Ke(e){return function(t){const s=({startAngle:n=0,endAngle:a=0,padAngle:o=0})=>({startAngle:n,endAngle:a,padAngle:o}),i=(0,li.interpolate)(s(this._current),s(t));return this._current=t,function(n){const a=i(n),{data:o,index:r,value:l}=t;return e(ar(nr({},a),{data:o,index:r,value:l}))}}}var dr={initPie(){const e=this,{config:t}=e,s=t.data_type,i=t[`${s}_padding`],n=t[`${s}_startingAngle`]||0,a=(i?i*.01:t[`${s}_padAngle`])||0;e.pie=(0,tt.pie)().startAngle(n).endAngle(n+2*Math.PI).padAngle(a).value(o=>{var r,l;return(l=(r=o.values)==null?void 0:r.reduce((c,u)=>c+u.value,0))!=null?l:o}).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius(){const e=this,{config:t,state:s}=e,i=t.data_type,n=t[`${i}_padding`],a=t.gauge_width||t.donut_width,o=e.filterTargetsToShow(e.data.targets).length*t.gauge_arcs_minWidth,r=.85,l=hi.call(e)?r:1;s.radiusExpanded=Math.min(s.arcWidth,s.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?r:l),s.radius=s.radiusExpanded*.95,s.innerRadiusRatio=a?(s.radius-a)/s.radius:.6,s.gaugeArcWidth=a||(o<=s.radius-s.innerRadius?s.radius-s.innerRadius:o<=s.radius?o:s.radius);const c=t.pie_innerRadius||(n?n*(s.innerRadiusRatio+.1):0);s.outerRadius=t.pie_outerRadius,s.innerRadius=e.hasType("donut")||e.hasType("gauge")?s.radius*s.innerRadiusRatio:c},getRadius(e){const t=this,s=e==null?void 0:e.data;let{innerRadius:i,outerRadius:n}=t.state;return!I(i)&&s&&(i=i[s.id]||0),N(n)&&s&&s.id in n?n=n[s.id]:I(n)||(n=t.state.radius),{innerRadius:i,outerRadius:n}},updateArc(){const e=this;e.updateRadius(),e.svgArc=e.getSvgArc(),e.svgArcExpanded=e.getSvgArcExpanded()},getArcLength(){const e=this,{config:t}=e,s=t.gauge_arcLength*3.6;let i=2*(s/360);return s<-360?i=-2:s>360&&(i=2),i*Math.PI},getStartingAngle(){const e=this,{config:t}=e,s=t.data_type,i=e.hasType("gauge")?t.gauge_fullCircle:!1,n=-1*Math.PI/2,a=Math.PI/2;let o=t[`${s}_startingAngle`]||0;return!i&&o<=n?o=n:!i&&o>=a?o=a:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(e,t=!1){var s;const i=this,{config:n,state:a}=i,o=t&&i.hasType("gauge");let{pie:r}=i,l=e,c=!1;if(!n)return null;const u=i.getStartingAngle(),d=n.gauge_fullCircle||t&&!o?i.getArcLength():u*-2;if(l.data&&i.isGaugeType(l.data)&&!i.hasMultiArcGauge()){const{gauge_min:h,gauge_max:g}=n,f=i.getTotalDataSum(a.rendered),p=d*((f-h)/(g-h));r=r.startAngle(u).endAngle(p+u)}if(t===!1&&r(i.filterTargetsToShow()).forEach((h,g)=>{var f;!c&&h.data.id===((f=l.data)==null?void 0:f.id)&&(c=!0,l=h,l.index=g)}),isNaN(l.startAngle)&&(l.startAngle=0),isNaN(l.endAngle)&&(l.endAngle=l.startAngle),t||l.data&&(n.gauge_enforceMinMax||i.hasMultiArcGauge())){const{gauge_min:h,gauge_max:g}=n,f=t&&!o?i.getTotalDataSum(a.rendered):g,p=d/(f-h),_=(s=l.value)!=null?s:0,x=_<h?0:_<f?_-h:f-h;l.startAngle=u,l.endAngle=u+p*x}return c||t?l:null},getSvgArc(){const e=this,{inner:t,outer:s,corner:i}=pi.call(e),n=(0,tt.arc)().innerRadius(t).outerRadius(s),a=function(o,r){var l;let c="M 0 0";if(o.value||o.data){const u=r?o:(l=e.updateAngle(o))!=null?l:null;u&&(c=n.cornerRadius(i(u,s(u)))(u))}return c};return a.centroid=n.centroid,a},getSvgArcExpanded(e=1){const t=this,{inner:s,outer:i,corner:n}=pi.call(t,e),a=(0,tt.arc)().innerRadius(s).outerRadius(i);return o=>{const r=t.updateAngle(o),l=i(r);let c=0;return r&&(c=n(r,l)),r?a.cornerRadius(c)(r):"M 0 0"}},getArc(e,t,s){return s||this.isArcType(e.data)?this.svgArc(e,t):"M 0 0"},redrawArcRangeText(){const e=this,{config:t,$el:{arcs:s},state:i,$T:n}=e,a=t.arc_rangeText_format,o=e.hasType("gauge")&&t.arc_rangeText_fixed;let r=t.arc_rangeText_values;if(r!=null&&r.length){const l=t.arc_rangeText_unit==="%",c=e.getTotalDataSum(i.rendered);l&&(r=r.map(h=>c/100*h));const u=e.pie(r).map((h,g)=>(h.index=g,h));let d=s.selectAll(`.${X.arcRange}`).data(r);d.exit(),d=n(d.enter().append("text").attr("class",X.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const g=l?h/c*100:h;return k(a)?a(g):`${g}${l?"%":""}`}).merge(d)),(!i.rendered||i.rendered&&!o)&&c>0&&d.attr("transform",function(h,g){return e.transformForArcLabel(this,u[g],!0)}),d.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t,s=!1){const i=this,n=i.updateAngle(t,s);if(!n)return"";let a,o=1;if(s||i.hasMultiArcGauge())a=rr(i,t,n,s);else if(!i.hasType("gauge")||i.data.targets.length>1){const r=cr(i,t,n);a=r.pos,o=r.ratio}else return"";return Ds.call(i,e,a),`translate(${a.x*o},${a.y*o})`},convertToArcData(e){return this.addName({id:"data"in e?e.data.id:e.id,value:e.value,ratio:this.getRatio("arc",e),index:e.index})},textForArcLabel(e){var t;const s=this,i=s.hasType("gauge"),n=(t=["donut","gauge","pie","polar"].filter(s.hasType.bind(s)))==null?void 0:t[0];s.shouldShowArcLabel()&&e.style("fill",s.updateTextColor.bind(s)).attr("filter",a=>s.updateTextBGColor.bind(s)(a,s.config.data_labels_backgroundColors)).each(function(a){const o=(0,R.select)(this),r=s.updateAngle(a),l=s.getRatio("arc",r),c=Ue.call(s,l,n);if(a._cache={updated:r,ratio:l,meetsThreshold:c},c){const{value:u}=r||a,d=(s.getArcLabelConfig("format")||s.defaultArcValueFormat)(u,l,a.data.id).toString();Qt(o,d,[-1,1],i)}else o.text("")})},expandArc(e){const t=this,{state:{transiting:s},$el:i}=t;if(s){const a=setInterval(()=>{s||(clearInterval(a),i.legend.selectAll(`.${K.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const n=t.mapToTargetIds(e);i.svg.selectAll(t.selectorTargets(n,`.${X.chartArc}`)).each(function(a){if(!t.shouldExpand(a.data.id))return;const o=t.getExpandConfig(a.data.id,"duration"),r=t.getSvgArcExpanded(t.getExpandConfig(a.data.id,"rate"));(0,R.select)(this).selectAll("path").transition().duration(o).attrTween("d",Ke(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",Ke(r.bind(t)))})},unexpandArc(e){const t=this,{state:{transiting:s},$el:{svg:i}}=t;if(s)return;const n=t.mapToTargetIds(e);i.selectAll(t.selectorTargets(n,`.${X.chartArc}`)).selectAll("path").transition().duration(a=>t.getExpandConfig(a.data.id,"duration")).attrTween("d",Ke(t.svgArc.bind(t))),i.selectAll(`${X.arc}`).style("opacity",null)},getExpandConfig(e,t){const s=this,{config:i}=s,n={duration:50,rate:.98};let a;return s.isDonutType(e)?a="donut":s.isGaugeType(e)?a="gauge":s.isPieType(e)&&(a="pie"),a?i[`${a}_expand_${t}`]:n[t]},shouldExpand(e){const t=this,{config:s}=t;return t.isDonutType(e)&&s.donut_expand||t.isGaugeType(e)&&s.gauge_expand||t.isPieType(e)&&s.pie_expand},shouldShowArcLabel(){const e=this,{config:t}=e;return["donut","gauge","pie","polar"].some(s=>e.hasType(s)&&t[`${s}_label_show`])},getArcLabelConfig(e="format"){const t=this,{config:s}=t;let i=n=>n;return["donut","gauge","pie","polar"].filter(t.hasType.bind(t)).forEach(n=>{i=s[`${n}_label_${e}`]}),e==="format"&&k(i)?i.bind(t.api):i},updateTargetsForArc(e){const t=this,{$el:s}=t,i=t.hasType("gauge"),n=t.getChartClass("Arc"),a=t.getClass("arcs",!0),o=t.classFocus.bind(t),r=s.main.select(`.${X.chartArcs}`),l=r.selectAll(`.${X.chartArc}`).data(t.pie(e)).attr("class",u=>n(u)+o(u.data)),c=l.enter().append("g").attr("class",n).call(this.setCssRule(!1,`.${X.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));c.append("g").attr("class",a).merge(l),c.append("text").attr("dy",i&&!t.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",t.getStylePropValue("middle")).style("pointer-events",t.getStylePropValue("none")),s.text=r.selectAll(`.${D.target} text`)},initArc(){const e=this,{$el:t}=e;t.arcs=t.main.select(`.${D.chart}`).append("g").attr("class",X.chartArcs).attr("transform",e.getTranslate("arc")),e.setArcTitle()},setArcTitle(e){const t=this,s=e||t.getArcTitle(),i=t.hasType("gauge");if(s){const n=i?$t.chartArcsGaugeTitle:X.chartArcsTitle;let a=t.$el.arcs.select(`.${n}`);a.empty()&&(a=t.$el.arcs.append("text").attr("class",n).style("text-anchor","middle")),i&&a.attr("dy","-0.3em"),Qt(a,s,i?void 0:[-.6,1.35],!0)}},getArcTitle(){const e=this,t=e.hasType("donut")&&"donut"||e.hasType("gauge")&&"gauge";return t?e.config[`${t}_title`]:""},getArcTitleWithNeedleValue(){const e=this,{config:t,state:s}=e,i=e.getArcTitle();if(i&&e.config.arc_needle_show&&/{=[A-Z_]+}/.test(i)){let n=s.current.needle;return I(n)||(n=t.arc_needle_value),ge(i,{NEEDLE_VALUE:~~n})}return!1},redrawArc(e,t,s){const i=this,{config:n,state:a,$el:{main:o}}=i,r=n.interaction_enabled,l=r&&n.data_selection_isselectable;let c=o.selectAll(`.${X.arcs}`).selectAll(`.${X.arc}`).data(i.arcData.bind(i));c.exit().transition().duration(t).style("opacity","0").remove(),c=c.enter().append("path").attr("class",i.getClass("arc",!0)).style("fill",u=>i.color(u.data)).style("cursor",u=>{var d;return(d=l==null?void 0:l.bind)!=null&&d.call(l,i.api)(u)?"pointer":null}).style("opacity","0").each(function(u){i.isGaugeType(u.data)&&(u.startAngle=n.gauge_startingAngle,u.endAngle=n.gauge_startingAngle),this._current=u}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",u=>!i.isGaugeType(u.data)&&s?"scale(0)":"").style("opacity",function(u){return u===this._current?"0":null}).each(()=>{a.transiting=!0}).transition().duration(e).attrTween("d",function(u){const d=i.updateAngle(u);if(!d)return()=>"M 0 0";isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const h=(0,li.interpolate)(this._current,d);return this._current=h(0),function(g){const f=h(g);return f.data=u.data,i.getArc(f,!0)}}).attr("transform",s?"scale(1)":"").style("fill",u=>{let d;return i.levelColor?(d=i.levelColor(u.data.values[0].value),n.data_colors[u.data.id]=d):d=i.color(u.data),d}).style("opacity",null).call(Ae,function(){if(i.levelColor){const u=(0,R.select)(this),d=u.datum(this._current);i.updateLegendItemColor(d.data.id,u.style("fill"))}a.transiting=!1,J(n.onrendered,i.api)}),r&&i.bindArcEvent(c),i.hasType("polar")&&i.redrawPolar(),i.hasType("gauge")&&i.redrawBackgroundArcs(),n.arc_needle_show&&i.redrawNeedle(),i.redrawArcText(e),i.redrawArcRangeText()},redrawNeedle(){const e=this,{$el:t,config:s,state:{hiddenTargetIds:i,radius:n}}=e,a=(n-1)/100*s.arc_needle_length,o=i.length!==e.data.targets.length;let r=e.$el.arcs.select(`.${X.needle}`);const l=s.arc_needle_path,c=s.arc_needle_bottom_width/2,u=s.arc_needle_top_width/2,d=s.arc_needle_top_rx,h=s.arc_needle_top_ry,g=s.arc_needle_bottom_len,f=s.arc_needle_bottom_rx,p=s.arc_needle_bottom_ry,_=e.getNeedleAngle(),x=()=>{const m=e.getArcTitleWithNeedleValue();m&&e.setArcTitle(m)};if(x(),r.empty()&&(r=t.arcs.append("path").classed(X.needle,!0),t.needle=r,t.needle.updateHelper=(m,y=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(Ae,()=>{y&&(s.arc_needle_value=m),x()})}),o){const m=k(l)?l.call(e,a):`M-${c} ${g} A${f} ${p} 0 0 0 ${c} ${g} L${u} -${a} A${d} ${h} 0 0 0 -${u} -${a} L-${c} ${g} Z`;e.$T(r).attr("d",m).style("fill",s.arc_needle_color).style("display",null).style("transform",`rotate(${_}deg)`)}else r.style("display","none")},getNeedleAngle(e){const t=this,{config:s,state:i}=t,n=t.getArcLength(),a=t.hasType("gauge"),o=t.getTotalDataSum(!0);let r=W(e)?e:s.arc_needle_value,l=s[`${s.data_type}_startingAngle`]||0,c=0;if(I(r)||(r=a&&t.data.targets.length===1?o:0),i.current.needle=r,a){l=t.getStartingAngle();const u=s.gauge_fullCircle?n:l*-2,{gauge_min:d,gauge_max:h}=s;c=u*((r-d)/(h-d))}else c=n*(r/o);return(l+c)*(180/Math.PI)},redrawBackgroundArcs(){const e=this,{config:t,state:s}=e,i=e.hasMultiArcGauge(),n=t.gauge_fullCircle,a=e.filterTargetsToShow(e.data.targets).length===0&&!!t.data_empty_label_text,o=e.getStartingAngle(),r=n?o+e.getArcLength():o*-1;let l=e.$el.arcs.select(`${i?"g":""}.${X.chartArcsBackground}`);if(i){let c=0;l=l.selectAll(`path.${X.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(u,d)=>`${X.chartArcsBackground} ${X.chartArcsBackground}-${d}`).merge(l).style("fill",t.gauge_background||null).attr("d",({id:u})=>{if(a||s.hiddenTargetIds.indexOf(u)>=0)return"M 0 0";const d={data:[{value:t.gauge_max}],startAngle:o,endAngle:r,index:c++};return e.getArc(d,!0,!0)}),l.exit().remove()}else l.attr("d",a?"M 0 0":()=>{const c={data:[{value:t.gauge_max}],startAngle:o,endAngle:r};return e.getArc(c,!0,!0)})},bindArcEvent(e){const t=this,{config:s,state:i}=t,n=i.inputType==="touch",a=i.inputType==="mouse";function o(l,c,u){t.expandArc(u),t.api.focus(u),t.toggleFocusLegend(u,!0),t.showTooltip([c],l)}function r(l){const c=(l==null?void 0:l.id)||void 0;t.unexpandArc(c),t.api.revert(),t.revertLegend(),t.hideTooltip()}if(e.on("click",function(l,c,u){var d;const h=t.updateAngle(c);let g;h&&(g=t.convertToArcData(h),(d=t.toggleShape)==null||d.call(t,this,g,u),s.data_onclick.bind(t.api)(g,this))}),a&&e.on("mouseover",function(l,c){if(i.transiting)return;i.event=l;const u=t.updateAngle(c),d=u?t.convertToArcData(u):null,h=(d==null?void 0:d.id)||void 0;o(this,d,h),t.setOverOut(!0,d)}).on("mouseout",(l,c)=>{if(i.transiting||!s.interaction_onout)return;i.event=l;const u=t.updateAngle(c),d=u?t.convertToArcData(u):null;r(),t.setOverOut(!1,d)}).on("mousemove",function(l,c){const u=t.updateAngle(c),d=u?t.convertToArcData(u):null;i.event=l,t.showTooltip([d],this)}),n&&t.hasArcType()&&!t.radars){const l=c=>{var u,d;const{clientX:h,clientY:g}=(d=(u=c.changedTouches)==null?void 0:u[0])!=null?d:{clientX:0,clientY:0};return(0,R.select)(lt.elementFromPoint(h,g))};t.$el.svg.on("touchstart touchmove",function(c){if(i.transiting)return;i.event=c;const d=l(c).datum(),h=d!=null&&d.data&&d.data.id?t.updateAngle(d):null,g=h?t.convertToArcData(h):null,f=(g==null?void 0:g.id)||void 0;t.callOverOutForTouch(g),nt(f)?r():o(this,g,f)},{passive:!0})}},redrawArcText(e){const t=this,{config:s,state:i,$el:{main:n,arcs:a}}=t,o=t.hasType("gauge"),r=t.hasMultiArcGauge();let l;if(o&&t.data.targets.length===1&&s.gauge_title||(l=n.selectAll(`.${X.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?$t.gaugeValue:null).call(t.textForArcLabel.bind(t)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(i.radius/5)}px`:null),Is.call(t),l.attr("transform",function(c){return t.transformForArcLabel.bind(t)(this,c)}).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),n.select(`.${X.chartArcsTitle}`).style("opacity",t.hasType("donut")||o?null:"0"),o){const c=s.gauge_fullCircle;c&&(l==null||l.attr("dy",`${r?0:Math.round(i.radius/14)}`)),s.gauge_label_show&&(a.select(`.${$t.chartArcsGaugeUnit}`).attr("dy",`${c?1.5:.75}em`).text(s.gauge_units),a.select(`.${$t.chartArcsGaugeMin}`).attr("dx",`${-1*(i.innerRadius+(i.radius-i.innerRadius)/(c?1:2))}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(s.gauge_min,!1)),!c&&a.select(`.${$t.chartArcsGaugeMax}`).attr("dx",`${i.innerRadius+(i.radius-i.innerRadius)/2}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(s.gauge_max,!0)))}hi.call(t)&&Jo.call(t,e)},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:s}}=t,i=I(e)?n=>n.index===e:n=>n.data.id===e;return s==null?void 0:s.selectAll(`.${D.target} path`).filter(i)}},ie={initArea(e){const t=this,{config:s}=t;e.insert("g",`.${s.area_front?ft.circles:kt.lines}`).attr("class",t.getClass("areas",!0))},updateAreaColor(e){const t=this;return t.config.area_linearGradient?t.getGradienColortUrl(e.id):t.color(e)},updateArea(e,t=!1){const s=this,{config:i,state:n,$el:a,$T:o}=s,r=t?a.subchart:a;i.area_linearGradient&&s.updateLinearGradient();const l=r.main.selectAll(`.${$e.areas}`).selectAll(`.${$e.area}`).data(s.lineData.bind(s));o(l.exit(),e).style("opacity","0").remove(),r.area=l.enter().append("path").attr("class",s.getClass("area",!0)).style("fill",s.updateAreaColor.bind(s)).style("opacity",function(){return n.orgAreaOpacity=(0,R.select)(this).style("opacity"),"0"}).merge(l),l.style("opacity",n.orgAreaOpacity),s.setRatioForGroupedData(r.area.data())},redrawArea(e,t,s=!1){const i=this,{area:n}=s?this.$el.subchart:this.$el,{orgAreaOpacity:a}=i.state;return[i.$T(n,t,Ct()).attr("d",e).style("fill",i.updateAreaColor.bind(i)).style("opacity",o=>String(i.isAreaRangeType(o)?a/1.75:a))]},generateDrawArea(e,t){const s=this,{config:i}=s,n=i.line_connectNull,a=i.axis_rotated,o=s.generateGetAreaPoints(e,t),r=s.getYScaleById.bind(s),l=d=>(t?s.subxx:s.xx).call(s,d),c=(d,h)=>s.isGrouped(d.id)?o(d,h)[0][1]:r(d.id,t)(s.isAreaRangeType(d)?s.getRangedData(d,"high"):s.getShapeYMin(d.id)),u=(d,h)=>s.isGrouped(d.id)?o(d,h)[1][1]:r(d.id,t)(s.isAreaRangeType(d)?s.getRangedData(d,"low"):d.value);return d=>{let h=n?s.filterRemoveNull(d.values):d.values,g=0,f=0,p;if(s.isAreaType(d)){let _=(0,tt.area)();_=a?_.y(l).x0(c).x1(u):_.x(l).y0(i.area_above?0:i.area_below?s.state.height:c).y1(u),n||(_=_.defined(x=>s.getBaseValue(x)!==null)),s.isStepType(d)&&(h=s.convertValuesToStep(h)),p=_.curve(s.getCurve(d))(h)}else h[0]&&(g=s.scale.x(h[0].x),f=s.getYScaleById(d.id)(h[0].value)),p=a?`M ${f} ${g}`:`M ${g} ${f}`;return p||"M 0 0"}},generateGetAreaPoints(e,t){const s=this,{config:i}=s,n=s.getShapeX(0,e,t),a=s.getShapeY(!!t),o=s.getShapeOffset(s.isAreaType,e,t),r=s.getYScaleById.bind(s);return function(l,c){const u=r.call(s,l.id,t)(s.getShapeYMin(l.id)),d=o(l,c)||u,h=n(l),g=l.value;let f=a(l);return i.axis_rotated&&(g>0&&f<u||g<0&&u<f)&&(f=u),[[h,d],[h,f-(u-d)],[h,f-(u-d)],[h,d]]}}};function Je(e){const t=this.config.bar_connectLine,s=(t==null?void 0:t[e])||t;return/^(start|end)\-(start|end)$/.test(s)?s:null}var ur={initBar(){const{$el:e,config:t,state:{clip:s}}=this;e.bar=e.main.select(`.${D.chart}`),e.bar=t.bar_front?e.bar.append("g"):e.bar.insert("g",":first-child"),e.bar.attr("class",yt.chartBars).call(this.setCssRule(!1,`.${yt.chartBars}`,["pointer-events:none"])),t.clipPath===!1&&(t.bar_radius||t.bar_radius_ratio)&&e.bar.attr("clip-path",s.pathXAxis.replace(/#[^)]*/,`#${s.id}`))},updateTargetsForBar(e){const t=this,{config:s,$el:i}=t,n=t.getChartClass("Bar"),a=t.getClass("bars",!0),o=t.classFocus.bind(t),r=s.interaction_enabled&&s.data_selection_isselectable;i.bar||t.initBar(),i.main.select(`.${yt.chartBars}`).selectAll(`.${yt.chartBar}`).data(t.filterNullish(e)).attr("class",u=>n(u)+o(u)).enter().append("g").attr("class",n).style("opacity","0").style("pointer-events",t.getStylePropValue("none")).append("g").attr("class",a).style("cursor",u=>{var d;return(d=r==null?void 0:r.bind)!=null&&d.call(r,t.api)(u)?"pointer":null}).call(u=>{t.setCssRule(!0,` .${yt.bar}`,["fill"],t.color)(u),u.each(function(d){Je.call(t,d.id)&&(0,R.select)(this).append("path").attr("class",yt.barConnectLine)})})},updateBar(e,t=!1){const s=this,{config:i,$el:n,$T:a}=s,o=t?n.subchart:n,r=s.getClass("bar",!0),l=s.initialOpacity.bind(s);i.bar_linearGradient&&s.updateLinearGradient();const c=o.main.selectAll(`.${yt.bars}`).selectAll(`.${yt.bar}`).data(s.labelishData.bind(s));a(c.exit(),e).style("opacity","0").remove(),o.bar=c.enter().append("path").attr("class",r).style("fill",s.updateBarColor.bind(s)).merge(c).style("opacity",l),s.setRatioForGroupedData(o.bar.data())},updateBarColor(e){const t=this,s=t.getStylePropValue(t.color);return t.config.bar_linearGradient?t.getGradienColortUrl(e.id):s?s(e):null},redrawBar(e,t,s=!1){const i=this,{bar:n}=s?i.$el.subchart:i.$el,a=[];return[i.$T(n,t,Ct()).attr("d",function(o,r,l){const c=(I(o.value)||i.isBarRangeType(o))&&e(o,r),u=Je.call(i,o.id);if(c.length>1&&(a.push(c[1]),r===l.length-1)){const d=i.$T((0,R.select)(this.parentNode.querySelector(`.${yt.barConnectLine}`)),t,Ct());i.updateConnectLine(d,u,a),a.splice(0)}return c[0]}).style("fill",i.updateBarColor.bind(i)).style("clip-path",o=>o.clipPath).style("opacity",null)]},generateDrawBar(e,t){const s=this,{config:i}=s,n=s.generateGetBarPoints(e,t),a=i.axis_rotated,o=i.bar_radius,r=i.bar_radius_ratio,l=I(o)&&o>0?()=>o:I(r)?c=>c*r:null;return(c,u)=>{const d=n(c,u),h=+a,g=+!h,f=c.value<0,p=i[`axis_${s.axis.getId(c.id)}_inverted`],_=!p&&f||p&&!f,x=["",""],m=s.isGrouped(c.id),y=l&&m?s.isStackingRadiusData(c):!1,$=[d[0][h],d[0][g]];let v=0;if(c.clipPath=null,l){const w=a?g:h,S=d[2][w]-d[0][w];v=!m||y?l(S):0;const A=`a${v} ${v} ${_?"1 0 0":"0 0 1"} `;x[+!a]=`${A}${v},${v}`,x[+a]=`${A}${[-v,v][a?"sort":"reverse"]()}`,_&&x.reverse()}const b=a?d[1][h]+(_?v:-v):d[1][g]+(_?-v:v);if(v){let w="";a?_&&$[0]<b?w=`0 ${b-$[0]}px 0 0`:!_&&$[0]>b&&(w=`0 0 0 ${$[0]-b}px`):_&&$[1]>b?w=`${$[1]-b}px 0 0 0`:!_&&$[1]<b&&(w=`0 0 ${b-$[1]}px 0`),w&&(c.clipPath=`inset(${w})`)}const T=a?`H${b} ${x[0]}V${d[2][g]-v} ${x[1]}H${d[3][h]}`:`V${b} ${x[0]}H${d[2][h]-v} ${x[1]}V${d[3][g]}`,C=[`M${d[0][h]},${d[0][g]}${T}z`];return Je.call(s,c.id)&&C.push(a?{x:d[0][h],y:d[0][g],width:d[0][h]-b,height:d[2][g]-d[0][g]}:{x:d[0][h],y:b,width:d[2][h]-d[0][h],height:d[3][g]-b}),C}},isStackingRadiusData(e){const t=this,{$el:s,config:i,data:n,state:a}=t,{id:o,index:r,value:l}=e;if(a.hiddenTargetIds.indexOf(o)>-1){const h=s.bar.filter(g=>g.id===o&&g.value===l);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const c=i.data_groups.find(h=>h.indexOf(o)>-1),d=t.orderTargets(t.filterTargetsToShow(n.targets.filter(t.isBarType,t))).filter(h=>c.indexOf(h.id)>-1).map(h=>h.values.filter(g=>g.index===r&&(I(l)&&l>0?g.value>0:g.value<0))[0]).filter(Boolean).map(h=>h.id);return l!==0&&d.indexOf(o)===d.length-1},generateGetBarPoints(e,t){const s=this,{config:i}=s,n=t?s.axis.subX:s.axis.x,a=s.getIndicesMax(e)+1,o=s.getBarW("bar",n,a),r=s.getShapeX(o,e,!!t),l=s.getShapeY(!!t),c=s.getShapeOffset(s.isBarType,e,!!t),u=s.getYScaleById.bind(s);return(d,h)=>{const{id:g}=d,f=u.call(s,g,t)(s.getShapeYMin(g)),p=c(d,h)||f,_=I(o)?o:o[d.id]||o._$width,x=i[`axis_${s.axis.getId(g)}_inverted`],m=d.value,y=r(d);let $=l(d);i.axis_rotated&&!x&&(m>0&&$<f||m<0&&f<$)&&($=f),s.isBarRangeType(d)||($-=f-p);const v=y+_;return[[y,p],[y,$],[v,$],[v,p]]}},updateConnectLine(e,t,s){const i=s.map((n,a,o)=>{const r=this.config.axis_rotated,l=/^start-(start|end)$/.test(t),c=/^end-(start|end)$/.test(t),u=[],d=r?c?n.x-n.width:n.x:n.x+n.width,h=r||l?n.y+n.height:n.y;return a===0?u.push(`${d},${h}`):(u.push(r?`L${n.x-(/\w+-end$/.test(t)?n.width:0)},${n.y}`:`L${n.x},${n.y+(/\w+-start$/.test(t)?n.height:0)}`),a<o.length-1&&u.push(`M${d},${h}`)),u.join(" ")});e.attr("d",`M${i.join("")}z`)}},hr={initBubble(){const e=this,{config:t}=e;e.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength(){const e=this,{width:t,height:s}=e.state,i=xt.bubbleBaseLength;let n=e.cache.get(i);return n||e.cache.add(i,n=Rt("min",[t,s])),n},getBubbleR(e){const t=this;let s=t.config.bubble_maxR;k(s)?s=s.bind(t.api)(e):I(s)||(s=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const i=Rt("max",t.getMinMaxData().max.map(o=>t.isBubbleZType(o)?t.getBubbleZData(o.value,"y"):N(o.value)?o.value.mid:o.value)),n=s*s*Math.PI,a=(t.isBubbleZType(e)?t.getBubbleZData(e.value,"z"):e.value)*(n/i);return Math.sqrt(a/Math.PI)},getBubbleZData(e,t){return N(e)?e[t]:e[t==="y"?0:1]}},gr=Object.defineProperty,xi=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,_i=(e,t,s)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,xr=(e,t)=>{for(var s in t||(t={}))fr.call(t,s)&&_i(e,s,t[s]);if(xi)for(var s of xi(t))pr.call(t,s)&&_i(e,s,t[s]);return e},_r={initCandlestick(){const{$el:e}=this;e.candlestick=e.main.select(`.${D.chart}`).append("g").attr("class",Lt.chartCandlesticks)},updateTargetsForCandlestick(e){const t=this,{$el:s}=t,i=t.getChartClass("Candlestick");s.candlestick||t.initCandlestick(),t.$el.main.select(`.${Lt.chartCandlesticks}`).selectAll(`.${Lt.chartCandlestick}`).data(t.filterNullish(e)).enter().append("g").attr("class",i).style("pointer-events","none")},updateCandlestick(e,t=!1){const s=this,{$el:i,$T:n}=s,a=t?i.subchart:i,o=s.getClass("candlestick",!0),r=s.initialOpacity.bind(s),l=a.main.selectAll(`.${Lt.chartCandlestick}`).selectAll(`.${Lt.candlestick}`).data(s.labelishData.bind(s));n(l.exit(),e).style("opacity","0").remove();const c=l.enter().filter(u=>u.value).append("g").attr("class",o);c.append("line"),c.append("path"),a.candlestick=l.merge(c).style("opacity",r)},generateDrawCandlestick(e,t){const s=this,{config:i}=s,n=s.generateGetCandlestickPoints(e,t),a=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const u=n(r,l),d=s.getCandlestickData(r),h=d==null?void 0:d._isUp,g=+a,f=+!g;c.classed&&c.classed(Lt[h?"valueUp":"valueDown"],!0);const p=a?`H${u[1][1]} V${u[1][0]} H${u[0][1]}`:`V${u[1][1]} H${u[1][0]} V${u[0][1]}`;c.select("path").attr("d",`M${u[0][g]},${u[0][f]}${p}z`).style("fill",m=>(h?s.color(m):N(o)?o[m.id]:o)||s.color(m));const _=c.select("line"),x=a?{x1:u[2][1],x2:u[2][2],y1:u[2][0],y2:u[2][0]}:{x1:u[2][0],x2:u[2][0],y1:u[2][1],y2:u[2][2]};for(const m in x)_.attr(m,x[m])}},generateGetCandlestickPoints(e,t=!1){const s=this,i=t?s.axis.subX:s.axis.x,n=s.getIndicesMax(e)+1,a=s.getBarW("candlestick",i,n),o=s.getShapeX(a,e,!!t),r=s.getShapeY(!!t),l=s.getShapeOffset(s.isBarType,e,!!t),c=s.getYScaleById.bind(s);return(u,d)=>{const h=c.call(s,u.id,t)(s.getShapeYMin(u.id)),g=l(u,d)||h,f=I(a)?a:a[u.id]||a._$width,p=s.getCandlestickData(u);let _;if(p&&I(p.open)&&I(p.close)){const x={start:o(u),end:0};x.end=x.start+f;const m={start:r(p.open),end:r(p.close)},y={x:x.start+f/2,high:r(p.high),low:r(p.low)};m.start-=h-g,_=[[x.start,m.start],[x.end,m.end],[y.x,y.low,y.high]]}else _=[[0,0],[0,0],[0,0,0]];return _}},redrawCandlestick(e,t,s=!1){const i=this,{$el:n,$T:a}=i,{candlestick:o}=s?n.subchart:n,r=Ct(!0);return[o.each(function(l,c){const u=a((0,R.select)(this),t,r);e(l,c,u)}).style("opacity",null)]},getCandlestickData({value:e}){let t;if(V(e)){const[s,i,n,a,o=!1]=e;t={open:s,high:i,low:n,close:a},o!==!1&&(t.volume=o)}else N(e)&&(t=xr({},e));return t&&(t._isUp=t.close>=t.open),t||null}},mr=Object.defineProperty,mi=Object.getOwnPropertySymbols,yr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,yi=(e,t,s)=>t in e?mr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,br=(e,t)=>{for(var s in t||(t={}))yr.call(t,s)&&yi(e,s,t[s]);if(mi)for(var s of mi(t))$r.call(t,s)&&yi(e,s,t[s]);return e};function Le(e=!1){const t=this,{config:s,state:{current:{width:i,height:n}}}=t,a=t.getCurrentPadding(),o=br({width:i-(a.left+a.right),height:n-(s.legend_show?t.getLegendHeight()+10:0)-(a.top+a.bottom)},a);if(e){const{width:r,height:l}=$i.call(t,{width:o.width,height:o.height});o.width<r&&(o.width=r),o.height<l&&(o.height=l)}return o}function $i(e){const t=this,{config:s}=t;let i=s.funnel_neck_width,n=s.funnel_neck_height;return[i,n]=[i,n].map((a,o)=>{let r=a;return N(a)&&(r=e[o?"height":"width"]*a.ratio),r}),{width:i,height:n}}function vr(e){const t=this,{top:s,left:i,width:n}=Le.call(t,!0),a=[];return e.forEach((o,r)=>{const{ratio:l}=o,c=r>0?a[r-1][2][1]:s;a.push(o.coords=[[i,c],[i+n,c],[i+n,r>0?l+c:l+s],[i,r>0?l+c:l+s],[i,c]])}),a}function bi(e=!1){const t=this,{width:s,height:i,top:n,left:a}=Le.call(t,!0),o=$i.call(t,{width:s,height:i}),r=(s-o.width)/2,l=(s+o.width)/2,c=i-o.height,u=[[0,0],[s,0],[l,c],[l,i],[r,i],[r,c],[0,0]];return e&&u.forEach(d=>{d[0]+=a,d[1]+=n}),`M${u.join("L")}z`}function Tr(e){const t=this,{config:s}=t,i=e.map(n=>({id:n.id,value:n.values.reduce((a,o)=>a+o.value,0)}));return s.data_order&&i.sort(t.getSortCompareFn.bind(t)(!0)),vi.call(t,i)}function vi(e){const t=this,{height:s}=Le.call(t),i=t.getTotalDataSum(!0);return e.forEach(n=>{n.ratio=n.value/i*s}),e}var Ar={initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${D.chart}`).append("g").classed(ue.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(ue.funnelBackground,!0),e.bindFunnelEvent()},bindFunnelEvent(){const e=this,{$el:{funnel:t},config:s,state:i}=e,n=a=>{var o;const r=a.isTrusted?a.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return/^path$/i.test(r.tagName)&&(i.event=a,l=(0,R.select)(r).datum()),l};if(s.interaction_enabled){const a=i.inputType==="touch";t.on(a?"touchstart":"mouseover mousemove",o=>{const r=n(o);r&&(e.showTooltip([r],o.target),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},a?{passive:!0}:void 0).on(a?"touchend":"mouseout",o=>{const r=n(o);s.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},updateTargetsForFunnel(e){const t=this,{$el:{funnel:s}}=t,i=t.getChartClass("Funnel"),n=t.getClass("funnel",!0);s||t.initFunnel();const a=Tr.call(t,e.filter(t.isFunnelType.bind(t))),o=s.selectAll(`.${ue.chartFunnel}`).data(t.filterNullish(a));o.exit().remove();const r=o.enter().insert("g",`.${ue.funnelBackground}`);r.append("path"),s.path=r.merge(o).attr("class",l=>i(l)).select("path").attr("class",n).style("opacity","0").style("fill",t.color)},updateFunnel(e){const t=this,{$el:{funnel:s}}=t,i=e.map(({id:n})=>n);s.path=s.path.filter(n=>i.indexOf(n.id)>=0)},generateGetFunnelPoints(){const e=this,{$el:{funnel:t}}=e,s=e.filterTargetsToShow(t.path),{top:i,left:n,right:a}=Le.call(e),o=(n-a)/2,r={};let l=i!=null?i:0;return s.each((c,u)=>{var d;r[c.id]=[[o,l],[o,l+=((d=s==null?void 0:s[u])!=null?d:c).ratio]]}),c=>r[c.id]},redrawFunnel(){const e=this,{$T:t,$el:{funnel:s}}=e,i=e.filterTargetsToShow(s.path),n=vr.call(e,vi.call(e,i.data()));s.attr("clip-path",`path('${bi.bind(e)()}')`),s.background.attr("d",bi.call(e,!0)),t(i).attr("d",(a,o)=>`M${n[o].join("L")}z`).style("opacity","1"),s.selectAll("g").style("opacity",null)}},wr={initGauge(){const e=this,{config:t,$el:{arcs:s}}=e,i=(n=null,a="")=>{s.append("text").attr("class",n).style("text-anchor","middle").style("pointer-events","none").text(a)};if(e.hasType("gauge")){const n=e.hasMultiArcGauge();s.append(n?"g":"path").attr("class",X.chartArcsBackground).style("fill",!n&&t.gauge_background||null),t.gauge_units&&i($t.chartArcsGaugeUnit),t.gauge_label_show&&(i($t.chartArcsGaugeMin),!t.gauge_fullCircle&&i($t.chartArcsGaugeMax))}},updateGaugeMax(){const e=this,{config:t,state:s}=e,n=e.hasMultiArcGauge()?e.getMinMaxData().max[0].value:e.getTotalDataSum(s.rendered);!t.gauge_enforceMinMax&&n+t.gauge_min*(t.gauge_min>0?-1:1)>t.gauge_max&&(t.gauge_max=n-t.gauge_min)},redrawArcGaugeLine(){const e=this,{config:t,state:s,$el:i}=e,{hiddenTargetIds:n}=e.state,a=i.main.selectAll(`.${X.arcs}`).selectAll(`.${X.arcLabelLine}`).data(e.arcData.bind(e));a.enter().append("rect").attr("class",r=>`${X.arcLabelLine} ${D.target} ${D.target}-${r.data.id}`).merge(a).style("fill",r=>e.levelColor?e.levelColor(r.data.values[0].value):e.color(r.data)).style("display",t.gauge_label_show?null:"none").each(function(r){let l=0;const c=2;let u=0,d=0,h="";if(n.indexOf(r.data.id)<0){const g=e.updateAngle(r),f=s.gaugeArcWidth/e.filterTargetsToShow(e.data.targets).length*(g.index+1),p=g.endAngle-Math.PI/2,_=s.radius-f,x=p-(_===0?0:1/_);l=s.radiusExpanded-s.radius+f,u=Math.cos(x)*_,d=Math.sin(x)*_,h=`rotate(${p*180/Math.PI}, ${u}, ${d})`}(0,R.select)(this).attr("x",u).attr("y",d).attr("width",l).attr("height",c).attr("transform",h).style("stroke-dasharray",`0, ${l+c}, 0`)})},textForGaugeMinMax(e,t){const s=this,{config:i}=s,n=i.gauge_label_extents;return k(n)?n.bind(s.api)(e,t):e},getGaugeLabelHeight(){const{config:e}=this;return this.config.gauge_label_show&&!e.gauge_fullCircle?20:0},getPaddingBottomForGauge(){const e=this;return e.getGaugeLabelHeight()*(e.config.gauge_label_show?2:2.5)}},Sr=Object.defineProperty,Rr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,Ti=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,Ai=(e,t,s)=>t in e?Sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,kr=(e,t)=>{for(var s in t||(t={}))Er.call(t,s)&&Ai(e,s,t[s]);if(Ti)for(var s of Ti(t))Lr.call(t,s)&&Ai(e,s,t[s]);return e},Pr=(e,t)=>Rr(e,Cr(t));function Or(e,t,s,i=!1){const n=e?[e,0]:s;for(let a=e||s.reduce((o,r)=>o+r);a<=t;)s.forEach(o=>{a+o<=t&&n.push(o),a+=o});return n.length%2!==0&&n.push(i?s[1]:0),{dash:n.join(" "),length:n.reduce((a,o)=>a+o,0)}}function Ir(e,t,s){const i=this,n=[],a="2 2";if(W(t)){const o=(r,l)=>nt(r)?l:s?At.call(i,r):r;for(let r=0,l;l=t[r];r++){const c=o(l.start,e[0].x),u=o(l.end,e[e.length-1].x),d=l.style||{dasharray:a};n[r]={start:c,end:u,style:d}}}return n}var Dr={initLine(){const{$el:e}=this;e.line=e.main.select(`.${D.chart}`).append("g").attr("class",kt.chartLines).call(this.setCssRule(!1,`.${kt.chartLines}`,["pointer-events:none"]))},updateTargetsForLine(e){const t=this,{$el:{area:s,line:i,main:n}}=t,a=t.getChartClass("Line"),o=t.getClass("lines",!0),r=t.classFocus.bind(t);i||t.initLine();const l=e.filter(d=>!(t.isScatterType(d)||t.isBubbleType(d))),c=n.select(`.${kt.chartLines}`).selectAll(`.${kt.chartLine}`).data(t.filterNullish(l)).attr("class",d=>a(d)+r(d)),u=c.enter().append("g").attr("class",a).style("opacity","0").style("pointer-events",t.getStylePropValue("none"));if(u.append("g").attr("class",o),t.hasTypeOf("Area")){const d=(!s&&u.empty()?c:u).filter(t.isAreaType.bind(t));t.initArea(d)}t.updateTargetForCircle(l,u)},updateLine(e,t=!1){const s=this,{format:{extraLineClasses:i},$el:n,$T:a}=s,o=t?n.subchart:n,r=o.main.selectAll(`.${kt.lines}`).selectAll(`.${kt.line}`).data(s.lineData.bind(s));a(r.exit(),e).style("opacity","0").remove(),o.line=r.enter().append("path").attr("class",l=>`${s.getClass("line",!0)(l)} ${i(l)||""}`).style("stroke",s.color).merge(r).style("opacity",s.initialOpacity.bind(s)).attr("transform",null)},redrawLine(e,t,s=!1){const i=this,{$el:n,$T:a}=i,{line:o}=s?n.subchart:n;return[a(o,t,Ct()).attr("d",e).style("stroke",this.color).style("opacity",null)]},getCurve(e){const t=this;return t.config.axis_rotated&&t.isStepType(e)?i=>{const n=t.getInterpolate(e)(i);return n.orgPoint=n.point,n.pointRotated=function(a,o){this._point===1&&(this._point=2);const r=this._y*(1-this._t)+o*this._t;this._context.lineTo(this._x,r),this._context.lineTo(a,r),this._x=a,this._y=o},n.point=function(a,o){this._point===0?this.orgPoint(a,o):this.pointRotated(a,o)},n}:t.getInterpolate(e)},generateDrawLine(e,t){const s=this,{config:i,scale:n}=s,a=i.line_connectNull,o=i.axis_rotated,r=s.generateGetLinePoints(e,t),l=s.getYScaleById.bind(s),c=g=>(t?s.subxx:s.xx).call(s,g),u=(g,f)=>s.isGrouped(g.id)?r(g,f)[0][1]:l(g.id,t)(s.getBaseValue(g));let d=(0,tt.line)();d=o?d.x(u).y(c):d.x(c).y(u),a||(d=d.defined(g=>s.getBaseValue(g)!==null));const h=t?n.subX:n.x;return g=>{const f=l(g.id,t);let p=a?s.filterRemoveNull(g.values):g.values,_=0,x=0,m;if(s.isLineType(g)){const y=i.data_regions[g.id];y?(s.isAreaRangeType(g)&&(p=p.map($=>Pr(kr({},$),{value:s.getRangedData($,"mid")}))),m=s.lineWithRegions(p,n.zoom||h,f,y)):(s.isStepType(g)&&(p=s.convertValuesToStep(p)),m=d.curve(s.getCurve(g))(p))}else p[0]&&(_=h(p[0].x),x=f(p[0].value)),m=o?`M ${x} ${_}`:`M ${_} ${x}`;return m||"M 0 0"}},lineWithRegions(e,t,s,i){const n=this,{config:a}=n,o=a.axis_rotated,r=n.axis.isTimeSeries(),l="2 2",c=Ir.bind(n)(e,i,r),u=n.hasNullDataValue(e);let d,h,g,f;const p=o?S=>s(S.value):S=>t(S.x),_=o?S=>t(S.x):S=>s(S.value),x=S=>`M${S[0][0]},${S[0][1]}L${S[1][0]},${S[1][1]}`,m=r?(S,A,O,E)=>{const P=S.x.getTime(),F=A.x-S.x,U=new Date(P+F*O),Y=new Date(P+F*(O+E)),ut=o?[[s(h(O)),t(U)],[s(h(O+g)),t(Y)]]:[[t(U),s(h(O))],[t(Y),s(h(O+g))]];return x(ut)}:(S,A,O,E)=>{const P=t(A.x,!o),F=s(A.value,o),U=O+E,Y=t(d(O),!o),ut=s(h(O),o);let et=t(d(U),!o),wt=s(h(U),o);et>P&&(et=P),S.value>A.value&&(o?wt<F:wt>F)&&(wt=F);const de=[[Y,ut],[et,wt]];return o&&de.forEach(xe=>xe.reverse()),x(de)},y={x:n.axis.getAxisType("x"),y:n.axis.getAxisType("y")};let $="";const v=n.$el.line.filter(({id:S})=>S===e[0].id),b=v.clone().style("display","none"),T=(S,A)=>S.attr("d",A).node().getTotalLength(),C={dash:[],lastLength:0};let w=!1;for(let S=0,A;A=e[S];S++){const O=e[S-1],E=O&&M(O.value);let P=n.isWithinRegions(A.x,c);if(M(A.value)){if(nt(c)||!P||!E)$+=`${S&&E?"L":"M"}${p(A)},${_(A)}`;else if(E)if(P=((P==null?void 0:P.dasharray)||l).split(" ").map(Number),d=Wt(y.x,O.x,A.x),h=Wt(y.y,O.value,A.value),u){const F=t(A.x)-t(O.x),U=s(A.value)-s(O.value),Y=Math.sqrt(Math.pow(F,2)+Math.pow(U,2));g=P[0]/Y,f=g*P[1];for(let ut=g;ut<=1;ut+=f)$+=m(O,A,ut,g),ut+f>=1&&($+=m(O,A,1,0))}else{let F=[];if(w=A.x===e[e.length-1].x,r){const et=+O.x,wt=new Date(et),de=new Date(et+(+A.x-et));F=[[t(wt),s(h(0))],[t(de),s(h(1))]]}else F=[[t(d(0)),s(h(0))],[t(d(1)),s(h(1))]];o&&F.forEach(et=>et.reverse());const U=T(b,$),Y=T(b,$+=`L${F[1].join(",")}`),ut=Or(U-C.lastLength,Y-C.lastLength,P,w);C.lastLength+=ut.length,C.dash.push(ut.dash)}}}return C.dash.length&&(!w&&C.dash.push(T(b,$)),b.remove(),v.attr("stroke-dasharray",C.dash.join(" "))),$},isWithinRegions(e,t){for(let s=0,i;i=t[s];s++)if(i.start<e&&e<=i.end)return i.style;return!1},isWithinStep(e,t){return Math.abs(t-Tt(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||V(t)&&t.indexOf(e.id)!==-1}};const ne=()=>Ct();var ke={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:s}}=this;let i=t.point_opacity;return nt(i)&&(i=this.getBaseValue(e)!==null&&s[e.id]?this.opacityForCircle(e):"0"),i},opacityForCircle(e){var t;const{config:s}=this;let i=s.point_opacity;return nt(i)&&(i=s.point_show&&!((t=this.isPointFocusOnly)!=null&&t.call(this))?null:"0",i=M(this.getBaseValue(e))?this.isBubbleType(e)||this.isScatterType(e)?"0.5":i:"0"),i},initCircle(){const e=this,{$el:{main:t}}=e;!e.point&&(e.point=e.generatePoint()),(e.hasType("bubble")||e.hasType("scatter"))&&t.select(`.${D.chart} > .${ft.chartCircles}`).empty()&&t.select(`.${D.chart}`).append("g").attr("class",ft.chartCircles)},updateTargetForCircle(e,t){const s=this,{config:i,data:n,$el:a}=s,o=i.interaction_enabled&&i.data_selection_enabled,r=o&&i.data_selection_isselectable,l=s.getClass("circles",!0);if(!i.point_show)return;s.initCircle();let c=e,u=t;if(!c){c=s.filterNullish(n.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const d=a.main.select(`.${ft.chartCircles}`).style("pointer-events","none").selectAll(`.${ft.circles}`).data(c);d.exit().remove(),u=d.enter()}o&&u.append("g").attr("class",d=>s.generateClass(Q.selectedCircles,d.id)),u.append("g").attr("class",l).call(d=>{s.setCssRule(!0,`.${ft.circles}`,["cursor:pointer"],r)(d),s.setCssRule(!0,` .${ft.circle}`,["fill","stroke"],s.color)(d)}).style("opacity",function(){return(0,R.select)(this.parentNode).attr("class").indexOf(ft.chartCircles)>-1?"0":null}),o&&c.forEach(d=>{a.main.selectAll(`.${Q.selectedCircles}${s.getTargetSelectorSuffix(d.id)}`).selectAll(`${Q.selectedCircle}`).each(h=>{h.value=d.values[h.index].value})})},updateCircle(e=!1){const t=this,{config:s,state:i,$el:n}=t,a=t.isPointFocusOnly(),o=e?n.subchart:n;if(s.point_show&&!i.toggling){s.point_radialGradient&&t.updateLinearGradient();const r=o.main.selectAll(`.${ft.circles}`).selectAll(`.${ft.circle}`).data(l=>{const c=t.isLineType(l)&&t.shouldDrawPointsForLine(l)||t.isBubbleType(l)||t.isRadarType(l)||t.isScatterType(l)?a?[l.values[0]]:l.values:[];return t.filterNullish(c)});r.exit().remove(),r.enter().filter(Boolean).append(t.point("create",this,t.pointR.bind(t),t.updateCircleColor.bind(t))),o.circle=o.main.selectAll(`.${ft.circles} .${ft.circle}`).style("stroke",t.getStylePropValue(t.color)).style("opacity",t.initialOpacityForCircle.bind(t))}},updateCircleColor(e){const t=this,s=t.getStylePropValue(t.color);return t.config.point_radialGradient?t.getGradienColortUrl(e.id):s?s(e):null},redrawCircle(e,t,s,i,n=!1){const a=this,{state:{rendered:o},$el:r,$T:l}=a,c=n?r.subchart:r,u=c.main.selectAll(`.${Q.selectedCircle}`);if(!a.config.point_show)return[];const d=a.point("update",a,e,t,a.updateCircleColor.bind(a),s,i,u),h=a.isCirclePoint()?"c":"",g=Ct(),f=a.opacityForCircle.bind(a),p=[];return c.circle.each(function(_){let x=d.bind(this)(_);x=l(x,s||!o,g).style("opacity",f),p.push(x)}),[p,l(u,s).attr(`${h}x`,e).attr(`${h}y`,t)]},showCircleFocus(e){const t=this,{state:{hasRadar:s,resizing:i,toggling:n,transiting:a},$el:o}=t;let{circle:r}=o;if(a===!1&&r&&t.isPointFocusOnly()){const l=(s?t.radarCircleX:t.circleX).bind(t),c=(s?t.radarCircleY:t.circleY).bind(t),u=n||nt(e),d=t.point("update",t,l,c,t.getStylePropValue(t.color),i?!1:u);e&&(r=r.filter(function(h){var g;const f=(g=e.filter)==null?void 0:g.call(e,p=>p.id===h.id);return f.length?(0,R.select)(this).datum(f[0]):!1})),r.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:g,index:f,value:p}=h;let _="hidden";M(p)&&(d.bind(this)(h),t.expandCircles(f,g),_=""),this.style.visibility=_})}},hideCircleFocus(){const e=this,{$el:{circle:t}}=e;e.isPointFocusOnly()&&t&&(e.unexpandCircles(),t.style("visibility","hidden"))},circleX(e){return this.xx(e)},updateCircleY(e=!1){const t=this,s=t.generateGetLinePoints(t.getShapeIndices(t.isLineType),e);return(i,n)=>{const a=i.id;return t.isGrouped(a)?s(i,n)[0][1]:t.getYScaleById(a,e)(t.getBaseValue(i))}},expandCircles(e,t,s){const i=this,n=i.pointExpandedR.bind(i);s&&i.unexpandCircles();const a=i.getShapeByIndex("circle",e,t).classed(D.EXPANDED,!0),o=n(a)/i.config.point_r,r=1-o;i.isCirclePoint()?a.attr("r",n):a.each(function(){const l=(0,R.select)(this);if(this.tagName==="circle")l.attr("r",n);else{const{width:c,height:u}=Yt(this),d=r*(+l.attr("x")+c/2),h=r*(+l.attr("y")+u/2);l.attr("transform",`translate(${d} ${h}) scale(${o})`)}})},unexpandCircles(e){const t=this,s=t.pointR.bind(t),i=t.getShapeByIndex("circle",e).filter(function(){return(0,R.select)(this).classed(D.EXPANDED)}).classed(D.EXPANDED,!1);if(i.attr("r",s),!t.isCirclePoint()){const n=s(i)/t.config.point_r;i.attr("transform",n!==1?`scale(${n})`:null)}},pointR(e){const t=this,{config:s}=t,i=s.point_r;let n=i;return t.isBubbleType(e)?n=t.getBubbleR(e):k(i)&&(n=i.bind(t.api)(e)),e.r=n,n},pointExpandedR(e){const t=this,{config:s}=t,i=t.isBubbleType(e)?1.15:1.75;return s.point_focus_expand_enabled?s.point_focus_expand_r||t.pointR(e)*i:t.pointR(e)},pointSelectR(e){const t=this,s=t.config.point_select_r;return k(s)?s(e):s||t.pointR(e)*4},isPointFocusOnly(){const e=this;return e.config.point_focus_only&&!e.hasType("bubble")&&!e.hasType("scatter")&&!e.hasArcType(null,["radar"])},isWithinCircle(e,t){const{state:s}=this,i=Tt(s.event,e),n=(0,R.select)(e),a=this.isCirclePoint(e)?"c":"",o=this.getPointSensitivity(n==null?void 0:n.datum());let r=+n.attr(`${a}x`),l=+n.attr(`${a}y`);if(!(r||l)&&e.nodeType===1){const{x:c,y:u}=ct(e);r=c,l=u}return Math.sqrt(Math.pow(r-i[0],2)+Math.pow(l-i[1],2))<(t||o)},getPointSensitivity(e){const t=this;let s=t.config.point_sensitivity;if(e)k(s)?s=s.call(t.api,e):s==="radius"&&(s=e.r);else return s;return s},updatePointClass(e){const t=this,{circle:s}=t.$el;let i=!1;return(N(e)||s)&&(i=e===!0?s.each(function(n){let a=t.getClass("circle",!0)(n);this.getAttribute("class").indexOf(D.EXPANDED)>-1&&(a+=` ${D.EXPANDED}`),this.setAttribute("class",a)}):t.getClass("circle",!0)(e)),i},generateGetLinePoints(e,t){const s=this,{config:i}=s,n=s.getShapeX(0,e,t),a=s.getShapeY(t),o=s.getShapeOffset(s.isLineType,e,t),r=s.getYScaleById.bind(s);return(l,c)=>{const u=r.call(s,l.id,t)(s.getShapeYMin(l.id)),d=o(l,c)||u,h=n(l);let g=a(l);i.axis_rotated&&(l.value>0&&g<u||l.value<0&&u<g)&&(g=u);const f=[h,g-(u-d)];return[f,f,f,f]}},custom:{create(e,t,s){return e.append("use").attr("xlink:href",`#${t}`).attr("class",this.updatePointClass.bind(this)).style("fill",s).node()},update(e,t,s,i,n,a,o){const r=this,{width:l,height:c}=Yt(e.node()),u=g=>M(g.value)?t(g)-l/2:0,d=g=>M(g.value)?s(g)-c/2:0;let h=e;return n&&(a&&h.attr("x",u),h=r.$T(h,n,ne()),o&&r.$T(o,n,ne())),h.attr("x",u).attr("y",d).style("fill",i)}},circle:{create(e,t,s){return e.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",t).style("fill",s).node()},update(e,t,s,i,n,a,o){const r=this;let l=e;return r.hasType("bubble")&&l.attr("r",r.pointR.bind(r)),n&&(a&&l.attr("cx",t),l.attr("cx")&&(l=r.$T(l,n,ne())),o&&r.$T(l,n,ne())),l.attr("cx",t).attr("cy",s).style("fill",i)}},rectangle:{create(e,t,s){const i=n=>t(n)*2;return e.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",i).attr("height",i).style("fill",s).node()},update(e,t,s,i,n,a,o){const r=this,l=r.config.point_r,c=h=>t(h)-l,u=h=>s(h)-l;let d=e;return n&&(a&&d.attr("x",c),d=r.$T(d,n,ne()),o&&r.$T(o,n,ne())),d.attr("x",c).attr("y",u).style("fill",i)}}};function zr(e){return bt(e)&&k(e.create)&&k(e.update)}function Fr(e,t){var s;const i=this,n=(l,c)=>{const u=l.attributes;for(let d=0,h;h=u[d];d++)h=h.name,c.setAttribute(h,l.getAttribute(h))},o=new DOMParser().parseFromString(Pt(e),"image/svg+xml").documentElement,r=lt.createElementNS(R.namespaces.svg,o.nodeName.toLowerCase());if(r.id=t,r.style.fill="inherit",r.style.stroke="inherit",n(o,r),(s=o.childNodes)!=null&&s.length){const l=(0,R.select)(r);"innerHTML"in r?l.html(Pt(o.innerHTML)):jt(o.childNodes).forEach(c=>{n(c,l.append(c.tagName).node())})}i.$el.defs.node().appendChild(r)}var ae={hasValidPointType(e){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(e||this.config.point_type)},hasLegendDefsPoint(){var e;const{config:t}=this;return t.legend_show&&((e=t.point_pattern)==null?void 0:e.length)&&t.legend_usePoint},getDefsPointId(e){const{state:{datetimeId:t}}=this;return`${t}-point${e}`},generatePoint(){const e=this,{$el:t,config:s}=e,i=[],n=at(s.point_pattern)?s.point_pattern:[s.point_type];return function(a,o,...r){return function(l){var c,u,d,h;const g=e.getTargetSelectorSuffix(l.id||((c=l.data)==null?void 0:c.id)||l),f=(0,R.select)(this);i.indexOf(g)<0&&i.push(g);let p=n[i.indexOf(g)%n.length];if(e.hasValidPointType(p))p=e[p];else if(!zr(p||s.point_type)){const _=e.getDefsPointId(g);if(t.defs.select(`#${_}`).size()<1&&Fr.call(e,p,_),a==="create")return(u=e.custom)==null?void 0:u.create.bind(o)(f,_,...r);if(a==="update")return(d=e.custom)==null?void 0:d.update.bind(o)(f,...r)}return(h=p[a])==null?void 0:h.bind(o)(f,...r)}}}};function wi(e){const t=e.config.polar_level_max;let s=e.getMinMaxData().max[0].value;return t&&t>s&&(s=t),s}var Mr={initPolar(){const e=this,{$el:{arcs:t},config:s}=e,i=s.polar_level_text_show,n=s.polar_level_text_backgroundColor;t.levels=t.append("g").attr("class",zt.levels),i&&n&&e.generateTextBGColorFilter(n)},getPolarOuterRadius(e,t){var s;const i=wi(this);return((s=e==null?void 0:e.data.values[0].value)!=null?s:0)/i*t},updateTargetsForPolar(e){this.updateTargetsForArc(e)},redrawPolar(){const e=this,{config:t}=e;t.polar_level_show&&e.updatePolarLevel()},updatePolarLevel(){const e=this,{config:t,state:s,$el:{arcs:{levels:i}}}=e,n=t.polar_level_depth,a=wi(e),o=Se(0,n),r=s.radius,l=o.map(h=>r*((h+1)/n)),c=(t.polar_level_text_format||function(){}).bind(e.api),u=i.selectAll(`.${zt.level}`).data(o);u.exit().remove();const d=u.enter().append("g").attr("class",(h,g)=>`${zt.level} ${zt.level}-${g}`);if(d.append("circle"),d.merge(u).selectAll("circle").style("visibility",t.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>l[h]),t.polar_level_text_show){const h=t.polar_level_text_backgroundColor,g=`#${s.datetimeId}-labels-bg${e.getTargetSelectorSuffix(h)}`;d.append("text").style("text-anchor","middle"),d.merge(u).selectAll("text").attr("dy",f=>-l[f]+5).attr("filter",h?`url(${g})`:null).text(f=>c(a/o.length*(f+1)))}}};function Xr(e,t,s,i,n,a){const o=e&&i>0?s-i:i,r=2*Math.PI;return n*(1-a*(t==="x"?Math.sin:Math.cos)(o*r/s))}const oe=xt.radarPoints,Si=xt.radarTextWidth;var Br={initRadar(){const e=this,{config:t,state:{current:s},$el:i}=e;e.hasType("radar")&&(i.radar=i.main.select(`.${D.chart}`).append("g").attr("class",as.chartRadars),i.radar.levels=i.radar.append("g").attr("class",zt.levels),i.radar.axes=i.radar.append("g").attr("class",ot.axis),i.radar.shapes=i.radar.append("g").attr("class",it.shapes),s.dataMax=t.radar_axis_max||e.getMinMaxData().max[0].value,t.radar_axis_text_show&&(t.interaction_enabled&&e.bindRadarEvent(),e.updateRadarLevel(),e.updateRadarAxes()))},getRadarSize(){const e=this,{config:t,state:{arcWidth:s,arcHeight:i}}=e,n=t.axis_x_categories.length<4?-20:10,a=(Math.min(s,i)-n)/2;return[a,a]},updateTargetsForRadar(e){const t=this,{config:s}=t;vt(s.axis_x_categories)&&(s.axis_x_categories=Se(0,Rt("max",e.map(i=>i.values.length)))),t.generateRadarPoints()},getRadarPosition(e,t,s,i){const n=this,{config:a}=n,[o,r]=n.getRadarSize(),l=a.axis_x_categories.length,c=a.radar_direction_clockwise,u=jt(e).map(d=>Xr(c,d,l,t,W(s)?s:e==="x"?o:r,I(i)?i:a.radar_size_ratio));return u.length===1?u[0]:u},generateRadarPoints(){const e=this,t=e.data.targets,[s,i]=e.getRadarSize(),n=e.cache.get(oe)||{},a=n._size;(!a||a.width!==s&&a.height!==i)&&(t.forEach(o=>{n[o.id]=o.values.map((r,l)=>e.getRadarPosition(["x","y"],l,void 0,e.getRatio("radar",r)))}),n._size={width:s,height:i},e.cache.add(oe,n))},redrawRadar(){const e=this,{radar:t,main:s}=e.$el,i=e.getTranslate("radar");i&&(t.attr("transform",i),s.select(`.${rt.chartTexts}`).attr("transform",i),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(oe);return(t,s)=>{const i=e[t.id][s];return[i,i,i,i]}},updateRadarLevel(){const e=this,{config:t,state:s,$el:{radar:i}}=e,[n,a]=e.getRadarSize(),o=t.radar_level_depth,r=t.axis_x_categories.length,l=t.radar_level_text_show,c=i.levels,u=Se(0,o),d=t.radar_size_ratio*Math.min(n,a),h=u.map(x=>d*((x+1)/o)),g=(t.radar_level_text_format||function(){}).bind(e.api),f=u.map(x=>{const m=h[x];return Se(0,r).map($=>e.getRadarPosition(["x","y"],$,m,1).join(",")).join(" ")}),p=c.selectAll(`.${zt.level}`).data(u);p.exit().remove();const _=p.enter().append("g").attr("class",(x,m)=>`${zt.level} ${zt.level}-${m}`);_.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),l&&(c.select("text").empty()&&c.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>g(0)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(x=>g(s.current.dataMax/u.length*(x+1)))),_.merge(p).attr("transform",x=>`translate(${n-h[x]}, ${a-h[x]})`).selectAll("polygon").attr("points",x=>f[x]),l&&c.selectAll("text").attr("x",x=>nt(x)?n:f[x].split(",")[0]).attr("y",x=>nt(x)?a:0)},updateRadarAxes(){const e=this,{config:t,$el:{radar:s}}=e,[i,n]=e.getRadarSize(),a=t.axis_x_categories;let o=s.axes.selectAll("g").data(a);o.exit().remove();const r=o.enter().append("g").attr("class",(l,c)=>`${ot.axis}-${c}`);if(t.radar_axis_line_show&&r.append("line"),t.radar_axis_text_show&&r.append("text"),o=r.merge(o),t.radar_axis_line_show&&o.select("line").attr("x1",i).attr("y1",n).attr("x2",(l,c)=>e.getRadarPosition("x",c)).attr("y2",(l,c)=>e.getRadarPosition("y",c)),t.radar_axis_text_show){const{x:l=0,y:c=0}=t.radar_axis_text_position,u=e.cache.get(Si)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){Qt((0,R.select)(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){nt(this.width)&&(this.width=ct(this,!0).width/2);let h=e.getRadarPosition("x",d.index,void 0,1),g=Math.round(e.getRadarPosition("y",d.index,void 0,1));return h>i?h+=this.width+l:Math.round(h)<i&&(h-=this.width+l),g>n?(g/2===n&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),g+=c):g<n&&(g-=c),`translate(${h} ${g})`}),!u){const d=[s.axes,s.levels].map(h=>fs(h.node()).width);d.every(h=>h>0)&&e.cache.add(Si,d[0]-d[1])}}},bindRadarEvent(){const e=this,{config:t,state:s,$el:{radar:i,svg:n}}=e,a=e.isPointFocusOnly(),{inputType:o,transiting:r}=s,l=o==="mouse",c=u=>{if(s.event=u,!t.interaction_onout)return;const d=e.getDataIndexFromEvent(u),h=nt(d);(l||h)&&(e.hideTooltip(),a?e.hideCircleFocus():e.unexpandCircles(),l?e.setOverOut(!1,d):h&&e.callOverOutForTouch())};i.axes.on(l?"mouseover ":"touchstart",u=>{if(r)return;s.event=u;const d=e.getDataIndexFromEvent(u);e.selectRectForSingle(n.node(),d),l?e.setOverOut(!0,d):e.callOverOutForTouch(d)},l?void 0:{passive:!0}).on("mouseout",l?c:null),l||n.on("touchstart",c,{passive:!0})},updateRadarShape(){const e=this,t=e.data.targets.filter(a=>e.isRadarType(a)),s=e.cache.get(oe),i=e.$el.radar.shapes.selectAll("polygon").data(e.filterNullish(t)),n=i.enter().append("g").attr("class",e.getChartClass("Radar"));e.$T(i.exit()).remove(),n.append("polygon").merge(i).style("fill",e.color).style("stroke",e.color).attr("points",a=>s[a.id].join(" ")),e.updateTargetForCircle(t,n)},radarCircleX(e){return this.cache.get(oe)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(oe)[e.id][e.index][1]}},It=Z(14);function Nr(e,t){const s=this,{scale:{x:i,y:n},state:{width:a}}=s;e.selectAll("g").attr("transform",o=>`translate(${o===t?"0,0":`${i(o.x0)},${n(o.y0)}`})`).select("rect").attr("width",o=>o===t?a:i(o.x1)-i(o.x0)).attr("height",o=>o===t?0:n(o.y1)-n(o.y0))}function Gr(e){const t=this;return e.map(s=>{const{id:i,values:n}=s,{value:a}=n[0];return{name:i,id:i,value:a,ratio:t.getRatio("treemap",n[0])}})}function Vr(e){const t=this,s=(0,It.hierarchy)(e).sum(n=>n.value),i=t.getSortCompareFn(!0);return[t.treemap(i?s.sort(i):s)]}var Yr={initTreemap(){const e=this,{$el:t,state:{current:{width:s,height:i},clip:n,datetimeId:a}}=e;n.id=`${a}-clip`,e.treemap=(0,It.treemap)().tile(e.getTreemapTile()),t.defs.append("clipPath").attr("id",n.id).append("rect").attr("width",s).attr("height",i),t.treemap=t.main.select(`.${D.chart}`).attr("clip-path",`url(#${n.id})`).append("g").classed(rs.chartTreemaps,!0),e.bindTreemapEvent()},bindTreemapEvent(){const e=this,{$el:t,config:s,state:i}=e,n=a=>{var o;const r=a.isTrusted?a.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return/^rect$/i.test(r.tagName)&&(i.event=a,l=(0,R.select)(r).datum()),l==null?void 0:l.data};if(s.interaction_enabled){const a=i.inputType==="touch";t.treemap.on(a?"touchstart":"mouseover mousemove",o=>{const r=n(o);r&&(e.showTooltip([r],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},a?{passive:!0}:void 0).on(a?"touchend":"mouseout",o=>{const r=n(o);s.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},getTreemapTile(){var e,t;const s=this,{config:i,state:{current:{width:n,height:a}}}=s,o=(t={binary:It.treemapBinary,dice:It.treemapDice,slice:It.treemapSlice,sliceDice:It.treemapSliceDice,squarify:It.treemapSquarify,resquarify:It.treemapResquarify}[(e=i.treemap_tile)!=null?e:"binary"])!=null?t:It.treemapBinary;return(r,l,c,u,d)=>{o(r,0,0,n,a);for(const h of r.children)h.x0=l+h.x0/n*(u-l),h.x1=l+h.x1/n*(u-l),h.y0=c+h.y0/a*(d-c),h.y1=c+h.y1/a*(d-c)}},getTreemapData(e){const t=this;return{name:"root",children:Gr.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:s}}=t,i=Vr.call(t,t.getTreemapData(e!=null?e:t.data.targets));s.data(t.filterNullish(i))},updateTreemap(e){const t=this,{$el:s,$T:i}=t,n=s.treemap.datum(),a=t.getChartClass("Treemap"),o=t.getClass("treemap",!0),r=s.treemap.selectAll("g").data(n.children);i(r.exit(),e).style("opacity","0").remove(),r.enter().append("g").append("rect"),s.treemap.selectAll("g").attr("class",a).select("rect").attr("class",o).attr("fill",l=>t.color(l.data.name))},generateGetTreemapPoints(){const e=this,{$el:t,scale:{x:s,y:i}}=e,n={};return t.treemap.selectAll("g").each(a=>{n[a.data.name]=[[s(a.x0),i(a.y0)],[s(a.x1),i(a.y1)]]}),a=>n[a.id]},redrawTreemap(e){const t=this,{$el:s,state:{current:{width:i,height:n}}}=t;return s.defs.select("rect").attr("width",i).attr("height",n),[t.$T(s.treemap,e,Ct()).call(Nr.bind(t),s.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{$el:{treemap:s},config:i,scale:{x:n,y:a}}=t,{id:o,value:r}=e,l=i.treemap_label_format,c=t.getRatio("treemap",e),u=(c*100).toFixed(2),d=i.treemap_label_show&&Ue.call(t,c,"treemap")?null:"0",h=s.selectAll("g").filter(p=>p.data.id===o).datum();let g=0,f=0;if(h){const{x0:p,x1:_,y0:x,y1:m}=h;g=n(_)-n(p),f=a(m)-a(x)}return function(p){return p.style("opacity",d),k(l)?l.bind(t.api)(r,c,o,{width:g,height:f}):`${o}
|
|
33
|
-
${u}%`}}},
|
|
33
|
+
`):[];if(l.length)return l;if(Y(r))return r;let c=o.tickWidth;(!c||c<=0)&&(c=n?95:o.isCategory?(o.isInverted?s(i[0])-s(i[1]):s(i[1])-s(i[0]))-12:110);function u(d,h){let g,f,p;for(let _=1;_<h.length;_++)if(h.charAt(_)===" "&&(f=_),g=h.substr(0,_+1),p=a*g.length,c<p)return u(d.concat(h.substr(0,f||_)),h.slice(f?f+1:_));return d.concat(h)}return u(l,String(r))}scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?String(t):"bottom",this):this.config.orient}tickFormat(t){const{config:s}=this;return arguments.length?(s.tickFormat=t,this):s.tickFormat}tickCentered(t){const{config:s}=this;return arguments.length?(s.tickCentered=t,this):s.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(t){var s;const{outerTickSize:i,tickOffset:n,tickValues:a}=this.config;let o;if(this.params.isCategory)o=n*2;else{const r=(s=this.params.owner.scale.zoom)!=null?s:this.helper.scale;o=(this.g.select("path.domain").node().getTotalLength()-i*2)/(t||this.g.selectAll("line").size());const c=a?a.map((u,d,h)=>{const g=d+1;return g<h.length?r(h[g])-r(u):null}).filter(Boolean):[];o=Math.min(...c,o)}return o===1/0?0:o}ticks(...t){const{config:s}=this;return t.length?(s.tickArguments=Yt(t),this):s.tickArguments}tickCulling(t){const{config:s}=this;return arguments.length?(s.tickCulling=t,this):s.tickCulling}tickValues(t){const{config:s}=this;if(k(t))s.tickValues=()=>t(this.helper.scale.domain());else{if(!arguments.length)return s.tickValues;s.tickValues=t}return this}setTransition(t){return this.config.transition=t,this}}var qo=Object.defineProperty,Ko=(e,t,s)=>t in e?qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Pt=(e,t,s)=>Ko(e,typeof t!="symbol"?t+"":t,s),Jo={getAxisInstance:function(){return this.axis||new Qo(this)}};class Qo{constructor(t){Pt(this,"owner"),Pt(this,"x"),Pt(this,"subX"),Pt(this,"y"),Pt(this,"y2"),Pt(this,"axesList",{}),Pt(this,"tick",{x:null,y:null,y2:null}),Pt(this,"xs",[]),Pt(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${rt.axis} ${rt[`axis${xt(t)}`]}`}isHorizontal(t,s){const i=t.config.axis_rotated;return s?i:!i}isCategorized(){const{config:t,state:s}=this.owner;return t.axis_x_type.indexOf("category")>=0||s.hasRadar}isCustomX(){const{config:t}=this.owner;return!this.isTimeSeries()&&(t.data_x||ot(t.data_xs))}isTimeSeries(t="x"){return this.owner.config[`axis_${t}_type`]==="timeseries"}isLog(t="x"){return this.owner.config[`axis_${t}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(t="x"){let s="linear";return this.isTimeSeries(t)?s=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(s="log"),s}getExtent(){const t=this.owner,{config:s,scale:i}=t;let n=s.axis_x_extent;if(n){if(k(n))n=n.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(this.isTimeSeries()&&n.every(isNaN)){const a=At.bind(t);n=n.map(o=>i.subX(a(o)))}}return n}init(){const t=this.owner,{config:s,$el:{main:i,axis:n},state:{clip:a}}=t,o=["x","y"];s.axis_y2_show&&o.push("y2"),o.forEach(r=>{const l=this.getAxisClassName(r);n[r]=i.append("g").attr("class",l).attr("clip-path",()=>{let c=null;return r==="x"?c=a.pathXAxis:r==="y"&&(c=a.pathYAxis),c}).attr("transform",t.getTranslate(r)).style("visibility",s[`axis_${r}_show`]?null:"hidden"),this.generateAxes(r)})}setOrient(){const t=this.owner,{axis_rotated:s,axis_y_inner:i,axis_y2_inner:n}=t.config;this.orient={x:s?"left":"bottom",y:s?i?"top":"bottom":i?"right":"left",y2:s?n?"bottom":"top":n?"left":"right",subX:s?"left":"bottom"}}generateAxes(t){const s=this.owner,{config:i}=s,n=[],a=i[`axis_${t}_axes`],o=i.axis_rotated;let r;t==="x"?r=o?se.axisLeft:se.axisBottom:t==="y"?r=o?se.axisBottom:se.axisLeft:t==="y2"&&(r=o?se.axisTop:se.axisRight),a.length&&a.forEach(l=>{const c=l.tick||{},u=s.scale[t].copy();l.domain&&u.domain(l.domain),n.push(r(u).ticks(c.count).tickFormat(k(c.format)?c.format.bind(s.api):(d=>d)).tickValues(c.values).tickSizeOuter(c.outer===!1?0:6))}),this.axesList[t]=n}updateAxes(){const t=this.owner,{config:s,$el:{main:i},$T:n}=t;Object.keys(this.axesList).forEach(a=>{const o=s[`axis_${a}_axes`],r=t.scale[a].copy(),l=r.range();this.axesList[a].forEach((c,u)=>{const d=c.scale().range();l.every((f,p)=>f===d[p])||c.scale().range(l);const h=`${this.getAxisClassName(a)}-${u+1}`;let g=i.select(`.${h.replace(/\s/,".")}`);g.empty()?g=i.append("g").attr("class",h).style("visibility",s[`axis_${a}_show`]?null:"hidden").call(c):(o[u].domain&&r.domain(o[u].domain),n(g).call(c.scale(r))),g.attr("transform",t.getTranslate(a,u+1))})})}setAxis(t,s,i,n){const a=this.owner;t!=="subX"&&(this.tick[t]=this.getTickValues(t)),this[t]=this.getAxis(t,s,i,t==="x"&&(a.scale.zoom||a.config.subchart_show||a.state.resizing)?!0:n)}getAxis(t,s,i,n,a){const o=this.owner,{config:r}=o,l=/^(x|subX)$/.test(t),c=l?"x":t,u=l&&this.isCategorized(),d=this.orient[t],h=a?0:o.getAxisTickRotate(c);let g;if(l)g=t==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const m=r[`axis_${t}_tick_format`];k(m)&&(g=m.bind(o.api))}let f=this.tick[c];const p=te({outerTick:i,noTransition:n,config:r,id:t,tickTextRotate:h,owner:o},l&&{isCategory:u,isInverted:r.axis_x_inverted,tickMultiline:r.axis_x_tick_multiline,tickWidth:r.axis_x_tick_width,tickTitle:u&&r.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new Zo(p).scale(l&&o.scale.zoom||s).orient(d);if(l&&this.isTimeSeries()&&f&&!k(f)){const m=At.bind(o);f=f.map(y=>m(y))}else!l&&this.isTimeSeriesY()&&(_.ticks(r.axis_y_tick_time_value),f=null);f&&_.tickValues(f),_.tickFormat(g||!l&&o.isStackNormalized()&&o.hasAxisGroupedData(t)&&(m=>`${m}%`)),u&&(_.tickCentered(r.axis_x_tick_centered),vt(r.axis_x_tick_culling)&&(r.axis_x_tick_culling=!1));const x=r[`axis_${c}_tick_count`];return x&&_.ticks(x),_}updateXAxisTickValues(t,s){var i;const n=this.owner,{config:a}=n,o=a.axis_x_tick_fit;let r=a.axis_x_tick_count,l;return(o||r&&o)&&(l=n.mapTargetsToUniqueXs(t),this.isCategorized()&&r>l.length&&(r=l.length),l=this.generateTickValues(l,r,this.isTimeSeries())),s?s.tickValues(l):this.x&&(this.x.tickValues(l),(i=this.subX)==null||i.tickValues(l)),l}getId(t){const{config:s,scale:i}=this.owner;let n=s.data_axes[t];return(!n||!i[n])&&(n="y"),n}getXAxisTickFormat(t){const s=this.owner,{config:i,format:n}=s,a=t&&i.subchart_axis_x_tick_format||i.axis_x_tick_format,o=this.isTimeSeries(),r=this.isCategorized();let l;return a?k(a)?l=a.bind(s.api):o&&(l=c=>c?n.axisTime(a)(c):""):l=o?n.defaultAxisTime:r?s.categoryName:c=>c<0?c.toFixed(0):c,k(l)?c=>l.apply(s,r?[c,s.categoryName(c)]:[c]):l}getTickValues(t){const s=this.owner,i=s.config[`axis_${t}_tick_values`],n=s[`${t}Axis`];return(k(i)?i.call(s.api):i)||(n?n.tickValues():void 0)}getLabelOptionByAxisId(t){return this.owner.config[`axis_${t}_label`]}getLabelText(t){const s=this.getLabelOptionByAxisId(t);return N(s)?s:s?s.text:null}setLabelText(t,s){const i=this.owner,{config:n}=i,a=this.getLabelOptionByAxisId(t);N(a)?n[`axis_${t}_label`]=s:a&&(a.text=s)}getLabelPosition(t,s){const i=this.owner.config.axis_rotated,n=this.getLabelOptionByAxisId(t),a=bt(n)&&n.position?n.position:s[+!i],o=r=>!!~a.indexOf(r);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}}getAxisLabelPosition(t){return this.getLabelPosition(t,t==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}getLabelPositionById(t){return this.getAxisLabelPosition(t)}xForAxisLabel(t){const s=this.owner,{state:{width:i,height:n}}=s,a=this.getAxisLabelPosition(t);let o=a.isMiddle?-n/2:0;return this.isHorizontal(s,t!=="x")?o=a.isLeft?0:a.isCenter?i/2:i:a.isBottom&&(o=-n),o}textAnchorForAxisLabel(t){const s=this.owner,i=this.getAxisLabelPosition(t);let n=i.isMiddle?"middle":"end";return this.isHorizontal(s,t!=="x")?n=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(n="start"),n}dxForAxisLabel(t){const s=this.owner,i=this.getAxisLabelPosition(t);let n=i.isBottom?"0.5em":"0";return this.isHorizontal(s,t!=="x")?n=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(n="-0.5em"),n}dyForAxisLabel(t){const s=this.owner,{config:i}=s,n=i.axis_rotated,a=this.getAxisLabelPosition(t).isInner,o=i[`axis_${t}_tick_rotate`]?s.getHorizontalAxisHeight(t):0,{width:r}=this.getMaxTickSize(t);let l;if(t==="x"){const c=i.axis_x_height;n?l=a?"1.2em":-25-r:a?l="-0.5em":c?l=c-10:o?l=o-10:l="3em"}else l={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],n?a?l=l[0]:o?l=o*(t==="y2"?-1:1)-l[1]:l=l[2]:l=a?l[3]:(l[4]+(i[`axis_${t}_inner`]?0:r+l[4]))*(t==="y"?-1:1);return l}getMaxTickSize(t,s){const i=this.owner,{config:n,state:{current:a,resizing:o},$el:{svg:r,chart:l}}=i,c=a.maxTickSize[t],u=`axis_${t}`,d={width:0,height:0};if(o||s||!n[`${u}_show`]||c.width>0&&i.filterTargetsToShow().length===0)return c;if(r){const h=/^y2?$/.test(t),g=i.filterTargetsToShow(i.data.targets),f=i.scale[t].copy().domain(i[`get${h?"Y":"X"}Domain`](g,t)),p=f.domain(),_=p[0]===p[1]&&p.every(S=>S>0),x=Y(c.domain)&&c.domain[0]===c.domain[1]&&c.domain.every(S=>S>0);if(_||x)return c.size;c.domain=p,h||c.ticks.splice(0);const m=this.getAxis(t,f,!1,!1,!0),y=n[`${u}_tick_rotate`],$=n[`${u}_tick_count`];!n[`${u}_tick_values`]&&$&&m.tickValues(this.generateTickValues(p,$,h?this.isTimeSeriesY():this.isTimeSeries())),!h&&this.updateXAxisTickValues(g,m);const b=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),T=b.append("g").attr("class",`${rt[`axis${xt(t)}`]} ${D.dummy}`);m.create(T);const{sizeFor1Char:C}=T.node();b.selectAll("text").attr("transform",I(y)?`rotate(${y})`:null).each(function(S,A){const{width:w,height:O}=C?{width:this.textContent.length*C.w,height:C.h}:dt(this,!0);d.width=Math.max(d.width,w),d.height=Math.max(d.height,O),h||(c.ticks[A]=w)}),b.remove()}return Object.keys(d).forEach(h=>{d[h]>0&&(c[h]=d[h])}),c}getXAxisTickTextY2Overflow(t){const s=this.owner,{axis:i,config:n,state:{current:a,isLegendRight:o,legendItemWidth:r}}=s,l=s.getAxisTickRotate("x"),c=l>0&&l<90;if((i.isCategorized()||i.isTimeSeries())&&n.axis_x_tick_fit&&(!n.axis_x_tick_culling||vt(n.axis_x_tick_culling))&&!n.axis_x_tick_multiline&&c){const u=n.axis_y2_show&&a.maxTickSize.y2.width||0,d=o&&r||0,h=a.width-s.getCurrentPaddingByDirection("left"),g=this.getXAxisTickMaxOverflow(l,h-t)-u-d,f=Math.max(0,g)+t;return Math.min(f,h/2)}return 0}getXAxisTickMaxOverflow(t,s){const i=this.owner,{axis:n,config:a,state:o}=i,r=n.isTimeSeries(),l=o.current.maxTickSize.x.ticks,c=l.length,{left:u,right:d}=o.axis.x.padding;let h=0;const g=c-(r&&a.axis_x_tick_fit?.5:0);for(let _=0;_<c;_++){const x=_+1,m=Math.cos(Math.PI*t/180)*l[_],y=x-(r?1:.5)+u;if(y<=0)continue;const v=(s-m)/y,b=g-x,T=d*v,C=b*v+T,S=m-v/2-C;h=Math.max(h,S)}const f=i.filterTargetsToShow(i.data.targets);let p=0;if(!r&&a.axis_x_tick_count<=f.length&&f[0].values.length){const _=Wt(i.axis.getAxisType("x"),0,s-h).domain([u*-1,i.getXDomainMax(i.data.targets)+1+d]);p=(_(1)-_(0))/2}return h+p}updateLabels(t){const s=this.owner,{config:i,$el:{main:n},$T:a}=s,o=i.axis_rotated;["x","y","y2"].forEach(r=>{const l=this.getLabelText(r),c=`axis${xt(r)}`,u=rt[`${c}Label`];if(l){let d=n.select(`text.${u}`);d.empty()&&(d=n.select(`g.${rt[c]}`).insert("text",":first-child").attr("class",u).attr("transform",["rotate(-90)",null][r==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(r))),a(d,t).attr("x",()=>this.xForAxisLabel(r)).attr("dx",()=>this.dxForAxisLabel(r)).attr("dy",()=>this.dyForAxisLabel(r)).text(l)}})}getPadding(t,s,i,n){const a=I(t)?t:t[s];return M(a)?this.owner.convertPixelToScale(/(bottom|top)/.test(s)?"y":"x",a,n):i}generateTickValues(t,s,i){let n=t;if(s){const a=k(s)?s():s;if(a===1)n=[t[0]];else if(a===2)n=[t[0],t[t.length-1]];else if(a>2){const o=this.isCategorized(),r=a-2,l=t[0],c=t[t.length-1],u=(c-l)/(r+1);let d;n=[l];for(let h=0;h<r;h++)d=+l+u*(h+1),n.push(i?new Date(d):o?Math.round(d):d);n.push(c)}}return i||(n=n.sort((a,o)=>a-o)),n}generateTransitions(t){const s=this.owner,{$el:{axis:i},$T:n}=s,[a,o,r,l]=["x","y","y2","subX"].map(c=>n(i[c],t));return{axisX:a,axisY:o,axisY2:r,axisSubX:l}}redraw(t,s,i){const n=this.owner,{config:a,state:o,$el:r}=n,l=s?"0":null;["x","y","y2","subX"].forEach(c=>{const u=this[c],d=r.axis[c];u&&d&&(!i&&!a.transition_duration&&(u.config.withoutTransition=!0),d.style("opacity",l),u.create(t[`axis${xt(c)}`]))}),this.updateAxes(),!o.rendered&&a.axis_tooltip&&this.setAxisTooltip()}redrawAxis(t,s,i,n,a){var o,r,l;const c=this.owner,{config:u,scale:d,$el:h}=c,g=!!d.zoom;let f;!g&&this.isCategorized()&&t.length===0&&d.x.domain([0,h.axis.x.selectAll(".tick").size()]),d.x&&t.length?(!g&&c.updateXDomain(t,s.UpdateXDomain,s.UpdateOrgXDomain,s.TrimXDomain),u.axis_x_tick_values||this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),(o=this.subX)==null||o.tickValues([])),u.zoom_rescale&&!n&&(f=d.x.orgDomain()),["y","y2"].forEach(p=>{const _=`axis_${p}_`,x=d[p];if(x){const m=u[`${_}tick_values`],y=u[`${_}tick_count`];if(x.domain(c.getYDomain(t,p,f)),!m&&y){const $=c.axis[p],v=x.domain();$.tickValues(this.generateTickValues(v,v.every(b=>b===0)?1:y,this.isTimeSeriesY()))}}}),this.redraw(i,c.hasArcType(),a),this.updateLabels(s.Transition),(s.UpdateXDomain||s.UpdateXAxis||s.Y)&&t.length&&this.setCulling(),s.Y&&((r=d.subY)==null||r.domain(c.getYDomain(t,"y")),(l=d.subY2)==null||l.domain(c.getYDomain(t,"y2")))}setCulling(){const t=this.owner,{config:s,state:{clip:i,current:n},$el:a}=t;["subX","x","y","y2"].forEach(o=>{const r=a.axis[o],c=`axis_${o==="subX"?"x":o}_tick_culling`,u=s[c];if(r&&u){const d=r.selectAll(".tick"),h=ee(d.data(),!s[`${c}_reverse`]),g=h.length,f=s[`${c}_max`],p=s[`${c}_lines`];let _;if(g){for(let x=1;x<g;x++)if(g/x<f){_=x;break}d.each(function(x){const m=p?this.querySelector("text"):this;m&&(m.style.display=h.indexOf(x)%_?"none":null)})}else d.style("display",null);if(o==="x"){const x=n.maxTickSize.x.clipPath?i.pathXAxisTickTexts:null;a.svg.selectAll(`.${rt.axisX} .tick text`).attr("clip-path",x)}}})}setAxisTooltip(){var t;const s=this.owner,{config:{axis_rotated:i,axis_tooltip:n},$el:{axis:a,axisTooltip:o}}=s,r=(t=n.backgroundColor)!=null?t:"black";s.generateTextBGColorFilter(r,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(l=>{var c,u,d;if(N(r)||r[l])if(o[l]=(c=a[l])==null?void 0:c.append("text").classed(rt[`axis${l.toUpperCase()}Tooltip`],!0).attr("filter",s.updateTextBGColor({id:l},r)),i){const h=l==="x"?"x":"y",g=l==="y"?"1.15em":l==="x"?"-0.3em":"-0.4em";(u=o[l])==null||u.attr(h,g).attr(`d${l==="x"?"y":"x"}`,l==="x"?"0.4em":"-1.3em").style("text-anchor",l==="x"?"end":null)}else{const h=l==="x"?"y":"x",g=l==="x"?"1.15em":`${l==="y"?"-":""}0.4em`;(d=o[l])==null||d.attr(h,g).attr(`d${l==="x"?"x":"y"}`,l==="x"?"-1em":"0.3em").style("text-anchor",l==="y"?"end":null)}})}}var tr={initEventRect(){this.$el.main.select(`.${D.chart}`).append("g").attr("class",St.eventRects).style("fill-opacity","0")},redrawEventRect(){var e;const t=this,{config:s,state:i,$el:n}=t,a=t.isMultipleX(),o=s.axis_x_inverted;if(n.eventRect)t.updateEventRect(n.eventRect,!0);else if(t.data.targets.length){const l=t.$el.main.select(`.${St.eventRects}`).style("cursor",s.zoom_enabled&&s.zoom_type!=="drag"?s.axis_rotated?"ns-resize":"ew-resize":null).classed(St.eventRectsMultiple,a).classed(St.eventRectsSingle,!a).selectAll(`.${St.eventRect}`).data([0]).enter().append("rect");t.updateEventRect(l),t.updateEventType(l),l.call(t.getDraggableSelection()),n.eventRect=l,t.state.inputType==="touch"&&!n.svg.on("touchstart.eventRect")&&!t.hasArcType()&&t.bindTouchOnEventRect(),i.rendered&&t.updateEventRect(n.eventRect,!0)}if(!a){const r=t.getMaxDataCountTarget();(!s.data_xSort||o)&&r.sort((l,c)=>o?c.x-l.x:l.x-c.x),t.updateDataIndexByX(r),t.updateXs(r),(e=t.updatePointClass)==null||e.call(t,!0),i.eventReceiver.data=r}t.updateEventRectData()},bindTouchOnEventRect(){const e=this,{config:t,state:s,$el:{eventRect:i,svg:n}}=e,a=g=>{if(e.isMultipleX())e.selectRectForMultipleXs(g);else{const f=e.getDataIndexFromEvent(s.event);e.callOverOutForTouch(f),f===-1?e.unselectRect():e.selectRectForSingle(g,f)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=Me(r)&&r||!1,c=!isNaN(r)&&r||null;let u;const d=!l&&c===null,h=g=>{const f=g.type,_=g.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];f==="touchstart"?l?g.preventDefault():c!==null&&(u=_):f==="touchmove"&&(l||u===!0||c!==null&&Math.abs(u-_)>=c)&&(u=!0,g.preventDefault())};i.on("touchstart",g=>{s.event=g,e.updateEventRect()},{passive:d}).on("touchstart.eventRect touchmove.eventRect",g=>{if(s.event=g,!i.empty()&&i.classed(St.eventRect)){if(s.dragging||s.flowing||e.hasArcType()||g.touches.length>1)return;h(g),a(i.node())}else o()},{passive:d}).on("touchend.eventRect",g=>{s.event=g,!i.empty()&&i.classed(St.eventRect)&&(e.hasArcType()||!e.toggleShape||s.cancelClick)&&s.cancelClick&&(s.cancelClick=!1)},{passive:d}),n.on("touchstart",g=>{s.event=g;const{target:f}=g;f&&f!==i.node()&&o()},{passive:d})},updateEventRect(e,t=!1){const s=this,{state:i,$el:n}=s,{eventReceiver:a,width:o,height:r,rendered:l,resizing:c}=i,u=e||n.eventRect,d=()=>{if(a){const h=Ts(n.chart.node());a.rect=dt(u.node(),!0).toJSON(),a.rect.top+=h.y,a.rect.left+=h.x}};(!l||c||t)&&(u.attr("x",0).attr("y",0).attr("width",o).attr("height",r),(!l||t)&&u.classed(St.eventRect,!0)),d()},updateEventType(e){const t=this,s=Me(e),i=s?t.$el.eventRect:e,n=s?e!==(i==null?void 0:i.datum().multipleX):!1;i&&(n&&(i==null||i.on("mouseover mousemove mouseout click",null)),t.isMultipleX()?t.generateEventRectsForMultipleXs(i):t.generateEventRectsForSingleX(i))},updateEventRectData(){const e=this,{config:t,scale:s,state:i}=e,n=s.zoom||s.x,a=t.axis_rotated,o=e.isMultipleX();let r,l,c,u;if(e.updateEventType(o),o)r=0,l=0,c=i.width,u=i.height;else{let g,f;if(e.axis.isCategorized())g=e.getEventRectWidth(),f=p=>n(p.x)-g/2;else{const p=({index:_})=>({prev:e.getPrevX(_),next:e.getNextX(_)});g=_=>{const x=p(_),m=n.domain();let y;return x.prev===null&&x.next===null?y=a?i.height:i.width:x.prev===null?y=(n(x.next)+n(_.x))/2:x.next===null?y=n(m[1])-(n(x.prev)+n(_.x))/2:(Object.keys(x).forEach(($,v)=>{var b;x[$]=(b=x[$])!=null?b:m[v]}),y=Math.max(0,(n(x.next)-n(x.prev))/2)),y},f=_=>{const x=p(_);let m;return x.prev===null&&x.next===null?m=0:x.prev===null?m=n(n.domain()[0]):m=(n(_.x)+n(x.prev))/2,m}}r=a?0:f,l=a?f:0,c=a?i.width:g,u=a?g:i.height}const{eventReceiver:d}=i,h=(g,f)=>k(g)?g(f):g;d.coords.splice(d.data.length),d.data.forEach((g,f)=>{d.coords[f]={x:h(r,g),y:h(l,g),w:h(c,g),h:h(u,g)}})},selectRectForSingle(e,t){var s,i;const n=this,{config:a,$el:{main:o,circle:r}}=n,l=a.data_selection_enabled,c=a.data_selection_grouped,u=a.data_selection_isselectable,d=a.tooltip_grouped,h=n.getAllValuesOnIndex(t);if(d&&(n.showTooltip(h,e),(s=n.showGridFocus)==null||s.call(n,h),!l||c))return;!r&&o.selectAll(`.${D.EXPANDED}:not(.${it.shape}-${t})`).classed(D.EXPANDED,!1);const g=o.selectAll(`.${it.shape}-${t}`).classed(D.EXPANDED,!0).style("cursor",u?"pointer":null).filter(function(f){return n.isWithinShape(this,f)});g.empty()&&!d&&a.interaction_onout&&((i=n.hideGridFocus)==null||i.call(n),n.hideTooltip(),!c&&n.setExpand(t)),g.call(f=>{var p,_;const x=f.data();l&&(c||u!=null&&u.bind(n.api)(x))&&(e.style.cursor="pointer"),d||(n.showTooltip(x,e),(p=n.showGridFocus)==null||p.call(n,x),(_=n.unexpandCircles)==null||_.call(n),f.each(m=>n.setExpand(t,m.id)))})},selectRectForMultipleXs(e,t=!0){const s=this,{config:i,state:n}=s,a=s.filterTargetsToShow(s.data.targets);if(n.dragging||s.hasArcType(a))return;const o=Tt(n.event,e),r=s.findClosestFromTargets(a,o);if(t&&n.mouseover&&(!r||r.id!==n.mouseover.id)&&(i.data_onout.call(s.api,n.mouseover),n.mouseover=void 0),!r){s.unselectRect();return}const c=(s.isBubbleType(r)||s.isScatterType(r)||!i.tooltip_grouped?[r]:s.filterByX(a,r.x)).map(d=>s.addName(d));s.showTooltip(c,e),s.setExpand(r.index,r.id,!0),s.showGridFocus(c);const u=s.dist(r,o);(s.isBarType(r.id)||u<s.getPointSensitivity(r))&&(s.$el.svg.select(`.${St.eventRect}`).style("cursor","pointer"),t&&(!n.mouseover||n.mouseover.x!==r.x||n.mouseover.id!==r.id)&&(i.data_onover.call(s.api,r),n.mouseover=r))},unselectRect(){const e=this,{$el:{circle:t,tooltip:s}}=e;e.$el.svg.select(`.${St.eventRect}`).style("cursor",null),e.hideGridFocus(),s&&(e.hideTooltip(),e._handleLinkedCharts(!1)),t&&!e.isPointFocusOnly()&&e.unexpandCircles(),e.expandBarTypeShapes(!1)},generateEventRectsForSingleX(e){const t=this,{config:s,state:i}=t,{eventReceiver:n}=i,a=e.style("cursor",s.data_selection_enabled&&s.data_selection_grouped?"pointer":null).on("click",function(o){i.event=o;const{currentIdx:r,data:l}=n,c=l[r===-1?t.getDataIndexFromEvent(o):r];t.clickHandlerForSingleX.bind(this)(c,t)}).datum({multipleX:!1});if(i.inputType==="mouse"){const o=r=>{const l=r?t.getDataIndexFromEvent(r):n.currentIdx;return l>-1?n.data[l]:null};a.on("mouseover",r=>{i.event=r,t.updateEventRect(),Object.values(t.$el.axisTooltip).forEach(l=>l==null?void 0:l.style("display",null))}).on("mousemove",function(r){const l=o(r);if(i.event=r,!l)return;let{index:c}=l;const u=s.line_step_type;if(s.line_step_tooltipMatch&&t.hasType("step")&&/^step\-(before|after)$/.test(u)){const h=t.scale.zoom||t.scale.x,g=t.axis.xs[c],f=h.invert(Tt(r,this)[0]);u==="step-after"&&f<g?c-=1:u==="step-before"&&f>g&&(c+=1)}t.showAxisGridFocus();const d=s.tooltip_grouped&&c===n.currentIdx;if(i.dragging||i.flowing||t.hasArcType()||d){s.tooltip_show&&d&&t.setTooltipPosition();return}c!==n.currentIdx&&(t.setOverOut(!1,n.currentIdx),n.currentIdx=c),c===-1?t.unselectRect():t.selectRectForSingle(this,c),t.setOverOut(c!==-1,c)}).on("mouseout",r=>{i.event=r,!(!s||t.hasArcType()||n.currentIdx===-1||!s.interaction_onout)&&(t.hideAxisGridFocus(),t.unselectRect(),t.setOverOut(!1,n.currentIdx),n.currentIdx=-1)})}return a},clickHandlerForSingleX(e,t){const s=t,{config:i,state:n,$el:{main:a}}=s;if(!e||s.hasArcType()||n.cancelClick){n.cancelClick&&(n.cancelClick=!1);return}const{index:o}=e;a.selectAll(`.${it.shape}-${o}`).each(function(r){var l;(i.data_selection_grouped||s.isWithinShape(this,r))&&((l=s.toggleShape)==null||l.call(s,this,r,o),i.data_onclick.bind(s.api)(r,this))})},generateEventRectsForMultipleXs(e){const t=this,{config:s,state:i}=t;e.on("click",function(n){i.event=n,t.clickHandlerForMultipleXS.bind(this)(t)}).datum({multipleX:!0}),i.inputType==="mouse"&&e.on("mouseover mousemove",function(n){i.event=n,t.selectRectForMultipleXs(this)}).on("mouseout",n=>{i.event=n,!(!t.config||t.hasArcType()||!s.interaction_onout)&&t.unselectRect()})},clickHandlerForMultipleXS(e){const t=e,{config:s,state:i}=t,n=t.filterTargetsToShow(t.data.targets);if(t.hasArcType(n))return;const a=Tt(i.event,this),o=t.findClosestFromTargets(n,a),r=t.getPointSensitivity(o);o&&(t.isBarType(o.id)||t.dist(o,a)<r)&&t.$el.main.selectAll(`.${it.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${it.shape}-${o.index}`).each(function(){var l;(s.data_selection_grouped||t.isWithinShape(this,o))&&((l=t.toggleShape)==null||l.call(t,this,o,o.index),s.data_onclick.bind(t.api)(o,this))})}},er=Z(12),sr={generateFlow(e){const t=this,{data:s,state:i,$el:n}=t;return function(){const a=e.flow.length;i.flowing=!0,s.targets.forEach(r=>{r.values.splice(0,a)}),t.updateXGrid&&t.updateXGrid(!0);const o={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(r=>{const l=r.split(".");let c=n[l[0]];c&&l.length>1&&(c=c[l[1]]),c!=null&&c.size()&&(o[r]=c)}),t.hideGridFocus(),t.setFlowList(o,e)}},setFlowList(e,t){const s=this,{flow:i,targets:n}=t,{duration:a=t.duration,index:o,length:r,orgDataCount:l}=i,c=s.getFlowTransform(n,l,o,r),u=Is();let d;u.add(Object.keys(e).map(h=>(d=e[h].transition().ease(er.easeLinear).duration(a),h==="axis.x"?d=d.call(g=>{s.axis.x.setTransition(g).create(g)}):h==="region.list"?d=d.filter(s.isRegionOnX).attr("transform",c):d=d.attr("transform",c),d))),d.call(u,()=>{s.cleanUpFlow(e,t)})},cleanUpFlow(e,t){const s=this,{config:i,state:n,$el:{svg:a}}=s,o=i.axis_rotated,{flow:r,shape:l,xv:c}=t,{cx:u,cy:d,xForText:h,yForText:g}=l.pos,{done:f=()=>{},length:p}=r;p&&(["circle","text","shape","eventRect"].forEach(_=>{const x=[];for(let m=0;m<p;m++)x.push(`.${V[_]}-${m}`);a.selectAll(`.${V[`${_}s`]}`).selectAll(x).remove()}),a.select(`.${V.xgrid}`).remove()),Object.keys(e).forEach(_=>{const x=e[_];if(_!=="axis.x"&&x.attr("transform",null),_==="grid.x")x.attr(n.xgridAttr);else if(_==="gridLines.x")x.attr("x1",o?0:c).attr("x2",o?n.width:c),x.select("text").attr("x",o?n.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(_))x.attr("d",l.type[_]);else if(_==="text")x.attr("x",h).attr("y",g).style("fill-opacity",s.opacityForText.bind(s));else if(_==="circle")if(s.isCirclePoint())x.attr("cx",u).attr("cy",d);else{const m=$=>u($)-i.point_r,y=$=>d($)-i.point_r;x.attr("x",m).attr("y",y)}else _==="region.list"&&x.select("rect").filter(s.isRegionOnX).attr("x",s.regionX.bind(s)).attr("width",s.regionWidth.bind(s))}),i.interaction_enabled&&s.redrawEventRect(),f.call(s.api),n.flowing=!1},getFlowTransform(e,t,s,i){const n=this,{data:a,scale:{x:o}}=n,r=a.targets[0].values;let l=n.getValueOnIndex(r,s),c=n.getValueOnIndex(r,s+i),u;const d=o.domain(),h=n.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?u=o(d[0])-o(h[0]):u=n.axis.isTimeSeries()?o(d[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?u=o(d[0])-o(h[0]):n.axis.isTimeSeries()?(l=n.getValueOnIndex(r,0),c=n.getValueOnIndex(r,r.length-1),u=o(l.x)-o(c.x)):u=Vt(h)/2;const g=Vt(d)/Vt(h);return`translate(${u},0) scale(${g},1)`}},ir={initClip(){const e=this,{clip:t,datetimeId:s}=e.state;t.id=`${s}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:s}=t;return!s.clipPath&&/-clip$/.test(e)||!s.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!s.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+a+10:i.bottom)+20,c=o?-(1+r):-(r-1),u=-15,d=o?i.left+20:n+10+r;e.attr("x",c).attr("y",u).attr("width",d).attr("height",l)},setYAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=s.axis_y_inner,c=l&&!o?s.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),u=-(o?20:i.top),d=(o?n+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+a)+10;e.attr("x",c).attr("y",u).attr("width",d).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:s,xAxisHeight:i},$el:{defs:n}}=e,a=e.getHorizontalAxisHeight("x");if(n&&!s.idXAxisTickTexts){const o=`${s.id}-xaxisticktexts`;e.appendClip(n,o),s.pathXAxisTickTexts=e.getClipPath(s.idXAxisTickTexts),s.idXAxisTickTexts=o}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&a!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=a},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:s}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const n=Math.sin(Math.PI/180*Math.abs(i));s.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/n}else s.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:s},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",s.maxTickSize.x.clipPath).attr("height",30)}};const nr=e=>M(e.position)||"end",ar=e=>e.position==="start"?4:e.position==="middle"?0:-4;function di(e,t,s){return i=>{let n=e?0:t;return i.position==="start"?n=e?-s:0:i.position==="middle"&&(n=(e?-s:t)/2),n}}function ui(e,t){t==="grid"&&e.each(function(){const s=(0,R.select)(this);["x1","x2","y1","y2"].forEach(i=>s.attr(i,+s.attr(i)))})}var or={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:s},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${D.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",s.pathGrid).attr("class",`${st.grid} ${st.gridLines}`),i.gridLines.main.append("g").attr("class",st.xgridLines),i.gridLines.main.append("g").attr("class",st.ygridLines),i.gridLines.x=(0,R.selectAll)([]))},updateXGrid(e){const t=this,{config:s,scale:i,state:n,$el:{main:a,grid:o}}=t,r=s.axis_rotated,l=t.generateGridData(s.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,u=d=>(i.zoom||i.x)(d)+c*(r?-1:1);n.xgridAttr=r?{x1:0,x2:n.width,y1:u,y2:u}:{x1:u,x2:u,y1:0,y2:n.height},o.x=a.select(`.${st.xgrids}`).selectAll(`.${st.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",st.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,R.select)(this);Object.keys(n.xgridAttr).forEach(h=>{d.attr(h,n.xgridAttr[h]).style("opacity",()=>d.attr(r?"y1":"x1")===(r?n.height:0)?"0":null)})})},updateYGrid(){const e=this,{axis:t,config:s,scale:i,state:n,$el:{grid:a,main:o}}=e,r=s.axis_rotated,l=u=>i.y(u),c=t.y.getGeneratedTicks(s.grid_y_ticks)||e.scale.y.ticks(s.grid_y_ticks);a.y=o.select(`.${st.ygrids}`).selectAll(`.${st.ygrid}`).data(c),a.y.exit().remove(),a.y=a.y.enter().append("line").attr("class",st.ygrid).merge(a.y),a.y.attr("x1",r?l:0).attr("x2",r?l:n.width).attr("y1",r?0:l).attr("y2",r?n.height:l),ui(a.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:s}}=e;!s.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:s,$el:{gridLines:i,main:n},$T:a}=t,o=s.axis_rotated,r=e==="x";s[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=n.select(`.${st[`${e}gridLines`]}`).selectAll(`.${st[`${e}gridLine`]}`).data(s[`grid_${e}_lines`]);a(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(u){const d=(0,R.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),a(l.attr("class",u=>`${st[`${e}gridLine`]} ${u.class||""}`.trim()).select("text").attr("text-anchor",nr).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",ar).attr("dy",-5)).text(function(u){var d;return(d=u.text)!=null?d:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:s},state:{width:i,height:n},$el:{gridLines:a},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=a.x.select("line"),u=a.x.select("text"),d=a.y.select("line"),h=a.y.select("text");return c=o(c,e).attr("x1",s?0:r).attr("x2",s?i:r).attr("y1",s?r:0).attr("y2",s?r:n),u=o(u,e).attr("x",di(!s,i,n)).attr("y",r),d=o(d,e).attr("x1",s?l:0).attr("x2",s?l:i).attr("y1",s?0:l).attr("y2",s?n:l),h=o(h,e).attr("x",di(s,i,n)).attr("y",l),[c.style("opacity",null),u.style("opacity",null),d.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:{clip:s},$el:i}=e,n=t.grid_front,a=`.${n&&i.gridLines.main?st.gridLines:D.chart}${n?" + *":""}`,o=i.main.insert("g",a).attr("clip-path",s.pathGrid).attr("class",st.grid);if(i.grid.main=o,t.grid_x_show&&o.append("g").attr("class",st.xgrids),t.grid_y_show&&o.append("g").attr("class",st.ygrids),t.axis_tooltip){const r=o.append("g").attr("class","bb-axis-tooltip");r.append("line").attr("class","bb-axis-tooltip-x"),r.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(o.append("g").attr("class",K.xgridFocus).append("line").attr("class",K.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&o.append("g").attr("class",K.ygridFocus).append("line").attr("class",K.ygridFocus))},showAxisGridFocus(){var e,t;const s=this,{config:i,format:n,state:{event:a,width:o,height:r}}=s,l=i.axis_rotated,[c,u]=Tt(a,(e=s.$el.eventRect)==null?void 0:e.node()),d={x:c,y:u};for(const[h,g]of Object.entries(s.$el.axisTooltip)){const f=h==="x"&&!l||h!=="x"&&l?"x":"y",p=d[f];let _=(t=s.scale[h])==null?void 0:t.invert(p);_&&(_=h==="x"&&s.axis.isTimeSeries()?n.xAxisTick(_):_==null?void 0:_.toFixed(2),g==null||g.attr(f,p).text(_))}s.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,g){const f=(0,R.select)(this);g===0?f.attr("x1",c).attr("x2",c).attr("y1",g?0:r).attr("y2",g?r:0):f.attr("x1",g?0:o).attr("x2",g?o:0).attr("y1",u).attr("y2",u)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll(`line.${rt.axisTooltipX}, line.${rt.axisTooltipY}`).style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const s=this,{config:i,state:{width:n,height:a}}=s,o=i.axis_rotated,r=s.$el.main.selectAll(`line.${K.xgridFocus}, line.${K.ygridFocus}`),l=(e||[r.datum()]).filter(d=>d&&M(s.getBaseValue(d)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&s.hasType("bubble")||s.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,u=s.xx.bind(s);r.style("visibility",null).data(l.concat(l)).each(function(d){const h=(0,R.select)(this),g={x:u(d),y:s.getYScaleById(d.id)(d.value)};let f;if(h.classed(K.xgridFocus))f=o?[null,g.x,c?g.y:n,g.x]:[g.x,c?g.y:null,g.x,a];else{const p=s.axis.getId(d.id)==="y2";f=o?[g.y,c&&!p?g.x:null,g.y,c&&p?g.x:a]:[c&&p?g.x:null,g.y,c&&!p?g.x:n,g.y]}["x1","y1","x2","y2"].forEach((p,_)=>h.attr(p,f[_]))}),ui(r,"grid"),(t=s.showCircleFocus)==null||t.call(s,e)},hideGridFocus(){var e;const t=this,{state:{inputType:s,resizing:i},$el:{main:n}}=t;(s==="mouse"||!i)&&(n.selectAll(`line.${K.xgridFocus}, line.${K.ygridFocus}`).style("visibility","hidden"),(e=t.hideCircleFocus)==null||e.call(t))},updateGridFocus(){var e;const t=this,{state:{inputType:s,width:i,height:n,resizing:a},$el:{grid:o}}=t,r=o.main.select(`line.${K.xgridFocus}`);if(s==="touch")r.empty()?a&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:n)}return!0},generateGridData(e,t){const s=this,i=s.$el.main.select(`.${rt.axisX}`).selectAll(".tick").size();let n=[];if(e==="year"){const a=s.getXDomain(),[o,r]=a.map(l=>l.getFullYear());for(let l=o;l<=r;l++)n.push(new Date(`${l}-01-01 00:00:00`))}else n=t.ticks(10),n.length>i&&(n=n.filter(a=>String(a).indexOf(".")<0));return n},getGridFilterToRemove(e){return e?t=>{let s=!1;return(Y(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(s=!0)}),s}:()=>!0},removeGridLines(e,t){const s=this,{config:i,$T:n}=s,a=s.getGridFilterToRemove(e),o=u=>!a(u),r=t?st.xgridLines:st.ygridLines,l=t?st.xgridLine:st.ygridLine;n(s.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(a)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},rr={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",he.regions)},updateRegion(){const e=this,{config:t,$el:{region:s},$T:i}=e;s.main||e.initRegion(),s.main.style("visibility",e.hasArcType()?"hidden":null);const n=s.main.selectAll(`.${he.region}`).data(t.regions);i(n.exit()).style("opacity","0").remove();const a=n.enter().append("g");a.append("rect").style("fill-opacity","0"),s.list=a.merge(n).attr("class",e.classRegion.bind(e)),s.list.each(function(o){var r;(0,R.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,R.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:s},$T:i}=t,n=t.regionX.bind(t),a=t.regionY.bind(t),o=["width","height"];let r=s.list.select("rect"),l=s.list.selectAll("text");return r=i(r,e).attr("x",n).attr("y",a).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),l=i(l,e).text(c=>{var u;return(u=c.label)==null?void 0:u.text}).attr("transform",({label:c})=>c.rotated?" rotate(-90)":null).attr("transform",function(c){var u;const{x:d=0,y:h=0,center:g=!1,rotated:f=!1}=(u=c.label)!=null?u:{},p=this.previousElementSibling,_={x:0,y:0};return N(g)&&["x","y"].forEach((x,m)=>{g.indexOf(x)>-1&&(_[x]=(+p.getAttribute(o[m])-dt(this)[o[m]])/2)}),`translate(${n(c)+_.x+d}, ${a(c)+_.y+h})${f?" rotate(-90)":""}`}).attr("text-anchor",({label:c})=>c!=null&&c.rotated?"end":null).attr("dy","1em").style("fill",({label:c})=>{var u;return(u=c==null?void 0:c.color)!=null?u:null}),[r.style("fill-opacity",c=>M(c.opacity)?c.opacity:null).on("end",function(){(0,R.select)(this.parentNode).selectAll("rect:not([x])").remove()}),l.style("opacity",null)]},regionX(e){return this.getRegionSize("x",e)},regionY(e){return this.getRegionSize("y",e)},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},getRegionSize(e,t){const s=this,{config:i,scale:n,state:a}=s,o=i.axis_rotated,r=/(x|y|y2)/.test(e),l=r?e==="x":e==="width",c=!r&&s[l?"regionX":"regionY"](t);let u=r?"start":"end",d=r?0:a[e],h;if(t.axis==="y"||t.axis==="y2"?(!r&&!l?u="start":r&&!l&&(u="end"),(l?o:!o)&&u in t&&(h=n[t.axis])):(l?!o:o)&&u in t&&(h=n.zoom||n.x),h){let g=0;d=t[u],s.axis.isTimeSeries(t.axis)?d=At.call(s,d):/(x|width)/.test(e)&&s.axis.isCategorized()&&isNaN(d)&&(d=i.axis_x_categories.indexOf(d),g=s.axis.x.tickOffset()*(u==="start"?-1:1)),d=h(d)+g}return r?d:d<c?0:d-c},isRegionOnX(e){return!e.axis||e.axis==="x"}},lr={getAxisSize(e){const t=this,s=t.config.axis_rotated;return s&&e==="x"||!s&&/y2?/.test(e)?t.getAxisWidthByAxisId(e,!0):t.getHorizontalAxisHeight(e)},getAxisWidthByAxisId(e,t){var s,i;const n=this;if(n.axis){const a=(s=n.axis)==null?void 0:s.getLabelPositionById(e),{width:o}=n.axis.getMaxTickSize(e,t),r=o===0?.5:0;return o+(((i=n.config.padding)==null?void 0:i.mode)==="fit"?a.isInner?10+r:10:a.isInner?20+r:40)}else return 40},getHorizontalAxisHeight(e){var t,s;const i=this,{config:n,state:a}=i,{rotatedPadding:o,isLegendRight:r,isLegendInset:l}=a,c=n.axis_rotated,u=((t=n.padding)==null?void 0:t.mode)==="fit",d=n[`axis_${e}_inner`],h=n[`axis_${e}_label`].text,g=13;let f=((s=n.padding)==null?void 0:s.mode)==="fit"?d&&!h?e==="y"?1:0:20:30;if(e==="x"&&!n.axis_x_show)return 8;if(e==="x"&&I(n.axis_x_height))return n.axis_x_height;if(e==="y"&&!n.axis_y_show)return n.legend_show&&!r&&!l?10:1;if(e==="y2"&&!n.axis_y2_show)return u?0:o.top;const p=i.axis.getMaxTickSize(e),_=Math.abs(n.axis_x_tick_rotate)>0&&(!n.axis_x_tick_autorotate||i.needToRotateXAxisTickTexts());return(n.axis_x_tick_multiline||_)&&p.height>g&&(f+=p.height-g),f+(i.axis.getLabelPositionById(e).isInner?0:10)+(e==="y2"&&!c?-10:0)},getEventRectWidth(){const e=this,{config:t,axis:s}=e,i=t.axis_x_inverted,n=s.x.tickInterval();return Math.max(0,i?Math.abs(n):n)},getAxisTickRotate(e){const t=this,{axis:s,config:i,state:n,$el:a}=t;let o=i[`axis_${e}_tick_rotate`];if(e==="x"){const r=s.isCategorized()||s.isTimeSeries();if(i.axis_x_tick_fit&&r){const l=i.axis_x_tick_count,c=n.current.maxTickSize.x.ticks.length;let u=0;if(l?u=l>c?c:l:c&&(u=c),u!==n.axis.x.tickCount){const{targets:d}=t.data;n.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(d,"min"),t.getXDomainMinMax(d,"max")],u)}n.axis.x.tickCount=u}a.svg&&i.axis_x_tick_autorotate&&i.axis_x_tick_fit&&!i.axis_x_tick_multiline&&!i.axis_x_tick_culling&&r&&(o=t.needToRotateXAxisTickTexts()?i.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const e=this,{state:{axis:t,current:s,isLegendRight:i,legendItemWidth:n}}=e,a=i&&n,o=s.width-a-e.getCurrentPaddingByDirection("left")-e.getCurrentPaddingByDirection("right"),r=t.x.tickCount+t.x.padding.left+t.x.padding.right,{width:l}=e.axis.getMaxTickSize("x"),c=r?o/r:0;return l>c}},cr={axis_x_clipPath:!0,axis_x_show:!0,axis_x_forceAsSingle:!1,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_culling_lines:!0,axis_x_tick_culling_reverse:!1,axis_x_tick_count:void 0,axis_x_tick_inner:!1,axis_x_tick_show:!0,axis_x_tick_text_show:!0,axis_x_tick_text_inner:!1,axis_x_tick_text_position:{x:0,y:0},axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_autorotate:!1,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_tick_tooltip:!1,axis_x_max:void 0,axis_x_min:void 0,axis_x_inverted:!1,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_x_axes:[]},dr={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_culling_reverse:!1,axis_y_tick_inner:!1,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},ur={axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_culling_reverse:!1,axis_y2_tick_inner:!1,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]},hr=Object.defineProperty,hi=Object.getOwnPropertySymbols,gr=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable,gi=(e,t,s)=>t in e?hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ke=(e,t)=>{for(var s in t||(t={}))gr.call(t,s)&&gi(e,s,t[s]);if(hi)for(var s of hi(t))fr.call(t,s)&&gi(e,s,t[s]);return e},pr=Ke(Ke(Ke({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},cr),dr),ur),xr={grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:void 0,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0},_r={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const mr=[Fo,Mo,Xo,Bo,No,Go,Vo],fi={axis:Jo,clip:ir,eventrect:tr,flow:sr,grid:or,region:rr,sizeAxis:lr},pi={optDataAxis:_r,optAxis:pr,optGrid:xr};var xi=Z(13);const yr=15,_i=20,mi=.35;function $r(e=!1){const t=this;return["donut","pie","polar","gauge"].find(s=>t.hasType(s)&&!(s==="gauge"&&e&&t.hasMultiArcGauge()))}function yi(){const e=this,{config:t}=e,s=$r.call(e,!0),i=s&&t[`${s}_label_line`],n=bt(i),a=(l,c,u)=>u,o={show:i===!0||n&&(i==null?void 0:i.show)!==!1,distance:n&&(i==null?void 0:i.distance)||_i};if(i===!0)return{chartType:s,line:o,text:{formatter:a}};if(!n)return{chartType:s,line:{show:!1,distance:_i},text:{formatter:null}};let r=a;return k(i.text)?r=i.text:i.text===!1&&(r=null),{chartType:s,line:o,text:{formatter:r}}}function br(e,t){const s=this,{state:i}=s,n=s.updateAngle(e);if(!n)return null;let{outerRadius:a}=s.getRadius(e),o=a;s.hasType("polar")&&(o=s.getPolarOuterRadius(e,a),a=i.radius);let r=(n.startAngle+n.endAngle)/2;Math.abs(n.endAngle-n.startAngle-2*Math.PI)<.01&&(r=Math.PI/2);const c=Math.sin(r),u=-Math.cos(r),d={x:c*o,y:u*o},h=a+yr,g={x:c*h,y:u*h},f=c>=0,p={x:g.x+t*(f?1:-1),y:g.y};return{startPoint:d,breakPoint:g,endPoint:p,isRight:f,midAngle:r}}function $i(){return yi.call(this).line.show}function vr(e){const t=this,{$el:{arcs:s},$T:i}=t,{line:n,text:a}=yi.call(t),o=n.distance;let r=null;s.selectAll(`.${X.chartArc}`).each(function(l){var c,u,d;const h=(0,R.select)(this),g=br.call(t,l,o),{ratio:f,meetsThreshold:p,updated:_}=(c=l._cache)!=null?c:{};if(!_||!g)return;const x=t.isTargetToShow(l.data.id)&&p,{startPoint:m,breakPoint:y,endPoint:$,isRight:v}=g,b=`${m.x},${m.y} ${y.x},${y.y} ${$.x},${$.y}`;if(n.show){let C=h.select(`.${X.arcLabelLine}`);C.empty()&&(C=h.append("polyline").attr("class",X.arcLabelLine)),i(C,e).attr("points",b).style("stroke",t.color(l.data)).style("opacity",x?null:"0")}let T=h.select(`.${X.arcLabelLineText}`);if(T.empty()&&(T=h.append("text").attr("class",X.arcLabelLineText).style("pointer-events","none")),x){const{value:C}=_,{id:S}=l.data,A=((d=(u=a.formatter)!=null?u:t.getArcLabelConfig("format"))!=null?d:t.defaultArcValueFormat)(C,f,S).toString();Qt(T,A,[-1,1],!1);const w={x:$.x+5*(v?1:-1),y:$.y};T.style("text-anchor",v?"start":"end");const O=T.node(),E=O==null?void 0:O.querySelectorAll("tspan");if(r===null&&(r=parseFloat(B.getComputedStyle(O).fontSize)||12),E&&E.length>1){const F=(E.length-3)/2;w.y+=(-F+mi)*r}else w.y+=mi*r;i(T,e).attr("transform",`translate(${w.x},${w.y})`).style("opacity",null).style("fill",t.updateTextColor.bind(t)(l))}else i(T,e).style("opacity","0")})}var Tr=Object.defineProperty,Ar=Object.defineProperties,wr=Object.getOwnPropertyDescriptors,bi=Object.getOwnPropertySymbols,Sr=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,vi=(e,t,s)=>t in e?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Cr=(e,t)=>{for(var s in t||(t={}))Sr.call(t,s)&&vi(e,s,t[s]);if(bi)for(var s of bi(t))Rr.call(t,s)&&vi(e,s,t[s]);return e},Er=(e,t)=>Ar(e,wr(t));function Lr(e){return["donut","pie","polar","gauge"].find(t=>e.hasType(t))}function kr(e,t,s,i){var n,a;const{config:o,state:{radiusExpanded:r}}=e,l=s.endAngle-Math.PI/2,c=Math.sin(l),u={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const d=o.arc_rangeText_position;if(d){const h=o.arc_rangeText_values,g=k(d)?d(h[t.index]):d;u.x+=(n=g==null?void 0:g.x)!=null?n:0,u.y+=(a=g==null?void 0:g.y)!=null?a:0}}return u}function Pr(e,t,s,i){const{config:n}=e,a=Lr(e);let o=a?n[`${a}_label_ratio`]:void 0;if(o)o=k(o)?o.bind(e.api)(t,s,i):o;else{const d=36/s,h=d>.375;o=s&&i?(h?1.175-d:.8)*s/i:0}return o}function Or(e,t,s){let{outerRadius:i}=e.getRadius(t);e.hasType("polar")&&(i=e.getPolarOuterRadius(t,i));const[n,a]=e.svgArc.centroid(s).map(l=>isNaN(l)?0:l),o=Math.sqrt(n*n+a*a),r=Pr(e,t,i,o);return{pos:{x:n,y:a},ratio:r}}function Ti(e=0){const t=this,{config:s,state:i}=t,n=t.hasMultiArcGauge(),a=i.gaugeArcWidth/t.filterTargetsToShow(t.data.targets).length,o=e?Math.min(i.radiusExpanded*e-i.radius,a*.8-(1-e)*100):0;return{inner(r){const{innerRadius:l}=t.getRadius(r);return n?i.radius-a*(r.index+1):I(l)?l:0},outer(r){const{outerRadius:l}=t.getRadius(r);let c;if(n)c=i.radius-a*r.index+o;else if(t.hasType("polar")&&!e)c=t.getPolarOuterRadius(r,l);else if(c=l,e){let{radiusExpanded:u}=i;i.radius!==l&&(u-=Math.abs(i.radius-l)),c=u*e}return c},corner(r,l){const{arc_cornerRadius_ratio:c=0,arc_cornerRadius:u=0}=s,{data:{id:d},value:h}=r;let g=0;return c?g=c*l:g=I(u)?u:u.call(t.api,d,h,l),g}}}function Je(e){return function(t){const s=({startAngle:n=0,endAngle:a=0,padAngle:o=0})=>({startAngle:n,endAngle:a,padAngle:o}),i=(0,xi.interpolate)(s(this._current),s(t));return this._current=t,function(n){const a=i(n),{data:o,index:r,value:l}=t;return e(Er(Cr({},a),{data:o,index:r,value:l}))}}}var Ir={initPie(){const e=this,{config:t}=e,s=t.data_type,i=t[`${s}_padding`],n=t[`${s}_startingAngle`]||0,a=(i?i*.01:t[`${s}_padAngle`])||0;e.pie=(0,tt.pie)().startAngle(n).endAngle(n+2*Math.PI).padAngle(a).value(o=>{var r,l;return(l=(r=o.values)==null?void 0:r.reduce((c,u)=>c+u.value,0))!=null?l:o}).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius(){const e=this,{config:t,state:s}=e,i=t.data_type,n=t[`${i}_padding`],a=t.gauge_width||t.donut_width,o=e.filterTargetsToShow(e.data.targets).length*t.gauge_arcs_minWidth,r=.85,l=$i.call(e)?r:1;s.radiusExpanded=Math.min(s.arcWidth,s.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?r:l),s.radius=s.radiusExpanded*.95,s.innerRadiusRatio=a?(s.radius-a)/s.radius:.6,s.gaugeArcWidth=a||(o<=s.radius-s.innerRadius?s.radius-s.innerRadius:o<=s.radius?o:s.radius);const c=t.pie_innerRadius||(n?n*(s.innerRadiusRatio+.1):0);s.outerRadius=t.pie_outerRadius,s.innerRadius=e.hasType("donut")||e.hasType("gauge")?s.radius*s.innerRadiusRatio:c},getRadius(e){const t=this,s=e==null?void 0:e.data;let{innerRadius:i,outerRadius:n}=t.state;return!I(i)&&s&&(i=i[s.id]||0),G(n)&&s&&s.id in n?n=n[s.id]:I(n)||(n=t.state.radius),{innerRadius:i,outerRadius:n}},updateArc(){const e=this;e.updateRadius(),e.svgArc=e.getSvgArc(),e.svgArcExpanded=e.getSvgArcExpanded()},getArcLength(){const e=this,{config:t}=e,s=t.gauge_arcLength*3.6;let i=2*(s/360);return s<-360?i=-2:s>360&&(i=2),i*Math.PI},getStartingAngle(){const e=this,{config:t}=e,s=t.data_type,i=e.hasType("gauge")?t.gauge_fullCircle:!1,n=-1*Math.PI/2,a=Math.PI/2;let o=t[`${s}_startingAngle`]||0;return!i&&o<=n?o=n:!i&&o>=a?o=a:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(e,t=!1){var s;const i=this,{config:n,state:a}=i,o=t&&i.hasType("gauge");let{pie:r}=i,l=e,c=!1;if(!n)return null;const u=i.getStartingAngle(),d=n.gauge_fullCircle||t&&!o?i.getArcLength():u*-2;if(l.data&&i.isGaugeType(l.data)&&!i.hasMultiArcGauge()){const{gauge_min:h,gauge_max:g}=n,f=i.getTotalDataSum(a.rendered),p=d*((f-h)/(g-h));r=r.startAngle(u).endAngle(p+u)}if(t===!1&&r(i.filterTargetsToShow()).forEach((h,g)=>{var f;!c&&h.data.id===((f=l.data)==null?void 0:f.id)&&(c=!0,l=h,l.index=g)}),isNaN(l.startAngle)&&(l.startAngle=0),isNaN(l.endAngle)&&(l.endAngle=l.startAngle),t||l.data&&(n.gauge_enforceMinMax||i.hasMultiArcGauge())){const{gauge_min:h,gauge_max:g}=n,f=t&&!o?i.getTotalDataSum(a.rendered):g,p=d/(f-h),_=(s=l.value)!=null?s:0,x=_<h?0:_<f?_-h:f-h;l.startAngle=u,l.endAngle=u+p*x}return c||t?l:null},getSvgArc(){const e=this,{inner:t,outer:s,corner:i}=Ti.call(e),n=(0,tt.arc)().innerRadius(t).outerRadius(s),a=function(o,r){var l;let c="M 0 0";if(o.value||o.data){const u=r?o:(l=e.updateAngle(o))!=null?l:null;u&&(c=n.cornerRadius(i(u,s(u)))(u))}return c};return a.centroid=n.centroid,a},getSvgArcExpanded(e=1){const t=this,{inner:s,outer:i,corner:n}=Ti.call(t,e),a=(0,tt.arc)().innerRadius(s).outerRadius(i);return o=>{const r=t.updateAngle(o),l=i(r);let c=0;return r&&(c=n(r,l)),r?a.cornerRadius(c)(r):"M 0 0"}},getArc(e,t,s){return s||this.isArcType(e.data)?this.svgArc(e,t):"M 0 0"},redrawArcRangeText(){const e=this,{config:t,$el:{arcs:s},state:i,$T:n}=e,a=t.arc_rangeText_format,o=e.hasType("gauge")&&t.arc_rangeText_fixed;let r=t.arc_rangeText_values;if(r!=null&&r.length){const l=t.arc_rangeText_unit==="%",c=e.getTotalDataSum(i.rendered);l&&(r=r.map(h=>c/100*h));const u=e.pie(r).map((h,g)=>(h.index=g,h));let d=s.selectAll(`.${X.arcRange}`).data(r);d.exit(),d=n(d.enter().append("text").attr("class",X.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const g=l?h/c*100:h;return k(a)?a(g):`${g}${l?"%":""}`}).merge(d)),(!i.rendered||i.rendered&&!o)&&c>0&&d.attr("transform",function(h,g){return e.transformForArcLabel(this,u[g],!0)}),d.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t,s=!1){const i=this,n=i.updateAngle(t,s);if(!n)return"";let a,o=1;if(s||i.hasMultiArcGauge())a=kr(i,t,n,s);else if(!i.hasType("gauge")||i.data.targets.length>1){const r=Or(i,t,n);a=r.pos,o=r.ratio}else return"";return Vs.call(i,e,a),`translate(${a.x*o},${a.y*o})`},convertToArcData(e){return this.addName({id:"data"in e?e.data.id:e.id,value:e.value,ratio:this.getRatio("arc",e),index:e.index})},textForArcLabel(e){var t;const s=this,i=s.hasType("gauge"),n=(t=["donut","gauge","pie","polar"].filter(s.hasType.bind(s)))==null?void 0:t[0];s.shouldShowArcLabel()&&e.style("fill",s.updateTextColor.bind(s)).attr("filter",a=>s.updateTextBGColor.bind(s)(a,s.config.data_labels_backgroundColors)).each(function(a){const o=(0,R.select)(this),r=s.updateAngle(a),l=s.getRatio("arc",r),c=Ze.call(s,l,n);if(a._cache={updated:r,ratio:l,meetsThreshold:c},c){const{value:u}=r||a,d=(s.getArcLabelConfig("format")||s.defaultArcValueFormat)(u,l,a.data.id).toString();Qt(o,d,[-1,1],i)}else o.text("")})},expandArc(e){const t=this,{state:{transiting:s},$el:i}=t;if(s){const a=setInterval(()=>{s||(clearInterval(a),i.legend.selectAll(`.${K.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const n=t.mapToTargetIds(e);i.svg.selectAll(t.selectorTargets(n,`.${X.chartArc}`)).each(function(a){if(!t.shouldExpand(a.data.id))return;const o=t.getExpandConfig(a.data.id,"duration"),r=t.getSvgArcExpanded(t.getExpandConfig(a.data.id,"rate"));(0,R.select)(this).selectAll("path").transition().duration(o).attrTween("d",Je(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",Je(r.bind(t)))})},unexpandArc(e){const t=this,{state:{transiting:s},$el:{svg:i}}=t;if(s)return;const n=t.mapToTargetIds(e);i.selectAll(t.selectorTargets(n,`.${X.chartArc}`)).selectAll("path").transition().duration(a=>t.getExpandConfig(a.data.id,"duration")).attrTween("d",Je(t.svgArc.bind(t))),i.selectAll(`${X.arc}`).style("opacity",null)},getExpandConfig(e,t){const s=this,{config:i}=s,n={duration:50,rate:.98};let a;return s.isDonutType(e)?a="donut":s.isGaugeType(e)?a="gauge":s.isPieType(e)&&(a="pie"),a?i[`${a}_expand_${t}`]:n[t]},shouldExpand(e){const t=this,{config:s}=t;return t.isDonutType(e)&&s.donut_expand||t.isGaugeType(e)&&s.gauge_expand||t.isPieType(e)&&s.pie_expand},shouldShowArcLabel(){const e=this,{config:t}=e;return["donut","gauge","pie","polar"].some(s=>e.hasType(s)&&t[`${s}_label_show`])},getArcLabelConfig(e="format"){const t=this,{config:s}=t;let i=n=>n;return["donut","gauge","pie","polar"].filter(t.hasType.bind(t)).forEach(n=>{i=s[`${n}_label_${e}`]}),e==="format"&&k(i)?i.bind(t.api):i},updateTargetsForArc(e){const t=this,{$el:s}=t,i=t.hasType("gauge"),n=t.getChartClass("Arc"),a=t.getClass("arcs",!0),o=t.classFocus.bind(t),r=s.main.select(`.${X.chartArcs}`),l=r.selectAll(`.${X.chartArc}`).data(t.pie(e)).attr("class",u=>n(u)+o(u.data)),c=l.enter().append("g").attr("class",n).call(this.setCssRule(!1,`.${X.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));c.append("g").attr("class",a).merge(l),c.append("text").attr("dy",i&&!t.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",t.getStylePropValue("middle")).style("pointer-events",t.getStylePropValue("none")),s.text=r.selectAll(`.${D.target} text`)},initArc(){const e=this,{$el:t}=e;t.arcs=t.main.select(`.${D.chart}`).append("g").attr("class",X.chartArcs).attr("transform",e.getTranslate("arc")),e.setArcTitle()},setArcTitle(e){const t=this,s=e||t.getArcTitle(),i=t.hasType("gauge");if(s){const n=i?$t.chartArcsGaugeTitle:X.chartArcsTitle;let a=t.$el.arcs.select(`.${n}`);a.empty()&&(a=t.$el.arcs.append("text").attr("class",n).style("text-anchor","middle")),i&&a.attr("dy","-0.3em"),Qt(a,s,i?void 0:[-.6,1.35],!0)}},getArcTitle(){const e=this,t=e.hasType("donut")&&"donut"||e.hasType("gauge")&&"gauge";return t?e.config[`${t}_title`]:""},getArcTitleWithNeedleValue(){const e=this,{config:t,state:s}=e,i=e.getArcTitle();if(i&&e.config.arc_needle_show&&/{=[A-Z_]+}/.test(i)){let n=s.current.needle;return I(n)||(n=t.arc_needle_value),ge(i,{NEEDLE_VALUE:~~n})}return!1},redrawArc(e,t,s){const i=this,{config:n,state:a,$el:{main:o}}=i,r=n.interaction_enabled,l=r&&n.data_selection_isselectable;let c=o.selectAll(`.${X.arcs}`).selectAll(`.${X.arc}`).data(i.arcData.bind(i));c.exit().transition().duration(t).style("opacity","0").remove(),c=c.enter().append("path").attr("class",i.getClass("arc",!0)).style("fill",u=>i.color(u.data)).style("cursor",u=>{var d;return(d=l==null?void 0:l.bind)!=null&&d.call(l,i.api)(u)?"pointer":null}).style("opacity","0").each(function(u){i.isGaugeType(u.data)&&(u.startAngle=n.gauge_startingAngle,u.endAngle=n.gauge_startingAngle),this._current=u}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",u=>!i.isGaugeType(u.data)&&s?"scale(0)":"").style("opacity",function(u){return u===this._current?"0":null}).each(()=>{a.transiting=!0}).transition().duration(e).attrTween("d",function(u){const d=i.updateAngle(u);if(!d)return()=>"M 0 0";isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const h=(0,xi.interpolate)(this._current,d);return this._current=h(0),function(g){const f=h(g);return f.data=u.data,i.getArc(f,!0)}}).attr("transform",s?"scale(1)":"").style("fill",u=>{let d;return i.levelColor?(d=i.levelColor(u.data.values[0].value),n.data_colors[u.data.id]=d):d=i.color(u.data),d}).style("opacity",null).call(Ae,function(){if(i.levelColor){const u=(0,R.select)(this),d=u.datum(this._current);i.updateLegendItemColor(d.data.id,u.style("fill"))}a.transiting=!1,J(n.onrendered,i.api)}),r&&i.bindArcEvent(c),i.hasType("polar")&&i.redrawPolar(),i.hasType("gauge")&&i.redrawBackgroundArcs(),n.arc_needle_show&&i.redrawNeedle(),i.redrawArcText(e),i.redrawArcRangeText()},redrawNeedle(){const e=this,{$el:t,config:s,state:{hiddenTargetIds:i,radius:n}}=e,a=(n-1)/100*s.arc_needle_length,o=i.length!==e.data.targets.length;let r=e.$el.arcs.select(`.${X.needle}`);const l=s.arc_needle_path,c=s.arc_needle_bottom_width/2,u=s.arc_needle_top_width/2,d=s.arc_needle_top_rx,h=s.arc_needle_top_ry,g=s.arc_needle_bottom_len,f=s.arc_needle_bottom_rx,p=s.arc_needle_bottom_ry,_=e.getNeedleAngle(),x=()=>{const m=e.getArcTitleWithNeedleValue();m&&e.setArcTitle(m)};if(x(),r.empty()&&(r=t.arcs.append("path").classed(X.needle,!0),t.needle=r,t.needle.updateHelper=(m,y=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(Ae,()=>{y&&(s.arc_needle_value=m),x()})}),o){const m=k(l)?l.call(e,a):`M-${c} ${g} A${f} ${p} 0 0 0 ${c} ${g} L${u} -${a} A${d} ${h} 0 0 0 -${u} -${a} L-${c} ${g} Z`;e.$T(r).attr("d",m).style("fill",s.arc_needle_color).style("display",null).style("transform",`rotate(${_}deg)`)}else r.style("display","none")},getNeedleAngle(e){const t=this,{config:s,state:i}=t,n=t.getArcLength(),a=t.hasType("gauge"),o=t.getTotalDataSum(!0);let r=H(e)?e:s.arc_needle_value,l=s[`${s.data_type}_startingAngle`]||0,c=0;if(I(r)||(r=a&&t.data.targets.length===1?o:0),i.current.needle=r,a){l=t.getStartingAngle();const u=s.gauge_fullCircle?n:l*-2,{gauge_min:d,gauge_max:h}=s;c=u*((r-d)/(h-d))}else c=n*(r/o);return(l+c)*(180/Math.PI)},redrawBackgroundArcs(){const e=this,{config:t,state:s}=e,i=e.hasMultiArcGauge(),n=t.gauge_fullCircle,a=e.filterTargetsToShow(e.data.targets).length===0&&!!t.data_empty_label_text,o=e.getStartingAngle(),r=n?o+e.getArcLength():o*-1;let l=e.$el.arcs.select(`${i?"g":""}.${X.chartArcsBackground}`);if(i){let c=0;l=l.selectAll(`path.${X.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(u,d)=>`${X.chartArcsBackground} ${X.chartArcsBackground}-${d}`).merge(l).style("fill",t.gauge_background||null).attr("d",({id:u})=>{if(a||s.hiddenTargetIds.indexOf(u)>=0)return"M 0 0";const d={data:[{value:t.gauge_max}],startAngle:o,endAngle:r,index:c++};return e.getArc(d,!0,!0)}),l.exit().remove()}else l.attr("d",a?"M 0 0":()=>{const c={data:[{value:t.gauge_max}],startAngle:o,endAngle:r};return e.getArc(c,!0,!0)})},bindArcEvent(e){const t=this,{config:s,state:i}=t,n=i.inputType==="touch",a=i.inputType==="mouse";function o(l,c,u){t.expandArc(u),t.api.focus(u),t.toggleFocusLegend(u,!0),t.showTooltip([c],l)}function r(l){const c=(l==null?void 0:l.id)||void 0;t.unexpandArc(c),t.api.revert(),t.revertLegend(),t.hideTooltip()}if(e.on("click",function(l,c,u){var d;const h=t.updateAngle(c);let g;h&&(g=t.convertToArcData(h),(d=t.toggleShape)==null||d.call(t,this,g,u),s.data_onclick.bind(t.api)(g,this))}),a&&e.on("mouseover",function(l,c){if(i.transiting)return;i.event=l;const u=t.updateAngle(c),d=u?t.convertToArcData(u):null,h=(d==null?void 0:d.id)||void 0;o(this,d,h),t.setOverOut(!0,d)}).on("mouseout",(l,c)=>{if(i.transiting||!s.interaction_onout)return;i.event=l;const u=t.updateAngle(c),d=u?t.convertToArcData(u):null;r(),t.setOverOut(!1,d)}).on("mousemove",function(l,c){const u=t.updateAngle(c),d=u?t.convertToArcData(u):null;i.event=l,t.showTooltip([d],this)}),n&&t.hasArcType()&&!t.radars){const l=c=>{var u,d;const{clientX:h,clientY:g}=(d=(u=c.changedTouches)==null?void 0:u[0])!=null?d:{clientX:0,clientY:0};return(0,R.select)(ct.elementFromPoint(h,g))};t.$el.svg.on("touchstart touchmove",function(c){if(i.transiting)return;i.event=c;const d=l(c).datum(),h=d!=null&&d.data&&d.data.id?t.updateAngle(d):null,g=h?t.convertToArcData(h):null,f=(g==null?void 0:g.id)||void 0;t.callOverOutForTouch(g),nt(f)?r():o(this,g,f)},{passive:!0})}},redrawArcText(e){const t=this,{config:s,state:i,$el:{main:n,arcs:a}}=t,o=t.hasType("gauge"),r=t.hasMultiArcGauge();let l;if(o&&t.data.targets.length===1&&s.gauge_title||(l=n.selectAll(`.${X.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?$t.gaugeValue:null).call(t.textForArcLabel.bind(t)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(i.radius/5)}px`:null),Gs.call(t),l.attr("transform",function(c){return t.transformForArcLabel.bind(t)(this,c)}).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),n.select(`.${X.chartArcsTitle}`).style("opacity",t.hasType("donut")||o?null:"0"),o){const c=s.gauge_fullCircle;c&&(l==null||l.attr("dy",`${r?0:Math.round(i.radius/14)}`)),s.gauge_label_show&&(a.select(`.${$t.chartArcsGaugeUnit}`).attr("dy",`${c?1.5:.75}em`).text(s.gauge_units),a.select(`.${$t.chartArcsGaugeMin}`).attr("dx",`${-1*(i.innerRadius+(i.radius-i.innerRadius)/(c?1:2))}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(s.gauge_min,!1)),!c&&a.select(`.${$t.chartArcsGaugeMax}`).attr("dx",`${i.innerRadius+(i.radius-i.innerRadius)/2}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(s.gauge_max,!0)))}$i.call(t)&&vr.call(t,e)},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:s}}=t,i=I(e)?n=>n.index===e:n=>n.data.id===e;return s==null?void 0:s.selectAll(`.${D.target} path`).filter(i)}},ie={initArea(e){const t=this,{config:s}=t;e.insert("g",`.${s.area_front?pt.circles:kt.lines}`).attr("class",t.getClass("areas",!0))},updateAreaColor(e){const t=this;return t.config.area_linearGradient?t.getGradienColortUrl(e.id):t.color(e)},updateArea(e,t=!1){const s=this,{config:i,state:n,$el:a,$T:o}=s,r=t?a.subchart:a;i.area_linearGradient&&s.updateLinearGradient();const l=r.main.selectAll(`.${$e.areas}`).selectAll(`.${$e.area}`).data(s.lineData.bind(s));o(l.exit(),e).style("opacity","0").remove(),r.area=l.enter().append("path").attr("class",s.getClass("area",!0)).style("fill",s.updateAreaColor.bind(s)).style("opacity",function(){return n.orgAreaOpacity=(0,R.select)(this).style("opacity"),"0"}).merge(l),l.style("opacity",n.orgAreaOpacity),s.setRatioForGroupedData(r.area.data())},redrawArea(e,t,s=!1){const i=this,{area:n}=s?this.$el.subchart:this.$el,{orgAreaOpacity:a}=i.state;return[i.$T(n,t,Ct()).attr("d",e).style("fill",i.updateAreaColor.bind(i)).style("opacity",o=>String(i.isAreaRangeType(o)?a/1.75:a))]},generateDrawArea(e,t){const s=this,{config:i}=s,n=i.line_connectNull,a=i.axis_rotated,o=s.generateGetAreaPoints(e,t),r=s.getYScaleById.bind(s),l=d=>(t?s.subxx:s.xx).call(s,d),c=(d,h)=>s.isGrouped(d.id)?o(d,h)[0][1]:r(d.id,t)(s.isAreaRangeType(d)?s.getRangedData(d,"high"):s.getShapeYMin(d.id)),u=(d,h)=>s.isGrouped(d.id)?o(d,h)[1][1]:r(d.id,t)(s.isAreaRangeType(d)?s.getRangedData(d,"low"):d.value);return d=>{let h=n?s.filterRemoveNull(d.values):d.values,g=0,f=0,p;if(s.isAreaType(d)){let _=(0,tt.area)();_=a?_.y(l).x0(c).x1(u):_.x(l).y0(i.area_above?0:i.area_below?s.state.height:c).y1(u),n||(_=_.defined(x=>s.getBaseValue(x)!==null)),s.isStepType(d)&&(h=s.convertValuesToStep(h)),p=_.curve(s.getCurve(d))(h)}else h[0]&&(g=s.scale.x(h[0].x),f=s.getYScaleById(d.id)(h[0].value)),p=a?`M ${f} ${g}`:`M ${g} ${f}`;return p||"M 0 0"}},generateGetAreaPoints(e,t){const s=this,{config:i}=s,n=s.getShapeX(0,e,t),a=s.getShapeY(!!t),o=s.getShapeOffset(s.isAreaType,e,t),r=s.getYScaleById.bind(s);return function(l,c){const u=r.call(s,l.id,t)(s.getShapeYMin(l.id)),d=o(l,c)||u,h=n(l),g=l.value;let f=a(l);return i.axis_rotated&&(g>0&&f<u||g<0&&u<f)&&(f=u),[[h,d],[h,f-(u-d)],[h,f-(u-d)],[h,d]]}}};function Qe(e){const t=this.config.bar_connectLine,s=(t==null?void 0:t[e])||t;return/^(start|end)\-(start|end)$/.test(s)?s:null}var Dr={initBar(){const{$el:e,config:t,state:{clip:s}}=this;e.bar=e.main.select(`.${D.chart}`),e.bar=t.bar_front?e.bar.append("g"):e.bar.insert("g",":first-child"),e.bar.attr("class",yt.chartBars).call(this.setCssRule(!1,`.${yt.chartBars}`,["pointer-events:none"])),t.clipPath===!1&&(t.bar_radius||t.bar_radius_ratio)&&e.bar.attr("clip-path",s.pathXAxis.replace(/#[^)]*/,`#${s.id}`))},updateTargetsForBar(e){const t=this,{config:s,$el:i}=t,n=t.getChartClass("Bar"),a=t.getClass("bars",!0),o=t.classFocus.bind(t),r=s.interaction_enabled&&s.data_selection_isselectable;i.bar||t.initBar(),i.main.select(`.${yt.chartBars}`).selectAll(`.${yt.chartBar}`).data(t.filterNullish(e)).attr("class",u=>n(u)+o(u)).enter().append("g").attr("class",n).style("opacity","0").style("pointer-events",t.getStylePropValue("none")).append("g").attr("class",a).style("cursor",u=>{var d;return(d=r==null?void 0:r.bind)!=null&&d.call(r,t.api)(u)?"pointer":null}).call(u=>{t.setCssRule(!0,` .${yt.bar}`,["fill"],t.color)(u),u.each(function(d){Qe.call(t,d.id)&&(0,R.select)(this).append("path").attr("class",yt.barConnectLine)})})},updateBar(e,t=!1){const s=this,{config:i,$el:n,$T:a}=s,o=t?n.subchart:n,r=s.getClass("bar",!0),l=s.initialOpacity.bind(s);i.bar_linearGradient&&s.updateLinearGradient();const c=o.main.selectAll(`.${yt.bars}`).selectAll(`.${yt.bar}`).data(s.labelishData.bind(s));a(c.exit(),e).style("opacity","0").remove(),o.bar=c.enter().append("path").attr("class",r).style("fill",s.updateBarColor.bind(s)).merge(c).style("opacity",l),s.setRatioForGroupedData(o.bar.data())},updateBarColor(e){const t=this,s=t.getStylePropValue(t.color);return t.config.bar_linearGradient?t.getGradienColortUrl(e.id):s?s(e):null},redrawBar(e,t,s=!1){const i=this,{bar:n}=s?i.$el.subchart:i.$el,a=[];return[i.$T(n,t,Ct()).attr("d",function(o,r,l){const c=(I(o.value)||i.isBarRangeType(o))&&e(o,r),u=Qe.call(i,o.id);if(c.length>1&&(a.push(c[1]),r===l.length-1)){const d=i.$T((0,R.select)(this.parentNode.querySelector(`.${yt.barConnectLine}`)),t,Ct());i.updateConnectLine(d,u,a),a.splice(0)}return c[0]}).style("fill",i.updateBarColor.bind(i)).style("clip-path",o=>o.clipPath).style("opacity",null)]},generateDrawBar(e,t){const s=this,{config:i}=s,n=s.generateGetBarPoints(e,t),a=i.axis_rotated,o=i.bar_radius,r=i.bar_radius_ratio,l=I(o)&&o>0?()=>o:I(r)?c=>c*r:null;return(c,u)=>{const d=n(c,u),h=+a,g=+!h,f=c.value<0,p=i[`axis_${s.axis.getId(c.id)}_inverted`],_=!p&&f||p&&!f,x=["",""],m=s.isGrouped(c.id),y=l&&m?s.isStackingRadiusData(c):!1,$=[d[0][h],d[0][g]];let v=0;if(c.clipPath=null,l){const S=a?g:h,A=d[2][S]-d[0][S];v=!m||y?l(A):0;const w=`a${v} ${v} ${_?"1 0 0":"0 0 1"} `;x[+!a]=`${w}${v},${v}`,x[+a]=`${w}${[-v,v][a?"sort":"reverse"]()}`,_&&x.reverse()}const b=a?d[1][h]+(_?v:-v):d[1][g]+(_?-v:v);if(v){let S="";a?_&&$[0]<b?S=`0 ${b-$[0]}px 0 0`:!_&&$[0]>b&&(S=`0 0 0 ${$[0]-b}px`):_&&$[1]>b?S=`${$[1]-b}px 0 0 0`:!_&&$[1]<b&&(S=`0 0 ${b-$[1]}px 0`),S&&(c.clipPath=`inset(${S})`)}const T=a?`H${b} ${x[0]}V${d[2][g]-v} ${x[1]}H${d[3][h]}`:`V${b} ${x[0]}H${d[2][h]-v} ${x[1]}V${d[3][g]}`,C=[`M${d[0][h]},${d[0][g]}${T}z`];return Qe.call(s,c.id)&&C.push(a?{x:d[0][h],y:d[0][g],width:d[0][h]-b,height:d[2][g]-d[0][g]}:{x:d[0][h],y:b,width:d[2][h]-d[0][h],height:d[3][g]-b}),C}},isStackingRadiusData(e){const t=this,{$el:s,config:i,data:n,state:a}=t,{id:o,index:r,value:l}=e;if(a.hiddenTargetIds.indexOf(o)>-1){const h=s.bar.filter(g=>g.id===o&&g.value===l);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const c=i.data_groups.find(h=>h.indexOf(o)>-1),d=t.orderTargets(t.filterTargetsToShow(n.targets.filter(t.isBarType,t))).filter(h=>c.indexOf(h.id)>-1).map(h=>h.values.filter(g=>g.index===r&&(I(l)&&l>0?g.value>0:g.value<0))[0]).filter(Boolean).map(h=>h.id);return l!==0&&d.indexOf(o)===d.length-1},generateGetBarPoints(e,t){const s=this,{config:i}=s,n=t?s.axis.subX:s.axis.x,a=s.getIndicesMax(e)+1,o=s.getBarW("bar",n,a),r=s.getShapeX(o,e,!!t),l=s.getShapeY(!!t),c=s.getShapeOffset(s.isBarType,e,!!t),u=s.getYScaleById.bind(s);return(d,h)=>{const{id:g}=d,f=u.call(s,g,t)(s.getShapeYMin(g)),p=c(d,h)||f,_=I(o)?o:o[d.id]||o._$width,x=i[`axis_${s.axis.getId(g)}_inverted`],m=d.value,y=r(d);let $=l(d);i.axis_rotated&&!x&&(m>0&&$<f||m<0&&f<$)&&($=f),s.isBarRangeType(d)||($-=f-p);const v=y+_;return[[y,p],[y,$],[v,$],[v,p]]}},updateConnectLine(e,t,s){const i=s.map((n,a,o)=>{const r=this.config.axis_rotated,l=/^start-(start|end)$/.test(t),c=/^end-(start|end)$/.test(t),u=[],d=r?c?n.x-n.width:n.x:n.x+n.width,h=r||l?n.y+n.height:n.y;return a===0?u.push(`${d},${h}`):(u.push(r?`L${n.x-(/\w+-end$/.test(t)?n.width:0)},${n.y}`:`L${n.x},${n.y+(/\w+-start$/.test(t)?n.height:0)}`),a<o.length-1&&u.push(`M${d},${h}`)),u.join(" ")});e.attr("d",`M${i.join("")}z`)}},zr={initBubble(){const e=this,{config:t}=e;e.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength(){const e=this,{width:t,height:s}=e.state,i=at.bubbleBaseLength;let n=e.cache.get(i);return n||e.cache.add(i,n=Rt("min",[t,s])),n},getBubbleR(e){const t=this;let s=t.config.bubble_maxR;k(s)?s=s.bind(t.api)(e):I(s)||(s=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const i=Rt("max",t.getMinMaxData().max.map(o=>t.isBubbleZType(o)?t.getBubbleZData(o.value,"y"):G(o.value)?o.value.mid:o.value)),n=s*s*Math.PI,a=(t.isBubbleZType(e)?t.getBubbleZData(e.value,"z"):e.value)*(n/i);return Math.sqrt(a/Math.PI)},getBubbleZData(e,t){return G(e)?e[t]:e[t==="y"?0:1]}},Fr=Object.defineProperty,Ai=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,Xr=Object.prototype.propertyIsEnumerable,wi=(e,t,s)=>t in e?Fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Br=(e,t)=>{for(var s in t||(t={}))Mr.call(t,s)&&wi(e,s,t[s]);if(Ai)for(var s of Ai(t))Xr.call(t,s)&&wi(e,s,t[s]);return e},Nr={initCandlestick(){const{$el:e}=this;e.candlestick=e.main.select(`.${D.chart}`).append("g").attr("class",Lt.chartCandlesticks)},updateTargetsForCandlestick(e){const t=this,{$el:s}=t,i=t.getChartClass("Candlestick");s.candlestick||t.initCandlestick(),t.$el.main.select(`.${Lt.chartCandlesticks}`).selectAll(`.${Lt.chartCandlestick}`).data(t.filterNullish(e)).enter().append("g").attr("class",i).style("pointer-events","none")},updateCandlestick(e,t=!1){const s=this,{$el:i,$T:n}=s,a=t?i.subchart:i,o=s.getClass("candlestick",!0),r=s.initialOpacity.bind(s),l=a.main.selectAll(`.${Lt.chartCandlestick}`).selectAll(`.${Lt.candlestick}`).data(s.labelishData.bind(s));n(l.exit(),e).style("opacity","0").remove();const c=l.enter().filter(u=>u.value).append("g").attr("class",o);c.append("line"),c.append("path"),a.candlestick=l.merge(c).style("opacity",r)},generateDrawCandlestick(e,t){const s=this,{config:i}=s,n=s.generateGetCandlestickPoints(e,t),a=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const u=n(r,l),d=s.getCandlestickData(r),h=d==null?void 0:d._isUp,g=+a,f=+!g;c.classed&&c.classed(Lt[h?"valueUp":"valueDown"],!0);const p=a?`H${u[1][1]} V${u[1][0]} H${u[0][1]}`:`V${u[1][1]} H${u[1][0]} V${u[0][1]}`;c.select("path").attr("d",`M${u[0][g]},${u[0][f]}${p}z`).style("fill",m=>(h?s.color(m):G(o)?o[m.id]:o)||s.color(m));const _=c.select("line"),x=a?{x1:u[2][1],x2:u[2][2],y1:u[2][0],y2:u[2][0]}:{x1:u[2][0],x2:u[2][0],y1:u[2][1],y2:u[2][2]};for(const m in x)_.attr(m,x[m])}},generateGetCandlestickPoints(e,t=!1){const s=this,i=t?s.axis.subX:s.axis.x,n=s.getIndicesMax(e)+1,a=s.getBarW("candlestick",i,n),o=s.getShapeX(a,e,!!t),r=s.getShapeY(!!t),l=s.getShapeOffset(s.isBarType,e,!!t),c=s.getYScaleById.bind(s);return(u,d)=>{const h=c.call(s,u.id,t)(s.getShapeYMin(u.id)),g=l(u,d)||h,f=I(a)?a:a[u.id]||a._$width,p=s.getCandlestickData(u);let _;if(p&&I(p.open)&&I(p.close)){const x={start:o(u),end:0};x.end=x.start+f;const m={start:r(p.open),end:r(p.close)},y={x:x.start+f/2,high:r(p.high),low:r(p.low)};m.start-=h-g,_=[[x.start,m.start],[x.end,m.end],[y.x,y.low,y.high]]}else _=[[0,0],[0,0],[0,0,0]];return _}},redrawCandlestick(e,t,s=!1){const i=this,{$el:n,$T:a}=i,{candlestick:o}=s?n.subchart:n,r=Ct(!0);return[o.each(function(l,c){const u=a((0,R.select)(this),t,r);e(l,c,u)}).style("opacity",null)]},getCandlestickData({value:e}){let t;if(Y(e)){const[s,i,n,a,o=!1]=e;t={open:s,high:i,low:n,close:a},o!==!1&&(t.volume=o)}else G(e)&&(t=Br({},e));return t&&(t._isUp=t.close>=t.open),t||null}},Gr=Object.defineProperty,Si=Object.getOwnPropertySymbols,Vr=Object.prototype.hasOwnProperty,Yr=Object.prototype.propertyIsEnumerable,Ri=(e,t,s)=>t in e?Gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,jr=(e,t)=>{for(var s in t||(t={}))Vr.call(t,s)&&Ri(e,s,t[s]);if(Si)for(var s of Si(t))Yr.call(t,s)&&Ri(e,s,t[s]);return e};function Le(e=!1){const t=this,{config:s,state:{current:{width:i,height:n}}}=t,a=t.getCurrentPadding(),o=jr({width:i-(a.left+a.right),height:n-(s.legend_show?t.getLegendHeight()+10:0)-(a.top+a.bottom)},a);if(e){const{width:r,height:l}=Ci.call(t,{width:o.width,height:o.height});o.width<r&&(o.width=r),o.height<l&&(o.height=l)}return o}function Ci(e){const t=this,{config:s}=t;let i=s.funnel_neck_width,n=s.funnel_neck_height;return[i,n]=[i,n].map((a,o)=>{let r=a;return G(a)&&(r=e[o?"height":"width"]*a.ratio),r}),{width:i,height:n}}function Wr(e){const t=this,{top:s,left:i,width:n}=Le.call(t,!0),a=[];return e.forEach((o,r)=>{const{ratio:l}=o,c=r>0?a[r-1][2][1]:s;a.push(o.coords=[[i,c],[i+n,c],[i+n,r>0?l+c:l+s],[i,r>0?l+c:l+s],[i,c]])}),a}function Ei(e=!1){const t=this,{width:s,height:i,top:n,left:a}=Le.call(t,!0),o=Ci.call(t,{width:s,height:i}),r=(s-o.width)/2,l=(s+o.width)/2,c=i-o.height,u=[[0,0],[s,0],[l,c],[l,i],[r,i],[r,c],[0,0]];return e&&u.forEach(d=>{d[0]+=a,d[1]+=n}),`M${u.join("L")}z`}function Hr(e){const t=this,{config:s}=t,i=e.map(n=>({id:n.id,value:n.values.reduce((a,o)=>a+o.value,0)}));return s.data_order&&i.sort(t.getSortCompareFn.bind(t)(!0)),Li.call(t,i)}function Li(e){const t=this,{height:s}=Le.call(t),i=t.getTotalDataSum(!0);return e.forEach(n=>{n.ratio=n.value/i*s}),e}var Ur={initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${D.chart}`).append("g").classed(ue.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(ue.funnelBackground,!0),e.bindFunnelEvent()},bindFunnelEvent(){const e=this,{$el:{funnel:t},config:s,state:i}=e,n=a=>{var o;const r=a.isTrusted?a.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return/^path$/i.test(r.tagName)&&(i.event=a,l=(0,R.select)(r).datum()),l};if(s.interaction_enabled){const a=i.inputType==="touch";t.on(a?"touchstart":"mouseover mousemove",o=>{const r=n(o);r&&(e.showTooltip([r],o.target),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},a?{passive:!0}:void 0).on(a?"touchend":"mouseout",o=>{const r=n(o);s.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},updateTargetsForFunnel(e){const t=this,{$el:{funnel:s}}=t,i=t.getChartClass("Funnel"),n=t.getClass("funnel",!0);s||t.initFunnel();const a=Hr.call(t,e.filter(t.isFunnelType.bind(t))),o=s.selectAll(`.${ue.chartFunnel}`).data(t.filterNullish(a));o.exit().remove();const r=o.enter().insert("g",`.${ue.funnelBackground}`);r.append("path"),s.path=r.merge(o).attr("class",l=>i(l)).select("path").attr("class",n).style("opacity","0").style("fill",t.color)},updateFunnel(e){const t=this,{$el:{funnel:s}}=t,i=e.map(({id:n})=>n);s.path=s.path.filter(n=>i.indexOf(n.id)>=0)},generateGetFunnelPoints(){const e=this,{$el:{funnel:t}}=e,s=e.filterTargetsToShow(t.path),{top:i,left:n,right:a}=Le.call(e),o=(n-a)/2,r={};let l=i!=null?i:0;return s.each((c,u)=>{var d;r[c.id]=[[o,l],[o,l+=((d=s==null?void 0:s[u])!=null?d:c).ratio]]}),c=>r[c.id]},redrawFunnel(){const e=this,{$T:t,$el:{funnel:s}}=e,i=e.filterTargetsToShow(s.path),n=Wr.call(e,Li.call(e,i.data()));s.attr("clip-path",`path('${Ei.bind(e)()}')`),s.background.attr("d",Ei.call(e,!0)),t(i).attr("d",(a,o)=>`M${n[o].join("L")}z`).style("opacity","1"),s.selectAll("g").style("opacity",null)}},Zr={initGauge(){const e=this,{config:t,$el:{arcs:s}}=e,i=(n=null,a="")=>{s.append("text").attr("class",n).style("text-anchor","middle").style("pointer-events","none").text(a)};if(e.hasType("gauge")){const n=e.hasMultiArcGauge();s.append(n?"g":"path").attr("class",X.chartArcsBackground).style("fill",!n&&t.gauge_background||null),t.gauge_units&&i($t.chartArcsGaugeUnit),t.gauge_label_show&&(i($t.chartArcsGaugeMin),!t.gauge_fullCircle&&i($t.chartArcsGaugeMax))}},updateGaugeMax(){const e=this,{config:t,state:s}=e,n=e.hasMultiArcGauge()?e.getMinMaxData().max[0].value:e.getTotalDataSum(s.rendered);!t.gauge_enforceMinMax&&n+t.gauge_min*(t.gauge_min>0?-1:1)>t.gauge_max&&(t.gauge_max=n-t.gauge_min)},redrawArcGaugeLine(){const e=this,{config:t,state:s,$el:i}=e,{hiddenTargetIds:n}=e.state,a=i.main.selectAll(`.${X.arcs}`).selectAll(`.${X.arcLabelLine}`).data(e.arcData.bind(e));a.enter().append("rect").attr("class",r=>`${X.arcLabelLine} ${D.target} ${D.target}-${r.data.id}`).merge(a).style("fill",r=>e.levelColor?e.levelColor(r.data.values[0].value):e.color(r.data)).style("display",t.gauge_label_show?null:"none").each(function(r){let l=0;const c=2;let u=0,d=0,h="";if(n.indexOf(r.data.id)<0){const g=e.updateAngle(r),f=s.gaugeArcWidth/e.filterTargetsToShow(e.data.targets).length*(g.index+1),p=g.endAngle-Math.PI/2,_=s.radius-f,x=p-(_===0?0:1/_);l=s.radiusExpanded-s.radius+f,u=Math.cos(x)*_,d=Math.sin(x)*_,h=`rotate(${p*180/Math.PI}, ${u}, ${d})`}(0,R.select)(this).attr("x",u).attr("y",d).attr("width",l).attr("height",c).attr("transform",h).style("stroke-dasharray",`0, ${l+c}, 0`)})},textForGaugeMinMax(e,t){const s=this,{config:i}=s,n=i.gauge_label_extents;return k(n)?n.bind(s.api)(e,t):e},getGaugeLabelHeight(){const{config:e}=this;return this.config.gauge_label_show&&!e.gauge_fullCircle?20:0},getPaddingBottomForGauge(){const e=this;return e.getGaugeLabelHeight()*(e.config.gauge_label_show?2:2.5)}},qr=Object.defineProperty,Kr=Object.defineProperties,Jr=Object.getOwnPropertyDescriptors,ki=Object.getOwnPropertySymbols,Qr=Object.prototype.hasOwnProperty,tl=Object.prototype.propertyIsEnumerable,Pi=(e,t,s)=>t in e?qr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,el=(e,t)=>{for(var s in t||(t={}))Qr.call(t,s)&&Pi(e,s,t[s]);if(ki)for(var s of ki(t))tl.call(t,s)&&Pi(e,s,t[s]);return e},sl=(e,t)=>Kr(e,Jr(t));function il(e,t,s,i=!1){const n=e?[e,0]:s;for(let a=e||s.reduce((o,r)=>o+r);a<=t;)s.forEach(o=>{a+o<=t&&n.push(o),a+=o});return n.length%2!==0&&n.push(i?s[1]:0),{dash:n.join(" "),length:n.reduce((a,o)=>a+o,0)}}function nl(e,t,s){const i=this,n=[],a="2 2";if(H(t)){const o=(r,l)=>nt(r)?l:s?At.call(i,r):r;for(let r=0,l;l=t[r];r++){const c=o(l.start,e[0].x),u=o(l.end,e[e.length-1].x),d=l.style||{dasharray:a};n[r]={start:c,end:u,style:d}}}return n}var al={initLine(){const{$el:e}=this;e.line=e.main.select(`.${D.chart}`).append("g").attr("class",kt.chartLines).call(this.setCssRule(!1,`.${kt.chartLines}`,["pointer-events:none"]))},updateTargetsForLine(e){const t=this,{$el:{area:s,line:i,main:n}}=t,a=t.getChartClass("Line"),o=t.getClass("lines",!0),r=t.classFocus.bind(t);i||t.initLine();const l=e.filter(d=>!(t.isScatterType(d)||t.isBubbleType(d))),c=n.select(`.${kt.chartLines}`).selectAll(`.${kt.chartLine}`).data(t.filterNullish(l)).attr("class",d=>a(d)+r(d)),u=c.enter().append("g").attr("class",a).style("opacity","0").style("pointer-events",t.getStylePropValue("none"));if(u.append("g").attr("class",o),t.hasTypeOf("Area")){const d=(!s&&u.empty()?c:u).filter(t.isAreaType.bind(t));t.initArea(d)}t.updateTargetForCircle(l,u)},updateLine(e,t=!1){const s=this,{format:{extraLineClasses:i},$el:n,$T:a}=s,o=t?n.subchart:n,r=o.main.selectAll(`.${kt.lines}`).selectAll(`.${kt.line}`).data(s.lineData.bind(s));a(r.exit(),e).style("opacity","0").remove(),o.line=r.enter().append("path").attr("class",l=>`${s.getClass("line",!0)(l)} ${i(l)||""}`).style("stroke",s.color).merge(r).style("opacity",s.initialOpacity.bind(s)).attr("transform",null)},redrawLine(e,t,s=!1){const i=this,{$el:n,$T:a}=i,{line:o}=s?n.subchart:n;return[a(o,t,Ct()).attr("d",e).style("stroke",this.color).style("opacity",null)]},getCurve(e){const t=this;return t.config.axis_rotated&&t.isStepType(e)?i=>{const n=t.getInterpolate(e)(i);return n.orgPoint=n.point,n.pointRotated=function(a,o){this._point===1&&(this._point=2);const r=this._y*(1-this._t)+o*this._t;this._context.lineTo(this._x,r),this._context.lineTo(a,r),this._x=a,this._y=o},n.point=function(a,o){this._point===0?this.orgPoint(a,o):this.pointRotated(a,o)},n}:t.getInterpolate(e)},generateDrawLine(e,t){const s=this,{config:i,scale:n}=s,a=i.line_connectNull,o=i.axis_rotated,r=s.generateGetLinePoints(e,t),l=s.getYScaleById.bind(s),c=g=>(t?s.subxx:s.xx).call(s,g),u=(g,f)=>s.isGrouped(g.id)?r(g,f)[0][1]:l(g.id,t)(s.getBaseValue(g));let d=(0,tt.line)();d=o?d.x(u).y(c):d.x(c).y(u),a||(d=d.defined(g=>s.getBaseValue(g)!==null));const h=t?n.subX:n.x;return g=>{const f=l(g.id,t);let p=a?s.filterRemoveNull(g.values):g.values,_=0,x=0,m;if(s.isLineType(g)){const y=i.data_regions[g.id];y?(s.isAreaRangeType(g)&&(p=p.map($=>sl(el({},$),{value:s.getRangedData($,"mid")}))),m=s.lineWithRegions(p,n.zoom||h,f,y)):(s.isStepType(g)&&(p=s.convertValuesToStep(p)),m=d.curve(s.getCurve(g))(p))}else p[0]&&(_=h(p[0].x),x=f(p[0].value)),m=o?`M ${x} ${_}`:`M ${_} ${x}`;return m||"M 0 0"}},lineWithRegions(e,t,s,i){const n=this,{config:a}=n,o=a.axis_rotated,r=n.axis.isTimeSeries(),l="2 2",c=nl.bind(n)(e,i,r),u=n.hasNullDataValue(e);let d,h,g,f;const p=o?A=>s(A.value):A=>t(A.x),_=o?A=>t(A.x):A=>s(A.value),x=A=>`M${A[0][0]},${A[0][1]}L${A[1][0]},${A[1][1]}`,m=r?(A,w,O,E)=>{const P=A.x.getTime(),F=w.x-A.x,U=new Date(P+F*O),j=new Date(P+F*(O+E)),ht=o?[[s(h(O)),t(U)],[s(h(O+g)),t(j)]]:[[t(U),s(h(O))],[t(j),s(h(O+g))]];return x(ht)}:(A,w,O,E)=>{const P=t(w.x,!o),F=s(w.value,o),U=O+E,j=t(d(O),!o),ht=s(h(O),o);let et=t(d(U),!o),wt=s(h(U),o);et>P&&(et=P),A.value>w.value&&(o?wt<F:wt>F)&&(wt=F);const de=[[j,ht],[et,wt]];return o&&de.forEach(xe=>xe.reverse()),x(de)},y={x:n.axis.getAxisType("x"),y:n.axis.getAxisType("y")};let $="";const v=n.$el.line.filter(({id:A})=>A===e[0].id),b=v.clone().style("display","none"),T=(A,w)=>A.attr("d",w).node().getTotalLength(),C={dash:[],lastLength:0};let S=!1;for(let A=0,w;w=e[A];A++){const O=e[A-1],E=O&&M(O.value);let P=n.isWithinRegions(w.x,c);if(M(w.value)){if(nt(c)||!P||!E)$+=`${A&&E?"L":"M"}${p(w)},${_(w)}`;else if(E)if(P=((P==null?void 0:P.dasharray)||l).split(" ").map(Number),d=Wt(y.x,O.x,w.x),h=Wt(y.y,O.value,w.value),u){const F=t(w.x)-t(O.x),U=s(w.value)-s(O.value),j=Math.sqrt(Math.pow(F,2)+Math.pow(U,2));g=P[0]/j,f=g*P[1];for(let ht=g;ht<=1;ht+=f)$+=m(O,w,ht,g),ht+f>=1&&($+=m(O,w,1,0))}else{let F=[];if(S=w.x===e[e.length-1].x,r){const et=+O.x,wt=new Date(et),de=new Date(et+(+w.x-et));F=[[t(wt),s(h(0))],[t(de),s(h(1))]]}else F=[[t(d(0)),s(h(0))],[t(d(1)),s(h(1))]];o&&F.forEach(et=>et.reverse());const U=T(b,$),j=T(b,$+=`L${F[1].join(",")}`),ht=il(U-C.lastLength,j-C.lastLength,P,S);C.lastLength+=ht.length,C.dash.push(ht.dash)}}}return C.dash.length&&(!S&&C.dash.push(T(b,$)),b.remove(),v.attr("stroke-dasharray",C.dash.join(" "))),$},isWithinRegions(e,t){for(let s=0,i;i=t[s];s++)if(i.start<e&&e<=i.end)return i.style;return!1},isWithinStep(e,t){return Math.abs(t-Tt(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||Y(t)&&t.indexOf(e.id)!==-1}};const ne=()=>Ct();var ke={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:s}}=this;let i=t.point_opacity;return nt(i)&&(i=this.getBaseValue(e)!==null&&s[e.id]?this.opacityForCircle(e):"0"),i},opacityForCircle(e){var t;const{config:s}=this;let i=s.point_opacity;return nt(i)&&(i=s.point_show&&!((t=this.isPointFocusOnly)!=null&&t.call(this))?null:"0",i=M(this.getBaseValue(e))?this.isBubbleType(e)||this.isScatterType(e)?"0.5":i:"0"),i},initCircle(){const e=this,{$el:{main:t}}=e;!e.point&&(e.point=e.generatePoint()),(e.hasType("bubble")||e.hasType("scatter"))&&t.select(`.${D.chart} > .${pt.chartCircles}`).empty()&&t.select(`.${D.chart}`).append("g").attr("class",pt.chartCircles)},updateTargetForCircle(e,t){const s=this,{config:i,data:n,$el:a}=s,o=i.interaction_enabled&&i.data_selection_enabled,r=o&&i.data_selection_isselectable,l=s.getClass("circles",!0);if(!i.point_show)return;s.initCircle();let c=e,u=t;if(!c){c=s.filterNullish(n.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const d=a.main.select(`.${pt.chartCircles}`).style("pointer-events","none").selectAll(`.${pt.circles}`).data(c);d.exit().remove(),u=d.enter()}o&&u.append("g").attr("class",d=>s.generateClass(Q.selectedCircles,d.id)),u.append("g").attr("class",l).call(d=>{s.setCssRule(!0,`.${pt.circles}`,["cursor:pointer"],r)(d),s.setCssRule(!0,` .${pt.circle}`,["fill","stroke"],s.color)(d)}).style("opacity",function(){return(0,R.select)(this.parentNode).attr("class").indexOf(pt.chartCircles)>-1?"0":null}),o&&c.forEach(d=>{a.main.selectAll(`.${Q.selectedCircles}${s.getTargetSelectorSuffix(d.id)}`).selectAll(`${Q.selectedCircle}`).each(h=>{h.value=d.values[h.index].value})})},updateCircle(e=!1){const t=this,{config:s,state:i,$el:n}=t,a=t.isPointFocusOnly(),o=e?n.subchart:n;if(s.point_show&&!i.toggling){s.point_radialGradient&&t.updateLinearGradient();const r=o.main.selectAll(`.${pt.circles}`).selectAll(`.${pt.circle}`).data(l=>{const c=t.isLineType(l)&&t.shouldDrawPointsForLine(l)||t.isBubbleType(l)||t.isRadarType(l)||t.isScatterType(l)?a?[l.values[0]]:l.values:[];return t.filterNullish(c)});r.exit().remove(),r.enter().filter(Boolean).append(t.point("create",this,t.pointR.bind(t),t.updateCircleColor.bind(t))),o.circle=o.main.selectAll(`.${pt.circles} .${pt.circle}`).style("stroke",t.getStylePropValue(t.color)).style("opacity",t.initialOpacityForCircle.bind(t))}},updateCircleColor(e){const t=this,s=t.getStylePropValue(t.color);return t.config.point_radialGradient?t.getGradienColortUrl(e.id):s?s(e):null},redrawCircle(e,t,s,i,n=!1){const a=this,{state:{rendered:o},$el:r,$T:l}=a,c=n?r.subchart:r,u=c.main.selectAll(`.${Q.selectedCircle}`);if(!a.config.point_show)return[];const d=a.point("update",a,e,t,a.updateCircleColor.bind(a),s,i,u),h=a.isCirclePoint()?"c":"",g=Ct(),f=a.opacityForCircle.bind(a),p=[];return c.circle.each(function(_){let x=d.bind(this)(_);x=l(x,s||!o,g).style("opacity",f),p.push(x)}),[p,l(u,s).attr(`${h}x`,e).attr(`${h}y`,t)]},showCircleFocus(e){const t=this,{state:{hasRadar:s,resizing:i,toggling:n,transiting:a},$el:o}=t;let{circle:r}=o;if(a===!1&&r&&t.isPointFocusOnly()){const l=(s?t.radarCircleX:t.circleX).bind(t),c=(s?t.radarCircleY:t.circleY).bind(t),u=n||nt(e),d=t.point("update",t,l,c,t.getStylePropValue(t.color),i?!1:u);e&&(r=r.filter(function(h){var g;const f=(g=e.filter)==null?void 0:g.call(e,p=>p.id===h.id);return f.length?(0,R.select)(this).datum(f[0]):!1})),r.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:g,index:f,value:p}=h;let _="hidden";M(p)&&(d.bind(this)(h),t.expandCircles(f,g),_=""),this.style.visibility=_})}},hideCircleFocus(){const e=this,{$el:{circle:t}}=e;e.isPointFocusOnly()&&t&&(e.unexpandCircles(),t.style("visibility","hidden"))},circleX(e){return this.xx(e)},updateCircleY(e=!1){const t=this,s=t.generateGetLinePoints(t.getShapeIndices(t.isLineType),e);return(i,n)=>{const a=i.id;return t.isGrouped(a)?s(i,n)[0][1]:t.getYScaleById(a,e)(t.getBaseValue(i))}},expandCircles(e,t,s){const i=this,n=i.pointExpandedR.bind(i);s&&i.unexpandCircles();const a=i.getShapeByIndex("circle",e,t).classed(D.EXPANDED,!0),o=n(a)/i.config.point_r,r=1-o;i.isCirclePoint()?a.attr("r",n):a.each(function(){const l=(0,R.select)(this);if(this.tagName==="circle")l.attr("r",n);else{const{width:c,height:u}=Ft(this),d=r*(+l.attr("x")+c/2),h=r*(+l.attr("y")+u/2);l.attr("transform",`translate(${d} ${h}) scale(${o})`)}})},unexpandCircles(e){const t=this,s=t.pointR.bind(t),i=t.getShapeByIndex("circle",e).filter(function(){return(0,R.select)(this).classed(D.EXPANDED)}).classed(D.EXPANDED,!1);if(i.attr("r",s),!t.isCirclePoint()){const n=s(i)/t.config.point_r;i.attr("transform",n!==1?`scale(${n})`:null)}},pointR(e){const t=this,{config:s}=t,i=s.point_r;let n=i;return t.isBubbleType(e)?n=t.getBubbleR(e):k(i)&&(n=i.bind(t.api)(e)),e.r=n,n},pointExpandedR(e){const t=this,{config:s}=t,i=t.isBubbleType(e)?1.15:1.75;return s.point_focus_expand_enabled?s.point_focus_expand_r||t.pointR(e)*i:t.pointR(e)},pointSelectR(e){const t=this,s=t.config.point_select_r;return k(s)?s(e):s||t.pointR(e)*4},isPointFocusOnly(){const e=this;return e.config.point_focus_only&&!e.hasType("bubble")&&!e.hasType("scatter")&&!e.hasArcType(null,["radar"])},isWithinCircle(e,t){const{state:s}=this,i=Tt(s.event,e),n=(0,R.select)(e),a=this.isCirclePoint(e)?"c":"",o=this.getPointSensitivity(n==null?void 0:n.datum());let r=+n.attr(`${a}x`),l=+n.attr(`${a}y`);if(!(r||l)&&e.nodeType===1){const{x:c,y:u}=dt(e);r=c,l=u}return Math.sqrt(Math.pow(r-i[0],2)+Math.pow(l-i[1],2))<(t||o)},getPointSensitivity(e){const t=this;let s=t.config.point_sensitivity;if(e)k(s)?s=s.call(t.api,e):s==="radius"&&(s=e.r);else return s;return s},updatePointClass(e){const t=this,{circle:s}=t.$el;let i=!1;return(G(e)||s)&&(i=e===!0?s.each(function(n){let a=t.getClass("circle",!0)(n);this.getAttribute("class").indexOf(D.EXPANDED)>-1&&(a+=` ${D.EXPANDED}`),this.setAttribute("class",a)}):t.getClass("circle",!0)(e)),i},generateGetLinePoints(e,t){const s=this,{config:i}=s,n=s.getShapeX(0,e,t),a=s.getShapeY(t),o=s.getShapeOffset(s.isLineType,e,t),r=s.getYScaleById.bind(s);return(l,c)=>{const u=r.call(s,l.id,t)(s.getShapeYMin(l.id)),d=o(l,c)||u,h=n(l);let g=a(l);i.axis_rotated&&(l.value>0&&g<u||l.value<0&&u<g)&&(g=u);const f=[h,g-(u-d)];return[f,f,f,f]}},custom:{create(e,t,s){return e.append("use").attr("xlink:href",`#${t}`).attr("class",this.updatePointClass.bind(this)).style("fill",s).node()},update(e,t,s,i,n,a,o){const r=this,{width:l,height:c}=Ft(e.node()),u=g=>M(g.value)?t(g)-l/2:0,d=g=>M(g.value)?s(g)-c/2:0;let h=e;return n&&(a&&h.attr("x",u),h=r.$T(h,n,ne()),o&&r.$T(o,n,ne())),h.attr("x",u).attr("y",d).style("fill",i)}},circle:{create(e,t,s){return e.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",t).style("fill",s).node()},update(e,t,s,i,n,a,o){const r=this;let l=e;return r.hasType("bubble")&&l.attr("r",r.pointR.bind(r)),n&&(a&&l.attr("cx",t),l.attr("cx")&&(l=r.$T(l,n,ne())),o&&r.$T(l,n,ne())),l.attr("cx",t).attr("cy",s).style("fill",i)}},rectangle:{create(e,t,s){const i=n=>t(n)*2;return e.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",i).attr("height",i).style("fill",s).node()},update(e,t,s,i,n,a,o){const r=this,l=r.config.point_r,c=h=>t(h)-l,u=h=>s(h)-l;let d=e;return n&&(a&&d.attr("x",c),d=r.$T(d,n,ne()),o&&r.$T(o,n,ne())),d.attr("x",c).attr("y",u).style("fill",i)}}};function ol(e){return bt(e)&&k(e.create)&&k(e.update)}function rl(e,t){var s;const i=this,n=(l,c)=>{const u=l.attributes;for(let d=0,h;h=u[d];d++)h=h.name,c.setAttribute(h,l.getAttribute(h))},o=new DOMParser().parseFromString(Jt(e),"image/svg+xml").documentElement,r=ct.createElementNS(R.namespaces.svg,o.nodeName.toLowerCase());if(r.id=t,r.style.fill="inherit",r.style.stroke="inherit",n(o,r),(s=o.childNodes)!=null&&s.length){const l=(0,R.select)(r);"innerHTML"in r?l.html(Jt(o.innerHTML)):Yt(o.childNodes).forEach(c=>{n(c,l.append(c.tagName).node())})}i.$el.defs.node().appendChild(r)}var ae={hasValidPointType(e){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(e||this.config.point_type)},hasLegendDefsPoint(){var e;const{config:t}=this;return t.legend_show&&((e=t.point_pattern)==null?void 0:e.length)&&t.legend_usePoint},getDefsPointId(e){const{state:{datetimeId:t}}=this;return`${t}-point${e}`},getValidPointPattern(){const{config:e}=this,t=/^(circle|rect(angle)?)$/i.test(e.point_type)?e.point_type:"circle";return ot(e.point_pattern)?e.point_pattern:[t]},generatePoint(){const e=this,{$el:t,config:s}=e,i=[],n=e.getValidPointPattern();return function(a,o,...r){return function(l){var c,u,d,h;const g=e.getTargetSelectorSuffix(l.id||((c=l.data)==null?void 0:c.id)||l),f=(0,R.select)(this);i.indexOf(g)<0&&i.push(g);let p=n[i.indexOf(g)%n.length];if(e.hasValidPointType(p))p=e[p];else if(!ol(p||s.point_type)){const _=e.getDefsPointId(g);if(t.defs.select(`#${_}`).size()<1&&rl.call(e,p,_),a==="create")return(u=e.custom)==null?void 0:u.create.bind(o)(f,_,...r);if(a==="update")return(d=e.custom)==null?void 0:d.update.bind(o)(f,...r)}return(h=p[a])==null?void 0:h.bind(o)(f,...r)}}}};function Oi(e){const t=e.config.polar_level_max;let s=e.getMinMaxData().max[0].value;return t&&t>s&&(s=t),s}var ll={initPolar(){const e=this,{$el:{arcs:t},config:s}=e,i=s.polar_level_text_show,n=s.polar_level_text_backgroundColor;t.levels=t.append("g").attr("class",Dt.levels),i&&n&&e.generateTextBGColorFilter(n)},getPolarOuterRadius(e,t){var s;const i=Oi(this);return((s=e==null?void 0:e.data.values[0].value)!=null?s:0)/i*t},updateTargetsForPolar(e){this.updateTargetsForArc(e)},redrawPolar(){const e=this,{config:t}=e;t.polar_level_show&&e.updatePolarLevel()},updatePolarLevel(){const e=this,{config:t,state:s,$el:{arcs:{levels:i}}}=e,n=t.polar_level_depth,a=Oi(e),o=Se(0,n),r=s.radius,l=o.map(h=>r*((h+1)/n)),c=(t.polar_level_text_format||function(){}).bind(e.api),u=i.selectAll(`.${Dt.level}`).data(o);u.exit().remove();const d=u.enter().append("g").attr("class",(h,g)=>`${Dt.level} ${Dt.level}-${g}`);if(d.append("circle"),d.merge(u).selectAll("circle").style("visibility",t.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>l[h]),t.polar_level_text_show){const h=t.polar_level_text_backgroundColor,g=`#${s.datetimeId}-labels-bg${e.getTargetSelectorSuffix(h)}`;d.append("text").style("text-anchor","middle"),d.merge(u).selectAll("text").attr("dy",f=>-l[f]+5).attr("filter",h?`url(${g})`:null).text(f=>c(a/o.length*(f+1)))}}};function cl(e,t,s,i,n,a){const o=e&&i>0?s-i:i,r=2*Math.PI;return n*(1-a*(t==="x"?Math.sin:Math.cos)(o*r/s))}const oe=at.radarPoints,Ii=at.radarTextWidth;var dl={initRadar(){const e=this,{config:t,state:{current:s},$el:i}=e;e.hasType("radar")&&(i.radar=i.main.select(`.${D.chart}`).append("g").attr("class",os.chartRadars),i.radar.levels=i.radar.append("g").attr("class",Dt.levels),i.radar.axes=i.radar.append("g").attr("class",rt.axis),i.radar.shapes=i.radar.append("g").attr("class",it.shapes),s.dataMax=t.radar_axis_max||e.getMinMaxData().max[0].value,t.radar_axis_text_show&&(t.interaction_enabled&&e.bindRadarEvent(),e.updateRadarLevel(),e.updateRadarAxes()))},getRadarSize(){const e=this,{config:t,state:{arcWidth:s,arcHeight:i}}=e,n=t.axis_x_categories.length<4?-20:10,a=(Math.min(s,i)-n)/2;return[a,a]},updateTargetsForRadar(e){const t=this,{config:s}=t;vt(s.axis_x_categories)&&(s.axis_x_categories=Se(0,Rt("max",e.map(i=>i.values.length)))),t.generateRadarPoints()},getRadarPosition(e,t,s,i){const n=this,{config:a}=n,[o,r]=n.getRadarSize(),l=a.axis_x_categories.length,c=a.radar_direction_clockwise,u=Yt(e).map(d=>cl(c,d,l,t,H(s)?s:e==="x"?o:r,I(i)?i:a.radar_size_ratio));return u.length===1?u[0]:u},generateRadarPoints(){const e=this,t=e.data.targets,[s,i]=e.getRadarSize(),n=e.cache.get(oe)||{},a=n._size;(!a||a.width!==s&&a.height!==i)&&(t.forEach(o=>{n[o.id]=o.values.map((r,l)=>e.getRadarPosition(["x","y"],l,void 0,e.getRatio("radar",r)))}),n._size={width:s,height:i},e.cache.add(oe,n))},redrawRadar(){const e=this,{radar:t,main:s}=e.$el,i=e.getTranslate("radar");i&&(t.attr("transform",i),s.select(`.${lt.chartTexts}`).attr("transform",i),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(oe);return(t,s)=>{const i=e[t.id][s];return[i,i,i,i]}},updateRadarLevel(){const e=this,{config:t,state:s,$el:{radar:i}}=e,[n,a]=e.getRadarSize(),o=t.radar_level_depth,r=t.axis_x_categories.length,l=t.radar_level_text_show,c=i.levels,u=Se(0,o),d=t.radar_size_ratio*Math.min(n,a),h=u.map(x=>d*((x+1)/o)),g=(t.radar_level_text_format||function(){}).bind(e.api),f=u.map(x=>{const m=h[x];return Se(0,r).map($=>e.getRadarPosition(["x","y"],$,m,1).join(",")).join(" ")}),p=c.selectAll(`.${Dt.level}`).data(u);p.exit().remove();const _=p.enter().append("g").attr("class",(x,m)=>`${Dt.level} ${Dt.level}-${m}`);_.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),l&&(c.select("text").empty()&&c.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>g(0)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(x=>g(s.current.dataMax/u.length*(x+1)))),_.merge(p).attr("transform",x=>`translate(${n-h[x]}, ${a-h[x]})`).selectAll("polygon").attr("points",x=>f[x]),l&&c.selectAll("text").attr("x",x=>nt(x)?n:f[x].split(",")[0]).attr("y",x=>nt(x)?a:0)},updateRadarAxes(){const e=this,{config:t,$el:{radar:s}}=e,[i,n]=e.getRadarSize(),a=t.axis_x_categories;let o=s.axes.selectAll("g").data(a);o.exit().remove();const r=o.enter().append("g").attr("class",(l,c)=>`${rt.axis}-${c}`);if(t.radar_axis_line_show&&r.append("line"),t.radar_axis_text_show&&r.append("text"),o=r.merge(o),t.radar_axis_line_show&&o.select("line").attr("x1",i).attr("y1",n).attr("x2",(l,c)=>e.getRadarPosition("x",c)).attr("y2",(l,c)=>e.getRadarPosition("y",c)),t.radar_axis_text_show){const{x:l=0,y:c=0}=t.radar_axis_text_position,u=e.cache.get(Ii)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){Qt((0,R.select)(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){nt(this.width)&&(this.width=dt(this,!0).width/2);let h=e.getRadarPosition("x",d.index,void 0,1),g=Math.round(e.getRadarPosition("y",d.index,void 0,1));return h>i?h+=this.width+l:Math.round(h)<i&&(h-=this.width+l),g>n?(g/2===n&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),g+=c):g<n&&(g-=c),`translate(${h} ${g})`}),!u){const d=[s.axes,s.levels].map(h=>$s(h.node()).width);d.every(h=>h>0)&&e.cache.add(Ii,d[0]-d[1])}}},bindRadarEvent(){const e=this,{config:t,state:s,$el:{radar:i,svg:n}}=e,a=e.isPointFocusOnly(),{inputType:o,transiting:r}=s,l=o==="mouse",c=u=>{if(s.event=u,!t.interaction_onout)return;const d=e.getDataIndexFromEvent(u),h=nt(d);(l||h)&&(e.hideTooltip(),a?e.hideCircleFocus():e.unexpandCircles(),l?e.setOverOut(!1,d):h&&e.callOverOutForTouch())};i.axes.on(l?"mouseover ":"touchstart",u=>{if(r)return;s.event=u;const d=e.getDataIndexFromEvent(u);e.selectRectForSingle(n.node(),d),l?e.setOverOut(!0,d):e.callOverOutForTouch(d)},l?void 0:{passive:!0}).on("mouseout",l?c:null),l||n.on("touchstart",c,{passive:!0})},updateRadarShape(){const e=this,t=e.data.targets.filter(a=>e.isRadarType(a)),s=e.cache.get(oe),i=e.$el.radar.shapes.selectAll("polygon").data(e.filterNullish(t)),n=i.enter().append("g").attr("class",e.getChartClass("Radar"));e.$T(i.exit()).remove(),n.append("polygon").merge(i).style("fill",e.color).style("stroke",e.color).attr("points",a=>s[a.id].join(" ")),e.updateTargetForCircle(t,n)},radarCircleX(e){return this.cache.get(oe)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(oe)[e.id][e.index][1]}},Ot=Z(14);function ul(e,t){const s=this,{scale:{x:i,y:n},state:{width:a}}=s;e.selectAll("g").attr("transform",o=>`translate(${o===t?"0,0":`${i(o.x0)},${n(o.y0)}`})`).select("rect").attr("width",o=>o===t?a:i(o.x1)-i(o.x0)).attr("height",o=>o===t?0:n(o.y1)-n(o.y0))}function hl(e){const t=this;return e.map(s=>{const{id:i,values:n}=s,{value:a}=n[0];return{name:i,id:i,value:a,ratio:t.getRatio("treemap",n[0])}})}function gl(e){const t=this,s=(0,Ot.hierarchy)(e).sum(n=>n.value),i=t.getSortCompareFn(!0);return[t.treemap(i?s.sort(i):s)]}var fl={initTreemap(){const e=this,{$el:t,state:{current:{width:s,height:i},clip:n,datetimeId:a}}=e;n.id=`${a}-clip`,e.treemap=(0,Ot.treemap)().tile(e.getTreemapTile()),t.defs.append("clipPath").attr("id",n.id).append("rect").attr("width",s).attr("height",i),t.treemap=t.main.select(`.${D.chart}`).attr("clip-path",`url(#${n.id})`).append("g").classed(ls.chartTreemaps,!0),e.bindTreemapEvent()},bindTreemapEvent(){const e=this,{$el:t,config:s,state:i}=e,n=a=>{var o;const r=a.isTrusted?a.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return/^rect$/i.test(r.tagName)&&(i.event=a,l=(0,R.select)(r).datum()),l==null?void 0:l.data};if(s.interaction_enabled){const a=i.inputType==="touch";t.treemap.on(a?"touchstart":"mouseover mousemove",o=>{const r=n(o);r&&(e.showTooltip([r],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},a?{passive:!0}:void 0).on(a?"touchend":"mouseout",o=>{const r=n(o);s.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},getTreemapTile(){var e,t;const s=this,{config:i,state:{current:{width:n,height:a}}}=s,o=(t={binary:Ot.treemapBinary,dice:Ot.treemapDice,slice:Ot.treemapSlice,sliceDice:Ot.treemapSliceDice,squarify:Ot.treemapSquarify,resquarify:Ot.treemapResquarify}[(e=i.treemap_tile)!=null?e:"binary"])!=null?t:Ot.treemapBinary;return(r,l,c,u,d)=>{o(r,0,0,n,a);for(const h of r.children)h.x0=l+h.x0/n*(u-l),h.x1=l+h.x1/n*(u-l),h.y0=c+h.y0/a*(d-c),h.y1=c+h.y1/a*(d-c)}},getTreemapData(e){const t=this;return{name:"root",children:hl.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:s}}=t,i=gl.call(t,t.getTreemapData(e!=null?e:t.data.targets));s.data(t.filterNullish(i))},updateTreemap(e){const t=this,{$el:s,$T:i}=t,n=s.treemap.datum(),a=t.getChartClass("Treemap"),o=t.getClass("treemap",!0),r=s.treemap.selectAll("g").data(n.children);i(r.exit(),e).style("opacity","0").remove(),r.enter().append("g").append("rect"),s.treemap.selectAll("g").attr("class",a).select("rect").attr("class",o).attr("fill",l=>t.color(l.data.name))},generateGetTreemapPoints(){const e=this,{$el:t,scale:{x:s,y:i}}=e,n={};return t.treemap.selectAll("g").each(a=>{n[a.data.name]=[[s(a.x0),i(a.y0)],[s(a.x1),i(a.y1)]]}),a=>n[a.id]},redrawTreemap(e){const t=this,{$el:s,state:{current:{width:i,height:n}}}=t;return s.defs.select("rect").attr("width",i).attr("height",n),[t.$T(s.treemap,e,Ct()).call(ul.bind(t),s.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{$el:{treemap:s},config:i,scale:{x:n,y:a}}=t,{id:o,value:r}=e,l=i.treemap_label_format,c=t.getRatio("treemap",e),u=(c*100).toFixed(2),d=i.treemap_label_show&&Ze.call(t,c,"treemap")?null:"0",h=s.selectAll("g").filter(p=>p.data.id===o).datum();let g=0,f=0;if(h){const{x0:p,x1:_,y0:x,y1:m}=h;g=n(_)-n(p),f=a(m)-a(x)}return function(p){return p.style("opacity",d),k(l)?l.bind(t.api)(r,c,o,{width:g,height:f}):`${o}
|
|
34
|
+
${u}%`}}},Ut={point_show:!0,point_r:2.5,point_radialGradient:!1,point_sensitivity:10,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_focus_only:!1,point_opacity:void 0,point_pattern:[],point_select_r:void 0,point_type:"circle"},re={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},pl={bar_connectLine:!1,bar_front:!1,bar_indices_removeNull:!1,bar_label_threshold:0,bar_linearGradient:!1,bar_overlap:!1,bar_padding:0,bar_radius:void 0,bar_radius_ratio:void 0,bar_sensitivity:2,bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0},xl={bubble_maxR:35,bubble_zerobased:!1},_l={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"},ml={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0},yl={scatter_zerobased:!1},ts={spline_interpolation_type:"cardinal"},Pe={arc_cornerRadius:0,arc_cornerRadius_ratio:0,arc_needle_show:!1,arc_needle_color:void 0,arc_needle_value:void 0,arc_needle_path:void 0,arc_needle_length:100,arc_needle_top_rx:0,arc_needle_top_ry:0,arc_needle_top_width:0,arc_needle_bottom_rx:1,arc_needle_bottom_ry:1,arc_needle_bottom_width:15,arc_needle_bottom_len:0,arc_rangeText_values:void 0,arc_rangeText_unit:"absolute",arc_rangeText_fixed:!1,arc_rangeText_format:void 0,arc_rangeText_position:void 0},$l={donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_label_line:!1,donut_label_image:void 0,donut_label_ratio:void 0,donut_width:void 0,donut_title:"",donut_expand:{},donut_expand_rate:.98,donut_expand_duration:50,donut_padAngle:0,donut_startingAngle:0},bl={funnel_neck_width:0,funnel_neck_height:0},vl={gauge_background:"",gauge_fullCircle:!1,gauge_label_show:!0,gauge_label_extents:void 0,gauge_label_format:void 0,gauge_label_ratio:void 0,gauge_label_threshold:0,gauge_label_line:!1,gauge_label_image:void 0,gauge_enforceMinMax:!1,gauge_min:0,gauge_max:100,gauge_type:"single",gauge_startingAngle:-1*Math.PI/2,gauge_arcLength:100,gauge_title:"",gauge_units:void 0,gauge_width:void 0,gauge_arcs_minWidth:5,gauge_expand:{},gauge_expand_rate:.98,gauge_expand_duration:50},Tl={pie_label_show:!0,pie_label_format:void 0,pie_label_ratio:void 0,pie_label_threshold:.05,pie_label_line:!1,pie_label_image:void 0,pie_expand:{},pie_expand_rate:.98,pie_expand_duration:50,pie_innerRadius:0,pie_outerRadius:void 0,pie_padAngle:0,pie_padding:0,pie_startingAngle:0},Al={polar_label_show:!0,polar_label_format:void 0,polar_label_threshold:.05,polar_label_line:!1,polar_label_image:void 0,polar_label_ratio:void 0,polar_level_depth:3,polar_level_max:void 0,polar_level_show:!0,polar_level_text_backgroundColor:"#fff",polar_level_text_format:e=>e%1===0?e:e.toFixed(2),polar_level_text_show:!0,polar_padAngle:0,polar_padding:0,polar_startingAngle:0},wl={radar_axis_max:void 0,radar_axis_line_show:!0,radar_axis_text_show:!0,radar_axis_text_position:{},radar_level_depth:3,radar_level_show:!0,radar_level_text_format:e=>e%1===0?e:e.toFixed(2),radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1},Sl={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};function le(e,t){ut(Ht.prototype,Object.values(fi).concat(e)),ut(Bt.prototype,mr),jt.setOptions(Object.values(pi).concat(t||[]))}function It(e,t){le([ae,ke,al].concat(e||[])),jt.setOptions([Ut,ml].concat(t||[]))}function ce(e,t){ut(Ht.prototype,[Ir,ae].concat(e||[])),jt.setOptions([Ut].concat(t||[]))}let Di=()=>(It(ie,[re]),(Di=()=>L.AREA)()),zi=()=>(It(ie,[re]),(zi=()=>L.AREA_LINE_RANGE)()),Fi=()=>(It(ie,[re]),(Fi=()=>L.AREA_STEP_RANGE)()),Mi=()=>(It(ie,[re,ts]),(Mi=()=>L.AREA_SPLINE)()),Xi=()=>(It(ie,[re,ts]),(Xi=()=>L.AREA_SPLINE_RANGE)()),Bi=()=>(It(ie,[re]),(Bi=()=>L.AREA_STEP)()),Ni=()=>(It(),(Ni=()=>L.LINE)()),Gi=()=>(It(void 0,[ts]),(Gi=()=>L.SPLINE)()),Vi=()=>(It(),(Vi=()=>L.STEP)()),Yi=()=>(ce(void 0,[Pe,$l]),(Yi=()=>L.DONUT)()),ji=()=>(ce([Zr],[Pe,vl]),(ji=()=>L.GAUGE)()),Wi=()=>(ce(void 0,[Pe,Tl]),(Wi=()=>L.PIE)()),Hi=()=>(ce([ll],[Pe,Al]),(Hi=()=>L.POLAR)()),Ui=()=>(ce([fi.eventrect,ke,dl],[Ut,wl,{axis_x_categories:pi.optAxis.axis_x_categories}]),(Ui=()=>L.RADAR)()),Zi=()=>(le([Dr,ae],[pl,Ut]),(Zi=()=>L.BAR)()),qi=()=>(le([ae,ke,zr],[xl,Ut]),(qi=()=>L.BUBBLE)()),Ki=()=>(le([Nr,ae],[_l,Ut]),(Ki=()=>L.CANDLESTICK)()),Ji=()=>(le([ae,ke],[Ut,yl]),(Ji=()=>L.SCATTER)()),Qi=()=>(ce([Ur],[bl]),(Qi=()=>L.FUNNEL)()),tn=()=>(le([fl],[Sl]),(tn=()=>L.TREEMAP)()),es=Object.create(null);const en={version:"3.18.0",generate(e){const t=te(Object.create(null),es,e),s=new Bt(t);return s.internal.charts=this.instance,this.instance.push(s),s},defaults(e){return G(e)&&(es=e),es},instance:[],plugin:{}};Object.keys(mt).forEach(e=>mt[e]()),Object.keys(z).forEach(e=>z[e]())})(),Oe})()});
|