1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | (function(dt,Zt){if(typeof exports=="object"&&typeof module=="object")module.exports=Zt(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"],Zt);else{var ge=typeof exports=="object"?Zt(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")):Zt(dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3,dt.d3);for(var fe in ge)(typeof exports=="object"?exports:dt)[fe]=ge[fe]}})(this,function(Je,dt,Zt,ge,fe,zi,Fi,Mi,Xi,Bi,Ni,Gi,Vi){return function(){"use strict";var Yi=[,,function(I){I.exports=Xi},function(I){I.exports=Ni},function(I){I.exports=dt},function(I){I.exports=ge},function(I){I.exports=Zt},function(I){I.exports=Mi},function(I){I.exports=Gi},function(I){I.exports=Bi},function(I){I.exports=Vi},function(I){I.exports=Je},function(I){I.exports=fe},function(I){I.exports=Fi},function(I){I.exports=zi}],Qe={};function U(I){var xt=Qe[I];if(xt!==void 0)return xt.exports;var w=Qe[I]={exports:{}};return Yi[I](w,w.exports,U),w.exports}(function(){U.d=function(I,xt){for(var w in xt)U.o(xt,w)&&!U.o(I,w)&&Object.defineProperty(I,w,{enumerable:!0,get:xt[w]})}})(),function(){U.o=function(I,xt){return Object.prototype.hasOwnProperty.call(I,xt)}}(),function(){U.r=function(I){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})}}();var ke={};return function(){U.r(ke),U.d(ke,{bb:function(){return Ii},default:function(){return Ii}});var I={};U.r(I),U.d(I,{selection:function(){return Fs},subchart:function(){return Ms},zoom:function(){return Xs}});var xt={};U.r(xt),U.d(xt,{area:function(){return fi},areaLineRange:function(){return pi},areaSpline:function(){return _i},areaSplineRange:function(){return mi},areaStep:function(){return $i},areaStepRange:function(){return xi},bar:function(){return Ci},bubble:function(){return Ei},candlestick:function(){return ki},donut:function(){return Ti},funnel:function(){return Pi},gauge:function(){return Ai},line:function(){return yi},pie:function(){return wi},polar:function(){return Si},radar:function(){return Ri},scatter:function(){return Li},spline:function(){return bi},step:function(){return vi},treemap:function(){return Oi}});var w=U(2),pe=U(3),ji=Object.defineProperty,ts=Object.getOwnPropertySymbols,Hi=Object.prototype.hasOwnProperty,Wi=Object.prototype.propertyIsEnumerable,es=(e,t,s)=>t in e?ji(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Z=(e,t)=>{for(var s in t||(t={}))Hi.call(t,s)&&es(e,s,t[s]);if(ts)for(var s of ts(t))Wi.call(t,s)&&es(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_"},G={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",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"},xe={area:"bb-area",areas:"bb-areas"},at={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"},vt={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars"},Ct={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},ut={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Le={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Bt={dragarea:"bb-dragarea",INCLUDED:"_included_"},re={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"},Y={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"},Et={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},Tt={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},q={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},et={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"},It={level:"bb-level",levels:"bb-levels"},ss={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},le={region:"bb-region",regions:"bb-regions"},Q={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},st={shape:"bb-shape",shapes:"bb-shapes"},is={brush:"bb-brush",subchart:"bb-subchart"},gt={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",TextOverlapping:"text-overlapping"},_e={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},ns={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Pe={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var B=Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z({},D),G),xe),at),vt),Ct),ut),Le),Bt),_t),Y),Et),Tt),q),re),et),ss),le),Q),st),is),gt),_e),ns),Pe),Ui={boost_useCssRule:!1,boost_useWorker:!1},Zi={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},qi={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},Ki={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:[]},Ji={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},Qi={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},tn={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_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:""},en={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},me=U(4);function sn(){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 nn(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=sn(),ot=j==null?void 0:j.document,[an,Tr,as,Ar]=nn(j);var on=Object.defineProperty,os=Object.getOwnPropertySymbols,rn=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable,rs=(e,t,s)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ls=(e,t)=>{for(var s in t||(t={}))rn.call(t,s)&&rs(e,s,t[s]);if(os)for(var s of os(t))ln.call(t,s)&&rs(e,s,t[s]);return e};const M=e=>e||e===0,O=e=>typeof e=="function",V=e=>typeof e=="string",L=e=>typeof e=="number",it=e=>typeof e=="undefined",H=e=>typeof e!="undefined",Oe=e=>typeof e=="boolean",cn=e=>Math.ceil(e/10)*10,$e=e=>Math.ceil(e)+.5,Nt=e=>e[1]-e[0],St=e=>typeof e=="object",At=e=>it(e)||e===null||V(e)&&e.length===0||St(e)&&!(e instanceof Date)&&Object.keys(e).length===0||L(e)&&isNaN(e),nt=e=>!At(e),N=e=>Array.isArray(e),X=e=>e&&!(e!=null&&e.nodeType)&&St(e)&&!N(e);function Dt(e,t,s){return H(e[t])?e[t]:s}function dn(e,t){let s=!1;return Object.keys(e).forEach(i=>e[i]===t&&(s=!0)),s}function K(e,t,...s){const i=O(e);return i&&e.call(t,...s),i}function ye(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 Ie(e){return V(e)?e.replace(/<(script|img)?/ig,"<").replace(/(script)?>/ig,">"):e}function ce(e,t,s=[-1,1],i=!1){if(!(!e||!V(t)))if(t.indexOf(`
|
10 | `)===-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 cs(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 ds(e){const{width:t,height:s}=e.getBoundingClientRect(),i=cs(e),n=i[0].x,a=Math.min(i[0].y,i[1].y);return{x:n,y:a,width:t,height:s}}function yt(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,w.pointer)(i||e,t)}catch(a){}return n.map(a=>isNaN(a)?0:a)}function us(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,me.brushSelection)(n)),n}function be(e){return!("rect"in e)||"rect"in e&&e.hasAttribute("width")&&e.rect.width!==+e.getAttribute("width")?e.rect=e.getBoundingClientRect():e.rect}function kt(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 De(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?De(e,t,s,a-1,n):De(e,t,a+1,i,n)}function hs(e){const t=us(e);return t?t[0]===t[1]:!0}function un(...e){const t=s=>{if(X(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)=>ls(ls({},s),i))}function rt(e={},t){N(t)&&t.forEach(s=>rt(e,s));for(const s in t)/^\d+$/.test(s)||s in e||(e[s]=t[s]);return e}const ft=e=>e.charAt(0).toUpperCase()+e.slice(1);function hn(e,t="-"){return e.split(t).map((s,i)=>i?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():s.toLowerCase()).join("")}const Gt=e=>[].slice.call(e);function gn(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 fn(e){let t=[];return e.forEach(s=>{var i;try{s.cssRules&&s.cssRules.length&&(t=t.concat(Gt(s.cssRules)))}catch(n){(i=j.console)==null||i.warn(`Error while reading rules from ${s.href}: ${n.toString()}`)}}),t}function gs(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 ve(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=e.getBoundingClientRect();o.x-=r.x,o.y-=r.y}return o}function fs(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 ze(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 Fe(e){return e&&e.length?e.reduce((t,s)=>t.concat(s)):[]}function qt(e,...t){if(!t.length||t.length===1&&!t[0])return e;const s=t.shift();return X(e)&&X(s)&&Object.keys(s).forEach(i=>{const n=s[i];X(n)?(!e[i]&&(e[i]={}),e[i]=qt(e[i],n)):e[i]=N(n)?n.concat():n}),qt(e,...t)}function Kt(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 wt(e,t){let s=t.filter(i=>nt(i));return s.length?L(s[0])?s=Math[e](...s):s[0]instanceof Date&&(s=Kt(s,e==="min")[0]):s=void 0,s}const Te=(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},pn={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=ot.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(qt({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 Ae(e,t){let s=e;for(const i in t)s=s.replace(new RegExp(`{=${i}}`,"g"),t[i]);return s}function mt(e){var t;let s;if(e instanceof Date)s=e;else if(V(e)){const{config:i,format:n}=this;s=(t=n.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else L(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 Me(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function xn(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 de(){var e,t;return((e=ot)==null?void 0:e.hidden)===!1||((t=ot)==null?void 0:t.visibilityState)==="visible"}function _n(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&&ot 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 ps(e,t){t()===!1?an(()=>ps(e,t)):e()}var mn=Object.defineProperty,xs=Object.getOwnPropertySymbols,$n=Object.prototype.hasOwnProperty,yn=Object.prototype.propertyIsEnumerable,Xe=(e,t,s)=>t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,_s=(e,t)=>{for(var s in t||(t={}))$n.call(t,s)&&Xe(e,s,t[s]);if(xs)for(var s of xs(t))yn.call(t,s)&&Xe(e,s,t[s]);return e},bn=(e,t,s)=>Xe(e,typeof t!="symbol"?t+"":t,s);const ms=class Di{static setOptions(t){this.data=t.reduce((s,i)=>_s(_s({},s),i),this.data)}constructor(){return un(Ki,Ui,tn,Zi,en,qi,Ji,Qi,Di.data)}};bn(ms,"data",{});let Vt=ms;class vn{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 Tn{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},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 $s={element:vn,state:Tn};class An{constructor(){Object.keys($s).forEach(t=>{this[t]=new $s[t]})}getStore(t){return this[t]}}var wn=Object.defineProperty,Sn=(e,t,s)=>t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Rn=(e,t,s)=>Sn(e,typeof t!="symbol"?t+"":t,s);const pt={bubbleBaseLength:"$baseLength",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",legendItemTextBox:"legendItemTextBox",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect"};class Cn{constructor(){Rn(this,"cache",{})}add(t,s,i=!1){return this.cache[t]=i?this.cloneTarget(s):s,this.cache[t]}remove(t){(V(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 E={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"},Be={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"},zt={Area:[E.AREA,E.AREA_SPLINE,E.AREA_SPLINE_RANGE,E.AREA_LINE_RANGE,E.AREA_STEP,E.AREA_STEP_RANGE],AreaRange:[E.AREA_SPLINE_RANGE,E.AREA_LINE_RANGE,E.AREA_STEP_RANGE],Arc:[E.PIE,E.DONUT,E.GAUGE,E.POLAR,E.RADAR],Line:[E.LINE,E.SPLINE,E.AREA,E.AREA_SPLINE,E.AREA_SPLINE_RANGE,E.AREA_LINE_RANGE,E.STEP,E.AREA_STEP,E.AREA_STEP_RANGE],Step:[E.STEP,E.AREA_STEP,E.AREA_STEP_RANGE],Spline:[E.SPLINE,E.AREA_SPLINE,E.AREA_SPLINE_RANGE]};function En(e){const t=e,{config:s}=t;let i="";if(At(s.data_type||s.data_types)&&!t[Be.LINE])i="line";else for(const n in Be){const a=E[n];if(t.hasType(a)&&!t[Be[n]]){i=a;break}}i&&kn(`Please, make sure if %c${hn(i)}`,"module has been imported and specified correctly.","https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality")}function kn(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:Ln,clearTimeout:Pn}=j;function On(e){const t=[];let s;const i=function(){i.clear(),e===!1?as(()=>{t.forEach(n=>n())},{timeout:200}):s=Ln(()=>{t.forEach(n=>n())},L(e)?e:200)};return i.clear=()=>{s&&(Pn(s),s=null)},i.add=n=>t.push(n),i.remove=n=>t.splice(t.indexOf(n),1),i}function ys(){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(de()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}ps(()=>{i==null||i()},n)};return t.add=function(s){N(s)?e=e.concat(s):e.push(s)},t}const Ne={};function In(e,t){var s;const i=e.toString(),n=i.replace(/(function|[\s\W\n])/g,"").substring(0,15);return n in Ne||(Ne[n]=new j.Blob([`${(s=t==null?void 0:t.map(String).join(";"))!=null?s:""}
|
12 |
|
13 | self.onmessage=function({data}) {
|
14 | const result = (${i}).apply(null, data);
|
15 | self.postMessage(result);
|
16 | };`],{type:"text/javascript"})),j.URL.createObjectURL(Ne[n])}function Dn(e){const t=new j.Worker(e);return t.onerror=function(s){console.error?console.error(s):console.log(s)},t}function Ge(e=!0,t,s,i){let n=function(...a){const o=t(...a);s(o)};if(j.Worker&&e){const a=In(t,i),o=Dn(a);n=function(...r){o.postMessage(r),o.onmessage=function(l){return j.URL.revokeObjectURL(a),s(l.data)}}}return n}var we=U(5);function Ve(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 Ye(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 bs(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=Ye(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=Ve(s);return n}function zn(e,t="csv",s,i,n){const a=new XMLHttpRequest,o={csv:Fn,tsv:Mn,json:bs};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 vs(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 Fn(e){return vs({rows:we.csvParseRows,parse:we.csvParse},e)}function Mn(e){return vs({rows:we.tsvParseRows,parse:we.tsvParse},e)}function Ts(e,t){const s=e||(t==null?void 0:t.data_keys);return s!=null&&s.x&&(t.data_x=s.x),s}var Xn={convertData(e,t){const{config:s}=this,i=s.boost_useWorker;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)zn(n.url,n.mimeType,n.headers,Ts(n.keys,s),t);else if(n.json)Ge(i,bs,t,[Ve,Ye])(n.json,Ts(n.keys,s));else if(n.rows)Ge(i,Ye,t)(n.rows);else if(n.columns)Ge(i,Ve,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;let r=!1,l=!1,c=!1;i&&(r=i.isCategorized(),l=i.isTimeSeries(),c=i.isCustomX());const u=Object.keys(e[0]||{}),d=u.length?u.filter(s.isNotX,s):[],h=u.length?u.filter(s.isX,s):[];let g;d.forEach(p=>{const _=this.getXKey(p);c||l?h.indexOf(_)>=0?g=(t&&s.data.xs[p]||[]).concat(e.map(x=>x[_]).filter(M).map((x,m)=>s.generateTargetX(x,p,m))):n.data_x?g=this.getOtherTargetXs():nt(n.data_xs)&&(g=s.getXValuesOfXKey(_,s.data.targets)):g=e.map((x,m)=>m),g&&(this.data.xs[p]=g)}),d.forEach(p=>{if(!this.data.xs[p])throw new Error(`x is not defined for id = "${p}".`)});const f=d.map((p,_)=>{const x=n.data_idConverter.bind(s.api)(p),m=s.getXKey(p),$=c&&r,b=$&&e.map(A=>A.x).every(A=>n.axis_x_categories.indexOf(A)>-1),v=e.__append__,y=m===null&&v?s.api.data.values(p).length:0;return{id:x,id_org:p,values:e.map((A,S)=>{const R=A[m];let T=A[p],C;return T=T!==null&&!isNaN(T)&&!X(T)?+T:N(T)||X(T)?T:null,($||a.hasRadar)&&_===0&&!it(R)?(!b&&_===0&&S===0&&!v&&(n.axis_x_categories=[]),C=n.axis_x_categories.indexOf(R),C===-1&&(C=n.axis_x_categories.length,n.axis_x_categories.push(R))):C=s.generateTargetX(R,p,y+S),(it(T)||s.data.xs[p].length<=S)&&(C=void 0),{x:C,value:T,id:x,index:-1}}).filter(A=>H(A.x))}});if(f.forEach(p=>{var _;n.data_xSort&&(p.values=p.values.sort((x,m)=>{const $=x.x||x.x===0?x.x:1/0,b=m.x||m.x===0?m.x:1/0;return $-b})),p.values.forEach((x,m)=>x.index=m),(_=s.data.xs[p.id])==null||_.sort((x,m)=>x-m)}),a.hasNegativeValue=s.hasNegativeValueInTargets(f),a.hasPositiveValue=s.hasPositiveValueInTargets(f),o&&s.isValidChartType(o)){const p=s.mapToIds(f).filter(_=>!(_ in n.data_types)||!s.isValidChartType(n.data_types[_]));s.setTargetType(p,o)}return f.forEach(p=>s.cache.add(p.id_org,p,!0)),f}},Bn={isX(e){const t=this,{config:s}=t,i=s.data_x&&e===s.data_x,n=nt(s.data_xs)&&dn(s.data_xs,e);return i||n},isNotX(e){return!this.isX(e)},isStackNormalized(){const{config:e}=this;return!!(e.data_stack_normalize&&e.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},getXKey(e){const t=this,{config:s}=t;return s.data_x?s.data_x:nt(s.data_xs)?s.data_xs[e]:null},getXValuesOfXKey(e,t){const s=this,i=t&&nt(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(V(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&&(nt(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=mt.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(L);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=pt.dataMinMax;let s=e.cache.get(t);if(!s){const i=e.data.targets.map(r=>r.values),n=e.getMinMaxValue(i);let a=[],o=[];i.forEach(r=>{const l=e.getFilteredDataByValue(r,n.min),c=e.getFilteredDataByValue(r,n.max);l.length&&(a=a.concat(l)),c.length&&(o=o.concat(c))}),e.cache.add(t,s={min:a,max:o})}return s},getTotalPerIndex(){const e=this,t=pt.dataTotalPerIndex;let s=e.cache.get(t);return(e.config.data_groups.length||e.isStackNormalized())&&!s&&(s=[],e.data.targets.forEach(i=>{i.values.forEach((n,a)=>{s[a]||(s[a]=0),s[a]+=L(n.value)?n.value:0})})),s},getTotalDataSum(e){const t=this,s=pt.dataTotalSum;let i=t.cache.get(s);if(!L(i)){const n=Fe(t.data.targets.map(a=>a.values)).map(a=>a.value);i=n.length?n.reduce((a,o)=>a+o):0,t.cache.add(s,i)}return 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=Kt(ze(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?N(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=ze(Fe(e.map(n=>n.values.map(a=>+a.x)))),i=s!=null&&s.isTimeSeries()?i.map(n=>new Date(+n)):i.map(Number)),Kt(i)},addTargetIds(e,t){const{state:s}=this;(N(t)?t:[t]).forEach(n=>{s[e].indexOf(n)<0&&s[e].push(n)})},removeTargetIds(e,t){const{state:s}=this;(N(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=>V(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=N(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),N(c)?r.push(...c):X(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){const s=Object.keys(e);let i;for(let n=0;n<s.length;n++){i=e[s[n]].values;for(let a=0;a<i.length;a++)if(t(i[a].value))return!0}return!1},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=>L(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 O(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return Fe(e.map(s=>s.values)).filter(s=>s.x-t===0)},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 Oe(e)&&e||St(e)&&nt(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,w.select)(c).datum();l=u&&Object.keys(u).length===1?u.index:void 0}else{const c=i.axis_rotated,u=gs(s.chart.node()),d=a==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?d.clientY+u.y:d.clientX+u.x;if(Me(s.svg)){const g=[h,0];c&&g.reverse(),h=ve(s.svg.node(),...g)[c?"y":"x"]}else h-=c?r.top:r.left;l=De(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,s){const i=this,n=[0,0],a=1.3;return i.$el.chart.select("svg").selectAll(".dummy").data([e,t]).enter().append("text").text(o=>i.dataLabelFormat(o.id)(o)).each(function(o,r){n[r]=this.getBoundingClientRect()[s]*a}).remove(),n},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)?`.${vt.chartBar}.${D.target}${s.getTargetSelectorSuffix(r.id)} .${vt.bar}-${r.index}`:`.${Ct.chartCandlestick}.${D.target}${s.getTargetSelectorSuffix(r.id)} .${Ct.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=N(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=N(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 it(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(N(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);let c=this.getTotalPerIndex();if(a.hiddenTargetIds.length){let d=l(a.hiddenTargetIds,!1);d.length&&(d=d.reduce((h,g)=>h.map((f,p)=>(L(f)?f:0)+g[p])),c=c.map((h,g)=>h-d[g]))}const u=c[t.index];t.ratio=L(t.value)&&c&&u?t.value/u: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)&&(X(e.value)&&("z"in e.value||"y"in e.value)||N(e.value)&&e.value.length>=2)},isBarRangeType(e){const t=this,{value:s}=e;return t.isBarType(e)&&N(s)&&s.length>=2&&s.every(i=>L(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 As(e,t=!1){const s=this,{api:i}=s;t&&s.api.flush(!0),e==null||e.call(i)}var Nn={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(),As.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(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}const u=a.svg.selectAll(c.map(d=>i.selectorTarget(d)));o(u).style("opacity","0").remove().call(ye,l),c.forEach(d=>{var h;const g=i.getTargetSelectorSuffix(d);n.withoutFadeIn[d]=!1,a.legend&&a.legend.selectAll(`.${Y.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()}},ws=U(6),Gn={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=X(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} .${st.shape}`:G.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(`.${st.shape}-${t}`).each(function(u){c(u,this)});else{const u=s.cache.get(pt.setOverOut)||[],d=r.selectAll(`.${st.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,w.select)(g).datum(),g)}h.each(function(){e&&(c((0,w.select)(this).datum(),this),u.push(this))}),s.cache.add(pt.setOverOut,u)}}},callOverOutForTouch(e){const t=this,s=t.cache.get(pt.callOverOutForTouch);(X(e)&&s?e.id!==s.id:e!==s)&&((s||L(s))&&t.setOverOut(!1,s),(e||L(e))&&t.setOverOut(!0,e),t.cache.add(pt.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:s}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,ws.drag)().on("drag",function(i){s.event=i,e.drag(yt(i,this))}).on("start",function(i){s.event=i,e.dragstart(yt(i,this))}).on("end",i=>{s.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,s){var i,n;const a=this,{config:o,state:{eventReceiver:r,hasAxis:l,hasFunnel:c,hasRadar:u,hasTreemap:d},$el:{eventRect:h,funnel:g,radar:f,svg:p,treemap:_}}=a;let x=(n=(c||d)&&r.rect||u&&f.axes.select(`.${at.axis}-${t} text`)||h||((i=a.getArcElementByIdOrIndex)==null?void 0:i.call(a,t)))==null?void 0:n.node();if(x){const m=a.isMultipleX(),$=o.axis_rotated;let{width:b,left:v,top:y}=x.getBoundingClientRect();if(l&&!u&&!m){const T=r.coords[t];T?(b=T.w,v+=T.x,y+=T.y):(b=0,v=0,y=0)}let A=v+(s?s[0]:0)+(m||$?0:b/2),S=y+(s?s[1]:0)+($?4:0);if(Me(p)){const T=ve(a.$el.svg.node(),A,S,!1);A=T.x,S=T.y}const R={screenX:A,screenY:S,clientX:A,clientY:S,bubbles:u};(c||d)&&(x=(g!=null?g:_).node()),pn[/^(mouse|click)/.test(e)?"mouse":"touch"](x,e,R)}},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)}},Vn={categoryName(e){var t;const{axis_x_categories:s}=this.config;return(t=s==null?void 0:s[e])!=null?t:e}},Yn={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(B[s?"shapes":"shape"],o[n]):"")+this.generateClass(B[e],o[i?"id":n])).trim()}},getChartClass(e){return t=>B[`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(B.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let s="";return t&&(s=` ${B.target}-${t}`),this.generateClass(B.target,e)+s},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.indexOf(e.id)>=0?B.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.indexOf(e.id)>=0?B.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}.${B.target+i} ${s}, ${t}.${B.circles+i} ${s}`},selectorTargets(e,t){const s=e||[];return s.length?s.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${B.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}},Ft=U(7);const jn=(e,t,s)=>{const i=(0,w.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 Hn(e){const t=pt.colorPattern,{body:s}=ot;let i=s[t];if(!i){const n=";",a=e.classed(Le.colorPattern,!0).style("background-image");e.classed(Le.colorPattern,!1),a.indexOf(n)>-1&&(i=a.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(n).map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),s[t]=i)}return i}const Wn=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var Un={generateColor(){const e=this,{$el:t,config:s}=e,i=s.data_colors,n=s.data_color,a=[];let o=nt(s.color_pattern)?s.color_pattern:(0,Ft.scaleOrdinal)(Hn(t.chart)||Wn).range();const r=o;if(O(s.color_tiles)){const l=s.color_tiles.bind(e.api)(),c=o.map((u,d)=>{const h=u.replace(/[#\(\)\s,]/g,""),g=`${e.state.datetimeId}-pattern-${h}-${d}`;return jn(l[d%l.length],u,g)});o=c.map(u=>`url(#${u.id})`),e.patterns=c}return function(l){var c;const u=l.id||((c=l.data)==null?void 0:c.id)||l,d=e.isTypeOf(u,["line","spline","step"])||!s.data_types[u];let h;return O(i[u])?h=i[u].bind(e.api)(l):i[u]?h=i[u]:(a.indexOf(u)<0&&a.push(u),h=d?r[a.indexOf(u)%r.length]:o[a.indexOf(u)%o.length],i[u]=h),O(n)?n.bind(e.api)(h,l):h}},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 nt(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:i,state:n}=s;if(e){let a=[];V(e)?a.push(""):X(e)&&(a=Object.keys(e)),a.forEach(o=>{const r=`${n.datetimeId}-labels-bg${s.getTargetSelectorSuffix(o)}${V(e)?s.getTargetSelectorSuffix(e):""}`;i.defs.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="${o===""?e:e[o]}" />
|
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=O(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;X(o)?o=({id:r})=>r in a?a[r]:s.color(r):V(o)?o=()=>a:O(a)&&(o=o.bind(s.api)),n.selectAll(X(t)?`.${G.arc}${s.getTargetSelectorSuffix(t.id)}`:`.${st.shape}-${t}`).style("fill",o)}},Zn={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=+_,$=a?m>0:m<0;p===g&&!(c&&$)&&(l[h][x]+=m)})}})}})}return wt(t,Object.keys(l).map(c=>wt(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())return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(T=>n.getId(T.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"),$=[E.BAR,E.BUBBLE,E.SCATTER,...zt.Line].some(T=>{const C=T.indexOf("area")>-1?"area":T;return i.hasType(T,u,!0)&&a[`${C}_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 b=x>=0&&m>=0,v=x<=0&&m<=0;(M(d)&&b||M(h)&&v)&&($=!1),$&&(b&&(x=0),v&&(m=0));const y=Math.abs(m-x);let A={top:y*.1,bottom:y*.1};if(H(g)){const T=Math.max(Math.abs(x),Math.abs(m));m=g+T,x=g-T}if(p){const T=Nt(o.y.range()),C=i.getDataLabelLength(x,m,"width").map(z=>z/T);["bottom","top"].forEach((z,P)=>{A[z]+=y*(C[P]/(1-C[0]-C[1]))})}else if(_){const T=i.getDataLabelLength(x,m,"height");["bottom","top"].forEach((C,z)=>{A[C]+=i.convertPixelToScale("y",T[z],y)})}A=i.getResettedPadding(A);const S=a[`${r}_padding`];nt(S)&&["bottom","top"].forEach(T=>{A[T]=n.getPadding(S,T,A[T],y)}),$&&(b&&(A.bottom=x),v&&(A.top=-m));const R=l?[x,m].map(T=>T<0?0:T):[x-A.bottom,m+A.top];return f?R.reverse():R},getXDomainMinMax(e,t){var s;const i=this,n=i.config[`axis_x_${t}`],a=wt(t,e.map(r=>wt(t,r.values.map(l=>l.x))));let o=X(n)?n.value:n;return o=H(o)&&((s=i.axis)!=null&&s.isTimeSeries())?mt.bind(this)(o):o,X(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=Nt(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}=L(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||Kt(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||hs(o)?l.xDomain:us(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=wt("min",[o,i.zoom_x_min])),H(i.zoom_x_max)&&(r=wt("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 Ss(e,t,s){const{config:i}=e,n=`axis_${t}_tick_format`;return(i[n]?i[n]:e.defaultValueFormat).call(e.api,s)}var qn={yFormat(e){return Ss(this,"y",e)},y2Format(e){return Ss(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 N(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=>{const o="~";let r=a;return N(a)?r=a.join(o):X(a)&&(r=Object.values(a).join(o)),r};let n=i;return O(s.format)?n=s.format:St(s.format)&&(s.format[e]?n=s.format[e]===!0?i:s.format[e]:n=()=>""),n.bind(t.api)}};function Se(e){const t=this,s=t.getDataById(e);return t.levelColor?t.levelColor(s.values[0].value):t.color(s)}function je(e,t=!0){var s;const{config:i}=this;let n=(s=i.data_names[e])!=null?s:e;return t&&O(i.legend_format)&&(n=i.legend_format(n,e!==n?e:void 0)),n}var Kn={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(Y.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=Dt(c,"withTransition",!0),c.withTransitionForTransform=Dt(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(`.${Y.legendItem}`).classed(Y.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,w.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=O(n)?n.bind(e.api)(c,e.color(c),e.api.data(c)[0].values):Ae(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(`.${Y.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(Y.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const s=this,{$el:{legend:i},$T:n}=s,a=s.mapToTargetIds(e);i&&n(i.selectAll(`.${Y.legendItem}`).filter(o=>a.indexOf(o)>=0).classed(q.legendItemFocused,t)).style("opacity",function(){return t?null:s.opacityForUnfocusedLegend.call(s,(0,w.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:s}=e;t&&s(t.selectAll(`.${Y.legendItem}`).classed(q.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&&At(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=pt.legendItemTextBox;return e&&(a=!n.redrawing&&i.get(o)||{},a[e]||(a[e]=s.getTextRect(t,Y.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,w.select)(this);return(!d.empty()&&d.attr("class")||"")+t.generateClass(Y.legendItem,u)}).style("visibility",u=>t.isLegendToShow(u)?null:"hidden"),n.interaction_enabled&&(l&&[[`.${Y.legendItem}`,"cursor:pointer"],[`.${Y.legendItem} text`,"pointer-events:none"],[`.${Y.legendItemPoint} text`,"pointer-events:none"],[`.${Y.legendItemTile}`,"pointer-events:none"],[`.${Y.legendItemEvent}`,"fill-opacity:0"]].forEach(u=>{const[d,h]=u;t.setCssRule(!1,d,[h])(s.legend)}),e.on(c.dblclick?"dblclick":"click",c||O(n.legend_item_onclick)?function(u,d){if(!K(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(Y.legendItemHidden)===-1?i.show():(i.hide(),i.show(d)):(i.toggle(d),(0,w.select)(this).classed(q.legendItemFocused,!1))}o&&t.hideTooltip()}:null),!o&&e.on("mouseout",c||O(n.legend_item_onout)?function(u,d){K(n.legend_item_onout,i,d,!a.hiddenTargetIds.includes(d))||((0,w.select)(this).classed(q.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${_t.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||O(n.legend_item_onover)?function(u,d){K(n.legend_item_onover,i,d,!a.hiddenTargetIds.includes(d))||((0,w.select)(this).classed(q.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(y=>!H(i.data_names[y])||i.data_names[y]!==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=y=>d.max.width*h.steps[y],f=y=>h.margins[h.steps[y]]+h.offsets[y]):n.isLegendInset?(g=y=>d.max.width*h.steps[y]+10,f=y=>h.margins[h.steps[y]]+h.offsets[y]):(g=y=>h.margins[h.steps[y]]+h.offsets[y],f=y=>d.max.height*h.steps[y]);const $={xText:(y,A)=>g(y,A)+4+u.width,xRect:(y,A)=>g(y,A),x1Tile:(y,A)=>g(y,A)-2,x2Tile:(y,A)=>g(y,A)-2+u.width,yText:(y,A)=>f(y,A)+9,yRect:(y,A)=>f(y,A)-5,yTile:(y,A)=>f(y,A)+4};s.generateLegendItem(_,u,m,$),p=a.select(`.${Y.legendBackground} rect`),n.isLegendInset&&d.max.width>0&&p.size()===0&&(p=a.insert("g",`.${Y.legendItem}`).attr("class",Y.legendBackground).append("rect")),i.legend_tooltip&&a.selectAll("title").data(_).text(y=>je.bind(s)(y,!1));const b=a.selectAll("text").data(_).text(y=>je.bind(s)(y)).each(function(y,A){m(this,y,A)});o(b,x).attr("x",$.xText).attr("y",$.yText);const v=a.selectAll(`rect.${Y.legendItemEvent}`).data(_);o(v,x).attr("width",y=>h.widths[y]).attr("height",y=>h.heights[y]).attr("x",$.xRect).attr("y",$.yRect),s.updateLegendItemPos(_,x,$),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(b,v){v||(x=(_-t.totalLength-p)/2,x<t.posMin&&(x=(_-p)/2,t.totalLength=0,t.step++)),s.steps[b]=t.step,s.margins[t.step]=a.isLegendInset?10:x,s.offsets[b]=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 $=o?t.max.height:t.max.width;n.legend_equally?(Object.keys(s.widths).forEach(b=>s.widths[b]=t.max.width),Object.keys(s.heights).forEach(b=>s.heights[b]=t.max.height),x=(_-$*e.length)/2,x<t.posMin?(t.totalLength=0,t.step=0,e.forEach(b=>m(b))):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(`.${Y.legendItem}`).data(e).enter().append("g");if(n.setLegendItem(f),a.legend_tooltip&&f.append("title").text(p=>p),f.append("text").text(p=>je.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",Y.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=nt(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"),ot.createElementNS(w.namespaces.svg,"hasValidPointType"in n&&n.hasValidPointType(m)?m:"use")}).attr("class",Y.legendItemPoint).style("fill",Se.bind(n)).style("pointer-events",n.getStylePropValue("none")).attr("href",(_,x,m)=>{const b=m[x].nodeName.toLowerCase(),v=n.getTargetSelectorSuffix(_);return b==="use"?`#${o.datetimeId}-point${v}`:void 0})}else f.append(d?"line":u).attr("class",Y.legendItemTile).style("stroke",Se.bind(n)).style("pointer-events",n.getStylePropValue("none")).call(p=>{u==="circle"?p.attr("r",c).style("fill",Se.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(`.${Y.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,$=null;if(d==="circle"){const b=h*.2;g="cx",f="cy",x=h+b,p=h*2,_=-b}else if(d==="rect"){const b=h*2.5;m=b,$=b,_=3}(0,w.select)(this).attr(g,b=>s.x1Tile(b)+p).attr(f,b=>s.yTile(b)-_).attr("r",x).attr("width",m).attr("height",$)})}else{const u=a.selectAll(`.${Y.legendItemTile}`).data(e);o(u,t).style("stroke",Se.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)})}}},Jn=U(8),Qn={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.${gt.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($=>{const b=ft($);(/^(line|area)$/.test($)&&a.hasTypeOf(b)||a.hasType($))&&a[`update${b}`](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)&&de(),u=n.getRedrawList(r,t,l,c),d=()=>{l&&l(),o.redrawing=!1,K(a.onrendered,n.api)};if(d)if(c&&u.length){const h=ys();(0,Jn.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 _=ft(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)&&nt(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=Dt(e,"withTransition",!0),e.withTransform=Dt(e,"withTransform",!1),e.withLegend=Dt(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=Dt(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 Yt(e="linear",t,s){const i={linear:Ft.scaleLinear,log:Ft.scaleSymlog,_log:Ft.scaleLog,time:Ft.scaleTime,utc:Ft.scaleUtc}[e]();return i.type=e,/_?log/.test(e)&&i.clamp(!0),i.range([t!=null?t:0,s!=null?s:1])}var ta={getXScale(e,t,s,i){const n=this,a=n.state.loading!=="append"&&n.scale.zoom||Yt(n.axis.getAxisType("x"),e,t);return n.getCustomizedXScale(s?a.domain(s):a,i)},getYScale(e,t,s,i){const a=Yt(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),$={x:x?m:0,y:x?0:h,subX:x?1:0,subY:x?0:f},b={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()),y=t&&l.xDomain;c.x=n.getXScale($.x,b.x,v,()=>a.x.tickOffset()),c.subX=n.getXScale($.x,b.x,y,A=>{var S;return A%1?0:((S=a.subX)!=null?S: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,b.y,c.y?c.y.domain():o.axis_y_default),c.subY=n.getYScale("y",$.subY,b.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,b.y,c.y2?c.y2.domain():o.axis_y2_default),c.subY2=n.getYScale("y2",$.subY,b.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,Ft.scaleLinear)().rangeRound([x.left,u.width-x.right]),c.y=(0,Ft.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=mt.call(t,r):s.isCategorized()&&V(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}},ea={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${ft(e)}`;let s=this.$el.chart.node(),i=0;for(;i<30&&s&&s.tagName!=="BODY";){try{i=s.getBoundingClientRect()[e]}catch(a){t in s&&(i=s[t])}s=s.parentNode}const n=ot.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?at.axisX:at.axisY,l=n.main.select(`.${r}`).node(),c=i&&s[`axis_${a?"x":"y"}_label`];let u=0;if(i&&(V(c)||V(c.text)||/^inner-/.test(c==null?void 0:c.position))){const p=n.main.select(`.${r}-label`);p.empty()||(u=p.node().getBoundingClientRect().left)}const d=l&&o?l.getBoundingClientRect():{right:0},h=n.chart.node().getBoundingClientRect().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(`.${is.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=L(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&&(_=cn(_));let $=r&&h&&(g||it(u)&&!f)?0:c?(f?_:0)+(u!=null?u:0):it(u)?_:u;return h&&r?(d&&(c||g)&&a[`axis_${d}_label`].text&&($+=n.axis.getAxisLabelPosition(d).isOuter?x:0),e==="right"?($+=l?!c&&it(u)?10:2:!f||g?c?2:1:0,$+=s?n.axis.getXAxisTickTextY2Overflow(x):0):e==="left"&&l&&it(u)&&($=a.axis_x_show?c?_:Math.max(_,40):1)):e==="top"?(o.title&&o.title.node()&&($+=n.getTitlePadding()),m=l&&!g?p:0):e==="bottom"&&r&&l&&!f&&($+=1),$+_*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=L(e);let n=i?0:{};return s.padding===!1?!i&&Object.keys(e).forEach(a=>{n[a]=!At(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,$=o.getCurrentPadding(!0);if(l.margin=!d&&u?{top:$.top,right:d?0:$.right+f.right,bottom:f.bottom+$.bottom,left:x+(d?0:$.left)}:{top:(h?0:4)+$.top,right:d?0:$.right+f.right,bottom:m+x+f.bottom+$.bottom,left:d?0:$.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 b=o.hasType("gauge"),v=r.legend_show&&l.isLegendRight,y=(i=l.hasRadar&&o.cache.get(pt.radarTextWidth))!=null?i:0;l.arcWidth=l.width-(v?g.width+10:0)-y,l.arcHeight=l.height-(v&&!b?0:10),(n=r.arc_rangeText_values)!=null&&n.length&&(b?(l.arcWidth-=25,l.arcHeight-=10,l.margin.left+=10):(l.arcHeight-=20,l.margin.top+=10)),b&&!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)}},sa={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?`.${st.shapes+n.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[d]),n.state.cssRule[d]=gn(r,d,s.filter(Boolean).map(h=>V(u)&&h.indexOf(":")===-1?`${h}: ${u}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:O(e)?e.bind(this):e}};function ia(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function na(e,t,s,i,n){var a;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=L(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 Rs(e,t){var s;const i=this.config.data_labels_position,{id:n,index:a,value:o}=e;return(s=O(i)?i.bind(this.api)(t,o,n,a,this.$el.text):(n in i?i[n]:i)[t])!=null?s:0}var aa={opacityForText(e){const t=this;return t.isBarType(e)&&!t.meetsLabelThreshold(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",gt.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(`.${gt.chartTexts}`).selectAll(`.${gt.chartText}`).data(e).attr("class",r=>`${s(r)}${n(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",s).call(t.setCssRule(!0,` .${gt.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(`.${gt.texts}`).selectAll(`.${gt.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,w.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),L(h)?this.textContent=h:ce(d,h)})},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(V(i))a=i;else if(X(i)){const{id:o}=e.data||e;a=i[o]}else O(i)&&(a=i.bind(t.api)(n,e));if(t.isCandlestickType(e)&&!O(i)){const o=t.getCandlestickData(e);if(!(o!=null&&o._isUp)){const r=s.candlestick_color_down;a=X(r)?r[e.id]:r}}return a||n},updateTextBGColor(e,t){const s=this,{$el:i}=s;let n="";if(V(t)||X(t)){const a=V(t)?"":s.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=i.defs.select(["filter[id*='labels-bg","']"].join(a));o.size()&&(n=`url(#${o.attr("id")})`)}return n||null},redrawText(e,t,s,i){const n=this,{$T:a,axis:o,config:r,state:{hasTreemap:l}}=n,c=kt(!0),u=r.axis_rotated,d=r.data_labels.rotate,h=ia(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")),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=na.bind(n)(f,m,h,u,x),_.attr("text-anchor",h)),this.childElementCount||d?_.attr("transform",`translate(${m.x} ${m.y}) ${g}`):_.attr("x",m.x).attr("y",m.y)}),!0},getTextRect(e,t){const s=this;let i=e.node?e.node():e;/text/i.test(i.tagName)||(i=i.querySelector("text"));const n=i.textContent,a=`${pt.textRect}-${n.replace(/\W/g,"_")}`;let o=s.cache.get(a);return o||(s.$el.svg.append("text").style("visibility","hidden").style("font",(0,w.select)(i).style("font")).classed(t,!0).text(n).call(r=>{o=be(r.node())}).remove(),s.cache.add(a,o)),o},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${ft(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=be(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.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+Rs.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=be(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],L(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")),_+Rs.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=fs(a.node()),r=(l,c)=>Math.sqrt(Math.pow(l,2)+Math.pow(c,2));a.node()&&n.each(function(){const l=fs(this),c=(0,w.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(gt.TextOverlapping,d&&h)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,w.selectAll)([this,this.previousSibling]).classed(gt.TextOverlapping,!1)})},meetsLabelThreshold(e=0,t){const s=this,{config:i}=s,n=i[`${t}_label_threshold`]||0;return e>=n}};function Cs(e="left",t){const s=L(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 oa={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",Cs(t.title_position)).attr("class",gt.title);ce(i,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:s},$el:{title:i}}=e;if(i){const n=Cs(t.title_position,s.width),a=(t.title_padding.top||0)+e.getTextRect(e.$el.title,gt.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,gt.title).height:0)+(s.title_padding.bottom||0)}},ra={initTooltip(){const e=this,{config:t,$el:s}=e;s.tooltip=(0,w.select)(t.tooltip_contents.bindto),s.tooltip.empty()&&(s.tooltip=s.chart.append("div").attr("class",_e.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()&&V(s.tooltip_init_x)&&(s.tooltip_init_x=mt.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&&!At(r)){const{top:l=0,left:c=50}=r;i.tooltip.style("top",V(l)?l:`${l}px`).style("left",V(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:s,config:i}=t;return O(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(P=>{const k=r[`tooltip_format_${P}`];return O(k)?k.bind(o):k}),g=(...P)=>Ie((u||t)(...P)),f=(...P)=>Ie((d||(k=>k))(...P)),p=(...P)=>{const k=h||(l.hasTreemap||a.isStackNormalized()?(F,W)=>`${(W*100).toFixed(2)}%`:s);return Ie(k(...P))},_=r.tooltip_order,x=P=>a.axis&&a.isBubbleZType(P)?a.getBubbleZData(P.value,"z"):a.getBaseValue(P),m=a.levelColor?P=>a.levelColor(P.value):P=>i(P),$=r.tooltip_contents,b=$.template,v=a.mapToTargetIds();if(_===null&&r.data_groups.length){const P=a.orderTargets(a.data.targets).map(k=>k.id).reverse();e.sort((k,F)=>{let W=k?k.value:null,J=F?F.value:null;return W>0&&J>0&&(W=k.id?P.indexOf(k.id):null,J=F.id?P.indexOf(F.id):null),W-J})}else if(/^(asc|desc)$/.test(_)){const P=_==="asc";e.sort((k,F)=>{const W=k?x(k):null,J=F?x(F):null;return P?W-J:J-W})}else O(_)&&e.sort(_.bind(o));const y=a.getTooltipContentTemplate(b),A=e.length;let S,R,T,C,z;for(z=0;z<A;z++)if(R=e[z],!(!R||!(x(R)||x(R)===0))){if(it(S)){const P=(l.hasAxis||l.hasRadar)&&g(R.x);S=Ae(y[0],{CLASS_TOOLTIP:_e.tooltip,TITLE:M(P)?b?P:`<tr><th colspan="2">${P}</th></tr>`:""})}if(!R.ratio&&c.arcs&&(T=["arc",a.$el.arcs.select(`path.${G.arc}-${R.id}`).data()[0]],R.ratio=a.getRatio(...T)),T=[R.ratio,R.id,R.index],a.isAreaRangeType(R)){const[P,k]=["high","low"].map(W=>p(a.getRangedData(R,W),...T));C=`<b>Mid:</b> ${p(x(R),...T)} <b>High:</b> ${P} <b>Low:</b> ${k}`}else if(a.isCandlestickType(R)){const[P,k,F,W,J]=["open","high","low","close","volume"].map(lt=>a.getRangedData(R,lt,"candlestick")?p(a.getRangedData(R,lt,"candlestick"),...T):void 0);C=`<b>Open:</b> ${P} <b>High:</b> ${k} <b>Low:</b> ${F} <b>Close:</b> ${W}${J?` <b>Volume:</b> ${J}`:""}`}else if(a.isBarRangeType(R)){const{value:P,id:k,index:F}=R;C=`${p(P,void 0,k,F)}`}else C=p(x(R),...T);if(C!==void 0){if(R.name===null)continue;const P=f((n=R.name)!=null?n:R.id,...T),k=m(R),F={CLASS_TOOLTIP_NAME:_e.tooltipName+a.getTargetSelectorSuffix(R.id),COLOR:b||!a.patterns?k:`<svg><rect style="fill:${k}" width="10" height="10"></rect></svg>`,NAME:P,VALUE:C};if(b&&X($.text)){const W=v.indexOf(R.id);Object.keys($.text).forEach(J=>{F[J]=$.text[J][W]})}S+=Ae(y[1],F)}}return`${S}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
|
18 | {=TITLE}
|
19 | {{<tr class="{=CLASS_TOOLTIP_NAME}">
|
20 | <td class="name">${this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>'}{=NAME}</td>
|
21 | <td class="value">{=VALUE}</td>
|
22 | </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,_]=yt(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=(y=0,A,S="y")=>{var R;const T=o[A?(R=n.axis)==null?void 0:R.getId(A):S];return T?T(y)+(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:$=0}=g,b=(i=(s=a.tooltip_position)==null?void 0:s.bind(n.api)(f,m,$,l==null?void 0:l.node(),x))!=null?i:Me(u)?n.getTooltipPositionViewBox.bind(n)(m,$,x):n.getTooltipPosition.bind(n)(m,$,x);["top","left"].forEach(v=>{const y=b[v];c.style(v,`${y}px`),v==="left"&&!g.xPosInPercent&&(g.xPosInPercent=y/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=ve(h,g,f,!1),_=h.getBoundingClientRect(),x=ve(h,20,0,!1).x;let m=p.y,$=p.x+e/2+x;return d&&(c.hasFunnel||c.hasTreemap||c.hasRadar?($-=e/2+x,m+=t):(m+=_.height/2,$+=_.width/2-(e-x))),$+e>_.width&&($=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:$}},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,$=r.axis_rotated,b=o.hasArcType(),v=o.getSvgLeft(!0);let y=v+h.width-o.getCurrentPaddingByDirection("right");const A=20;let{x:S,y:R}=s;if(f)S+=S>=u/2?15:-(e+15),R+=15;else if(b){if(x!=="touch"){let z=(n=(i=o.getTitlePadding)==null?void 0:i.call(o))!=null?n:0;z&&m&&((a=r.arc_rangeText_values)!=null&&a.length)&&(z+=10),S+=(u-(_?o.getLegendWidth():0))/2,R+=(m?d:d/2+t)+z}}else if(g||p)R+=t;else{const C={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};$?(S+=v+C.left+A,R=C.top+s.xAxis+A,y-=v):(S=v+C.left+A+(l.zoom?S:s.xAxis),R+=C.top-5)}if(S+e+15>y&&(S-=e+(g||p||b?0:$?A*2:38)),R+t>h.height){const C=p?t+10:30;R-=m?t*1.5:t+C}const T={top:R,left:S};return Object.keys(T).forEach(C=>{T[C]<0&&(T[C]=0)}),T},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];K(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")}),K(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:{});K(n.tooltip_onhide,i,o),a.style("display","none").style("visibility","hidden").datum(null),K(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=ot.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)&&ot.elementFromPoint(g,f);const _=p&&(0,w.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)}}}},la={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=$e(a.margin.left),c=$e(a.margin.top);else if(e==="context")l=$e(a.margin2.left),c=$e(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(`.${at.axisX}`),e),o=t!=null&&t.axisY?t.axisY:n(i.select(`.${at.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:n(i.select(`.${at.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(`.${G.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)}},ca={isValidChartType(e){return!!(e&&Object.values(E).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(E).forEach(s=>{const i=E[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 zt?!zt[e].filter(i=>s.indexOf(i)===-1).every(i=>!this.hasType(i,t)):!1},isTypeOf(e,t){var s;const i=V(e)?e:e.id,n=this.config&&(((s=this.config.data_types)==null?void 0:s[i])||this.config.data_type);return N(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=V(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,zt.Line)},isStepType(e){return this.isTypeOf(e,zt.Step)},isSplineType(e){return this.isTypeOf(e,zt.Spline)},isAreaType(e){return this.isTypeOf(e,zt.Area)},isAreaRangeType(e){return this.isTypeOf(e,zt.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||N(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=>L(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=U(9);function da(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 ua={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=ft(/^(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=nt(i),a={};let o=n?{}:0;return n&&ze(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])}it(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 nt(n)?e[n[o]]:e},getIndicesMax(e){return nt(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=St(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(nt(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=_-(L(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 L(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:$,rowValues:b,values:v}=x;if(a[m]<a[c]){const y=v[f];let A=b[l];(!A||Number(A.x)!==f)&&(A=$[f]),(A==null?void 0:A.value)*u>=0&&L(y)&&(u!==0||o==="positive"&&y>0||o==="negative"&&y<0)&&(_+=g(y)-p)}}),_}},circleY(e,t){const s=this,i=e.id;let n;return s.isGrouped(i)&&(n=da.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()?mt.bind(l):Number);let m=t.tickInterval(g);if(d.zoom&&!l.axis.isCategorized()&&_>1){const v=x.every((y,A)=>y===u.xDomain[A]);m=u.xDomain.map((y,A)=>{const S=v?y:y-Math.abs(x[A]);return d.zoom(S)}).reduce((y,A)=>Math.abs(y)+A)/g}const $=v=>{const y=v?c[p][v]:c[p],A=v?y.ratio:c[`${p}_ratio`],S=v?y.max:c[`${p}_max`],R=L(y)?y:O(y)?y.call(l,h.width,s,g):s?m*A/s:0;return S&&R>S?S:R};let b=$();return!f&&St(c[p])&&(b={_$width:b,_$total:[]},l.filterTargetsToShow(l.data.targets).forEach(v=>{c[p][v.id]&&(b[v.id]=$(v.id),b._$total.push(b[v.id]||b._$width))})),b},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(`.${B[`${e}s`]}${i.getTargetSelectorSuffix(s)}`):n.main).selectAll(`.${B[e]}${a}`),o},isWithinShape(e,t){var s;const i=this,n=(0,w.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(B.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=yt(this.state.event,e),s=cs(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}=e.getBBox(),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}},ha=Object.defineProperty,ga=(e,t,s)=>t in e?ha(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ht=(e,t,s)=>ga(e,typeof t!="symbol"?t+"":t,s);class jt{constructor(t){ht(this,"api"),ht(this,"config"),ht(this,"cache"),ht(this,"$el"),ht(this,"state"),ht(this,"charts"),ht(this,"data",{xs:{},targets:[]}),ht(this,"axis"),ht(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),ht(this,"org",{xScale:null,xDomain:null}),ht(this,"color"),ht(this,"patterns"),ht(this,"levelColor"),ht(this,"point"),ht(this,"brush"),ht(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const s=this;s.api=t,s.config=new Vt,s.cache=new Cn;const i=new An;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,w.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"),K(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),K(t.config.onafterinit,t.api)}init(){const t=this,{config:s,state:i,$el:n}=t,a=s.boost_useCssRule;if(En(t),i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasFunnel=!i.hasAxis&&t.hasType("funnel"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!t.hasArcType()&&!i.hasFunnel&&!i.hasTreemap,i.datetimeId=`bb-${+new Date*kt()}`,a){const r=ot.createElement("style");r.type="text/css",ot.head.appendChild(r),i.style={rootSelctor:`.${i.datetimeId}`,sheet:r.sheet},n.style=r}const o={element:s.bindto,classname:"bb"};X(s.bindto)&&(o.element=s.bindto.element||"#chart",o.classname=s.bindto.classname||o.classname),n.chart=O(o.element.node)?s.bindto.element:(0,w.select)(o.element||[]),n.chart.empty()&&(n.chart=(0,w.select)(ot.body.appendChild(ot.createElement("div")))),n.chart.html("").classed(o.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=()=>xn(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,o=i.axis_rotated;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?pe.timeParse:pe.utcParse,n.axisTime=i.axis_x_localtime?pe.timeFormat:pe.utcFormat;const r=s.config.zoom_enabled&&s.config.zoom_type==="drag";n.defaultAxisTime=l=>{const{x:c,zoom:u}=s.scale,d=r?u:u&&c.orgDomain().toString()!==u.domain().toString(),h=l.getMilliseconds()&&".%L"||l.getSeconds()&&".:%S"||l.getMinutes()&&"%I:%M"||l.getHours()&&"%I %p"||l.getDate()!==1&&"%b %d"||d&&l.getDate()===1&&"%b'%y"||l.getMonth()&&"%-m/%-d"||"%Y";return n.axisTime(h)(l)}}a.isLegendRight=i.legend_position==="right",a.isLegendInset=i.legend_position==="inset",a.isLegendTop=i.legend_inset_anchor==="top-left"||i.legend_inset_anchor==="top-right",a.isLegendLeft=i.legend_inset_anchor==="top-left"||i.legend_inset_anchor==="bottom-left",a.rotatedPadding.top=s.getResettedPadding(a.rotatedPadding.top),a.rotatedPadding.right=o&&!i.axis_x_show?0:30,a.inputType=_n(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:b,y2:v,subX:y,subY:A,subY2:S}=r;$&&($.domain(Kt(a.getXDomain(a.data.targets),!o.axis_x_inverted)),y.domain($.domain()),u.xDomain=$.domain()),b&&(b.domain(a.getYDomain(a.data.targets,"y")),A.domain(b.domain())),v&&(v.domain(a.getYDomain(a.data.targets,"y2")),S&&S.domain(v.domain()))}if(c.svg=c.chart.append("svg").style("overflow","hidden").style("display","block"),f&&l.inputType){const $=l.inputType==="touch",{onclick:b,onover:v,onout:y}=o;c.svg.on("click",(b==null?void 0:b.bind(a.api))||null).on($?"touchstart":"mouseenter",(v==null?void 0:v.bind(a.api))||null).on($?"touchend":"mouseleave",(y==null?void 0:y.bind(a.api))||null)}o.svg_classname&&c.svg.attr("class",o.svg_classname);const x=O(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($=>{a.appendClip(c.defs,l.clip[$])}),a.generateTextBGColorFilter(_),x&&a.patterns.forEach($=>c.defs.append(()=>$.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",`${gt.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(),K(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 $=a.getMinMaxData();K(o.data_onmin,a.api,$.min),K(o.data_onmax,a.api,$.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()),o.forEach(r=>{const l=ft(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");i||a.push("Arc","Pie"),t.hasType("gauge")?a.push("Gauge"):i?a.push("Radar"):o&&a.push("Polar")}a.forEach(o=>{t[`init${o}`]()}),nt(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(nt(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;const i=this,{hasAxis:n,hasFunnel:a,hasRadar:o,hasTreemap:r}=i.state,l=u=>i[`updateTargetsFor${u}`](t.filter(i[`is${u}Type`].bind(i)));if(i.updateTargetsForText(t),n)["bar","candlestick","line"].forEach(u=>{const d=ft(u);(u==="line"&&i.hasTypeOf(d)||i.hasType(u))&&l(d)}),i.updateTargetsForSubchart&&i.updateTargetsForSubchart(t);else if(i.hasArcType(t)){let u="Arc";o?u="Radar":i.hasType("polar")&&(u="Polar"),l(u)}else a?l("Funnel"):r&&l("Treemap");const c=i.hasType("bubble")||i.hasType("scatter");c&&((s=i.updateTargetForCircle)==null||s.call(i)),i.filterTargetsToShowAtInit(c)}filterTargetsToShowAtInit(t=!1){const s=this,{$el:{svg:i},$T:n}=s;let a=`.${D.target}`;t&&(a+=`, .${ut.chartCircles} > .${ut.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};return Object.keys(s).forEach(i=>{let n=s[i];V(n)&&(n=s[n]),s[i]=Dt(t,`with${i}`,n)}),s}initialOpacity(t){const s=this,{withoutFadeIn:i}=s.state;return s.getBaseValue(t)!==null&&i[t.id]?null:"0"}bindResize(){const t=this,{config:s,state:i}=t,n=On(s.resize_timer),a=[];a.push(()=>K(s.onresize,t.api)),s.resize_auto===!0&&a.push(()=>{i.resizing=!0,s.legend_show&&(t.updateSizes(),t.updateLegend()),t.api.flush(!1)}),a.push(()=>{K(s.onresized,t.api),i.resizing=!1}),a.forEach(o=>n.add(o)),t.resizeFunction=n,j.addEventListener("resize",t.resizeFunction=n)}callPluginHook(t,...s){this.config.plugins.forEach(i=>{t==="$beforeInit"&&(i.$$=this,this.api.plugins.push(i)),i[t](...s)})}}rt(jt.prototype,[Xn,Bn,Nn,Vn,Yn,Un,Zn,Gn,qn,Kn,Qn,ta,ua,ea,sa,aa,oa,ra,la,ca]);function fa(e){const t=this.config;let s,i,n;const a=()=>{const o=i.shift();if(o&&s&&St(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 pa={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=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())):i.initToRender(!0)},destroy(){const e=this.internal,{$el:{chart:t,style:s,svg:i}}=e;if(nt(e)){e.callPluginHook("$willDestroy"),e.charts.splice(e.charts.indexOf(this),1),e.unbindAllEvents(),i.select("*").interrupt(),e.resizeFunction.clear(),j.removeEventListener("resize",e.resizeFunction),t.classed("bb",!1).style("position",null).selectChildren().remove(),s&&s.parentNode.removeChild(s),Object.keys(this).forEach(n=>{n==="internal"&&Object.keys(e).forEach(a=>{e[a]=null}),this[n]=null,delete this[n]});for(const n in this)this[n]=()=>{}}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||At(e))&&(r=a.orgConfig),r}},xa={color(e){return this.internal.color(e)}};const Es=function(e){const{targets:t}=this.internal.data;if(!it(e)){const s=N(e)?e:[e];return t.filter(i=>s.some(n=>n===i.id))}return t};rt(Es,{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);N(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 _a={data:Es};const ma=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 $a(e,t,s){const{width:i,height:n}=t||s,a=new XMLSerializer,o=e.cloneNode(!0),r=fn(Gt(ot.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",w.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=ot.createElement("style");c.appendChild(ot.createTextNode(r.join(`
|
24 | `)));const u=a.serializeToString(c),d=`<svg xmlns="${w.namespaces.svg}" width="${i}" height="${n}"
|
25 | viewBox="0 0 ${s.width} ${s.height}"
|
26 | preserveAspectRatio="${(t==null?void 0:t.preserveAspectRatio)===!1?"none":"xMinYMid meet"}">
|
27 | <foreignObject width="100%" height="100%">
|
28 | ${u}
|
29 | ${l.replace(/(url\()[^#]+/g,"$1")}
|
30 | </foreignObject></svg>`;return`data:image/svg+xml;base64,${ma(d)}`}function ya(e,t){const{top:s,left:i}=t,{x:n,y:a}=e.getBBox(),{a:o,b:r,c:l,d:c,e:u,f:d}=e.getScreenCTM(),{width:h,height:g}=e.getBoundingClientRect();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 ba(e){const{left:t,top:s}=e.getBoundingClientRect(),i=a=>a.textContent||a.childElementCount,n=[];return Gt(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:_}=ya(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 Gt(a.querySelectorAll("tspan")).filter(i).forEach(l=>{n.push(o(l))}),r}else n.push(o(a))}),n}function va(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 Ta={export(e,t){const s=this.internal,{state:i,$el:{chart:n,svg:a}}=s,{width:o,height:r}=i.current,l=qt({width:o,height:r,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e),c=$a(n.node(),l,{width:o,height:r}),u=l.preserveFontStyle?ba(a.node()):[];if(t&&O(t)){const d=new Image;d.crossOrigin="Anonymous",d.onload=()=>{const h=ot.createElement("canvas"),g=h.getContext("2d");h.width=l.width||o,h.height=l.height||r,g.drawImage(d,0,0),u.length&&(va(g,u),u.length=0),t.bind(this)(h.toDataURL(l.mimeType))},d.src=c}return c}},Aa={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(q.focused,!0).classed(q.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(q.focused,!1).classed(q.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(q.focused,!1).classed(q.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,w.select)(this).classed(q.legendItemFocused)}).classed(q.legendItemFocused,!1)),i.focusedTargetIds=[],i.defocusedTargetIds=[]}},wa={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})}}},Sa={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),()=>{as(()=>t.loadFromArgs(e))}):t.loadFromArgs(e)},unload(e){const t=this.internal;let s=e||{};At(s)&&this.tooltip.hide(),N(s)?s={ids:s}:V(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),As.call(t,s.done,s.resizeAfter)})}};function ks(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),K(i.config.data_onshown,this,a)),i.$T(o).style("opacity",r,"important").call(ye,()=>{var l;!e&&a.length===0&&(o.style("display","none"),K((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 Ra={show(e,t={}){ks.call(this,!0,e,t)},hide(e,t={}){ks.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)}},Ca={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,`.${st.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)}}},Ea=Object.defineProperty,ka=(e,t,s)=>t in e?Ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ls=(e,t,s)=>ka(e,typeof t!="symbol"?t+"":t,s);class Mt{constructor(t){Ls(this,"plugins",[]),Ls(this,"internal");const s=new jt(this);this.internal=s,function i(n,a,o){Object.keys(n).forEach(r=>{const l=O(n[r]),c=a!==o,u=nt(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)})}(Mt.prototype,this,this),fa.call(s,t),s.beforeInit(),s.init()}}rt(Mt.prototype,[pa,xa,_a,Ta,Aa,wa,Sa,Ra,Ca]);function Ps(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(`.${st.shapes}`).selectAll(`.${st.shape}`).each(function(c){const u=(0,w.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(Et.line)||u.classed(xe.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 La={selected(e){const t=this.internal,s=[];return t.$el.main.selectAll(`.${st.shapes+t.getTargetSelectorSuffix(e)}`).selectAll(`.${st.shape}`).filter(function(){return(0,w.select)(this).classed(Q.SELECTED)}).each(i=>s.push(i)),s},select(e,t,s){const i=this.internal;Ps.bind(i)(!0,e,t,s)},unselect(e,t){const s=this.internal;Ps.bind(s)(!1,e,t)}};const Os=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=>mt.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};rt(Os,{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 Pa={subchart:Os},Rt=U(10);const Is=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=>mt.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};rt(Is,{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=wt("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=wt("min",[i[0],e])),s.zoom_x_min},range(e){const t=this.zoom;if(X(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 Oa={zoom:Is,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(Rt.zoomIdentity),e.updateZoom(!0),i==null||i.style("display","none"),(0,Rt.zoomTransform)(s.node())!==Rt.zoomIdentity&&e.zoom.transform(s,Rt.zoomIdentity),a.domain=void 0)}},Ia={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,me.brushY)():(0,me.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,me.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(`.${B.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]]:N(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(`.${B.brush}`):(0,w.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(B.subchart,!0).attr("transform",e.getTranslate("context"));const{main:d}=o;d.style("visibility",l),d.append("g").attr("clip-path",u).attr("class",B.chart),["bar","line","bubble","candlestick","scatter"].forEach(g=>{const f=ft(/^(bubble|scatter)$/.test(g)?"circle":g);if(e.hasType(g)||e.hasTypeOf(f)){const p=d.select(`.${B.chart}`),_=B[`chart${f}s`];p.select(`.${_}`).empty()&&p.append("g").attr("class",_)}});const h=d.append("g").attr("clip-path",u).attr("class",B.brush).call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),r.subX=d.append("g").attr("class",B.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(ft(a))).forEach(a=>{const o=/^(bubble|scatter)$/.test(a),r=ft(o?"circle":a),l=t.getChartClass(r,!0),c=t.getClass(o?"circles":`${a}s`,!0),u=n.select(`.${B[`chart${`${r}s`}`]}`);if(o){const d=u.selectAll(`.${B.circles}`).data(e.filter(t[`is${ft(a)}Type`].bind(t))).attr("class",c);d.exit().remove(),d.enter().append("g").attr("class",c)}else{const d=u.selectAll(`.${B[`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(`.${B.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(!hs(n)&&n.brush.update(),Object.keys(s.type).forEach(u=>{const d=ft(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(`.${B.axisX}`),e);i.main.attr("transform",s.getTranslate("context")),a.attr("transform",s.getTranslate("subX"))}},Da={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,Rt.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=Nt(e.scale.x.orgDomain())/Nt(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",Rt.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,K(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)===Rt.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&&K(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)===Rt.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)&&K(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=Rt.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,ws.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",Pe.zoomBrush).attr("width",i?s.width:0).attr("height",i?0:s.height)),n=yt(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=yt(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(){O(i.onclick)&&i.onclick.bind(e.api)(this),e.api.unzoom()}).classed(Pe.buttonZoomReset,!0).text(i.text||"Reset Zoom"))},getZoomTransform(){const e=this,{$el:{eventRect:t}}=e;return t!=null&&t.node()?(0,Rt.zoomTransform)(t.node()):{k:1}}},za={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(`.${Bt.dragarea}`).attr("x",d).attr("y",g).attr("width",h-d).attr("height",f-g),n.selectAll(`.${st.shapes}`).selectAll(`.${st.shape}`).filter(p=>o==null?void 0:o.bind(t.api)(p)).each(function(p,_){const x=(0,w.select)(this),m=x.classed(Q.SELECTED),$=x.classed(Bt.INCLUDED);let b=!1,v;if(x.classed(ut.circle)){const y=+x.attr("cx")*1,A=+x.attr("cy")*1;v=t.togglePoint,b=d<y&&y<h&&g<A&&A<f}else if(x.classed(vt.bar)){const{x:y,y:A,width:S,height:R}=ds(this);v=t.togglePath,b=!(h<y||y+S<d)&&!(f<A||A+R<g)}else return;b^$&&(x.classed(Bt.INCLUDED,!$),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",Bt.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(`.${Bt.dragarea}`)).style("opacity","0").remove(),s.selectAll(`.${st.shape}`).classed(Bt.INCLUDED,!1),e.setDragStatus(!1))}},Fa=Object.defineProperty,Ma=Object.defineProperties,Xa=Object.getOwnPropertyDescriptors,Ds=Object.getOwnPropertySymbols,Ba=Object.prototype.hasOwnProperty,Na=Object.prototype.propertyIsEnumerable,zs=(e,t,s)=>t in e?Fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ga=(e,t)=>{for(var s in t||(t={}))Ba.call(t,s)&&zs(e,s,t[s]);if(Ds)for(var s of Ds(t))Na.call(t,s)&&zs(e,s,t[s]);return e},Va=(e,t)=>Ma(e,Xa(t)),Ya=Va(Ga({},za),{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);K(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;K(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;K(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;K(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,w.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:st.shapes}`;a.data_selection_grouped&&(h+=n.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(d?`.${Q.selectedCircle}`:`.${st.shape}.${Q.SELECTED}`).classed(Q.SELECTED,!1).each(function(g){const f=(0,w.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))}}}),ja={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:()=>!0,data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:()=>{},data_onunselected:()=>{}},Ha={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:()=>{}},Wa={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 Fs=()=>(rt(jt.prototype,Ya),rt(Mt.prototype,La),Vt.setOptions([ja]),(Fs=()=>!0)()),Ms=()=>(rt(jt.prototype,Ia),rt(Mt.prototype,Pa),Vt.setOptions([Ha]),(Ms=()=>!0)()),Xs=()=>(rt(jt.prototype,Da),rt(Mt.prototype,Oa),Vt.setOptions([Wa]),(Xs=()=>!0)());function Bs(e,t,s){const{config:i}=e,n=(a,o)=>{const r=L(o)?o:o===!1?void 0:null;r!==null&&(i[`axis_${a}_${t}`]=r)};H(s)&&(St(s)?Object.keys(s).forEach(a=>{n(a,s[a])}):(L(s)||s===!1)&&["y","y2"].forEach(a=>{n(a,s)}),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function Ns(e,t){const{config:s}=e;return{x:s[`axis_x_${t}`],y:s[`axis_y_${t}`],y2:s[`axis_y2_${t}`]}}var Ua={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?Bs(t,"min",e):Ns(t,"min")},max:function(e){const t=this.internal;return M(e)||e===!1?Bs(t,"max",e):Ns(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()}}}},Za={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 At(i)?Object.values(t.data.xs)[0]:i}return s.axis_x_categories=e,t.redraw(),s.axis_x_categories}},qa={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||!de())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?mt.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 He(e,t){const s=this.internal,{config:i}=s,n=i.transition_duration&&de(),a=`grid_${t}_lines`;return e&&(i[a]=e,s.updateGrid(),s.redrawGrid(n)),i[a]}function Gs(e,t){const s=`grid_${t}_lines`;return He.bind(this)(this.internal.config[s].concat(e||[]),t)}function Vs(e,t){this.internal.removeGridLines(e,t)}const Ys=function(e){return He.bind(this)(e,"x")};rt(Ys,{add(e){return Gs.bind(this)(e,"x")},remove(e){return Vs.bind(this)(e,!0)}});const js=function(e){return He.bind(this)(e,"y")};rt(js,{add(e){return Gs.bind(this)(e,"y")},remove(e){return Vs.bind(this)(e,!1)}});var Ka={xgrids:Ys,ygrids:js},Ja={groups(e){const t=this.internal,{config:s}=t;return it(e)||(s.data_groups=e,t.redraw()),s.data_groups}};function Hs(e,t=!1){const s=this.internal,{config:i}=s,n=i.transition_duration&&de();return e?(i.regions=t?i.regions.concat(e):e,s.updateRegion(),s.redrawRegion(n),t?i.regions:e):i.regions}const Ws=function(e){return Hs.bind(this)(e)};rt(Ws,{add:function(e){return Hs.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:s,$T:i}=t,n=e||{},a=Dt(n,"classes",[le.region]);let o=t.$el.main.select(`.${le.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 Qa={regions:Ws},to={x(e){const t=this.internal,{axis:s,data:i}=t,n=s.isCustomX()&&s.isCategorized();return N(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 X(e)&&(t.updateTargetXs(t.data.targets,e),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},Jt=U(11),eo=Object.defineProperty,so=(e,t,s)=>t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t,s)=>so(e,typeof t!="symbol"?t+"":t,s);class Us{constructor(t){We(this,"owner"),We(this,"config"),We(this,"scale");const s=Yt(),{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())}static getSizeFor1Char(t,s=!0){const i={w:5.5,h:11.5};return!t.empty()&&t.text("0").call(n=>{try{const{width:a,height:o}=n.node().getBBox();a&&o&&(i.w=a,i.h=o)}finally{n.text("")}}),s&&(this.getSizeFor1Char=()=>i),i}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=Yt("_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=>V(l)&&L(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 io=Object.defineProperty,no=(e,t,s)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ue=(e,t,s)=>no(e,typeof t!="symbol"?t+"":t,s);class ao{constructor(t={}){ue(this,"helper"),ue(this,"config"),ue(this,"params"),ue(this,"g"),ue(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 Us(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,$=m&&/^(x|y|y2)$/.test(m)?a.config[`axis_${m}_tick_text_position`]:{x:0,y:0},b=m==="subX"?"subchart_axis_x":`axis_${m}`,v=a.config[`${b}_show`],y={tick:v?a.config[`${b}_tick_show`]:!1,text:v?a.config[`${b}_tick_text_show`]:!1},A=a.config.axis_evalTextSize;let S;t.each(function(){const R=(0,w.select)(this);let T=this.__chart__||o,C=n.copyScale();S=R,this.__chart__=C,i.tickOffset=a.isCategory?(C(1)-C(0))/2:0;const z=R.selectAll(".domain").data([0]);if(z.enter().append("path").attr("class","domain").merge(z).attr("d",()=>{const P=i.outerTickSize*g;return u?`M${x[0]},${P}V0H${x[1]}V${P}`:`M${P},${x[0]}H0V${x[1]}H${P}`}),y.tick||y.text){const P=i.tickValues||n.generateTicks(C,c);s.generatedTicks=P;let k=R.selectAll(".tick").data(P,C);const F=k.enter().insert("g",".domain").attr("class","tick"),W=k.exit().remove();k=F.merge(k),y.tick&&F.append("line"),y.text&&F.append("text");const J=k.select("text"),lt=O(A)?A.bind(s.params.owner.api)(J.node()):Us.getSizeFor1Char(J,A),$t=[];let bt=J.selectAll("tspan").data((ct,Xt)=>{const Wt=a.tickMultiline?l(ct,C,P,c,lt.w):N(n.textFormatted(ct))?n.textFormatted(ct).concat():[n.textFormatted(ct)];return $t[Xt]=Wt.length,Wt.map(Ut=>({index:Xt,splitted:Ut}))});bt.exit().remove(),bt=bt.enter().append("tspan").merge(bt).text(ct=>ct.splitted),bt.attr("x",u?0:_*g).attr("dx",(()=>{let ct=0;return/(top|bottom)/.test(r)&&f&&(ct=8*Math.sin(Math.PI*(f/180))*(r==="top"?-1:1)),ct+($.x||0)})()).attr("dy",(ct,Xt)=>{const Wt=".71em";let Ut=0;return r!=="top"&&(Ut=lt.h,Xt===0&&(Ut=c?-(($t[ct.index]-1)*(lt.h/2)-3):$.y===0?Wt:0)),L(Ut)&&$.y?Ut+$.y:Ut||Wt});const oe=k.select("line"),he=k.select("text");if(F.select("line").attr(`${h}2`,p*g),F.select("text").attr(h,_*g),s.setTickLineTextPosition(oe,he),a.tickTitle){const ct=he.select("title");(ct.empty()?he.append("title"):ct).text(Xt=>a.tickTitle[Xt])}if(C.bandwidth){const ct=C,Xt=ct.bandwidth()/2;T=Wt=>ct(Wt)+Xt,C=T}else T.bandwidth?T=C:d(W,C);k=a.owner.state.flowing?n.transitionise(k):a.owner.$T(k),d(F,T),d(k.style("opacity",null),C)}}),this.g=S}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){const i=this.getTickXY(),{innerTickSize:n,orient:a,tickLength:o,tickOffset:r}=this.config,l=this.params.tickTextRotate,c=f=>{const p=["start","end"];return a==="top"&&p.reverse(),f?p[f>0?0:1]:"middle"},u=f=>f?`rotate(${f})`:null,d=f=>{const p=f/(a==="bottom"?15:23);return f?11.5-2.5*p*(f>0?1:-1):o},{config:{axis_rotated:h,axis_x_tick_text_inner:g}}=this.params.owner;switch(a){case"bottom":t.attr("x1",i.x).attr("x2",i.x).attr("y2",this.getTickSize.bind(this)),s.attr("x",0).attr("y",d(l)).style("text-anchor",c(l)).style("text-anchor",(f,p,{length:_})=>!h&&p===0&&(g===!0||g.first)?"start":!h&&p===_-1&&(g===!0||g.last)?"end":c(l)).attr("transform",u(l));break;case"top":t.attr("x2",0).attr("y2",-n),s.attr("x",0).attr("y",-d(l)*2).style("text-anchor",c(l)).attr("transform",u(l));break;case"left":t.attr("x2",-n).attr("y1",i.y).attr("y2",i.y),s.attr("x",-o).attr("y",r).style("text-anchor","end");break;case"right":t.attr("x2",n).attr("y2",0),s.attr("x",o).attr("y",0).style("text-anchor","start")}}splitTickText(t,s,i,n,a){const{params:o}=this,r=this.helper.textFormatted(t),l=V(r)&&r.indexOf(`
|
31 | `)>-1?r.split(`
|
32 | `):[];if(l.length)return l;if(N(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=Gt(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(O(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 oo=Object.defineProperty,ro=(e,t,s)=>t in e?oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Lt=(e,t,s)=>ro(e,typeof t!="symbol"?t+"":t,s),lo={getAxisInstance:function(){return this.axis||new co(this)}};class co{constructor(t){Lt(this,"owner"),Lt(this,"x"),Lt(this,"subX"),Lt(this,"y"),Lt(this,"y2"),Lt(this,"axesList",{}),Lt(this,"tick",{x:null,y:null,y2:null}),Lt(this,"xs",[]),Lt(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${at.axis} ${at[`axis${ft(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||nt(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(O(n))n=n.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(this.isTimeSeries()&&n.every(isNaN)){const a=mt.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=s.axis_rotated,r=["x","y"];s.axis_y2_show&&r.push("y2"),r.forEach(l=>{const c=this.getAxisClassName(l),u=at[`axis${l.toUpperCase()}Label`];n[l]=i.append("g").attr("class",c).attr("clip-path",()=>{let d=null;return l==="x"?d=a.pathXAxis:l==="y"&&(d=a.pathYAxis),d}).attr("transform",t.getTranslate(l)).style("visibility",s[`axis_${l}_show`]?null:"hidden"),n[l].append("text").attr("class",u).attr("transform",["rotate(-90)",null][l==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(l)),this.generateAxes(l)}),s.axis_tooltip&&this.setAxisTooltip()}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?Jt.axisLeft:Jt.axisBottom:t==="y"?r=o?Jt.axisBottom:Jt.axisLeft:t==="y2"&&(r=o?Jt.axisTop:Jt.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(O(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`];O(m)&&(g=m.bind(o.api))}let f=this.tick[c];const p=qt({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 ao(p).scale(l&&o.scale.zoom||s).orient(d);if(l&&this.isTimeSeries()&&f&&!O(f)){const m=mt.bind(o);f=f.map($=>m($))}else!l&&this.isTimeSeriesY()&&(_.ticks(r.axis_y_tick_time_value),f=null);f&&_.tickValues(f),_.tickFormat(g||!l&&o.isStackNormalized()&&(m=>`${m}%`)),u&&(_.tickCentered(r.axis_x_tick_centered),At(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?O(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,O(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(O(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 V(s)?s:s?s.text:null}setLabelText(t,s){const i=this.owner,{config:n}=i,a=this.getLabelOptionByAxisId(t);V(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=St(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}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}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}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},$el:{svg:o,chart:r}}=i,l=a.maxTickSize[t],c=`axis_${t}`,u={width:0,height:0};if(s||!n[`${c}_show`]||l.width>0&&i.filterTargetsToShow().length===0)return l;if(o){const d=/^y2?$/.test(t),h=i.filterTargetsToShow(i.data.targets),g=i.scale[t].copy().domain(i[`get${d?"Y":"X"}Domain`](h,t)),f=g.domain(),p=f[0]===f[1]&&f.every(y=>y>0),_=N(l.domain)&&l.domain[0]===l.domain[1]&&l.domain.every(y=>y>0);if(p||_)return l.size;l.domain=f,d||l.ticks.splice(0);const x=this.getAxis(t,g,!1,!1,!0),m=n[`${c}_tick_rotate`],$=n[`${c}_tick_count`];!n[`${c}_tick_values`]&&$&&x.tickValues(this.generateTickValues(f,$,d?this.isTimeSeriesY():this.isTimeSeries())),!d&&this.updateXAxisTickValues(h,x);const v=r.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0");x.create(v),v.selectAll("text").attr("transform",L(m)?`rotate(${m})`:null).each(function(y,A){const{width:S,height:R}=this.getBoundingClientRect();u.width=Math.max(u.width,S),u.height=Math.max(u.height,R),d||(l.ticks[A]=S)}),v.remove()}return Object.keys(u).forEach(d=>{u[d]>0&&(l[d]=u[d])}),l}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||At(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[_],$=x-(r?1:.5)+u;if($<=0)continue;const v=(s-m)/$,y=g-x,A=d*v,S=y*v+A,R=m-v/2-S;h=Math.max(h,R)}const f=i.filterTargetsToShow(i.data.targets);let p=0;if(!r&&a.axis_x_tick_count<=f.length&&f[0].values.length){const _=Yt(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,{$el:{main:i},$T:n}=s,a={x:i.select(`.${at.axisX} .${at.axisXLabel}`),y:i.select(`.${at.axisY} .${at.axisYLabel}`),y2:i.select(`.${at.axisY2} .${at.axisY2Label}`)};Object.keys(a).filter(o=>!a[o].empty()).forEach(o=>{const r=a[o];n(r,t).attr("x",()=>this.xForAxisLabel(o)).attr("dx",()=>this.dxForAxisLabel(o)).attr("dy",()=>this.dyForAxisLabel(o)).text(()=>this.getLabelText(o))})}getPadding(t,s,i,n){const a=L(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=O(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,$el:o}=n,r=s?"0":null;["x","y","y2","subX"].forEach(l=>{const c=this[l],u=o.axis[l];c&&u&&(!i&&!a.transition_duration&&(c.config.withoutTransition=!0),u.style("opacity",r),c.create(t[`axis${ft(l)}`]))}),this.updateAxes()}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`],$=u[`${_}tick_count`];if(x.domain(c.getYDomain(t,p,f)),!m&&$){const b=c.axis[p],v=x.domain();b.tickValues(this.generateTickValues(v,v.every(y=>y===0)?1:$,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=Kt(d.data()),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(`.${at.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(o[l]=(c=a[l])==null?void 0:c.append("text").classed(at[`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 uo={initEventRect(){this.$el.main.select(`.${D.chart}`).append("g").attr("class",Tt.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(`.${Tt.eventRects}`).style("cursor",s.zoom_enabled&&s.zoom_type!=="drag"?s.axis_rotated?"ns-resize":"ew-resize":null).classed(Tt.eventRectsMultiple,a).classed(Tt.eventRectsSingle,!a).selectAll(`.${Tt.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=h=>{if(e.isMultipleX())e.selectRectForMultipleXs(h);else{const g=e.getDataIndexFromEvent(s.event);e.callOverOutForTouch(g),g===-1?e.unselectRect():e.selectRectForSingle(h,g)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=Oe(r)&&r||!1,c=!isNaN(r)&&r||null;let u;const d=h=>{const g=h.type,p=h.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];g==="touchstart"?l?h.preventDefault():c!==null&&(u=p):g==="touchmove"&&(l||u===!0||c!==null&&Math.abs(u-p)>=c)&&(u=!0,h.preventDefault())};i.on("touchstart",h=>{s.event=h,e.updateEventRect()}).on("touchstart.eventRect touchmove.eventRect",h=>{if(s.event=h,!i.empty()&&i.classed(Tt.eventRect)){if(s.dragging||s.flowing||e.hasArcType()||h.touches.length>1)return;d(h),a(i.node())}else o()},!0).on("touchend.eventRect",h=>{s.event=h,!i.empty()&&i.classed(Tt.eventRect)&&(e.hasArcType()||!e.toggleShape||s.cancelClick)&&s.cancelClick&&(s.cancelClick=!1)},!0),n.on("touchstart",h=>{s.event=h;const{target:g}=h;g&&g!==i.node()&&o()})},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=gs(n.chart.node());a.rect=u.node().getBoundingClientRect().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(Tt.eventRect,!0)),d()},updateEventType(e){const t=this,s=Oe(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 $;return x.prev===null&&x.next===null?$=a?i.height:i.width:x.prev===null?$=(n(x.next)+n(_.x))/2:x.next===null?$=n(m[1])-(n(x.prev)+n(_.x))/2:(Object.keys(x).forEach((b,v)=>{var y;x[b]=(y=x[b])!=null?y:m[v]}),$=Math.max(0,(n(x.next)-n(x.prev))/2)),$},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)=>O(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(.${st.shape}-${t})`).classed(D.EXPANDED,!1);const g=o.selectAll(`.${st.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=yt(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(`.${Tt.eventRect}`).style("cursor","pointer"),t&&!n.mouseover&&(i.data_onover.call(s.api,r),n.mouseover=r))},unselectRect(){const e=this,{$el:{circle:t,tooltip:s}}=e;e.$el.svg.select(`.${Tt.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(yt(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(`.${st.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=yt(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(`.${st.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${st.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))})}},ho=U(12),go={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=ys();let d;u.add(Object.keys(e).map(h=>(d=e[h].transition().ease(ho.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(`.${B[_]}-${m}`);a.selectAll(`.${B[`${_}s`]}`).selectAll(x).remove()}),a.select(`.${B.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=b=>u(b)-i.point_r,$=b=>d(b)-i.point_r;x.attr("x",m).attr("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=Nt(h)/2;const g=Nt(d)/Nt(h);return`translate(${u},0) scale(${g},1)`}},fo={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 po=e=>M(e.position)||"end",xo=e=>e.position==="start"?4:e.position==="middle"?0:-4;function Zs(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 qs(e,t){t==="grid"&&e.each(function(){const s=(0,w.select)(this);["x1","x2","y1","y2"].forEach(i=>s.attr(i,+s.attr(i)))})}var _o={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",`${et.grid} ${et.gridLines}`),i.gridLines.main.append("g").attr("class",et.xgridLines),i.gridLines.main.append("g").attr("class",et.ygridLines),i.gridLines.x=(0,w.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(`.${et.xgrids}`).selectAll(`.${et.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",et.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,w.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(`.${et.ygrids}`).selectAll(`.${et.ygrid}`).data(c),a.y.exit().remove(),a.y=a.y.enter().append("line").attr("class",et.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),qs(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(`.${et[`${e}gridLines`]}`).selectAll(`.${et[`${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,w.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),a(l.attr("class",u=>`${et[`${e}gridLine`]} ${u.class||""}`.trim()).select("text").attr("text-anchor",po).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",xo).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",Zs(!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",Zs(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?et.gridLines:D.chart}${n?" + *":""}`,o=i.main.insert("g",a).attr("clip-path",s.pathGrid).attr("class",et.grid);if(i.grid.main=o,t.grid_x_show&&o.append("g").attr("class",et.xgrids),t.grid_y_show&&o.append("g").attr("class",et.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",q.xgridFocus).append("line").attr("class",q.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&o.append("g").attr("class",q.ygridFocus).append("line").attr("class",q.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]=yt(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,w.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.bb-axis-tooltip-x, line.bb-axis-tooltip-y").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.${q.xgridFocus}, line.${q.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,w.select)(this),g={x:u(d),y:s.getYScaleById(d.id)(d.value)};let f;if(h.classed(q.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[_]))}),qs(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.${q.xgridFocus}, line.${q.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.${q.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(`.${at.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(N(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?et.xgridLines:et.ygridLines,l=t?et.xgridLine:et.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)}},mo={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",le.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(`.${le.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,w.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,w.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:s},$T:i}=t;let n=s.list.select("rect"),a=s.list.selectAll("text");return n=i(n,e).attr("x",t.regionX.bind(t)).attr("y",t.regionY.bind(t)).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),a=i(a,e).attr("transform",o=>{var r;const{x:l=0,y:c=0,rotated:u=!1}=(r=o.label)!=null?r:{};return`translate(${t.regionX.bind(t)(o)+l}, ${t.regionY.bind(t)(o)+c})${u?" rotate(-90)":""}`}).attr("text-anchor",o=>{var r;return(r=o.label)!=null&&r.rotated?"end":null}).attr("dy","1em").style("fill",o=>{var r,l;return(l=(r=o.label)==null?void 0:r.color)!=null?l:null}).text(o=>{var r;return(r=o.label)==null?void 0:r.text}),[n.style("fill-opacity",o=>M(o.opacity)?o.opacity:null).on("end",function(){(0,w.select)(this.parentNode).selectAll("rect:not([x])").remove()}),a.style("opacity",null)]},getRegionXY(e,t){const s=this,{config:i,scale:n}=s,a=i.axis_rotated,o=e==="x";let r="start",l,c=0;return t.axis==="y"||t.axis==="y2"?(o||(r="end"),(o?a:!a)&&r in t&&(l=n[t.axis],c=l(t[r]))):(o?!a:a)&&r in t&&(l=n.zoom||n.x,c=l(s.axis.isTimeSeries()?mt.call(s,t[r]):t[r])),c},regionX(e){return this.getRegionXY("x",e)},regionY(e){return this.getRegionXY("y",e)},getRegionSize(e,t){const s=this,{config:i,scale:n,state:a}=s,o=i.axis_rotated,r=e==="width",l=s[r?"regionX":"regionY"](t);let c,u="end",d=a[e];return t.axis==="y"||t.axis==="y2"?(r||(u="start"),(r?o:!o)&&u in t&&(c=n[t.axis],d=c(t[u]))):(r?!o:o)&&u in t&&(c=n.zoom||n.x,d=c(s.axis.isTimeSeries()?mt.call(s,t[u]):t[u])),d<l?0:d-l},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},isRegionOnX(e){return!e.axis||e.axis==="x"}},$o={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"&&L(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}},yo={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_count:void 0,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_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:[]},vo={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_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:[]},To=Object.defineProperty,Ks=Object.getOwnPropertySymbols,Ao=Object.prototype.hasOwnProperty,wo=Object.prototype.propertyIsEnumerable,Js=(e,t,s)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ue=(e,t)=>{for(var s in t||(t={}))Ao.call(t,s)&&Js(e,s,t[s]);if(Ks)for(var s of Ks(t))wo.call(t,s)&&Js(e,s,t[s]);return e},So=Ue(Ue(Ue({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},yo),bo),vo),Ro={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},Co={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const Eo=[Ua,Za,qa,Ka,Ja,Qa,to],Qs={axis:lo,clip:fo,eventrect:uo,flow:go,grid:_o,region:mo,sizeAxis:$o},ti={optDataAxis:Co,optAxis:So,optGrid:Ro};var ei=U(13),ko=Object.defineProperty,Lo=Object.defineProperties,Po=Object.getOwnPropertyDescriptors,si=Object.getOwnPropertySymbols,Oo=Object.prototype.hasOwnProperty,Io=Object.prototype.propertyIsEnumerable,ii=(e,t,s)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Do=(e,t)=>{for(var s in t||(t={}))Oo.call(t,s)&&ii(e,s,t[s]);if(si)for(var s of si(t))Io.call(t,s)&&ii(e,s,t[s]);return e},zo=(e,t)=>Lo(e,Po(t));function ni(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):L(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=L(u)?u:u.call(t.api,d,h,l),g}}}function Ze(e){return function(t){const s=({startAngle:n=0,endAngle:a=0,padAngle:o=0})=>({startAngle:n,endAngle:a,padAngle:o}),i=(0,ei.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(zo(Do({},a),{data:o,index:r,value:l}))}}}var Fo={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;s.radiusExpanded=Math.min(s.arcWidth,s.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?.85:1),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 r=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:r},getRadius(e){const t=this,s=e==null?void 0:e.data;let{innerRadius:i,outerRadius:n}=t.state;return!L(i)&&s&&(i=i[s.id]||0),X(n)&&s&&s.id in n?n=n[s.id]:L(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}=ni.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}=ni.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(`.${G.arcRange}`).data(r);d.exit(),d=n(d.enter().append("text").attr("class",G.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const g=l?h/c*100:h;return O(a)?a(g):`${g}${l?"%":""}`}).merge(d)),(!i.rendered||i.rendered&&!o)&&c>0&&d.attr("transform",(h,g)=>e.transformForArcLabel(u[g],!0)),d.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t=!1){var s,i,n;const a=this,{config:o,state:{radiusExpanded:r}}=a,l=a.updateAngle(e,t);let c="";if(l){if(t||a.hasMultiArcGauge()){const u=Math.sin(l.endAngle-Math.PI/2),d=o.arc_rangeText_position;let h=Math.cos(l.endAngle-Math.PI/2)*(r+(t?5:25)),g=u*(r+15-Math.abs(u*10))+3;if(t&&d){const f=o.arc_rangeText_values,p=O(d)?d(f[e.index]):d;h+=(s=p==null?void 0:p.x)!=null?s:0,g+=(i=p==null?void 0:p.y)!=null?i:0}c=`translate(${h},${g})`}else if(!a.hasType("gauge")||a.data.targets.length>1){let{outerRadius:u}=a.getRadius(e);a.hasType("polar")&&(u=a.getPolarOuterRadius(e,u));const d=this.svgArc.centroid(l),[h,g]=d.map(_=>isNaN(_)?0:_),f=Math.sqrt(h*h+g*g);let p=(n=["donut","gauge","pie","polar"].filter(a.hasType.bind(a)).map(_=>o[`${_}_label_ratio`]))==null?void 0:n[0];p?p=O(p)?p.bind(a.api)(e,u,f):p:p=u&&(f?(36/u>.375?1.175-36/u:.8)*u/f:0),c=`translate(${h*p},${g*p})`}}return c},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){const t=this,s=t.hasType("gauge");t.shouldShowArcLabel()&&e.style("fill",t.updateTextColor.bind(t)).attr("filter",i=>t.updateTextBGColor.bind(t)(i,t.config.data_labels_backgroundColors)).each(function(i){var n;const a=(0,w.select)(this),o=t.updateAngle(i),r=t.getRatio("arc",o);if(t.meetsLabelThreshold(r,(n=["donut","gauge","pie","polar"].filter(t.hasType.bind(t)))==null?void 0:n[0])){const{value:c}=o||i,u=(t.getArcLabelFormat()||t.defaultArcValueFormat)(c,r,i.data.id).toString();ce(a,u,[-1,1],s)}else a.text("")})},expandArc(e){const t=this,{state:{transiting:s},$el:i}=t;if(s){const a=setInterval(()=>{s||(clearInterval(a),i.legend.selectAll(`.${q.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const n=t.mapToTargetIds(e);i.svg.selectAll(t.selectorTargets(n,`.${G.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,w.select)(this).selectAll("path").transition().duration(o).attrTween("d",Ze(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",Ze(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,`.${G.chartArc}`)).selectAll("path").transition().duration(a=>t.getExpandConfig(a.data.id,"duration")).attrTween("d",Ze(t.svgArc.bind(t))),i.selectAll(`${G.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`])},getArcLabelFormat(){const e=this,{config:t}=e;let s=i=>i;return["donut","gauge","pie","polar"].filter(e.hasType.bind(e)).forEach(i=>{s=t[`${i}_label_format`]}),O(s)?s.bind(e.api):s},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(`.${G.chartArcs}`),l=r.selectAll(`.${G.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,`.${G.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":".35em").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",G.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:G.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"),ce(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 L(n)||(n=t.arc_needle_value),Ae(i,{NEEDLE_VALUE:L(n)?n:0})}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(`.${G.arcs}`).selectAll(`.${G.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,ei.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(ye,function(){if(i.levelColor){const u=(0,w.select)(this),d=u.datum(this._current);i.updateLegendItemColor(d.data.id,u.style("fill"))}a.transiting=!1,K(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(`.${G.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(G.needle,!0),t.needle=r,t.needle.updateHelper=(m,$=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(ye,()=>{$&&(s.arc_needle_value=m),x()})}),o){const m=O(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(L(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":""}.${G.chartArcsBackground}`);if(i){let c=0;l=l.selectAll(`path.${G.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(u,d)=>`${G.chartArcsBackground} ${G.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,w.select)(ot.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),it(f)?r():o(this,g,f)})}},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(`.${G.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?_t.gaugeValue:null).call(t.textForArcLabel.bind(t)).attr("transform",c=>t.transformForArcLabel.bind(t)(c)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(i.radius/5)}px`:null).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),n.select(`.${G.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)))}},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:s}}=t,i=L(e)?n=>n.index===e:n=>n.data.id===e;return s==null?void 0:s.selectAll(`.${D.target} path`).filter(i)}},Qt={initArea(e){const t=this,{config:s}=t;e.insert("g",`.${s.area_front?ut.circles:Et.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(`.${xe.areas}`).selectAll(`.${xe.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,w.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,kt()).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]]}}},Mo={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",vt.chartBars).call(this.setCssRule(!1,`.${vt.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(`.${vt.chartBars}`).selectAll(`.${vt.chartBar}`).data(e.filter(u=>u.values.some(d=>L(d.value)||t.isBarRangeType(d)))).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(t.setCssRule(!0,` .${vt.bar}`,["fill"],t.color))},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(`.${vt.bars}`).selectAll(`.${vt.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;return[i.$T(n,t,kt()).attr("d",a=>(L(a.value)||i.isBarRangeType(a))&&e(a)).style("fill",i.updateBarColor.bind(i)).style("clip-path",a=>a.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=L(o)&&o>0?()=>o:L(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),$=l&&m?s.isStackingRadiusData(c):!1,b=[d[0][h],d[0][g]];let v=0;if(c.clipPath=null,l){const S=a?g:h,R=d[2][S]-d[0][S];v=!m||$?l(R):0;const T=`a${v} ${v} ${_?"1 0 0":"0 0 1"} `;x[+!a]=`${T}${v},${v}`,x[+a]=`${T}${[-v,v][a?"sort":"reverse"]()}`,_&&x.reverse()}const y=a?d[1][h]+(_?v:-v):d[1][g]+(_?-v:v);if(v){let S="";a?_&&b[0]<y?S=`0 ${y-b[0]}px 0 0`:!_&&b[0]>y&&(S=`0 0 0 ${b[0]-y}px`):_&&b[1]>y?S=`${b[1]-y}px 0 0 0`:!_&&b[1]<y&&(S=`0 0 ${y-b[1]}px 0`),S&&(c.clipPath=`inset(${S})`)}const A=a?`H${y} ${x[0]}V${d[2][g]-v} ${x[1]}H${d[3][h]}`:`V${y} ${x[0]}H${d[2][h]-v} ${x[1]}V${d[3][g]}`;return`M${d[0][h]},${d[0][g]}${A}z`}},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&&(L(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,_=L(o)?o:o[d.id]||o._$width,x=i[`axis_${s.axis.getId(g)}_inverted`],m=d.value,$=r(d);let b=l(d);i.axis_rotated&&!x&&(m>0&&b<f||m<0&&f<b)&&(b=f),s.isBarRangeType(d)||(b-=f-p);const v=$+_;return[[$,p],[$,b],[v,b],[v,p]]}}},Xo={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=pt.bubbleBaseLength;let n=e.cache.get(i);return n||e.cache.add(i,n=wt("min",[t,s])),n},getBubbleR(e){const t=this;let s=t.config.bubble_maxR;O(s)?s=s.bind(t.api)(e):L(s)||(s=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const i=wt("max",t.getMinMaxData().max.map(o=>t.isBubbleZType(o)?t.getBubbleZData(o.value,"y"):X(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 X(e)?e[t]:e[t==="y"?0:1]}},Bo=Object.defineProperty,ai=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,Go=Object.prototype.propertyIsEnumerable,oi=(e,t,s)=>t in e?Bo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Vo=(e,t)=>{for(var s in t||(t={}))No.call(t,s)&&oi(e,s,t[s]);if(ai)for(var s of ai(t))Go.call(t,s)&&oi(e,s,t[s]);return e},Yo={initCandlestick(){const{$el:e}=this;e.candlestick=e.main.select(`.${D.chart}`).append("g").attr("class",Ct.chartCandlesticks)},updateTargetsForCandlestick(e){const t=this,{$el:s}=t,i=t.getChartClass("Candlestick");s.candlestick||t.initCandlestick(),t.$el.main.select(`.${Ct.chartCandlesticks}`).selectAll(`.${Ct.chartCandlestick}`).data(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(`.${Ct.chartCandlestick}`).selectAll(`.${Ct.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(Ct[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):X(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=L(a)?a:a[u.id]||a._$width,p=s.getCandlestickData(u);let _;if(p&&L(p.open)&&L(p.close)){const x={start:o(u),end:0};x.end=x.start+f;const m={start:r(p.open),end:r(p.close)},$={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],[$.x,$.low,$.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=kt(!0);return[o.each(function(l,c){const u=a((0,w.select)(this),t,r);e(l,c,u)}).style("opacity",null)]},getCandlestickData({value:e}){let t;if(N(e)){const[s,i,n,a,o=!1]=e;t={open:s,high:i,low:n,close:a},o!==!1&&(t.volume=o)}else X(e)&&(t=Vo({},e));return t&&(t._isUp=t.close>=t.open),t||null}},jo=Object.defineProperty,ri=Object.getOwnPropertySymbols,Ho=Object.prototype.hasOwnProperty,Wo=Object.prototype.propertyIsEnumerable,li=(e,t,s)=>t in e?jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Uo=(e,t)=>{for(var s in t||(t={}))Ho.call(t,s)&&li(e,s,t[s]);if(ri)for(var s of ri(t))Wo.call(t,s)&&li(e,s,t[s]);return e};function Re(e=!1){const t=this,{config:s,state:{current:{width:i,height:n}}}=t,a=t.getCurrentPadding(),o=Uo({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 X(a)&&(r=e[o?"height":"width"]*a.ratio),r}),{width:i,height:n}}function Zo(e){const t=this,{top:s,left:i,width:n}=Re.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 di(e=!1){const t=this,{width:s,height:i,top:n,left:a}=Re.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 qo(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)),ui.call(t,i)}function ui(e){const t=this,{height:s}=Re.call(t),i=t.getTotalDataSum(!0);return e.forEach(n=>{n.ratio=n.value/i*s}),e}var Ko={initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${D.chart}`).append("g").classed(re.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(re.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,w.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))}).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=qo.call(t,e.filter(t.isFunnelType.bind(t))),o=s.selectAll(`.${re.chartFunnel}`).data(a);o.exit().remove();const r=o.enter().insert("g",`.${re.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}=Re.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=Zo.call(e,ui.call(e,i.data()));s.attr("clip-path",`path('${di.bind(e)()}')`),s.background.attr("d",di.call(e,!0)),t(i).attr("d",(a,o)=>`M${n[o].join("L")}z`).style("opacity","1"),s.selectAll("g").style("opacity",null)}},Jo={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",G.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(`.${G.arcs}`).selectAll(`.${G.arcLabelLine}`).data(e.arcData.bind(e));a.enter().append("rect").attr("class",r=>`${G.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,w.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 O(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)}};function Qo(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 tr(e,t,s){const i=this,n=[],a="2 2";if(H(t)){const o=(r,l)=>it(r)?l:s?mt.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 er={initLine(){const{$el:e}=this;e.line=e.main.select(`.${D.chart}`).append("g").attr("class",Et.chartLines).call(this.setCssRule(!1,`.${Et.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(`.${Et.chartLines}`).selectAll(`.${Et.chartLine}`).data(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(`.${Et.lines}`).selectAll(`.${Et.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,kt()).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 $=i.data_regions[g.id];$?m=s.lineWithRegions(p,n.zoom||h,f,$):(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=tr.bind(n)(e,i,r),u=n.hasNullDataValue(e);let d,h,g,f;const p=o?T=>s(T.value):T=>t(T.x),_=o?T=>t(T.x):T=>s(T.value),x=T=>`M${T[0][0]},${T[0][1]}L${T[1][0]},${T[1][1]}`,m=r?(T,C,z,P)=>{const k=T.x.getTime(),F=C.x-T.x,W=new Date(k+F*z),J=new Date(k+F*(z+P)),lt=o?[[s(h(z)),t(W)],[s(h(z+g)),t(J)]]:[[t(W),s(h(z))],[t(J),s(h(z+g))]];return x(lt)}:(T,C,z,P)=>{const k=t(C.x,!o),F=s(C.value,o),W=z+P,J=t(d(z),!o),lt=s(h(z),o);let $t=t(d(W),!o),bt=s(h(W),o);$t>k&&($t=k),T.value>C.value&&(o?bt<F:bt>F)&&(bt=F);const oe=[[J,lt],[$t,bt]];return o&&oe.forEach(he=>he.reverse()),x(oe)},$={x:n.axis.getAxisType("x"),y:n.axis.getAxisType("y")};let b="";const v=n.$el.line.filter(({id:T})=>T===e[0].id),y=v.clone().style("display","none"),A=(T,C)=>T.attr("d",C).node().getTotalLength(),S={dash:[],lastLength:0};let R=!1;for(let T=0,C;C=e[T];T++){const z=e[T-1],P=z&&M(z.value);let k=n.isWithinRegions(C.x,c);if(M(C.value)){if(it(c)||!k||!P)b+=`${T&&P?"L":"M"}${p(C)},${_(C)}`;else if(P)if(k=((k==null?void 0:k.dasharray)||l).split(" ").map(Number),d=Yt($.x,z.x,C.x),h=Yt($.y,z.value,C.value),u){const F=t(C.x)-t(z.x),W=s(C.value)-s(z.value),J=Math.sqrt(Math.pow(F,2)+Math.pow(W,2));g=k[0]/J,f=g*k[1];for(let lt=g;lt<=1;lt+=f)b+=m(z,C,lt,g),lt+f>=1&&(b+=m(z,C,1,0))}else{let F=[];if(R=C.x===e[e.length-1].x,r){const $t=+z.x,bt=new Date($t),oe=new Date($t+(+C.x-$t));F=[[t(bt),s(h(0))],[t(oe),s(h(1))]]}else F=[[t(d(0)),s(h(0))],[t(d(1)),s(h(1))]];o&&F.forEach($t=>$t.reverse());const W=A(y,b),J=A(y,b+=`L${F[1].join(",")}`),lt=Qo(W-S.lastLength,J-S.lastLength,k,R);S.lastLength+=lt.length,S.dash.push(lt.dash)}}}return S.dash.length&&(!R&&S.dash.push(A(y,b)),y.remove(),v.attr("stroke-dasharray",S.dash.join(" "))),b},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-yt(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||N(t)&&t.indexOf(e.id)!==-1}};const te=()=>kt();var Ce={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:s}}=this;let i=t.point_opacity;return it(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 it(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} > .${ut.chartCircles}`).empty()&&t.select(`.${D.chart}`).append("g").attr("class",ut.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=n.targets.filter(h=>this.isScatterType(h)||this.isBubbleType(h));const d=a.main.select(`.${ut.chartCircles}`).style("pointer-events","none").selectAll(`.${ut.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,`.${ut.circles}`,["cursor:pointer"],r)(d),s.setCssRule(!0,` .${ut.circle}`,["fill","stroke"],s.color)(d)}).style("opacity",function(){return(0,w.select)(this.parentNode).attr("class").indexOf(ut.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(`.${ut.circles}`).selectAll(`.${ut.circle}`).data(l=>t.isLineType(l)&&t.shouldDrawPointsForLine(l)||t.isBubbleType(l)||t.isRadarType(l)||t.isScatterType(l)?a?[l.values[0]]:l.values:[]);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(`.${ut.circles} .${ut.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=kt(),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||it(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,w.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,w.select)(this);if(this.tagName==="circle")l.attr("r",n);else{const{width:c,height:u}=this.getBBox(),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,w.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):O(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 O(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=yt(s.event,e),n=(0,w.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}=be(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)O(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(X(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}=e.node().getBBox(),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,te()),o&&r.$T(o,n,te())),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,te())),o&&r.$T(l,n,te())),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,te()),o&&r.$T(o,n,te())),d.attr("x",c).attr("y",u).style("fill",i)}}};function sr(e){return St(e)&&O(e.create)&&O(e.update)}function ir(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(e,"image/svg+xml").documentElement,r=ot.createElementNS(w.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,w.select)(r);"innerHTML"in r?l.html(o.innerHTML):Gt(o.childNodes).forEach(c=>{n(c,l.append(c.tagName).node())})}i.$el.defs.node().appendChild(r)}var ee={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=nt(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,w.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(!sr(p||s.point_type)){const _=e.getDefsPointId(g);if(t.defs.select(`#${_}`).size()<1&&ir.bind(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 hi(e){const t=e.config.polar_level_max;let s=e.getMinMaxData().max[0].value;return t&&t>s&&(s=t),s}var nr={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",It.levels),i&&n&&e.generateTextBGColorFilter(n)},getPolarOuterRadius(e,t){var s;const i=hi(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=hi(e),o=Te(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(`.${It.level}`).data(o);u.exit().remove();const d=u.enter().append("g").attr("class",(h,g)=>`${It.level} ${It.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 ar(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 se=pt.radarPoints,gi=pt.radarTextWidth;var or={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",ss.chartRadars),i.radar.levels=i.radar.append("g").attr("class",It.levels),i.radar.axes=i.radar.append("g").attr("class",at.axis),i.radar.shapes=i.radar.append("g").attr("class",st.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;At(s.axis_x_categories)&&(s.axis_x_categories=Te(0,wt("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=Gt(e).map(d=>ar(c,d,l,t,H(s)?s:e==="x"?o:r,L(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(se)||{},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(se,n))},redrawRadar(){const e=this,{radar:t,main:s}=e.$el,i=e.getTranslate("radar");i&&(t.attr("transform",i),s.select(`.${gt.chartTexts}`).attr("transform",i),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(se);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=Te(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 Te(0,r).map(b=>e.getRadarPosition(["x","y"],b,m,1).join(",")).join(" ")}),p=c.selectAll(`.${It.level}`).data(u);p.exit().remove();const _=p.enter().append("g").attr("class",(x,m)=>`${It.level} ${It.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=>it(x)?n:f[x].split(",")[0]).attr("y",x=>it(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)=>`${at.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(gi)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){ce((0,w.select)(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){it(this.width)&&(this.width=this.getBoundingClientRect().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=>ds(h.node()).width);d.every(h=>h>0)&&e.cache.add(gi,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=it(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)}).on("mouseout",l?c:null),l||n.on("touchstart",c)},updateRadarShape(){const e=this,t=e.data.targets.filter(a=>e.isRadarType(a)),s=e.cache.get(se),i=e.$el.radar.shapes.selectAll("polygon").data(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(se)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(se)[e.id][e.index][1]}},Pt=U(14);function rr(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 lr(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 cr(e){const t=this,s=(0,Pt.hierarchy)(e).sum(n=>n.value),i=t.getSortCompareFn(!0);return[t.treemap(i?s.sort(i):s)]}var dr={initTreemap(){const e=this,{$el:t,state:{current:{width:s,height:i},clip:n,datetimeId:a}}=e;n.id=`${a}-clip`,e.treemap=(0,Pt.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(ns.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,w.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))}).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:Pt.treemapBinary,dice:Pt.treemapDice,slice:Pt.treemapSlice,sliceDice:Pt.treemapSliceDice,squarify:Pt.treemapSquarify,resquarify:Pt.treemapResquarify}[(e=i.treemap_tile)!=null?e:"binary"])!=null?t:Pt.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:lr.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:s}}=t,i=cr.call(t,t.getTreemapData(e!=null?e:t.data.targets));s.data(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,kt()).call(rr.bind(t),s.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{config:s}=t,{id:i,value:n}=e,a=s.treemap_label_format,o=t.getRatio("treemap",e),r=(o*100).toFixed(2),l=s.treemap_label_show&&t.meetsLabelThreshold(o,"treemap")?null:"0";return function(c){return c.style("opacity",l),O(a)?a.bind(t.api)(n,o,i):`${i}
|
33 | ${r}%`}}},Ht={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"},ie={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},ur={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},hr={bubble_maxR:35,bubble_zerobased:!1},gr={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"},fr={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0},pr={scatter_zerobased:!1},qe={spline_interpolation_type:"cardinal"},Ee={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},xr={donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,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},_r={funnel_neck_width:0,funnel_neck_height:0},mr={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_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},$r={pie_label_show:!0,pie_label_format:void 0,pie_label_ratio:void 0,pie_label_threshold:.05,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},yr={polar_label_show:!0,polar_label_format:void 0,polar_label_threshold:.05,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},br={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},vr={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};function ne(e,t){rt(jt.prototype,Object.values(Qs).concat(e)),rt(Mt.prototype,Eo),Vt.setOptions(Object.values(ti).concat(t||[]))}function Ot(e,t){ne([ee,Ce,er].concat(e||[])),Vt.setOptions([Ht,fr].concat(t||[]))}function ae(e,t){rt(jt.prototype,[Fo,ee].concat(e||[])),Vt.setOptions([Ht].concat(t||[]))}let fi=()=>(Ot(Qt,[ie]),(fi=()=>E.AREA)()),pi=()=>(Ot(Qt,[ie]),(pi=()=>E.AREA_LINE_RANGE)()),xi=()=>(Ot(Qt,[ie]),(xi=()=>E.AREA_STEP_RANGE)()),_i=()=>(Ot(Qt,[ie,qe]),(_i=()=>E.AREA_SPLINE)()),mi=()=>(Ot(Qt,[ie,qe]),(mi=()=>E.AREA_SPLINE_RANGE)()),$i=()=>(Ot(Qt,[ie]),($i=()=>E.AREA_STEP)()),yi=()=>(Ot(),(yi=()=>E.LINE)()),bi=()=>(Ot(void 0,[qe]),(bi=()=>E.SPLINE)()),vi=()=>(Ot(),(vi=()=>E.STEP)()),Ti=()=>(ae(void 0,[Ee,xr]),(Ti=()=>E.DONUT)()),Ai=()=>(ae([Jo],[Ee,mr]),(Ai=()=>E.GAUGE)()),wi=()=>(ae(void 0,[Ee,$r]),(wi=()=>E.PIE)()),Si=()=>(ae([nr],[Ee,yr]),(Si=()=>E.POLAR)()),Ri=()=>(ae([Qs.eventrect,Ce,or],[Ht,br,{axis_x_categories:ti.optAxis.axis_x_categories}]),(Ri=()=>E.RADAR)()),Ci=()=>(ne([Mo,ee],[ur,Ht]),(Ci=()=>E.BAR)()),Ei=()=>(ne([ee,Ce,Xo],[hr,Ht]),(Ei=()=>E.BUBBLE)()),ki=()=>(ne([Yo,ee],[gr,Ht]),(ki=()=>E.CANDLESTICK)()),Li=()=>(ne([ee,Ce],[Ht,pr]),(Li=()=>E.SCATTER)()),Pi=()=>(ae([Ko],[_r]),(Pi=()=>E.FUNNEL)()),Oi=()=>(ne([dr],[vr]),(Oi=()=>E.TREEMAP)()),Ke={};const Ii={version:"3.14.2",generate(e){const t=qt({},Ke,e),s=new Mt(t);return s.internal.charts=this.instance,this.instance.push(s),s},defaults(e){return X(e)&&(Ke=e),Ke},instance:[],plugin:{}};Object.keys(xt).forEach(e=>xt[e]()),Object.keys(I).forEach(e=>I[e]())}(),ke}()});
|