billboard.js
Version:
Re-usable easy interface JavaScript chart library, based on D3 v4+
17 lines (16 loc) • 264 kB
JavaScript
/*!
* Copyright (c) 2017 ~ present NAVER Corp.
* billboard.js project is licensed under the MIT license
*
* billboard.js, JavaScript chart library
* https://naver.github.io/billboard.js/
*
* @version 3.17.2
*/(function(gt,qt){if(typeof exports=="object"&&typeof module=="object")module.exports=qt(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"],qt);else{var xe=typeof exports=="object"?qt(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")):qt(gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3,gt.d3);for(var _e in xe)(typeof exports=="object"?exports:gt)[_e]=xe[_e]}})(this,function(ti,gt,qt,xe,_e,Vs,Ys,js,Hs,Ws,Us,Zs,qs){return(function(){"use strict";var Ks=[,,(function(D){D.exports=Hs}),(function(D){D.exports=Us}),(function(D){D.exports=gt}),(function(D){D.exports=xe}),(function(D){D.exports=qt}),(function(D){D.exports=js}),(function(D){D.exports=Zs}),(function(D){D.exports=Ws}),(function(D){D.exports=qs}),(function(D){D.exports=ti}),(function(D){D.exports=_e}),(function(D){D.exports=Ys}),(function(D){D.exports=Vs})],ei={};function U(D){var mt=ei[D];if(mt!==void 0)return mt.exports;var w=ei[D]={exports:{}};return Ks[D](w,w.exports,U),w.exports}(function(){U.d=function(D,mt){for(var w in mt)U.o(mt,w)&&!U.o(D,w)&&Object.defineProperty(D,w,{enumerable:!0,get:mt[w]})}})(),(function(){U.o=function(D,mt){return Object.prototype.hasOwnProperty.call(D,mt)}})(),(function(){U.r=function(D){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(D,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(D,"__esModule",{value:!0})}})();var Pe={};return(function(){U.r(Pe),U.d(Pe,{bb:function(){return Ns},default:function(){return Ns}});var D={};U.r(D),U.d(D,{selection:function(){return Vi},subchart:function(){return Yi},zoom:function(){return ji}});var mt={};U.r(mt),U.d(mt,{area:function(){return bs},areaLineRange:function(){return vs},areaSpline:function(){return As},areaSplineRange:function(){return ws},areaStep:function(){return Ss},areaStepRange:function(){return Ts},bar:function(){return Ds},bubble:function(){return zs},candlestick:function(){return Fs},donut:function(){return ks},funnel:function(){return Xs},gauge:function(){return Ls},line:function(){return Rs},pie:function(){return Ps},polar:function(){return Os},radar:function(){return Is},scatter:function(){return Ms},spline:function(){return Cs},step:function(){return Es},treemap:function(){return Bs}});var w=U(2),me=U(3),Js=Object.defineProperty,ii=Object.getOwnPropertySymbols,Qs=Object.prototype.hasOwnProperty,tn=Object.prototype.propertyIsEnumerable,si=(e,t,i)=>t in e?Js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Z=(e,t)=>{for(var i in t||(t={}))Qs.call(t,i)&&si(e,i,t[i]);if(ii)for(var i of ii(t))tn.call(t,i)&&si(e,i,t[i]);return e};const I={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},V={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"},$e={area:"bb-area",areas:"bb-areas"},ot={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},$t={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},kt={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},ft={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Oe={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Nt={dragarea:"bb-dragarea",INCLUDED:"_included_"},ce={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},yt={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"},Lt={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},wt={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"},Dt={level:"bb-level",levels:"bb-levels"},ni={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},de={region:"bb-region",regions:"bb-regions"},Q={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},it={shape:"bb-shape",shapes:"bb-shapes"},ai={brush:"bb-brush",subchart:"bb-subchart"},rt={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},ye={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},oi={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Ie={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var N=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({},I),V),$e),ot),$t),kt),ft),Oe),Nt),yt),Y),Lt),wt),q),ce),et),ni),de),Q),it),ai),rt),ye),oi),Ie),en={boost_useCssRule:!1,boost_useWorker:!1},sn={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},nn={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},an={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:[]},on={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},rn={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},ln={data_x:void 0,data_idConverter:e=>e,data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_groupsZeroAs:"positive",data_color:void 0,data_colors:{},data_labels:{},data_labels_backgroundColors:void 0,data_labels_colors:void 0,data_labels_position:{},data_labels_imgUrl:void 0,data_hide:!1,data_filter:void 0,data_onclick:()=>{},data_onover:()=>{},data_onout:()=>{},data_onshown:void 0,data_onhidden:void 0,data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},cn={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},be=U(4);function dn(){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 un(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",i=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",s=a=>setTimeout(a,1),n=a=>clearTimeout(a);return[t?e.requestAnimationFrame:s,t?e.cancelAnimationFrame:n,i?e.requestIdleCallback:s,i?e.cancelIdleCallback:n]}const j=dn(),lt=j==null?void 0:j.document,[hn,Vr,ri,Yr]=un(j);var gn=Object.defineProperty,li=Object.getOwnPropertySymbols,fn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,ci=(e,t,i)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,di=(e,t)=>{for(var i in t||(t={}))fn.call(t,i)&&ci(e,i,t[i]);if(li)for(var i of li(t))pn.call(t,i)&&ci(e,i,t[i]);return e};const M=e=>e||e===0,L=e=>typeof e=="function",X=e=>typeof e=="string",O=e=>typeof e=="number",st=e=>typeof e=="undefined",H=e=>typeof e!="undefined",De=e=>typeof e=="boolean",xn=e=>Math.ceil(e/10)*10,ve=e=>Math.ceil(e)+.5,Gt=e=>e[1]-e[0],Rt=e=>typeof e=="object",_n=e=>{for(const t in e)return!1;return!0},bt=e=>st(e)||e===null||X(e)&&e.length===0||Rt(e)&&!(e instanceof Date)&&_n(e)||O(e)&&isNaN(e),nt=e=>!bt(e),G=e=>Array.isArray(e),B=e=>e&&!(e!=null&&e.nodeType)&&Rt(e)&&!G(e);function zt(e,t,i){return H(e[t])?e[t]:i}function mn(e,t){let i=!1;return Object.keys(e).forEach(s=>e[s]===t&&(i=!0)),i}function K(e,t,...i){const s=L(e);return s&&e.call(t,...i),s}function Te(e,t){let i=0;const s=function(...n){!--i&&t.apply(this,...n)};"duration"in e?e.each(()=>++i).on("end",s):(++i,e.call(s))}function ze(e){return X(e)?e.replace(/<(script|img)?/ig,"<").replace(/(script)?>/ig,">"):e}function ue(e,t,i=[-1,1],s=!1){if(!(!e||!X(t)))if(t.indexOf(`
`)===-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(`
`),o=s?a.length-1:1;e.html(""),a.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?i[0]*o:i[1]}em`).text(r)})}}}function ui(e){const{x:t,y:i,width:s,height:n}=e.getBBox();return[{x:t,y:i+n},{x:t,y:i},{x:t+s,y:i},{x:t+s,y:i+n}]}function hi(e){const{width:t,height:i}=ct(e),s=ui(e),n=s[0].x,a=Math.min(s[0].y,s[1].y);return{x:n,y:a,width:t,height:i}}function vt(e,t){var i;const s=e&&((i=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:i[0]);let n=[0,0];try{n=(0,w.pointer)(s||e,t)}catch(a){}return n.map(a=>isNaN(a)?0:a)}function gi(e){const{event:t,$el:i}=e,s=i.subchart.main||i.main;let n;return t&&t.type==="brush"?n=t.selection:s&&(n=s.select(".bb-brush").node())&&(n=(0,be.brushSelection)(n)),n}function fi(e,t,i=!1){const s=n=>n[e?"getBoundingClientRect":"getBBox"]();return i?s(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=s(t):t.rect}function ct(e,t=!1){return fi(!0,e,t)}function Kt(e,t=!1){return fi(!1,e,t)}function Ct(e=!0,t=0,i=1e4){const s=j.crypto||j.msCrypto,n=s?t+s.getRandomValues(new Uint32Array(1))[0]%(i-t+1):Math.floor(Math.random()*(i-t)+t);return e?String(n):n}function Fe(e,t,i,s,n){if(i>s)return-1;const a=Math.floor((i+s)/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?Fe(e,t,i,a-1,n):Fe(e,t,a+1,s,n)}function pi(e){const t=gi(e);return t?t[0]===t[1]:!0}function $n(...e){const t=i=>{if(B(i)&&i.constructor){const s=new i.constructor;for(const n in i)s[n]=t(i[n]);return s}return i};return e.map(i=>t(i)).reduce((i,s)=>di(di({},i),s))}function dt(e={},t){G(t)&&t.forEach(i=>dt(e,i));for(const i in t)/^\d+$/.test(i)||i in e||(e[i]=t[i]);return e}const pt=e=>e.charAt(0).toUpperCase()+e.slice(1);function yn(e,t="-"){return e.split(t).map((i,s)=>s?i.charAt(0).toUpperCase()+i.slice(1).toLowerCase():i.toLowerCase()).join("")}const Vt=e=>[].slice.call(e);function bn(e,t,i){const{rootSelector:s="",sheet:n}=e,o=`${s} ${(r=>r.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${i.join(";")}}`;return n[n.insertRule?"insertRule":"addRule"](o,n.cssRules.length)}function vn(e){let t=[];return e.forEach(i=>{var s;try{i.cssRules&&i.cssRules.length&&(t=t.concat(Vt(i.cssRules)))}catch(n){(s=j.console)==null||s.warn(`Error while reading rules from ${i.href}: ${n.toString()}`)}}),t}function xi(e){var t,i,s,n,a,o;return{x:((i=(t=j.pageXOffset)!=null?t:j.scrollX)!=null?i:0)+((s=e.scrollLeft)!=null?s:0),y:((a=(n=j.pageYOffset)!=null?n:j.scrollY)!=null?a:0)+((o=e.scrollTop)!=null?o:0)}}function Ae(e,t=0,i=0,s=!0){const n=new DOMPoint(t,i),a=e.getScreenCTM(),o=n.matrixTransform(s?a==null?void 0:a.inverse():a);if(s===!1){const r=ct(e);o.x-=r.x,o.y-=r.y}return o}function _i(e){const t=e?e.transform:null,i=t&&t.baseVal;return i&&i.numberOfItems?i.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Me(e){const t=e[0]instanceof Date,i=(t?e.map(Number):e).filter((s,n,a)=>a.indexOf(s)===n);return t?i.map(s=>new Date(s)):i}function mi(e){return e&&e.length?e.reduce((t,i)=>t.concat(i)):[]}function Jt(e,...t){if(!t.length||t.length===1&&!t[0])return e;const i=t.shift();return B(e)&&B(i)&&Object.keys(i).forEach(s=>{if(!/^(__proto__|constructor|prototype)$/i.test(s)){const n=i[s];B(n)?(!e[s]&&(e[s]={}),e[s]=Jt(e[s],n)):e[s]=G(n)?n.concat():n}}),Jt(e,...t)}function Qt(e,t=!0){let i;return e[0]instanceof Date?i=t?(s,n)=>s-n:(s,n)=>n-s:t&&!e.every(isNaN)?i=(s,n)=>s-n:t||(i=(s,n)=>s>n&&-1||s<n&&1||s===n&&0),e.concat().sort(i)}function St(e,t){let i=t.filter(s=>nt(s));return i.length?O(i[0])?i=Math[e](...i):i[0]instanceof Date&&(i=Qt(i,e==="min")[0]):i=void 0,i}const we=(e,t,i=1)=>{const s=[],n=Math.max(0,Math.ceil((t-e)/i))|0;for(let a=e;a<n;a++)s.push(e+a*i);return s},Tn={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,i,s=e())=>{t.dispatchEvent(new MouseEvent(i,s))}}catch(t){return(i,s,n=e())=>{const a=lt.createEvent("MouseEvent");a.initMouseEvent(s,n.bubbles,n.cancelable,j,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),i.dispatchEvent(a)}}})(),touch:(e,t,i)=>{const s=new Touch(Jt({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},i));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[s],targetTouches:[],changedTouches:[s]}))}};function he(e,t){let i=e;for(const s in t)i=i.replace(new RegExp(`{=${s}}`,"g"),t[s]);return i}function Tt(e){var t;let i;if(e instanceof Date)i=e;else if(X(e)){const{config:s,format:n}=this;i=(t=n.dataTime(s.data_xFormat)(e))!=null?t:new Date(e)}else O(e)&&!isNaN(e)&&(i=new Date(+e));return(!i||isNaN(+i))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),i}function Xe(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function An(e,t,i=!1){const s=!!e.node;let n=!1;for(const[a,o]of Object.entries(t))if(n=s?e.style(a)===o:e.style[a]===o,i===!1&&n)break;return n}function ge(){var e,t;return((e=lt)==null?void 0:e.hidden)===!1||((t=lt)==null?void 0:t.visibilityState)==="visible"}function wn(e,t){const{DocumentTouch:i,matchMedia:s,navigator:n}=j,a=s==null?void 0:s("(pointer:coarse)").matches;let o=!1;if(t)if(n&&"maxTouchPoints"in n)o=n.maxTouchPoints>0;else if("ontouchmove"in j||i&< instanceof i)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&&(s==null?void 0:s("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function $i(e,t){t()===!1?hn(()=>$i(e,t)):e()}function Sn(e){if(B(e)&&!X(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(X(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[i,s=i,n=i,a=s]=t;return{top:i,right:s,bottom:n,left:a}}var Rn=Object.defineProperty,yi=Object.getOwnPropertySymbols,Cn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,Be=(e,t,i)=>t in e?Rn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,bi=(e,t)=>{for(var i in t||(t={}))Cn.call(t,i)&&Be(e,i,t[i]);if(yi)for(var i of yi(t))En.call(t,i)&&Be(e,i,t[i]);return e},kn=(e,t,i)=>Be(e,typeof t!="symbol"?t+"":t,i);const vi=class Gs{static setOptions(t){this.data=t.reduce((i,s)=>bi(bi({},i),s),this.data)}constructor(){return $n(an,en,ln,sn,cn,nn,on,rn,Gs.data)}};kn(vi,"data",{});let Yt=vi;class Ln{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 Pn{constructor(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasFunnel:!1,hasRadar:!1,hasTreemap:!1,cssRule:{},current:{domain:void 0,width:0,height:0,dataMax:0,maxTickSize:{x:{width:0,height:0,ticks:[],clipPath:0,domain:""},y:{width:0,height:0,domain:""},y2:{width:0,height:0,domain:""}},types:[],needle:void 0,zoomDomain:null},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,eventReceiver:{currentIdx:-1,rect:{},data:[],coords:[]},axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},event:null,dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,redrawing:!1,resizing:!1,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:[],hiddenLegendIds:[],focusedTargetIds:[],defocusedTargetIds:[],radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null}}}}const Ti={element:Ln,state:Pn};class On{constructor(){Object.keys(Ti).forEach(t=>{this[t]=new Ti[t]})}getStore(t){return this[t]}}var In=Object.defineProperty,Dn=(e,t,i)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,zn=(e,t,i)=>Dn(e,typeof t!="symbol"?t+"":t,i);const _t={bubbleBaseLength:"$baseLength",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",legendItemTextBox:"legendItemTextBox",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect"};class Fn{constructor(){zn(this,"cache",{})}add(t,i,s=!1){return this.cache[t]=s?this.cloneTarget(i):i,this.cache[t]}remove(t){(X(t)?[t]:t).forEach(i=>delete this.cache[i])}get(t,i=!1){if(i&&Array.isArray(t)){const s=[];for(let n=0,a;a=t[n];n++)a in this.cache&&s.push(this.cloneTarget(this.cache[a]));return s}else{const s=this.cache[t];return M(s)?s:null}}reset(t){const i=this;for(const s in i.cache)(t||/^\$/.test(s))&&(i.cache[s]=null)}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(i=>({x:i.x,value:i.value,id:i.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"},Ne={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"},Ft={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 Mn(e){const t=e,{config:i}=t;let s="";if(bt(i.data_type||i.data_types)&&!t[Ne.LINE])s="line";else for(const n in Ne){const a=E[n];if(t.hasType(a)&&!t[Ne[n]]){s=a;break}}s&&Xn(`Please, make sure if %c${yn(s)}`,"module has been imported and specified correctly.","https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality")}function Xn(e,t,i){var s;const n="[billboard.js]";if((s=j.console)==null?void 0:s.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),i&&console.info("%c\u2139\uFE0F","font-size:15px",i)}throw Error(`${n} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const{setTimeout:Bn,clearTimeout:Nn}=j;function Gn(e){const t=[];let i;const s=function(){s.clear(),e===!1?ri(()=>{t.forEach(n=>n())},{timeout:200}):i=Bn(()=>{t.forEach(n=>n())},O(e)?e:200)};return s.clear=()=>{i&&(Nn(i),i=null)},s.add=n=>t.push(n),s.remove=n=>t.splice(t.indexOf(n),1),s}function Ai(){let e=[];const t=function(i,s){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(ge()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}$i(()=>{s==null||s()},n)};return t.add=function(i){G(i)?e=e.concat(i):e.push(i)},t}const Ge={};function Vn(e,t){var i;const s=e.toString(),n=s.replace(/(function|[\s\W\n])/g,"").substring(0,15);return n in Ge||(Ge[n]=new j.Blob([`${(i=t==null?void 0:t.map(String).join(";"))!=null?i:""}
self.onmessage=function({data}) {
const result = (${s}).apply(null, data);
self.postMessage(result);
};`],{type:"text/javascript"})),j.URL.createObjectURL(Ge[n])}function Yn(e){const t=new j.Worker(e);return t.onerror=function(i){console.error?console.error(i):console.log(i)},t}function Ve(e=!0,t,i,s){let n=function(...a){const o=t(...a);i(o)};if(j.Worker&&e){const a=Vn(t,s),o=Yn(a);n=function(...r){o.postMessage(r),o.onmessage=function(l){return j.URL.revokeObjectURL(a),i(l.data)}}}return n}var Se=U(5);function Ye(e){const t=[];return e.forEach(function(i,s){const n=i[0];i.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 (${s}, ${o})!`);t[o-1][n]=a}})}),t}function je(e){const t=e[0],i=[];return e.forEach(function(s,n){if(n>0){const a={};s.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${n}, ${r})!`);a[t[r]]=o}),i.push(a)}}),i}function wi(e,t){const i=[];let s,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?s=t.value.concat(t.x):s=t.value,i.push(s),e.forEach(function(o){const r=s.map(function(l){let c=a(o,l);return typeof c=="undefined"&&(c=null),c});i.push(r)}),n=je(i)}else Object.keys(e).forEach(function(a){var o;const r=e[a].concat();(o=r.unshift)==null||o.call(r,a),i.push(r)}),n=Ye(i);return n}function jn(e,t="csv",i,s,n){const a=new XMLHttpRequest,o={csv:Hn,tsv:Wn,json:wi};a.open("GET",e),i&&Object.keys(i).forEach(function(r){a.setRequestHeader(r,i[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,s))}else throw new Error(`${e}: Something went wrong loading!`)},a.send()}function Si(e,t){const i=e.rows(t);let s;return i.length===1?(s=[{}],i[0].forEach(n=>{s[0][n]=null})):s=e.parse(t),s}function Hn(e){return Si({rows:Se.csvParseRows,parse:Se.csvParse},e)}function Wn(e){return Si({rows:Se.tsvParseRows,parse:Se.tsvParse},e)}function Ri(e,t){const i=e||(t==null?void 0:t.data_keys);return i!=null&&i.x&&(t.data_x=i.x),i}function Un(e,t,i){const s=this,{config:n}=s;let a;e.forEach(o=>{const r=s.getXKey(o);if(i.customX||i.timeSeries?i.xs.indexOf(r)>=0?a=(i.appendXs&&s.data.xs[o]||[]).concat(t.map((l,c)=>{const u=M(l[r]);return u?s.generateTargetX(u,o,c):!1}).filter(l=>l!==!1)):n.data_x?a=this.getOtherTargetXs():nt(n.data_xs)&&(a=s.getXValuesOfXKey(r,s.data.targets)):a=t.map((l,c)=>c),a)s.data.xs[o]=a;else throw new Error(`x is not defined for id = "${o}".`)})}var Zn={convertData(e,t){const{config:i}=this,s=a=>a!=null&&a.length&&!bt(a[0])?i.boost_useWorker:!1;let n=e;if(e.bindto&&(n={},["url","mimeType","headers","keys","json","keys","rows","columns"].forEach(a=>{const o=`data_${a}`;o in e&&(n[a]=e[o])})),n.url&&t)jn(n.url,n.mimeType,n.headers,Ri(n.keys,i),t);else if(n.json)Ve(s(n.json),wi,t,[Ye,je])(n.json,Ri(n.keys,i));else if(n.rows)Ve(s(n.rows),je,t)(n.rows);else if(n.columns)Ve(s(n.columns),Ye,t)(n.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const i=this,{axis:s,config:n,state:a}=i,o=n.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((h,g)=>(i.isX.call(i,g)?h.xs.push(g):i.isNotX.call(i,g)&&h.ids.push(g),h),{ids:[],xs:[]}):{ids:[],xs:[]},u={appendXs:t,xs:c,idConverter:n.data_idConverter.bind(i.api),categorized:s==null?void 0:s.isCategorized(),timeSeries:s==null?void 0:s.isTimeSeries(),customX:s==null?void 0:s.isCustomX()};Un.bind(i)(l,e,u);const d=l.map((h,g)=>{const f=n.data_idConverter.bind(i.api)(h),p=i.getXKey(h),_=u.customX&&u.categorized,x=_&&(()=>{const b=new Set(n.axis_x_categories);return e.every(v=>b.has(v.x))})(),m=e.__append__,$=p===null&&m?i.api.data.values(h).length:0;return{id:f,id_org:h,values:e.map((b,v)=>{const y=b[p];let T=b[h],C;return T=T!==null&&!isNaN(T)&&!B(T)?+T:G(T)||B(T)?T:null,(_||a.hasRadar)&&g===0&&!st(y)?(!x&&g===0&&v===0&&!m&&(n.axis_x_categories=[]),C=n.axis_x_categories.indexOf(y),C===-1&&(C=n.axis_x_categories.length,n.axis_x_categories.push(y))):C=i.generateTargetX(y,h,$+v),(st(T)||i.data.xs[h].length<=v)&&(C=void 0),{x:C,value:T,id:f,index:-1}}).filter(b=>H(b.x))}});if(d.forEach(h=>{var g;n.data_xSort&&(h.values=h.values.sort((f,p)=>{const _=f.x||f.x===0?f.x:1/0,x=p.x||p.x===0?p.x:1/0;return _-x})),h.values.forEach((f,p)=>f.index=p),(g=i.data.xs[h.id])==null||g.sort((f,p)=>f-p)}),a.hasNegativeValue=i.hasNegativeValueInTargets(d),a.hasPositiveValue=i.hasPositiveValueInTargets(d),o&&i.isValidChartType(o)){const h=i.mapToIds(d).filter(g=>!(g in n.data_types)||!i.isValidChartType(n.data_types[g]));i.setTargetType(h,o)}return d.forEach(h=>i.cache.add(h.id_org,h,!0)),d}},qn={isX(e){const t=this,{config:i}=t,s=i.data_x&&e===i.data_x,n=nt(i.data_xs)&&mn(i.data_xs,e);return s||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(i=>i.indexOf(e)>=0&&i.length>1):t.length>0},getXKey(e){const t=this,{config:i}=t;return i.data_x?i.data_x:nt(i.data_xs)?i.data_xs[e]:null},getXValuesOfXKey(e,t){const i=this,s=t&&nt(t)?i.mapToIds(t):[];let n;return s.forEach(a=>{i.getXKey(a)===e&&(n=i.data.xs[a])}),n},getIndexByX(e,t){const i=this;return t?t.indexOf(X(e)?e:+e):(i.filterByX(i.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const i=this;return e in i.data.xs&&i.data.xs[e]&&M(i.data.xs[e][t])?i.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:i}=t;Object.keys(e).forEach(s=>{i.data_xs[s]=e[s]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(nt(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:i}=t;let s;return e&&(s=i.data_names[e.id],e.name=s!==void 0?s:e.id),e},getAllValuesOnIndex(e,t=!1){const i=this;let s=i.filterTargetsToShow(i.data.targets).map(n=>i.addName(i.getValueOnIndex(n.values,e)));return t&&(s=s.filter(n=>n&&"value"in n&&M(n.value))),s},getValueOnIndex(e,t){const i=e.filter(s=>s.index===t);return i.length?i[0]:null},updateTargetX(e,t){const i=this;e.forEach(s=>{s.values.forEach((n,a)=>{n.x=i.generateTargetX(t[a],s.id,a)}),i.data.xs[s.id]=t})},updateTargetXs(e,t){const i=this;e.forEach(s=>{t[s.id]&&i.updateTargetX([s],t[s.id])})},generateTargetX(e,t,i){const s=this,{axis:n}=s;let a=n!=null&&n.isCategorized()?i:e||i;if(n!=null&&n.isTimeSeries()){const o=Tt.bind(s);a=o(e||s.getXValue(t,i))}else n!=null&&n.isCustomX()&&!(n!=null&&n.isCategorized())&&(a=M(e)?+e:s.getXValue(t,i));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:i}=t.state;let{value:s}=e;return s&&i&&(t.isAreaRangeType(e)?s=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(s=t.getBubbleZData(s,"y"))),s},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let i,s;return(e||this.data.targets.map(n=>n.values)).forEach((n,a)=>{const o=n.map(t).filter(O);i=Math.min(a?i:1/0,...o),s=Math.max(a?s:-1/0,...o)}),{min:i,max:s}},getMinMaxData(){const e=this,t=_t.dataMinMax;let i=e.cache.get(t);if(!i){const s=e.data.targets.map(c=>c.values),n=e.getMinMaxValue(s);let a=[],o=[];const{min:r,max:l}=n;s.forEach(c=>{const u=e.getFilteredDataByValue(c,r),d=e.getFilteredDataByValue(c,l);u.length&&(a=a.concat(u)),d.length&&(o=o.concat(d))}),e.cache.add(t,i={min:a,max:o})}return i},getTotalPerIndex(){const e=this,t=_t.dataTotalPerIndex;let i=e.cache.get(t);return(e.config.data_groups.length||e.isStackNormalized())&&!i&&(i=[],e.data.targets.forEach(s=>{s.values.forEach((n,a)=>{i[a]||(i[a]=0),i[a]+=~~n.value})})),i},getTotalDataSum(e){const t=this,i=_t.dataTotalSum;let s=t.cache.get(i);return O(s)||(s=t.data.targets.reduce((n,a)=>n+a.values.reduce((o,r)=>o+~~r.value,0),0),t.cache.add(i,s)),e&&(s-=t.getHiddenTotalDataSum()),s},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:i}}=e;let s=0;return i.length&&(s=t.data.values.bind(t)(i).reduce((n,a)=>n+a)),s},getFilteredDataByValue(e,t){return e.filter(i=>this.getBaseValue(i)===t)},getMaxDataCount(){return Math.max(...this.data.targets.map(e=>e.values.length),0)},getMaxDataCountTarget(){let e=this.filterTargetsToShow()||[];const t=e.length,i=this.config.axis_x_inverted;return t>1?(e=e.map(s=>s.values).reduce((s,n)=>s.concat(n)).map(s=>s.x),e=Qt(Me(e)).map((s,n,a)=>({x:s,index:i?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?G(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const i=this.mapToIds(e);for(let s=0,n;n=i[s];s++)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(i=>t.isTargetToShow(i.id))},mapTargetsToUniqueXs(e){const t=this,{axis:i}=t;let s=[];return e!=null&&e.length&&(s=Me(mi(e.map(n=>n.values.map(a=>+a.x)))),s=i!=null&&i.isTimeSeries()?s.map(n=>new Date(+n)):s.map(Number)),Qt(s)},addTargetIds(e,t){const{state:i}=this;(G(t)?t:[t]).forEach(n=>{i[e].indexOf(n)<0&&i[e].push(n)})},removeTargetIds(e,t){const{state:i}=this;(G(t)?t:[t]).forEach(n=>{const a=i[e].indexOf(n);a>=0&&i[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:i}=t.state,s={},n=t.isMultipleX(),a=n?t.mapTargetsToUniqueXs(e).map(o=>X(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=G(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),G(c)?r.push(...c):B(c)&&"high"in c?r.push(...Object.values(c)):t.isBubbleZType(l)?r.push(i&&t.getBubbleZData(c,"y")):n?r[t.getIndexByX(l.x,a)]=c:r.push(c)}),s[o.id]=r}),s},checkValueInTargets(e,t){return Object.keys(e).some(i=>e[i].values.some(s=>t(s.value)))},hasMultiTargets(){return this.filterTargetsToShow().length>1},hasNegativeValueInTargets(e){return this.checkValueInTargets(e,t=>t<0)},hasPositiveValueInTargets(e){return this.checkValueInTargets(e,t=>t>0)},orderTargets(e){const t=this,i=[...e],s=t.getSortCompareFn();return s&&i.sort(s),i},getSortCompareFn(e=!1){const t=this,{config:i}=t,s=i.data_order,n=/asc/i.test(s),a=/desc/i.test(s);let o;if(n||a){const r=(c,u)=>c+Math.abs(u.value),l=c=>O(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 L(s)&&(o=s.bind(t.api));return o||null},filterByX(e,t){return mi(e.map(i=>i.values)).filter(i=>i.x-t===0)},filterNullish(e){const t=i=>M(i.value);return e&&e.filter(i=>"value"in i?t(i):i.values.some(t))},filterRemoveNull(e){return e.filter(t=>M(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(i=>({id:i.id,id_org:i.id_org,values:i.values.filter(s=>t[0]<=s.x&&s.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return De(e)&&e||Rt(e)&&nt(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:i,config:s,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=s.axis_rotated,u=xi(i.chart.node()),d=a==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?d.clientY+u.y:d.clientX+u.x;if(Xe(i.svg)){const g=[h,0];c&&g.reverse(),h=Ae(i.eventRect.node(),...g)[c?"y":"x"]}else h-=c?r.top:r.left;l=Fe(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,i){var s;const n=this,a=1.3;return((s=n.getTextRect([e,t].map(o=>n.dataLabelFormat()(o))))==null?void 0:s.map(o=>o[i]*a))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const i=e[t].x,s=[];let n;for(n=t-1;n>=0&&i===e[n].x;n--)s.push(e[n]);for(n=t;n<e.length&&i===e[n].x;n++)s.push(e[n]);return s},findClosestFromTargets(e,t){const i=this,s=e.map(n=>i.findClosest(n.values,t));return i.findClosest(s,t)},findClosest(e,t){const i=this,{$el:{main:s}}=i,n=e.filter(r=>r&&M(r.value));let a,o;return n.filter(r=>i.isBarType(r.id)||i.isCandlestickType(r.id)).forEach(r=>{const l=i.isBarType(r.id)?`.${$t.chartBar}.${I.target}${i.getTargetSelectorSuffix(r.id)} .${$t.bar}-${r.index}`:`.${kt.chartCandlestick}.${I.target}${i.getTargetSelectorSuffix(r.id)} .${kt.candlestick}-${r.index} path`;!o&&i.isWithinBar(s.select(l).node())&&(o=r)}),n.filter(r=>!i.isBarType(r.id)&&!i.isCandlestickType(r.id)).forEach(r=>{const l=i.dist(r,t);a=i.getPointSensitivity(r),l<a&&(a=l,o=r)}),o},dist(e,t){const i=this,{config:{axis_rotated:s},scale:n}=i,a=+s,o=+!s,r=i.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:i,config:s}=t,n=s.line_step_type,a=i?i.isCategorized():!1,o=G(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=G(e)?e.concat():[e],i=[];return t.forEach(s=>{const{x:n,id:a}=s;i.push({x:n,id:a,value:s.value[0]}),i.push({x:n,id:a,value:s.value[2]})}),i},updateDataAttributes(e,t){const i=this,{config:s}=i,n=s[`data_${e}`];return st(t)||(Object.keys(t).forEach(a=>{n[a]=t[a]}),i.redraw({withLegend:!0})),n},getRangedData(e,t="",i="areaRange"){const s=e==null?void 0:e.value;if(G(s)){if(i==="bar")return s.reduce((n,a)=>a-n);{const n={areaRange:["high","mid","low"],candlestick:["open","high","low","close","volume"]}[i].indexOf(t);return n>=0&&s?s[n]:void 0}}else if(s&&t)return s[t];return s},setRatioForGroupedData(e){const t=this,{config:i}=t;if(i.data_groups.length&&e.some(s=>t.isGrouped(s.id))){const s=n=>t.getRatio("index",n,!0);e.forEach(n=>{"values"in n?n.values.forEach(s):s(n)})}},getRatio(e,t,i=!1){const s=this,{config:n,state:a}=s,o=s.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(s.pie.padAngle()())r=t.value/s.getTotalDataSum(!0);else{const l=n.gauge_fullCircle?s.getArcLength():s.getStartingAngle()*-2,c=s.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)=>~~f+g[p])),c=c.map((h,g)=>h-d[g]))}const u=c[t.index];t.ratio=O(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=s.getYScaleById.bind(s)(t.id).domain().reduce((u,d)=>d-u);r=c===0?0:Math.abs(s.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=s.getTotalDataSum(!0));return i&&r?r*100:r},updateDataIndexByX(e){const t=this,i=e.reduce((s,n,a)=>(s[Number(n.x)]=a,s),{});t.data.targets.forEach(s=>{s.values.forEach((n,a)=>{let o=i[Number(n.x)];o===void 0&&(o=a),n.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(B(e.value)&&("z"in e.value||"y"in e.value)||G(e.value)&&e.value.length>=2)},isBarRangeType(e){const t=this,{value:i}=e;return t.isBarType(e)&&G(i)&&i.length>=2&&i.every(O)},getDataById(e){var t;const i=this.cache.get(e)||this.api.data(e);return(t=i==null?void 0:i[0])!=null?t:i}};function Ci(e,t=!1){const i=this,{api:s}=i;t&&i.api.flush(!0),e==null||e.call(s)}var Kn={load(e,t){const i=this,{axis:s,data:n,org:a,scale:o}=i,{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;i.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)),i.updateTargets(n.targets),o.zoom&&(l.x=s.isCategorized()?o.x.orgScale():(a.xScale||o.x).copy(),l.domain=i.getXDomain(n.targets),l.x.domain(l.domain),l.currentDomain=i.zoom.getDomain(),i.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,i.$el.eventRect.property("__zoom",null))),i.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(a.xDomain=l.domain,a.xScale=l.x,s.isCategorized()&&(l.currentDomain=i.getZoomDomainValue(l.currentDomain),a.xDomain=i.getZoomDomainValue(a.xDomain),a.xScale=l.x.domain(a.xDomain)),i.updateCurrentZoomTransform(l.x,l.currentDomain)):a.xScale&&a.xScale.domain(a.xDomain),i.updateTypesElements(),Ci.call(i,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(),t.convertData(e,i=>{const s=e.data||i;e.append&&(s.__append__=!0),s&&t.load(t.convertDataToTargets.call(t,s),e)}))},unload(e,t){var i;const s=this,{state:n,$el:a,$T:o}=s,r=!!((i=s.hasLegendDefsPoint)!=null&&i.call(s));let l=t,c=e;if(s.cache.reset(),l||(l=()=>{}),c=c.filter(d=>s.hasTarget(s.data.targets,d)),!c||c.length===0){l();return}const u=a.svg.selectAll(c.map(d=>s.selectorTarget(d)));o(u).style("opacity","0").remove().call(Te,l),c.forEach(d=>{var h;const g=s.getTargetSelectorSuffix(d);n.withoutFadeIn[d]=!1,a.legend&&a.legend.selectAll(`.${Y.legendItem}${g}`).remove(),s.data.targets=s.data.targets.filter(f=>f.id!==d),r&&((h=a.defs)==null||h.select(`#${s.getDefsPointId(g)}`).remove())}),n.hasFunnel&&s.updateFunnel(s.data.targets),n.hasTreemap&&s.updateTargetsForTreemap(s.data.targets),s.updateTypesElements()}},Ei=U(6),Jn={setExpand(e,t,i){const s=this,{config:n,$el:{circle:a}}=s;a&&n.point_focus_expand_enabled&&s.expandCircles(e,t,i),s.expandBarTypeShapes(!0,e,t,i)},expandBarTypeShapes(e=!0,t,i,s){const n=this;["bar","candlestick"].filter(a=>n.$el[a]).forEach(a=>{s&&n.$el[a].classed(I.EXPANDED,!1),n.getShapeByIndex(a,t,i).classed(I.EXPANDED,e)})},setOverOut(e,t){const i=this,{config:s,state:{hasFunnel:n,hasRadar:a,hasTreemap:o},$el:{main:r}}=i,l=B(t);if(l||t!==-1){const c=s[e?"data_onover":"data_onout"].bind(i.api);if(s.color_onover&&i.setOverColor(e,t,l),l){const u=i.getTargetSelectorSuffix(t.id),d=n||o?`${I.target+u} .${it.shape}`:V.arc+u;c(t,r.select(`.${d}`).node())}else if(s.tooltip_grouped)e&&(a&&i.isPointFocusOnly()?i.showCircleFocus(i.getAllValuesOnIndex(t,!0)):i.setExpand(t,null,!0)),!i.isMultipleX()&&r.selectAll(`.${it.shape}-${t}`).each(function(u){c(u,this)});else{const u=i.cache.get(_t.setOverOut)||[],d=r.selectAll(`.${it.shape}-${t}`).filter(function(g){return i.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();s.data_onout.bind(i.api)((0,w.select)(g).datum(),g)}h.each(function(){e&&(c((0,w.select)(this).datum(),this),u.push(this))}),i.cache.add(_t.setOverOut,u)}}},callOverOutForTouch(e){const t=this,i=t.cache.get(_t.callOverOutForTouch);(B(e)&&i?e.id!==i.id:e!==i)&&((i||O(i))&&t.setOverOut(!1,i),(e||O(e))&&t.setOverOut(!0,e),t.cache.add(_t.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:i}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,Ei.drag)().on("drag",function(s){i.event=s,e.drag(vt(s,this))}).on("start",function(s){i.event=s,e.dragstart(vt(s,this))}).on("end",s=>{i.event=s,e.dragend()}):()=>{}},dispatchEvent(e,t,i){var s,n,a;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:u,hasRadar:d,hasTreemap:h},$el:{eventRect:g,funnel:f,radar:p,svg:_,treemap:x}}=o;let m=(a=(n=(u||h)&&l.rect||d&&p.axes.select(`.${ot.axis}-${t} text`)||g||((s=o.getArcElementByIdOrIndex)==null?void 0:s.call(o,t)))==null?void 0:n.node)==null?void 0:a.call(n);if(m){const $=o.isMultipleX(),b=r.axis_rotated;let{width:v,left:y,top:T}=ct(m);if(c&&!d&&!$){const R=l.coords[t];R?(v=R.w,y+=R.x,T+=R.y):(v=0,y=0,T=0)}let C=y+(i?i[0]:0)+($||b?0:v/2),A=T+(i?i[1]:0)+(b?4:0);if(Xe(_)){const R=Ae(o.$el.eventRect.node(),C,A,!1);C=R.x,A=R.y}const S={screenX:C,screenY:A,clientX:C,clientY:A,bubbles:d};(u||h)&&(m=(f!=null?f:x).node()),Tn[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,S)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{eventRect:t,zoomResetBtn:i}}=e;t==null||t.on(".zoom wheel.zoom .drag",null),i==null||i.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:i,eventRect:s,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,s,a==null?void 0:a.list,l==null?void 0:l.getSelection(),i==null?void 0:i.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)}},Qn={categoryName(e){var t;const{axis_x_categories:i}=this.config;return(t=i==null?void 0:i[e])!=null?t:e}},ta={generateClass(e,t){return` ${e} ${e+this.getTargetSelectorSuffix(t)}`},getClass(e,t){const i=/s$/.test(e),s=/^(area|arc|line|funnel|treemap)s?$/.test(e),n=i?"id":"index";return a=>{const o=a.data||a;return((t?this.generateClass(N[i?"shapes":"shape"],o[n]):"")+this.generateClass(N[e],o[s?"id":n])).trim()}},getChartClass(e){return t=>N[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],i=[];return function(s){var n;const a=s.id||((n=s.data)==null?void 0:n.id)||s;return i.indexOf(a)<0&&i.push(a),t[i.indexOf(a)%t.length]}},classRegion(e,t){return`${this.generateClass(N.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let i="";return t&&(i=` ${N.target}-${t}`),this.generateClass(N.target,e)+i},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.indexOf(e.id)>=0?N.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.indexOf(e.id)>=0?N.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-")},selectorTarget(e,t="",i=""){const s=this.getTargetSelectorSuffix(e);return`${t}.${N.target+s} ${i}, ${t}.${N.circles+s} ${i}`},selectorTargets(e,t){const i=e||[];return i.length?i.map(s=>this.selectorTarget(s,t)):null},selectorLegend(e){return`.${N.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}},Mt=U(7);const ea=(e,t,i)=>{const s=(0,w.select)(e.cloneNode(!0));return s.attr("id",i).insert("rect",":first-child").attr("width",s.attr("width")).attr("height",s.attr("height")).style("fill",t),{id:i,node:s.node()}};function ia(e){const t=_t.colorPattern,{body:i}=lt;let s=i[t];if(!s){const a=e.classed(Oe.colorPattern,!0).style("background-image");e.classed(Oe.colorPattern,!1),a.indexOf(";")>-1&&(s=a.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),i[t]=s)}return s}const sa=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var na={generateColor(){const e=this,{$el:t,config:i}=e,s=[];let n=nt(i.color_pattern)?i.color_pattern:(0,Mt.scaleOrdinal)(ia(t.chart)||sa).range();const a=n;if(L(i.color_tiles)){const o=i.color_tiles.bind(e.api)(),r=n.map((l,c)=>{const u=l.replace(/[#\(\)\s,]/g,""),d=`${e.state.datetimeId}-pattern-${u}-${c}`;return ea(o[c%o.length],l,d)});n=r.map(l=>`url(#${l.id})`),e.patterns=r}return function(o){var r;const l=i.data_colors,c=i.data_color,u=o.id||((r=o.data)==null?void 0:r.id)||o,d=e.isTypeOf(u,["line","spline","step"])||!i.data_types[u];let h;return L(l[u])?h=l[u].bind(e.api)(o):l[u]?h=l[u]:(s.indexOf(u)<0&&s.push(u),h=d?a[s.indexOf(u)%a.length]:n[s.indexOf(u)%n.length],l[u]=h),L(c)?c.bind(e.api)(h,o):h}},generateLevelColor(){const e=this,{config:t}=e,i=t.color_pattern,s=t.color_threshold,n=s.unit==="value",a=s.max||100,o=s.values&&s.values.length?s.values:[];return nt(s)?function(r){const l=n?r:r*100/a;let c=i[i.length-1];for(let u=0,d=o.length;u<d;u++)if(l<=o[u]){c=i[u];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const i=this,{$el:{defs:s},state:n}=i;if(e){let a=[];X(e)?a.push(""):B(e)?a=Object.keys(e):L(e)&&(a=i.mapToTargetIds()),a.forEach(o=>{const r=`${n.datetimeId}-labels-bg${i.getTargetSelectorSuffix(o)}${X(e)?i.getTargetSelectorSuffix(e):""}`,l=o===""?e:(e==null?void 0:e[o])||"";s.select(`#${r}`).empty()&&s.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r).html(`<feFlood flood-color="${l}" />
<feComposite in="SourceGraphic" />`)})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:i},state:{datetimeId:s},$el:{defs:n}}=e;i.forEach(a=>{const o=`${s}-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"