katucharts.js 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +106 -0
- package/README.md +1100 -0
- package/dist/__vite-optional-peer-dep_jspdf_katucharts-BDMct_Gn.js +4 -0
- package/dist/accessibility/A11yModule.d.ts +26 -0
- package/dist/axis/Axis.d.ts +140 -0
- package/dist/axis/AxisCoordinator.d.ts +38 -0
- package/dist/bio.d.ts +22 -0
- package/dist/components/Credits.d.ts +38 -0
- package/dist/components/Crosshair.d.ts +15 -0
- package/dist/components/DataLabels.d.ts +7 -0
- package/dist/components/ExportButton.d.ts +27 -0
- package/dist/components/Legend.d.ts +53 -0
- package/dist/components/TitleRenderer.d.ts +19 -0
- package/dist/components/Tooltip.d.ts +61 -0
- package/dist/core/Chart.d.ts +156 -0
- package/dist/core/EventBus.d.ts +14 -0
- package/dist/core/InteractionController.d.ts +62 -0
- package/dist/core/OptionsParser.d.ts +61 -0
- package/dist/core/Registry.d.ts +27 -0
- package/dist/core/SVGRenderer.d.ts +48 -0
- package/dist/core/ScrollablePlotOverlay.d.ts +31 -0
- package/dist/core/StackComputer.d.ts +25 -0
- package/dist/core/StateManager.d.ts +21 -0
- package/dist/core/UpdateScheduler.d.ts +28 -0
- package/dist/core/animationConstants.d.ts +20 -0
- package/dist/core/chartTypes.d.ts +46 -0
- package/dist/core/registerAll.d.ts +4 -0
- package/dist/core/registerBio.d.ts +4 -0
- package/dist/core/registerCore.d.ts +4 -0
- package/dist/core/registerFinance.d.ts +4 -0
- package/dist/core/registerFinancial.d.ts +4 -0
- package/dist/core/registerFlow.d.ts +4 -0
- package/dist/core/registerGeneral.d.ts +4 -0
- package/dist/datatable/DataTable.d.ts +162 -0
- package/dist/datatable/DataTableDefaults.d.ts +7 -0
- package/dist/datatable/api/TableApi.d.ts +35 -0
- package/dist/datatable/columns/ColumnDef.d.ts +16 -0
- package/dist/datatable/columns/ColumnManager.d.ts +31 -0
- package/dist/datatable/data/DataProcessor.d.ts +46 -0
- package/dist/datatable/data/DataSource.d.ts +26 -0
- package/dist/datatable/editing/CellEditor.d.ts +29 -0
- package/dist/datatable/export/TableExport.d.ts +23 -0
- package/dist/datatable/locales/en.d.ts +9 -0
- package/dist/datatable/locales/es.d.ts +6 -0
- package/dist/datatable/locales/index.d.ts +22 -0
- package/dist/datatable/locales/pt-BR.d.ts +6 -0
- package/dist/datatable/locales/resolveLocale.d.ts +16 -0
- package/dist/datatable/locales/zh.d.ts +6 -0
- package/dist/datatable/render/CellRenderer.d.ts +24 -0
- package/dist/datatable/render/HeaderRenderer.d.ts +51 -0
- package/dist/datatable/render/PaginationRenderer.d.ts +26 -0
- package/dist/datatable/render/SearchRenderer.d.ts +21 -0
- package/dist/datatable/render/TableRenderer.d.ts +81 -0
- package/dist/datatable/render/ToolbarRenderer.d.ts +34 -0
- package/dist/datatable/render/icons.d.ts +24 -0
- package/dist/datatable/render/popover.d.ts +15 -0
- package/dist/datatable/selection/SelectionManager.d.ts +29 -0
- package/dist/datatable/themes/TableTheme.d.ts +36 -0
- package/dist/datatable/themes/styleSheet.d.ts +16 -0
- package/dist/datatable.d.ts +19 -0
- package/dist/export/ChartExporter.d.ts +50 -0
- package/dist/export/Export.d.ts +76 -0
- package/dist/finance.d.ts +49 -0
- package/dist/index.d.ts +67 -0
- package/dist/indicators/Indicator.d.ts +23 -0
- package/dist/indicators/expandIndicators.d.ts +18 -0
- package/dist/indicators/moving-averages/DEMA.d.ts +10 -0
- package/dist/indicators/moving-averages/EMA.d.ts +12 -0
- package/dist/indicators/moving-averages/SMA.d.ts +11 -0
- package/dist/indicators/moving-averages/TEMA.d.ts +10 -0
- package/dist/indicators/moving-averages/WMA.d.ts +12 -0
- package/dist/indicators/oscillators/CCI.d.ts +11 -0
- package/dist/indicators/oscillators/MACD.d.ts +20 -0
- package/dist/indicators/oscillators/Momentum.d.ts +10 -0
- package/dist/indicators/oscillators/ROC.d.ts +10 -0
- package/dist/indicators/oscillators/RSI.d.ts +11 -0
- package/dist/indicators/oscillators/Stochastic.d.ts +20 -0
- package/dist/indicators/registry.d.ts +9 -0
- package/dist/indicators/trend/ADX.d.ts +11 -0
- package/dist/indicators/trend/IchimokuCloud.d.ts +14 -0
- package/dist/indicators/trend/PSAR.d.ts +11 -0
- package/dist/indicators/util.d.ts +8 -0
- package/dist/indicators/volatility/ATR.d.ts +11 -0
- package/dist/indicators/volatility/BollingerBands.d.ts +11 -0
- package/dist/indicators/volume/OBV.d.ts +11 -0
- package/dist/indicators/volume/VBP.d.ts +12 -0
- package/dist/indicators/volume/VWAP.d.ts +12 -0
- package/dist/interaction/Drilldown.d.ts +29 -0
- package/dist/interaction/HoverManager.d.ts +47 -0
- package/dist/interaction/Zoom.d.ts +68 -0
- package/dist/katucharts-bio.es.js +5861 -0
- package/dist/katucharts-bio.umd.js +1 -0
- package/dist/katucharts-datatable.es.js +3363 -0
- package/dist/katucharts-datatable.umd.js +296 -0
- package/dist/katucharts-finance.es.js +4364 -0
- package/dist/katucharts-finance.umd.js +1 -0
- package/dist/katucharts-react.es.js +35 -0
- package/dist/katucharts-react.umd.js +1 -0
- package/dist/katucharts.es.js +20531 -0
- package/dist/katucharts.umd.js +9 -0
- package/dist/layout/LayoutEngine.d.ts +44 -0
- package/dist/license/LicenseManager.d.ts +63 -0
- package/dist/options/defaults.d.ts +5 -0
- package/dist/react/KatuChartsReact.d.ts +16 -0
- package/dist/react.d.ts +2 -0
- package/dist/responsive/ResponsiveEngine.d.ts +15 -0
- package/dist/series/BaseSeries.d.ts +186 -0
- package/dist/series/bioinformatics/CircosChart.d.ts +4 -0
- package/dist/series/bioinformatics/ClusteredHeatmapChart.d.ts +22 -0
- package/dist/series/bioinformatics/ForestPlotChart.d.ts +21 -0
- package/dist/series/bioinformatics/KaplanMeierChart.d.ts +22 -0
- package/dist/series/bioinformatics/ManhattanChart.d.ts +34 -0
- package/dist/series/bioinformatics/PCoAChart.d.ts +22 -0
- package/dist/series/bioinformatics/PhyloTreeChart.d.ts +27 -0
- package/dist/series/bioinformatics/SequenceLogoChart.d.ts +21 -0
- package/dist/series/bioinformatics/ViolinChart.d.ts +23 -0
- package/dist/series/bioinformatics/VolcanoChart.d.ts +28 -0
- package/dist/series/bioinformatics/circos/CircosChart.d.ts +20 -0
- package/dist/series/bioinformatics/circos/CircosColorScales.d.ts +6 -0
- package/dist/series/bioinformatics/circos/CircosComparativeChart.d.ts +41 -0
- package/dist/series/bioinformatics/circos/CircosHeatmapChart.d.ts +31 -0
- package/dist/series/bioinformatics/circos/CircosLayoutEngine.d.ts +37 -0
- package/dist/series/bioinformatics/circos/CircosRules.d.ts +6 -0
- package/dist/series/bioinformatics/circos/CircosSpiralChart.d.ts +39 -0
- package/dist/series/bioinformatics/circos/CircosTypes.d.ts +131 -0
- package/dist/series/bioinformatics/circos/tracks/AreaTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/ConnectorTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/GlyphTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/HeatmapTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/HighlightTrackRenderer.d.ts +6 -0
- package/dist/series/bioinformatics/circos/tracks/HistogramTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/LineTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/LinkTrackRenderer.d.ts +8 -0
- package/dist/series/bioinformatics/circos/tracks/LollipopTrackRenderer.d.ts +9 -0
- package/dist/series/bioinformatics/circos/tracks/RibbonTrackRenderer.d.ts +9 -0
- package/dist/series/bioinformatics/circos/tracks/ScatterTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/StackTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/TextTrackRenderer.d.ts +8 -0
- package/dist/series/bioinformatics/circos/tracks/TileTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/TrackAxesRenderer.d.ts +6 -0
- package/dist/series/bioinformatics/circos/tracks/TrackBackgroundRenderer.d.ts +5 -0
- package/dist/series/cartesian/AreaChart.d.ts +33 -0
- package/dist/series/cartesian/BoxPlotChart.d.ts +24 -0
- package/dist/series/cartesian/BubbleChart.d.ts +34 -0
- package/dist/series/cartesian/ColumnChart.d.ts +37 -0
- package/dist/series/cartesian/LineChart.d.ts +28 -0
- package/dist/series/cartesian/ScatterChart.d.ts +20 -0
- package/dist/series/cartesian/SplineChart.d.ts +9 -0
- package/dist/series/cartesian/WaterfallChart.d.ts +25 -0
- package/dist/series/financial/AreaRangeChart.d.ts +24 -0
- package/dist/series/financial/BaselineChart.d.ts +20 -0
- package/dist/series/financial/CandlestickChart.d.ts +55 -0
- package/dist/series/financial/ColumnRangeChart.d.ts +16 -0
- package/dist/series/financial/FlagsChart.d.ts +34 -0
- package/dist/series/financial/HeikinAshiChart.d.ts +11 -0
- package/dist/series/financial/HollowCandlestickChart.d.ts +17 -0
- package/dist/series/financial/KagiChart.d.ts +23 -0
- package/dist/series/financial/LineBreakChart.d.ts +23 -0
- package/dist/series/financial/PointAndFigureChart.d.ts +24 -0
- package/dist/series/financial/RenkoChart.d.ts +22 -0
- package/dist/series/financial/VBPChart.d.ts +18 -0
- package/dist/series/financial/VolumeChart.d.ts +15 -0
- package/dist/series/flow/DependencyWheelChart.d.ts +23 -0
- package/dist/series/flow/NetworkGraphChart.d.ts +18 -0
- package/dist/series/flow/SankeyChart.d.ts +24 -0
- package/dist/series/gauge/GaugeChart.d.ts +40 -0
- package/dist/series/heatmap/HeatmapChart.d.ts +18 -0
- package/dist/series/hierarchical/SunburstChart.d.ts +44 -0
- package/dist/series/hierarchical/TreegraphChart.d.ts +19 -0
- package/dist/series/hierarchical/TreemapChart.d.ts +20 -0
- package/dist/series/hierarchical/WordcloudChart.d.ts +19 -0
- package/dist/series/index.d.ts +45 -0
- package/dist/series/map/FlowmapChart.d.ts +33 -0
- package/dist/series/map/MapChart.d.ts +53 -0
- package/dist/series/map/MapPointChart.d.ts +26 -0
- package/dist/series/map/mapProjection.d.ts +46 -0
- package/dist/series/pie/PieChart.d.ts +53 -0
- package/dist/series/polar/PolarChart.d.ts +18 -0
- package/dist/series/race/BarRaceChart.d.ts +44 -0
- package/dist/series/timeline/TimelineChart.d.ts +23 -0
- package/dist/series/venn/VennChart.d.ts +28 -0
- package/dist/stock/DataGrouping.d.ts +21 -0
- package/dist/stock/Navigator.d.ts +25 -0
- package/dist/stock/RangeSelector.d.ts +9 -0
- package/dist/stock/StockController.d.ts +47 -0
- package/dist/stockcharts.d.ts +8 -0
- package/dist/streaming/StreamAdapter.d.ts +36 -0
- package/dist/types/datatable-options.d.ts +633 -0
- package/dist/types/options.d.ts +1333 -0
- package/dist/utils/CircularBuffer.d.ts +24 -0
- package/dist/utils/chartText.d.ts +18 -0
- package/dist/utils/color.d.ts +23 -0
- package/dist/utils/decimation.d.ts +19 -0
- package/dist/utils/deepMerge.d.ts +5 -0
- package/dist/utils/dom.d.ts +10 -0
- package/dist/utils/format.d.ts +42 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/math.d.ts +6 -0
- package/dist/utils/throttle.d.ts +2 -0
- package/package.json +95 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(b,vt){typeof exports=="object"&&typeof module<"u"?vt(exports):typeof define=="function"&&define.amd?define(["exports"],vt):(b=typeof globalThis<"u"?globalThis:b||self,vt(b.KatuChartsFinance={}))})(this,function(b){"use strict";class vt{constructor(){this.types=new Map}registerType(t,n){this.types.set(t,n)}getType(t){return this.types.get(t)}hasType(t){return this.types.has(t)}getRegisteredTypes(){return Array.from(this.types.keys())}}const Te=globalThis,G=Te.__katuChartRegistry||(Te.__katuChartRegistry=new vt);var ee="http://www.w3.org/1999/xhtml";const $e={svg:"http://www.w3.org/2000/svg",xhtml:ee,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$e.hasOwnProperty(t)?{space:$e[t],local:e}:e}function Qi(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ee&&t.documentElement.namespaceURI===ee?t.createElement(e):t.createElementNS(n,e)}}function ji(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ne(e){var t=Vt(e);return(t.local?ji:Qi)(t)}function tr(){}function ne(e){return e==null?tr:function(){return this.querySelector(e)}}function er(e){typeof e!="function"&&(e=ne(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=new Array(o),c,l,u=0;u<o;++u)(c=s[u])&&(l=e.call(c,c.__data__,u,s))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new K(i,this._parents)}function nr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ir(){return[]}function Fe(e){return e==null?ir:function(){return this.querySelectorAll(e)}}function rr(e){return function(){return nr(e.apply(this,arguments))}}function sr(e){typeof e=="function"?e=rr(e):e=Fe(e);for(var t=this._groups,n=t.length,i=[],r=[],s=0;s<n;++s)for(var o=t[s],a=o.length,c,l=0;l<a;++l)(c=o[l])&&(i.push(e.call(c,c.__data__,l,o)),r.push(c));return new K(i,r)}function Re(e){return function(){return this.matches(e)}}function Ve(e){return function(t){return t.matches(e)}}var or=Array.prototype.find;function ar(e){return function(){return or.call(this.children,e)}}function lr(){return this.firstElementChild}function cr(e){return this.select(e==null?lr:ar(typeof e=="function"?e:Ve(e)))}var hr=Array.prototype.filter;function ur(){return Array.from(this.children)}function fr(e){return function(){return hr.call(this.children,e)}}function dr(e){return this.selectAll(e==null?ur:fr(typeof e=="function"?e:Ve(e)))}function pr(e){typeof e!="function"&&(e=Re(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=[],c,l=0;l<o;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new K(i,this._parents)}function De(e){return new Array(e.length)}function gr(){return new K(this._enter||this._groups.map(De),this._parents)}function Dt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Dt.prototype={constructor:Dt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function xr(e){return function(){return e}}function yr(e,t,n,i,r,s){for(var o=0,a,c=t.length,l=s.length;o<l;++o)(a=t[o])?(a.__data__=s[o],i[o]=a):n[o]=new Dt(e,s[o]);for(;o<c;++o)(a=t[o])&&(r[o]=a)}function mr(e,t,n,i,r,s,o){var a,c,l=new Map,u=t.length,h=s.length,f=new Array(u),p;for(a=0;a<u;++a)(c=t[a])&&(f[a]=p=o.call(c,c.__data__,a,t)+"",l.has(p)?r[a]=c:l.set(p,c));for(a=0;a<h;++a)p=o.call(e,s[a],a,s)+"",(c=l.get(p))?(i[a]=c,c.__data__=s[a],l.delete(p)):n[a]=new Dt(e,s[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(f[a])===c&&(r[a]=c)}function _r(e){return e.__data__}function wr(e,t){if(!arguments.length)return Array.from(this,_r);var n=t?mr:yr,i=this._parents,r=this._groups;typeof e!="function"&&(e=xr(e));for(var s=r.length,o=new Array(s),a=new Array(s),c=new Array(s),l=0;l<s;++l){var u=i[l],h=r[l],f=h.length,p=vr(e.call(u,u&&u.__data__,l,i)),d=p.length,y=a[l]=new Array(d),m=o[l]=new Array(d),g=c[l]=new Array(f);n(u,h,y,m,g,p,t);for(var x=0,_=0,w,v;x<d;++x)if(w=y[x]){for(x>=_&&(_=x+1);!(v=m[_])&&++_<d;);w._next=v||null}}return o=new K(o,i),o._enter=a,o._exit=c,o}function vr(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function br(){return new K(this._exit||this._groups.map(De),this._parents)}function kr(e,t,n){var i=this.enter(),r=this,s=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),i&&r?i.merge(r).order():r}function Mr(e){for(var t=e.selection?e.selection():e,n=this._groups,i=t._groups,r=n.length,s=i.length,o=Math.min(r,s),a=new Array(r),c=0;c<o;++c)for(var l=n[c],u=i[c],h=l.length,f=a[c]=new Array(h),p,d=0;d<h;++d)(p=l[d]||u[d])&&(f[d]=p);for(;c<r;++c)a[c]=n[c];return new K(a,this._parents)}function Ar(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var i=e[t],r=i.length-1,s=i[r],o;--r>=0;)(o=i[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function Cr(e){e||(e=Pr);function t(h,f){return h&&f?e(h.__data__,f.__data__):!h-!f}for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o=n[s],a=o.length,c=r[s]=new Array(a),l,u=0;u<a;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new K(r,this._parents).order()}function Pr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Er(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ir(){return Array.from(this)}function Sr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null}function Tr(){let e=0;for(const t of this)++e;return e}function $r(){return!this.node()}function Nr(e){for(var t=this._groups,n=0,i=t.length;n<i;++n)for(var r=t[n],s=0,o=r.length,a;s<o;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Fr(e){return function(){this.removeAttribute(e)}}function Rr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Vr(e,t){return function(){this.setAttribute(e,t)}}function Dr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Lr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Or(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Br(e,t){var n=Vt(e);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((t==null?n.local?Rr:Fr:typeof t=="function"?n.local?Or:Lr:n.local?Dr:Vr)(n,t))}function Le(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zr(e){return function(){this.style.removeProperty(e)}}function Hr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Xr(e,t,n){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function Wr(e,t,n){return arguments.length>1?this.each((t==null?zr:typeof t=="function"?Xr:Hr)(e,t,n??"")):xt(this.node(),e)}function xt(e,t){return e.style.getPropertyValue(t)||Le(e).getComputedStyle(e,null).getPropertyValue(t)}function Ur(e){return function(){delete this[e]}}function Yr(e,t){return function(){this[e]=t}}function qr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Gr(e,t){return arguments.length>1?this.each((t==null?Ur:typeof t=="function"?qr:Yr)(e,t)):this.node()[e]}function Oe(e){return e.trim().split(/^|\s+/)}function ie(e){return e.classList||new Be(e)}function Be(e){this._node=e,this._names=Oe(e.getAttribute("class")||"")}Be.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ze(e,t){for(var n=ie(e),i=-1,r=t.length;++i<r;)n.add(t[i])}function He(e,t){for(var n=ie(e),i=-1,r=t.length;++i<r;)n.remove(t[i])}function Kr(e){return function(){ze(this,e)}}function Zr(e){return function(){He(this,e)}}function Jr(e,t){return function(){(t.apply(this,arguments)?ze:He)(this,e)}}function Qr(e,t){var n=Oe(e+"");if(arguments.length<2){for(var i=ie(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Jr:t?Kr:Zr)(n,t))}function jr(){this.textContent=""}function ts(e){return function(){this.textContent=e}}function es(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ns(e){return arguments.length?this.each(e==null?jr:(typeof e=="function"?es:ts)(e)):this.node().textContent}function is(){this.innerHTML=""}function rs(e){return function(){this.innerHTML=e}}function ss(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function os(e){return arguments.length?this.each(e==null?is:(typeof e=="function"?ss:rs)(e)):this.node().innerHTML}function as(){this.nextSibling&&this.parentNode.appendChild(this)}function ls(){return this.each(as)}function cs(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function hs(){return this.each(cs)}function us(e){var t=typeof e=="function"?e:Ne(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function fs(){return null}function ds(e,t){var n=typeof e=="function"?e:Ne(e),i=t==null?fs:typeof t=="function"?t:ne(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function ps(){var e=this.parentNode;e&&e.removeChild(this)}function gs(){return this.each(ps)}function xs(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ys(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ms(e){return this.select(e?ys:xs)}function _s(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ws(e){return function(t){e.call(this,t,this.__data__)}}function vs(e){return e.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");return i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),{type:t,name:n}})}function bs(e){return function(){var t=this.__on;if(t){for(var n=0,i=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++i]=s;++i?t.length=i:delete this.__on}}}function ks(e,t,n){return function(){var i=this.__on,r,s=ws(t);if(i){for(var o=0,a=i.length;o<a;++o)if((r=i[o]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},i?i.push(r):this.__on=[r]}}function Ms(e,t,n){var i=vs(e+""),r,s=i.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<s;++r)if((o=i[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=t?ks:bs,r=0;r<s;++r)this.each(a(i[r],t,n));return this}function Xe(e,t,n){var i=Le(e),r=i.CustomEvent;typeof r=="function"?r=new r(t,n):(r=i.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function As(e,t){return function(){return Xe(this,e,t)}}function Cs(e,t){return function(){return Xe(this,e,t.apply(this,arguments))}}function Ps(e,t){return this.each((typeof t=="function"?Cs:As)(e,t))}function*Es(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],r=0,s=i.length,o;r<s;++r)(o=i[r])&&(yield o)}var We=[null];function K(e,t){this._groups=e,this._parents=t}function bt(){return new K([[document.documentElement]],We)}function Is(){return this}K.prototype=bt.prototype={constructor:K,select:er,selectAll:sr,selectChild:cr,selectChildren:dr,filter:pr,data:wr,enter:gr,exit:br,join:kr,merge:Mr,selection:Is,order:Ar,sort:Cr,call:Er,nodes:Ir,node:Sr,size:Tr,empty:$r,each:Nr,attr:Br,style:Wr,property:Gr,classed:Qr,text:ns,html:os,raise:ls,lower:hs,append:us,insert:ds,remove:gs,clone:ms,datum:_s,on:Ms,dispatch:Ps,[Symbol.iterator]:Es};function Ss(e){return typeof e=="string"?new K([[document.querySelector(e)]],[document.documentElement]):new K([[e]],We)}var Ts={value:()=>{}};function Ue(){for(var e=0,t=arguments.length,n={},i;e<t;++e){if(!(i=arguments[e]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new Lt(n)}function Lt(e){this._=e}function $s(e,t){return e.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Lt.prototype=Ue.prototype={constructor:Lt,on:function(e,t){var n=this._,i=$s(e+"",n),r,s=-1,o=i.length;if(arguments.length<2){for(;++s<o;)if((r=(e=i[s]).type)&&(r=Ns(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(r=(e=i[s]).type)n[r]=Ye(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Ye(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Lt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,s;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],i=0,r=s.length;i<r;++i)s[i].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)}};function Ns(e,t){for(var n=0,i=e.length,r;n<i;++n)if((r=e[n]).name===t)return r.value}function Ye(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=Ts,e=e.slice(0,i).concat(e.slice(i+1));break}return n!=null&&e.push({name:t,value:n}),e}var yt=0,kt=0,Mt=0,qe=1e3,Ot,At,Bt=0,ht=0,zt=0,Ct=typeof performance=="object"&&performance.now?performance:Date,Ge=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function re(){return ht||(Ge(Fs),ht=Ct.now()+zt)}function Fs(){ht=0}function Ht(){this._call=this._time=this._next=null}Ht.prototype=Ke.prototype={constructor:Ht,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?re():+n)+(t==null?0:+t),!this._next&&At!==this&&(At?At._next=this:Ot=this,At=this),this._call=e,this._time=n,se()},stop:function(){this._call&&(this._call=null,this._time=1/0,se())}};function Ke(e,t,n){var i=new Ht;return i.restart(e,t,n),i}function Rs(){re(),++yt;for(var e=Ot,t;e;)(t=ht-e._time)>=0&&e._call.call(void 0,t),e=e._next;--yt}function Ze(){ht=(Bt=Ct.now())+zt,yt=kt=0;try{Rs()}finally{yt=0,Ds(),ht=0}}function Vs(){var e=Ct.now(),t=e-Bt;t>qe&&(zt-=t,Bt=e)}function Ds(){for(var e,t=Ot,n,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ot=n);At=e,se(i)}function se(e){if(!yt){kt&&(kt=clearTimeout(kt));var t=e-ht;t>24?(e<1/0&&(kt=setTimeout(Ze,e-Ct.now()-zt)),Mt&&(Mt=clearInterval(Mt))):(Mt||(Bt=Ct.now(),Mt=setInterval(Vs,qe)),yt=1,Ge(Ze))}}function Je(e,t,n){var i=new Ht;return t=t==null?0:+t,i.restart(r=>{i.stop(),e(r+t)},t,n),i}var Ls=Ue("start","end","cancel","interrupt"),Os=[],Qe=0,je=1,oe=2,Xt=3,tn=4,ae=5,Wt=6;function Ut(e,t,n,i,r,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Bs(e,n,{name:t,index:i,group:r,on:Ls,tween:Os,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Qe})}function le(e,t){var n=Q(e,t);if(n.state>Qe)throw new Error("too late; already scheduled");return n}function tt(e,t){var n=Q(e,t);if(n.state>Xt)throw new Error("too late; already running");return n}function Q(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Bs(e,t,n){var i=e.__transition,r;i[t]=n,n.timer=Ke(s,0,n.time);function s(l){n.state=je,n.timer.restart(o,n.delay,n.time),n.delay<=l&&o(l-n.delay)}function o(l){var u,h,f,p;if(n.state!==je)return c();for(u in i)if(p=i[u],p.name===n.name){if(p.state===Xt)return Je(o);p.state===tn?(p.state=Wt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=Wt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Je(function(){n.state===Xt&&(n.state=tn,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=oe,n.on.call("start",e,e.__data__,n.index,n.group),n.state===oe){for(n.state=Xt,r=new Array(f=n.tween.length),u=0,h=-1;u<f;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++h]=p);r.length=h+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=ae,1),h=-1,f=r.length;++h<f;)r[h].call(e,u);n.state===ae&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Wt,n.timer.stop(),delete i[t];for(var l in i)return;delete e.__transition}}function zs(e,t){var n=e.__transition,i,r,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((i=n[o]).name!==t){s=!1;continue}r=i.state>oe&&i.state<ae,i.state=Wt,i.timer.stop(),i.on.call(r?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete n[o]}s&&delete e.__transition}}function Hs(e){return this.each(function(){zs(this,e)})}function ce(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function en(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function Pt(){}var Et=.7,Yt=1/Et,mt="\\s*([+-]?\\d+)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xs=/^#([0-9a-f]{3,8})$/,Ws=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),Us=new RegExp(`^rgb\\(${et},${et},${et}\\)$`),Ys=new RegExp(`^rgba\\(${mt},${mt},${mt},${It}\\)$`),qs=new RegExp(`^rgba\\(${et},${et},${et},${It}\\)$`),Gs=new RegExp(`^hsl\\(${It},${et},${et}\\)$`),Ks=new RegExp(`^hsla\\(${It},${et},${et},${It}\\)$`),nn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ce(Pt,_t,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rn,formatHex:rn,formatHex8:Zs,formatHsl:Js,formatRgb:sn,toString:sn});function rn(){return this.rgb().formatHex()}function Zs(){return this.rgb().formatHex8()}function Js(){return hn(this).formatHsl()}function sn(){return this.rgb().formatRgb()}function _t(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Xs.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?on(t):n===3?new Y(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?qt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?qt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ws.exec(e))?new Y(t[1],t[2],t[3],1):(t=Us.exec(e))?new Y(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ys.exec(e))?qt(t[1],t[2],t[3],t[4]):(t=qs.exec(e))?qt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Gs.exec(e))?cn(t[1],t[2]/100,t[3]/100,1):(t=Ks.exec(e))?cn(t[1],t[2]/100,t[3]/100,t[4]):nn.hasOwnProperty(e)?on(nn[e]):e==="transparent"?new Y(NaN,NaN,NaN,0):null}function on(e){return new Y(e>>16&255,e>>8&255,e&255,1)}function qt(e,t,n,i){return i<=0&&(e=t=n=NaN),new Y(e,t,n,i)}function Qs(e){return e instanceof Pt||(e=_t(e)),e?(e=e.rgb(),new Y(e.r,e.g,e.b,e.opacity)):new Y}function he(e,t,n,i){return arguments.length===1?Qs(e):new Y(e,t,n,i??1)}function Y(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}ce(Y,he,en(Pt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new Y(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Et:Math.pow(Et,e),new Y(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Y(ut(this.r),ut(this.g),ut(this.b),Gt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:an,formatHex:an,formatHex8:js,formatRgb:ln,toString:ln}));function an(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}`}function js(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function ln(){const e=Gt(this.opacity);return`${e===1?"rgb(":"rgba("}${ut(this.r)}, ${ut(this.g)}, ${ut(this.b)}${e===1?")":`, ${e})`}`}function Gt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ut(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ft(e){return e=ut(e),(e<16?"0":"")+e.toString(16)}function cn(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new j(e,t,n,i)}function hn(e){if(e instanceof j)return new j(e.h,e.s,e.l,e.opacity);if(e instanceof Pt||(e=_t(e)),!e)return new j;if(e instanceof j)return e;e=e.rgb();var t=e.r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,a=s-r,c=(s+r)/2;return a?(t===s?o=(n-i)/a+(n<i)*6:n===s?o=(i-t)/a+2:o=(t-n)/a+4,a/=c<.5?s+r:2-s-r,o*=60):a=c>0&&c<1?0:o,new j(o,a,c,e.opacity)}function to(e,t,n,i){return arguments.length===1?hn(e):new j(e,t,n,i??1)}function j(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}ce(j,to,en(Pt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new j(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Et:Math.pow(Et,e),new j(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new Y(ue(e>=240?e-240:e+120,r,i),ue(e,r,i),ue(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new j(un(this.h),Kt(this.s),Kt(this.l),Gt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Gt(this.opacity);return`${e===1?"hsl(":"hsla("}${un(this.h)}, ${Kt(this.s)*100}%, ${Kt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function un(e){return e=(e||0)%360,e<0?e+360:e}function Kt(e){return Math.max(0,Math.min(1,e||0))}function ue(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const fn=e=>()=>e;function eo(e,t){return function(n){return e+n*t}}function no(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}function io(e){return(e=+e)==1?dn:function(t,n){return n-t?no(t,n,e):fn(isNaN(t)?n:t)}}function dn(e,t){var n=t-e;return n?eo(e,n):fn(isNaN(e)?t:e)}const pn=function e(t){var n=io(t);function i(r,s){var o=n((r=he(r)).r,(s=he(s)).r),a=n(r.g,s.g),c=n(r.b,s.b),l=dn(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=c(u),r.opacity=l(u),r+""}}return i.gamma=e,i}(1);function ot(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var fe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,de=new RegExp(fe.source,"g");function ro(e){return function(){return e}}function so(e){return function(t){return e(t)+""}}function oo(e,t){var n=fe.lastIndex=de.lastIndex=0,i,r,s,o=-1,a=[],c=[];for(e=e+"",t=t+"";(i=fe.exec(e))&&(r=de.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(i=i[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:ot(i,r)})),n=de.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?so(c[0].x):ro(t):(t=c.length,function(l){for(var u=0,h;u<t;++u)a[(h=c[u]).i]=h.x(l);return a.join("")})}var gn=180/Math.PI,pe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xn(e,t,n,i,r,s){var o,a,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*i)&&(n-=e*c,i-=t*c),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,c/=a),e*i<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*gn,skewX:Math.atan(c)*gn,scaleX:o,scaleY:a}}var Zt;function ao(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?pe:xn(t.a,t.b,t.c,t.d,t.e,t.f)}function lo(e){return e==null||(Zt||(Zt=document.createElementNS("http://www.w3.org/2000/svg","g")),Zt.setAttribute("transform",e),!(e=Zt.transform.baseVal.consolidate()))?pe:(e=e.matrix,xn(e.a,e.b,e.c,e.d,e.e,e.f))}function yn(e,t,n,i){function r(l){return l.length?l.pop()+" ":""}function s(l,u,h,f,p,d){if(l!==h||u!==f){var y=p.push("translate(",null,t,null,n);d.push({i:y-4,x:ot(l,h)},{i:y-2,x:ot(u,f)})}else(h||f)&&p.push("translate("+h+t+f+n)}function o(l,u,h,f){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),f.push({i:h.push(r(h)+"rotate(",null,i)-2,x:ot(l,u)})):u&&h.push(r(h)+"rotate("+u+i)}function a(l,u,h,f){l!==u?f.push({i:h.push(r(h)+"skewX(",null,i)-2,x:ot(l,u)}):u&&h.push(r(h)+"skewX("+u+i)}function c(l,u,h,f,p,d){if(l!==h||u!==f){var y=p.push(r(p)+"scale(",null,",",null,")");d.push({i:y-4,x:ot(l,h)},{i:y-2,x:ot(u,f)})}else(h!==1||f!==1)&&p.push(r(p)+"scale("+h+","+f+")")}return function(l,u){var h=[],f=[];return l=e(l),u=e(u),s(l.translateX,l.translateY,u.translateX,u.translateY,h,f),o(l.rotate,u.rotate,h,f),a(l.skewX,u.skewX,h,f),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,h,f),l=u=null,function(p){for(var d=-1,y=f.length,m;++d<y;)h[(m=f[d]).i]=m.x(p);return h.join("")}}}var co=yn(ao,"px, ","px)","deg)"),ho=yn(lo,", ",")",")");function uo(e,t){var n,i;return function(){var r=tt(this,e),s=r.tween;if(s!==n){i=n=s;for(var o=0,a=i.length;o<a;++o)if(i[o].name===t){i=i.slice(),i.splice(o,1);break}}r.tween=i}}function fo(e,t,n){var i,r;if(typeof n!="function")throw new Error;return function(){var s=tt(this,e),o=s.tween;if(o!==i){r=(i=o).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}s.tween=r}}function po(e,t){var n=this._id;if(e+="",arguments.length<2){for(var i=Q(this.node(),n).tween,r=0,s=i.length,o;r<s;++r)if((o=i[r]).name===e)return o.value;return null}return this.each((t==null?uo:fo)(n,e,t))}function ge(e,t,n){var i=e._id;return e.each(function(){var r=tt(this,i);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Q(r,i).value[t]}}function mn(e,t){var n;return(typeof t=="number"?ot:t instanceof _t?pn:(n=_t(t))?(t=n,pn):oo)(e,t)}function go(e){return function(){this.removeAttribute(e)}}function xo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yo(e,t,n){var i,r=n+"",s;return function(){var o=this.getAttribute(e);return o===r?null:o===i?s:s=t(i=o,n)}}function mo(e,t,n){var i,r=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===r?null:o===i?s:s=t(i=o,n)}}function _o(e,t,n){var i,r,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=a+"",o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a)))}}function wo(e,t,n){var i,r,s;return function(){var o,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=a+"",o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a)))}}function vo(e,t){var n=Vt(e),i=n==="transform"?ho:mn;return this.attrTween(e,typeof t=="function"?(n.local?wo:_o)(n,i,ge(this,"attr."+e,t)):t==null?(n.local?xo:go)(n):(n.local?mo:yo)(n,i,t))}function bo(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ko(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Mo(e,t){var n,i;function r(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&ko(e,s)),n}return r._value=t,r}function Ao(e,t){var n,i;function r(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&bo(e,s)),n}return r._value=t,r}function Co(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var i=Vt(e);return this.tween(n,(i.local?Mo:Ao)(i,t))}function Po(e,t){return function(){le(this,e).delay=+t.apply(this,arguments)}}function Eo(e,t){return t=+t,function(){le(this,e).delay=t}}function Io(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Po:Eo)(t,e)):Q(this.node(),t).delay}function So(e,t){return function(){tt(this,e).duration=+t.apply(this,arguments)}}function To(e,t){return t=+t,function(){tt(this,e).duration=t}}function $o(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?So:To)(t,e)):Q(this.node(),t).duration}function No(e,t){if(typeof t!="function")throw new Error;return function(){tt(this,e).ease=t}}function Fo(e){var t=this._id;return arguments.length?this.each(No(t,e)):Q(this.node(),t).ease}function Ro(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;tt(this,e).ease=n}}function Vo(e){if(typeof e!="function")throw new Error;return this.each(Ro(this._id,e))}function Do(e){typeof e!="function"&&(e=Re(e));for(var t=this._groups,n=t.length,i=new Array(n),r=0;r<n;++r)for(var s=t[r],o=s.length,a=i[r]=[],c,l=0;l<o;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new it(i,this._parents,this._name,this._id)}function Lo(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,i=t.length,r=n.length,s=Math.min(i,r),o=new Array(i),a=0;a<s;++a)for(var c=t[a],l=n[a],u=c.length,h=o[a]=new Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(h[p]=f);for(;a<i;++a)o[a]=t[a];return new it(o,this._parents,this._name,this._id)}function Oo(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Bo(e,t,n){var i,r,s=Oo(t)?le:tt;return function(){var o=s(this,e),a=o.on;a!==i&&(r=(i=a).copy()).on(t,n),o.on=r}}function zo(e,t){var n=this._id;return arguments.length<2?Q(this.node(),n).on.on(e):this.each(Bo(n,e,t))}function Ho(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xo(){return this.on("end.remove",Ho(this._id))}function Wo(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ne(e));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o<r;++o)for(var a=i[o],c=a.length,l=s[o]=new Array(c),u,h,f=0;f<c;++f)(u=a[f])&&(h=e.call(u,u.__data__,f,a))&&("__data__"in u&&(h.__data__=u.__data__),l[f]=h,Ut(l[f],t,n,f,l,Q(u,n)));return new it(s,this._parents,t,n)}function Uo(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Fe(e));for(var i=this._groups,r=i.length,s=[],o=[],a=0;a<r;++a)for(var c=i[a],l=c.length,u,h=0;h<l;++h)if(u=c[h]){for(var f=e.call(u,u.__data__,h,c),p,d=Q(u,n),y=0,m=f.length;y<m;++y)(p=f[y])&&Ut(p,t,n,y,f,d);s.push(f),o.push(u)}return new it(s,o,t,n)}var Yo=bt.prototype.constructor;function qo(){return new Yo(this._groups,this._parents)}function Go(e,t){var n,i,r;return function(){var s=xt(this,e),o=(this.style.removeProperty(e),xt(this,e));return s===o?null:s===n&&o===i?r:r=t(n=s,i=o)}}function _n(e){return function(){this.style.removeProperty(e)}}function Ko(e,t,n){var i,r=n+"",s;return function(){var o=xt(this,e);return o===r?null:o===i?s:s=t(i=o,n)}}function Zo(e,t,n){var i,r,s;return function(){var o=xt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),xt(this,e))),o===c?null:o===i&&c===r?s:(r=c,s=t(i=o,a))}}function Jo(e,t){var n,i,r,s="style."+t,o="end."+s,a;return function(){var c=tt(this,e),l=c.on,u=c.value[s]==null?a||(a=_n(t)):void 0;(l!==n||r!==u)&&(i=(n=l).copy()).on(o,r=u),c.on=i}}function Qo(e,t,n){var i=(e+="")=="transform"?co:mn;return t==null?this.styleTween(e,Go(e,i)).on("end.style."+e,_n(e)):typeof t=="function"?this.styleTween(e,Zo(e,i,ge(this,"style."+e,t))).each(Jo(this._id,e)):this.styleTween(e,Ko(e,i,t),n).on("end.style."+e,null)}function jo(e,t,n){return function(i){this.style.setProperty(e,t.call(this,i),n)}}function ta(e,t,n){var i,r;function s(){var o=t.apply(this,arguments);return o!==r&&(i=(r=o)&&jo(e,o,n)),i}return s._value=t,s}function ea(e,t,n){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,ta(e,t,n??""))}function na(e){return function(){this.textContent=e}}function ia(e){return function(){var t=e(this);this.textContent=t??""}}function ra(e){return this.tween("text",typeof e=="function"?ia(ge(this,"text",e)):na(e==null?"":e+""))}function sa(e){return function(t){this.textContent=e.call(this,t)}}function oa(e){var t,n;function i(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&sa(r)),t}return i._value=e,i}function aa(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,oa(e))}function la(){for(var e=this._name,t=this._id,n=wn(),i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],a=o.length,c,l=0;l<a;++l)if(c=o[l]){var u=Q(c,t);Ut(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new it(i,this._parents,e,n)}function ca(){var e,t,n=this,i=n._id,r=n.size();return new Promise(function(s,o){var a={value:o},c={value:function(){--r===0&&s()}};n.each(function(){var l=tt(this,i),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&s()})}var ha=0;function it(e,t,n,i){this._groups=e,this._parents=t,this._name=n,this._id=i}function wn(){return++ha}var rt=bt.prototype;it.prototype={constructor:it,select:Wo,selectAll:Uo,selectChild:rt.selectChild,selectChildren:rt.selectChildren,filter:Do,merge:Lo,selection:qo,transition:la,call:rt.call,nodes:rt.nodes,node:rt.node,size:rt.size,empty:rt.empty,each:rt.each,on:zo,attr:vo,attrTween:Co,style:Qo,styleTween:ea,text:ra,textTween:aa,remove:Xo,tween:po,delay:Io,duration:$o,ease:Fo,easeVarying:Vo,end:ca,[Symbol.iterator]:rt[Symbol.iterator]};function vn(e){return--e*e*e+1}function ua(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fa={time:null,delay:0,duration:250,ease:ua};function da(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function pa(e){var t,n;e instanceof it?(t=e._id,e=e._name):(t=wn(),(n=fa).time=re(),e=e==null?null:e+"");for(var i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],a=o.length,c,l=0;l<a;++l)(c=o[l])&&Ut(c,e,t,l,o,n||da(c,t));return new it(i,this._parents,e,t)}bt.prototype.interrupt=Hs,bt.prototype.transition=pa;function ga(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Jt(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function xa(e){return e=Jt(Math.abs(e)),e?e[1]:NaN}function ya(e,t){return function(n,i){for(var r=n.length,s=[],o=0,a=e[0],c=0;r>0&&a>0&&(c+a+1>i&&(a=Math.max(1,i-c)),s.push(n.substring(r-=a,r+a)),!((c+=a+1)>i));)a=e[o=(o+1)%e.length];return s.reverse().join(t)}}function ma(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var _a=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xe(e){if(!(t=_a.exec(e)))throw new Error("invalid format: "+e);var t;return new ye({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}xe.prototype=ye.prototype;function ye(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}ye.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function wa(e){t:for(var t=e.length,n=1,i=-1,r;n<t;++n)switch(e[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+e[n])break t;i>0&&(i=0);break}return i>0?e.slice(0,i)+e.slice(r+1):e}var Qt;function va(e,t){var n=Jt(e,t);if(!n)return Qt=void 0,e.toPrecision(t);var i=n[0],r=n[1],s=r-(Qt=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+Jt(e,Math.max(0,t+s-1))[0]}function bn(e,t){var n=Jt(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const kn={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:ga,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>bn(e*100,t),r:bn,s:va,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Mn(e){return e}var An=Array.prototype.map,Cn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ba(e){var t=e.grouping===void 0||e.thousands===void 0?Mn:ya(An.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",r=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?Mn:ma(An.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(h,f){h=xe(h);var p=h.fill,d=h.align,y=h.sign,m=h.symbol,g=h.zero,x=h.width,_=h.comma,w=h.precision,v=h.trim,k=h.type;k==="n"?(_=!0,k="g"):kn[k]||(w===void 0&&(w=12),v=!0,k="g"),(g||p==="0"&&d==="=")&&(g=!0,p="0",d="=");var M=(f&&f.prefix!==void 0?f.prefix:"")+(m==="$"?n:m==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),I=(m==="$"?i:/[%p]/.test(k)?o:"")+(f&&f.suffix!==void 0?f.suffix:""),E=kn[k],P=/[defgprs%]/.test(k);w=w===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O(A){var R=M,N=I,V,S,C;if(k==="c")N=E(A)+N,A="";else{A=+A;var L=A<0||1/A<0;if(A=isNaN(A)?c:E(Math.abs(A),w),v&&(A=wa(A)),L&&+A==0&&y!=="+"&&(L=!1),R=(L?y==="("?y:a:y==="-"||y==="("?"":y)+R,N=(k==="s"&&!isNaN(A)&&Qt!==void 0?Cn[8+Qt/3]:"")+N+(L&&y==="("?")":""),P){for(V=-1,S=A.length;++V<S;)if(C=A.charCodeAt(V),48>C||C>57){N=(C===46?r+A.slice(V+1):A.slice(V))+N,A=A.slice(0,V);break}}}_&&!g&&(A=t(A,1/0));var B=R.length+A.length+N.length,D=B<x?new Array(x-B+1).join(p):"";switch(_&&g&&(A=t(D+A,D.length?x-N.length:1/0),D=""),d){case"<":A=R+A+N+D;break;case"=":A=R+D+A+N;break;case"^":A=D.slice(0,B=D.length>>1)+R+A+N+D.slice(B);break;default:A=D+R+A+N;break}return s(A)}return O.toString=function(){return h+""},O}function u(h,f){var p=Math.max(-8,Math.min(8,Math.floor(xa(f)/3)))*3,d=Math.pow(10,-p),y=l((h=xe(h),h.type="f",h),{suffix:Cn[8+p/3]});return function(m){return y(d*m)}}return{format:l,formatPrefix:u}}var jt,Pn;ka({thousands:",",grouping:[3],currency:["$",""]});function ka(e){return jt=ba(e),Pn=jt.format,jt.formatPrefix,jt}Object.entries({"%A":"%A","%a":"%a","%d":"%d","%e":"%-d","%b":"%b","%B":"%B","%m":"%m","%y":"%y","%Y":"%Y","%H":"%H","%I":"%I","%k":"%-H","%l":"%-I","%M":"%M","%p":"%p","%P":"%p","%S":"%S","%L":"%L"}).map(([e,t])=>[new RegExp(e.replace("%","\\%"),"g"),t]);const Ma=/\{([^}]+)\}/g;function En(e,t,n=!1){return e.replace(Ma,(i,r)=>{const s=r.indexOf(":");let o=r,a=null;s!==-1&&(o=r.slice(0,s),a=r.slice(s+1));const c=o.trim().split(".");let l=t;for(const h of c){if(l==null)return"";l=l[h]}if(l==null)return"";let u;if(a){const h=typeof l=="number"?l:parseFloat(String(l));if(isNaN(h))u=String(l);else try{u=Pn(a)(h)}catch{u=String(l)}}else u=String(l);return n?Pa(u):u})}const Aa=/[&<>"']/g,Ca={"&":"&","<":"<",">":">",'"':""","'":"'"};function Pa(e){return String(e).replace(Aa,t=>Ca[t])}const Ea=/<\/?[^>]+(>|$)/g,Ia=/<br\s*\/?>/gi;function In(e){return e.replace(Ia," ").replace(Ea,"").trim()}const F=600,q=8,Sa=F+100,$=300,me=250,W=vn,T=vn,Sn="12px",Tn="#000000",$n="#1a1a1a",Ta="#ffffff",$a=3;function _e(e){const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Nn(e,t,n){return .2126*_e(e)+.7152*_e(t)+.0722*_e(n)}function Fn(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}const Na=Nn(26,26,26);function Rn(e,t){var o;if(t)return t;const n=e?(o=_t(e))==null?void 0:o.rgb():null;if(!n||isNaN(n.r)||n.opacity===0)return Tn;const i=Nn(n.r,n.g,n.b),r=Fn(i,Na);return r>=$a?$n:Fn(i,1)>=r?Ta:$n}const Fa=500;function at(e,t,n,i){return i>Fa?t:t+e*n}class J{constructor(t){this.selectedPoints=new Set,this._cachedExtents=null,this.config=t,this.visible=t.visible!==!1,this.data=t._processedData||[]}init(t){this.context=t,this.group=t.chartGroup.append("g").attr("class",`katucharts-series katucharts-series-${this.config._internalType}`).attr("data-series-index",this.config.index),this.config.opacity!==void 0&&this.config.opacity!==1&&this.group.attr("opacity",this.config.opacity),this.config.zIndex!==void 0&&this.group.style("z-index",String(this.config.zIndex)),this.config.className&&this.group.classed(this.config.className,!0),this.config.shadow&&this.applyShadowFilter(),this.visible||this.group.style("display","none"),this.config.allowPointSelect&&this.data.forEach((n,i)=>{n.selected&&this.selectedPoints.add(i)}),this.group.on("mouseenter",()=>{var n,i;(i=(n=this.config.events)==null?void 0:n.mouseOver)==null||i.call(this,new Event("mouseOver")),this.context.events.emit("series:mouseenter",this)}).on("mouseleave",()=>{var n,i;(i=(n=this.config.events)==null?void 0:n.mouseOut)==null||i.call(this,new Event("mouseOut")),this.context.events.emit("series:mouseleave",this)})}setOnVisibilityChange(t){this._onVisibilityChange=t}processData(){this.data=this.config._processedData||[],this._cachedExtents=null}getColor(){return this.config.color||this.context.colors[this.context.colorIndex%this.context.colors.length]}autoLabelColor(t){return Rn(this.context.backgroundColor,t)}labelHalo(){const t=this.labelHaloColor();return`0 0 3px ${t}, 0 0 3px ${t}`}labelHaloColor(){return Rn(this.context.backgroundColor)==="#ffffff"?"rgba(0,0,0,0.85)":"#ffffff"}autoBorderColor(){const t=this.context.backgroundColor;return!t||t==="transparent"||t==="none"?"#ffffff":t}getMultiLegendItems(){return null}getLegendSymbolShape(){return null}getBubbleLegendInfo(){return null}animateUpdate(t){this.group.selectAll("*").remove(),this.render()}updateContext(t){Object.assign(this.context,t)}redraw(){this.group.selectAll("*").remove(),this.render()}setVisible(t,n=!0){var i,r,s,o;this.visible=t,t?(r=(i=this.config.events)==null?void 0:i.show)==null||r.call(this,new Event("show")):(o=(s=this.config.events)==null?void 0:s.hide)==null||o.call(this,new Event("hide")),n&&this._onVisibilityChange?(t?this.group.style("display","").attr("opacity",0).transition().duration(300).attr("opacity",this.config.opacity??1):this.group.transition().duration(300).attr("opacity",0).on("end",()=>{this.group.style("display","none")}),this._onVisibilityChange(500)):this.group.style("display",t?"":"none"),this.context.events.emit("series:visibilityChanged",this,t)}toggleVisible(){this.setVisible(!this.visible)}getDataExtents(){if(this._cachedExtents)return this._cachedExtents;let t=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of this.data)s.x!==void 0&&s.x!==null&&(s.x<t&&(t=s.x),s.x>n&&(n=s.x)),s.y!==void 0&&s.y!==null&&(s.y<i&&(i=s.y),s.y>r&&(r=s.y));return this._cachedExtents={xMin:t,xMax:n,yMin:i,yMax:r},this._cachedExtents}getCategories(){return this.data.filter(t=>t.name!==void 0).map(t=>t.name)}destroy(){var t;(t=this.group)==null||t.remove()}setData(t,n=!0,i=!0){this.data=t,this.config._processedData=t,this._cachedExtents=null,n&&(i?this.animateUpdate(500):this.redraw(),this.context.events.emit("series:dataChanged",this))}addPoint(t,n=!0,i=!1,r=!0){if(this.data.push(t),this.config._processedData=this.data,i&&this.data.length>1)this.data.shift(),this.config._processedData=this.data,this._cachedExtents=null;else if(this._cachedExtents){const s=this._cachedExtents;t.x!==void 0&&t.x!==null&&(t.x<s.xMin&&(s.xMin=t.x),t.x>s.xMax&&(s.xMax=t.x)),t.y!==void 0&&t.y!==null&&(t.y<s.yMin&&(s.yMin=t.y),t.y>s.yMax&&(s.yMax=t.y))}n&&(r?this.animateUpdate(300):this.redraw(),this.context.events.emit("series:dataChanged",this))}addPoints(t,n=!0,i=!1,r=!0){for(const s of t)this.data.push(s);i&&this.data.length>t.length&&this.data.splice(0,t.length),this.config._processedData=this.data,this._cachedExtents=null,n&&(r?this.animateUpdate(300):this.redraw(),this.context.events.emit("series:dataChanged",this))}removePoint(t,n=!0,i=!0){t>=0&&t<this.data.length&&(this.data.splice(t,1),this.config._processedData=this.data,this._cachedExtents=null,n&&(i?this.animateUpdate(300):this.redraw(),this.context.events.emit("series:dataChanged",this)))}updateSeries(t,n=!0){Object.assign(this.config,t),t.data&&(this.config._processedData=t.data,this.data=this.config._processedData,this._cachedExtents=null),n&&this.redraw()}applyBatch(t){for(const n of t.entries)switch(n.type){case"setData":this.data=n.payload,this.config._processedData=this.data;break;case"addPoint":this.data.push(n.payload.point),n.payload.shift&&this.data.length>1&&this.data.shift();break;case"addPoints":for(const i of n.payload.points)this.data.push(i);n.payload.shift&&this.data.splice(0,n.payload.points.length);break;case"removePoint":n.payload.index>=0&&n.payload.index<this.data.length&&this.data.splice(n.payload.index,1);break}this.config._processedData=this.data,this._cachedExtents=null,this.redraw(),this.context.events.emit("series:dataChanged",this)}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}getSelectedPoints(){return Array.from(this.selectedPoints).map(t=>({index:t,point:this.data[t]})).filter(t=>t.point!==void 0)}applyClipPath(){const{plotArea:t}=this.context;this.clipId=`katucharts-clip-${this.config.index}-${Date.now()}`;const n=this.group.select(function(){return this.ownerSVGElement});if(!n.empty()){let i=n.select("defs");i.empty()&&(i=n.append("defs")),i.append("clipPath").attr("id",this.clipId).append("rect").attr("x",0).attr("y",0).attr("width",t.width).attr("height",t.height),this.group.attr("clip-path",`url(#${this.clipId})`)}}applyShadowFilter(){const t=this.config.shadow;if(!t)return;const n=`katucharts-shadow-${this.config.index}-${Date.now()}`,i=this.group.select(function(){return this.ownerSVGElement});if(!i.empty()){let r=i.select("defs");r.empty()&&(r=i.append("defs"));const s=typeof t=="object"?t:{},o=s.offsetX??1,a=s.offsetY??1,c=s.width??3,l=s.opacity??.15;r.append("filter").attr("id",n).append("feDropShadow").attr("dx",o).attr("dy",a).attr("stdDeviation",c).attr("flood-opacity",l),this.group.style("filter",`url(#${n})`)}}applyInactiveState(){var r,s,o,a,c;const t=this.context.allSeries;if(!t||t.length<=1)return;const n=((s=(r=this.config.states)==null?void 0:r.inactive)==null?void 0:s.opacity)??.2,i=((c=(a=(o=this.config.states)==null?void 0:o.inactive)==null?void 0:a.animation)==null?void 0:c.duration)??me;for(const l of t)l!==this&&l.visible&&l.group.transition("inactive").duration(i).ease(T).attr("opacity",n)}clearInactiveState(){var i,r,s,o,a,c;const t=this.context.allSeries;if(!t||t.length<=1)return;const n=((s=(r=(i=this.config.states)==null?void 0:i.normal)==null?void 0:r.animation)==null?void 0:s.duration)??((c=(a=(o=this.config.states)==null?void 0:o.inactive)==null?void 0:a.animation)==null?void 0:c.duration)??me;for(const l of t)l!==this&&l.visible&&l.group.transition("inactive").duration(n).ease(T).attr("opacity",l.config.opacity??1)}emitAfterAnimate(t){var s;const n=!!((s=this.config.events)!=null&&s.afterAnimate),i=typeof this.config.animation=="object"?this.config.animation:null,r=!!(i!=null&&i.complete);(n||r)&&setTimeout(()=>{var o,a,c;(a=(o=this.config.events)==null?void 0:o.afterAnimate)==null||a.call(this,new Event("afterAnimate")),(c=i==null?void 0:i.complete)==null||c.call(i)},t)}renderDataLabels(t,n,i){const r=this.config.dataLabels;if(!(r!=null&&r.enabled))return;this.group.selectAll(".katucharts-data-labels").remove();const s=this.group.append("g").attr("class","katucharts-data-labels");this.getColor(),t.forEach((o,a)=>{var y,m;if(o.y===null||o.y===void 0)return;const c=o.dataLabels,l={...r,...c};let u;if(l.formatter?u=l.formatter.call({point:{...o,index:a},series:this,x:o.x??a,y:o.y,percentage:o._percentage}):l.format?u=In(En(l.format,{point:o,series:{name:this.config.name??""},x:o.x,y:o.y,percentage:o._percentage??o.percentage})):u=String(o.y),l.filter){const g=o[l.filter.property??"y"]??0,x=l.filter.operator??">",_=l.filter.value??0;if(!(x===">"?g>_:x==="<"?g<_:x===">="?g>=_:x==="<="?g<=_:x==="=="?g===_:!0))return}const h=n(o,a)+(l.x??0),f=i(o,a)+(l.y??-10),p=s.append("text").attr("x",h).attr("y",f).attr("text-anchor",l.align==="left"?"start":l.align==="right"?"end":"middle").attr("dominant-baseline",l.verticalAlign==="top"?"text-before-edge":l.verticalAlign==="bottom"?"text-after-edge":"central").text(u),d=l.style||{};if(p.style("font-size",d.fontSize??Sn).style("font-weight",d.fontWeight??"bold").style("fill",l.color||d.color||this.autoLabelColor()),d.textOutline&&p.style("text-shadow",d.textOutline),l.rotation&&p.attr("transform",`rotate(${l.rotation},${h},${f})`),l.backgroundColor||l.borderWidth){const g=(m=(y=p.node()).getBBox)==null?void 0:m.call(y);if(g){const x=l.padding??5,_=l.borderRadius??0;s.insert("rect",":last-child").attr("x",g.x-x).attr("y",g.y-x).attr("width",g.width+x*2).attr("height",g.height+x*2).attr("rx",_).attr("fill",l.backgroundColor||"none").attr("stroke",l.borderColor||"none").attr("stroke-width",l.borderWidth??0)}}this.context.animate&&l.defer!==!1&&p.attr("opacity",0).transition().delay(Sa+a*q).duration(400).ease(W).attr("opacity",1)})}handlePointSelect(t,n,i,r){var o,a,c,l;if(!this.config.allowPointSelect)return;const s=this.selectedPoints.has(i);if(s){if(((a=(o=n.events)==null?void 0:o.unselect)==null?void 0:a.call(n,r))===!1)return;this.selectedPoints.delete(i),n.selected=!1,this.clearSelectStyle(t)}else{if(((l=(c=n.events)==null?void 0:c.select)==null?void 0:l.call(n,r))===!1)return;this.selectedPoints.add(i),n.selected=!0,this.applySelectStyle(t)}this.context.events.emit("point:select",{point:n,index:i,series:this,selected:!s})}applySelectStyle(t){var i;const n=(i=this.config.states)==null?void 0:i.select;n!=null&&n.color&&t.attr("fill",n.color),n!=null&&n.borderColor&&t.attr("stroke",n.borderColor),(n==null?void 0:n.borderWidth)!==void 0&&t.attr("stroke-width",n.borderWidth)}clearSelectStyle(t){t.attr("fill",null).attr("stroke",null).attr("stroke-width",null)}attachPointEvents(t,n,i){var o;if(this.config.enableMouseTracking===!1)return;const r=n.events||{},s=((o=this.config.point)==null?void 0:o.events)||{};t.on("mouseover",a=>{var c,l;this.context.events.emit("point:mouseover",{point:n,index:i,series:this,event:a,plotX:this.context.xAxis.getPixelForValue(n.x??i),plotY:this.context.yAxis.getPixelForValue(n.y??0)}),(c=r.mouseOver)==null||c.call(n,a),(l=s.mouseOver)==null||l.call(n,a)}).on("mouseout",a=>{var c,l;this.context.events.emit("point:mouseout",{point:n,index:i,series:this,event:a}),(c=r.mouseOut)==null||c.call(n,a),(l=s.mouseOut)==null||l.call(n,a)}).on("click",a=>{var c,l,u,h;this.context.events.emit("point:click",{point:n,index:i,series:this,event:a}),(c=r.click)==null||c.call(n,a),(l=s.click)==null||l.call(n,a),(h=(u=this.config.events)==null?void 0:u.click)==null||h.call(this,a),this.handlePointSelect(t,n,i,a)}),t.style("cursor",this.config.cursor||"pointer")}applyJitter(t,n,i){return i?t+(Math.random()-.5)*i*n:t}}class we extends J{constructor(t){super(t),this.selectedIndices=new Set}getCandleStyle(t){const n=t.isUp?t.upLineColor:t.downLineColor;return{fill:t.isUp?t.upColor:t.downColor,stroke:n,wick:n}}getCandleClass(){return"katucharts-candlestick"}render(){var I,E,P,O,A,R,N,V;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.data,o=this.applyDataGrouping(s),a=this.config.pointRange,c=this.config.groupPadding??.2,l=this.config.pointPadding??.1,u=c+l,h=this.config.maxPointWidth??1/0,f=a?Math.max(1,Math.min(h,i.width/Math.max(1,((I=t.domain)==null?void 0:I[1])-((E=t.domain)==null?void 0:E[0])||o.length)*a*(1-u))):Math.max(1,Math.min(h,i.width/o.length*(1-u))),p=this.config.pointWidth??f,d=this.config.color||"#f45b5b",y=this.config.upColor||"#2f7ed8",m=this.config.lineColor||d,g=this.config.upLineColor||y,x=this.config.lineWidth??1,_=((O=(P=this.config.states)==null?void 0:P.inactive)==null?void 0:O.opacity)??.4,w=this.config.allowPointSelect===!0,v=(R=(A=this.config.states)==null?void 0:A.select)==null?void 0:R.color,k=(V=(N=this.config.states)==null?void 0:N.select)==null?void 0:V.borderColor,M=[];for(let S=0;S<o.length;S++){const C=o[S];if(C.y===null&&C.open===void 0)continue;const L=C.open??C.y??0,B=C.high??L,D=C.low??L,Nt=C.close??L,wt=t.getPixelForValue(C.x??S),Ie=Nt>=L,Se=this.getCandleStyle({open:L,high:B,low:D,close:Nt,isUp:Ie,index:S,data:o,upColor:y,downColor:d,upLineColor:g,downLineColor:m}),Ui=Se.fill,Ua=Se.stroke,Z=this.group.append("g").attr("class",this.getCandleClass()).style("cursor",this.config.cursor||"pointer");M.push(Z);const Yi=Z.append("line").attr("x1",wt).attr("x2",wt).attr("stroke",Se.wick).attr("stroke-width",x),qi=Ie?Nt:L,Ya=Ie?L:Nt,Gi=n.getPixelForValue(qi),Ki=Math.max(1,Math.abs(n.getPixelForValue(Ya)-n.getPixelForValue(qi))),Zi=Z.append("rect").attr("x",wt-p/2).attr("width",p).attr("stroke",Ua).attr("stroke-width",x).attr("rx",2);if(r){const U=n.getPixelForValue((B+D)/2),nt=at(S,0,q,o.length);Yi.attr("y1",U).attr("y2",U).transition().duration(F).ease(W).delay(nt).attr("y1",n.getPixelForValue(B)).attr("y2",n.getPixelForValue(D)),Zi.attr("y",U).attr("height",0).attr("fill",Ui).transition().duration(F).ease(W).delay(nt).attr("y",Gi).attr("height",Ki)}else Yi.attr("y1",n.getPixelForValue(B)).attr("y2",n.getPixelForValue(D)),Zi.attr("y",Gi).attr("height",Ki).attr("fill",Ui);this.config.enableMouseTracking!==!1&&Z.on("mouseover",U=>{var lt,st,Ft,Rt;const nt=((st=(lt=this.config.states)==null?void 0:lt.hover)==null?void 0:st.lineWidthPlus)??2;Z.select("rect").transition("size").duration($).ease(T).attr("x",wt-p*.7).attr("width",p*1.4),Z.select("line").transition("size").duration($).ease(T).attr("stroke-width",x+nt),Z.style("filter","drop-shadow(0 2px 4px rgba(0,0,0,0.25))"),M.forEach(ct=>ct.interrupt("highlight")),M.forEach(ct=>ct.attr("opacity",1)),M.forEach((ct,te)=>{te!==S&&ct.transition("highlight").duration($).ease(T).attr("opacity",_)}),this.context.events.emit("point:mouseover",{point:{...C,open:L,high:B,low:D,close:Nt},index:S,series:this,event:U,plotX:wt,plotY:n.getPixelForValue((B+D)/2)}),(Rt=(Ft=C.events)==null?void 0:Ft.mouseOver)==null||Rt.call(C,U)}).on("mouseout",U=>{var nt,lt;Z.select("rect").transition("size").duration($).ease(T).attr("x",wt-p/2).attr("width",p),Z.select("line").transition("size").duration($).ease(T).attr("stroke-width",x),Z.style("filter",""),M.forEach(st=>st.interrupt("highlight")),M.forEach(st=>st.transition("highlight").duration($).ease(T).attr("opacity",1)),this.context.events.emit("point:mouseout",{point:C,index:S,series:this,event:U}),(lt=(nt=C.events)==null?void 0:nt.mouseOut)==null||lt.call(C,U)}).on("click",U=>{var nt,lt,st,Ft,Rt,ct,te,Ji;w&&(this.selectedIndices.has(S)?(this.selectedIndices.delete(S),Z.select("rect").attr("stroke-width",x),(lt=(nt=C.events)==null?void 0:nt.unselect)==null||lt.call(C,U)):(this.selectedIndices.add(S),Z.select("rect").attr("stroke",k||"#000").attr("stroke-width",v?2:x+1),v&&Z.select("rect").attr("fill",v),(Ft=(st=C.events)==null?void 0:st.select)==null||Ft.call(C,U))),this.context.events.emit("point:click",{point:C,index:S,series:this,event:U}),(ct=(Rt=C.events)==null?void 0:Rt.click)==null||ct.call(C,U),(Ji=(te=this.config.events)==null?void 0:te.click)==null||Ji.call(this,U)})}this.renderCandlestickLabels(o,t,n)}renderCandlestickLabels(t,n,i){var a,c;const r=this.config.dataLabels;if(!(r!=null&&r.enabled))return;const s=((a=r.style)==null?void 0:a.fontSize)||Sn,o=r.color||((c=r.style)==null?void 0:c.color)||Tn;t.forEach((l,u)=>{if(l.y===null&&l.open===void 0)return;const h=l.high??l.open??l.y??0,f=n.getPixelForValue(l.x??u),p=i.getPixelForValue(h);let d;r.formatter?d=r.formatter.call({point:l,series:{name:this.config.name},x:l.x,y:l.y}):r.format?d=In(En(r.format,{point:l,series:{name:this.config.name},x:l.x,y:l.y})):d=String(l.close??l.y??""),this.group.append("text").attr("class","katucharts-candlestick-label").attr("x",f+(r.x??0)).attr("y",p-6+(r.y??0)).attr("text-anchor","middle").attr("font-size",s).attr("fill",o).style("pointer-events","none").text(d)})}applyDataGrouping(t){const n=this.config.dataGrouping;if(!(n!=null&&n.enabled)||!n.units||t.length===0)return t;const i=n.groupPixelWidth??10,{plotArea:r}=this.context,s=r.width/Math.max(1,t.length);if(s>=i)return t;const o=Math.ceil(i/s),a=[];for(let c=0;c<t.length;c+=o){const l=t.slice(c,c+o);if(l.length===0)continue;const u=l[0].open??l[0].y??0,h=l[l.length-1].close??l[l.length-1].y??0;let f=-1/0,p=1/0;for(const d of l)f=Math.max(f,d.high??d.y??0),p=Math.min(p,d.low??d.y??0);a.push({...l[0],x:l[0].x,open:u,high:f,low:p,close:h,y:h})}return a}getDataExtents(){let t=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of this.data){const o=s.x??0;t=Math.min(t,o),n=Math.max(n,o);const a=s.high??s.y??0,c=s.low??s.y??0;i=Math.min(i,c),r=Math.max(r,a)}return{xMin:t,xMax:n,yMin:i,yMax:r}}}class Ra extends J{constructor(t){super(t)}render(){var h,f;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.data,o=Math.max(2,Math.min(10,i.width/s.length*.3)),a=this.config.color||"#f45b5b",c=this.config.upColor||"#2f7ed8",l=((f=(h=this.config.states)==null?void 0:h.inactive)==null?void 0:f.opacity)??.4,u=[];for(let p=0;p<s.length;p++){const d=s[p];if(d.y===null&&d.open===void 0)continue;const y=d.open??d.y??0,m=d.high??y,g=d.low??y,x=d.close??y,_=t.getPixelForValue(d.x??p),w=x>=y?c:a,v=this.group.append("g").attr("class","katucharts-ohlc").style("cursor",this.config.cursor||"pointer");u.push(v),r&&v.attr("opacity",0).transition().duration(F).ease(W).delay(at(p,0,q,s.length)).attr("opacity",1),v.append("line").attr("x1",_).attr("x2",_).attr("y1",n.getPixelForValue(m)).attr("y2",n.getPixelForValue(g)).attr("stroke",w).attr("stroke-width",1.5),v.append("line").attr("x1",_-o).attr("x2",_).attr("y1",n.getPixelForValue(y)).attr("y2",n.getPixelForValue(y)).attr("stroke",w).attr("stroke-width",1.5),v.append("line").attr("x1",_).attr("x2",_+o).attr("y1",n.getPixelForValue(x)).attr("y2",n.getPixelForValue(x)).attr("stroke",w).attr("stroke-width",1.5),this.config.enableMouseTracking!==!1&&v.on("mouseover",k=>{var M,I;v.selectAll("line").interrupt("hover").transition("hover").duration($).ease(T).attr("stroke-width",3),v.style("filter","drop-shadow(0 2px 4px rgba(0,0,0,0.25))"),u.forEach(E=>E.interrupt("highlight")),u.forEach(E=>E.attr("opacity",1)),u.forEach((E,P)=>{P!==p&&E.transition("highlight").duration($).ease(T).attr("opacity",l)}),this.context.events.emit("point:mouseover",{point:{...d,open:y,high:m,low:g,close:x},index:p,series:this,event:k,plotX:_,plotY:n.getPixelForValue((m+g)/2)}),(I=(M=d.events)==null?void 0:M.mouseOver)==null||I.call(d,k)}).on("mouseout",k=>{var M,I;v.selectAll("line").interrupt("hover").transition("hover").duration($).ease(T).attr("stroke-width",1.5),v.style("filter",""),u.forEach(E=>E.interrupt("highlight")),u.forEach(E=>E.transition("highlight").duration($).ease(T).attr("opacity",1)),this.context.events.emit("point:mouseout",{point:d,index:p,series:this,event:k}),(I=(M=d.events)==null?void 0:M.mouseOut)==null||I.call(d,k)}).on("click",k=>{var M,I,E,P;this.context.events.emit("point:click",{point:d,index:p,series:this,event:k}),(I=(M=d.events)==null?void 0:M.click)==null||I.call(d,k),(P=(E=this.config.events)==null?void 0:E.click)==null||P.call(this,k)})}}getDataExtents(){let t=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of this.data){const o=s.x??0;t=Math.min(t,o),n=Math.max(n,o);const a=s.high??s.y??0,c=s.low??s.y??0;i=Math.min(i,c),r=Math.max(r,a)}return{xMin:t,xMax:n,yMin:i,yMax:r}}}class Vn extends we{constructor(t){super(t)}processData(){if(super.processData(),this.data.length===0)return;const t=[];for(let n=0;n<this.data.length;n++){const i=this.data[n],r=i.open??i.y??0,s=i.high??r,o=i.low??r,a=i.close??r,c=(r+s+o+a)/4;let l;if(n===0)l=(r+a)/2;else{const f=t[n-1];l=(f.open+f.close)/2}const u=Math.max(s,l,c),h=Math.min(o,l,c);t.push({...i,open:l,high:u,low:h,close:c,y:c})}this.data=t}}class Dn extends we{getCandleStyle(t){const n=t.index>0?t.data[t.index-1].close??t.data[t.index-1].y??0:t.open,i=t.close>n,r=i?t.upColor:t.downColor;return{fill:i?"none":t.downColor,stroke:r,wick:r}}getCandleClass(){return"katucharts-candlestick katucharts-hollow-candlestick"}}class Ln extends J{constructor(t){super(t)}render(){var m,g,x,_;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.data,o=this.config.groupPadding??.2,a=this.config.pointPadding??.1,c=o+a,l=this.config.maxPointWidth??1/0,u=Math.max(1,Math.min(l,i.width/Math.max(1,s.length)*(1-c))),h=this.config.pointWidth??u,f=this.config.upColor||"#2f7ed8",p=this.config.color||"#f45b5b",d=((g=(m=this.config.states)==null?void 0:m.inactive)==null?void 0:g.opacity)??.4;(_=(x=this.config.states)==null?void 0:x.hover)==null||_.brightness;const y=[];for(let w=0;w<s.length;w++){const v=s[w];if(v.y===null||v.y===void 0)continue;const k=v.y,M=v.open??0,P=(v.close??0)>=M?f:p,O=t.getPixelForValue(v.x??w),A=n.getPixelForValue(k),R=n.getPixelForValue(0),N=Math.max(0,R-A),V=this.group.append("rect").attr("class","katucharts-volume-bar").attr("x",O-h/2).attr("width",h).attr("fill",P).attr("rx",1);r?V.attr("y",R).attr("height",0).transition().duration(F).ease(W).delay(at(w,0,q,s.length)).attr("y",A).attr("height",N):V.attr("y",A).attr("height",N),y.push(V),this.config.enableMouseTracking!==!1&&V.style("cursor",this.config.cursor||"pointer").on("mouseover",S=>{var C,L;V.transition("hover").duration($).ease(T).attr("opacity",.8),y.forEach((B,D)=>{D!==w&&B.interrupt("highlight")}),y.forEach((B,D)=>{D!==w&&B.transition("highlight").duration($).ease(T).attr("opacity",d)}),this.context.events.emit("point:mouseover",{point:v,index:w,series:this,event:S,plotX:O,plotY:A}),(L=(C=v.events)==null?void 0:C.mouseOver)==null||L.call(v,S)}).on("mouseout",S=>{var C,L;V.transition("hover").duration($).ease(T).attr("opacity",1),y.forEach(B=>{B.interrupt("highlight"),B.transition("highlight").duration($).ease(T).attr("opacity",1)}),this.context.events.emit("point:mouseout",{point:v,index:w,series:this,event:S}),(L=(C=v.events)==null?void 0:C.mouseOut)==null||L.call(v,S)}).on("click",S=>{var C,L,B,D;this.context.events.emit("point:click",{point:v,index:w,series:this,event:S}),(L=(C=v.events)==null?void 0:C.click)==null||L.call(v,S),(D=(B=this.config.events)==null?void 0:B.click)==null||D.call(this,S)})}r&&this.emitAfterAnimate(F+s.length*q),this.renderDataLabels(s,(w,v)=>t.getPixelForValue(w.x??v),(w,v)=>n.getPixelForValue(w.y??0))}getDataExtents(){let t=1/0,n=-1/0,i=-1/0;for(const r of this.data){const s=r.x??0;s<t&&(t=s),s>n&&(n=s);const o=r.y??0;o>i&&(i=o)}return{xMin:t,xMax:n,yMin:0,yMax:i}}}function X(e){return function(){return e}}const On=1e-12,ve=Math.PI,be=2*ve,dt=1e-6,Va=be-dt;function Bn(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Da(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Bn;const n=10**t;return function(i){this._+=i[0];for(let r=1,s=i.length;r<s;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class La{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Bn:Da(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,i,r){this._append`Q${+t},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(t,n,i,r,s,o){this._append`C${+t},${+n},${+i},${+r},${this._x1=+s},${this._y1=+o}`}arcTo(t,n,i,r,s){if(t=+t,n=+n,i=+i,r=+r,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,c=i-t,l=r-n,u=o-t,h=a-n,f=u*u+h*h;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(f>dt)if(!(Math.abs(h*c-l*u)>dt)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let p=i-o,d=r-a,y=c*c+l*l,m=p*p+d*d,g=Math.sqrt(y),x=Math.sqrt(f),_=s*Math.tan((ve-Math.acos((y+f-m)/(2*g*x)))/2),w=_/x,v=_/g;Math.abs(w-1)>dt&&this._append`L${t+w*u},${n+w*h}`,this._append`A${s},${s},0,0,${+(h*p>u*d)},${this._x1=t+v*c},${this._y1=n+v*l}`}}arc(t,n,i,r,s,o){if(t=+t,n=+n,i=+i,o=!!o,i<0)throw new Error(`negative radius: ${i}`);let a=i*Math.cos(r),c=i*Math.sin(r),l=t+a,u=n+c,h=1^o,f=o?r-s:s-r;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>dt||Math.abs(this._y1-u)>dt)&&this._append`L${l},${u}`,i&&(f<0&&(f=f%be+be),f>Va?this._append`A${i},${i},0,1,${h},${t-a},${n-c}A${i},${i},0,1,${h},${this._x1=l},${this._y1=u}`:f>dt&&this._append`A${i},${i},0,${+(f>=ve)},${h},${this._x1=t+i*Math.cos(s)},${this._y1=n+i*Math.sin(s)}`)}rect(t,n,i,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function zn(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const i=Math.floor(n);if(!(i>=0))throw new RangeError(`invalid digits: ${n}`);t=i}return e},()=>new La(t)}function Hn(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xn(e){this._context=e}Xn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function St(e){return new Xn(e)}function Wn(e){return e[0]}function Un(e){return e[1]}function pt(e,t){var n=X(!0),i=null,r=St,s=null,o=zn(a);e=typeof e=="function"?e:e===void 0?Wn:X(e),t=typeof t=="function"?t:t===void 0?Un:X(t);function a(c){var l,u=(c=Hn(c)).length,h,f=!1,p;for(i==null&&(s=r(p=o())),l=0;l<=u;++l)!(l<u&&n(h=c[l],l,c))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+e(h,l,c),+t(h,l,c));if(p)return s=null,p+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:X(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:X(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:X(!!c),a):n},a.curve=function(c){return arguments.length?(r=c,i!=null&&(s=r(i)),a):r},a.context=function(c){return arguments.length?(c==null?i=s=null:s=r(i=c),a):i},a}function ke(e,t,n){var i=null,r=X(!0),s=null,o=St,a=null,c=zn(l);e=typeof e=="function"?e:e===void 0?Wn:X(+e),t=typeof t=="function"?t:X(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Un:X(+n);function l(h){var f,p,d,y=(h=Hn(h)).length,m,g=!1,x,_=new Array(y),w=new Array(y);for(s==null&&(a=o(x=c())),f=0;f<=y;++f){if(!(f<y&&r(m=h[f],f,h))===g)if(g=!g)p=f,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),d=f-1;d>=p;--d)a.point(_[d],w[d]);a.lineEnd(),a.areaEnd()}g&&(_[f]=+e(m,f,h),w[f]=+t(m,f,h),a.point(i?+i(m,f,h):_[f],n?+n(m,f,h):w[f]))}if(x)return a=null,x+""||null}function u(){return pt().defined(r).curve(o).context(s)}return l.x=function(h){return arguments.length?(e=typeof h=="function"?h:X(+h),i=null,l):e},l.x0=function(h){return arguments.length?(e=typeof h=="function"?h:X(+h),l):e},l.x1=function(h){return arguments.length?(i=h==null?null:typeof h=="function"?h:X(+h),l):i},l.y=function(h){return arguments.length?(t=typeof h=="function"?h:X(+h),n=null,l):t},l.y0=function(h){return arguments.length?(t=typeof h=="function"?h:X(+h),l):t},l.y1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:X(+h),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(i).y(t)},l.defined=function(h){return arguments.length?(r=typeof h=="function"?h:X(!!h),l):r},l.curve=function(h){return arguments.length?(o=h,s!=null&&(a=o(s)),l):o},l.context=function(h){return arguments.length?(h==null?s=a=null:a=o(s=h),l):s},l}function Yn(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function Me(e,t){this._context=e,this._k=(1-t)/6}Me.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Yn(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Yn(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},function e(t){function n(i){return new Me(i,t)}return n.tension=function(i){return e(+i)},n}(0);function Oa(e,t,n){var i=e._x1,r=e._y1,s=e._x2,o=e._y2;if(e._l01_a>On){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,r=(r*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>On){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(i,r,s,o,e._x2,e._y2)}function qn(e,t){this._context=e,this._alpha=t}qn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Oa(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Ba=function e(t){function n(i){return t?new qn(i,t):new Me(i,0)}return n.alpha=function(i){return e(+i)},n}(.5);class Ae extends J{constructor(t){super(t)}getCurve(){return St}render(){const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.data,o=this.getColor(),a=this.config.fillOpacity??.3,c=this.config.fillColor||o,l=this.config.lineColor||o,u=this.config.lineWidth??1,h=s.filter(g=>{const x=g.low,_=g.high??g.y;return x!=null&&_!==void 0&&_!==null});if(h.length===0)return;const f=(g,x)=>t.getPixelForValue(g.x??x),p=g=>n.getPixelForValue(g.low),d=g=>n.getPixelForValue(g.high??g.y),y=ke().x((g,x)=>f(g,x)).y0(g=>p(g)).y1(g=>d(g)).curve(this.getCurve()),m=this.group.append("path").datum(h).attr("class","katucharts-arearange-fill").attr("d",y).attr("fill",c).attr("fill-opacity",a).attr("stroke","none");if(u>0){const g=pt().x((_,w)=>f(_,w)).y(_=>d(_)).curve(this.getCurve()),x=pt().x((_,w)=>f(_,w)).y(_=>p(_)).curve(this.getCurve());this.group.append("path").datum(h).attr("class","katucharts-arearange-line-top").attr("d",g).attr("fill","none").attr("stroke",l).attr("stroke-width",u),this.group.append("path").datum(h).attr("class","katucharts-arearange-line-bottom").attr("d",x).attr("fill","none").attr("stroke",l).attr("stroke-width",u)}if(r){const g=i.height/2,x=ke().x((_,w)=>f(_,w)).y0(()=>g).y1(()=>g).curve(this.getCurve());if(m.attr("d",x).transition().duration(F).ease(W).attr("d",y),u>0){const w=pt().x((M,I)=>f(M,I)).y(()=>g).curve(this.getCurve())(h)||"",v=pt().x((M,I)=>f(M,I)).y(M=>d(M)).curve(this.getCurve())(h)||"",k=pt().x((M,I)=>f(M,I)).y(M=>p(M)).curve(this.getCurve())(h)||"";this.group.select(".katucharts-arearange-line-top").attr("d",w).transition().duration(F).ease(W).attr("d",v),this.group.select(".katucharts-arearange-line-bottom").attr("d",w).transition().duration(F).ease(W).attr("d",k)}this.emitAfterAnimate(F)}}getDataExtents(){let t=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of this.data){const o=s.x??0;o<t&&(t=o),o>n&&(n=o);const a=s.low,c=s.high??s.y;a!=null&&(a<i&&(i=a),a>r&&(r=a)),c!=null&&(c<i&&(i=c),c>r&&(r=c))}return{xMin:t,xMax:n,yMin:i,yMax:r}}}class Gn extends Ae{getCurve(){return Ba.alpha(.5)}}class Kn extends J{constructor(t){super(t)}render(){var m,g;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.data,o=this.config.groupPadding??.2,a=this.config.pointPadding??.1,c=o+a,l=this.config.maxPointWidth??1/0,u=Math.max(1,Math.min(l,i.width/Math.max(1,s.length)*(1-c))),h=this.config.pointWidth??u,f=this.getColor(),p=this.config.borderRadius??0,d=((g=(m=this.config.states)==null?void 0:m.inactive)==null?void 0:g.opacity)??.4,y=[];for(let x=0;x<s.length;x++){const _=s[x],w=_.low,v=_.high??_.y;if(w==null||v===void 0||v===null)continue;const k=t.getPixelForValue(_.x??x),M=n.getPixelForValue(v),I=n.getPixelForValue(w),E=Math.min(M,I),P=Math.max(1,Math.abs(I-M)),O=_.color||f,A=this.group.append("rect").attr("class","katucharts-columnrange-bar").attr("x",k-h/2).attr("width",h).attr("fill",O).attr("rx",p).style("cursor",this.config.cursor||"pointer");if(r){const R=E+P/2;A.attr("y",R).attr("height",0).transition().duration(F).ease(W).delay(at(x,0,q,s.length)).attr("y",E).attr("height",P)}else A.attr("y",E).attr("height",P);y.push(A),this.config.enableMouseTracking!==!1&&A.on("mouseover",R=>{var N,V;A.transition("hover").duration($).ease(T).attr("opacity",.85),y.forEach((S,C)=>{C!==x&&S.interrupt("highlight"),C!==x&&S.transition("highlight").duration($).ease(T).attr("opacity",d)}),this.context.events.emit("point:mouseover",{point:_,index:x,series:this,event:R,plotX:k,plotY:M}),(V=(N=_.events)==null?void 0:N.mouseOver)==null||V.call(_,R)}).on("mouseout",R=>{var N,V;A.transition("hover").duration($).ease(T).attr("opacity",1),y.forEach(S=>{S.interrupt("highlight"),S.transition("highlight").duration($).ease(T).attr("opacity",1)}),this.context.events.emit("point:mouseout",{point:_,index:x,series:this,event:R}),(V=(N=_.events)==null?void 0:N.mouseOut)==null||V.call(_,R)}).on("click",R=>{var N,V,S,C;this.context.events.emit("point:click",{point:_,index:x,series:this,event:R}),(V=(N=_.events)==null?void 0:N.click)==null||V.call(_,R),(C=(S=this.config.events)==null?void 0:S.click)==null||C.call(this,R)})}r&&this.emitAfterAnimate(F+s.length*q)}getDataExtents(){let t=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of this.data){const o=s.x??0;o<t&&(t=o),o>n&&(n=o);const a=s.low,c=s.high??s.y;a!=null&&(a<i&&(i=a),a>r&&(r=a)),c!=null&&(c<i&&(i=c),c>r&&(r=c))}return{xMin:t,xMax:n,yMin:i,yMax:r}}}class Zn extends J{constructor(t){super(t)}render(){const{yAxis:t,plotArea:n}=this.context,i=this.context.animate,r=this.data;if(r.length===0)return;const s=Math.max(...r.map(h=>h.volume??0))||1,o=this.config.zoneWidth??.3,a=n.width*o,c=this.config.color||"rgba(120,150,200,0.45)",l=this.config.upColor,u=this.config.fillOpacity??.5;for(const h of r){const f=h.low,p=h.high,d=h.volume??0;if(f===void 0||p===void 0)continue;const y=t.getPixelForValue(p),m=t.getPixelForValue(f),g=Math.min(y,m),x=Math.max(1,Math.abs(m-y)-1),_=d/s*a,w=this.group.append("rect").attr("class","katucharts-vbp-bar").attr("x",0).attr("y",g).attr("height",x).attr("fill",l||c).attr("opacity",u);i?w.attr("width",0).transition().duration(F).ease(W).attr("width",_):w.attr("width",_),this.config.enableMouseTracking!==!1&&w.on("mouseover",v=>{this.context.events.emit("point:mouseover",{point:{x:h.x,y:h.y,low:f,high:p,volume:d},index:0,series:this,event:v,plotX:_,plotY:g})}).on("mouseout",v=>{this.context.events.emit("point:mouseout",{point:h,index:0,series:this,event:v})})}}getDataExtents(){return{xMin:1/0,xMax:-1/0,yMin:1/0,yMax:-1/0}}}class Jn extends J{constructor(t){super(t)}render(){var w,v,k,M,I,E;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.data,o=this.config.threshold??0,a=n.getPixelForValue(o),c={color:((w=this.config.topLine)==null?void 0:w.color)??"#2f7ed8",fillColor:((v=this.config.topLine)==null?void 0:v.fillColor)??"rgba(47,126,216,0.2)",fillOpacity:((k=this.config.topLine)==null?void 0:k.fillOpacity)??1},l={color:((M=this.config.bottomLine)==null?void 0:M.color)??"#f45b5b",fillColor:((I=this.config.bottomLine)==null?void 0:I.fillColor)??"rgba(244,91,91,0.2)",fillOpacity:((E=this.config.bottomLine)==null?void 0:E.fillOpacity)??1},u=this.config.lineWidth??2,h=s.filter(P=>P.y!==null&&P.y!==void 0);if(h.length===0)return;const f=(P,O)=>t.getPixelForValue(P.x??O),p=P=>n.getPixelForValue(P.y??0),d=`katucharts-baseline-top-${this.config.index}-${Date.now()}`,y=`katucharts-baseline-bottom-${this.config.index}-${Date.now()}`,m=this.group.select(function(){return this.ownerSVGElement});if(m.empty())return;let g=m.select("defs");g.empty()&&(g=m.append("defs")),g.append("clipPath").attr("id",d).append("rect").attr("x",0).attr("y",0).attr("width",i.width).attr("height",Math.max(0,a)),g.append("clipPath").attr("id",y).append("rect").attr("x",0).attr("y",a).attr("width",i.width).attr("height",Math.max(0,i.height-a));const x=ke().x((P,O)=>f(P,O)).y0(()=>a).y1(P=>p(P)).curve(St),_=pt().x((P,O)=>f(P,O)).y(P=>p(P)).curve(St);this.renderZone(h,x,_,d,c,u,"top"),this.renderZone(h,x,_,y,l,u,"bottom"),this.config.lineWidth!==0&&this.group.append("line").attr("class","katucharts-baseline-threshold").attr("x1",0).attr("x2",i.width).attr("y1",a).attr("y2",a).attr("stroke","#999").attr("stroke-width",1).attr("stroke-dasharray","4,3").attr("opacity",.6),r&&this.animateDrawIn(u)}renderZone(t,n,i,r,s,o,a){const c=this.group.append("g").attr("class",`katucharts-baseline-zone-${a}`).attr("clip-path",`url(#${r})`);c.append("path").datum(t).attr("class",`katucharts-baseline-area-${a}`).attr("d",n).attr("fill",s.fillColor).attr("fill-opacity",s.fillOpacity).attr("stroke","none"),c.append("path").datum(t).attr("class",`katucharts-baseline-line-${a}`).attr("d",i).attr("fill","none").attr("stroke",s.color).attr("stroke-width",o)}animateDrawIn(t){this.group.selectAll('[class*="katucharts-baseline-line-"]').each(function(){var s;const n=this,i=((s=n.getTotalLength)==null?void 0:s.call(n))??0;if(i===0)return;const r=Ss(n);r.attr("stroke-dasharray",`${i} ${i}`).attr("stroke-dashoffset",i).transition().duration(F).ease(W).attr("stroke-dashoffset",0).on("end",()=>{r.attr("stroke-dasharray",null)})}),this.group.selectAll('[class*="katucharts-baseline-area-"]').attr("opacity",0).transition().duration(F).ease(W).attr("opacity",1),this.emitAfterAnimate(F)}getDataExtents(){let t=1/0,n=-1/0,i=1/0,r=-1/0;const s=this.config.threshold??0;for(const o of this.data){const a=o.x??0;a<t&&(t=a),a>n&&(n=a);const c=o.y??0;c<i&&(i=c),c>r&&(r=c)}return s<i&&(i=s),s>r&&(r=s),{xMin:t,xMax:n,yMin:i,yMax:r}}}const Qn=30,Tt=20,Ce=25,Pe=8,gt=12,Ee="9px";class jn extends J{constructor(t){super(t)}render(){const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.data,o=this.config.shape||"flag",a=this.getColor(),c=this.resolveOnSeries();for(let l=0;l<s.length;l++){const u=s[l];if(u.x===void 0||u.x===null)continue;const h=t.getPixelForValue(u.x??l),f=this.resolveAnchorY(u,l,c,n,i),p=u.shape||o,d=u.color||this.config.color||a,y=u.title??"",m=this.group.append("g").attr("class","katucharts-flag").style("cursor",this.config.cursor||"pointer"),g=f-Ce;if(m.append("line").attr("x1",h).attr("x2",h).attr("y1",f).attr("y2",g).attr("stroke",d).attr("stroke-width",1),this.renderShape(m,p,h,g,d,y),r){const x=at(l,0,q,s.length);m.attr("opacity",0).transition().duration(F).ease(W).delay(x).attr("opacity",1)}this.attachFlagEvents(m,u,l,h,g)}}getDataExtents(){let t=1/0,n=-1/0;for(const i of this.data)i.x!==void 0&&i.x!==null&&(i.x<t&&(t=i.x),i.x>n&&(n=i.x));return{xMin:t,xMax:n,yMin:1/0,yMax:-1/0}}resolveOnSeries(){const t=this.config.onSeries;return this.context.allSeries?t?this.context.allSeries.find(n=>n.config.id===t)??null:this.context.allSeries.find(n=>n!==this&&n.config._internalType!=="flags")??null:null}resolveAnchorY(t,n,i,r,s){if(!i)return Ce+Tt;const o=t.x??n,a=i.data;let c=null,l=1/0;for(const u of a){const h=u.x??0,f=Math.abs(h-o);f<l&&(l=f,c=u)}if(c){const u=c.high??c.y;if(u!=null)return r.getPixelForValue(u)}return Ce+Tt}renderShape(t,n,i,r,s,o){switch(n){case"circlepin":t.append("circle").attr("cx",i).attr("cy",r-Pe).attr("r",Pe).attr("fill",s).attr("stroke",s).attr("stroke-width",1),o&&t.append("text").attr("x",i).attr("y",r-Pe).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill","#ffffff").attr("font-size",Ee).style("pointer-events","none").text(o);break;case"squarepin":t.append("rect").attr("x",i-gt/2).attr("y",r-gt-gt/2).attr("width",gt).attr("height",gt).attr("fill",s).attr("stroke",s).attr("stroke-width",1).attr("transform",`rotate(45,${i},${r-gt})`),o&&t.append("text").attr("x",i).attr("y",r-gt).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill","#ffffff").attr("font-size",Ee).style("pointer-events","none").text(o);break;case"flag":default:t.append("rect").attr("x",i).attr("y",r-Tt).attr("width",Qn).attr("height",Tt).attr("fill",s).attr("stroke",s).attr("stroke-width",1).attr("rx",2),o&&t.append("text").attr("x",i+Qn/2).attr("y",r-Tt/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill","#ffffff").attr("font-size",Ee).style("pointer-events","none").text(o);break}}attachFlagEvents(t,n,i,r,s){var c;if(this.config.enableMouseTracking===!1)return;const o=n.events||{},a=((c=this.config.point)==null?void 0:c.events)||{};t.on("mouseover",l=>{var u,h;t.style("filter","drop-shadow(0 2px 4px rgba(0,0,0,0.3))"),this.context.events.emit("point:mouseover",{point:n,index:i,series:this,event:l,plotX:r,plotY:s}),(u=o.mouseOver)==null||u.call(n,l),(h=a.mouseOver)==null||h.call(n,l)}).on("mouseout",l=>{var u,h;t.style("filter",""),this.context.events.emit("point:mouseout",{point:n,index:i,series:this,event:l}),(u=o.mouseOut)==null||u.call(n,l),(h=a.mouseOut)==null||h.call(n,l)}).on("click",l=>{var u,h,f,p;this.context.events.emit("point:click",{point:n,index:i,series:this,event:l}),(u=o.click)==null||u.call(n,l),(h=a.click)==null||h.call(n,l),(p=(f=this.config.events)==null?void 0:f.click)==null||p.call(this,l)})}}class ti extends J{constructor(t){super(t),this.bricks=[]}processData(){super.processData();const t=this.config.brickSize??1,n=this.data.map(s=>s.close??s.y).filter(s=>s!=null);if(this.bricks=[],n.length<2)return;let i=Math.floor(n[0]/t)*t,r=0;for(let s=1;s<n.length;s++){const a=n[s]-i,c=Math.floor(Math.abs(a)/t);if(c>=1){const l=a>0?"up":"down";for(let u=0;u<c;u++){const h=l==="up"?i+u*t:i-(u+1)*t;this.bricks.push({index:r++,direction:l,bottom:h,top:h+t})}i+=(l==="up"?1:-1)*c*t}}}render(){var h,f;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.bricks;if(s.length===0)return;const o=this.config.upColor||"#2f7ed8",a=this.config.downColor||this.config.color||"#f45b5b",c=((f=(h=this.config.states)==null?void 0:h.inactive)==null?void 0:f.opacity)??.4,l=Math.max(1,i.width/Math.max(1,s.length)*.8),u=[];for(let p=0;p<s.length;p++){const d=s[p],y=t.getPixelForValue(d.index),m=n.getPixelForValue(d.top),g=n.getPixelForValue(d.bottom),x=Math.max(1,Math.abs(g-m)),_=d.direction==="up"?o:a,w=this.group.append("rect").attr("class","katucharts-renko-brick").attr("x",y-l/2).attr("y",Math.min(m,g)).attr("width",l).attr("height",x).attr("fill",_).attr("stroke",_).attr("stroke-width",.5).style("cursor",this.config.cursor||"pointer");u.push(w),r&&w.attr("opacity",0).transition().duration(F).ease(W).delay(at(p,0,q,s.length)).attr("opacity",1),this.config.enableMouseTracking!==!1&&w.on("mouseover",v=>{w.style("filter","drop-shadow(0 2px 4px rgba(0,0,0,0.25))"),u.forEach((k,M)=>{M!==p&&k.transition("highlight").duration($).ease(T).attr("opacity",c)}),this.context.events.emit("point:mouseover",{point:{x:d.index,y:d.top,low:d.bottom,high:d.top,direction:d.direction},index:p,series:this,event:v,plotX:y,plotY:m})}).on("mouseout",v=>{w.style("filter",""),u.forEach(k=>k.interrupt("highlight")),u.forEach(k=>k.transition("highlight").duration($).ease(T).attr("opacity",1)),this.context.events.emit("point:mouseout",{point:{x:d.index,y:d.top},index:p,series:this,event:v})}).on("click",v=>{var k,M;this.context.events.emit("point:click",{point:{x:d.index,y:d.top,direction:d.direction},index:p,series:this,event:v}),(M=(k=this.config.events)==null?void 0:k.click)==null||M.call(this,v)})}r&&this.emitAfterAnimate(F+s.length*q)}getDataExtents(){if(this.bricks.length===0&&this.processData(),this.bricks.length===0)return{xMin:0,xMax:0,yMin:0,yMax:0};let t=1/0,n=-1/0;for(const i of this.bricks)i.bottom<t&&(t=i.bottom),i.top>n&&(n=i.top);return{xMin:0,xMax:this.bricks.length-1,yMin:t,yMax:n}}}class ei extends J{constructor(t){super(t),this.segments=[]}processData(){super.processData();const t=this.data.map(f=>f.close??f.y).filter(f=>f!=null);if(this.segments=[],t.length<2)return;const n=Math.max(...t)-Math.min(...t),i=this.config.reversalAmount??n*.04;let r=t[1]>=t[0]?"up":"down",s=t[0],o=t[1],a=0;const c=[],l=[];let u="yin";const h=(f,p)=>{if(r==="up"){const d=c.length>0?c[c.length-1]:-1/0;p>d&&(u="yang"),c.push(p)}else{const d=l.length>0?l[l.length-1]:1/0;p<d&&(u="yin"),l.push(p)}this.segments.push({x:a++,startPrice:f,endPrice:p,type:u})};for(let f=2;f<t.length;f++){const p=t[f];r==="up"?p>o?o=p:o-p>=i&&(h(s,o),s=o,o=p,r="down"):p<o?o=p:p-o>=i&&(h(s,o),s=o,o=p,r="up")}h(s,o)}render(){var f,p;const{xAxis:t,yAxis:n}=this.context,i=this.context.animate,r=this.segments;if(r.length===0)return;const s=this.config.upColor||"#2f7ed8",o=this.config.downColor||this.config.color||"#f45b5b";for(let d=0;d<r.length;d++){const y=r[d];t.getPixelForValue(y.x),n.getPixelForValue(y.startPrice),n.getPixelForValue(y.endPrice)}const a=[];let c="",l=r[0].type,u=null,h=null;for(let d=0;d<r.length;d++){const y=r[d],m=t.getPixelForValue(y.x),g=n.getPixelForValue(y.startPrice),x=n.getPixelForValue(y.endPrice);y.type!==l&&c&&(a.push({d:c,type:l}),c=`M${u},${h}L${m},${h}`,l=y.type),c?u!==null&&(c+=`L${m},${h}`):c=`M${m},${g}`,c+=`L${m},${x}`,u=m,h=x}c&&a.push({d:c,type:l});for(const d of a){const y=d.type==="yang"?s:o,m=d.type==="yang"?3:1,g=this.group.append("path").attr("class",`katucharts-kagi-${d.type}`).attr("d",d.d).attr("fill","none").attr("stroke",y).attr("stroke-width",m).attr("stroke-linejoin","miter");if(i){const x=((p=(f=g.node()).getTotalLength)==null?void 0:p.call(f))||0;x>0&&g.attr("stroke-dasharray",`${x} ${x}`).attr("stroke-dashoffset",x).transition().duration(F).ease(W).attr("stroke-dashoffset",0).on("end",()=>{g.attr("stroke-dasharray",null)})}}if(this.config.enableMouseTracking!==!1)for(let d=0;d<r.length;d++){const y=r[d],m=t.getPixelForValue(y.x),g=n.getPixelForValue(y.startPrice),x=n.getPixelForValue(y.endPrice),_=Math.abs(x-g);this.group.append("rect").attr("class","katucharts-kagi-hitarea").attr("x",m-8).attr("y",Math.min(g,x)).attr("width",16).attr("height",Math.max(_,4)).attr("fill","transparent").style("cursor",this.config.cursor||"pointer").on("mouseover",w=>{const v=`katucharts-kagi-${y.type}`,k=y.type==="yang"?3:1;this.group.selectAll(`path.${v}`).interrupt("hover").transition("hover").duration($).ease(T).attr("stroke-width",k+1.5);const M=y.type==="yang"?"katucharts-kagi-yin":"katucharts-kagi-yang";this.group.selectAll(`path.${M}`).interrupt("hover").transition("hover").duration(me).ease(T).attr("opacity",.3),this.context.events.emit("point:mouseover",{point:{x:y.x,y:y.endPrice,open:y.startPrice,close:y.endPrice,type:y.type},index:d,series:this,event:w,plotX:m,plotY:x})}).on("mouseout",w=>{this.group.selectAll("path.katucharts-kagi-yang").interrupt("hover").transition("hover").duration($).ease(T).attr("stroke-width",3).attr("opacity",1),this.group.selectAll("path.katucharts-kagi-yin").interrupt("hover").transition("hover").duration($).ease(T).attr("stroke-width",1).attr("opacity",1),this.context.events.emit("point:mouseout",{point:{x:y.x,y:y.endPrice},index:d,series:this,event:w})}).on("click",w=>{var v,k;this.context.events.emit("point:click",{point:{x:y.x,y:y.endPrice,type:y.type},index:d,series:this,event:w}),(k=(v=this.config.events)==null?void 0:v.click)==null||k.call(this,w)})}i&&this.emitAfterAnimate(F)}getDataExtents(){if(this.segments.length===0&&this.processData(),this.segments.length===0)return{xMin:0,xMax:0,yMin:0,yMax:0};let t=1/0,n=-1/0;for(const i of this.segments){const r=Math.min(i.startPrice,i.endPrice),s=Math.max(i.startPrice,i.endPrice);r<t&&(t=r),s>n&&(n=s)}return{xMin:0,xMax:this.segments.length-1,yMin:t,yMax:n}}}class ni extends J{constructor(t){super(t),this.columns=[]}processData(){super.processData();const t=this.config.boxSize??1,i=(this.config.reversalAmount??3)*t,r=this.data.map(f=>f.close??f.y).filter(f=>f!=null);if(this.columns=[],r.length<2)return;const s=f=>Math.floor(f/t)*t;let o=r[1]>=r[0]?"X":"O",a=s(r[0])+t,c=s(r[0]),l=0;const u=(f,p)=>{const d=[];for(let y=f;y<p;y+=t)d.push(y);return d},h=()=>{this.columns.push({index:l++,direction:o,startPrice:o==="X"?c:a,endPrice:o==="X"?a:c,boxes:u(c,a)})};for(let f=1;f<r.length;f++){const p=r[f],d=s(p);o==="X"?d+t>a?a=d+t:a-d>=i&&(h(),o="O",a=a-t,c=d):d<c?c=d:d-c>=i&&(h(),o="X",c=c+t,a=d+t)}h()}render(){var p,d;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.columns;if(s.length===0)return;const o=this.config.boxSize??1,a=this.config.upColor||"#2f7ed8",c=this.config.downColor||this.config.color||"#f45b5b",l=((d=(p=this.config.states)==null?void 0:p.inactive)==null?void 0:d.opacity)??.4,u=Math.max(8,Math.min(16,i.width/Math.max(1,s.length)*.6)),h=[];let f=0;for(let y=0;y<s.length;y++){const m=s[y],g=m.direction==="X"?a:c,x=m.direction==="X"?"X":"O",_=this.group.append("g").attr("class",`katucharts-pnf-column katucharts-pnf-${m.direction}`).style("cursor",this.config.cursor||"pointer");h.push(_);for(const w of m.boxes){const v=t.getPixelForValue(m.index),k=n.getPixelForValue(w+o/2),M=_.append("text").attr("x",v).attr("y",k).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",`${u}px`).attr("font-weight","bold").attr("fill",g).style("pointer-events","none").text(x);r&&(M.attr("opacity",0).transition().duration(F).ease(W).delay(at(f,0,q,this.getTotalBoxCount())).attr("opacity",1),f++)}if(this.config.enableMouseTracking!==!1){const w=t.getPixelForValue(m.index),v=n.getPixelForValue(Math.max(m.startPrice,m.endPrice)),k=n.getPixelForValue(Math.min(m.startPrice,m.endPrice)),M=Math.max(u*1.5,20),I=Math.max(Math.abs(k-v),4);_.append("rect").attr("x",w-M/2).attr("y",Math.min(v,k)).attr("width",M).attr("height",I).attr("fill","transparent").style("cursor",this.config.cursor||"pointer").on("mouseover",E=>{_.selectAll("text").interrupt("hover").transition("hover").duration($).ease(T).attr("font-size",`${u*1.2}px`),h.forEach((P,O)=>{O!==y&&P.transition("highlight").duration($).ease(T).attr("opacity",l)}),this.context.events.emit("point:mouseover",{point:{x:m.index,y:m.endPrice,direction:m.direction,startPrice:m.startPrice,endPrice:m.endPrice,boxCount:m.boxes.length},index:y,series:this,event:E,plotX:w,plotY:v})}).on("mouseout",E=>{_.selectAll("text").interrupt("hover").transition("hover").duration($).ease(T).attr("font-size",`${u}px`),h.forEach(P=>P.interrupt("highlight")),h.forEach(P=>P.transition("highlight").duration($).ease(T).attr("opacity",1)),this.context.events.emit("point:mouseout",{point:{x:m.index,y:m.endPrice},index:y,series:this,event:E})}).on("click",E=>{var P,O;this.context.events.emit("point:click",{point:{x:m.index,y:m.endPrice,direction:m.direction},index:y,series:this,event:E}),(O=(P=this.config.events)==null?void 0:P.click)==null||O.call(this,E)})}}if(r){const y=this.getTotalBoxCount();this.emitAfterAnimate(F+y*q)}}getTotalBoxCount(){return this.columns.reduce((t,n)=>t+n.boxes.length,0)}getDataExtents(){if(this.columns.length===0&&this.processData(),this.columns.length===0)return{xMin:0,xMax:0,yMin:0,yMax:0};const t=this.config.boxSize??1;let n=1/0,i=-1/0;for(const r of this.columns)for(const s of r.boxes)s<n&&(n=s),s+t>i&&(i=s+t);return{xMin:0,xMax:this.columns.length-1,yMin:n,yMax:i}}}class ii extends J{constructor(t){super(t),this.blocks=[]}processData(){super.processData();const t=this.config.lineBreakCount??3,n=this.data.map(r=>r.close??r.y).filter(r=>r!=null);if(this.blocks=[],n.length<2)return;const i={index:0,open:n[0],close:n[1],direction:n[1]>=n[0]?"up":"down"};this.blocks.push(i);for(let r=2;r<n.length;r++){const s=n[r],o=this.blocks.slice(-t),a=this.blocks[this.blocks.length-1];let c=-1/0,l=1/0;for(const u of o){const h=Math.max(u.open,u.close),f=Math.min(u.open,u.close);h>c&&(c=h),f<l&&(l=f)}s>c?this.blocks.push({index:this.blocks.length,open:a.close,close:s,direction:"up"}):s<l&&this.blocks.push({index:this.blocks.length,open:a.close,close:s,direction:"down"})}}render(){var h,f;const{xAxis:t,yAxis:n,plotArea:i}=this.context,r=this.context.animate,s=this.blocks;if(s.length===0)return;const o=this.config.upColor||"#2f7ed8",a=this.config.downColor||this.config.color||"#f45b5b",c=((f=(h=this.config.states)==null?void 0:h.inactive)==null?void 0:f.opacity)??.4,l=Math.max(1,i.width/Math.max(1,s.length)*.8),u=[];for(let p=0;p<s.length;p++){const d=s[p],y=t.getPixelForValue(d.index),m=n.getPixelForValue(d.open),g=n.getPixelForValue(d.close),x=Math.min(m,g),_=Math.max(1,Math.abs(m-g)),w=d.direction==="up"?o:a,v=x+_/2,k=this.group.append("rect").attr("class","katucharts-linebreak-block").attr("x",y-l/2).attr("width",l).attr("fill",w).attr("stroke",w).attr("stroke-width",.5).style("cursor",this.config.cursor||"pointer");u.push(k),r?k.attr("y",v).attr("height",0).transition().duration(F).ease(W).delay(at(p,0,q,s.length)).attr("y",x).attr("height",_):k.attr("y",x).attr("height",_),this.config.enableMouseTracking!==!1&&k.on("mouseover",M=>{k.style("filter","drop-shadow(0 2px 4px rgba(0,0,0,0.25))"),u.forEach((I,E)=>{E!==p&&I.transition("highlight").duration($).ease(T).attr("opacity",c)}),this.context.events.emit("point:mouseover",{point:{x:d.index,y:d.close,open:d.open,close:d.close,direction:d.direction},index:p,series:this,event:M,plotX:y,plotY:g})}).on("mouseout",M=>{k.style("filter",""),u.forEach(I=>I.interrupt("highlight")),u.forEach(I=>I.transition("highlight").duration($).ease(T).attr("opacity",1)),this.context.events.emit("point:mouseout",{point:{x:d.index,y:d.close},index:p,series:this,event:M})}).on("click",M=>{var I,E;this.context.events.emit("point:click",{point:{x:d.index,y:d.close,direction:d.direction},index:p,series:this,event:M}),(E=(I=this.config.events)==null?void 0:I.click)==null||E.call(this,M)})}r&&this.emitAfterAnimate(F+s.length*q)}getDataExtents(){if(this.blocks.length===0&&this.processData(),this.blocks.length===0)return{xMin:0,xMax:0,yMin:0,yMax:0};let t=1/0,n=-1/0;for(const i of this.blocks){const r=Math.min(i.open,i.close),s=Math.max(i.open,i.close);r<t&&(t=r),s>n&&(n=s)}return{xMin:0,xMax:this.blocks.length-1,yMin:t,yMax:n}}}function ri(){G.registerType("heikinashi",Vn),G.registerType("hollowcandlestick",Dn),G.registerType("volume",Ln),G.registerType("arearange",Ae),G.registerType("areasplinerange",Gn),G.registerType("columnrange",Kn),G.registerType("vbp",Zn),G.registerType("baseline",Jn),G.registerType("flags",jn),G.registerType("renko",ti),G.registerType("kagi",ei),G.registerType("pointandfigure",ni),G.registerType("linebreak",ii)}class z{}class za{constructor(){this.indicators=new Map}register(t){this.indicators.set(t.name.toLowerCase(),t)}get(t){return this.indicators.get(t.toLowerCase())}getAll(){return new Map(this.indicators)}}const si=globalThis,H=si.__katuIndicatorRegistry||(si.__katuIndicatorRegistry=new za);class oi extends z{constructor(){super(...arguments),this.name="sma"}calculate(t,n){const i=n.period??14,r=new Array(t.length);let s=0;for(let o=0;o<t.length;o++)s+=t[o].close,o>=i&&(s-=t[o-i].close),o<i-1?r[o]={x:t[o].x,y:null}:r[o]={x:t[o].x,y:s/i};return{values:r}}}const ai=new oi;H.register(ai);class li extends z{constructor(){super(...arguments),this.name="ema"}calculate(t,n){const i=n.period??14,r=2/(i+1),s=new Array(t.length);let o=0,a=0;for(let c=0;c<t.length;c++)c<i-1?(a+=t[c].close,s[c]={x:t[c].x,y:null}):c===i-1?(a+=t[c].close,o=a/i,s[c]={x:t[c].x,y:o}):(o=t[c].close*r+o*(1-r),s[c]={x:t[c].x,y:o});return{values:s}}}const ci=new li;H.register(ci);class hi extends z{constructor(){super(...arguments),this.name="wma"}calculate(t,n){const i=n.period??14,r=i*(i+1)/2,s=new Array(t.length);for(let o=0;o<t.length;o++){if(o<i-1){s[o]={x:t[o].x,y:null};continue}let a=0;for(let c=0;c<i;c++)a+=t[o-i+1+c].close*(c+1);s[o]={x:t[o].x,y:a/r}}return{values:s}}}const ui=new hi;H.register(ui);function $t(e,t){const n=2/(t+1),i=new Array(e.length).fill(null);let r=null,s=0,o=0;for(let a=0;a<e.length;a++){const c=e[a];c!=null&&(r===null?(s+=c,o++,o===t&&(r=s/t,i[a]=r)):(r=c*n+r*(1-n),i[a]=r))}return i}class fi extends z{constructor(){super(...arguments),this.name="dema"}calculate(t,n){const i=n.period??14,r=t.map(c=>c.close),s=$t(r,i),o=$t(s,i);return{values:t.map((c,l)=>{const u=s[l],h=o[l];return{x:c.x,y:u!==null&&h!==null?2*u-h:null}})}}}const di=new fi;H.register(di);class pi extends z{constructor(){super(...arguments),this.name="tema"}calculate(t,n){const i=n.period??14,r=t.map(l=>l.close),s=$t(r,i),o=$t(s,i),a=$t(o,i);return{values:t.map((l,u)=>{const h=s[u],f=o[u],p=a[u];return{x:l.x,y:h!==null&&f!==null&&p!==null?3*h-3*f+p:null}})}}}const gi=new pi;H.register(gi);class xi extends z{constructor(){super(...arguments),this.name="rsi"}calculate(t,n){const i=n.period??14,r=new Array(t.length);for(let c=0;c<i;c++)r[c]={x:t[c].x,y:null};let s=0,o=0;for(let c=1;c<=i;c++){const l=t[c].close-t[c-1].close;s+=Math.max(0,l),o+=Math.max(0,-l)}s/=i,o/=i;const a=o===0?1/0:s/o;r[i]={x:t[i].x,y:o===0?100:100-100/(1+a)};for(let c=i+1;c<t.length;c++){const l=t[c].close-t[c-1].close,u=Math.max(0,l),h=Math.max(0,-l);s=(s*(i-1)+u)/i,o=(o*(i-1)+h)/i;const f=o===0?100:100-100/(1+s/o);r[c]={x:t[c].x,y:f}}return{values:r}}}const yi=new xi;H.register(yi);class mi extends z{constructor(){super(...arguments),this.name="stochastic"}calculate(t,n){const i=n.kPeriod??14,r=n.dPeriod??3,s=n.smoothK??3,o=this.computeRawK(t,i),a=this.sma(o,s),c=this.sma(a,r),l=new Array(t.length),u=new Array(t.length);for(let h=0;h<t.length;h++)l[h]={x:t[h].x,y:a[h]},u[h]={x:t[h].x,y:c[h]};return{values:l,signal:u}}computeRawK(t,n){const i=new Array(t.length);for(let r=0;r<t.length;r++){if(r<n-1){i[r]=null;continue}let s=1/0,o=-1/0;for(let c=r-n+1;c<=r;c++)t[c].low<s&&(s=t[c].low),t[c].high>o&&(o=t[c].high);const a=o-s;i[r]=a===0?50:100*(t[r].close-s)/a}return i}sma(t,n){const i=new Array(t.length).fill(null),r=[];for(let s=0;s<t.length;s++)if(t[s]!==null&&r.push(s),r.length>=n){let o=0;for(let a=r.length-n;a<r.length;a++)o+=t[r[a]];i[s]=o/n}return i}}const _i=new mi;H.register(_i);class wi extends z{constructor(){super(...arguments),this.name="macd"}calculate(t,n){const i=n.fastPeriod??12,r=n.slowPeriod??26,s=n.signalPeriod??9,o=t.map(m=>m.close),a=this.ema(o,i),c=this.ema(o,r),l=new Array(t.length);for(let m=0;m<t.length;m++)a[m]===null||c[m]===null?l[m]=null:l[m]=a[m]-c[m];const u=this.extractNonNull(l),h=this.ema(u.values,s),f=new Array(t.length),p=new Array(t.length),d=new Array(t.length);let y=0;for(let m=0;m<t.length;m++){const g=t[m].x;if(l[m]===null)f[m]={x:g,y:null},p[m]={x:g,y:null},d[m]={x:g,y:null};else{const x=l[m],_=h[y];f[m]={x:g,y:x},p[m]={x:g,y:_},d[m]={x:g,y:_===null?null:x-_},y++}}return{values:f,signal:p,histogram:d}}ema(t,n){const i=new Array(t.length).fill(null);if(t.length<n)return i;let r=0;for(let o=0;o<n;o++)r+=t[o];const s=2/(n+1);i[n-1]=r/n;for(let o=n;o<t.length;o++)i[o]=t[o]*s+i[o-1]*(1-s);return i}extractNonNull(t){const n=[],i=[];for(let r=0;r<t.length;r++)t[r]!==null&&(n.push(t[r]),i.push(r));return{values:n,indices:i}}}const vi=new wi;H.register(vi);class bi extends z{constructor(){super(...arguments),this.name="cci"}calculate(t,n){const i=n.period??20,r=t.map(o=>(o.high+o.low+o.close)/3),s=new Array(t.length);for(let o=0;o<t.length;o++){if(o<i-1){s[o]={x:t[o].x,y:null};continue}let a=0;for(let h=o-i+1;h<=o;h++)a+=r[h];const c=a/i;let l=0;for(let h=o-i+1;h<=o;h++)l+=Math.abs(r[h]-c);const u=l/i;s[o]={x:t[o].x,y:u===0?0:(r[o]-c)/(.015*u)}}return{values:s}}}const ki=new bi;H.register(ki);class Mi extends z{constructor(){super(...arguments),this.name="roc"}calculate(t,n){const i=n.period??9;return{values:t.map((s,o)=>{if(o<i)return{x:s.x,y:null};const a=t[o-i].close;return{x:s.x,y:a===0?0:(s.close-a)/a*100}})}}}const Ai=new Mi;H.register(Ai);class Ci extends z{constructor(){super(...arguments),this.name="momentum"}calculate(t,n){const i=n.period??14;return{values:t.map((s,o)=>o<i?{x:s.x,y:null}:{x:s.x,y:s.close-t[o-i].close})}}}const Pi=new Ci;H.register(Pi);class Ei extends z{constructor(){super(...arguments),this.name="bollingerbands"}calculate(t,n){const i=n.period??20,r=n.stdDev??2,s=new Array(t.length),o=new Array(t.length),a=new Array(t.length),c=new Array(t.length);for(let l=0;l<t.length;l++){const u=t[l].x;if(l<i-1){s[l]={x:u,y:null},o[l]={x:u,y:null},a[l]={x:u,y:null},c[l]={x:u,y:null};continue}let h=0;for(let g=l-i+1;g<=l;g++)h+=t[g].close;const f=h/i;let p=0;for(let g=l-i+1;g<=l;g++){const x=t[g].close-f;p+=x*x}const d=Math.sqrt(p/i),y=f+r*d,m=f-r*d;s[l]={x:u,y:f},o[l]={x:u,y},a[l]={x:u,y:f},c[l]={x:u,y:m}}return{values:s,bands:{upper:o,middle:a,lower:c}}}}const Ii=new Ei;H.register(Ii);class Si extends z{constructor(){super(...arguments),this.name="atr"}calculate(t,n){const i=n.period??14,r=new Array(t.length);r[0]={x:t[0].x,y:null};const s=new Array(t.length);s[0]=t[0].high-t[0].low;for(let a=1;a<t.length;a++){const c=t[a].high,l=t[a].low,u=t[a-1].close;s[a]=Math.max(c-l,Math.abs(c-u),Math.abs(l-u))}for(let a=1;a<i;a++)r[a]={x:t[a].x,y:null};let o=0;for(let a=0;a<i;a++)o+=s[a];o/=i,r[i-1]={x:t[i-1].x,y:o};for(let a=i;a<t.length;a++)o=(o*(i-1)+s[a])/i,r[a]={x:t[a].x,y:o};return{values:r}}}const Ti=new Si;H.register(Ti);class $i extends z{constructor(){super(...arguments),this.name="vwap"}calculate(t,n){const i=new Array(t.length);let r=0,s=0,o=null;for(let a=0;a<t.length;a++){const c=t[a],l=c.volume??0;if(l>0){const u=(c.high+c.low+c.close)/3;r+=u*l,s+=l,o=r/s}i[a]={x:c.x,y:o}}return{values:i}}}const Ni=new $i;H.register(Ni);class Fi extends z{constructor(){super(...arguments),this.name="obv"}calculate(t,n){const i=new Array(t.length);if(t.length===0)return{values:[]};let r=0;i[0]={x:t[0].x,y:r};for(let s=1;s<t.length;s++){const o=t[s].volume??0;t[s].close>t[s-1].close?r+=o:t[s].close<t[s-1].close&&(r-=o),i[s]={x:t[s].x,y:r}}return{values:i}}}const Ri=new Fi;H.register(Ri);class Vi extends z{constructor(){super(...arguments),this.name="vbp"}calculate(t,n){const i=Math.max(1,n.ranges??12);if(t.length===0)return{values:[]};let r=1/0,s=-1/0;for(const u of t)r=Math.min(r,u.low??u.close),s=Math.max(s,u.high??u.close);const o=(s-r)/i||1,a=new Array(i).fill(0),c=new Array(i).fill(0);for(const u of t){let h=Math.floor((u.close-r)/o);h<0&&(h=0),h>=i&&(h=i-1);const f=u.volume??0;a[h]+=f,u.close>=u.open&&(c[h]+=f)}return{values:a.map((u,h)=>({x:h,y:r+(h+.5)*o,low:r+h*o,high:r+(h+1)*o,volume:u,volumeUp:c[h]}))}}}const Di=new Vi;H.register(Di);class Li extends z{constructor(){super(...arguments),this.name="ichimoku"}calculate(t,n){const i=n.tenkanPeriod??9,r=n.kijunPeriod??26,s=n.senkouBPeriod??52,o=n.displacement??26,a=t.length;if(a===0)return{values:[],signal:[],bands:{upper:[],lower:[],middle:[]}};const c=new Array(a),l=new Array(a),u=new Array(a);for(let x=0;x<a;x++)c[x]=x>=i-1?this.midpoint(t,x-i+1,i):null,l[x]=x>=r-1?this.midpoint(t,x-r+1,r):null,u[x]=x>=s-1?this.midpoint(t,x-s+1,s):null;const h=a>1?(t[a-1].x-t[0].x)/(a-1):0,f=new Array(a),p=new Array(a);for(let x=0;x<a;x++)f[x]={x:t[x].x,y:c[x]},p[x]={x:t[x].x,y:l[x]};const d=a+o,y=new Array(d),m=new Array(d);for(let x=0;x<d;x++){const _=x-o,w=_>=0&&_<a?t[_].x+o*h:t[0].x+x*h;let v=null;_>=0&&_<a&&c[_]!==null&&l[_]!==null&&(v=(c[_]+l[_])/2);let k=null;_>=0&&_<a&&(k=u[_]),y[x]={x:w,y:v},m[x]={x:w,y:k}}const g=new Array(a);for(let x=0;x<a;x++){const _=t[x].x-o*h;g[x]={x:_,y:t[x].close}}return{values:f,signal:p,bands:{upper:y,lower:m,middle:g}}}midpoint(t,n,i){let r=-1/0,s=1/0;const o=n+i;for(let a=n;a<o;a++)t[a].high>r&&(r=t[a].high),t[a].low<s&&(s=t[a].low);return(r+s)/2}}const Oi=new Li;H.register(Oi);class Bi extends z{constructor(){super(...arguments),this.name="adx"}calculate(t,n){const i=n.period??14,r=t.length,s=t.map(g=>({x:g.x,y:null}));if(r<i*2)return{values:s};const o=new Array(r).fill(0),a=new Array(r).fill(0),c=new Array(r).fill(0);for(let g=1;g<r;g++){const x=t[g].high-t[g-1].high,_=t[g-1].low-t[g].low;o[g]=x>_&&x>0?x:0,a[g]=_>x&&_>0?_:0,c[g]=Math.max(t[g].high-t[g].low,Math.abs(t[g].high-t[g-1].close),Math.abs(t[g].low-t[g-1].close))}let l=0,u=0,h=0;for(let g=1;g<=i;g++)l+=o[g],u+=a[g],h+=c[g];const f=new Array(r).fill(NaN),p=g=>{const x=h===0?0:100*l/h,_=h===0?0:100*u/h,w=x+_;f[g]=w===0?0:100*Math.abs(x-_)/w};p(i);for(let g=i+1;g<r;g++)l=l-l/i+o[g],u=u-u/i+a[g],h=h-h/i+c[g],p(g);let d=0;const y=i*2-1;let m=0;for(let g=i;g<=y;g++)m+=f[g];d=m/i,s[y]={x:t[y].x,y:d};for(let g=y+1;g<r;g++)d=(d*(i-1)+f[g])/i,s[g]={x:t[g].x,y:d};return{values:s}}}const zi=new Bi;H.register(zi);class Hi extends z{constructor(){super(...arguments),this.name="psar"}calculate(t,n){const i=n.increment??.02,r=n.maximum??.2,s=t.length,o=t.map(h=>({x:h.x,y:null}));if(s<2)return{values:o};let a=t[1].close>=t[0].close,c=a?t[0].low:t[0].high,l=a?t[0].high:t[0].low,u=i;o[0]={x:t[0].x,y:c};for(let h=1;h<s;h++){let f=c+u*(l-c);a?(f=Math.min(f,t[h-1].low,h>=2?t[h-2].low:t[h-1].low),t[h].low<f?(a=!1,f=l,l=t[h].low,u=i):t[h].high>l&&(l=t[h].high,u=Math.min(u+i,r))):(f=Math.max(f,t[h-1].high,h>=2?t[h-2].high:t[h-1].high),t[h].high>f?(a=!0,f=l,l=t[h].high,u=i):t[h].low<l&&(l=t[h].low,u=Math.min(u+i,r))),c=f,o[h]={x:t[h].x,y:c}}return{values:o}}}const Xi=new Hi;H.register(Xi);class Ha{static fromWebSocket(t,n,i,r){const s=(r==null?void 0:r.shift)??!1,o=a=>{let c;try{c=JSON.parse(a.data)}catch{return}const l=i(c);if(Array.isArray(l))if(n.addPoints)n.addPoints(l,!0,s);else{for(const u of l)n.addPoint(u,!1,s);n.addPoint(l[l.length-1],!0,s)}else n.addPoint(l,!0,s)};return t.addEventListener("message",o),{unsubscribe:()=>t.removeEventListener("message",o)}}static fromEventSource(t,n,i,r,s){const o=(s==null?void 0:s.shift)??!1,a=c=>{const l=r(c.data);n.addPoint(l,!0,o)};return t.addEventListener(i,a),{unsubscribe:()=>t.removeEventListener(i,a)}}static fromPolling(t,n,i,r){const s=(r==null?void 0:r.shift)??!1;let o=!0;const a=async()=>{if(o){try{const c=await t();if(!o)return;if(Array.isArray(c))if(n.addPoints)n.addPoints(c,!0,s);else for(const l of c)n.addPoint(l,!0,s);else n.addPoint(c,!0,s)}catch{}o&&setTimeout(a,i)}};return setTimeout(a,i),{unsubscribe:()=>{o=!1}}}}class Xa{constructor(t){this.head=0,this._size=0,this.capacity=t,this.buffer=new Array(t)}push(t){const n=this._size===this.capacity?this.buffer[this.head]:void 0,i=(this.head+this._size)%this.capacity;return this.buffer[i]=t,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity,n}pushMany(t){const n=[];for(const i of t){const r=this.push(i);r!==void 0&&n.push(r)}return n}get size(){return this._size}get isFull(){return this._size===this.capacity}get(t){if(!(t<0||t>=this._size))return this.buffer[(this.head+t)%this.capacity]}toArray(){const t=new Array(this._size);for(let n=0;n<this._size;n++)t[n]=this.buffer[(this.head+n)%this.capacity];return t}clear(){this.head=0,this._size=0}}class Wi{constructor(){this.entries=[]}add(t,n){if(t==="setData"){this.entries=[{type:t,payload:n}];return}this.entries.push({type:t,payload:n})}get isEmpty(){return this.entries.length===0}}class Wa{constructor(t,n){this.pendingUpdates=new Map,this.rafId=null,this.lastFrameTime=0,this.maxFps=t.maxFps??30,this.flushCallback=n}schedule(t,n,i){let r=this.pendingUpdates.get(t);r||(r=new Wi,this.pendingUpdates.set(t,r)),r.add(n,i),this.requestFrame()}requestFrame(){this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;const t=performance.now(),n=1e3/this.maxFps;if(t-this.lastFrameTime<n){this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.lastFrameTime=performance.now(),this.flush()});return}this.lastFrameTime=t,this.flush()}))}flush(){if(this.pendingUpdates.size!==0){for(const[t,n]of this.pendingUpdates)n.isEmpty||t.applyBatch(n);this.pendingUpdates.clear(),this.flushCallback()}}destroy(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingUpdates.clear()}get hasPending(){return this.pendingUpdates.size>0}}ri(),b.ADX=zi,b.ADXIndicator=Bi,b.ATR=Ti,b.ATRIndicator=Si,b.AreaRangeChart=Ae,b.AreaSplineRangeChart=Gn,b.BaselineChart=Jn,b.BollingerBands=Ii,b.BollingerBandsIndicator=Ei,b.CCI=ki,b.CCIIndicator=bi,b.CandlestickChart=we,b.CircularBuffer=Xa,b.ColumnRangeChart=Kn,b.DEMA=di,b.DEMAIndicator=fi,b.EMA=ci,b.EMAIndicator=li,b.FlagsChart=jn,b.HeikinAshiChart=Vn,b.HollowCandlestickChart=Dn,b.IchimokuCloud=Oi,b.IchimokuCloudIndicator=Li,b.Indicator=z,b.IndicatorRegistry=H,b.KagiChart=ei,b.LineBreakChart=ii,b.MACD=vi,b.MACDIndicator=wi,b.Momentum=Pi,b.MomentumIndicator=Ci,b.OBV=Ri,b.OBVIndicator=Fi,b.OHLCChart=Ra,b.PSAR=Xi,b.PSARIndicator=Hi,b.PointAndFigureChart=ni,b.ROC=Ai,b.ROCIndicator=Mi,b.RSI=yi,b.RSIIndicator=xi,b.RenkoChart=ti,b.SMA=ai,b.SMAIndicator=oi,b.Stochastic=_i,b.StochasticIndicator=mi,b.StreamAdapter=Ha,b.TEMA=gi,b.TEMAIndicator=pi,b.UpdateBatch=Wi,b.UpdateScheduler=Wa,b.VBP=Di,b.VBPChart=Zn,b.VBPIndicator=Vi,b.VWAP=Ni,b.VWAPIndicator=$i,b.VolumeChart=Ln,b.WMA=ui,b.WMAIndicator=hi,b.registerFinanceSeriesTypes=ri,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p, useRef as f, useEffect as R, memo as g } from "react";
|
|
3
|
+
function C(n, r) {
|
|
4
|
+
try {
|
|
5
|
+
return JSON.stringify(n) !== JSON.stringify(r);
|
|
6
|
+
} catch {
|
|
7
|
+
return !0;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const h = p(
|
|
11
|
+
({ katuCharts: n, options: r, callback: s, containerProps: m }, u) => {
|
|
12
|
+
const i = f(null), e = f(null), c = f(null), o = f(!0), d = (t) => {
|
|
13
|
+
i.current = t, typeof u == "function" ? u(t) : u && (u.current = t);
|
|
14
|
+
};
|
|
15
|
+
return R(() => {
|
|
16
|
+
if (!i.current) return;
|
|
17
|
+
const t = n.chart(i.current, r);
|
|
18
|
+
return e.current = t, c.current = r, s == null || s(t), () => {
|
|
19
|
+
var a;
|
|
20
|
+
(a = e.current) == null || a.destroy(), e.current = null;
|
|
21
|
+
};
|
|
22
|
+
}, [n]), R(() => {
|
|
23
|
+
if (o.current) {
|
|
24
|
+
o.current = !1;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
e.current && c.current && C(c.current, r) && (e.current.update(r), c.current = r);
|
|
28
|
+
}, [r]), /* @__PURE__ */ y("div", { ...m, ref: d });
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
h.displayName = "KatuChartsReact";
|
|
32
|
+
const O = g(h);
|
|
33
|
+
export {
|
|
34
|
+
O as KatuChartsReact
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],u):(e=typeof globalThis<"u"?globalThis:e||self,u(e.KatuChartsReact={},e.jsxRuntime,e.React))})(this,function(e,u,t){"use strict";function y(f,r){try{return JSON.stringify(f)!==JSON.stringify(r)}catch{return!0}}const R=t.forwardRef(({katuCharts:f,options:r,callback:o,containerProps:p},i)=>{const d=t.useRef(null),s=t.useRef(null),c=t.useRef(null),a=t.useRef(!0),j=n=>{d.current=n,typeof i=="function"?i(n):i&&(i.current=n)};return t.useEffect(()=>{if(!d.current)return;const n=f.chart(d.current,r);return s.current=n,c.current=r,o==null||o(n),()=>{var h;(h=s.current)==null||h.destroy(),s.current=null}},[f]),t.useEffect(()=>{if(a.current){a.current=!1;return}s.current&&c.current&&y(c.current,r)&&(s.current.update(r),c.current=r)},[r]),u.jsx("div",{...p,ref:j})});R.displayName="KatuChartsReact";const m=t.memo(R);e.KatuChartsReact=m,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|