billboard.js 4.0.3 → 4.1.0-next.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.
Files changed (270) hide show
  1. package/README.md +82 -7
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +1841 -491
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +19 -24
  6. package/dist/billboard.pkgd.js +1837 -676
  7. package/dist/billboard.pkgd.min.js +24 -29
  8. package/dist/billboard.react.js +205 -0
  9. package/dist/billboard.react.min.js +9 -0
  10. package/dist/billboard.worker.js +10 -0
  11. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-sparkline.js +3 -2
  14. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  15. package/dist/plugin/billboardjs-plugin-stanford.js +3 -2
  16. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  17. package/dist/plugin/billboardjs-plugin-tableview.js +57 -27
  18. package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
  19. package/dist/plugin/billboardjs-plugin-textoverlap.js +72 -54
  20. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +3 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +3 -3
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +57 -27
  28. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +65 -3556
  30. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
  31. package/dist/theme/dark.css +1 -1
  32. package/dist/theme/dark.min.css +1 -1
  33. package/dist/theme/datalab.css +1 -1
  34. package/dist/theme/datalab.min.css +1 -1
  35. package/dist/theme/graph.css +1 -1
  36. package/dist/theme/graph.min.css +1 -1
  37. package/dist/theme/insight.css +1 -1
  38. package/dist/theme/insight.min.css +1 -1
  39. package/dist/theme/modern.css +1 -1
  40. package/dist/theme/modern.min.css +1 -1
  41. package/dist-esm/Chart/Chart.js +134 -152
  42. package/dist-esm/Chart/api/axis.js +217 -237
  43. package/dist-esm/Chart/api/category.js +54 -54
  44. package/dist-esm/Chart/api/chart.js +172 -215
  45. package/dist-esm/Chart/api/color.js +21 -21
  46. package/dist-esm/Chart/api/data.js +172 -173
  47. package/dist-esm/Chart/api/export.js +242 -262
  48. package/dist-esm/Chart/api/flow.js +198 -254
  49. package/dist-esm/Chart/api/focus.js +136 -143
  50. package/dist-esm/Chart/api/grid.js +191 -190
  51. package/dist-esm/Chart/api/group.js +31 -34
  52. package/dist-esm/Chart/api/legend.js +54 -63
  53. package/dist-esm/Chart/api/load.js +237 -257
  54. package/dist-esm/Chart/api/regions.js +148 -168
  55. package/dist-esm/Chart/api/selection.js +181 -139
  56. package/dist-esm/Chart/api/show.js +133 -147
  57. package/dist-esm/Chart/api/stubs.js +43 -42
  58. package/dist-esm/Chart/api/subchart.js +155 -172
  59. package/dist-esm/Chart/api/tooltip.js +132 -177
  60. package/dist-esm/Chart/api/x.js +67 -71
  61. package/dist-esm/Chart/api/zoom.js +183 -220
  62. package/dist-esm/ChartInternal/Axis/Axis.js +1059 -1266
  63. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +408 -540
  64. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +113 -149
  65. package/dist-esm/ChartInternal/ChartInternal.js +573 -749
  66. package/dist-esm/ChartInternal/data/convert.helper.js +133 -159
  67. package/dist-esm/ChartInternal/data/convert.js +200 -229
  68. package/dist-esm/ChartInternal/data/data.js +967 -1153
  69. package/dist-esm/ChartInternal/data/load.js +145 -197
  70. package/dist-esm/ChartInternal/interactions/drag.js +86 -122
  71. package/dist-esm/ChartInternal/interactions/eventrect.js +455 -621
  72. package/dist-esm/ChartInternal/interactions/flow.js +151 -215
  73. package/dist-esm/ChartInternal/interactions/interaction.js +214 -252
  74. package/dist-esm/ChartInternal/interactions/subchart.js +425 -300
  75. package/dist-esm/ChartInternal/interactions/zoom.js +321 -440
  76. package/dist-esm/ChartInternal/internals/category.js +18 -18
  77. package/dist-esm/ChartInternal/internals/class.js +89 -99
  78. package/dist-esm/ChartInternal/internals/clip.js +88 -119
  79. package/dist-esm/ChartInternal/internals/color.js +233 -288
  80. package/dist-esm/ChartInternal/internals/domain.js +452 -588
  81. package/dist-esm/ChartInternal/internals/format.js +64 -77
  82. package/dist-esm/ChartInternal/internals/grid.js +333 -457
  83. package/dist-esm/ChartInternal/internals/legend.js +675 -927
  84. package/dist-esm/ChartInternal/internals/redraw.js +200 -289
  85. package/dist-esm/ChartInternal/internals/region.js +106 -159
  86. package/dist-esm/ChartInternal/internals/scale.js +186 -215
  87. package/dist-esm/ChartInternal/internals/selection.js +132 -159
  88. package/dist-esm/ChartInternal/internals/size.axis.js +92 -139
  89. package/dist-esm/ChartInternal/internals/size.js +286 -394
  90. package/dist-esm/ChartInternal/internals/style.js +39 -41
  91. package/dist-esm/ChartInternal/internals/subchart.util.js +49 -0
  92. package/dist-esm/ChartInternal/internals/text.arc.js +155 -219
  93. package/dist-esm/ChartInternal/internals/text.js +368 -528
  94. package/dist-esm/ChartInternal/internals/text.util.js +179 -239
  95. package/dist-esm/ChartInternal/internals/title.js +96 -121
  96. package/dist-esm/ChartInternal/internals/tooltip.js +450 -586
  97. package/dist-esm/ChartInternal/internals/transform.js +79 -97
  98. package/dist-esm/ChartInternal/internals/type.js +285 -236
  99. package/dist-esm/ChartInternal/shape/arc.js +825 -1112
  100. package/dist-esm/ChartInternal/shape/area.js +73 -94
  101. package/dist-esm/ChartInternal/shape/bar.js +227 -288
  102. package/dist-esm/ChartInternal/shape/bubble.js +9 -8
  103. package/dist-esm/ChartInternal/shape/candlestick.js +110 -138
  104. package/dist-esm/ChartInternal/shape/core/barRadius.js +197 -133
  105. package/dist-esm/ChartInternal/shape/core/bubble.js +64 -73
  106. package/dist-esm/ChartInternal/shape/core/candlestick.js +93 -86
  107. package/dist-esm/ChartInternal/shape/core/dataRegion.js +68 -75
  108. package/dist-esm/ChartInternal/shape/core/geometry.js +112 -112
  109. package/dist-esm/ChartInternal/shape/core/path.js +142 -115
  110. package/dist-esm/ChartInternal/shape/core/point.js +105 -125
  111. package/dist-esm/ChartInternal/shape/core/treemap.js +83 -88
  112. package/dist-esm/ChartInternal/shape/funnel.js +310 -338
  113. package/dist-esm/ChartInternal/shape/gauge.js +71 -103
  114. package/dist-esm/ChartInternal/shape/line.js +208 -278
  115. package/dist-esm/ChartInternal/shape/point.js +310 -425
  116. package/dist-esm/ChartInternal/shape/polar.js +84 -109
  117. package/dist-esm/ChartInternal/shape/radar.js +228 -318
  118. package/dist-esm/ChartInternal/shape/shape.js +782 -843
  119. package/dist-esm/ChartInternal/shape/treemap.js +152 -190
  120. package/dist-esm/canvas/CanvasAxisRenderer.js +1180 -1328
  121. package/dist-esm/canvas/CanvasEngine.js +148 -166
  122. package/dist-esm/canvas/CanvasPainter.js +395 -411
  123. package/dist-esm/canvas/CanvasRenderer.js +1584 -1834
  124. package/dist-esm/canvas/CanvasTheme.js +899 -802
  125. package/dist-esm/canvas/HitDetector.js +394 -463
  126. package/dist-esm/canvas/axisTicks.js +672 -786
  127. package/dist-esm/canvas/classes.js +19 -17
  128. package/dist-esm/canvas/color.js +40 -59
  129. package/dist-esm/canvas/geometry.js +38 -38
  130. package/dist-esm/canvas/labels.js +318 -371
  131. package/dist-esm/canvas/pointPattern.js +578 -580
  132. package/dist-esm/canvas/util.js +242 -262
  133. package/dist-esm/config/Options/Options.js +29 -32
  134. package/dist-esm/config/Options/axis/axis.js +101 -101
  135. package/dist-esm/config/Options/axis/x.js +759 -755
  136. package/dist-esm/config/Options/axis/y.js +525 -522
  137. package/dist-esm/config/Options/axis/y2.js +501 -485
  138. package/dist-esm/config/Options/common/boost.js +93 -32
  139. package/dist-esm/config/Options/common/color.js +88 -87
  140. package/dist-esm/config/Options/common/grid.js +74 -73
  141. package/dist-esm/config/Options/common/legend.js +180 -179
  142. package/dist-esm/config/Options/common/main.js +474 -473
  143. package/dist-esm/config/Options/common/point.js +160 -159
  144. package/dist-esm/config/Options/common/title.js +47 -46
  145. package/dist-esm/config/Options/common/tooltip.js +253 -252
  146. package/dist-esm/config/Options/data/axis.js +173 -172
  147. package/dist-esm/config/Options/data/data.js +958 -957
  148. package/dist-esm/config/Options/data/selection.js +131 -130
  149. package/dist-esm/config/Options/interaction/interaction.js +53 -52
  150. package/dist-esm/config/Options/interaction/subchart.js +164 -73
  151. package/dist-esm/config/Options/interaction/zoom.js +86 -85
  152. package/dist-esm/config/Options/shape/arc.js +150 -149
  153. package/dist-esm/config/Options/shape/area.js +69 -68
  154. package/dist-esm/config/Options/shape/bar.js +147 -146
  155. package/dist-esm/config/Options/shape/bubble.js +35 -34
  156. package/dist-esm/config/Options/shape/candlestick.js +61 -60
  157. package/dist-esm/config/Options/shape/donut.js +181 -180
  158. package/dist-esm/config/Options/shape/funnel.js +49 -48
  159. package/dist-esm/config/Options/shape/gauge.js +237 -236
  160. package/dist-esm/config/Options/shape/line.js +58 -57
  161. package/dist-esm/config/Options/shape/pie.js +185 -184
  162. package/dist-esm/config/Options/shape/polar.js +167 -166
  163. package/dist-esm/config/Options/shape/radar.js +76 -75
  164. package/dist-esm/config/Options/shape/scatter.js +36 -36
  165. package/dist-esm/config/Options/shape/spline.js +46 -46
  166. package/dist-esm/config/Options/shape/treemap.js +80 -79
  167. package/dist-esm/config/Store/Element.js +64 -62
  168. package/dist-esm/config/Store/State.js +189 -200
  169. package/dist-esm/config/Store/Store.js +25 -26
  170. package/dist-esm/config/classes.js +157 -155
  171. package/dist-esm/config/config.js +26 -35
  172. package/dist-esm/config/const.js +120 -128
  173. package/dist-esm/config/resolver/axis.core.js +25 -25
  174. package/dist-esm/config/resolver/axis.js +26 -27
  175. package/dist-esm/config/resolver/canvas.js +2071 -2472
  176. package/dist-esm/config/resolver/canvasShape.js +201 -177
  177. package/dist-esm/config/resolver/category.js +26 -27
  178. package/dist-esm/config/resolver/export.js +24 -26
  179. package/dist-esm/config/resolver/flow.js +29 -31
  180. package/dist-esm/config/resolver/grid.js +34 -35
  181. package/dist-esm/config/resolver/interaction/selection.js +17 -17
  182. package/dist-esm/config/resolver/interaction/subchart.js +17 -17
  183. package/dist-esm/config/resolver/interaction/zoom.js +17 -17
  184. package/dist-esm/config/resolver/regions.js +30 -31
  185. package/dist-esm/config/resolver/shape/arc.helpers.js +19 -19
  186. package/dist-esm/config/resolver/shape/area.js +17 -17
  187. package/dist-esm/config/resolver/shape/axis.helpers.js +28 -25
  188. package/dist-esm/config/resolver/shape/bar.js +13 -13
  189. package/dist-esm/config/resolver/shape/bubble.js +18 -14
  190. package/dist-esm/config/resolver/shape/candlestick.js +13 -13
  191. package/dist-esm/config/resolver/shape/donut.js +11 -11
  192. package/dist-esm/config/resolver/shape/funnel.js +11 -11
  193. package/dist-esm/config/resolver/shape/gauge.js +12 -12
  194. package/dist-esm/config/resolver/shape/line.js +10 -10
  195. package/dist-esm/config/resolver/shape/pie.js +11 -11
  196. package/dist-esm/config/resolver/shape/polar.js +12 -12
  197. package/dist-esm/config/resolver/shape/radar.js +22 -14
  198. package/dist-esm/config/resolver/shape/scatter.js +13 -13
  199. package/dist-esm/config/resolver/shape/treemap.js +11 -11
  200. package/dist-esm/core.js +208 -211
  201. package/dist-esm/index.canvas.js +14 -13
  202. package/dist-esm/index.esm.js +25 -24
  203. package/dist-esm/module/Cache.js +117 -129
  204. package/dist-esm/module/browser.js +30 -35
  205. package/dist-esm/module/dsv.js +107 -127
  206. package/dist-esm/module/error.js +45 -52
  207. package/dist-esm/module/generator.js +75 -83
  208. package/dist-esm/module/sanitize.js +302 -399
  209. package/dist-esm/module/util/brush.js +27 -38
  210. package/dist-esm/module/util/dom.js +288 -348
  211. package/dist-esm/module/util/object.js +277 -341
  212. package/dist-esm/module/util/type-checks.js +21 -25
  213. package/dist-esm/module/worker.js +312 -130
  214. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +185 -198
  215. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +442 -450
  216. package/dist-esm/plugin/billboardjs-plugin-stanford.js +813 -950
  217. package/dist-esm/plugin/billboardjs-plugin-tableview.js +708 -788
  218. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +344 -301
  219. package/dist-esm/react/index.js +157 -0
  220. package/package.json +28 -8
  221. package/src/Chart/api/selection.ts +130 -5
  222. package/src/ChartInternal/Axis/Axis.ts +164 -65
  223. package/src/ChartInternal/Axis/AxisRenderer.ts +41 -8
  224. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  225. package/src/ChartInternal/ChartInternal.ts +1 -1
  226. package/src/ChartInternal/data/convert.ts +54 -4
  227. package/src/ChartInternal/data/data.ts +4 -1
  228. package/src/ChartInternal/interactions/eventrect.ts +6 -0
  229. package/src/ChartInternal/interactions/subchart.ts +437 -66
  230. package/src/ChartInternal/internals/color.ts +2 -2
  231. package/src/ChartInternal/internals/domain.ts +15 -3
  232. package/src/ChartInternal/internals/grid.ts +21 -1
  233. package/src/ChartInternal/internals/scale.ts +9 -2
  234. package/src/ChartInternal/internals/selection.ts +1 -1
  235. package/src/ChartInternal/internals/subchart.util.ts +55 -0
  236. package/src/ChartInternal/internals/text.arc.ts +3 -1
  237. package/src/ChartInternal/internals/text.ts +18 -5
  238. package/src/ChartInternal/internals/transform.ts +8 -2
  239. package/src/ChartInternal/internals/type.ts +105 -1
  240. package/src/ChartInternal/shape/IShape.ts +6 -3
  241. package/src/ChartInternal/shape/bar.ts +62 -31
  242. package/src/ChartInternal/shape/core/barRadius.ts +129 -0
  243. package/src/ChartInternal/shape/core/candlestick.ts +1 -1
  244. package/src/ChartInternal/shape/core/path.ts +76 -9
  245. package/src/ChartInternal/shape/funnel.ts +2 -3
  246. package/src/ChartInternal/shape/point.ts +2 -2
  247. package/src/ChartInternal/shape/shape.ts +149 -17
  248. package/src/Plugin/stanford/index.ts +0 -4
  249. package/src/Plugin/tableview/index.ts +85 -3
  250. package/src/Plugin/textoverlap/index.ts +9 -15
  251. package/src/canvas/CanvasAxisRenderer.ts +184 -36
  252. package/src/canvas/CanvasRenderer.ts +247 -160
  253. package/src/canvas/CanvasTheme.ts +212 -0
  254. package/src/canvas/axisTicks.ts +122 -40
  255. package/src/config/Options/axis/y2.ts +13 -0
  256. package/src/config/Options/common/boost.ts +64 -4
  257. package/src/config/Options/common/color.ts +2 -2
  258. package/src/config/Options/interaction/subchart.ts +98 -1
  259. package/src/config/Options/shape/gauge.ts +1 -1
  260. package/src/config/Options/shape/treemap.ts +2 -2
  261. package/src/config/Store/Element.ts +3 -1
  262. package/src/config/Store/State.ts +1 -0
  263. package/src/config/classes.ts +1 -0
  264. package/src/config/resolver/canvas.ts +92 -10
  265. package/src/module/voronoi.ts +119 -0
  266. package/src/module/worker.entry.ts +61 -0
  267. package/src/module/worker.ts +346 -63
  268. package/src/react/index.ts +193 -0
  269. package/types/options.d.ts +206 -3
  270. package/types/react/index.d.ts +27 -0
@@ -5,41 +5,36 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.3
9
- */(function(Ht,an){if(typeof exports=="object"&&typeof module=="object")module.exports=an(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if(typeof define=="function"&&define.amd)define(["d3-axis","d3-brush","d3-drag","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],an);else{var Kn=typeof exports=="object"?an(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):an(Ht.d3,Ht.d3,Ht.d3,Ht.d3,Ht.d3,Ht.d3,Ht.d3,Ht.d3,Ht.d3,Ht.d3,Ht.d3);for(var Zn in Kn)(typeof exports=="object"?exports:Ht)[Zn]=Kn[Zn]}})(this,function(Ka,Ht,an,Kn,Zn,ec,nc,ic,ac,sc,oc){return(function(){"use strict";var rc=[,,(function(U){U.exports=nc}),(function(U){U.exports=ec}),(function(U){U.exports=ic}),(function(U){U.exports=ac}),(function(U){U.exports=an}),(function(U){U.exports=Ht}),(function(U){U.exports=sc}),(function(U){U.exports=oc}),(function(U){U.exports=Ka}),(function(U){U.exports=Zn}),(function(U){U.exports=Kn})],Za={};function pt(U){var Dt=Za[U];if(Dt!==void 0)return Dt.exports;var F=Za[U]={exports:{}};return rc[U](F,F.exports,pt),F.exports}(function(){pt.d=function(U,Dt){if(Array.isArray(Dt))for(var F=0;F<Dt.length;){var I=Dt[F++],Sn=Dt[F++];pt.o(U,I)?Sn===0&&F++:Sn===0?Object.defineProperty(U,I,{enumerable:!0,value:Dt[F++]}):Object.defineProperty(U,I,{enumerable:!0,get:Sn})}else for(var I in Dt)pt.o(Dt,I)&&!pt.o(U,I)&&Object.defineProperty(U,I,{enumerable:!0,get:Dt[I]})}})(),(function(){pt.o=function(U,Dt){return Object.prototype.hasOwnProperty.call(U,Dt)}})(),(function(){pt.r=function(U){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(U,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(U,"__esModule",{value:!0})}})();var Di={};return(function(){pt.r(Di),pt.d(Di,{bb:function(){return Zl},default:function(){return Zl}});var U={};pt.r(U),pt.d(U,{selection:function(){return Br},subchart:function(){return Nr},zoom:function(){return Hr}});var Dt={};pt.r(Dt),pt.d(Dt,{area:function(){return dl},areaLineRange:function(){return ul},areaSpline:function(){return fl},areaSplineRange:function(){return gl},areaStep:function(){return pl},areaStepRange:function(){return hl},bar:function(){return xl},bubble:function(){return _l},candlestick:function(){return Tl},donut:function(){return Pl},funnel:function(){return Fl},gauge:function(){return Ol},line:function(){return Bl},pie:function(){return Xl},polar:function(){return Wl},radar:function(){return Hl},scatter:function(){return Yl},spline:function(){return zl},step:function(){return Nl},treemap:function(){return Kl}});var F=pt(2);const I={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",AREA_STEP_RANGE:"area-step-range",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",FUNNEL:"funnel",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},Sn={export:"exportApi",flow:"flow",xgrids:"grid",ygrids:"grid",regions:"regions",category:"category",categories:"category"},ue=10,rt=6,Ve=3,lc=rt+Ve,qa=1,Ja={x:{start:"M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",end:"M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"},y:{start:"M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z",end:"M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"}},Ii={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",AREA_STEP_RANGE:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",FUNNEL:"initFunnel",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},se={Area:[I.AREA,I.AREA_SPLINE,I.AREA_SPLINE_RANGE,I.AREA_LINE_RANGE,I.AREA_STEP,I.AREA_STEP_RANGE],AreaRange:[I.AREA_SPLINE_RANGE,I.AREA_LINE_RANGE,I.AREA_STEP_RANGE],Arc:[I.PIE,I.DONUT,I.GAUGE,I.POLAR,I.RADAR],Line:[I.LINE,I.SPLINE,I.AREA,I.AREA_SPLINE,I.AREA_SPLINE_RANGE,I.AREA_LINE_RANGE,I.STEP,I.AREA_STEP,I.AREA_STEP_RANGE],Step:[I.STEP,I.AREA_STEP,I.AREA_STEP_RANGE],Spline:[I.SPLINE,I.AREA_SPLINE,I.AREA_SPLINE_RANGE]};var Pe=pt(3);const J=e=>e||e===0,O=e=>typeof e=="function",nt=e=>typeof e=="string",X=e=>typeof e=="number",yt=e=>typeof e=="undefined",ct=e=>typeof e!="undefined",He=e=>typeof e=="boolean",cc=e=>Math.ceil(e/10)*10,sn=e=>Math.ceil(e)+.5,Ye=e=>e[1]-e[0],Yt=e=>typeof e=="object",dc=e=>{for(const t in e)return!1;return!0},Qt=e=>yt(e)||e===null||nt(e)&&e.length===0||Yt(e)&&!(e instanceof Date)&&dc(e)||X(e)&&isNaN(e),mt=e=>!Qt(e),ot=e=>Array.isArray(e),Q=e=>e&&!(e!=null&&e.nodeType)&&Yt(e)&&!ot(e);function uc(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function hc(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",i=s=>setTimeout(s,1),a=s=>clearTimeout(s);return[t?e.requestAnimationFrame:i,t?e.cancelAnimationFrame:a,n?e.requestIdleCallback:i,n?e.cancelIdleCallback:a]}const B=uc(),tt=B==null?void 0:B.document,[fc,P_,Qa,gc]=hc(B),pc=new Set(["span","div","p","br","b","i","em","small","strong","mark","u","s","sub","sup","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","hr","pre","code","blockquote","abbr","ins","del","a","img","figure","figcaption","svg","g","path","circle","ellipse","rect","line","polyline","polygon","text","tspan","textPath","use","defs","symbol","clipPath","mask","linearGradient","radialGradient","stop","pattern","marker","title","desc"]),xc=new Set(["class","id","style","title","lang","dir","href","src","alt","width","height","colspan","rowspan","scope","headers","d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","dx","dy","viewBox","preserveAspectRatio","transform","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternTransform","marker-start","marker-mid","marker-end","markerWidth","markerHeight","refX","refY","xlink:href"]),qn=new Map;pc.forEach(e=>qn.set(e.toLowerCase(),e));const Jn=new Map;xc.forEach(e=>Jn.set(e.toLowerCase(),e));const _c=new Set(["http:","https:","mailto:"]),mc=new Set(["href","src","xlink:href"]),vc=/^<\/?([a-zA-Z][a-zA-Z0-9]*)/,bc=/^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/,yc=/^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/,ts=/([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,es=/url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi,Tc=["expression(","behavior:","binding:","@import","@charset","-moz-binding:"];function Mi(e){return e.replace(/&colon;/gi,":").replace(/&newline;/gi,`
10
- `).replace(/&tab;/gi," ").replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&#(\d+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,10))).replace(/&#x([0-9a-f]+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,16)))}function ns(e){const n=Mi(e).trim().replace(/[\s\u0000-\u001f]/g,"").toLowerCase();if(!n||n.startsWith("#"))return!0;const i=n.match(/^[^/?#]*:/);return i?_c.has(i[0]):!0}function wc(e){const n=Mi(e).replace(/[\u0000-\u001f]/g,"");es.lastIndex=0;let i;for(;(i=es.exec(n))!==null;)if(!ns(i[1]))return null;const a=n.toLowerCase().replace(/\s/g,"");for(const s of Tc)if(a.includes(s))return null;return e}const Cc={'"':"&quot;","'":"&#39;","`":"&#96;"},Sc=/["'`]/g;function $i(e){return e.replace(Sc,t=>Cc[t])}function Ac(e,t,n=!1){if(mc.has(e))return ns(t)?n?$i(t):t:null;if(e==="style"){const a=wc(t);return a===null?null:n?$i(a):a}const i=Mi(t).toLowerCase().replace(/\s/g,"");return/\bon\w+=/.test(i)?null:n?$i(t):t}function kc(e){const t=e.match(vc);return t?t[1].toLowerCase():null}function Lc(e){const t=kc(e);return t!==null&&qn.has(t)}function Rc(e){var t,n,i;const a=e.match(bc);if(a){const p=a[1].toLowerCase();return`</${(t=qn.get(p))!=null?t:p}>`}const s=e.match(yc);if(!s)return"";const[,o,r,l]=s,c=o.toLowerCase(),d=(n=qn.get(c))!=null?n:c,u=[];ts.lastIndex=0;let h;for(;(h=ts.exec(r))!==null;){const p=h[1].toLowerCase(),x=h[2],_=h[3],v=h[4];if(p.startsWith("on"))continue;const m=(i=Jn.get(p))!=null?i:p;let b,y;if(x!==void 0)b=x,y='"';else if(_!==void 0)b=_,y="'";else if(v!==void 0)b=v,y='"';else{Jn.has(p)&&u.push(m);continue}if(Jn.has(p)){const w=Ac(p,b,v!==void 0);w!==null&&u.push(`${m}=${y}${w}${y}`)}}const f=u.length>0?` ${u.join(" ")}`:"";return`<${d}${f}${l?"/>":">"}`}function me(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|[^<>\s]+>/g,t=>t.startsWith("<!--")?"":t.startsWith("<")?Lc(t)?Rc(t):t.replace(/</g,"&lt;"):t.slice(0,-1)+"&gt;")}var Ec=Object.defineProperty,is=Object.getOwnPropertySymbols,Pc=Object.prototype.hasOwnProperty,Dc=Object.prototype.propertyIsEnumerable,as=(e,t,n)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ss=(e,t)=>{for(var n in t||(t={}))Pc.call(t,n)&&as(e,n,t[n]);if(is)for(var n of is(t))Dc.call(t,n)&&as(e,n,t[n]);return e};function os(e,t){for(let n=0;n<e.length;n++){const i=e[n];i!==null&&ct(i)&&t(i,n)}}function De(e,t,n){return ct(e[t])?e[t]:n}function Ic(e,t){for(const n in e)if(e[n]===t)return!0;return!1}function V(e,t,...n){const i=O(e);return i&&e.call(t,...n),i}function Qn(e,t){let n=0;const i=function(...a){!--n&&t.apply(this,a)};"duration"in e?e.each(()=>++n).on("end",i):(++n,e.call(i))}const Ot=e=>e.charAt(0).toUpperCase()+e.slice(1);function Mc(e,t="-"){return e.split(t).map((n,i)=>i?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const je=e=>[].slice.call(e);function $c(...e){const t=n=>{if(ot(n))return n.map(t);if(Q(n)&&n.constructor){const i=new n.constructor;for(const a in n)i[a]=t(n[a]);return i}return n};return e.map(n=>t(n)).reduce((n,i)=>ss(ss({},n),i))}function Tt(e={},t){ot(t)&&t.forEach(n=>Tt(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}function Fi(e){const t=e[0]instanceof Date,n=Array.from(new Set(t?e.map(Number):e));return t?n.map(i=>new Date(i)):n}function Fc(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function ve(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return Q(e)&&Q(n)&&Object.keys(n).forEach(i=>{if(!/^(__proto__|constructor|prototype)$/i.test(i)){const a=n[i];a instanceof Date?e[i]=new Date(a.getTime()):Q(a)?(!e[i]&&(e[i]={}),e[i]=ve(e[i],a)):e[i]=ot(a)?a.concat():a}}),ve(e,...t)}function on(e,t=!0){let n;return e[0]instanceof Date?n=t?(i,a)=>i-a:(i,a)=>a-i:t&&!e.every(isNaN)?n=(i,a)=>i-a:t||(n=(i,a)=>i>a&&-1||i<a&&1||i===a&&0),e.concat().sort(n)}function oe(e,t){let n=t.filter(i=>mt(i));if(n.length)if(X(n[0])){let i=e==="min"?1/0:-1/0;for(const a of n)(e==="min"?a<i:a>i)&&(i=a);n=i}else n[0]instanceof Date&&(n=on(n,e==="min")[0]);else n=void 0;return n}const ti=(e,t,n=1)=>{const i=[],a=Math.max(0,Math.ceil((t-e)/n))|0;for(let s=0;s<a;s++)i.push(e+s*n);return i};let Oc=0;function he(e=!0){const t=++Oc;return e?String(t):t}function Oi(e,t,n,i,a){if(n>i)return-1;const s=Math.floor((n+i)/2);let{x:o,w:r=0}=e[s];return a&&(o=e[s].y,r=e[s].h),t>=o&&t<=o+r?s:t<o?Oi(e,t,n,s-1,a):Oi(e,t,s+1,i,a)}function Ue(e,t){return me(e.replace(/\{=([^}]+)\}/g,(n,i)=>{var a;return(a=t[i])!=null?a:""}))}function Xt(e){var t;let n;if(e instanceof Date)n=e;else if(nt(e)){const{config:i,format:a}=this;n=(t=a.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else X(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function rs(e){if(Q(e)&&!nt(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(nt(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[n,i=n,a=n,s=i]=t;return{top:n,right:i,bottom:a,left:s}}function ls(e,t){t()===!1?fc(()=>ls(e,t)):e()}function cs(e,t=(n=>n)){const n=new Set;return os(e,(i,a)=>{n.add(t(i,a))}),n}function ds(e,t,n=(i=>i)){const i=new Map;return os(e,(a,s)=>{i.set(t(a,s),n(a,s))}),i}function Ie(e="linear",t,n){const i={linear:Pe.scaleLinear,log:Pe.scaleSymlog,_log:Pe.scaleLog,time:Pe.scaleTime,utc:Pe.scaleUtc}[e]();return i.type=e,/_?log/.test(e)&&i.clamp(!0),i.range([t!=null?t:0,n!=null?n:1])}var Bc={getXScale(e,t,n,i){const a=this,s=a.state.loading!=="append"&&a.scale.zoom||Ie(a.axis.getAxisType("x"),e,t);return a.getCustomizedXScale(n?s.domain(n):s,i)},getYScale(e,t,n,i,a){const o=this.axis.getAxisType(e);if(a&&a.type===o)return a.range([t,n]),i&&a.domain(i),a;const r=Ie(o,t,n);return i&&r.domain(i),r},getYScaleById(e,t=!1){var n;const i=((n=this.axis)==null?void 0:n.getId(e))==="y2",a=t?i?"subY2":"subY":i?"y2":"y";return this.scale[a]},getCustomizedXScale(e,t){const n=this,i=()=>(t?t():n.axis.x.tickOffset())||(n.axis.isCategorized()?(e(1)-e(0))/2:0),a=n.config.axis_x_inverted,s=function(o){return e(o)+i()};for(const o in e)s[o]=e[o];return s.orgDomain=()=>e.domain(),s.orgScale=()=>e,n.axis.isCategorized()&&(s.domain=function(o){let r=o;return arguments.length?(e.domain(r),s):(r=this.orgDomain(),a?[r[0]+1,r[1]]:[r[0],r[1]+1])}),s},updateScales(e,t=!0){var n,i,a,s,o,r;const l=this,{axis:c,config:d,format:u,org:h,scale:f,state:{current:g,width:p,height:x,width2:_,height2:v,hasAxis:m,hasTreemap:b}}=l;if(m){const y=d.axis_rotated,T=l.getResettedPadding(1),w={x:y?T:0,y:y?0:x,subX:y?1:0,subY:y?0:v},C={x:y?x:p,y:y?p:T,subX:y?x:p,subY:y?_:1},A=t?(n=f.x)==null?void 0:n.orgDomain():f.zoom||(a=(i=f.x)==null?void 0:i.domain)==null?void 0:a.call(i),S=t?h.xDomain:f.zoom||(o=(s=f.subX)==null?void 0:s.domain)==null?void 0:o.call(s);f.x=l.getXScale(w.x,C.x,A,()=>c.x.tickOffset()),f.subX=l.getXScale(w.x,C.x,S,k=>{var L;return k%1?0:((L=c.subX)!=null?L:c.x).tickOffset()}),u.xAxisTick=c.getXAxisTickFormat(),u.subXAxisTick=c.getXAxisTickFormat(!0),c.setAxis("x",f.x,d.axis_x_tick_outer,e),d.subchart_show&&c.setAxis("subX",f.subX,d.axis_x_tick_outer,e),f.y=l.getYScale("y",w.y,C.y,f.y?f.y.domain():d.axis_y_default,f.y),f.subY=l.getYScale("y",w.subY,C.subY,f.subY?f.subY.domain():d.axis_y_default,f.subY),c.setAxis("y",f.y,d.axis_y_tick_outer,e),d.axis_y2_show&&(f.y2=l.getYScale("y2",w.y,C.y,f.y2?f.y2.domain():d.axis_y2_default,f.y2),f.subY2=l.getYScale("y2",w.subY,C.subY,f.subY2?f.subY2.domain():d.axis_y2_default,f.subY2),c.setAxis("y2",f.y2,d.axis_y2_tick_outer,e))}else if(b){const y=l.getCurrentPadding();f.x=(0,Pe.scaleLinear)().rangeRound([y.left,g.width-y.right]),f.y=(0,Pe.scaleLinear)().rangeRound([y.top,g.height-y.bottom])}else(r=l.updateArc)==null||r.call(l)},xx(e){const t=this,{config:n,scale:{x:i,zoom:a}}=t,s=n.zoom_enabled&&a?a:i;return e?s(J(e.x)?e.x:e):null},xv(e){const t=this,{axis:n,config:i,scale:{x:a,zoom:s}}=t,o=i.zoom_enabled&&s?s:a;let r=t.getBaseValue(e);return n.isTimeSeries()?r=Xt.call(t,r):n.isCategorized()&&nt(r)&&(r=i.axis_x_categories.indexOf(r)),o(r)},yv(e){const t=this,{scale:{y:n,y2:i}}=t;return(e.axis&&e.axis==="y2"?i:n)(t.getBaseValue(e))},subxx(e){return e?this.scale.subX(e.x):null}};const us=1e5;function re(e){const t=/(\d+(?:\.\d+)?)px/.exec(e),n=parseFloat(t?t[1]:e);return Number.isFinite(n)?n:12}function Ut(e,t,n,i){return t.indices[n]||e.getShapeIndices(i)}function rn(e,t,n=[]){var i;const a=typeof t=="string"?t:t==null?void 0:t.id;return!((i=e.isGrouped)!=null&&i.call(e,a))||n.some(s=>s(e,t))}function Me(e,t){var n;const i=typeof t=="string"?t:t==null?void 0:t.id;return i&&((n=e.data_types)==null?void 0:n[i])||e.data_type||I.LINE}function ei(e){const t=+e;return Number.isFinite(t)?t:null}function hs(e){var t,n;const i=(n=(t=e.scale.zoom||e.scale.x)==null?void 0:t.domain)==null?void 0:n.call(t),a=ei(i==null?void 0:i[0]),s=ei(i==null?void 0:i[1]);return a===null||s===null?null:[Math.min(a,s),Math.max(a,s)]}function ni(e){return ei(e==null?void 0:e.x)}function zc(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=ni(e[s]);if(o===null)return 0;(n?o<t:o>t)?i=s+1:a=s}return i}function Nc(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=ni(e[s]);if(o===null)return e.length;(n?o<=t:o>=t)?i=s+1:a=s}return i}function be(e,t,n=1){const i=(t==null?void 0:t.values)||[],a={start:0,end:i.length},s=hs(e);if(!i.length||!s)return a;const o=e.state,r=o._canvasVisibleRangeCache||(o._canvasVisibleRangeCache=new Map),l=[t.id,i.length,o.dataGeneration,s[0],s[1],n].join(":"),c=r.get(t.id);if((c==null?void 0:c.key)===l)return c.range;const d=ni(i[0]),u=ni(i[i.length-1]);if(d===null||u===null)return a;const h=d<=u,f=zc(i,s[0],h),g=Nc(i,s[1],h),p={start:Math.max(0,Math.min(f,g)-n),end:Math.min(i.length,Math.max(f,g)+n)};return r.set(t.id,{key:l,range:p}),p}function Kt(e,t){return Me(e.config,t)===I.BAR}function An(e,t){return se.Area.indexOf(Me(e.config,t))>-1}function ln(e,t){const n=Me(e.config,t);return se.Line.indexOf(n)>-1}function $e(e,t){return Me(e.config,t)===I.SCATTER}function Fe(e,t){return Me(e.config,t)===I.BUBBLE}function le(e,t){return ln(e,t)||$e(e,t)||Fe(e,t)}function Gt(e,t){return Me(e.config,t)===I.CANDLESTICK}function Bi(e,t){return Me(e.config,t)===I.TREEMAP}function D_(e,t){const n=Me(e,t);return n===I.BAR||se.Area.indexOf(n)>-1}function Lt(e,t){const n=e.getBaseValue(t);return n!=null}function vt(e,t){return Number.isFinite(e)&&Number.isFinite(t)}function fs(e,t,n){const i=Math.ceil(n)+1,a=Math.max(1,Math.ceil(e)+i*2+1),s=Math.max(1,Math.ceil(t)+i*2+1);return{data:new Uint8Array(a*s),height:s,offset:i,width:a}}function gs(e,t,n){const i=Math.round(t)+e.offset,a=Math.round(n)+e.offset;if(i<0||i>=e.width||a<0||a>=e.height)return!1;const s=a*e.width+i;return e.data[s]?!1:(e.data[s]=1,!0)}function ii(e,t){const n=typeof e=="function"?e.call(t):e;return n!=null&&n.length?n:void 0}function ps(e,t,n){var i,a,s,o,r,l;if((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i,n))return t instanceof Date?t:Xt.call(e,t);if(n==="x"&&((o=(s=e.axis)==null?void 0:s.isCategorized)!=null&&o.call(s))&&typeof t=="string"){const c=e.config.axis_x_categories.indexOf(t);return c>=0?c:t}return(l=(r=e.axis)==null?void 0:r.isLog)!=null&&l.call(r,n)&&t!==null&&t!==void 0?+t:t}function Oe(e,t){return ps(e,t,"x")}function kn(e,t,n="y"){return ps(e,t,n)}function xs(e,t,n="y"){return t.map(i=>kn(e,i,n))}function zi(e,t){return t.map(n=>Oe(e,n)).filter(n=>{var i,a;return!(typeof n=="string"&&((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)))})}function Ke(e,t){const n=typeof t=="function"?t():t;return e.ticks?e.ticks(n):e.domain()}function _s(e,t){const[n,i]=e.domain(),a=+n,s=+i;if(t||!Number.isFinite(a)||!Number.isFinite(s)||s<=0)return Ke(e,t);const o=Ie("_log").domain([a>0?a:1,s]).range(e.range());let r=o.ticks();for(let l=s.toFixed().length;r.length>15;l--)r=o.ticks(l);return r.length&&(r.splice(0,1,n),r.splice(r.length-1,1,i)),r}function Ln(e,t){const n=+e,i=+t;return Number.isFinite(n)&&Number.isFinite(i)?Math.abs(n-i)<1e-6:e===t}function Xc(e,t){const[n,i]=t,a=e.slice();return n!==void 0&&!a.some(s=>Ln(s,n))&&a.unshift(n),i!==void 0&&!a.some(s=>Ln(s,i))&&a.push(i),a}function ms(e,t){const n=Oe(e,t);return ei(n)}function Ni(e){var t,n,i,a,s,o,r,l;const{scale:c}=e,d=(n=(t=c.zoom)==null?void 0:t.domain)==null?void 0:n.call(t),u=((a=(i=c.subX)==null?void 0:i.domain)==null?void 0:a.call(i))||((o=(s=c.x)==null?void 0:s.orgDomain)==null?void 0:o.call(s))||((l=(r=c.x)==null?void 0:r.domain)==null?void 0:l.call(r));return!(d!=null&&d.length)||!(u!=null&&u.length)?!1:!Ln(d[0],u[0])||!Ln(d[1],u[1])}function te(e){return Ni(e)?e.scale.zoom:e.scale.x}function Gc(e,t,n=0){var i,a;const s=(a=(i=te(e)).domain)==null?void 0:a.call(i);if(!(s!=null&&s.length))return!0;const o=ms(e,t),r=+s[0],l=+s[1];return o===null||!Number.isFinite(r)||!Number.isFinite(l)?!0:o>=Math.min(r,l)-n&&o<=Math.max(r,l)+n}function Wc(e,t){const n=[t>0?Math.abs(e[t]-e[t-1]):1/0,t<e.length-1?Math.abs(e[t+1]-e[t]):1/0].filter(Number.isFinite),i=Math.min(...n);return Number.isFinite(i)?i/2:0}function vs(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<t?n=a+1:i=a}return n}function Vc(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<=t?n=a+1:i=a}return n}function Hc(e,t){var n;const{axis:i,state:a}=e,s=[a.dataGeneration,(n=i==null?void 0:i.isTimeSeries)!=null&&n.call(i)?1:0,t.map(c=>`${c.id}:${c.values.length}`).join(",")].join("|"),o=a._canvasXDataTickCache;if((o==null?void 0:o.key)===s)return o;const r=e.mapTargetsToUniqueXs(t),l={key:s,values:r,comparable:r.map(c=>{var d;return(d=ms(e,c))!=null?d:NaN})};return a._canvasXDataTickCache=l,l}function Yc(e,t){const{values:n,comparable:i}=t;if(!Ni(e))return n;const a=hs(e);if(!a||i.length!==n.length||!Number.isFinite(i[0]))return n.filter(d=>Gc(e,d));const[s,o]=a;let r=vs(i,s),l=Vc(i,o);const c=d=>{const u=vs(i,d);let h=-1,f=1/0;for(const g of[u-1,u]){const p=i[g],x=Math.abs(p-d);x<f&&(f=x,h=g)}h>-1&&h<i.length&&f<=Wc(i,h)+1e-6&&(r=Math.min(r,h),l=Math.max(l,h+1))};return c(s),c(o),n.slice(Math.max(0,r),Math.min(n.length,l))}function jc(e,t){return typeof e=="function"?`fn:${t}`:Array.isArray(e)?e.map(n=>n instanceof Date?+n:String(n)).join(","):""}function Uc(e,t){var n,i,a;const{config:s,state:o}=e,l=(((i=(n=te(e)).domain)==null?void 0:i.call(n))||[]).map(d=>d instanceof Date?+d:String(d)).join(","),c=s.axis_rotated?o.height:o.width;return[t?1:0,o.dataGeneration,l,c,s.axis_x_tick_fit?1:0,s.axis_x_tick_count||"",s.axis_x_tick_culling,s.axis_x_tick_culling_max||"",s.axis_x_tick_culling_reverse?1:0,((a=s.axis_x_categories)==null?void 0:a.length)||0,jc(s.axis_x_tick_values,o.redrawGeneration)].join("|")}function Xi(e,t,n,i=!1){var a;return(a=e.axis)!=null&&a.generateTickValues?e.axis.generateTickValues(t,n,i):t}function Kc(e,t){const[n,i]=e,a=[];if(!t||!Number.isFinite(t))return a;for(let s=Math.round(n);s<=i;s+=t)a.push(s);return a}function ai(e,t=!0){var n,i,a,s,o,r,l;const{axis:c,config:d}=e,u=te(e),h=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),f=e.state._canvasXTickValuesCache||(e.state._canvasXTickValuesCache=new Map),g=Uc(e,t),p=f.get(g);if(p)return p;const x=m=>(f.set(g,m),m);if(!(h!=null&&h.length))return x([]);const _=ii(d.axis_x_tick_values,e.api);if(_){const m=zi(e,_);return x(t?ys(e,m):m)}if(d.axis_x_tick_fit&&(h!=null&&h.length)&&e.mapTargetsToUniqueXs){const m=Hc(e,h),b=Yc(e,m),y=Xi(e,b,d.axis_x_tick_count,(i=c==null?void 0:c.isTimeSeries)==null?void 0:i.call(c));return x(t?ys(e,y,!0):y)}if(Ni(e)&&!((a=c==null?void 0:c.isCategorized)!=null&&a.call(c))){const m=((o=(s=e.zoom)==null?void 0:s.getDomain)==null?void 0:o.call(s))||u.domain(),b=Xc(Ke(u,d.axis_x_tick_count||ue),m);return x(t?Rn(b,Wi(e)):b)}if((r=c==null?void 0:c.isCategorized)!=null&&r.call(c)&&((l=d.axis_x_categories)!=null&&l.length)){const m=d.axis_x_categories.map((b,y)=>y);return x(t?Rn(m,Wi(e)):m)}const v=Ke(u,d.axis_x_tick_count||ue);return x(t?Rn(v,Wi(e)):v)}function Zc(e){const{config:t,state:{height2:n,width2:i}}=e,a=t.axis_rotated?n:i;if(t.axis_x_tick_count)return t.axis_x_tick_count;if(t.axis_x_tick_culling!==!1)return Math.min(t.axis_x_tick_culling_max||ue,Math.max(2,Math.floor(a/70)))}function qc(e){var t,n,i,a;const{axis:s,config:o,scale:r}=e,l=r.subX,c=((t=e.getTargetsToShow)==null?void 0:t.call(e))||e.filterTargetsToShow(),d=Zc(e),u=g=>Rn(g,d);if(!l||!(c!=null&&c.length))return[];const h=ii(o.axis_x_tick_values,e.api);if(h)return u(zi(e,h));if(o.axis_x_tick_fit&&e.mapTargetsToUniqueXs){const g=Xi(e,e.mapTargetsToUniqueXs(c),o.axis_x_tick_count,(n=s==null?void 0:s.isTimeSeries)==null?void 0:n.call(s));return u(g)}if((i=s==null?void 0:s.isCategorized)!=null&&i.call(s)&&((a=o.axis_x_categories)!=null&&a.length))return u(o.axis_x_categories.map((g,p)=>p));const f=Ke(l,o.axis_x_tick_count||ue);return u(f)}function Jc(e){var t,n;const i=te(e),a=((t=i.orgDomain)==null?void 0:t.call(i))||((n=i.domain)==null?void 0:n.call(i));if(!(a!=null&&a.length))return[];const s=+a[0],o=+a[a.length-1];if(!Number.isFinite(s)||!Number.isFinite(o))return[];const r=Math.ceil(Math.min(s,o)),l=Math.floor(Math.max(s,o)),c=Array.from({length:Math.max(0,l-r+1)},(d,u)=>r+u);return e.config.axis_x_tick_outer?c.slice(1,-1):c}function Gi(e,t,n=te(e)){var i,a,s,o,r;const l=n,c=Oe(e,t);if((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)){const d=(s=l.orgScale)==null?void 0:s.call(l);if(d)return d(c);const u=((r=(o=e.axis.x)==null?void 0:o.tickOffset)==null?void 0:r.call(o))||(l(1)-l(0))/2;return l(c)-u}return l(c)}function Qc(e,t,n){if(t.length<2)return!1;const i=Math.max(1,n)/2,a=t.map(o=>Gi(e,o)).filter(Number.isFinite).sort((o,r)=>o-r);if(a.length<2)return!1;let s=a[0]+i;for(let o=1;o<a.length;o++){const r=a[o]-i,l=a[o]+i;if(r<=s+qa)return!0;s=Math.max(s,l)}return!1}function bs(e,t){const n=new Set;return t.filter(i=>{const a=Gi(e,i),s=Math.round(a);return!Number.isFinite(a)||n.has(s)?!1:(n.add(s),!0)})}function td(e,t,n=1){var i;const{axis:a,config:s}=e;if((i=a==null?void 0:a.isCategorized)!=null&&i.call(a)){const r=Jc(e);return bs(e,r)}if(s.axis_x_tick_culling===!1||s.axis_x_tick_culling_lines===!1)return t;const o=ai(e,!1);return Qc(e,o,n)?t:bs(e,o)}function si(e,t="y",n,i=!0){var a,s,o;const{axis:r,config:l,scale:c}=e,d=`axis_${t}`,u=c[t],h=ii(l[`${d}_tick_values`],e.api),f=x=>i?ad(e,t,x):x;if(h)return f(xs(e,h,t));const g=Kc(u.domain(),l[`${d}_tick_stepSize`]);if(g.length)return f(g);const p=n!=null?n:l[`${d}_tick_count`];if((a=r==null?void 0:r.isTimeSeries)!=null&&a.call(r,t)&&l[`${d}_tick_time_value`])return f(Ke(u,l[`${d}_tick_time_value`]));if((s=r==null?void 0:r.isLog)!=null&&s.call(r,t))return f(_s(u,p));if(p){const x=u.domain();return f(Xi(e,x,x.every(_=>_===0)?1:p,(o=r==null?void 0:r.isTimeSeries)==null?void 0:o.call(r,t)))}return f(Ke(u,ue))}function ed(e,t,n){const i=t==="x"?te(e):e.scale[t],a=i!=null&&i.copy?i.copy():i;return n.domain&&(a!=null&&a.domain)&&a.domain(n.domain),a}function nd(e,t,n,i){var a,s,o;const r=i.tick||{},l=ii(r.values,e.api);return l?t==="x"?zi(e,l):xs(e,l,t):t!=="x"&&((s=(a=e.axis)==null?void 0:a.isLog)!=null&&s.call(a,t))?_s(n,r.count):Ke(n,(o=r.count)!=null?o:ue)}function id(e,t){var n;const i=(n=t.tick)==null?void 0:n.format;return typeof i=="function"?i.bind(e.api):(a=>a)}function Rn(e,t){const n=e.length-1;if(t&&n>t){const i=e.length-1;return t<=1?[e[0]]:Array.from({length:t},(a,s)=>e[Math.round(s*i/(t-1))])}return e}function ad(e,t,n){const{config:i}=e,a=`axis_${t}_tick_culling`;if(!i[a])return n;const s=n.slice().sort((d,u)=>{const h=+d,f=+u,g=Number.isFinite(h)&&Number.isFinite(f)?h-f:String(d).localeCompare(String(u));return i[`${a}_reverse`]?-g:g}),o=s.length,r=i[`${a}_max`]||ue;let l=0;for(let d=1;d<o;d++)if(o/d<r){l=d;break}if(!l)return n;const c=new Set(s.filter((d,u)=>u%l===0));return n.filter(d=>c.has(d))}function ys(e,t,n=!1){const{config:i}=e;if(i.axis_x_tick_culling===!1)return t;const a=i.axis_x_tick_culling_max||ue,s=n?t:t.slice().sort((c,d)=>{const u=+c,h=+d;return Number.isFinite(u)&&Number.isFinite(h)?i.axis_x_tick_culling_reverse?h-u:u-h:i.axis_x_tick_culling_reverse?String(d).localeCompare(String(c)):String(c).localeCompare(String(d))}),o=s.length;let r=0;for(let c=1;c<o;c++)if(o/c<a){r=c;break}if(!r)return t;if(n)return t.filter((c,d)=>i.axis_x_tick_culling_reverse?(o-1-d)%r===0:d%r===0);const l=new Set(s.filter((c,d)=>d%r===0));return t.filter(c=>l.has(c))}function Wi(e){const{config:t,state:{height:n,width:i}}=e,a=t.axis_rotated?n:i;if(t.axis_x_tick_count)return t.axis_x_tick_count;if(t.axis_x_tick_culling!==!1)return Math.min(t.axis_x_tick_culling_max||ue,Math.max(2,Math.floor(a/70)))}function sd(e){var t,n;const{axis:i,config:a}=e,s=(n=(t=i==null?void 0:i.y)==null?void 0:t.getGeneratedTicks)==null?void 0:n.call(t,a.grid_y_ticks);return s!=null&&s.length?s:a.grid_y_ticks?Rn(si(e,"y",void 0,!1),a.grid_y_ticks):si(e,"y",void 0,!1)}var od=Object.defineProperty,rd=(e,t,n)=>t in e?od(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ld=(e,t,n)=>rd(e,typeof t!="symbol"?t+"":t,n);class Ts{constructor(t){ld(this,"ctx",t)}get context(){return this.ctx}withContext(t,n){const i=this.ctx;this.ctx=t;try{n()}finally{this.ctx=i}}withState(t){const{ctx:n}=this;n.save();try{t(n)}finally{n.restore()}}withTranslation(t,n,i){this.withState(a=>{a.translate(t,n),i(a)})}clipRect(t,n){this.withState(i=>{i.beginPath(),i.rect(t.x,t.y,t.w,t.h),i.clip(),n(i)})}measureText(t){return this.ctx.measureText(t)}traceLine(t,n,i,a){const{ctx:s}=this;s.moveTo(t,n),s.lineTo(i,a)}traceCrispLine(t,n,i,a,s){this.traceLine(this.crisp(t,s),this.crisp(n,s),this.crisp(i,s),this.crisp(a,s))}traceCircle(t,n,i){this.ctx.moveTo(t+i,n),this.ctx.arc(t,n,i,0,Math.PI*2)}strokePath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.stroke()})}fillPath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.fill()})}fillRect(t,n){this.withStyle(n,i=>{i.fillRect(t.x,t.y,t.w,t.h)})}fillRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.fillRect(a,i);return}this.fillPath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.strokeRect(a,i);return}this.strokePath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRect(t,n){this.withStyle(n,i=>{i.strokeRect(t.x,t.y,t.w,t.h)})}text(t,n,i,a){const s=(r,l,c)=>{(a==null?void 0:a.maxWidth)===void 0?r.fillText(t,l,c):r.fillText(t,l,c,a.maxWidth)},o=r=>{a!=null&&a.angle?(r.translate(n,i),r.rotate(a.angle*Math.PI/180),s(r,0,0)):s(r,n,i)};a!=null&&a.angle?this.withState(r=>{this.applyStyle(a),o(r)}):this.withStyle(a,o)}textLines(t,n,i,a){this.withState(s=>{const o=t.split(`
11
- `),r=re((a==null?void 0:a.font)||s.font),l=o.length>1?-((o.length-1)*r):0;this.applyStyle(a),s.translate(n,i),a!=null&&a.angle&&s.rotate(a.angle*Math.PI/180),o.forEach((c,d)=>{const u=l+d*r;(a==null?void 0:a.maxWidth)===void 0?s.fillText(c,0,u):s.fillText(c,0,u,a.maxWidth)})})}point(t,n,i,a,s){this.withStyle(s,o=>{const r=!(s!=null&&s.stroke)||s.fill!==void 0,l=(s==null?void 0:s.stroke)!==void 0;if(t==="rectangle"){const c=a*2,d={x:n-a,y:i-a,w:c,h:c};r&&o.fillRect(d.x,d.y,d.w,d.h),l&&o.strokeRect(d.x,d.y,d.w,d.h)}else o.beginPath(),o.arc(n,i,a,0,Math.PI*2),r&&o.fill(),l&&o.stroke()})}getRectRadii(t,n){const i=typeof n=="number"?{tl:n,tr:n,br:n,bl:n}:{tl:n.tl||0,tr:n.tr||0,br:n.br||0,bl:n.bl||0},a=Math.max(0,Math.min(Math.abs(t.w),Math.abs(t.h))/2);return{tl:Math.max(0,Math.min(i.tl,a)),tr:Math.max(0,Math.min(i.tr,a)),br:Math.max(0,Math.min(i.br,a)),bl:Math.max(0,Math.min(i.bl,a))}}traceRoundRect(t,n,i){const{x:a,y:s,w:o,h:r}=n,l=a+o,c=s+r;t.moveTo(a+i.tl,s),t.lineTo(l-i.tr,s),i.tr?t.quadraticCurveTo(l,s,l,s+i.tr):t.lineTo(l,s),t.lineTo(l,c-i.br),i.br?t.quadraticCurveTo(l,c,l-i.br,c):t.lineTo(l,c),t.lineTo(a+i.bl,c),i.bl?t.quadraticCurveTo(a,c,a,c-i.bl):t.lineTo(a,c),t.lineTo(a,s+i.tl),i.tl?t.quadraticCurveTo(a,s,a+i.tl,s):t.lineTo(a,s),t.closePath()}normalizeRect(t){const n=t.w<0?t.x+t.w:t.x,i=t.h<0?t.y+t.h:t.y;return{x:n,y:i,w:Math.abs(t.w),h:Math.abs(t.h)}}applyStyle(t){if(!t)return;const{ctx:n}=this;t.fill!==void 0&&(n.fillStyle=t.fill),t.stroke!==void 0&&(n.strokeStyle=t.stroke),t.lineWidth!==void 0&&(n.lineWidth=t.lineWidth),t.alpha!==void 0&&(n.globalAlpha=t.alpha),t.font!==void 0&&(n.font=t.font),t.textAlign!==void 0&&(n.textAlign=t.textAlign),t.textBaseline!==void 0&&(n.textBaseline=t.textBaseline),t.lineDash!==void 0&&n.setLineDash(t.lineDash)}withStyle(t,n){t?this.withState(i=>{this.applyStyle(t),n(i)}):n(this.ctx)}crisp(t,n){return n%2?Math.round(t)+.5:Math.round(t)}}var cd=Object.defineProperty,dd=Object.defineProperties,ud=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertySymbols,hd=Object.prototype.hasOwnProperty,fd=Object.prototype.propertyIsEnumerable,Vi=(e,t,n)=>t in e?cd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gd=(e,t)=>{for(var n in t||(t={}))hd.call(t,n)&&Vi(e,n,t[n]);if(ws)for(var n of ws(t))fd.call(t,n)&&Vi(e,n,t[n]);return e},pd=(e,t)=>dd(e,ud(t)),Hi=(e,t,n)=>Vi(e,typeof t!="symbol"?t+"":t,n);const Cs=20,Ss=15;function Yi(e){return e?-1:1}function xd(e,t){return e?t?-1:1:t?1:-1}function ji(e,t,n){return{x:e.left-Cs,y:0,w:t+Cs*2,h:n}}function Ui(e,t,n){return{x:0,y:e.top-Ss,w:t,h:n+Ss*2}}function _d(e,t){var n,i;const a=(i=(n=e.config.axis_tooltip)==null?void 0:n.backgroundColor)!=null?i:"black";return typeof a=="string"?a:(a==null?void 0:a[t])||null}function md(e,t,n){var i,a;const s=e.scale[t];if(!(s!=null&&s.invert))return null;const o=s.invert(n);if(o==null)return null;if(t==="x"&&((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i)))return e.format.xAxisTick(o);const r=Number(o);return Number.isFinite(r)?r.toFixed(2):`${o}`}function vd(e,t){const{config:n,state:{height:i,margin:a,width:s}}=e,o=n.axis_rotated,r={x:a.left,y:a.top};return t==="x"?!o&&(r.y+=i):t==="y"?o&&(r.y+=i):o?r.y-=1:r.x+=s,r}function bd(e,t,n,i){return i?{x:e.x+n,y:e.y-t}:{x:e.x+t,y:e.y+n}}function As(e,t){const n=e?e(t):t;return n==null?"":String(n)}function En(e,t){return e[`${t}TickFont`]||e.labelFont}function Ki(e,t){const n=e.measureText("0"),i=(n.fontBoundingBoxAscent||0)+(n.fontBoundingBoxDescent||0),a=(n.actualBoundingBoxAscent||0)+(n.actualBoundingBoxDescent||0),s=(t||10)*(11.5/10);return Math.max(t,i,a,s)}function yd(e){return 11.5-2.5*(e/15)*(e>0?1:-1)}function Td(e){return 8*Math.sin(Math.PI*(e/180))}function Zi(e,t){if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return Number.isFinite(n)?/em$/.test(e.trim())?n*t:n:0}return 0}function wd(e,t,n){if(!t)return[e];const i=n.measureText("0").width||5.5;function a(s,o){let r;for(let l=1;l<o.length;l++)if(o.charAt(l)===" "&&(r=l),t<i*(l+1)){const c=r||l;return a(s.concat(o.slice(0,c)),o.slice(r?r+1:l))}return s.concat(o)}return a([],e)}function qi(e,t,n,i){var a,s;const o=e.config.axis_x_tick_width;if(o&&o>0)return o;if(n)return 95;if((s=(a=e.axis)==null?void 0:a.isCategorized)!=null&&s.call(a)&&t.length>1){const r=i(Oe(e,t[0])),l=i(Oe(e,t[1]));return Math.max(0,Math.abs(l-r)-12)}return 110}function ks(e,t,n,i,a=[],s=!1,o=te(e),r){const l=n?n(i):i;if(l==null)return[""];if(Array.isArray(l))return l.map(d=>String(d));const c=String(l);return c.indexOf(`
8
+ * @version 4.1.0-next.1
9
+ */(function(Qt,fn){if(typeof exports=="object"&&typeof module=="object")module.exports=fn(require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if(typeof define=="function"&&define.amd)define(["d3-brush","d3-drag","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],fn);else{var ai=typeof exports=="object"?fn(require("d3-brush"),require("d3-drag"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):fn(Qt.d3,Qt.d3,Qt.d3,Qt.d3,Qt.d3,Qt.d3,Qt.d3,Qt.d3,Qt.d3,Qt.d3);for(var si in ai)(typeof exports=="object"?exports:Qt)[si]=ai[si]}})(this,function(xs,Qt,fn,ai,si,Yc,Hc,jc,Uc,Kc){return(function(){"use strict";var Zc=[,,(function(q){q.exports=Yc}),(function(q){q.exports=si}),(function(q){q.exports=Hc}),(function(q){q.exports=jc}),(function(q){q.exports=Qt}),(function(q){q.exports=xs}),(function(q){q.exports=Uc}),(function(q){q.exports=Kc}),(function(q){q.exports=ai}),(function(q){q.exports=fn})],ms={};function bt(q){var Ft=ms[q];if(Ft!==void 0)return Ft.exports;var O=ms[q]={exports:{}};return Zc[q](O,O.exports,bt),O.exports}(function(){bt.d=function(q,Ft){if(Array.isArray(Ft))for(var O=0;O<Ft.length;){var I=Ft[O++],Mn=Ft[O++];bt.o(q,I)?Mn===0&&O++:Mn===0?Object.defineProperty(q,I,{enumerable:!0,value:Ft[O++]}):Object.defineProperty(q,I,{enumerable:!0,get:Mn})}else for(var I in Ft)bt.o(Ft,I)&&!bt.o(q,I)&&Object.defineProperty(q,I,{enumerable:!0,get:Ft[I]})}})(),(function(){bt.o=function(q,Ft){return Object.prototype.hasOwnProperty.call(q,Ft)}})(),(function(){bt.r=function(q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(q,"__esModule",{value:!0})}})();var Ui={};return(function(){bt.r(Ui),bt.d(Ui,{bb:function(){return Vc},default:function(){return Vc}});var q={};bt.r(q),bt.d(q,{selection:function(){return Ll},subchart:function(){return Dl},zoom:function(){return $l}});var Ft={};bt.r(Ft),bt.d(Ft,{area:function(){return ic},areaLineRange:function(){return ac},areaSpline:function(){return oc},areaSplineRange:function(){return rc},areaStep:function(){return lc},areaStepRange:function(){return sc},bar:function(){return cc},bubble:function(){return uc},candlestick:function(){return pc},donut:function(){return Cc},funnel:function(){return Rc},gauge:function(){return Ec},line:function(){return Pc},pie:function(){return Mc},polar:function(){return Oc},radar:function(){return Bc},scatter:function(){return zc},spline:function(){return Dc},step:function(){return Ic},treemap:function(){return Gc}});var O=bt(2);const I={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",AREA_STEP_RANGE:"area-step-range",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",FUNNEL:"funnel",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},Mn={export:"exportApi",flow:"flow",xgrids:"grid",ygrids:"grid",regions:"regions",category:"category",categories:"category"},_e=10,dt=6,Je=3,qc=dt+Je,vs=1,bs={x:{start:"M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",end:"M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"},y:{start:"M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z",end:"M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"}},Ki={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",AREA_STEP_RANGE:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",FUNNEL:"initFunnel",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},ce={Area:[I.AREA,I.AREA_SPLINE,I.AREA_SPLINE_RANGE,I.AREA_LINE_RANGE,I.AREA_STEP,I.AREA_STEP_RANGE],AreaRange:[I.AREA_SPLINE_RANGE,I.AREA_LINE_RANGE,I.AREA_STEP_RANGE],Arc:[I.PIE,I.DONUT,I.GAUGE,I.POLAR,I.RADAR],Line:[I.LINE,I.SPLINE,I.AREA,I.AREA_SPLINE,I.AREA_SPLINE_RANGE,I.AREA_LINE_RANGE,I.STEP,I.AREA_STEP,I.AREA_STEP_RANGE],Step:[I.STEP,I.AREA_STEP,I.AREA_STEP_RANGE],Spline:[I.SPLINE,I.AREA_SPLINE,I.AREA_SPLINE_RANGE]};var Qe=bt(3);const J=e=>e||e===0,z=e=>typeof e=="function",Q=e=>typeof e=="string",$=e=>typeof e=="number",Ct=e=>typeof e=="undefined",ct=e=>typeof e!="undefined",tn=e=>typeof e=="boolean",Jc=e=>Math.ceil(e/10)*10,gn=e=>Math.ceil(e)+.5,en=e=>e[1]-e[0],Kt=e=>typeof e=="object",Qc=e=>{for(const t in e)return!1;return!0},se=e=>Ct(e)||e===null||Q(e)&&e.length===0||Kt(e)&&!(e instanceof Date)&&Qc(e)||$(e)&&isNaN(e),yt=e=>!se(e),ot=e=>Array.isArray(e),tt=e=>e&&!(e!=null&&e.nodeType)&&Kt(e)&&!ot(e);function tu(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function eu(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",i=s=>setTimeout(s,1),a=s=>clearTimeout(s);return[t?e.requestAnimationFrame:i,t?e.cancelAnimationFrame:a,n?e.requestIdleCallback:i,n?e.cancelIdleCallback:a]}const N=tu(),nt=N==null?void 0:N.document,[nu,Pm,ys,iu]=eu(N),au=new Set(["span","div","p","br","b","i","em","small","strong","mark","u","s","sub","sup","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","hr","pre","code","blockquote","abbr","ins","del","a","img","figure","figcaption","svg","g","path","circle","ellipse","rect","line","polyline","polygon","text","tspan","textPath","use","defs","symbol","clipPath","mask","linearGradient","radialGradient","stop","pattern","marker","title","desc"]),su=new Set(["class","id","style","title","lang","dir","href","src","alt","width","height","colspan","rowspan","scope","headers","d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","dx","dy","viewBox","preserveAspectRatio","transform","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternTransform","marker-start","marker-mid","marker-end","markerWidth","markerHeight","refX","refY","xlink:href"]),oi=new Map;au.forEach(e=>oi.set(e.toLowerCase(),e));const ri=new Map;su.forEach(e=>ri.set(e.toLowerCase(),e));const ou=new Set(["http:","https:","mailto:"]),ru=new Set(["href","src","xlink:href"]),lu=/^<\/?([a-zA-Z][a-zA-Z0-9]*)/,cu=/^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/,uu=/^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/,Ts=/([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,ws=/url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi,du=["expression(","behavior:","binding:","@import","@charset","-moz-binding:"];function Zi(e){return e.replace(/&colon;/gi,":").replace(/&newline;/gi,`
10
+ `).replace(/&tab;/gi," ").replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&#(\d+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,10))).replace(/&#x([0-9a-f]+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,16)))}function Cs(e){const n=Zi(e).trim().replace(/[\s\u0000-\u001f]/g,"").toLowerCase();if(!n||n.startsWith("#"))return!0;const i=n.match(/^[^/?#]*:/);return i?ou.has(i[0]):!0}function hu(e){const n=Zi(e).replace(/[\u0000-\u001f]/g,"");ws.lastIndex=0;let i;for(;(i=ws.exec(n))!==null;)if(!Cs(i[1]))return null;const a=n.toLowerCase().replace(/\s/g,"");for(const s of du)if(a.includes(s))return null;return e}const fu={'"':"&quot;","'":"&#39;","`":"&#96;"},gu=/["'`]/g;function qi(e){return e.replace(gu,t=>fu[t])}function pu(e,t,n=!1){if(ru.has(e))return Cs(t)?n?qi(t):t:null;if(e==="style"){const a=hu(t);return a===null?null:n?qi(a):a}const i=Zi(t).toLowerCase().replace(/\s/g,"");return/\bon\w+=/.test(i)?null:n?qi(t):t}function _u(e){const t=e.match(lu);return t?t[1].toLowerCase():null}function xu(e){const t=_u(e);return t!==null&&oi.has(t)}function mu(e){var t,n,i;const a=e.match(cu);if(a){const p=a[1].toLowerCase();return`</${(t=oi.get(p))!=null?t:p}>`}const s=e.match(uu);if(!s)return"";const[,o,r,l]=s,c=o.toLowerCase(),u=(n=oi.get(c))!=null?n:c,d=[];Ts.lastIndex=0;let h;for(;(h=Ts.exec(r))!==null;){const p=h[1].toLowerCase(),_=h[2],x=h[3],m=h[4];if(p.startsWith("on"))continue;const v=(i=ri.get(p))!=null?i:p;let b,y;if(_!==void 0)b=_,y='"';else if(x!==void 0)b=x,y="'";else if(m!==void 0)b=m,y='"';else{ri.has(p)&&d.push(v);continue}if(ri.has(p)){const w=pu(p,b,m!==void 0);w!==null&&d.push(`${v}=${y}${w}${y}`)}}const f=d.length>0?` ${d.join(" ")}`:"";return`<${u}${f}${l?"/>":">"}`}function Se(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|[^<>\s]+>/g,t=>t.startsWith("<!--")?"":t.startsWith("<")?xu(t)?mu(t):t.replace(/</g,"&lt;"):t.slice(0,-1)+"&gt;")}var vu=Object.defineProperty,Ss=Object.getOwnPropertySymbols,bu=Object.prototype.hasOwnProperty,yu=Object.prototype.propertyIsEnumerable,ks=(e,t,n)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,As=(e,t)=>{for(var n in t||(t={}))bu.call(t,n)&&ks(e,n,t[n]);if(Ss)for(var n of Ss(t))yu.call(t,n)&&ks(e,n,t[n]);return e};function Ls(e,t){for(let n=0;n<e.length;n++){const i=e[n];i!==null&&ct(i)&&t(i,n)}}function Ne(e,t,n){return ct(e[t])?e[t]:n}function Tu(e,t){for(const n in e)if(e[n]===t)return!0;return!1}function Y(e,t,...n){const i=z(e);return i&&e.call(t,...n),i}function li(e,t){let n=0;const i=function(...a){!--n&&t.apply(this,a)};"duration"in e?e.each(()=>++n).on("end",i):(++n,e.call(i))}const $t=e=>e.charAt(0).toUpperCase()+e.slice(1);function wu(e,t="-"){return e.split(t).map((n,i)=>i?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const nn=e=>[].slice.call(e);function Cu(...e){const t=n=>{if(ot(n))return n.map(t);if(tt(n)&&n.constructor){const i=new n.constructor;for(const a in n)i[a]=t(n[a]);return i}return n};return e.map(n=>t(n)).reduce((n,i)=>As(As({},n),i))}function St(e={},t){ot(t)&&t.forEach(n=>St(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}function Ji(e){const t=e[0]instanceof Date,n=Array.from(new Set(t?e.map(Number):e));return t?n.map(i=>new Date(i)):n}function Su(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function ke(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return tt(e)&&tt(n)&&Object.keys(n).forEach(i=>{if(!/^(__proto__|constructor|prototype)$/i.test(i)){const a=n[i];a instanceof Date?e[i]=new Date(a.getTime()):tt(a)?(!e[i]&&(e[i]={}),e[i]=ke(e[i],a)):e[i]=ot(a)?a.concat():a}}),ke(e,...t)}function pn(e,t=!0){let n;return e[0]instanceof Date?n=t?(i,a)=>i-a:(i,a)=>a-i:t&&!e.every(isNaN)?n=(i,a)=>i-a:t||(n=(i,a)=>i>a&&-1||i<a&&1||i===a&&0),e.concat().sort(n)}function ue(e,t){let n=t.filter(i=>yt(i));if(n.length)if($(n[0])){let i=e==="min"?1/0:-1/0;for(const a of n)(e==="min"?a<i:a>i)&&(i=a);n=i}else n[0]instanceof Date&&(n=pn(n,e==="min")[0]);else n=void 0;return n}const ci=(e,t,n=1)=>{const i=[],a=Math.max(0,Math.ceil((t-e)/n))|0;for(let s=0;s<a;s++)i.push(e+s*n);return i};let ku=0;function xe(e=!0){const t=++ku;return e?String(t):t}function Qi(e,t,n,i,a){if(n>i)return-1;const s=Math.floor((n+i)/2);let{x:o,w:r=0}=e[s];return a&&(o=e[s].y,r=e[s].h),t>=o&&t<=o+r?s:t<o?Qi(e,t,n,s-1,a):Qi(e,t,s+1,i,a)}function an(e,t){return Se(e.replace(/\{=([^}]+)\}/g,(n,i)=>{var a;return(a=t[i])!=null?a:""}))}function Wt(e){var t;let n;if(e instanceof Date)n=e;else if(Q(e)){const{config:i,format:a}=this;n=(t=a.dataTime(i.data_xFormat)(e))!=null?t:new Date(e)}else $(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function Rs(e){if(tt(e)&&!Q(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(Q(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[n,i=n,a=n,s=i]=t;return{top:n,right:i,bottom:a,left:s}}function Es(e,t){t()===!1?nu(()=>Es(e,t)):e()}function Ps(e,t=(n=>n)){const n=new Set;return Ls(e,(i,a)=>{n.add(t(i,a))}),n}function Ds(e,t,n=(i=>i)){const i=new Map;return Ls(e,(a,s)=>{i.set(t(a,s),n(a,s))}),i}function Xe(e="linear",t,n){const i={linear:Qe.scaleLinear,log:Qe.scaleSymlog,_log:Qe.scaleLog,time:Qe.scaleTime,utc:Qe.scaleUtc}[e]();return i.type=e,/_?log/.test(e)&&i.clamp(!0),i.range([t!=null?t:0,n!=null?n:1])}var Au={getXScale(e,t,n,i){const a=this,s=a.state.loading!=="append"&&a.scale.zoom||Xe(a.axis.getAxisType("x"),e,t);return a.getCustomizedXScale(n?s.domain(n):s,i)},getYScale(e,t,n,i,a){const o=this.axis.getAxisType(e);if(a&&a.type===o)return a.range([t,n]),i&&a.domain(i),a;const r=Xe(o,t,n);return i&&r.domain(i),r},getYScaleById(e,t=!1){var n;const i=((n=this.axis)==null?void 0:n.getId(e))==="y2",a=t?i?"subY2":"subY":i?"y2":"y";return this.scale[a]},getCustomizedXScale(e,t){const n=this,i=()=>(t?t():n.axis.x.tickOffset())||(n.axis.isCategorized()?(e(1)-e(0))/2:0),a=n.config.axis_x_inverted,s=function(o){return e(o)+i()};for(const o in e)s[o]=e[o];return s.orgDomain=()=>e.domain(),s.orgScale=()=>e,n.axis.isCategorized()&&(s.domain=function(o){let r=o;return arguments.length?(e.domain(r),s):(r=this.orgDomain(),a?[r[0]+1,r[1]]:[r[0],r[1]+1])}),s},updateScales(e,t=!0){var n,i,a,s,o,r,l,c,u;const d=this,{axis:h,config:f,format:g,org:p,scale:_,state:{current:x,width:m,height:v,width2:b,height2:y,hasAxis:T,hasTreemap:w}}=d;if(T){const C=f.axis_rotated,k=d.getResettedPadding(1),S={x:C?k:0,y:C?0:v,subX:C?1:0,subY:C?0:y},A={x:C?v:m,y:C?m:k,subX:C?v:m,subY:C?b:1},L=t?(n=_.x)==null?void 0:n.orgDomain():_.zoom||(a=(i=_.x)==null?void 0:i.domain)==null?void 0:a.call(i),E=t?p.xDomain:_.zoom||(o=(s=_.subX)==null?void 0:s.domain)==null?void 0:o.call(s);_.x=d.getXScale(S.x,A.x,L,()=>h.x.tickOffset()),_.subX=d.getXScale(S.x,A.x,E,D=>{var R;return D%1?0:((R=h.subX)!=null?R:h.x).tickOffset()}),g.xAxisTick=h.getXAxisTickFormat(),g.subXAxisTick=h.getXAxisTickFormat(!0),h.setAxis("x",_.x,f.axis_x_tick_outer,e),f.subchart_show&&h.setAxis("subX",_.subX,(r=f.subchart_axis_x_tick_outer)!=null?r:f.axis_x_tick_outer,e),_.y=d.getYScale("y",S.y,A.y,_.y?_.y.domain():f.axis_y_default,_.y),_.subY=d.getYScale("y",S.subY,A.subY,_.subY?_.subY.domain():f.axis_y_default,_.subY),h.setAxis("y",_.y,f.axis_y_tick_outer,e),f.subchart_show&&f.subchart_axis_y_show&&h.setAxis("subY",_.subY,(l=f.subchart_axis_y_tick_outer)!=null?l:f.axis_y_tick_outer,e),(f.axis_y2_show||f.subchart_axis_y2_show)&&(_.y2=d.getYScale("y2",S.y,A.y,_.y2?_.y2.domain():f.axis_y2_default,_.y2),_.subY2=d.getYScale("y2",S.subY,A.subY,_.subY2?_.subY2.domain():f.axis_y2_default,_.subY2),h.setAxis("y2",_.y2,f.axis_y2_tick_outer,e),f.subchart_show&&f.subchart_axis_y2_show&&h.setAxis("subY2",_.subY2,(c=f.subchart_axis_y2_tick_outer)!=null?c:f.axis_y2_tick_outer,e))}else if(w){const C=d.getCurrentPadding();_.x=(0,Qe.scaleLinear)().rangeRound([C.left,x.width-C.right]),_.y=(0,Qe.scaleLinear)().rangeRound([C.top,x.height-C.bottom])}else(u=d.updateArc)==null||u.call(d)},xx(e){const t=this,{config:n,scale:{x:i,zoom:a}}=t,s=n.zoom_enabled&&a?a:i;return e?s(J(e.x)?e.x:e):null},xv(e){const t=this,{axis:n,config:i,scale:{x:a,zoom:s}}=t,o=i.zoom_enabled&&s?s:a;let r=t.getBaseValue(e);return n.isTimeSeries()?r=Wt.call(t,r):n.isCategorized()&&Q(r)&&(r=i.axis_x_categories.indexOf(r)),o(r)},yv(e){const t=this,{scale:{y:n,y2:i}}=t;return(e.axis&&e.axis==="y2"?i:n)(t.getBaseValue(e))},subxx(e){return e?this.scale.subX(e.x):null}};const Is=1e5;function de(e){const t=/(\d+(?:\.\d+)?)px/.exec(e),n=parseFloat(t?t[1]:e);return Number.isFinite(n)?n:12}function te(e,t,n,i){return t.indices[n]||e.getShapeIndices(i)}function _n(e,t,n=[]){var i;const a=typeof t=="string"?t:t==null?void 0:t.id;return!((i=e.isGrouped)!=null&&i.call(e,a))||n.some(s=>s(e,t))}function Ge(e,t){var n;const i=typeof t=="string"?t:t==null?void 0:t.id;return i&&((n=e.data_types)==null?void 0:n[i])||e.data_type||I.LINE}function ui(e){const t=+e;return Number.isFinite(t)?t:null}function Ms(e){var t,n;const i=(n=(t=e.scale.zoom||e.scale.x)==null?void 0:t.domain)==null?void 0:n.call(t),a=ui(i==null?void 0:i[0]),s=ui(i==null?void 0:i[1]);return a===null||s===null?null:[Math.min(a,s),Math.max(a,s)]}function di(e){return ui(e==null?void 0:e.x)}function Lu(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=di(e[s]);if(o===null)return 0;(n?o<t:o>t)?i=s+1:a=s}return i}function Ru(e,t,n){let i=0,a=e.length;for(;i<a;){const s=i+a>>1,o=di(e[s]);if(o===null)return e.length;(n?o<=t:o>=t)?i=s+1:a=s}return i}function Ae(e,t,n=1){const i=(t==null?void 0:t.values)||[],a={start:0,end:i.length},s=Ms(e);if(!i.length||!s)return a;const o=e.state,r=o._canvasVisibleRangeCache||(o._canvasVisibleRangeCache=new Map),l=[t.id,i.length,o.dataGeneration,s[0],s[1],n].join(":"),c=r.get(t.id);if((c==null?void 0:c.key)===l)return c.range;const u=di(i[0]),d=di(i[i.length-1]);if(u===null||d===null)return a;const h=u<=d,f=Lu(i,s[0],h),g=Ru(i,s[1],h),p={start:Math.max(0,Math.min(f,g)-n),end:Math.min(i.length,Math.max(f,g)+n)};return r.set(t.id,{key:l,range:p}),p}function ee(e,t){return Ge(e.config,t)===I.BAR}function Fn(e,t){return ce.Area.indexOf(Ge(e.config,t))>-1}function xn(e,t){const n=Ge(e.config,t);return ce.Line.indexOf(n)>-1}function Ve(e,t){return Ge(e.config,t)===I.SCATTER}function We(e,t){return Ge(e.config,t)===I.BUBBLE}function he(e,t){return xn(e,t)||Ve(e,t)||We(e,t)}function Yt(e,t){return Ge(e.config,t)===I.CANDLESTICK}function ta(e,t){return Ge(e.config,t)===I.TREEMAP}function Dm(e,t){const n=Ge(e,t);return n===I.BAR||ce.Area.indexOf(n)>-1}function Rt(e,t){const n=e.getBaseValue(t);return n!=null}function Tt(e,t){return Number.isFinite(e)&&Number.isFinite(t)}function Fs(e,t,n){const i=Math.ceil(n)+1,a=Math.max(1,Math.ceil(e)+i*2+1),s=Math.max(1,Math.ceil(t)+i*2+1);return{data:new Uint8Array(a*s),height:s,offset:i,width:a}}function Os(e,t,n){const i=Math.round(t)+e.offset,a=Math.round(n)+e.offset;if(i<0||i>=e.width||a<0||a>=e.height)return!1;const s=a*e.width+i;return e.data[s]?!1:(e.data[s]=1,!0)}function Nt(e,t,n,i=`axis_${t}`){const a=e[`${i}_tick_${n}`];return a!==void 0?a:e[`axis_${t}_tick_${n}`]}function hi(e,t){const n=typeof e=="function"?e.call(t):e;return n!=null&&n.length?n:void 0}function $s(e,t,n){var i,a,s,o,r,l;if((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i,n))return t instanceof Date?t:Wt.call(e,t);if(n==="x"&&((o=(s=e.axis)==null?void 0:s.isCategorized)!=null&&o.call(s))&&typeof t=="string"){const c=e.config.axis_x_categories.indexOf(t);return c>=0?c:t}return(l=(r=e.axis)==null?void 0:r.isLog)!=null&&l.call(r,n)&&t!==null&&t!==void 0?+t:t}function Le(e,t){return $s(e,t,"x")}function On(e,t,n="y"){return $s(e,t,n)}function Bs(e,t,n="y"){return t.map(i=>On(e,i,n))}function ea(e,t){return t.map(n=>Le(e,n)).filter(n=>{var i,a;return!(typeof n=="string"&&((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)))})}function sn(e,t){const n=typeof t=="function"?t():t;return e.ticks?e.ticks(n):e.domain()}function zs(e,t){const[n,i]=e.domain(),a=+n,s=+i;if(t||!Number.isFinite(a)||!Number.isFinite(s)||s<=0)return sn(e,t);const o=Xe("_log").domain([a>0?a:1,s]).range(e.range());let r=o.ticks();for(let l=s.toFixed().length;r.length>15;l--)r=o.ticks(l);return r.length&&(r.splice(0,1,n),r.splice(r.length-1,1,i)),r}function $n(e,t){const n=+e,i=+t;return Number.isFinite(n)&&Number.isFinite(i)?Math.abs(n-i)<1e-6:e===t}function Eu(e,t){const[n,i]=t,a=e.slice();return n!==void 0&&!a.some(s=>$n(s,n))&&a.unshift(n),i!==void 0&&!a.some(s=>$n(s,i))&&a.push(i),a}function Ns(e,t){const n=Le(e,t);return ui(n)}function na(e){var t,n,i,a,s,o,r,l;const{scale:c}=e,u=(n=(t=c.zoom)==null?void 0:t.domain)==null?void 0:n.call(t),d=((a=(i=c.subX)==null?void 0:i.domain)==null?void 0:a.call(i))||((o=(s=c.x)==null?void 0:s.orgDomain)==null?void 0:o.call(s))||((l=(r=c.x)==null?void 0:r.domain)==null?void 0:l.call(r));return!(u!=null&&u.length)||!(d!=null&&d.length)?!1:!$n(u[0],d[0])||!$n(u[1],d[1])}function Zt(e){return na(e)?e.scale.zoom:e.scale.x}function Pu(e,t,n=0){var i,a;const s=(a=(i=Zt(e)).domain)==null?void 0:a.call(i);if(!(s!=null&&s.length))return!0;const o=Ns(e,t),r=+s[0],l=+s[1];return o===null||!Number.isFinite(r)||!Number.isFinite(l)?!0:o>=Math.min(r,l)-n&&o<=Math.max(r,l)+n}function Du(e,t){const n=[t>0?Math.abs(e[t]-e[t-1]):1/0,t<e.length-1?Math.abs(e[t+1]-e[t]):1/0].filter(Number.isFinite),i=Math.min(...n);return Number.isFinite(i)?i/2:0}function Xs(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<t?n=a+1:i=a}return n}function Iu(e,t){let n=0,i=e.length;for(;n<i;){const a=n+i>>1;e[a]<=t?n=a+1:i=a}return n}function Mu(e,t){var n;const{axis:i,state:a}=e,s=[a.dataGeneration,(n=i==null?void 0:i.isTimeSeries)!=null&&n.call(i)?1:0,t.map(c=>`${c.id}:${c.values.length}`).join(",")].join("|"),o=a._canvasXDataTickCache;if((o==null?void 0:o.key)===s)return o;const r=e.mapTargetsToUniqueXs(t),l={key:s,values:r,comparable:r.map(c=>{var u;return(u=Ns(e,c))!=null?u:NaN})};return a._canvasXDataTickCache=l,l}function Fu(e,t){const{values:n,comparable:i}=t;if(!na(e))return n;const a=Ms(e);if(!a||i.length!==n.length||!Number.isFinite(i[0]))return n.filter(u=>Pu(e,u));const[s,o]=a;let r=Xs(i,s),l=Iu(i,o);const c=u=>{const d=Xs(i,u);let h=-1,f=1/0;for(const g of[d-1,d]){const p=i[g],_=Math.abs(p-u);_<f&&(f=_,h=g)}h>-1&&h<i.length&&f<=Du(i,h)+1e-6&&(r=Math.min(r,h),l=Math.max(l,h+1))};return c(s),c(o),n.slice(Math.max(0,r),Math.min(n.length,l))}function Ou(e,t){return typeof e=="function"?`fn:${t}`:Array.isArray(e)?e.map(n=>n instanceof Date?+n:String(n)).join(","):""}function $u(e,t){var n,i,a;const{config:s,state:o}=e,l=(((i=(n=Zt(e)).domain)==null?void 0:i.call(n))||[]).map(u=>u instanceof Date?+u:String(u)).join(","),c=s.axis_rotated?o.height:o.width;return[t?1:0,o.dataGeneration,l,c,s.axis_x_tick_fit?1:0,s.axis_x_tick_count||"",s.axis_x_tick_culling,s.axis_x_tick_culling_max||"",s.axis_x_tick_culling_reverse?1:0,((a=s.axis_x_categories)==null?void 0:a.length)||0,Ou(s.axis_x_tick_values,o.redrawGeneration)].join("|")}function ia(e,t,n,i=!1){var a;return(a=e.axis)!=null&&a.generateTickValues?e.axis.generateTickValues(t,n,i):t}function Bu(e,t){const[n,i]=e,a=[];if(!t||!Number.isFinite(t))return a;for(let s=Math.round(n);s<=i;s+=t)a.push(s);return a}function fi(e,t=!0){var n,i,a,s,o,r,l;const{axis:c,config:u}=e,d=Zt(e),h=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),f=e.state._canvasXTickValuesCache||(e.state._canvasXTickValuesCache=new Map),g=$u(e,t),p=f.get(g);if(p)return p;const _=v=>(f.set(g,v),v);if(!(h!=null&&h.length))return _([]);const x=hi(u.axis_x_tick_values,e.api);if(x){const v=ea(e,x);return _(t?sa(e,v):v)}if(u.axis_x_tick_fit&&(h!=null&&h.length)&&e.mapTargetsToUniqueXs){const v=Mu(e,h),b=Fu(e,v),y=ia(e,b,u.axis_x_tick_count,(i=c==null?void 0:c.isTimeSeries)==null?void 0:i.call(c));return _(t?sa(e,y,!0):y)}if(na(e)&&!((a=c==null?void 0:c.isCategorized)!=null&&a.call(c))){const v=((o=(s=e.zoom)==null?void 0:s.getDomain)==null?void 0:o.call(s))||d.domain(),b=Eu(sn(d,u.axis_x_tick_count||_e),v);return _(t?pi(b,oa(e)):b)}if((r=c==null?void 0:c.isCategorized)!=null&&r.call(c)&&((l=u.axis_x_categories)!=null&&l.length)){const v=u.axis_x_categories.map((b,y)=>y);return _(t?pi(v,oa(e)):v)}const m=sn(d,u.axis_x_tick_count||_e);return _(t?pi(m,oa(e)):m)}function zu(e){const{config:t,state:{height2:n,width2:i}}=e,a=t.axis_rotated?n:i,s=Nt(t,"x","count","subchart_axis_x"),o=Nt(t,"x","culling","subchart_axis_x"),r=Nt(t,"x","culling_max","subchart_axis_x");if(s)return s;if(o!==!1)return Math.min(r||_e,Math.max(2,Math.floor(a/70)))}function Gs(e,t=!0){var n,i,a,s;const{axis:o,config:r,scale:l}=e,c=l.subX,u=((n=e.getTargetsToShow)==null?void 0:n.call(e))||e.filterTargetsToShow(),d=Nt(r,"x","count","subchart_axis_x"),h=zu(e),f=(_,x=!1)=>t?sa(e,_,x,"subchart_axis_x",h):_;if(!c||!(u!=null&&u.length))return[];const g=hi(Nt(r,"x","values","subchart_axis_x"),e.api);if(g)return f(ea(e,g));if(r.axis_x_tick_fit&&e.mapTargetsToUniqueXs){const _=ia(e,e.mapTargetsToUniqueXs(u),d,(i=o==null?void 0:o.isTimeSeries)==null?void 0:i.call(o));return f(_,!0)}if((a=o==null?void 0:o.isCategorized)!=null&&a.call(o)&&((s=r.axis_x_categories)!=null&&s.length))return f(r.axis_x_categories.map((_,x)=>x),!0);const p=sn(c,d||_e);return f(p,!0)}function Vs(e,t=Zt(e),n=e.config.axis_x_tick_outer){var i,a;const s=t,o=((i=s.orgDomain)==null?void 0:i.call(s))||((a=s.domain)==null?void 0:a.call(s));if(!(o!=null&&o.length))return[];const r=+o[0],l=+o[o.length-1];if(!Number.isFinite(r)||!Number.isFinite(l))return[];const c=Math.ceil(Math.min(r,l)),u=Math.floor(Math.max(r,l)),d=Array.from({length:Math.max(0,u-c+1)},(h,f)=>c+f);return n?d.slice(1,-1):d}function aa(e,t,n=Zt(e)){var i,a,s,o,r;const l=n,c=Le(e,t);if((a=(i=e.axis)==null?void 0:i.isCategorized)!=null&&a.call(i)){const u=(s=l.orgScale)==null?void 0:s.call(l);if(u)return u(c);const d=((r=(o=e.axis.x)==null?void 0:o.tickOffset)==null?void 0:r.call(o))||(l(1)-l(0))/2;return l(c)-d}return l(c)}function Ws(e,t,n,i=Zt(e)){if(t.length<2)return!1;const a=Math.max(1,n)/2,s=t.map(r=>aa(e,r,i)).filter(Number.isFinite).sort((r,l)=>r-l);if(s.length<2)return!1;let o=s[0]+a;for(let r=1;r<s.length;r++){const l=s[r]-a,c=s[r]+a;if(l<=o+vs)return!0;o=Math.max(o,c)}return!1}function gi(e,t,n=Zt(e)){const i=new Set;return t.filter(a=>{const s=aa(e,a,n),o=Math.round(s);return!Number.isFinite(s)||i.has(o)?!1:(i.add(o),!0)})}function Nu(e,t,n=1){var i;const{axis:a,config:s}=e;if((i=a==null?void 0:a.isCategorized)!=null&&i.call(a)){const r=Vs(e);return gi(e,r)}if(s.axis_x_tick_culling===!1||s.axis_x_tick_culling_lines===!1)return t;const o=fi(e,!1);return Ws(e,o,n)?t:gi(e,o)}function Xu(e,t,n=1){var i;const{axis:a,config:s,scale:o}=e,r=o.subX,l=Nt(s,"x","culling","subchart_axis_x"),c=Nt(s,"x","culling_lines","subchart_axis_x"),u=Nt(s,"x","outer","subchart_axis_x");if(!r)return[];if((i=a==null?void 0:a.isCategorized)!=null&&i.call(a)){const h=Vs(e,r,u);return gi(e,h,r)}if(l===!1||c===!1)return t;const d=Gs(e,!1);return Ws(e,d,n,r)?t:gi(e,d,r)}function Bn(e,t="y",n,i=!0,a=e.scale[t],s=`axis_${t}`){var o,r,l;const{axis:c,config:u}=e,d=`axis_${t}`,h=hi(Nt(u,t,"values",s),e.api),f=_=>i?Yu(e,t,_,s):_;if(h)return f(Bs(e,h,t));const g=Bu(a.domain(),u[`${d}_tick_stepSize`]);if(g.length)return f(g);const p=n!=null?n:Nt(u,t,"count",s);if((o=c==null?void 0:c.isTimeSeries)!=null&&o.call(c,t)&&u[`${d}_tick_time_value`])return f(sn(a,u[`${d}_tick_time_value`]));if((r=c==null?void 0:c.isLog)!=null&&r.call(c,t))return f(zs(a,p));if(p){const _=a.domain();return f(ia(e,_,_.every(x=>x===0)?1:p,(l=c==null?void 0:c.isTimeSeries)==null?void 0:l.call(c,t)))}return f(sn(a,_e))}function Gu(e,t,n){const i=t==="x"?Zt(e):e.scale[t],a=i!=null&&i.copy?i.copy():i;return n.domain&&(a!=null&&a.domain)&&a.domain(n.domain),a}function Vu(e,t,n,i){var a,s,o;const r=i.tick||{},l=hi(r.values,e.api);return l?t==="x"?ea(e,l):Bs(e,l,t):t!=="x"&&((s=(a=e.axis)==null?void 0:a.isLog)!=null&&s.call(a,t))?zs(n,r.count):sn(n,(o=r.count)!=null?o:_e)}function Wu(e,t){var n;const i=(n=t.tick)==null?void 0:n.format;return typeof i=="function"?i.bind(e.api):(a=>a)}function pi(e,t){const n=e.length-1;if(t&&n>t){const i=e.length-1;return t<=1?[e[0]]:Array.from({length:t},(a,s)=>e[Math.round(s*i/(t-1))])}return e}function Yu(e,t,n,i=`axis_${t}`){const{config:a}=e;if(!Nt(a,t,"culling",i))return n;const o=Nt(a,t,"culling_max",i)||_e,r=Nt(a,t,"culling_reverse",i),l=n.slice().sort((h,f)=>{const g=+h,p=+f,_=Number.isFinite(g)&&Number.isFinite(p)?g-p:String(h).localeCompare(String(f));return r?-_:_}),c=l.length;let u=0;for(let h=1;h<c;h++)if(c/h<o){u=h;break}if(!u)return n;const d=new Set(l.filter((h,f)=>f%u===0));return n.filter(h=>d.has(h))}function sa(e,t,n=!1,i="axis_x",a){const{config:s}=e;if(Nt(s,"x","culling",i)===!1)return t;const r=a||Nt(s,"x","culling_max",i)||_e,l=Nt(s,"x","culling_reverse",i),c=n?t:t.slice().sort((f,g)=>{const p=+f,_=+g;return Number.isFinite(p)&&Number.isFinite(_)?l?_-p:p-_:l?String(g).localeCompare(String(f)):String(f).localeCompare(String(g))}),u=c.length;let d=0;for(let f=1;f<u;f++)if(u/f<r){d=f;break}if(!d)return t;if(n)return t.filter((f,g)=>l?(u-1-g)%d===0:g%d===0);const h=new Set(c.filter((f,g)=>g%d===0));return t.filter(f=>h.has(f))}function oa(e){const{config:t,state:{height:n,width:i}}=e,a=t.axis_rotated?n:i;if(t.axis_x_tick_count)return t.axis_x_tick_count;if(t.axis_x_tick_culling!==!1)return Math.min(t.axis_x_tick_culling_max||_e,Math.max(2,Math.floor(a/70)))}function Hu(e){var t,n;const{axis:i,config:a}=e,s=(n=(t=i==null?void 0:i.y)==null?void 0:t.getGeneratedTicks)==null?void 0:n.call(t,a.grid_y_ticks);return s!=null&&s.length?s:a.grid_y_ticks?pi(Bn(e,"y",void 0,!1),a.grid_y_ticks):Bn(e,"y",void 0,!1)}var ju=Object.defineProperty,Uu=(e,t,n)=>t in e?ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ku=(e,t,n)=>Uu(e,typeof t!="symbol"?t+"":t,n);class Ys{constructor(t){Ku(this,"ctx",t)}get context(){return this.ctx}withContext(t,n){const i=this.ctx;this.ctx=t;try{n()}finally{this.ctx=i}}withState(t){const{ctx:n}=this;n.save();try{t(n)}finally{n.restore()}}withTranslation(t,n,i){this.withState(a=>{a.translate(t,n),i(a)})}clipRect(t,n){this.withState(i=>{i.beginPath(),i.rect(t.x,t.y,t.w,t.h),i.clip(),n(i)})}measureText(t){return this.ctx.measureText(t)}traceLine(t,n,i,a){const{ctx:s}=this;s.moveTo(t,n),s.lineTo(i,a)}traceCrispLine(t,n,i,a,s){this.traceLine(this.crisp(t,s),this.crisp(n,s),this.crisp(i,s),this.crisp(a,s))}traceCircle(t,n,i){this.ctx.moveTo(t+i,n),this.ctx.arc(t,n,i,0,Math.PI*2)}strokePath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.stroke()})}fillPath(t,n){this.withStyle(n,i=>{i.beginPath(),t(i),i.fill()})}fillRect(t,n){this.withStyle(n,i=>{i.fillRect(t.x,t.y,t.w,t.h)})}fillRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.fillRect(a,i);return}this.fillPath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRoundRect(t,n=0,i){const a=this.normalizeRect(t),s=this.getRectRadii(a,n);if(!s.tl&&!s.tr&&!s.br&&!s.bl){this.strokeRect(a,i);return}this.strokePath(o=>{this.traceRoundRect(o,a,s)},i)}strokeRect(t,n){this.withStyle(n,i=>{i.strokeRect(t.x,t.y,t.w,t.h)})}text(t,n,i,a){const s=(r,l,c)=>{(a==null?void 0:a.maxWidth)===void 0?r.fillText(t,l,c):r.fillText(t,l,c,a.maxWidth)},o=r=>{a!=null&&a.angle?(r.translate(n,i),r.rotate(a.angle*Math.PI/180),s(r,0,0)):s(r,n,i)};a!=null&&a.angle?this.withState(r=>{this.applyStyle(a),o(r)}):this.withStyle(a,o)}textLines(t,n,i,a){this.withState(s=>{const o=t.split(`
11
+ `),r=de((a==null?void 0:a.font)||s.font),l=o.length>1?-((o.length-1)*r):0;this.applyStyle(a),s.translate(n,i),a!=null&&a.angle&&s.rotate(a.angle*Math.PI/180),o.forEach((c,u)=>{const d=l+u*r;(a==null?void 0:a.maxWidth)===void 0?s.fillText(c,0,d):s.fillText(c,0,d,a.maxWidth)})})}point(t,n,i,a,s){this.withStyle(s,o=>{const r=!(s!=null&&s.stroke)||s.fill!==void 0,l=(s==null?void 0:s.stroke)!==void 0;if(t==="rectangle"){const c=a*2,u={x:n-a,y:i-a,w:c,h:c};r&&o.fillRect(u.x,u.y,u.w,u.h),l&&o.strokeRect(u.x,u.y,u.w,u.h)}else o.beginPath(),o.arc(n,i,a,0,Math.PI*2),r&&o.fill(),l&&o.stroke()})}getRectRadii(t,n){const i=typeof n=="number"?{tl:n,tr:n,br:n,bl:n}:{tl:n.tl||0,tr:n.tr||0,br:n.br||0,bl:n.bl||0},a=Math.max(0,Math.min(Math.abs(t.w),Math.abs(t.h))/2);return{tl:Math.max(0,Math.min(i.tl,a)),tr:Math.max(0,Math.min(i.tr,a)),br:Math.max(0,Math.min(i.br,a)),bl:Math.max(0,Math.min(i.bl,a))}}traceRoundRect(t,n,i){const{x:a,y:s,w:o,h:r}=n,l=a+o,c=s+r;t.moveTo(a+i.tl,s),t.lineTo(l-i.tr,s),i.tr?t.quadraticCurveTo(l,s,l,s+i.tr):t.lineTo(l,s),t.lineTo(l,c-i.br),i.br?t.quadraticCurveTo(l,c,l-i.br,c):t.lineTo(l,c),t.lineTo(a+i.bl,c),i.bl?t.quadraticCurveTo(a,c,a,c-i.bl):t.lineTo(a,c),t.lineTo(a,s+i.tl),i.tl?t.quadraticCurveTo(a,s,a+i.tl,s):t.lineTo(a,s),t.closePath()}normalizeRect(t){const n=t.w<0?t.x+t.w:t.x,i=t.h<0?t.y+t.h:t.y;return{x:n,y:i,w:Math.abs(t.w),h:Math.abs(t.h)}}applyStyle(t){if(!t)return;const{ctx:n}=this;t.fill!==void 0&&(n.fillStyle=t.fill),t.stroke!==void 0&&(n.strokeStyle=t.stroke),t.lineWidth!==void 0&&(n.lineWidth=t.lineWidth),t.alpha!==void 0&&(n.globalAlpha=t.alpha),t.font!==void 0&&(n.font=t.font),t.textAlign!==void 0&&(n.textAlign=t.textAlign),t.textBaseline!==void 0&&(n.textBaseline=t.textBaseline),t.lineDash!==void 0&&n.setLineDash(t.lineDash)}withStyle(t,n){t?this.withState(i=>{this.applyStyle(t),n(i)}):n(this.ctx)}crisp(t,n){return n%2?Math.round(t)+.5:Math.round(t)}}var Zu=Object.defineProperty,qu=Object.defineProperties,Ju=Object.getOwnPropertyDescriptors,Hs=Object.getOwnPropertySymbols,Qu=Object.prototype.hasOwnProperty,td=Object.prototype.propertyIsEnumerable,ra=(e,t,n)=>t in e?Zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,js=(e,t)=>{for(var n in t||(t={}))Qu.call(t,n)&&ra(e,n,t[n]);if(Hs)for(var n of Hs(t))td.call(t,n)&&ra(e,n,t[n]);return e},Us=(e,t)=>qu(e,Ju(t)),la=(e,t,n)=>ra(e,typeof t!="symbol"?t+"":t,n);const Ks=20,Zs=15;function ca(e){return e?-1:1}function ed(e,t){return e?t?-1:1:t?1:-1}function nd(e,t){var n,i,a;const s=t==="y2"?"subY2":"subY",o=(a=(i=(n=e.axis)==null?void 0:n[s])==null?void 0:i.tickFormat)==null?void 0:a.call(i),r=e.config[`subchart_axis_${t}_tick_format`]||e.config[`axis_${t}_tick_format`];return o||(typeof r=="function"?r.bind(e.api):(l=>l))}function id(e){return e?{stroke:e.lineColor,lineWidth:e.lineWidth,lineDash:e.dashArray}:void 0}function ad(e){return e?{fill:e.labelColor,font:e.labelFont}:void 0}function ua(e,t,n){return{x:e.left-Ks,y:0,w:t+Ks*2,h:n}}function da(e,t,n){return{x:0,y:e.top-Zs,w:t,h:n+Zs*2}}function sd(e,t){var n,i;const a=(i=(n=e.config.axis_tooltip)==null?void 0:n.backgroundColor)!=null?i:"black";return typeof a=="string"?a:(a==null?void 0:a[t])||null}function od(e,t,n){var i,a;const s=e.scale[t];if(!(s!=null&&s.invert))return null;const o=s.invert(n);if(o==null)return null;if(t==="x"&&((a=(i=e.axis)==null?void 0:i.isTimeSeries)!=null&&a.call(i)))return e.format.xAxisTick(o);const r=Number(o);return Number.isFinite(r)?r.toFixed(2):`${o}`}function rd(e,t){const{config:n,state:{height:i,margin:a,width:s}}=e,o=n.axis_rotated,r={x:a.left,y:a.top};return t==="x"?!o&&(r.y+=i):t==="y"?o&&(r.y+=i):o?r.y-=1:r.x+=s,r}function ld(e,t,n,i){return i?{x:e.x+n,y:e.y-t}:{x:e.x+t,y:e.y+n}}function qs(e,t){const n=e?e(t):t;return n==null?"":String(n)}function zn(e,t){return e[`${t}TickFont`]||e.labelFont}function ha(e,t){const n=e.measureText("0"),i=(n.fontBoundingBoxAscent||0)+(n.fontBoundingBoxDescent||0),a=(n.actualBoundingBoxAscent||0)+(n.actualBoundingBoxDescent||0),s=(t||10)*(11.5/10);return Math.max(t,i,a,s)}function cd(e){return 11.5-2.5*(e/15)*(e>0?1:-1)}function ud(e){return 8*Math.sin(Math.PI*(e/180))}function fa(e,t){if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return Number.isFinite(n)?/em$/.test(e.trim())?n*t:n:0}return 0}function dd(e,t,n){if(!t)return[e];const i=n.measureText("0").width||5.5;function a(s,o){let r;for(let l=1;l<o.length;l++)if(o.charAt(l)===" "&&(r=l),t<i*(l+1)){const c=r||l;return a(s.concat(o.slice(0,c)),o.slice(r?r+1:l))}return s.concat(o)}return a([],e)}function ga(e,t,n,i){var a,s;const o=e.config.axis_x_tick_width;if(o&&o>0)return o;if(n)return 95;if((s=(a=e.axis)==null?void 0:a.isCategorized)!=null&&s.call(a)&&t.length>1){const r=i(Le(e,t[0])),l=i(Le(e,t[1]));return Math.max(0,Math.abs(l-r)-12)}return 110}function Js(e,t,n,i,a=[],s=!1,o=Zt(e),r){const l=n?n(i):i;if(l==null)return[""];if(Array.isArray(l))return l.map(u=>String(u));const c=String(l);return c.indexOf(`
12
12
  `)>-1?c.split(`
13
- `):e.config.axis_x_tick_multiline?wd(c,r!=null?r:qi(e,a,s,o),t):[c]}function Ji(e,t){const{isRotated:n,tickCount:i,tickIndex:a,tickRotate:s,tickTextDirection:o}=t,r=e.config.axis_x_tick_text_inner;let l=n?o>0?"left":"right":s?s>0?"left":"right":"center";return!n&&a===0&&(r===!0||r!=null&&r.first)?l="left":!n&&a===i-1&&(r===!0||r!=null&&r.last)&&(l="right"),l}function Cd(e,t){var n,i;return((n=e==null?void 0:e.indexOf("center"))!=null?n:-1)>-1?{x:t/2,align:"center"}:((i=e==null?void 0:e.indexOf("right"))!=null?i:-1)>-1?{x:t,align:"right"}:{x:0,align:"left"}}function Be(e){return Number.isFinite(e)}function Qi(e,t,n){return Be(e)&&e>=Math.min(t,n)&&e<=Math.max(t,n)}function Ls(e){return e?-1:1}function Sd(e,t,n){return t?n?e.axis_y2_inner?1:-1:e.axis_y_inner?-1:1:n?e.axis_y2_inner?-1:1:e.axis_y_inner?1:-1}function ta(e,t,n=te(e)){return n(Oe(e,t))}function Ad(e,t){var n,i;return(i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&typeof t=="string"&&Number.isNaN(Number(t))?e.config.axis_x_categories.indexOf(t):Oe(e,t)}function kd(e,t){var n,i;return!!((i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&Number.isNaN(Number(t)))}function Rs(e,t,n,i){var a,s;if(t===void 0)return n;let o=te(e)(Ad(e,t));if(kd(e,t)){const r=te(e),l=((s=(a=e.axis.x)==null?void 0:a.tickOffset)==null?void 0:s.call(a))||(r(1)-r(0))/2;o+=l*(i==="start"?-1:1)}return o}function Es(e,t,n="y"){return e.scale[n||"y"](kn(e,t,n))}function Ps(e,t,n){return e==="start"?t+4:e==="middle"?(t+n)/2:n-4}function Ds(e,t,n){return e==="start"?n-4:e==="middle"?(t+n)/2:t+4}function Ld(e,t){const{config:n,scale:i,state:{width:a,height:s}}=e,o=t.axis||"x",r=n.axis_rotated;if(o==="x"){const h=Rs(e,t.start,0,"start"),f=Rs(e,t.end,r?s:a,"end"),g=Math.min(h,f),p=Math.abs(f-h);return r?{x:0,y:g,w:a,h:p}:{x:g,y:0,w:p,h:s}}if(!i[o])return null;const l=t.start===void 0?r?0:s:Es(e,t.start,o),c=t.end===void 0?r?a:0:Es(e,t.end,o),d=Math.min(l,c),u=Math.abs(c-l);return r?{x:d,y:0,w:u,h:s}:{x:0,y:d,w:a,h:u}}class Rd{constructor(t,n){Hi(this,"engine",t),Hi(this,"theme",n),Hi(this,"painter"),this.painter=new Ts(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}draw(t){this.drawRegions(t),this.drawGrid(t),this.drawAxis(t)}drawAxis(t){const{config:n}=t;n.axis_x_show&&this.drawXAxis(t),n.axis_y_show&&this.drawYAxis(t),n.axis_y2_show&&t.scale.y2&&this.drawYAxis(t,"y2"),this.drawAdditionalAxes(t),this.drawAxisLabels(t)}drawSubXAxis(t){var n,i,a;const{ctx:s,painter:o,theme:{style:{axis:r}}}=this,{config:l,format:c,scale:d,state:{current:u,margin2:h,width2:f,height2:g}}=t;if(!l.subchart_show||!l.subchart_axis_x_show||!d.subX||f<=0||g<=0)return;const p=l.axis_rotated,x=o.crisp(h.left,r.lineWidth),_=o.crisp(h.top+g,r.lineWidth),v=h.left,m=h.left+f,b=h.top,y=h.top+g,T=p?b:v,w=p?y:m,C=qc(t),A=p?l.axis_x_tick_inner?1:-1:l.axis_x_tick_inner?-1:1,S=Ls(p),k=Yi(p),L=l.axis_x_tick_text_position,R=p?0:((n=t.getAxisTickRotate)==null?void 0:n.call(t,"x"))||0,E=c.subXAxisTick||((a=(i=t.axis)==null?void 0:i.getXAxisTickFormat)==null?void 0:a.call(i,!0));o.clipRect(p?Ui(h,u.width,g):pd(gd({},ji(h,f,u.height-h.top)),{y:h.top}),()=>{s.strokeStyle=r.lineColor,s.lineWidth=r.lineWidth,o.strokePath(()=>{p?o.traceLine(x,b,x,y):o.traceLine(v,_,m,_),l.axis_x_tick_outer&&(p?(o.traceLine(x,b,x+rt*S,b),o.traceLine(x,y,x+rt*S,y)):(o.traceLine(v,_,v,_+rt*S),o.traceLine(m,_,m,_+rt*S)))});const P=En(r,"x");s.font=P,s.fillStyle=r.labelColor,s.textAlign=p?k>0?"left":"right":"center",s.textBaseline=p?"middle":k>0?"top":"bottom",s.strokeStyle=r.tickColor,s.lineWidth=r.tickWidth;const D=Ki(o,re(P)),z=qi(t,C,p,d.subX);for(const $ of C){const G=d.subX(Oe(t,$)),N=h.left+G,q=h.top+G;if(!Qi(p?q:N,T,w)||(l.subchart_axis_x_tick_show&&o.strokePath(()=>{p?o.traceLine(x,q,x+rt*A,q):o.traceLine(N,_,N,_+rt*A)}),!l.subchart_axis_x_tick_text_show))continue;const K=ks(t,o,E,$,C,p,d.subX,z);let lt,ft;p?(lt=x+(rt+Ve)*k+(L.x||0),ft=q+(L.y||0),s.textAlign=k>0?"left":"right",s.textBaseline="middle"):(lt=N+(L.x||0),ft=_+(rt+Ve)*k+(L.y||0),s.textAlign=R?R>0?"left":"right":"center",s.textBaseline=k>0?"top":"bottom"),o.withState(bt=>{bt.translate(lt,ft),R&&bt.rotate(R*Math.PI/180),K.forEach(($t,Et)=>{bt.fillText($t,0,Et*D)})})}})}drawTitle(t){var n,i;const{ctx:a,painter:s,theme:{style:{title:o}}}=this,{config:r,state:{current:l}}=t;if(!r.title_text)return;const c=String(r.title_text).split(`
14
- `),d=re(o.font),u=d*1.5,{x:h,align:f}=Cd(r.title_position,l.width),g=(i=(n=t.getCanvasTitleHeight)==null?void 0:n.call(t))!=null?i:d,p=(r.title_padding.top||0)+g;s.withState(()=>{a.font=o.font,a.fillStyle=o.color,a.textAlign=f,a.textBaseline="alphabetic",c.forEach((x,_)=>{a.fillText(x,h,p+(_?d+(_-1)*u:0))})})}drawAxisLabels(t){const{ctx:n,painter:i,theme:{style:{axis:a}}}=this,{axis:s,config:o}=t,r=re(a.labelFont),l=["x","y","y2"],c={x:a.xLabelColor,y:a.yLabelColor,y2:a.y2LabelColor},d={start:"left",middle:"center",end:"right"};s&&i.withState(()=>{n.font=a.labelFont,n.textBaseline="alphabetic",l.forEach(u=>{const h=s.getLabelText(u);if(!h||!o[`axis_${u}_show`]||u==="y2"&&!t.scale.y2)return;const f=u==="x"&&o.axis_rotated||u!=="x"&&!o.axis_rotated,g=vd(t,u),p=s.xForAxisLabel(u)+Zi(s.dxForAxisLabel(u),r),x=Zi(s.dyForAxisLabel(u),r),{x:_,y:v}=bd(g,p,x,f),m=s.textAnchorForAxisLabel(u);n.fillStyle=c[u]||a.labelColor,n.textAlign=d[m]||"center",i.text(String(h),_,v,{angle:f?-90:0})})})}drawGrid(t){const{ctx:n,painter:i,theme:{style:{grid:a}}}=this,{config:s,scale:o,state:{height:r,margin:l,width:c}}=t;if(!a.lineColor)return;const d=s.axis_rotated,u=l.left,h=l.left+c,f=l.top,g=l.top+r;i.withState(()=>{n.strokeStyle=a.lineColor,n.lineWidth=a.lineWidth,a.dashArray.length&&n.setLineDash(a.dashArray),s.grid_x_show&&o.x&&i.strokePath(()=>{for(const p of ai(t)){const x=ta(t,p);Be(x)&&(d?i.traceCrispLine(u,l.top+x,h,l.top+x,a.lineWidth):i.traceCrispLine(l.left+x,f,l.left+x,g,a.lineWidth))}}),s.grid_y_show&&o.y&&i.strokePath(()=>{for(const p of sd(t)){const x=kn(t,p),_=o.y(x);Be(_)&&(d?i.traceCrispLine(l.left+_,f,l.left+_,g,a.lineWidth):i.traceCrispLine(u,l.top+_,h,l.top+_,a.lineWidth))}}),!s.grid_lines_front&&this.drawGridLines(t)})}drawRegions(t){const{ctx:n,painter:i,theme:{style:{region:a}}}=this,{config:s,state:{height:o,margin:r,width:l}}=t,c=s.regions||[];c.length&&i.clipRect({x:r.left,y:r.top,w:l,h:o},()=>{var d;n.fillStyle=a.fill,n.font=a.labelFont,n.textBaseline="top";for(const u of c){const h=Ld(t,u);if(!h||!Be(h.x)||!Be(h.y)||!h.w||!h.h)continue;const f=r.left+h.x,g=r.top+h.y,p=h.w,x=h.h;if(n.globalAlpha=Number.isFinite(u.opacity)?u.opacity:a.opacity,i.fillRect({x:f,y:g,w:p,h:x}),(d=u.label)!=null&&d.text){const _=u.label,v=_.center||"",m=String(_.text),b=i.measureText(m).width,y=parseFloat(n.font)||12;let T=f+(_.x||0),w=g+(_.y||0);v.indexOf("x")>-1&&(T+=(p-b)/2),v.indexOf("y")>-1&&(w+=(x-y)/2),i.text(m,T,w,{angle:_.rotated?-90:0,alpha:1,fill:_.color||a.labelColor})}}})}drawGridLines(t){const{ctx:n,painter:i,theme:{style:{axis:a,grid:s}}}=this,{config:o,scale:r,state:{height:l,margin:c,width:d}}=t,u=o.axis_rotated,h=c.left,f=c.left+d,g=c.top,p=c.top+l;s.lineColor&&i.withState(()=>{n.strokeStyle=s.lineColor,n.lineWidth=s.lineWidth,n.font=s.labelFont||a.labelFont,n.fillStyle=s.labelColor,n.textBaseline="middle",n.setLineDash([]);const x=(m,b,y,T=!1)=>{m&&i.text(m,b,y,{angle:T?-90:0})},_=m=>{if(m.value===void 0||!r.x)return;const b=ta(t,m.value);if(Be(b))if(u){const y=c.top+b;i.strokePath(()=>{i.traceLine(h,y,f,y)}),n.textAlign=m.position==="start"?"left":m.position==="middle"?"center":"right",x(m.text,Ps(m.position,h,f),y-5)}else{const y=c.left+b;i.strokePath(()=>{i.traceLine(y,g,y,p)}),n.textAlign=m.position==="start"?"left":m.position==="middle"?"center":"right",x(m.text,y-5,Ds(m.position,g,p),!0)}},v=m=>{const b=m.axis==="y2"?r.y2:r.y,y=m.axis==="y2"?"y2":"y";if(m.value===void 0||!b)return;const T=kn(t,m.value,y),w=b(T);if(Be(w))if(u){const C=c.left+w;i.strokePath(()=>{i.traceLine(C,g,C,p)}),n.textAlign=m.position==="start"?"left":m.position==="middle"?"center":"right",x(m.text,C-5,Ds(m.position,g,p),!0)}else{const C=c.top+w;i.strokePath(()=>{i.traceLine(h,C,f,C)}),n.textAlign=m.position==="start"?"left":m.position==="middle"?"center":"right",x(m.text,Ps(m.position,h,f),C-5)}};(o.grid_x_lines||[]).forEach(_),(o.grid_y_lines||[]).forEach(v)})}drawAdditionalAxes(t){["x","y","y2"].forEach(n=>{const i=t.config[`axis_${n}_axes`]||[];!i.length||!t.scale[n]||!t.config[`axis_${n}_show`]||i.forEach((a,s)=>{var o;const r=ed(t,n,a);if(!r)return;const l={scale:r,ticks:nd(t,n,r,a),format:id(t,a),index:s+1,outerTick:((o=a.tick)==null?void 0:o.outer)!==!1};n==="x"?this.drawXAxis(t,l):this.drawYAxis(t,n,l)})})}drawXAxis(t,n){var i;const{ctx:a,painter:s,theme:{style:{axis:o}}}=this,{axis:r,config:l,state:{current:c,margin:d,width:u,height:h}}=t,f=l.axis_rotated,g=n!=null&&n.index?t.getAxisSize("x")*n.index:0,p=(n==null?void 0:n.scale)||te(t),x=s.crisp(d.left-(f?g:0),o.lineWidth),_=s.crisp(d.top+h+(f?0:g),o.lineWidth),v=d.left,m=d.left+u,b=d.top,y=d.top+h,T=f?b:v,w=f?y:m,C=(n==null?void 0:n.ticks)||ai(t),A=(n==null?void 0:n.ticks)||td(t,C,o.tickWidth),S=(n==null?void 0:n.format)||r.getXAxisTickFormat(),k=n?n.outerTick:l.axis_x_tick_outer,L=f?l.axis_x_tick_inner?1:-1:l.axis_x_tick_inner?-1:1,R=Ls(f),E=Yi(f),P=l.axis_x_tick_text_position,D=f?0:((i=t.getAxisTickRotate)==null?void 0:i.call(t,"x"))||0;s.clipRect(f?Ui(d,c.width,h):ji(d,u,c.height),()=>{if(a.strokeStyle=o.lineColor,a.lineWidth=o.lineWidth,s.strokePath(()=>{f?s.traceLine(x,b,x,y):s.traceLine(v,_,m,_),k&&(f?(s.traceLine(x,b,x+rt*R,b),s.traceLine(x,y,x+rt*R,y)):(s.traceLine(v,_,v,_+rt*R),s.traceLine(m,_,m,_+rt*R)))}),a.font=En(o,"x"),a.fillStyle=o.labelColor,a.textAlign=f?E>0?"left":"right":"center",a.textBaseline=f?"middle":E>0?"top":"bottom",a.strokeStyle=o.tickColor,a.lineWidth=o.tickWidth,l.axis_x_tick_show&&s.strokePath(()=>{for(const N of A){const q=Gi(t,N,p),At=d.left+q,K=d.top+q;Qi(f?K:At,T,w)&&(f?s.traceLine(x,K,x+rt*L,K):s.traceLine(At,_,At,_+rt*L))}}),!n&&!l.axis_x_tick_text_show)return;const z=En(o,"x"),$=Ki(s,re(z)),G=qi(t,C,f,p);C.forEach((N,q)=>{this.drawXAxisTickText(t,N,S,o.labelColor,{isRotated:f,rangeEnd:w,rangeStart:T,tickCount:C.length,tickFont:z,tickIndex:q,tickLineHeight:$,tickTextDirection:E,tickTextWidth:G,tickRotate:D,tickTextPosition:P,targetScale:p,ticks:C,x,y:_})})})}drawFocusedXAxisTick(t,n){var i;const{painter:a,theme:{style:{axis:s}}}=this,{axis:o,config:r,state:{current:l,margin:c,width:d,height:u}}=t,h=(i=n==null?void 0:n[0])==null?void 0:i.x;if(h===void 0||!o||!r.axis_x_show||!r.axis_x_tick_text_show||!s.activeLabelColor||s.activeLabelColor===s.labelColor)return;const f=ai(t),g=f.findIndex(w=>Ln(w,h)),p=f[g];if(p===void 0)return;const x=r.axis_rotated,_=a.crisp(c.left,s.lineWidth),v=a.crisp(c.top+u,s.lineWidth),m=x?c.top:c.left,b=x?c.top+u:c.left+d,y=o.getXAxisTickFormat(),T=Yi(x);a.clipRect(x?Ui(c,l.width,u):ji(c,d,l.height),()=>{var w;this.drawXAxisTickText(t,p,y,s.activeLabelColor,{isRotated:x,rangeEnd:b,rangeStart:m,targetScale:te(t),tickCount:f.length,tickIndex:g,tickTextDirection:T,tickRotate:x?0:((w=t.getAxisTickRotate)==null?void 0:w.call(t,"x"))||0,tickTextPosition:r.axis_x_tick_text_position,ticks:f,x:_,y:v})})}drawAxisTooltip(t,n){const{ctx:i,painter:a,theme:{style:{axis:s,grid:o}}}=this,{config:r,state:{margin:l,width:c,height:d}}=t;if(!r.axis_tooltip||!n)return;const u=r.axis_rotated,h=n[0]-l.left,f=n[1]-l.top,g=h>=0&&h<=c,p=f>=0&&f<=d;if(!g&&!p)return;const x=l.left+h,_=l.top+f,v=re(s.labelFont),m=v||10,b=(y,T,w,C,A)=>{const S=_d(t,y),k=S&&md(t,y,T);if(!k)return;i.font=s.labelFont,i.textAlign=A,i.textBaseline="alphabetic";const L=i.measureText(k),R=L.width,E=L.actualBoundingBoxAscent||m*.8,P=L.actualBoundingBoxDescent||m*.2,D=Math.max(2,R*.15),z=Math.max(3,m*.25),$=A==="right"?w-R:A==="center"?w-R/2:w,G=C-E;i.fillStyle=S,i.fillRect($-D,G-z,R+D*2,E+P+z*2),i.fillStyle="#fff",i.fillText(k,w,C)};a.withState(()=>{i.strokeStyle=o.lineColor,i.lineWidth=o.lineWidth,i.setLineDash([]),a.strokePath(()=>{g&&a.traceLine(x,l.top,x,l.top+d),p&&a.traceLine(l.left,_,l.left+c,_)}),i.setLineDash([]),u?(p&&r.axis_x_show&&b("x",f,l.left-v*.3,_+v*.4,"right"),g&&r.axis_y_show&&b("y",h,x-v*1.3,l.top+d+v*1.15,"left"),g&&r.axis_y2_show&&t.scale.y2&&b("y2",h,x-v*1.3,l.top-v*.4,"left")):(g&&r.axis_x_show&&b("x",h,x-v,l.top+d+v*1.15,"left"),p&&r.axis_y_show&&b("y",f,l.left-v*.4,_+v*.3,"right"),p&&r.axis_y2_show&&t.scale.y2&&b("y2",f,l.left+c+v*.4,_+v*.3,"left"))})}drawXAxisTickText(t,n,i,a,s){var o,r;const{ctx:l,painter:c,theme:{style:{axis:d}}}=this,{state:{margin:u}}=t,{isRotated:h,rangeEnd:f,rangeStart:g,tickTextDirection:p,tickRotate:x,tickTextPosition:_,targetScale:v,ticks:m,x:b,y}=s,T=ta(t,n,v),w=u.left+T,C=u.top+T;if(!Qi(h?C:w,g,f))return;const S=(o=s.tickFont)!=null?o:En(d,"x");l.font=S,l.fillStyle=a;const k=ks(t,c,i,n,m,h,v,s.tickTextWidth),L=(r=s.tickLineHeight)!=null?r:Ki(c,re(S));let R,E;if(h)R=b+(rt+Ve)*p+(_.x||0),E=C+(_.y||0),l.textAlign=Ji(t,s),l.textBaseline="middle";else if(x){const P=re(S),D=_.y?Zi(_.y,P):.71*P,z=Td(x)+(_.x||0),$=yd(x)+D;l.textAlign=Ji(t,s),l.textBaseline="alphabetic",c.withState(G=>{G.translate(w,y),G.rotate(x*Math.PI/180),k.forEach((N,q)=>{G.fillText(N,z,$+q*L)})});return}else R=w+(_.x||0),E=y+(rt+Ve)*p+(_.y||0),l.textAlign=Ji(t,s),l.textBaseline=p>0?"top":"bottom";c.withState(P=>{P.translate(R,E),x&&P.rotate(x*Math.PI/180),k.forEach((D,z)=>{P.fillText(D,0,z*L)})})}drawYAxis(t,n="y",i){var a,s,o,r;const{ctx:l,painter:c,theme:{style:{axis:d}}}=this,{config:u,scale:h,state:{margin:f,width:g,height:p}}=t,x=`axis_${n}`,_=(i==null?void 0:i.scale)||h[n],v=n==="y2",m=u.axis_rotated,b=i!=null&&i.index?t.getAxisSize(n)*i.index:0,y=c.crisp(f.left+(v?g+(m?0:b):-b),d.lineWidth),T=c.crisp(f.top+(m?v?-b-1:p+b:0),d.lineWidth),w=f.left,C=f.left+g,A=f.top,S=f.top+p,k=(i==null?void 0:i.ticks)||si(t,n),L=(i==null?void 0:i.ticks)||(u[`${x}_tick_culling`]&&u[`${x}_tick_culling_lines`]!==!1?si(t,n,void 0,!1):k),R=(i==null?void 0:i.format)||((o=(s=(a=t.axis)==null?void 0:a[n])==null?void 0:s.tickFormat)==null?void 0:o.call(s))||((r=u[`${x}_tick_format`])==null?void 0:r.bind(t.api))||(G=>G),E=i?i.outerTick:u[`${x}_tick_outer`],P=m?v?u.axis_y2_tick_inner?1:-1:u.axis_y_tick_inner?-1:1:v?u.axis_y2_tick_inner?-1:1:u.axis_y_tick_inner?1:-1,D=Sd(u,m,v),z=xd(m,v),$=u[`${x}_tick_text_position`];c.withState(()=>{l.strokeStyle=d.lineColor,l.lineWidth=d.lineWidth,c.strokePath(()=>{m?c.traceLine(w,T,C,T):c.traceLine(y,A,y,S),E&&(m?(c.traceLine(w,T,w,T+rt*D),c.traceLine(C,T,C,T+rt*D)):(c.traceLine(y,A,y+rt*D,A),c.traceLine(y,S,y+rt*D,S)))});const G=En(d,n);l.font=G,l.fillStyle=d.labelColor,l.textAlign=m?"center":z>0?"left":"right",l.textBaseline=m?z>0?"top":"bottom":"middle",l.strokeStyle=d.tickColor,l.lineWidth=d.tickWidth;const N=[],q=[],At=(K,lt)=>{const ft=kn(t,K,n),bt=f.left+_(ft),$t=f.top+_(ft);Be(m?bt:$t)&&lt.push({tick:K,tx:bt,ty:$t})};for(const K of k)At(K,N);for(const K of L)At(K,q);if((i||u[`${x}_tick_show`])&&c.strokePath(()=>{for(const{tx:K,ty:lt}of q)m?c.traceLine(K,T,K,T+rt*P):c.traceLine(y,lt,y+rt*P,lt)}),i||u[`${x}_tick_text_show`])for(const{tick:K,tx:lt,ty:ft}of N)m?c.text(As(R,K),lt+($.x||0),T+rt*z+($.y||0)):c.text(As(R,K),y+(rt+Ve)*z+($.x||0),ft+($.y||0))})}}const ee={canvas:"bb-canvas",overlay:"bb-canvas-overlay",legend:"bb-canvas-legend",legendBottom:"bb-canvas-legend-bottom",legendInset:"bb-canvas-legend-inset",legendItemInteractive:"bb-legend-item-interactive",legendItemTileCircle:"bb-legend-item-tile-circle",legendItemTitle:"bb-legend-item-title",legendRight:"bb-canvas-legend-right"};var I_=ee,Ed=Object.defineProperty,Pd=(e,t,n)=>t in e?Ed(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cn=(e,t,n)=>Pd(e,typeof t!="symbol"?t+"":t,n);class Dd{constructor(){cn(this,"canvas"),cn(this,"ctx"),cn(this,"dpr",1),cn(this,"frame",null),cn(this,"frameCtx",null),cn(this,"frameValid",!1)}init(t,n,i){this.canvas=tt.createElement("canvas"),this.canvas.className=ee.canvas,this.canvas.style.display="block",t.appendChild(this.canvas),this.dpr=B.devicePixelRatio||1,this.ctx=this.canvas.getContext("2d"),this.resize(n,i)}resize(t,n){const i=Math.max(0,t),a=Math.max(0,n);this.dpr=B.devicePixelRatio||1,this.canvas.width=i*this.dpr,this.canvas.height=a*this.dpr,this.canvas.style.width=`${i}px`,this.canvas.style.height=`${a}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.frame=null,this.frameCtx=null,this.frameValid=!1}clearOverlay(){this.frameValid&&this.restoreFrame()}withOverlay(t){const{ctx:n}=this;this.frameValid?this.clearOverlay():this.captureFrame(),n.save(),n.setTransform(this.dpr,0,0,this.dpr,0,0);try{t(n)}finally{n.restore()}}beginFrame(t,n){const{ctx:i}=this;this.frameValid=!1,i.save(),i.setTransform(this.dpr,0,0,this.dpr,0,0),i.clearRect(0,0,t,n)}endFrame(){this.ctx.restore()}captureFrame(){const{canvas:t}=this;if(this.frameValid=!1,t.width&&t.height){let{frame:n,frameCtx:i}=this;if(!n){const a=tt.createElement("canvas");n=a,i=a.getContext("2d"),this.frame=n,this.frameCtx=i}if(!n||!i)return;i.setTransform(1,0,0,1,0,0),n.width!==t.width||n.height!==t.height?(n.width=t.width,n.height=t.height):i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),this.frameValid=!0}}restoreFrame(){if(!this.frameValid||!this.frame||!this.frameCtx)return;const{canvas:t,ctx:n}=this;n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.drawImage(this.frame,0,0),n.restore(),n.setTransform(this.dpr,0,0,this.dpr,0,0)}destroy(){var t;(t=this.canvas)==null||t.remove(),this.frame=null,this.frameCtx=null,this.frameValid=!1}}function ea(e){const{bar_radius:t,bar_radius_ratio:n}=e.config;return X(t)&&t>0?()=>t:X(n)?i=>i*n:null}function na(e){const{config:t,data:n}=e,i=new Set;if(!t.data_groups.length)return i;const a=e.orderTargets(e.filterTargetsToShow(n.targets.filter(e.isBarType,e)));for(const s of t.data_groups){const o=new Set(s),r=new Map,l=new Map;for(const c of a)if(o.has(c.id))for(const d of c.values)d.value===null||d.value===0||(d.value>0?r:l).set(d.index,c.id);for(const[c,d]of r)i.add(`${d}:${c}`);for(const[c,d]of l)i.add(`${d}:${c}`)}return i}function Id(e,t,n){return n?e?t?{tl:n,bl:n}:{tr:n,br:n}:t?{br:n,bl:n}:{tl:n,tr:n}:0}function Md(e,t,n,i){let a="";return n?i&&e[0]<t?a=`0 ${t-e[0]}px 0 0`:!i&&e[0]>t&&(a=`0 0 0 ${e[0]-t}px`):i&&e[1]>t?a=`${e[1]-t}px 0 0 0`:!i&&e[1]<t&&(a=`0 0 ${t-e[1]}px 0`),a?`inset(${a})`:null}function ia(e,t,n,i,a,s){const{config:o,state:r}=e,l=o.axis_rotated,c=+l,d=+!c,u=t.value<0,h=o[`axis_${e.axis.getId(t.id)}_inverted`],f=!h&&u||h&&!u,g=e.isGrouped(t.id),p=i&&g&&t.value!==0?r.hiddenTargetIds.has(t.id)&&s?s(t):a.has(`${t.id}:${t.index}`):!1,x=[n[0][c],n[0][d]];let _=0;if(i){const m=l?d:c,b=Math.abs(n[2][m]-n[0][m]);_=Math.max(0,!g||p?i(b):0)}const v=l?n[1][c]+(f?_:-_):n[1][d]+(f?-_:_);return{radius:_,corners:Id(l,f,_),clipPath:_?Md(x,v,l,f):null,indexX:c,indexY:d,isNegative:f,pos:v}}const Is="2 2";function Ms(e,t,n){const i=e.axis.isTimeSeries(),a=(s,o)=>yt(s)?o:i?Xt.call(e,s):s;return(n||[]).map(s=>{var o,r;return{start:a(s.start,(o=t[0])==null?void 0:o.x),end:a(s.end,(r=t[t.length-1])==null?void 0:r.x),style:s.style||{dasharray:Is}}})}function $s(e,t){for(let n=0,i;i=t[n];n++)if(i.start<e&&e<=i.end)return i.style;return!1}function $d(e){const t=String((e==null?void 0:e.dasharray)||Is).split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:[2,2]}function Fd(e,t,n,i,a){const s=e.config.axis_rotated,o=Ms(e,t,a),r=[];for(let l=1;l<t.length;l++){const c=t[l-1],d=t[l];if(!J(c.value)||!J(d.value)){r.push({isBreak:!0});continue}const u=$s(d.x,o),h=n(c.x),f=i(c.value),g=n(d.x),p=i(d.value);r.push({start:s?[f,h]:[h,f],end:s?[p,g]:[g,p],dash:u?$d(u):[]})}return r}function oi(e,t){return e.config.axis_rotated?[t[1],t[0]]:[t[0],t[1]]}function Fs(e,t,n=1){const i=t.map(h=>oi(e,h)),a=i.map(([h])=>h),s=i.map(([,h])=>h),o=Math.min(...a),r=Math.min(...s),l=Math.max(...a)-o,c=Math.max(...s)-r,d=Math.max(n,l),u=Math.max(n,c);return{x:o-(d-l)/2,y:r-(u-c)/2,w:d,h:u}}function Pn(e,t){var n,i;const a=(n=e.isGrouped)!=null&&n.call(e,t.id)&&e.circleY?e.circleY(t,t.index):e.getYScaleById(t.id)(e.getBaseValue(t)),s=(i=e.xx(t))!=null?i:NaN;return e.config.axis_rotated?{x:a,y:s}:{x:s,y:a}}function Od(e,t,n){return{x:e.cx(t,n),y:e.cy(t,n)}}function Bd(e,t){return{body:Fs(e,[t[0],t[1]]),wickStart:oi(e,[t[2][0],t[2][1]]),wickEnd:oi(e,[t[2][0],t[2][2]])}}function dn(e,t,n,i=!1){if(t===n)return{x:0,y:0,w:e.state.width,h:0};const{scale:{x:a,y:s}}=e,o=a(t.x0),r=s(t.y0),l=a(t.x1)-o,c=s(t.y1)-r;return{x:o,y:r,w:i?Math.max(0,l):l,h:i?Math.max(0,c):c}}function zd(e,t,n,i){const{config:a}=e,{id:s,value:o,ratio:r=0}=t,l=a.treemap_label_format,c=typeof l=="function"?l.bind(e.api)(o,r,s,{width:n,height:i}):`${s}
15
- ${(r*100).toFixed(2)}%`;return c==null?null:String(c)}var gt=pt(4),Nd=Object.defineProperty,Xd=Object.defineProperties,Gd=Object.getOwnPropertyDescriptors,Os=Object.getOwnPropertySymbols,Wd=Object.prototype.hasOwnProperty,Vd=Object.prototype.propertyIsEnumerable,Bs=(e,t,n)=>t in e?Nd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hd=(e,t)=>{for(var n in t||(t={}))Wd.call(t,n)&&Bs(e,n,t[n]);if(Os)for(var n of Os(t))Vd.call(t,n)&&Bs(e,n,t[n]);return e},Yd=(e,t)=>Xd(e,Gd(t));function jd(e,t,n){return e.isStepType(t)?e.convertValuesToStep(n):n}function zs(e,t,n,i){const{config:a,scale:s}=e,o=a.line_connectNull,r=a.axis_rotated,l=e.generateGetLinePoints(t,n),c=e.getYScaleById.bind(e),d=g=>(n?e.subxx:e.xx).call(e,g),u=(g,p)=>e.isGrouped(g.id)?l(g,p)[0][1]:c(g.id,n)(e.getBaseValue(g));let h=(0,gt.line)();h=r?h.x(u).y(d):h.x(d).y(u),i&&(h=h.context(i)),o||(h=h.defined(g=>e.getBaseValue(g)!==null));const f=n?s.subX:s.x;return g=>{const p=c(g.id,n);let x=o?e.filterRemoveNull(g.values):g.values,_=0,v=0,m;if(e.isLineType(g)){const b=a.data_regions[g.id];b&&!i&&e.lineWithRegions?(e.isAreaRangeType(g)&&(x=x.map(y=>Yd(Hd({},y),{value:e.getRangedData(y,"mid")}))),e.isStepType(g)&&(x=e.convertValuesToStep(x)),m=e.lineWithRegions(x,s.zoom||f,p,b)):m=h.curve(e.getCurve(g))(jd(e,g,x))}else x[0]&&(_=f(x[0].x),v=p(x[0].value)),m=r?`M ${v} ${_}`:`M ${_} ${v}`;return m||(i?void 0:"M 0 0")}}function Ns(e,t,n,i){const{config:a}=e,s=a.line_connectNull,o=a.axis_rotated,r=e.generateGetAreaPoints(t,n),l=e.getYScaleById.bind(e),c=h=>(n?e.subxx:e.xx).call(e,h),d=(h,f)=>e.isGrouped(h.id)?r(h,f)[0][1]:l(h.id,n)(e.isAreaRangeType(h)?e.getRangedData(h,"high"):e.getShapeYMin(h.id)),u=(h,f)=>e.isGrouped(h.id)?r(h,f)[1][1]:l(h.id,n)(e.isAreaRangeType(h)?e.getRangedData(h,"low"):h.value);return h=>{let f=s?e.filterRemoveNull(h.values):h.values,g=0,p=0,x;if(e.isAreaType(h)){let _=(0,gt.area)();_=o?_.y(c).x0(d).x1(u):_.x(c).y0(a.area_above?0:a.area_below?e.state.height:d).y1(u),i&&(_=_.context(i)),s||(_=_.defined(v=>e.getBaseValue(v)!==null)),e.isStepType(h)&&(f=e.convertValuesToStep(f)),x=_.curve(e.getCurve(h))(f)}else f[0]&&(g=e.scale.x(f[0].x),p=e.getYScaleById(h.id)(f[0].value)),x=o?`M ${p} ${g}`:`M ${g} ${p}`;return x||(i?void 0:"M 0 0")}}let ye;function ri(e,t){if(!X(t)||t>=1)return e;const n=e.match(/^#([\da-f]{3}|[\da-f]{6})$/i);if(n){const s=(n[1].length===3?n[1].split("").map(r=>r+r).join(""):n[1]).match(/.{2}/g);return s?`rgba(${s.map(r=>parseInt(r,16)).join(",")},${t})`:e}if(/^rgb\(/i.test(e))return e.replace(/^rgb\((.*)\)$/i,`rgba($1,${t})`);if(/^rgba\(/i.test(e))return e.replace(/^rgba\((.*),\s*([\d.]+)\)$/i,(a,s,o)=>`rgba(${s},${Number(o)*t})`);const i=Ud(e);return i&&i!==e?ri(i,t):e}function Ud(e){if(!B.document||(ye===void 0&&(ye=B.document.createElement("canvas").getContext("2d")),!ye))return null;ye.fillStyle="#000",ye.fillStyle=e;const t=ye.fillStyle;ye.fillStyle="#fff",ye.fillStyle=e;const n=ye.fillStyle;return t===n?t:null}function Dn(e,t,n,i){const a=t(n,i),s=Fs(e,a);return vt(s.x,s.y)&&vt(s.x+s.w,s.y+s.h)?{points:a,rect:s}:null}function In(e,t,n,i){const a=t(n,i),{body:s,wickStart:o,wickEnd:r}=Bd(e,a);return vt(s.x,s.y)&&vt(s.x+s.w,s.y+s.h)&&vt(o[0],o[1])&&vt(r[0],r[1])?{body:s,points:a,wickStart:o,wickEnd:r}:null}const Kd=1.2;function aa(e,t){var n,i,a;let{value:s}=t;if((n=e.isBubbleZType)!=null&&n.call(e,t))s=e.getBubbleZData(s,"z");else if((i=e.isCandlestickType)!=null&&i.call(e,t)){const o=(a=e.getCandlestickData)==null?void 0:a.call(e,t);o&&(s=o.close)}return s}function Xs(e,t){const n=e.dataLabelFormat(t.id)(aa(e,t),t.id,t.index,[]);return n==null?null:String(n)}function Gs(e){return`${e.id}:${e.index}`}function sa(e,t,n){var i;if(!(t!=null&&t.length))return()=>!1;if(e.config.tooltip_grouped&&t.length>1){const s=(i=t[0])==null?void 0:i.index;return o=>s!==void 0&&o.index===s&&n(e,o)}const a=new Set(t.filter(s=>s&&n(e,s)).map(Gs));return s=>a.has(Gs(s))}function li(e,t,n,i){const a=e.config.data_labels_position;let s;if(O(a))s=a.bind(e.api)(n,aa(e,t),t.id,t.index,i);else if(a){const o=t.id in a?a[t.id]:a;s=o==null?void 0:o[n]}return X(s)?s:0}function Zd(e,t){var n,i;const a=(n=e.config.data_labels)==null?void 0:n.image;if(O(a))return(i=a.call(e.api,aa(e,t),t.id,t.index))!=null?i:null;if(a){const{url:s="",width:o=0,height:r=0,pos:l}=a;return{url:s,width:o,height:r,pos:l}}return null}function qd(e,t){return Ue(e.url,{ID:t.id})}function Jd(e,t,n,i,a,s){var o,r,l;const{width:c=0,height:d=0,pos:u}=t,h=c/2,f=d/2,g=oa(e.canvasEngine.ctx,n,i,a).h,p=re(e.canvasEngine.ctx.font),x=i-h,_=a-f-((o=e.isTreemapType)!=null&&o.call(e,s)?p*.7:g/2);let v=i,m=a;return e.config.axis_rotated?v+=h:m+=f,{x:x+((r=u==null?void 0:u.x)!=null?r:0),y:_+((l=u==null?void 0:u.y)!=null?l:0),textX:v,textY:m}}function Ws(e,t,n){var i,a,s;const o=(i=e.updateTextColor)==null?void 0:i.call(e,t);return typeof o=="string"?o:(a=e.isTreemapType)!=null&&a.call(e,t)?n:((s=e.color)==null?void 0:s.call(e,t))||n}function Qd(e,t){var n;const i=e.config.data_labels_backgroundColors;if(!i)return null;if(nt(i))return i;if(O(i)){const s=(n=e.color)==null?void 0:n.call(e,t),o=i.bind(e.api)(s,t);return o==null?null:String(o)}const a=i[t.id];return a==null?null:String(a)}function tu(e){var t,n,i;if(!e)return null;const a=Q(e)?e:{};return{padding:rs((t=a.padding)!=null?t:"3 5"),radius:X(a.radius)?a.radius:10,stroke:(n=a.stroke)!=null?n:"#000",strokeWidth:X(a.strokeWidth)?a.strokeWidth:1,fill:(i=a.fill)!=null?i:"none"}}function oa(e,t,n,i,a={top:0,right:0,bottom:0,left:0}){var s,o;const r=t.split(`
16
- `),l=r.map(_=>e.measureText(_)),c=Math.max(...l.map(_=>_.width),0),d=re(e.font),u=d*Kd,h=l[0]?(l[0].fontBoundingBoxAscent||0)+(l[0].fontBoundingBoxDescent||0):0,f=l[0]&&(l[0].fontBoundingBoxDescent||l[0].actualBoundingBoxDescent)||0,g=r.length>1?u*r.length:Math.max(d,h,((s=l[0])==null?void 0:s.actualBoundingBoxAscent)+((o=l[0])==null?void 0:o.actualBoundingBoxDescent)||0);let p=n,x=i;return e.textAlign==="center"?p-=c/2:(e.textAlign==="right"||e.textAlign==="end")&&(p-=c),e.textBaseline==="middle"?x-=g/2:e.textBaseline==="alphabetic"?x-=g-f:(e.textBaseline==="bottom"||e.textBaseline==="ideographic")&&(x-=g),{x:p-a.left,y:x-a.top,w:c+a.left+a.right,h:g+a.top+a.bottom}}function Vs(e,t,n,i,a,s){var o,r;const l=t.context,c=Qd(e,n),d=tu((o=e.config.data_labels)==null?void 0:o.border),u=(r=d==null?void 0:d.padding)!=null?r:{top:0,right:0,bottom:0,left:0},h=oa(l,i,a,s,u),f=e.config.data_labels.rotate;t.withState(g=>{var p;f&&(g.translate(a,s),g.rotate(f*Math.PI/180),h.x-=a,h.y-=s),c&&t.fillRoundRect(h,(p=d==null?void 0:d.radius)!=null?p:0,{fill:c}),d&&(d.fill!=="none"&&t.fillRoundRect(h,d.radius,{fill:d.fill}),t.strokeRoundRect(h,d.radius,{stroke:d.stroke,lineWidth:d.strokeWidth}))})}function eu(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function nu(e){return e==="start"?"left":e==="end"?"right":"center"}function iu(e,t,n,i){var a,s,o;const r=eu(e.config.data_labels.rotate),l=e.config.axis_rotated,c=e.config[`axis_${(a=e.axis)==null?void 0:a.getId(t.id)}_inverted`],d=Gt(e,t),{value:u}=t,h=X(u)&&u<0||d&&!((o=(s=e.getCandlestickData)==null?void 0:s.call(e,t))!=null&&o._isUp),f=4,g=f*2;return l?r==="start"?(n+=h?0:g,i+=f):r==="middle"?(n+=g,i-=g):r==="end"&&(h&&(n-=g),i+=f):(r==="start"?(n+=f,h&&(i+=g*2)):r==="middle"?i-=g:r==="end"&&(n-=f,h&&(i+=g*2)),c&&(i+=h?-17:d?13:7)),{x:n,y:i,textAlign:nu(r)}}function Hs(e,t,n,i,a){var s;if(e.config.axis_rotated)i+=6,t.textAlign="left",t.textBaseline="middle";else if(Fe(e,n))t.textAlign="center",t.textBaseline="middle";else{const{config:o,state:r}=e,l=o[`axis_${(s=e.axis)==null?void 0:s.getId(n.id)}_inverted`],c=n.value<0||n.value===0&&!r.hasPositiveValue&&r.hasNegativeValue;let d=3;X(o.point_r)&&o.point_r>5&&(ln(e,n)||$e(e,n))&&(d+=o.point_r/2.3),t.textAlign="center",(l?!c:c)?(a+=d,t.textBaseline="top"):(a-=d*2,t.textBaseline="bottom")}return{x:i,y:a}}var au=Object.defineProperty,Ys=Object.getOwnPropertySymbols,su=Object.prototype.hasOwnProperty,ou=Object.prototype.propertyIsEnumerable,js=(e,t,n)=>t in e?au(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Te=(e,t)=>{for(var n in t||(t={}))su.call(t,n)&&js(e,n,t[n]);if(Ys)for(var n of Ys(t))ou.call(t,n)&&js(e,n,t[n]);return e};const Us={x:0,y:0,w:8,h:8},ra=new Map,Ks=[1,0,0,1,0,0];function ru(e){return e==="circle"||e==="rectangle"}function It(e,t,n=0){const i=e.getAttribute(t),a=i===null?NaN:parseFloat(i);return Number.isFinite(a)?a:n}function lu(e){const t=(e.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi)||[]).map(Number).filter(Number.isFinite),n=[];for(let i=0;i<t.length-1;i+=2)n.push([t[i],t[i+1]]);return n}function cu(e){const t=(e==null?void 0:e.trim().split(/[\s,]+/).map(Number).filter(Number.isFinite))||[];return t.length===4?{x:t[0],y:t[1],w:t[2],h:t[3]}:null}function Zs(e){const t=e.map(([s])=>s),n=e.map(([,s])=>s),i=Math.min(...t),a=Math.min(...n);return{x:i,y:a,w:Math.max(...t)-i,h:Math.max(...n)-a}}function du(e){const t=e.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)&&Number.isFinite(o.w)&&Number.isFinite(o.h));if(!t.length)return Te({},Us);const n=Math.min(...t.map(o=>o.x)),i=Math.min(...t.map(o=>o.y)),a=Math.max(...t.map(o=>o.x+o.w)),s=Math.max(...t.map(o=>o.y+o.h));return{x:n,y:i,w:a-n,h:s-i}}function Mn(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function uu(e){let t=[...Ks];return((e==null?void 0:e.match(/[a-z]+\([^)]*\)/gi))||[]).forEach(n=>{var i;const[,a,s]=n.match(/^([a-z]+)\(([^)]*)\)$/i)||[],o=a==null?void 0:a.toLowerCase(),r=((s==null?void 0:s.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi))||[]).map(Number).filter(Number.isFinite);let l=null;if(o==="matrix"&&r.length>=6)l=r.slice(0,6);else if(o==="translate"&&r.length)l=[1,0,0,1,r[0],r[1]||0];else if(o==="scale"&&r.length)l=[r[0],0,0,(i=r[1])!=null?i:r[0],0,0];else if(o==="rotate"&&r.length){const c=r[0]*Math.PI/180,d=Math.cos(c),u=Math.sin(c),h=[d,u,-u,d,0,0];l=r.length>=3?Mn(Mn([1,0,0,1,r[1],r[2]],h),[1,0,0,1,-r[1],-r[2]]):h}else o==="skewx"&&r.length?l=[1,0,Math.tan(r[0]*Math.PI/180),1,0,0]:o==="skewy"&&r.length&&(l=[1,Math.tan(r[0]*Math.PI/180),0,1,0,0]);l&&(t=Mn(t,l))}),t}function ze(e,t){const n=e.getAttribute("style"),i=e.getAttribute(t),a=n==null?void 0:n.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"));return((a==null?void 0:a[1])||i||"").trim()||null}function hu(e,t){const n=Te({},t),i=ze(e,"fill"),a=ze(e,"stroke"),s=ze(e,"stroke-width"),o=ze(e,"opacity"),r=ze(e,"fill-opacity"),l=ze(e,"stroke-opacity");if(i&&(n.fill=i==="none"?null:i),a&&(n.stroke=a==="none"?null:a),s){const c=parseFloat(s);Number.isFinite(c)&&(n.lineWidth=c)}return[o,r,l].forEach(c=>{var d;const u=c===null?NaN:parseFloat(c);Number.isFinite(u)&&(n.alpha=((d=n.alpha)!=null?d:1)*u)}),n}function fu(e){const t=new Map;return Array.from(e.querySelectorAll("[id]")).forEach(n=>{const i=n.getAttribute("id");i&&t.set(i,n)}),t}function fe(e,t){const n=e==null?void 0:e.trim();return n?/%$/.test(n)?n:parseFloat(n):t}function ge(e,t,n,i){if(typeof e=="number")return Number.isFinite(e)?e:i;if(typeof e=="string"&&/%$/.test(e)){const s=parseFloat(e);return Number.isFinite(s)?t+n*s/100:i}const a=parseFloat(e!=null?e:"");return Number.isFinite(a)?a:i}function gu(e){const t=(e==null?void 0:e.trim())||"0",n=parseFloat(t),i=/%$/.test(t)?n/100:n;return Math.max(0,Math.min(1,Number.isFinite(i)?i:0))}function pu(e){return Array.from(e.children||[]).filter(t=>t.tagName.toLowerCase()==="stop").map(t=>{const n=ze(t,"stop-color")||"#000",i=ze(t,"stop-opacity"),a=i===null?NaN:parseFloat(i);return{offset:gu(t.getAttribute("offset")),color:n,opacity:Number.isFinite(a)?a:void 0}})}function xu(e){const t=new Map;return e.forEach((n,i)=>{const a=n.tagName.toLowerCase(),s=pu(n);s.length&&(a==="lineargradient"?t.set(i,{type:"linearGradient",x1:fe(n.getAttribute("x1"),"0%"),y1:fe(n.getAttribute("y1"),"0%"),x2:fe(n.getAttribute("x2"),"100%"),y2:fe(n.getAttribute("y2"),"0%"),stops:s}):a==="radialgradient"&&t.set(i,{type:"radialGradient",cx:fe(n.getAttribute("cx"),"50%"),cy:fe(n.getAttribute("cy"),"50%"),r:fe(n.getAttribute("r"),"50%"),fx:fe(n.getAttribute("fx"),"50%"),fy:fe(n.getAttribute("fy"),"50%"),fr:fe(n.getAttribute("fr"),0),stops:s}))}),t}function la(e,t,n,i=Ks,a={},s=new Set){const o=e.tagName.toLowerCase(),r=Array.from(e.children||[]),l=hu(e,a),c=Mn(i,uu(e.getAttribute("transform"))),d={matrix:c,style:l};if(o==="defs")return[];if(o==="svg"||o==="g"||o==="symbol")return r.reduce((u,h)=>u.concat(la(h,t,n,c,l,s)),[]);if(o==="use"){const u=e.getAttribute("href")||e.getAttribute("xlink:href")||"",h=u.charAt(0)==="#"?u.slice(1):"",f=h&&n.get(h);if(!f||s.has(h))return[];const g=It(e,"x",0),p=It(e,"y",0),x=Mn(c,[1,0,0,1,g,p]);s.add(h);const _=la(f,t,n,x,l,s);return s.delete(h),_}if(o==="polygon"||o==="polyline"){const u=lu(e.getAttribute("points")||"");return u.length?[Te({type:o,points:u,box:Zs(u)},d)]:[]}if(o==="circle"){const u=It(e,"cx",0),h=It(e,"cy",0),f=It(e,"r",0);return f>0?[Te({type:"circle",cx:u,cy:h,r:f,box:{x:u-f,y:h-f,w:f*2,h:f*2}},d)]:[]}if(o==="ellipse"){const u=It(e,"cx",0),h=It(e,"cy",0),f=It(e,"rx",0),g=It(e,"ry",0);return f>0&&g>0?[Te({type:"ellipse",cx:u,cy:h,rx:f,ry:g,box:{x:u-f,y:h-g,w:f*2,h:g*2}},d)]:[]}if(o==="rect"){const u=It(e,"x",0),h=It(e,"y",0),f=It(e,"width",0),g=It(e,"height",0);return f>0&&g>0?[Te({type:"rect",x:u,y:h,w:f,h:g,box:{x:u,y:h,w:f,h:g}},d)]:[]}if(o==="line"){const u=It(e,"x1",0),h=It(e,"y1",0),f=It(e,"x2",0),g=It(e,"y2",0);return[Te({type:"line",x1:u,y1:h,x2:f,y2:g,box:Zs([[u,h],[f,g]])},d)]}if(o==="path"){const u=e.getAttribute("d")||"";return u?[Te({type:"path",d:u,box:t},d)]:[]}return[]}function _u(e){if(!/^</.test(e))return null;if(ra.has(e))return ra.get(e)||null;let t=null;try{const i=new B.DOMParser().parseFromString(me(e),"image/svg+xml").documentElement,a=cu(i.getAttribute("viewBox"))||Us,s=fu(i),o=la(i,a,s);o.length&&(t={shapes:o,box:i.tagName.toLowerCase()==="svg"?a:du(o.map(r=>r.box)),paints:xu(s)})}catch(n){t=null}return ra.set(e,t),t}function mu(e,t){if(t.type==="polygon"||t.type==="polyline"){const[n,...i]=t.points;e.moveTo(n[0],n[1]),i.forEach(([a,s])=>e.lineTo(a,s)),t.type==="polygon"&&e.closePath()}else t.type==="circle"?(e.moveTo(t.cx+t.r,t.cy),e.arc(t.cx,t.cy,t.r,0,Math.PI*2)):t.type==="ellipse"?(e.moveTo(t.cx+t.rx,t.cy),e.ellipse(t.cx,t.cy,t.rx,t.ry,0,0,Math.PI*2)):t.type==="rect"?e.rect(t.x,t.y,t.w,t.h):t.type==="line"&&(e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2))}function ci(e){const t=e==null?void 0:e.match(/^url\(#([^)]+)\)$/);return(t==null?void 0:t[1])||null}function qs(e,t,n){const{x:i,y:a,w:s,h:o}=n,r=t.type==="linearGradient"?e.createLinearGradient(ge(t.x1,i,s,i),ge(t.y1,a,o,a),ge(t.x2,i,s,i+s),ge(t.y2,a,o,a)):e.createRadialGradient(ge(t.fx,i,s,i+s/2),ge(t.fy,a,o,a+o/2),ge(t.fr,i,Math.max(s,o),0),ge(t.cx,i,s,i+s/2),ge(t.cy,a,o,a+o/2),Math.max(.01,ge(t.r,0,Math.max(s,o),Math.max(s,o)/2)));return t.stops.forEach(({offset:l,color:c,opacity:d})=>{r.addColorStop(l,d===void 0?c:ri(c,d))}),r}function vu(e,t,n,i,a){const s=Te({},t||{});if(n.fill!==void 0)if(n.fill===null)delete s.fill;else if(ci(n.fill)){const o=i.get(ci(n.fill));o&&(s.fill=qs(e,o,a))}else/^url\(/.test(n.fill)||(s.fill=n.fill);if(n.stroke!==void 0)if(n.stroke===null)delete s.stroke;else if(ci(n.stroke)){const o=i.get(ci(n.stroke));o&&(s.stroke=qs(e,o,a))}else/^url\(/.test(n.stroke)||(s.stroke=n.stroke);return n.lineWidth!==void 0&&(s.lineWidth=n.lineWidth),{style:s,shouldFill:n.fill!==null&&(!s.stroke||s.fill!==void 0),shouldStroke:n.stroke!==null&&s.stroke!==void 0,alpha:n.alpha}}function $n(e,t,n,i,a,s,o=a){if(ru(t)){e.point(t,n,i,a,s);return}const r=_u(t);if(!r||a<=0){e.point("circle",n,i,a,s);return}e.withState(l=>{const{box:c,paints:d,shapes:u}=r,h=o>0?a/o:1,f=g=>{const{style:p,shouldFill:x,shouldStroke:_,alpha:v}=vu(l,s,g.style,d,c);if(l.save(),e.applyStyle(p),v!==void 0&&(l.globalAlpha*=v),l.transform(...g.matrix),l.beginPath(),g.type==="path"){if(B.Path2D){const m=g.path2D||(g.path2D=new B.Path2D(g.d));x&&l.fill(m),_&&l.stroke(m)}}else mu(l,g),x&&l.fill(),_&&l.stroke();l.restore()};l.translate(n-(c.x+c.w/2)*h,i-(c.y+c.h/2)*h),l.scale(h,h),u.forEach(f)})}var bu=Object.defineProperty,yu=Object.defineProperties,Tu=Object.getOwnPropertyDescriptors,Js=Object.getOwnPropertySymbols,wu=Object.prototype.hasOwnProperty,Cu=Object.prototype.propertyIsEnumerable,ca=(e,t,n)=>t in e?bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qs=(e,t)=>{for(var n in t||(t={}))wu.call(t,n)&&ca(e,n,t[n]);if(Js)for(var n of Js(t))Cu.call(t,n)&&ca(e,n,t[n]);return e},to=(e,t)=>yu(e,Tu(t)),un=(e,t,n)=>ca(e,typeof t!="symbol"?t+"":t,n);const Su=[An,Kt,le,Gt],Au=1e3,eo=new WeakMap,no=new Map;function io(e,t){if(!t||t==="none")return;const n=t.match(/^matrix\(([^)]+)\)$/),i=t.match(/^matrix3d\(([^)]+)\)$/);if(n){const a=n[1].split(",").map(s=>Number(s.trim()));a.length===6&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[2],a[3],a[4],a[5])}else if(i){const a=i[1].split(",").map(s=>Number(s.trim()));a.length===16&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[4],a[5],a[12],a[13])}}function ku(e,t,n){const i=e.naturalWidth||e.width,a=e.naturalHeight||e.height;if(!i||!a||!t||!n)return{x:0,y:0,w:t,h:n};const s=Math.min(t/i,n/a),o=i*s,r=a*s;return{x:(t-o)/2,y:(n-r)/2,w:o,h:r}}function Lu(e){const{state:t}=e;return t.hasFunnel||t.hasTreemap?{x:0,y:0}:{x:sn(t.margin.left),y:sn(t.margin.top)}}function ao(e,t,n,i,a=!1){i.strokePath(s=>{zs(e,n,a,s)(t)},{lineDash:[]})}function so(e,t,n,i,a=!1){i.fillPath(s=>{Ns(e,n,a,s)(t)})}function oo(e,t){const n=be(e,t);return n.start===0&&n.end===t.values.length?t:to(Qs({},t),{values:t.values.slice(n.start,n.end)})}function da(e,t){if(!(e!=null&&e.length)||!(t!=null&&t.id))return null;let n=eo.get(e);if(!n){n=new Map;for(const i of e){if(!(i!=null&&i.id))continue;const a=`${i.id}:*`;n.has(a)||n.set(a,i),"index"in i&&n.set(`${i.id}:${i.index}`,i)}eo.set(e,n)}return"index"in t?n.get(`${t.id}:${t.index}`)||null:n.get(`${t.id}:*`)||null}function Ru(e,t){const n=B.Path2D;if(!n)return null;const i=`${e}:${t}`,a=no.get(i);if(a)return a;const s=new n(Ja[e][t]);return no.set(i,s),s}function Fn(e,t){const n=e.config.color_onover;return!n||!t?null:Q(n)?t.id in n?n[t.id]:null:nt(n)?n:O(n)?n.call(e.api,t):null}function Eu(e,t,n){const i=da(n,t);return Fn(e,i)||e.color(t.id)}function ro(e){var t;return(e==null?void 0:e.id)||((t=e==null?void 0:e.data)==null?void 0:t.id)}function Pu(e,t){var n;const i=ro(t);return!!i&&((n=e.state.focusedTargetIds)==null?void 0:n.has(i))}function On(e,t){var n;const i=ro(t);return i&&((n=e.state.defocusedTargetIds)!=null&&n.has(i))?e.canvasTheme.style.shape.targetDefocusedOpacity:1}function Du(e,t,n,i=!1){var a;const s=(a=e.generateGetAreaPoints)==null?void 0:a.call(e,n,i);if(!s)return null;const o=be(e,t);let r=1/0,l=1/0,c=-1/0,d=-1/0;for(let u=o.start;u<o.end;u++){const h=t.values[u];Lt(e,h)&&s(h,u).forEach(([f,g])=>{vt(f,g)&&(r=Math.min(r,f),l=Math.min(l,g),c=Math.max(c,f),d=Math.max(d,g))})}return Number.isFinite(r)&&Number.isFinite(l)?{x:r,y:l,w:c-r,h:d-l}:null}function di(e,t,n){return t+n*(X(e)?e:0)}function lo(e,t,n,i,a,s){const o=e.config[`${i}_linearGradient`];if(!o||!a||!a.w||!a.h)return s;const r=e.config.axis_rotated,l=typeof o=="object"?o:{},c=l.x||(r?[1,0]:[0,0]),d=l.y||(r?[0,0]:[0,1]),u=Array.isArray(l.stops)?l.stops:[[0,s,1],[1,s,0]],h=t.createLinearGradient(di(c[0],a.x,a.w),di(d[0],a.y,a.h),di(c[1],a.x,a.w),di(d[1],a.y,a.h));return u.forEach(([f,g,p])=>{const x=O(g)?g.call(e.api,n.id):g,_=String(x||s),v=Number(f),m=Number.isFinite(v)?Math.max(0,Math.min(1,v)):0;h.addColorStop(m,ri(_,p))}),h}function we(e,t){return rn(e,t,Su)}function ui(e,t){const n=e.config.point_opacity;return Number.isFinite(n)?n:$e(e,t)||Fe(e,t)?.5:1}function Bn(e,t,n){var i,a;const s=e.config.point_r;return Fe(e,t)||O(s)?(a=(i=e.pointR)==null?void 0:i.call(e,n))!=null?a:2.5:s}function Iu(e,t,n,i){return!i&&n==="circle"&&$e(e,t)&&!O(e.config.point_r)&&t.values.length>us}function Mu(e,t){const{bar_connectLine:n}=e.config,i=Q(n)?n[t]:n;return/^(start|end)-(start|end)$/.test(i)?i:null}function $u(e,t,n){const{indexX:i,indexY:a,pos:s}=n;return e.config.axis_rotated?{x:t[0][i],y:t[0][a],width:t[0][i]-s,height:t[2][a]-t[0][a]}:{x:t[0][i],y:s,width:t[2][i]-t[0][i],height:t[3][a]-s}}function Fu(e,t,n,i,a=1){if(i.length<2)return;const s=e.config.axis_rotated,o=/^start-(start|end)$/.test(n),r=/^end-(start|end)$/.test(n),l=/\w+-end$/.test(n),c=/\w+-start$/.test(n),d=f=>({x:s?r?f.x-f.width:f.x:f.x+f.width,y:s||o?f.y+f.height:f.y}),u=f=>({x:s?f.x-(l?f.width:0):f.x,y:s?f.y:f.y+(c?f.height:0)});let h=d(i[0]);t.strokePath(()=>{for(let f=1;f<i.length;f++){const g=u(i[f]);t.traceLine(h.x,h.y,g.x,g.y),f<i.length-1&&(h=d(i[f]))}},{alpha:a,stroke:e.canvasTheme.style.shape.barConnectLineColor,lineWidth:e.canvasTheme.style.shape.barConnectLineWidth,lineDash:[]})}function ua(e,t){var n;const{config:i}=e;if(Fe(e,t))return"circle";const a=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],s=Array.isArray(i.point_pattern)&&i.point_pattern.length?i.point_pattern:[i.point_type],o=Math.max(0,a.indexOf(t.id)),r=s[o%s.length];return/^rect(angle)?$/i.test(r)||r==="rectangle"?"rectangle":r||"circle"}function Ou(e,t,n,i,a,s,o){const r=e.config.point_radialGradient;if(!r||!s)return o;const l=Q(r)?r:{},c=X(l.cx)?l.cx:.3,d=X(l.cy)?l.cy:.3,u=X(l.r)?l.r:.7,h=Array.isArray(l.stops)?l.stops:[[.1,null,1],[.9,null,0]],f=i+(c-.5)*s*2,g=a+(d-.5)*s*2,p=t.createRadialGradient(f,g,0,f,g,Math.max(1,s*u*2));return h.forEach(([x,_,v])=>{let m=O(_)?_.bind(e.api)(n.id):_;m||(m=o);const b=Number(x),y=Number.isFinite(b)?Math.max(0,Math.min(1,b)):0;p.addColorStop(y,ri(m,v))}),p}function co(e,t,n){const i=e.config.candlestick_color_down;return(n!=null&&n._isUp?e.color(t):i&&typeof i=="object"?i[t.id]:i)||e.color(t)}function Bu(e,t){return e.shouldDrawPointsForLine?e.shouldDrawPointsForLine(t):!0}function zu(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function Nu(e,t,n){const{config:i,scale:a}=e,s=a.zoom||a.x,o=e.getYScaleById(t.id),r=i.line_connectNull?e.filterRemoveNull(t.values):t.values;let l=e.isAreaRangeType(t)?r.map(g=>to(Qs({},g),{value:e.getRangedData(g,"mid")})):r;e.isStepType(t)&&(l=e.convertValuesToStep(l));const c=Fd(e,l,s,o,i.data_regions[t.id]);let d=null,u=[];const h=()=>{if(u.length<2||!d){u=[];return}n.strokePath(g=>{const[p,...x]=u;g.moveTo(p[0],p[1]),x.forEach(_=>{g.lineTo(_[0],_[1])})},{lineDash:d}),u=[]},f=(g,p,x)=>{!d||!zu(d,x)?(h(),d=x,u=[g,p]):u.push(p)};for(const{start:g,end:p,dash:x,isBreak:_}of c){if(_||!g||!p||!x){h(),d=null;continue}if(!vt(g[0],g[1])||!vt(p[0],p[1])){h(),d=null;continue}f(g,p,x)}h()}class Xu{constructor(t,n){un(this,"engine",t),un(this,"theme",n),un(this,"painter"),un(this,"labelImageCache",new Map),un(this,"backgroundImageCache",new Map),un(this,"backgroundClassStyleCache",new Map),this.painter=new Ts(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}destroy(){const t=n=>{n.image.onload=null,n.image.onerror=null};this.labelImageCache.forEach(t),this.backgroundImageCache.forEach(t),this.labelImageCache.clear(),this.backgroundImageCache.clear(),this.backgroundClassStyleCache.clear()}getLabelImage(t,n){if(!t||!B.Image)return null;let i=this.labelImageCache.get(t);if(!i){const a={image:new B.Image,loaded:!1,loading:!0};i=a,this.labelImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.redraw)==null||s.call(n)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundImage(t,n){if(!t||!B.Image)return null;let i=this.backgroundImageCache.get(t);if(!i){const a={image:new B.Image,loaded:!1,loading:!0};i=a,this.backgroundImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.renderCanvasFrame)==null||s.call(n,void 0,null,!1)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundClassStyle(t,n){if(!n||!B.document)return{};const i=this.backgroundClassStyleCache.get(n);if(i)return i;const a=B.document.createElement("div");a.className=n,a.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:1px;height:1px;",t.$el.chart.node().appendChild(a);const s=B.getComputedStyle(a),o=parseFloat(s.opacity),r={opacity:Number.isFinite(o)?o:void 0,transform:s.transform||void 0};return a.remove(),this.backgroundClassStyleCache.set(n,r),r}drawBackground(t){const n=t.config.background;if(!(n!=null&&n.imgUrl)&&!(n!=null&&n.color))return;const{ctx:i,painter:a}=this,{current:s,margin:o,width:r,height:l}=t.state,c=this.getBackgroundClassStyle(t,n.class);a.withState(()=>{if(c.opacity!==void 0&&(i.globalAlpha*=c.opacity),n.imgUrl){const d=this.getBackgroundImage(n.imgUrl,t);if(d!=null&&d.loaded){const u=Lu(t),h=ku(d.image,s.width,s.height);i.translate(u.x,u.y),io(i,c.transform),i.drawImage(d.image,h.x,h.y,h.w,h.h)}}else n.color&&(io(i,c.transform),a.fillRect({x:o.left,y:o.top,w:r,h:l},{fill:n.color}))})}drawLabelImage(t,n,i,a,s){const o=Zd(t,n);if(!(o!=null&&o.url))return{x:a,y:s};const r=qd(o,n),l=Jd(t,o,i,a,s,n),c=this.getLabelImage(r,t);return c!=null&&c.loaded&&this.ctx.drawImage(c.image,l.x,l.y,o.width,o.height),{x:l.textX,y:l.textY}}drawDataLabel(t,n,i,a,s){const{painter:o,theme:{style:r}}=this;if({x:a,y:s}=this.drawLabelImage(t,n,i,a,s),t.config.data_labels.rotate){const l=iu(t,n,a,s);a=l.x,s=l.y,this.ctx.textAlign=l.textAlign}this.ctx.fillStyle=Ws(t,n,r.label.color),Vs(t,o,n,i,a,s),o.textLines(i,a,s,{angle:t.config.data_labels.rotate})}drawFocusLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,theme:{style:s}}=this,o=n.filter(l=>l&&Lt(t,l)&&le(t,l)&&we(t,{id:l.id})),r={size:()=>o.length};o.length&&(a.font=s.label.font,o.forEach(l=>{const c=Xs(t,l);let{x:d,y:u}=Pn(t,l);c&&({x:d,y:u}=Hs(t,a,l,d,u),d+=li(t,l,"x",r),u+=li(t,l,"y",r),vt(d,u)&&this.drawDataLabel(t,l,c,d,u))}))}draw(t,n,i){if(t.state.hasTreemap){this.drawTreemaps(t);return}const{margin:a,width:s,height:o}=t.state,r=()=>{t.config.area_front||this.drawAreas(t,n,i),this.drawLines(t,n),t.config.area_front&&this.drawAreas(t,n,i),this.drawCircles(t,n,i)},l=()=>{t.config.bar_front||this.drawBars(t,n,i),this.drawCandlesticks(t,n,i),r(),t.config.bar_front&&this.drawBars(t,n,i),this.drawSelections(t,n),this.drawLabels(t,n)};t.config.clipPath===!1?l():this.painter.clipRect({x:a.left,y:a.top,w:s,h:o},l)}drawSubchart(t,n){const{config:i,state:a}=t;if(!i.subchart_show||!a.hasAxis||a.width2<=0||a.height2<=0)return;const{ctx:s,painter:o,theme:{style:r}}=this,{margin2:l,width2:c,height2:d}=a,u={x:l.left,y:l.top,w:c,h:d},h=t.filterTargetsToShow().filter(we.bind(null,t));o.withState(()=>{s.strokeStyle=r.axis.lineColor,s.lineWidth=r.axis.lineWidth,o.strokePath(()=>{i.axis_rotated?o.traceLine(u.x,u.y,u.x,u.y+u.h):o.traceLine(u.x,u.y+u.h,u.x+u.w,u.y+u.h)}),o.clipRect(u,()=>{o.withTranslation(u.x,u.y,()=>{var f,g,p,x,_,v;const m=h.filter(An.bind(null,t)),b=Ut(t,n,I.AREA,An.bind(null,t));s.globalAlpha=r.shape.areaOpacity;for(const R of m)R.values.some(Lt.bind(null,t))&&(s.fillStyle=t.color(R.id),so(t,R,b,o,!0));s.globalAlpha=1;const y=h.filter(Kt.bind(null,t)),T=Ut(t,n,I.BAR,Kt.bind(null,t)),w=(f=t.generateGetBarPoints)==null?void 0:f.call(t,T,!0);if(w){s.globalAlpha=r.shape.barOpacity;for(const R of y)s.fillStyle=t.color(R.id),R.values.forEach((E,P)=>{if(!Lt(t,E))return;const D=Dn(t,w,E,P);D&&o.fillRect(D.rect,{fill:s.fillStyle})});s.globalAlpha=1}const C=h.filter(Gt.bind(null,t)),A=Ut(t,n,I.CANDLESTICK,Gt.bind(null,t)),S=(g=t.generateGetCandlestickPoints)==null?void 0:g.call(t,A,!0);if(S){s.lineWidth=r.shape.candlestickLineWidth;for(const R of C)R.values.forEach((E,P)=>{var D;const z=(D=t.getCandlestickData)==null?void 0:D.call(t,E),$=z&&In(t,S,E,P);if(!$)return;const G=co(t,{id:R.id},z);s.strokeStyle=G,s.fillStyle=G,o.strokePath(()=>{o.traceLine($.wickStart[0],$.wickStart[1],$.wickEnd[0],$.wickEnd[1])}),o.fillRect($.body,{fill:s.fillStyle})})}const k=h.filter(ln.bind(null,t)),L=Ut(t,n,I.LINE,ln.bind(null,t));s.globalAlpha=1,s.lineWidth=r.shape.lineWidth;for(const R of k)R.values.some(Lt.bind(null,t))&&(s.strokeStyle=t.color(R.id),ao(t,R,L,o,!0));if(i.point_show&&!((p=t.isPointFocusOnly)!=null&&p.call(t))){const R=(x=t.updateCircleY)==null?void 0:x.call(t,!0),E=(_=t.subxx)==null?void 0:_.bind(t);if(E&&R){for(const P of h){if(!$e(t,P)&&!Fe(t,P))continue;const D=t.color(P.id),z=r.shape.pointFillColor||D,$=r.shape.pointStrokeColor||D,G=$?(v=r.shape.pointLineWidth)!=null?v:1:0,N=$&&G>0?{fill:z,stroke:$,lineWidth:G}:{fill:z};s.globalAlpha=ui(t,P),P.values.forEach((q,At)=>{if(!Lt(t,q))return;const K=i.axis_rotated?R(q,At):E(q),lt=i.axis_rotated?E(q):R(q,At),ft=Math.min(Bn(t,P,q),3);vt(K,lt)&&$n(o,"circle",K,lt,ft,N)})}s.globalAlpha=1}}})}),this.drawSubchartBrush(t)})}drawSubchartBrush(t){var n,i;const{config:a,scale:s,state:o}=t,r=o.domain;if(!a.subchart_show||!(r!=null&&r.length)||!s.subX)return;const{margin2:l,width2:c,height2:d}=o,u=s.subX(r[0]),h=s.subX(r[1]),f=a.axis_rotated?d:c,g=(i=(n=t.axis)==null?void 0:n.getExtent)==null?void 0:i.call(n),p=Array.isArray(g)&&g.length>=2&&g.every(Number.isFinite)?g.slice(0,2):[0,f],x=Math.max(0,Math.min(f,Math.min(...p))),_=Math.max(0,Math.min(f,Math.max(...p))),v=Math.max(x,Math.min(_,Math.min(u,h))),m=Math.max(x,Math.min(_,Math.max(u,h))),b=m-v;if(b<=0)return;const y=a.axis_rotated?{x:l.left,y:l.top+v,w:c,h:b}:{x:l.left+v,y:l.top,w:b,h:d};this.painter.fillRect(y,{fill:this.theme.style.subchartBrush.fill,alpha:this.theme.style.subchartBrush.opacity}),a.subchart_showHandle&&(this.drawSubchartBrushHandle(t,v,"start"),this.drawSubchartBrushHandle(t,m,"end"))}drawSubchartBrushHandle(t,n,i){const{config:a,state:{margin2:s,width2:o,height2:r}}=t,{ctx:l,painter:c,theme:{style:d}}=this,u=a.axis_rotated,h=d.subchartBrush.handleFill,f=d.subchartBrush.handleStroke,g=u?s.left+o/2:s.left+n,p=u?s.top+n:s.top+r/2,x=Ru(u?"y":"x",i);x&&c.withState(()=>{l.translate(g,p),l.fillStyle=h,l.strokeStyle=f,l.lineWidth=d.subchartBrush.handleLineWidth,l.globalAlpha=d.subchartBrush.handleOpacity,l.fill(x),l.globalAlpha=1,l.stroke(x)})}drawBars(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=Kt.bind(null,t),l=sa(t,i,Kt),c=t.filterTargetsToShow().filter(r).filter(we.bind(null,t)),d=t.generateGetBarPoints(Ut(t,n,I.BAR,r),!1),{margin:u}=t.state,h=ea(t),f=h?na(t):new Set;d&&s.withTranslation(u.left,u.top,()=>{var g;for(const p of c){const x=be(t,p),_=Mu(t,p.id),v=On(t,p),m=[],b=[];for(let y=x.start;y<x.end;y++){const T=p.values[y];if(!Lt(t,T))continue;const w=Dn(t,d,T,y);if(!w)continue;const{points:C,rect:A}=w,S=ia(t,T,C,h,f,(g=t.isStackingRadiusData)==null?void 0:g.bind(t));b.push({d:T,points:C,rect:A,radiusInfo:S}),_&&m.push($u(t,C,S))}_&&o.shape.barConnectLineWidth>0&&Fu(t,s,_,m,v);for(const{d:y,rect:T,radiusInfo:w}of b){const C=Fn(t,da(i,y)),A=C||t.color(p.id),k=(l(y)?o.shape.barExpandedOpacity:o.shape.barOpacity)*v;a.fillStyle=C?A:lo(t,a,p,"bar",T,A),h?s.fillRoundRect(T,w.corners,{alpha:k}):s.fillRect(T,{alpha:k}),o.shape.barLineWidth>0&&(a.strokeStyle=o.shape.barStrokeColor,a.lineWidth=o.shape.barLineWidth,h?s.strokeRoundRect(T,w.corners,{alpha:o.shape.barOpacity*v}):s.strokeRect(T,{alpha:o.shape.barOpacity*v}))}}})}drawCandlesticks(t,n,i){var a;const{ctx:s,painter:o,theme:{style:r}}=this,l=Gt.bind(null,t),c=sa(t,i,Gt),d=t.filterTargetsToShow().filter(l).filter(we.bind(null,t)),u=(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,Ut(t,n,I.CANDLESTICK,l),!1),{margin:h}=t.state;u&&o.withTranslation(h.left,h.top,()=>{var f;s.lineWidth=r.shape.candlestickLineWidth;for(const g of d){const p=be(t,g),x=On(t,g),_=r.shape.candlestickLineWidth,v=r.shape.candlestickStrokeColor||"#000";for(let m=p.start;m<p.end;m++){const b=g.values[m],y=(f=t.getCandlestickData)==null?void 0:f.call(t,b);if(!y)continue;const T=In(t,u,b,m);if(!T)continue;const{body:w,wickStart:C,wickEnd:A}=T;s.fillStyle=Fn(t,da(i,b))||co(t,b,y),s.strokeStyle=v,s.globalAlpha=x,_>0&&o.strokePath(()=>{o.traceLine(C[0],C[1],A[0],A[1])}),o.fillRect(w,{alpha:(c(b)?r.shape.candlestickExpandedOpacity:1)*x}),_>0&&o.strokeRect(w,{alpha:x,lineWidth:_,stroke:v})}}s.globalAlpha=1})}hasExpandedShapeFocus(t,n){return!!(n!=null&&n.some(i=>i&&(Kt(t,i)||Gt(t,i))))}drawLines(t,n){const{ctx:i,painter:a,theme:{style:s}}=this,o=ln.bind(null,t),r=t.filterTargetsToShow().filter(o).filter(we.bind(null,t)),l=Ut(t,n,I.LINE,o),{margin:c}=t.state;t.generateGetLinePoints&&a.withTranslation(c.left,c.top,()=>{var d;for(const u of r){const h=oo(t,u);h.values.some(Lt.bind(null,t))&&(i.globalAlpha=On(t,u),i.lineWidth=Pu(t,u)?s.shape.lineFocusedWidth:s.shape.lineWidth,i.strokeStyle=t.color(u.id),(d=t.config.data_regions)!=null&&d[h.id]?Nu(t,h,a):ao(t,h,l,a))}i.globalAlpha=1})}drawAreas(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=An.bind(null,t),l=t.filterTargetsToShow().filter(r).filter(we.bind(null,t)),c=Ut(t,n,I.AREA,r),{margin:d}=t.state;t.generateGetAreaPoints&&s.withTranslation(d.left,d.top,()=>{for(const u of l){const h=oo(t,u);if(!h.values.some(Lt.bind(null,t)))continue;const f=Eu(t,h,i);a.globalAlpha=o.shape.areaOpacity*On(t,u),a.fillStyle=lo(t,a,h,"area",t.config.area_linearGradient?Du(t,u,c):null,f),so(t,h,c,s)}a.globalAlpha=1})}drawCircles(t,n,i){var a;if(!t.config.point_show||(a=t.isPointFocusOnly)!=null&&a.call(t))return;const{ctx:s,painter:o,theme:{style:r}}=this,{cx:l,cy:c}=n.pos,{margin:d}=t.state,u=sa(t,i,le),h=!!(i!=null&&i.some(f=>f&&le(t,f)));!l||!c||o.withTranslation(d.left,d.top,()=>{var f,g,p;for(const x of t.filterTargetsToShow()){if(!le(t,x)||!we(t,x)||ln(t,x)&&!Bu(t,x))continue;const _=t.color(x.id),v=ua(t,x),m=On(t,x),b=!!t.config.point_radialGradient,y=Iu(t,x,v,b),T=be(t,x),w=T.end-T.start,C=y?fs(t.state.width,t.state.height,Bn(t,x,x.values[T.start]||x.values[0])):null,A=ui(t,x)*m;s.fillStyle=_,s.globalAlpha=A;const S=r.shape.pointFillColor||_,k=r.shape.pointStrokeColor||_,L=k?(f=r.shape.pointLineWidth)!=null?f:1:0,R=!!k&&L>0,E=R&&v==="circle"&&X(A)&&A<1&&S===k;if(!h&&!b&&v==="circle")if(s.fillStyle=S,R&&!E&&(s.strokeStyle=k,s.lineWidth=L),w>Au)for(let P=T.start;P<T.end;P++){const D=x.values[P];if(!Lt(t,D))continue;const z=Bn(t,x,D),$=E?z+L/2:z,G=l(D,P),N=c(D,P);vt(G,N)&&(C&&!gs(C,G,N)||(s.beginPath(),s.arc(G,N,$,0,Math.PI*2),s.fill(),R&&!E&&s.stroke()))}else{s.beginPath();for(let P=T.start;P<T.end;P++){const D=x.values[P];if(!Lt(t,D))continue;const z=Bn(t,x,D),$=E?z+L/2:z,G=l(D,P),N=c(D,P);vt(G,N)&&o.traceCircle(G,N,$)}s.fill(),R&&!E&&s.stroke()}else for(let P=T.start;P<T.end;P++){const D=x.values[P];if(!Lt(t,D))continue;const z=u(D),$=Bn(t,x,D),G=z?(p=(g=t.pointExpandedR)==null?void 0:g.call(t,D))!=null?p:$*1.75:$,N=l(D,P),q=c(D,P),At=Fn(t,D),K=At||_,lt=r.shape.pointFillColor||K,ft=r.shape.pointStrokeColor||K,bt=z&&(At||r.focusPoint.fill)||lt,$t=z?At||r.focusPoint.stroke||K:ft,Et=z?r.focusPoint.lineWidth:L,kt=ui(t,D)*m,jn=!!$t&&(Et!=null?Et:0)>0,nn=v==="circle"&&jn&&X(kt)&&kt<1&&bt===$t,Pi=nn?G+(Et||0)/2:G;vt(N,q)&&(s.fillStyle=b?Ou(t,s,D,N,q,G,K):bt,s.globalAlpha=kt,$n(o,v,N,q,Pi,jn&&!nn?{fill:s.fillStyle,stroke:$t,lineWidth:Et}:void 0,$))}}})}drawSelections(t,n){var i,a;const s=(i=t.getCanvasSelectedData)==null?void 0:i.call(t);if(!t.config.data_selection_enabled||!(s!=null&&s.length)||t.state.hasTreemap)return;const{ctx:o,painter:r,theme:{style:l}}=this,{margin:c}=t.state,d=Kt.bind(null,t),u=Gt.bind(null,t),h=s.some(d)?t.generateGetBarPoints(Ut(t,n,I.BAR,d),!1):null,f=s.some(u)?(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,Ut(t,n,I.CANDLESTICK,u),!1):null,g=h?ea(t):null,p=g?na(t):new Set;r.withTranslation(c.left,c.top,()=>{s.forEach(x=>{var _,v,m,b,y,T;const w=t.color(x.id);if(d(x)&&h){const C=Dn(t,h,x,x.index);if(!C)return;const{points:A,rect:S}=C,k=g?ia(t,x,A,g,p).corners:0;g?r.fillRoundRect(S,k,{fill:"#fff",alpha:.3}):r.fillRect(S,{fill:"#fff",alpha:.3}),g?r.strokeRoundRect(S,k,{stroke:w,lineWidth:2}):r.strokeRect(S,{stroke:w,lineWidth:2})}else if(u(x)&&f){if(!((_=t.getCandlestickData)==null?void 0:_.call(t,x)))return;const A=In(t,f,x,x.index);if(!A)return;const{body:S,wickStart:k,wickEnd:L}=A;r.strokePath(()=>{r.traceLine(k[0],k[1],L[0],L[1])},{stroke:w,lineWidth:3}),r.fillRect(S,{fill:"#fff",alpha:.3}),r.strokeRect(S,{stroke:w,lineWidth:2})}else if(le(t,x)){const C=ua(t,{id:x.id}),{x:A,y:S}=Pn(t,x),k=(m=(v=t.pointR)==null?void 0:v.call(t,x))!=null?m:2.5,L=(y=(b=t.pointSelectR)==null?void 0:b.call(t,x))!=null?y:k*2;if(!vt(A,S))return;$n(r,"circle",A,S,L,{fill:l.selectedPoint.fill,lineWidth:l.selectedPoint.lineWidth,stroke:l.selectedPoint.stroke||w}),$n(r,C,A,S,k,{fill:l.shape.pointFillColor||w,stroke:l.shape.pointStrokeColor||w,lineWidth:(T=l.shape.pointLineWidth)!=null?T:1})}}),o.globalAlpha=1})}drawLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,painter:s,theme:{style:o}}=this,{margin:r}=t.state,{cx:l,cy:c}=n.pos,d=n.indices[I.BAR]?t.generateGetBarPoints(n.indices[I.BAR],!1):null,u=t.generateGetCandlestickPoints?t.generateGetCandlestickPoints(Ut(t,n,I.CANDLESTICK,Gt.bind(null,t)),!1):null,h=t.filterTargetsToShow().filter(x=>(Kt(t,x)||le(t,x)||An(t,x)||Gt(t,x))&&we(t,x)),f=[];let g=0;h.forEach(x=>{const _=be(t,x),v=t.labelishData(x),m=[];for(let b=0;b<v.length;b++){const y=v[b],T=Xs(t,y);T&&y.index>=_.start&&y.index<_.end&&Lt(t,y)&&m.push({d:y,text:T})}g+=m.length,m.length&&f.push(m)});const p={size:()=>g};s.withTranslation(r.left,r.top,()=>{a.font=o.label.font,a.textAlign="center",f.forEach(x=>{var _,v;for(const{d:m,text:b}of x){let y,T;if(Kt(t,m)&&d){const w=Dn(t,d,m,m.index);if(!w)continue;const{points:C,rect:A}=w,S=t.getBaseValue(m),k=oi(t,C[2]),L=S<0,R=oa(a,b,0,0).h;y=t.config.axis_rotated&&!t.config.data_labels.centered?k[0]+(L?-4:4):A.x+A.w/2,T=t.config.data_labels.centered||t.config.axis_rotated?A.y+A.h/2:k[1]+(L?R-3:-3),a.textAlign=t.config.axis_rotated&&!t.config.data_labels.centered?L?"right":"left":"center",a.textBaseline=t.config.data_labels.centered||t.config.axis_rotated?"middle":"alphabetic"}else if(Gt(t,m)&&u){const w=(_=t.getCandlestickData)==null?void 0:_.call(t,m),C=In(t,u,m,m.index),A=w==null?void 0:w._isUp;if(!C)continue;const{wickEnd:S,wickStart:k}=C,L=t.config[`axis_${(v=t.axis)==null?void 0:v.getId(m.id)}_inverted`];y=t.config.axis_rotated?A?S[0]+4:k[0]-4:k[0],T=t.config.axis_rotated?k[1]+3:A?S[1]-3:k[1]+12,!t.config.axis_rotated&&L&&(T+=15*(A?1:-1)),a.textAlign=t.config.axis_rotated?A?"left":"right":"center",a.textBaseline="alphabetic"}else l&&c&&({x:y,y:T}=Od(n.pos,m,m.index),{x:y,y:T}=Hs(t,a,m,y,T));y+=li(t,m,"x",p),T+=li(t,m,"y",p),vt(y,T)&&this.drawDataLabel(t,m,b,y,T)}})})}drawEmptyLabel(t){const n=t.config.data_empty_label_text,i=t.filterTargetsToShow();if(!n||i.length)return;const{margin:a,width:s,height:o}=t.state,{style:r}=this.theme;this.painter.text(String(n),a.left+s/2,a.top+o/2,{fill:r.emptyLabel.color,font:r.emptyLabel.font,textAlign:"center",textBaseline:"middle"})}drawZoomBrush(t,n,i){const{axis_rotated:a}=t.config,{height:s,margin:o,width:r}=t.state,l=Math.min(n,i),c=Math.abs(i-n),d=a?{x:o.left,y:o.top+l,w:r,h:c}:{x:o.left+l,y:o.top,w:c,h:s};c<=0||this.painter.fillRect(d,{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawSelectionDragArea(t,n){const{margin:i,width:a,height:s}=t.state,o={x:i.left,y:i.top,w:a,h:s},r=Math.max(o.x,n.x),l=Math.max(o.y,n.y),c=Math.min(o.x+o.w,n.x+n.w),d=Math.min(o.y+o.h,n.y+n.h);c<=r||d<=l||this.painter.fillRect({x:r,y:l,w:c-r,h:d-l},{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawTreemaps(t){var n;const{ctx:i,painter:a,theme:{style:s}}=this,{config:o}=t,r=(n=t.getTreemapRoot)==null?void 0:n.call(t,t.data.targets),l=(r==null?void 0:r.children)||[];a.withState(()=>{var c;i.lineWidth=s.treemap.lineWidth,i.strokeStyle=s.treemap.stroke;for(const d of l){const{data:u}=d;if(!Bi(t,u))continue;const{x:h,y:f,w:g,h:p}=dn(t,d,r,!0);if(!vt(h,f)||!vt(h+g,f+p)||g<=0||p<=0)continue;const x={x:h,y:f,w:g,h:p};if(i.fillStyle=t.color(u.name),a.fillRect(x),a.strokeRect(x),!o.treemap_label_show||(u.ratio||0)<(o.treemap_label_threshold||0))continue;const _=zd(t,u,g,p);if(!_)continue;const v=_.split(`
17
- `),m=!!o.data_labels.centered;i.font=s.label.font;const b=re(i.font),y=i.measureText((c=v[0])!=null?c:""),T=(y.fontBoundingBoxAscent||0)+(y.fontBoundingBoxDescent||0)||(y.actualBoundingBoxAscent||0)+(y.actualBoundingBoxDescent||0),w=Math.max(b,T)+(v.length-1)*b,C=m?f+p/2:f+w+5;let A=m?h+g/2:h+5,S=C-(v.length-1)*b/(m?2:1);i.textAlign=m?"center":"left",i.textBaseline=m?"middle":"alphabetic",{x:A,y:S}=this.drawLabelImage(t,u,_,A,S),i.fillStyle=Ws(t,u,s.label.color),Vs(t,a,u,_,A,m?S+(v.length-1)*b/2:C),v.forEach((k,L)=>{a.text(k,A,S+L*b,{maxWidth:Math.max(0,g-8)})})}})}drawFocus(t,n){if(!(n!=null&&n.length))return;const{painter:i}=this,{style:a}=this.theme,{margin:s}=t.state,o=n.find(r=>r&&Lt(t,r));i.withTranslation(s.left,s.top,()=>{if(t.config.tooltip_show&&t.config.grid_focus_show!==!1&&!t.config.axis_tooltip&&o){const{x:r,y:l}=Pn(t,o),c=a.axis.lineWidth,d=t.config.axis_rotated,u=Number.isFinite(d?l:r),h=Number.isFinite(d?r:l),f=x=>i.crisp(s.left+x,c)-s.left,g=x=>i.crisp(s.top+x,c)-s.top,p=t.config.grid_focus_edge&&!t.config.tooltip_grouped;u&&i.strokePath(()=>{var x,_;if(d){if(i.traceLine(f(0),l,p&&h?r:f(t.state.width),l),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const v=((x=t.axis)==null?void 0:x.getId(o.id))==="y2";i.traceLine(r,p&&!v?l:g(0),r,p&&v?l:g(t.state.height))}}else if(i.traceLine(r,p&&h?l:g(0),r,g(t.state.height)),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const v=((_=t.axis)==null?void 0:_.getId(o.id))==="y2";i.traceLine(p&&v?r:f(0),l,p&&!v?r:f(t.state.width),l)}},{lineDash:a.focusGrid.dashArray,lineWidth:a.focusGrid.lineWidth,stroke:a.focusGrid.lineColor})}t.config.point_show&&!t.state.canvasFocusMainRedraw&&n.filter(r=>r&&Lt(t,r)&&le(t,r)&&we(t,{id:r.id})).forEach(r=>{var l,c,d,u;const h=ua(t,{id:r.id}),{x:f,y:g}=Pn(t,r),p=(c=(l=t.pointR)==null?void 0:l.call(t,r))!=null?c:2.5,x=(u=(d=t.pointExpandedR)==null?void 0:d.call(t,r))!=null?u:p*1.75,_=Fn(t,r),v=_||t.color(r.id),m=_||a.focusPoint.fill||a.shape.pointFillColor||v,b=_||a.focusPoint.stroke||v,y=a.focusPoint.lineWidth,T=ui(t,r),w=!!b&&(y!=null?y:0)>0,C=h==="circle"&&w&&X(T)&&T<1&&m===b;vt(f,g)&&$n(i,h,f,g,C?x+(y||0)/2:x,w&&!C?{fill:m,lineWidth:y,stroke:b,alpha:T}:{fill:m,alpha:T},p)}),this.drawFocusLabels(t,n)})}}var Gu=Object.defineProperty,uo=Object.getOwnPropertySymbols,Wu=Object.prototype.hasOwnProperty,Vu=Object.prototype.propertyIsEnumerable,Hu=(e,t,n)=>t in e?Gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yu=(e,t)=>{var n={};for(var i in e)Wu.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&uo)for(var i of uo(e))t.indexOf(i)<0&&Vu.call(e,i)&&(n[i]=e[i]);return n},ha=(e,t,n)=>Hu(e,typeof t!="symbol"?t+"":t,n);const pe="http://www.w3.org/2000/svg";function W(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:"");return Number.isFinite(n)?n:t}function Ze(e,t){const n=W(e.opacity,1),i=W(e["fill-opacity"],1),a=n*i;return Number.isFinite(a)?a:t}function Z(e,t){const n=e==null?void 0:e.trim();return n&&!/^(none|transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i.test(n)?n:t}function hn(e,t){const n=Z(e,""),i=t?Z(t,""):"";return n&&n!==i?n:void 0}function fn(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:""),i=typeof t=="number"?t:parseFloat(t!=null?t:"");return Number.isFinite(n)&&(!Number.isFinite(i)||n!==i)?n:void 0}function zn(e){return Array.isArray(e)?e.filter(t=>Number.isFinite(t)&&t>0):(e||"").split(/[,\s]+/).map(t=>parseFloat(t)).filter(t=>Number.isFinite(t)&&t>0)}function ju(e,t){const n=e.getPropertyValue("font").trim();if(n)return n;const i=e.getPropertyValue("font-size").trim(),a=e.getPropertyValue("font-family").trim();if(!i||!a)return t;const s=e.getPropertyValue("font-style").trim(),o=e.getPropertyValue("font-variant").trim(),r=e.getPropertyValue("font-weight").trim(),l=e.getPropertyValue("line-height").trim(),c=l&&l!=="normal"?`${i}/${l}`:i;return[s&&s!=="normal"?s:"",o&&o!=="normal"?o:"",r&&!/^(normal|400)$/.test(r)?r:"",c,a].filter(Boolean).join(" ")}function xe(e,t){var n;const i=t.replace(/-([a-z])/g,(a,s)=>s.toUpperCase());return(n=e[t])!=null?n:e[i]}function at(e,t){const n=xe(e,t);return(n==null?"":Z(String(n),""))||void 0}function Mt(e,t){const n=xe(e,t),i=typeof n=="number"?n:parseFloat(String(n!=null?n:""));return Number.isFinite(i)?i:void 0}function Ne(e){const t=Mt(e,"opacity"),n=Mt(e,"fill-opacity");return t===void 0&&n===void 0?void 0:(t!=null?t:1)*(n!=null?n:1)}function ho(e){const t=xe(e,"stroke-dasharray"),n=t==null?[]:zn(t);return n.length?n:void 0}function ne(e){var t,n,i,a;const s=xe(e,"font");if(s!=null&&String(s).trim())return String(s).trim();const o=xe(e,"font-size"),r=xe(e,"font-family");if(o==null||r==null)return;const l=String(o).trim(),c=String(r).trim();if(!l||!c)return;const d=String((t=xe(e,"font-style"))!=null?t:"").trim(),u=String((n=xe(e,"font-variant"))!=null?n:"").trim(),h=String((i=xe(e,"font-weight"))!=null?i:"").trim(),f=String((a=xe(e,"line-height"))!=null?a:"").trim();return[d&&d!=="normal"?d:"",u&&u!=="normal"?u:"",h&&!/^(normal|400)$/.test(h)?h:"",f&&f!=="normal"?`${l}/${f}`:l,c].filter(Boolean).join(" ")}function it(e,t,n){var i;const a=Object.keys(n).reduce((s,o)=>(n[o]!==void 0&&(s[o]=n[o]),s),{});Object.keys(a).length&&(e[t]=ve((i=e[t])!=null?i:{},a))}function Uu(e){return e.split(",").map(t=>t.trim().replace(/\s*>\s*/g," ").replace(/\s+/g," ").replace(/^(?:svg)?\.bb\s+/,"").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g,"$1.")).filter(Boolean)}function Ku(e,t,n){switch(t){case".bb-axis path.domain":case".bb-axis .domain":case".bb-axis-x path.domain":case".bb-axis-x .domain":case".bb-axis-y path.domain":case".bb-axis-y .domain":case".bb-axis-y2 path.domain":case".bb-axis-y2 .domain":it(e,"axis",{lineColor:at(n,"stroke"),lineWidth:Mt(n,"stroke-width")});break;case".bb-axis line":case".bb-axis .tick line":case".bb-axis-x line":case".bb-axis-x .tick line":case".bb-axis-y line":case".bb-axis-y .tick line":case".bb-axis-y2 line":case".bb-axis-y2 .tick line":it(e,"axis",{tickColor:at(n,"stroke"),tickWidth:Mt(n,"stroke-width")});break;case".bb-axis text":case".bb-axis .tick text":{const i=ne(n);it(e,"axis",{labelColor:at(n,"fill"),xTickFont:i,yTickFont:i,y2TickFont:i});break}case".bb-axis-x text":case".bb-axis-x .tick text":it(e,"axis",{labelColor:at(n,"fill"),xTickFont:ne(n)});break;case".bb-axis-y text":case".bb-axis-y .tick text":it(e,"axis",{labelColor:at(n,"fill"),yTickFont:ne(n)});break;case".bb-axis-y2 text":case".bb-axis-y2 .tick text":it(e,"axis",{labelColor:at(n,"fill"),y2TickFont:ne(n)});break;case".tick._active_ text":case".bb-axis .tick._active_ text":case".bb-axis-x .tick._active_ text":it(e,"axis",{activeLabelColor:at(n,"fill")});break;case".bb-axis-x-label":case".bb-axis-x .bb-axis-x-label":it(e,"axis",{labelFont:ne(n),xLabelColor:at(n,"fill")});break;case".bb-axis-y-label":case".bb-axis-y .bb-axis-y-label":it(e,"axis",{labelFont:ne(n),yLabelColor:at(n,"fill")});break;case".bb-axis-y2-label":case".bb-axis-y2 .bb-axis-y2-label":it(e,"axis",{labelFont:ne(n),y2LabelColor:at(n,"fill")});break;case".bb-grid line":case".bb-grid .bb-xgrid":case".bb-grid .bb-ygrid":case".bb-xgrid":case".bb-ygrid":it(e,"grid",{lineColor:at(n,"stroke"),lineWidth:Mt(n,"stroke-width"),dashArray:ho(n)});break;case".bb-grid text":it(e,"grid",{labelColor:at(n,"fill"),labelFont:ne(n)});break;case".bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus":it(e,"focusGrid",{lineColor:at(n,"stroke"),lineWidth:Mt(n,"stroke-width"),dashArray:ho(n)});break;case".bb-region rect":case".bb-region":it(e,"region",{fill:at(n,"fill"),opacity:Ne(n)});break;case".bb-region text":it(e,"region",{labelColor:at(n,"fill"),labelFont:ne(n)});break;case".bb-bar":it(e,"shape",{barOpacity:Ne(n),barStrokeColor:at(n,"stroke"),barLineWidth:Mt(n,"stroke-width")});break;case".bb-bar._expanded_":it(e,"shape",{barExpandedOpacity:Ne(n)});break;case".bb-candlestick":it(e,"shape",{candlestickStrokeColor:at(n,"stroke"),candlestickLineWidth:Mt(n,"stroke-width")});break;case".bb-candlestick._expanded_":it(e,"shape",{candlestickExpandedOpacity:Ne(n)});break;case".bb-line":it(e,"shape",{barConnectLineColor:at(n,"stroke"),barConnectLineWidth:Mt(n,"stroke-width"),lineWidth:Mt(n,"stroke-width")});break;case".bb-target.bb-focused .bb-line":case".bb-target.bb-focused path.bb-line":it(e,"shape",{lineFocusedWidth:Mt(n,"stroke-width")});break;case".bb-target.bb-defocused":it(e,"shape",{targetDefocusedOpacity:Mt(n,"opacity")});break;case".bb-area":it(e,"shape",{areaOpacity:Ne(n)});break;case".bb-circle":it(e,"shape",{pointFillColor:at(n,"fill"),pointStrokeColor:at(n,"stroke"),pointLineWidth:Mt(n,"stroke-width")});break;case".bb-selected-circle":it(e,"selectedPoint",{fill:at(n,"fill"),stroke:at(n,"stroke"),lineWidth:Mt(n,"stroke-width")});break;case".bb-circle._expanded_":it(e,"focusPoint",{fill:at(n,"fill"),stroke:at(n,"stroke"),lineWidth:Mt(n,"stroke-width")});break;case".bb-zoom-brush":it(e,"zoomBrush",{fill:at(n,"fill"),opacity:Ne(n)});break;case".bb-brush .extent":case".bb-brush .selection":it(e,"subchartBrush",{fill:at(n,"fill"),opacity:Ne(n)});break;case".bb-brush .handle--custom":it(e,"subchartBrush",{handleFill:at(n,"fill"),handleOpacity:Ne(n),handleStroke:at(n,"stroke"),handleLineWidth:Mt(n,"stroke-width")});break;case".bb-chart-treemaps rect":case".bb-chart-treemaps":it(e,"treemap",{stroke:at(n,"stroke"),lineWidth:Mt(n,"stroke-width")});break;case".bb-text.bb-empty":case".bb-text .bb-empty":case".bb-empty":it(e,"emptyLabel",{color:at(n,"fill"),font:ne(n)});break;case".bb-text":it(e,"label",{color:at(n,"fill"),font:ne(n)});break;case".bb-title":it(e,"title",{color:at(n,"fill"),font:ne(n)});break}}function Zu(e){const t={};return Object.keys(e!=null?e:{}).forEach(n=>{Uu(n).forEach(i=>{Ku(t,i,e[n])})}),t}function qu(e){if(!e)return{};const t=e,{selectors:n}=t,i=Yu(t,["selectors"]);return ve({},Zu(n),i)}function fo(e,t){try{return JSON.stringify({className:e.className,style:e.getAttribute("style")||"",override:t||null})}catch(n){return null}}class Ju{constructor(){ha(this,"style"),ha(this,"cacheContainer",null),ha(this,"cacheKey",null)}load(t,n){var i,a,s,o;const r=tt.createElementNS(pe,"svg");r.setAttribute("class","bb"),r.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden",t.appendChild(r);const l=(Pt,Nt)=>{const Vt=B.getComputedStyle(Pt),jt={};for(const Ft of Nt)jt[Ft]=Ft==="font"?ju(Vt,""):Vt.getPropertyValue(Ft).trim();return jt},c=(Pt,Nt,Vt)=>{const jt=tt.createElementNS(pe,Pt);jt.setAttribute("class",Nt),r.appendChild(jt);const Ft=l(jt,Vt);return r.removeChild(jt),Ft},d=(Pt,Nt,Vt,jt)=>{const Ft=tt.createElementNS(pe,"g"),ae=tt.createElementNS(pe,Nt);Ft.setAttribute("class",Pt),Vt&&ae.setAttribute("class",Vt),Ft.appendChild(ae),r.appendChild(Ft);const Ee=l(ae,jt);return r.removeChild(Ft),Ee},u=(Pt,Nt,Vt,jt,Ft)=>{const ae=tt.createElementNS(pe,"g"),Ee=tt.createElementNS(pe,"g"),Un=tt.createElementNS(pe,Vt);ae.setAttribute("class",Pt),Ee.setAttribute("class",Nt),jt&&Un.setAttribute("class",jt),Ee.appendChild(Un),ae.appendChild(Ee),r.appendChild(ae);const E_=l(Un,Ft);return r.removeChild(ae),E_},h=(Pt,Nt,Vt,jt="")=>{const Ft=tt.createElementNS(pe,"g"),ae=tt.createElementNS(pe,"g"),Ee=tt.createElementNS(pe,Nt);Ft.setAttribute("class",`bb-axis ${Pt}`),ae.setAttribute("class",["tick",jt].filter(Boolean).join(" ")),Ee.textContent=Nt==="text"?"0":"",ae.appendChild(Ee),Ft.appendChild(ae),r.appendChild(Ft);const Un=l(Ee,Vt);return r.removeChild(Ft),Un},f="rgb(1, 2, 3)",g=(Pt,Nt)=>{const Vt=tt.createElement("style");Vt.textContent=`
13
+ `):e.config.axis_x_tick_multiline?dd(c,r!=null?r:ga(e,a,s,o),t):[c]}function pa(e,t){const{isRotated:n,tickCount:i,tickIndex:a,tickRotate:s,tickTextDirection:o}=t,r=e.config.axis_x_tick_text_inner;let l=n?o>0?"left":"right":s?s>0?"left":"right":"center";return!n&&a===0&&(r===!0||r!=null&&r.first)?l="left":!n&&a===i-1&&(r===!0||r!=null&&r.last)&&(l="right"),l}function hd(e,t){var n,i;return((n=e==null?void 0:e.indexOf("center"))!=null?n:-1)>-1?{x:t/2,align:"center"}:((i=e==null?void 0:e.indexOf("right"))!=null?i:-1)>-1?{x:t,align:"right"}:{x:0,align:"left"}}function Ye(e){return Number.isFinite(e)}function _i(e,t,n){return Ye(e)&&e>=Math.min(t,n)&&e<=Math.max(t,n)}function Qs(e){return e?-1:1}function fd(e,t,n){return t?n?e.axis_y2_inner?1:-1:e.axis_y_inner?-1:1:n?e.axis_y2_inner?-1:1:e.axis_y_inner?1:-1}function _a(e,t,n=Zt(e)){return n(Le(e,t))}function gd(e,t){var n,i;return(i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&typeof t=="string"&&Number.isNaN(Number(t))?e.config.axis_x_categories.indexOf(t):Le(e,t)}function pd(e,t){var n,i;return!!((i=(n=e.axis)==null?void 0:n.isCategorized)!=null&&i.call(n)&&Number.isNaN(Number(t)))}function to(e,t,n,i){var a,s;if(t===void 0)return n;let o=Zt(e)(gd(e,t));if(pd(e,t)){const r=Zt(e),l=((s=(a=e.axis.x)==null?void 0:a.tickOffset)==null?void 0:s.call(a))||(r(1)-r(0))/2;o+=l*(i==="start"?-1:1)}return o}function eo(e,t,n="y"){return e.scale[n||"y"](On(e,t,n))}function no(e,t,n){return e==="start"?t+4:e==="middle"?(t+n)/2:n-4}function io(e,t,n){return e==="start"?n-4:e==="middle"?(t+n)/2:t+4}function _d(e,t){const{config:n,scale:i,state:{width:a,height:s}}=e,o=t.axis||"x",r=n.axis_rotated;if(o==="x"){const h=to(e,t.start,0,"start"),f=to(e,t.end,r?s:a,"end"),g=Math.min(h,f),p=Math.abs(f-h);return r?{x:0,y:g,w:a,h:p}:{x:g,y:0,w:p,h:s}}if(!i[o])return null;const l=t.start===void 0?r?0:s:eo(e,t.start,o),c=t.end===void 0?r?a:0:eo(e,t.end,o),u=Math.min(l,c),d=Math.abs(c-l);return r?{x:u,y:0,w:d,h:s}:{x:0,y:u,w:a,h:d}}class xd{constructor(t,n){la(this,"engine",t),la(this,"theme",n),la(this,"painter"),this.painter=new Ys(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}draw(t){this.drawRegions(t),this.drawGrid(t),this.drawAxis(t)}drawAxis(t){const{config:n}=t;n.axis_x_show&&this.drawXAxis(t),n.axis_y_show&&this.drawYAxis(t),n.axis_y2_show&&t.scale.y2&&this.drawYAxis(t,"y2"),this.drawAdditionalAxes(t),this.drawAxisLabels(t)}drawSubXAxis(t){var n,i,a,s;const{ctx:o,painter:r,theme:{style:{axis:l}}}=this,{config:c,format:u,scale:d,state:{current:h,margin2:f,width2:g,height2:p}}=t;if(!c.subchart_show||!c.subchart_axis_x_show||!d.subX||g<=0||p<=0)return;const _=c.axis_rotated,x=r.crisp(f.left,l.lineWidth),m=r.crisp(f.top+p,l.lineWidth),v=f.left,b=f.left+g,y=f.top,T=f.top+p,w=_?y:v,C=_?T:b,k=Gs(t),S=Xu(t,k,l.tickWidth),A=(n=c.subchart_axis_x_tick_outer)!=null?n:c.axis_x_tick_outer,L=_?c.axis_x_tick_inner?1:-1:c.axis_x_tick_inner?-1:1,E=Qs(_),D=ca(_),R=c.axis_x_tick_text_position,P=_?0:((i=t.getAxisTickRotate)==null?void 0:i.call(t,"x"))||0,B=u.subXAxisTick||((s=(a=t.axis)==null?void 0:a.getXAxisTickFormat)==null?void 0:s.call(a,!0));r.clipRect(_?da(f,h.width,p):Us(js({},ua(f,g,h.height-f.top)),{y:f.top}),()=>{o.globalAlpha=1,o.strokeStyle=l.lineColor,o.lineWidth=l.lineWidth,o.setLineDash([]),r.strokePath(()=>{_?r.traceLine(x,y,x,T):r.traceLine(v,m,b,m),A&&(_?(r.traceLine(x,y,x+dt*E,y),r.traceLine(x,T,x+dt*E,T)):(r.traceLine(v,m,v,m+dt*E),r.traceLine(b,m,b,m+dt*E)))});const M=zn(l,"x");o.font=M,o.fillStyle=l.labelColor,o.textAlign=_?D>0?"left":"right":"center",o.textBaseline=_?"middle":D>0?"top":"bottom",o.strokeStyle=l.tickColor,o.lineWidth=l.tickWidth;const X=ha(r,de(M)),G=ga(t,k,_,d.subX);if(c.subchart_axis_x_tick_show)for(const Z of S){const et=d.subX(Le(t,Z)),rt=f.left+et,xt=f.top+et;_i(_?xt:rt,w,C)&&r.strokePath(()=>{_?r.traceLine(x,xt,x+dt*L,xt):r.traceLine(rt,m,rt,m+dt*L)})}for(const Z of k){const et=d.subX(Le(t,Z)),rt=f.left+et,xt=f.top+et;if(!_i(_?xt:rt,w,C)||!c.subchart_axis_x_tick_text_show)continue;const wt=Js(t,r,B,Z,k,_,d.subX,G);let _t,mt;_?(_t=x+(dt+Je)*D+(R.x||0),mt=xt+(R.y||0),o.textAlign=D>0?"left":"right",o.textBaseline="middle"):(_t=rt+(R.x||0),mt=m+(dt+Je)*D+(R.y||0),o.textAlign=P?P>0?"left":"right":"center",o.textBaseline=D>0?"top":"bottom"),r.withState(Pt=>{Pt.translate(_t,mt),P&&Pt.rotate(P*Math.PI/180),wt.forEach((Dt,Lt)=>{Pt.fillText(Dt,0,Lt*X)})})}})}drawSubYAxes(t){const{config:n,scale:i,state:{margin2:a,width2:s,height2:o}}=t;!n.subchart_show||s<=0||o<=0||["y","y2"].forEach(r=>{var l;const c=r==="y2"?i.subY2:i.subY;!n[`subchart_axis_${r}_show`]||!c||this.drawYAxis(t,r,{scale:c,ticks:Bn(t,r,void 0,!0,c,`subchart_axis_${r}`),format:nd(t,r),index:0,outerTick:(l=n[`subchart_axis_${r}_tick_outer`])!=null?l:n[`axis_${r}_tick_outer`],margin:a,width:s,height:o,prefix:`subchart_axis_${r}`,tickShow:n[`subchart_axis_${r}_tick_show`],tickTextShow:n[`subchart_axis_${r}_tick_text_show`],tickTextPosition:n[`axis_${r}_tick_text_position`]})})}drawTitle(t){var n,i;const{ctx:a,painter:s,theme:{style:{title:o}}}=this,{config:r,state:{current:l}}=t;if(!r.title_text)return;const c=String(r.title_text).split(`
14
+ `),u=de(o.font),d=u*1.5,{x:h,align:f}=hd(r.title_position,l.width),g=(i=(n=t.getCanvasTitleHeight)==null?void 0:n.call(t))!=null?i:u,p=(r.title_padding.top||0)+g;s.withState(()=>{a.font=o.font,a.fillStyle=o.color,a.textAlign=f,a.textBaseline="alphabetic",c.forEach((_,x)=>{a.fillText(_,h,p+(x?u+(x-1)*d:0))})})}drawAxisLabels(t){const{ctx:n,painter:i,theme:{style:{axis:a}}}=this,{axis:s,config:o}=t,r=de(a.labelFont),l=["x","y","y2"],c={x:a.xLabelColor,y:a.yLabelColor,y2:a.y2LabelColor},u={start:"left",middle:"center",end:"right"};s&&i.withState(()=>{n.font=a.labelFont,n.textBaseline="alphabetic",l.forEach(d=>{const h=s.getLabelText(d);if(!h||!o[`axis_${d}_show`]||d==="y2"&&!t.scale.y2)return;const f=d==="x"&&o.axis_rotated||d!=="x"&&!o.axis_rotated,g=rd(t,d),p=s.xForAxisLabel(d)+fa(s.dxForAxisLabel(d),r),_=fa(s.dyForAxisLabel(d),r),{x,y:m}=ld(g,p,_,f),v=s.textAnchorForAxisLabel(d);n.fillStyle=c[d]||a.labelColor,n.textAlign=u[v]||"center",i.text(String(h),x,m,{angle:f?-90:0})})})}drawGrid(t){const{ctx:n,painter:i,theme:{style:{grid:a}}}=this,{config:s,scale:o,state:{height:r,margin:l,width:c}}=t;if(!a.lineColor)return;const u=s.axis_rotated,d=l.left,h=l.left+c,f=l.top,g=l.top+r;i.withState(()=>{n.strokeStyle=a.lineColor,n.lineWidth=a.lineWidth,a.dashArray.length&&n.setLineDash(a.dashArray),s.grid_x_show&&o.x&&i.strokePath(()=>{for(const p of fi(t)){const _=_a(t,p);Ye(_)&&(u?i.traceCrispLine(d,l.top+_,h,l.top+_,a.lineWidth):i.traceCrispLine(l.left+_,f,l.left+_,g,a.lineWidth))}}),s.grid_y_show&&o.y&&i.strokePath(()=>{for(const p of Hu(t)){const _=On(t,p),x=o.y(_);Ye(x)&&(u?i.traceCrispLine(l.left+x,f,l.left+x,g,a.lineWidth):i.traceCrispLine(d,l.top+x,h,l.top+x,a.lineWidth))}}),!s.grid_lines_front&&this.drawGridLines(t)})}drawRegions(t){const{ctx:n,painter:i,theme:{style:{region:a}}}=this,{config:s,state:{height:o,margin:r,width:l}}=t,c=s.regions||[];c.length&&i.clipRect({x:r.left,y:r.top,w:l,h:o},()=>{var u;n.fillStyle=a.fill,n.font=a.labelFont,n.textBaseline="top";for(const d of c){const h=_d(t,d);if(!h||!Ye(h.x)||!Ye(h.y)||!h.w||!h.h)continue;const f=r.left+h.x,g=r.top+h.y,p=h.w,_=h.h;if(n.globalAlpha=Number.isFinite(d.opacity)?d.opacity:a.opacity,i.fillRect({x:f,y:g,w:p,h:_}),(u=d.label)!=null&&u.text){const x=d.label,m=x.center||"",v=String(x.text),b=i.measureText(v).width,y=parseFloat(n.font)||12;let T=f+(x.x||0),w=g+(x.y||0);m.indexOf("x")>-1&&(T+=(p-b)/2),m.indexOf("y")>-1&&(w+=(_-y)/2),i.text(v,T,w,{angle:x.rotated?-90:0,alpha:1,fill:x.color||a.labelColor})}}})}drawGridLines(t){const{ctx:n,painter:i,theme:{style:{axis:a,grid:s}}}=this,{config:o,scale:r,state:{height:l,margin:c,width:u}}=t,d=o.axis_rotated,h=c.left,f=c.left+u,g=c.top,p=c.top+l;s.lineColor&&i.withState(()=>{n.strokeStyle=s.lineColor,n.lineWidth=s.lineWidth,n.font=s.labelFont||a.labelFont,n.fillStyle=s.labelColor,n.textBaseline="middle",n.setLineDash([]);const _=(y,T,w,C=!1,k)=>{y&&i.text(y,T,w,Us(js({},k),{angle:C?-90:0}))},x=(y,T,w)=>{const C=id(this.theme.getGridLineStyle(T,y,"line"));i.strokePath(w,C)},m=(y,T)=>ad(this.theme.getGridLineStyle(y,T,"text")),v=y=>{if(y.value===void 0||!r.x)return;const T=_a(t,y.value);if(Ye(T))if(d){const w=c.top+T;x(y,"x",()=>{i.traceLine(h,w,f,w)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,no(y.position,h,f),w-5,!1,m("x",y))}else{const w=c.left+T;x(y,"x",()=>{i.traceLine(w,g,w,p)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,w-5,io(y.position,g,p),!0,m("x",y))}},b=y=>{const T=y.axis==="y2"?r.y2:r.y,w=y.axis==="y2"?"y2":"y";if(y.value===void 0||!T)return;const C=On(t,y.value,w),k=T(C);if(Ye(k))if(d){const S=c.left+k;x(y,"y",()=>{i.traceLine(S,g,S,p)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,S-5,io(y.position,g,p),!0,m("y",y))}else{const S=c.top+k;x(y,"y",()=>{i.traceLine(h,S,f,S)}),n.textAlign=y.position==="start"?"left":y.position==="middle"?"center":"right",_(y.text,no(y.position,h,f),S-5,!1,m("y",y))}};(o.grid_x_lines||[]).forEach(v),(o.grid_y_lines||[]).forEach(b)})}drawAdditionalAxes(t){["x","y","y2"].forEach(n=>{const i=t.config[`axis_${n}_axes`]||[];!i.length||!t.scale[n]||!t.config[`axis_${n}_show`]||i.forEach((a,s)=>{var o;const r=Gu(t,n,a);if(!r)return;const l={scale:r,ticks:Vu(t,n,r,a),format:Wu(t,a),index:s+1,outerTick:((o=a.tick)==null?void 0:o.outer)!==!1};n==="x"?this.drawXAxis(t,l):this.drawYAxis(t,n,l)})})}drawXAxis(t,n){var i;const{ctx:a,painter:s,theme:{style:{axis:o}}}=this,{axis:r,config:l,state:{current:c,margin:u,width:d,height:h}}=t,f=l.axis_rotated,g=n!=null&&n.index?t.getAxisSize("x")*n.index:0,p=(n==null?void 0:n.scale)||Zt(t),_=s.crisp(u.left-(f?g:0),o.lineWidth),x=s.crisp(u.top+h+(f?0:g),o.lineWidth),m=u.left,v=u.left+d,b=u.top,y=u.top+h,T=f?b:m,w=f?y:v,C=(n==null?void 0:n.ticks)||fi(t),k=(n==null?void 0:n.ticks)||Nu(t,C,o.tickWidth),S=(n==null?void 0:n.format)||r.getXAxisTickFormat(),A=n?n.outerTick:l.axis_x_tick_outer,L=f?l.axis_x_tick_inner?1:-1:l.axis_x_tick_inner?-1:1,E=Qs(f),D=ca(f),R=l.axis_x_tick_text_position,P=f?0:((i=t.getAxisTickRotate)==null?void 0:i.call(t,"x"))||0;s.clipRect(f?da(u,c.width,h):ua(u,d,c.height),()=>{if(a.strokeStyle=o.lineColor,a.lineWidth=o.lineWidth,s.strokePath(()=>{f?s.traceLine(_,b,_,y):s.traceLine(m,x,v,x),A&&(f?(s.traceLine(_,b,_+dt*E,b),s.traceLine(_,y,_+dt*E,y)):(s.traceLine(m,x,m,x+dt*E),s.traceLine(v,x,v,x+dt*E)))}),a.font=zn(o,"x"),a.fillStyle=o.labelColor,a.textAlign=f?D>0?"left":"right":"center",a.textBaseline=f?"middle":D>0?"top":"bottom",a.strokeStyle=o.tickColor,a.lineWidth=o.tickWidth,l.axis_x_tick_show&&s.strokePath(()=>{for(const G of k){const Z=aa(t,G,p),et=u.left+Z,rt=u.top+Z;_i(f?rt:et,T,w)&&(f?s.traceLine(_,rt,_+dt*L,rt):s.traceLine(et,x,et,x+dt*L))}}),!n&&!l.axis_x_tick_text_show)return;const B=zn(o,"x"),M=ha(s,de(B)),X=ga(t,C,f,p);C.forEach((G,Z)=>{this.drawXAxisTickText(t,G,S,o.labelColor,{isRotated:f,rangeEnd:w,rangeStart:T,tickCount:C.length,tickFont:B,tickIndex:Z,tickLineHeight:M,tickTextDirection:D,tickTextWidth:X,tickRotate:P,tickTextPosition:R,targetScale:p,ticks:C,x:_,y:x})})})}drawFocusedXAxisTick(t,n){var i;const{painter:a,theme:{style:{axis:s}}}=this,{axis:o,config:r,state:{current:l,margin:c,width:u,height:d}}=t,h=(i=n==null?void 0:n[0])==null?void 0:i.x;if(h===void 0||!o||!r.axis_x_show||!r.axis_x_tick_text_show||!s.activeLabelColor||s.activeLabelColor===s.labelColor)return;const f=fi(t),g=f.findIndex(w=>$n(w,h)),p=f[g];if(p===void 0)return;const _=r.axis_rotated,x=a.crisp(c.left,s.lineWidth),m=a.crisp(c.top+d,s.lineWidth),v=_?c.top:c.left,b=_?c.top+d:c.left+u,y=o.getXAxisTickFormat(),T=ca(_);a.clipRect(_?da(c,l.width,d):ua(c,u,l.height),()=>{var w;this.drawXAxisTickText(t,p,y,s.activeLabelColor,{isRotated:_,rangeEnd:b,rangeStart:v,targetScale:Zt(t),tickCount:f.length,tickIndex:g,tickTextDirection:T,tickRotate:_?0:((w=t.getAxisTickRotate)==null?void 0:w.call(t,"x"))||0,tickTextPosition:r.axis_x_tick_text_position,ticks:f,x,y:m})})}drawAxisTooltip(t,n){const{ctx:i,painter:a,theme:{style:{axis:s,grid:o}}}=this,{config:r,state:{margin:l,width:c,height:u}}=t;if(!r.axis_tooltip||!n)return;const d=r.axis_rotated,h=n[0]-l.left,f=n[1]-l.top,g=h>=0&&h<=c,p=f>=0&&f<=u;if(!g&&!p)return;const _=l.left+h,x=l.top+f,m=de(s.labelFont),v=m||10,b=(y,T,w,C,k)=>{const S=sd(t,y),A=S&&od(t,y,T);if(!A)return;i.font=s.labelFont,i.textAlign=k,i.textBaseline="alphabetic";const L=i.measureText(A),E=L.width,D=L.actualBoundingBoxAscent||v*.8,R=L.actualBoundingBoxDescent||v*.2,P=Math.max(2,E*.15),B=Math.max(3,v*.25),M=k==="right"?w-E:k==="center"?w-E/2:w,X=C-D;i.fillStyle=S,i.fillRect(M-P,X-B,E+P*2,D+R+B*2),i.fillStyle="#fff",i.fillText(A,w,C)};a.withState(()=>{i.strokeStyle=o.lineColor,i.lineWidth=o.lineWidth,i.setLineDash([]),a.strokePath(()=>{g&&a.traceLine(_,l.top,_,l.top+u),p&&a.traceLine(l.left,x,l.left+c,x)}),i.setLineDash([]),d?(p&&r.axis_x_show&&b("x",f,l.left-m*.3,x+m*.4,"right"),g&&r.axis_y_show&&b("y",h,_-m*1.3,l.top+u+m*1.15,"left"),g&&r.axis_y2_show&&t.scale.y2&&b("y2",h,_-m*1.3,l.top-m*.4,"left")):(g&&r.axis_x_show&&b("x",h,_-m,l.top+u+m*1.15,"left"),p&&r.axis_y_show&&b("y",f,l.left-m*.4,x+m*.3,"right"),p&&r.axis_y2_show&&t.scale.y2&&b("y2",f,l.left+c+m*.4,x+m*.3,"left"))})}drawXAxisTickText(t,n,i,a,s){var o,r;const{ctx:l,painter:c,theme:{style:{axis:u}}}=this,{state:{margin:d}}=t,{isRotated:h,rangeEnd:f,rangeStart:g,tickTextDirection:p,tickRotate:_,tickTextPosition:x,targetScale:m,ticks:v,x:b,y}=s,T=_a(t,n,m),w=d.left+T,C=d.top+T;if(!_i(h?C:w,g,f))return;const S=(o=s.tickFont)!=null?o:zn(u,"x");l.font=S,l.fillStyle=a;const A=Js(t,c,i,n,v,h,m,s.tickTextWidth),L=(r=s.tickLineHeight)!=null?r:ha(c,de(S));let E,D;if(h)E=b+(dt+Je)*p+(x.x||0),D=C+(x.y||0),l.textAlign=pa(t,s),l.textBaseline="middle";else if(_){const R=de(S),P=x.y?fa(x.y,R):.71*R,B=ud(_)+(x.x||0),M=cd(_)+P;l.textAlign=pa(t,s),l.textBaseline="alphabetic",c.withState(X=>{X.translate(w,y),X.rotate(_*Math.PI/180),A.forEach((G,Z)=>{X.fillText(G,B,M+Z*L)})});return}else E=w+(x.x||0),D=y+(dt+Je)*p+(x.y||0),l.textAlign=pa(t,s),l.textBaseline=p>0?"top":"bottom";c.withState(R=>{R.translate(E,D),_&&R.rotate(_*Math.PI/180),A.forEach((P,B)=>{R.fillText(P,0,B*L)})})}drawYAxis(t,n="y",i){var a,s,o,r,l,c,u,d;const{ctx:h,painter:f,theme:{style:{axis:g}}}=this,{config:p,scale:_,state:x}=t,{margin:m,width:v,height:b}=x,y=(i==null?void 0:i.margin)||m,T=(a=i==null?void 0:i.width)!=null?a:v,w=(s=i==null?void 0:i.height)!=null?s:b,C=(i==null?void 0:i.prefix)||`axis_${n}`,k=(i==null?void 0:i.scale)||_[n],S=n==="y2",A=p.axis_rotated,L=i!=null&&i.index?t.getAxisSize(n)*i.index:0,E=f.crisp(y.left+(S?T+(A?0:L):-L),g.lineWidth),D=f.crisp(y.top+(A?S?-L-1:w+L:0),g.lineWidth),R=y.left,P=y.left+T,B=y.top,M=y.top+w,X=(i==null?void 0:i.ticks)||Bn(t,n),G=(i==null?void 0:i.ticks)||(p[`${C}_tick_culling`]&&p[`${C}_tick_culling_lines`]!==!1?Bn(t,n,void 0,!1):X),Z=(i==null?void 0:i.format)||((l=(r=(o=t.axis)==null?void 0:o[n])==null?void 0:r.tickFormat)==null?void 0:l.call(r))||((c=p[`${C}_tick_format`])==null?void 0:c.bind(t.api))||(Pt=>Pt),et=i?i.outerTick:p[`${C}_tick_outer`],rt=A?S?p.axis_y2_tick_inner?1:-1:p.axis_y_tick_inner?-1:1:S?p.axis_y2_tick_inner?-1:1:p.axis_y_tick_inner?1:-1,xt=fd(p,A,S),gt=ed(A,S),wt=(i==null?void 0:i.tickTextPosition)||p[`${C}_tick_text_position`]||p[`axis_${n}_tick_text_position`],_t=(u=i==null?void 0:i.tickShow)!=null?u:i?!0:p[`${C}_tick_show`],mt=(d=i==null?void 0:i.tickTextShow)!=null?d:i?!0:p[`${C}_tick_text_show`];f.withState(()=>{h.strokeStyle=g.lineColor,h.lineWidth=g.lineWidth,f.strokePath(()=>{A?f.traceLine(R,D,P,D):f.traceLine(E,B,E,M),et&&(A?(f.traceLine(R,D,R,D+dt*xt),f.traceLine(P,D,P,D+dt*xt)):(f.traceLine(E,B,E+dt*xt,B),f.traceLine(E,M,E+dt*xt,M)))});const Pt=zn(g,n);h.font=Pt,h.fillStyle=g.labelColor,h.textAlign=A?"center":gt>0?"left":"right",h.textBaseline=A?gt>0?"top":"bottom":"middle",h.strokeStyle=g.tickColor,h.lineWidth=g.tickWidth;const Dt=[],Lt=[],$e=(jt,Be)=>{const hn=On(t,jt,n),Hi=y.left+k(hn),ji=y.top+k(hn);Ye(A?Hi:ji)&&Be.push({tick:jt,tx:Hi,ty:ji})};for(const jt of X)$e(jt,Dt);for(const jt of G)$e(jt,Lt);if(_t&&f.strokePath(()=>{for(const{tx:jt,ty:Be}of Lt)A?f.traceLine(jt,D,jt,D+dt*rt):f.traceLine(E,Be,E+dt*rt,Be)}),mt)for(const{tick:jt,tx:Be,ty:hn}of Dt)A?f.text(qs(Z,jt),Be+(wt.x||0),D+dt*gt+(wt.y||0)):f.text(qs(Z,jt),E+(dt+Je)*gt+(wt.x||0),hn+(wt.y||0))})}}const oe={canvas:"bb-canvas",overlay:"bb-canvas-overlay",legend:"bb-canvas-legend",legendBottom:"bb-canvas-legend-bottom",legendInset:"bb-canvas-legend-inset",legendItemInteractive:"bb-legend-item-interactive",legendItemTileCircle:"bb-legend-item-tile-circle",legendItemTitle:"bb-legend-item-title",legendRight:"bb-canvas-legend-right"};var Im=oe,md=Object.defineProperty,vd=(e,t,n)=>t in e?md(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mn=(e,t,n)=>vd(e,typeof t!="symbol"?t+"":t,n);class bd{constructor(){mn(this,"canvas"),mn(this,"ctx"),mn(this,"dpr",1),mn(this,"frame",null),mn(this,"frameCtx",null),mn(this,"frameValid",!1)}init(t,n,i){this.canvas=nt.createElement("canvas"),this.canvas.className=oe.canvas,this.canvas.style.display="block",t.appendChild(this.canvas),this.dpr=N.devicePixelRatio||1,this.ctx=this.canvas.getContext("2d"),this.resize(n,i)}resize(t,n){const i=Math.max(0,t),a=Math.max(0,n);this.dpr=N.devicePixelRatio||1,this.canvas.width=i*this.dpr,this.canvas.height=a*this.dpr,this.canvas.style.width=`${i}px`,this.canvas.style.height=`${a}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.frame=null,this.frameCtx=null,this.frameValid=!1}clearOverlay(){this.frameValid&&this.restoreFrame()}withOverlay(t){const{ctx:n}=this;this.frameValid?this.clearOverlay():this.captureFrame(),n.save(),n.setTransform(this.dpr,0,0,this.dpr,0,0);try{t(n)}finally{n.restore()}}beginFrame(t,n){const{ctx:i}=this;this.frameValid=!1,i.save(),i.setTransform(this.dpr,0,0,this.dpr,0,0),i.clearRect(0,0,t,n)}endFrame(){this.ctx.restore()}captureFrame(){const{canvas:t}=this;if(this.frameValid=!1,t.width&&t.height){let{frame:n,frameCtx:i}=this;if(!n){const a=nt.createElement("canvas");n=a,i=a.getContext("2d"),this.frame=n,this.frameCtx=i}if(!n||!i)return;i.setTransform(1,0,0,1,0,0),n.width!==t.width||n.height!==t.height?(n.width=t.width,n.height=t.height):i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),this.frameValid=!0}}restoreFrame(){if(!this.frameValid||!this.frame||!this.frameCtx)return;const{canvas:t,ctx:n}=this;n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.drawImage(this.frame,0,0),n.restore(),n.setTransform(this.dpr,0,0,this.dpr,0,0)}destroy(){var t;(t=this.canvas)==null||t.remove(),this.frame=null,this.frameCtx=null,this.frameValid=!1}}function xa(e){const{config:t,state:n}=e;return!!(t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&t.subchart_show&&t.subchart_brush_enabled===!1&&n.width2>0&&n.height2>0)}function ao(e,t){var n;const{config:i,scale:a,state:s}=e,o=a.zoom||a.x,r=a.subX;if(!o||!r)return null;const l=i.axis_rotated?s.height2:s.width2,c=i.axis_rotated?s.height:s.width,u=(n=r.invert)==null?void 0:n.call(r,t);let d=u==null?NaN:o(u);return!Number.isFinite(d)&&l>0&&(d=Math.max(0,Math.min(1,t/l))*c),Number.isFinite(d)?Math.max(0,Math.min(c,d)):null}const ma=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,so=/([aAcChHlLmMqQsStTvVzZ])|([-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?)/g;function yd(e){const t=new Set;let n=-1,i=0,a=!1,s;for(so.lastIndex=0;s=so.exec(e);)if(s[1])a=s[1]==="a"||s[1]==="A",i=0;else if(n++,a){const o=i%7;(o===2||o===3||o===4)&&t.add(n),i++}return t}function Td(e,t){const n=yd(t),i=[],a=[];let s=0,o=-1,r=-1,l,c;const u=f=>{i[o]?i[o]+=f:i[++o]=f};ma.lastIndex=0;const d=ma,h=new RegExp(ma.source,"g");for(e+="",t+="";(l=d.exec(e))&&(c=h.exec(t));){if(r++,c.index>s&&u(t.slice(s,c.index)),l[0]===c[0])u(c[0]);else{const f=+l[0],g=+c[0],p=n.has(r);i[++o]=null,a.push({index:o,fn:p?_=>Math.round(f+(g-f)*_):_=>f+(g-f)*_})}s=h.lastIndex}if(s<t.length&&u(t.slice(s)),!a.length){const f=i.join("");return()=>f}return f=>{for(let g=0,p=a.length;g<p;g++){const{index:_,fn:x}=a[g];i[_]=String(x(f))}return i.join("")}}function xi(e){const{bar_radius:t,bar_radius_ratio:n}=e.config;return $(t)&&t>0?()=>t:$(n)?i=>i*n:null}function va(e){const{config:t,data:n}=e,i=new Set;if(!t.data_groups.length)return i;const a=e.orderTargets(e.filterTargetsToShow(n.targets.filter(e.isBarType,e)));for(const s of t.data_groups){const o=new Set(s),r=new Map,l=new Map;for(const c of a)if(o.has(c.id))for(const u of c.values)u.value===null||u.value===0||(u.value>0?r:l).set(u.index,c.id);for(const[c,u]of r)i.add(`${u}:${c}`);for(const[c,u]of l)i.add(`${u}:${c}`)}return i}function wd(e,t,n){return n?e?t?{tl:n,bl:n}:{tr:n,br:n}:t?{br:n,bl:n}:{tl:n,tr:n}:0}function Cd(e,t,n,i){let a="";return n?i&&e[0]<t?a=`0 ${t-e[0]}px 0 0`:!i&&e[0]>t&&(a=`0 0 0 ${e[0]-t}px`):i&&e[1]>t?a=`${e[1]-t}px 0 0 0`:!i&&e[1]<t&&(a=`0 0 ${t-e[1]}px 0`),a?`inset(${a})`:null}function ba(e,t,n,i,a,s){const{config:o,state:r}=e,l=o.axis_rotated,c=+l,u=+!c,d=t.value<0,h=o[`axis_${e.axis.getId(t.id)}_inverted`],f=!h&&d||h&&!d,g=e.isGrouped(t.id),p=i&&g&&t.value!==0?r.hiddenTargetIds.has(t.id)&&s?s(t):a.has(`${t.id}:${t.index}`):!1,_=[n[0][c],n[0][u]];let x=0;if(i){const v=l?u:c,b=Math.abs(n[2][v]-n[0][v]);x=Math.max(0,!g||p?i(b):0)}const m=l?n[1][c]+(f?x:-x):n[1][u]+(f?-x:x);return{radius:x,corners:wd(l,f,x),clipPath:x?Cd(_,m,l,f):null,indexX:c,indexY:u,isNegative:f,pos:m}}const oo="2 2";function ro(e,t,n){const i=e.axis.isTimeSeries(),a=(s,o)=>Ct(s)?o:i?Wt.call(e,s):s;return(n||[]).map(s=>{var o,r;return{start:a(s.start,(o=t[0])==null?void 0:o.x),end:a(s.end,(r=t[t.length-1])==null?void 0:r.x),style:s.style||{dasharray:oo}}})}function lo(e,t){for(let n=0,i;i=t[n];n++)if(i.start<e&&e<=i.end)return i.style;return!1}function Sd(e){const t=String((e==null?void 0:e.dasharray)||oo).split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:[2,2]}function kd(e,t,n,i,a){const s=e.config.axis_rotated,o=ro(e,t,a),r=[];for(let l=1;l<t.length;l++){const c=t[l-1],u=t[l];if(!J(c.value)||!J(u.value)){r.push({isBreak:!0});continue}const d=lo(u.x,o),h=n(c.x),f=i(c.value),g=n(u.x),p=i(u.value);r.push({start:s?[f,h]:[h,f],end:s?[p,g]:[g,p],dash:d?Sd(d):[]})}return r}function mi(e,t){return e.config.axis_rotated?[t[1],t[0]]:[t[0],t[1]]}function co(e,t,n=1){const i=t.map(h=>mi(e,h)),a=i.map(([h])=>h),s=i.map(([,h])=>h),o=Math.min(...a),r=Math.min(...s),l=Math.max(...a)-o,c=Math.max(...s)-r,u=Math.max(n,l),d=Math.max(n,c);return{x:o-(u-l)/2,y:r-(d-c)/2,w:u,h:d}}function Nn(e,t){var n,i;const a=(n=e.isGrouped)!=null&&n.call(e,t.id)&&e.circleY?e.circleY(t,t.index):e.getYScaleById(t.id)(e.getBaseValue(t)),s=(i=e.xx(t))!=null?i:NaN;return e.config.axis_rotated?{x:a,y:s}:{x:s,y:a}}function Ad(e,t,n){return{x:e.cx(t,n),y:e.cy(t,n)}}function Ld(e,t){return{body:co(e,[t[0],t[1]]),wickStart:mi(e,[t[2][0],t[2][1]]),wickEnd:mi(e,[t[2][0],t[2][2]])}}function vn(e,t,n,i=!1){if(t===n)return{x:0,y:0,w:e.state.width,h:0};const{scale:{x:a,y:s}}=e,o=a(t.x0),r=s(t.y0),l=a(t.x1)-o,c=s(t.y1)-r;return{x:o,y:r,w:i?Math.max(0,l):l,h:i?Math.max(0,c):c}}function Rd(e,t,n,i){const{config:a}=e,{id:s,value:o,ratio:r=0}=t,l=a.treemap_label_format,c=typeof l=="function"?l.bind(e.api)(o,r,s,{width:n,height:i}):`${s}
15
+ ${(r*100).toFixed(2)}%`;return c==null?null:String(c)}var pt=bt(4),Ed=Object.defineProperty,Pd=Object.defineProperties,Dd=Object.getOwnPropertyDescriptors,uo=Object.getOwnPropertySymbols,Id=Object.prototype.hasOwnProperty,Md=Object.prototype.propertyIsEnumerable,ho=(e,t,n)=>t in e?Ed(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fo=(e,t)=>{for(var n in t||(t={}))Id.call(t,n)&&ho(e,n,t[n]);if(uo)for(var n of uo(t))Md.call(t,n)&&ho(e,n,t[n]);return e},go=(e,t)=>Pd(e,Dd(t));function po(e,t){return t?n=>{var i;const a=(i=e.getSubchartCandlestickShapeValue)==null?void 0:i.call(e,n,!0);return a===void 0?e.getBaseValue(n):a}:n=>e.getBaseValue(n)}function _o(e,t,n){return n?t.map(i=>{var a;const s=(a=e.getSubchartCandlestickShapeValue)==null?void 0:a.call(e,i,n);return s===void 0?i:go(fo({},i),{value:s})}):t}function Fd(e,t,n){return e.isStepType(t)?e.convertValuesToStep(n):n}function xo(e,t,n,i){const{config:a,scale:s}=e,o=a.line_connectNull,r=a.axis_rotated,l=e.generateGetLinePoints(t,n),c=e.getYScaleById.bind(e),u=po(e,n),d=p=>(n?e.subxx:e.xx).call(e,p),h=(p,_)=>e.isGrouped(p.id)?l(p,_)[0][1]:c(p.id,n)(u(p));let f=(0,pt.line)();f=r?f.x(h).y(d):f.x(d).y(h),i&&(f=f.context(i)),o||(f=f.defined(p=>u(p)!==null));const g=n?s.subX:s.x;return p=>{const _=c(p.id,n);let x=o?e.filterRemoveNull(p.values):p.values,m=0,v=0,b;if(e.isLineType(p)){const y=a.data_regions[p.id];y&&!i&&e.lineWithRegions?(x=_o(e,x,n),e.isAreaRangeType(p)&&(x=x.map(T=>go(fo({},T),{value:e.getRangedData(T,"mid")}))),e.isStepType(p)&&(x=e.convertValuesToStep(x)),b=e.lineWithRegions(x,s.zoom||g,_,y)):b=f.curve(e.getCurve(p))(Fd(e,p,x))}else x[0]&&(m=g(x[0].x),v=_(u(x[0]))),b=r?`M ${v} ${m}`:`M ${m} ${v}`;return b||(i?void 0:"M 0 0")}}function mo(e,t,n,i){const{config:a}=e,s=a.line_connectNull,o=a.axis_rotated,r=e.generateGetAreaPoints(t,n),l=e.getYScaleById.bind(e),c=po(e,n),u=new Map,d=p=>{let _=u.get(p);return _===void 0&&(_=e.getShapeYMin(p,n),u.set(p,_)),_},h=p=>(n?e.subxx:e.xx).call(e,p),f=(p,_)=>e.isGrouped(p.id)?r(p,_)[0][1]:l(p.id,n)(e.isAreaRangeType(p)?e.getRangedData(p,"high"):d(p.id)),g=(p,_)=>e.isGrouped(p.id)?r(p,_)[1][1]:l(p.id,n)(e.isAreaRangeType(p)?e.getRangedData(p,"low"):c(p));return p=>{let _=s?e.filterRemoveNull(p.values):p.values,x=0,m=0,v;if(e.isAreaType(p)){let b=(0,pt.area)();b=o?b.y(h).x0(f).x1(g):b.x(h).y0(a.area_above?0:a.area_below?n?e.state.height2:e.state.height:f).y1(g),i&&(b=b.context(i)),s||(b=b.defined(y=>c(y)!==null)),_=_o(e,_,n),e.isStepType(p)&&(_=e.convertValuesToStep(_)),v=b.curve(e.getCurve(p))(_)}else _[0]&&(x=(n?e.scale.subX:e.scale.x)(_[0].x),m=e.getYScaleById(p.id,n)(c(_[0]))),v=o?`M ${m} ${x}`:`M ${x} ${m}`;return v||(i?void 0:"M 0 0")}}let Re;function vi(e,t){if(!$(t)||t>=1)return e;const n=e.match(/^#([\da-f]{3}|[\da-f]{6})$/i);if(n){const s=(n[1].length===3?n[1].split("").map(r=>r+r).join(""):n[1]).match(/.{2}/g);return s?`rgba(${s.map(r=>parseInt(r,16)).join(",")},${t})`:e}if(/^rgb\(/i.test(e))return e.replace(/^rgb\((.*)\)$/i,`rgba($1,${t})`);if(/^rgba\(/i.test(e))return e.replace(/^rgba\((.*),\s*([\d.]+)\)$/i,(a,s,o)=>`rgba(${s},${Number(o)*t})`);const i=Od(e);return i&&i!==e?vi(i,t):e}function Od(e){if(!N.document||(Re===void 0&&(Re=N.document.createElement("canvas").getContext("2d")),!Re))return null;Re.fillStyle="#000",Re.fillStyle=e;const t=Re.fillStyle;Re.fillStyle="#fff",Re.fillStyle=e;const n=Re.fillStyle;return t===n?t:null}function Xn(e,t,n,i){const a=t(n,i),s=co(e,a);return Tt(s.x,s.y)&&Tt(s.x+s.w,s.y+s.h)?{points:a,rect:s}:null}function Gn(e,t,n,i){const a=t(n,i),{body:s,wickStart:o,wickEnd:r}=Ld(e,a);return Tt(s.x,s.y)&&Tt(s.x+s.w,s.y+s.h)&&Tt(o[0],o[1])&&Tt(r[0],r[1])?{body:s,points:a,wickStart:o,wickEnd:r}:null}const $d=1.2;function ya(e,t){var n,i,a;let{value:s}=t;if((n=e.isBubbleZType)!=null&&n.call(e,t))s=e.getBubbleZData(s,"z");else if((i=e.isCandlestickType)!=null&&i.call(e,t)){const o=(a=e.getCandlestickData)==null?void 0:a.call(e,t);o&&(s=o.close)}return s}function vo(e,t){const n=e.dataLabelFormat(t.id)(ya(e,t),t.id,t.index,[]);return n==null?null:String(n)}function bo(e){return`${e.id}:${e.index}`}function Ta(e,t,n){var i;if(!(t!=null&&t.length))return()=>!1;if(e.config.tooltip_grouped&&t.length>1){const s=(i=t[0])==null?void 0:i.index;return o=>s!==void 0&&o.index===s&&n(e,o)}const a=new Set(t.filter(s=>s&&n(e,s)).map(bo));return s=>a.has(bo(s))}function bi(e,t,n,i){const a=e.config.data_labels_position;let s;if(z(a))s=a.bind(e.api)(n,ya(e,t),t.id,t.index,i);else if(a){const o=t.id in a?a[t.id]:a;s=o==null?void 0:o[n]}return $(s)?s:0}function Bd(e,t){var n,i;const a=(n=e.config.data_labels)==null?void 0:n.image;if(z(a))return(i=a.call(e.api,ya(e,t),t.id,t.index))!=null?i:null;if(a){const{url:s="",width:o=0,height:r=0,pos:l}=a;return{url:s,width:o,height:r,pos:l}}return null}function zd(e,t){return an(e.url,{ID:t.id})}function Nd(e,t,n,i,a,s){var o,r,l;const{width:c=0,height:u=0,pos:d}=t,h=c/2,f=u/2,g=wa(e.canvasEngine.ctx,n,i,a).h,p=de(e.canvasEngine.ctx.font),_=i-h,x=a-f-((o=e.isTreemapType)!=null&&o.call(e,s)?p*.7:g/2);let m=i,v=a;return e.config.axis_rotated?m+=h:v+=f,{x:_+((r=d==null?void 0:d.x)!=null?r:0),y:x+((l=d==null?void 0:d.y)!=null?l:0),textX:m,textY:v}}function yo(e,t,n){var i,a,s;const o=(i=e.updateTextColor)==null?void 0:i.call(e,t);return typeof o=="string"?o:(a=e.isTreemapType)!=null&&a.call(e,t)?n:((s=e.color)==null?void 0:s.call(e,t))||n}function Xd(e,t){var n;const i=e.config.data_labels_backgroundColors;if(!i)return null;if(Q(i))return i;if(z(i)){const s=(n=e.color)==null?void 0:n.call(e,t),o=i.bind(e.api)(s,t);return o==null?null:String(o)}const a=i[t.id];return a==null?null:String(a)}function Gd(e){var t,n,i;if(!e)return null;const a=tt(e)?e:{};return{padding:Rs((t=a.padding)!=null?t:"3 5"),radius:$(a.radius)?a.radius:10,stroke:(n=a.stroke)!=null?n:"#000",strokeWidth:$(a.strokeWidth)?a.strokeWidth:1,fill:(i=a.fill)!=null?i:"none"}}function wa(e,t,n,i,a={top:0,right:0,bottom:0,left:0}){var s,o;const r=t.split(`
16
+ `),l=r.map(x=>e.measureText(x)),c=Math.max(...l.map(x=>x.width),0),u=de(e.font),d=u*$d,h=l[0]?(l[0].fontBoundingBoxAscent||0)+(l[0].fontBoundingBoxDescent||0):0,f=l[0]&&(l[0].fontBoundingBoxDescent||l[0].actualBoundingBoxDescent)||0,g=r.length>1?d*r.length:Math.max(u,h,((s=l[0])==null?void 0:s.actualBoundingBoxAscent)+((o=l[0])==null?void 0:o.actualBoundingBoxDescent)||0);let p=n,_=i;return e.textAlign==="center"?p-=c/2:(e.textAlign==="right"||e.textAlign==="end")&&(p-=c),e.textBaseline==="middle"?_-=g/2:e.textBaseline==="alphabetic"?_-=g-f:(e.textBaseline==="bottom"||e.textBaseline==="ideographic")&&(_-=g),{x:p-a.left,y:_-a.top,w:c+a.left+a.right,h:g+a.top+a.bottom}}function To(e,t,n,i,a,s){var o,r;const l=t.context,c=Xd(e,n),u=Gd((o=e.config.data_labels)==null?void 0:o.border),d=(r=u==null?void 0:u.padding)!=null?r:{top:0,right:0,bottom:0,left:0},h=wa(l,i,a,s,d),f=e.config.data_labels.rotate;t.withState(g=>{var p;f&&(g.translate(a,s),g.rotate(f*Math.PI/180),h.x-=a,h.y-=s),c&&t.fillRoundRect(h,(p=u==null?void 0:u.radius)!=null?p:0,{fill:c}),u&&(u.fill!=="none"&&t.fillRoundRect(h,u.radius,{fill:u.fill}),t.strokeRoundRect(h,u.radius,{stroke:u.stroke,lineWidth:u.strokeWidth}))})}function Vd(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function Wd(e){return e==="start"?"left":e==="end"?"right":"center"}function Yd(e,t,n,i){var a,s,o;const r=Vd(e.config.data_labels.rotate),l=e.config.axis_rotated,c=e.config[`axis_${(a=e.axis)==null?void 0:a.getId(t.id)}_inverted`],u=Yt(e,t),{value:d}=t,h=$(d)&&d<0||u&&!((o=(s=e.getCandlestickData)==null?void 0:s.call(e,t))!=null&&o._isUp),f=4,g=f*2;return l?r==="start"?(n+=h?0:g,i+=f):r==="middle"?(n+=g,i-=g):r==="end"&&(h&&(n-=g),i+=f):(r==="start"?(n+=f,h&&(i+=g*2)):r==="middle"?i-=g:r==="end"&&(n-=f,h&&(i+=g*2)),c&&(i+=h?-17:u?13:7)),{x:n,y:i,textAlign:Wd(r)}}function wo(e,t,n,i,a){var s;if(e.config.axis_rotated)i+=6,t.textAlign="left",t.textBaseline="middle";else if(We(e,n))t.textAlign="center",t.textBaseline="middle";else{const{config:o,state:r}=e,l=o[`axis_${(s=e.axis)==null?void 0:s.getId(n.id)}_inverted`],c=n.value<0||n.value===0&&!r.hasPositiveValue&&r.hasNegativeValue;let u=3;$(o.point_r)&&o.point_r>5&&(xn(e,n)||Ve(e,n))&&(u+=o.point_r/2.3),t.textAlign="center",(l?!c:c)?(a+=u,t.textBaseline="top"):(a-=u*2,t.textBaseline="bottom")}return{x:i,y:a}}var Hd=Object.defineProperty,Co=Object.getOwnPropertySymbols,jd=Object.prototype.hasOwnProperty,Ud=Object.prototype.propertyIsEnumerable,So=(e,t,n)=>t in e?Hd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ee=(e,t)=>{for(var n in t||(t={}))jd.call(t,n)&&So(e,n,t[n]);if(Co)for(var n of Co(t))Ud.call(t,n)&&So(e,n,t[n]);return e};const ko={x:0,y:0,w:8,h:8},Ca=new Map,Ao=[1,0,0,1,0,0];function Kd(e){return e==="circle"||e==="rectangle"}function Bt(e,t,n=0){const i=e.getAttribute(t),a=i===null?NaN:parseFloat(i);return Number.isFinite(a)?a:n}function Zd(e){const t=(e.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi)||[]).map(Number).filter(Number.isFinite),n=[];for(let i=0;i<t.length-1;i+=2)n.push([t[i],t[i+1]]);return n}function qd(e){const t=(e==null?void 0:e.trim().split(/[\s,]+/).map(Number).filter(Number.isFinite))||[];return t.length===4?{x:t[0],y:t[1],w:t[2],h:t[3]}:null}function Lo(e){const t=e.map(([s])=>s),n=e.map(([,s])=>s),i=Math.min(...t),a=Math.min(...n);return{x:i,y:a,w:Math.max(...t)-i,h:Math.max(...n)-a}}function Jd(e){const t=e.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)&&Number.isFinite(o.w)&&Number.isFinite(o.h));if(!t.length)return Ee({},ko);const n=Math.min(...t.map(o=>o.x)),i=Math.min(...t.map(o=>o.y)),a=Math.max(...t.map(o=>o.x+o.w)),s=Math.max(...t.map(o=>o.y+o.h));return{x:n,y:i,w:a-n,h:s-i}}function Vn(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Qd(e){let t=[...Ao];return((e==null?void 0:e.match(/[a-z]+\([^)]*\)/gi))||[]).forEach(n=>{var i;const[,a,s]=n.match(/^([a-z]+)\(([^)]*)\)$/i)||[],o=a==null?void 0:a.toLowerCase(),r=((s==null?void 0:s.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi))||[]).map(Number).filter(Number.isFinite);let l=null;if(o==="matrix"&&r.length>=6)l=r.slice(0,6);else if(o==="translate"&&r.length)l=[1,0,0,1,r[0],r[1]||0];else if(o==="scale"&&r.length)l=[r[0],0,0,(i=r[1])!=null?i:r[0],0,0];else if(o==="rotate"&&r.length){const c=r[0]*Math.PI/180,u=Math.cos(c),d=Math.sin(c),h=[u,d,-d,u,0,0];l=r.length>=3?Vn(Vn([1,0,0,1,r[1],r[2]],h),[1,0,0,1,-r[1],-r[2]]):h}else o==="skewx"&&r.length?l=[1,0,Math.tan(r[0]*Math.PI/180),1,0,0]:o==="skewy"&&r.length&&(l=[1,Math.tan(r[0]*Math.PI/180),0,1,0,0]);l&&(t=Vn(t,l))}),t}function He(e,t){const n=e.getAttribute("style"),i=e.getAttribute(t),a=n==null?void 0:n.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"));return((a==null?void 0:a[1])||i||"").trim()||null}function th(e,t){const n=Ee({},t),i=He(e,"fill"),a=He(e,"stroke"),s=He(e,"stroke-width"),o=He(e,"opacity"),r=He(e,"fill-opacity"),l=He(e,"stroke-opacity");if(i&&(n.fill=i==="none"?null:i),a&&(n.stroke=a==="none"?null:a),s){const c=parseFloat(s);Number.isFinite(c)&&(n.lineWidth=c)}return[o,r,l].forEach(c=>{var u;const d=c===null?NaN:parseFloat(c);Number.isFinite(d)&&(n.alpha=((u=n.alpha)!=null?u:1)*d)}),n}function eh(e){const t=new Map;return Array.from(e.querySelectorAll("[id]")).forEach(n=>{const i=n.getAttribute("id");i&&t.set(i,n)}),t}function me(e,t){const n=e==null?void 0:e.trim();return n?/%$/.test(n)?n:parseFloat(n):t}function ve(e,t,n,i){if(typeof e=="number")return Number.isFinite(e)?e:i;if(typeof e=="string"&&/%$/.test(e)){const s=parseFloat(e);return Number.isFinite(s)?t+n*s/100:i}const a=parseFloat(e!=null?e:"");return Number.isFinite(a)?a:i}function nh(e){const t=(e==null?void 0:e.trim())||"0",n=parseFloat(t),i=/%$/.test(t)?n/100:n;return Math.max(0,Math.min(1,Number.isFinite(i)?i:0))}function ih(e){return Array.from(e.children||[]).filter(t=>t.tagName.toLowerCase()==="stop").map(t=>{const n=He(t,"stop-color")||"#000",i=He(t,"stop-opacity"),a=i===null?NaN:parseFloat(i);return{offset:nh(t.getAttribute("offset")),color:n,opacity:Number.isFinite(a)?a:void 0}})}function ah(e){const t=new Map;return e.forEach((n,i)=>{const a=n.tagName.toLowerCase(),s=ih(n);s.length&&(a==="lineargradient"?t.set(i,{type:"linearGradient",x1:me(n.getAttribute("x1"),"0%"),y1:me(n.getAttribute("y1"),"0%"),x2:me(n.getAttribute("x2"),"100%"),y2:me(n.getAttribute("y2"),"0%"),stops:s}):a==="radialgradient"&&t.set(i,{type:"radialGradient",cx:me(n.getAttribute("cx"),"50%"),cy:me(n.getAttribute("cy"),"50%"),r:me(n.getAttribute("r"),"50%"),fx:me(n.getAttribute("fx"),"50%"),fy:me(n.getAttribute("fy"),"50%"),fr:me(n.getAttribute("fr"),0),stops:s}))}),t}function Sa(e,t,n,i=Ao,a={},s=new Set){const o=e.tagName.toLowerCase(),r=Array.from(e.children||[]),l=th(e,a),c=Vn(i,Qd(e.getAttribute("transform"))),u={matrix:c,style:l};if(o==="defs")return[];if(o==="svg"||o==="g"||o==="symbol")return r.reduce((d,h)=>d.concat(Sa(h,t,n,c,l,s)),[]);if(o==="use"){const d=e.getAttribute("href")||e.getAttribute("xlink:href")||"",h=d.charAt(0)==="#"?d.slice(1):"",f=h&&n.get(h);if(!f||s.has(h))return[];const g=Bt(e,"x",0),p=Bt(e,"y",0),_=Vn(c,[1,0,0,1,g,p]);s.add(h);const x=Sa(f,t,n,_,l,s);return s.delete(h),x}if(o==="polygon"||o==="polyline"){const d=Zd(e.getAttribute("points")||"");return d.length?[Ee({type:o,points:d,box:Lo(d)},u)]:[]}if(o==="circle"){const d=Bt(e,"cx",0),h=Bt(e,"cy",0),f=Bt(e,"r",0);return f>0?[Ee({type:"circle",cx:d,cy:h,r:f,box:{x:d-f,y:h-f,w:f*2,h:f*2}},u)]:[]}if(o==="ellipse"){const d=Bt(e,"cx",0),h=Bt(e,"cy",0),f=Bt(e,"rx",0),g=Bt(e,"ry",0);return f>0&&g>0?[Ee({type:"ellipse",cx:d,cy:h,rx:f,ry:g,box:{x:d-f,y:h-g,w:f*2,h:g*2}},u)]:[]}if(o==="rect"){const d=Bt(e,"x",0),h=Bt(e,"y",0),f=Bt(e,"width",0),g=Bt(e,"height",0);return f>0&&g>0?[Ee({type:"rect",x:d,y:h,w:f,h:g,box:{x:d,y:h,w:f,h:g}},u)]:[]}if(o==="line"){const d=Bt(e,"x1",0),h=Bt(e,"y1",0),f=Bt(e,"x2",0),g=Bt(e,"y2",0);return[Ee({type:"line",x1:d,y1:h,x2:f,y2:g,box:Lo([[d,h],[f,g]])},u)]}if(o==="path"){const d=e.getAttribute("d")||"";return d?[Ee({type:"path",d,box:t},u)]:[]}return[]}function sh(e){if(!/^</.test(e))return null;if(Ca.has(e))return Ca.get(e)||null;let t=null;try{const i=new N.DOMParser().parseFromString(Se(e),"image/svg+xml").documentElement,a=qd(i.getAttribute("viewBox"))||ko,s=eh(i),o=Sa(i,a,s);o.length&&(t={shapes:o,box:i.tagName.toLowerCase()==="svg"?a:Jd(o.map(r=>r.box)),paints:ah(s)})}catch(n){t=null}return Ca.set(e,t),t}function oh(e,t){if(t.type==="polygon"||t.type==="polyline"){const[n,...i]=t.points;e.moveTo(n[0],n[1]),i.forEach(([a,s])=>e.lineTo(a,s)),t.type==="polygon"&&e.closePath()}else t.type==="circle"?(e.moveTo(t.cx+t.r,t.cy),e.arc(t.cx,t.cy,t.r,0,Math.PI*2)):t.type==="ellipse"?(e.moveTo(t.cx+t.rx,t.cy),e.ellipse(t.cx,t.cy,t.rx,t.ry,0,0,Math.PI*2)):t.type==="rect"?e.rect(t.x,t.y,t.w,t.h):t.type==="line"&&(e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2))}function yi(e){const t=e==null?void 0:e.match(/^url\(#([^)]+)\)$/);return(t==null?void 0:t[1])||null}function Ro(e,t,n){const{x:i,y:a,w:s,h:o}=n,r=t.type==="linearGradient"?e.createLinearGradient(ve(t.x1,i,s,i),ve(t.y1,a,o,a),ve(t.x2,i,s,i+s),ve(t.y2,a,o,a)):e.createRadialGradient(ve(t.fx,i,s,i+s/2),ve(t.fy,a,o,a+o/2),ve(t.fr,i,Math.max(s,o),0),ve(t.cx,i,s,i+s/2),ve(t.cy,a,o,a+o/2),Math.max(.01,ve(t.r,0,Math.max(s,o),Math.max(s,o)/2)));return t.stops.forEach(({offset:l,color:c,opacity:u})=>{r.addColorStop(l,u===void 0?c:vi(c,u))}),r}function rh(e,t,n,i,a){const s=Ee({},t||{});if(n.fill!==void 0)if(n.fill===null)delete s.fill;else if(yi(n.fill)){const o=i.get(yi(n.fill));o&&(s.fill=Ro(e,o,a))}else/^url\(/.test(n.fill)||(s.fill=n.fill);if(n.stroke!==void 0)if(n.stroke===null)delete s.stroke;else if(yi(n.stroke)){const o=i.get(yi(n.stroke));o&&(s.stroke=Ro(e,o,a))}else/^url\(/.test(n.stroke)||(s.stroke=n.stroke);return n.lineWidth!==void 0&&(s.lineWidth=n.lineWidth),{style:s,shouldFill:n.fill!==null&&(!s.stroke||s.fill!==void 0),shouldStroke:n.stroke!==null&&s.stroke!==void 0,alpha:n.alpha}}function Wn(e,t,n,i,a,s,o=a){if(Kd(t)){e.point(t,n,i,a,s);return}const r=sh(t);if(!r||a<=0){e.point("circle",n,i,a,s);return}e.withState(l=>{const{box:c,paints:u,shapes:d}=r,h=o>0?a/o:1,f=g=>{const{style:p,shouldFill:_,shouldStroke:x,alpha:m}=rh(l,s,g.style,u,c);if(l.save(),e.applyStyle(p),m!==void 0&&(l.globalAlpha*=m),l.transform(...g.matrix),l.beginPath(),g.type==="path"){if(N.Path2D){const v=g.path2D||(g.path2D=new N.Path2D(g.d));_&&l.fill(v),x&&l.stroke(v)}}else oh(l,g),_&&l.fill(),x&&l.stroke();l.restore()};l.translate(n-(c.x+c.w/2)*h,i-(c.y+c.h/2)*h),l.scale(h,h),d.forEach(f)})}var lh=Object.defineProperty,ch=Object.defineProperties,uh=Object.getOwnPropertyDescriptors,Eo=Object.getOwnPropertySymbols,dh=Object.prototype.hasOwnProperty,hh=Object.prototype.propertyIsEnumerable,ka=(e,t,n)=>t in e?lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Po=(e,t)=>{for(var n in t||(t={}))dh.call(t,n)&&ka(e,n,t[n]);if(Eo)for(var n of Eo(t))hh.call(t,n)&&ka(e,n,t[n]);return e},Do=(e,t)=>ch(e,uh(t)),bn=(e,t,n)=>ka(e,typeof t!="symbol"?t+"":t,n);const fh=[Fn,ee,he,Yt],gh=1e3,Io=new WeakMap,Mo=new Map;function Fo(e,t){if(!t||t==="none")return;const n=t.match(/^matrix\(([^)]+)\)$/),i=t.match(/^matrix3d\(([^)]+)\)$/);if(n){const a=n[1].split(",").map(s=>Number(s.trim()));a.length===6&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[2],a[3],a[4],a[5])}else if(i){const a=i[1].split(",").map(s=>Number(s.trim()));a.length===16&&a.every(Number.isFinite)&&e.transform(a[0],a[1],a[4],a[5],a[12],a[13])}}function ph(e,t,n){const i=e.naturalWidth||e.width,a=e.naturalHeight||e.height;if(!i||!a||!t||!n)return{x:0,y:0,w:t,h:n};const s=Math.min(t/i,n/a),o=i*s,r=a*s;return{x:(t-o)/2,y:(n-r)/2,w:o,h:r}}function _h(e){const{state:t}=e;return t.hasFunnel||t.hasTreemap?{x:0,y:0}:{x:gn(t.margin.left),y:gn(t.margin.top)}}function Oo(e,t,n,i,a=!1){i.strokePath(s=>{xo(e,n,a,s)(t)},{lineDash:[]})}function $o(e,t,n,i,a=!1){i.fillPath(s=>{mo(e,n,a,s)(t)})}function Bo(e,t){const n=Ae(e,t);return n.start===0&&n.end===t.values.length?t:Do(Po({},t),{values:t.values.slice(n.start,n.end)})}function Aa(e,t){if(!(e!=null&&e.length)||!(t!=null&&t.id))return null;let n=Io.get(e);if(!n){n=new Map;for(const i of e){if(!(i!=null&&i.id))continue;const a=`${i.id}:*`;n.has(a)||n.set(a,i),"index"in i&&n.set(`${i.id}:${i.index}`,i)}Io.set(e,n)}return"index"in t?n.get(`${t.id}:${t.index}`)||null:n.get(`${t.id}:*`)||null}function xh(e,t){const n=N.Path2D;if(!n)return null;const i=`${e}:${t}`,a=Mo.get(i);if(a)return a;const s=new n(bs[e][t]);return Mo.set(i,s),s}function Yn(e,t){const n=e.config.color_onover;return!n||!t?null:tt(n)?t.id in n?n[t.id]:null:Q(n)?n:z(n)?n.call(e.api,t):null}function mh(e,t,n){const i=Aa(n,t);return Yn(e,i)||e.color(t.id)}function zo(e){var t;return(e==null?void 0:e.id)||((t=e==null?void 0:e.data)==null?void 0:t.id)}function No(e,t){var n;const i=zo(t);return!!i&&((n=e.state.focusedTargetIds)==null?void 0:n.has(i))}function be(e,t){var n;const i=zo(t);return i&&((n=e.state.defocusedTargetIds)!=null&&n.has(i))?e.canvasTheme.style.shape.targetDefocusedOpacity:1}function vh(e,t,n,i=!1){var a;const s=(a=e.generateGetAreaPoints)==null?void 0:a.call(e,n,i);if(!s)return null;const o=Ae(e,t);let r=1/0,l=1/0,c=-1/0,u=-1/0;for(let d=o.start;d<o.end;d++){const h=t.values[d];Rt(e,h)&&s(h,d).forEach(([f,g])=>{Tt(f,g)&&(r=Math.min(r,f),l=Math.min(l,g),c=Math.max(c,f),u=Math.max(u,g))})}return Number.isFinite(r)&&Number.isFinite(l)?{x:r,y:l,w:c-r,h:u-l}:null}function Ti(e,t,n){return t+n*($(e)?e:0)}function Xo(e,t,n,i,a,s){const o=e.config[`${i}_linearGradient`];if(!o||!a||!a.w||!a.h)return s;const r=e.config.axis_rotated,l=typeof o=="object"?o:{},c=l.x||(r?[1,0]:[0,0]),u=l.y||(r?[0,0]:[0,1]),d=Array.isArray(l.stops)?l.stops:[[0,s,1],[1,s,0]],h=t.createLinearGradient(Ti(c[0],a.x,a.w),Ti(u[0],a.y,a.h),Ti(c[1],a.x,a.w),Ti(u[1],a.y,a.h));return d.forEach(([f,g,p])=>{const _=z(g)?g.call(e.api,n.id):g,x=String(_||s),m=Number(f),v=Number.isFinite(m)?Math.max(0,Math.min(1,m)):0;h.addColorStop(v,vi(x,p))}),h}function Pe(e,t){return _n(e,t,fh)}function wi(e,t){const n=e.config.point_opacity;return Number.isFinite(n)?n:Ve(e,t)||We(e,t)?.5:1}function Hn(e,t,n){var i,a;const s=e.config.point_r;return We(e,t)||z(s)?(a=(i=e.pointR)==null?void 0:i.call(e,n))!=null?a:2.5:s}function bh(e,t,n,i){return!i&&n==="circle"&&Ve(e,t)&&!z(e.config.point_r)&&t.values.length>Is}function yh(e,t){const{bar_connectLine:n}=e.config,i=tt(n)?n[t]:n;return/^(start|end)-(start|end)$/.test(i)?i:null}function Th(e,t,n){const{indexX:i,indexY:a,pos:s}=n;return e.config.axis_rotated?{x:t[0][i],y:t[0][a],width:t[0][i]-s,height:t[2][a]-t[0][a]}:{x:t[0][i],y:s,width:t[2][i]-t[0][i],height:t[3][a]-s}}function wh(e,t,n,i,a=1){if(i.length<2)return;const s=e.config.axis_rotated,o=/^start-(start|end)$/.test(n),r=/^end-(start|end)$/.test(n),l=/\w+-end$/.test(n),c=/\w+-start$/.test(n),u=f=>({x:s?r?f.x-f.width:f.x:f.x+f.width,y:s||o?f.y+f.height:f.y}),d=f=>({x:s?f.x-(l?f.width:0):f.x,y:s?f.y:f.y+(c?f.height:0)});let h=u(i[0]);t.strokePath(()=>{for(let f=1;f<i.length;f++){const g=d(i[f]);t.traceLine(h.x,h.y,g.x,g.y),f<i.length-1&&(h=u(i[f]))}},{alpha:a,stroke:e.canvasTheme.style.shape.barConnectLineColor,lineWidth:e.canvasTheme.style.shape.barConnectLineWidth,lineDash:[]})}function La(e,t){var n;const{config:i}=e;if(We(e,t))return"circle";const a=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],s=Array.isArray(i.point_pattern)&&i.point_pattern.length?i.point_pattern:[i.point_type],o=Math.max(0,a.indexOf(t.id)),r=s[o%s.length];return/^rect(angle)?$/i.test(r)||r==="rectangle"?"rectangle":r||"circle"}function Ch(e,t,n,i,a,s,o){const r=e.config.point_radialGradient;if(!r||!s)return o;const l=tt(r)?r:{},c=$(l.cx)?l.cx:.3,u=$(l.cy)?l.cy:.3,d=$(l.r)?l.r:.7,h=Array.isArray(l.stops)?l.stops:[[.1,null,1],[.9,null,0]],f=i+(c-.5)*s*2,g=a+(u-.5)*s*2,p=t.createRadialGradient(f,g,0,f,g,Math.max(1,s*d*2));return h.forEach(([_,x,m])=>{let v=z(x)?x.bind(e.api)(n.id):x;v||(v=o);const b=Number(_),y=Number.isFinite(b)?Math.max(0,Math.min(1,b)):0;p.addColorStop(y,vi(v,m))}),p}function Go(e,t,n){const i=e.config.candlestick_color_down;return(n!=null&&n._isUp?e.color(t):i&&typeof i=="object"?i[t.id]:i)||e.color(t)}function Sh(e,t){return e.shouldDrawPointsForLine?e.shouldDrawPointsForLine(t):!0}function kh(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function Ah(e,t,n){const{config:i,scale:a}=e,s=a.zoom||a.x,o=e.getYScaleById(t.id),r=i.line_connectNull?e.filterRemoveNull(t.values):t.values;let l=e.isAreaRangeType(t)?r.map(g=>Do(Po({},g),{value:e.getRangedData(g,"mid")})):r;e.isStepType(t)&&(l=e.convertValuesToStep(l));const c=kd(e,l,s,o,i.data_regions[t.id]);let u=null,d=[];const h=()=>{if(d.length<2||!u){d=[];return}n.strokePath(g=>{const[p,..._]=d;g.moveTo(p[0],p[1]),_.forEach(x=>{g.lineTo(x[0],x[1])})},{lineDash:u}),d=[]},f=(g,p,_)=>{!u||!kh(u,_)?(h(),u=_,d=[g,p]):d.push(p)};for(const{start:g,end:p,dash:_,isBreak:x}of c){if(x||!g||!p||!_){h(),u=null;continue}if(!Tt(g[0],g[1])||!Tt(p[0],p[1])){h(),u=null;continue}f(g,p,_)}h()}class Lh{constructor(t,n){bn(this,"engine",t),bn(this,"theme",n),bn(this,"painter"),bn(this,"labelImageCache",new Map),bn(this,"backgroundImageCache",new Map),bn(this,"backgroundClassStyleCache",new Map),this.painter=new Ys(t.ctx)}get ctx(){return this.painter.context}withContext(t,n){this.painter.withContext(t,n)}destroy(){const t=n=>{n.image.onload=null,n.image.onerror=null};this.labelImageCache.forEach(t),this.backgroundImageCache.forEach(t),this.labelImageCache.clear(),this.backgroundImageCache.clear(),this.backgroundClassStyleCache.clear()}getLabelImage(t,n){if(!t||!N.Image)return null;let i=this.labelImageCache.get(t);if(!i){const a={image:new N.Image,loaded:!1,loading:!0};i=a,this.labelImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.redraw)==null||s.call(n)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundImage(t,n){if(!t||!N.Image)return null;let i=this.backgroundImageCache.get(t);if(!i){const a={image:new N.Image,loaded:!1,loading:!0};i=a,this.backgroundImageCache.set(t,i),a.image.onload=()=>{var s;a.loaded=!0,a.loading=!1,(s=n.renderCanvasFrame)==null||s.call(n,void 0,null,!1)},a.image.onerror=()=>{a.loaded=!1,a.loading=!1},a.image.src=t}return i}getBackgroundClassStyle(t,n){if(!n||!N.document)return{};const i=this.backgroundClassStyleCache.get(n);if(i)return i;const a=N.document.createElement("div");a.className=n,a.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:1px;height:1px;",t.$el.chart.node().appendChild(a);const s=N.getComputedStyle(a),o=parseFloat(s.opacity),r={opacity:Number.isFinite(o)?o:void 0,transform:s.transform||void 0};return a.remove(),this.backgroundClassStyleCache.set(n,r),r}drawBackground(t){const n=t.config.background;if(!(n!=null&&n.imgUrl)&&!(n!=null&&n.color))return;const{ctx:i,painter:a}=this,{current:s,margin:o,width:r,height:l}=t.state,c=this.getBackgroundClassStyle(t,n.class);a.withState(()=>{if(c.opacity!==void 0&&(i.globalAlpha*=c.opacity),n.imgUrl){const u=this.getBackgroundImage(n.imgUrl,t);if(u!=null&&u.loaded){const d=_h(t),h=ph(u.image,s.width,s.height);i.translate(d.x,d.y),Fo(i,c.transform),i.drawImage(u.image,h.x,h.y,h.w,h.h)}}else n.color&&(Fo(i,c.transform),a.fillRect({x:o.left,y:o.top,w:r,h:l},{fill:n.color}))})}drawLabelImage(t,n,i,a,s){const o=Bd(t,n);if(!(o!=null&&o.url))return{x:a,y:s};const r=zd(o,n),l=Nd(t,o,i,a,s,n),c=this.getLabelImage(r,t);return c!=null&&c.loaded&&this.ctx.drawImage(c.image,l.x,l.y,o.width,o.height),{x:l.textX,y:l.textY}}drawDataLabel(t,n,i,a,s){const{painter:o,theme:{style:r}}=this;if({x:a,y:s}=this.drawLabelImage(t,n,i,a,s),t.config.data_labels.rotate){const l=Yd(t,n,a,s);a=l.x,s=l.y,this.ctx.textAlign=l.textAlign}this.ctx.fillStyle=yo(t,n,r.label.color),To(t,o,n,i,a,s),o.textLines(i,a,s,{angle:t.config.data_labels.rotate})}drawFocusLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,theme:{style:s}}=this,o=n.filter(l=>l&&Rt(t,l)&&he(t,l)&&Pe(t,{id:l.id})),r={size:()=>o.length};o.length&&(a.font=s.label.font,o.forEach(l=>{const c=vo(t,l);let{x:u,y:d}=Nn(t,l);c&&({x:u,y:d}=wo(t,a,l,u,d),u+=bi(t,l,"x",r),d+=bi(t,l,"y",r),Tt(u,d)&&this.drawDataLabel(t,l,c,u,d))}))}draw(t,n,i){if(t.state.hasTreemap){this.drawTreemaps(t);return}const{margin:a,width:s,height:o}=t.state,r=()=>{t.config.area_front||this.drawAreas(t,n,i),this.drawLines(t,n),t.config.area_front&&this.drawAreas(t,n,i),this.drawCircles(t,n,i)},l=()=>{t.config.bar_front||this.drawBars(t,n,i),this.drawCandlesticks(t,n,i),r(),t.config.bar_front&&this.drawBars(t,n,i),this.drawSelections(t,n),this.drawLabels(t,n)};t.config.clipPath===!1?l():this.painter.clipRect({x:a.left,y:a.top,w:s,h:o},l)}drawSubchart(t,n){const{config:i,state:a}=t;if(!i.subchart_show||!a.hasAxis||a.width2<=0||a.height2<=0)return;const{ctx:s,painter:o,theme:{style:r}}=this,{margin2:l,width2:c,height2:u}=a,d={x:l.left,y:l.top,w:c,h:u};t.withSubchartTypeContext(()=>{var h;const f=t.filterTargetsToShow().filter(Pe.bind(null,t)),g=t.getDrawShape();(h=t.updateSubchartYDomain)==null||h.call(t,f),o.withState(()=>{o.clipRect(d,()=>{o.withTranslation(d.x,d.y,()=>{var p,_,x,m,v,b;const y=f.filter(Fn.bind(null,t)),T=te(t,g,I.AREA,Fn.bind(null,t));for(const R of y)R.values.some(Rt.bind(null,t))&&(s.globalAlpha=r.shape.areaOpacity*be(t,R),s.fillStyle=t.color(R.id),$o(t,R,T,o,!0));s.globalAlpha=1;const w=f.filter(ee.bind(null,t)),C=te(t,g,I.BAR,ee.bind(null,t)),k=(p=t.generateGetBarPoints)==null?void 0:p.call(t,C,!0);if(k){for(const R of w)s.globalAlpha=r.shape.barOpacity*be(t,R),s.fillStyle=t.color(R.id),R.values.forEach((P,B)=>{var M;if(!Rt(t,P))return;const X=Xn(t,k,P,B),G=((M=t.getSubchartCandlestickBarColor)==null?void 0:M.call(t,P,!0))||s.fillStyle;X&&o.fillRect(X.rect,{fill:G})});s.globalAlpha=1}const S=f.filter(Yt.bind(null,t)),A=te(t,g,I.CANDLESTICK,Yt.bind(null,t)),L=(_=t.generateGetCandlestickPoints)==null?void 0:_.call(t,A,!0);if(L){s.lineWidth=r.shape.candlestickLineWidth;for(const R of S){const P=be(t,R);s.globalAlpha=P,R.values.forEach((B,M)=>{var X;const G=(X=t.getCandlestickData)==null?void 0:X.call(t,B),Z=G&&Gn(t,L,B,M);if(!Z)return;const et=Go(t,{id:R.id},G);s.strokeStyle=et,s.fillStyle=et,o.strokePath(()=>{o.traceLine(Z.wickStart[0],Z.wickStart[1],Z.wickEnd[0],Z.wickEnd[1])}),o.fillRect(Z.body,{fill:s.fillStyle})})}}const E=f.filter(xn.bind(null,t)),D=te(t,g,I.LINE,xn.bind(null,t));s.globalAlpha=1;for(const R of E)R.values.some(Rt.bind(null,t))&&(s.globalAlpha=be(t,R),s.lineWidth=No(t,R)?r.shape.lineFocusedWidth:r.shape.lineWidth,s.strokeStyle=t.color(R.id),Oo(t,R,D,o,!0));if(s.globalAlpha=1,i.point_show&&!((x=t.isPointFocusOnly)!=null&&x.call(t))){const R=(m=t.updateCircleY)==null?void 0:m.call(t,!0),P=(v=t.subxx)==null?void 0:v.bind(t);if(P&&R){for(const B of f){if(!Ve(t,B)&&!We(t,B))continue;const M=t.color(B.id),X=r.shape.pointFillColor||M,G=r.shape.pointStrokeColor||M,Z=G?(b=r.shape.pointLineWidth)!=null?b:1:0,et=G&&Z>0?{fill:X,stroke:G,lineWidth:Z}:{fill:X};s.globalAlpha=wi(t,B)*be(t,B),B.values.forEach((rt,xt)=>{if(!Rt(t,rt))return;const gt=i.axis_rotated?R(rt,xt):P(rt),wt=i.axis_rotated?P(rt):R(rt,xt),_t=Math.min(Hn(t,B,rt),3);Tt(gt,wt)&&Wn(o,"circle",gt,wt,_t,et)})}s.globalAlpha=1}}})}),this.drawSubchartBrush(t)})})}drawSubchartBrush(t){var n,i;const{config:a,scale:s,state:o}=t,r=o.domain;if(!a.subchart_show||a.subchart_brush_enabled===!1||!(r!=null&&r.length)||!s.subX)return;const{margin2:l,width2:c,height2:u}=o,d=s.subX(r[0]),h=s.subX(r[1]),f=a.axis_rotated?u:c,g=(i=(n=t.axis)==null?void 0:n.getExtent)==null?void 0:i.call(n),p=Array.isArray(g)&&g.length>=2&&g.every(Number.isFinite)?g.slice(0,2):[0,f],_=Math.max(0,Math.min(f,Math.min(...p))),x=Math.max(0,Math.min(f,Math.max(...p))),m=Math.max(_,Math.min(x,Math.min(d,h))),v=Math.max(_,Math.min(x,Math.max(d,h))),b=v-m;if(b<=0)return;const y=a.axis_rotated?{x:l.left,y:l.top+m,w:c,h:b}:{x:l.left+m,y:l.top,w:b,h:u};this.painter.fillRect(y,{fill:this.theme.style.subchartBrush.fill,alpha:this.theme.style.subchartBrush.opacity}),a.subchart_showHandle&&(this.drawSubchartBrushHandle(t,m,"start"),this.drawSubchartBrushHandle(t,v,"end"))}drawSubchartBrushHandle(t,n,i){const{config:a,state:{margin2:s,width2:o,height2:r}}=t,{ctx:l,painter:c,theme:{style:u}}=this,d=a.axis_rotated,h=u.subchartBrush.handleFill,f=u.subchartBrush.handleStroke,g=d?s.left+o/2:s.left+n,p=d?s.top+n:s.top+r/2,_=xh(d?"y":"x",i);_&&c.withState(()=>{l.translate(g,p),l.fillStyle=h,l.strokeStyle=f,l.lineWidth=u.subchartBrush.handleLineWidth,l.globalAlpha=u.subchartBrush.handleOpacity,l.fill(_),l.globalAlpha=1,l.stroke(_)})}drawBars(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=ee.bind(null,t),l=Ta(t,i,ee),c=t.filterTargetsToShow().filter(r).filter(Pe.bind(null,t)),u=t.generateGetBarPoints(te(t,n,I.BAR,r),!1),{margin:d}=t.state,h=xi(t),f=h?va(t):new Set;u&&s.withTranslation(d.left,d.top,()=>{var g;for(const p of c){const _=Ae(t,p),x=yh(t,p.id),m=be(t,p),v=[],b=[];for(let y=_.start;y<_.end;y++){const T=p.values[y];if(!Rt(t,T))continue;const w=Xn(t,u,T,y);if(!w)continue;const{points:C,rect:k}=w,S=ba(t,T,C,h,f,(g=t.isStackingRadiusData)==null?void 0:g.bind(t));b.push({d:T,points:C,rect:k,radiusInfo:S}),x&&v.push(Th(t,C,S))}x&&o.shape.barConnectLineWidth>0&&wh(t,s,x,v,m);for(const{d:y,rect:T,radiusInfo:w}of b){const C=Yn(t,Aa(i,y)),k=C||t.color(p.id),A=(l(y)?o.shape.barExpandedOpacity:o.shape.barOpacity)*m;a.fillStyle=C?k:Xo(t,a,p,"bar",T,k),h?s.fillRoundRect(T,w.corners,{alpha:A}):s.fillRect(T,{alpha:A}),o.shape.barLineWidth>0&&(a.strokeStyle=o.shape.barStrokeColor,a.lineWidth=o.shape.barLineWidth,h?s.strokeRoundRect(T,w.corners,{alpha:o.shape.barOpacity*m}):s.strokeRect(T,{alpha:o.shape.barOpacity*m}))}}})}drawCandlesticks(t,n,i){var a;const{ctx:s,painter:o,theme:{style:r}}=this,l=Yt.bind(null,t),c=Ta(t,i,Yt),u=t.filterTargetsToShow().filter(l).filter(Pe.bind(null,t)),d=(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,te(t,n,I.CANDLESTICK,l),!1),{margin:h}=t.state;d&&o.withTranslation(h.left,h.top,()=>{var f;s.lineWidth=r.shape.candlestickLineWidth;for(const g of u){const p=Ae(t,g),_=be(t,g),x=r.shape.candlestickLineWidth,m=r.shape.candlestickStrokeColor||"#000";for(let v=p.start;v<p.end;v++){const b=g.values[v],y=(f=t.getCandlestickData)==null?void 0:f.call(t,b);if(!y)continue;const T=Gn(t,d,b,v);if(!T)continue;const{body:w,wickStart:C,wickEnd:k}=T;s.fillStyle=Yn(t,Aa(i,b))||Go(t,b,y),s.strokeStyle=m,s.globalAlpha=_,x>0&&o.strokePath(()=>{o.traceLine(C[0],C[1],k[0],k[1])}),o.fillRect(w,{alpha:(c(b)?r.shape.candlestickExpandedOpacity:1)*_}),x>0&&o.strokeRect(w,{alpha:_,lineWidth:x,stroke:m})}}s.globalAlpha=1})}hasExpandedShapeFocus(t,n){return!!(n!=null&&n.some(i=>i&&(ee(t,i)||Yt(t,i))))}drawLines(t,n){const{ctx:i,painter:a,theme:{style:s}}=this,o=xn.bind(null,t),r=t.filterTargetsToShow().filter(o).filter(Pe.bind(null,t)),l=te(t,n,I.LINE,o),{margin:c}=t.state;t.generateGetLinePoints&&a.withTranslation(c.left,c.top,()=>{var u;for(const d of r){const h=Bo(t,d);h.values.some(Rt.bind(null,t))&&(i.globalAlpha=be(t,d),i.lineWidth=No(t,d)?s.shape.lineFocusedWidth:s.shape.lineWidth,i.strokeStyle=t.color(d.id),(u=t.config.data_regions)!=null&&u[h.id]?Ah(t,h,a):Oo(t,h,l,a))}i.globalAlpha=1})}drawAreas(t,n,i){const{ctx:a,painter:s,theme:{style:o}}=this,r=Fn.bind(null,t),l=t.filterTargetsToShow().filter(r).filter(Pe.bind(null,t)),c=te(t,n,I.AREA,r),{margin:u}=t.state;t.generateGetAreaPoints&&s.withTranslation(u.left,u.top,()=>{for(const d of l){const h=Bo(t,d);if(!h.values.some(Rt.bind(null,t)))continue;const f=mh(t,h,i);a.globalAlpha=o.shape.areaOpacity*be(t,d),a.fillStyle=Xo(t,a,h,"area",t.config.area_linearGradient?vh(t,d,c):null,f),$o(t,h,c,s)}a.globalAlpha=1})}drawCircles(t,n,i){var a;if(!t.config.point_show||(a=t.isPointFocusOnly)!=null&&a.call(t))return;const{ctx:s,painter:o,theme:{style:r}}=this,{cx:l,cy:c}=n.pos,{margin:u}=t.state,d=Ta(t,i,he),h=!!(i!=null&&i.some(f=>f&&he(t,f)));!l||!c||o.withTranslation(u.left,u.top,()=>{var f,g,p;for(const _ of t.filterTargetsToShow()){if(!he(t,_)||!Pe(t,_)||xn(t,_)&&!Sh(t,_))continue;const x=t.color(_.id),m=La(t,_),v=be(t,_),b=!!t.config.point_radialGradient,y=bh(t,_,m,b),T=Ae(t,_),w=T.end-T.start,C=y?Fs(t.state.width,t.state.height,Hn(t,_,_.values[T.start]||_.values[0])):null,k=wi(t,_)*v;s.fillStyle=x,s.globalAlpha=k;const S=r.shape.pointFillColor||x,A=r.shape.pointStrokeColor||x,L=A?(f=r.shape.pointLineWidth)!=null?f:1:0,E=!!A&&L>0,D=E&&m==="circle"&&$(k)&&k<1&&S===A;if(!h&&!b&&m==="circle")if(s.fillStyle=S,E&&!D&&(s.strokeStyle=A,s.lineWidth=L),w>gh)for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=Hn(t,_,P),M=D?B+L/2:B,X=l(P,R),G=c(P,R);Tt(X,G)&&(C&&!Os(C,X,G)||(s.beginPath(),s.arc(X,G,M,0,Math.PI*2),s.fill(),E&&!D&&s.stroke()))}else{s.beginPath();for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=Hn(t,_,P),M=D?B+L/2:B,X=l(P,R),G=c(P,R);Tt(X,G)&&o.traceCircle(X,G,M)}s.fill(),E&&!D&&s.stroke()}else for(let R=T.start;R<T.end;R++){const P=_.values[R];if(!Rt(t,P))continue;const B=d(P),M=Hn(t,_,P),X=B?(p=(g=t.pointExpandedR)==null?void 0:g.call(t,P))!=null?p:M*1.75:M,G=l(P,R),Z=c(P,R),et=Yn(t,P),rt=et||x,xt=r.shape.pointFillColor||rt,gt=r.shape.pointStrokeColor||rt,wt=B&&(et||r.focusPoint.fill)||xt,_t=B?et||r.focusPoint.stroke||rt:gt,mt=B?r.focusPoint.lineWidth:L,Pt=wi(t,P)*v,Dt=!!_t&&(mt!=null?mt:0)>0,Lt=m==="circle"&&Dt&&$(Pt)&&Pt<1&&wt===_t,$e=Lt?X+(mt||0)/2:X;Tt(G,Z)&&(s.fillStyle=b?Ch(t,s,P,G,Z,X,rt):wt,s.globalAlpha=Pt,Wn(o,m,G,Z,$e,Dt&&!Lt?{fill:s.fillStyle,stroke:_t,lineWidth:mt}:void 0,M))}}})}drawSelections(t,n){var i,a;const s=(i=t.getCanvasSelectedData)==null?void 0:i.call(t);if(!t.config.data_selection_enabled||!(s!=null&&s.length)||t.state.hasTreemap)return;const{ctx:o,painter:r,theme:{style:l}}=this,{margin:c}=t.state,u=ee.bind(null,t),d=Yt.bind(null,t),h=s.some(u)?t.generateGetBarPoints(te(t,n,I.BAR,u),!1):null,f=s.some(d)?(a=t.generateGetCandlestickPoints)==null?void 0:a.call(t,te(t,n,I.CANDLESTICK,d),!1):null,g=h?xi(t):null,p=g?va(t):new Set;r.withTranslation(c.left,c.top,()=>{s.forEach(_=>{var x,m,v,b,y,T,w;const C=t.color(_.id);if(u(_)&&h){const k=Xn(t,h,_,_.index);if(!k)return;const{points:S,rect:A}=k,L=g?ba(t,_,S,g,p).corners:0;g?r.fillRoundRect(A,L,{fill:"#fff",alpha:.3}):r.fillRect(A,{fill:"#fff",alpha:.3}),g?r.strokeRoundRect(A,L,{stroke:C,lineWidth:2}):r.strokeRect(A,{stroke:C,lineWidth:2})}else if(d(_)&&f){if(!((x=t.getCandlestickData)==null?void 0:x.call(t,_)))return;const S=Gn(t,f,_,_.index);if(!S)return;const{body:A,wickStart:L,wickEnd:E}=S;r.strokePath(()=>{r.traceLine(L[0],L[1],E[0],E[1])},{stroke:C,lineWidth:3}),r.fillRect(A,{fill:"#fff",alpha:.3}),r.strokeRect(A,{stroke:C,lineWidth:2})}else if(he(t,_)){const k=La(t,{id:_.id}),{x:S,y:A}=Nn(t,_),L=(v=(m=t.pointR)==null?void 0:m.call(t,_))!=null?v:2.5,E=(y=(b=t.pointSelectR)==null?void 0:b.call(t,_))!=null?y:L*2;if(!Tt(S,A))return;Wn(r,"circle",S,A,E,{fill:l.selectedPoint.fill,lineWidth:l.selectedPoint.lineWidth,stroke:l.selectedPoint.stroke||C}),(T=t.isPointFocusOnly)!=null&&T.call(t)||Wn(r,k,S,A,L,{fill:l.shape.pointFillColor||C,stroke:l.shape.pointStrokeColor||C,lineWidth:(w=l.shape.pointLineWidth)!=null?w:1})}}),o.globalAlpha=1})}drawLabels(t,n){var i;if(!((i=t.hasDataLabel)!=null&&i.call(t)))return;const{ctx:a,painter:s,theme:{style:o}}=this,{margin:r}=t.state,{cx:l,cy:c}=n.pos,u=n.indices[I.BAR]?t.generateGetBarPoints(n.indices[I.BAR],!1):null,d=t.generateGetCandlestickPoints?t.generateGetCandlestickPoints(te(t,n,I.CANDLESTICK,Yt.bind(null,t)),!1):null,h=t.filterTargetsToShow().filter(_=>(ee(t,_)||he(t,_)||Fn(t,_)||Yt(t,_))&&Pe(t,_)),f=[];let g=0;h.forEach(_=>{const x=Ae(t,_),m=t.labelishData(_),v=[];for(let b=0;b<m.length;b++){const y=m[b],T=vo(t,y);T&&y.index>=x.start&&y.index<x.end&&Rt(t,y)&&v.push({d:y,text:T})}g+=v.length,v.length&&f.push(v)});const p={size:()=>g};s.withTranslation(r.left,r.top,()=>{a.font=o.label.font,a.textAlign="center",f.forEach(_=>{var x,m;for(const{d:v,text:b}of _){let y,T;if(ee(t,v)&&u){const w=Xn(t,u,v,v.index);if(!w)continue;const{points:C,rect:k}=w,S=t.getBaseValue(v),A=mi(t,C[2]),L=S<0,E=wa(a,b,0,0).h;y=t.config.axis_rotated&&!t.config.data_labels.centered?A[0]+(L?-4:4):k.x+k.w/2,T=t.config.data_labels.centered||t.config.axis_rotated?k.y+k.h/2:A[1]+(L?E-3:-3),a.textAlign=t.config.axis_rotated&&!t.config.data_labels.centered?L?"right":"left":"center",a.textBaseline=t.config.data_labels.centered||t.config.axis_rotated?"middle":"alphabetic"}else if(Yt(t,v)&&d){const w=(x=t.getCandlestickData)==null?void 0:x.call(t,v),C=Gn(t,d,v,v.index),k=w==null?void 0:w._isUp;if(!C)continue;const{wickEnd:S,wickStart:A}=C,L=t.config[`axis_${(m=t.axis)==null?void 0:m.getId(v.id)}_inverted`];y=t.config.axis_rotated?k?S[0]+4:A[0]-4:A[0],T=t.config.axis_rotated?A[1]+3:k?S[1]-3:A[1]+12,!t.config.axis_rotated&&L&&(T+=15*(k?1:-1)),a.textAlign=t.config.axis_rotated?k?"left":"right":"center",a.textBaseline="alphabetic"}else l&&c&&({x:y,y:T}=Ad(n.pos,v,v.index),{x:y,y:T}=wo(t,a,v,y,T));y+=bi(t,v,"x",p),T+=bi(t,v,"y",p),Tt(y,T)&&this.drawDataLabel(t,v,b,y,T)}})})}drawEmptyLabel(t){const n=t.config.data_empty_label_text,i=t.filterTargetsToShow();if(!n||i.length)return;const{margin:a,width:s,height:o}=t.state,{style:r}=this.theme;this.painter.text(String(n),a.left+s/2,a.top+o/2,{fill:r.emptyLabel.color,font:r.emptyLabel.font,textAlign:"center",textBaseline:"middle"})}drawZoomBrush(t,n,i){const{axis_rotated:a}=t.config,{height:s,margin:o,width:r}=t.state,l=Math.min(n,i),c=Math.abs(i-n),u=a?{x:o.left,y:o.top+l,w:r,h:c}:{x:o.left+l,y:o.top,w:c,h:s};c<=0||this.painter.fillRect(u,{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawSelectionDragArea(t,n){const{margin:i,width:a,height:s}=t.state,o={x:i.left,y:i.top,w:a,h:s},r=Math.max(o.x,n.x),l=Math.max(o.y,n.y),c=Math.min(o.x+o.w,n.x+n.w),u=Math.min(o.y+o.h,n.y+n.h);c<=r||u<=l||this.painter.fillRect({x:r,y:l,w:c-r,h:u-l},{fill:this.theme.style.zoomBrush.fill,alpha:this.theme.style.zoomBrush.opacity})}drawTreemaps(t){var n;const{ctx:i,painter:a,theme:{style:s}}=this,{config:o}=t,r=(n=t.getTreemapRoot)==null?void 0:n.call(t,t.data.targets),l=(r==null?void 0:r.children)||[];a.withState(()=>{var c;i.lineWidth=s.treemap.lineWidth,i.strokeStyle=s.treemap.stroke;for(const u of l){const{data:d}=u;if(!ta(t,d))continue;const{x:h,y:f,w:g,h:p}=vn(t,u,r,!0);if(!Tt(h,f)||!Tt(h+g,f+p)||g<=0||p<=0)continue;const _={x:h,y:f,w:g,h:p};if(i.fillStyle=t.color(d.name),a.fillRect(_),a.strokeRect(_),!o.treemap_label_show||(d.ratio||0)<(o.treemap_label_threshold||0))continue;const x=Rd(t,d,g,p);if(!x)continue;const m=x.split(`
17
+ `),v=!!o.data_labels.centered;i.font=s.label.font;const b=de(i.font),y=i.measureText((c=m[0])!=null?c:""),T=(y.fontBoundingBoxAscent||0)+(y.fontBoundingBoxDescent||0)||(y.actualBoundingBoxAscent||0)+(y.actualBoundingBoxDescent||0),w=Math.max(b,T)+(m.length-1)*b,C=v?f+p/2:f+w+5;let k=v?h+g/2:h+5,S=C-(m.length-1)*b/(v?2:1);i.textAlign=v?"center":"left",i.textBaseline=v?"middle":"alphabetic",{x:k,y:S}=this.drawLabelImage(t,d,x,k,S),i.fillStyle=yo(t,d,s.label.color),To(t,a,d,x,k,v?S+(m.length-1)*b/2:C),m.forEach((A,L)=>{a.text(A,k,S+L*b,{maxWidth:Math.max(0,g-8)})})}})}drawSubchartFocus(t,n){const{config:i,scale:a,state:s}=t,o=n==null?void 0:n.find(_=>_&&Rt(t,_));if(!o||!i.subchart_show||i.subchart_grid_focus_continuous||i.subchart_brush_enabled!==!1||i.grid_focus_show===!1||i.subchart_grid_focus===!1||!i.tooltip_show||i.axis_tooltip||!a.subX||s.width2<=0||s.height2<=0)return;const{margin2:r,width2:l,height2:c}=s,u=a.subX(o.x);if(!Number.isFinite(u))return;const{painter:d,theme:{style:h}}=this,f=h.axis.lineWidth,g=d.crisp(r.left+u,f),p=d.crisp(r.top+u,f);d.strokePath(()=>{i.axis_rotated?d.traceLine(r.left,p,r.left+l,p):d.traceLine(g,r.top,g,r.top+c)},{lineDash:h.focusGrid.dashArray,lineWidth:h.focusGrid.lineWidth,stroke:h.focusGrid.lineColor})}drawFocus(t,n){if(!(n!=null&&n.length))return;const{painter:i}=this,{style:a}=this.theme,{margin:s}=t.state,o=n.find(r=>r&&Rt(t,r));t.config.subchart_grid_focus!==!1&&!xa(t)&&this.drawSubchartFocus(t,n),i.withTranslation(s.left,s.top,()=>{if(t.config.tooltip_show&&t.config.grid_focus_show!==!1&&!t.config.axis_tooltip&&o){const{x:r,y:l}=Nn(t,o),c=a.axis.lineWidth,u=t.config.axis_rotated,d=Number.isFinite(u?l:r),h=Number.isFinite(u?r:l),f=v=>i.crisp(s.left+v,c)-s.left,g=v=>i.crisp(s.top+v,c)-s.top,p=t.config.grid_focus_edge&&!t.config.tooltip_grouped,_=xa(t),x=_?t.state.margin2.left-s.left+t.state.width2:t.state.width,m=_?t.state.margin2.top-s.top+t.state.height2:t.state.height;d&&i.strokePath(()=>{var v,b;if(u){if(i.traceLine(f(0),l,p&&h?r:f(x),l),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const y=((v=t.axis)==null?void 0:v.getId(o.id))==="y2";i.traceLine(r,p&&!y?l:g(0),r,p&&y?l:g(t.state.height))}}else if(i.traceLine(r,p&&h?l:g(0),r,g(m)),h&&t.config.grid_focus_y&&!t.config.tooltip_grouped){const y=((b=t.axis)==null?void 0:b.getId(o.id))==="y2";i.traceLine(p&&y?r:f(0),l,p&&!y?r:f(t.state.width),l)}},{lineDash:a.focusGrid.dashArray,lineWidth:a.focusGrid.lineWidth,stroke:a.focusGrid.lineColor})}t.config.point_show&&!t.state.canvasFocusMainRedraw&&n.filter(r=>r&&Rt(t,r)&&he(t,r)&&Pe(t,{id:r.id})).forEach(r=>{var l,c,u,d;const h=La(t,{id:r.id}),{x:f,y:g}=Nn(t,r),p=(c=(l=t.pointR)==null?void 0:l.call(t,r))!=null?c:2.5,_=(d=(u=t.pointExpandedR)==null?void 0:u.call(t,r))!=null?d:p*1.75,x=Yn(t,r),m=x||t.color(r.id),v=x||a.focusPoint.fill||a.shape.pointFillColor||m,b=x||a.focusPoint.stroke||m,y=a.focusPoint.lineWidth,T=wi(t,r),w=!!b&&(y!=null?y:0)>0,C=h==="circle"&&w&&$(T)&&T<1&&v===b;Tt(f,g)&&Wn(i,h,f,g,C?_+(y||0)/2:_,w&&!C?{fill:v,lineWidth:y,stroke:b,alpha:T}:{fill:v,alpha:T},p)}),this.drawFocusLabels(t,n)})}}var Rh=Object.defineProperty,Vo=Object.getOwnPropertySymbols,Eh=Object.prototype.hasOwnProperty,Ph=Object.prototype.propertyIsEnumerable,Dh=(e,t,n)=>t in e?Rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ih=(e,t)=>{var n={};for(var i in e)Eh.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&Vo)for(var i of Vo(e))t.indexOf(i)<0&&Ph.call(e,i)&&(n[i]=e[i]);return n},jn=(e,t,n)=>Dh(e,typeof t!="symbol"?t+"":t,n);const ye="http://www.w3.org/2000/svg";function W(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:"");return Number.isFinite(n)?n:t}function on(e,t){const n=W(e.opacity,1),i=W(e["fill-opacity"],1),a=n*i;return Number.isFinite(a)?a:t}function K(e,t){const n=e==null?void 0:e.trim();return n&&!/^(none|transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i.test(n)?n:t}function yn(e,t){const n=K(e,""),i=t?K(t,""):"";return n&&n!==i?n:void 0}function Tn(e,t){const n=typeof e=="number"?e:parseFloat(e!=null?e:""),i=typeof t=="number"?t:parseFloat(t!=null?t:"");return Number.isFinite(n)&&(!Number.isFinite(i)||n!==i)?n:void 0}function Un(e){return Array.isArray(e)?e.filter(t=>Number.isFinite(t)&&t>0):(e||"").split(/[,\s]+/).map(t=>parseFloat(t)).filter(t=>Number.isFinite(t)&&t>0)}function Mh(e,t){const n=e.getPropertyValue("font").trim();if(n)return n;const i=e.getPropertyValue("font-size").trim(),a=e.getPropertyValue("font-family").trim();if(!i||!a)return t;const s=e.getPropertyValue("font-style").trim(),o=e.getPropertyValue("font-variant").trim(),r=e.getPropertyValue("font-weight").trim(),l=e.getPropertyValue("line-height").trim(),c=l&&l!=="normal"?`${i}/${l}`:i;return[s&&s!=="normal"?s:"",o&&o!=="normal"?o:"",r&&!/^(normal|400)$/.test(r)?r:"",c,a].filter(Boolean).join(" ")}function Te(e,t){var n;const i=t.replace(/-([a-z])/g,(a,s)=>s.toUpperCase());return(n=e[t])!=null?n:e[i]}function it(e,t){const n=Te(e,t);return(n==null?"":K(String(n),""))||void 0}function Ot(e,t){const n=Te(e,t),i=typeof n=="number"?n:parseFloat(String(n!=null?n:""));return Number.isFinite(i)?i:void 0}function je(e){const t=Ot(e,"opacity"),n=Ot(e,"fill-opacity");return t===void 0&&n===void 0?void 0:(t!=null?t:1)*(n!=null?n:1)}function Ra(e){const t=Te(e,"stroke-dasharray"),n=t==null?[]:Un(t);return n.length?n:void 0}function ne(e){var t,n,i,a;const s=Te(e,"font");if(s!=null&&String(s).trim())return String(s).trim();const o=Te(e,"font-size"),r=Te(e,"font-family");if(o==null||r==null)return;const l=String(o).trim(),c=String(r).trim();if(!l||!c)return;const u=String((t=Te(e,"font-style"))!=null?t:"").trim(),d=String((n=Te(e,"font-variant"))!=null?n:"").trim(),h=String((i=Te(e,"font-weight"))!=null?i:"").trim(),f=String((a=Te(e,"line-height"))!=null?a:"").trim();return[u&&u!=="normal"?u:"",d&&d!=="normal"?d:"",h&&!/^(normal|400)$/.test(h)?h:"",f&&f!=="normal"?`${l}/${f}`:l,c].filter(Boolean).join(" ")}function st(e,t,n){var i;const a=Object.keys(n).reduce((s,o)=>(n[o]!==void 0&&(s[o]=n[o]),s),{});Object.keys(a).length&&(e[t]=ke((i=e[t])!=null?i:{},a))}function Wo(e){return e.split(",").map(t=>t.trim().replace(/\s*>\s*/g," ").replace(/\s+/g," ").replace(/^(?:svg)?\.bb\s+/,"").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g,"$1.")).filter(Boolean)}function Ea(e){return Object.keys(e).filter(t=>e[t]!==void 0)}function Yo(e,t,n){return Ea(t).forEach(i=>{n!=null&&n.has(i)||(e[i]=t[i])}),e}function Ho(e){const t=e.split(" ");return t.every((n,i)=>n==="line"||n==="text"?i===t.length-1:/^(\.[A-Za-z_-][\w-]*)+$/.test(n))}function jo(e){const t=e.split(" "),n=t[t.length-1];return n==="line"||n==="text"?n:null}function Fh(e){return(e||"").split(/\s+/).filter(Boolean)}function Oh(e,t){const n=t==="text"?{labelColor:it(e,"fill"),labelFont:ne(e)}:{lineColor:it(e,"stroke"),lineWidth:Ot(e,"stroke-width"),dashArray:Ra(e)};return Yo({},n)}function $h(e){const t=[];return Object.keys(e!=null?e:{}).forEach(n=>{Wo(n).forEach(i=>{const a=jo(i)||"line",s=Oh(e[n],a);Ho(i)&&Ea(s).length&&t.push({selector:i,target:a,style:s})})}),t}function Bh(e,t,n,i){if(!Ho(e))return!1;const a=jo(e);if(a&&a!==i)return!1;if(!a&&i==="text")return!1;const s=Fh(n),o=`bb-${t}grid-line`,r=new Set(["bb-grid","bb-grid-lines",`bb-${t}grid-lines`,o,...s]),l=(e.match(/\.[A-Za-z_-][\w-]*/g)||[]).map(c=>c.slice(1));return!!l.length&&l.every(c=>r.has(c))&&(l.includes(o)||s.some(c=>l.includes(c)))}function zh(e,t,n){switch(t){case".bb-axis path.domain":case".bb-axis .domain":case".bb-axis-x path.domain":case".bb-axis-x .domain":case".bb-axis-y path.domain":case".bb-axis-y .domain":case".bb-axis-y2 path.domain":case".bb-axis-y2 .domain":st(e,"axis",{lineColor:it(n,"stroke"),lineWidth:Ot(n,"stroke-width")});break;case".bb-axis line":case".bb-axis .tick line":case".bb-axis-x line":case".bb-axis-x .tick line":case".bb-axis-y line":case".bb-axis-y .tick line":case".bb-axis-y2 line":case".bb-axis-y2 .tick line":st(e,"axis",{tickColor:it(n,"stroke"),tickWidth:Ot(n,"stroke-width")});break;case".bb-axis text":case".bb-axis .tick text":{const i=ne(n);st(e,"axis",{labelColor:it(n,"fill"),xTickFont:i,yTickFont:i,y2TickFont:i});break}case".bb-axis-x text":case".bb-axis-x .tick text":st(e,"axis",{labelColor:it(n,"fill"),xTickFont:ne(n)});break;case".bb-axis-y text":case".bb-axis-y .tick text":st(e,"axis",{labelColor:it(n,"fill"),yTickFont:ne(n)});break;case".bb-axis-y2 text":case".bb-axis-y2 .tick text":st(e,"axis",{labelColor:it(n,"fill"),y2TickFont:ne(n)});break;case".tick._active_ text":case".bb-axis .tick._active_ text":case".bb-axis-x .tick._active_ text":st(e,"axis",{activeLabelColor:it(n,"fill")});break;case".bb-axis-x-label":case".bb-axis-x .bb-axis-x-label":st(e,"axis",{labelFont:ne(n),xLabelColor:it(n,"fill")});break;case".bb-axis-y-label":case".bb-axis-y .bb-axis-y-label":st(e,"axis",{labelFont:ne(n),yLabelColor:it(n,"fill")});break;case".bb-axis-y2-label":case".bb-axis-y2 .bb-axis-y2-label":st(e,"axis",{labelFont:ne(n),y2LabelColor:it(n,"fill")});break;case".bb-grid line":case".bb-grid .bb-xgrid":case".bb-grid .bb-ygrid":case".bb-xgrid":case".bb-ygrid":st(e,"grid",{lineColor:it(n,"stroke"),lineWidth:Ot(n,"stroke-width"),dashArray:Ra(n)});break;case".bb-grid text":st(e,"grid",{labelColor:it(n,"fill"),labelFont:ne(n)});break;case".bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus line":case".bb-grid .bb-xgrid-focus":st(e,"focusGrid",{lineColor:it(n,"stroke"),lineWidth:Ot(n,"stroke-width"),dashArray:Ra(n)});break;case".bb-region rect":case".bb-region":st(e,"region",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-region text":st(e,"region",{labelColor:it(n,"fill"),labelFont:ne(n)});break;case".bb-bar":st(e,"shape",{barOpacity:je(n),barStrokeColor:it(n,"stroke"),barLineWidth:Ot(n,"stroke-width")});break;case".bb-bar._expanded_":st(e,"shape",{barExpandedOpacity:je(n)});break;case".bb-candlestick":st(e,"shape",{candlestickStrokeColor:it(n,"stroke"),candlestickLineWidth:Ot(n,"stroke-width")});break;case".bb-candlestick._expanded_":st(e,"shape",{candlestickExpandedOpacity:je(n)});break;case".bb-line":st(e,"shape",{barConnectLineColor:it(n,"stroke"),barConnectLineWidth:Ot(n,"stroke-width"),lineWidth:Ot(n,"stroke-width")});break;case".bb-target.bb-focused .bb-line":case".bb-target.bb-focused path.bb-line":st(e,"shape",{lineFocusedWidth:Ot(n,"stroke-width")});break;case".bb-target.bb-defocused":st(e,"shape",{targetDefocusedOpacity:Ot(n,"opacity")});break;case".bb-area":st(e,"shape",{areaOpacity:je(n)});break;case".bb-circle":st(e,"shape",{pointFillColor:it(n,"fill"),pointStrokeColor:it(n,"stroke"),pointLineWidth:Ot(n,"stroke-width")});break;case".bb-selected-circle":st(e,"selectedPoint",{fill:it(n,"fill"),stroke:it(n,"stroke"),lineWidth:Ot(n,"stroke-width")});break;case".bb-circle._expanded_":st(e,"focusPoint",{fill:it(n,"fill"),stroke:it(n,"stroke"),lineWidth:Ot(n,"stroke-width")});break;case".bb-zoom-brush":st(e,"zoomBrush",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-brush .extent":case".bb-brush .selection":st(e,"subchartBrush",{fill:it(n,"fill"),opacity:je(n)});break;case".bb-brush .handle--custom":st(e,"subchartBrush",{handleFill:it(n,"fill"),handleOpacity:je(n),handleStroke:it(n,"stroke"),handleLineWidth:Ot(n,"stroke-width")});break;case".bb-chart-treemaps rect":case".bb-chart-treemaps":st(e,"treemap",{stroke:it(n,"stroke"),lineWidth:Ot(n,"stroke-width")});break;case".bb-text.bb-empty":case".bb-text .bb-empty":case".bb-empty":st(e,"emptyLabel",{color:it(n,"fill"),font:ne(n)});break;case".bb-text":st(e,"label",{color:it(n,"fill"),font:ne(n)});break;case".bb-title":st(e,"title",{color:it(n,"fill"),font:ne(n)});break}}function Nh(e){const t={};return Object.keys(e!=null?e:{}).forEach(n=>{Wo(n).forEach(i=>{zh(t,i,e[n])})}),t}function Xh(e){if(!e)return{};const t=e,{selectors:n}=t,i=Ih(t,["selectors"]);return ke({},Nh(n),i)}function Uo(e,t){try{return JSON.stringify({className:e.className,style:e.getAttribute("style")||"",override:t||null})}catch(n){return null}}class Gh{constructor(){jn(this,"style"),jn(this,"cacheContainer",null),jn(this,"cacheKey",null),jn(this,"gridLineSelectorOverrides",[]),jn(this,"directGridOverrideKeys",new Set)}load(t,n){var i,a,s,o,r;const l=nt.createElementNS(ye,"svg");this.gridLineSelectorOverrides=$h(n==null?void 0:n.selectors),this.directGridOverrideKeys=new Set(Object.keys((i=n==null?void 0:n.grid)!=null?i:{})),l.setAttribute("class","bb"),l.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden",t.appendChild(l);const c=(Mt,Vt)=>{const Ut=N.getComputedStyle(Mt),Jt={};for(const zt of Vt)Jt[zt]=zt==="font"?Mh(Ut,""):Ut.getPropertyValue(zt).trim();return Jt},u=(Mt,Vt,Ut)=>{const Jt=nt.createElementNS(ye,Mt);Jt.setAttribute("class",Vt),l.appendChild(Jt);const zt=c(Jt,Ut);return l.removeChild(Jt),zt},d=(Mt,Vt,Ut,Jt)=>{const zt=nt.createElementNS(ye,"g"),le=nt.createElementNS(ye,Vt);zt.setAttribute("class",Mt),Ut&&le.setAttribute("class",Ut),zt.appendChild(le),l.appendChild(zt);const ze=c(le,Jt);return l.removeChild(zt),ze},h=(Mt,Vt,Ut,Jt,zt)=>{const le=nt.createElementNS(ye,"g"),ze=nt.createElementNS(ye,"g"),ii=nt.createElementNS(ye,Ut);le.setAttribute("class",Mt),ze.setAttribute("class",Vt),Jt&&ii.setAttribute("class",Jt),ze.appendChild(ii),le.appendChild(ze),l.appendChild(le);const Em=c(ii,zt);return l.removeChild(le),Em},f=(Mt,Vt,Ut,Jt="")=>{const zt=nt.createElementNS(ye,"g"),le=nt.createElementNS(ye,"g"),ze=nt.createElementNS(ye,Vt);zt.setAttribute("class",`bb-axis ${Mt}`),le.setAttribute("class",["tick",Jt].filter(Boolean).join(" ")),ze.textContent=Vt==="text"?"0":"",le.appendChild(ze),zt.appendChild(le),l.appendChild(zt);const ii=c(ze,Ut);return l.removeChild(zt),ii},g="rgb(1, 2, 3)",p=(Mt,Vt)=>{const Ut=nt.createElement("style");Ut.textContent=`
18
18
  .bb-shapes-canvas-probe .bb-circle {
19
- fill: ${f};
20
- stroke: ${f};
19
+ fill: ${g};
20
+ stroke: ${g};
21
21
  }
22
- `,tt.head.appendChild(Vt);try{return d("bb-shapes bb-shapes-canvas-probe","circle",Pt,Nt)}finally{Vt.remove()}},p=d("bb-axis bb-axis-x","path","domain",["stroke","stroke-width"]),x=h("bb-axis-x","line",["stroke","stroke-width"]),_=h("bb-axis-x","text",["fill","font"]),v=h("bb-axis-x","text",["fill"],"_active_"),m=h("bb-axis-y","text",["fill","font"]),b=h("bb-axis-y2","text",["fill","font"]),y=d("bb-axis bb-axis-x","text","bb-axis-x-label",["fill","font"]),T=d("bb-axis bb-axis-y","text","bb-axis-y-label",["fill","font"]),w=d("bb-axis bb-axis-y2","text","bb-axis-y2-label",["fill","font"]),C=c("circle","",["fill","stroke","stroke-width"]),A=d("bb-grid","line","bb-ygrid",["stroke","stroke-width","stroke-dasharray"]),S=d("bb-grid","text","",["fill","font"]),k=u("bb-grid","bb-xgrid-focus","line","bb-xgrid-focus",["stroke","stroke-width","stroke-dasharray"]),L=c("text","bb-text bb-empty",["fill","font"]),R=d("bb-region","rect","",["fill","fill-opacity"]),E=d("bb-region","text","",["fill","font"]),P=c("path","bb-bar",["opacity","fill-opacity","stroke","stroke-width"]),D=c("path","bb-bar _expanded_",["opacity","fill-opacity"]),z=c("path","bb-candlestick",["stroke","stroke-width"]),$=c("path","bb-candlestick _expanded_",["opacity","fill-opacity"]),G=c("path","bb-line",["stroke-width"]),N=d("bb-target bb-focused","path","bb-line",["stroke-width"]),q=c("g","bb-target bb-defocused",["opacity"]),At=c("path","bb-area",["opacity","fill-opacity"]),K=c("circle","bb-circle",["fill","stroke","stroke-width"]),lt=c("circle","bb-selected-circle",["fill","stroke","stroke-width"]),ft=g("bb-circle _expanded_",["fill","stroke","stroke-width"]),bt=c("rect","bb-zoom-brush",["fill","fill-opacity","opacity"]),$t=d("bb-brush","rect","extent",["fill","fill-opacity","opacity"]),Et=d("bb-brush","rect","selection",["fill","fill-opacity","opacity"]),kt=d("bb-brush","path","handle--custom",["fill","fill-opacity","opacity","stroke","stroke-width"]),jn=d("bb-chart-treemaps","rect","",["stroke","stroke-width"]),nn=c("text","bb-text",["fill","font"]),Pi=d("","text","bb-title",["fill","font"]),ql=Z(bt.fill,"#000"),Jl=W(bt["fill-opacity"]||bt.opacity,.1),S_=Z(Et.fill,Z($t.fill,ql)),A_=(o=(s=(a=(i=fn(Et["fill-opacity"],1))!=null?i:fn(Et.opacity,1))!=null?a:fn($t["fill-opacity"],1))!=null?s:fn($t.opacity,1))!=null?o:Jl,Ql=Z(kt.stroke,"transparent"),_t={axis:{lineColor:Z(p.stroke,"#000"),lineWidth:W(p["stroke-width"],1),tickColor:Z(x.stroke,Z(p.stroke,"#000")),tickWidth:W(x["stroke-width"],W(p["stroke-width"],1)),labelFont:T.font||m.font||"10px sans-serif",xTickFont:_.font||m.font||"10px sans-serif",yTickFont:m.font||"10px sans-serif",y2TickFont:b.font||m.font||"10px sans-serif",labelColor:Z(m.fill,"#000"),xLabelColor:Z(y.fill,Z(_.fill,"#000")),yLabelColor:Z(T.fill,Z(m.fill,"#000")),y2LabelColor:Z(w.fill,Z(T.fill,Z(m.fill,"#000"))),activeLabelColor:hn(v.fill,_.fill)||Z(m.fill,"#000")},grid:{lineColor:Z(A.stroke,"#aaa"),lineWidth:W(A["stroke-width"],1),dashArray:zn(A["stroke-dasharray"]),labelFont:S.font||m.font||"10px sans-serif",labelColor:Z(S.fill,"#aaa")},focusGrid:{lineColor:Z(k.stroke,Z(A.stroke,"#aaa")),lineWidth:W(k["stroke-width"],W(A["stroke-width"],1)),dashArray:zn(k["stroke-dasharray"]||A["stroke-dasharray"])},emptyLabel:{font:L.font||nn.font||m.font||"20px sans-serif",color:Z(L.fill,"#808080")},region:{fill:Z(R.fill,"steelblue"),opacity:W(R["fill-opacity"],.1),labelFont:E.font||m.font||"10px sans-serif",labelColor:Z(E.fill,"#000")},shape:{barOpacity:Ze(P,1),barExpandedOpacity:W(Ze(D,Ze(P,1)),Ze(P,1)),barStrokeColor:Z(P.stroke,"#000"),barLineWidth:W(P["stroke-width"],0),barConnectLineColor:Z(G.stroke,"#000"),barConnectLineWidth:W(G["stroke-width"],1),candlestickStrokeColor:Z(z.stroke,"#000"),candlestickLineWidth:W(z["stroke-width"],1),candlestickExpandedOpacity:W(Ze($,1),1),lineWidth:W(G["stroke-width"],1),lineFocusedWidth:W(N["stroke-width"],2),areaOpacity:Ze(At,.2),targetDefocusedOpacity:W(q.opacity,.3),pointFillColor:hn(K.fill,C.fill),pointStrokeColor:hn(K.stroke,C.stroke),pointLineWidth:fn(K["stroke-width"],C["stroke-width"])},selectedPoint:{fill:Z(lt.fill,"#fff"),stroke:hn(lt.stroke),lineWidth:W(lt["stroke-width"],2)},focusPoint:{fill:hn(ft.fill,f),stroke:hn(ft.stroke,f),lineWidth:W(ft["stroke-width"],1)},zoomBrush:{fill:ql,opacity:Jl},subchartBrush:{fill:S_,opacity:A_,handleFill:Z(kt.fill,"transparent"),handleOpacity:Ze(kt,1),handleStroke:Ql,handleLineWidth:W(kt["stroke-width"],Ql==="transparent"?0:1)},treemap:{stroke:Z(jn.stroke,"#fff"),lineWidth:W(jn["stroke-width"],1)},label:{font:nn.font||m.font||"10px sans-serif",color:Z(nn.fill,"#000")},title:{font:Pi.font||nn.font||m.font||"14px sans-serif",color:Z(Pi.fill,"#000")}},k_=qu(n),M=ve(_t,k_),We=n==null?void 0:n.axis,L_=!!We&&Object.prototype.hasOwnProperty.call(We,"labelColor"),R_=!!We&&Object.prototype.hasOwnProperty.call(We,"labelFont");if(M.axis.lineWidth=W(M.axis.lineWidth,_t.axis.lineWidth),M.axis.tickWidth=W(M.axis.tickWidth,M.axis.lineWidth),R_){const Pt=We,Nt=M.axis.labelFont;Pt.xTickFont===void 0&&(M.axis.xTickFont=Nt),Pt.yTickFont===void 0&&(M.axis.yTickFont=Nt),Pt.y2TickFont===void 0&&(M.axis.y2TickFont=Nt)}if(M.axis.labelFont=M.axis.labelFont||_t.axis.labelFont,M.axis.xTickFont=M.axis.xTickFont||M.axis.labelFont,M.axis.yTickFont=M.axis.yTickFont||M.axis.labelFont,M.axis.y2TickFont=M.axis.y2TickFont||M.axis.yTickFont,M.axis.labelColor=Z(M.axis.labelColor,_t.axis.labelColor),L_){const Pt=M.axis.labelColor;We.xLabelColor===void 0&&(M.axis.xLabelColor=Pt),We.yLabelColor===void 0&&(M.axis.yLabelColor=Pt),We.y2LabelColor===void 0&&(M.axis.y2LabelColor=Pt)}M.axis.xLabelColor=Z(M.axis.xLabelColor,M.axis.labelColor),M.axis.yLabelColor=Z(M.axis.yLabelColor,M.axis.labelColor),M.axis.y2LabelColor=Z(M.axis.y2LabelColor,M.axis.yLabelColor),M.axis.activeLabelColor=Z(M.axis.activeLabelColor,M.axis.labelColor),M.grid.lineWidth=W(M.grid.lineWidth,_t.grid.lineWidth),M.grid.dashArray=zn(M.grid.dashArray),M.focusGrid.lineWidth=W(M.focusGrid.lineWidth,_t.focusGrid.lineWidth),M.focusGrid.dashArray=zn(M.focusGrid.dashArray),M.region.opacity=W(M.region.opacity,_t.region.opacity),M.shape.barOpacity=W(M.shape.barOpacity,_t.shape.barOpacity),M.shape.barExpandedOpacity=W(M.shape.barExpandedOpacity,M.shape.barOpacity),M.shape.barLineWidth=W(M.shape.barLineWidth,_t.shape.barLineWidth),M.shape.barConnectLineWidth=W(M.shape.barConnectLineWidth,_t.shape.barConnectLineWidth),M.shape.candlestickLineWidth=W(M.shape.candlestickLineWidth,_t.shape.candlestickLineWidth),M.shape.candlestickStrokeColor=Z(M.shape.candlestickStrokeColor,_t.shape.candlestickStrokeColor),M.shape.candlestickExpandedOpacity=W(M.shape.candlestickExpandedOpacity,_t.shape.candlestickExpandedOpacity),M.shape.lineWidth=W(M.shape.lineWidth,_t.shape.lineWidth),M.shape.lineFocusedWidth=W(M.shape.lineFocusedWidth,_t.shape.lineFocusedWidth),M.shape.areaOpacity=W(M.shape.areaOpacity,_t.shape.areaOpacity),M.shape.targetDefocusedOpacity=W(M.shape.targetDefocusedOpacity,_t.shape.targetDefocusedOpacity),M.shape.pointLineWidth=fn(M.shape.pointLineWidth),M.selectedPoint.lineWidth=W(M.selectedPoint.lineWidth,_t.selectedPoint.lineWidth),M.focusPoint.lineWidth=W(M.focusPoint.lineWidth,_t.focusPoint.lineWidth),M.zoomBrush.opacity=W(M.zoomBrush.opacity,_t.zoomBrush.opacity),M.subchartBrush.opacity=W(M.subchartBrush.opacity,_t.subchartBrush.opacity),M.subchartBrush.handleOpacity=W(M.subchartBrush.handleOpacity,_t.subchartBrush.handleOpacity),M.subchartBrush.handleLineWidth=W(M.subchartBrush.handleLineWidth,_t.subchartBrush.handleLineWidth),M.treemap.lineWidth=W(M.treemap.lineWidth,_t.treemap.lineWidth),this.style=M,this.cacheContainer=t,this.cacheKey=fo(t,n),r.remove()}reload(t,n){const i=fo(t,n);i!==null&&this.style&&this.cacheContainer===t&&this.cacheKey===i||this.load(t,n)}}var Qu=Object.defineProperty,th=(e,t,n)=>t in e?Qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ce=(e,t,n)=>th(e,typeof t!="symbol"?t+"":t,n);const qe=24,go=64,fa=[le,Kt,Gt];function gn(e,t){return Math.floor(e/t)}function po(e,t,n){var i,a;const s=gn(t.x,n),o=gn(t.x+((i=t.w)!=null?i:0),n),r=gn(t.y,n),l=gn(t.y+((a=t.h)!=null?a:0),n);for(let c=s;c<=o;c++)for(let d=r;d<=l;d++){const u=`${c}:${d}`,h=e.get(u);h?h.push(t):e.set(u,[t])}}function xo(e,t,n,i,a=0){const s=gn(t,i),o=gn(n,i),r=[];for(let l=-a;l<=a;l++)for(let c=-a;c<=a;c++){const d=e.get(`${s+l}:${o+c}`);if(d!=null&&d.length)for(let u=0;u<d.length;u++)r.push(d[u])}return r}function eh(e,t){var n,i,a;const s=e.config.point_sensitivity;if(Number.isFinite(s))return s;(n=e.pointR)==null||n.call(e,t);const o=(a=(i=e.getPointSensitivity)==null?void 0:i.call(e,t))!=null?a:qe;return Number.isFinite(o)?o:qe}function nh(e,t){return $e(e,t)&&t.values.length>us&&!e.config.data_selection_enabled&&Number.isFinite(e.config.point_sensitivity)&&Number.isFinite(e.config.point_r)}class ih{constructor(){ce(this,"bars",[]),ce(this,"points",[]),ce(this,"indices",[]),ce(this,"barGrid",new Map),ce(this,"pointGrid",new Map),ce(this,"plot",{x:0,y:0,w:0,h:0}),ce(this,"pointCellSize",qe),ce(this,"maxPointSensitivity",qe),ce(this,"grouped",!1),ce(this,"pointBased",!1),ce(this,"indexAxis","x")}rebuild(t,n){var i,a,s;const{current:o,margin:r,width:l,height:c}=t.state,d=t.filterTargetsToShow();this.bars=[],this.points=[],this.indices=[],this.barGrid=new Map,this.pointGrid=new Map,this.maxPointSensitivity=qe,this.indexAxis=t.config.axis_rotated?"y":"x",this.plot=t.state.hasTreemap?{x:0,y:0,w:o.width,h:o.height}:{x:r.left,y:r.top,w:l,h:c},this.grouped=!!t.config.tooltip_grouped&&!t.state.hasTreemap,this.pointBased=!(t.config.axis_x_forceAsSingle&&this.grouped)&&(!!((i=t.isMultipleX)!=null&&i.call(t))||d.some(x=>$e(t,x)||Fe(t,x)));const h=this.grouped&&(!this.pointBased||t.config.data_selection_enabled&&t.config.data_selection_grouped)?new Map:null,f=(x,_,v)=>{var m,b;if(!h)return;const y=(b=(m=t.getXCacheKey)==null?void 0:m.call(t,v.x))!=null?b:v.index;Number.isFinite(v.index)&&!h.has(y)&&vt(x,_)&&h.set(y,{x,y:_,data:v})};if(t.state.hasTreemap){const x=(a=t.getTreemapRoot)==null?void 0:a.call(t,t.data.targets),_=(x==null?void 0:x.children)||[];for(const v of _){const{data:m}=v;if(!Bi(t,m))continue;const{x:b,y,w:T,h:w}=dn(t,v,x,!0);!vt(b,y)||!vt(b+T,y+w)||this.addBar({x:b,y,w:T,h:w,data:m})}this.indices=[];return}if(n.indices[I.BAR]||d.some(Kt.bind(null,t))){const x=Kt.bind(null,t),_=Ut(t,n,I.BAR,x),v=t.generateGetBarPoints(_,!1);d.filter(x).filter(m=>rn(t,m,fa)).forEach(m=>{const b=be(t,m);for(let y=b.start;y<b.end;y++){const T=m.values[y];if(!Lt(t,T))continue;const w=Dn(t,v,T,y);if(!w)continue;const{rect:C}=w,A=r.left+C.x,S=r.top+C.y,{w:k,h:L}=C;this.addBar({x:A,y:S,w:k,h:L,data:T}),f(A+k/2,S+L/2,T)}})}if(n.indices[I.CANDLESTICK]||d.some(Gt.bind(null,t))){const x=Gt.bind(null,t),_=Ut(t,n,I.CANDLESTICK,x),v=(s=t.generateGetCandlestickPoints)==null?void 0:s.call(t,_,!1);v&&d.filter(x).filter(m=>rn(t,m,fa)).forEach(m=>{var b;const y=be(t,m);for(let T=y.start;T<y.end;T++){const w=m.values[T];if(!((b=t.getCandlestickData)==null?void 0:b.call(t,w)))continue;const A=In(t,v,w,T);if(!A)continue;const{body:S}=A,k=r.left+S.x,L=r.top+S.y,{w:R,h:E}=S;this.addBar({x:k,y:L,w:Math.max(1,R),h:Math.max(1,E),data:w}),f(k+R/2,L+E/2,w)}})}const{cx:g,cy:p}=n.pos;g&&p&&d.filter(le.bind(null,t)).filter(x=>rn(t,x,fa)).forEach(x=>{const _=be(t,x),v=nh(t,x)?fs(l,c,t.config.point_r):null;for(let m=_.start;m<_.end;m++){const b=x.values[m];if(!Lt(t,b))continue;const y=r.left+g(b,m),T=r.top+p(b,m),w=eh(t,b);vt(y,T)&&(v&&!gs(v,y-r.left,T-r.top)||(this.addPoint({x:y,y:T,sensitivity:w,data:b}),f(y,T,b)))}}),this.buildPointGrid(),this.indices=h?Array.from(h.values()).sort((x,_)=>x[this.indexAxis]-_[this.indexAxis]):[]}hitBar(t,n){for(const i of xo(this.barGrid,t,n,go)){const{w:a=0,h:s=0}=i;if(t>=i.x&&t<=i.x+a&&n>=i.y&&n<=i.y+s)return i.data}return null}hitPoint(t,n){var i,a;let s=null,o=Number.POSITIVE_INFINITY;for(const r of xo(this.pointGrid,t,n,this.pointCellSize,1)){const l=r.x-t,c=r.y-n,d=Math.sqrt(l*l+c*c),u=(i=r.sensitivity)!=null?i:qe;d<=u&&d<o&&(o=d,s=r)}return(a=s==null?void 0:s.data)!=null?a:null}findNearest(t,n){const i=this.hitBar(t,n);if(i)return i;if(!this.pointBased&&this.grouped&&this.isWithinPlot(t,n)){const a=this.findNearestIndexItem(t,n);if(a)return a.data}return this.hitPoint(t,n)}findNearestShape(t,n){var i;return(i=this.hitBar(t,n))!=null?i:this.hitPoint(t,n)}findNearestIndexByCoord(t,n){var i,a;return(a=(i=this.findNearestIndexItem(t,n))==null?void 0:i.data)!=null?a:null}findInRect(t,n=!1){const i=Math.min(t.x,t.x+t.w),a=Math.max(t.x,t.x+t.w),s=Math.min(t.y,t.y+t.h),o=Math.max(t.y,t.y+t.h),r=new Set,l=[],c=d=>{const u=d.data,h=`${u.id}:${u.index}`;r.has(h)||(r.add(h),l.push(u))};if(n){const d=this.indexAxis,u=d==="y"?s:i,h=d==="y"?o:a;return this.indices.filter(f=>f[d]>=u&&f[d]<=h).forEach(c),l}return this.bars.filter(d=>{var u,h;const f=(u=d.w)!=null?u:0,g=(h=d.h)!=null?h:0;return!(a<d.x||d.x+f<i)&&!(o<d.y||d.y+g<s)}).forEach(c),this.points.filter(d=>d.x>=i&&d.x<=a&&d.y>=s&&d.y<=o).forEach(c),l}addBar(t){this.bars.push(t),po(this.barGrid,t,go)}addPoint(t){var n;const i=(n=t.sensitivity)!=null?n:qe;this.maxPointSensitivity=Math.max(this.maxPointSensitivity,i),this.points.push(t)}buildPointGrid(){this.pointCellSize=Math.max(1,this.maxPointSensitivity),this.pointGrid=new Map;for(const t of this.points)po(this.pointGrid,t,this.pointCellSize)}isWithinPlot(t,n){const{plot:i}=this;return t>=i.x&&t<=i.x+i.w&&n>=i.y&&n<=i.y+i.h}findNearestIndexItem(t,n){const{indexAxis:i,indices:a}=this,s=i==="y"?n:t;if(!a.length)return null;let o=0,r=a.length-1;for(;o<r;){const d=o+r>>1;a[d][i]<s?o=d+1:r=d}const l=a[o],c=a[o-1];return c&&Math.abs(c[i]-s)<Math.abs(l[i]-s)?c:l}}var hi=pt(5),ah=Object.defineProperty,_o=Object.getOwnPropertySymbols,sh=Object.prototype.hasOwnProperty,oh=Object.prototype.propertyIsEnumerable,mo=(e,t,n)=>t in e?ah(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dt=(e,t)=>{for(var n in t||(t={}))sh.call(t,n)&&mo(e,n,t[n]);if(_o)for(var n of _o(t))oh.call(t,n)&&mo(e,n,t[n]);return e};const Y={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},et={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},fi={area:"bb-area",areas:"bb-areas"},Rt={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},Zt={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},Ce={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},Bt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},ga={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Je={dragarea:"bb-dragarea",INCLUDED:"_included_"},Nn={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},qt={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},H={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},_e={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},Se={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},ut={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},wt={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},Ae={level:"bb-level",levels:"bb-levels"},vo={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},Xn={region:"bb-region",regions:"bb-regions"},xt={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},Ct={shape:"bb-shape",shapes:"bb-shapes"},bo={brush:"bb-brush",subchart:"bb-subchart"},St={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},gi={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},yo={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},pa={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var st=dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt({},Y),et),fi),Rt),Zt),Ce),Bt),ga),Je),qt),H),_e),Se),ut),Nn),wt),Ae),vo),Xn),xt),Ct),bo),St),gi),yo),pa),rh={boost_useCssRule:!1,boost_useWorker:!1},lh={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},ch={legend_contents_bindto:void 0,legend_contents_template:"<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_format:void 0,legend_padding:0,legend_position:"bottom",legend_show:!0,legend_tooltip:!1,legend_usePoint:!1},dh={bindto:"#chart",background:{},clipPath:!0,svg_classname:void 0,size_width:void 0,size_height:void 0,padding:!0,padding_mode:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,resize_auto:!0,resize_timer:!0,onclick:void 0,onover:void 0,onout:void 0,onresize:void 0,onresized:void 0,onbeforeinit:void 0,oninit:void 0,onafterinit:void 0,onrendered:void 0,transition_duration:250,plugins:[],render:{},render_mode:"svg",canvas_theme:{},regions:[]},uh={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},hh={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:void 0,tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:()=>{},tooltip_onhide:()=>{},tooltip_onshown:()=>{},tooltip_onhidden:()=>{},tooltip_order:null},fh={data_x:void 0,data_idConverter:e=>e,data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_groupsZeroAs:"positive",data_color:void 0,data_colors:{},data_labels:{},data_labels_backgroundColors:void 0,data_labels_colors:void 0,data_labels_position:{},data_labels_imgUrl:void 0,data_hide:!1,data_filter:void 0,data_onclick:()=>{},data_onover:()=>{},data_onout:()=>{},data_onshown:void 0,data_onhidden:void 0,data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},gh={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},ph=Object.defineProperty,xh=(e,t,n)=>t in e?ph(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_h=(e,t,n)=>xh(e,typeof t!="symbol"?t+"":t,n);const To=class tc{static setOptions(t){for(let n=0;n<t.length;n++)Object.assign(this.data,t[n])}constructor(){return $c(dh,rh,fh,lh,gh,ch,uh,hh,tc.data)}};_h(To,"data",{});let Qe=To;class mh{constructor(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX:null},axisTooltip:{x:null,y:null,y2:null},defs:null,tooltip:null,legend:null,title:null,subchart:{main:null,bar:null,line:null,area:null},arcs:null,bar:null,candlestick:null,line:null,area:null,circle:null,radar:null,text:null,grid:{main:null,x:null,y:null},gridLines:{main:null,x:null,y:null},region:{main:null,list:null},eventRect:null,zoomResetBtn:null}}}class vh{constructor(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasFunnel:!1,hasRadar:!1,hasTreemap:!1,isCanvasMode:!1,canvasShape:null,canvasFocusKey:null,canvasSubchartBrushDragging:!1,canvasSubchartBrushMode:null,canvasSubchartBrushStart:null,canvasSubchartBrushOrigin:null,canvasSubchartBrushMoved:!1,canvasFlowFrame:null,canvasFlowFinish:null,canvasFocusMainRedraw:!1,cssRule:{},loading:void 0,domain:void 0,current:{domain:void 0,width:0,height:0,dataMax:0,maxTickSize:{x:{width:0,height:0,ticks:[],clipPath:0,domain:""},y:{width:0,height:0,domain:""},y2:{width:0,height:0,domain:""}},types:[],needle:void 0,zoomDomain:null},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,canvasInlineStyle:{minHeight:""},canvasSelection:new Set,canvasSelectionDragStart:null,canvasSelectionDragIncluded:new Set,canvasSelectionDragging:!1,canvasSelectionDragMoved:!1,canvasSelectionDragMoveHandler:null,canvasSelectionDragEndHandler:null,eventReceiver:{currentIdx:-1,rect:{},data:[],coords:[]},axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},event:null,dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,redrawing:!1,resizing:!1,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:new Set,hiddenLegendIds:new Set,focusedTargetIds:new Set,defocusedTargetIds:new Set,radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null},pendingRaf:null,rafBatchQueue:[],dirty:{data:!1,visibility:!1,size:!1},redrawGeneration:0,dataGeneration:0,_targetsToShow:null,_cachedDrawShape:null,_canvasVisibleRangeCache:null,_canvasXDataTickCache:null,_canvasXTickValuesCache:null,_eventRectFingerprint:null,_lastTooltipMouse:null,_gridFocusEl:null,generateClassCache:new Map}}}const wo={element:mh,state:vh};class bh{constructor(){Object.keys(wo).forEach(t=>{this[t]=new wo[t]})}getStore(t){return this[t]}}var yh=Object.defineProperty,Th=(e,t,n)=>t in e?yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wh=(e,t,n)=>Th(e,typeof t!="symbol"?t+"":t,n);const j={bubbleBaseLength:"$baseLength",bubbleMaxValue:"$bubbleMaxValue",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",domainMinMax:"$domainMinMax",filteredTargets:"$filteredTargets",filteredNullish:"$filteredNullish",svgLeft:"$svgLeft",valuesByX:"$valuesByX",legendItemTextBox:"legendItemTextBox",legendItemMap:"$legendItemMap",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect",shapeOffset:"$shapeOffset",maxTickSize:"$maxTickSize",maxDataCountTarget:"$maxDataCountTarget",valuesXIndexMap:"$valuesXIndexMap"};class Ch{constructor(){wh(this,"cache",new Map)}add(t,n,i=!1){const a=i?this.cloneTarget(n):n;return this.cache.set(t,a),a}remove(t){const n=nt(t)?[t]:t;for(let i=0;i<n.length;i++)this.cache.delete(n[i])}get(t,n=!1){if(n&&Array.isArray(t)){const i=[];for(let a=0,s;s=t[a];a++)this.cache.has(s)&&i.push(this.cache.get(s));return i}else return this.cache.has(t)?this.cache.get(t):null}has(t){return this.cache.has(t)}getKeys(){return Array.from(this.cache.keys())}reset(t,n){t?this.cache.clear():this.cache.forEach((i,a)=>{/^\$/.test(a)&&(n!=null&&n.some(s=>a.startsWith(s))||this.cache.delete(a))})}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(n=>({x:n.x,value:n.value,id:n.id}))}}}const Co="https://github.com/naver/billboard.js/blob/master/MODULE_IMPORTS.md";function Sh(e){const t=e,{config:n}=t;let i="";if(Qt(n.data_type||n.data_types)&&!t[Ii.LINE])i="line";else for(const a in Ii){const s=I[a];if(t.hasType(s)&&!t[Ii[a]]){i=s;break}}i&&So(`Please, make sure if %c${Mc(i)}`,"module has been imported and specified correctly.",Co)}function M_(e){const t=Sn[e];t&&So(`Please, make sure if %c${t}`,"module has been imported and specified correctly.",Co)}function So(e,t,n){var i;const a="[billboard.js]";if((i=B.console)==null?void 0:i.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${a} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),n&&console.info("%c\u2139\uFE0F","font-size:15px",n)}throw Error(`${a} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const Ah=/\s?(bb-)/g,kh=/\.+/g;function Lh(e){return e.replace(Ah,".$1").replace(kh,".")}function Ao(e,t,n=!1){const i=s=>s[e?"getBoundingClientRect":"getBBox"](),a=e?"rectClient":"rectBBox";return n?i(t):!(a in t)||t.hasAttribute("width")&&t[a].width!==+(t.getAttribute("width")||0)?t[a]=i(t):t[a]}function pn(e,t,n=[-1,1],i=!1){if(!(!e||!nt(t)))if(t.indexOf(`
22
+ `,nt.head.appendChild(Ut);try{return d("bb-shapes bb-shapes-canvas-probe","circle",Mt,Vt)}finally{Ut.remove()}},_=d("bb-axis bb-axis-x","path","domain",["stroke","stroke-width"]),x=f("bb-axis-x","line",["stroke","stroke-width"]),m=f("bb-axis-x","text",["fill","font"]),v=f("bb-axis-x","text",["fill"],"_active_"),b=f("bb-axis-y","text",["fill","font"]),y=f("bb-axis-y2","text",["fill","font"]),T=d("bb-axis bb-axis-x","text","bb-axis-x-label",["fill","font"]),w=d("bb-axis bb-axis-y","text","bb-axis-y-label",["fill","font"]),C=d("bb-axis bb-axis-y2","text","bb-axis-y2-label",["fill","font"]),k=u("circle","",["fill","stroke","stroke-width"]),S=d("bb-grid","line","bb-ygrid",["stroke","stroke-width","stroke-dasharray"]),A=d("bb-grid","text","",["fill","font"]),L=h("bb-grid","bb-xgrid-focus","line","bb-xgrid-focus",["stroke","stroke-width","stroke-dasharray"]),E=u("text","bb-text bb-empty",["fill","font"]),D=d("bb-region","rect","",["fill","fill-opacity"]),R=d("bb-region","text","",["fill","font"]),P=u("path","bb-bar",["opacity","fill-opacity","stroke","stroke-width"]),B=u("path","bb-bar _expanded_",["opacity","fill-opacity"]),M=u("path","bb-candlestick",["stroke","stroke-width"]),X=u("path","bb-candlestick _expanded_",["opacity","fill-opacity"]),G=u("path","bb-line",["stroke-width"]),Z=d("bb-target bb-focused","path","bb-line",["stroke-width"]),et=u("g","bb-target bb-defocused",["opacity"]),rt=u("path","bb-area",["opacity","fill-opacity"]),xt=u("circle","bb-circle",["fill","stroke","stroke-width"]),gt=u("circle","bb-selected-circle",["fill","stroke","stroke-width"]),wt=p("bb-circle _expanded_",["fill","stroke","stroke-width"]),_t=u("rect","bb-zoom-brush",["fill","fill-opacity","opacity"]),mt=d("bb-brush","rect","extent",["fill","fill-opacity","opacity"]),Pt=d("bb-brush","rect","selection",["fill","fill-opacity","opacity"]),Dt=d("bb-brush","path","handle--custom",["fill","fill-opacity","opacity","stroke","stroke-width"]),Lt=d("bb-chart-treemaps","rect","",["stroke","stroke-width"]),$e=u("text","bb-text",["fill","font"]),jt=d("","text","bb-title",["fill","font"]),Be=K(_t.fill,"#000"),hn=W(_t["fill-opacity"]||_t.opacity,.1),Hi=K(Pt.fill,K(mt.fill,Be)),ji=(r=(o=(s=(a=Tn(Pt["fill-opacity"],1))!=null?a:Tn(Pt.opacity,1))!=null?s:Tn(mt["fill-opacity"],1))!=null?o:Tn(mt.opacity,1))!=null?r:hn,_s=K(Dt.stroke,"transparent"),vt={axis:{lineColor:K(_.stroke,"#000"),lineWidth:W(_["stroke-width"],1),tickColor:K(x.stroke,K(_.stroke,"#000")),tickWidth:W(x["stroke-width"],W(_["stroke-width"],1)),labelFont:w.font||b.font||"10px sans-serif",xTickFont:m.font||b.font||"10px sans-serif",yTickFont:b.font||"10px sans-serif",y2TickFont:y.font||b.font||"10px sans-serif",labelColor:K(b.fill,"#000"),xLabelColor:K(T.fill,K(m.fill,"#000")),yLabelColor:K(w.fill,K(b.fill,"#000")),y2LabelColor:K(C.fill,K(w.fill,K(b.fill,"#000"))),activeLabelColor:yn(v.fill,m.fill)||K(b.fill,"#000")},grid:{lineColor:K(S.stroke,"#aaa"),lineWidth:W(S["stroke-width"],1),dashArray:Un(S["stroke-dasharray"]),labelFont:A.font||b.font||"10px sans-serif",labelColor:K(A.fill,"#aaa")},focusGrid:{lineColor:K(L.stroke,K(S.stroke,"#aaa")),lineWidth:W(L["stroke-width"],W(S["stroke-width"],1)),dashArray:Un(L["stroke-dasharray"]||S["stroke-dasharray"])},emptyLabel:{font:E.font||$e.font||b.font||"20px sans-serif",color:K(E.fill,"#808080")},region:{fill:K(D.fill,"steelblue"),opacity:W(D["fill-opacity"],.1),labelFont:R.font||b.font||"10px sans-serif",labelColor:K(R.fill,"#000")},shape:{barOpacity:on(P,1),barExpandedOpacity:W(on(B,on(P,1)),on(P,1)),barStrokeColor:K(P.stroke,"#000"),barLineWidth:W(P["stroke-width"],0),barConnectLineColor:K(G.stroke,"#000"),barConnectLineWidth:W(G["stroke-width"],1),candlestickStrokeColor:K(M.stroke,"#000"),candlestickLineWidth:W(M["stroke-width"],1),candlestickExpandedOpacity:W(on(X,1),1),lineWidth:W(G["stroke-width"],1),lineFocusedWidth:W(Z["stroke-width"],2),areaOpacity:on(rt,.2),targetDefocusedOpacity:W(et.opacity,.3),pointFillColor:yn(xt.fill,k.fill),pointStrokeColor:yn(xt.stroke,k.stroke),pointLineWidth:Tn(xt["stroke-width"],k["stroke-width"])},selectedPoint:{fill:K(gt.fill,"#fff"),stroke:yn(gt.stroke),lineWidth:W(gt["stroke-width"],2)},focusPoint:{fill:yn(wt.fill,g),stroke:yn(wt.stroke,g),lineWidth:W(wt["stroke-width"],1)},zoomBrush:{fill:Be,opacity:hn},subchartBrush:{fill:Hi,opacity:ji,handleFill:K(Dt.fill,"transparent"),handleOpacity:on(Dt,1),handleStroke:_s,handleLineWidth:W(Dt["stroke-width"],_s==="transparent"?0:1)},treemap:{stroke:K(Lt.stroke,"#fff"),lineWidth:W(Lt["stroke-width"],1)},label:{font:$e.font||b.font||"10px sans-serif",color:K($e.fill,"#000")},title:{font:jt.font||$e.font||b.font||"14px sans-serif",color:K(jt.fill,"#000")}},Am=Xh(n),F=ke(vt,Am),qe=n==null?void 0:n.axis,Lm=!!qe&&Object.prototype.hasOwnProperty.call(qe,"labelColor"),Rm=!!qe&&Object.prototype.hasOwnProperty.call(qe,"labelFont");if(F.axis.lineWidth=W(F.axis.lineWidth,vt.axis.lineWidth),F.axis.tickWidth=W(F.axis.tickWidth,F.axis.lineWidth),Rm){const Mt=qe,Vt=F.axis.labelFont;Mt.xTickFont===void 0&&(F.axis.xTickFont=Vt),Mt.yTickFont===void 0&&(F.axis.yTickFont=Vt),Mt.y2TickFont===void 0&&(F.axis.y2TickFont=Vt)}if(F.axis.labelFont=F.axis.labelFont||vt.axis.labelFont,F.axis.xTickFont=F.axis.xTickFont||F.axis.labelFont,F.axis.yTickFont=F.axis.yTickFont||F.axis.labelFont,F.axis.y2TickFont=F.axis.y2TickFont||F.axis.yTickFont,F.axis.labelColor=K(F.axis.labelColor,vt.axis.labelColor),Lm){const Mt=F.axis.labelColor;qe.xLabelColor===void 0&&(F.axis.xLabelColor=Mt),qe.yLabelColor===void 0&&(F.axis.yLabelColor=Mt),qe.y2LabelColor===void 0&&(F.axis.y2LabelColor=Mt)}F.axis.xLabelColor=K(F.axis.xLabelColor,F.axis.labelColor),F.axis.yLabelColor=K(F.axis.yLabelColor,F.axis.labelColor),F.axis.y2LabelColor=K(F.axis.y2LabelColor,F.axis.yLabelColor),F.axis.activeLabelColor=K(F.axis.activeLabelColor,F.axis.labelColor),F.grid.lineWidth=W(F.grid.lineWidth,vt.grid.lineWidth),F.grid.dashArray=Un(F.grid.dashArray),F.focusGrid.lineWidth=W(F.focusGrid.lineWidth,vt.focusGrid.lineWidth),F.focusGrid.dashArray=Un(F.focusGrid.dashArray),F.region.opacity=W(F.region.opacity,vt.region.opacity),F.shape.barOpacity=W(F.shape.barOpacity,vt.shape.barOpacity),F.shape.barExpandedOpacity=W(F.shape.barExpandedOpacity,F.shape.barOpacity),F.shape.barLineWidth=W(F.shape.barLineWidth,vt.shape.barLineWidth),F.shape.barConnectLineWidth=W(F.shape.barConnectLineWidth,vt.shape.barConnectLineWidth),F.shape.candlestickLineWidth=W(F.shape.candlestickLineWidth,vt.shape.candlestickLineWidth),F.shape.candlestickStrokeColor=K(F.shape.candlestickStrokeColor,vt.shape.candlestickStrokeColor),F.shape.candlestickExpandedOpacity=W(F.shape.candlestickExpandedOpacity,vt.shape.candlestickExpandedOpacity),F.shape.lineWidth=W(F.shape.lineWidth,vt.shape.lineWidth),F.shape.lineFocusedWidth=W(F.shape.lineFocusedWidth,vt.shape.lineFocusedWidth),F.shape.areaOpacity=W(F.shape.areaOpacity,vt.shape.areaOpacity),F.shape.targetDefocusedOpacity=W(F.shape.targetDefocusedOpacity,vt.shape.targetDefocusedOpacity),F.shape.pointLineWidth=Tn(F.shape.pointLineWidth),F.selectedPoint.lineWidth=W(F.selectedPoint.lineWidth,vt.selectedPoint.lineWidth),F.focusPoint.lineWidth=W(F.focusPoint.lineWidth,vt.focusPoint.lineWidth),F.zoomBrush.opacity=W(F.zoomBrush.opacity,vt.zoomBrush.opacity),F.subchartBrush.opacity=W(F.subchartBrush.opacity,vt.subchartBrush.opacity),F.subchartBrush.handleOpacity=W(F.subchartBrush.handleOpacity,vt.subchartBrush.handleOpacity),F.subchartBrush.handleLineWidth=W(F.subchartBrush.handleLineWidth,vt.subchartBrush.handleLineWidth),F.treemap.lineWidth=W(F.treemap.lineWidth,vt.treemap.lineWidth),this.style=F,this.cacheContainer=t,this.cacheKey=Uo(t,n),l.remove()}reload(t,n){const i=Uo(t,n);i!==null&&this.style&&this.cacheContainer===t&&this.cacheKey===i||this.load(t,n)}getGridLineStyle(t,n={},i="line"){const a={};for(const s of this.gridLineSelectorOverrides)Bh(s.selector,t,n.class,i)&&Yo(a,s.style,this.directGridOverrideKeys);return Ea(a).length?a:void 0}}var Vh=Object.defineProperty,Wh=(e,t,n)=>t in e?Vh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fe=(e,t,n)=>Wh(e,typeof t!="symbol"?t+"":t,n);const rn=24,Ko=64,Pa=[he,ee,Yt];function wn(e,t){return Math.floor(e/t)}function Zo(e,t,n){var i,a;const s=wn(t.x,n),o=wn(t.x+((i=t.w)!=null?i:0),n),r=wn(t.y,n),l=wn(t.y+((a=t.h)!=null?a:0),n);for(let c=s;c<=o;c++)for(let u=r;u<=l;u++){const d=`${c}:${u}`,h=e.get(d);h?h.push(t):e.set(d,[t])}}function qo(e,t,n,i,a=0){const s=wn(t,i),o=wn(n,i),r=[];for(let l=-a;l<=a;l++)for(let c=-a;c<=a;c++){const u=e.get(`${s+l}:${o+c}`);if(u!=null&&u.length)for(let d=0;d<u.length;d++)r.push(u[d])}return r}function Yh(e,t){var n,i,a;const s=e.config.point_sensitivity;if(Number.isFinite(s))return s;(n=e.pointR)==null||n.call(e,t);const o=(a=(i=e.getPointSensitivity)==null?void 0:i.call(e,t))!=null?a:rn;return Number.isFinite(o)?o:rn}function Hh(e,t){return Ve(e,t)&&t.values.length>Is&&!e.config.data_selection_enabled&&Number.isFinite(e.config.point_sensitivity)&&Number.isFinite(e.config.point_r)}class jh{constructor(){fe(this,"bars",[]),fe(this,"points",[]),fe(this,"indices",[]),fe(this,"barGrid",new Map),fe(this,"pointGrid",new Map),fe(this,"plot",{x:0,y:0,w:0,h:0}),fe(this,"pointCellSize",rn),fe(this,"maxPointSensitivity",rn),fe(this,"grouped",!1),fe(this,"pointBased",!1),fe(this,"indexAxis","x")}rebuild(t,n){var i,a,s;const{current:o,margin:r,width:l,height:c}=t.state,u=t.filterTargetsToShow();this.bars=[],this.points=[],this.indices=[],this.barGrid=new Map,this.pointGrid=new Map,this.maxPointSensitivity=rn,this.indexAxis=t.config.axis_rotated?"y":"x",this.plot=t.state.hasTreemap?{x:0,y:0,w:o.width,h:o.height}:{x:r.left,y:r.top,w:l,h:c},this.grouped=!!t.config.tooltip_grouped&&!t.state.hasTreemap,this.pointBased=!(t.config.axis_x_forceAsSingle&&this.grouped)&&(!!((i=t.isMultipleX)!=null&&i.call(t))||u.some(_=>Ve(t,_)||We(t,_)));const h=this.grouped&&(!this.pointBased||t.config.data_selection_enabled&&t.config.data_selection_grouped)?new Map:null,f=(_,x,m)=>{var v,b;if(!h)return;const y=(b=(v=t.getXCacheKey)==null?void 0:v.call(t,m.x))!=null?b:m.index;Number.isFinite(m.index)&&!h.has(y)&&Tt(_,x)&&h.set(y,{x:_,y:x,data:m})};if(t.state.hasTreemap){const _=(a=t.getTreemapRoot)==null?void 0:a.call(t,t.data.targets),x=(_==null?void 0:_.children)||[];for(const m of x){const{data:v}=m;if(!ta(t,v))continue;const{x:b,y,w:T,h:w}=vn(t,m,_,!0);!Tt(b,y)||!Tt(b+T,y+w)||this.addBar({x:b,y,w:T,h:w,data:v})}this.indices=[];return}if(n.indices[I.BAR]||u.some(ee.bind(null,t))){const _=ee.bind(null,t),x=te(t,n,I.BAR,_),m=t.generateGetBarPoints(x,!1);u.filter(_).filter(v=>_n(t,v,Pa)).forEach(v=>{const b=Ae(t,v);for(let y=b.start;y<b.end;y++){const T=v.values[y];if(!Rt(t,T))continue;const w=Xn(t,m,T,y);if(!w)continue;const{rect:C}=w,k=r.left+C.x,S=r.top+C.y,{w:A,h:L}=C;this.addBar({x:k,y:S,w:A,h:L,data:T}),f(k+A/2,S+L/2,T)}})}if(n.indices[I.CANDLESTICK]||u.some(Yt.bind(null,t))){const _=Yt.bind(null,t),x=te(t,n,I.CANDLESTICK,_),m=(s=t.generateGetCandlestickPoints)==null?void 0:s.call(t,x,!1);m&&u.filter(_).filter(v=>_n(t,v,Pa)).forEach(v=>{var b;const y=Ae(t,v);for(let T=y.start;T<y.end;T++){const w=v.values[T];if(!((b=t.getCandlestickData)==null?void 0:b.call(t,w)))continue;const k=Gn(t,m,w,T);if(!k)continue;const{body:S}=k,A=r.left+S.x,L=r.top+S.y,{w:E,h:D}=S;this.addBar({x:A,y:L,w:Math.max(1,E),h:Math.max(1,D),data:w}),f(A+E/2,L+D/2,w)}})}const{cx:g,cy:p}=n.pos;g&&p&&u.filter(he.bind(null,t)).filter(_=>_n(t,_,Pa)).forEach(_=>{const x=Ae(t,_),m=Hh(t,_)?Fs(l,c,t.config.point_r):null;for(let v=x.start;v<x.end;v++){const b=_.values[v];if(!Rt(t,b))continue;const y=r.left+g(b,v),T=r.top+p(b,v),w=Yh(t,b);Tt(y,T)&&(m&&!Os(m,y-r.left,T-r.top)||(this.addPoint({x:y,y:T,sensitivity:w,data:b}),f(y,T,b)))}}),this.buildPointGrid(),this.indices=h?Array.from(h.values()).sort((_,x)=>_[this.indexAxis]-x[this.indexAxis]):[]}hitBar(t,n){for(const i of qo(this.barGrid,t,n,Ko)){const{w:a=0,h:s=0}=i;if(t>=i.x&&t<=i.x+a&&n>=i.y&&n<=i.y+s)return i.data}return null}hitPoint(t,n){var i,a;let s=null,o=Number.POSITIVE_INFINITY;for(const r of qo(this.pointGrid,t,n,this.pointCellSize,1)){const l=r.x-t,c=r.y-n,u=Math.sqrt(l*l+c*c),d=(i=r.sensitivity)!=null?i:rn;u<=d&&u<o&&(o=u,s=r)}return(a=s==null?void 0:s.data)!=null?a:null}findNearest(t,n){const i=this.hitBar(t,n);if(i)return i;if(!this.pointBased&&this.grouped&&this.isWithinPlot(t,n)){const a=this.findNearestIndexItem(t,n);if(a)return a.data}return this.hitPoint(t,n)}findNearestShape(t,n){var i;return(i=this.hitBar(t,n))!=null?i:this.hitPoint(t,n)}findNearestIndexByCoord(t,n){var i,a;return(a=(i=this.findNearestIndexItem(t,n))==null?void 0:i.data)!=null?a:null}findInRect(t,n=!1){const i=Math.min(t.x,t.x+t.w),a=Math.max(t.x,t.x+t.w),s=Math.min(t.y,t.y+t.h),o=Math.max(t.y,t.y+t.h),r=new Set,l=[],c=u=>{const d=u.data,h=`${d.id}:${d.index}`;r.has(h)||(r.add(h),l.push(d))};if(n){const u=this.indexAxis,d=u==="y"?s:i,h=u==="y"?o:a;return this.indices.filter(f=>f[u]>=d&&f[u]<=h).forEach(c),l}return this.bars.filter(u=>{var d,h;const f=(d=u.w)!=null?d:0,g=(h=u.h)!=null?h:0;return!(a<u.x||u.x+f<i)&&!(o<u.y||u.y+g<s)}).forEach(c),this.points.filter(u=>u.x>=i&&u.x<=a&&u.y>=s&&u.y<=o).forEach(c),l}addBar(t){this.bars.push(t),Zo(this.barGrid,t,Ko)}addPoint(t){var n;const i=(n=t.sensitivity)!=null?n:rn;this.maxPointSensitivity=Math.max(this.maxPointSensitivity,i),this.points.push(t)}buildPointGrid(){this.pointCellSize=Math.max(1,this.maxPointSensitivity),this.pointGrid=new Map;for(const t of this.points)Zo(this.pointGrid,t,this.pointCellSize)}isWithinPlot(t,n){const{plot:i}=this;return t>=i.x&&t<=i.x+i.w&&n>=i.y&&n<=i.y+i.h}findNearestIndexItem(t,n){const{indexAxis:i,indices:a}=this,s=i==="y"?n:t;if(!a.length)return null;let o=0,r=a.length-1;for(;o<r;){const u=o+r>>1;a[u][i]<s?o=u+1:r=u}const l=a[o],c=a[o-1];return c&&Math.abs(c[i]-s)<Math.abs(l[i]-s)?c:l}}var Ci=bt(5),Uh=Object.defineProperty,Jo=Object.getOwnPropertySymbols,Kh=Object.prototype.hasOwnProperty,Zh=Object.prototype.propertyIsEnumerable,Qo=(e,t,n)=>t in e?Uh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ft=(e,t)=>{for(var n in t||(t={}))Kh.call(t,n)&&Qo(e,n,t[n]);if(Jo)for(var n of Jo(t))Zh.call(t,n)&&Qo(e,n,t[n]);return e};const j={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},at={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},Si={area:"bb-area",areas:"bb-areas"},It={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},ie={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},De={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},Xt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Da={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},ln={dragarea:"bb-dragarea",INCLUDED:"_included_"},Kn={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},ae={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},H={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},we={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},Ie={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},lt={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",xgridFocusContinuous:"bb-xgrid-focus-continuous",ygridFocus:"bb-ygrid-focus"},kt={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},Me={level:"bb-level",levels:"bb-levels"},tr={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},Zn={region:"bb-region",regions:"bb-regions"},ut={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},At={shape:"bb-shape",shapes:"bb-shapes"},er={brush:"bb-brush",subchart:"bb-subchart"},Et={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},ki={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},nr={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Ia={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var V=ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft(ft({},j),at),Si),It),ie),De),Xt),Da),ln),ae),H),we),Ie),lt),Kn),kt),Me),tr),Zn),ut),At),er),Et),ki),nr),Ia),qh={boost_useCssRule:!1,boost_useWorker:!1,boost_workerUrl:void 0},Jh={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},Qh={legend_contents_bindto:void 0,legend_contents_template:"<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_format:void 0,legend_padding:0,legend_position:"bottom",legend_show:!0,legend_tooltip:!1,legend_usePoint:!1},tf={bindto:"#chart",background:{},clipPath:!0,svg_classname:void 0,size_width:void 0,size_height:void 0,padding:!0,padding_mode:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,resize_auto:!0,resize_timer:!0,onclick:void 0,onover:void 0,onout:void 0,onresize:void 0,onresized:void 0,onbeforeinit:void 0,oninit:void 0,onafterinit:void 0,onrendered:void 0,transition_duration:250,plugins:[],render:{},render_mode:"svg",canvas_theme:{},regions:[]},ef={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},nf={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:void 0,tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:()=>{},tooltip_onhide:()=>{},tooltip_onshown:()=>{},tooltip_onhidden:()=>{},tooltip_order:null},af={data_x:void 0,data_idConverter:e=>e,data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_groupsZeroAs:"positive",data_color:void 0,data_colors:{},data_labels:{},data_labels_backgroundColors:void 0,data_labels_colors:void 0,data_labels_position:{},data_labels_imgUrl:void 0,data_hide:!1,data_filter:void 0,data_onclick:()=>{},data_onover:()=>{},data_onout:()=>{},data_onshown:void 0,data_onhidden:void 0,data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},sf={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},interaction_onout:!0},of=Object.defineProperty,rf=(e,t,n)=>t in e?of(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lf=(e,t,n)=>rf(e,typeof t!="symbol"?t+"":t,n);const ir=class Wc{static setOptions(t){for(let n=0;n<t.length;n++)Object.assign(this.data,t[n])}constructor(){return Cu(tf,qh,af,Jh,sf,Qh,ef,nf,Wc.data)}};lf(ir,"data",{});let cn=ir;class cf{constructor(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX:null,subY:null,subY2:null},axisTooltip:{x:null,y:null,y2:null},defs:null,tooltip:null,legend:null,title:null,subchart:{main:null,bar:null,line:null,area:null},arcs:null,bar:null,candlestick:null,line:null,area:null,circle:null,radar:null,text:null,grid:{main:null,x:null,y:null},gridLines:{main:null,x:null,y:null},region:{main:null,list:null},eventRect:null,zoomResetBtn:null}}}class uf{constructor(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasFunnel:!1,hasRadar:!1,hasTreemap:!1,isCanvasMode:!1,canvasShape:null,canvasFocusKey:null,canvasSubchartBrushDragging:!1,canvasSubchartBrushMode:null,canvasSubchartBrushStart:null,canvasSubchartBrushOrigin:null,canvasSubchartBrushMoved:!1,canvasFlowFrame:null,canvasFlowFinish:null,canvasFocusMainRedraw:!1,cssRule:{},loading:void 0,domain:void 0,subchartSourceTypes:void 0,current:{domain:void 0,width:0,height:0,dataMax:0,maxTickSize:{x:{width:0,height:0,ticks:[],clipPath:0,domain:""},y:{width:0,height:0,domain:""},y2:{width:0,height:0,domain:""}},types:[],needle:void 0,zoomDomain:null},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,canvasInlineStyle:{minHeight:""},canvasSelection:new Set,canvasSelectionDragStart:null,canvasSelectionDragIncluded:new Set,canvasSelectionDragging:!1,canvasSelectionDragMoved:!1,canvasSelectionDragMoveHandler:null,canvasSelectionDragEndHandler:null,eventReceiver:{currentIdx:-1,rect:{},data:[],coords:[]},axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},event:null,dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,redrawing:!1,resizing:!1,toggling:!1,zooming:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",orgConfig:{},hiddenTargetIds:new Set,hiddenLegendIds:new Set,focusedTargetIds:new Set,defocusedTargetIds:new Set,radius:0,innerRadius:0,outerRadius:void 0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null},pendingRaf:null,rafBatchQueue:[],dirty:{data:!1,visibility:!1,size:!1},redrawGeneration:0,dataGeneration:0,_targetsToShow:null,_cachedDrawShape:null,_canvasVisibleRangeCache:null,_canvasXDataTickCache:null,_canvasXTickValuesCache:null,_eventRectFingerprint:null,_lastTooltipMouse:null,_gridFocusEl:null,generateClassCache:new Map}}}const ar={element:cf,state:uf};class df{constructor(){Object.keys(ar).forEach(t=>{this[t]=new ar[t]})}getStore(t){return this[t]}}var hf=Object.defineProperty,ff=(e,t,n)=>t in e?hf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gf=(e,t,n)=>ff(e,typeof t!="symbol"?t+"":t,n);const U={bubbleBaseLength:"$baseLength",bubbleMaxValue:"$bubbleMaxValue",colorPattern:"__colorPattern__",dataMinMax:"$dataMinMax",dataTotalSum:"$dataTotalSum",dataTotalPerIndex:"$totalPerIndex",domainMinMax:"$domainMinMax",filteredTargets:"$filteredTargets",filteredNullish:"$filteredNullish",svgLeft:"$svgLeft",valuesByX:"$valuesByX",legendItemTextBox:"legendItemTextBox",legendItemMap:"$legendItemMap",radarPoints:"$radarPoints",radarTextWidth:"$radarTextWidth",setOverOut:"setOverOut",callOverOutForTouch:"callOverOutForTouch",textRect:"textRect",shapeOffset:"$shapeOffset",maxTickSize:"$maxTickSize",maxDataCountTarget:"$maxDataCountTarget",valuesXIndexMap:"$valuesXIndexMap"};class pf{constructor(){gf(this,"cache",new Map)}add(t,n,i=!1){const a=i?this.cloneTarget(n):n;return this.cache.set(t,a),a}remove(t){const n=Q(t)?[t]:t;for(let i=0;i<n.length;i++)this.cache.delete(n[i])}get(t,n=!1){if(n&&Array.isArray(t)){const i=[];for(let a=0,s;s=t[a];a++)this.cache.has(s)&&i.push(this.cache.get(s));return i}else return this.cache.has(t)?this.cache.get(t):null}has(t){return this.cache.has(t)}getKeys(){return Array.from(this.cache.keys())}reset(t,n){t?this.cache.clear():this.cache.forEach((i,a)=>{/^\$/.test(a)&&(n!=null&&n.some(s=>a.startsWith(s))||this.cache.delete(a))})}cloneTarget(t){return{id:t.id,id_org:t.id_org,values:t.values.map(n=>({x:n.x,value:n.value,id:n.id}))}}}const sr="https://github.com/naver/billboard.js/blob/master/MODULE_IMPORTS.md";function _f(e){const t=e,{config:n}=t;let i="";if(se(n.data_type||n.data_types)&&!t[Ki.LINE])i="line";else for(const a in Ki){const s=I[a];if(t.hasType(s)&&!t[Ki[a]]){i=s;break}}i&&or(`Please, make sure if %c${wu(i)}`,"module has been imported and specified correctly.",sr)}function Mm(e){const t=Mn[e];t&&or(`Please, make sure if %c${t}`,"module has been imported and specified correctly.",sr)}function or(e,t,n){var i;const a="[billboard.js]";if((i=N.console)==null?void 0:i.error){const o=t?["background:red;color:white;display:block;font-size:15px",t]:[];console.error(`\u274C ${a} ${e}`,"background:red;color:white;display:block;font-size:15px",...o),n&&console.info("%c\u2139\uFE0F","font-size:15px",n)}throw Error(`${a} ${e.replace(/\%c([a-z-]+)/i,"'$1' ")} ${t!=null?t:""}`)}const xf=/\s?(bb-)/g,mf=/\.+/g;function vf(e){return e.replace(xf,".$1").replace(mf,".")}function rr(e,t,n=!1){const i=s=>s[e?"getBoundingClientRect":"getBBox"](),a=e?"rectClient":"rectBBox";return n?i(t):!(a in t)||t.hasAttribute("width")&&t[a].width!==+(t.getAttribute("width")||0)?t[a]=i(t):t[a]}function Cn(e,t,n=[-1,1],i=!1){if(!(!e||!Q(t)))if(t.indexOf(`
23
23
  `)===-1)e.text(t);else{const a=[e.text(),t].map(s=>s.replace(/[\s\n]/g,""));if(a[0]!==a[1]){const s=t.split(`
24
- `),o=i?s.length-1:1;e.html(""),s.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?n[0]*o:n[1]}em`).text(r)})}}}function ko(e){const{x:t,y:n,width:i,height:a}=Xe(e,!0);return[{x:t,y:n+a},{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+a}]}function Lo(e){const{width:t,height:n}=ht(e),i=ko(e),a=i[0].x,s=Math.min(i[0].y,i[1].y);return{x:a,y:s,width:t,height:n}}function Jt(e,t){var n;const i=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let a=[0,0];try{a=(0,F.pointer)(i||e,t)}catch(s){}return a.map(s=>isNaN(s)?0:s)}function ht(e,t=!1){return Ao(!0,e,t)}function Xe(e,t=!1){return Ao(!1,e,t)}function Rh(e,t,n){const{rootSelector:i="",sheet:a}=e,s=`${i} ${Lh(t)} {${n.join(";")}}`;return a[a.insertRule?"insertRule":"addRule"](s,a.cssRules.length)}function Eh(e){let t=[];return e.forEach(n=>{var i;try{n.cssRules&&n.cssRules.length&&(t=t.concat(je(n.cssRules)))}catch(a){(i=B.console)==null||i.warn(`Error while reading rules from ${n.href}: ${String(a)}`)}}),t}function Ro(e){var t,n,i,a,s,o;return{x:((n=(t=B.pageXOffset)!=null?t:B.scrollX)!=null?n:0)+((i=e.scrollLeft)!=null?i:0),y:((s=(a=B.pageYOffset)!=null?a:B.scrollY)!=null?s:0)+((o=e.scrollTop)!=null?o:0)}}function pi(e,t=0,n=0,i=!0){const a=new DOMPoint(t,n),s=e.getScreenCTM(),o=a.matrixTransform(i?s==null?void 0:s.inverse():s);if(i===!1){const r=ht(e);o.x-=r.x,o.y-=r.y}return o}function xa(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function _a(e,t){var n;const i=(n=e==null?void 0:e.getAttribute)==null?void 0:n.call(e,t);if(i)return parseFloat(i);const a=xa(e);return t==="x"?a.e:a.f}function ma(e){const t=e.attr("viewBox");return t?t.trim().split(/[\s,]+/).length===4:!1}function Ph(e,t,n=!1){const i=!!e.node;let a=!1;for(const[s,o]of Object.entries(t))if(a=i?e.style(s)===o:e.style[s]===o,n?!a:a)break;return a}function Gn(){var e,t;return((e=tt)==null?void 0:e.hidden)===!1||((t=tt)==null?void 0:t.visibilityState)==="visible"}function Dh(e,t){const{DocumentTouch:n,matchMedia:i,navigator:a}=B,s=i==null?void 0:i("(pointer:coarse)").matches;let o=!1;if(t)if(a&&"maxTouchPoints"in a)o=a.maxTouchPoints>0;else if("ontouchmove"in B||n&&tt instanceof n)o=!0;else if(s)o=!0;else{const l=a.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!s&&(i==null?void 0:i("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function Eo(e,t){e.pendingRaf!==null?(B.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=B.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=B.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}const Ih={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,i=e())=>{t.dispatchEvent(new MouseEvent(n,i))}}catch(t){return(n,i,a=e())=>{const s=tt.createEvent("MouseEvent");s.initMouseEvent(i,a.bubbles,a.cancelable,B,0,a.screenX,a.screenY,a.clientX,a.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(e,t,n)=>{const i=new Touch(ve({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}},{setTimeout:Mh,clearTimeout:$h}=B;function Fh(e){const t=[];let n;const i=function(){i.clear(),e===!1?n=Qa(()=>{n=null,t.forEach(a=>a())},{timeout:200}):n=Mh(()=>{n=null,t.forEach(a=>a())},X(e)?e:200)};return i.clear=()=>{n&&((e===!1?gc:$h)(n),n=null)},i.add=a=>t.push(a),i.remove=a=>{const s=t.indexOf(a);s!==-1&&t.splice(s,1)},i}function Po(){let e=[];const t=function(n,i){function a(){var s;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(s=l.empty)!=null&&s.call(l)){o++;continue}if(Gn()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}ls(()=>{i==null||i()},a)};return t.add=function(n){ot(n)?e=e.concat(n):e.push(n)},t}const tn={};let Oh=0;function Bh(e,t){var n;const i=e.toString(),a=(n=t==null?void 0:t.map(String).join(";"))!=null?n:"",s=(i+a).replace(/(function|[\s\W\n])/g,"").substring(0,30);if(!(s in tn))try{const o=new B.Blob([`${a}
25
-
26
- self.onmessage=function({data}) {
27
- const result = (${i}).apply(null, data.args);
28
- self.postMessage({id: data.id, result});
29
- };`],{type:"text/javascript"});tn[s]={src:B.URL.createObjectURL(o),worker:null}}catch(o){return null}return{key:s,src:tn[s].src}}function zh(e,t){const n=tn[e];if(!n)return null;if(!n.worker){try{n.worker=new B.Worker(t)}catch(i){return null}n.worker&&(n.worker.onerror=function(i){console.error?console.error(i):console.log(i)})}return n.worker}function va(e=!0,t,n,i){let a=function(...s){const o=t(...s);n(o)};if(B.Worker&&e){const s=Bh(t,i),o=s&&zh(s.key,s.src);o&&(a=function(...r){const l=++Oh,c=function(d){var u;((u=d.data)==null?void 0:u.id)===l&&(o.removeEventListener("message",c),n(d.data.result))};o.addEventListener("message",c),o.postMessage({id:l,args:r})})}return a}function Nh(){for(const e in tn){const t=tn[e];t.worker&&t.worker.terminate(),t.src&&B.URL.revokeObjectURL(t.src),delete tn[e]}}const ba=34,Wn=10,ya=13;function Do(e){const t=e.charCodeAt(0);function n(a,s){const o=[];let r=a.length,l=0,c=0,d=r<=0,u=!1;a.charCodeAt(0)===65279&&l++,a.charCodeAt(r-1)===Wn&&--r,a.charCodeAt(r-1)===ya&&--r;function h(){if(d)return null;if(u)return u=!1,null;const g=l;let p,x;if(a.charCodeAt(g)===ba){for(;++l<r;)if(a.charCodeAt(l)===ba){if(a.charCodeAt(l+1)!==ba)break;l++}return(x=l++)>=r?d=!0:(p=a.charCodeAt(l++))===Wn?u=!0:p===ya&&(u=!0,a.charCodeAt(l)===Wn&&++l),a.slice(g+1,x).replace(/""/g,'"')}for(;l<r;){if((p=a.charCodeAt(x=l++))===Wn)u=!0;else if(p===ya)u=!0,a.charCodeAt(l)===Wn&&++l;else if(p!==t)continue;return a.slice(g,x)}return d=!0,a.slice(g,r)}let f;for(;(f=h())!==null;){const g=[];for(;f!==null;)g.push(f),f=h();if(s){const p=s(g,c++);p!=null&&o.push(p)}else o.push(g)}return o}function i(a,s){let o=[];return n(a,(r,l)=>{var c;if(l===0)return o=r,null;const d={};for(let u=0;u<o.length;u++)d[o[u]]=(c=r[u])!=null?c:"";return s?s(d,l-1,o):d})}return{parse:i,parseRows:n}}const Io=Do(","),Mo=Do(" "),Xh=Io.parse,Gh=Io.parseRows,Wh=Mo.parse,Vh=Mo.parseRows;function Ta(e){const t=[];return e.forEach(function(n,i){const a=n[0];n.forEach(function(s,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof s=="undefined")throw new Error(`Source data is missing a component at (${i}, ${o})!`);t[o-1][a]=s}})}),t}function wa(e){const t=e[0],n=[];return e.forEach(function(i,a){if(a>0){const s={};i.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${a}, ${r})!`);s[t[r]]=o}),n.push(s)}}),n}function $o(e,t){const n=[];let i,a;if(Array.isArray(e)){const s=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let d=o;return c.some(function(u){return!(d=d&&typeof d=="object"&&u in d?d[u]:void 0)}),d};t.x?i=t.value.concat(t.x):i=t.value,n.push(i),e.forEach(function(o){const r=i.map(function(l){let c=s(o,l);return typeof c=="undefined"&&(c=null),c});n.push(r)}),a=wa(n)}else Object.keys(e).forEach(function(s){var o;const r=[].concat(e[s]);(o=r.unshift)==null||o.call(r,s),n.push(r)}),a=Ta(n);return a}function Hh(e,t="csv",n,i,a){const s=new XMLHttpRequest,o={csv:Yh,tsv:jh,json:$o};s.open("GET",e),n&&Object.keys(n).forEach(function(r){s.setRequestHeader(r,n[r])}),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){const r=s.responseText;r&&a.call(this,o[t](t==="json"?JSON.parse(r):r,i))}else throw new Error(`${e}: Something went wrong loading!`)},s.send()}function Fo(e,t){const n=e.rows(t);let i;return n.length===1?(i=[{}],n[0].forEach(a=>{i[0][a]=null})):i=e.parse(t),i}function Yh(e){return Fo({rows:Gh,parse:Xh},e)}function jh(e){return Fo({rows:Vh,parse:Wh},e)}function Oo(e,t){const n=e||(t==null?void 0:t.data_keys);return n!=null&&n.x&&(t.data_x=n.x),n}function Uh(e,t,n){const i=this,{config:a}=i;let s;e.forEach(o=>{const r=i.getXKey(o);if(n.customX||n.timeSeries?n.xs.indexOf(r)>=0?s=(n.appendXs&&i.data.xs[o]||[]).concat(t.map((l,c)=>{const d=l[r];return J(d)?i.generateTargetX(d,o,c):!1}).filter(l=>l!==!1)):a.data_x?s=this.getOtherTargetXs():mt(a.data_xs)&&(s=i.getXValuesOfXKey(r,i.data.targets)):s=t.map((l,c)=>c),s)i.data.xs[o]=s;else throw new Error(`x is not defined for id = "${o}".`)})}var Kh={convertData(e,t){const{config:n}=this,i=s=>s!=null&&s.length&&!Qt(s[0])?n.boost_useWorker:!1;let a=e;if(e.bindto&&(a={},["url","mimeType","headers","keys","json","rows","columns"].forEach(s=>{const o=`data_${s}`;o in e&&(a[s]=e[o])})),a.url&&t)Hh(a.url,a.mimeType,a.headers,Oo(a.keys,n),t);else if(a.json)va(i(a.json),$o,t,[Ta,wa])(a.json,Oo(a.keys,n));else if(a.rows)va(i(a.rows),wa,t)(a.rows);else if(a.columns)va(i(a.columns),Ta,t)(a.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const n=this,{axis:i,config:a,state:s}=n,o=a.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((g,p)=>(n.isX.call(n,p)?g.xs.push(p):g.ids.push(p),g),{ids:[],xs:[]}):{ids:[],xs:[]},d={appendXs:t,xs:c,categorized:i==null?void 0:i.isCategorized(),timeSeries:i==null?void 0:i.isTimeSeries(),customX:i==null?void 0:i.isCustomX()};Uh.bind(n)(l,e,d);const u=d.customX&&d.categorized&&a.axis_x_categories.length?new Map(a.axis_x_categories.map((g,p)=>[g,p])):null,h=a.data_idConverter.bind(n.api),f=l.map((g,p)=>{const x=h(g),_=n.getXKey(g),v=d.customX&&d.categorized,m=v&&p===0&&(()=>{const T=cs(a.axis_x_categories);return e.every(w=>T.has(w[_]))})(),b=e.__append__,y=_===null&&b?n.api.data.values(g).length:0;return{id:x,id_org:g,values:e.map((T,w)=>{var C;const A=T[_];let S=T[g],k;if(S=S!==null&&!isNaN(S)&&!Q(S)?+S:ot(S)||Q(S)?S:null,(v||s.hasRadar)&&p===0&&!yt(A)){!m&&w===0&&!b&&(a.axis_x_categories=[],u&&u.clear());const L=String(A);k=(C=u==null?void 0:u.get(L))!=null?C:-1,k===-1&&(k=a.axis_x_categories.length,a.axis_x_categories.push(A),u==null||u.set(L,k))}else k=n.generateTargetX(A,g,y+w);return(yt(S)||n.data.xs[g].length<=w)&&(k=void 0),{x:k,value:S,id:x,index:-1}}).filter(T=>ct(T.x))}});if(f.forEach(g=>{var p;a.data_xSort&&(g.values=g.values.sort((x,_)=>{const v=x.x||x.x===0?x.x:1/0,m=_.x||_.x===0?_.x:1/0;return v-m})),g.values.forEach((x,_)=>x.index=_),(p=n.data.xs[g.id])==null||p.sort((x,_)=>x-_)}),s.hasNegativeValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value<0)),s.hasPositiveValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value>0)),o&&n.isValidChartType(o)){const g=n.mapToIds(f).filter(p=>!(p in a.data_types)||!n.isValidChartType(a.data_types[p]));n.setTargetType(g,o)}return f.forEach(g=>n.cache.add(g.id_org,g,!0)),f}};const Zh={areaRange:{high:0,mid:1,low:2},candlestick:{open:0,high:1,low:2,close:3,volume:4}};function Bo(e){return ot(e)?e:[e]}var qh={isX(e){const t=this,{config:n}=t,i=n.data_x&&e===n.data_x,a=mt(n.data_xs)&&Ic(n.data_xs,e);return i||a},isStackNormalized(){const{config:e}=this;return!!((e.data_stack_normalize===!0||Yt(e.data_stack_normalize))&&e.data_groups.length)},isStackNormalizedPerGroup(){var e;const{config:t}=this;return!!(Yt(t.data_stack_normalize)&&((e=t.data_stack_normalize)!=null&&e.perGroup)&&t.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(n=>n.indexOf(e)>=0&&n.length>1):t.length>0},hasAxisGroupedData(e){const t=this,{axis:n}=t;return t.data.targets.filter(s=>n.getId(s.id)===e).map(s=>s.id).some(s=>t.isGrouped(s))},getXKey(e){const t=this,{config:n}=t;return n.data_x?n.data_x:mt(n.data_xs)?n.data_xs[e]:null},getXValuesOfXKey(e,t){const n=this,i=t&&mt(t)?n.mapToIds(t):[];let a;return i.forEach(s=>{n.getXKey(s)===e&&(a=n.data.xs[s])}),a},getIndexByX(e,t){const n=this;return t?t.indexOf(nt(e)?e:+e):(n.filterByX(n.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const n=this;return e in n.data.xs&&n.data.xs[e]&&J(n.data.xs[e][t])?n.data.xs[e][t]:t},getOtherTargetXs(){const e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},getOtherTargetX(e){const t=this.getOtherTargetXs();return t&&e<t.length?t[e]:null},addXs(e){const t=this,{config:n}=t;Object.keys(e).forEach(i=>{n.data_xs[i]=e[i]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(mt(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:n}=t;let i;return e&&(i=n.data_names[e.id],e.name=i!==void 0?i:e.id),e},getAllValuesOnIndex(e,t=!1){const n=this;let i=n.filterTargetsToShow(n.data.targets).map(a=>n.addName(n.getValueOnIndex(a.values,e)));return t&&(i=i.filter(a=>a&&"value"in a&&J(a.value))),i},getValueOnIndex(e,t){var n;if(((n=e[t])==null?void 0:n.index)===t)return e[t];const i=e.filter(a=>a.index===t);return i.length?i[0]:null},updateTargetX(e,t){const n=this;e.forEach(i=>{i.values.forEach((a,s)=>{a.x=n.generateTargetX(t[s],i.id,s)}),n.data.xs[i.id]=t})},updateTargetXs(e,t){const n=this;e.forEach(i=>{t[i.id]&&n.updateTargetX([i],t[i.id])})},generateTargetX(e,t,n){const i=this,{axis:a}=i;let s=a!=null&&a.isCategorized()?n:e||n;if(a!=null&&a.isTimeSeries()){const o=Xt.bind(i);s=o(e||i.getXValue(t,n))}else a!=null&&a.isCustomX()&&!(a!=null&&a.isCategorized())&&(s=J(e)?+e:i.getXValue(t,n));return s},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return ct(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return ct(t)?t:null},getBaseValue(e){const t=this,{hasAxis:n}=t.state;let{value:i}=e;return i&&n&&(t.isAreaRangeType(e)?i=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(i=t.getBubbleZData(i,"y"))),i},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let n=1/0,i=-1/0;const a=e||this.data.targets.map(s=>s.values);for(let s=0;s<a.length;s++){const o=a[s];for(let r=0;r<o.length;r++){const l=t(o[r]);X(l)&&(l<n&&(n=l),l>i&&(i=l))}}return{min:n,max:i}},getMinMaxData(){const e=this,t=j.dataMinMax;let n=e.cache.get(t);if(!n){const i=e.data.targets.map(c=>c.values),a=e.getMinMaxValue(i),s=[],o=[],{min:r,max:l}=a;i.forEach(c=>{const d=e.getFilteredDataByValue(c,r),u=e.getFilteredDataByValue(c,l);if(d.length)for(let h=0;h<d.length;h++)s.push(d[h]);if(u.length)for(let h=0;h<u.length;h++)o.push(u[h])}),e.cache.add(t,n={min:s,max:o})}return n},getTotalPerIndex(e){const t=this,{config:n}=t,i=e?`${j.dataTotalPerIndex}-${e}`:j.dataTotalPerIndex;let a=t.cache.get(i);if((t.config.data_groups.length||t.isStackNormalized())&&!a){a=[];let{targets:s}=t.data;if(t.isStackNormalizedPerGroup()&&e){const o=n.data_groups.find(r=>r.indexOf(e)>=0);if(o)s=s.filter(r=>o.indexOf(r.id)>=0);else return null}s.forEach(o=>{o.values.forEach((r,l)=>{a[l]||(a[l]=0),a[l]+=X(r.value)?r.value:0})}),t.cache.add(i,a)}return a},getTotalDataSum(e){const t=this,n=j.dataTotalSum;let i=t.cache.get(n);return X(i)||(i=t.data.targets.reduce((a,s)=>a+s.values.reduce((o,r)=>{var l;return o+((l=r.value)!=null?l:0)},0),0),t.cache.add(n,i)),e&&(i-=t.getHiddenTotalDataSum()),i},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:n}}=e;let i=0;return n.size&&(i=t.data.values.bind(t)([...n]).reduce((a,s)=>a+s,0)),i},getFilteredDataByValue(e,t){return e.filter(n=>this.getBaseValue(n)===t)},getMaxDataCount(){const{targets:e}=this.data;let t=0;for(let n=0;n<e.length;n++)e[n].values.length>t&&(t=e[n].values.length);return t},getMaxDataCountTarget(){const e=this,{cache:t,state:n}=e,i=t.get(j.maxDataCountTarget);if(i&&i.generation===n.dataGeneration)return i.value;let a=e.filterTargetsToShow()||[];const s=a.length,o=e.config.axis_x_inverted;if(s>1){const r=[];for(let l=0;l<a.length;l++){const c=a[l].values;for(let d=0;d<c.length;d++)r.push(c[d].x)}a=r,a=on(Fi(a)).map((l,c,d)=>({x:l,index:o?d.length-c-1:c}))}else s&&(a=a[0].values.concat());return t.add(j.maxDataCountTarget,{value:a,generation:n.dataGeneration}),a},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?ot(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const n=this.mapToIds(e);for(let i=0,a;a=n[i];i++)if(a===t)return!0;return!1},isTargetToShow(e){return!this.state.hiddenTargetIds.has(e)},isLegendToShow(e){return!this.state.hiddenLegendIds.has(e)},getTargetsToShow(){var e;const{state:t}=this;return(e=t._targetsToShow)!=null?e:this.filterTargetsToShow()},filterTargetsToShow(e){const t=this;if(!e){const{cache:n,data:i,state:a}=t,s=j.filteredTargets,o=n.get(s);if(o&&o.generation===a.dataGeneration)return o.value;const r=i.targets.filter(l=>t.isTargetToShow(l.id));return n.add(s,{value:r,generation:a.dataGeneration}),r}return e.filter(n=>t.isTargetToShow(n.id))},mapTargetsToUniqueXs(e){const t=this,{axis:n}=t;let i=[];return e!=null&&e.length&&(i=Fi(Fc(e.map(a=>a.values.map(s=>+s.x)))),i=n!=null&&n.isTimeSeries()?i.map(a=>new Date(+a)):i.map(Number)),on(i)},addTargetIds(e,t){const{state:n}=this;Bo(t).forEach(i=>n[e].add(i))},removeTargetIds(e,t){const{state:n}=this;Bo(t).forEach(i=>n[e].delete(i))},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:n}=t.state,i={},a=t.isMultipleX();let s=null;if(a){const o=t.cache.get(j.valuesXIndexMap);if(o&&o.generation===t.state.dataGeneration)s=o.value;else{const r=t.mapTargetsToUniqueXs(t.data.targets).map(l=>nt(l)?l:+l);s=new Map(r.map((l,c)=>[l,c])),t.cache.add(j.valuesXIndexMap,{value:s,generation:t.state.dataGeneration})}}return e.forEach(o=>{const r=[];o.values.filter(({value:l})=>J(l)||l===null).forEach(l=>{let{value:c}=l;if(c!==null&&t.isCandlestickType(l)&&(c=ot(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),ot(c))r.push(...c);else if(Q(c)&&"high"in c)r.push(...Object.values(c));else if(t.isBubbleZType(l))r.push(n&&t.getBubbleZData(c,"y"));else if(a&&s){const d=nt(l.x)?l.x:+l.x,u=s.get(d);u!==void 0&&(r[u]=c)}else r.push(c)}),i[o.id]=r}),i},hasMultiTargets(){return this.filterTargetsToShow().length>1},orderTargets(e){const t=this,n=e.slice(),i=t.getSortCompareFn();return i&&n.sort(i),n},getSortCompareFn(e=!1){const t=this,{config:n}=t,i=n.data_order,a=/asc/i.test(i),s=/desc/i.test(i);let o;if(a||s){const r=(c,d)=>c+Math.abs(d.value),l=c=>X(c)?c:"values"in c?c.values.reduce(r,0):c.value;o=(c,d)=>{const u=l(c),h=l(d);return e?a?u-h:h-u:a?h-u:u-h}}else O(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return this.getValuesByX(e).get(this.getXCacheKey(t))||[]},filterNullish(e){const t=n=>J(n.value);return e&&e.filter(n=>"value"in n?t(n):n.values.some(t))},filterRemoveNull(e){return e.filter(t=>J(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(n=>({id:n.id,id_org:n.id_org,values:n.values.filter(i=>t[0]<=i.x&&i.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return He(e)&&e||Yt(e)&&mt(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:n,config:i,state:{hasRadar:a,inputType:s,eventReceiver:{coords:o,rect:r}}}=t;let l;if(a){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const d=(0,F.select)(c).datum();l=d&&Object.keys(d).length===1?d.index:void 0}else{const c=i.axis_rotated,d=Ro(n.chart.node()),u=s==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?u.clientY+d.y:u.clientX+d.x;if(ma(n.svg)){const f=[h,0];c&&f.reverse(),h=pi(n.eventRect.node(),...f)[c?"y":"x"]}else h-=c?r.top:r.left;l=Oi(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,n){var i,a,s;const o=this,r=1.3,l=[e,t].map(c=>o.dataLabelFormat()(c));if(o.config.render_mode==="canvas"&&!o.$el.svg){const c=(a=(i=o.$el.chart)==null?void 0:i.node)==null?void 0:a.call(i),d=c==null?void 0:c.ownerDocument,u=d==null?void 0:d.createElementNS("http://www.w3.org/2000/svg","svg");if(c&&u){const h=l.map(g=>{const p=d.createElementNS("http://www.w3.org/2000/svg","text");return p.textContent=g,u.appendChild(p),p});u.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",c.appendChild(u);const f=h.map(g=>g.getBoundingClientRect()[n]*r);return u.remove(),f}}return((s=o.getTextRect(l))==null?void 0:s.map(c=>c[n]*r))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const n=e[t].x,i=[];let a;for(a=t-1;a>=0&&n===e[a].x;a--)i.push(e[a]);for(a=t;a<e.length&&n===e[a].x;a++)i.push(e[a]);return i},getXCacheKey(e){return nt(e)?e:+e},getValuesByX(e){const t=this,{cache:n,state:i}=t,a=e.map(r=>{const{values:l}=r,c=l[0],d=l[l.length-1];return`${r.id}:${l.length}:${c?t.getXCacheKey(c.x):""}:${d?t.getXCacheKey(d.x):""}`}).join("|"),s=n.get(j.valuesByX);if(s&&s.generation===i.dataGeneration&&s.targetKey===a)return s.value;const o=new Map;for(let r=0;r<e.length;r++){const l=e[r].values;for(let c=0;c<l.length;c++){const d=l[c],u=t.getXCacheKey(d.x),h=o.get(u);h?h.push(d):o.set(u,[d])}}return n.add(j.valuesByX,{generation:i.dataGeneration,targetKey:a,value:o}),o},getClosestCandidates(e,t,n=!0){const i=this,{config:a,scale:s}=i,o=e.length,r=e[0];if(!n||o<200||!r||!a.data_xSort)return e;const l=i.isBarType(r.id),c=i.isCandlestickType(r.id),d=a.point_sensitivity;if(!(l||c)&&!X(d))return e;const u=s.zoom||s.x,h=t[+a.axis_rotated],f=u(e[0].x)<=u(e[o-1].x);let g=0,p=o-1;for(;g<p;){const b=g+p>>1,y=u(e[b].x);(f?y<h:y>h)?g=b+1:p=b}const x=[],_=new Set,v=b=>{b>=0&&b<o&&!_.has(b)&&(_.add(b),x.push(e[b]))},m=b=>{if(b<0||b>=o)return;const y=i.getXCacheKey(e[b].x);let T=b;for(;T>=0&&i.getXCacheKey(e[T].x)===y;)v(T--);for(T=b+1;T<o&&i.getXCacheKey(e[T].x)===y;)v(T++)};if(l||c)for(let b=g-2;b<=g+2;b++)m(b);else{const b=d,y=(T,w)=>{for(let C=T;C>=0&&C<o;C+=w){const A=e[C];if(Math.abs(u(A.x)-h)>b)break;v(C)}};y(g,1),y(g-1,-1)}return x},findClosestFromTargets(e,t){const n=this,i=[];for(let a=0;a<e.length;a++){const s=n.findClosest(e[a].values,t);s&&i.push(s)}return n.findClosest(i,t,!1)},findClosest(e,t,n=!0){const i=this,{$el:{main:a}}=i,s=i.getClosestCandidates(e,t,n);let o,r;for(let l=0;l<s.length;l++){const c=s[l];if(!c||!J(c.value))continue;const d=i.isBarType(c.id),u=i.isCandlestickType(c.id);if(d||u){const h=d?`.${Zt.chartBar}.${Y.target}${i.getTargetSelectorSuffix(c.id)} .${Zt.bar}-${c.index}`:`.${Ce.chartCandlestick}.${Y.target}${i.getTargetSelectorSuffix(c.id)} .${Ce.candlestick}-${c.index} path`;!r&&i.isWithinBar(a.select(h).node())&&(r=c)}else{const h=i.dist(c,t),f=i.getPointSensitivity(c);h<f&&(o===void 0||h<o)&&(o=h,r=c)}}return r},dist(e,t){const n=this,{config:{axis_rotated:i},scale:a}=n,s=+i,o=+!i,r=n.circleY(e,e.index),c=(a.zoom||a.x)(e.x)-t[s],d=r-t[o];return Math.sqrt(c*c+d*d)},convertValuesToStep(e){const t=this,{axis:n,config:i}=t,a=i.line_step_type,s=n?n.isCategorized():!1,o=ot(e)?e.concat():[e];if(!(s||/step\-(after|before)/.test(a)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:d}=r;o.unshift({x:--d,value:r.value,id:c}),s&&a==="step-after"&&o.unshift({x:d-1,value:r.value,id:c}),d=l.x,o.push({x:++d,value:l.value,id:c}),s&&a==="step-before"&&o.push({x:d+1,value:l.value,id:c})}return o},convertValuesToRange(e){const t=ot(e)?e.concat():[e],n=[];return t.forEach(i=>{const{x:a,id:s}=i;n.push({x:a,id:s,value:i.value[0]}),n.push({x:a,id:s,value:i.value[2]})}),n},updateDataAttributes(e,t){const n=this,{config:i}=n,a=i[`data_${e}`];return yt(t)||(Object.keys(t).forEach(s=>{a[s]=t[s]}),n.redraw({withLegend:!0})),a},getRangedData(e,t="",n="areaRange"){var i,a;const s=e==null?void 0:e.value;if(ot(s)){if(n==="bar")return s.reduce((o,r)=>r-o);{const o=(a=(i=Zh[n])==null?void 0:i[t])!=null?a:-1;return o>=0?s[o]:void 0}}else if(s&&t)return s[t];return s},setRatioForGroupedData(e){const t=this,{config:n}=t;if(n.data_groups.length&&e.some(i=>t.isGrouped(i.id))){const i=a=>t.getRatio("index",a,!0);e.forEach(a=>{"values"in a?a.values.forEach(i):i(a)})}},getRatio(e,t,n=!1){const i=this,{config:a,state:s}=i,o=i.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(i.pie.padAngle()())r=t.value/i.getTotalDataSum(!0);else{const l=a.gauge_fullCircle?i.getArcLength():i.getStartingAngle()*-2,c=i.hasType("gauge")?l:Math.PI*2;r=(t.endAngle-t.startAngle)/c}else if(e==="index"){const l=o.data.values.bind(o),{hiddenTargetIds:c}=s;let d=this.getTotalPerIndex(i.isStackNormalizedPerGroup()?t.id:void 0);if(d===null)return r;if(c.size){let h=[...c];if(i.isStackNormalizedPerGroup()&&t.id){const f=a.data_groups.find(g=>g.indexOf(t.id)>=0);f&&(h=h.filter(g=>f.indexOf(g)>=0))}if(h.length){let f=l(h,!1);f.length&&(f=f.reduce((g,p)=>g.map((x,_)=>(X(x)?x:0)+p[_])),d=d.map((g,p)=>g-f[p]))}}const u=d[t.index];t.ratio=X(t.value)&&d&&u?t.value/u:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/s.current.dataMax*a.radar_size_ratio;else if(e==="bar"){const c=i.getYScaleById.bind(i)(t.id).domain().reduce((d,u)=>u-d);r=c===0?0:Math.abs(i.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=i.getTotalDataSum(!0));return n&&r?r*100:r},updateDataIndexByX(e){const t=this,n=e.reduce((i,a,s)=>(i[Number(a.x)]=s,i),{});t.data.targets.forEach(i=>{i.values.forEach((a,s)=>{let o=n[Number(a.x)];o===void 0&&(o=s),a.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(Q(e.value)&&("z"in e.value||"y"in e.value)||ot(e.value)&&e.value.length>=2)},isBarRangeType(e){const t=this,{value:n}=e;return t.isBarType(e)&&ot(n)&&n.length>=2&&n.every(X)},getDataById(e){var t;const n=this.cache.get(e)||this.api.data(e);return(t=n==null?void 0:n[0])!=null?t:n}};function xi(e,t=!1){const n=this,{api:i}=n;t&&n.api.flush(!0),e==null||e.call(i)}var Jh={load(e,t){const n=this,{axis:i,data:a,org:s,scale:o}=n,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;if(c){t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(u=>{var h;const f=((h=t.types)==null?void 0:h[u.id])||t.type;n.setTargetType(u.id,f)});const d=new Map(c.map(u=>[u.id,u]));a.targets.forEach(u=>{const h=d.get(u.id);if(h){if(r){const f=h.values;for(let g=0;g<f.length;g++)u.values.push(f[g])}else u.values=h.values;d.delete(u.id)}}),d.forEach(u=>a.targets.push(u))}if(n.state.isCanvasMode){n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.updateTypesElements(),xi.call(n,t.done,t.resizeAfter);return}n.updateTargets(a.targets),o.zoom&&(l.x=i.isCategorized()?o.x.orgScale():(s.xScale||o.x).copy(),l.domain=n.getXDomain(a.targets),l.x.domain(l.domain),l.currentDomain=n.zoom.getDomain(),n.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,n.$el.eventRect.property("__zoom",null))),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(s.xDomain=l.domain,s.xScale=l.x,i.isCategorized()&&(l.currentDomain=n.getZoomDomainValue(l.currentDomain),s.xDomain=n.getZoomDomainValue(s.xDomain),s.xScale=l.x.domain(s.xDomain)),n.updateCurrentZoomTransform(l.x,l.currentDomain)):s.xScale&&s.xScale.domain(s.xDomain),n.updateTypesElements(),xi.call(n,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(!1,[j.filteredTargets,j.maxDataCountTarget,j.valuesXIndexMap,j.maxTickSize]),t.convertData(e,n=>{const i=e.data||n;e.append&&(i.__append__=!0),i&&t.load(t.convertDataToTargets.call(t,i),e)}))},unload(e,t){var n;const i=this,{state:a,$el:s,$T:o}=i,r=!!((n=i.hasLegendDefsPoint)!=null&&n.call(i));let l=t,c=e;if(i.cache.reset(!1,[j.filteredTargets,j.maxDataCountTarget,j.valuesXIndexMap,j.maxTickSize]),l||(l=()=>{}),c=c.filter(h=>i.hasTarget(i.data.targets,h)),c.length===0){l();return}const d=new Set(c);if(a.isCanvasMode){c.forEach(h=>{a.withoutFadeIn[h]=!1}),i.data.targets=i.data.targets.filter(h=>!d.has(h.id)),i.removeHiddenTargetIds(c),i.removeHiddenLegendIds(c),i.updateTypesElements(),l();return}c.forEach(h=>{var f;const g=i.getTargetSelectorSuffix(h);a.withoutFadeIn[h]=!1,s.legend&&s.legend.selectAll(`.${H.legendItem}${g}`).remove(),r&&((f=s.defs)==null||f.select(`#${i.getDefsPointId(g)}`).remove())}),i.data.targets=i.data.targets.filter(h=>!d.has(h.id)),a.hasFunnel&&i.updateFunnel(i.data.targets),a.hasTreemap&&i.updateTargetsForTreemap(i.data.targets),i.updateTypesElements();const u=s.svg.selectAll(c.map(h=>i.selectorTarget(h)));o(u).style("opacity","0").remove().call(Qn,l)}},zo=pt(6),Qh={setExpand(e,t,n){const i=this,{config:a,$el:{circle:s}}=i;s&&a.point_focus_expand_enabled&&i.expandCircles(e,t,n),i.expandBarTypeShapes(!0,e,t,n)},expandBarTypeShapes(e=!0,t,n,i){const a=this;["bar","candlestick"].filter(s=>a.$el[s]).forEach(s=>{i&&a.$el[s].classed(Y.EXPANDED,!1),a.getShapeByIndex(s,t,n).classed(Y.EXPANDED,e)})},setOverOut(e,t){const n=this,{config:i,state:{hasFunnel:a,hasRadar:s,hasTreemap:o},$el:{main:r}}=n,l=Q(t);if(l||t!==-1){const c=i[e?"data_onover":"data_onout"].bind(n.api);if(i.color_onover&&n.setOverColor(e,t,l),l){const d=n.getTargetSelectorSuffix(t.id),u=a||o?`${Y.target+d} .${Ct.shape}`:et.arc+d;c(t,r.select(`.${u}`).node())}else if(i.tooltip_grouped)e&&(s&&n.isPointFocusOnly()?n.showCircleFocus(n.getAllValuesOnIndex(t,!0)):n.setExpand(t,null,!0)),!n.isMultipleX()&&r.selectAll(`.${Ct.shape}-${t}`).each(function(d){c(d,this)});else{const d=n.cache.get(j.setOverOut)||[],u=r.selectAll(`.${Ct.shape}-${t}`).filter(function(f){return n.isWithinShape(this,f)}),h=u.filter(function(){return d.every(f=>f!==this)});if(!e||u.empty()||d.length===h.size()&&h.nodes().every((f,g)=>f!==d[g]))for(;d.length;){const f=d.pop();i.data_onout.bind(n.api)((0,F.select)(f).datum(),f)}h.each(function(){e&&(c((0,F.select)(this).datum(),this),d.push(this))}),n.cache.add(j.setOverOut,d)}}},callOverOutForTouch(e){const t=this,n=t.cache.get(j.callOverOutForTouch);(Q(e)&&n?e.id!==n.id:e!==n)&&((n||X(n))&&t.setOverOut(!1,n),(e||X(e))&&t.setOverOut(!0,e),t.cache.add(j.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:n}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,zo.drag)().on("drag",function(i){n.event=i,e.drag(Jt(i,this))}).on("start",function(i){n.event=i,e.dragstart(Jt(i,this))}).on("end",i=>{n.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,n){var i,a,s;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:d,hasRadar:u,hasTreemap:h},$el:{eventRect:f,funnel:g,radar:p,svg:x,treemap:_}}=o;let v=(s=(a=(d||h)&&l.rect||u&&p.axes.select(`.${Rt.axis}-${t} text`)||f||((i=o.getArcElementByIdOrIndex)==null?void 0:i.call(o,t)))==null?void 0:a.node)==null?void 0:s.call(a);if(v){const m=o.isMultipleX(),b=r.axis_rotated;let{width:y,left:T,top:w}=ht(v);if(c&&!u&&!m){const k=l.coords[t];k?(y=k.w,T+=k.x,w+=k.y):(y=0,T=0,w=0)}let C=T+(n?n[0]:0)+(m||b?0:y/2),A=w+(n?n[1]:0)+(b?4:0);if(ma(x)&&o.$el.eventRect){const k=pi(o.$el.eventRect.node(),C,A,!1);C=k.x,A=k.y}const S={screenX:C,screenY:A,clientX:C,clientY:A,bubbles:u};(d||h)&&(v=(g!=null?g:_).node()),Ih[/^(mouse|click)/.test(e)?"mouse":"touch"](v,e,S)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{canvas:t,eventRect:n,svg:i,zoomResetBtn:a}}=e;n==null||n.on(".zoom wheel.zoom .drag",null),t==null||t.on(".zoom wheel.zoom .drag",null),i==null||i.on("wheel",null),a==null||a.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:n,eventRect:i,legend:a,region:s,svg:o,treemap:r},brush:l}=t,c=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,i,s==null?void 0:s.list,l==null?void 0:l.getSelection(),n==null?void 0:n.selectAll("path"),a==null?void 0:a.selectAll("g"),r].forEach(d=>d==null?void 0:d.on(c,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},tf={categoryName(e){var t;const{axis_x_categories:n}=this.config;return(t=n==null?void 0:n[e])!=null?t:e}};const ef=/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g;var nf={generateClass(e,t){const n=this.state.generateClassCache,i=`${e}\0${t}`;let a=n.get(i);return a||(a=` ${e} ${e+this.getTargetSelectorSuffix(t)}`,n.set(i,a)),a},getClass(e,t){const n=/s$/.test(e),i=/^(area|arc|line|funnel|treemap)s?$/.test(e),a=n?"id":"index";return s=>{const o=s.data||s;return((t?this.generateClass(st[n?"shapes":"shape"],o[a]):"")+this.generateClass(st[e],o[i?"id":a])).trim()}},getChartClass(e){return t=>st[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],n=[];return function(i){var a;const s=i.id||((a=i.data)==null?void 0:a.id)||i;return n.indexOf(s)<0&&n.push(s),t[n.indexOf(s)%t.length]}},classRegion(e,t){return`${this.generateClass(st.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let n="";return t&&(n=` ${st.target}-${t}`),this.generateClass(st.target,e)+n},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.has(e.id)?st.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.has(e.id)?st.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(ef,"-")},selectorTarget(e,t="",n=""){const i=this.getTargetSelectorSuffix(e);return`${t}.${st.target+i} ${n}, ${t}.${st.circles+i} ${n}`},selectorTargets(e,t){const n=e||[];return n.length?n.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${st.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}};const af=(e,t,n)=>{const i=(0,F.select)(e.cloneNode(!0));return i.attr("id",n).insert("rect",":first-child").attr("width",i.attr("width")).attr("height",i.attr("height")).style("fill",t),{id:n,node:i.node()}};function sf(e){const t=j.colorPattern,{body:n}=tt;let i=n[t];if(!i){const s=e.classed(ga.colorPattern,!0).style("background-image");e.classed(ga.colorPattern,!1),s.indexOf(";")>-1&&(i=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),n[t]=i)}return i}const of=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var rf={generateColor(){const e=this,{$el:t,config:n}=e,i=[],a=n.area_linearGradient||n.bar_linearGradient||n.point_radialGradient;let s=mt(n.color_pattern)?n.color_pattern:(0,Pe.scaleOrdinal)(sf(t.chart)||of).range();const o=s;if(O(n.color_tiles)){const r=n.color_tiles.bind(e.api)(),l=s.map((c,d)=>{const u=c.replace(/[#\(\)\s,]/g,""),h=`${e.state.datetimeId}-pattern-${u}-${d}`;return af(r[d%r.length],c,h)});s=l.map(c=>`url(#${c.id})`),e.patterns=l}return function(r){var l;const c=n.data_colors,d=n.data_color,u=r.id||((l=r.data)==null?void 0:l.id)||r,h=e.isTypeOf(u,["line","spline","step"])||!n.data_types[u];let f;if(O(c[u]))f=c[u].bind(e.api)(r);else if(c[u])f=c[u];else{let g=i.indexOf(u);g<0&&(i.push(u),g=i.length-1),f=h?o[g%o.length]:s[g%s.length],c[u]=f}if(f=O(d)?d.call(e.api,f,r):f,a&&t.defs){const g=e.$el.defs.selectAll(`[id$='-gradient${e.getTargetSelectorSuffix(u)}'] stop`);let p;g.each(function(x,_){p=_===0?this.style.stopColor:this.style.stopColor===p}),p===!0&&g.attr("stop-color",f)}return f}},generateLevelColor(){const e=this,{config:t}=e,n=t.color_pattern,i=t.color_threshold,a=i.unit==="value",s=i.max||100,o=i.values&&i.values.length?i.values:[];return mt(i)?function(r){const l=a?r:r*100/s;let c=n[n.length-1];for(let d=0,u=o.length;d<u;d++)if(l<=o[d]){c=n[d];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const n=this,{$el:{defs:i},state:a}=n;if(e){let s=[];nt(e)?s.push(""):Q(e)?s=Object.keys(e):O(e)&&(s=n.mapToTargetIds()),s.forEach(o=>{const r=`${a.datetimeId}-labels-bg${n.getTargetSelectorSuffix(o)}${nt(e)?n.getTargetSelectorSuffix(e):""}`,l=me(o===""?e:(e==null?void 0:e[o])||"");if(i.select(`#${r}`).empty()){const c=i.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r);c.append("feFlood").attr("flood-color",l),c.append("feComposite").attr("in","SourceGraphic")}})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:n},state:{datetimeId:i},$el:{defs:a}}=e;n.forEach(s=>{const o=`${i}-gradient${e.getTargetSelectorSuffix(s.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(s)&&"area"||e.isBarType(s)&&"bar";if((r||l)&&a.select(`#${o}`).empty()){const c=e.color(s),d={defs:null,stops:[]};if(r){const{cx:u=.3,cy:h=.3,r:f=.7,stops:g=[[.1,c,0],[.9,c,1]]}=r;d.stops=g,d.defs=a.append("radialGradient").attr("id",`${o}`).attr("cx",u).attr("cy",h).attr("r",f)}else{const u=t.axis_rotated,{x:h=u?[1,0]:[0,0],y:f=u?[0,0]:[0,1],stops:g=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];d.stops=g,d.defs=a.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",f[0]).attr("y2",f[1])}d.stops.forEach(u=>{const[h,f,g]=u,p=O(f)?f.bind(e.api)(s.id):f;d.defs&&d.defs.append("stop").attr("offset",h).attr("stop-color",p||c).attr("stop-opacity",g)})}})},setOverColor(e,t){const n=this,{config:i,$el:{main:a}}=n,s=i.color_onover;let o=e?s:n.color;Q(o)?o=({id:r})=>r in s?s[r]:n.color(r):nt(o)?o=()=>s:O(s)&&(o=o.bind(n.api)),a.selectAll(Q(t)?`.${et.arc}${n.getTargetSelectorSuffix(t.id)}`:`.${Ct.shape}-${t}`).style("fill",o)}},_i=pt(7);function No(e){const{event:t,$el:n}=e,i=n.subchart.main||n.main;let a;return t&&t.type==="brush"?a=t.selection:i&&(a=i.select(".bb-brush").node())&&(a=(0,_i.brushSelection)(a)),a}function Xo(e){const t=No(e);return t?t[0]===t[1]:!0}function Go(e,t){return t.map(n=>{var i,a,s,o;const{values:r}=n,l=r[0],c=r[r.length-1],d=l?(a=(i=e.getXCacheKey)==null?void 0:i.call(e,l.x))!=null?a:l.x:"",u=c?(o=(s=e.getXCacheKey)==null?void 0:s.call(e,c.x))!=null?o:c.x:"";return`${n.id}:${r.length}:${d}:${u}`}).join("|")}function Wo(e,t){var n;const i=(n=e.data)==null?void 0:n.targets;if(!i)return!1;for(let a=0;a<t.length;a++){const s=t[a],o=i.find(r=>r.id===s.id);if(!o||o.values!==s.values)return!1}return!0}function Ca(e,t){mt(t)&&((e.min===void 0||t<e.min)&&(e.min=t),(e.max===void 0||t>e.max)&&(e.max=t))}function Vo(e,t){for(let n=0;n<t.length;n++)Ca(e,t[n])}function lf(e,t){var n,i;const a={min:void 0,max:void 0},s=e.state.hasAxis;for(let o=0;o<t.length;o++){const r=t[o],l=(n=e.isCandlestickType)==null?void 0:n.call(e,r),{values:c}=r;for(let d=0;d<c.length;d++){const u=c[d];let h=u.value;(J(h)||h===null)&&(h!==null&&l&&(h=Array.isArray(h)?h.slice(0,4):[h.open,h.high,h.low,h.close]),Array.isArray(h)?Vo(a,h):Q(h)&&"high"in h?Vo(a,Object.values(h)):(i=e.isBubbleZType)!=null&&i.call(e,u)?Ca(a,s&&e.getBubbleZData(h,"y")):Ca(a,h))}}return[a.min,a.max]}function cf(e,t){let n;for(let i=0;i<e.length;i++){const{values:a}=e[i];for(let s=0;s<a.length;s++){const{x:o}=a[s];mt(o)&&(n===void 0||(t==="min"?o<n:o>n))&&(n=o)}}return n}var df={getYDomainMinMaxBoth(e){const t=this,{axis:n,cache:i,config:a,state:s}=t,r=Wo(t,e)?`${j.domainMinMax}_y_${Go(t,e)}`:null,l=r&&i.get(r);if(l&&l.generation===s.dataGeneration)return l.value;const c=a.data_groups,d=t.mapToIds(e),u=cs(d);let h;if(c.length>0){const f=t.getValuesAsIdKeyed(e),g=e.some(y=>y.values.some(T=>T.value<0)),p=e.some(y=>y.values.some(T=>T.value>0)),x=new Map(d.map(y=>[y,n.getId(y)])),_={},v={};for(const y in f)_[y]=f[y].slice(),v[y]=f[y].slice();c.forEach(y=>{const T=y.filter(w=>u.has(w));if(T.length){const w=T[0],C=x.get(w);_[w]&&g&&(_[w]=_[w].map(A=>A<0?A:0)),v[w]&&p&&(v[w]=v[w].map(A=>A>0?A:0)),T.filter((A,S)=>S>0).forEach(A=>{if(_[A]){const S=x.get(A);_[A].forEach((k,L)=>{const R=+k;S===C&&!(g&&R>0)&&(_[w][L]+=R)})}if(v[A]){const S=x.get(A);v[A].forEach((k,L)=>{const R=+k;S===C&&!(p&&R<0)&&(v[w][L]+=R)})}})}});const m=[],b=[];for(const y in _)m.push(oe("min",_[y])),b.push(oe("max",v[y]));h=[oe("min",m),oe("max",b)]}else h=lf(t,e);return r&&i.add(r,{generation:s.dataGeneration,value:h}),h},isHiddenTargetWithYDomain(e){const t=this;for(const n of t.state.hiddenTargetIds)if(t.axis.getId(n)===e)return!0;return!1},getYDomain(e,t,n){const i=this,{axis:a,config:s,scale:o}=i,r=`axis_${t}`;if(i.isStackNormalized()&&e.filter(E=>a.getId(E.id)===t).map(E=>E.id).some(E=>i.isGrouped(E)))return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(L=>a.getId(L.id)===t),d=n?i.filterByXDomain(c,n):c;if(d.length===0)return i.isHiddenTargetWithYDomain(t)?o[t].domain():t==="y2"?o.y.domain():i.getYDomain(e,"y2",n);const u=s[`${r}_min`],h=s[`${r}_max`],f=s[`${r}_center`],g=s[`${r}_inverted`],p=i.hasDataLabel()&&s.axis_rotated,x=i.hasDataLabel()&&!s.axis_rotated,[_,v]=i.getYDomainMinMaxBoth(d);let m=_,b=v,y=[I.BAR,I.BUBBLE,I.SCATTER,...se.Line].some(L=>{const R=L.indexOf("area")>-1?"area":L;return i.hasType(L,d,!0)&&s[`${R}_zerobased`]});m=J(u)?u:J(h)?m<=h?m:h-10:m,b=J(h)?h:J(u)?u<=b?b:u+10:b,isNaN(m)&&(m=0),isNaN(b)&&(b=m),m===b&&(m<0?b=0:m=0);const T=m>=0&&b>=0,w=m<=0&&b<=0;(J(u)&&T||J(h)&&w)&&(y=!1),y&&(T&&(m=0),w&&(b=0));const C=Math.abs(b-m);let A={top:C*.1,bottom:C*.1};if(ct(f)){const L=Math.max(Math.abs(m),Math.abs(b));b=f+L,m=f-L}if(p){const L=Ye(o.y.range()),R=i.getDataLabelLength(m,b,"width").map(E=>{const P=E/L;return isFinite(P)?P:0});["bottom","top"].forEach((E,P)=>{A[E]+=C*(R[P]/(1-R[0]-R[1]))})}else if(x){const L=i.getDataLabelLength(m,b,"height");["bottom","top"].forEach((R,E)=>{A[R]+=i.convertPixelToScale("y",L[E],C)})}A=i.getResettedPadding(A);const S=s[`${r}_padding`];mt(S)&&["bottom","top"].forEach(L=>{A[L]=a.getPadding(S,L,A[L],C)}),y&&(T&&(A.bottom=m),w&&(A.top=-b));const k=l?[m,b].map(L=>L<0?0:L):[m-A.bottom,b+A.top];return g?k.reverse():k},getXDomainMinMax(e,t){var n;const i=this,{cache:a,state:s}=i,o=i.config[`axis_x_${t}`],l=Wo(i,e)?`${j.domainMinMax}_x_${t}_${Go(i,e)}`:null,c=l&&a.get(l);let d=(c==null?void 0:c.generation)===s.dataGeneration?c.value:void 0;d===void 0&&(d=cf(e,t),l&&a.add(l,{generation:s.dataGeneration,value:d}));let u=Q(o)?o.value:o;return u=ct(u)&&((n=i.axis)!=null&&n.isTimeSeries())?Xt.bind(this)(u):u,Q(o)&&o.fit&&(t==="min"&&u<d||t==="max"&&u>d)&&(u=void 0),ct(u)?u:d},getXDomainPadding(e,t){const n=this,{axis:i,config:a}=n,s=a.axis_x_padding,o=i.isTimeSeries()&&t,r=Ye(e);let l;if(i.isCategorized()||o)l=0;else if(n.hasType("bar")){const u=n.getMaxDataCount();l=u>1?r/(u-1)/2:.5}else l=n.getResettedPadding(r*.01);let{left:c=l,right:d=l}=X(s)?{left:s,right:s}:s;if(s.unit==="px"){const u=Math.abs(r+r*.2);c=i.getPadding(s,"left",l,u),d=i.getPadding(s,"right",l,u)}else{const u=r+c+d;if(o&&u){const h=r/t/u;c=c/u/h,d=d/u/h}}return{left:c,right:d}},getXDomain(e){const t=this,{axis:n,config:i,scale:{x:a}}=t,s=i.axis_x_inverted,o=[t.getXDomainMinMax(e,"min"),t.getXDomainMinMax(e,"max")];let[r=0,l=0]=o;if(a.type!=="log"){const c=n.isCategorized(),d=n.isTimeSeries(),u=t.getXDomainPadding(o);let[h,f]=o;h-f===0&&!c&&(d?(h=new Date(h.getTime()*.5),f=new Date(f.getTime()*1.5)):(h=h===0?1:h*.5,f=f===0?-1:f*1.5)),(h||h===0)&&(r=d?new Date(h.getTime()-u.left):h-u.left),(f||f===0)&&(l=d?new Date(f.getTime()+u.right):f+u.right)}return s?[l,r]:[r,l]},updateXDomain(e,t,n,i,a){var s;const o=this,{config:r,org:l,scale:{x:c,subX:d}}=o,u=r.zoom_enabled;if(n&&(c.domain(a||on(o.getXDomain(e),!r.axis_x_inverted)),l.xDomain=c.domain(),d.domain(c.domain()),(s=o.brush)==null||s.scale(d)),t){const h=a||!o.brush||Xo(o)?l.xDomain:No(o).map(d.invert);c.domain(h)}return(n||t)&&u&&o.zoom.updateScaleExtent(),i&&c.domain(o.trimXDomain(c.orgDomain())),c.domain()},trimXDomain(e){const t=this,n=t.config.axis_x_inverted,i=t.getZoomDomain(),[a,s]=i;return(n?e[0]>=a:e[0]<=a)&&(e[1]=+e[1]+(a-e[0]),e[0]=a),(n?e[1]<=s:e[1]>=s)&&(e[0]=+e[0]-(e[1]-s),e[1]=s),e},getZoomDomain(e="zoom",t=!1){const n=this,{config:i,scale:a,org:s}=n;let[o,r]=t&&a[e]?a[e].domain():s.xDomain;return e==="zoom"&&(ct(i.zoom_x_min)&&(o=oe("min",[o,i.zoom_x_min])),ct(i.zoom_x_max)&&(r=oe("max",[r,i.zoom_x_max]))),[o,r]},getZoomDomainValue(e){const t=this,{config:n,axis:i}=t;if(i.isCategorized()&&Array.isArray(e)){const a=n.axis_x_inverted;return e.map((o,r)=>Number(o)+(r===0?+a:+!a))}return e},convertPixelToScale(e,t,n){const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r;return e==="x"?r=o?"height":"width":r=o?"width":"height",n*(t/s[r])},withinRange(e,t=[0,0],n){const a=this.config.axis_x_inverted,[s,o]=n;if(Array.isArray(e)){const r=a?e[1]:e[0],l=a?e[0]:e[1];if(r<l)return e.every((c,d)=>(d===0?a?+c<=s:+c>=s:a?+c>=o:+c<=o)&&!e.every((u,h)=>u===t[h]))}return!1}};function Ho(e,t,n){const{config:i}=e,a=`axis_${t}_tick_format`;return(i[a]?i[a]:e.defaultValueFormat).call(e.api,n)}var uf={yFormat(e){return Ho(this,"y",e)},y2Format(e){return Ho(this,"y2",e)},getDefaultValueFormat(){const e=this,{defaultArcValueFormat:t,yFormat:n,y2Format:i}=e,a=e.hasArcType(null,["gauge","polar","radar"]);return function(s,o,r){return(a?t:e.axis&&e.axis.getId(r)==="y2"?i:n).call(e,s,o)}},defaultValueFormat(e){return ot(e)?e.join("~"):J(e)?+e:""},defaultArcValueFormat(e,t){return`${(t*100).toFixed(1)}%`},defaultPolarValueFormat(e){return`${e}`},dataLabelFormat(e){const t=this,n=t.config.data_labels,i=s=>{let r=s;return ot(s)?r=s.join("~"):Q(s)&&(r=Object.values(s).join("~")),r};let a=i;return O(n.format)?a=n.format:Yt(n.format)&&(n.format[e]?a=n.format[e]===!0?i:n.format[e]:a=()=>""),a.bind(t.api)}};const Yo=10,hf=750;function mi(e){const t=this,n=t.getDataById(e);return t.levelColor?t.levelColor(n.values[0].value):t.color(n)}function ff(e,t=!0){var n;const{config:i}=this;let a=(n=i.data_names[e])!=null?n:e;return t&&O(i.legend_format)&&(a=i.legend_format(a,e!==a?e:void 0)),a}function gf(e,t){var n;if(!t||t.empty())return;const i=(n=e.$el.legend)==null?void 0:n.selectAll(`.${H.legendItem}`);i&&!i.empty()&&(t=i);const a=[];t.each(function(o){a.push({id:o,node:this})});const s=ds(a,o=>o.id,o=>o.node);e.cache.add(j.legendItemMap,s)}function jo(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function pf(e,t,n){const i=jo(n);e.state.legendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function Uo(e,t){const n=e.state.legendTouch,i=n&&jo(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>Yo||Math.abs(i.clientY-n.y)>Yo)}function xf(e,t,n){Uo(e,n);const i=e.state.legendTouch;return e.state.legendTouch=null,!!i&&i.id===t&&!i.moved}function _f(e,t){e.state.legendLastTouchClickId=t,e.state.legendLastTouchClickTime=Date.now()}function mf(e,t){const{state:n}=e,i=n.legendLastTouchClickId===t&&Date.now()-(n.legendLastTouchClickTime||0)<hf;return i&&(n.legendLastTouchClickId=null,n.legendLastTouchClickTime=0),i}function vf(e){var t;const n=(t=e.config.interaction_inputType_touch)==null?void 0:t.preventDefault,i=He(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}var bf={initLegend(){var e;const t=this,{config:n,$el:i}=t;if(t.legendItemTextBox={},t.state.legendHasRendered=!1,t.state.isCanvasMode){n.legend_show?(e=t.updateHtmlLegend)==null||e.call(t):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets));return}n.legend_show?(n.legend_contents_bindto||(i.legend=t.$el.svg.append("g").classed(H.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets))},updateLegend(e,t,n){var i;const a=this,{config:s,state:o,scale:r,$el:l}=a,c=t||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=De(c,"withTransition",!0),c.withTransitionForTransform=De(c,"withTransitionForTransform",!0),s.legend_contents_bindto&&s.legend_contents_template?a.updateLegendTemplate():o.hasTreemap||a.updateLegendElement(e||a.mapToIds(a.data.targets),c),(i=l.legend)==null||i.selectAll(`.${H.legendItem}`).classed(H.legendItemHidden,function(d){const u=!a.isTargetToShow(d);return u&&(this.style.opacity=null),u}),a.updateScales(!1,!r.zoom),a.updateSvgSize(),a.transformAll(c.withTransitionForTransform,n),o.legendHasRendered=!0},updateLegendTemplate(){const e=this,{config:t,$el:n}=e,i=(0,F.select)(t.legend_contents_bindto),a=t.legend_contents_template;if(!i.empty()){const s=e.mapToIds(e.data.targets),o=[];let r="";s.forEach(c=>{const d=O(a)?me(a.call(e.api,c,e.color(c),e.api.data(c)[0].values)):Ue(a,{COLOR:e.color(c),TITLE:c});d&&(o.push(c),r+=d)});const l=i.html(r).selectAll(function(){return this.childNodes}).data(o);e.setLegendItem(l),n.legend=i}},updateSizeForLegend(e){const t=this,{config:n,state:{isLegendTop:i,isLegendLeft:a,isLegendRight:s,isLegendInset:o,current:r}}=t,{width:l,height:c}=e,d={top:i?t.getCurrentPaddingByDirection("top")+n.legend_inset_y+5.5:r.height-c-t.getCurrentPaddingByDirection("bottom")-n.legend_inset_y,left:a?t.getCurrentPaddingByDirection("left")+n.legend_inset_x+.5:r.width-l-t.getCurrentPaddingByDirection("right")-n.legend_inset_x+.5};t.state.margin3={top:s?0:o?d.top:r.height-c,right:NaN,bottom:0,left:s?r.width-l:o?d.left:0}},transformLegend(e){const t=this,{$el:{legend:n},$T:i}=t;i(n,e).attr("transform",t.getTranslate("legend"))},updateLegendItemColor(e,t){const n=this,{legend:i}=n.$el;if(i){const a=n.getLegendItemById(e);a&&(0,F.select)(a).select("line").style("stroke",t)}},getLegendWidth(){const e=this,{current:{width:t},isLegendRight:n,isLegendInset:i,legendItemWidth:a,legendStep:s}=e.state;return e.config.legend_show?n||i?a*(s+1):t:0},getLegendHeight(){var e;const t=this,{current:n,isLegendRight:i,legendItemHeight:a,legendStep:s}=t.state,r=((e=t.config.padding)==null?void 0:e.mode)==="fit"?10:20;return t.config.legend_show?i?n.height:Math.max(r,a)*(s+1):0},opacityForUnfocusedLegend(e){return e.classed(H.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const n=this,{$el:{legend:i},$T:a}=n,s=n.mapToTargetIds(e);i&&a(i.selectAll(`.${H.legendItem}`).filter(o=>s.indexOf(o)>=0).classed(ut.legendItemFocused,t)).style("opacity",function(){return t?null:n.opacityForUnfocusedLegend.call(n,(0,F.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:n}=e;t&&n(t.selectAll(`.${H.legendItem}`).classed(ut.legendItemFocused,!1)).style("opacity",null)},showLegend(e){const t=this,{config:n,$el:i,$T:a}=t;n.legend_show||(n.legend_show=!0,i.legend?i.legend.style("visibility",null):t.initLegend(),!t.state.legendHasRendered&&t.updateLegend()),t.removeHiddenLegendIds(e),a(i.legend.selectAll(t.selectorLegends(e)).style("visibility",null)).style("opacity",null)},hideLegend(e){const t=this,{config:n,$el:{legend:i}}=t;n.legend_show&&Qt(e)&&(n.legend_show=!1,i==null||i.style("visibility","hidden")),t.addHiddenLegendIds(e),i==null||i.selectAll(t.selectorLegends(e)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(e,t){const n=this,{cache:i,state:a}=n;let s;const o=j.legendItemTextBox;return e&&(s=!a.redrawing&&i.get(o)||{},s[e]||(s[e]=n.getTextRect(t,H.legendItem),i.add(o,s)),s=s[e]),s},setLegendItem(e){const t=this,{$el:n,api:i,config:a,state:s}=t,o=s.inputType==="touch",r=t.hasType("gauge"),l=a.boost_useCssRule,c=a.legend_item_interaction,d=c.dblclick?"dblclick":"click",u=c||O(a.legend_item_onclick),h=o?vf(t):void 0,f=function(g,p){var x;if(!V(a.legend_item_onclick,i,p,!s.hiddenTargetIds.has(p))){const{altKey:_,type:v}=g,m=(0,F.select)(this);v==="dblclick"||_?s.hiddenTargetIds.size&&!m.classed(H.legendItemHidden)?i.show():(i.hide(),i.show(p)):(i.toggle(p),m.classed(ut.legendItemFocused,!1))}o&&(t.hideTooltip(),(x=t.hideGridFocus)==null||x.call(t,!0))};e.attr("class",function(g){const p=(0,F.select)(this);return(!p.empty()&&p.attr("class")||"")+t.generateClass(H.legendItem,g)}).style("visibility",g=>t.isLegendToShow(g)?null:"hidden"),a.interaction_enabled&&(l&&[[`.${H.legendItem}`,"cursor:pointer"],[`.${H.legendItem} text`,"pointer-events:none"],[`.${H.legendItemPoint} text`,"pointer-events:none"],[`.${H.legendItemTile}`,"pointer-events:none"],[`.${H.legendItemEvent}`,"fill-opacity:0"]].forEach(g=>{const[p,x]=g;t.setCssRule(!1,p,[x])(n.legend)}),e.on(d,u?function(g,p){o&&g.type==="click"&&mf(t,p)||f.call(this,g,p)}:null),o&&d==="click"&&u&&e.on("touchstart",function(g,p){pf(t,p,g)},h).on("touchmove",g=>{Uo(t,g)},h).on("touchend",function(g,p){xf(t,p,g)&&(_f(t,p),f.call(this,g,p))},h),!o&&e.on("mouseout",c||O(a.legend_item_onout)?function(g,p){V(a.legend_item_onout,i,p,!s.hiddenTargetIds.has(p))||((0,F.select)(this).classed(ut.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${qt.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||O(a.legend_item_onover)?function(g,p){V(a.legend_item_onover,i,p,!s.hiddenTargetIds.has(p))||((0,F.select)(this).classed(ut.legendItemFocused,!0),r&&t.markOverlapped(p,t,`.${qt.gaugeValue}`),!s.transiting&&t.isTargetToShow(p)&&i.focus(p))}:null),!e.empty()&&e.on("click mouseout mouseover")&&e.style("cursor",t.getStylePropValue("pointer"))),gf(t,e)},getLegendItemById(e){var t;const n=this,i=n.cache.get(j.legendItemMap);if(i&&i instanceof Map)return i.get(e)||null;const a=(t=n.$el.legend)==null?void 0:t.selectAll(`.${H.legendItem}`).filter(s=>s===e);return(a==null?void 0:a.node())||null},updateLegendElement(e,t){const n=this,{config:i,state:a,$el:{legend:s},$T:o}=n,l=i.legend_item_tile_type!=="circle",c=i.legend_item_tile_r,d={width:l?i.legend_item_tile_width:c*2,height:l?i.legend_item_tile_height:c*2},u={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:d.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let f,g,p;const x=e.filter(C=>!ct(i.data_names[C])||i.data_names[C]!==null),_=t.withTransition,v=a.isLegendRight||a.isLegendInset,m=ff.bind(n),b=n.getUpdateLegendPositions(x,u,h,v);a.isLegendInset&&(u.step=i.legend_inset_step?i.legend_inset_step:x.length,a.legendStep=u.step),a.isLegendRight?(f=C=>u.max.width*h.steps[C],g=C=>h.margins[h.steps[C]]+h.offsets[C]):a.isLegendInset?(f=C=>u.max.width*h.steps[C]+10,g=C=>h.margins[h.steps[C]]+h.offsets[C]):(f=C=>h.margins[h.steps[C]]+h.offsets[C],g=C=>u.max.height*h.steps[C]);const y={xText:(C,A)=>f(C,A)+4+d.width,xRect:(C,A)=>f(C,A),x1Tile:(C,A)=>f(C,A)-2,x2Tile:(C,A)=>f(C,A)-2+d.width,yText:(C,A)=>g(C,A)+9,yRect:(C,A)=>g(C,A)-5,yTile:(C,A)=>g(C,A)+4};n.generateLegendItem(x,d,b,y,v,m),p=s.select(`.${H.legendBackground} rect`),a.isLegendInset&&u.max.width>0&&p.size()===0&&(p=s.insert("g",`.${H.legendItem}`).attr("class",H.legendBackground).append("rect")),i.legend_tooltip&&s.selectAll("title").data(x).text(C=>m(C,!1));const T=s.selectAll("text").data(x).text(C=>m(C)).each(function(C,A){b(this,C,A)});o(T,_).attr("x",y.xText).attr("y",y.yText);const w=s.selectAll(`rect.${H.legendItemEvent}`).data(x);o(w,_).attr("width",C=>h.widths[C]).attr("height",C=>h.heights[C]).attr("x",y.xRect).attr("y",y.yRect),n.updateLegendItemPos(x,_,y),p&&o(p,_).attr("height",n.getLegendHeight()-12).attr("width",u.max.width*(u.step+1)+10),a.legendItemWidth=u.max.width,a.legendItemHeight=u.max.height,a.legendStep=u.step},getUpdateLegendPositions(e,t,n,i){const a=this,{config:s,state:o}=a;return function(r,l,c){const d=c===0,u=c===e.length-1,h=a.getLegendItemTextBox(l,r),f=h.width+t.tileWidth+(u&&!i?0:t.padding.right)+s.legend_padding,g=h.height+t.padding.top,p=i?g:f,x=i?a.getLegendHeight():a.getLegendWidth();let _;const v=function(b,y){y||(_=(x-t.totalLength-p)/2,_<t.posMin&&(_=(x-p)/2,t.totalLength=0,t.step++)),n.steps[b]=t.step,n.margins[t.step]=o.isLegendInset?10:_,n.offsets[b]=t.totalLength,t.totalLength+=p};if(d&&(t.totalLength=0,t.step=0,t.max.width=0,t.max.height=0),s.legend_show&&!a.isLegendToShow(l)){n.widths[l]=0,n.heights[l]=0,n.steps[l]=0,n.offsets[l]=0;return}n.widths[l]=f,n.heights[l]=g,(!t.max.width||f>=t.max.width)&&(t.max.width=f),(!t.max.height||g>=t.max.height)&&(t.max.height=g);const m=i?t.max.height:t.max.width;if(s.legend_equally){for(const b in n.widths)n.widths[b]=t.max.width;for(const b in n.heights)n.heights[b]=t.max.height;_=(x-m*e.length)/2,_<t.posMin?(t.totalLength=0,t.step=0,e.forEach(b=>v(b))):v(l,!0)}else v(l)}},generateLegendItem(e,t,n,i,a,s){const o=this,{config:r,state:l,$el:{legend:c}}=o,d=r.legend_usePoint,u=r.legend_item_tile_r,h=r.legend_item_tile_type,f=h!=="circle",g=-200,p=c.selectAll(`.${H.legendItem}`).data(e).enter().append("g");if(o.setLegendItem(p),r.legend_tooltip&&p.append("title").text(x=>x),p.append("text").text(x=>s(x)).each(function(x,_){n(this,x,_)}).style("pointer-events",o.getStylePropValue("none")).attr("x",a?i.xText:g).attr("y",a?g:i.yText),p.append("rect").attr("class",H.legendItemEvent).style("fill-opacity",o.getStylePropValue("0")).attr("x",a?i.xRect:g).attr("y",a?g:i.yRect),d){const x=[],_=o.getValidPointPattern();p.append(v=>{x.indexOf(v)===-1&&x.push(v);let m=_[x.indexOf(v)%_.length];return m==="rectangle"&&(m="rect"),tt.createElementNS(F.namespaces.svg,"hasValidPointType"in o&&o.hasValidPointType(m)?m:"use")}).attr("class",H.legendItemPoint).style("fill",mi.bind(o)).style("pointer-events",o.getStylePropValue("none")).attr("href",(v,m,b)=>{const T=b[m].nodeName.toLowerCase(),w=o.getTargetSelectorSuffix(v);return T==="use"?`#${l.datetimeId}-point${w}`:void 0})}else p.append(f?"line":h).attr("class",H.legendItemTile).style("stroke",mi.bind(o)).style("pointer-events",o.getStylePropValue("none")).call(x=>{h==="circle"?x.attr("r",u).style("fill",mi.bind(o)).attr("cx",a?i.x2Tile:g).attr("cy",a?g:i.yTile):f&&x.attr("stroke-width",t.height).attr("x1",a?i.x1Tile:g).attr("y1",a?g:i.yTile).attr("x2",a?i.x2Tile:g).attr("y2",a?g:i.yTile)})},updateLegendItemPos(e,t,n){const i=this,{config:a,$el:{legend:s},$T:o}=i,r=a.legend_usePoint,l=a.legend_item_tile_type,c=l!=="circle";if(r){const d=s.selectAll(`.${H.legendItemPoint}`).data(e),u=a.legend_item_tile_type!=="circle",h=u?a.legend_item_tile_width:a.legend_item_tile_r*2,f=u?a.legend_item_tile_height:a.legend_item_tile_r*2,g=h*.75,p=f*.75,x=h/8,_=f/8;o(d,t).each(function(){const v=this.nodeName.toLowerCase();let m="x",b="y",y=null,T=null,w=null;v==="circle"?(m="cx",b="cy",y=Math.min(g,p)/2):v==="rect"&&(T=g,w=p);const C=(0,F.select)(this).attr("transform",null).attr("x",null).attr("y",null).attr("cx",null).attr("cy",null).attr("r",y).attr("width",T).attr("height",w);v==="use"?C.attr("transform",A=>`translate(${n.x1Tile(A)} ${n.yTile(A)-f/2}) scale(${x} ${_})`):C.attr(m,A=>n.x1Tile(A)+(h-(T||0))/2).attr(b,A=>n.yTile(A)-(w||0)/2)})}else{const d=s.selectAll(`.${H.legendItemTile}`).data(e);o(d,t).style("stroke",mi.bind(i)).call(u=>{l==="circle"?u.attr("cx",h=>{const f=n.x2Tile(h);return f-(f-n.x1Tile(h))/2}).attr("cy",n.yTile):c&&u.attr("x1",n.x1Tile).attr("y1",n.yTile).attr("x2",n.x2Tile).attr("y2",n.yTile)})}}},yf=pt(8),Tf={redraw(e={}){var t,n,i,a,s,o,r,l,c,d;const u=this,{config:h,state:f,$el:g}=u,{main:p,treemap:x}=g;f.redrawing=!0,f.redrawGeneration++,(f.dirty.data||f.dirty.visibility||e.initializing)&&f.dataGeneration++,(e.initializing||f.dirty.size||f.dirty.data||!f.rendered)&&u.cache.remove([j.svgLeft]);const _=u.filterTargetsToShow(u.data.targets);f._targetsToShow=_;const v={data:f.dirty.data,visibility:f.dirty.visibility,size:f.dirty.size};f.dirty.data=!1,f.dirty.visibility=!1,f.dirty.size=!1;const{flow:m,initializing:b}=e,y=u.getWithOption(e),T=y.Transition?h.transition_duration:0,w=y.TransitionForExit?T:0,C=y.TransitionForAxis?T:0,A=(t=u.axis)==null?void 0:t.generateTransitions(C),S=v.data||v.visibility||b;if(f.isCanvasMode&&(u.setContainerSize(),(n=u.updateHtmlLegend)==null||n.call(u)),u.updateSizes(b),f.isCanvasMode){const k=u.scale.zoom,L=k==null?void 0:k.domain();k&&(u.scale.zoom=null),u.updateScales(b,y.UpdateXDomain),k&&(k.range(u.scale.x.range()),L&&k.domain(L),u.scale.zoom=u.getCustomizedXScale(k),u.axis.x.scale(u.scale.zoom),u.scale.x.domain(h.zoom_rescale?L:u.org.xDomain),u.scale.subX.domain(u.org.xDomain)),f.hasAxis&&u.axis.syncAxisDomains(_,y,m),f.hasAxis&&((i=u.applyCanvasSubchartDomain)==null||i.call(u));const R=S?u.getDrawShape():f._cachedDrawShape||u.getDrawShape();S&&(f._cachedDrawShape=R),(a=u.updateHtmlLegend)==null||a.call(u),(s=u.resizeCanvas)==null||s.call(u),f.canvasFocusKey=null,u.renderCanvasFrame(R,null,!0),b&&u.updateTypesElements(),u.callPluginHook("$redraw",e,0),f.redrawing=!1,f._targetsToShow=null,f._cachedDrawShape=null,u.mapToIds(u.data.targets).forEach(E=>{f.withoutFadeIn[E]=!0}),V(h.onrendered,u.api);return}y.Legend&&h.legend_show?(e.withTransition=!!T,!x&&u.updateLegend(u.mapToIds(u.data.targets),e,A)):y.Dimension&&u.updateDimension(!0),h.data_empty_label_text&&p.select(`text.${St.text}.${Y.empty}`).attr("x",f.width/2).attr("y",f.height/2).text(h.data_empty_label_text).style("display",_.length?"none":null),(o=u.redrawTitle)==null||o.call(u),f.hasAxis?(u.axis.redrawAxis(_,y,A,m,b),(r=u.hasGrid)!=null&&r.call(u)&&u.updateGrid(),h.regions.length&&((l=u.updateRegion)==null||l.call(u)),["bar","candlestick","line","area"].forEach(k=>{const L=Ot(k);(/^(line|area)$/.test(k)&&u.hasTypeOf(L)||u.hasType(k))&&S&&u[`update${L}`](y.TransitionForExit)}),g.text&&p.selectAll(`.${xt.selectedCircles}`).filter(u.isBarType.bind(u)).selectAll("circle").remove(),h.interaction_enabled&&!m&&y.EventRect&&(u.redrawEventRect(),(c=u.bindZoomEvent)==null||c.call(u))):(g.arcs&&u.redrawArc(T,w,y.Transform),g.radar&&u.redrawRadar(),g.polar&&u.redrawPolar(),g.funnel&&u.redrawFunnel(),x&&u.updateTreemap(w)),!f.resizing&&!x&&(u.hasPointType()||f.hasRadar)?S&&u.updateCircle():(d=u.hasLegendDefsPoint)!=null&&d.call(u)&&u.data.targets.forEach(u.point("create",this)),u.hasDataLabel()&&!u.hasArcType(null,["radar"])&&S&&u.updateText(),b&&u.updateTypesElements(),u.generateRedrawList(_,m,T,y.Subchart,S),u.updateTooltipOnRedraw(),u.callPluginHook("$redraw",e,T)},generateRedrawList(e,t,n,i,a=!0){const s=this,{config:o,state:r}=s,l=a?s.getDrawShape():r._cachedDrawShape||s.getDrawShape();a&&(r._cachedDrawShape=l),r.hasAxis&&o.subchart_show&&s.redrawSubchart(i,n,l);const c=t&&s.generateFlow({targets:e,flow:t,duration:t.duration,shape:l,xv:s.xv.bind(s)}),d=(n||c)&&Gn(),u=s.getRedrawList(l,t,c,d),h=()=>{c&&c(),r.redrawing=!1,r._targetsToShow=null,r._cachedDrawShape=null,V(o.onrendered,s.api)};if(d&&u.length){const f=Po();(0,yf.transition)().duration(n).each(()=>{u.flatMap(g=>g).forEach(g=>f.add(g))}).call(f,h)}else r.transiting||h();s.mapToIds(s.data.targets).forEach(f=>{r.withoutFadeIn[f]=!0})},getRedrawList(e,t,n,i){const a=this,{config:s,state:{hasAxis:o,hasRadar:r,hasTreemap:l},$el:{grid:c}}=a,{cx:d,cy:u,xForText:h,yForText:f}=e.pos,g=[];if(o){a.redrawGrid&&(s.grid_x_lines.length||s.grid_y_lines.length)&&g.push(a.redrawGrid(i)),a.redrawRegion&&s.regions.length&&g.push(a.redrawRegion(i));for(const p in e.type){const x=Ot(p),_=e.type[p];(/^(area|line)$/.test(p)&&a.hasTypeOf(x)||a.hasType(p))&&g.push(a[`redraw${x}`](_,i))}!t&&c.main&&a.updateGridFocus&&g.push(a.updateGridFocus())}return(!a.hasArcType()||r)&&mt(s.data_labels)&&s.data_labels!==!1&&g.push(a.redrawText(h,f,t,i)),(a.hasPointType()||r)&&!a.isPointFocusOnly()&&a.redrawCircle&&g.push(a.redrawCircle(d,u,i,n)),l&&g.push(a.redrawTreemap(i)),g},updateAndRedraw(e={}){const t=this,{config:n,state:i}=t;let a;e.withTransition=De(e,"withTransition",!0),e.withTransform=De(e,"withTransform",!1),e.withLegend=De(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=De(e,"withTransitionForTransform",e.withTransition),e.withLegend&&n.legend_show||(i.hasAxis&&(a=t.axis.generateTransitions(e.withTransitionForAxis?n.transition_duration:0)),t.updateScales(),t.updateSvgSize(),t.transformAll(e.withTransitionForTransform,a)),t.redraw(e)}},wf={setContainerSize(){const e=this,{state:t}=e;t.current.width=e.getCurrentWidth(),t.current.height=e.getCurrentHeight()},getCurrentWidth(){const e=this;return e.config.size_width||e.getParentRectValue("width")},getCurrentHeight(){const e=this,{config:t}=e,n=t.size_height||e.getParentHeight();return n>0?n:320/(e.hasType("gauge")&&!t.gauge_fullCircle?2:1)},getParentRectValue(e){const t=`offset${Ot(e)}`;let n=this.$el.chart.node(),i=0;for(;i<30&&n&&n.tagName!=="BODY";){try{i=ht(n,!0)[e]}catch(s){t in n&&(i=n[t])}n=n.parentNode}const a=tt.body[t];return i>a&&(i=a),i},getParentHeight(){const e=this.$el.chart.style("height");let t=0;return e&&(t=/px$/.test(e)?parseInt(e,10):this.getParentRectValue("height")),t},getSvgLeft(e){var t,n,i;const a=this,{cache:s,config:o,state:{hasAxis:r},$el:l}=a;if(e){const A=s.get(j.svgLeft);if(A!==null)return A}const c=o.axis_rotated,d=c||!c&&!o.axis_y_inner,u=c?Rt.axisX:Rt.axisY,h=l.main.select(`.${u}`).node(),f=r&&o[`axis_${c?"x":"y"}_label`],p=r&&(nt(f)||nt(f.text)||/^inner-/.test(f==null?void 0:f.position))?l.main.select(`.${u}-label`):null,x=p&&!p.empty()?p.node():null,_=!e,v={label:x?ht(x,_):null,leftAxis:h&&d?ht(h,_):null,chart:ht(l.chart.node(),_)},m=(n=(t=v.label)==null?void 0:t.left)!=null?n:0,b=(i=v.leftAxis)!=null?i:{right:0},y=v.chart.left+m,T=a.hasArcType(),w=b.right-y-(T?0:a.getCurrentPaddingByDirection("left",e)),C=w>0?w:0;return s.add(j.svgLeft,C),C},updateDimension(e){var t,n;const i=this,{config:a,state:{hasAxis:s,isCanvasMode:o},$el:r}=i;if(s&&!e&&i.axis.x&&a.axis_rotated&&((t=i.axis.subX)==null||t.create(r.axis.subX)),i.updateScales(e),o){(n=i.resizeCanvas)==null||n.call(i);return}i.updateSvgSize(),i.transformAll(!1)},updateSvgSize(){var e;const t=this,{config:n,state:{clip:i,current:a,hasAxis:s,width:o,height:r},$el:{svg:l}}=t;if(!l){(e=t.resizeCanvas)==null||e.call(t);return}if(n.resize_auto==="viewBox"?l.attr("viewBox",`0 0 ${a.width} ${a.height}`):l.attr("width",a.width).attr("height",a.height),s){const c=l.select(`.${bo.brush} .overlay`),d={width:0,height:0};c.size()&&(d.width=+c.attr("width"),d.height=+c.attr("height")),l.selectAll([`#${i.id}`,`#${i.idGrid}`]).select("rect").attr("width",o).attr("height",r),l.select(`#${i.idXAxis}`).select("rect").call(t.setXAxisClipPath.bind(t)),l.select(`#${i.idYAxis}`).select("rect").call(t.setYAxisClipPath.bind(t)),i.idSubchart&&l.select(`#${i.idSubchart}`).select("rect").attr("width",o).attr("height",d.height)}},getCurrentPaddingByDirection(e,t=!1,n=!1){var i;const a=this,{config:s,$el:o,state:{hasAxis:r,isCanvasMode:l}}=a,c=s.axis_rotated,d=((i=s.padding)==null?void 0:i.mode)==="fit",u=X(s[`padding_${e}`])?s[`padding_${e}`]:void 0,h=r?{top:c?"y2":null,bottom:c?"y":"x",left:c?"x":"y",right:c?null:"y2"}[e]:null,f=/^(left|right)$/.test(e),g=h&&s[`axis_${h}_inner`],p=h&&s[`axis_${h}_show`],x=h?s[`axis_${h}_axes`].length:0;let _=h?f?a.getAxisWidthByAxisId(h,t):a.getHorizontalAxisHeight(h):0;const v=20;let m=0;!d&&f&&(_=cc(_));let b=r&&f&&(g||yt(u)&&!p)?0:d?(p?_:0)+(u!=null?u:0):yt(u)?_:u;return f&&r?(h&&(d||g)&&s[`axis_${h}_label`].text&&(b+=a.axis.getAxisLabelPosition(h).isOuter?v:0),e==="right"?(b+=c?!d&&yt(u)?10:2:!p||g?d?2:1:0,b+=n?a.axis.getXAxisTickTextY2Overflow(v):0):e==="left"&&c&&yt(u)&&(b=s.axis_x_show?d?_:Math.max(_,40):1)):e==="top"?((o.title&&o.title.node()||l&&s.title_text)&&(b+=a.getTitlePadding()),m=c&&!g?x:0):e==="bottom"&&r&&c&&!p&&(b+=1),b+_*x-m},getCurrentPadding(e=!1){const t=this,[n,i,a,s]=["top","bottom","left","right"].map(o=>t.getCurrentPaddingByDirection(o,null,e));return{top:n,bottom:i,left:a,right:s}},getResettedPadding(e){const t=this,{config:n}=t,i=X(e);let a=i?0:{};return n.padding===!1?!i&&Object.keys(e).forEach(s=>{a[s]=!Qt(n.data_labels)&&n.data_labels!==!1&&s==="top"?e[s]:0}):a=e,a},updateSizes(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:{legend:c}}=o,d=r.axis_rotated,u=o.hasArcType()||l.hasFunnel||l.hasTreemap,h=((t=r.padding)==null?void 0:t.mode)==="fit";!e&&o.setContainerSize();const f=c?o.getLegendWidth():0,g=c?o.getLegendHeight():0,p={width:f,height:g};!u&&r.axis_x_show&&r.axis_x_tick_autorotate&&o.updateXAxisTickClip();const x={right:r.legend_show&&l.isLegendRight?f+(h?0:20):0,bottom:!r.legend_show||l.isLegendRight||l.isLegendInset?0:g},_=d||u?0:o.getHorizontalAxisHeight("x"),v=r.subchart_axis_x_show&&r.subchart_axis_x_tick_text_show?_:30,m=r.subchart_show&&!u?r.subchart_size_height+v:0,b=o.hasType("gauge")&&r.arc_needle_show&&!r.gauge_fullCircle&&!r.gauge_label_show?10:0,y=o.getCurrentPadding(!0);if(l.margin=!u&&d?{top:y.top,right:u?0:y.right+x.right,bottom:x.bottom+y.bottom,left:m+(u?0:y.left)}:{top:(h?0:4)+y.top,right:u?0:y.right+x.right,bottom:b+m+x.bottom+y.bottom,left:u?0:y.left},l.margin=o.getResettedPadding(l.margin),l.margin2=d?{top:l.margin.top,right:NaN,bottom:20+x.bottom,left:o.state.rotatedPadding.left}:{top:l.current.height-m-x.bottom,right:NaN,bottom:v+x.bottom,left:l.margin.left},l.margin3={top:0,right:NaN,bottom:0,left:0},(n=o.updateSizeForLegend)==null||n.call(o,p),l.width=l.current.width-l.margin.left-l.margin.right,l.height=l.current.height-l.margin.top-l.margin.bottom,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l.width2=d?l.margin.left-l.rotatedPadding.left-l.rotatedPadding.right:l.width,l.height2=d?l.height:l.current.height-l.margin2.top-l.margin2.bottom,l.width2<0&&(l.width2=0),l.height2<0&&(l.height2=0),o.hasArcType()){const T=o.hasType("gauge"),w=r.legend_show&&l.isLegendRight,C=(i=l.hasRadar&&o.cache.get(j.radarTextWidth))!=null?i:0;l.arcWidth=l.width-(w?p.width+10:0)-C,l.arcHeight=l.height-(w&&!T?0:10),(a=r.arc_rangeText_values)!=null&&a.length&&(T?(l.arcWidth-=25,l.arcHeight-=10,l.margin.left+=10):(l.arcHeight-=20,l.margin.top+=10)),T&&!r.gauge_fullCircle&&(l.arcHeight+=l.height-o.getPaddingBottomForGauge()),(s=o.updateRadius)==null||s.call(o)}l.isLegendRight&&u&&(l.margin3.left=l.arcWidth/2+l.radiusExpanded*1.1)}},Cf={setCssRule(e,t,n,i){const a=this,{config:s,state:{cssRule:o,style:r}}=a;return s.boost_useCssRule?l=>{l.each(c=>{const d=i&&(i==null?void 0:i.call(a,c)),u=`${e?`.${Ct.shapes+a.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[u]),a.state.cssRule[u]=Rh(r,u,n.filter(Boolean).map(h=>nt(d)&&h.indexOf(":")===-1?`${h}: ${d}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:O(e)?e.bind(this):e}};function Sf(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function Af(e,t,n,i,a){var s;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=X(r)&&r<0||l&&!((s=o.getCandlestickData(e))!=null&&s._isUp);let{x:d,y:u}=t;const h=4,f=h*2;return i?n==="start"?(d+=c?0:f,u+=h):n==="middle"?(d+=f,u-=f):n==="end"&&(c&&(d-=f),u+=h):(n==="start"?(d+=h,c&&(u+=f*2)):n==="middle"?u-=f:n==="end"&&(d-=h,c&&(u+=f*2)),a&&(u+=c?-17:l?13:7)),{x:d,y:u}}function Ko(e,t){var n;const i=this.config.data_labels_position,{id:a,index:s,value:o}=e;return(n=O(i)?i.bind(this.api)(t,o,a,s,this.$el.text):(a in i?i[a]:i)[t])!=null?n:0}function kf(e,t,n){var i,a;const s=this,{config:o,$T:r}=s,l=o.axis_rotated,{border:{padding:c="3 5",radius:d=10,stroke:u="#000",strokeWidth:h=1,fill:f="none"}}=o.data_labels,g=rs(c),p=o.data_labels.border!==!0,x=Xe(e);let _=(0,F.select)(e.previousElementSibling);(_.empty()||((i=_.node())==null?void 0:i.tagName)!=="rect"||!((a=_.attr("class"))!=null&&a.includes(n)))&&(_=(0,F.select)(e.parentNode).insert("rect",()=>e).attr("class",`${St.textBorderRect} ${n}`).attr("width",x.width+(p?g.left+g.right:0)).attr("height",x.height+(p?g.top+g.bottom:0)),p&&_.style("fill",f).style("stroke",u).style("stroke-width",`${h}px`).attr("rx",d).attr("ry",d)),r(_).attr("x",t.x-(p?g.left:0)-(l?0:x.width/2)).attr("y",t.y-(p?g.top:0)-x.height/4*3.2)}function Sa(e=0,t){const n=this,{config:i}=n,a=i[`${t}_label_threshold`]||0;return e>=a}function Zo(){const e=this,{$el:{text:t},config:n}=e;(e.state.arcWidth?e.getArcLabelConfig("image"):n.data_labels.image)&&t.filter(function(){const a=this.previousElementSibling;return a?a.tagName!=="image"||!a.classList.contains(St.textLabelImage):!0}).each(function(a){var s,o,r,l;const c=Lf.call(e,a);if(!c)return;const{url:d,width:u,height:h,pos:f}=c;if(d){const g=(0,F.select)(this.parentNode);g==null||g.insert("image",`${(o=(s=this.getAttribute("class"))==null?void 0:s.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",p=>Ue(d,{ID:"id"in p?p.id:p.data.id})).attr("class",St.textLabelImage).style("pointer-events","none").attr("width",u).attr("height",h).attr("transform",f?`translate(${(r=f.x)!=null?r:0} ${(l=f.y)!=null?l:0})`:null)}})}function Lf(e){var t;const n=this,{config:i,state:a}=n,s=a.arcWidth?n.getArcLabelConfig("image"):i.data_labels.image;if(O(s))return(t=s.call(n.api,e.value,e.id,e.index))!=null?t:{url:"",width:0,height:0,pos:{x:0,y:0}};if(s){const{url:o="",width:r=0,height:l=0,pos:c}=s;return{url:o,width:r,height:l,pos:c}}return null}function qo(e,t,n){var i;const a=this,{config:s,state:{arcWidth:o,hasTreemap:r}}=a,l=s.axis_rotated,c=(0,F.select)(e.previousElementSibling),d=u=>{var h;const f=u.style.opacity!=="0"&&u.style.fillOpacity!=="0";return(o?u.textContent:f)&&((h=this.previousElementSibling)==null?void 0:h.tagName)!=="image"};if(!c.empty()&&((i=c.node())==null?void 0:i.tagName)==="image"){const u=n||ht(e),h=+c.attr("width")/2,f=+c.attr("height")/2;let g=t.x-h,p=t.y-f-u.height/2;l?t.x+=h:(r&&(g=-h,p=-(f*2+u.height)),a.hasType("pie")||a.hasType("polar")||(t.y+=f)),a.$T(c).style("opacity",d(e)?null:"0").attr("x",g).attr("y",p)}}function Rf(e){return ds(e,t=>t,t=>Xe(t,!0))}var Ef={opacityForText(e){const t=this;return t.isBarType(e)&&!Sa.call(t,Math.abs(t.getRatio("bar",e)),"bar")?"0":t.hasDataLabel()?null:"0"},initText(){const{$el:e}=this;e.main.select(`.${Y.chart}`).append("g").attr("class",St.chartTexts).style("pointer-events",e.funnel||e.treemap?"none":null)},updateTargetsForText(e){const t=this,n=t.getChartClass("Text"),i=t.getClass("texts","id"),a=t.classFocus.bind(t);t.$el.main.select(`.${St.chartTexts}`).selectAll(`.${St.chartText}`).data(t.filterNullish(e)).attr("class",r=>`${n(r)}${a(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",n).call(t.setCssRule(!0,` .${St.text}`,["fill","pointer-events:none"],t.updateTextColor)).append("g").attr("class",i)},updateText(){const e=this,{$el:t,$T:n,config:i,axis:a}=e,s=e.getClass("text","index"),o=i.data_labels.centered,r=t.main.selectAll(`.${St.texts}`).selectAll(`.${St.text}`).data(e.labelishData.bind(e));n(r.exit()).style("fill-opacity","0").remove(),t.text=r.enter().append("text").merge(r).attr("class",s).attr("text-anchor",l=>{let d=i[`axis_${a==null?void 0:a.getId(l.id)}_inverted`]?l.value>0:l.value<0;if(e.isCandlestickType(l)){const u=e.getCandlestickData(l);d=!(u!=null&&u._isUp)}else if(e.isTreemapType(l))return o?"middle":"start";return i.axis_rotated?d?"end":"start":"middle"}).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each(function(l,c,d){const u=(0,F.select)(this);let{value:h}=l;if(e.isBubbleZType(l))h=e.getBubbleZData(h,"z");else if(e.isCandlestickType(l)){const f=e.getCandlestickData(l);f&&(h=f.close)}h=e.isTreemapType(l)?e.treemapDataLabelFormat(l)(u):e.dataLabelFormat(l.id)(h,l.id,l.index,d),X(h)?this.textContent=h:pn(u,h,void 0,!0)}),Zo.call(e)},updateTextColor(e){const t=this,{config:n}=t,i=n.data_labels_colors,a=t.isArcType(e)&&!t.isRadarType(e)||t.isFunnelType(e)||t.isTreemapType(e)?null:t.color(e);let s;if(nt(i))s=i;else if(Q(i)){const{id:o}=e.data||e;s=i[o]}else O(i)&&(s=i.bind(t.api)(a,e));if(t.isCandlestickType(e)&&!O(i)){const o=t.getCandlestickData(e);if(!(o!=null&&o._isUp)){const r=n.candlestick_color_down;s=Q(r)?r[e.id]:r}}return s||a},updateTextBGColor(e,t){const n=this,{$el:{defs:i}}=n;let a="";if(t){const s=nt(t)?"":n.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=i.select(["filter[id*='labels-bg","']"].join(s));if(o.size()&&(a=`url(#${o.attr("id")})`),O(t)){n.generateTextBGColorFilter(t);const r=n.color(e),l=t.bind(n.api)(r,e);l?o.select("feFlood").attr("flood-color",l):a=""}}return a||null},redrawText(e,t,n,i){const a=this,{$T:s,axis:o,config:r,state:{hasTreemap:l}}=a,c=he(!0),d=r.axis_rotated,u=r.data_labels.rotate,h=Sf(u),f=u?`rotate(${u})`:"",g=a.$el.text.style("fill",a.getStylePropValue(a.updateTextColor)).attr("filter",_=>a.updateTextBGColor.bind(a)(_,r.data_labels_backgroundColors)).style("fill-opacity",n?0:a.opacityForText.bind(a)),p=new Map,x=[];return g.each(function(_){const v=this;p.set(v,{rect:ht(v)}),r.data_labels.centered&&(a.isBarType(_)||a.isTreemapType(_))&&x.push(v)}),x.length>0&&Rf(x).forEach((_,v)=>{const m=p.get(v);m&&(m.bbox=_)}),g.each(function(_,v){const m=p.get(this),b=s(l&&this.childElementCount?this.parentNode:this,!!(i&&(this.getAttribute("x")||this.getAttribute("transform"))),c),y=r[`axis_${o==null?void 0:o.getId(_.id)}_inverted`];let T={x:e.call(this,_,v,m),y:t.call(this,_,v,m)};u&&(T=Af.bind(a)(_,T,h,d,y),b.attr("text-anchor",h)),qo.call(a,this,T,m==null?void 0:m.rect),this.childElementCount||u?b.attr("transform",`translate(${T.x} ${T.y}) ${f}`):b.attr("x",T.x).attr("y",T.y),r.data_labels.border&&kf.call(a,b.node(),T,`${St.textBorderRect}-${v}`)}),!0},getTextRect(e,t){var n,i;const a=this;let s,o,r;Array.isArray(e)?s=`${j.textRect}-${e.join("_")}`:(o=(i=(n=e.node)==null?void 0:n.call(e))!=null?i:e,/text/i.test(o.tagName)||(o=o.querySelector("text")),r=o.textContent,s=`${j.textRect}-${r.replace(/\W/g,"_")}`);const l=a.cache.get(s)||[];return l.length===0&&((a.$el.svg||a.$el.chart.select("svg")).selectAll(`.${Y.dummy}`).data(r?[r]:e).enter().append("text").style("visibility","hidden").style("font",o?(0,F.select)(o).style("font"):null).classed(t||Y.dummy,!0).text(c=>c).each(function(c,d){l[d]=ht(this)}).remove(),a.cache.add(s,l)),l.length>1?l:l[0]},generateXYForText(e,t){const n=this,{state:{hasRadar:i,hasFunnel:a,hasTreemap:s}}=n,o=Object.keys(e),r={},l=t?n.getXForText:n.getYForText;return a&&o.push("funnel"),i&&o.push("radar"),s&&o.push("treemap"),o.forEach(c=>{r[c]=n[`generateGet${Ot(c)}Points`](e[c],!1)}),function(c,d,u){const h=n.isAreaType(c)&&"area"||n.isBarType(c)&&"bar"||n.isCandlestickType(c)&&"candlestick"||n.isFunnelType(c)&&"funnel"||n.isRadarType(c)&&"radar"||n.isTreemapType(c)&&"treemap"||"line";return l.call(n,r[h](c,d),c,this,u)}},getCenteredTextPos(e,t,n,i,a){const s=this,{config:o}=s,r=o.axis_rotated,l=s.isBarType(e),c=s.isTreemapType(e);if(o.data_labels.centered&&(l||c)){const d=(a==null?void 0:a.bbox)||Xe(n);if(l){const u=s.getRangedData(e,null,"bar")>=0;if(r){const h=(u?t[1][1]-t[0][1]:t[0][1]-t[1][1])/2+d.width/2;return u?-h-3:h+2}else{const h=(u?t[0][1]-t[1][1]:t[1][1]-t[0][1])/2+d.height/2;return u?h:-h-2}}else if(c)return i==="x"?(t[1][0]-t[0][0])/2:(t[1][1]-t[0][1])/2-d.y-d.height/2}return 0},getXForText(e,t,n,i){var a,s,o;const r=this,{config:l}=r,c=l.axis_rotated,d=r.isFunnelType(t),u=r.isTreemapType(t);let h=e?e[0][0]:0;if(r.isCandlestickType(t))c?h=(a=r.getCandlestickData(t))!=null&&a._isUp?e[2][2]+4:e[2][1]-4:h+=(e[1][0]-h)/2;else if(d)if(e)h=(o=(s=e[2])==null?void 0:s[0])!=null?o:h;else return _a(n,"x");else if(u)h+=l.data_labels.centered?0:5;else if(c){const f=l[`axis_${r.axis.getId(t.id)}_inverted`],g=r.isBarType(t)?4:6,p=t.value;h=e[2][1],h+=g*((f?p>0:p<0)?-1:1)}else h=r.hasType("bar")?(e[2][0]+e[0][0])/2:h;return(c||u||d)&&(h+=r.getCenteredTextPos(t,e,n,"x",i)),h+Ko.call(this,t,"x")},getYForText(e,t,n,i){var a,s;const o=this,{axis:r,config:l,state:c}=o,d=l.axis_rotated,u=l[`axis_${r==null?void 0:r.getId(t.id)}_inverted`],h=o.isBarType(t),f=o.isFunnelType(t),g=o.isTreemapType(t),p=l.point_r,x=(i==null?void 0:i.rect)||ht(n);let{value:_}=t,v=3,m;if(o.isCandlestickType(t))_=o.getCandlestickData(t),d?(m=e[0][0],m+=(e[1][0]-m)/2+v):(m=_&&_._isUp?e[2][2]-v:e[2][1]+v*4,u&&(m+=15*(_._isUp?1:-1)));else if(f)if(e)m=((s=(a=e[2])==null?void 0:a[1])!=null?s:e[0][1])+x.height/2-3;else return _a(n,"y");else if(g)m=e[0][1]+(l.data_labels.centered?0:x.height+5);else if(d)m=(e[0][0]+e[2][0]+x.height*.6)/2;else if(m=e[2][1],X(p)&&p>5&&(o.isLineType(t)||o.isScatterType(t))&&(v+=l.point_r/2.3),_<0||_===0&&!c.hasPositiveValue&&c.hasNegativeValue)m+=u?h?-3:-5:x.height+(h?-v:v);else{let b=-v*2;h?b=-v:o.isBubbleType(t)&&(b=v),u&&(b=h?10:15),m+=b}return(!d||g)&&(m+=o.getCenteredTextPos(t,e,n,"y",i)),m+Ko.call(this,t,"y")},markOverlapped(e,t,n){const i=t.$el.arcs.selectAll(n),a=i.filter(l=>l.data.id!==e),s=i.filter(l=>l.data.id===e),o=xa(s.node()),r=(l,c)=>Math.sqrt(l*l+c*c);s.node()&&a.each(function(){const l=xa(this),c=(0,F.select)(this),d=r(o.e,o.f)>r(l.e,l.f)?s:c,u=Math.ceil(Math.abs(o.e-l.e))<Math.ceil(d.node().getComputedTextLength()),h=Math.ceil(Math.abs(o.f-l.f))<parseInt(s.style("font-size"),10);c.classed(St.TextOverlapping,u&&h)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,F.selectAll)([this,this.previousSibling]).classed(St.TextOverlapping,!1)})}};function Jo(e="left",t){const n=X(t);return e.includes("center")?n?t/2:"middle":e.includes("right")?n?t:"end":n?0:"start"}function Pf(e){var t,n,i,a,s,o,r,l;const{config:c,$el:d}=e,u=((i=(n=(t=e.canvasTheme)==null?void 0:t.style)==null?void 0:n.title)==null?void 0:i.font)||((o=(s=(a=e.canvasTheme)==null?void 0:a.style)==null?void 0:s.label)==null?void 0:o.font)||"14px sans-serif",h=(l=(r=d.chart)==null?void 0:r.node)==null?void 0:l.call(r),f=h==null?void 0:h.ownerDocument;if(h&&f&&c.title_text){const g=f.createElementNS("http://www.w3.org/2000/svg","svg"),p=f.createElementNS("http://www.w3.org/2000/svg","text");g.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",p.setAttribute("class",St.title),p.style.font=u,p.textContent=String(c.title_text),g.appendChild(p),h.appendChild(g);const x=ht(p).height;if(g.remove(),x)return x}return c.title_text?parseFloat(u)||14:0}var Df={initTitle(){const e=this,{config:t,$el:n}=e;if(t.title_text){n.title=n.svg.append("g");const i=n.title.append("text").style("text-anchor",Jo(t.title_position)).attr("class",St.title);pn(i,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:n},$el:{title:i}}=e;if(i){const a=Jo(t.title_position,n.width),s=(t.title_padding.top||0)+e.getTextRect(e.$el.title,St.title).height;i.attr("transform",`translate(${a}, ${s})`)}},getCanvasTitleHeight(){return Pf(this)},getTitlePadding(){const e=this,{$el:{title:t},config:n,state:i}=e,a=n.title_padding.top||0,s=n.title_padding.bottom||0;if(i.isCanvasMode&&n.title_text)return a+e.getCanvasTitleHeight()+s;if(!(t!=null&&t.node()))return a+s;const o=t.node(),r=_a(o,"y");if(r){const l=Xe(o);return r+l.y+l.height+s}return a+e.getTextRect(t,St.title).height+s}};const If=/(\r?\n|\t)/g,Mf=/{{(.*)}}/;var $f={initTooltip(){const e=this,{config:t,$el:n}=e;n.tooltip=(0,F.select)(t.tooltip_contents.bindto),n.tooltip.empty()&&(n.tooltip=n.chart.append("div").attr("class",gi.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.bindTooltipResizePos()},initShowTooltip(){var e;const t=this,{config:n,$el:i,state:{hasAxis:a,hasRadar:s}}=t;if(n.tooltip_init_show){const o=!(a||s);(e=t.axis)!=null&&e.isTimeSeries()&&nt(n.tooltip_init_x)&&(n.tooltip_init_x=Xt.call(t,n.tooltip_init_x)),t.api.tooltip.show({data:{[o?"index":"x"]:n.tooltip_init_x}});const r=n.tooltip_init_position;if(!n.tooltip_contents.bindto&&!Qt(r)){const{top:l=0,left:c=50}=r;i.tooltip.style("top",nt(l)?l:`${l}px`).style("left",nt(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:n,config:i}=t;return me(O(i.tooltip_contents)?i.tooltip_contents.bind(n)(...e):t.getTooltipContent(...e))},getTooltipContent(e,t,n,i){var a;const s=this,{api:o,config:r,state:l,$el:c}=s,d=r.tooltip_format_title,u=r.tooltip_format_name,h=r.tooltip_format_value,f=O(d)?d.bind(o):t,g=O(u)?u.bind(o):(E=>E),p=O(h)?h.bind(o):null,x=(E,P,D,z)=>{let $=p;return $||(l.hasTreemap||s.isStackNormalized()&&(!s.isStackNormalizedPerGroup()||s.isGrouped(D))?$=(G,N)=>`${(N*100).toFixed(2)}%`:$=n),$(E,P,D,z)},_=r.tooltip_order,v=E=>s.axis&&s.isBubbleZType(E)?s.getBubbleZData(E.value,"z"):s.getBaseValue(E),m=s.levelColor?E=>s.levelColor(E.value):E=>i(E),b=r.tooltip_contents,y=b.template,T=s.mapToTargetIds();if(_===null&&r.data_groups.length){const E=s.orderTargets(s.data.targets).map(P=>P.id).reverse();e.sort((P,D)=>{let z=P?P.value:null,$=D?D.value:null;return z>0&&$>0&&(z=P.id?E.indexOf(P.id):null,$=D.id?E.indexOf(D.id):null),z-$})}else if(/^(asc|desc)$/.test(_)){const E=_==="asc";e.sort((P,D)=>{const z=P?v(P):null,$=D?v(D):null;return E?z-$:$-z})}else O(_)&&e.sort(_.bind(o));const w=s.getTooltipContentTemplate(y),C=e.length;let A,S,k,L,R;for(R=0;R<C;R++){S=e[R];const E=S&&v(S);if(!(!S||!(E||E===0))){if(yt(A)){const P=(l.hasAxis||l.hasRadar)&&f(S.x);A=Ue(w[0],{CLASS_TOOLTIP:gi.tooltip,TITLE:J(P)?y?P:`<tr><th colspan="2">${P}</th></tr>`:""})}if(!S.ratio&&c.arcs&&(k=["arc",s.$el.arcs.select(`path.${et.arc}-${S.id}`).data()[0]],S.ratio=s.getRatio(...k)),k=[S.ratio,S.id,S.index],s.isAreaRangeType(S)){const[P,D]=["high","low"].map($=>x(s.getRangedData(S,$),...k));L=`<b>Mid:</b> ${x(v(S),...k)} <b>High:</b> ${P} <b>Low:</b> ${D}`}else if(s.isCandlestickType(S)){const[P,D,z,$,G]=["open","high","low","close","volume"].map(N=>s.getRangedData(S,N,"candlestick")?x(s.getRangedData(S,N,"candlestick"),...k):void 0);L=`<b>Open:</b> ${P} <b>High:</b> ${D} <b>Low:</b> ${z} <b>Close:</b> ${$}${G?` <b>Volume:</b> ${G}`:""}`}else if(s.isBarRangeType(S)){const{value:P,id:D,index:z}=S;L=`${x(P,void 0,D,z)}`}else L=x(v(S),...k);if(L!==void 0){if(S.name===null)continue;const P=g((a=S.name)!=null?a:S.id,...k),D=m(S),z={CLASS_TOOLTIP_NAME:gi.tooltipName+s.getTargetSelectorSuffix(S.id),COLOR:y||!s.patterns?D:`<svg><rect style="fill:${D}" width="10" height="10"></rect></svg>`,NAME:P,VALUE:L};if(y&&Q(b.text)){const $=T.indexOf(S.id);Object.keys(b.text).forEach(G=>{z[G]=b.text[G][$]})}A+=Ue(w[1],z)}}}return`${A}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
24
+ `),o=i?s.length-1:1;e.html(""),s.forEach((r,l)=>{e.append("tspan").attr("x",0).attr("dy",`${l===0?n[0]*o:n[1]}em`).text(r)})}}}function lr(e){const{x:t,y:n,width:i,height:a}=Ue(e,!0);return[{x:t,y:n+a},{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+a}]}function cr(e){const{width:t,height:n}=ht(e),i=lr(e),a=i[0].x,s=Math.min(i[0].y,i[1].y);return{x:a,y:s,width:t,height:n}}function qt(e,t){var n;const i=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let a=[0,0];try{a=(0,O.pointer)(i||e,t)}catch(s){}return a.map(s=>isNaN(s)?0:s)}function ht(e,t=!1){return rr(!0,e,t)}function Ue(e,t=!1){return rr(!1,e,t)}function bf(e,t,n){const{rootSelector:i="",sheet:a}=e,s=`${i} ${vf(t)} {${n.join(";")}}`;return a[a.insertRule?"insertRule":"addRule"](s,a.cssRules.length)}function yf(e){let t=[];return e.forEach(n=>{var i;try{n.cssRules&&n.cssRules.length&&(t=t.concat(nn(n.cssRules)))}catch(a){(i=N.console)==null||i.warn(`Error while reading rules from ${n.href}: ${String(a)}`)}}),t}function ur(e){var t,n,i,a,s,o;return{x:((n=(t=N.pageXOffset)!=null?t:N.scrollX)!=null?n:0)+((i=e.scrollLeft)!=null?i:0),y:((s=(a=N.pageYOffset)!=null?a:N.scrollY)!=null?s:0)+((o=e.scrollTop)!=null?o:0)}}function Ai(e,t=0,n=0,i=!0){const a=new DOMPoint(t,n),s=e.getScreenCTM(),o=a.matrixTransform(i?s==null?void 0:s.inverse():s);if(i===!1){const r=ht(e);o.x-=r.x,o.y-=r.y}return o}function Ma(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Fa(e,t){var n;const i=(n=e==null?void 0:e.getAttribute)==null?void 0:n.call(e,t);if(i)return parseFloat(i);const a=Ma(e);return t==="x"?a.e:a.f}function Oa(e){const t=e.attr("viewBox");return t?t.trim().split(/[\s,]+/).length===4:!1}function Tf(e,t,n=!1){const i=!!e.node;let a=!1;for(const[s,o]of Object.entries(t))if(a=i?e.style(s)===o:e.style[s]===o,n?!a:a)break;return a}function qn(){var e,t;return((e=nt)==null?void 0:e.hidden)===!1||((t=nt)==null?void 0:t.visibilityState)==="visible"}function wf(e,t){const{DocumentTouch:n,matchMedia:i,navigator:a}=N,s=i==null?void 0:i("(pointer:coarse)").matches;let o=!1;if(t)if(a&&"maxTouchPoints"in a)o=a.maxTouchPoints>0;else if("ontouchmove"in N||n&&nt instanceof n)o=!0;else if(s)o=!0;else{const l=a.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(l)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(l)}return e&&!s&&(i==null?void 0:i("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function dr(e,t){e.pendingRaf!==null?(N.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=N.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=N.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}const $a={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,i=e())=>{t.dispatchEvent(new MouseEvent(n,i))}}catch(t){return(n,i,a=e())=>{const s=nt.createEvent("MouseEvent");s.initMouseEvent(i,a.bubbles,a.cancelable,N,0,a.screenX,a.screenY,a.clientX,a.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(e,t,n)=>{const i=new Touch(ke({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}},{setTimeout:Cf,clearTimeout:Sf}=N;function kf(e){const t=[];let n;const i=function(){i.clear(),e===!1?n=ys(()=>{n=null,t.forEach(a=>a())},{timeout:200}):n=Cf(()=>{n=null,t.forEach(a=>a())},$(e)?e:200)};return i.clear=()=>{n&&((e===!1?iu:Sf)(n),n=null)},i.add=a=>t.push(a),i.remove=a=>{const s=t.indexOf(a);s!==-1&&t.splice(s,1)},i}function hr(){let e=[];const t=function(n,i){function a(){var s;let o=0;for(let r=0,l;l=e[r];r++){if(l===!0||(s=l.empty)!=null&&s.call(l)){o++;continue}if(qn()===!1){o=e.length;break}try{l.transition()}catch(c){o++}}return o===e.length}Es(()=>{i==null||i()},a)};return t.add=function(n){ot(n)?e=e.concat(n):e.push(n)},t}const Ce={},Li=new Set,un=new Map,Af=5e3,fr=3;let Lf=0;function Rf(){try{return"var bbWorker=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=[];return e.forEach(function(e,n){let r=e[0];e.forEach(function(e,i){if(i>0){if(t[i-1]===void 0&&(t[i-1]={}),e===void 0)throw Error(`Source data is missing a component at (${n}, ${i})!`);t[i-1][r]=e}})}),t}function n(e){let t=e[0],n=[];return e.forEach(function(e,r){if(r>0){let i={};e.forEach(function(e,n){if(e===void 0)throw Error(`Source data is missing a component at (${r}, ${n})!`);i[t[n]]=e}),n.push(i)}}),n}function r(e,r){let i=[],a,o;if(Array.isArray(e)){let t=function(e,t){if(e[t]!==void 0)return e[t];let n=t.replace(/\\[(\\w+)\\]/g,`.$1`).replace(/^\\./,``).split(`.`),r=e;return n.some(function(e){return!(r=r&&typeof r==`object`&&e in r?r[e]:void 0)}),r};a=r.x?r.value.concat(r.x):r.value,i.push(a),e.forEach(function(e){let n=a.map(function(n){let r=t(e,n);return r===void 0&&(r=null),r});i.push(n)}),o=n(i)}else Object.keys(e).forEach(function(t){let n=[].concat(e[t]);n.unshift?.(t),i.push(n)}),o=t(i);return o}let i={columns:t,json:r,rows:n},a=self;function o({data:e}){let{args:t,id:n,op:r}=e;try{let e=i[r];if(!e)throw Error(`Unknown worker op: ${r}`);a.postMessage({id:n,result:e(...t)})}catch(e){a.postMessage({id:n,error:e&&(e.message||e.name)||String(e)})}}return typeof window>`u`&&(a.onmessage=o),e.handleMessage=o,e.ops=i,e})({});"}catch(e){return""}}function Ba(){const{Blob:e,Worker:t,URL:n}=N;return t&&e&&(n!=null&&n.createObjectURL)&&(n!=null&&n.revokeObjectURL)?{Blob:e,Worker:t,URL:n}:null}function gr(){return N.Worker||null}function Ef(e){var t,n;return typeof e=="number"?{timeout:e,workerUrl:""}:{timeout:(t=e==null?void 0:e.timeout)!=null?t:Af,workerUrl:(n=e==null?void 0:e.workerUrl)!=null?n:""}}function pr(e,t=!1){var n,i;const a=Ce[e];t&&Li.add(e),a&&((n=a.worker)==null||n.terminate(),a.revoke&&((i=Ba())==null||i.URL.revokeObjectURL(a.src)),delete Ce[e]);for(const s of un.keys())s.startsWith(`${e}:`)&&un.delete(s)}function Pf(e,t){if(e===t)return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return!0}}function Df(e){const[t,...n]=e;return Array.isArray(t)?[t.slice(0,fr).map(i=>Array.isArray(i)?i.slice(0,fr+1):i),...n]:e}function _r(e,t,n,i){const a=++Lf;let s=!1,o;const r=new Promise((l,c)=>{const u=(g,p)=>{s||(s=!0,o(),g(p))},d=function(g){var p;((p=g.data)==null?void 0:p.id)===a&&(g.data.error?u(c,new Error(g.data.error)):u(l,g.data.result))},h=function(){u(c,new Error("worker error"))},f=setTimeout(()=>u(c,new Error("worker timeout")),i);o=()=>{clearTimeout(f),e.removeEventListener("message",d),e.removeEventListener("error",h)},e.addEventListener("message",d),e.addEventListener("error",h)});try{e.postMessage({args:n,id:a,op:t})}catch(l){throw s=!0,o(),l}return r}function If(e,t,n,i,a,s){const o=Df(a),r=_r(e,n,o,s).then(l=>Pf(l,i(...o)),()=>!1).then(l=>(l?un.set(t,!0):un.delete(t),l));return un.set(t,r),r}function Mf(e,t=""){const n=!!gr(),i=t?null:Ba(),a=t?"":Rf(),s=t||"blob";if(!n||!t&&(!i||!a)||Li.has(s))return null;if(!(s in Ce))try{if(t)Ce[s]={revoke:!1,src:t,worker:null};else if(i){const o=new i.Blob([a],{type:"text/javascript"});Ce[s]={revoke:!0,src:i.URL.createObjectURL(o),worker:null}}}catch(o){return null}return{key:s,src:Ce[s].src}}function Ff(e,t){const n=Ce[e],i=gr();if(!n||!i||Li.has(e))return null;if(!n.worker)try{n.worker=new i(t)}catch(a){return pr(e,!0),null}return n.worker}function za(e=!0,t,n,i,a){const{timeout:s,workerUrl:o}=Ef(a),r=function(...c){const u=n(...c);i(u)};let l=r;if(e){const c=Mf(t,o),u=c?Ff(c.key,c.src):null;if(u&&c){const{key:d}=c;l=function(...h){var f;const g=()=>{pr(d,!0),l=r,r(...h)};try{const p=`${d}:${t}`,_=(f=un.get(p))!=null?f:If(u,p,t,n,h,s);_r(u,t,h,s).then(x=>{_===!0?i(x):_.then(m=>m?i(x):g())},g)}catch(p){g()}}}}return l}function Of(){const e=Ba();for(const t in Ce){const n=Ce[t];n.worker&&n.worker.terminate(),n.src&&n.revoke&&(e==null||e.URL.revokeObjectURL(n.src)),delete Ce[t]}Li.clear(),un.clear()}const Na=34,Jn=10,Xa=13;function xr(e){const t=e.charCodeAt(0);function n(a,s){const o=[];let r=a.length,l=0,c=0,u=r<=0,d=!1;a.charCodeAt(0)===65279&&l++,a.charCodeAt(r-1)===Jn&&--r,a.charCodeAt(r-1)===Xa&&--r;function h(){if(u)return null;if(d)return d=!1,null;const g=l;let p,_;if(a.charCodeAt(g)===Na){for(;++l<r;)if(a.charCodeAt(l)===Na){if(a.charCodeAt(l+1)!==Na)break;l++}return(_=l++)>=r?u=!0:(p=a.charCodeAt(l++))===Jn?d=!0:p===Xa&&(d=!0,a.charCodeAt(l)===Jn&&++l),a.slice(g+1,_).replace(/""/g,'"')}for(;l<r;){if((p=a.charCodeAt(_=l++))===Jn)d=!0;else if(p===Xa)d=!0,a.charCodeAt(l)===Jn&&++l;else if(p!==t)continue;return a.slice(g,_)}return u=!0,a.slice(g,r)}let f;for(;(f=h())!==null;){const g=[];for(;f!==null;)g.push(f),f=h();if(s){const p=s(g,c++);p!=null&&o.push(p)}else o.push(g)}return o}function i(a,s){let o=[];return n(a,(r,l)=>{var c;if(l===0)return o=r,null;const u={};for(let d=0;d<o.length;d++)u[o[d]]=(c=r[d])!=null?c:"";return s?s(u,l-1,o):u})}return{parse:i,parseRows:n}}const mr=xr(","),vr=xr(" "),$f=mr.parse,Bf=mr.parseRows,zf=vr.parse,Nf=vr.parseRows;function br(e){const t=[];return e.forEach(function(n,i){const a=n[0];n.forEach(function(s,o){if(o>0){if(typeof t[o-1]=="undefined"&&(t[o-1]={}),typeof s=="undefined")throw new Error(`Source data is missing a component at (${i}, ${o})!`);t[o-1][a]=s}})}),t}function yr(e){const t=e[0],n=[];return e.forEach(function(i,a){if(a>0){const s={};i.forEach(function(o,r){if(typeof o=="undefined")throw new Error(`Source data is missing a component at (${a}, ${r})!`);s[t[r]]=o}),n.push(s)}}),n}function Tr(e,t){const n=[];let i,a;if(Array.isArray(e)){const s=function(o,r){if(o[r]!==void 0)return o[r];const c=r.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let u=o;return c.some(function(d){return!(u=u&&typeof u=="object"&&d in u?u[d]:void 0)}),u};t.x?i=t.value.concat(t.x):i=t.value,n.push(i),e.forEach(function(o){const r=i.map(function(l){let c=s(o,l);return typeof c=="undefined"&&(c=null),c});n.push(r)}),a=yr(n)}else Object.keys(e).forEach(function(s){var o;const r=[].concat(e[s]);(o=r.unshift)==null||o.call(r,s),n.push(r)}),a=br(n);return a}function Xf(e,t="csv",n,i,a){const s=new XMLHttpRequest,o={csv:Gf,tsv:Vf,json:Tr};s.open("GET",e),n&&Object.keys(n).forEach(function(r){s.setRequestHeader(r,n[r])}),s.onreadystatechange=function(){if(s.readyState===4)if(s.status===200){const r=s.responseText;r&&a.call(this,o[t](t==="json"?JSON.parse(r):r,i))}else throw new Error(`${e}: Something went wrong loading!`)},s.send()}function wr(e,t){const n=e.rows(t);let i;return n.length===1?(i=[{}],n[0].forEach(a=>{i[0][a]=null})):i=e.parse(t),i}function Gf(e){return wr({rows:Bf,parse:$f},e)}function Vf(e){return wr({rows:Nf,parse:zf},e)}const Wf=5e3;function Yf(e){var t,n;const i=e[0];if(ot(i)){let a=0;for(let s=0,o=e.length;s<o;s++)a+=(n=(t=e[s])==null?void 0:t.length)!=null?n:0;return a}return e.length*Object.keys(i!=null?i:{}).length}function Cr(e,t){const n=e||(t==null?void 0:t.data_keys);return n!=null&&n.x&&(t.data_x=n.x),n}function Hf(e,t,n){const i=this,{config:a}=i;let s;e.forEach(o=>{const r=i.getXKey(o);if(n.customX||n.timeSeries?n.xs.indexOf(r)>=0?s=(n.appendXs&&i.data.xs[o]||[]).concat(t.map((l,c)=>{const u=l[r];return J(u)?i.generateTargetX(u,o,c):!1}).filter(l=>l!==!1)):a.data_x?s=this.getOtherTargetXs():yt(a.data_xs)&&(s=i.getXValuesOfXKey(r,i.data.targets)):s=t.map((l,c)=>c),s)i.data.xs[o]=s;else throw new Error(`x is not defined for id = "${o}".`)})}var jf={convertData(e,t){const{config:n}=this,i=o=>!(o!=null&&o.length)||se(o[0])?!1:n.boost_useWorker==="auto"?Yf(o)>=Wf:!!n.boost_useWorker,a=n.boost_workerUrl?{workerUrl:n.boost_workerUrl}:void 0;let s=e;if(e.bindto&&(s={},["url","mimeType","headers","keys","json","rows","columns"].forEach(o=>{const r=`data_${o}`;r in e&&(s[o]=e[r])})),s.url&&t)Xf(s.url,s.mimeType,s.headers,Cr(s.keys,n),t);else if(s.json)za(i(s.json),"json",Tr,t,a)(s.json,Cr(s.keys,n));else if(s.rows)za(i(s.rows),"rows",yr,t,a)(s.rows);else if(s.columns)za(i(s.columns),"columns",br,t,a)(s.columns);else if(e.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets(e,t){const n=this,{axis:i,config:a,state:s}=n,o=a.data_type,r=Object.keys(e[0]||{}),{ids:l,xs:c}=r.length?r.reduce((g,p)=>(n.isX.call(n,p)?g.xs.push(p):g.ids.push(p),g),{ids:[],xs:[]}):{ids:[],xs:[]},u={appendXs:t,xs:c,categorized:i==null?void 0:i.isCategorized(),timeSeries:i==null?void 0:i.isTimeSeries(),customX:i==null?void 0:i.isCustomX()};Hf.bind(n)(l,e,u);const d=u.customX&&u.categorized&&a.axis_x_categories.length?new Map(a.axis_x_categories.map((g,p)=>[g,p])):null,h=a.data_idConverter.bind(n.api),f=l.map((g,p)=>{const _=h(g),x=n.getXKey(g),m=u.customX&&u.categorized,v=m&&p===0&&(()=>{const T=Ps(a.axis_x_categories);return e.every(w=>T.has(w[x]))})(),b=e.__append__,y=x===null&&b?n.api.data.values(g).length:0;return{id:_,id_org:g,values:e.map((T,w)=>{var C;const k=T[x];let S=T[g],A;if(S=S!==null&&!isNaN(S)&&!tt(S)?+S:ot(S)||tt(S)?S:null,(m||s.hasRadar)&&p===0&&!Ct(k)){!v&&w===0&&!b&&(a.axis_x_categories=[],d&&d.clear());const L=String(k);A=(C=d==null?void 0:d.get(L))!=null?C:-1,A===-1&&(A=a.axis_x_categories.length,a.axis_x_categories.push(k),d==null||d.set(L,A))}else A=n.generateTargetX(k,g,y+w);return(Ct(S)||n.data.xs[g].length<=w)&&(A=void 0),{x:A,value:S,id:_,index:-1}}).filter(T=>ct(T.x))}});if(f.forEach(g=>{var p;a.data_xSort&&(g.values=g.values.sort((_,x)=>{const m=_.x||_.x===0?_.x:1/0,v=x.x||x.x===0?x.x:1/0;return m-v})),g.values.forEach((_,x)=>_.index=x),(p=n.data.xs[g.id])==null||p.sort((_,x)=>_-x)}),s.hasNegativeValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value<0)),s.hasPositiveValue=f.some(g=>g.values.some(p=>p.value!==null&&p.value>0)),o&&n.isValidChartType(o)){const g=n.mapToIds(f).filter(p=>!(p in a.data_types)||!n.isValidChartType(a.data_types[p]));n.setTargetType(g,o)}return f.forEach(g=>n.cache.add(g.id_org,g,!0)),f}};const Uf={areaRange:{high:0,mid:1,low:2},candlestick:{open:0,high:1,low:2,close:3,volume:4}};function Sr(e){return ot(e)?e:[e]}var Kf={isX(e){const t=this,{config:n}=t,i=n.data_x&&e===n.data_x,a=yt(n.data_xs)&&Tu(n.data_xs,e);return i||a},isStackNormalized(){const{config:e}=this;return!!((e.data_stack_normalize===!0||Kt(e.data_stack_normalize))&&e.data_groups.length)},isStackNormalizedPerGroup(){var e;const{config:t}=this;return!!(Kt(t.data_stack_normalize)&&((e=t.data_stack_normalize)!=null&&e.perGroup)&&t.data_groups.length)},isGrouped(e){const t=this.config.data_groups;return e?t.some(n=>n.indexOf(e)>=0&&n.length>1):t.length>0},hasAxisGroupedData(e){const t=this,{axis:n}=t;return t.data.targets.filter(s=>n.getId(s.id)===e).map(s=>s.id).some(s=>t.isGrouped(s))},getXKey(e){const t=this,{config:n}=t;return n.data_x?n.data_x:yt(n.data_xs)?n.data_xs[e]:null},getXValuesOfXKey(e,t){const n=this,i=t&&yt(t)?n.mapToIds(t):[];let a;return i.forEach(s=>{n.getXKey(s)===e&&(a=n.data.xs[s])}),a},getIndexByX(e,t){const n=this;return t?t.indexOf(Q(e)?e:+e):(n.filterByX(n.data.targets,e)[0]||{index:null}).index},getXValue(e,t){const n=this;return e in n.data.xs&&n.data.xs[e]&&J(n.data.xs[e][t])?n.data.xs[e][t]:t},getOtherTargetXs(){const e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},getOtherTargetX(e){const t=this.getOtherTargetXs();return t&&e<t.length?t[e]:null},addXs(e){const t=this,{config:n}=t;Object.keys(e).forEach(i=>{n.data_xs[i]=e[i]})},isMultipleX(){return!this.config.axis_x_forceAsSingle&&(yt(this.config.data_xs)||this.hasType("bubble")||this.hasType("scatter"))},addName(e){const t=this,{config:n}=t;let i;return e&&(i=n.data_names[e.id],e.name=i!==void 0?i:e.id),e},getAllValuesOnIndex(e,t=!1){const n=this;let i=n.filterTargetsToShow(n.data.targets).map(a=>n.addName(n.getValueOnIndex(a.values,e)));return t&&(i=i.filter(a=>a&&"value"in a&&J(a.value))),i},getValueOnIndex(e,t){var n;if(((n=e[t])==null?void 0:n.index)===t)return e[t];const i=e.filter(a=>a.index===t);return i.length?i[0]:null},updateTargetX(e,t){const n=this;e.forEach(i=>{i.values.forEach((a,s)=>{a.x=n.generateTargetX(t[s],i.id,s)}),n.data.xs[i.id]=t})},updateTargetXs(e,t){const n=this;e.forEach(i=>{t[i.id]&&n.updateTargetX([i],t[i.id])})},generateTargetX(e,t,n){const i=this,{axis:a}=i;let s=a!=null&&a.isCategorized()?n:e||n;if(a!=null&&a.isTimeSeries()){const o=Wt.bind(i);s=o(e||i.getXValue(t,n))}else a!=null&&a.isCustomX()&&!(a!=null&&a.isCategorized())&&(s=J(e)?+e:i.getXValue(t,n));return s},updateXs(e){e.length&&(this.axis.xs=e.map(t=>t.x))},getPrevX(e){const t=this.axis.xs[e-1];return ct(t)?t:null},getNextX(e){const t=this.axis.xs[e+1];return ct(t)?t:null},getBaseValue(e){const t=this,{hasAxis:n}=t.state;let{value:i}=e;return i&&n&&(t.isAreaRangeType(e)?i=t.getRangedData(e,"mid"):t.isBubbleZType(e)&&(i=t.getBubbleZData(i,"y"))),i},getMinMaxValue(e){const t=this.getBaseValue.bind(this);let n=1/0,i=-1/0;const a=e||this.data.targets.map(s=>s.values);for(let s=0;s<a.length;s++){const o=a[s];for(let r=0;r<o.length;r++){const l=t(o[r]);$(l)&&(l<n&&(n=l),l>i&&(i=l))}}return{min:n,max:i}},getMinMaxData(){const e=this,t=U.dataMinMax;let n=e.cache.get(t);if(!n){const i=e.data.targets.map(c=>c.values),a=e.getMinMaxValue(i),s=[],o=[],{min:r,max:l}=a;i.forEach(c=>{const u=e.getFilteredDataByValue(c,r),d=e.getFilteredDataByValue(c,l);if(u.length)for(let h=0;h<u.length;h++)s.push(u[h]);if(d.length)for(let h=0;h<d.length;h++)o.push(d[h])}),e.cache.add(t,n={min:s,max:o})}return n},getTotalPerIndex(e){const t=this,{config:n}=t,i=e?`${U.dataTotalPerIndex}-${e}`:U.dataTotalPerIndex;let a=t.cache.get(i);if((t.config.data_groups.length||t.isStackNormalized())&&!a){a=[];let{targets:s}=t.data;if(t.isStackNormalizedPerGroup()&&e){const o=n.data_groups.find(r=>r.indexOf(e)>=0);if(o)s=s.filter(r=>o.indexOf(r.id)>=0);else return null}s.forEach(o=>{o.values.forEach((r,l)=>{a[l]||(a[l]=0),a[l]+=$(r.value)?r.value:0})}),t.cache.add(i,a)}return a},getTotalDataSum(e){const t=this,n=U.dataTotalSum;let i=t.cache.get(n);return $(i)||(i=t.data.targets.reduce((a,s)=>a+s.values.reduce((o,r)=>{var l;return o+((l=r.value)!=null?l:0)},0),0),t.cache.add(n,i)),e&&(i-=t.getHiddenTotalDataSum()),i},getHiddenTotalDataSum(){const e=this,{api:t,state:{hiddenTargetIds:n}}=e;let i=0;return n.size&&(i=t.data.values.bind(t)([...n]).reduce((a,s)=>a+s,0)),i},getFilteredDataByValue(e,t){return e.filter(n=>this.getBaseValue(n)===t)},getMaxDataCount(){const{targets:e}=this.data;let t=0;for(let n=0;n<e.length;n++)e[n].values.length>t&&(t=e[n].values.length);return t},getMaxDataCountTarget(){const e=this,{cache:t,state:n}=e,i=t.get(U.maxDataCountTarget);if(i&&i.generation===n.dataGeneration)return i.value;let a=e.filterTargetsToShow()||[];const s=a.length,o=e.config.axis_x_inverted;if(s>1){const r=[];for(let l=0;l<a.length;l++){const c=a[l].values;for(let u=0;u<c.length;u++)r.push(c[u].x)}a=r,a=pn(Ji(a)).map((l,c,u)=>({x:l,index:o?u.length-c-1:c}))}else s&&(a=a[0].values.concat());return t.add(U.maxDataCountTarget,{value:a,generation:n.dataGeneration}),a},mapToIds(e){return e.map(t=>t.id)},mapToTargetIds(e){const t=this;return e?ot(e)?e.concat():[e]:t.mapToIds(t.data.targets)},hasTarget(e,t){const n=this.mapToIds(e);for(let i=0,a;a=n[i];i++)if(a===t)return!0;return!1},isTargetToShow(e){return!this.state.hiddenTargetIds.has(e)},isLegendToShow(e){return!this.state.hiddenLegendIds.has(e)},getTargetsToShow(){var e;const{state:t}=this;return(e=t._targetsToShow)!=null?e:this.filterTargetsToShow()},filterTargetsToShow(e){const t=this;if(!e){const{cache:n,data:i,state:a}=t,s=U.filteredTargets,o=n.get(s);if(o&&o.generation===a.dataGeneration)return o.value;const r=i.targets.filter(l=>t.isTargetToShow(l.id));return n.add(s,{value:r,generation:a.dataGeneration}),r}return e.filter(n=>t.isTargetToShow(n.id))},mapTargetsToUniqueXs(e){const t=this,{axis:n}=t;let i=[];return e!=null&&e.length&&(i=Ji(Su(e.map(a=>a.values.map(s=>+s.x)))),i=n!=null&&n.isTimeSeries()?i.map(a=>new Date(+a)):i.map(Number)),pn(i)},addTargetIds(e,t){const{state:n}=this;Sr(t).forEach(i=>n[e].add(i))},removeTargetIds(e,t){const{state:n}=this;Sr(t).forEach(i=>n[e].delete(i))},addHiddenTargetIds(e){this.addTargetIds("hiddenTargetIds",e)},removeHiddenTargetIds(e){this.removeTargetIds("hiddenTargetIds",e)},addHiddenLegendIds(e){this.addTargetIds("hiddenLegendIds",e)},removeHiddenLegendIds(e){this.removeTargetIds("hiddenLegendIds",e)},getValuesAsIdKeyed(e){const t=this,{hasAxis:n}=t.state,i={},a=t.isMultipleX();let s=null;if(a){const o=t.cache.get(U.valuesXIndexMap);if(o&&o.generation===t.state.dataGeneration)s=o.value;else{const r=t.mapTargetsToUniqueXs(t.data.targets).map(l=>Q(l)?l:+l);s=new Map(r.map((l,c)=>[l,c])),t.cache.add(U.valuesXIndexMap,{value:s,generation:t.state.dataGeneration})}}return e.forEach(o=>{const r=[];o.values.filter(({value:l})=>J(l)||l===null).forEach(l=>{let{value:c}=l;if(c!==null&&t.isCandlestickType(l)&&(c=ot(c)?c.slice(0,4):[c.open,c.high,c.low,c.close]),ot(c))r.push(...c);else if(tt(c)&&"high"in c)r.push(...Object.values(c));else if(t.isBubbleZType(l))r.push(n&&t.getBubbleZData(c,"y"));else if(a&&s){const u=Q(l.x)?l.x:+l.x,d=s.get(u);d!==void 0&&(r[d]=c)}else r.push(c)}),i[o.id]=r}),i},hasMultiTargets(){return this.filterTargetsToShow().length>1},orderTargets(e){const t=this,n=e.slice(),i=t.getSortCompareFn();return i&&n.sort(i),n},getSortCompareFn(e=!1){const t=this,{config:n}=t,i=n.data_order,a=/asc/i.test(i),s=/desc/i.test(i);let o;if(a||s){const r=(c,u)=>c+Math.abs(u.value),l=c=>$(c)?c:"values"in c?c.values.reduce(r,0):c.value;o=(c,u)=>{const d=l(c),h=l(u);return e?a?d-h:h-d:a?h-d:d-h}}else z(i)&&(o=i.bind(t.api));return o||null},filterByX(e,t){return this.getValuesByX(e).get(this.getXCacheKey(t))||[]},filterNullish(e){const t=n=>J(n.value);return e&&e.filter(n=>"value"in n?t(n):n.values.some(t))},filterRemoveNull(e){return e.filter(t=>J(this.getBaseValue(t)))},filterByXDomain(e,t){return e.map(n=>({id:n.id,id_org:n.id_org,values:n.values.filter(i=>t[0]<=i.x&&i.x<=t[1])}))},hasDataLabel(){const e=this.config.data_labels;return tn(e)&&e||Kt(e)&&yt(e)},hasNullDataValue(e){return e.some(({value:t})=>t===null)},getDataIndexFromEvent(e){const t=this,{$el:n,config:i,state:{hasRadar:a,inputType:s,eventReceiver:{coords:o,rect:r}}}=t;let l;if(a){let c=e.target;/tspan/i.test(c.tagName)&&(c=c.parentNode);const u=(0,O.select)(c).datum();l=u&&Object.keys(u).length===1?u.index:void 0}else{const c=i.axis_rotated,u=ur(n.chart.node()),d=s==="touch"&&e.changedTouches?e.changedTouches[0]:e;let h=c?d.clientY+u.y:d.clientX+u.x;if(Oa(n.svg)){const f=[h,0];c&&f.reverse(),h=Ai(n.eventRect.node(),...f)[c?"y":"x"]}else h-=c?r.top:r.left;l=Qi(o,h,0,o.length-1,c)}return l},getDataLabelLength(e,t,n){var i,a,s;const o=this,r=1.3,l=[e,t].map(c=>o.dataLabelFormat()(c));if(o.config.render_mode==="canvas"&&!o.$el.svg){const c=(a=(i=o.$el.chart)==null?void 0:i.node)==null?void 0:a.call(i),u=c==null?void 0:c.ownerDocument,d=u==null?void 0:u.createElementNS("http://www.w3.org/2000/svg","svg");if(c&&d){const h=l.map(g=>{const p=u.createElementNS("http://www.w3.org/2000/svg","text");return p.textContent=g,d.appendChild(p),p});d.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",c.appendChild(d);const f=h.map(g=>g.getBoundingClientRect()[n]*r);return d.remove(),f}}return((s=o.getTextRect(l))==null?void 0:s.map(c=>c[n]*r))||[0,0]},isNoneArc(e){return this.hasTarget(this.data.targets,e.id)},isArc(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},findSameXOfValues(e,t){const n=e[t].x,i=[];let a;for(a=t-1;a>=0&&n===e[a].x;a--)i.push(e[a]);for(a=t;a<e.length&&n===e[a].x;a++)i.push(e[a]);return i},getXCacheKey(e){return Q(e)?e:+e},getValuesByX(e){const t=this,{cache:n,state:i}=t,a=e.map(r=>{const{values:l}=r,c=l[0],u=l[l.length-1];return`${r.id}:${l.length}:${c?t.getXCacheKey(c.x):""}:${u?t.getXCacheKey(u.x):""}`}).join("|"),s=n.get(U.valuesByX);if(s&&s.generation===i.dataGeneration&&s.targetKey===a)return s.value;const o=new Map;for(let r=0;r<e.length;r++){const l=e[r].values;for(let c=0;c<l.length;c++){const u=l[c],d=t.getXCacheKey(u.x),h=o.get(d);h?h.push(u):o.set(d,[u])}}return n.add(U.valuesByX,{generation:i.dataGeneration,targetKey:a,value:o}),o},getClosestCandidates(e,t,n=!0){const i=this,{config:a,scale:s}=i,o=e.length,r=e[0];if(!n||o<200||!r||!a.data_xSort)return e;const l=i.isBarType(r.id),c=i.isCandlestickType(r.id),u=a.point_sensitivity;if(!(l||c)&&!$(u))return e;const d=s.zoom||s.x,h=t[+a.axis_rotated],f=d(e[0].x)<=d(e[o-1].x);let g=0,p=o-1;for(;g<p;){const b=g+p>>1,y=d(e[b].x);(f?y<h:y>h)?g=b+1:p=b}const _=[],x=new Set,m=b=>{b>=0&&b<o&&!x.has(b)&&(x.add(b),_.push(e[b]))},v=b=>{if(b<0||b>=o)return;const y=i.getXCacheKey(e[b].x);let T=b;for(;T>=0&&i.getXCacheKey(e[T].x)===y;)m(T--);for(T=b+1;T<o&&i.getXCacheKey(e[T].x)===y;)m(T++)};if(l||c)for(let b=g-2;b<=g+2;b++)v(b);else{const b=u,y=(T,w)=>{for(let C=T;C>=0&&C<o;C+=w){const k=e[C];if(Math.abs(d(k.x)-h)>b)break;m(C)}};y(g,1),y(g-1,-1)}return _},findClosestFromTargets(e,t){const n=this,i=[];for(let a=0;a<e.length;a++){const s=n.findClosest(e[a].values,t);s&&i.push(s)}return n.findClosest(i,t,!1)},findClosest(e,t,n=!0){const i=this,{$el:{main:a}}=i,s=i.getClosestCandidates(e,t,n);let o,r;for(let l=0;l<s.length;l++){const c=s[l];if(!c||!J(c.value))continue;const u=i.isBarType(c.id),d=i.isCandlestickType(c.id);if(u||d){const h=u?`.${ie.chartBar}.${j.target}${i.getTargetSelectorSuffix(c.id)} .${ie.bar}-${c.index}`:`.${De.chartCandlestick}.${j.target}${i.getTargetSelectorSuffix(c.id)} .${De.candlestick}-${c.index} path`;!r&&i.isWithinBar(a.select(h).node())&&(r=c)}else{const h=i.dist(c,t),f=i.getPointSensitivity(c);h<f&&(o===void 0||h<o)&&(o=h,r=c)}}return r},dist(e,t){const n=this,{config:{axis_rotated:i},scale:a}=n,s=+i,o=+!i,r=n.circleY(e,e.index),c=(a.zoom||a.x)(e.x)-t[s],u=r-t[o];return Math.sqrt(c*c+u*u)},convertValuesToStep(e){const t=this,{axis:n,config:i}=t,a=i.line_step_type,s=n?n.isCategorized():!1,o=ot(e)?e.concat():[e];if(!(s||/step\-(after|before)/.test(a)))return e;if(o.length){const r=o[0],l=o[o.length-1],{id:c}=r;let{x:u}=r;o.unshift({x:--u,value:r.value,id:c}),s&&a==="step-after"&&o.unshift({x:u-1,value:r.value,id:c}),u=l.x,o.push({x:++u,value:l.value,id:c}),s&&a==="step-before"&&o.push({x:u+1,value:l.value,id:c})}return o},convertValuesToRange(e){const t=ot(e)?e.concat():[e],n=[];return t.forEach(i=>{const{x:a,id:s}=i;n.push({x:a,id:s,value:i.value[0]}),n.push({x:a,id:s,value:i.value[2]})}),n},updateDataAttributes(e,t){const n=this,{config:i}=n,a=i[`data_${e}`];return Ct(t)||(Object.keys(t).forEach(s=>{a[s]=t[s]}),n.redraw({withLegend:!0})),a},getRangedData(e,t="",n="areaRange"){var i,a;const s=e==null?void 0:e.value;if(ot(s)){if(n==="bar")return s.reduce((o,r)=>r-o);{const o=(a=(i=Uf[n])==null?void 0:i[t])!=null?a:-1;return o>=0?s[o]:void 0}}else if(s&&t)return s[t];return s},setRatioForGroupedData(e){const t=this,{config:n}=t;if(n.data_groups.length&&e.some(i=>t.isGrouped(i.id))){const i=a=>t.getRatio("index",a,!0);e.forEach(a=>{"values"in a?a.values.forEach(i):i(a)})}},getRatio(e,t,n=!1){const i=this,{config:a,state:s}=i,o=i.api;let r=0;if(t&&o.data.shown().length)if(r=t.ratio||t.value,e==="arc")if(i.pie.padAngle()())r=t.value/i.getTotalDataSum(!0);else{const l=a.gauge_fullCircle?i.getArcLength():i.getStartingAngle()*-2,c=i.hasType("gauge")?l:Math.PI*2;r=(t.endAngle-t.startAngle)/c}else if(e==="index"){const l=o.data.values.bind(o),{hiddenTargetIds:c}=s;let u=this.getTotalPerIndex(i.isStackNormalizedPerGroup()?t.id:void 0);if(u===null)return r;if(c.size){let h=[...c];if(i.isStackNormalizedPerGroup()&&t.id){const f=a.data_groups.find(g=>g.indexOf(t.id)>=0);f&&(h=h.filter(g=>f.indexOf(g)>=0))}if(h.length){let f=l(h,!1);f.length&&(f=f.reduce((g,p)=>g.map((_,x)=>($(_)?_:0)+p[x])),u=u.map((g,p)=>g-f[p]))}}const d=u[t.index];t.ratio=$(t.value)&&u&&d?t.value/d:0,r=t.ratio}else if(e==="radar")r=parseFloat(String(Math.max(t.value,0)))/s.current.dataMax*a.radar_size_ratio;else if(e==="bar"){const c=i.getYScaleById.bind(i)(t.id).domain().reduce((u,d)=>d-u);r=c===0?0:Math.abs(i.getRangedData(t,null,e)/c)}else e==="treemap"&&(r/=i.getTotalDataSum(!0));return n&&r?r*100:r},updateDataIndexByX(e){const t=this,n=e.reduce((i,a,s)=>(i[Number(a.x)]=s,i),{});t.data.targets.forEach(i=>{i.values.forEach((a,s)=>{let o=n[Number(a.x)];o===void 0&&(o=s),a.index=o})})},isBubbleZType(e){return this.isBubbleType(e)&&(tt(e.value)&&("z"in e.value||"y"in e.value)||ot(e.value)&&e.value.length>=2)},isBarRangeType(e){var t;const n=this,{value:i}=e;return n.isBarType(e)&&!((t=n.isSubchartSourceTypeOf)!=null&&t.call(n,e,I.CANDLESTICK))&&ot(i)&&i.length>=2&&i.every($)},getDataById(e){var t;const n=this.cache.get(e)||this.api.data(e);return(t=n==null?void 0:n[0])!=null?t:n}};function Ri(e,t=!1){const n=this,{api:i}=n;t&&n.api.flush(!0),e==null||e.call(i)}var Zf={load(e,t){const n=this,{axis:i,data:a,org:s,scale:o}=n,{append:r}=t,l={domain:null,currentDomain:null,x:null};let c=e;if(c){t.filter&&(c=c.filter(t.filter)),(t.type||t.types)&&c.forEach(d=>{var h;const f=((h=t.types)==null?void 0:h[d.id])||t.type;n.setTargetType(d.id,f)});const u=new Map(c.map(d=>[d.id,d]));a.targets.forEach(d=>{const h=u.get(d.id);if(h){if(r){const f=h.values;for(let g=0;g<f.length;g++)d.values.push(f[g])}else d.values=h.values;u.delete(d.id)}}),u.forEach(d=>a.targets.push(d))}if(n.state.isCanvasMode){n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.updateTypesElements(),Ri.call(n,t.done,t.resizeAfter);return}n.updateTargets(a.targets),o.zoom&&(l.x=i.isCategorized()?o.x.orgScale():(s.xScale||o.x).copy(),l.domain=n.getXDomain(a.targets),l.x.domain(l.domain),l.currentDomain=n.zoom.getDomain(),n.withinRange(l.currentDomain,void 0,l.domain)||(o.x.domain(l.domain),o.zoom=null,n.$el.eventRect.property("__zoom",null))),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),o.zoom?(s.xDomain=l.domain,s.xScale=l.x,i.isCategorized()&&(l.currentDomain=n.getZoomDomainValue(l.currentDomain),s.xDomain=n.getZoomDomainValue(s.xDomain),s.xScale=l.x.domain(s.xDomain)),n.updateCurrentZoomTransform(l.x,l.currentDomain)):s.xScale&&s.xScale.domain(s.xDomain),n.updateTypesElements(),Ri.call(n,t.done,t.resizeAfter)},loadFromArgs(e){const t=this;t.config&&(t.cache.reset(!1,[U.filteredTargets,U.maxDataCountTarget,U.valuesXIndexMap,U.maxTickSize]),t.convertData(e,n=>{const i=e.data||n;e.append&&(i.__append__=!0),i&&t.load(t.convertDataToTargets.call(t,i),e)}))},unload(e,t){var n;const i=this,{state:a,$el:s,$T:o}=i,r=!!((n=i.hasLegendDefsPoint)!=null&&n.call(i));let l=t,c=e;if(i.cache.reset(!1,[U.filteredTargets,U.maxDataCountTarget,U.valuesXIndexMap,U.maxTickSize]),l||(l=()=>{}),c=c.filter(h=>i.hasTarget(i.data.targets,h)),c.length===0){l();return}const u=new Set(c);if(a.isCanvasMode){c.forEach(h=>{a.withoutFadeIn[h]=!1}),i.data.targets=i.data.targets.filter(h=>!u.has(h.id)),i.removeHiddenTargetIds(c),i.removeHiddenLegendIds(c),i.updateTypesElements(),l();return}c.forEach(h=>{var f;const g=i.getTargetSelectorSuffix(h);a.withoutFadeIn[h]=!1,s.legend&&s.legend.selectAll(`.${H.legendItem}${g}`).remove(),r&&((f=s.defs)==null||f.select(`#${i.getDefsPointId(g)}`).remove())}),i.data.targets=i.data.targets.filter(h=>!u.has(h.id)),a.hasFunnel&&i.updateFunnel(i.data.targets),a.hasTreemap&&i.updateTargetsForTreemap(i.data.targets),i.updateTypesElements();const d=s.svg.selectAll(c.map(h=>i.selectorTarget(h)));o(d).style("opacity","0").remove().call(li,l)}},kr=bt(6),qf={setExpand(e,t,n){const i=this,{config:a,$el:{circle:s}}=i;s&&a.point_focus_expand_enabled&&i.expandCircles(e,t,n),i.expandBarTypeShapes(!0,e,t,n)},expandBarTypeShapes(e=!0,t,n,i){const a=this;["bar","candlestick"].filter(s=>a.$el[s]).forEach(s=>{i&&a.$el[s].classed(j.EXPANDED,!1),a.getShapeByIndex(s,t,n).classed(j.EXPANDED,e)})},setOverOut(e,t){const n=this,{config:i,state:{hasFunnel:a,hasRadar:s,hasTreemap:o},$el:{main:r}}=n,l=tt(t);if(l||t!==-1){const c=i[e?"data_onover":"data_onout"].bind(n.api);if(i.color_onover&&n.setOverColor(e,t,l),l){const u=n.getTargetSelectorSuffix(t.id),d=a||o?`${j.target+u} .${At.shape}`:at.arc+u;c(t,r.select(`.${d}`).node())}else if(i.tooltip_grouped)e&&(s&&n.isPointFocusOnly()?n.showCircleFocus(n.getAllValuesOnIndex(t,!0)):n.setExpand(t,null,!0)),!n.isMultipleX()&&r.selectAll(`.${At.shape}-${t}`).each(function(u){c(u,this)});else{const u=n.cache.get(U.setOverOut)||[],d=r.selectAll(`.${At.shape}-${t}`).filter(function(f){return n.isWithinShape(this,f)}),h=d.filter(function(){return u.every(f=>f!==this)});if(!e||d.empty()||u.length===h.size()&&h.nodes().every((f,g)=>f!==u[g]))for(;u.length;){const f=u.pop();i.data_onout.bind(n.api)((0,O.select)(f).datum(),f)}h.each(function(){e&&(c((0,O.select)(this).datum(),this),u.push(this))}),n.cache.add(U.setOverOut,u)}}},callOverOutForTouch(e){const t=this,n=t.cache.get(U.callOverOutForTouch);(tt(e)&&n?e.id!==n.id:e!==n)&&((n||$(n))&&t.setOverOut(!1,n),(e||$(e))&&t.setOverOut(!0,e),t.cache.add(U.callOverOutForTouch,e))},getDraggableSelection(){const e=this,{config:t,state:n}=e;return t.interaction_enabled&&t.data_selection_draggable&&e.drag?(0,kr.drag)().on("drag",function(i){n.event=i,e.drag(qt(i,this))}).on("start",function(i){n.event=i,e.dragstart(qt(i,this))}).on("end",i=>{n.event=i,e.dragend()}):()=>{}},dispatchEvent(e,t,n){var i,a,s;const o=this,{config:r,state:{eventReceiver:l,hasAxis:c,hasFunnel:u,hasRadar:d,hasTreemap:h},$el:{eventRect:f,funnel:g,radar:p,svg:_,treemap:x}}=o;let m=(s=(a=(u||h)&&l.rect||d&&p.axes.select(`.${It.axis}-${t} text`)||f||((i=o.getArcElementByIdOrIndex)==null?void 0:i.call(o,t)))==null?void 0:a.node)==null?void 0:s.call(a);if(m){const v=o.isMultipleX(),b=r.axis_rotated;let{width:y,left:T,top:w}=ht(m);if(c&&!d&&!v){const A=l.coords[t];A?(y=A.w,T+=A.x,w+=A.y):(y=0,T=0,w=0)}let C=T+(n?n[0]:0)+(v||b?0:y/2),k=w+(n?n[1]:0)+(b?4:0);if(Oa(_)&&o.$el.eventRect){const A=Ai(o.$el.eventRect.node(),C,k,!1);C=A.x,k=A.y}const S={screenX:C,screenY:k,clientX:C,clientY:k,bubbles:d};(u||h)&&(m=(g!=null?g:x).node()),$a[/^(mouse|click)/.test(e)?"mouse":"touch"](m,e,S)}},setDragStatus(e){this.state.dragging=e},unbindZoomEvent(){const e=this,{$el:{canvas:t,eventRect:n,svg:i,zoomResetBtn:a}}=e;n==null||n.on(".zoom wheel.zoom .drag",null),t==null||t.on(".zoom wheel.zoom .drag",null),i==null||i.on("wheel",null),a==null||a.on("click",null).style("display","none")},unbindAllEvents(){var e;const t=this,{$el:{arcs:n,eventRect:i,legend:a,region:s,svg:o,treemap:r},brush:l}=t,c=["wheel","click","mouseover","mousemove","mouseout","touchstart","touchmove","touchend","touchstart.eventRect","touchmove.eventRect","touchend.eventRect",".brush",".drag",".zoom","wheel.zoom","dblclick.zoom"].join(" ");[o,i,s==null?void 0:s.list,l==null?void 0:l.getSelection(),n==null?void 0:n.selectAll("path"),a==null?void 0:a.selectAll("g"),r].forEach(u=>u==null?void 0:u.on(c,null)),(e=t.unbindZoomEvent)==null||e.call(t)}},Jf={categoryName(e){var t;const{axis_x_categories:n}=this.config;return(t=n==null?void 0:n[e])!=null?t:e}};const Qf=/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g;var tg={generateClass(e,t){const n=this.state.generateClassCache,i=`${e}\0${t}`;let a=n.get(i);return a||(a=` ${e} ${e+this.getTargetSelectorSuffix(t)}`,n.set(i,a)),a},getClass(e,t){const n=/s$/.test(e),i=/^(area|arc|line|funnel|treemap)s?$/.test(e),a=n?"id":"index";return s=>{const o=s.data||s;return((t?this.generateClass(V[n?"shapes":"shape"],o[a]):"")+this.generateClass(V[e],o[i?"id":a])).trim()}},getChartClass(e){return t=>V[`chart${e}`]+this.classTarget((t.data?t.data:t).id)},generateExtraLineClass(){const t=this.config.line_classes||[],n=[];return function(i){var a;const s=i.id||((a=i.data)==null?void 0:a.id)||i;return n.indexOf(s)<0&&n.push(s),t[n.indexOf(s)%t.length]}},classRegion(e,t){return`${this.generateClass(V.region,t)} ${"class"in e?e.class:""}`},classTarget(e){const t=this.config.data_classes[e];let n="";return t&&(n=` ${V.target}-${t}`),this.generateClass(V.target,e)+n},classFocus(e){return this.classFocused(e)+this.classDefocused(e)},classFocused(e){return` ${this.state.focusedTargetIds.has(e.id)?V.focused:""}`},classDefocused(e){return` ${this.state.defocusedTargetIds.has(e.id)?V.defocused:""}`},getTargetSelectorSuffix(e){return(e||e===0?`-${e}`:"").replace(Qf,"-")},selectorTarget(e,t="",n=""){const i=this.getTargetSelectorSuffix(e);return`${t}.${V.target+i} ${n}, ${t}.${V.circles+i} ${n}`},selectorTargets(e,t){const n=e||[];return n.length?n.map(i=>this.selectorTarget(i,t)):null},selectorLegend(e){return`.${V.legendItem+this.getTargetSelectorSuffix(e)}`},selectorLegends(e){return e!=null&&e.length?e.map(t=>this.selectorLegend(t)):null}};const eg=(e,t,n)=>{const i=(0,O.select)(e.cloneNode(!0));return i.attr("id",n).insert("rect",":first-child").attr("width",i.attr("width")).attr("height",i.attr("height")).style("fill",t),{id:n,node:i.node()}};function ng(e){const t=U.colorPattern,{body:n}=nt;let i=n[t];if(!i){const s=e.classed(Da.colorPattern,!0).style("background-image");e.classed(Da.colorPattern,!1),s.indexOf(";")>-1&&(i=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(o=>o.trim().replace(/[\"'\s]/g,"")).filter(Boolean),n[t]=i)}return i}const ig=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var ag={generateColor(){const e=this,{$el:t,config:n}=e,i=[],a=n.area_linearGradient||n.bar_linearGradient||n.point_radialGradient;let s=yt(n.color_pattern)?n.color_pattern:[...ng(t.chart)||ig];const o=s;if(z(n.color_tiles)){const r=n.color_tiles.bind(e.api)(),l=s.map((c,u)=>{const d=c.replace(/[#\(\)\s,]/g,""),h=`${e.state.datetimeId}-pattern-${d}-${u}`;return eg(r[u%r.length],c,h)});s=l.map(c=>`url(#${c.id})`),e.patterns=l}return function(r){var l;const c=n.data_colors,u=n.data_color,d=r.id||((l=r.data)==null?void 0:l.id)||r,h=e.isTypeOf(d,["line","spline","step"])||!n.data_types[d];let f;if(z(c[d]))f=c[d].bind(e.api)(r);else if(c[d])f=c[d];else{let g=i.indexOf(d);g<0&&(i.push(d),g=i.length-1),f=h?o[g%o.length]:s[g%s.length],c[d]=f}if(f=z(u)?u.call(e.api,f,r):f,a&&t.defs){const g=e.$el.defs.selectAll(`[id$='-gradient${e.getTargetSelectorSuffix(d)}'] stop`);let p;g.each(function(_,x){p=x===0?this.style.stopColor:this.style.stopColor===p}),p===!0&&g.attr("stop-color",f)}return f}},generateLevelColor(){const e=this,{config:t}=e,n=t.color_pattern,i=t.color_threshold,a=i.unit==="value",s=i.max||100,o=i.values&&i.values.length?i.values:[];return yt(i)?function(r){const l=a?r:r*100/s;let c=n[n.length-1];for(let u=0,d=o.length;u<d;u++)if(l<=o[u]){c=n[u];break}return c}:null},generateTextBGColorFilter(e,t={x:0,y:0,width:1,height:1}){const n=this,{$el:{defs:i},state:a}=n;if(e){let s=[];Q(e)?s.push(""):tt(e)?s=Object.keys(e):z(e)&&(s=n.mapToTargetIds()),s.forEach(o=>{const r=`${a.datetimeId}-labels-bg${n.getTargetSelectorSuffix(o)}${Q(e)?n.getTargetSelectorSuffix(e):""}`,l=Se(o===""?e:(e==null?void 0:e[o])||"");if(i.select(`#${r}`).empty()){const c=i.append("filter").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("id",r);c.append("feFlood").attr("flood-color",l),c.append("feComposite").attr("in","SourceGraphic")}})}},getGradienColortUrl(e){return`url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(e)})`},updateLinearGradient(){const e=this,{config:t,data:{targets:n},state:{datetimeId:i},$el:{defs:a}}=e;n.forEach(s=>{const o=`${i}-gradient${e.getTargetSelectorSuffix(s.id)}`,r=e.hasPointType()&&t.point_radialGradient,l=e.isAreaType(s)&&"area"||e.isBarType(s)&&"bar";if((r||l)&&a.select(`#${o}`).empty()){const c=e.color(s),u={defs:null,stops:[]};if(r){const{cx:d=.3,cy:h=.3,r:f=.7,stops:g=[[.1,c,0],[.9,c,1]]}=r;u.stops=g,u.defs=a.append("radialGradient").attr("id",`${o}`).attr("cx",d).attr("cy",h).attr("r",f)}else{const d=t.axis_rotated,{x:h=d?[1,0]:[0,0],y:f=d?[0,0]:[0,1],stops:g=[[0,c,1],[1,c,0]]}=t[`${l}_linearGradient`];u.stops=g,u.defs=a.append("linearGradient").attr("id",`${o}`).attr("x1",h[0]).attr("x2",h[1]).attr("y1",f[0]).attr("y2",f[1])}u.stops.forEach(d=>{const[h,f,g]=d,p=z(f)?f.bind(e.api)(s.id):f;u.defs&&u.defs.append("stop").attr("offset",h).attr("stop-color",p||c).attr("stop-opacity",g)})}})},setOverColor(e,t){const n=this,{config:i,$el:{main:a}}=n,s=i.color_onover;let o=e?s:n.color;tt(o)?o=({id:r})=>r in s?s[r]:n.color(r):Q(o)?o=()=>s:z(s)&&(o=o.bind(n.api)),a.selectAll(tt(t)?`.${at.arc}${n.getTargetSelectorSuffix(t.id)}`:`.${At.shape}-${t}`).style("fill",o)}},Ei=bt(7);function Ar(e){const{event:t,$el:n}=e,i=n.subchart.main||n.main;let a;return t&&t.type==="brush"?a=t.selection:i&&(a=i.select(".bb-brush").node())&&(a=(0,Ei.brushSelection)(a)),a}function Lr(e){const t=Ar(e);return t?t[0]===t[1]:!0}function Rr(e,t){return t.map(n=>{var i,a,s,o,r,l,c,u,d;const{values:h}=n,f=h[0],g=h[h.length-1],p=f?(a=(i=e.getXCacheKey)==null?void 0:i.call(e,f.x))!=null?a:f.x:"",_=g?(o=(s=e.getXCacheKey)==null?void 0:s.call(e,g.x))!=null?o:g.x:"",x=(l=(r=e.getTargetType)==null?void 0:r.call(e,n))!=null?l:"",m=(d=(u=(c=e.state)==null?void 0:c.subchartSourceTypes)==null?void 0:u[n.id])!=null?d:"";return`${n.id}:${x}:${m}:${h.length}:${p}:${_}`}).join("|")}function Er(e,t){var n;const i=(n=e.data)==null?void 0:n.targets;if(!i)return!1;for(let a=0;a<t.length;a++){const s=t[a],o=i.find(r=>r.id===s.id);if(!o||o.values!==s.values)return!1}return!0}function Ga(e,t){yt(t)&&((e.min===void 0||t<e.min)&&(e.min=t),(e.max===void 0||t>e.max)&&(e.max=t))}function Pr(e,t){for(let n=0;n<t.length;n++)Ga(e,t[n])}function sg(e,t){var n,i,a,s;const o={min:void 0,max:void 0},r=e.state.hasAxis;for(let l=0;l<t.length;l++){const c=t[l],u=(n=e.isCandlestickType)==null?void 0:n.call(e,c),d=!u&&!!((i=e.isSubchartSourceTypeOf)!=null&&i.call(e,c,I.CANDLESTICK)),{values:h}=c;for(let f=0;f<h.length;f++){const g=h[f];let p=g.value;if(!(J(p)||p===null))continue;const _=d?(a=e.getSubchartCandlestickShapeValue)==null?void 0:a.call(e,g,!0):void 0;$(_)?p=_:p!==null&&(u||d)&&(p=Array.isArray(p)?p.slice(0,4):[p.open,p.high,p.low,p.close]),Array.isArray(p)?Pr(o,p):tt(p)&&"high"in p?Pr(o,Object.values(p)):(s=e.isBubbleZType)!=null&&s.call(e,g)?Ga(o,r&&e.getBubbleZData(p,"y")):Ga(o,p)}}return[o.min,o.max]}function og(e,t){let n;for(let i=0;i<e.length;i++){const{values:a}=e[i];for(let s=0;s<a.length;s++){const{x:o}=a[s];yt(o)&&(n===void 0||(t==="min"?o<n:o>n))&&(n=o)}}return n}var rg={getYDomainMinMaxBoth(e){const t=this,{axis:n,cache:i,config:a,state:s}=t,r=Er(t,e)?`${U.domainMinMax}_y_${Rr(t,e)}`:null,l=r&&i.get(r);if(l&&l.generation===s.dataGeneration)return l.value;const c=a.data_groups,u=t.mapToIds(e),d=Ps(u);let h;if(c.length>0){const f=t.getValuesAsIdKeyed(e),g=e.some(y=>y.values.some(T=>T.value<0)),p=e.some(y=>y.values.some(T=>T.value>0)),_=new Map(u.map(y=>[y,n.getId(y)])),x={},m={};for(const y in f)x[y]=f[y].slice(),m[y]=f[y].slice();c.forEach(y=>{const T=y.filter(w=>d.has(w));if(T.length){const w=T[0],C=_.get(w);x[w]&&g&&(x[w]=x[w].map(k=>k<0?k:0)),m[w]&&p&&(m[w]=m[w].map(k=>k>0?k:0)),T.filter((k,S)=>S>0).forEach(k=>{if(x[k]){const S=_.get(k);x[k].forEach((A,L)=>{const E=+A;S===C&&!(g&&E>0)&&(x[w][L]+=E)})}if(m[k]){const S=_.get(k);m[k].forEach((A,L)=>{const E=+A;S===C&&!(p&&E<0)&&(m[w][L]+=E)})}})}});const v=[],b=[];for(const y in x)v.push(ue("min",x[y])),b.push(ue("max",m[y]));h=[ue("min",v),ue("max",b)]}else h=sg(t,e);return r&&i.add(r,{generation:s.dataGeneration,value:h}),h},isHiddenTargetWithYDomain(e){const t=this;for(const n of t.state.hiddenTargetIds)if(t.axis.getId(n)===e)return!0;return!1},getYDomain(e,t,n){const i=this,{axis:a,config:s,scale:o}=i,r=`axis_${t}`;if(i.isStackNormalized()&&e.filter(D=>a.getId(D.id)===t).map(D=>D.id).some(D=>i.isGrouped(D)))return[0,100];const l=(o==null?void 0:o[t])&&o[t].type==="log",c=e.filter(L=>a.getId(L.id)===t),u=n?i.filterByXDomain(c,n):c;if(u.length===0)return i.isHiddenTargetWithYDomain(t)?o[t].domain():t==="y2"?o.y.domain():i.getYDomain(e,"y2",n);const d=s[`${r}_min`],h=s[`${r}_max`],f=s[`${r}_center`],g=s[`${r}_inverted`],p=i.hasDataLabel()&&s.axis_rotated,_=i.hasDataLabel()&&!s.axis_rotated,[x,m]=i.getYDomainMinMaxBoth(u);let v=x,b=m,y=[I.BAR,I.BUBBLE,I.SCATTER,...ce.Line].some(L=>{const E=L.indexOf("area")>-1?"area":L;return i.hasType(L,u,!0)&&s[`${E}_zerobased`]});v=J(d)?d:J(h)?v<=h?v:h-10:v,b=J(h)?h:J(d)?d<=b?b:d+10:b,isNaN(v)&&(v=0),isNaN(b)&&(b=v),v===b&&(v<0?b=0:v=0);const T=v>=0&&b>=0,w=v<=0&&b<=0;(J(d)&&T||J(h)&&w)&&(y=!1),y&&(T&&(v=0),w&&(b=0));const C=Math.abs(b-v);let k={top:C*.1,bottom:C*.1};if(ct(f)){const L=Math.max(Math.abs(v),Math.abs(b));b=f+L,v=f-L}if(p){const L=en(o.y.range()),E=i.getDataLabelLength(v,b,"width").map(D=>{const R=D/L;return isFinite(R)?R:0});["bottom","top"].forEach((D,R)=>{k[D]+=C*(E[R]/(1-E[0]-E[1]))})}else if(_){const L=i.getDataLabelLength(v,b,"height");["bottom","top"].forEach((E,D)=>{k[E]+=i.convertPixelToScale("y",L[D],C)})}k=i.getResettedPadding(k);const S=s[`${r}_padding`];yt(S)&&["bottom","top"].forEach(L=>{k[L]=a.getPadding(S,L,k[L],C)}),y&&(T&&(k.bottom=v),w&&(k.top=-b));const A=l?[v,b].map(L=>L<0?0:L):[v-k.bottom,b+k.top];return g?A.reverse():A},getXDomainMinMax(e,t){var n;const i=this,{cache:a,state:s}=i,o=i.config[`axis_x_${t}`],l=Er(i,e)?`${U.domainMinMax}_x_${t}_${Rr(i,e)}`:null,c=l&&a.get(l);let u=(c==null?void 0:c.generation)===s.dataGeneration?c.value:void 0;u===void 0&&(u=og(e,t),l&&a.add(l,{generation:s.dataGeneration,value:u}));let d=tt(o)?o.value:o;return d=ct(d)&&((n=i.axis)!=null&&n.isTimeSeries())?Wt.bind(this)(d):d,tt(o)&&o.fit&&(t==="min"&&d<u||t==="max"&&d>u)&&(d=void 0),ct(d)?d:u},getXDomainPadding(e,t){const n=this,{axis:i,config:a}=n,s=a.axis_x_padding,o=i.isTimeSeries()&&t,r=en(e);let l;if(i.isCategorized()||o)l=0;else if(n.hasType("bar")){const d=n.getMaxDataCount();l=d>1?r/(d-1)/2:.5}else l=n.getResettedPadding(r*.01);let{left:c=l,right:u=l}=$(s)?{left:s,right:s}:s;if(s.unit==="px"){const d=Math.abs(r+r*.2);c=i.getPadding(s,"left",l,d),u=i.getPadding(s,"right",l,d)}else{const d=r+c+u;if(o&&d){const h=r/t/d;c=c/d/h,u=u/d/h}}return{left:c,right:u}},getXDomain(e){const t=this,{axis:n,config:i,scale:{x:a}}=t,s=i.axis_x_inverted,o=[t.getXDomainMinMax(e,"min"),t.getXDomainMinMax(e,"max")];let[r=0,l=0]=o;if(a.type!=="log"){const c=n.isCategorized(),u=n.isTimeSeries(),d=t.getXDomainPadding(o);let[h,f]=o;h-f===0&&!c&&(u?(h=new Date(h.getTime()*.5),f=new Date(f.getTime()*1.5)):(h=h===0?1:h*.5,f=f===0?-1:f*1.5)),(h||h===0)&&(r=u?new Date(h.getTime()-d.left):h-d.left),(f||f===0)&&(l=u?new Date(f.getTime()+d.right):f+d.right)}return s?[l,r]:[r,l]},updateXDomain(e,t,n,i,a){var s;const o=this,{config:r,org:l,scale:{x:c,subX:u}}=o,d=r.zoom_enabled;if(n&&(c.domain(a||pn(o.getXDomain(e),!r.axis_x_inverted)),l.xDomain=c.domain(),u.domain(c.domain()),(s=o.brush)==null||s.scale(u)),t){const h=a||!o.brush||Lr(o)?l.xDomain:Ar(o).map(u.invert);c.domain(h)}return(n||t)&&d&&o.zoom.updateScaleExtent(),i&&c.domain(o.trimXDomain(c.orgDomain())),c.domain()},trimXDomain(e){const t=this,n=t.config.axis_x_inverted,i=t.getZoomDomain(),[a,s]=i;return(n?e[0]>=a:e[0]<=a)&&(e[1]=+e[1]+(a-e[0]),e[0]=a),(n?e[1]<=s:e[1]>=s)&&(e[0]=+e[0]-(e[1]-s),e[1]=s),e},getZoomDomain(e="zoom",t=!1){const n=this,{config:i,scale:a,org:s}=n;let[o,r]=t&&a[e]?a[e].domain():s.xDomain;return e==="zoom"&&(ct(i.zoom_x_min)&&(o=ue("min",[o,i.zoom_x_min])),ct(i.zoom_x_max)&&(r=ue("max",[r,i.zoom_x_max]))),[o,r]},getZoomDomainValue(e){const t=this,{config:n,axis:i}=t;if(i.isCategorized()&&Array.isArray(e)){const a=n.axis_x_inverted;return e.map((o,r)=>Number(o)+(r===0?+a:+!a))}return e},convertPixelToScale(e,t,n){const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r;return e==="x"?r=o?"height":"width":r=o?"width":"height",n*(t/s[r])},withinRange(e,t=[0,0],n){const a=this.config.axis_x_inverted,[s,o]=n;if(Array.isArray(e)){const r=a?e[1]:e[0],l=a?e[0]:e[1];if(r<l)return e.every((c,u)=>(u===0?a?+c<=s:+c>=s:a?+c>=o:+c<=o)&&!e.every((d,h)=>d===t[h]))}return!1}};function Dr(e,t,n){const{config:i}=e,a=`axis_${t}_tick_format`;return(i[a]?i[a]:e.defaultValueFormat).call(e.api,n)}var lg={yFormat(e){return Dr(this,"y",e)},y2Format(e){return Dr(this,"y2",e)},getDefaultValueFormat(){const e=this,{defaultArcValueFormat:t,yFormat:n,y2Format:i}=e,a=e.hasArcType(null,["gauge","polar","radar"]);return function(s,o,r){return(a?t:e.axis&&e.axis.getId(r)==="y2"?i:n).call(e,s,o)}},defaultValueFormat(e){return ot(e)?e.join("~"):J(e)?+e:""},defaultArcValueFormat(e,t){return`${(t*100).toFixed(1)}%`},defaultPolarValueFormat(e){return`${e}`},dataLabelFormat(e){const t=this,n=t.config.data_labels,i=s=>{let r=s;return ot(s)?r=s.join("~"):tt(s)&&(r=Object.values(s).join("~")),r};let a=i;return z(n.format)?a=n.format:Kt(n.format)&&(n.format[e]?a=n.format[e]===!0?i:n.format[e]:a=()=>""),a.bind(t.api)}};const Ir=10,cg=750;function Pi(e){const t=this,n=t.getDataById(e);return t.levelColor?t.levelColor(n.values[0].value):t.color(n)}function ug(e,t=!0){var n;const{config:i}=this;let a=(n=i.data_names[e])!=null?n:e;return t&&z(i.legend_format)&&(a=i.legend_format(a,e!==a?e:void 0)),a}function dg(e,t){var n;if(!t||t.empty())return;const i=(n=e.$el.legend)==null?void 0:n.selectAll(`.${H.legendItem}`);i&&!i.empty()&&(t=i);const a=[];t.each(function(o){a.push({id:o,node:this})});const s=Ds(a,o=>o.id,o=>o.node);e.cache.add(U.legendItemMap,s)}function Mr(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function hg(e,t,n){const i=Mr(n);e.state.legendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function Fr(e,t){const n=e.state.legendTouch,i=n&&Mr(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>Ir||Math.abs(i.clientY-n.y)>Ir)}function fg(e,t,n){Fr(e,n);const i=e.state.legendTouch;return e.state.legendTouch=null,!!i&&i.id===t&&!i.moved}function gg(e,t){e.state.legendLastTouchClickId=t,e.state.legendLastTouchClickTime=Date.now()}function pg(e,t){const{state:n}=e,i=n.legendLastTouchClickId===t&&Date.now()-(n.legendLastTouchClickTime||0)<cg;return i&&(n.legendLastTouchClickId=null,n.legendLastTouchClickTime=0),i}function _g(e){var t;const n=(t=e.config.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}var xg={initLegend(){var e;const t=this,{config:n,$el:i}=t;if(t.legendItemTextBox={},t.state.legendHasRendered=!1,t.state.isCanvasMode){n.legend_show?(e=t.updateHtmlLegend)==null||e.call(t):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets));return}n.legend_show?(n.legend_contents_bindto||(i.legend=t.$el.svg.append("g").classed(H.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=new Set(t.mapToIds(t.data.targets))},updateLegend(e,t,n){var i;const a=this,{config:s,state:o,scale:r,$el:l}=a,c=t||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=Ne(c,"withTransition",!0),c.withTransitionForTransform=Ne(c,"withTransitionForTransform",!0),s.legend_contents_bindto&&s.legend_contents_template?a.updateLegendTemplate():o.hasTreemap||a.updateLegendElement(e||a.mapToIds(a.data.targets),c),(i=l.legend)==null||i.selectAll(`.${H.legendItem}`).classed(H.legendItemHidden,function(u){const d=!a.isTargetToShow(u);return d&&(this.style.opacity=null),d}),a.updateScales(!1,!r.zoom),a.updateSvgSize(),a.transformAll(c.withTransitionForTransform,n),o.legendHasRendered=!0},updateLegendTemplate(){const e=this,{config:t,$el:n}=e,i=(0,O.select)(t.legend_contents_bindto),a=t.legend_contents_template;if(!i.empty()){const s=e.mapToIds(e.data.targets),o=[];let r="";s.forEach(c=>{const u=z(a)?Se(a.call(e.api,c,e.color(c),e.api.data(c)[0].values)):an(a,{COLOR:e.color(c),TITLE:c});u&&(o.push(c),r+=u)});const l=i.html(r).selectAll(function(){return this.childNodes}).data(o);e.setLegendItem(l),n.legend=i}},updateSizeForLegend(e){const t=this,{config:n,state:{isLegendTop:i,isLegendLeft:a,isLegendRight:s,isLegendInset:o,current:r}}=t,{width:l,height:c}=e,u={top:i?t.getCurrentPaddingByDirection("top")+n.legend_inset_y+5.5:r.height-c-t.getCurrentPaddingByDirection("bottom")-n.legend_inset_y,left:a?t.getCurrentPaddingByDirection("left")+n.legend_inset_x+.5:r.width-l-t.getCurrentPaddingByDirection("right")-n.legend_inset_x+.5};t.state.margin3={top:s?0:o?u.top:r.height-c,right:NaN,bottom:0,left:s?r.width-l:o?u.left:0}},transformLegend(e){const t=this,{$el:{legend:n},$T:i}=t;i(n,e).attr("transform",t.getTranslate("legend"))},updateLegendItemColor(e,t){const n=this,{legend:i}=n.$el;if(i){const a=n.getLegendItemById(e);a&&(0,O.select)(a).select("line").style("stroke",t)}},getLegendWidth(){const e=this,{current:{width:t},isLegendRight:n,isLegendInset:i,legendItemWidth:a,legendStep:s}=e.state;return e.config.legend_show?n||i?a*(s+1):t:0},getLegendHeight(){var e;const t=this,{current:n,isLegendRight:i,legendItemHeight:a,legendStep:s}=t.state,r=((e=t.config.padding)==null?void 0:e.mode)==="fit"?10:20;return t.config.legend_show?i?n.height:Math.max(r,a)*(s+1):0},opacityForUnfocusedLegend(e){return e.classed(H.legendItemHidden)?null:"0.3"},toggleFocusLegend(e,t){const n=this,{$el:{legend:i},$T:a}=n,s=n.mapToTargetIds(e);i&&a(i.selectAll(`.${H.legendItem}`).filter(o=>s.indexOf(o)>=0).classed(lt.legendItemFocused,t)).style("opacity",function(){return t?null:n.opacityForUnfocusedLegend.call(n,(0,O.select)(this))})},revertLegend(){const e=this,{$el:{legend:t},$T:n}=e;t&&n(t.selectAll(`.${H.legendItem}`).classed(lt.legendItemFocused,!1)).style("opacity",null)},showLegend(e){const t=this,{config:n,$el:i,$T:a}=t;n.legend_show||(n.legend_show=!0,i.legend?i.legend.style("visibility",null):t.initLegend(),!t.state.legendHasRendered&&t.updateLegend()),t.removeHiddenLegendIds(e),a(i.legend.selectAll(t.selectorLegends(e)).style("visibility",null)).style("opacity",null)},hideLegend(e){const t=this,{config:n,$el:{legend:i}}=t;n.legend_show&&se(e)&&(n.legend_show=!1,i==null||i.style("visibility","hidden")),t.addHiddenLegendIds(e),i==null||i.selectAll(t.selectorLegends(e)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox(e,t){const n=this,{cache:i,state:a}=n;let s;const o=U.legendItemTextBox;return e&&(s=!a.redrawing&&i.get(o)||{},s[e]||(s[e]=n.getTextRect(t,H.legendItem),i.add(o,s)),s=s[e]),s},setLegendItem(e){const t=this,{$el:n,api:i,config:a,state:s}=t,o=s.inputType==="touch",r=t.hasType("gauge"),l=a.boost_useCssRule,c=a.legend_item_interaction,u=c.dblclick?"dblclick":"click",d=c||z(a.legend_item_onclick),h=o?_g(t):void 0,f=function(g,p){var _;if(!Y(a.legend_item_onclick,i,p,!s.hiddenTargetIds.has(p))){const{altKey:x,type:m}=g,v=(0,O.select)(this);m==="dblclick"||x?s.hiddenTargetIds.size&&!v.classed(H.legendItemHidden)?i.show():(i.hide(),i.show(p)):(i.toggle(p),v.classed(lt.legendItemFocused,!1))}o&&(t.hideTooltip(),(_=t.hideGridFocus)==null||_.call(t,!0))};e.attr("class",function(g){const p=(0,O.select)(this);return(!p.empty()&&p.attr("class")||"")+t.generateClass(H.legendItem,g)}).style("visibility",g=>t.isLegendToShow(g)?null:"hidden"),a.interaction_enabled&&(l&&[[`.${H.legendItem}`,"cursor:pointer"],[`.${H.legendItem} text`,"pointer-events:none"],[`.${H.legendItemPoint} text`,"pointer-events:none"],[`.${H.legendItemTile}`,"pointer-events:none"],[`.${H.legendItemEvent}`,"fill-opacity:0"]].forEach(g=>{const[p,_]=g;t.setCssRule(!1,p,[_])(n.legend)}),e.on(u,d?function(g,p){o&&g.type==="click"&&pg(t,p)||f.call(this,g,p)}:null),o&&u==="click"&&d&&e.on("touchstart",function(g,p){hg(t,p,g)},h).on("touchmove",g=>{Fr(t,g)},h).on("touchend",function(g,p){fg(t,p,g)&&(gg(t,p),f.call(this,g,p))},h),!o&&e.on("mouseout",c||z(a.legend_item_onout)?function(g,p){Y(a.legend_item_onout,i,p,!s.hiddenTargetIds.has(p))||((0,O.select)(this).classed(lt.legendItemFocused,!1),r&&t.undoMarkOverlapped(t,`.${ae.gaugeValue}`),t.api.revert())}:null).on("mouseover",c||z(a.legend_item_onover)?function(g,p){Y(a.legend_item_onover,i,p,!s.hiddenTargetIds.has(p))||((0,O.select)(this).classed(lt.legendItemFocused,!0),r&&t.markOverlapped(p,t,`.${ae.gaugeValue}`),!s.transiting&&t.isTargetToShow(p)&&i.focus(p))}:null),!e.empty()&&e.on("click mouseout mouseover")&&e.style("cursor",t.getStylePropValue("pointer"))),dg(t,e)},getLegendItemById(e){var t;const n=this,i=n.cache.get(U.legendItemMap);if(i&&i instanceof Map)return i.get(e)||null;const a=(t=n.$el.legend)==null?void 0:t.selectAll(`.${H.legendItem}`).filter(s=>s===e);return(a==null?void 0:a.node())||null},updateLegendElement(e,t){const n=this,{config:i,state:a,$el:{legend:s},$T:o}=n,l=i.legend_item_tile_type!=="circle",c=i.legend_item_tile_r,u={width:l?i.legend_item_tile_width:c*2,height:l?i.legend_item_tile_height:c*2},d={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:u.width+5,totalLength:0},h={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let f,g,p;const _=e.filter(C=>!ct(i.data_names[C])||i.data_names[C]!==null),x=t.withTransition,m=a.isLegendRight||a.isLegendInset,v=ug.bind(n),b=n.getUpdateLegendPositions(_,d,h,m);a.isLegendInset&&(d.step=i.legend_inset_step?i.legend_inset_step:_.length,a.legendStep=d.step),a.isLegendRight?(f=C=>d.max.width*h.steps[C],g=C=>h.margins[h.steps[C]]+h.offsets[C]):a.isLegendInset?(f=C=>d.max.width*h.steps[C]+10,g=C=>h.margins[h.steps[C]]+h.offsets[C]):(f=C=>h.margins[h.steps[C]]+h.offsets[C],g=C=>d.max.height*h.steps[C]);const y={xText:(C,k)=>f(C,k)+4+u.width,xRect:(C,k)=>f(C,k),x1Tile:(C,k)=>f(C,k)-2,x2Tile:(C,k)=>f(C,k)-2+u.width,yText:(C,k)=>g(C,k)+9,yRect:(C,k)=>g(C,k)-5,yTile:(C,k)=>g(C,k)+4};n.generateLegendItem(_,u,b,y,m,v),p=s.select(`.${H.legendBackground} rect`),a.isLegendInset&&d.max.width>0&&p.size()===0&&(p=s.insert("g",`.${H.legendItem}`).attr("class",H.legendBackground).append("rect")),i.legend_tooltip&&s.selectAll("title").data(_).text(C=>v(C,!1));const T=s.selectAll("text").data(_).text(C=>v(C)).each(function(C,k){b(this,C,k)});o(T,x).attr("x",y.xText).attr("y",y.yText);const w=s.selectAll(`rect.${H.legendItemEvent}`).data(_);o(w,x).attr("width",C=>h.widths[C]).attr("height",C=>h.heights[C]).attr("x",y.xRect).attr("y",y.yRect),n.updateLegendItemPos(_,x,y),p&&o(p,x).attr("height",n.getLegendHeight()-12).attr("width",d.max.width*(d.step+1)+10),a.legendItemWidth=d.max.width,a.legendItemHeight=d.max.height,a.legendStep=d.step},getUpdateLegendPositions(e,t,n,i){const a=this,{config:s,state:o}=a;return function(r,l,c){const u=c===0,d=c===e.length-1,h=a.getLegendItemTextBox(l,r),f=h.width+t.tileWidth+(d&&!i?0:t.padding.right)+s.legend_padding,g=h.height+t.padding.top,p=i?g:f,_=i?a.getLegendHeight():a.getLegendWidth();let x;const m=function(b,y){y||(x=(_-t.totalLength-p)/2,x<t.posMin&&(x=(_-p)/2,t.totalLength=0,t.step++)),n.steps[b]=t.step,n.margins[t.step]=o.isLegendInset?10:x,n.offsets[b]=t.totalLength,t.totalLength+=p};if(u&&(t.totalLength=0,t.step=0,t.max.width=0,t.max.height=0),s.legend_show&&!a.isLegendToShow(l)){n.widths[l]=0,n.heights[l]=0,n.steps[l]=0,n.offsets[l]=0;return}n.widths[l]=f,n.heights[l]=g,(!t.max.width||f>=t.max.width)&&(t.max.width=f),(!t.max.height||g>=t.max.height)&&(t.max.height=g);const v=i?t.max.height:t.max.width;if(s.legend_equally){for(const b in n.widths)n.widths[b]=t.max.width;for(const b in n.heights)n.heights[b]=t.max.height;x=(_-v*e.length)/2,x<t.posMin?(t.totalLength=0,t.step=0,e.forEach(b=>m(b))):m(l,!0)}else m(l)}},generateLegendItem(e,t,n,i,a,s){const o=this,{config:r,state:l,$el:{legend:c}}=o,u=r.legend_usePoint,d=r.legend_item_tile_r,h=r.legend_item_tile_type,f=h!=="circle",g=-200,p=c.selectAll(`.${H.legendItem}`).data(e).enter().append("g");if(o.setLegendItem(p),r.legend_tooltip&&p.append("title").text(_=>_),p.append("text").text(_=>s(_)).each(function(_,x){n(this,_,x)}).style("pointer-events",o.getStylePropValue("none")).attr("x",a?i.xText:g).attr("y",a?g:i.yText),p.append("rect").attr("class",H.legendItemEvent).style("fill-opacity",o.getStylePropValue("0")).attr("x",a?i.xRect:g).attr("y",a?g:i.yRect),u){const _=[],x=o.getValidPointPattern();p.append(m=>{_.indexOf(m)===-1&&_.push(m);let v=x[_.indexOf(m)%x.length];return v==="rectangle"&&(v="rect"),nt.createElementNS(O.namespaces.svg,"hasValidPointType"in o&&o.hasValidPointType(v)?v:"use")}).attr("class",H.legendItemPoint).style("fill",Pi.bind(o)).style("pointer-events",o.getStylePropValue("none")).attr("href",(m,v,b)=>{const T=b[v].nodeName.toLowerCase(),w=o.getTargetSelectorSuffix(m);return T==="use"?`#${l.datetimeId}-point${w}`:void 0})}else p.append(f?"line":h).attr("class",H.legendItemTile).style("stroke",Pi.bind(o)).style("pointer-events",o.getStylePropValue("none")).call(_=>{h==="circle"?_.attr("r",d).style("fill",Pi.bind(o)).attr("cx",a?i.x2Tile:g).attr("cy",a?g:i.yTile):f&&_.attr("stroke-width",t.height).attr("x1",a?i.x1Tile:g).attr("y1",a?g:i.yTile).attr("x2",a?i.x2Tile:g).attr("y2",a?g:i.yTile)})},updateLegendItemPos(e,t,n){const i=this,{config:a,$el:{legend:s},$T:o}=i,r=a.legend_usePoint,l=a.legend_item_tile_type,c=l!=="circle";if(r){const u=s.selectAll(`.${H.legendItemPoint}`).data(e),d=a.legend_item_tile_type!=="circle",h=d?a.legend_item_tile_width:a.legend_item_tile_r*2,f=d?a.legend_item_tile_height:a.legend_item_tile_r*2,g=h*.75,p=f*.75,_=h/8,x=f/8;o(u,t).each(function(){const m=this.nodeName.toLowerCase();let v="x",b="y",y=null,T=null,w=null;m==="circle"?(v="cx",b="cy",y=Math.min(g,p)/2):m==="rect"&&(T=g,w=p);const C=(0,O.select)(this).attr("transform",null).attr("x",null).attr("y",null).attr("cx",null).attr("cy",null).attr("r",y).attr("width",T).attr("height",w);m==="use"?C.attr("transform",k=>`translate(${n.x1Tile(k)} ${n.yTile(k)-f/2}) scale(${_} ${x})`):C.attr(v,k=>n.x1Tile(k)+(h-(T||0))/2).attr(b,k=>n.yTile(k)-(w||0)/2)})}else{const u=s.selectAll(`.${H.legendItemTile}`).data(e);o(u,t).style("stroke",Pi.bind(i)).call(d=>{l==="circle"?d.attr("cx",h=>{const f=n.x2Tile(h);return f-(f-n.x1Tile(h))/2}).attr("cy",n.yTile):c&&d.attr("x1",n.x1Tile).attr("y1",n.yTile).attr("x2",n.x2Tile).attr("y2",n.yTile)})}}},mg=bt(8),vg={redraw(e={}){var t,n,i,a,s,o,r,l,c,u;const d=this,{config:h,state:f,$el:g}=d,{main:p,treemap:_}=g;f.redrawing=!0,f.redrawGeneration++,(f.dirty.data||f.dirty.visibility||e.initializing)&&f.dataGeneration++,(e.initializing||f.dirty.size||f.dirty.data||!f.rendered)&&d.cache.remove([U.svgLeft]);const x=d.filterTargetsToShow(d.data.targets);f._targetsToShow=x;const m={data:f.dirty.data,visibility:f.dirty.visibility,size:f.dirty.size};f.dirty.data=!1,f.dirty.visibility=!1,f.dirty.size=!1;const{flow:v,initializing:b}=e,y=d.getWithOption(e),T=y.Transition?h.transition_duration:0,w=y.TransitionForExit?T:0,C=y.TransitionForAxis?T:0,k=(t=d.axis)==null?void 0:t.generateTransitions(C),S=m.data||m.visibility||b;if(f.isCanvasMode&&(d.setContainerSize(),(n=d.updateHtmlLegend)==null||n.call(d)),d.updateSizes(b),f.isCanvasMode){const A=d.scale.zoom,L=A==null?void 0:A.domain();A&&(d.scale.zoom=null),d.updateScales(b,y.UpdateXDomain),A&&(A.range(d.scale.x.range()),L&&A.domain(L),d.scale.zoom=d.getCustomizedXScale(A),d.axis.x.scale(d.scale.zoom),d.scale.x.domain(h.zoom_rescale?L:d.org.xDomain),d.scale.subX.domain(d.org.xDomain)),f.hasAxis&&d.axis.syncAxisDomains(x,y,v),f.hasAxis&&((i=d.applyCanvasSubchartDomain)==null||i.call(d));const E=S?d.getDrawShape():f._cachedDrawShape||d.getDrawShape();S&&(f._cachedDrawShape=E),(a=d.updateHtmlLegend)==null||a.call(d),(s=d.resizeCanvas)==null||s.call(d),f.canvasFocusKey=null,d.renderCanvasFrame(E,null,!0),b&&d.updateTypesElements(),d.callPluginHook("$redraw",e,0),f.redrawing=!1,f._targetsToShow=null,f._cachedDrawShape=null,d.mapToIds(d.data.targets).forEach(D=>{f.withoutFadeIn[D]=!0}),Y(h.onrendered,d.api);return}y.Legend&&h.legend_show?(e.withTransition=!!T,!_&&d.updateLegend(d.mapToIds(d.data.targets),e,k)):y.Dimension&&d.updateDimension(!0),h.data_empty_label_text&&p.select(`text.${Et.text}.${j.empty}`).attr("x",f.width/2).attr("y",f.height/2).text(h.data_empty_label_text).style("display",x.length?"none":null),(o=d.redrawTitle)==null||o.call(d),f.hasAxis?(d.axis.redrawAxis(x,y,k,v,b),(r=d.hasGrid)!=null&&r.call(d)&&d.updateGrid(),h.regions.length&&((l=d.updateRegion)==null||l.call(d)),["bar","candlestick","line","area"].forEach(A=>{const L=$t(A);(/^(line|area)$/.test(A)&&d.hasTypeOf(L)||d.hasType(A))&&S&&d[`update${L}`](y.TransitionForExit)}),g.text&&p.selectAll(`.${ut.selectedCircles}`).filter(d.isBarType.bind(d)).selectAll("circle").remove(),h.interaction_enabled&&!v&&y.EventRect&&(d.redrawEventRect(),(c=d.bindZoomEvent)==null||c.call(d))):(g.arcs&&d.redrawArc(T,w,y.Transform),g.radar&&d.redrawRadar(),g.polar&&d.redrawPolar(),g.funnel&&d.redrawFunnel(),_&&d.updateTreemap(w)),!f.resizing&&!_&&(d.hasPointType()||f.hasRadar)?S&&d.updateCircle():(u=d.hasLegendDefsPoint)!=null&&u.call(d)&&d.data.targets.forEach(d.point("create",this)),d.hasDataLabel()&&!d.hasArcType(null,["radar"])&&S&&d.updateText(),b&&d.updateTypesElements(),d.generateRedrawList(x,v,T,y.Subchart,S),d.updateTooltipOnRedraw(),d.callPluginHook("$redraw",e,T)},generateRedrawList(e,t,n,i,a=!0){const s=this,{config:o,state:r}=s,l=a?s.getDrawShape():r._cachedDrawShape||s.getDrawShape();a&&(r._cachedDrawShape=l),r.hasAxis&&o.subchart_show&&s.redrawSubchart(i,n,l);const c=t&&s.generateFlow({targets:e,flow:t,duration:t.duration,shape:l,xv:s.xv.bind(s)}),u=(n||c)&&qn(),d=s.getRedrawList(l,t,c,u),h=()=>{c&&c(),r.redrawing=!1,r._targetsToShow=null,r._cachedDrawShape=null,Y(o.onrendered,s.api)};if(u&&d.length){const f=hr();(0,mg.transition)().duration(n).each(()=>{d.flatMap(g=>g).forEach(g=>f.add(g))}).call(f,h)}else r.transiting||h();s.mapToIds(s.data.targets).forEach(f=>{r.withoutFadeIn[f]=!0})},getRedrawList(e,t,n,i){const a=this,{config:s,state:{hasAxis:o,hasRadar:r,hasTreemap:l},$el:{grid:c}}=a,{cx:u,cy:d,xForText:h,yForText:f}=e.pos,g=[];if(o){a.redrawGrid&&(s.grid_x_lines.length||s.grid_y_lines.length)&&g.push(a.redrawGrid(i)),a.redrawRegion&&s.regions.length&&g.push(a.redrawRegion(i));for(const p in e.type){const _=$t(p),x=e.type[p];(/^(area|line)$/.test(p)&&a.hasTypeOf(_)||a.hasType(p))&&g.push(a[`redraw${_}`](x,i))}!t&&c.main&&a.updateGridFocus&&g.push(a.updateGridFocus())}return(!a.hasArcType()||r)&&yt(s.data_labels)&&s.data_labels!==!1&&g.push(a.redrawText(h,f,t,i)),(a.hasPointType()||r)&&!a.isPointFocusOnly()&&a.redrawCircle&&g.push(a.redrawCircle(u,d,i,n)),l&&g.push(a.redrawTreemap(i)),g},updateAndRedraw(e={}){const t=this,{config:n,state:i}=t;let a;e.withTransition=Ne(e,"withTransition",!0),e.withTransform=Ne(e,"withTransform",!1),e.withLegend=Ne(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=Ne(e,"withTransitionForTransform",e.withTransition),e.withLegend&&n.legend_show||(i.hasAxis&&(a=t.axis.generateTransitions(e.withTransitionForAxis?n.transition_duration:0)),t.updateScales(),t.updateSvgSize(),t.transformAll(e.withTransitionForTransform,a)),t.redraw(e)}},bg={setContainerSize(){const e=this,{state:t}=e;t.current.width=e.getCurrentWidth(),t.current.height=e.getCurrentHeight()},getCurrentWidth(){const e=this;return e.config.size_width||e.getParentRectValue("width")},getCurrentHeight(){const e=this,{config:t}=e,n=t.size_height||e.getParentHeight();return n>0?n:320/(e.hasType("gauge")&&!t.gauge_fullCircle?2:1)},getParentRectValue(e){const t=`offset${$t(e)}`;let n=this.$el.chart.node(),i=0;for(;i<30&&n&&n.tagName!=="BODY";){try{i=ht(n,!0)[e]}catch(s){t in n&&(i=n[t])}n=n.parentNode}const a=nt.body[t];return i>a&&(i=a),i},getParentHeight(){const e=this.$el.chart.style("height");let t=0;return e&&(t=/px$/.test(e)?parseInt(e,10):this.getParentRectValue("height")),t},getSvgLeft(e){var t,n,i;const a=this,{cache:s,config:o,state:{hasAxis:r},$el:l}=a;if(e){const k=s.get(U.svgLeft);if(k!==null)return k}const c=o.axis_rotated,u=c||!c&&!o.axis_y_inner,d=c?It.axisX:It.axisY,h=l.main.select(`.${d}`).node(),f=r&&o[`axis_${c?"x":"y"}_label`],p=r&&(Q(f)||Q(f.text)||/^inner-/.test(f==null?void 0:f.position))?l.main.select(`.${d}-label`):null,_=p&&!p.empty()?p.node():null,x=!e,m={label:_?ht(_,x):null,leftAxis:h&&u?ht(h,x):null,chart:ht(l.chart.node(),x)},v=(n=(t=m.label)==null?void 0:t.left)!=null?n:0,b=(i=m.leftAxis)!=null?i:{right:0},y=m.chart.left+v,T=a.hasArcType(),w=b.right-y-(T?0:a.getCurrentPaddingByDirection("left",e)),C=w>0?w:0;return s.add(U.svgLeft,C),C},updateDimension(e){var t,n;const i=this,{config:a,state:{hasAxis:s,isCanvasMode:o},$el:r}=i;if(s&&!e&&i.axis.x&&a.axis_rotated&&((t=i.axis.subX)==null||t.create(r.axis.subX)),i.updateScales(e),o){(n=i.resizeCanvas)==null||n.call(i);return}i.updateSvgSize(),i.transformAll(!1)},updateSvgSize(){var e;const t=this,{config:n,state:{clip:i,current:a,hasAxis:s,width:o,height:r},$el:{svg:l}}=t;if(!l){(e=t.resizeCanvas)==null||e.call(t);return}if(n.resize_auto==="viewBox"?l.attr("viewBox",`0 0 ${a.width} ${a.height}`):l.attr("width",a.width).attr("height",a.height),s){const c=l.select(`.${er.brush} .overlay`),u={width:0,height:0};c.size()&&(u.width=+c.attr("width"),u.height=+c.attr("height")),l.selectAll([`#${i.id}`,`#${i.idGrid}`]).select("rect").attr("width",o).attr("height",r),l.select(`#${i.idXAxis}`).select("rect").call(t.setXAxisClipPath.bind(t)),l.select(`#${i.idYAxis}`).select("rect").call(t.setYAxisClipPath.bind(t)),i.idSubchart&&l.select(`#${i.idSubchart}`).select("rect").attr("width",o).attr("height",u.height)}},getCurrentPaddingByDirection(e,t=!1,n=!1){var i;const a=this,{config:s,$el:o,state:{hasAxis:r,isCanvasMode:l}}=a,c=s.axis_rotated,u=((i=s.padding)==null?void 0:i.mode)==="fit",d=$(s[`padding_${e}`])?s[`padding_${e}`]:void 0,h=r?{top:c?"y2":null,bottom:c?"y":"x",left:c?"x":"y",right:c?null:"y2"}[e]:null,f=/^(left|right)$/.test(e),g=h&&s[`axis_${h}_inner`],p=h&&s[`axis_${h}_show`],_=h?s[`axis_${h}_axes`].length:0;let x=h?f?a.getAxisWidthByAxisId(h,t):a.getHorizontalAxisHeight(h):0;const m=20;let v=0;!u&&f&&(x=Jc(x));let b=r&&f&&(g||Ct(d)&&!p)?0:u?(p?x:0)+(d!=null?d:0):Ct(d)?x:d;return f&&r?(h&&(u||g)&&s[`axis_${h}_label`].text&&(b+=a.axis.getAxisLabelPosition(h).isOuter?m:0),e==="right"?(b+=c?!u&&Ct(d)?10:2:!p||g?u?2:1:0,b+=n?a.axis.getXAxisTickTextY2Overflow(m):0):e==="left"&&c&&Ct(d)&&(b=s.axis_x_show?u?x:Math.max(x,40):1)):e==="top"?((o.title&&o.title.node()||l&&s.title_text)&&(b+=a.getTitlePadding()),v=c&&!g?_:0):e==="bottom"&&r&&c&&!p&&(b+=1),b+x*_-v},getCurrentPadding(e=!1){const t=this,[n,i,a,s]=["top","bottom","left","right"].map(o=>t.getCurrentPaddingByDirection(o,null,e));return{top:n,bottom:i,left:a,right:s}},getResettedPadding(e){const t=this,{config:n}=t,i=$(e);let a=i?0:{};return n.padding===!1?!i&&Object.keys(e).forEach(s=>{a[s]=!se(n.data_labels)&&n.data_labels!==!1&&s==="top"?e[s]:0}):a=e,a},updateSizes(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:{legend:c}}=o,u=r.axis_rotated,d=o.hasArcType()||l.hasFunnel||l.hasTreemap,h=((t=r.padding)==null?void 0:t.mode)==="fit";!e&&o.setContainerSize();const f=c?o.getLegendWidth():0,g=c?o.getLegendHeight():0,p={width:f,height:g};!d&&r.axis_x_show&&r.axis_x_tick_autorotate&&o.updateXAxisTickClip();const _={right:r.legend_show&&l.isLegendRight?f+(h?0:20):0,bottom:!r.legend_show||l.isLegendRight||l.isLegendInset?0:g},x=u||d?0:o.getHorizontalAxisHeight("x"),m=r.subchart_axis_x_show&&r.subchart_axis_x_tick_text_show?x:30,v=r.subchart_show&&!d?r.subchart_size_height+m:0,b=o.hasType("gauge")&&r.arc_needle_show&&!r.gauge_fullCircle&&!r.gauge_label_show?10:0,y=o.getCurrentPadding(!0);if(l.margin=!d&&u?{top:y.top,right:d?0:y.right+_.right,bottom:_.bottom+y.bottom,left:v+(d?0:y.left)}:{top:(h?0:4)+y.top,right:d?0:y.right+_.right,bottom:b+v+_.bottom+y.bottom,left:d?0:y.left},l.margin=o.getResettedPadding(l.margin),l.margin2=u?{top:l.margin.top,right:NaN,bottom:20+_.bottom,left:o.state.rotatedPadding.left}:{top:l.current.height-v-_.bottom,right:NaN,bottom:m+_.bottom,left:l.margin.left},l.margin3={top:0,right:NaN,bottom:0,left:0},(n=o.updateSizeForLegend)==null||n.call(o,p),l.width=l.current.width-l.margin.left-l.margin.right,l.height=l.current.height-l.margin.top-l.margin.bottom,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l.width2=u?l.margin.left-l.rotatedPadding.left-l.rotatedPadding.right:l.width,l.height2=u?l.height:l.current.height-l.margin2.top-l.margin2.bottom,l.width2<0&&(l.width2=0),l.height2<0&&(l.height2=0),o.hasArcType()){const T=o.hasType("gauge"),w=r.legend_show&&l.isLegendRight,C=(i=l.hasRadar&&o.cache.get(U.radarTextWidth))!=null?i:0;l.arcWidth=l.width-(w?p.width+10:0)-C,l.arcHeight=l.height-(w&&!T?0:10),(a=r.arc_rangeText_values)!=null&&a.length&&(T?(l.arcWidth-=25,l.arcHeight-=10,l.margin.left+=10):(l.arcHeight-=20,l.margin.top+=10)),T&&!r.gauge_fullCircle&&(l.arcHeight+=l.height-o.getPaddingBottomForGauge()),(s=o.updateRadius)==null||s.call(o)}l.isLegendRight&&d&&(l.margin3.left=l.arcWidth/2+l.radiusExpanded*1.1)}},yg={setCssRule(e,t,n,i){const a=this,{config:s,state:{cssRule:o,style:r}}=a;return s.boost_useCssRule?l=>{l.each(c=>{const u=i&&(i==null?void 0:i.call(a,c)),d=`${e?`.${At.shapes+a.getTargetSelectorSuffix(c.id)}`:""}${t}`;t in o&&r.sheet.deleteRule(o[d]),a.state.cssRule[d]=bf(r,d,n.filter(Boolean).map(h=>Q(u)&&h.indexOf(":")===-1?`${h}: ${u}`:h||""))})}:()=>{}},getStylePropValue(e){const{config:{boost_useCssRule:t}}=this;return t?null:z(e)?e.bind(this):e}};function Tg(e){let t="middle";return e>0&&e<=170?t="end":e>190&&e<=360&&(t="start"),t}function wg(e,t,n,i,a){var s;const o=this,{value:r}=e,l=o.isCandlestickType(e),c=$(r)&&r<0||l&&!((s=o.getCandlestickData(e))!=null&&s._isUp);let{x:u,y:d}=t;const h=4,f=h*2;return i?n==="start"?(u+=c?0:f,d+=h):n==="middle"?(u+=f,d-=f):n==="end"&&(c&&(u-=f),d+=h):(n==="start"?(u+=h,c&&(d+=f*2)):n==="middle"?d-=f:n==="end"&&(u-=h,c&&(d+=f*2)),a&&(d+=c?-17:l?13:7)),{x:u,y:d}}function Or(e,t){var n;const i=this.config.data_labels_position,{id:a,index:s,value:o}=e;return(n=z(i)?i.bind(this.api)(t,o,a,s,this.$el.text):(a in i?i[a]:i)[t])!=null?n:0}function Cg(e,t,n){var i,a;const s=this,{config:o,$T:r}=s,l=o.axis_rotated,{border:{padding:c="3 5",radius:u=10,stroke:d="#000",strokeWidth:h=1,fill:f="none"}}=o.data_labels,g=Rs(c),p=o.data_labels.border!==!0,_=Ue(e);let x=(0,O.select)(e.previousElementSibling);(x.empty()||((i=x.node())==null?void 0:i.tagName)!=="rect"||!((a=x.attr("class"))!=null&&a.includes(n)))&&(x=(0,O.select)(e.parentNode).insert("rect",()=>e).attr("class",`${Et.textBorderRect} ${n}`).attr("width",_.width+(p?g.left+g.right:0)).attr("height",_.height+(p?g.top+g.bottom:0)),p&&x.style("fill",f).style("stroke",d).style("stroke-width",`${h}px`).attr("rx",u).attr("ry",u)),r(x).attr("x",t.x-(p?g.left:0)-(l?0:_.width/2)).attr("y",t.y-(p?g.top:0)-_.height/4*3.2)}function Va(e=0,t){const n=this,{config:i}=n,a=i[`${t}_label_threshold`]||0;return e>=a}function $r(){const e=this,{$el:{text:t},config:n}=e;(e.state.arcWidth?e.getArcLabelConfig("image"):n.data_labels.image)&&t.filter(function(){const a=this.previousElementSibling;return a?a.tagName!=="image"||!a.classList.contains(Et.textLabelImage):!0}).each(function(a){var s,o,r,l;const c=Sg.call(e,a);if(!c)return;const{url:u,width:d,height:h,pos:f}=c;if(u){const g=(0,O.select)(this.parentNode);g==null||g.insert("image",`${(o=(s=this.getAttribute("class"))==null?void 0:s.replace(/(?:^(.)|\s)/g,".$1"))!=null?o:"text"}`).style("opacity","0").attr("href",p=>an(u,{ID:"id"in p?p.id:p.data.id})).attr("class",Et.textLabelImage).style("pointer-events","none").attr("width",d).attr("height",h).attr("transform",f?`translate(${(r=f.x)!=null?r:0} ${(l=f.y)!=null?l:0})`:null)}})}function Sg(e){var t;const n=this,{config:i,state:a}=n,s=a.arcWidth?n.getArcLabelConfig("image"):i.data_labels.image;if(z(s))return(t=s.call(n.api,e.value,e.id,e.index))!=null?t:{url:"",width:0,height:0,pos:{x:0,y:0}};if(s){const{url:o="",width:r=0,height:l=0,pos:c}=s;return{url:o,width:r,height:l,pos:c}}return null}function Br(e,t,n){var i;const a=this,{config:s,state:{arcWidth:o,hasTreemap:r}}=a,l=s.axis_rotated,c=(0,O.select)(e.previousElementSibling),u=d=>{var h;const f=d.style.opacity!=="0"&&d.style.fillOpacity!=="0";return(o?d.textContent:f)&&((h=this.previousElementSibling)==null?void 0:h.tagName)!=="image"};if(!c.empty()&&((i=c.node())==null?void 0:i.tagName)==="image"){const d=n||ht(e),h=+c.attr("width")/2,f=+c.attr("height")/2;let g=t.x-h,p=t.y-f-d.height/2;l?t.x+=h:(r&&(g=-h,p=-(f*2+d.height)),a.hasType("pie")||a.hasType("polar")||(t.y+=f)),a.$T(c).style("opacity",u(e)?null:"0").attr("x",g).attr("y",p)}}function kg(e){return Ds(e,t=>t,t=>Ue(t,!0))}var Ag={opacityForText(e){const t=this;return t.isBarType(e)&&!Va.call(t,Math.abs(t.getRatio("bar",e)),"bar")?"0":t.hasDataLabel()?null:"0"},initText(){const{$el:e}=this;e.main.select(`.${j.chart}`).append("g").attr("class",Et.chartTexts).style("pointer-events",e.funnel||e.treemap?"none":null)},updateTargetsForText(e){const t=this,n=t.getChartClass("Text"),i=t.getClass("texts","id"),a=t.classFocus.bind(t);t.$el.main.select(`.${Et.chartTexts}`).selectAll(`.${Et.chartText}`).data(t.filterNullish(e)).attr("class",r=>`${n(r)}${a(r)}`.trim()).enter().append("g").style("opacity","0").attr("class",n).call(t.setCssRule(!0,` .${Et.text}`,["fill","pointer-events:none"],t.updateTextColor)).append("g").attr("class",i)},updateText(){const e=this,{$el:t,$T:n,config:i,axis:a}=e,s=e.getClass("text","index"),o=i.data_labels.centered,r=t.main.selectAll(`.${Et.texts}`).selectAll(`.${Et.text}`).data(e.labelishData.bind(e));n(r.exit()).style("fill-opacity","0").remove(),t.text=r.enter().append("text").merge(r).attr("class",s).attr("text-anchor",l=>{let u=i[`axis_${a==null?void 0:a.getId(l.id)}_inverted`]?l.value>0:l.value<0;if(e.isCandlestickType(l)){const d=e.getCandlestickData(l);u=!(d!=null&&d._isUp)}else if(e.isTreemapType(l))return o?"middle":"start";return i.axis_rotated?u?"end":"start":"middle"}).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each(function(l,c,u){const d=(0,O.select)(this);let{value:h}=l;if(e.isBubbleZType(l))h=e.getBubbleZData(h,"z");else if(e.isCandlestickType(l)){const f=e.getCandlestickData(l);f&&(h=f.close)}h=e.isTreemapType(l)?e.treemapDataLabelFormat(l)(d):e.dataLabelFormat(l.id)(h,l.id,l.index,u),$(h)?this.textContent=h:Cn(d,h,void 0,!0)}),$r.call(e)},updateTextColor(e){const t=this,{config:n}=t,i=n.data_labels_colors,a=t.isArcType(e)&&!t.isRadarType(e)||t.isFunnelType(e)||t.isTreemapType(e)?null:t.color(e);let s;if(Q(i))s=i;else if(tt(i)){const{id:o}=e.data||e;s=i[o]}else z(i)&&(s=i.bind(t.api)(a,e));if(t.isCandlestickType(e)&&!z(i)){const o=t.getCandlestickData(e);if(!(o!=null&&o._isUp)){const r=n.candlestick_color_down;s=tt(r)?r[e.id]:r}}return s||a},updateTextBGColor(e,t){const n=this,{$el:{defs:i}}=n;let a="";if(t){const s=Q(t)?"":n.getTargetSelectorSuffix("id"in e?e.id:e.data.id),o=i.select(["filter[id*='labels-bg","']"].join(s));if(o.size()&&(a=`url(#${o.attr("id")})`),z(t)){n.generateTextBGColorFilter(t);const r=n.color(e),l=t.bind(n.api)(r,e);l?o.select("feFlood").attr("flood-color",l):a=""}}return a||null},redrawText(e,t,n,i){const a=this,{$T:s,axis:o,config:r,state:{hasTreemap:l}}=a,c=xe(!0),u=r.axis_rotated,d=r.data_labels.rotate,h=Tg(d),f=d?`rotate(${d})`:"",g=a.$el.text.style("fill",a.getStylePropValue(a.updateTextColor)).attr("filter",x=>a.updateTextBGColor.bind(a)(x,r.data_labels_backgroundColors)).style("fill-opacity",n?0:a.opacityForText.bind(a)),p=new Map,_=[];return g.each(function(x){const m=this;p.set(m,{rect:ht(m)}),r.data_labels.centered&&(a.isBarType(x)||a.isTreemapType(x))&&_.push(m)}),_.length>0&&kg(_).forEach((x,m)=>{const v=p.get(m);v&&(v.bbox=x)}),g.each(function(x,m){const v=p.get(this),b=s(l&&this.childElementCount?this.parentNode:this,!!(i&&(this.getAttribute("x")||this.getAttribute("transform"))),c),y=r[`axis_${o==null?void 0:o.getId(x.id)}_inverted`];let T={x:e.call(this,x,m,v),y:t.call(this,x,m,v)};d&&(T=wg.bind(a)(x,T,h,u,y),b.attr("text-anchor",h)),Br.call(a,this,T,v==null?void 0:v.rect),this.childElementCount||d?b.attr("transform",`translate(${T.x} ${T.y}) ${f}`):b.attr("x",T.x).attr("y",T.y),r.data_labels.border&&Cg.call(a,b.node(),T,`${Et.textBorderRect}-${m}`)}),!0},getTextRect(e,t){var n,i;const a=this;let s,o,r;Array.isArray(e)?s=`${U.textRect}-${e.join("_")}`:(o=(i=(n=e.node)==null?void 0:n.call(e))!=null?i:e,/text/i.test(o.tagName)||(o=o.querySelector("text")),r=o.textContent,s=`${U.textRect}-${r.replace(/\W/g,"_")}`);const l=a.cache.get(s)||[];return l.length===0&&((a.$el.svg||a.$el.chart.select("svg")).selectAll(`.${j.dummy}`).data(r?[r]:e).enter().append("text").style("visibility","hidden").style("font",o?(0,O.select)(o).style("font"):null).classed(t||j.dummy,!0).text(c=>c).each(function(c,u){l[u]=ht(this)}).remove(),a.cache.add(s,l)),l.length>1?l:l[0]},generateXYForText(e,t){const n=this,{state:{hasRadar:i,hasFunnel:a,hasTreemap:s}}=n,o=Object.keys(e),r={},l=t?n.getXForText:n.getYForText;return a&&o.push("funnel"),i&&o.push("radar"),s&&o.push("treemap"),o.forEach(c=>{r[c]=n[`generateGet${$t(c)}Points`](e[c],!1)}),function(c,u,d){const h=n.isAreaType(c)&&"area"||n.isBarType(c)&&"bar"||n.isCandlestickType(c)&&"candlestick"||n.isFunnelType(c)&&"funnel"||n.isRadarType(c)&&"radar"||n.isTreemapType(c)&&"treemap"||"line";return l.call(n,r[h](c,u),c,this,d)}},getCenteredTextPos(e,t,n,i,a){const s=this,{config:o}=s,r=o.axis_rotated,l=s.isBarType(e),c=s.isTreemapType(e);if(o.data_labels.centered&&(l||c)){const u=(a==null?void 0:a.bbox)||Ue(n);if(l){const d=s.getRangedData(e,null,"bar")>=0;if(r){const h=(d?t[1][1]-t[0][1]:t[0][1]-t[1][1])/2+u.width/2;return d?-h-3:h+2}else{const h=(d?t[0][1]-t[1][1]:t[1][1]-t[0][1])/2+u.height/2;return d?h:-h-2}}else if(c)return i==="x"?(t[1][0]-t[0][0])/2:(t[1][1]-t[0][1])/2-u.y-u.height/2}return 0},getXForText(e,t,n,i){var a,s,o;const r=this,{config:l}=r,c=l.axis_rotated,u=r.isFunnelType(t),d=r.isTreemapType(t);let h=e?e[0][0]:0;if(r.isCandlestickType(t))c?h=(a=r.getCandlestickData(t))!=null&&a._isUp?e[2][2]+4:e[2][1]-4:h+=(e[1][0]-h)/2;else if(u)if(e)h=(o=(s=e[2])==null?void 0:s[0])!=null?o:h;else return Fa(n,"x");else if(d)h+=l.data_labels.centered?0:5;else if(c){const f=l[`axis_${r.axis.getId(t.id)}_inverted`],g=r.isBarType(t)?4:6,p=t.value;h=e[2][1],h+=g*((f?p>0:p<0)?-1:1)}else h=r.hasType("bar")?(e[2][0]+e[0][0])/2:h;return(c||d||u)&&(h+=r.getCenteredTextPos(t,e,n,"x",i)),h+Or.call(this,t,"x")},getYForText(e,t,n,i){var a,s;const o=this,{axis:r,config:l,state:c}=o,u=l.axis_rotated,d=l[`axis_${r==null?void 0:r.getId(t.id)}_inverted`],h=o.isBarType(t),f=o.isFunnelType(t),g=o.isTreemapType(t),p=l.point_r,_=(i==null?void 0:i.rect)||ht(n);let{value:x}=t,m=3,v;if(o.isCandlestickType(t))x=o.getCandlestickData(t),u?(v=e[0][0],v+=(e[1][0]-v)/2+m):(v=x&&x._isUp?e[2][2]-m:e[2][1]+m*4,d&&(v+=15*(x._isUp?1:-1)));else if(f)if(e)v=((s=(a=e[2])==null?void 0:a[1])!=null?s:e[0][1])+_.height/2-3;else return Fa(n,"y");else if(g)v=e[0][1]+(l.data_labels.centered?0:_.height+5);else if(u)v=(e[0][0]+e[2][0]+_.height*.6)/2;else if(v=e[2][1],$(p)&&p>5&&(o.isLineType(t)||o.isScatterType(t))&&(m+=l.point_r/2.3),x<0||x===0&&!c.hasPositiveValue&&c.hasNegativeValue)v+=d?h?-3:-5:_.height+(h?-m:m);else{let b=-m*2;h?b=-m:o.isBubbleType(t)&&(b=m),d&&(b=h?10:15),v+=b}return(!u||g)&&(v+=o.getCenteredTextPos(t,e,n,"y",i)),v+Or.call(this,t,"y")},markOverlapped(e,t,n){const i=t.$el.arcs.selectAll(n),a=i.filter(u=>u.data.id!==e),s=i.filter(u=>u.data.id===e),o=Ma(s.node()),r=(u,d)=>Math.sqrt(u*u+d*d);if(!s.node())return;const l=parseInt(s.style("font-size"),10),c=[];a.each(function(){const u=Ma(this),d=r(o.e,o.f)>r(u.e,u.f)?s:(0,O.select)(this),h=Math.ceil(Math.abs(o.e-u.e))<Math.ceil(d.node().getComputedTextLength()),f=Math.ceil(Math.abs(o.f-u.f))<l;c.push({node:this,overlaps:h&&f})}),c.forEach(({node:u,overlaps:d})=>{(0,O.select)(u).classed(Et.TextOverlapping,d)})},undoMarkOverlapped(e,t){e.$el.arcs.selectAll(t).each(function(){(0,O.selectAll)([this,this.previousSibling]).classed(Et.TextOverlapping,!1)})}};function zr(e="left",t){const n=$(t);return e.includes("center")?n?t/2:"middle":e.includes("right")?n?t:"end":n?0:"start"}function Lg(e){var t,n,i,a,s,o,r,l;const{config:c,$el:u}=e,d=((i=(n=(t=e.canvasTheme)==null?void 0:t.style)==null?void 0:n.title)==null?void 0:i.font)||((o=(s=(a=e.canvasTheme)==null?void 0:a.style)==null?void 0:s.label)==null?void 0:o.font)||"14px sans-serif",h=(l=(r=u.chart)==null?void 0:r.node)==null?void 0:l.call(r),f=h==null?void 0:h.ownerDocument;if(h&&f&&c.title_text){const g=f.createElementNS("http://www.w3.org/2000/svg","svg"),p=f.createElementNS("http://www.w3.org/2000/svg","text");g.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",p.setAttribute("class",Et.title),p.style.font=d,p.textContent=String(c.title_text),g.appendChild(p),h.appendChild(g);const _=ht(p).height;if(g.remove(),_)return _}return c.title_text?parseFloat(d)||14:0}var Rg={initTitle(){const e=this,{config:t,$el:n}=e;if(t.title_text){n.title=n.svg.append("g");const i=n.title.append("text").style("text-anchor",zr(t.title_position)).attr("class",Et.title);Cn(i,t.title_text,[.3,1.5])}},redrawTitle(){const e=this,{config:t,state:{current:n},$el:{title:i}}=e;if(i){const a=zr(t.title_position,n.width),s=(t.title_padding.top||0)+e.getTextRect(e.$el.title,Et.title).height;i.attr("transform",`translate(${a}, ${s})`)}},getCanvasTitleHeight(){return Lg(this)},getTitlePadding(){const e=this,{$el:{title:t},config:n,state:i}=e,a=n.title_padding.top||0,s=n.title_padding.bottom||0;if(i.isCanvasMode&&n.title_text)return a+e.getCanvasTitleHeight()+s;if(!(t!=null&&t.node()))return a+s;const o=t.node(),r=Fa(o,"y");if(r){const l=Ue(o);return r+l.y+l.height+s}return a+e.getTextRect(t,Et.title).height+s}};const Eg=/(\r?\n|\t)/g,Pg=/{{(.*)}}/;var Dg={initTooltip(){const e=this,{config:t,$el:n}=e;n.tooltip=(0,O.select)(t.tooltip_contents.bindto),n.tooltip.empty()&&(n.tooltip=n.chart.append("div").attr("class",ki.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.bindTooltipResizePos()},initShowTooltip(){var e;const t=this,{config:n,$el:i,state:{hasAxis:a,hasRadar:s}}=t;if(n.tooltip_init_show){const o=!(a||s);(e=t.axis)!=null&&e.isTimeSeries()&&Q(n.tooltip_init_x)&&(n.tooltip_init_x=Wt.call(t,n.tooltip_init_x)),t.api.tooltip.show({data:{[o?"index":"x"]:n.tooltip_init_x}});const r=n.tooltip_init_position;if(!n.tooltip_contents.bindto&&!se(r)){const{top:l=0,left:c=50}=r;i.tooltip.style("top",Q(l)?l:`${l}px`).style("left",Q(c)?c:`${c}px`).style("display",null)}}},getTooltipHTML(...e){const t=this,{api:n,config:i}=t;return Se(z(i.tooltip_contents)?i.tooltip_contents.bind(n)(...e):t.getTooltipContent(...e))},getTooltipContent(e,t,n,i){var a;const s=this,{api:o,config:r,state:l,$el:c}=s,u=r.tooltip_format_title,d=r.tooltip_format_name,h=r.tooltip_format_value,f=z(u)?u.bind(o):t,g=z(d)?d.bind(o):(D=>D),p=z(h)?h.bind(o):null,_=(D,R,P,B)=>{let M=p;return M||(l.hasTreemap||s.isStackNormalized()&&(!s.isStackNormalizedPerGroup()||s.isGrouped(P))?M=(X,G)=>`${(G*100).toFixed(2)}%`:M=n),M(D,R,P,B)},x=r.tooltip_order,m=D=>s.axis&&s.isBubbleZType(D)?s.getBubbleZData(D.value,"z"):s.getBaseValue(D),v=s.levelColor?D=>s.levelColor(D.value):D=>i(D),b=r.tooltip_contents,y=b.template,T=s.mapToTargetIds();if(x===null&&r.data_groups.length){const D=s.orderTargets(s.data.targets).map(R=>R.id).reverse();e.sort((R,P)=>{let B=R?R.value:null,M=P?P.value:null;return B>0&&M>0&&(B=R.id?D.indexOf(R.id):null,M=P.id?D.indexOf(P.id):null),B-M})}else if(/^(asc|desc)$/.test(x)){const D=x==="asc";e.sort((R,P)=>{const B=R?m(R):null,M=P?m(P):null;return D?B-M:M-B})}else z(x)&&e.sort(x.bind(o));const w=s.getTooltipContentTemplate(y),C=e.length;let k,S,A,L,E;for(E=0;E<C;E++){S=e[E];const D=S&&m(S);if(!(!S||!(D||D===0))){if(Ct(k)){const R=(l.hasAxis||l.hasRadar)&&f(S.x);k=an(w[0],{CLASS_TOOLTIP:ki.tooltip,TITLE:J(R)?y?R:`<tr><th colspan="2">${R}</th></tr>`:""})}if(!S.ratio&&c.arcs&&(A=["arc",s.$el.arcs.select(`path.${at.arc}-${S.id}`).data()[0]],S.ratio=s.getRatio(...A)),A=[S.ratio,S.id,S.index],s.isAreaRangeType(S)){const[R,P]=["high","low"].map(M=>_(s.getRangedData(S,M),...A));L=`<b>Mid:</b> ${_(m(S),...A)} <b>High:</b> ${R} <b>Low:</b> ${P}`}else if(s.isCandlestickType(S)){const[R,P,B,M,X]=["open","high","low","close","volume"].map(G=>s.getRangedData(S,G,"candlestick")?_(s.getRangedData(S,G,"candlestick"),...A):void 0);L=`<b>Open:</b> ${R} <b>High:</b> ${P} <b>Low:</b> ${B} <b>Close:</b> ${M}${X?` <b>Volume:</b> ${X}`:""}`}else if(s.isBarRangeType(S)){const{value:R,id:P,index:B}=S;L=`${_(R,void 0,P,B)}`}else L=_(m(S),...A);if(L!==void 0){if(S.name===null)continue;const R=g((a=S.name)!=null?a:S.id,...A),P=v(S),B={CLASS_TOOLTIP_NAME:ki.tooltipName+s.getTargetSelectorSuffix(S.id),COLOR:y||!s.patterns?P:`<svg><rect style="fill:${P}" width="10" height="10"></rect></svg>`,NAME:R,VALUE:L};if(y&&tt(b.text)){const M=T.indexOf(S.id);Object.keys(b.text).forEach(X=>{B[X]=b.text[X][M]})}k+=an(w[1],B)}}}return`${k}</table>`},getTooltipContentTemplate(e){return(e||`<table class="{=CLASS_TOOLTIP}"><tbody>
30
25
  {=TITLE}
31
26
  {{<tr class="{=CLASS_TOOLTIP_NAME}">
32
27
  <td class="name">${this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>'}{=NAME}</td>
33
28
  <td class="value">{=VALUE}</td>
34
29
  </tr>}}
35
- </tbody></table>`).replace(If,"").split(Mf)},setTooltipPosition(e,t){var n,i;const a=this,{config:s,scale:o,state:r,$el:{eventRect:l,tooltip:c,svg:d}}=a,{bindto:u}=s.tooltip_contents,h=s.axis_rotated,f=c==null?void 0:c.datum();if(!u&&f){const g=e!=null?e:f.data,[p,x]=Jt(r.event,t!=null?t:l==null?void 0:l.node()),_={x:p,y:x};if(r.hasAxis&&o.x&&f&&"x"in f){const y=(T=0,w,C="y")=>{var A;const S=o[w?(A=a.axis)==null?void 0:A.getId(w):C];return S?S(T)+(h?r.margin.left:r.margin.top):0};_.xAxis=o.x(f.x)+(s.tooltip_position?h?r.margin.top:r.margin.left:0),g.length===1?_.yAxis=y(g[0].value,g[0].id):_.yAxis=y}const{width:v=0,height:m=0}=f,b=(i=(n=s.tooltip_position)==null?void 0:n.bind(a.api)(g,v,m,l==null?void 0:l.node(),_))!=null?i:d&&ma(d)?a.getTooltipPositionViewBox.bind(a)(v,m,_):a.getTooltipPosition.bind(a)(v,m,_);["top","left"].forEach(y=>{const T=b[y];c.style(y,`${T}px`),y==="left"&&!f.xPosInPercent&&(f.xPosInPercent=T/r.current.width*100)})}},getTooltipPositionViewBox(e,t,n){var i,a;const s=this,{$el:{eventRect:o,svg:r},config:l,state:c}=s,d=l.axis_rotated,u=s.hasArcType()||c.hasFunnel||c.hasTreemap,h=(a=(i=u?r:o)==null?void 0:i.node())!=null?a:c.event.target;let{x:f,y:g}=n;c.hasAxis&&(f=d?f:n.xAxis,g=d?n.xAxis:g);const p=pi(h,f,g,!1),x=ht(h),_=pi(h,20,0,!1).x;let v=p.y,m=p.x+e/2+_;return u&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(m-=e/2+_,v+=t):(v+=x.height/2,m+=x.width/2-(e-_))),m+e>x.width&&(m=x.width-e-_),v+t>x.height&&(v-=t*2),{top:v,left:m}},getTooltipPosition(e,t,n){var i,a,s;const o=this,{config:r,scale:l,state:c}=o,{width:d,height:u,current:h,hasFunnel:f,hasRadar:g,hasTreemap:p,isLegendRight:x,inputType:_}=c,v=o.hasType("gauge")&&!r.gauge_fullCircle,m=r.axis_rotated,b=o.hasArcType(),y=c.isCanvasMode?0:o.getSvgLeft(!0);let T=y+h.width-o.getCurrentPaddingByDirection("right");const w=20;let{x:C,y:A}=n;if(g)C+=C>=d/2?15:-(e+15),A+=15;else if(b){if(_!=="touch"){let L=(a=(i=o.getTitlePadding)==null?void 0:i.call(o))!=null?a:0;L&&v&&((s=r.arc_rangeText_values)!=null&&s.length)&&(L+=10),C+=(d-(x?o.getLegendWidth():0))/2,A+=(v?u:u/2+t)+L}}else if(f||p)A+=t;else{const k={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};m?(C+=y+k.left+w,A=k.top+n.xAxis+w,T-=y):(C=y+k.left+w+(l.zoom?C:n.xAxis),A+=k.top-5)}if(C+e+15>T&&(C-=e+(f||p||b?0:m?w*2:38)),A+t>h.height){const k=p?t+10:30;A-=v?t*1.5:t+k}const S={top:A,left:C};return S.top<0&&(S.top=0),S.left<0&&(S.left=0),S},showTooltip(e,t){const n=this,{config:i,$el:{tooltip:a}}=n;if(!a||!i.tooltip_show)return;let s=null,o=0,r=`${n.data.targets.length}:`,l;for(let u=0;u<e.length;u++){const h=e[u];u>0&&(r+=","),r+=`${h==null?void 0:h.index}|${h==null?void 0:h.id}|${h==null?void 0:h.value}`,!l&&h&&(l=h),h&&J(n.getBaseValue(h))?(o++,s==null||s.push(h)):s||(s=e.slice(0,u))}if(o===0||!l)return;const c=a.datum();let d=s;if(!c||c.current!==r){const{index:u,x:h}=l;d||(d=e.slice()),V(i.tooltip_onshow,n.api,e),a.html(n.getTooltipHTML(e,n.axis?n.axis.getXAxisTickFormat():n.categoryName.bind(n),n.getDefaultValueFormat(),n.color)).style("display",null).style("visibility",null),a.datum({index:u,x:h,current:r,data:e,width:a.property("offsetWidth"),height:a.property("offsetHeight")}),V(i.tooltip_onshown,n.api,e),n._handleLinkedCharts(!0,u)}n.setTooltipPosition(d||e,t)},bindTooltipResizePos(){const e=this,{resizeFunction:t,state:n,$el:{tooltip:i}}=e;t.add(()=>{if(i.style("display")==="block"){const{current:a}=n,{width:s,xPosInPercent:o}=i.datum();let r=a.width/100*o;const l=a.width-(r+s);l<0&&(r+=l),i.style("left",`${r}px`)}})},hideTooltip(e){var t;const n=this,{api:i,config:a,$el:{tooltip:s}}=n;if(s&&s.style("display")!=="none"&&(!a.tooltip_doNotHide||e)){const o=(t=s.datum().data)!=null?t:[];V(a.tooltip_onhide,i,o),s.style("display","none").datum(null),V(a.tooltip_onhidden,i,o)}},_handleLinkedCharts(e,t){const n=this,{charts:i,config:a,state:{event:s}}=n;if(s!=null&&s.isTrusted&&a.tooltip_linked&&i.length>1){const o=a.tooltip_linked_name;i.filter(r=>r!==n.api).forEach(r=>{var l,c;const{config:d,$el:u,state:h}=r.internal,f=d.tooltip_linked,g=d.tooltip_linked_name,p=tt.body.contains(u.chart.node());if(f&&o===g&&p){const x=u.tooltip.data()[0],_=t!==(x==null?void 0:x.index);try{e&&_&&h.isCanvasMode?(c=(l=r.internal).showCanvasLinkedTooltip)==null||c.call(l,t):r.tooltip[e&&_?"show":"hide"]({index:t})}catch(v){}}})}},updateTooltipOnRedraw(e,t){var n;const i=this,{config:a,$el:{eventRect:s,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:d,hasTreemap:u}}=i;if(!i.state.isCanvasMode&&(r==null?void 0:r.style("display"))==="block"&&l){const h=e!=null?e:(n=d?o:s)==null?void 0:n.node();if(c||d)if(i.isMultipleX())i.selectRectForMultipleXs(h,!1);else{const f=t!=null?t:i.getDataIndexFromEvent(l);t===-1?i.api.tooltip.hide():(i.selectRectForSingle(h,f),i.setExpand(f,null,!0))}else{const{clientX:f,clientY:g}=l;setTimeout(()=>{let p=[f,g].every(Number.isFinite)&&tt.elementFromPoint(f,g);const x=p&&(0,F.select)(p).datum();if(x){const _=i.hasArcType()?i.convertToArcData(i.updateAngle(x)):x==null?void 0:x.data;u&&(p=o.node()),_&&i.showTooltip([_],p)}else i.api.tooltip.hide()},a.transition_duration)}}}},Ff={getTranslate(e,t=0){var n;const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r=0,l,c;if(t&&/^(x|y2?)$/.test(e)&&(r=i.getAxisSize(e)*t),e==="main")l=sn(s.margin.left),c=sn(s.margin.top);else if(e==="context")l=sn(s.margin2.left),c=sn(s.margin2.top);else if(e==="legend")l=s.margin3.left,c=s.margin3.top;else if(e==="x")l=o?-r:0,c=o?0:s.height+r;else if(e==="y")l=o?0:-r,c=o?s.height+r:0;else if(e==="y2")l=o?0:s.width+r,c=o?-r-1:0;else if(e==="subX")l=0,c=o?0:s.height2;else if(e==="arc")l=s.arcWidth/2,c=s.arcHeight/2,(n=a.arc_rangeText_values)!=null&&n.length&&(c+=5+(i.hasType("gauge")&&a.title_text?10:0));else if(e==="polar")l=s.arcWidth/2,c=s.arcHeight/2;else if(e==="radar"){const[d,u]=i.getRadarSize();l=s.width/2-d,c=s.height/2-u}return`translate(${l}, ${c})`},transformMain(e,t){const n=this,{$el:{main:i},$T:a}=n,s=t!=null&&t.axisX?t.axisX:a(i.select(`.${Rt.axisX}`),e),o=t!=null&&t.axisY?t.axisY:a(i.select(`.${Rt.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:a(i.select(`.${Rt.axisY2}`),e);a(i,e).attr("transform",n.getTranslate("main")),s.attr("transform",n.getTranslate("x")),o.attr("transform",n.getTranslate("y")),r.attr("transform",n.getTranslate("y2")),i.select(`.${et.chartArcs}`).attr("transform",n.getTranslate("arc"))},transformAll(e,t){const n=this,{config:i,state:{hasAxis:a,hasFunnel:s,hasTreemap:o,isCanvasMode:r},$el:l}=n;r||(!s&&!o&&n.transformMain(e,t),a&&i.subchart_show&&n.transformContext(e,t),l.legend&&n.transformLegend(e))}};const Of=new Set(["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"]);var Bf={isValidChartType(e){return!!(e&&Object.values(I).indexOf(e)>-1)},setTargetType(e,t){const n=this,{config:i,state:{withoutFadeIn:a}}=n;n.mapToTargetIds(e).forEach(s=>{a[s]=t===i.data_types[s],i.data_types[s]=t}),e||(i.data_type=t)},updateTypesElements(){const e=this,{state:{current:t}}=e;Object.keys(I).forEach(n=>{const i=I[n],a=e.hasType(i,null,!0),s=t.types.indexOf(i);s===-1&&a?t.types.push(i):s>-1&&!a&&t.types.splice(s,1)}),e.setChartElements()},hasType(e,t,n=!1){var i;const a=this,{config:s,state:{current:o}}=a,r=s.data_types,l=t||a.data.targets;return!n&&((i=o.types)==null?void 0:i.indexOf(e))>-1?!0:l!=null&&l.length?l.some(c=>{const d=r[c.id];return d===e||!d&&e==="line"}):Object.keys(r).length?Object.values(r).some(c=>c===e):s.data_type===e},hasTypeOf(e,t,n=[]){return e in se?!se[e].filter(i=>n.indexOf(i)===-1).every(i=>!this.hasType(i,t)):!1},isTypeOf(e,t){var n;const i=nt(e)?e:e.id,a=this.config&&(((n=this.config.data_types)==null?void 0:n[i])||this.config.data_type);return ot(t)?t.indexOf(a)>=0:a===t},hasPointType(){const e=this;return e.hasTypeOf("Line")||e.hasType("bubble")||e.hasType("scatter")},hasArcType(e,t){return this.hasTypeOf("Arc",e,t)},hasMultiArcGauge(){return this.hasType("gauge")&&this.config.gauge_type==="multi"},isLineType(e){const t=nt(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,se.Line)},isStepType(e){return this.isTypeOf(e,se.Step)},isSplineType(e){return this.isTypeOf(e,se.Spline)},isAreaType(e){return this.isTypeOf(e,se.Area)},isAreaRangeType(e){return this.isTypeOf(e,se.AreaRange)},isBarType(e){return this.isTypeOf(e,"bar")},isBubbleType(e){return this.isTypeOf(e,"bubble")},isCandlestickType(e){return this.isTypeOf(e,"candlestick")},isScatterType(e){return this.isTypeOf(e,"scatter")},isTreemapType(e){return this.isTypeOf(e,"treemap")},isPieType(e){return this.isTypeOf(e,"pie")},isFunnelType(e){return this.isTypeOf(e,"funnel")},isGaugeType(e){return this.isTypeOf(e,"gauge")},isDonutType(e){return this.isTypeOf(e,"donut")},isPolarType(e){return this.isTypeOf(e,"polar")},isRadarType(e){return this.isTypeOf(e,"radar")},isArcType(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)||this.isPolarType(e)||this.isRadarType(e)},isCirclePoint(e){const{config:t}=this,n=t.point_pattern;return(e==null?void 0:e.tagName)==="circle"||t.point_type==="circle"&&(!n||ot(n)&&n.length===0)},lineData(e){return this.isLineType(e)?[e]:[]},arcData(e){return this.isArcType(e.data)?[e]:[]},labelishData(e){return this.isBarType(e)||this.isLineType(e)||this.isScatterType(e)||this.isBubbleType(e)||this.isCandlestickType(e)||this.isFunnelType(e)||this.isRadarType(e)||this.isTreemapType(e)?e.values.filter(t=>X(t.value)||!!t.value):[]},barLineBubbleData(e){return this.isBarType(e)||this.isLineType(e)||this.isBubbleType(e)?e.values:[]},isInterpolationType(e){return Of.has(e)}};const zf={basis:gt.curveBasis,"basis-closed":gt.curveBasisClosed,"basis-open":gt.curveBasisOpen,bundle:gt.curveBundle,cardinal:gt.curveCardinal,"cardinal-closed":gt.curveCardinalClosed,"cardinal-open":gt.curveCardinalOpen,"catmull-rom":gt.curveCatmullRom,"catmull-rom-closed":gt.curveCatmullRomClosed,"catmull-rom-open":gt.curveCatmullRomOpen,"monotone-x":gt.curveMonotoneX,"monotone-y":gt.curveMonotoneY,natural:gt.curveNatural,"linear-closed":gt.curveLinearClosed,linear:gt.curveLinear,step:gt.curveStep,"step-after":gt.curveStepAfter,"step-before":gt.curveStepBefore};function Aa(e,t){var n,i;return e.isLineType(t)||((n=e.isScatterType)==null?void 0:n.call(e,t))||((i=e.isBubbleType)==null?void 0:i.call(e,t))}function Qo(e){return t=>Aa(e,t)}function ka(e,t){var n,i,a;return(n=e.isCandlestickType)!=null&&n.call(e,t)?(a=(i=e.getCandlestickData)==null?void 0:i.call(e,t))==null?void 0:a.close:e.getBaseValue(t)}function Nf(e){var t,n;const i=this;let a;if(Aa(i,e)){const s=Qo(i);a=i.generateGetLinePoints(i.getShapeIndices(s),!1,s)}else i.isBarType(e)?a=i.generateGetBarPoints(i.getShapeIndices(i.isBarType)):(t=i.isCandlestickType)!=null&&t.call(i,e)&&(a=(n=i.generateGetCandlestickPoints)==null?void 0:n.call(i,i.getShapeIndices(i.isCandlestickType)));return a}function tr(e,t,n){return this.config[t]?this.getGradienColortUrl(e.id):n(e)}function er(e){const{$el:t}=this,{elKey:n,className:i,cssRules:a,position:s}=e,o=t.main.select(`.${st.chart}`);t[n]=s==="first"?o.insert("g",":first-child"):o.append("g"),t[n].attr("class",i),a!=null&&a.length&&t[n].call(this.setCssRule(!1,`.${i}`,a))}function La(e,t){const n=this,{$el:i}=n,{type:a,elKey:s,containerClass:o,itemClass:r,initFn:l,withFocus:c=!0,withStyles:d=!0}=t;i[s]||l.call(n);const u=n.getChartClass(a),h=c?n.classFocus.bind(n):()=>"",g=i.main.select(`.${o}`).selectAll(`.${r}`).data(n.filterNullish(e)).attr("class",p=>u(p)+h(p)).enter().append("g").attr("class",u);return d&&g.style("opacity","0").style("pointer-events",n.getStylePropValue("none")),g}var Xf={getDrawShape(){const e=this,t=e.config.axis_rotated,{hasRadar:n,hasTreemap:i}=e.state,a={type:{},indices:{},pos:{}};if(!i&&["bar","candlestick","line","area"].forEach(s=>{const o=Ot(s);if(e.hasType(s)||e.hasTypeOf(o)||s==="line"&&(e.hasType("bubble")||e.hasType("scatter"))){const r=e.getShapeIndices(e[`is${o}Type`]),l=e[`generateDraw${o}`];a.indices[s]=r,a.type[s]=l?l.bind(e)(r,!1):void 0}}),!e.hasArcType()||n||i){let s,o,r,l;i||(s=n?e.radarCircleX:t?e.circleY:e.circleX,o=n?e.radarCircleY:t?e.circleX:e.circleY),i&&e.state.isCanvasMode?r=l=function(){}:(r=e.generateXYForText(a.indices,!0),l=e.generateXYForText(a.indices,!1)),a.pos={xForText:r,yForText:l,cx:(s||function(){}).bind(e),cy:(o||function(){}).bind(e)}}return a},getShapeIndices(e){const t=this,{config:n}=t,i=n.data_xs,a=mt(i),s={};let o=a?{}:0;return a&&Fi(Object.keys(i).map(r=>i[r])).forEach(r=>{o[r]=0,s[r]={}}),t.filterTargetsToShow(t.data.targets.filter(e,t)).forEach(r=>{var l;const c=r.id in i?i[r.id]:"",d=c?s[c]:s;for(let u=0,h;h=n.data_groups[u];u++)if(!(h.indexOf(r.id)<0))for(let f=0,g;g=h[f];f++){if(g in d){d[r.id]=d[g];break}r.id!==g&&c&&(d[g]=(l=d[r.id])!=null?l:o[c])}yt(d[r.id])&&(d[r.id]=c?o[c]++:o++,d.__max__=(c?o[c]:o)-1)}),s},getIndices(e,t,n){const i=this,{data_xs:a,bar_indices_removeNull:s}=i.config,{id:o,index:r}=t;if(i.isBarType(o)&&s){const l={};return i.getAllValuesOnIndex(r,!0).forEach((c,d)=>{l[c.id]=d,l.__max__=d}),l}return mt(a)?e[a[o]]:e},getIndicesMax(e){if(!mt(this.config.data_xs))return e.__max__;let t=0;for(const n in e)t+=e[n].__max__||0;return t},getShapeX(e,t,n){const i=this,{config:a,scale:s}=i,o=n?s.subX:s.zoom||s.x,r=a.bar_overlap,l=a.bar_padding,c=(h,f)=>h+f,d=Yt(e)&&(e._$total.length?e._$total.reduce(c)/2:0),u=[];if(d&&Yt(e)&&e._$total.length){let h=0;for(const f of e._$total)h+=f,u.push(h)}return h=>{var f;const g=i.getIndices(t,h,"getShapeX"),p=h.id in g?g[h.id]:0,x=(g.__max__||0)+1;let _=0;if(mt(h.x)){const v=o(h.x,!0);if(d){const m=e[h.id]||e._$width;_=r?v-m/2:v-m+((f=u[p])!=null?f:e._$total.slice(0,p+1).reduce(c))-d}else _=v-(X(e)?e:e._$width)*(x/2-(r?1:p))}return e&&_&&x>1&&l&&(p&&(_+=l*p),x>2?_-=(x-1)*l/2:x===2&&(_-=l/2)),_}},getShapeY(e){const t=this,n=t.isStackNormalized();return i=>{let{value:a}=i;return X(i)?a=i:t.isAreaRangeType(i)?a=t.getBaseValue(i,"mid"):n?a=t.getRatio("index",i,!0):t.isBubbleZType(i)?a=t.getBubbleZData(i.value,"y"):t.isBarRangeType(i)&&(a=a[1]),t.getYScaleById(i.id,e)(a)}},getShapeYMin(e){const t=this,n=t.axis.getId(e),i=t.scale[n],[a]=i.domain(),s=t.config[`axis_${n}_inverted`];return!t.isGrouped(e)&&!s&&a>0?a:0},getShapeOffsetData(e){const t=this,n=t.orderTargets(t.filterTargetsToShow(t.data.targets.filter(e,t))),i=t.state.dataGeneration,a=n.map(u=>u.id).join("_"),s=`${j.shapeOffset}_${a}`,o=t.cache.get(s);if((o==null?void 0:o.generation)===i)return o;const r=t.isStackNormalized(),l=n.map(u=>{let h=u.values;const f={};t.isStepType(u)&&(h=t.convertValuesToStep(h));const g=h.reduce((p,x)=>{const _=Number(x.x),v=ka(t,x);return p[_]=x,f[_]=r?t.getRatio("index",x,!0):v,p},{});return{id:u.id,rowValues:h,rowValueMapByXValue:g,values:f}}),c=n.reduce((u,{id:h},f)=>(u[h]=f,u),{}),d={generation:i,indexMapByTargetId:c,shapeOffsetTargets:l};return t.cache.add(s,d),d},getShapeOffset(e,t,n){const i=this,{shapeOffsetTargets:a,indexMapByTargetId:s}=i.getShapeOffsetData(e),o=i.config.data_groupsZeroAs;let r=null;if(!i.config.bar_indices_removeNull){r=new Map;for(const l of a){const c=i.getIndices(t,{id:l.id,index:0});r.set(l.id,a.filter(d=>d.id!==l.id&&c[d.id]===c[l.id]))}}return(l,c)=>{var d;const{id:u,value:h,x:f}=l,g=ka(i,l),p=i.getIndices(t,l),x=i.getYScaleById(u,n);if(i.isBarRangeType(l))return x(h[0]);const _=Number(f),v=x(o==="zero"?0:i.getShapeYMin(u));let m=v;const b=(d=r==null?void 0:r.get(u))!=null?d:a.filter(y=>y.id!==u&&p[y.id]===p[u]);for(const y of b){const{id:T,rowValueMapByXValue:w,rowValues:C,values:A}=y;if(s[T]<s[u]){const S=A[_];let k=C[c];(!k||Number(k.x)!==_)&&(k=w[_]);const L=k&&ka(i,k);X(L)&&X(g)&&L*g>=0&&X(S)&&(g!==0||o==="positive"&&S>0||o==="negative"&&S<0)&&(m+=x(S)-v)}}return m}},generateGetLinePoints(e,t,n){const i=this,{config:a}=i,s=i.getShapeX(0,e,t),o=i.getShapeY(t),r=i.getShapeOffset(n||i.isLineType,e,t),l=i.getYScaleById.bind(i);return(c,d)=>{const u=l.call(i,c.id,t)(i.getShapeYMin(c.id)),h=r(c,d)||u,f=s(c);let g=o(c);a.axis_rotated&&(c.value>0&&g<u||c.value<0&&u<g)&&(g=u);const p=[f,g-(u-h)];return[p,p,p,p]}},generateGetAreaPoints(e,t){const n=this,{config:i}=n,a=n.getShapeX(0,e,t),s=n.getShapeY(!!t),o=n.getShapeOffset(n.isAreaType,e,t),r=n.getYScaleById.bind(n),l=new Map;return function(c,d){let u=l.get(c.id);u===void 0&&(u=r.call(n,c.id,t)(n.getShapeYMin(c.id)),l.set(c.id,u));const h=o(c,d)||u,f=a(c),g=c.value;let p=s(c);return i.axis_rotated&&(g>0&&p<u||g<0&&u<p)&&(p=u),[[f,h],[f,p-(u-h)],[f,p-(u-h)],[f,h]]}},generateGetBarPoints(e,t){const n=this,{config:i}=n,a=t?n.axis.subX:n.axis.x,s=n.getIndicesMax(e)+1,o=n.getBarW("bar",a,s),r=n.getShapeX(o,e,!!t),l=n.getShapeY(!!t),c=n.getShapeOffset(n.isBarType,e,!!t),d=n.getYScaleById.bind(n),u=new Map;return(h,f)=>{const{id:g}=h;let p=u.get(g);p||(p={y0:d.call(n,g,t)(n.getShapeYMin(g)),isInverted:i[`axis_${n.axis.getId(g)}_inverted`]},u.set(g,p));const{y0:x,isInverted:_}=p,v=c(h,f)||x,m=X(o)?o:o[h.id]||o._$width,b=h.value,y=r(h);let T=l(h);i.axis_rotated&&!_&&(b>0&&T<x||b<0&&x<T)&&(T=x),n.isBarRangeType(h)||(T-=x-v);const w=y+m;return[[y,v],[y,T],[w,T],[w,v]]}},circleY(e,t){const n=this,i=e.id;let a;return n.isGrouped(i)&&(a=Nf.bind(n)(e)),a?a(e,t)[0][1]:n.getYScaleById(i)(n.getBaseValue(e))},circleX(e){return this.xx(e)},updateCircleY(e=!1){const t=this,n=Qo(t),i=t.generateGetLinePoints(t.getShapeIndices(n),e,n);return(a,s)=>{const o=a.id;return t.isGrouped(o)&&Aa(t,a)?i(a,s)[0][1]:t.getYScaleById(o,e)(t.getBaseValue(a))}},pointR(e){const t=this,{config:n}=t,i=n.point_r;let a=i;return t.isBubbleType(e)?a=t.getBubbleR(e):O(i)&&(a=i.bind(t.api)(e)),e.r=a,a},pointExpandedR(e){const t=this,{config:n}=t,i=t.isBubbleType(e)?1.15:1.75;return n.point_focus_expand_enabled?n.point_focus_expand_r||t.pointR(e)*i:t.pointR(e)},pointSelectR(e){const t=this,n=t.config.point_select_r;return O(n)?n(e):n||t.pointR(e)*4},isPointFocusOnly(){const e=this;return e.config.point_focus_only&&!e.hasType("bubble")&&!e.hasType("scatter")&&!e.hasArcType(null,["radar"])},getPointSensitivity(e){const t=this;let n=t.config.point_sensitivity;if(e)O(n)?n=n.call(t.api,e):n==="radius"&&(n=e.r);else return n;return n},getBarW(e,t,n){var i,a,s,o,r;const l=this,{config:c,org:d,scale:u,state:h}=l,f=l.getMaxDataCount(),g=e==="bar"&&((i=c.data_groups)==null?void 0:i.length),p=`${e}_width`,{k:x}=(s=(a=l.getZoomTransform)==null?void 0:a.call(l))!=null?s:{k:1},_=[(o=c.axis_x_min)!=null?o:d.xDomain[0],(r=c.axis_x_max)!=null?r:d.xDomain[1]].map(y=>l.axis.isTimeSeries()?Xt.call(l,y):Number(y));let v=t.tickInterval(f);if(u.zoom&&!l.axis.isCategorized()&&x>1){const y=_.every((T,w)=>T===d.xDomain[w]);v=d.xDomain.map((T,w)=>{const C=y?T:T-Math.abs(_[w]);return u.zoom(C)}).reduce((T,w)=>Math.abs(T)+w)/f}const m=y=>{const T=y?c[p][y]:c[p],w=y?T.ratio:c[`${p}_ratio`],C=y?T.max:c[`${p}_max`],A=X(T)?T:O(T)?T.call(l,h.width,n,f):n?v*w/n:0;return C&&A>C?C:A};let b=m();return!g&&Yt(c[p])&&(b={_$width:b,_$total:[]},l.getTargetsToShow().forEach(y=>{c[p][y.id]&&(b[y.id]=m(y.id),b._$total.push(b[y.id]||b._$width))})),b},getShapeByIndex(e,t,n){const i=this,{$el:a}=i,s=J(t)?`-${t}`:"";let o=a[e];return o&&!o.empty()?o=o.filter(r=>n?r.id===n:!0).filter(r=>J(t)?r.index===t:!0):o=(n?a.main.selectAll(`.${st[`${e}s`]}${i.getTargetSelectorSuffix(n)}`):a.main).selectAll(`.${st[e]}${s}`),o},isWithinShape(e,t){var n;const i=this,a=(0,F.select)(e);let s;return i.isTargetToShow(t.id)?(n=i.hasValidPointType)!=null&&n.call(i,e.nodeName)?s=i.isStepType(t)?i.isWithinStep(e,i.getYScaleById(t.id)(i.getBaseValue(t))):i.isWithinCircle(e,i.isBubbleType(t)?i.pointSelectR(t)*1.5:0):e.nodeName==="path"&&(s=a.classed(st.bar)?i.isWithinBar(e):!0):s=!1,s},getInterpolate(e){const n=this.getInterpolateType(e);return zf[n]},getCurve(e){const t=this;return t.config.axis_rotated&&t.isStepType(e)?i=>{const a=t.getInterpolate(e)(i);return a.orgPoint=a.point,a.pointRotated=function(s,o){this._point===1&&(this._point=2);const r=this._y*(1-this._t)+o*this._t;this._context.lineTo(this._x,r),this._context.lineTo(s,r),this._x=s,this._y=o},a.point=function(s,o){this._point===0?this.orgPoint(s,o):this.pointRotated(s,o)},a}:t.getInterpolate(e)},getInterpolateType(e){const t=this,{config:n}=t,i=n.spline_interpolation_type,a=t.isInterpolationType(i)?i:"cardinal";return t.isSplineType(e)?a:t.isStepType(e)?n.line_step_type:"linear"},isWithinBar(e){const t=Jt(this.state.event,e),n=ko(e),[i,a,s]=n,o=Math.min(i.x,a.x),r=Math.min(i.y,a.y),l=this.config.bar_sensitivity,c=Math.abs(s.x-a.x),d=Math.abs(i.y-a.y),u=o-l,h=o+c+l,f=r+d+l,g=r-l;return u<t[0]&&t[0]<h&&g<t[1]&&t[1]<f}},Gf=Object.defineProperty,Wf=(e,t,n)=>t in e?Gf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zt=(e,t,n)=>Wf(e,typeof t!="symbol"?t+"":t,n);function Vf(e){return e.hasArcType()?"arc charts":e.hasType("funnel")?"funnel chart":null}function Hf(e){var t,n;const{config:i}=e,a=i.render_mode==="canvas"?Vf(e):null;a&&((n=(t=B.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] render.mode='canvas' is ignored for ${a}; falling back to SVG.`),i.render_mode="svg")}class de{constructor(t){zt(this,"api"),zt(this,"config"),zt(this,"cache"),zt(this,"$el"),zt(this,"state"),zt(this,"charts"),zt(this,"data",{xs:{},targets:[]}),zt(this,"axis"),zt(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),zt(this,"org",{xScale:null,xDomain:null}),zt(this,"color"),zt(this,"patterns"),zt(this,"levelColor"),zt(this,"point"),zt(this,"brush"),zt(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const n=this;n.api=t,n.config=new Qe,n.cache=new Ch;const i=new bh;n.$el=i.getStore("element"),n.state=i.getStore("state"),n.$T=n.$T.bind(n)}$T(t,n,i){const{config:a,state:s}=this,o=a.transition_duration,r=a.subchart_show;let l=t;return l&&("tagName"in l&&(l=(0,F.select)(l)),l=(n!==!1&&o||n)&&(!s.zooming||s.dragging)&&!s.resizing&&s.rendered&&!r?l.transition(i).duration(o):l),l}beforeInit(){const t=this;t.callPluginHook("$beforeInit"),V(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),V(t.config.onafterinit,t.api)}init(){const t=this,{config:n,state:i,$el:a}=t,{boost_useCssRule:s,bindto:o}=n;Sh(t),Hf(t);const r=t.hasArcType();if(i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasFunnel=!i.hasAxis&&t.hasType("funnel"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!r&&!i.hasFunnel&&!i.hasTreemap,i.datetimeId=`bb-${+new Date*he()}`,s){const c=tt.createElement("style");c.type="text/css",tt.head.appendChild(c),i.style={rootSelector:`.${i.datetimeId}`,sheet:c.sheet},a.style=c}const l={element:o,classname:"bb"};Q(o)&&(l.element=o.element||"#chart",l.classname=o.classname||l.classname),a.chart=O(l.element.node)?o.element:(0,F.select)(l.element||[]),a.chart.empty()&&(a.chart=(0,F.select)(tt.body.appendChild(tt.createElement("div")))),a.chart.html("").classed(l.classname,!0).classed(i.datetimeId,s).style("position","relative"),t.initParams(),t.initToRender()}initToRender(t){const n=this,{config:i,state:a,$el:{chart:s}}=n,o=()=>Ph(s,{display:"none",visibility:"hidden"}),r=i.render.lazy===!1?!1:i.render.lazy||o(),l=B.MutationObserver;r&&l&&i.render.observe!==!1&&!t&&new l((c,d)=>{o()||(d.disconnect(),!a.rendered&&n.initToRender(!0))}).observe(s.node(),{attributes:!0,attributeFilter:["class","style"]}),(!r||t)&&n.convertData(i,c=>{n.initWithData(c),n.afterInit()})}initParams(){var t,n;const i=this,{config:a,format:s,state:o}=i;if(a.render_mode==="canvas"&&((t=i.prepareCanvasConfig)==null||t.call(i)),i.color=i.generateColor(),i.levelColor=i.generateLevelColor(),a.padding===!1&&(a.axis_x_show=!1,a.axis_y_show=!1,a.axis_y2_show=!1,a.subchart_show=!1),a.render_mode!=="canvas"&&(i.hasPointType()||(n=i.hasLegendDefsPoint)!=null&&n.call(i))&&(i.point=i.generatePoint()),o.hasAxis){i.initClip(),s.extraLineClasses=i.generateExtraLineClass(),s.dataTime=a.data_xLocaltime?hi.timeParse:hi.utcParse,s.axisTime=a.axis_x_localtime?hi.timeFormat:hi.utcFormat;const d=a.zoom_enabled&&a.zoom_type==="drag";s.defaultAxisTime=u=>{const{x:h,zoom:f}=i.scale,g=d?f:f&&h.orgDomain().toString()!==f.domain().toString(),p=u.getMilliseconds()&&".%L"||u.getSeconds()&&".:%S"||u.getMinutes()&&"%I:%M"||u.getHours()&&"%I %p"||u.getDate()!==1&&"%b %d"||g&&u.getDate()===1&&"%b'%y"||u.getMonth()&&"%-m/%-d"||"%Y";return s.axisTime(p)(u)}}const{legend_position:r,legend_inset_anchor:l,axis_rotated:c}=a;o.isLegendRight=r==="right",o.isLegendInset=r==="inset",o.isLegendTop=l==="top-left"||l==="top-right",o.isLegendLeft=l==="top-left"||l==="bottom-left",o.rotatedPadding.top=i.getResettedPadding(o.rotatedPadding.top),o.rotatedPadding.right=c&&!a.axis_x_show?0:30,o.inputType=Dh(a.interaction_inputType_mouse,a.interaction_inputType_touch)}initWithData(t){var n,i,a,s,o,r;const l=this,{config:c,scale:d,state:u,$el:h,org:f}=l,{hasAxis:g,hasFunnel:p,hasTreemap:x}=u,_=c.interaction_enabled,v=l.hasType("polar"),m=c.data_labels_backgroundColors;if(g&&(l.axis=l.getAxisInstance(),c.zoom_enabled&&l.initZoom()),l.data.xs={},l.data.targets=l.convertDataToTargets(t),c.data_filter&&(l.data.targets=l.data.targets.filter(c.data_filter.bind(l.api))),c.data_hide&&l.addHiddenTargetIds(c.data_hide===!0?l.mapToIds(l.data.targets):c.data_hide),c.legend_hide&&l.addHiddenLegendIds(c.legend_hide===!0?l.mapToIds(l.data.targets):c.legend_hide),l.updateSizes(),l.updateScales(!0),g){const{x:T,y:w,y2:C,subX:A,subY:S,subY2:k}=d;T&&(T.domain(on(l.getXDomain(l.data.targets),!c.axis_x_inverted)),A.domain(T.domain()),f.xDomain=T.domain()),w&&(w.domain(l.getYDomain(l.data.targets,"y")),S.domain(w.domain())),C&&(C.domain(l.getYDomain(l.data.targets,"y2")),k&&k.domain(C.domain()))}if(c.render_mode==="canvas"){if(!l.initCanvas)throw Error("[billboard.js] Please import and call canvas() to use render.mode='canvas'.");if(l.bindResize(),l.initCanvas(),c.tooltip_show&&l.initTooltip(),l.callPluginHook("$init"),V(c.oninit,l.api),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();V(c.data_onmin,l.api,T.min),V(c.data_onmax,l.api,T.max)}u.rendered=!0;return}if(h.svg=h.chart.append("svg").style("overflow","hidden").style("display","block"),_&&u.inputType){const T=u.inputType==="touch",{onclick:w,onover:C,onout:A}=c,S=(n=c.interaction_inputType_touch)==null?void 0:n.preventDefault,k=He(S)&&S||!1,L=!isNaN(S)&&S||null,R=T?{passive:!k&&L===null}:void 0;h.svg.on("click",(w==null?void 0:w.bind(l.api))||null).on(T?"touchstart":"mouseenter",(C==null?void 0:C.bind(l.api))||null,R).on(T?"touchend":"mouseleave",(A==null?void 0:A.bind(l.api))||null)}c.svg_classname&&h.svg.attr("class",c.svg_classname);const b=O(c.color_tiles)&&l.patterns;(g||b||v||x||m||(i=l.hasLegendDefsPoint)!=null&&i.call(l))&&(h.defs=h.svg.append("defs"),g&&["id","idXAxis","idYAxis","idGrid"].forEach(T=>{l.appendClip(h.defs,u.clip[T])}),l.generateTextBGColorFilter(m),b&&l.patterns.forEach(T=>h.defs.append(()=>T.node))),l.updateSvgSize(),l.bindResize();const y=h.svg.append("g").classed(Y.main,!0).attr("transform",p||x?null:l.getTranslate("main"));if(h.main=y,c.subchart_show&&l.initSubchart(),c.tooltip_show&&l.initTooltip(),c.title_text&&l.initTitle(),!x&&c.legend_show&&l.initLegend(),c.data_empty_label_text&&y.append("text").attr("class",`${St.text} ${Y.empty}`).attr("text-anchor","middle").attr("dominant-baseline","middle"),g&&(c.regions.length&&((a=l.initRegion)==null||a.call(l)),!c.clipPath&&l.axis.init()),y.append("g").classed(Y.chart,!0).attr("clip-path",g?u.clip.path:null),l.callPluginHook("$init"),l.initChartElements(),g&&(_&&((s=l.initEventRect)==null||s.call(l)),(o=l.initGrid)==null||o.call(l),c.clipPath&&((r=l.axis)==null||r.init())),l.updateTargets(l.data.targets),l.updateDimension(),V(c.oninit,l.api),l.setBackground(),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();V(c.data_onmin,l.api,T.min),V(c.data_onmax,l.api,T.max)}c.tooltip_show&&l.initShowTooltip(),u.rendered=!0}initChartElements(){const t=this,{hasAxis:n,hasRadar:i,hasTreemap:a}=t.state,s=[];if(n){const o=["bar","bubble","candlestick","line"];t.config.bar_front&&o.push(o.shift());for(const r of o){const l=Ot(r);(r==="line"&&t.hasTypeOf(l)||t.hasType(r))&&s.push(l)}}else if(a)s.push("Treemap");else if(t.hasType("funnel"))s.push("Funnel");else{const o=t.hasType("polar"),r=t.hasType("gauge");i||s.push("Arc","Pie"),r?s.push("Gauge"):i?s.push("Radar"):o&&s.push("Polar")}for(const o of s)t[`init${o}`]();mt(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()}setChartElements(){const t=this,{$el:{chart:n,svg:i,defs:a,main:s,tooltip:o,legend:r,title:l,canvas:c,eventOverlay:d,grid:u,needle:h,arcs:f,circle:g,bar:p,candlestick:x,line:_,area:v,text:m}}=t;t.api.$={chart:n,svg:i,canvas:c,eventOverlay:d,defs:a,main:s,tooltip:o,legend:r,title:l,grid:u,arc:f,circles:g,bar:{bars:p},candlestick:x,line:{lines:_,areas:v},needle:h,text:{texts:m}}}setBackground(){const t=this,{config:{background:n},state:i,$el:{svg:a}}=t;if(mt(n)){const s=a.select("g").insert(n.imgUrl?"image":"rect",":first-child");n.imgUrl?s.attr("href",n.imgUrl):n.color&&s.style("fill",n.color).attr("clip-path",i.clip.path),s.attr("class",n.class||null).attr("width","100%").attr("height","100%")}}updateTargets(t){var n,i;const a=this,{hasAxis:s,hasFunnel:o,hasRadar:r,hasTreemap:l}=a.state,c=u=>a[`updateTargetsFor${u}`](t.filter(a[`is${u}Type`].bind(a)));if(a.updateTargetsForText(t),s){const u=["bar","candlestick","line"];for(const h of u){const f=Ot(h);(h==="line"&&a.hasTypeOf(f)||a.hasType(h))&&c(f)}(n=a.updateTargetsForSubchart)==null||n.call(a,t)}else if(a.hasArcType(t)){let u="Arc";r?u="Radar":a.hasType("polar")&&(u="Polar"),c(u)}else o?c("Funnel"):l&&c("Treemap");const d=a.hasType("bubble")||a.hasType("scatter");d&&((i=a.updateTargetForCircle)==null||i.call(a)),a.filterTargetsToShowAtInit(d)}filterTargetsToShowAtInit(t=!1){const n=this,{$el:{svg:i},$T:a}=n;let s=`.${Y.target}`;t&&(s+=`, .${Bt.chartCircles} > .${Bt.circles}`),a(i.selectAll(s).filter(o=>n.isTargetToShow(o.id))).style("opacity",null)}getWithOption(t){const n={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};for(const[i,a]of Object.entries(n)){const s=nt(a)?n[a]:a;n[i]=De(t,`with${i}`,s)}return n}initialOpacity(t){const n=this,{withoutFadeIn:i}=n.state;return n.getBaseValue(t)!==null&&i[t.id]?null:"0"}bindResize(){var t,n;const i=this,{$el:a,config:s,state:o}=i,r=Fh(s.resize_timer),{resize_auto:l}=s,c=[];c.push(()=>V(s.onresize,i.api)),/^(true|parent)$/.test(l)&&c.push(()=>{var d;const u=o.current.width,h=o.current.height;i.setContainerSize(),!(u===o.current.width&&h===o.current.height)&&(o.resizing=!0,s.legend_show&&(i.updateSizes(),o.isCanvasMode?(d=i.updateHtmlLegend)==null||d.call(i):i.updateLegend()),i.api.flush(!1))}),c.push(()=>{V(s.onresized,i.api),o.resizing=!1}),c.forEach(d=>r.add(d)),i.resizeFunction=r,l==="parent"&&B.ResizeObserver?(i.resizeFunction.resizeObserver=new B.ResizeObserver(i.resizeFunction.bind(i))).observe(a.chart.node().parentNode):(l==="parent"&&((n=(t=B.console)==null?void 0:t.warn)==null||n.call(t,"[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize.")),B.addEventListener("resize",i.resizeFunction))}callPluginHook(t,...n){this.config.plugins.forEach(i=>{t==="$beforeInit"&&(i.$$=this,this.api.plugins.push(i)),i[t](...n)})}}Tt(de.prototype,[Kh,qh,Jh,tf,nf,rf,df,Qh,uf,bf,Tf,Bc,Xf,wf,Cf,Ef,Df,$f,Ff,Bf]);const Ra=[le,Kt,Gt,Bi],nr=10,Yf=750,ir=6,jf=2,Uf=1e5,Kf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},vi=new WeakMap;function ar(e){var t,n;(n=(t=B.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] ${e}`)}function bi(e,t){var n;const{config:i}=e,a=(n=i.data_names[t])!=null?n:t;return O(i.legend_format)?i.legend_format(a,t!==a?t:void 0):a}function Zf(e){return`${e}`.replace(/[&<>"']/g,t=>Kf[t])}function qf(e,t){var n,i;const{config:a}=e,s=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],o=((i=e.getValidPointPattern)==null?void 0:i.call(e))||(Array.isArray(a.point_pattern)&&a.point_pattern.length?a.point_pattern:[a.point_type]),r=Math.max(0,s.indexOf(t));return o[r%o.length]||"circle"}function Jf(e,t){const n=Zf(e.color(t)),i=qf(e,t),a='viewBox="0 0 8 8" aria-hidden="true" focusable="false" style="display:block;width:100%;height:100%;overflow:visible;pointer-events:none"',s=`fill="${n}" stroke="${n}"`;return/^rect(angle)?$/i.test(i)?`<svg ${a}><rect x="1" y="1" width="6" height="6" ${s}></rect></svg>`:!i||/^circle$/i.test(i)?`<svg ${a}><circle cx="4" cy="4" r="3" ${s}></circle></svg>`:`<svg ${a}><g ${s}>${me(i)}</g></svg>`}function Qf(e,t){const n=new Map;t.each(function(i){n.set(i,this)}),e.cache.add(j.legendItemMap,n)}function sr(e,t){const{config:n}=e;t.attr("class",function(i){const s=`${(0,F.select)(this).attr("class")||""} ${e.generateClass(H.legendItem,i)}`;return Array.from(new Set(s.trim().split(/\s+/).filter(Boolean))).join(" ")}).style("visibility",i=>e.isLegendToShow(i)?null:"hidden").classed(H.legendItemHidden,i=>!e.isTargetToShow(i)).classed(ee.legendItemInteractive,!!n.interaction_enabled),Qf(e,t)}function tg(e,t){var n;const{legend:i}=e.$el,a=((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t];i==null||i.selectAll(`.${H.legendItem}`).classed(ut.legendItemFocused,s=>a.indexOf(s)>=0).style("opacity",function(s){return a.indexOf(s)>=0?null:e.opacityForUnfocusedLegend.call(e,(0,F.select)(this))})}function eg(e){const{legend:t}=e.$el;t==null||t.selectAll(`.${H.legendItem}`).classed(ut.legendItemFocused,!1).style("opacity",null)}function ng(e,t){var n,i,a;const{state:s}=e,r=(((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t]).filter(e.isTargetToShow,e),l=new Set(r),c=(((i=e.mapToTargetIds)==null?void 0:i.call(e))||[]).filter(d=>!l.has(d)&&e.isTargetToShow(d));s.focusedTargetIds=l,s.defocusedTargetIds=new Set(c),(a=e.renderCanvasFrame)==null||a.call(e,void 0,null,!1)}function or(e){var t,n,i;const{state:a}=e,s=!!((t=a.focusedTargetIds)!=null&&t.size)||!!((n=a.defocusedTargetIds)!=null&&n.size);a.focusedTargetIds=new Set,a.defocusedTargetIds=new Set,s&&((i=e.renderCanvasFrame)==null||i.call(e,void 0,null,!1))}function rr(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function ig(e,t,n){const i=rr(n);e.state.canvasLegendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function lr(e,t){const n=e.state.canvasLegendTouch,i=n&&rr(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>nr||Math.abs(i.clientY-n.y)>nr)}function ag(e,t,n){lr(e,n);const i=e.state.canvasLegendTouch;return e.state.canvasLegendTouch=null,!!i&&i.id===t&&!i.moved}function sg(e,t){e.state.canvasLegendLastTouchClickId=t,e.state.canvasLegendLastTouchClickTime=Date.now()}function og(e,t){const{state:n}=e,i=n.canvasLegendLastTouchClickId===t&&Date.now()-(n.canvasLegendLastTouchClickTime||0)<Yf;return i&&(n.canvasLegendLastTouchClickId=null,n.canvasLegendLastTouchClickTime=0),i}function cr(e,t){const{api:n,config:i,state:a}=e;if(t.on("click dblclick mouseover mouseout touchstart touchmove touchend",null),!i.interaction_enabled)return;const s=i.legend_item_interaction,o=typeof s=="object"&&(s!=null&&s.dblclick)?"dblclick":"click",r=a.inputType==="touch",l=s||O(i.legend_item_onclick),c=r?pr(i):void 0,d=function(u,h){var f;if(!V(i.legend_item_onclick,n,h,!a.hiddenTargetIds.has(h))){const g=(0,F.select)(this);u.type==="dblclick"||u.altKey?a.hiddenTargetIds.size&&!g.classed(H.legendItemHidden)?n.show():(n.hide(),n.show(h)):(n.toggle(h),g.classed(ut.legendItemFocused,!1)),or(e)}r&&((f=e.hideTooltip)==null||f.call(e))};t.on(o,l?function(u,h){r&&u.type==="click"&&og(e,h)||d.call(this,u,h)}:null),r&&o==="click"&&l&&t.on("touchstart",function(u,h){ig(e,h,u)},c).on("touchmove",u=>{lr(e,u)},c).on("touchend",function(u,h){ag(e,h,u)&&(sg(e,h),d.call(this,u,h))},c),!r&&t.on("mouseover",s||O(i.legend_item_onover)?function(u,h){V(i.legend_item_onover,n,h,!a.hiddenTargetIds.has(h))||!a.transiting&&e.isTargetToShow(h)&&(tg(e,h),ng(e,h))}:null).on("mouseout",s||O(i.legend_item_onout)?function(u,h){V(i.legend_item_onout,n,h,!a.hiddenTargetIds.has(h))||(eg(e),or(e))}:null)}function rg(e,t){var n,i;const a=(i=(n=e.$el.chart)==null?void 0:n.node)==null?void 0:i.call(n),s=a==null?void 0:a.ownerDocument;if(!a||!s)return null;const o=s.createElementNS("http://www.w3.org/2000/svg","svg"),r=s.createElementNS("http://www.w3.org/2000/svg","g"),l=s.createElementNS("http://www.w3.org/2000/svg","text");o.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",r.setAttribute("class",H.legendItem),l.textContent=t,r.appendChild(l),o.appendChild(r),a.appendChild(o);const c=ht(l);return o.remove(),c}function dr(e){return/^(indexed|category|log|timeseries)$/.test(e)}function yi(e){return/^(indexed|log|timeseries)$/.test(e)}function lg(e){var t,n;const i=e;return((t=i.changedTouches)==null?void 0:t[0])||((n=i.touches)==null?void 0:n[0])||("clientX"in e?e:null)}function cg(e,t,n=!1){var i,a;const s=Vn(e,t);return s?n?(a=(i=e.hitDetector).findNearestShape)==null?void 0:a.call(i,s[0],s[1]):e.hitDetector.findNearest(s[0],s[1]):null}function dg(e,t){var n;const{config:i,state:a}=e,{height:s,margin:o,width:r,xAxisHeight:l}=a,[c,d]=t,u=o.left,h=o.left+r,f=o.top,g=o.top+s,p=i.axis_x_show?Math.max(l||0,24):0;return(n=e.isMultipleX)!=null&&n.call(e)||a.hasTreemap?!1:i.axis_rotated?d>=f&&d<=g&&c>=u-p&&c<=h:c>=u&&c<=h&&d>=f&&d<=g+p}function ug(e,t){const{state:{height:n,margin:i,width:a}}=e,[s,o]=t;return s>=i.left&&s<=i.left+a&&o>=i.top&&o<=i.top+n}function hg(e,t){var n,i;return e.hitDetector.findNearest(t[0],t[1])||(dg(e,t)?(i=(n=e.hitDetector).findNearestIndexByCoord)==null?void 0:i.call(n,t[0],t[1]):null)}function ur(e,t){var n;const{config:i,state:a}=e,s=e.filterTargetsToShow(e.data.targets),o=gr(e,t),r=i.tooltip_grouped&&!a.hasTreemap&&!o?(n=e.filterByX)==null?void 0:n.call(e,s,t.x):null;return(a.hasTreemap?[t]:o?[t]:i.tooltip_grouped?r!=null&&r.length?r:s.map(l=>l.values[t.index]).filter(Boolean):[t]).map(l=>{var c;return((c=e.addName)==null?void 0:c.call(e,l))||l})}function fg(e,t,n){var i,a;return(i=e.isMultipleX)!=null&&i.call(e)&&!gr(e,t)?[((a=e.addName)==null?void 0:a.call(e,t))||t]:n}function Vn(e,t){const n=lg(t);if(!n)return null;const i=e.$el.canvas.node(),a=ht(i,!0);return[n.clientX-a.left,n.clientY-a.top]}function Ea(e,t){var n,i;if(!Array.isArray(t)||t.length<2)return null;const a=t.slice(0,2);return(i=(n=e.axis)==null?void 0:n.isTimeSeries)!=null&&i.call(n)?a.map(s=>Xt.call(e,s)):a}function Ti(e){const{config:t,state:n}=e;return!t.subchart_show||!n.hasAxis||n.width2<=0||n.height2<=0?null:{x:n.margin2.left,y:n.margin2.top,w:n.width2,h:n.height2}}function gg(e,t){const n=Ti(e);return!!n&&t[0]>=n.x&&t[0]<=n.x+n.w&&t[1]>=n.y&&t[1]<=n.y+n.h}function wi(e){var t,n;const i=Ti(e),a=i?e.config.axis_rotated?i.h:i.w:0,s=(n=(t=e.axis)==null?void 0:t.getExtent)==null?void 0:n.call(t),o=Array.isArray(s)?s.slice(0,2):[];if(o.length===2&&o.every(Number.isFinite)){const r=Math.max(0,Math.min(a,o[0])),l=Math.max(0,Math.min(a,o[1]));return[Math.min(r,l),Math.max(r,l)]}return[0,a]}function Pa(e,t,n=!1){const i=Vn(e,t),a=i&&Ti(e);if(!i||!a||!gg(e,i))return null;const s=e.config.axis_rotated?i[1]-a.y:i[0]-a.x,[o,r]=wi(e);return!n&&(s<o||s>r)?null:Math.max(o,Math.min(r,s))}function pg(e,t,n){const i=Math.min(t,n),a=Math.max(t,n);return[e.scale.subX.invert(i),e.scale.subX.invert(a)]}function hr(e){const{scale:t,state:n}=e,i=n.domain;if(!(i!=null&&i.length)||!t.subX)return null;const a=Ti(e),s=t.subX(i[0]),o=t.subX(i[1]);if(!a||!Number.isFinite(s)||!Number.isFinite(o))return null;const[r,l]=wi(e);return[Math.max(r,Math.min(l,Math.min(s,o))),Math.max(r,Math.min(l,Math.max(s,o)))]}function fr(e,t){const n=hr(e);if(!n)return"select";const[i,a]=n;return Math.abs(t-i)<=ir?"resize-start":Math.abs(t-a)<=ir?"resize-end":t>i&&t<a?"move":"select"}function Da(e,t,n){const[i,a]=wi(e);return[Math.max(i,Math.min(a,t)),Math.max(i,Math.min(a,n))]}function xg(e,t){return/^resize/.test(t)?e.config.axis_rotated?"ns-resize":"ew-resize":t==="move"?"move":"crosshair"}function Ge(e){return e?`${e.id}:${e.index}`:null}function _g(e,t){const n=e.state.canvasSelectionDragIncluded,i=vi.get(e)||new Map,a=new Map,s=new Set,o=[];return t.filter(r=>Ia(e,r)).forEach(r=>{const l=Ge(r);l&&(s.add(l),!a.has(l)&&a.set(l,r))}),a.forEach((r,l)=>{!n.has(l)&&o.push(r)}),i.forEach((r,l)=>{!s.has(l)&&o.push(r)}),vi.set(e,a),{included:s,rows:o}}function mg(e){return e?Array.isArray(e)?e:[e]:null}function Ia(e,t){return t&&Lt(e,t)&&rn(e,t,Ra)&&Ra.some(n=>n(e,t))&&e.config.data_selection_isselectable.bind(e.api)(t)}function Ma(e,t){e.filterTargetsToShow(e.data.targets).filter(n=>rn(e,n,Ra)).forEach(n=>{n.values.forEach(i=>{Ia(e,i)&&t(i)})})}function gr(e,t){return!(e.config.axis_x_forceAsSingle&&e.config.tooltip_grouped)&&($e(e,t)||Fe(e,t))}function vg(e){return e.interaction_inputType_touch!==!1}function pr(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=He(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}function bg(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=He(n)&&n||!1,a=!isNaN(n)&&n||null;let s;return o=>{var r,l;const c=((r=o.changedTouches)==null?void 0:r[0])||((l=o.touches)==null?void 0:l[0]);if(!c)return;const d=c[`client${e.axis_rotated?"Y":"X"}`];o.type==="touchstart"?i?o.preventDefault():a!==null&&(s=d):o.type==="touchmove"&&(i||s===!0||a!==null&&Math.abs(s-d)>=a)&&(s=!0,o.preventDefault())}}function xn(e,t){return t.pointerType!=="mouse"&&e.state.inputType!=="touch"}function yg(e,t){const{state:n}=e,i=Ge(t),a=i&&n.canvasLastInputClickKey===i&&Date.now()-(n.canvasLastInputClickTime||0)<750;return a&&(n.canvasLastInputClickKey=null,n.canvasLastInputClickTime=0),!!a}function Tg(e,t){e.state.canvasLastInputClickKey=Ge(t),e.state.canvasLastInputClickTime=Date.now()}function wg(){var e,t,n;return(n=(t=(e=B.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function xr(e,t=!1){return Array.isArray(e)&&e.length>=2&&e.every(n=>Number.isFinite(+n)&&(!t||+n>0))}function Cg(e,t,n,i=!1){return e.slice(0,2).map((a,s)=>{const o=i?Math.exp(Math.log(+a)+(Math.log(+t[s])-Math.log(+a))*n):+a+(+t[s]-+a)*n;return a instanceof Date||t[s]instanceof Date?new Date(o):o})}function Sg(e){return e.data.targets.reduce((t,n)=>t+n.values.length,0)}function Ag(e){var t,n;const{scale:i}=e,a=e.filterTargetsToShow(e.data.targets);["y","y2"].forEach(s=>{var o;(o=i[s])==null||o.domain(e.getYDomain(a,s))}),(t=i.subY)==null||t.domain(e.getYDomain(a,"y")),(n=i.subY2)==null||n.domain(e.getYDomain(a,"y2"))}const kg={prepareCanvasConfig(){var e,t;const{config:n,state:i}=this;this.warnUnsupportedCanvasOptions(),(e=i.orgConfig)!=null&&e.transition&&Object.prototype.hasOwnProperty.call(i.orgConfig.transition,"duration")&&i.orgConfig.transition.duration&&ar("canvas mode: transition.duration is ignored; canvas redraws synchronously."),n.transition_duration=0,dr(n.axis_x_type)||(n.axis_x_type="indexed"),yi(n.axis_y_type)||(n.axis_y_type="indexed"),yi(n.axis_y2_type)||(n.axis_y2_type="indexed"),(t=this.hasType)!=null&&t.call(this,"bubble")&&(n.point_show=!0,n.point_type="circle")},applyCanvasSubchartDomain(){const e=this,{axis:t,config:n,scale:i,state:a}=e;if(!n.subchart_show||!a.hasAxis||!i.subX)return;!a.rendered&&!a.domain&&n.subchart_init_range&&(a.domain=Ea(e,n.subchart_init_range));const s=Ea(e,a.domain);!s||!e.withinRange(s,e.getZoomDomain("subX",!0),e.getZoomDomain("subX"))||(a.domain=s,i.x.domain(s),t.x.scale(i.x))},setCanvasSubchartDomain(e,t=!0,n=!1){const i=this,{config:a,scale:s,state:o}=i,r=Ea(i,e);if(!(!a.subchart_show||!r||!i.withinRange(r,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))))return o.domain=r,s.zoom=null,t&&i.redraw({withTransition:!1,withY:a.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),n&&a.subchart_onbrush.bind(i.api)(o.domain),o.domain},clearCanvasSubchartDomain(e=!0,t=!1){var n;const i=this,{axis:a,config:s,org:o,scale:r,state:l}=i;s.subchart_show&&(l.domain=void 0,r.zoom=null,(n=o.xDomain)!=null&&n.length&&(r.x.domain(o.xDomain),a.x.scale(r.x)),e&&i.redraw({withTransition:!1,withUpdateXDomain:!0,withUpdateOrgXDomain:!1,withY:s.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t&&s.subchart_onbrush.bind(i.api)(r.x.orgDomain()))},flushCanvasFlow(){var e,t;const{state:n}=this;n.canvasFlowFinish&&(n.canvasFlowFrame!==null&&((t=(e=B).cancelAnimationFrame)==null||t.call(e,n.canvasFlowFrame)),n.canvasFlowFrame=null,n.canvasFlowFinish())},animateCanvasFlow(e){var t,n,i,a,s,o,r,l,c,d,u;const h=this,{axis:f,data:g,org:p,scale:x,state:_}=h,{done:v=()=>{},duration:m,length:b,orgDataCount:y}=e,T=(t=B.requestAnimationFrame)==null?void 0:t.bind(B),w=!!((n=f.isLog)!=null&&n.call(f,"x"));if(!T||!m||!b||!y||Sg(h)>Uf)return!1;const C=x.x.domain().slice(0,2),A=(a=(i=p.xDomain)==null?void 0:i.slice)==null?void 0:a.call(i),S=(l=(o=(s=x.subX)==null?void 0:s.domain)==null?void 0:(r=o.call(s)).slice)==null?void 0:l.call(r);if(!xr(C,w))return!1;const k=g.targets.map($=>$.values.splice(0,b));h.updateXDomain(h.filterTargetsToShow(g.targets),!0,!0);const L=x.x.domain().slice(0,2),R=(d=(c=p.xDomain)==null?void 0:c.slice)==null?void 0:d.call(c);if(g.targets.forEach(($,G)=>{$.values.unshift(...k[G])}),!xr(L,w))return A&&(p.xDomain=A),x.x.domain(C),S&&x.subX.domain(S),f.x.scale(x.x),!1;Ag(h);let E=!1;const P=wg(),D=()=>{var $,G;E||(E=!0,g.targets.forEach(N=>{N.values.splice(0,b)}),R&&(p.xDomain=R),x.x.domain(L),(G=($=x.subX)==null?void 0:$.domain)==null||G.call($,R!=null?R:L),f.x.scale(x.x),_.dirty.data=!0,_._eventRectFingerprint=null,_.canvasShape=null,_._cachedDrawShape=null,h.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),h.updateTypesElements(),_.canvasFlowFrame=null,_.canvasFlowFinish=null,_.flowing=!1,v.call(h.api))},z=$=>{const G=Math.min(1,Math.max(0,($-P)/m)),N=Cg(C,L,G,w);x.x.domain(N),f.x.scale(x.x),_.canvasShape=null,_._cachedDrawShape=null,_._canvasVisibleRangeCache=null,_._canvasXTickValuesCache=null,h.renderCanvasFrame(void 0,null,!1),G<1?_.canvasFlowFrame=T(z):D()};return A&&(p.xDomain=A),x.x.domain(C),S&&x.subX.domain(S),f.x.scale(x.x),_.flowing=!0,_.cancelClick=!0,(u=h.hideTooltip)==null||u.call(h),_.canvasFlowFinish=D,_.canvasFlowFrame=T(z),!0},initCanvas(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.chart.node();i.isCanvasMode=!0,i.canvasInlineStyle.minHeight=s.style.minHeight,B.getComputedStyle(s).position==="static"&&a.chart.style("position","relative"),a.chart.style("min-height",`${i.current.height}px`),t.canvasEngine=new Dd,t.canvasEngine.init(s,i.current.width,t.getCanvasSurfaceHeight()),a.canvas=(0,F.select)(t.canvasEngine.canvas),t.canvasTheme=new Ju,t.canvasTheme.load(s,n.canvas_theme),t.canvasAxisRenderer=new Rd(t.canvasEngine,t.canvasTheme),t.canvasRenderer=new Xu(t.canvasEngine,t.canvasTheme),t.hitDetector=new ih,t.bindCanvasEvents(),n.zoom_enabled&&((e=t.bindZoomEvent)==null||e.call(t))},warnUnsupportedCanvasOptions(){var e,t,n,i;const{config:a}=this;[[!dr(a.axis_x_type),"axis.x.type other than indexed/category/log/timeseries"],[!yi(a.axis_y_type),"axis.y.type other than indexed/log/timeseries"],[!yi(a.axis_y2_type),"axis.y2.type other than indexed/log/timeseries"],[a.boost_useCssRule,"boost.useCssRule"],[(e=this.hasArcType)==null?void 0:e.call(this),"arc charts"],[(t=this.hasType)==null?void 0:t.call(this,"radar"),"radar chart"],[(n=this.hasType)==null?void 0:n.call(this,"polar"),"polar chart"],[(i=this.hasType)==null?void 0:i.call(this,"funnel"),"funnel chart"]].forEach(([o,r])=>{o&&ar(`canvas mode: ${r} is not yet supported.`)})},bindCanvasEvents(){const e=this,{config:t,state:n,$el:i}=e,a=i.canvas.node(),s=bg(t),o=pr(t);a.addEventListener("mousemove",e.onCanvasMouseMove.bind(e)),a.addEventListener("mouseenter",r=>{var l;n.event=r,(l=t.onover)==null||l.bind(e.api)(r)}),a.addEventListener("mouseout",e.onCanvasMouseOut.bind(e)),a.addEventListener("mouseleave",r=>{var l;n.event=r,(l=t.onout)==null||l.bind(e.api)(r)}),a.addEventListener("mousedown",r=>{var l;(l=e.onCanvasSubchartBrushStart)!=null&&l.call(e,r)||e.onCanvasSelectionDragStart(r)}),a.addEventListener("click",e.onCanvasClick.bind(e)),a.addEventListener("pointerdown",e.onCanvasPointerDown.bind(e)),a.addEventListener("pointerenter",e.onCanvasPointerEnter.bind(e)),a.addEventListener("pointermove",e.onCanvasPointerMove.bind(e)),a.addEventListener("pointerup",e.onCanvasPointerUp.bind(e)),a.addEventListener("pointerleave",e.onCanvasPointerOut.bind(e)),a.addEventListener("pointercancel",e.onCanvasPointerCancel.bind(e)),vg(t)&&(a.addEventListener("touchstart",r=>{s(r),e.onCanvasTouchStart(r)},o),a.addEventListener("touchmove",r=>{s(r),e.onCanvasTouchMove(r)},o),a.addEventListener("touchend",e.onCanvasTouchEnd.bind(e),o),a.addEventListener("touchcancel",e.onCanvasTouchCancel.bind(e),o))},updateHtmlLegend(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();if(!i.legend_show||a.hasTreemap){a.hasTreemap?((e=s.legend)==null||e.remove(),s.legend=null):(t=s.legend)==null||t.style("visibility","hidden"),a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0;return}const r=n.mapToIds(n.data.targets).filter(u=>i.data_names[u]!==null);if(i.legend_contents_bindto&&i.legend_contents_template){n.updateHtmlLegendTemplate(r)?(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0,a.legendHasRendered=!0):(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0);return}s.legend||(s.legend=(0,F.select)(o).append("div").classed(H.legend,!0).classed(ee.legend,!0)),s.legend.style("visibility",null);const l=s.legend.selectAll(`button.${H.legendItem}`).data(r,u=>u);l.exit().remove();const c=l.enter().append("button").attr("type","button").attr("data-id",u=>u);c.append("span").classed(H.legendItemTile,!0),c.append("span").classed(ee.legendItemTitle,!0);const d=c.merge(l).attr("class",u=>n.generateClass(H.legendItem,u).trim());sr(n,d),d.select(`.${H.legendItemTile}`).classed(ee.legendItemTileCircle,!i.legend_usePoint&&i.legend_item_tile_type==="circle").style("background-color",u=>i.legend_usePoint?null:n.color(u)).html(u=>i.legend_usePoint?Jf(n,u):""),d.select(`.${ee.legendItemTitle}`).text(u=>bi(n,u)),i.legend_tooltip&&d.attr("title",u=>bi(n,u)),cr(n,d),n.updateHtmlLegendSize(r),n.positionHtmlLegend(),a.legendHasRendered=!0},updateHtmlLegendTemplate(e){const t=this,{api:n,config:i,$el:a}=t,s=(0,F.select)(i.legend_contents_bindto),o=i.legend_contents_template,r=[];let l="";if(s.empty())return!1;e.forEach(d=>{const u=O(o)?me(o.call(n,d,t.color(d),n.data(d)[0].values)):Ue(o,{COLOR:t.color(d),TITLE:d});u&&(r.push(d),l+=u)});const c=s.html(l).classed(H.legend,!0).classed(ee.legend,!1).style("visibility",null).selectAll(function(){return this.children}).data(r);return sr(t,c),cr(t,c),a.legend=s,!0},updateHtmlLegendSize(e){const t=this,{config:n,state:i,$el:a}=t,s=[],o={};let r=0,l=0,c=0;const d=n.legend_contents_bindto&&n.legend_contents_template;if(d)a.legend.selectAll(`.${H.legendItem}`).each(function(u){const h=ht(this,!0),f=`${bi(t,u)}`,g=Math.max(32,f.length*7+24),p=20,x=Math.ceil(h.width||g),_=Math.ceil(h.height||p);s.push(x),r=Math.max(r,x),l=Math.max(l,_)});else if(e.length){const u=i.isLegendRight||i.isLegendInset,h=n.legend_item_tile_type!=="circle",f={width:h?n.legend_item_tile_width:n.legend_item_tile_r*2,height:h?n.legend_item_tile_height:n.legend_item_tile_r*2},g={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},p={offsets:{},widths:{},heights:{},margins:[0],steps:{}},x=e.map((w,C)=>{const A=`${bi(t,w)}`,S=rg(t,A),k=Math.max(32,A.length*7),L=12,R=C===e.length-1,E=n.legend_show&&!t.isLegendToShow(w),P=E?0:((S==null?void 0:S.width)||k)+g.tileWidth+(R&&!u?0:g.padding.right)+n.legend_padding,D=E?0:((S==null?void 0:S.height)||L)+g.padding.top;return g.max.width=Math.max(g.max.width,P),g.max.height=Math.max(g.max.height,D),{id:w,hidden:E,width:P,height:D}}),_=u?t.getLegendHeight():t.getLegendWidth(),v=(w,C,A=!1)=>{let S;A||(S=(_-g.totalLength-C)/2,S<g.posMin&&(S=(_-C)/2,g.totalLength=0,g.step++)),p.steps[w]=g.step,p.margins[g.step]=i.isLegendInset?10:S,p.offsets[w]=g.totalLength,g.totalLength+=C};i.isLegendInset&&(g.step=n.legend_inset_step?n.legend_inset_step:e.length,i.legendStep=g.step),x.forEach(({id:w,hidden:C,width:A,height:S})=>{const k=n.legend_equally&&!C?g.max.width:A,L=n.legend_equally&&!C?g.max.height:S,R=u?L:k;if(p.widths[w]=k,p.heights[w]=L,s.push(k),r=Math.max(r,k),l=Math.max(l,L),C){p.steps[w]=0,p.offsets[w]=0;return}v(w,R)});const m=i.isLegendRight?w=>g.max.width*p.steps[w]:i.isLegendInset?w=>g.max.width*p.steps[w]+10:w=>p.margins[p.steps[w]]+p.offsets[w],b=i.isLegendRight||i.isLegendInset?w=>p.margins[p.steps[w]]+p.offsets[w]:w=>g.max.height*p.steps[w],y=4+f.width,T=9;x.forEach(({id:w,hidden:C})=>{const A=C?0:m(w),S=C?0:b(w);o[w]={item:{x:A,y:S-5,width:p.widths[w],height:p.heights[w]},title:{x:y,y:0,height:p.heights[w]},tile:{x:-2,y:T-f.height/2,width:f.width,height:f.height}}}),c=g.step}if(!e.length){i.legendItemWidth=0,i.legendItemHeight=0,i.legendStep=0;return}if(d){const u=Math.max(1,i.current.width),h=10;let f=1,g=0;s.forEach(p=>{g&&g+h+p>u?(f++,g=p):g+=(g?h:0)+p}),i.legendStep=Math.max(0,f-1)}else i.legendStep=c;i.legendItemWidth=r,i.legendItemHeight=Math.max(12,l),d||a.legend.selectAll(`button.${H.legendItem}`).each(function(u){const h=o[u],f=(0,F.select)(this);h&&(f.style("left",`${h.item.x}px`).style("top",`${h.item.y}px`).style("width",`${h.item.width}px`).style("height",`${h.item.height}px`),f.select(`.${ee.legendItemTitle}`).style("left",`${h.title.x}px`).style("top",`${h.title.y}px`).style("height",`${h.title.height}px`).style("line-height",`${h.title.height}px`),f.select(`.${H.legendItemTile}`).style("left",`${h.tile.x}px`).style("top",`${h.tile.y}px`).style("width",`${h.tile.width}px`).style("height",`${h.tile.height}px`))})},getCanvasBottomLegendHeight(){var e;const t=this,{config:n,state:i,$el:a}=t;if(!n.legend_show||i.isLegendRight||i.isLegendInset||i.hasTreemap||!a.legend||!i.legendItemHeight)return 0;const s=ht(a.legend.node(),!0).height,o=i.legendItemHeight*(i.legendStep+1);return Math.ceil(Math.max(((e=t.getLegendHeight)==null?void 0:e.call(t))||0,s||o))},getCanvasSurfaceHeight(){const e=this;return Math.max(0,e.state.current.height-e.getCanvasBottomLegendHeight())},positionHtmlLegend(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.legend;if(s.classed(ee.legendBottom,!i.isLegendRight&&!i.isLegendInset).classed(ee.legendRight,i.isLegendRight).classed(ee.legendInset,i.isLegendInset).style("top",null).style("right",null).style("bottom",null).style("left",null).style("width",null).style("height",null).style("min-height",null),i.isLegendRight)s.style("top",`${i.margin3.top}px`).style("right","0").style("bottom",`${i.margin3.bottom}px`).style("width",`${Math.max(0,t.getLegendWidth())}px`);else if(i.isLegendInset){if(i.isLegendInset){const o=i.isLegendTop,r=i.isLegendLeft;s.style(o?"top":"bottom",`${n.legend_inset_y}px`).style(r?"left":"right",`${n.legend_inset_x}px`).style("width",`${Math.max(0,i.legendItemWidth*(i.legendStep+1)+20)}px`)}}else{const o=((e=t.getLegendHeight)==null?void 0:e.call(t))||0;s.style("top",`${Math.max(0,i.current.height-o)}px`).style("right","0").style("bottom","auto").style("left","0")}},getCanvasSelectedData(e){const t=this,n=t.state.canvasSelection,i=[];return!t.config.data_selection_enabled||!(n!=null&&n.size)||Ma(t,a=>{(!e||a.id===e)&&n.has(Ge(a))&&i.push(a)}),i},setCanvasSelection(e=!1,t,n,i){var a;const s=this,{config:o,state:r}=s,l=r.canvasSelection,c=o.data_selection_grouped,d=mg(t);let u=!1;o.data_selection_enabled&&(Ma(s,h=>{const f=Ge(h),g=c||!d||d.indexOf(h.id)>=0,p=!n||n.indexOf(h.index)>=0,x=l.has(f);e?g&&p&&!x?(l.add(f),V(o.data_onselected,s.api,h,s.canvasEngine.canvas),u=!0):i&&x&&(l.delete(f),V(o.data_onunselected,s.api,h,s.canvasEngine.canvas),u=!0):g&&p&&x&&(l.delete(f),V(o.data_onunselected,s.api,h,s.canvasEngine.canvas),u=!0)}),u&&((a=s.renderCanvasFrame)==null||a.call(s,void 0,null,!1)))},toggleCanvasSelection(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelection;let o=!1;i.data_selection_enabled&&(e.filter(r=>Ia(n,r)).forEach(r=>{const l=Ge(r),c=s.has(l);i.data_selection_multiple||Ma(n,d=>{const u=Ge(d);(i.data_selection_grouped?d.id===r.id:u!==l)&&s.has(u)&&(s.delete(u),V(i.data_onunselected,n.api,d,n.canvasEngine.canvas),o=!0)}),c&&s.has(l)?(s.delete(l),V(i.data_onunselected,n.api,r,n.canvasEngine.canvas)):(s.add(l),V(i.data_onselected,n.api,r,n.canvasEngine.canvas)),o=!0}),o&&((t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1)))},canStartCanvasSelectionDrag(e){const t=this,{config:n}=t,i=e;return!!(n.interaction_enabled&&n.data_selection_enabled&&n.data_selection_draggable&&n.data_selection_multiple&&!n.zoom_enabled&&(i.button===void 0||i.button===0))},getCanvasSelectionDragData(e){const t=this,{config:n}=t,i=t.hitDetector.findInRect(e,n.data_selection_grouped);if(!n.data_selection_grouped)return i;const a=new Set(i.map(s=>s.index));return t.filterTargetsToShow(t.data.targets).flatMap(s=>s.values.filter(o=>a.has(o.index)))},startCanvasSelectionDrag(e){var t,n;const i=this,{state:a}=i,s=Vn(i,e);return!s||!i.canStartCanvasSelectionDrag(e)?!1:(a.dragStart=s,a.canvasSelectionDragStart=s,a.canvasSelectionDragIncluded=new Set,a.canvasSelectionDragging=!0,a.canvasSelectionDragMoved=!1,vi.set(i,new Map),i.setDragStatus(!0),(t=i.hideTooltip)==null||t.call(i),(n=e.preventDefault)==null||n.call(e),!0)},updateCanvasSelectionDrag(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelectionDragStart,o=Vn(n,e);if(!a.canvasSelectionDragging||!s||!o)return!1;const[r,l]=s,[c,d]=o,u=Math.min(r,c),h=Math.max(r,c),f=i.data_selection_grouped?a.margin.top:Math.min(l,d),g=i.data_selection_grouped?a.margin.top+a.height:Math.max(l,d),p={x:u,y:f,w:h-u,h:g-f},x=Math.abs(c-r)>4||Math.abs(d-l)>4;if(a.canvasSelectionDragMoved=a.canvasSelectionDragMoved||x,x){const{included:_,rows:v}=_g(n,n.getCanvasSelectionDragData(p));v.length&&n.toggleCanvasSelection(v),a.canvasSelectionDragIncluded=_,a.cancelClick=!0}return n.renderCanvasSelectionDrag(p),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSelectionDrag(e){var t;const n=this,{state:i}=n;return i.canvasSelectionDragging?(n.updateCanvasSelectionDrag(e),i.cancelClick=i.cancelClick||i.canvasSelectionDragMoved,i.dragStart=null,i.canvasSelectionDragStart=null,i.canvasSelectionDragIncluded=new Set,i.canvasSelectionDragging=!1,i.canvasSelectionDragMoved=!1,vi.delete(n),n.setDragStatus(!1),n.clearCanvasFocus(),(t=e.preventDefault)==null||t.call(e),!0):!1},dispatchCanvasDataOut(e){const t=this,{config:n,state:i}=t,a=i.canvasDataHover;a&&(i.canvasDataHover=null,i.canvasDataHoverKey=null,n.interaction_enabled&&V(n.data_onout,t.api,a,e))},dispatchCanvasDataOver(e,t){const n=this,{config:i,state:a}=n,s=Ge(e);a.canvasDataHoverKey!==s&&(n.dispatchCanvasDataOut(t),a.canvasDataHover=e,a.canvasDataHoverKey=s,i.interaction_enabled&&e&&V(i.data_onover,n.api,e,t))},dispatchCanvasDataClick(e,t=!1){var n;const i=this,{config:a,$el:s}=i,o=s.canvas.node(),r=cg(i,e,!0);if(!r||yg(i,r))return r;if(a.interaction_enabled){const l=a.data_selection_grouped?i.filterTargetsToShow(i.data.targets).map(c=>c.values[r.index]).filter(Boolean):[r];(n=i.toggleCanvasSelection)==null||n.call(i,l),l.forEach(c=>V(a.data_onclick,i.api,c,o)),t&&Tg(i,r)}return r},updateCanvasSubchartBrush(e){var t,n;const i=this,{state:a}=i,s=a.canvasSubchartBrushStart,o=a.canvasSubchartBrushOrigin,r=a.canvasSubchartBrushMode,l=Pa(i,e,!0);if(!a.canvasSubchartBrushDragging||s===null||l===null||!r)return!1;const c=l-s;if(Math.abs(c)>jf&&(a.canvasSubchartBrushMoved=!0),!a.canvasSubchartBrushMoved)return(t=e.preventDefault)==null||t.call(e),!0;let d;if(r==="move"&&o){const[h,f]=wi(i),g=o[1]-o[0];let p=o[0]+c,x=o[1]+c;p<h&&(x+=h-p,p=h),x>f&&(p-=x-f,x=f),d=[Math.max(h,Math.min(f-g,p)),Math.min(f,Math.max(h+g,x))]}else r==="resize-start"&&o?d=Da(i,l,o[1]):r==="resize-end"&&o?d=Da(i,o[0],l):d=Da(i,s,l);const u=pg(i,d[0],d[1]);return i.setCanvasSubchartDomain(u,!0),a.cancelClick=!0,(n=e.preventDefault)==null||n.call(e),!0},updateCanvasSubchartCursor(e){const t=this,n=t.$el.canvas.node(),i=Pa(t,e);if(i===null)return n.style.cursor="",!1;const a=fr(t,i);return n.style.cursor=xg(t,a),!0},startCanvasSubchartBrush(e){var t;const n=this,{state:i}=n,a=Pa(n,e);if(a===null)return!1;const s=fr(n,a);return i.event=e,i.canvasSubchartBrushDragging=!0,i.canvasSubchartBrushMode=s,i.canvasSubchartBrushStart=a,i.canvasSubchartBrushOrigin=hr(n),i.canvasSubchartBrushMoved=!1,i.cancelClick=!0,n.setDragStatus(!0),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSubchartBrush(e){var t,n,i;const a=this,{state:s}=a;if(!s.canvasSubchartBrushDragging)return!1;a.updateCanvasSubchartBrush(e);const o=s.canvasSubchartBrushMode==="select"&&!s.canvasSubchartBrushMoved,r=s.canvasSubchartBrushMoved||o;return o?(t=a.clearCanvasSubchartDomain)==null||t.call(a,!0,!0):r&&a.config.subchart_onbrush.bind(a.api)((n=s.domain)!=null?n:a.scale.x.orgDomain()),s.canvasSubchartBrushDragging=!1,s.canvasSubchartBrushMode=null,s.canvasSubchartBrushStart=null,s.canvasSubchartBrushOrigin=null,s.canvasSubchartBrushMoved=!1,a.setDragStatus(!1),(i=e.preventDefault)==null||i.call(e),!0},cancelCanvasSubchartBrush(e){var t;const n=this,{state:i}=n;return i.canvasSubchartBrushDragging?(i.canvasSubchartBrushDragging=!1,i.canvasSubchartBrushMode=null,i.canvasSubchartBrushStart=null,i.canvasSubchartBrushOrigin=null,i.canvasSubchartBrushMoved=!1,n.setDragStatus(!1),(t=e.preventDefault)==null||t.call(e),!0):!1},onCanvasSubchartBrushStart(e){const t=this;if(!t.startCanvasSubchartBrush(e))return!1;const n=a=>{t.updateCanvasSubchartBrush(a)},i=a=>{t.endCanvasSubchartBrush(a),B.removeEventListener("mousemove",n),B.removeEventListener("mouseup",i)};return B.addEventListener("mousemove",n),B.addEventListener("mouseup",i),!0},onCanvasClick(e){var t;const n=this,{config:i,state:a}=n;if(a.event=e,a.flowing||a.cancelClick){a.cancelClick=!1;return}n.dispatchCanvasDataClick(e),(t=i.onclick)==null||t.bind(n.api)(e)},onCanvasSelectionDragStart(e){const t=this,{state:n}=t;if(!t.startCanvasSelectionDrag(e))return;const i=s=>{t.updateCanvasSelectionDrag(s)},a=s=>{t.endCanvasSelectionDrag(s),B.removeEventListener("mousemove",i),B.removeEventListener("mouseup",a),n.canvasSelectionDragMoveHandler=null,n.canvasSelectionDragEndHandler=null};n.canvasSelectionDragMoveHandler=i,n.canvasSelectionDragEndHandler=a,B.addEventListener("mousemove",i),B.addEventListener("mouseup",a)},onCanvasPointerDown(e){var t;if(!xn(this,e))return;const n=this,i=n.$el.canvas.node();if(!n.startCanvasSubchartBrush(e))return;const a=e.pointerId,s=d=>d.pointerId===a,o=d=>{s(d)&&n.updateCanvasSubchartBrush(d)},r=d=>{s(d)&&(n.endCanvasSubchartBrush(d),c())},l=d=>{s(d)&&(n.cancelCanvasSubchartBrush(d),c())};function c(){var d;B.removeEventListener("pointermove",o),B.removeEventListener("pointerup",r),B.removeEventListener("pointercancel",l);try{(d=i.releasePointerCapture)==null||d.call(i,a)}catch(u){}}try{(t=i.setPointerCapture)==null||t.call(i,a)}catch(d){}B.addEventListener("pointermove",o),B.addEventListener("pointerup",r),B.addEventListener("pointercancel",l)},onCanvasPointerEnter(e){var t;xn(this,e)&&(this.state.event=e,(t=this.config.onover)==null||t.bind(this.api)(e))},onCanvasPointerMove(e){xn(this,e)&&(this.updateCanvasSubchartBrush(e)||this.onCanvasMouseMove(e))},onCanvasPointerUp(e){var t;if(xn(this,e)){if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node())}},onCanvasPointerOut(e){var t;xn(this,e)&&(this.state.canvasSubchartBrushDragging||(this.state.event=e,this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)))},onCanvasPointerCancel(e){var t;if(xn(this,e)){if(this.state.event=e,this.cancelCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.onCanvasPointerOut(e)}},onCanvasTouchStart(e){var t;e.touches.length>1||(this.state.event=e,!this.startCanvasSubchartBrush(e)&&(this.startCanvasSelectionDrag(e)||((t=this.config.onover)==null||t.bind(this.api)(e),this.onCanvasMouseMove(e))))},onCanvasTouchMove(e){e.touches.length>1||this.updateCanvasSubchartBrush(e)||this.updateCanvasSelectionDrag(e)||this.onCanvasMouseMove(e)},onCanvasTouchEnd(e){var t,n,i;if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}if(this.endCanvasSelectionDrag(e)){(n=this.config.onout)==null||n.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node()),(i=this.config.onout)==null||i.bind(this.api)(e)},onCanvasTouchCancel(e){var t;this.state.event=e,this.cancelCanvasSubchartBrush(e),this.endCanvasSelectionDrag(e),this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)},onCanvasMouseMove(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:c}=o,d=c.canvas.node();if(l.event=e,l.flowing||l.canvasSelectionDragging)return;if((t=o.updateCanvasSubchartCursor)!=null&&t.call(o,e)){o.dispatchCanvasDataOut(d),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),(n=o.hideTooltip)==null||n.call(o);return}const u=Vn(o,e),h=u?hg(o,u):null;if(!h){if(o.dispatchCanvasDataOut(d),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),u&&r.axis_tooltip&&ug(o,u)){o.renderCanvasAxisTooltip(u),(i=o.hideTooltip)==null||i.call(o);return}(a=o.hideTooltip)==null||a.call(o);return}o.dispatchCanvasDataOver(h,d);const f=ur(o,h),g=fg(o,h,f),p=g.map(x=>`${x.id}:${x.index}`).join("|");(l.canvasFocusKey!==p||r.axis_tooltip)&&(l.canvasFocusKey=p,o.renderCanvasFocus(g,u)),(s=o.showTooltip)==null||s.call(o,f,d)},onCanvasMouseOut(){var e;const t=this.$el.canvas.node();t.style.cursor="",this.dispatchCanvasDataOut(t),this.state.canvasFocusKey?(this.state.canvasFocusKey=null,this.clearCanvasFocus()):this.config.axis_tooltip&&this.clearCanvasFocus(),(e=this.hideTooltip)==null||e.call(this)},showCanvasLinkedTooltip(e){var t,n,i,a;const s=this,{$el:o,state:r}=s,l=(t=o.canvas)==null?void 0:t.node(),d=s.filterTargetsToShow(s.data.targets).map(_=>_.values[e]).find(Boolean);if(!l||!d)return(n=s.hideTooltip)==null||n.call(s),!1;const u=ur(s,d),h=u.find(_=>_&&Lt(s,_))||u[0];if(!u.length||!h)return(i=s.hideTooltip)==null||i.call(s),!1;const{left:f,top:g}=ht(l,!0),p=Pn(s,h),x=[r.margin.left+p.x,r.margin.top+p.y];return r.event={clientX:f+x[0],clientY:g+x[1],currentTarget:l,target:l},r.canvasFocusKey=u.map(_=>`${_.id}:${_.index}`).join("|"),s.renderCanvasFocus(u,x),(a=s.showTooltip)==null||a.call(s,u,l),!0},renderCanvasZoomBrush(e,t){const n=this;n.canvasEngine.withOverlay(i=>{n.canvasRenderer.withContext(i,()=>{n.canvasRenderer.drawZoomBrush(n,e,t)})})},clearCanvasZoomBrush(){this.canvasEngine.clearOverlay()},renderCanvasSelectionDrag(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasRenderer.withContext(n,()=>{t.canvasRenderer.drawSelectionDragArea(t,e)})})},renderCanvasFrame(e,t,n=!1){const i=this,{state:a}=i,s=e||a.canvasShape||i.getDrawShape();a.canvasShape=s,a._canvasVisibleRangeCache=null,a._canvasXTickValuesCache=null,i.canvasEngine.beginFrame(a.current.width,i.getCanvasSurfaceHeight());try{i.canvasRenderer.drawBackground(i),i.canvasAxisRenderer.drawTitle(i),a.hasAxis&&i.canvasAxisRenderer.draw(i),i.canvasRenderer.draw(i,s),a.hasAxis&&i.config.grid_lines_front&&i.canvasAxisRenderer.drawGridLines(i),i.canvasRenderer.drawSubchart(i,s),a.hasAxis&&i.canvasAxisRenderer.drawSubXAxis(i),i.canvasRenderer.drawEmptyLabel(i),n&&i.hitDetector.rebuild(i,s)}finally{i.canvasEngine.endFrame()}i.canvasEngine.clearOverlay(),a.canvasFocusMainRedraw=!1,t&&i.renderCanvasFocus(t)},renderCanvasFocus(e,t){var n,i;const a=this,{state:s}=a,o=(i=(n=a.canvasRenderer).hasExpandedShapeFocus)==null?void 0:i.call(n,a,e);if(o){const r=s.canvasShape||a.getDrawShape();a.canvasEngine.beginFrame(s.current.width,a.getCanvasSurfaceHeight());try{a.canvasRenderer.drawBackground(a),a.canvasAxisRenderer.drawTitle(a),s.hasAxis&&a.canvasAxisRenderer.draw(a),a.canvasRenderer.draw(a,r,e),s.hasAxis&&a.config.grid_lines_front&&a.canvasAxisRenderer.drawGridLines(a),a.canvasRenderer.drawSubchart(a,r),s.hasAxis&&a.canvasAxisRenderer.drawSubXAxis(a),a.canvasRenderer.drawEmptyLabel(a)}finally{a.canvasEngine.endFrame()}}s.canvasFocusMainRedraw=!!o,a.canvasEngine.withOverlay(r=>{a.canvasRenderer.withContext(r,()=>{a.canvasRenderer.drawFocus(a,e)}),a.canvasAxisRenderer.withContext(r,()=>{a.canvasAxisRenderer.drawFocusedXAxisTick(a,e),t&&a.canvasAxisRenderer.drawAxisTooltip(a,t)})})},renderCanvasAxisTooltip(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasAxisRenderer.withContext(n,()=>{t.canvasAxisRenderer.drawAxisTooltip(t,e)})})},clearCanvasFocus(){var e;const t=this;t.state.canvasFocusMainRedraw?(t.state.canvasFocusMainRedraw=!1,t.renderCanvasFrame(void 0,null,!1)):(e=t.canvasEngine)==null||e.clearOverlay()},resizeCanvas(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();s.chart.style("min-height",`${a.current.height}px`),(e=n.canvasEngine)==null||e.resize(a.current.width,n.getCanvasSurfaceHeight()),(t=n.canvasTheme)==null||t.reload(o,i.canvas_theme)}};let _r=()=>(Tt(de.prototype,kg),(_r=()=>"canvas")());var mr={category(e,t){const n=this.internal,{config:i}=n;return arguments.length>1&&(i.axis_x_categories[e]=t,n.state.dirty.data=!0,n.redraw()),i.axis_x_categories[e]},categories(e){const t=this.internal,{config:n}=t;if(!e||!Array.isArray(e)){const i=n.axis_x_categories;return Qt(i)?Object.values(t.data.xs)[0]:i}return n.axis_x_categories=e,t.state.dirty.data=!0,t.redraw(),n.axis_x_categories}};function Lg(e){const t=this.config;let n,i,a;const s=()=>{const o=i.shift();if(o&&n&&Yt(n)&&o in n)return n=n[o],s();if(!o)return n};Object.keys(t).forEach(o=>{n=e,i=o.split("_"),a=s(),ct(a)&&(t[o]=a)}),this.api&&(this.state.orgConfig=e)}var Rg={resize(e){const t=this.internal,{config:n,state:i}=t;i.rendered&&(n.size_width=e?e.width:null,n.size_height=e?e.height:null,i.resizing=!0,i.dirty.size=!0,this.flush(!1),t.resizeFunction())},flush(e){var t,n;const i=this.internal,{state:a,$el:{zoomResetBtn:s}}=i;a.rendered?(a.resizing?(t=i.brush)==null||t.updateResize():(n=i.axis)==null||n.setOrient(),s==null||s.style("display","none"),i.scale.zoom&&(a.current.zoomDomain=i.scale.zoom.domain()),i.scale.zoom=null,a.resizing||(a.dirty.data=!0),e?i.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):i.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1}),!a.resizing&&i.brush&&(i.brush.getSelection().call(i.brush.move),i.unselectRect()),a.current.zoomDomain&&(i.api.zoom(a.current.zoomDomain),a.current.zoomDomain=null)):i.initToRender(!0)},destroy(){var e,t,n,i,a,s,o,r,l,c;const d=this.internal,{state:u,$el:{chart:h,style:f,svg:g}}=d;if(mt(d)){d.callPluginHook("$willDestroy"),(e=d.cache)==null||e.remove(["setOverOut","callOverOutForTouch"]),d.charts.splice(d.charts.indexOf(this),1),d.charts.length===0&&Nh(),d.unbindAllEvents(),g==null||g.select("*").interrupt(),u.canvasFlowFrame!==null&&((n=(t=B).cancelAnimationFrame)==null||n.call(t,u.canvasFlowFrame)),u.canvasFlowFrame=null,u.canvasFlowFinish=null,u.pendingRaf!==null&&((a=(i=B).cancelAnimationFrame)==null||a.call(i,u.pendingRaf)),u.pendingRaf=null,(s=d.canvasRenderer)==null||s.destroy(),(o=d.canvasEngine)==null||o.destroy(),(r=d.resizeFunction)==null||r.clear(),(c=(l=d.resizeFunction)==null?void 0:l.resizeObserver)==null||c.disconnect(),d.resizeFunction&&B.removeEventListener("resize",d.resizeFunction),h.classed("bb",!1).style("position",null),u.isCanvasMode&&h.style("min-height",u.canvasInlineStyle.minHeight||null),h.selectChildren().remove(),f&&f.parentNode.removeChild(f),Object.keys(this).forEach(p=>{p==="internal"&&Object.keys(d).forEach(x=>{d[x]=null}),this[p]=null,delete this[p]});for(const p in this)this[p]=()=>{}}return null},config(e,t,n){const i=this.internal,{config:a,state:s}=i,o=e==null?void 0:e.replace(/\./g,"_");let r;return e&&o in a?ct(t)?(a[o]=t,r=t,n&&this.flush()):r=a[o]:(arguments.length===0||Qt(e))&&(r=s.orgConfig),r}},Eg={color(e){return this.internal.color(e)}};const vr=function(e){const{targets:t}=this.internal.data;if(!yt(e)){const n=ot(e)?e:[e];return t.filter(i=>n.some(a=>a===i.id))}return t};Tt(vr,{shown:function(e){return this.internal.filterTargetsToShow(this.data(e))},values:function(e,t=!0){let n=null;if(e){const i=this.data(e);ot(i)&&(n=[],i.forEach(a=>{const s=a.values.map(o=>o.value);t?n=n.concat(s):n.push(s)}))}return n},names:function(e){return this.internal.updateDataAttributes("names",e)},colors:function(e){return this.internal.updateDataAttributes("colors",e)},axes:function(e){return this.internal.updateDataAttributes("axes",e)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});var Pg={data:vr},Dg={focus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n),r=new Set(o),l=n.mapToTargetIds().filter(c=>!r.has(c)&&n.isTargetToShow(c));n.revertLegend(),n.toggleFocusLegend(l,!1),n.toggleFocusLegend(o,!0),i.focusedTargetIds=r,i.defocusedTargetIds=new Set(l),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}const s=n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n)));this.revert(),this.defocus(),s.classed(ut.focused,!0).classed(ut.defocused,!1),n.hasArcType()&&!i.hasRadar&&(n.expandArc(a),n.hasType("gauge")&&n.markOverlapped(e,n,`.${qt.gaugeValue}`)),n.toggleFocusLegend(a,!0),i.focusedTargetIds=new Set(a),a.forEach(o=>i.defocusedTargetIds.delete(o))},defocus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n);n.toggleFocusLegend(o,!1),o.forEach(r=>i.focusedTargetIds.delete(r)),i.defocusedTargetIds=new Set(o),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n))).classed(ut.focused,!1).classed(ut.defocused,!0),n.hasArcType(null,["polar"])&&(n.unexpandArc(a),n.hasType("gauge")&&n.undoMarkOverlapped(n,`.${qt.gaugeValue}`)),n.toggleFocusLegend(a,!1),a.forEach(o=>i.focusedTargetIds.delete(o)),i.defocusedTargetIds=new Set(a)},revert(e){var t,n,i;const a=this.internal,{config:s,state:o,$el:r}=a,l=a.mapToTargetIds(e),c=()=>{s.legend_show&&(a.showLegend(l.filter(a.isLegendToShow.bind(a))),r.legend.selectAll(a.selectorLegends(l)).filter(function(){return(0,F.select)(this).classed(ut.legendItemFocused)}).classed(ut.legendItemFocused,!1))};if(o.isCanvasMode){const u=!!((t=o.focusedTargetIds)!=null&&t.size)||!!((n=o.defocusedTargetIds)!=null&&n.size);c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set,u&&((i=a.renderCanvasFrame)==null||i.call(a,void 0,null,!1));return}r.svg.selectAll(a.selectorTargets(l)).classed(ut.focused,!1).classed(ut.defocused,!1),a.hasArcType(null,["polar"])&&a.unexpandArc(l),c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set}},Ig={legend:{show:function(e){const t=this.internal;t.showLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})},hide:function(e){const t=this.internal;t.hideLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})}}},Mg={load(e){const t=this.internal,{config:n}=t;t.state.dirty.data=!0,t.state._eventRectFingerprint=null,e.xs&&t.addXs(e.xs),"names"in e&&this.data.names(e.names),"classes"in e&&Object.keys(e.classes).forEach(s=>{n.data_classes[s]=e.classes[s]}),"categories"in e&&t.axis.isCategorized()&&(n.axis_x_categories=e.categories),"axes"in e&&Object.keys(e.axes).forEach(s=>{n.data_axes[s]=e.axes[s]}),"colors"in e&&Object.keys(e.colors).forEach(s=>{n.data_colors[s]=e.colors[s]}),"regions"in e&&(n.data_regions=e.regions||{});const i=["data","columns","rows","json","url"].some(s=>s in e),a="unload"in e&&e.unload!==!1;if("regions"in e&&!i&&!a){t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),xi.call(t,e.done,e.resizeAfter);return}if(a){const s=t.mapToTargetIds(e.unload===!0?null:e.unload);t.unload(s,()=>{!t.config||!t.cache||(t.cache.remove(s),Qa(()=>t.loadFromArgs(e)))})}else t.loadFromArgs(e)},unload(e){const t=this.internal;let n=e||{};Qt(n)&&this.tooltip.hide(),ot(n)?n={ids:n}:nt(n)&&(n={ids:[n]});const i=t.mapToTargetIds(n.ids);t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.unload(i,()=>{!t.config||!t.cache||(t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.cache.remove(i),xi.call(t,n.done,n.resizeAfter))})}};function Ci(e,t,n,i=!1){var a;const s=this.internal,o=s.mapToTargetIds(t),r=new Set(o),l=[...s.state.hiddenTargetIds].filter(u=>r.has(u));if(s.state.toggling=!0,s.state.dirty.visibility=!0,s[`${e?"remove":"add"}HiddenTargetIds`](o),s.state.isCanvasMode){e&&l.length?V(s.config.data_onshown,this,l):!e&&l.length===0&&V((a=s.config)==null?void 0:a.data_onhidden,this,o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1;return}const c=s.$el.svg.selectAll(s.selectorTargets(o)),d=e?null:"0";e&&l.length&&(c.style("display",null),V(s.config.data_onshown,this,l)),s.$T(c).style("opacity",d,"important").call(Qn,()=>{var u;!e&&l.length===0&&(c.style("display","none"),V((u=s.config)==null?void 0:u.data_onhidden,this,o)),c.style("opacity",d)}),n.withLegend&&s[`${e?"show":"hide"}Legend`](o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1}var $g={show(e,t={}){Ci.call(this,!0,e,t)},hide(e,t={}){Ci.call(this,!1,e,t)},toggle(e,t={}){const n=this.internal,i={show:[],hide:[]};n.mapToTargetIds(e).forEach(a=>i[n.isTargetToShow(a)?"hide":"show"].push(a)),i.show.length&&i.hide.length?(Ci.call(this,!0,i.show,t,!0),Ci.call(this,!1,i.hide,t)):(i.show.length&&this.show(i.show,t),i.hide.length&&this.hide(i.hide,t))}},Fg={tooltip:{show:function(e){var t,n,i,a,s,o,r,l,c,d,u,h;const f=this.internal,{$el:g,config:p,state:{eventReceiver:x,hasFunnel:_,hasTreemap:v,inputType:m}}=f;let b,y;if(e.mouse&&(y=e.mouse),e.data){const{data:T}=e,w=(t=f.getYScaleById(T.id))==null?void 0:t(T.value);if((_||v)&&T.id){const C=f.selectorTarget(T.id,void 0,`.${Ct.shape}`);x.rect=g.main.select(C)}else f.isMultipleX()?y=[f.xx(T),w]:(p.tooltip_grouped||(y=[0,w]),b=(i=T.index)!=null?i:f.hasArcType()&&T.id?(n=f.getArcElementByIdOrIndex(T.id))==null?void 0:n.datum().index:f.getIndexByX(T.x))}else ct(e.x)?b=f.getIndexByX(e.x):ct(e.index)&&(b=e.index);if(f.state.isCanvasMode){const T=((a=f.filterTargetsToShow)==null?void 0:a.call(f))||f.data.targets,w=(s=e.data)!=null&&s.id&&!p.tooltip_grouped?T.filter(L=>L.id===e.data.id).map(L=>L.values[b!=null?b:e.data.index]).filter(Boolean):T.map(L=>L.values[b]).filter(Boolean),C=(r=(o=g.canvas)==null?void 0:o.node)==null?void 0:r.call(o),A=f.state.canvasShape||((l=f.getDrawShape)==null?void 0:l.call(f)),S=w[0],k=y||(S&&((c=A==null?void 0:A.pos)!=null&&c.cx)&&((d=A==null?void 0:A.pos)!=null&&d.cy)?[f.state.margin.left+A.pos.cx(S),f.state.margin.top+A.pos.cy(S)]:void 0);if(!w.length||!C)return;f.state.canvasFocusKey=w.map(L=>`${L.id}:${L.index}`).join("|"),(u=f.renderCanvasFocus)==null||u.call(f,w,k),(h=f.showTooltip)==null||h.call(f,w,C);return}(m==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(T=>{f.dispatchEvent(T,b,y)})},hide:function(){var e,t,n,i,a;const s=this.internal,{state:{inputType:o,isCanvasMode:r},$el:{tooltip:l}}=s,c=l==null?void 0:l.datum();if(r){s.state.canvasFocusKey=null,s.hideTooltip(!0),(e=s.clearCanvasFocus)==null||e.call(s);return}if((t=c==null?void 0:c.data)!=null&&t[0]){const{index:d}=c.data[0];(o==="mouse"?["mouseout"]:["touchend"]).forEach(u=>{s.dispatchEvent(u,d)})}o==="touch"&&s.callOverOutForTouch(),s.hideTooltip(!0),(n=s.hideGridFocus)==null||n.call(s),(i=s.unexpandCircles)==null||i.call(s),(a=s.expandBarTypeShapes)==null||a.call(s,!1)}}},Og=Object.defineProperty,Bg=(e,t,n)=>t in e?Og(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,br=(e,t,n)=>Bg(e,typeof t!="symbol"?t+"":t,n);class Wt{constructor(t){br(this,"plugins",[]),br(this,"internal");const n=new de(this);this.internal=n,(function i(a,s,o){Object.keys(a).forEach(r=>{const l=O(a[r]),c=s!==o,d=mt(a[r]),u=d&&Object.keys(a[r]).length>0;l&&(!c&&u||c)?s[r]=a[r].bind(o):d&&!l?s[r]={}:s[r]=a[r],u&&i(a[r],s[r],o)})})(Wt.prototype,this,this),Lg.call(n,t),n.beforeInit(),n.init()}}Tt(Wt.prototype,[Rg,Eg,Pg,Dg,Ig,Mg,$g,Fg]);let yr=()=>(Wt.prototype.category=mr.category,Wt.prototype.categories=mr.categories,(yr=()=>({}))());const zg=e=>{var t,n;return(n=(t=B).btoa)==null?void 0:n.call(t,encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(i,a)=>String.fromCharCode(+`0x${a}`)))};function Ng(e,t,n){const{width:i,height:a}=t||n,s=new XMLSerializer,o=e.cloneNode(!0),r=Eh(je(tt.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",F.namespaces.xhtml),o.style.margin="0",o.style.padding="0",t.preserveFontStyle&&o.querySelectorAll("text").forEach(h=>{h.innerHTML=""});const l=s.serializeToString(o),c=tt.createElement("style");c.appendChild(tt.createTextNode(r.join(`
36
- `)));const d=s.serializeToString(c),u=`<svg xmlns="${F.namespaces.svg}" width="${i}" height="${a}"
30
+ </tbody></table>`).replace(Eg,"").split(Pg)},setTooltipPosition(e,t){var n,i;const a=this,{config:s,scale:o,state:r,$el:{eventRect:l,tooltip:c,svg:u}}=a,{bindto:d}=s.tooltip_contents,h=s.axis_rotated,f=c==null?void 0:c.datum();if(!d&&f){const g=e!=null?e:f.data,[p,_]=qt(r.event,t!=null?t:l==null?void 0:l.node()),x={x:p,y:_};if(r.hasAxis&&o.x&&f&&"x"in f){const y=(T=0,w,C="y")=>{var k;const S=o[w?(k=a.axis)==null?void 0:k.getId(w):C];return S?S(T)+(h?r.margin.left:r.margin.top):0};x.xAxis=o.x(f.x)+(s.tooltip_position?h?r.margin.top:r.margin.left:0),g.length===1?x.yAxis=y(g[0].value,g[0].id):x.yAxis=y}const{width:m=0,height:v=0}=f,b=(i=(n=s.tooltip_position)==null?void 0:n.bind(a.api)(g,m,v,l==null?void 0:l.node(),x))!=null?i:u&&Oa(u)?a.getTooltipPositionViewBox.bind(a)(m,v,x):a.getTooltipPosition.bind(a)(m,v,x);["top","left"].forEach(y=>{const T=b[y];c.style(y,`${T}px`),y==="left"&&!f.xPosInPercent&&(f.xPosInPercent=T/r.current.width*100)})}},getTooltipPositionViewBox(e,t,n){var i,a;const s=this,{$el:{eventRect:o,svg:r},config:l,state:c}=s,u=l.axis_rotated,d=s.hasArcType()||c.hasFunnel||c.hasTreemap,h=(a=(i=d?r:o)==null?void 0:i.node())!=null?a:c.event.target;let{x:f,y:g}=n;c.hasAxis&&(f=u?f:n.xAxis,g=u?n.xAxis:g);const p=Ai(h,f,g,!1),_=ht(h),x=Ai(h,20,0,!1).x;let m=p.y,v=p.x+e/2+x;return d&&(c.hasFunnel||c.hasTreemap||c.hasRadar?(v-=e/2+x,m+=t):(m+=_.height/2,v+=_.width/2-(e-x))),v+e>_.width&&(v=_.width-e-x),m+t>_.height&&(m-=t*2),{top:m,left:v}},getTooltipPosition(e,t,n){var i,a,s;const o=this,{config:r,scale:l,state:c}=o,{width:u,height:d,current:h,hasFunnel:f,hasRadar:g,hasTreemap:p,isLegendRight:_,inputType:x}=c,m=o.hasType("gauge")&&!r.gauge_fullCircle,v=r.axis_rotated,b=o.hasArcType(),y=c.isCanvasMode?0:o.getSvgLeft(!0);let T=y+h.width-o.getCurrentPaddingByDirection("right");const w=20;let{x:C,y:k}=n;if(g)C+=C>=u/2?15:-(e+15),k+=15;else if(b){if(x!=="touch"){let L=(a=(i=o.getTitlePadding)==null?void 0:i.call(o))!=null?a:0;L&&m&&((s=r.arc_rangeText_values)!=null&&s.length)&&(L+=10),C+=(u-(_?o.getLegendWidth():0))/2,k+=(m?d:d/2+t)+L}}else if(f||p)k+=t;else{const A={top:o.getCurrentPaddingByDirection("top",!0),left:o.getCurrentPaddingByDirection("left",!0)};v?(C+=y+A.left+w,k=A.top+n.xAxis+w,T-=y):(C=y+A.left+w+(l.zoom?C:n.xAxis),k+=A.top-5)}if(C+e+15>T&&(C-=e+(f||p||b?0:v?w*2:38)),k+t>h.height){const A=p?t+10:30;k-=m?t*1.5:t+A}const S={top:k,left:C};return S.top<0&&(S.top=0),S.left<0&&(S.left=0),S},showTooltip(e,t){const n=this,{config:i,$el:{tooltip:a}}=n;if(!a||!i.tooltip_show)return;let s=null,o=0,r=`${n.data.targets.length}:`,l;for(let d=0;d<e.length;d++){const h=e[d];d>0&&(r+=","),r+=`${h==null?void 0:h.index}|${h==null?void 0:h.id}|${h==null?void 0:h.value}`,!l&&h&&(l=h),h&&J(n.getBaseValue(h))?(o++,s==null||s.push(h)):s||(s=e.slice(0,d))}if(o===0||!l)return;const c=a.datum();let u=s;if(!c||c.current!==r){const{index:d,x:h}=l;u||(u=e.slice()),Y(i.tooltip_onshow,n.api,e),a.html(n.getTooltipHTML(e,n.axis?n.axis.getXAxisTickFormat():n.categoryName.bind(n),n.getDefaultValueFormat(),n.color)).style("display",null).style("visibility",null),a.datum({index:d,x:h,current:r,data:e,width:a.property("offsetWidth"),height:a.property("offsetHeight")}),Y(i.tooltip_onshown,n.api,e),n._handleLinkedCharts(!0,d)}n.setTooltipPosition(u||e,t)},bindTooltipResizePos(){const e=this,{resizeFunction:t,state:n,$el:{tooltip:i}}=e;t.add(()=>{if(i.style("display")==="block"){const{current:a}=n,{width:s,xPosInPercent:o}=i.datum();let r=a.width/100*o;const l=a.width-(r+s);l<0&&(r+=l),i.style("left",`${r}px`)}})},hideTooltip(e){var t;const n=this,{api:i,config:a,$el:{tooltip:s}}=n;if(s&&s.style("display")!=="none"&&(!a.tooltip_doNotHide||e)){const o=(t=s.datum().data)!=null?t:[];Y(a.tooltip_onhide,i,o),s.style("display","none").datum(null),Y(a.tooltip_onhidden,i,o)}},_handleLinkedCharts(e,t){const n=this,{charts:i,config:a,state:{event:s}}=n;if(s!=null&&s.isTrusted&&a.tooltip_linked&&i.length>1){const o=a.tooltip_linked_name;i.filter(r=>r!==n.api).forEach(r=>{var l,c;const{config:u,$el:d,state:h}=r.internal,f=u.tooltip_linked,g=u.tooltip_linked_name,p=nt.body.contains(d.chart.node());if(f&&o===g&&p){const _=d.tooltip.data()[0],x=t!==(_==null?void 0:_.index);try{e&&x&&h.isCanvasMode?(c=(l=r.internal).showCanvasLinkedTooltip)==null||c.call(l,t):r.tooltip[e&&x?"show":"hide"]({index:t})}catch(m){}}})}},updateTooltipOnRedraw(e,t){var n;const i=this,{config:a,$el:{eventRect:s,svg:o,tooltip:r},state:{event:l,hasAxis:c,hasRadar:u,hasTreemap:d}}=i;if(!i.state.isCanvasMode&&(r==null?void 0:r.style("display"))==="block"&&l){const h=e!=null?e:(n=u?o:s)==null?void 0:n.node();if(c||u)if(i.isMultipleX())i.selectRectForMultipleXs(h,!1);else{const f=t!=null?t:i.getDataIndexFromEvent(l);t===-1?i.api.tooltip.hide():(i.selectRectForSingle(h,f),i.setExpand(f,null,!0))}else{const{clientX:f,clientY:g}=l;setTimeout(()=>{let p=[f,g].every(Number.isFinite)&&nt.elementFromPoint(f,g);const _=p&&(0,O.select)(p).datum();if(_){const x=i.hasArcType()?i.convertToArcData(i.updateAngle(_)):_==null?void 0:_.data;d&&(p=o.node()),x&&i.showTooltip([x],p)}else i.api.tooltip.hide()},a.transition_duration)}}}},Ig={getTranslate(e,t=0){var n;const i=this,{config:a,state:s}=i,o=a.axis_rotated;let r=0,l,c;if(t&&/^(x|y2?)$/.test(e)&&(r=i.getAxisSize(e)*t),e==="main")l=gn(s.margin.left),c=gn(s.margin.top);else if(e==="context")l=gn(s.margin2.left),c=gn(s.margin2.top);else if(e==="legend")l=s.margin3.left,c=s.margin3.top;else if(e==="x")l=o?-r:0,c=o?0:s.height+r;else if(e==="y")l=o?0:-r,c=o?s.height+r:0;else if(e==="y2")l=o?0:s.width+r,c=o?-r-1:0;else if(e==="subX")l=0,c=o?0:s.height2;else if(e==="subY")l=0,c=o?s.height2:0;else if(e==="subY2")l=o?0:s.width2,c=o?-1:0;else if(e==="arc")l=s.arcWidth/2,c=s.arcHeight/2,(n=a.arc_rangeText_values)!=null&&n.length&&(c+=5+(i.hasType("gauge")&&a.title_text?10:0));else if(e==="polar")l=s.arcWidth/2,c=s.arcHeight/2;else if(e==="radar"){const[u,d]=i.getRadarSize();l=s.width/2-u,c=s.height/2-d}return`translate(${l}, ${c})`},transformMain(e,t){const n=this,{$el:{main:i},$T:a}=n,s=t!=null&&t.axisX?t.axisX:a(i.select(`.${It.axisX}`),e),o=t!=null&&t.axisY?t.axisY:a(i.select(`.${It.axisY}`),e),r=t!=null&&t.axisY2?t.axisY2:a(i.select(`.${It.axisY2}`),e);a(i,e).attr("transform",n.getTranslate("main")),s.attr("transform",n.getTranslate("x")),o.attr("transform",n.getTranslate("y")),r.attr("transform",n.getTranslate("y2")),i.select(`.${at.chartArcs}`).attr("transform",n.getTranslate("arc"))},transformAll(e,t){const n=this,{config:i,state:{hasAxis:a,hasFunnel:s,hasTreemap:o,isCanvasMode:r},$el:l}=n;r||(!s&&!o&&n.transformMain(e,t),a&&i.subchart_show&&n.transformContext(e,t),l.legend&&n.transformLegend(e))}};const Mg=new Set(["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"]);var Fg={isValidChartType(e){return!!(e&&Object.values(I).indexOf(e)>-1)},getSubchartTargetType(e){const t=this,{config:n}=t,i=Q(e)?e:e==null?void 0:e.id,a=n.subchart_types||{},s=n.subchart_type,o=n.data_types||{},r=i&&a[i];return r&&t.isValidChartType(r)?r:s&&t.isValidChartType(s)?s:i&&o[i]||n.data_type||I.LINE},getTargetType(e){var t;const{config:n}=this,i=Q(e)?e:e==null?void 0:e.id;return i&&((t=n.data_types)==null?void 0:t[i])||n.data_type||I.LINE},getSubchartSourceTargetType(e){const{state:t}=this,n=Q(e)?e:e==null?void 0:e.id,i=t.subchartSourceTypes;return n&&(i==null?void 0:i[n])||this.getTargetType(e)},isSubchartSourceTypeOf(e,t){const n=this.getSubchartSourceTargetType(e);return ot(t)?t.indexOf(n)>=0:n===t},withSubchartTypeContext(e){const t=this,{config:n,data:i,state:a}=t,s=n.data_type,o=n.data_types,r=a.current.types,l=a.subchartSourceTypes,c={},u={},d=n.subchart_type;t.mapToIds(i.targets).forEach(h=>{u[h]=t.getTargetType(h),c[h]=t.getSubchartTargetType(h)}),n.data_type=d&&t.isValidChartType(d)?d:s,n.data_types=c,a.current.types=[],a.subchartSourceTypes=u;try{return e()}finally{n.data_type=s,n.data_types=o,a.current.types=r,a.subchartSourceTypes=l}},setTargetType(e,t){const n=this,{config:i,state:{withoutFadeIn:a}}=n;n.mapToTargetIds(e).forEach(s=>{a[s]=t===i.data_types[s],i.data_types[s]=t}),e||(i.data_type=t)},updateTypesElements(){const e=this,{state:{current:t}}=e;Object.keys(I).forEach(n=>{const i=I[n],a=e.hasType(i,null,!0),s=t.types.indexOf(i);s===-1&&a?t.types.push(i):s>-1&&!a&&t.types.splice(s,1)}),e.setChartElements()},hasType(e,t,n=!1){var i;const a=this,{config:s,state:{current:o}}=a,r=s.data_types,l=t||a.data.targets;return!n&&((i=o.types)==null?void 0:i.indexOf(e))>-1?!0:l!=null&&l.length?l.some(c=>{const u=r[c.id];return u===e||!u&&e==="line"}):Object.keys(r).length?Object.values(r).some(c=>c===e):s.data_type===e},hasTypeOf(e,t,n=[]){return e in ce?!ce[e].filter(i=>n.indexOf(i)===-1).every(i=>!this.hasType(i,t)):!1},isTypeOf(e,t){const n=Q(e)?e:e.id,i=this.config&&this.getTargetType(n);return ot(t)?t.indexOf(i)>=0:i===t},hasPointType(){const e=this;return e.hasTypeOf("Line")||e.hasType("bubble")||e.hasType("scatter")},hasArcType(e,t){return this.hasTypeOf("Arc",e,t)},hasMultiArcGauge(){return this.hasType("gauge")&&this.config.gauge_type==="multi"},isLineType(e){const t=Q(e)?e:e.id;return!this.config.data_types[t]||this.isTypeOf(t,ce.Line)},isStepType(e){return this.isTypeOf(e,ce.Step)},isSplineType(e){return this.isTypeOf(e,ce.Spline)},isAreaType(e){return this.isTypeOf(e,ce.Area)},isAreaRangeType(e){return this.isTypeOf(e,ce.AreaRange)},isBarType(e){return this.isTypeOf(e,"bar")},isBubbleType(e){return this.isTypeOf(e,"bubble")},isCandlestickType(e){return this.isTypeOf(e,"candlestick")},isScatterType(e){return this.isTypeOf(e,"scatter")},isTreemapType(e){return this.isTypeOf(e,"treemap")},isPieType(e){return this.isTypeOf(e,"pie")},isFunnelType(e){return this.isTypeOf(e,"funnel")},isGaugeType(e){return this.isTypeOf(e,"gauge")},isDonutType(e){return this.isTypeOf(e,"donut")},isPolarType(e){return this.isTypeOf(e,"polar")},isRadarType(e){return this.isTypeOf(e,"radar")},isArcType(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)||this.isPolarType(e)||this.isRadarType(e)},isCirclePoint(e){const{config:t}=this,n=t.point_pattern;return(e==null?void 0:e.tagName)==="circle"||t.point_type==="circle"&&(!n||ot(n)&&n.length===0)},lineData(e){return this.isLineType(e)?[e]:[]},arcData(e){return this.isArcType(e.data)?[e]:[]},labelishData(e){return this.isBarType(e)||this.isLineType(e)||this.isScatterType(e)||this.isBubbleType(e)||this.isCandlestickType(e)||this.isFunnelType(e)||this.isRadarType(e)||this.isTreemapType(e)?e.values.filter(t=>$(t.value)||!!t.value):[]},barLineBubbleData(e){return this.isBarType(e)||this.isLineType(e)||this.isBubbleType(e)?e.values:[]},isInterpolationType(e){return Mg.has(e)}};const Og={basis:pt.curveBasis,"basis-closed":pt.curveBasisClosed,"basis-open":pt.curveBasisOpen,bundle:pt.curveBundle,cardinal:pt.curveCardinal,"cardinal-closed":pt.curveCardinalClosed,"cardinal-open":pt.curveCardinalOpen,"catmull-rom":pt.curveCatmullRom,"catmull-rom-closed":pt.curveCatmullRomClosed,"catmull-rom-open":pt.curveCatmullRomOpen,"monotone-x":pt.curveMonotoneX,"monotone-y":pt.curveMonotoneY,natural:pt.curveNatural,"linear-closed":pt.curveLinearClosed,linear:pt.curveLinear,step:pt.curveStep,"step-after":pt.curveStepAfter,"step-before":pt.curveStepBefore};function Wa(e,t){var n,i;return e.isLineType(t)||((n=e.isScatterType)==null?void 0:n.call(e,t))||((i=e.isBubbleType)==null?void 0:i.call(e,t))}function Nr(e){return t=>Wa(e,t)}function Ya(e,t,n){var i,a,s;const o=n?Di(e,t,n):void 0;return $(o)?o:(i=e.isCandlestickType)!=null&&i.call(e,t)?(s=(a=e.getCandlestickData)==null?void 0:a.call(e,t))==null?void 0:s.close:e.getBaseValue(t)}function Di(e,t,n){var i,a,s;if(!n||(i=e.isCandlestickType)!=null&&i.call(e,t)||!((a=e.isSubchartSourceTypeOf)!=null&&a.call(e,t,I.CANDLESTICK)))return;const o=(s=e.getCandlestickData)==null?void 0:s.call(e,t);if(o)return e.isBarType(t)?$(o.open)&&$(o.close)?o._isUp?o.close:o.open:void 0:$(o.close)?o.close:void 0}function Xr(e,t,n){const i=Di(e,t,n);return $(i)&&e.isBarType(t)}function $g(e,t,n){var i;if(!Xr(e,t,n))return null;const a=(i=e.getCandlestickData)==null?void 0:i.call(e,t);if(a!=null&&a._isUp)return e.color(t);const s=e.config.candlestick_color_down;return(s&&typeof s=="object"?s[t.id]:s)||e.color(t)}function Bg(e){var t,n;const i=this;let a;if(Wa(i,e)){const s=Nr(i);a=i.generateGetLinePoints(i.getShapeIndices(s),!1,s)}else i.isBarType(e)?a=i.generateGetBarPoints(i.getShapeIndices(i.isBarType)):(t=i.isCandlestickType)!=null&&t.call(i,e)&&(a=(n=i.generateGetCandlestickPoints)==null?void 0:n.call(i,i.getShapeIndices(i.isCandlestickType)));return a}function Gr(e,t,n){return this.config[t]?this.getGradienColortUrl(e.id):n(e)}function Vr(e){const{$el:t}=this,{elKey:n,className:i,cssRules:a,position:s}=e,o=t.main.select(`.${V.chart}`);t[n]=s==="first"?o.insert("g",":first-child"):o.append("g"),t[n].attr("class",i),a!=null&&a.length&&t[n].call(this.setCssRule(!1,`.${i}`,a))}function Ha(e,t){const n=this,{$el:i}=n,{type:a,elKey:s,containerClass:o,itemClass:r,initFn:l,withFocus:c=!0,withStyles:u=!0}=t;i[s]||l.call(n);const d=n.getChartClass(a),h=c?n.classFocus.bind(n):()=>"",g=i.main.select(`.${o}`).selectAll(`.${r}`).data(n.filterNullish(e)).attr("class",p=>d(p)+h(p)).enter().append("g").attr("class",d);return u&&g.style("opacity","0").style("pointer-events",n.getStylePropValue("none")),g}var zg={getDrawShape(){const e=this,t=e.config.axis_rotated,{hasRadar:n,hasTreemap:i}=e.state,a={type:{},indices:{},pos:{}};if(!i&&["bar","candlestick","line","area"].forEach(s=>{const o=$t(s);if(e.hasType(s)||e.hasTypeOf(o)||s==="line"&&(e.hasType("bubble")||e.hasType("scatter"))){const r=e.getShapeIndices(e[`is${o}Type`]),l=e[`generateDraw${o}`];a.indices[s]=r,a.type[s]=l?l.bind(e)(r,!1):void 0}}),!e.hasArcType()||n||i){let s,o,r,l;i||(s=n?e.radarCircleX:t?e.circleY:e.circleX,o=n?e.radarCircleY:t?e.circleX:e.circleY),i&&e.state.isCanvasMode?r=l=function(){}:(r=e.generateXYForText(a.indices,!0),l=e.generateXYForText(a.indices,!1)),a.pos={xForText:r,yForText:l,cx:(s||function(){}).bind(e),cy:(o||function(){}).bind(e)}}return a},getShapeIndices(e){const t=this,{config:n}=t,i=n.data_xs,a=yt(i),s={};let o=a?{}:0;return a&&Ji(Object.keys(i).map(r=>i[r])).forEach(r=>{o[r]=0,s[r]={}}),t.filterTargetsToShow(t.data.targets.filter(e,t)).forEach(r=>{var l;const c=r.id in i?i[r.id]:"",u=c?s[c]:s;for(let d=0,h;h=n.data_groups[d];d++)if(!(h.indexOf(r.id)<0))for(let f=0,g;g=h[f];f++){if(g in u){u[r.id]=u[g];break}r.id!==g&&c&&(u[g]=(l=u[r.id])!=null?l:o[c])}Ct(u[r.id])&&(u[r.id]=c?o[c]++:o++,u.__max__=(c?o[c]:o)-1)}),s},getIndices(e,t,n){const i=this,{data_xs:a,bar_indices_removeNull:s}=i.config,{id:o,index:r}=t;if(i.isBarType(o)&&s){const l={};return i.getAllValuesOnIndex(r,!0).forEach((c,u)=>{l[c.id]=u,l.__max__=u}),l}return yt(a)?e[a[o]]:e},getIndicesMax(e){if(!yt(this.config.data_xs))return e.__max__;let t=0;for(const n in e)t+=e[n].__max__||0;return t},getShapeX(e,t,n){const i=this,{config:a,scale:s}=i,o=n?s.subX:s.zoom||s.x,r=a.bar_overlap,l=a.bar_padding,c=(h,f)=>h+f,u=Kt(e)&&(e._$total.length?e._$total.reduce(c)/2:0),d=[];if(u&&Kt(e)&&e._$total.length){let h=0;for(const f of e._$total)h+=f,d.push(h)}return h=>{var f;const g=i.getIndices(t,h,"getShapeX"),p=h.id in g?g[h.id]:0,_=(g.__max__||0)+1;let x=0;if(yt(h.x)){const m=o(h.x,!0);if(u){const v=e[h.id]||e._$width;x=r?m-v/2:m-v+((f=d[p])!=null?f:e._$total.slice(0,p+1).reduce(c))-u}else x=m-($(e)?e:e._$width)*(_/2-(r?1:p))}return e&&x&&_>1&&l&&(p&&(x+=l*p),_>2?x-=(_-1)*l/2:_===2&&(x-=l/2)),x}},getShapeY(e){const t=this,n=t.isStackNormalized();return i=>{let{value:a}=i;const s=e?Di(t,i,e):void 0;return $(i)?a=i:$(s)?a=s:t.isAreaRangeType(i)?a=t.getBaseValue(i,"mid"):n?a=t.getRatio("index",i,!0):t.isBubbleZType(i)?a=t.getBubbleZData(i.value,"y"):t.isBarRangeType(i)&&(a=a[1]),t.getYScaleById(i.id,e)(a)}},getShapeYMin(e,t=!1){const n=this,i=n.axis.getId(e),a=n.getYScaleById(e,t),[s]=a.domain(),o=n.config[`axis_${i}_inverted`];return!n.isGrouped(e)&&!o&&s>0?s:0},getShapeOffsetData(e,t){const n=this,i=n.orderTargets(n.filterTargetsToShow(n.data.targets.filter(e,n))),a=n.state.dataGeneration,s=i.map(h=>h.id).join("_"),o=`${U.shapeOffset}_${t?"sub":"main"}_${s}`,r=n.cache.get(o);if((r==null?void 0:r.generation)===a)return r;const l=n.isStackNormalized(),c=i.map(h=>{let f=h.values;const g={};n.isStepType(h)&&(f=n.convertValuesToStep(f));const p=f.reduce((_,x)=>{const m=Number(x.x),v=Ya(n,x,t);return _[m]=x,g[m]=l?n.getRatio("index",x,!0):v,_},{});return{id:h.id,rowValues:f,rowValueMapByXValue:p,values:g}}),u=i.reduce((h,{id:f},g)=>(h[f]=g,h),{}),d={generation:a,indexMapByTargetId:u,shapeOffsetTargets:c};return n.cache.add(o,d),d},getShapeOffset(e,t,n){const i=this,{shapeOffsetTargets:a,indexMapByTargetId:s}=i.getShapeOffsetData(e,n),o=i.config.data_groupsZeroAs;let r=null;if(!i.config.bar_indices_removeNull){r=new Map;for(const l of a){const c=i.getIndices(t,{id:l.id,index:0});r.set(l.id,a.filter(u=>u.id!==l.id&&c[u.id]===c[l.id]))}}return(l,c)=>{var u;const{id:d,value:h,x:f}=l,g=Ya(i,l,n),p=i.getIndices(t,l),_=i.getYScaleById(d,n);if(i.isBarRangeType(l))return _(h[0]);const x=Number(f),m=_(o==="zero"?0:i.getShapeYMin(d,n));let v=m;const b=(u=r==null?void 0:r.get(d))!=null?u:a.filter(y=>y.id!==d&&p[y.id]===p[d]);for(const y of b){const{id:T,rowValueMapByXValue:w,rowValues:C,values:k}=y;if(s[T]<s[d]){const S=k[x];let A=C[c];(!A||Number(A.x)!==x)&&(A=w[x]);const L=A&&Ya(i,A,n);$(L)&&$(g)&&L*g>=0&&$(S)&&(g!==0||o==="positive"&&S>0||o==="negative"&&S<0)&&(v+=_(S)-m)}}return v}},generateGetLinePoints(e,t,n){const i=this,{config:a}=i,s=i.getShapeX(0,e,t),o=i.getShapeY(t),r=i.getShapeOffset(n||i.isLineType,e,t),l=i.getYScaleById.bind(i),c=new Map;return(u,d)=>{let h=c.get(u.id);h===void 0&&(h=l.call(i,u.id,t)(i.getShapeYMin(u.id,t)),c.set(u.id,h));const f=r(u,d)||h,g=s(u);let p=o(u);a.axis_rotated&&(u.value>0&&p<h||u.value<0&&h<p)&&(p=h);const _=[g,p-(h-f)];return[_,_,_,_]}},generateGetAreaPoints(e,t){const n=this,{config:i}=n,a=n.getShapeX(0,e,t),s=n.getShapeY(!!t),o=n.getShapeOffset(n.isAreaType,e,t),r=n.getYScaleById.bind(n),l=new Map;return function(c,u){let d=l.get(c.id);d===void 0&&(d=r.call(n,c.id,t)(n.getShapeYMin(c.id,t)),l.set(c.id,d));const h=o(c,u)||d,f=a(c),g=c.value;let p=s(c);return i.axis_rotated&&(g>0&&p<d||g<0&&d<p)&&(p=d),[[f,h],[f,p-(d-h)],[f,p-(d-h)],[f,h]]}},generateGetBarPoints(e,t){const n=this,{config:i}=n,a=t?n.axis.subX:n.axis.x,s=n.getIndicesMax(e)+1,o=n.getBarW("bar",a,s),r=n.getShapeX(o,e,!!t),l=n.getShapeY(!!t),c=n.getShapeOffset(n.isBarType,e,!!t),u=n.getYScaleById.bind(n),d=new Map;return(h,f)=>{const{id:g}=h;let p=d.get(g);p||(p={y0:u.call(n,g,t)(n.getShapeYMin(g,t)),isInverted:i[`axis_${n.axis.getId(g)}_inverted`]},d.set(g,p));const{y0:_,isInverted:x}=p,m=c(h,f)||_,v=$(o)?o:o[h.id]||o._$width,b=h.value,y=r(h);let T=l(h);i.axis_rotated&&!x&&(b>0&&T<_||b<0&&_<T)&&(T=_),n.isBarRangeType(h)||(T-=_-m);const w=y+v;return[[y,m],[y,T],[w,T],[w,m]]}},circleY(e,t){const n=this,i=e.id;let a;return n.isGrouped(i)&&(a=Bg.bind(n)(e)),a?a(e,t)[0][1]:n.getYScaleById(i)(n.getBaseValue(e))},circleX(e){return this.xx(e)},updateCircleY(e=!1){const t=this,n=Nr(t),i=t.generateGetLinePoints(t.getShapeIndices(n),e,n),a=t.getShapeY(e);return(s,o)=>{const r=s.id;return t.isGrouped(r)&&Wa(t,s)?i(s,o)[0][1]:a(s)}},getSubchartCandlestickShapeValue(e,t){return Di(this,e,t)},isSubchartCandlestickBarValue(e,t){return Xr(this,e,t)},getSubchartCandlestickBarColor(e,t){return $g(this,e,t)},pointR(e){const t=this,{config:n}=t,i=n.point_r;let a=i;return t.isBubbleType(e)?a=t.getBubbleR(e):z(i)&&(a=i.bind(t.api)(e)),e.r=a,a},pointExpandedR(e){const t=this,{config:n}=t,i=t.isBubbleType(e)?1.15:1.75;return n.point_focus_expand_enabled?n.point_focus_expand_r||t.pointR(e)*i:t.pointR(e)},pointSelectR(e){const t=this,n=t.config.point_select_r;return z(n)?n(e):n||t.pointR(e)*4},isPointFocusOnly(){const e=this;return e.config.point_focus_only&&!e.hasType("bubble")&&!e.hasType("scatter")&&!e.hasArcType(null,["radar"])},getPointSensitivity(e){const t=this;let n=t.config.point_sensitivity;if(e)z(n)?n=n.call(t.api,e):n==="radius"&&(n=e.r);else return n;return n},getBarW(e,t,n){var i,a,s,o,r;const l=this,{config:c,org:u,scale:d,state:h}=l,f=l.getMaxDataCount(),g=e==="bar"&&((i=c.data_groups)==null?void 0:i.length),p=`${e}_width`,{k:_}=(s=(a=l.getZoomTransform)==null?void 0:a.call(l))!=null?s:{k:1},x=[(o=c.axis_x_min)!=null?o:u.xDomain[0],(r=c.axis_x_max)!=null?r:u.xDomain[1]].map(y=>l.axis.isTimeSeries()?Wt.call(l,y):Number(y));let m=t.tickInterval(f);if(d.zoom&&!l.axis.isCategorized()&&_>1){const y=x.every((T,w)=>T===u.xDomain[w]);m=u.xDomain.map((T,w)=>{const C=y?T:T-Math.abs(x[w]);return d.zoom(C)}).reduce((T,w)=>Math.abs(T)+w)/f}const v=y=>{const T=y?c[p][y]:c[p],w=y?T.ratio:c[`${p}_ratio`],C=y?T.max:c[`${p}_max`],k=$(T)?T:z(T)?T.call(l,h.width,n,f):n?m*w/n:0;return C&&k>C?C:k};let b=v();return!g&&Kt(c[p])&&(b={_$width:b,_$total:[]},l.getTargetsToShow().forEach(y=>{c[p][y.id]&&(b[y.id]=v(y.id),b._$total.push(b[y.id]||b._$width))})),b},getShapeByIndex(e,t,n){const i=this,{$el:a}=i,s=J(t)?`-${t}`:"";let o=a[e];return o&&!o.empty()?o=o.filter(r=>n?r.id===n:!0).filter(r=>J(t)?r.index===t:!0):o=(n?a.main.selectAll(`.${V[`${e}s`]}${i.getTargetSelectorSuffix(n)}`):a.main).selectAll(`.${V[e]}${s}`),o},isWithinShape(e,t){var n;const i=this,a=(0,O.select)(e);let s;return i.isTargetToShow(t.id)?(n=i.hasValidPointType)!=null&&n.call(i,e.nodeName)?s=i.isStepType(t)?i.isWithinStep(e,i.getYScaleById(t.id)(i.getBaseValue(t))):i.isWithinCircle(e,i.isBubbleType(t)?i.pointSelectR(t)*1.5:0):e.nodeName==="path"&&(s=a.classed(V.bar)?i.isWithinBar(e):!0):s=!1,s},getInterpolate(e){const n=this.getInterpolateType(e);return Og[n]},getCurve(e){const t=this;return t.config.axis_rotated&&t.isStepType(e)?i=>{const a=t.getInterpolate(e)(i);return a.orgPoint=a.point,a.pointRotated=function(s,o){this._point===1&&(this._point=2);const r=this._y*(1-this._t)+o*this._t;this._context.lineTo(this._x,r),this._context.lineTo(s,r),this._x=s,this._y=o},a.point=function(s,o){this._point===0?this.orgPoint(s,o):this.pointRotated(s,o)},a}:t.getInterpolate(e)},getInterpolateType(e){const t=this,{config:n}=t,i=n.spline_interpolation_type,a=t.isInterpolationType(i)?i:"cardinal";return t.isSplineType(e)?a:t.isStepType(e)?n.line_step_type:"linear"},isWithinBar(e){const t=qt(this.state.event,e),n=lr(e),[i,a,s]=n,o=Math.min(i.x,a.x),r=Math.min(i.y,a.y),l=this.config.bar_sensitivity,c=Math.abs(s.x-a.x),u=Math.abs(i.y-a.y),d=o-l,h=o+c+l,f=r+u+l,g=r-l;return d<t[0]&&t[0]<h&&g<t[1]&&t[1]<f}},Ng=Object.defineProperty,Xg=(e,t,n)=>t in e?Ng(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gt=(e,t,n)=>Xg(e,typeof t!="symbol"?t+"":t,n);function Gg(e){return e.hasArcType()?"arc charts":e.hasType("funnel")?"funnel chart":null}function Vg(e){var t,n;const{config:i}=e,a=i.render_mode==="canvas"?Gg(e):null;a&&((n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] render.mode='canvas' is ignored for ${a}; falling back to SVG.`),i.render_mode="svg")}class ge{constructor(t){Gt(this,"api"),Gt(this,"config"),Gt(this,"cache"),Gt(this,"$el"),Gt(this,"state"),Gt(this,"charts"),Gt(this,"data",{xs:{},targets:[]}),Gt(this,"axis"),Gt(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),Gt(this,"org",{xScale:null,xDomain:null}),Gt(this,"color"),Gt(this,"patterns"),Gt(this,"levelColor"),Gt(this,"point"),Gt(this,"brush"),Gt(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});const n=this;n.api=t,n.config=new cn,n.cache=new pf;const i=new df;n.$el=i.getStore("element"),n.state=i.getStore("state"),n.$T=n.$T.bind(n)}$T(t,n,i){const{config:a,state:s}=this,o=a.transition_duration,r=a.subchart_show;let l=t;return l&&("tagName"in l&&(l=(0,O.select)(l)),l=(n!==!1&&o||n)&&(!s.zooming||s.dragging)&&!s.resizing&&s.rendered&&!r?l.transition(i).duration(o):l),l}beforeInit(){const t=this;t.callPluginHook("$beforeInit"),Y(t.config.onbeforeinit,t.api)}afterInit(){const t=this;t.callPluginHook("$afterInit"),Y(t.config.onafterinit,t.api)}init(){const t=this,{config:n,state:i,$el:a}=t,{boost_useCssRule:s,bindto:o}=n;_f(t),Vg(t);const r=t.hasArcType();if(i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasFunnel=!i.hasAxis&&t.hasType("funnel"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!r&&!i.hasFunnel&&!i.hasTreemap,i.datetimeId=`bb-${+new Date*xe()}`,s){const c=nt.createElement("style");c.type="text/css",nt.head.appendChild(c),i.style={rootSelector:`.${i.datetimeId}`,sheet:c.sheet},a.style=c}const l={element:o,classname:"bb"};tt(o)&&(l.element=o.element||"#chart",l.classname=o.classname||l.classname),a.chart=z(l.element.node)?o.element:(0,O.select)(l.element||[]),a.chart.empty()&&(a.chart=(0,O.select)(nt.body.appendChild(nt.createElement("div")))),a.chart.html("").classed(l.classname,!0).classed(i.datetimeId,s).style("position","relative"),t.initParams(),t.initToRender()}initToRender(t){const n=this,{config:i,state:a,$el:{chart:s}}=n,o=()=>Tf(s,{display:"none",visibility:"hidden"}),r=i.render.lazy===!1?!1:i.render.lazy||o(),l=N.MutationObserver;r&&l&&i.render.observe!==!1&&!t&&new l((c,u)=>{o()||(u.disconnect(),!a.rendered&&n.initToRender(!0))}).observe(s.node(),{attributes:!0,attributeFilter:["class","style"]}),(!r||t)&&n.convertData(i,c=>{n.initWithData(c),n.afterInit()})}initParams(){var t,n;const i=this,{config:a,format:s,state:o}=i;if(a.render_mode==="canvas"&&((t=i.prepareCanvasConfig)==null||t.call(i)),i.color=i.generateColor(),i.levelColor=i.generateLevelColor(),a.padding===!1&&(a.axis_x_show=!1,a.axis_y_show=!1,a.axis_y2_show=!1,a.subchart_show=!1),a.render_mode!=="canvas"&&(i.hasPointType()||(n=i.hasLegendDefsPoint)!=null&&n.call(i))&&(i.point=i.generatePoint()),o.hasAxis){i.initClip(),s.extraLineClasses=i.generateExtraLineClass(),s.dataTime=a.data_xLocaltime?Ci.timeParse:Ci.utcParse,s.axisTime=a.axis_x_localtime?Ci.timeFormat:Ci.utcFormat;const u=a.zoom_enabled&&a.zoom_type==="drag";s.defaultAxisTime=d=>{const{x:h,zoom:f}=i.scale,g=u?f:f&&h.orgDomain().toString()!==f.domain().toString(),p=d.getMilliseconds()&&".%L"||d.getSeconds()&&".:%S"||d.getMinutes()&&"%I:%M"||d.getHours()&&"%I %p"||d.getDate()!==1&&"%b %d"||g&&d.getDate()===1&&"%b'%y"||d.getMonth()&&"%-m/%-d"||"%Y";return s.axisTime(p)(d)}}const{legend_position:r,legend_inset_anchor:l,axis_rotated:c}=a;o.isLegendRight=r==="right",o.isLegendInset=r==="inset",o.isLegendTop=l==="top-left"||l==="top-right",o.isLegendLeft=l==="top-left"||l==="bottom-left",o.rotatedPadding.top=i.getResettedPadding(o.rotatedPadding.top),o.rotatedPadding.right=c&&!a.axis_x_show?0:30,o.inputType=wf(a.interaction_inputType_mouse,a.interaction_inputType_touch)}initWithData(t){var n,i,a,s,o,r;const l=this,{config:c,scale:u,state:d,$el:h,org:f}=l,{hasAxis:g,hasFunnel:p,hasTreemap:_}=d,x=c.interaction_enabled,m=l.hasType("polar"),v=c.data_labels_backgroundColors;if(g&&(l.axis=l.getAxisInstance(),c.zoom_enabled&&l.initZoom()),l.data.xs={},l.data.targets=l.convertDataToTargets(t),c.data_filter&&(l.data.targets=l.data.targets.filter(c.data_filter.bind(l.api))),c.data_hide&&l.addHiddenTargetIds(c.data_hide===!0?l.mapToIds(l.data.targets):c.data_hide),c.legend_hide&&l.addHiddenLegendIds(c.legend_hide===!0?l.mapToIds(l.data.targets):c.legend_hide),l.updateSizes(),l.updateScales(!0),g){const{x:T,y:w,y2:C,subX:k,subY:S,subY2:A}=u;T&&(T.domain(pn(l.getXDomain(l.data.targets),!c.axis_x_inverted)),k.domain(T.domain()),f.xDomain=T.domain()),w&&(w.domain(l.getYDomain(l.data.targets,"y")),S.domain(w.domain())),C&&(C.domain(l.getYDomain(l.data.targets,"y2")),A&&A.domain(C.domain()))}if(c.render_mode==="canvas"){if(!l.initCanvas)throw Error("[billboard.js] Please import and call canvas() to use render.mode='canvas'.");if(l.bindResize(),l.initCanvas(),c.tooltip_show&&l.initTooltip(),l.callPluginHook("$init"),Y(c.oninit,l.api),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();Y(c.data_onmin,l.api,T.min),Y(c.data_onmax,l.api,T.max)}d.rendered=!0;return}if(h.svg=h.chart.append("svg").style("overflow","hidden").style("display","block"),x&&d.inputType){const T=d.inputType==="touch",{onclick:w,onover:C,onout:k}=c,S=(n=c.interaction_inputType_touch)==null?void 0:n.preventDefault,A=tn(S)&&S||!1,L=!isNaN(S)&&S||null,E=T?{passive:!A&&L===null}:void 0;h.svg.on("click",(w==null?void 0:w.bind(l.api))||null).on(T?"touchstart":"mouseenter",(C==null?void 0:C.bind(l.api))||null,E).on(T?"touchend":"mouseleave",(k==null?void 0:k.bind(l.api))||null)}c.svg_classname&&h.svg.attr("class",c.svg_classname);const b=z(c.color_tiles)&&l.patterns;(g||b||m||_||v||(i=l.hasLegendDefsPoint)!=null&&i.call(l))&&(h.defs=h.svg.append("defs"),g&&["id","idXAxis","idYAxis","idY2Axis","idGrid"].forEach(T=>{l.appendClip(h.defs,d.clip[T])}),l.generateTextBGColorFilter(v),b&&l.patterns.forEach(T=>h.defs.append(()=>T.node))),l.updateSvgSize(),l.bindResize();const y=h.svg.append("g").classed(j.main,!0).attr("transform",p||_?null:l.getTranslate("main"));if(h.main=y,c.subchart_show&&l.initSubchart(),c.tooltip_show&&l.initTooltip(),c.title_text&&l.initTitle(),!_&&c.legend_show&&l.initLegend(),c.data_empty_label_text&&y.append("text").attr("class",`${Et.text} ${j.empty}`).attr("text-anchor","middle").attr("dominant-baseline","middle"),g&&(c.regions.length&&((a=l.initRegion)==null||a.call(l)),!c.clipPath&&l.axis.init()),y.append("g").classed(j.chart,!0).attr("clip-path",g?d.clip.path:null),l.callPluginHook("$init"),l.initChartElements(),g&&(x&&((s=l.initEventRect)==null||s.call(l)),(o=l.initGrid)==null||o.call(l),c.clipPath&&((r=l.axis)==null||r.init())),l.updateTargets(l.data.targets),l.updateDimension(),Y(c.oninit,l.api),l.setBackground(),l.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),c.data_onmin||c.data_onmax){const T=l.getMinMaxData();Y(c.data_onmin,l.api,T.min),Y(c.data_onmax,l.api,T.max)}c.tooltip_show&&l.initShowTooltip(),d.rendered=!0}initChartElements(){const t=this,{hasAxis:n,hasRadar:i,hasTreemap:a}=t.state,s=[];if(n){const o=["bar","bubble","candlestick","line"];t.config.bar_front&&o.push(o.shift());for(const r of o){const l=$t(r);(r==="line"&&t.hasTypeOf(l)||t.hasType(r))&&s.push(l)}}else if(a)s.push("Treemap");else if(t.hasType("funnel"))s.push("Funnel");else{const o=t.hasType("polar"),r=t.hasType("gauge");i||s.push("Arc","Pie"),r?s.push("Gauge"):i?s.push("Radar"):o&&s.push("Polar")}for(const o of s)t[`init${o}`]();yt(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()}setChartElements(){const t=this,{$el:{chart:n,svg:i,defs:a,main:s,tooltip:o,legend:r,title:l,canvas:c,eventOverlay:u,grid:d,needle:h,arcs:f,circle:g,bar:p,candlestick:_,line:x,area:m,text:v}}=t;t.api.$={chart:n,svg:i,canvas:c,eventOverlay:u,defs:a,main:s,tooltip:o,legend:r,title:l,grid:d,arc:f,circles:g,bar:{bars:p},candlestick:_,line:{lines:x,areas:m},needle:h,text:{texts:v}}}setBackground(){const t=this,{config:{background:n},state:i,$el:{svg:a}}=t;if(yt(n)){const s=a.select("g").insert(n.imgUrl?"image":"rect",":first-child");n.imgUrl?s.attr("href",n.imgUrl):n.color&&s.style("fill",n.color).attr("clip-path",i.clip.path),s.attr("class",n.class||null).attr("width","100%").attr("height","100%")}}updateTargets(t){var n,i;const a=this,{hasAxis:s,hasFunnel:o,hasRadar:r,hasTreemap:l}=a.state,c=d=>a[`updateTargetsFor${d}`](t.filter(a[`is${d}Type`].bind(a)));if(a.updateTargetsForText(t),s){const d=["bar","candlestick","line"];for(const h of d){const f=$t(h);(h==="line"&&a.hasTypeOf(f)||a.hasType(h))&&c(f)}(n=a.updateTargetsForSubchart)==null||n.call(a,t)}else if(a.hasArcType(t)){let d="Arc";r?d="Radar":a.hasType("polar")&&(d="Polar"),c(d)}else o?c("Funnel"):l&&c("Treemap");const u=a.hasType("bubble")||a.hasType("scatter");u&&((i=a.updateTargetForCircle)==null||i.call(a)),a.filterTargetsToShowAtInit(u)}filterTargetsToShowAtInit(t=!1){const n=this,{$el:{svg:i},$T:a}=n;let s=`.${j.target}`;t&&(s+=`, .${Xt.chartCircles} > .${Xt.circles}`),a(i.selectAll(s).filter(o=>n.isTargetToShow(o.id))).style("opacity",null)}getWithOption(t){const n={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};for(const[i,a]of Object.entries(n)){const s=Q(a)?n[a]:a;n[i]=Ne(t,`with${i}`,s)}return n}initialOpacity(t){const n=this,{withoutFadeIn:i}=n.state;return n.getBaseValue(t)!==null&&i[t.id]?null:"0"}bindResize(){var t,n;const i=this,{$el:a,config:s,state:o}=i,r=kf(s.resize_timer),{resize_auto:l}=s,c=[];c.push(()=>Y(s.onresize,i.api)),/^(true|parent)$/.test(l)&&c.push(()=>{var u;const d=o.current.width,h=o.current.height;i.setContainerSize(),!(d===o.current.width&&h===o.current.height)&&(o.resizing=!0,s.legend_show&&(i.updateSizes(),o.isCanvasMode?(u=i.updateHtmlLegend)==null||u.call(i):i.updateLegend()),i.api.flush(!1))}),c.push(()=>{Y(s.onresized,i.api),o.resizing=!1}),c.forEach(u=>r.add(u)),i.resizeFunction=r,l==="parent"&&N.ResizeObserver?(i.resizeFunction.resizeObserver=new N.ResizeObserver(i.resizeFunction.bind(i))).observe(a.chart.node().parentNode):(l==="parent"&&((n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,"[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize.")),N.addEventListener("resize",i.resizeFunction))}callPluginHook(t,...n){this.config.plugins.forEach(i=>{t==="$beforeInit"&&(i.$$=this,this.api.plugins.push(i)),i[t](...n)})}}St(ge.prototype,[jf,Kf,Zf,Jf,tg,ag,rg,qf,lg,xg,vg,Au,zg,bg,yg,Ag,Rg,Dg,Ig,Fg]);const ja=[he,ee,Yt,ta],Wr=10,Wg=750,Yr=6,Yg=2,Hg=1e5,jg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ii=new WeakMap;function Hr(e){var t,n;(n=(t=N.console)==null?void 0:t.warn)==null||n.call(t,`[billboard.js] ${e}`)}function Mi(e,t){var n;const{config:i}=e,a=(n=i.data_names[t])!=null?n:t;return z(i.legend_format)?i.legend_format(a,t!==a?t:void 0):a}function Ug(e){return`${e}`.replace(/[&<>"']/g,t=>jg[t])}function Kg(e,t){var n,i;const{config:a}=e,s=((n=e.mapToIds)==null?void 0:n.call(e,e.data.targets))||[],o=((i=e.getValidPointPattern)==null?void 0:i.call(e))||(Array.isArray(a.point_pattern)&&a.point_pattern.length?a.point_pattern:[a.point_type]),r=Math.max(0,s.indexOf(t));return o[r%o.length]||"circle"}function Zg(e,t){const n=Ug(e.color(t)),i=Kg(e,t),a='viewBox="0 0 8 8" aria-hidden="true" focusable="false" style="display:block;width:100%;height:100%;overflow:visible;pointer-events:none"',s=`fill="${n}" stroke="${n}"`;return/^rect(angle)?$/i.test(i)?`<svg ${a}><rect x="1" y="1" width="6" height="6" ${s}></rect></svg>`:!i||/^circle$/i.test(i)?`<svg ${a}><circle cx="4" cy="4" r="3" ${s}></circle></svg>`:`<svg ${a}><g ${s}>${Se(i)}</g></svg>`}function qg(e,t){const n=new Map;t.each(function(i){n.set(i,this)}),e.cache.add(U.legendItemMap,n)}function jr(e,t){const{config:n}=e;t.attr("class",function(i){const s=`${(0,O.select)(this).attr("class")||""} ${e.generateClass(H.legendItem,i)}`;return Array.from(new Set(s.trim().split(/\s+/).filter(Boolean))).join(" ")}).style("visibility",i=>e.isLegendToShow(i)?null:"hidden").classed(H.legendItemHidden,i=>!e.isTargetToShow(i)).classed(oe.legendItemInteractive,!!n.interaction_enabled),qg(e,t)}function Jg(e,t){var n;const{legend:i}=e.$el,a=((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t];i==null||i.selectAll(`.${H.legendItem}`).classed(lt.legendItemFocused,s=>a.indexOf(s)>=0).style("opacity",function(s){return a.indexOf(s)>=0?null:e.opacityForUnfocusedLegend.call(e,(0,O.select)(this))})}function Qg(e){const{legend:t}=e.$el;t==null||t.selectAll(`.${H.legendItem}`).classed(lt.legendItemFocused,!1).style("opacity",null)}function tp(e,t){var n,i,a;const{state:s}=e,r=(((n=e.mapToTargetIds)==null?void 0:n.call(e,[t]))||[t]).filter(e.isTargetToShow,e),l=new Set(r),c=(((i=e.mapToTargetIds)==null?void 0:i.call(e))||[]).filter(u=>!l.has(u)&&e.isTargetToShow(u));s.focusedTargetIds=l,s.defocusedTargetIds=new Set(c),(a=e.renderCanvasFrame)==null||a.call(e,void 0,null,!1)}function Ur(e){var t,n,i;const{state:a}=e,s=!!((t=a.focusedTargetIds)!=null&&t.size)||!!((n=a.defocusedTargetIds)!=null&&n.size);a.focusedTargetIds=new Set,a.defocusedTargetIds=new Set,s&&((i=e.renderCanvasFrame)==null||i.call(e,void 0,null,!1))}function Kr(e){var t,n;return((t=e.changedTouches)==null?void 0:t[0])||((n=e.touches)==null?void 0:n[0])}function ep(e,t,n){const i=Kr(n);e.state.canvasLegendTouch=i?{id:t,x:i.clientX,y:i.clientY,moved:!1}:null}function Zr(e,t){const n=e.state.canvasLegendTouch,i=n&&Kr(t);i&&(n.moved=n.moved||Math.abs(i.clientX-n.x)>Wr||Math.abs(i.clientY-n.y)>Wr)}function np(e,t,n){Zr(e,n);const i=e.state.canvasLegendTouch;return e.state.canvasLegendTouch=null,!!i&&i.id===t&&!i.moved}function ip(e,t){e.state.canvasLegendLastTouchClickId=t,e.state.canvasLegendLastTouchClickTime=Date.now()}function ap(e,t){const{state:n}=e,i=n.canvasLegendLastTouchClickId===t&&Date.now()-(n.canvasLegendLastTouchClickTime||0)<Wg;return i&&(n.canvasLegendLastTouchClickId=null,n.canvasLegendLastTouchClickTime=0),i}function qr(e,t){const{api:n,config:i,state:a}=e;if(t.on("click dblclick mouseover mouseout touchstart touchmove touchend",null),!i.interaction_enabled)return;const s=i.legend_item_interaction,o=typeof s=="object"&&(s!=null&&s.dblclick)?"dblclick":"click",r=a.inputType==="touch",l=s||z(i.legend_item_onclick),c=r?al(i):void 0,u=function(d,h){var f;if(!Y(i.legend_item_onclick,n,h,!a.hiddenTargetIds.has(h))){const g=(0,O.select)(this);d.type==="dblclick"||d.altKey?a.hiddenTargetIds.size&&!g.classed(H.legendItemHidden)?n.show():(n.hide(),n.show(h)):(n.toggle(h),g.classed(lt.legendItemFocused,!1)),Ur(e)}r&&((f=e.hideTooltip)==null||f.call(e))};t.on(o,l?function(d,h){r&&d.type==="click"&&ap(e,h)||u.call(this,d,h)}:null),r&&o==="click"&&l&&t.on("touchstart",function(d,h){ep(e,h,d)},c).on("touchmove",d=>{Zr(e,d)},c).on("touchend",function(d,h){np(e,h,d)&&(ip(e,h),u.call(this,d,h))},c),!r&&t.on("mouseover",s||z(i.legend_item_onover)?function(d,h){Y(i.legend_item_onover,n,h,!a.hiddenTargetIds.has(h))||!a.transiting&&e.isTargetToShow(h)&&(Jg(e,h),tp(e,h))}:null).on("mouseout",s||z(i.legend_item_onout)?function(d,h){Y(i.legend_item_onout,n,h,!a.hiddenTargetIds.has(h))||(Qg(e),Ur(e))}:null)}function sp(e,t){var n,i;const a=(i=(n=e.$el.chart)==null?void 0:n.node)==null?void 0:i.call(n),s=a==null?void 0:a.ownerDocument;if(!a||!s)return null;const o=s.createElementNS("http://www.w3.org/2000/svg","svg"),r=s.createElementNS("http://www.w3.org/2000/svg","g"),l=s.createElementNS("http://www.w3.org/2000/svg","text");o.style.cssText="position:absolute;visibility:hidden;left:-10000px;top:-10000px;",r.setAttribute("class",H.legendItem),l.textContent=t,r.appendChild(l),o.appendChild(r),a.appendChild(o);const c=ht(l);return o.remove(),c}function Jr(e){return/^(indexed|category|log|timeseries)$/.test(e)}function Fi(e){return/^(indexed|log|timeseries)$/.test(e)}function op(e){var t,n;const i=e;return((t=i.changedTouches)==null?void 0:t[0])||((n=i.touches)==null?void 0:n[0])||("clientX"in e?e:null)}function rp(e,t,n=!1){var i,a;const s=Qn(e,t);return s?n?(a=(i=e.hitDetector).findNearestShape)==null?void 0:a.call(i,s[0],s[1]):e.hitDetector.findNearest(s[0],s[1]):null}function lp(e,t){var n;const{config:i,state:a}=e,{height:s,margin:o,width:r,xAxisHeight:l}=a,[c,u]=t,d=o.left,h=o.left+r,f=o.top,g=o.top+s,p=i.axis_x_show?Math.max(l||0,24):0;return(n=e.isMultipleX)!=null&&n.call(e)||a.hasTreemap?!1:i.axis_rotated?u>=f&&u<=g&&c>=d-p&&c<=h:c>=d&&c<=h&&u>=f&&u<=g+p}function cp(e,t){const{state:{height:n,margin:i,width:a}}=e,[s,o]=t;return s>=i.left&&s<=i.left+a&&o>=i.top&&o<=i.top+n}function up(e,t){var n,i;return e.hitDetector.findNearest(t[0],t[1])||(lp(e,t)?(i=(n=e.hitDetector).findNearestIndexByCoord)==null?void 0:i.call(n,t[0],t[1]):null)}function Qr(e,t){var n;const{config:i,state:a}=e,s=e.filterTargetsToShow(e.data.targets),o=il(e,t),r=i.tooltip_grouped&&!a.hasTreemap&&!o?(n=e.filterByX)==null?void 0:n.call(e,s,t.x):null;return(a.hasTreemap?[t]:o?[t]:i.tooltip_grouped?r!=null&&r.length?r:s.map(l=>l.values[t.index]).filter(Boolean):[t]).map(l=>{var c;return((c=e.addName)==null?void 0:c.call(e,l))||l})}function dp(e,t,n){var i,a;return(i=e.isMultipleX)!=null&&i.call(e)&&!il(e,t)?[((a=e.addName)==null?void 0:a.call(e,t))||t]:n}function Qn(e,t){const n=op(t);if(!n)return null;const i=e.$el.canvas.node(),a=ht(i,!0);return[n.clientX-a.left,n.clientY-a.top]}function Ua(e,t){var n,i;if(!Array.isArray(t)||t.length<2)return null;const a=t.slice(0,2);return(i=(n=e.axis)==null?void 0:n.isTimeSeries)!=null&&i.call(n)?a.map(s=>Wt.call(e,s)):a}function ti(e){const{config:t,state:n}=e;return!t.subchart_show||!n.hasAxis||n.width2<=0||n.height2<=0?null:{x:n.margin2.left,y:n.margin2.top,w:n.width2,h:n.height2}}function tl(e,t){const n=ti(e);return!!n&&t[0]>=n.x&&t[0]<=n.x+n.w&&t[1]>=n.y&&t[1]<=n.y+n.h}function hp(e,t){const{config:n,state:i}=e,a=ti(e);if(n.subchart_brush_enabled!==!1||!a||!tl(e,t))return null;const s=ao(e,n.axis_rotated?t[1]-a.y:t[0]-a.x);return s===null?null:n.axis_rotated?[i.margin.left+i.width/2,i.margin.top+s]:[i.margin.left+s,i.margin.top+i.height/2]}function Oi(e){var t,n;const i=ti(e),a=i?e.config.axis_rotated?i.h:i.w:0,s=(n=(t=e.axis)==null?void 0:t.getExtent)==null?void 0:n.call(t),o=Array.isArray(s)?s.slice(0,2):[];if(o.length===2&&o.every(Number.isFinite)){const r=Math.max(0,Math.min(a,o[0])),l=Math.max(0,Math.min(a,o[1]));return[Math.min(r,l),Math.max(r,l)]}return[0,a]}function Ka(e,t,n=!1){const i=Qn(e,t),a=i&&ti(e);if(!i||!a||!tl(e,i))return null;const s=e.config.axis_rotated?i[1]-a.y:i[0]-a.x,[o,r]=Oi(e);return!n&&(s<o||s>r)?null:Math.max(o,Math.min(r,s))}function fp(e,t,n){const i=Math.min(t,n),a=Math.max(t,n);return[e.scale.subX.invert(i),e.scale.subX.invert(a)]}function el(e){const{scale:t,state:n}=e,i=n.domain;if(!(i!=null&&i.length)||!t.subX)return null;const a=ti(e),s=t.subX(i[0]),o=t.subX(i[1]);if(!a||!Number.isFinite(s)||!Number.isFinite(o))return null;const[r,l]=Oi(e);return[Math.max(r,Math.min(l,Math.min(s,o))),Math.max(r,Math.min(l,Math.max(s,o)))]}function nl(e,t){const n=el(e);if(!n)return"select";const[i,a]=n;return Math.abs(t-i)<=Yr?"resize-start":Math.abs(t-a)<=Yr?"resize-end":t>i&&t<a?"move":"select"}function Za(e,t,n){const[i,a]=Oi(e);return[Math.max(i,Math.min(a,t)),Math.max(i,Math.min(a,n))]}function gp(e,t){return/^resize/.test(t)?e.config.axis_rotated?"ns-resize":"ew-resize":t==="move"?"move":"crosshair"}function Ke(e){return e?`${e.id}:${e.index}`:null}function pp(e,t){const n=e.state.canvasSelectionDragIncluded,i=Ii.get(e)||new Map,a=new Map,s=new Set,o=[];return t.filter(r=>qa(e,r)).forEach(r=>{const l=Ke(r);l&&(s.add(l),!a.has(l)&&a.set(l,r))}),a.forEach((r,l)=>{!n.has(l)&&o.push(r)}),i.forEach((r,l)=>{!s.has(l)&&o.push(r)}),Ii.set(e,a),{included:s,rows:o}}function _p(e){return e?Array.isArray(e)?e:[e]:null}function qa(e,t){return t&&Rt(e,t)&&_n(e,t,ja)&&ja.some(n=>n(e,t))&&e.config.data_selection_isselectable.bind(e.api)(t)}function Ja(e,t){e.filterTargetsToShow(e.data.targets).filter(n=>_n(e,n,ja)).forEach(n=>{n.values.forEach(i=>{qa(e,i)&&t(i)})})}function il(e,t){return!(e.config.axis_x_forceAsSingle&&e.config.tooltip_grouped)&&(Ve(e,t)||We(e,t))}function xp(e){return e.interaction_inputType_touch!==!1}function al(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;return{passive:!i&&a===null}}function mp(e){var t;const n=(t=e.interaction_inputType_touch)==null?void 0:t.preventDefault,i=tn(n)&&n||!1,a=!isNaN(n)&&n||null;let s;return o=>{var r,l;const c=((r=o.changedTouches)==null?void 0:r[0])||((l=o.touches)==null?void 0:l[0]);if(!c)return;const u=c[`client${e.axis_rotated?"Y":"X"}`];o.type==="touchstart"?i?o.preventDefault():a!==null&&(s=u):o.type==="touchmove"&&(i||s===!0||a!==null&&Math.abs(s-u)>=a)&&(s=!0,o.preventDefault())}}function Sn(e,t){return t.pointerType!=="mouse"&&e.state.inputType!=="touch"}function vp(e,t){const{state:n}=e,i=Ke(t),a=i&&n.canvasLastInputClickKey===i&&Date.now()-(n.canvasLastInputClickTime||0)<750;return a&&(n.canvasLastInputClickKey=null,n.canvasLastInputClickTime=0),!!a}function bp(e,t){e.state.canvasLastInputClickKey=Ke(t),e.state.canvasLastInputClickTime=Date.now()}function yp(){var e,t,n;return(n=(t=(e=N.performance)==null?void 0:e.now)==null?void 0:t.call(e))!=null?n:Date.now()}function sl(e,t=!1){return Array.isArray(e)&&e.length>=2&&e.every(n=>Number.isFinite(+n)&&(!t||+n>0))}function Tp(e,t,n,i=!1){return e.slice(0,2).map((a,s)=>{const o=i?Math.exp(Math.log(+a)+(Math.log(+t[s])-Math.log(+a))*n):+a+(+t[s]-+a)*n;return a instanceof Date||t[s]instanceof Date?new Date(o):o})}function wp(e){return e.data.targets.reduce((t,n)=>t+n.values.length,0)}function Cp(e){const{scale:t}=e,n=e.filterTargetsToShow(e.data.targets);["y","y2"].forEach(i=>{var a;(a=t[i])==null||a.domain(e.getYDomain(n,i))}),e.withSubchartTypeContext(()=>{var i,a;(i=t.subY)==null||i.domain(e.getYDomain(n,"y")),(a=t.subY2)==null||a.domain(e.getYDomain(n,"y2"))})}const Sp={prepareCanvasConfig(){var e,t;const{config:n,state:i}=this;this.warnUnsupportedCanvasOptions(),(e=i.orgConfig)!=null&&e.transition&&Object.prototype.hasOwnProperty.call(i.orgConfig.transition,"duration")&&i.orgConfig.transition.duration&&Hr("canvas mode: transition.duration is ignored; canvas redraws synchronously."),n.transition_duration=0,Jr(n.axis_x_type)||(n.axis_x_type="indexed"),Fi(n.axis_y_type)||(n.axis_y_type="indexed"),Fi(n.axis_y2_type)||(n.axis_y2_type="indexed"),(t=this.hasType)!=null&&t.call(this,"bubble")&&(n.point_show=!0,n.point_type="circle")},applyCanvasSubchartDomain(){const e=this,{axis:t,config:n,scale:i,state:a}=e;if(!n.subchart_show||!a.hasAxis||!i.subX)return;!a.rendered&&!a.domain&&n.subchart_init_range&&(a.domain=Ua(e,n.subchart_init_range));const s=Ua(e,a.domain);!s||!e.withinRange(s,e.getZoomDomain("subX",!0),e.getZoomDomain("subX"))||(a.domain=s,i.x.domain(s),t.x.scale(i.x))},setCanvasSubchartDomain(e,t=!0,n=!1){const i=this,{config:a,scale:s,state:o}=i,r=Ua(i,e);if(!(!a.subchart_show||!r||!i.withinRange(r,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))))return o.domain=r,s.zoom=null,t&&i.redraw({withTransition:!1,withY:a.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),n&&a.subchart_onbrush.bind(i.api)(o.domain),o.domain},clearCanvasSubchartDomain(e=!0,t=!1){var n;const i=this,{axis:a,config:s,org:o,scale:r,state:l}=i;s.subchart_show&&(l.domain=void 0,r.zoom=null,(n=o.xDomain)!=null&&n.length&&(r.x.domain(o.xDomain),a.x.scale(r.x)),e&&i.redraw({withTransition:!1,withUpdateXDomain:!0,withUpdateOrgXDomain:!1,withY:s.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t&&s.subchart_onbrush.bind(i.api)(r.x.orgDomain()))},flushCanvasFlow(){var e,t;const{state:n}=this;n.canvasFlowFinish&&(n.canvasFlowFrame!==null&&((t=(e=N).cancelAnimationFrame)==null||t.call(e,n.canvasFlowFrame)),n.canvasFlowFrame=null,n.canvasFlowFinish())},animateCanvasFlow(e){var t,n,i,a,s,o,r,l,c,u,d;const h=this,{axis:f,data:g,org:p,scale:_,state:x}=h,{done:m=()=>{},duration:v,length:b,orgDataCount:y}=e,T=(t=N.requestAnimationFrame)==null?void 0:t.bind(N),w=!!((n=f.isLog)!=null&&n.call(f,"x"));if(!T||!v||!b||!y||wp(h)>Hg)return!1;const C=_.x.domain().slice(0,2),k=(a=(i=p.xDomain)==null?void 0:i.slice)==null?void 0:a.call(i),S=(l=(o=(s=_.subX)==null?void 0:s.domain)==null?void 0:(r=o.call(s)).slice)==null?void 0:l.call(r);if(!sl(C,w))return!1;const A=g.targets.map(M=>M.values.splice(0,b));h.updateXDomain(h.filterTargetsToShow(g.targets),!0,!0);const L=_.x.domain().slice(0,2),E=(u=(c=p.xDomain)==null?void 0:c.slice)==null?void 0:u.call(c);if(g.targets.forEach((M,X)=>{M.values.unshift(...A[X])}),!sl(L,w))return k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),!1;Cp(h);let D=!1;const R=yp(),P=()=>{var M,X;D||(D=!0,g.targets.forEach(G=>{G.values.splice(0,b)}),E&&(p.xDomain=E),_.x.domain(L),(X=(M=_.subX)==null?void 0:M.domain)==null||X.call(M,E!=null?E:L),f.x.scale(_.x),x.dirty.data=!0,x._eventRectFingerprint=null,x.canvasShape=null,x._cachedDrawShape=null,h.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),h.updateTypesElements(),x.canvasFlowFrame=null,x.canvasFlowFinish=null,x.flowing=!1,m.call(h.api))},B=M=>{const X=Math.min(1,Math.max(0,(M-R)/v)),G=Tp(C,L,X,w);_.x.domain(G),f.x.scale(_.x),x.canvasShape=null,x._cachedDrawShape=null,x._canvasVisibleRangeCache=null,x._canvasXTickValuesCache=null,h.renderCanvasFrame(void 0,null,!1),X<1?x.canvasFlowFrame=T(B):P()};return k&&(p.xDomain=k),_.x.domain(C),S&&_.subX.domain(S),f.x.scale(_.x),x.flowing=!0,x.cancelClick=!0,(d=h.hideTooltip)==null||d.call(h),x.canvasFlowFinish=P,x.canvasFlowFrame=T(B),!0},initCanvas(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.chart.node();i.isCanvasMode=!0,i.canvasInlineStyle.minHeight=s.style.minHeight,N.getComputedStyle(s).position==="static"&&a.chart.style("position","relative"),a.chart.style("min-height",`${i.current.height}px`),t.canvasEngine=new bd,t.canvasEngine.init(s,i.current.width,t.getCanvasSurfaceHeight()),a.canvas=(0,O.select)(t.canvasEngine.canvas),t.canvasTheme=new Gh,t.canvasTheme.load(s,n.canvas_theme),t.canvasAxisRenderer=new xd(t.canvasEngine,t.canvasTheme),t.canvasRenderer=new Lh(t.canvasEngine,t.canvasTheme),t.hitDetector=new jh,t.bindCanvasEvents(),n.zoom_enabled&&((e=t.bindZoomEvent)==null||e.call(t))},warnUnsupportedCanvasOptions(){var e,t,n,i;const{config:a}=this;[[!Jr(a.axis_x_type),"axis.x.type other than indexed/category/log/timeseries"],[!Fi(a.axis_y_type),"axis.y.type other than indexed/log/timeseries"],[!Fi(a.axis_y2_type),"axis.y2.type other than indexed/log/timeseries"],[a.boost_useCssRule,"boost.useCssRule"],[(e=this.hasArcType)==null?void 0:e.call(this),"arc charts"],[(t=this.hasType)==null?void 0:t.call(this,"radar"),"radar chart"],[(n=this.hasType)==null?void 0:n.call(this,"polar"),"polar chart"],[(i=this.hasType)==null?void 0:i.call(this,"funnel"),"funnel chart"]].forEach(([o,r])=>{o&&Hr(`canvas mode: ${r} is not yet supported.`)})},bindCanvasEvents(){const e=this,{config:t,state:n,$el:i}=e,a=i.canvas.node(),s=mp(t),o=al(t);a.addEventListener("mousemove",e.onCanvasMouseMove.bind(e)),a.addEventListener("mouseenter",r=>{var l;n.event=r,(l=t.onover)==null||l.bind(e.api)(r)}),a.addEventListener("mouseout",e.onCanvasMouseOut.bind(e)),a.addEventListener("mouseleave",r=>{var l;n.event=r,(l=t.onout)==null||l.bind(e.api)(r)}),a.addEventListener("mousedown",r=>{var l;(l=e.onCanvasSubchartBrushStart)!=null&&l.call(e,r)||e.onCanvasSelectionDragStart(r)}),a.addEventListener("click",e.onCanvasClick.bind(e)),a.addEventListener("pointerdown",e.onCanvasPointerDown.bind(e)),a.addEventListener("pointerenter",e.onCanvasPointerEnter.bind(e)),a.addEventListener("pointermove",e.onCanvasPointerMove.bind(e)),a.addEventListener("pointerup",e.onCanvasPointerUp.bind(e)),a.addEventListener("pointerleave",e.onCanvasPointerOut.bind(e)),a.addEventListener("pointercancel",e.onCanvasPointerCancel.bind(e)),xp(t)&&(a.addEventListener("touchstart",r=>{s(r),e.onCanvasTouchStart(r)},o),a.addEventListener("touchmove",r=>{s(r),e.onCanvasTouchMove(r)},o),a.addEventListener("touchend",e.onCanvasTouchEnd.bind(e),o),a.addEventListener("touchcancel",e.onCanvasTouchCancel.bind(e),o))},updateHtmlLegend(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();if(!i.legend_show||a.hasTreemap){a.hasTreemap?((e=s.legend)==null||e.remove(),s.legend=null):(t=s.legend)==null||t.style("visibility","hidden"),a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0;return}const r=n.mapToIds(n.data.targets).filter(d=>i.data_names[d]!==null);if(i.legend_contents_bindto&&i.legend_contents_template){n.updateHtmlLegendTemplate(r)?(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0,a.legendHasRendered=!0):(a.legendItemWidth=0,a.legendItemHeight=0,a.legendStep=0);return}s.legend||(s.legend=(0,O.select)(o).append("div").classed(H.legend,!0).classed(oe.legend,!0)),s.legend.style("visibility",null);const l=s.legend.selectAll(`button.${H.legendItem}`).data(r,d=>d);l.exit().remove();const c=l.enter().append("button").attr("type","button").attr("data-id",d=>d);c.append("span").classed(H.legendItemTile,!0),c.append("span").classed(oe.legendItemTitle,!0);const u=c.merge(l).attr("class",d=>n.generateClass(H.legendItem,d).trim());jr(n,u),u.select(`.${H.legendItemTile}`).classed(oe.legendItemTileCircle,!i.legend_usePoint&&i.legend_item_tile_type==="circle").style("background-color",d=>i.legend_usePoint?null:n.color(d)).html(d=>i.legend_usePoint?Zg(n,d):""),u.select(`.${oe.legendItemTitle}`).text(d=>Mi(n,d)),i.legend_tooltip&&u.attr("title",d=>Mi(n,d)),qr(n,u),n.updateHtmlLegendSize(r),n.positionHtmlLegend(),a.legendHasRendered=!0},updateHtmlLegendTemplate(e){const t=this,{api:n,config:i,$el:a}=t,s=(0,O.select)(i.legend_contents_bindto),o=i.legend_contents_template,r=[];let l="";if(s.empty())return!1;e.forEach(u=>{const d=z(o)?Se(o.call(n,u,t.color(u),n.data(u)[0].values)):an(o,{COLOR:t.color(u),TITLE:u});d&&(r.push(u),l+=d)});const c=s.html(l).classed(H.legend,!0).classed(oe.legend,!1).style("visibility",null).selectAll(function(){return this.children}).data(r);return jr(t,c),qr(t,c),a.legend=s,!0},updateHtmlLegendSize(e){const t=this,{config:n,state:i,$el:a}=t,s=[],o={};let r=0,l=0,c=0;const u=n.legend_contents_bindto&&n.legend_contents_template;if(u)a.legend.selectAll(`.${H.legendItem}`).each(function(d){const h=ht(this,!0),f=`${Mi(t,d)}`,g=Math.max(32,f.length*7+24),p=20,_=Math.ceil(h.width||g),x=Math.ceil(h.height||p);s.push(_),r=Math.max(r,_),l=Math.max(l,x)});else if(e.length){const d=i.isLegendRight||i.isLegendInset,h=n.legend_item_tile_type!=="circle",f={width:h?n.legend_item_tile_width:n.legend_item_tile_r*2,height:h?n.legend_item_tile_height:n.legend_item_tile_r*2},g={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},p={offsets:{},widths:{},heights:{},margins:[0],steps:{}},_=e.map((w,C)=>{const k=`${Mi(t,w)}`,S=sp(t,k),A=Math.max(32,k.length*7),L=12,E=C===e.length-1,D=n.legend_show&&!t.isLegendToShow(w),R=D?0:((S==null?void 0:S.width)||A)+g.tileWidth+(E&&!d?0:g.padding.right)+n.legend_padding,P=D?0:((S==null?void 0:S.height)||L)+g.padding.top;return g.max.width=Math.max(g.max.width,R),g.max.height=Math.max(g.max.height,P),{id:w,hidden:D,width:R,height:P}}),x=d?t.getLegendHeight():t.getLegendWidth(),m=(w,C,k=!1)=>{let S;k||(S=(x-g.totalLength-C)/2,S<g.posMin&&(S=(x-C)/2,g.totalLength=0,g.step++)),p.steps[w]=g.step,p.margins[g.step]=i.isLegendInset?10:S,p.offsets[w]=g.totalLength,g.totalLength+=C};i.isLegendInset&&(g.step=n.legend_inset_step?n.legend_inset_step:e.length,i.legendStep=g.step),_.forEach(({id:w,hidden:C,width:k,height:S})=>{const A=n.legend_equally&&!C?g.max.width:k,L=n.legend_equally&&!C?g.max.height:S,E=d?L:A;if(p.widths[w]=A,p.heights[w]=L,s.push(A),r=Math.max(r,A),l=Math.max(l,L),C){p.steps[w]=0,p.offsets[w]=0;return}m(w,E)});const v=i.isLegendRight?w=>g.max.width*p.steps[w]:i.isLegendInset?w=>g.max.width*p.steps[w]+10:w=>p.margins[p.steps[w]]+p.offsets[w],b=i.isLegendRight||i.isLegendInset?w=>p.margins[p.steps[w]]+p.offsets[w]:w=>g.max.height*p.steps[w],y=4+f.width,T=9;_.forEach(({id:w,hidden:C})=>{const k=C?0:v(w),S=C?0:b(w);o[w]={item:{x:k,y:S-5,width:p.widths[w],height:p.heights[w]},title:{x:y,y:0,height:p.heights[w]},tile:{x:-2,y:T-f.height/2,width:f.width,height:f.height}}}),c=g.step}if(!e.length){i.legendItemWidth=0,i.legendItemHeight=0,i.legendStep=0;return}if(u){const d=Math.max(1,i.current.width),h=10;let f=1,g=0;s.forEach(p=>{g&&g+h+p>d?(f++,g=p):g+=(g?h:0)+p}),i.legendStep=Math.max(0,f-1)}else i.legendStep=c;i.legendItemWidth=r,i.legendItemHeight=Math.max(12,l),u||a.legend.selectAll(`button.${H.legendItem}`).each(function(d){const h=o[d],f=(0,O.select)(this);h&&(f.style("left",`${h.item.x}px`).style("top",`${h.item.y}px`).style("width",`${h.item.width}px`).style("height",`${h.item.height}px`),f.select(`.${oe.legendItemTitle}`).style("left",`${h.title.x}px`).style("top",`${h.title.y}px`).style("height",`${h.title.height}px`).style("line-height",`${h.title.height}px`),f.select(`.${H.legendItemTile}`).style("left",`${h.tile.x}px`).style("top",`${h.tile.y}px`).style("width",`${h.tile.width}px`).style("height",`${h.tile.height}px`))})},getCanvasBottomLegendHeight(){var e;const t=this,{config:n,state:i,$el:a}=t;if(!n.legend_show||i.isLegendRight||i.isLegendInset||i.hasTreemap||!a.legend||!i.legendItemHeight)return 0;const s=ht(a.legend.node(),!0).height,o=i.legendItemHeight*(i.legendStep+1);return Math.ceil(Math.max(((e=t.getLegendHeight)==null?void 0:e.call(t))||0,s||o))},getCanvasSurfaceHeight(){const e=this;return Math.max(0,e.state.current.height-e.getCanvasBottomLegendHeight())},positionHtmlLegend(){var e;const t=this,{config:n,state:i,$el:a}=t,s=a.legend;if(s.classed(oe.legendBottom,!i.isLegendRight&&!i.isLegendInset).classed(oe.legendRight,i.isLegendRight).classed(oe.legendInset,i.isLegendInset).style("top",null).style("right",null).style("bottom",null).style("left",null).style("width",null).style("height",null).style("min-height",null),i.isLegendRight)s.style("top",`${i.margin3.top}px`).style("right","0").style("bottom",`${i.margin3.bottom}px`).style("width",`${Math.max(0,t.getLegendWidth())}px`);else if(i.isLegendInset){if(i.isLegendInset){const o=i.isLegendTop,r=i.isLegendLeft;s.style(o?"top":"bottom",`${n.legend_inset_y}px`).style(r?"left":"right",`${n.legend_inset_x}px`).style("width",`${Math.max(0,i.legendItemWidth*(i.legendStep+1)+20)}px`)}}else{const o=((e=t.getLegendHeight)==null?void 0:e.call(t))||0;s.style("top",`${Math.max(0,i.current.height-o)}px`).style("right","0").style("bottom","auto").style("left","0")}},getCanvasSelectedData(e){const t=this,n=t.state.canvasSelection,i=[];return!t.config.data_selection_enabled||!(n!=null&&n.size)||Ja(t,a=>{(!e||a.id===e)&&n.has(Ke(a))&&i.push(a)}),i},setCanvasSelection(e=!1,t,n,i){var a;const s=this,{config:o,state:r}=s,l=r.canvasSelection,c=o.data_selection_grouped;let u=_p(t),d=!1;const h=e&&!o.data_selection_multiple;let f=!h;if(o.data_selection_enabled){if(h&&(n=n!=null&&n.length?[n[0]]:[0],!c))if(u)u=u.slice(0,1);else{const[g]=s.filterTargetsToShow(s.data.targets);u=g?[g.id]:[]}Ja(s,g=>{const p=Ke(g),_=c||!u||u.indexOf(g.id)>=0,x=!n||n.indexOf(g.index)>=0,m=l.has(p);if(e)if(_&&x&&(!m||h)){if(f||(s.setCanvasSelection(!1),f=!0),l.has(p))return;l.add(p),Y(o.data_onselected,s.api,g,s.canvasEngine.canvas),d=!0}else(!h||f)&&i&&m&&(l.delete(p),Y(o.data_onunselected,s.api,g,s.canvasEngine.canvas),d=!0);else _&&x&&m&&(l.delete(p),Y(o.data_onunselected,s.api,g,s.canvasEngine.canvas),d=!0)}),d&&((a=s.renderCanvasFrame)==null||a.call(s,void 0,null,!1))}},toggleCanvasSelection(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelection;let o=!1;i.data_selection_enabled&&(e.filter(r=>qa(n,r)).forEach(r=>{const l=Ke(r),c=s.has(l);i.data_selection_multiple||Ja(n,u=>{const d=Ke(u);(i.data_selection_grouped?u.id===r.id:d!==l)&&s.has(d)&&(s.delete(d),Y(i.data_onunselected,n.api,u,n.canvasEngine.canvas),o=!0)}),c&&s.has(l)?(s.delete(l),Y(i.data_onunselected,n.api,r,n.canvasEngine.canvas)):(s.add(l),Y(i.data_onselected,n.api,r,n.canvasEngine.canvas)),o=!0}),o&&((t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1)))},canStartCanvasSelectionDrag(e){const t=this,{config:n}=t,i=e;return!!(n.interaction_enabled&&n.data_selection_enabled&&n.data_selection_draggable&&n.data_selection_multiple&&!n.zoom_enabled&&(i.button===void 0||i.button===0))},getCanvasSelectionDragData(e){const t=this,{config:n}=t,i=t.hitDetector.findInRect(e,n.data_selection_grouped);if(!n.data_selection_grouped)return i;const a=new Set(i.map(s=>s.index));return t.filterTargetsToShow(t.data.targets).flatMap(s=>s.values.filter(o=>a.has(o.index)))},startCanvasSelectionDrag(e){var t,n;const i=this,{state:a}=i,s=Qn(i,e);return!s||!i.canStartCanvasSelectionDrag(e)?!1:(a.dragStart=s,a.canvasSelectionDragStart=s,a.canvasSelectionDragIncluded=new Set,a.canvasSelectionDragging=!0,a.canvasSelectionDragMoved=!1,Ii.set(i,new Map),i.setDragStatus(!0),(t=i.hideTooltip)==null||t.call(i),(n=e.preventDefault)==null||n.call(e),!0)},updateCanvasSelectionDrag(e){var t;const n=this,{config:i,state:a}=n,s=a.canvasSelectionDragStart,o=Qn(n,e);if(!a.canvasSelectionDragging||!s||!o)return!1;const[r,l]=s,[c,u]=o,d=Math.min(r,c),h=Math.max(r,c),f=i.data_selection_grouped?a.margin.top:Math.min(l,u),g=i.data_selection_grouped?a.margin.top+a.height:Math.max(l,u),p={x:d,y:f,w:h-d,h:g-f},_=Math.abs(c-r)>4||Math.abs(u-l)>4;if(a.canvasSelectionDragMoved=a.canvasSelectionDragMoved||_,_){const{included:x,rows:m}=pp(n,n.getCanvasSelectionDragData(p));m.length&&n.toggleCanvasSelection(m),a.canvasSelectionDragIncluded=x,a.cancelClick=!0}return n.renderCanvasSelectionDrag(p),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSelectionDrag(e){var t;const n=this,{state:i}=n;return i.canvasSelectionDragging?(n.updateCanvasSelectionDrag(e),i.cancelClick=i.cancelClick||i.canvasSelectionDragMoved,i.dragStart=null,i.canvasSelectionDragStart=null,i.canvasSelectionDragIncluded=new Set,i.canvasSelectionDragging=!1,i.canvasSelectionDragMoved=!1,Ii.delete(n),n.setDragStatus(!1),n.clearCanvasFocus(),(t=e.preventDefault)==null||t.call(e),!0):!1},dispatchCanvasDataOut(e){const t=this,{config:n,state:i}=t,a=i.canvasDataHover;a&&(i.canvasDataHover=null,i.canvasDataHoverKey=null,n.interaction_enabled&&Y(n.data_onout,t.api,a,e))},dispatchCanvasDataOver(e,t){const n=this,{config:i,state:a}=n,s=Ke(e);a.canvasDataHoverKey!==s&&(n.dispatchCanvasDataOut(t),a.canvasDataHover=e,a.canvasDataHoverKey=s,i.interaction_enabled&&e&&Y(i.data_onover,n.api,e,t))},dispatchCanvasDataClick(e,t=!1){var n;const i=this,{config:a,$el:s}=i,o=s.canvas.node(),r=rp(i,e,!0);if(!r||vp(i,r))return r;if(a.interaction_enabled){const l=a.data_selection_grouped?i.filterTargetsToShow(i.data.targets).map(c=>c.values[r.index]).filter(Boolean):[r];(n=i.toggleCanvasSelection)==null||n.call(i,l),l.forEach(c=>Y(a.data_onclick,i.api,c,o)),t&&bp(i,r)}return r},updateCanvasSubchartBrush(e){var t,n;const i=this,{config:a,state:s}=i,o=s.canvasSubchartBrushStart,r=s.canvasSubchartBrushOrigin,l=s.canvasSubchartBrushMode,c=Ka(i,e,!0);if(a.subchart_brush_enabled===!1||!s.canvasSubchartBrushDragging||o===null||c===null||!l)return!1;const u=c-o;if(Math.abs(u)>Yg&&(s.canvasSubchartBrushMoved=!0),!s.canvasSubchartBrushMoved)return(t=e.preventDefault)==null||t.call(e),!0;let d;if(l==="move"&&r){const[f,g]=Oi(i),p=r[1]-r[0];let _=r[0]+u,x=r[1]+u;_<f&&(x+=f-_,_=f),x>g&&(_-=x-g,x=g),d=[Math.max(f,Math.min(g-p,_)),Math.min(g,Math.max(f+p,x))]}else l==="resize-start"&&r?d=Za(i,c,r[1]):l==="resize-end"&&r?d=Za(i,r[0],c):d=Za(i,o,c);const h=fp(i,d[0],d[1]);return i.setCanvasSubchartDomain(h,!0),s.cancelClick=!0,(n=e.preventDefault)==null||n.call(e),!0},updateCanvasSubchartCursor(e){const t=this,n=t.$el.canvas.node();if(t.config.subchart_brush_enabled===!1)return n.style.cursor="",!1;const i=Ka(t,e);if(i===null)return n.style.cursor="",!1;const a=nl(t,i);return n.style.cursor=gp(t,a),!0},startCanvasSubchartBrush(e){var t;const n=this,{state:i}=n;if(n.config.subchart_brush_enabled===!1)return!1;const a=Ka(n,e);if(a===null)return!1;const s=nl(n,a);return i.event=e,i.canvasSubchartBrushDragging=!0,i.canvasSubchartBrushMode=s,i.canvasSubchartBrushStart=a,i.canvasSubchartBrushOrigin=el(n),i.canvasSubchartBrushMoved=!1,i.cancelClick=!0,n.setDragStatus(!0),(t=e.preventDefault)==null||t.call(e),!0},endCanvasSubchartBrush(e){var t,n,i;const a=this,{state:s}=a;if(!s.canvasSubchartBrushDragging)return!1;a.updateCanvasSubchartBrush(e);const o=s.canvasSubchartBrushMode==="select"&&!s.canvasSubchartBrushMoved,r=s.canvasSubchartBrushMoved||o;return o?(t=a.clearCanvasSubchartDomain)==null||t.call(a,!0,!0):r&&a.config.subchart_onbrush.bind(a.api)((n=s.domain)!=null?n:a.scale.x.orgDomain()),s.canvasSubchartBrushDragging=!1,s.canvasSubchartBrushMode=null,s.canvasSubchartBrushStart=null,s.canvasSubchartBrushOrigin=null,s.canvasSubchartBrushMoved=!1,a.setDragStatus(!1),(i=e.preventDefault)==null||i.call(e),!0},cancelCanvasSubchartBrush(e){var t;const n=this,{state:i}=n;return i.canvasSubchartBrushDragging?(i.canvasSubchartBrushDragging=!1,i.canvasSubchartBrushMode=null,i.canvasSubchartBrushStart=null,i.canvasSubchartBrushOrigin=null,i.canvasSubchartBrushMoved=!1,n.setDragStatus(!1),(t=e.preventDefault)==null||t.call(e),!0):!1},onCanvasSubchartBrushStart(e){const t=this;if(!t.startCanvasSubchartBrush(e))return!1;const n=a=>{t.updateCanvasSubchartBrush(a)},i=a=>{t.endCanvasSubchartBrush(a),N.removeEventListener("mousemove",n),N.removeEventListener("mouseup",i)};return N.addEventListener("mousemove",n),N.addEventListener("mouseup",i),!0},onCanvasClick(e){var t;const n=this,{config:i,state:a}=n;if(a.event=e,a.flowing||a.cancelClick){a.cancelClick=!1;return}n.dispatchCanvasDataClick(e),(t=i.onclick)==null||t.bind(n.api)(e)},onCanvasSelectionDragStart(e){const t=this,{state:n}=t;if(!t.startCanvasSelectionDrag(e))return;const i=s=>{t.updateCanvasSelectionDrag(s)},a=s=>{t.endCanvasSelectionDrag(s),N.removeEventListener("mousemove",i),N.removeEventListener("mouseup",a),n.canvasSelectionDragMoveHandler=null,n.canvasSelectionDragEndHandler=null};n.canvasSelectionDragMoveHandler=i,n.canvasSelectionDragEndHandler=a,N.addEventListener("mousemove",i),N.addEventListener("mouseup",a)},onCanvasPointerDown(e){var t;if(!Sn(this,e))return;const n=this,i=n.$el.canvas.node();if(!n.startCanvasSubchartBrush(e))return;const a=e.pointerId,s=u=>u.pointerId===a,o=u=>{s(u)&&n.updateCanvasSubchartBrush(u)},r=u=>{s(u)&&(n.endCanvasSubchartBrush(u),c())},l=u=>{s(u)&&(n.cancelCanvasSubchartBrush(u),c())};function c(){var u;N.removeEventListener("pointermove",o),N.removeEventListener("pointerup",r),N.removeEventListener("pointercancel",l);try{(u=i.releasePointerCapture)==null||u.call(i,a)}catch(d){}}try{(t=i.setPointerCapture)==null||t.call(i,a)}catch(u){}N.addEventListener("pointermove",o),N.addEventListener("pointerup",r),N.addEventListener("pointercancel",l)},onCanvasPointerEnter(e){var t;Sn(this,e)&&(this.state.event=e,(t=this.config.onover)==null||t.bind(this.api)(e))},onCanvasPointerMove(e){Sn(this,e)&&(this.updateCanvasSubchartBrush(e)||this.onCanvasMouseMove(e))},onCanvasPointerUp(e){var t;if(Sn(this,e)){if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node())}},onCanvasPointerOut(e){var t;Sn(this,e)&&(this.state.canvasSubchartBrushDragging||(this.state.event=e,this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)))},onCanvasPointerCancel(e){var t;if(Sn(this,e)){if(this.state.event=e,this.cancelCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}this.onCanvasPointerOut(e)}},onCanvasTouchStart(e){var t;e.touches.length>1||(this.state.event=e,!this.startCanvasSubchartBrush(e)&&(this.startCanvasSelectionDrag(e)||((t=this.config.onover)==null||t.bind(this.api)(e),this.onCanvasMouseMove(e))))},onCanvasTouchMove(e){e.touches.length>1||this.updateCanvasSubchartBrush(e)||this.updateCanvasSelectionDrag(e)||this.onCanvasMouseMove(e)},onCanvasTouchEnd(e){var t,n,i;if(this.state.event=e,this.endCanvasSubchartBrush(e)){(t=this.config.onout)==null||t.bind(this.api)(e);return}if(this.endCanvasSelectionDrag(e)){(n=this.config.onout)==null||n.bind(this.api)(e);return}this.dispatchCanvasDataClick(e,!0),this.dispatchCanvasDataOut(this.$el.canvas.node()),(i=this.config.onout)==null||i.bind(this.api)(e)},onCanvasTouchCancel(e){var t;this.state.event=e,this.cancelCanvasSubchartBrush(e),this.endCanvasSelectionDrag(e),this.onCanvasMouseOut(),(t=this.config.onout)==null||t.bind(this.api)(e)},onCanvasMouseMove(e){var t,n,i,a,s;const o=this,{config:r,state:l,$el:c}=o,u=c.canvas.node();if(l.event=e,l.flowing||l.canvasSelectionDragging)return;if((t=o.updateCanvasSubchartCursor)!=null&&t.call(o,e)){o.dispatchCanvasDataOut(u),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),(n=o.hideTooltip)==null||n.call(o);return}const d=Qn(o,e),h=d&&(hp(o,d)||d),f=h?up(o,h):null;if(!f){if(o.dispatchCanvasDataOut(u),l.canvasFocusKey&&(l.canvasFocusKey=null,o.clearCanvasFocus()),d&&r.axis_tooltip&&cp(o,d)){o.renderCanvasAxisTooltip(d),(i=o.hideTooltip)==null||i.call(o);return}(a=o.hideTooltip)==null||a.call(o);return}o.dispatchCanvasDataOver(f,u);const g=Qr(o,f),p=dp(o,f,g),_=p.map(x=>`${x.id}:${x.index}`).join("|");(l.canvasFocusKey!==_||r.axis_tooltip)&&(l.canvasFocusKey=_,o.renderCanvasFocus(p,h)),(s=o.showTooltip)==null||s.call(o,g,u)},onCanvasMouseOut(){var e;const t=this.$el.canvas.node();t.style.cursor="",this.dispatchCanvasDataOut(t),this.state.canvasFocusKey?(this.state.canvasFocusKey=null,this.clearCanvasFocus()):this.config.axis_tooltip&&this.clearCanvasFocus(),(e=this.hideTooltip)==null||e.call(this)},showCanvasLinkedTooltip(e){var t,n,i,a;const s=this,{$el:o,state:r}=s,l=(t=o.canvas)==null?void 0:t.node(),u=s.filterTargetsToShow(s.data.targets).map(x=>x.values[e]).find(Boolean);if(!l||!u)return(n=s.hideTooltip)==null||n.call(s),!1;const d=Qr(s,u),h=d.find(x=>x&&Rt(s,x))||d[0];if(!d.length||!h)return(i=s.hideTooltip)==null||i.call(s),!1;const{left:f,top:g}=ht(l,!0),p=Nn(s,h),_=[r.margin.left+p.x,r.margin.top+p.y];return r.event={clientX:f+_[0],clientY:g+_[1],currentTarget:l,target:l},r.canvasFocusKey=d.map(x=>`${x.id}:${x.index}`).join("|"),s.renderCanvasFocus(d,_),(a=s.showTooltip)==null||a.call(s,d,l),!0},renderCanvasZoomBrush(e,t){const n=this;n.canvasEngine.withOverlay(i=>{n.canvasRenderer.withContext(i,()=>{n.canvasRenderer.drawZoomBrush(n,e,t)})})},clearCanvasZoomBrush(){this.canvasEngine.clearOverlay()},renderCanvasSelectionDrag(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasRenderer.withContext(n,()=>{t.canvasRenderer.drawSelectionDragArea(t,e)})})},renderCanvasFrame(e,t,n=!1){const i=this,{state:a}=i,s=e||a.canvasShape||i.getDrawShape();a.canvasShape=s,a._canvasVisibleRangeCache=null,a._canvasXTickValuesCache=null,i.canvasEngine.beginFrame(a.current.width,i.getCanvasSurfaceHeight());try{i.canvasRenderer.drawBackground(i),i.canvasAxisRenderer.drawTitle(i),a.hasAxis&&i.canvasAxisRenderer.draw(i),i.canvasRenderer.draw(i,s),a.hasAxis&&i.config.grid_lines_front&&i.canvasAxisRenderer.drawGridLines(i),i.canvasRenderer.drawSubchart(i,s),a.hasAxis&&i.canvasAxisRenderer.drawSubXAxis(i),a.hasAxis&&i.canvasAxisRenderer.drawSubYAxes(i),i.canvasRenderer.drawEmptyLabel(i),n&&i.hitDetector.rebuild(i,s)}finally{i.canvasEngine.endFrame()}i.canvasEngine.clearOverlay(),a.canvasFocusMainRedraw=!1,t&&i.renderCanvasFocus(t)},renderCanvasFocus(e,t){var n,i;const a=this,{state:s}=a,o=(i=(n=a.canvasRenderer).hasExpandedShapeFocus)==null?void 0:i.call(n,a,e);if(o){const r=s.canvasShape||a.getDrawShape();a.canvasEngine.beginFrame(s.current.width,a.getCanvasSurfaceHeight());try{a.canvasRenderer.drawBackground(a),a.canvasAxisRenderer.drawTitle(a),s.hasAxis&&a.canvasAxisRenderer.draw(a),a.canvasRenderer.draw(a,r,e),s.hasAxis&&a.config.grid_lines_front&&a.canvasAxisRenderer.drawGridLines(a),a.canvasRenderer.drawSubchart(a,r),s.hasAxis&&a.canvasAxisRenderer.drawSubXAxis(a),s.hasAxis&&a.canvasAxisRenderer.drawSubYAxes(a),a.canvasRenderer.drawEmptyLabel(a)}finally{a.canvasEngine.endFrame()}}s.canvasFocusMainRedraw=!!o,a.canvasEngine.withOverlay(r=>{a.canvasRenderer.withContext(r,()=>{a.canvasRenderer.drawFocus(a,e)}),a.canvasAxisRenderer.withContext(r,()=>{a.canvasAxisRenderer.drawFocusedXAxisTick(a,e),t&&a.canvasAxisRenderer.drawAxisTooltip(a,t)})})},renderCanvasAxisTooltip(e){const t=this;t.canvasEngine.withOverlay(n=>{t.canvasAxisRenderer.withContext(n,()=>{t.canvasAxisRenderer.drawAxisTooltip(t,e)})})},clearCanvasFocus(){var e;const t=this;t.state.canvasFocusMainRedraw?(t.state.canvasFocusMainRedraw=!1,t.renderCanvasFrame(void 0,null,!1)):(e=t.canvasEngine)==null||e.clearOverlay()},resizeCanvas(){var e,t;const n=this,{config:i,state:a,$el:s}=n,o=s.chart.node();s.chart.style("min-height",`${a.current.height}px`),(e=n.canvasEngine)==null||e.resize(a.current.width,n.getCanvasSurfaceHeight()),(t=n.canvasTheme)==null||t.reload(o,i.canvas_theme)}};let ol=()=>(St(ge.prototype,Sp),(ol=()=>"canvas")());var rl={category(e,t){const n=this.internal,{config:i}=n;return arguments.length>1&&(i.axis_x_categories[e]=t,n.state.dirty.data=!0,n.redraw()),i.axis_x_categories[e]},categories(e){const t=this.internal,{config:n}=t;if(!e||!Array.isArray(e)){const i=n.axis_x_categories;return se(i)?Object.values(t.data.xs)[0]:i}return n.axis_x_categories=e,t.state.dirty.data=!0,t.redraw(),n.axis_x_categories}};function kp(e){const t=this.config;let n,i,a;const s=()=>{const o=i.shift();if(o&&n&&Kt(n)&&o in n)return n=n[o],s();if(!o)return n};Object.keys(t).forEach(o=>{n=e,i=o.split("_"),a=s(),ct(a)&&(t[o]=a)}),this.api&&(this.state.orgConfig=e)}var Ap={resize(e){const t=this.internal,{config:n,state:i}=t;i.rendered&&(n.size_width=e?e.width:null,n.size_height=e?e.height:null,i.resizing=!0,i.dirty.size=!0,this.flush(!1),t.resizeFunction())},flush(e){var t,n;const i=this.internal,{state:a,$el:{zoomResetBtn:s}}=i;a.rendered?(a.resizing?(t=i.brush)==null||t.updateResize():(n=i.axis)==null||n.setOrient(),s==null||s.style("display","none"),i.scale.zoom&&(a.current.zoomDomain=i.scale.zoom.domain()),i.scale.zoom=null,a.resizing||(a.dirty.data=!0),e?i.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):i.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1}),!a.resizing&&i.brush&&(i.brush.getSelection().call(i.brush.move),i.unselectRect()),a.current.zoomDomain&&(i.api.zoom(a.current.zoomDomain),a.current.zoomDomain=null)):i.initToRender(!0)},destroy(){var e,t,n,i,a,s,o,r,l,c;const u=this.internal,{state:d,$el:{chart:h,style:f,svg:g}}=u;if(yt(u)){u.callPluginHook("$willDestroy"),(e=u.cache)==null||e.remove(["setOverOut","callOverOutForTouch"]),u.charts.splice(u.charts.indexOf(this),1),u.charts.length===0&&Of(),u.unbindAllEvents(),g==null||g.select("*").interrupt(),d.canvasFlowFrame!==null&&((n=(t=N).cancelAnimationFrame)==null||n.call(t,d.canvasFlowFrame)),d.canvasFlowFrame=null,d.canvasFlowFinish=null,d.pendingRaf!==null&&((a=(i=N).cancelAnimationFrame)==null||a.call(i,d.pendingRaf)),d.pendingRaf=null,(s=u.canvasRenderer)==null||s.destroy(),(o=u.canvasEngine)==null||o.destroy(),(r=u.resizeFunction)==null||r.clear(),(c=(l=u.resizeFunction)==null?void 0:l.resizeObserver)==null||c.disconnect(),u.resizeFunction&&N.removeEventListener("resize",u.resizeFunction),h.classed("bb",!1).style("position",null),d.isCanvasMode&&h.style("min-height",d.canvasInlineStyle.minHeight||null),h.selectChildren().remove(),f&&f.parentNode.removeChild(f),Object.keys(this).forEach(p=>{p==="internal"&&Object.keys(u).forEach(_=>{u[_]=null}),this[p]=null,delete this[p]});for(const p in this)this[p]=()=>{}}return null},config(e,t,n){const i=this.internal,{config:a,state:s}=i,o=e==null?void 0:e.replace(/\./g,"_");let r;return e&&o in a?ct(t)?(a[o]=t,r=t,n&&this.flush()):r=a[o]:(arguments.length===0||se(e))&&(r=s.orgConfig),r}},Lp={color(e){return this.internal.color(e)}};const ll=function(e){const{targets:t}=this.internal.data;if(!Ct(e)){const n=ot(e)?e:[e];return t.filter(i=>n.some(a=>a===i.id))}return t};St(ll,{shown:function(e){return this.internal.filterTargetsToShow(this.data(e))},values:function(e,t=!0){let n=null;if(e){const i=this.data(e);ot(i)&&(n=[],i.forEach(a=>{const s=a.values.map(o=>o.value);t?n=n.concat(s):n.push(s)}))}return n},names:function(e){return this.internal.updateDataAttributes("names",e)},colors:function(e){return this.internal.updateDataAttributes("colors",e)},axes:function(e){return this.internal.updateDataAttributes("axes",e)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});var Rp={data:ll},Ep={focus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n),r=new Set(o),l=n.mapToTargetIds().filter(c=>!r.has(c)&&n.isTargetToShow(c));n.revertLegend(),n.toggleFocusLegend(l,!1),n.toggleFocusLegend(o,!0),i.focusedTargetIds=r,i.defocusedTargetIds=new Set(l),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}const s=n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n)));this.revert(),this.defocus(),s.classed(lt.focused,!0).classed(lt.defocused,!1),n.hasArcType()&&!i.hasRadar&&(n.expandArc(a),n.hasType("gauge")&&n.markOverlapped(e,n,`.${ae.gaugeValue}`)),n.toggleFocusLegend(a,!0),i.focusedTargetIds=new Set(a),a.forEach(o=>i.defocusedTargetIds.delete(o))},defocus(e){var t;const n=this.internal,{state:i}=n,a=n.mapToTargetIds(e);if(i.isCanvasMode){const o=a.filter(n.isTargetToShow,n);n.toggleFocusLegend(o,!1),o.forEach(r=>i.focusedTargetIds.delete(r)),i.defocusedTargetIds=new Set(o),(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1);return}n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n))).classed(lt.focused,!1).classed(lt.defocused,!0),n.hasArcType(null,["polar"])&&(n.unexpandArc(a),n.hasType("gauge")&&n.undoMarkOverlapped(n,`.${ae.gaugeValue}`)),n.toggleFocusLegend(a,!1),a.forEach(o=>i.focusedTargetIds.delete(o)),i.defocusedTargetIds=new Set(a)},revert(e){var t,n,i;const a=this.internal,{config:s,state:o,$el:r}=a,l=a.mapToTargetIds(e),c=()=>{s.legend_show&&(a.showLegend(l.filter(a.isLegendToShow.bind(a))),r.legend.selectAll(a.selectorLegends(l)).filter(function(){return(0,O.select)(this).classed(lt.legendItemFocused)}).classed(lt.legendItemFocused,!1))};if(o.isCanvasMode){const d=!!((t=o.focusedTargetIds)!=null&&t.size)||!!((n=o.defocusedTargetIds)!=null&&n.size);c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set,d&&((i=a.renderCanvasFrame)==null||i.call(a,void 0,null,!1));return}r.svg.selectAll(a.selectorTargets(l)).classed(lt.focused,!1).classed(lt.defocused,!1),a.hasArcType(null,["polar"])&&a.unexpandArc(l),c(),o.focusedTargetIds=new Set,o.defocusedTargetIds=new Set}},Pp={legend:{show:function(e){const t=this.internal;t.showLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})},hide:function(e){const t=this.internal;t.hideLegend(t.mapToTargetIds(e)),t.updateAndRedraw({withLegend:!0})}}},Dp={load(e){const t=this.internal,{config:n}=t;t.state.dirty.data=!0,t.state._eventRectFingerprint=null,e.xs&&t.addXs(e.xs),"names"in e&&this.data.names(e.names),"classes"in e&&Object.keys(e.classes).forEach(s=>{n.data_classes[s]=e.classes[s]}),"categories"in e&&t.axis.isCategorized()&&(n.axis_x_categories=e.categories),"axes"in e&&Object.keys(e.axes).forEach(s=>{n.data_axes[s]=e.axes[s]}),"colors"in e&&Object.keys(e.colors).forEach(s=>{n.data_colors[s]=e.colors[s]}),"regions"in e&&(n.data_regions=e.regions||{});const i=["data","columns","rows","json","url"].some(s=>s in e),a="unload"in e&&e.unload!==!1;if("regions"in e&&!i&&!a){t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),Ri.call(t,e.done,e.resizeAfter);return}if(a){const s=t.mapToTargetIds(e.unload===!0?null:e.unload);t.unload(s,()=>{!t.config||!t.cache||(t.cache.remove(s),ys(()=>t.loadFromArgs(e)))})}else t.loadFromArgs(e)},unload(e){const t=this.internal;let n=e||{};se(n)&&this.tooltip.hide(),ot(n)?n={ids:n}:Q(n)&&(n={ids:[n]});const i=t.mapToTargetIds(n.ids);t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.unload(i,()=>{!t.config||!t.cache||(t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),t.cache.remove(i),Ri.call(t,n.done,n.resizeAfter))})}};function $i(e,t,n,i=!1){var a;const s=this.internal,o=s.mapToTargetIds(t),r=new Set(o),l=[...s.state.hiddenTargetIds].filter(d=>r.has(d));if(s.state.toggling=!0,s.state.dirty.visibility=!0,s[`${e?"remove":"add"}HiddenTargetIds`](o),s.state.isCanvasMode){e&&l.length?Y(s.config.data_onshown,this,l):!e&&l.length===0&&Y((a=s.config)==null?void 0:a.data_onhidden,this,o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1;return}const c=s.$el.svg.selectAll(s.selectorTargets(o)),u=e?null:"0";e&&l.length&&(c.style("display",null),Y(s.config.data_onshown,this,l)),s.$T(c).style("opacity",u,"important").call(li,()=>{var d;!e&&l.length===0&&(c.style("display","none"),Y((d=s.config)==null?void 0:d.data_onhidden,this,o)),c.style("opacity",u)}),n.withLegend&&s[`${e?"show":"hide"}Legend`](o),i||s.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),s.state.toggling=!1}var Ip={show(e,t={}){$i.call(this,!0,e,t)},hide(e,t={}){$i.call(this,!1,e,t)},toggle(e,t={}){const n=this.internal,i={show:[],hide:[]};n.mapToTargetIds(e).forEach(a=>i[n.isTargetToShow(a)?"hide":"show"].push(a)),i.show.length&&i.hide.length?($i.call(this,!0,i.show,t,!0),$i.call(this,!1,i.hide,t)):(i.show.length&&this.show(i.show,t),i.hide.length&&this.hide(i.hide,t))}},Mp={tooltip:{show:function(e){var t,n,i,a,s,o,r,l,c,u,d,h;const f=this.internal,{$el:g,config:p,state:{eventReceiver:_,hasFunnel:x,hasTreemap:m,inputType:v}}=f;let b,y;if(e.mouse&&(y=e.mouse),e.data){const{data:T}=e,w=(t=f.getYScaleById(T.id))==null?void 0:t(T.value);if((x||m)&&T.id){const C=f.selectorTarget(T.id,void 0,`.${At.shape}`);_.rect=g.main.select(C)}else f.isMultipleX()?y=[f.xx(T),w]:(p.tooltip_grouped||(y=[0,w]),b=(i=T.index)!=null?i:f.hasArcType()&&T.id?(n=f.getArcElementByIdOrIndex(T.id))==null?void 0:n.datum().index:f.getIndexByX(T.x))}else ct(e.x)?b=f.getIndexByX(e.x):ct(e.index)&&(b=e.index);if(f.state.isCanvasMode){const T=((a=f.filterTargetsToShow)==null?void 0:a.call(f))||f.data.targets,w=(s=e.data)!=null&&s.id&&!p.tooltip_grouped?T.filter(L=>L.id===e.data.id).map(L=>L.values[b!=null?b:e.data.index]).filter(Boolean):T.map(L=>L.values[b]).filter(Boolean),C=(r=(o=g.canvas)==null?void 0:o.node)==null?void 0:r.call(o),k=f.state.canvasShape||((l=f.getDrawShape)==null?void 0:l.call(f)),S=w[0],A=y||(S&&((c=k==null?void 0:k.pos)!=null&&c.cx)&&((u=k==null?void 0:k.pos)!=null&&u.cy)?[f.state.margin.left+k.pos.cx(S),f.state.margin.top+k.pos.cy(S)]:void 0);if(!w.length||!C)return;f.state.canvasFocusKey=w.map(L=>`${L.id}:${L.index}`).join("|"),(d=f.renderCanvasFocus)==null||d.call(f,w,A),(h=f.showTooltip)==null||h.call(f,w,C);return}(v==="mouse"?["mouseover","mousemove"]:["touchstart"]).forEach(T=>{f.dispatchEvent(T,b,y)})},hide:function(){var e,t,n,i,a;const s=this.internal,{state:{inputType:o,isCanvasMode:r},$el:{tooltip:l}}=s,c=l==null?void 0:l.datum();if(r){s.state.canvasFocusKey=null,s.hideTooltip(!0),(e=s.clearCanvasFocus)==null||e.call(s);return}if((t=c==null?void 0:c.data)!=null&&t[0]){const{index:u}=c.data[0];(o==="mouse"?["mouseout"]:["touchend"]).forEach(d=>{s.dispatchEvent(d,u)})}o==="touch"&&s.callOverOutForTouch(),s.hideTooltip(!0),(n=s.hideGridFocus)==null||n.call(s),(i=s.unexpandCircles)==null||i.call(s),(a=s.expandBarTypeShapes)==null||a.call(s,!1)}}},Fp=Object.defineProperty,Op=(e,t,n)=>t in e?Fp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cl=(e,t,n)=>Op(e,typeof t!="symbol"?t+"":t,n);class Ht{constructor(t){cl(this,"plugins",[]),cl(this,"internal");const n=new ge(this);this.internal=n,(function i(a,s,o){Object.keys(a).forEach(r=>{const l=z(a[r]),c=s!==o,u=yt(a[r]),d=u&&Object.keys(a[r]).length>0;l&&(!c&&d||c)?s[r]=a[r].bind(o):u&&!l?s[r]={}:s[r]=a[r],d&&i(a[r],s[r],o)})})(Ht.prototype,this,this),kp.call(n,t),n.beforeInit(),n.init()}}St(Ht.prototype,[Ap,Lp,Rp,Ep,Pp,Dp,Ip,Mp]);let ul=()=>(Ht.prototype.category=rl.category,Ht.prototype.categories=rl.categories,(ul=()=>({}))());const $p=e=>{var t,n;return(n=(t=N).btoa)==null?void 0:n.call(t,encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(i,a)=>String.fromCharCode(+`0x${a}`)))};function Bp(e,t,n){const{width:i,height:a}=t||n,s=new XMLSerializer,o=e.cloneNode(!0),r=yf(nn(nt.styleSheets)).filter(h=>h.cssText).map(h=>h.cssText);o.setAttribute("xmlns",O.namespaces.xhtml),o.style.margin="0",o.style.padding="0",t.preserveFontStyle&&o.querySelectorAll("text").forEach(h=>{h.innerHTML=""});const l=s.serializeToString(o),c=nt.createElement("style");c.appendChild(nt.createTextNode(r.join(`
31
+ `)));const u=s.serializeToString(c),d=`<svg xmlns="${O.namespaces.svg}" width="${i}" height="${a}"
37
32
  viewBox="0 0 ${n.width} ${n.height}"
38
33
  preserveAspectRatio="${(t==null?void 0:t.preserveAspectRatio)===!1?"none":"xMinYMid meet"}">
39
34
  <foreignObject width="100%" height="100%">
40
- ${d}
35
+ ${u}
41
36
  ${l.replace(/(url\()[^#]+/g,"$1")}
42
- </foreignObject></svg>`;return`data:image/svg+xml;base64,${zg(u)}`}function Xg(e,t){const{top:n,left:i}=t,{x:a,y:s}=Xe(e,!0),{a:o,b:r,c:l,d:c,e:d,f:u}=e.getScreenCTM(),{width:h,height:f}=ht(e,!0);return{x:o*a+l*s+d-i,y:r*a+c*s+u-n+(f-Math.round(f/4)),width:h,height:f}}function Gg(e){const{left:t,top:n}=ht(e),i=s=>s.textContent||s.childElementCount,a=[];return je(e.querySelectorAll("text")).filter(i).forEach(s=>{const o=r=>{const{fill:l,fontFamily:c,fontSize:d,textAnchor:u,transform:h}=B.getComputedStyle(r),{x:f,y:g,width:p,height:x}=Xg(r,{left:t,top:n});return{[r.textContent]:{x:f,y:g,width:p,height:x,fill:l,fontFamily:c,fontSize:d,textAnchor:u,transform:h}}};s.childElementCount>1?je(s.querySelectorAll("tspan")).filter(i).forEach(r=>{a.push(o(r))}):a.push(o(s))}),a}function Wg(e,t){t.forEach(n=>{Object.keys(n).forEach(i=>{const{x:a,y:s,width:o,height:r,fill:l,fontFamily:c,fontSize:d,transform:u}=n[i];if(e.save(),e.font=`${d} ${c}`,e.fillStyle=l,u==="none")e.fillText(i,a,s);else{const h=u.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(f=>+f==0)?(h.push(a+o-o/4),h.push(s-r+r/3)):(h.push(a),h.push(s)),e.transform(...h),e.fillText(i,0,0)}e.restore()})})}function Vg(e,t,n){const{width:i,height:a}=t||n,s=tt.createElement("canvas"),o=s.getContext("2d");if(s.width=i,s.height=a,o){let l=0,c=i,d=a;if((t==null?void 0:t.preserveAspectRatio)!==!1){const u=Math.min(i/n.width,a/n.height);c=n.width*u,d=n.height*u,l=(a-d)/2}o.drawImage(e,0,0,e.width,e.height,0,l,c,d)}return s.toDataURL(t.mimeType)}var Hg={export(e,t){var n;const i=this.internal,{state:a,$el:{chart:s,svg:o}}=i,r=(n=i.canvasEngine)==null?void 0:n.canvas,l=a.isCanvasMode&&r?ht(r,!0):null,{width:c,height:d}=l&&l.width&&l.height?{width:l.width,height:l.height}:a.current,u=ve(Object.create(null),{width:c,height:d,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e);if(a.isCanvasMode&&r){const g=Vg(r,u,{width:c,height:d});return t==null||t.bind(this)(g),g}const h=Ng(s.node(),u,{width:c,height:d}),f=u.preserveFontStyle?Gg(o.node()):[];if(t&&O(t)){const g=new Image;g.crossOrigin="Anonymous",g.onload=()=>{const p=tt.createElement("canvas"),x=p.getContext("2d");p.width=u.width||c,p.height=u.height||d,x.drawImage(g,0,0),f.length&&(Wg(x,f),f.length=0),t.bind(this)(p.toDataURL(u.mimeType))},g.src=h}return h}};let Tr=()=>(Wt.prototype.export=Hg.export,(Tr=()=>({}))());var Yg={flow(e){const t=this.internal;let n;(e.json||e.rows||e.columns)&&t.convertData(e,a=>{n=a,i()});function i(){var a,s,o;let r,l=0,c=0,d,u;if(t.state.redrawing||!n||!Gn())return;(a=t.flushCanvasFlow)==null||a.call(t);const h=[],f=t.getMaxDataCount(),g=t.convertDataToTargets(n,!0),p=t.axis.isTimeSeries();t.data.targets.forEach(v=>{let m=!1;for(let b=0;b<g.length;b++)if(v.id===g[b].id){m=!0,v.values[v.values.length-1]&&(c=v.values[v.values.length-1].index+1);const y=g[b].values;l=y.length;for(let T=0;T<l;T++)y[T].index=c+T,p||(y[T].x=c+T),v.values.push(y[T]);g.splice(b,1);break}!m&&h.push(v.id)}),t.data.targets.forEach(v=>{for(let m=0;m<h.length;m++)if(v.id===h[m]){if(!v.values[v.values.length-1])continue;c=v.values[v.values.length-1].index+1;for(let b=0;b<l;b++)v.values.push({id:v.id,index:c+b,x:p?t.getOtherTargetX(c+b):c+b,value:null})}}),t.data.targets.length&&g.forEach(v=>{const m=t.data.targets[0].values[0].index,b=v.values,y=b.length,T=Math.max(c-m,0);if(T){b.length=y+T;for(let w=y-1;w>=0;w--)b[w+T]=b[w];for(let w=0;w<T;w++){const C=m+w;b[w]={id:v.id,index:C,x:p?t.getOtherTargetX(C):C,value:null}}}for(let w=T;w<b.length;w++){const C=b[w];C.index+=c,p||(C.x+=c)}});for(let v=0;v<g.length;v++)t.data.targets.push(g[v]);const x=t.data.targets[0],_=x.values[0];if(ct(e.to)?(l=0,u=p?Xt.call(t,e.to):e.to,x.values.forEach(v=>{v.x<u&&l++})):ct(e.length)&&(l=e.length),f?f===1&&p&&(d=(x.values[x.values.length-1].x-_.x)/2,r=[new Date(+_.x-d),new Date(+_.x+d)]):(p?d=x.values.length>1?x.values[x.values.length-1].x-_.x:_.x-t.getXDomain(t.data.targets)[0]:d=1,r=[_.x-d,_.x]),r&&t.updateXDomain(null,!0,!0,!1,r),t.state.isCanvasMode){const v=J(e.duration)?e.duration:t.config.transition_duration;if((s=t.animateCanvasFlow)==null?void 0:s.call(t,{done:e.done,duration:v,length:l,orgDataCount:f}))return;l&&f&&t.data.targets.forEach(b=>{b.values.splice(0,l)}),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),t.updateTypesElements(),(o=e.done)==null||o.call(t.api);return}t.updateTargets(t.data.targets),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({flow:{index:_.index,length:l,duration:J(e.duration)?e.duration:t.config.transition_duration,done:e.done,orgDataCount:f},withLegend:!0,withTransition:f>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}},jg={generateFlow(e){const t=this,{data:n,state:i,$el:a}=t;return function(){var s;const o=e.flow.length;i.flowing=!0,n.targets.forEach(l=>{l.values.splice(0,o)}),i.dataGeneration++,t.updateXGrid&&t.updateXGrid(!0);const r={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(l=>{const c=l.split(".");let d=a[c[0]];d&&c.length>1&&(d=d[c[1]]),d!=null&&d.size()&&(r[l]=d)}),(s=t.hideGridFocus)==null||s.call(t),t.setFlowList(r,e)}},setFlowList(e,t){const n=this,{flow:i,targets:a}=t,{duration:s=t.duration,index:o,length:r,orgDataCount:l}=i,c=n.getFlowTransform(a,l,o,r),d=Po();let u;d.add(Object.keys(e).map(h=>(u=e[h].transition().ease(f=>+f).duration(s),h==="axis.x"?u=u.call(f=>{n.axis.x.setTransition(f).create(f)}):h==="region.list"?u=u.filter(n.isRegionOnX).attr("transform",c):u=u.attr("transform",c),u))),u.call(d,()=>{n.cleanUpFlow(e,t)})},cleanUpFlow(e,t){const n=this,{config:i,state:a,$el:{svg:s}}=n,o=i.axis_rotated,{flow:r,shape:l,xv:c}=t,{cx:d,cy:u,xForText:h,yForText:f}=l.pos,{done:g=()=>{},length:p}=r;p&&(["circle","text","shape","eventRect"].forEach(x=>{const _=[];for(let v=0;v<p;v++)_.push(`.${st[x]}-${v}`);s.selectAll(`.${st[`${x}s`]}`).selectAll(_).remove()}),s.select(`.${st.xgrid}`).remove()),Object.keys(e).forEach(x=>{const _=e[x];if(x!=="axis.x"&&_.attr("transform",null),x==="grid.x")_.attr(a.xgridAttr);else if(x==="gridLines.x")_.attr("x1",o?0:c).attr("x2",o?a.width:c),_.select("text").attr("x",o?a.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(x))_.attr("d",l.type[x]);else if(x==="text")_.attr("x",h).attr("y",f).style("fill-opacity",n.opacityForText.bind(n));else if(x==="circle")if(n.isCirclePoint())_.attr("cx",d).attr("cy",u);else{const v=b=>d(b)-i.point_r,m=b=>u(b)-i.point_r;_.attr("x",v).attr("y",m)}else x==="region.list"&&_.select("rect").filter(n.isRegionOnX).attr("x",n.regionX.bind(n)).attr("width",n.regionWidth.bind(n))}),i.interaction_enabled&&n.redrawEventRect(),g.call(n.api),a.flowing=!1},getFlowTransform(e,t,n,i){const a=this,{data:s,scale:{x:o}}=a,r=s.targets[0].values;let l=a.getValueOnIndex(r,n),c=a.getValueOnIndex(r,n+i),d;const u=o.domain(),h=a.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?d=o(u[0])-o(h[0]):d=a.axis.isTimeSeries()?o(u[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?d=o(u[0])-o(h[0]):a.axis.isTimeSeries()?(l=a.getValueOnIndex(r,0),c=a.getValueOnIndex(r,r.length-1),d=o(l.x)-o(c.x)):d=Ye(h)/2;const f=Ye(u)/Ye(h);return`translate(${d},0) scale(${f},1)`}};let wr=()=>(Tt(de.prototype,jg),Wt.prototype.flow=Yg.flow,(wr=()=>({}))());function Cr(e){return Array.isArray(e)?e:[e]}function Sr(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function $a(e,t){const n=this.internal,{config:i}=n,a=i.transition_duration&&Gn(),s=`grid_${t}_lines`;return e?(i[s]=Cr(e),n.state.isCanvasMode?(Sr(n),i[s]):(n.updateGrid(),n.redrawGrid(a),i[s])):i[s]}function Ar(e,t){const n=`grid_${t}_lines`;return $a.bind(this)(this.internal.config[n].concat(e?Cr(e):[]),t)}function kr(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){const a=((n=i.getGridFilterToRemove)==null?void 0:n.call(i,e))||(()=>!0),s=`grid_${t?"x":"y"}_lines`;i.config[s]=i.config[s].filter(o=>!a(o)),Sr(i);return}i.removeGridLines(e,t)}const Lr=function(e){return $a.bind(this)(e,"x")};Tt(Lr,{add(e){return Ar.bind(this)(e,"x")},remove(e){return kr.bind(this)(e,!0)}});const Rr=function(e){return $a.bind(this)(e,"y")};Tt(Rr,{add(e){return Ar.bind(this)(e,"y")},remove(e){return kr.bind(this)(e,!1)}});var Er={xgrids:Lr,ygrids:Rr};const Ug=`line.${ut.xgridFocus}, line.${ut.ygridFocus}`,Kg=e=>J(e.position)||"end",Zg=e=>e.position==="start"?4:e.position==="middle"?0:-4;function Pr(e){var t;const{state:n,$el:{main:i}}=e,a=n._gridFocusEl,s=i.node(),o=((t=a==null?void 0:a.nodes)==null?void 0:t.call(a))||[];return o.length&&o.every(r=>s==null?void 0:s.contains(r))?a:n._gridFocusEl=i.selectAll(Ug)}function Dr(e,t,n){return i=>{let a=e?0:t;return i.position==="start"?a=e?-n:0:i.position==="middle"&&(a=(e?-n:t)/2),a}}function Ir(e,t){t==="grid"&&e.each(function(){const n=(0,F.select)(this);["x1","x2","y1","y2"].forEach(i=>n.attr(i,+n.attr(i)))})}var qg={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:n},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${Y.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",n.pathGrid).attr("class",`${wt.grid} ${wt.gridLines}`),i.gridLines.main.append("g").attr("class",wt.xgridLines),i.gridLines.main.append("g").attr("class",wt.ygridLines),i.gridLines.x=(0,F.selectAll)([]))},updateXGrid(e){const t=this,{config:n,scale:i,state:a,$el:{main:s,grid:o}}=t,r=n.axis_rotated,l=t.generateGridData(n.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,d=u=>(i.zoom||i.x)(u)+c*(r?-1:1);a.xgridAttr=r?{x1:0,x2:a.width,y1:d,y2:d}:{x1:d,x2:d,y1:0,y2:a.height},o.x=s.select(`.${wt.xgrids}`).selectAll(`.${wt.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",wt.xgrid).merge(o.x),e||o.x.each(function(){const u=(0,F.select)(this);Object.keys(a.xgridAttr).forEach(h=>{u.attr(h,a.xgridAttr[h])}),u.style("opacity",()=>+u.attr(r?"y1":"x1")===(r?a.height:0)?"0":null)})},updateYGrid(){const e=this,{axis:t,config:n,scale:i,state:a,$el:{grid:s,main:o}}=e,r=n.axis_rotated,l=d=>i.y(d),c=t.y.getGeneratedTicks(n.grid_y_ticks)||e.scale.y.ticks(n.grid_y_ticks);s.y=o.select(`.${wt.ygrids}`).selectAll(`.${wt.ygrid}`).data(c),s.y.exit().remove(),s.y=s.y.enter().append("line").attr("class",wt.ygrid).merge(s.y),s.y.attr("x1",r?l:0).attr("x2",r?l:a.width).attr("y1",r?0:l).attr("y2",r?a.height:l),Ir(s.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:n}}=e;!n.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:n,$el:{gridLines:i,main:a},$T:s}=t,o=n.axis_rotated,r=e==="x";n[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=a.select(`.${wt[`${e}gridLines`]}`).selectAll(`.${wt[`${e}gridLine`]}`).data(n[`grid_${e}_lines`]);s(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(d){const u=(0,F.select)(this);u.select("text").empty()&&d.text&&u.append("text").style("opacity","0")}),s(l.attr("class",d=>`${wt[`${e}gridLine`]} ${d.class||""}`.trim()).select("text").attr("text-anchor",Kg).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",Zg).attr("dy",-5)).text(function(d){var u;return(u=d.text)!=null?u:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:n},state:{width:i,height:a},$el:{gridLines:s},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=s.x.select("line"),d=s.x.select("text"),u=s.y.select("line"),h=s.y.select("text");return c=o(c,e).attr("x1",n?0:r).attr("x2",n?i:r).attr("y1",n?r:0).attr("y2",n?r:a),d=o(d,e).attr("x",Dr(!n,i,a)).attr("y",r),u=o(u,e).attr("x1",n?l:0).attr("x2",n?l:i).attr("y1",n?0:l).attr("y2",n?a:l),h=o(h,e).attr("x",Dr(n,i,a)).attr("y",l),[c.style("opacity",null),d.style("opacity",null),u.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:n,state:{clip:i},$el:a}=e;n._gridFocusEl=null;const s=t.grid_front,o=`.${s&&a.gridLines.main?wt.gridLines:Y.chart}${s?" + *":""}`,r=a.main.insert("g",o).attr("clip-path",i.pathGrid).attr("class",wt.grid);if(a.grid.main=r,t.grid_x_show&&r.append("g").attr("class",wt.xgrids),t.grid_y_show&&r.append("g").attr("class",wt.ygrids),t.axis_tooltip){const l=r.append("g").attr("class","bb-axis-tooltip");l.append("line").attr("class","bb-axis-tooltip-x"),l.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(r.append("g").attr("class",ut.xgridFocus).append("line").attr("class",ut.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&r.append("g").attr("class",ut.ygridFocus).append("line").attr("class",ut.ygridFocus))},showAxisGridFocus(){var e,t;const n=this,{config:i,format:a,state:{event:s,width:o,height:r}}=n,l=i.axis_rotated,[c,d]=Jt(s,(e=n.$el.eventRect)==null?void 0:e.node()),u={x:c,y:d};for(const[h,f]of Object.entries(n.$el.axisTooltip)){const g=h==="x"&&!l||h!=="x"&&l?"x":"y",p=u[g];let x=(t=n.scale[h])==null?void 0:t.invert(p);x&&(x=h==="x"&&n.axis.isTimeSeries()?a.xAxisTick(x):x==null?void 0:x.toFixed(2),f==null||f.attr(g,p).text(x))}n.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,f){const g=(0,F.select)(this);f===0?g.attr("x1",c).attr("x2",c).attr("y1",f?0:r).attr("y2",f?r:0):g.attr("x1",f?0:o).attr("x2",f?o:0).attr("y1",d).attr("y2",d)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll(`line.${Rt.axisTooltipX}, line.${Rt.axisTooltipY}`).style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const n=this,{config:i,state:{width:a,height:s}}=n,o=i.axis_rotated,r=Pr(n),l=(e||[r.datum()]).filter(u=>u&&J(n.getBaseValue(u)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&n.hasType("bubble")||n.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,d=n.xx.bind(n);r.style("visibility",null).data(l.concat(l)).each(function(u){const h=(0,F.select)(this),f={x:d(u),y:n.getYScaleById(u.id)(u.value)};let g;if(h.classed(ut.xgridFocus))g=o?[null,f.x,c?f.y:a,f.x]:[f.x,c?f.y:null,f.x,s];else{const p=n.axis.getId(u.id)==="y2";g=o?[f.y,c&&!p?f.x:null,f.y,c&&p?f.x:s]:[c&&p?f.x:null,f.y,c&&!p?f.x:a,f.y]}["x1","y1","x2","y2"].forEach((p,x)=>h.attr(p,g[x]))}),Ir(r,"grid"),(t=n.showCircleFocus)==null||t.call(n,e)},hideGridFocus(e=!1){var t;const n=this,{state:{inputType:i,resizing:a}}=n;(e||i==="mouse"||!a)&&(Pr(n).style("visibility","hidden"),(t=n.hideCircleFocus)==null||t.call(n))},updateGridFocus(){var e;const t=this,{state:{inputType:n,width:i,height:a,resizing:s},$el:{grid:o}}=t,r=o.main.select(`line.${ut.xgridFocus}`);if(n==="touch")r.empty()?s&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:a)}return!0},generateGridData(e,t){const n=this,i=n.$el.main.select(`.${Rt.axisX}`).selectAll(".tick").size();let a=[];if(e==="year"){const s=n.getXDomain(n.data.targets),[o,r]=s.map(l=>l.getFullYear());for(let l=o;l<=r;l++)a.push(new Date(`${l}-01-01 00:00:00`))}else a=t.ticks(ue),a.length>i&&(a=a.filter(s=>String(s).indexOf(".")<0));return a},getGridFilterToRemove(e){return e?t=>{let n=!1;return(ot(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(n=!0)}),n}:()=>!0},removeGridLines(e,t){const n=this,{config:i,$T:a}=n,s=n.getGridFilterToRemove(e),o=d=>!s(d),r=t?wt.xgridLines:wt.ygridLines,l=t?wt.xgridLine:wt.ygridLine;a(n.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(s)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},Jg={grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:void 0,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0};let Mr=()=>(Tt(de.prototype,qg),Wt.prototype.xgrids=Er.xgrids,Wt.prototype.ygrids=Er.ygrids,Qe.setOptions([Jg]),(Mr=()=>({}))());function $r(e=!1,t,n,i){const a=this,{config:s,$el:{main:o}}=a,r=s.data_selection_grouped,l=s.data_selection_isselectable.bind(a.api);s.data_selection_enabled&&o.selectAll(`.${Ct.shapes}`).selectAll(`.${Ct.shape}`).each(function(c){const d=(0,F.select)(this),{id:u,index:h}=c.data?c.data:c,f=a.getToggle(this,c).bind(a),g=r||!t||t.indexOf(u)>=0,p=!n||n.indexOf(h)>=0,x=d.classed(xt.SELECTED);d.classed(_e.line)||d.classed(fi.area)||(e?g&&p&&l(c)&&!x?f(!0,d.classed(xt.SELECTED,!0),c,h):ct(i)&&i&&x&&f(!1,d.classed(xt.SELECTED,!1),c,h):g&&p&&l(c)&&x&&f(!1,d.classed(xt.SELECTED,!1),c,h))})}var Qg={selected(e){var t;const n=this.internal,i=[];return n.state.isCanvasMode?((t=n.getCanvasSelectedData)==null?void 0:t.call(n,e))||i:(n.$el.main.selectAll(`.${Ct.shapes+n.getTargetSelectorSuffix(e)}`).selectAll(`.${Ct.shape}`).filter(function(){return(0,F.select)(this).classed(xt.SELECTED)}).each(a=>i.push(a)),i)},select(e,t,n){var i;const a=this.internal;if(a.state.isCanvasMode){(i=a.setCanvasSelection)==null||i.call(a,!0,e,t,n);return}$r.bind(a)(!0,e,t,n)},unselect(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){(n=i.setCanvasSelection)==null||n.call(i,!1,e,t);return}$r.bind(i)(!1,e,t)}},tp={drag(e){const t=this,{config:n,state:i,$el:{main:a}}=t,s=n.data_selection_grouped,o=n.interaction_enabled&&n.data_selection_isselectable;if(t.hasArcType()||!n.data_selection_enabled||n.zoom_enabled&&!t.zoom.altDomain||!n.data_selection_multiple)return;const[r,l]=i.dragStart||[0,0],[c,d]=e,u=Math.min(r,c),h=Math.max(r,c),f=s?i.margin.top:Math.min(l,d),g=s?i.height:Math.max(l,d),p=()=>{!t||!t.$el||!t.$el.main||(a.select(`.${Je.dragarea}`).attr("x",u).attr("y",f).attr("width",h-u).attr("height",g-f),a.selectAll(`.${Ct.shapes}`).selectAll(`.${Ct.shape}`).filter(x=>o==null?void 0:o.bind(t.api)(x)).each(function(x,_){const v=(0,F.select)(this),m=v.classed(xt.SELECTED),b=v.classed(Je.INCLUDED);let y,T;if(v.classed(Bt.circle)){const w=+v.attr("cx"),C=+v.attr("cy");T=t.togglePoint,y=u<w&&w<h&&f<C&&C<g}else if(v.classed(Zt.bar)){const{x:w,y:C,width:A,height:S}=Lo(this);T=t.togglePath,y=!(h<w||w+A<u)&&!(g<C||C+S<f)}else return;y^b&&(v.classed(Je.INCLUDED,!b),v.classed(xt.SELECTED,!m),T.call(t,!m,v,x,_))}))};Eo(t.state,p)},dragstart(e){const t=this,{config:n,state:i,$el:{main:a}}=t;t.hasArcType()||!n.data_selection_enabled||(i.dragStart=e,a.select(`.${Y.chart}`).append("rect").attr("class",Je.dragarea).style("opacity","0.1"),t.setDragStatus(!0))},dragend(){const e=this,{config:t,$el:{main:n},$T:i}=e;e.hasArcType()||!t.data_selection_enabled||(i(n.select(`.${Je.dragarea}`)).style("opacity","0").remove(),n.selectAll(`.${Ct.shape}`).classed(Je.INCLUDED,!1),e.setDragStatus(!1))}},ep=Object.defineProperty,np=Object.defineProperties,ip=Object.getOwnPropertyDescriptors,Fr=Object.getOwnPropertySymbols,ap=Object.prototype.hasOwnProperty,sp=Object.prototype.propertyIsEnumerable,Or=(e,t,n)=>t in e?ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,op=(e,t)=>{for(var n in t||(t={}))ap.call(t,n)&&Or(e,n,t[n]);if(Fr)for(var n of Fr(t))sp.call(t,n)&&Or(e,n,t[n]);return e},rp=(e,t)=>np(e,ip(t)),lp=rp(op({},tp),{selectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i,r=a.axis_rotated,l=(r?i.circleY:i.circleX).bind(i),c=(r?i.circleX:i.circleY).bind(i),d=i.pointSelectR.bind(i);V(a.data_onselected,i.api,t,e.node()),o(s.select(`.${xt.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${xt.selectedCircle}-${n}`).data([t]).enter().append("circle").attr("class",()=>i.generateClass(xt.selectedCircle,n)).attr("cx",l).attr("cy",c).attr("stroke",i.color).attr("r",u=>i.pointSelectR(u)*1.4)).attr("r",d)},unselectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i;V(a.data_onunselected,i.api,t,e==null?void 0:e.node()),o(s.select(`.${xt.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${xt.selectedCircle}-${n}`)).attr("r",0).remove()},togglePoint(e,t,n,i){this[`${e?"":"un"}selectPoint`](t,n,i)},selectPath(e,t){const n=this,{config:i}=n;V(i.data_onselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter","brightness(1.25)")},unselectPath(e,t){const n=this,{config:i}=n;V(i.data_onunselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter",null)},togglePath(e,t,n,i){this[`${e?"":"un"}selectPath`](t,n,i)},getToggle(e,t){const n=this;return e.nodeName==="path"?n.togglePath:n.isStepType(t)?()=>{}:n.togglePoint},toggleShape(e,t,n){var i;const a=this,{config:s,$el:{main:o}}=a;if(s.data_selection_enabled&&s.data_selection_isselectable.bind(a.api)(t)){const r=(0,F.select)(e),l=r.classed(xt.SELECTED),c=a.getToggle(e,t).bind(a);let d;if(!s.data_selection_multiple){const u=(i=a.isPointFocusOnly)==null?void 0:i.call(a);let h=`.${u?xt.selectedCircles:Ct.shapes}`;s.data_selection_grouped&&(h+=a.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(u?`.${xt.selectedCircle}`:`.${Ct.shape}.${xt.SELECTED}`).classed(xt.SELECTED,!1).each(function(f){const g=(0,F.select)(this);d=g,c(!1,g,f,f.index)})}(!d||d.node()!==r.node())&&(r.classed(xt.SELECTED,!l),c(!l,r,t,n))}}}),cp={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:()=>!0,data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:()=>{},data_onunselected:()=>{}};let Br=()=>(Tt(de.prototype,lp),Tt(Wt.prototype,Qg),Qe.setOptions([cp]),(Br=()=>!0)());const zr=function(e){var t,n;const i=this.internal,{axis:a,brush:s,config:o,scale:{x:r,subX:l},state:c}=i;let d;return c.isCanvasMode?(o.subchart_show&&(d=e,Array.isArray(d)?(d=a.isTimeSeries()?d.map(u=>Xt.bind(i)(u)):d,d=i.setCanvasSubchartDomain(d)||c.domain):d=(t=c.domain)!=null?t:r.orgDomain()),d):(o.subchart_show&&(d=e,Array.isArray(d)?(a.isTimeSeries()&&(d=d.map(h=>Xt.bind(i)(h))),i.withinRange(d,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))&&(c.domain=d.slice(),s.move(s.getSelection(),d.map(l)))):d=(n=c.domain)!=null?n:r.orgDomain()),d)};Tt(zr,{show(){var e,t,n;const i=this.internal,{$el:{subchart:a},config:s}=i,o=s.subchart_show;if(!o){if(i.state.isCanvasMode){(e=i.unbindZoomEvent)==null||e.call(i),s.subchart_show=!0,this.resize();return}i.unbindZoomEvent(),s.subchart_show=!o,!a.main&&i.initSubchart();let r=a.main.selectAll(`.${Y.target}`);i.data.targets.length!==r.size()&&(i.updateSizes(),i.updateTargetsForSubchart(i.data.targets),r=(t=a.main)==null?void 0:t.selectAll(`.${Y.target}`)),r==null||r.style("opacity",null),(n=a.main)==null||n.style("display",null),this.resize()}},hide(){var e;const t=this.internal,{$el:{subchart:{main:n}},config:i}=t;if(t.state.isCanvasMode){i.subchart_show&&(i.subchart_show=!1,this.resize(),(e=t.bindZoomEvent)==null||e.call(t));return}i.subchart_show&&(n==null?void 0:n.style("display"))!=="none"&&(i.subchart_show=!1,n.style("display","none"),this.resize())},toggle(){const e=this.internal,{config:t}=e;this.subchart[t.subchart_show?"hide":"show"]()},reset(){var e;const t=this.internal,{brush:n}=t;if(t.state.isCanvasMode){(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1);return}n.clear(n.getSelection())}});var dp={subchart:zr},up={initBrush(){const e=this,{config:t,scale:n,$el:{subchart:i},state:a}=e,s=t.axis_rotated,o=t.subchart_size_height;let r,l,c;e.brush=(s?(0,_i.brushY)():(0,_i.brushX)()).handleSize(5),e.brush.on("start brush end",d=>{const{selection:u,sourceEvent:h,target:f,type:g}=d;g==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?u:null),/(start|brush)/.test(g)&&(g==="brush"&&h&&a.domain&&(l==null||l.forEach((p,x)=>{p!==u[x]&&(a.domain[x]=n.x.orgDomain()[x])})),e.redrawForBrush(g!=="start")),g==="end"&&(r=n.x.orgDomain()),f!=null&&f.handle&&(u===null?e.brush.handle.attr("display","none"):e.brush.handle.attr("display",null).attr("transform",(p,x)=>{const _=[u[x],o/2];return`translate(${s?_.reverse():_})`}))}),e.brush.updateResize=function(){c&&clearTimeout(c),c=setTimeout(()=>{const d=this.getSelection();r&&(0,_i.brushSelection)(d.node())&&this.move(d,r.map(n.subX.orgScale()))},0)},e.brush.update=function(){var d;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((d=i.main)==null||d.select(`.${st.brush}`).call(this)),this},e.brush.scale=function(d){const u=t.subchart_size_height;let h=e.axis.getExtent();!h&&d.range?h=[[0,0],[d.range()[1],u]]:ot(h)&&(h=h.map((f,g)=>[f,g>0?u:g])),s&&h[1].reverse(),this.extent(h),this.update()},e.brush.getSelection=()=>i.main?i.main.select(`.${st.brush}`):(0,F.select)([])},initSubchart(){const e=this,{config:t,state:{clip:n,hasAxis:i},$el:{defs:a,svg:s,subchart:o,axis:r}}=e;if(!i)return;const l=t.subchart_show?null:"hidden",c=`${n.id}-subchart`,d=e.getClipPath(c);n.idSubchart=c,e.appendClip(a,c),e.initBrush(),o.main=s.append("g").classed(st.subchart,!0).attr("transform",e.getTranslate("context"));const{main:u}=o;u.style("visibility",l),u.append("g").attr("clip-path",d).attr("class",st.chart),["bar","line","bubble","candlestick","scatter"].forEach(f=>{const g=Ot(/^(bubble|scatter)$/.test(f)?"circle":f);if(e.hasType(f)||e.hasTypeOf(g)){const p=u.select(`.${st.chart}`),x=st[`chart${g}s`];p.select(`.${x}`).empty()&&p.append("g").attr("class",x)}});const h=u.append("g").attr("clip-path",d).attr("class",st.brush).call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),r.subX=u.append("g").attr("class",st.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",t.axis_rotated?"":n.pathXAxis).style("visibility",t.subchart_axis_x_show?l:"hidden")},addBrushHandle(e){const t=this,{config:n}=t,i=n.axis_rotated,a=n.subchart_init_range,s="handle--custom",o=Ja[i?"y":"x"];t.brush.handle=e.selectAll(`.${s}`).data(i?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",s).attr("cursor",`${i?"ns":"ew"}-resize`).attr("d",r=>o[/[se]/.test(r.type)?"end":"start"]).attr("display",a?null:"none")},updateTargetsForSubchart(e){const t=this,{config:n,state:i,$el:{subchart:{main:a}}}=t;n.subchart_show&&(["bar","line","bubble","candlestick","scatter"].filter(s=>t.hasType(s)||t.hasTypeOf(Ot(s))).forEach(s=>{const o=/^(bubble|scatter)$/.test(s),r=Ot(o?"circle":s),l=t.getChartClass(r,!0),c=t.getClass(o?"circles":`${s}s`,!0),d=a.select(`.${st[`chart${`${r}s`}`]}`);if(o){const u=d.selectAll(`.${st.circles}`).data(e.filter(t[`is${Ot(s)}Type`].bind(t))).attr("class",c);u.exit().remove(),u.enter().append("g").attr("class",c)}else{const u=d.selectAll(`.${st[`chart${r}`]}`).attr("class",l).data(e.filter(t[`is${r}Type`].bind(t))),h=u.enter().append("g").style("opacity","0").attr("class",l).append("g").attr("class",c);u.exit().remove(),s==="line"&&t.hasTypeOf("Area")&&h.append("g").attr("class",t.getClass("areas",!0))}}),a.selectAll(`.${st.brush} rect`).attr(n.axis_rotated?"width":"height",n.axis_rotated?i.width2:i.height2))},redrawSubchart(e,t,n){var i;const a=this,{config:s,$el:{subchart:{main:o}},state:r}=a,l=!!t;if(o.style("visibility",s.subchart_show?null:"hidden"),s.subchart_show&&(((i=r.event)==null?void 0:i.type)==="zoom"&&a.brush.update(),e)){const c=s.subchart_init_range;if(!Xo(a)&&a.brush.update(),Object.keys(n.type).forEach(d=>{const u=Ot(d),h=a[`generateDraw${u}`](n.indices[d],!0);a[`update${u}`](l,!0),a[`redraw${u}`](h,l,!0)}),a.hasType("bubble")||a.hasType("scatter")){const{cx:d}=n.pos,u=a.updateCircleY(!0);a.updateCircle(!0),a.redrawCircle(d,u,l,void 0,!0)}!r.rendered&&c&&(r.domain=c,a.brush.move(a.brush.getSelection(),c.map(a.scale.x)))}},redrawForBrush(e=!0){var t;const n=this,{config:{subchart_onbrush:i,zoom_rescale:a},scale:s,state:o}=n;n.redraw({withTransition:!1,withY:a,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e&&o.rendered&&i.bind(n.api)((t=o.domain)!=null?t:s.x.orgDomain())},transformContext(e,t){const n=this,{$el:{subchart:i},$T:a}=n,s=t!=null&&t.axisSubX?t.axisSubX:a(i.main.select(`.${st.axisX}`),e);i.main.attr("transform",n.getTranslate("context")),s.attr("transform",n.getTranslate("subX"))}},hp={subchart_show:!1,subchart_showHandle:!1,subchart_size_height:60,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:()=>{}};let Nr=()=>(Tt(de.prototype,up),Tt(Wt.prototype,dp),Qe.setOptions([hp]),(Nr=()=>!0)());var ie=pt(9);const Xr=function(e){var t,n;const i=this.internal,{axis:a,config:s,org:o,scale:r,state:l}=i;let c;if(!a)return;const d=a.isCategorized();if(s.zoom_enabled)if(c=e,Array.isArray(c)){if(a.isTimeSeries()&&(c=c.map(h=>Xt.bind(i)(h))),i.withinRange(c,i.getZoomDomain("zoom",!0),i.getZoomDomain("zoom"))){if(l.domain=c.slice(),c=i.getZoomDomainValue(c),i.api.tooltip.hide(),s.subchart_show)if(l.isCanvasMode)(t=i.setCanvasSubchartDomain)==null||t.call(i,c,!0,!1);else{const h=r.zoom||r.x;i.brush.getSelection().call(i.brush.move,c.map(h))}else{const h=d?r.x.orgScale():o.xScale||r.x;i.updateCurrentZoomTransform(h,c)}i.setZoomResetButton()}}else c=i.zoom.getDomain();return(n=l.domain)!=null?n:c};Tt(Xr,{enable(e){var t;const n=this.internal,{axis:i,config:a}=n;if(!i){a.zoom_enabled=!1;return}/^(drag|wheel)$/.test(e)&&(a.zoom_type=e),a.zoom_enabled=!!e,n.zoom?e===!1&&n.bindZoomEvent(!1):n.initZoom(),e!==!1&&(a.zoom_type==="drag"&&!n.zoomBehaviour&&((t=n.initZoomBehaviour)==null||t.call(n)),n.bindZoomEvent()),n.updateAndRedraw()},max(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_max=oe("max",[i[1],e])),n.zoom_x_max},min(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_min=oe("min",[i[0],e])),n.zoom_x_min},range(e){const t=this.zoom;if(Q(e)){const{min:n,max:i}=e;ct(n)&&t.min(n),ct(i)&&t.max(i)}return{min:t.min(),max:t.max()}}});var fp={zoom:Xr,unzoom(){var e;const t=this.internal,{config:n,$el:{canvas:i,eventRect:a,zoomResetBtn:s},scale:{zoom:o},state:r}=t,l=r.isCanvasMode?i:a;(o||r.isCanvasMode&&n.subchart_show&&r.domain)&&(n.subchart_show?r.isCanvasMode?(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1):t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(ie.zoomIdentity),t.updateZoom(!0),s==null||s.style("display","none"),l!=null&&l.node()&&(0,ie.zoomTransform)(l.node())!==ie.zoomIdentity&&t.zoom.transform(l,ie.zoomIdentity),r.domain=void 0)}};function Si(e){return e.state.isCanvasMode?e.$el.canvas:e.$el.eventRect}function Gr(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return ie.zoomIdentity.translate(t.x+(t.k-1)*n.left,t.y+(t.k-1)*n.top).scale(t.k)}function Wr(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return ie.zoomIdentity.translate(t.x-(t.k-1)*n.left,t.y-(t.k-1)*n.top).scale(t.k)}function Vr(e,t,n){const i=Jt(t,n);if(e.state.isCanvasMode){const{margin:a}=e.state;i[0]-=a.left,i[1]-=a.top}return i}var gp={initZoom(){const e=this;e.scale.zoom=null,e.generateZoom(),e.config.zoom_type==="drag"&&e.initZoomBehaviour()},bindZoomEvent(e=!0){const t=this,{config:n}=t;n.zoom_enabled&&e?!n.subchart_show&&t.bindZoomOnEventRect():e===!1&&(t.api.unzoom(),t.unbindZoomEvent())},generateZoom(){const e=this,{config:t,org:n,scale:i}=e,a=(0,ie.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));a.orgScaleExtent=()=>{const s=t.zoom_extent||[1,10];return[s[0],Math.max(e.getMaxDataCount()/s[1],s[1])]},a.updateScaleExtent=function(){const s=Ye(e.scale.x.orgDomain())/Ye(e.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*s,o[1]*s]),this},a.updateTransformScale=(s,o)=>{var r,l;const c=t.axis_rotated,d=Gr(e,s);(r=n.xScale)==null||r.range(i.x.range());const u=d[c?"rescaleY":"rescaleX"](n.xScale||i.x);if(u.domain().some(g=>/(Invalid Date|NaN)/.test(g.toString())))return;const h=e.trimXDomain(u.domain()),f=t.zoom_rescale;if(u.domain(h,n.xDomain),o){const g=u(i.x.domain()[0]),p=c?d.x:g,x=c?g:d.y,_=Wr(e,ie.zoomIdentity.translate(p,x).scale(s.k));(l=Si(e))==null||l.property("__zoom",_)}i.zoom=e.getCustomizedXScale(u),e.axis.x.scale(i.zoom),f?(!n.xScale&&(n.xScale=i.x.copy()),i.x.domain(h)):n.xScale&&(i.x.domain(n.xScale.domain()),n.xScale=null)},a.getDomain=()=>{const s=i[i.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(s[1]-=2),s},e.zoom=a},onZoomStart(e){const t=this,{sourceEvent:n}=e;n&&(t.zoom.startEvent=n,t.state.zooming=!0,V(t.config.zoom_onzoomstart,t.api,e))},onZoom(e){const t=this,{config:n,scale:i,state:a,org:s}=t,{sourceEvent:o}=e,r=(e==null?void 0:e.transform)===ie.zoomIdentity;if(!n.zoom_enabled||t.filterTargetsToShow(t.data.targets).length===0||!i.zoom&&(o==null?void 0:o.type.indexOf("touch"))>-1&&(o==null?void 0:o.touches.length)===1)return;e.sourceEvent&&(a.zooming=!0,a.domain=void 0);const l=(o==null?void 0:o.type)==="mousemove",c=(o==null?void 0:o.wheelDelta)<0,{transform:d}=e;!l&&c&&i.x.domain().every((g,p)=>g!==s.xDomain[p])&&i.x.domain(s.xDomain),t.zoom.updateTransformScale(d,n.zoom_type==="wheel"&&o);const u=n.transition_duration>0&&!n.subchart_show&&(a.dragging||r||!e.sourceEvent),h=o&&l&&n.zoom_type!=="wheel",f=()=>{var g;t.config&&(t.redraw({withTransition:u,withY:n.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.state.cancelClick=l,!r&&V(n.zoom_onzoom,t.api,(g=t.state.domain)!=null?g:t.zoom.getDomain()))};h?Eo(t.state,f):f()},onZoomEnd(e){var t,n;const i=this,{config:a,state:s}=i,o=i.zoom;if(!o)return;let{startEvent:r}=o,l=e==null?void 0:e.sourceEvent;const c=(e==null?void 0:e.transform)===ie.zoomIdentity;(r==null?void 0:r.type.indexOf("touch"))>-1&&(r=r.changedTouches[0],l=(t=l==null?void 0:l.changedTouches)==null?void 0:t[0]),!(a.zoom_type==="drag"&&l&&r.clientX===l.clientX&&r.clientY===l.clientY)&&(s.zooming=!1,!s.isCanvasMode&&i.redrawEventRect(),i.updateZoom(),!c&&(l||s.dragging)&&V(a.zoom_onzoomend,i.api,(n=i.state.domain)!=null?n:i.zoom.getDomain()))},updateZoom(e){const t=this,{subX:n,x:i,zoom:a}=t.scale;if(a){const s=a.domain(),o=n.domain(),r=.015,l=t.config.axis_x_inverted?(s[0]>=o[0]||s[0]+r>=o[0])&&(o[1]>=s[1]||o[1]>=s[1]+r):(s[0]<=o[0]||s[0]-r<=o[0])&&(o[1]<=s[1]||o[1]<=s[1]-r);(e||l)&&(t.axis.x.scale(n),i.domain(n.orgDomain()),t.scale.zoom=null)}},updateCurrentZoomTransform(e,t){var n;const i=this,{config:a}=i,s=a.axis_rotated,o=[-e(t[0]),0],r=ie.zoomIdentity.scale(e.range()[1]/(e(t[1])-e(t[0]))).translate(...s?o.reverse():o);(n=Si(i))==null||n.call(i.zoom.transform,Wr(i,r))},bindZoomOnEventRect(){var e,t;const n=this,{config:i,$el:{svg:a}}=n,s=Si(n),o=i.zoom_type==="drag"?n.zoomBehaviour:n.zoom;n.state.isCanvasMode&&((e=o==null?void 0:o.touchable)==null||e.call(o,()=>i.interaction_inputType_touch!==!1)),!n.state.isCanvasMode&&B.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((t=B.navigator)==null?void 0:t.userAgent)&&a.on("wheel",()=>{}),s==null||s.call(o).on("dblclick.zoom",null)},initZoomBehaviour(){const e=this,{config:t,state:n}=e,i=t.axis_rotated;let a=0,s=0,o,r;const l={axis:i?"y":"x",attr:i?"height":"width",index:i?1:0},c=d=>{const[u,h]=r!=null?r:[0,i?n.height:n.width];return Math.min(Math.max(d,u),h)};e.zoomBehaviour=(0,zo.drag)().touchable(()=>!n.isCanvasMode||t.interaction_inputType_touch!==!1).clickDistance(4).on("start",function(d){var u;r=e.scale.zoom?null:e.axis.getExtent(),n.event=d,e.setDragStatus(!0),e.unselectRect(),!n.isCanvasMode&&!o&&(o=e.$el.main.append("rect").attr("clip-path",n.clip.path).attr("class",pa.zoomBrush).attr("width",i?n.width:0).attr("height",i?0:n.height)),o==null||o.attr(i?"width":"height",i?n.width:n.height),a=c(Vr(e,d,this)[l.index]),s=a,n.isCanvasMode?(u=e.renderCanvasZoomBrush)==null||u.call(e,a,s):o.attr(l.axis,a).attr(l.attr,0),e.onZoomStart(d)}).on("drag",function(d){var u;s=c(Vr(e,d,this)[l.index]),n.isCanvasMode?(u=e.renderCanvasZoomBrush)==null||u.call(e,a,s):o.attr(l.axis,Math.min(a,s)).attr(l.attr,Math.abs(s-a))}).on("end",d=>{var u;const h=e.scale.zoom||e.scale.x;n.event=d,s=c(s),n.isCanvasMode?(u=e.clearCanvasZoomBrush)==null||u.call(e):o.attr(l.axis,0).attr(l.attr,0),a>s&&([a,s]=[s,a]),a<0&&(s+=Math.abs(a),a=0),a!==s&&e.api.zoom([a,s].map(f=>h.invert(f))),e.setDragStatus(!1)})},setZoomResetButton(){const e=this,{config:t,$el:n}=e,i=t.zoom_resetButton;i&&t.zoom_type==="drag"&&(n.zoomResetBtn?n.zoomResetBtn.style("display",null):n.zoomResetBtn=e.$el.chart.append("div").classed(Y.button,!0).append("span").on("click",function(){O(i.onclick)&&i.onclick.bind(e.api)(this),e.api.unzoom()}).classed(pa.buttonZoomReset,!0).text(i.text||"Reset Zoom"))},getZoomTransform(){const e=this,t=Si(e),n=t==null?void 0:t.node();return n?Gr(e,(0,ie.zoomTransform)(n)):{k:1}}},pp={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0};let Hr=()=>(Tt(de.prototype,gp),Tt(Wt.prototype,fp),Qe.setOptions([pp]),(Hr=()=>!0)());function Yr(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function jr(e,t=!1){const n=this.internal,{config:i}=n,a=i.transition_duration&&Gn();return e?(i.regions=t?i.regions.concat(e):e,n.state.isCanvasMode?(Yr(n),i.regions):(n.updateRegion(),n.redrawRegion(a),i.regions)):i.regions}const Ur=function(e){return jr.bind(this)(e)};Tt(Ur,{add:function(e){return jr.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:n,$T:i}=t,a=e||{},s=De(a,"classes",[Xn.region]);let o=n.regions;if(t.state.isCanvasMode)return Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(d=>{s.indexOf(d)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],Yr(t),n.regions;const r=t.$el.main.select(`.${Xn.regions}`).selectAll(s.map(l=>`.${l}`));return i(r).style("opacity","0").remove(),Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(d=>{s.indexOf(d)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],o}});var xp={regions:Ur},_p={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",Xn.regions)},updateRegion(){const e=this,{config:t,$el:{region:n},$T:i}=e;n.main||e.initRegion(),n.main.style("visibility",e.hasArcType()?"hidden":null);const a=n.main.selectAll(`.${Xn.region}`).data(t.regions);i(a.exit()).style("opacity","0").remove();const s=a.enter().append("g");s.append("rect").style("fill-opacity","0"),n.list=s.merge(a).attr("class",e.classRegion.bind(e)),n.list.each(function(o){var r;(0,F.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,F.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:n},$T:i}=t,a=t.regionX.bind(t),s=t.regionY.bind(t),o=["width","height"];let r=n.list.select("rect"),l=n.list.selectAll("text");return r=i(r,e).attr("x",a).attr("y",s).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),l=i(l,e).text(c=>{var d;return(d=c.label)==null?void 0:d.text}).attr("transform",({label:c})=>c.rotated?" rotate(-90)":null).attr("transform",function(c){var d;const{x:u=0,y:h=0,center:f=!1,rotated:g=!1}=(d=c.label)!=null?d:{},p=this.previousElementSibling,x={x:0,y:0};return nt(f)&&["x","y"].forEach((_,v)=>{f.indexOf(_)>-1&&(x[_]=(+p.getAttribute(o[v])-ht(this)[o[v]])/2)}),`translate(${a(c)+x.x+u}, ${s(c)+x.y+h})${g?" rotate(-90)":""}`}).attr("text-anchor",({label:c})=>c!=null&&c.rotated?"end":null).attr("dy","1em").style("fill",({label:c})=>{var d;return(d=c==null?void 0:c.color)!=null?d:null}),[r.style("fill-opacity",c=>J(c.opacity)?c.opacity:null).on("end",function(){(0,F.select)(this.parentNode).selectAll("rect:not([x])").remove()}),l.style("opacity",null)]},regionX(e){return this.getRegionSize("x",e)},regionY(e){return this.getRegionSize("y",e)},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},getRegionSize(e,t){const n=this,{config:i,scale:a,state:s}=n,o=i.axis_rotated,r=/(x|y|y2)/.test(e),l=r?e==="x":e==="width",c=!r&&n[l?"regionX":"regionY"](t);let d=r?"start":"end",u=r?0:s[e],h;if(t.axis==="y"||t.axis==="y2"?(!r&&!l?d="start":r&&!l&&(d="end"),(l?o:!o)&&d in t&&(h=a[t.axis])):(l?!o:o)&&d in t&&(h=a.zoom||a.x),h){let f=0;u=t[d],n.axis.isTimeSeries(t.axis)?u=Xt.call(n,u):/(x|width)/.test(e)&&n.axis.isCategorized()&&isNaN(u)&&(u=i.axis_x_categories.indexOf(u),f=n.axis.x.tickOffset()*(d==="start"?-1:1)),u=h(u)+f}return r?u:u<c?0:u-c},isRegionOnX(e){return!e.axis||e.axis==="x"}};let Kr=()=>(Tt(de.prototype,_p),Wt.prototype.regions=xp.regions,(Kr=()=>({}))());var _n={initArea(e){const t=this,{config:n}=t;e.insert("g",`.${n.area_front?Bt.circles:_e.lines}`).attr("class",t.getClass("areas",!0))},updateAreaColor(e){const t=this;return tr.call(t,e,"area_linearGradient",t.color)},updateArea(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,state:a,$el:s,$T:o}=n,r=t?s.subchart:s;i.area_linearGradient&&n.updateLinearGradient();const l=r.main.selectAll(`.${fi.areas}`).selectAll(`.${fi.area}`).data(n.lineData.bind(n));o(l.exit(),e).style("opacity","0").remove(),r.area=l.enter().append("path").attr("class",n.getClass("area",!0)).style("fill",n.updateAreaColor.bind(n)).style("opacity",function(){return a.orgAreaOpacity=(0,F.select)(this).style("opacity"),"0"}).merge(l),l.style("opacity",a.orgAreaOpacity),n.setRatioForGroupedData(r.area.data())},redrawArea(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{area:a}=n?this.$el.subchart:this.$el,{orgAreaOpacity:s}=i.state;return[i.$T(a,t,he()).attr("d",e).style("fill",i.updateAreaColor.bind(i)).style("opacity",o=>String(i.isAreaRangeType(o)?s/1.75:s))]},generateDrawArea(e,t){return Ns(this,e,t)}},mn={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},Fa={spline_interpolation_type:"cardinal"};function mp(e){return Yt(e)&&O(e.create)&&O(e.update)}function vp(e,t){var n;const i=this,a=(l,c)=>{const d=l.attributes;for(let u=0,h;h=d[u];u++)h=h.name,c.setAttribute(h,l.getAttribute(h))},o=new DOMParser().parseFromString(me(e),"image/svg+xml").documentElement,r=tt.createElementNS(F.namespaces.svg,o.nodeName.toLowerCase());if(r.id=t,r.style.fill="inherit",r.style.stroke="inherit",a(o,r),(n=o.childNodes)!=null&&n.length){const l=(0,F.select)(r);"innerHTML"in r?l.html(me(o.innerHTML)):je(o.childNodes).forEach(c=>{a(c,l.append(c.tagName).node())})}i.$el.defs.node().appendChild(r)}var vn={hasValidPointType(e){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(e||this.config.point_type)},hasLegendDefsPoint(){var e;const{config:t}=this;return t.legend_show&&((e=t.point_pattern)==null?void 0:e.length)&&t.legend_usePoint},getDefsPointId(e){const{state:{datetimeId:t}}=this;return`${t}-point${e}`},getValidPointPattern(){const{config:e}=this,t=/^(circle|rect(angle)?)$/i.test(e.point_type)?e.point_type:"circle";return mt(e.point_pattern)?e.point_pattern:[t]},generatePoint(){const e=this,{$el:t,config:n}=e,i=[],a=e.getValidPointPattern();return function(s,o,...r){return function(l){var c,d,u,h;const f=e.getTargetSelectorSuffix(l.id||((c=l.data)==null?void 0:c.id)||l),g=(0,F.select)(this);i.indexOf(f)<0&&i.push(f);let p=a[i.indexOf(f)%a.length];if(e.hasValidPointType(p))p=e[p];else if(!mp(p||n.point_type)){const x=e.getDefsPointId(f);if(t.defs.select(`#${x}`).size()<1&&vp.call(e,p,x),s==="create")return(d=e.custom)==null?void 0:d.create.bind(o)(g,x,...r);if(s==="update")return(u=e.custom)==null?void 0:u.update.bind(o)(g,...r)}return(h=p[s])==null?void 0:h.bind(o)(g,...r)}}}};function bp(e,t,n,i=!1){const a=e?[e,0]:n;for(let s=e||n.reduce((o,r)=>o+r);s<=t;)n.forEach(o=>{s+o<=t&&a.push(o),s+=o});return a.length%2!==0&&a.push(i?n[1]:0),{dash:a.join(" "),length:a.reduce((s,o)=>s+o,0)}}var yp={initLine(){er.call(this,{elKey:"line",className:_e.chartLines,cssRules:["pointer-events:none"]})},updateTargetsForLine(e){const t=this,{$el:{area:n,main:i}}=t,a=t.getClass("lines",!0),s=e.filter(r=>!(t.isScatterType(r)||t.isBubbleType(r))),o=La.call(t,s,{type:"Line",elKey:"line",containerClass:_e.chartLines,itemClass:_e.chartLine,initFn:t.initLine});if(o.append("g").attr("class",a),t.hasTypeOf("Area")){const r=i.select(`.${_e.chartLines}`).selectAll(`.${_e.chartLine}`),l=(!n&&o.empty()?r:o).filter(t.isAreaType.bind(t));t.initArea(l)}t.updateTargetForCircle(s,o)},updateLine(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{format:{extraLineClasses:i},$el:a,$T:s}=n,o=t?a.subchart:a,r=o.main.selectAll(`.${_e.lines}`).selectAll(`.${_e.line}`).data(n.lineData.bind(n));s(r.exit(),e).style("opacity","0").remove(),o.line=r.enter().append("path").attr("class",l=>`${n.getClass("line",!0)(l)} ${i(l)||""}`).style("stroke",n.color).merge(r).style("opacity",n.initialOpacity.bind(n)).attr("transform",null)},redrawLine(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{$el:a,$T:s}=i,{line:o}=n?a.subchart:a;return[s(o,t,he()).attr("d",e).style("stroke",this.color).style("opacity",null)]},generateDrawLine(e,t){return zs(this,e,t)},lineWithRegions(e,t,n,i){const a=this,{config:s}=a,o=s.axis_rotated,r=a.axis.isTimeSeries(),l="2 2",c=Ms(a,e,i),d=a.hasNullDataValue(e);let u,h,f,g;const p=o?S=>n(S.value):S=>t(S.x),x=o?S=>t(S.x):S=>n(S.value),_=S=>`M${S[0][0]},${S[0][1]}L${S[1][0]},${S[1][1]}`,v=r?(S,k,L,R)=>{const E=S.x.getTime(),P=k.x-S.x,D=new Date(E+P*L),z=new Date(E+P*(L+R)),$=o?[[n(h(L)),t(D)],[n(h(L+f)),t(z)]]:[[t(D),n(h(L))],[t(z),n(h(L+f))]];return _($)}:(S,k,L,R)=>{const E=t(k.x,!o),P=n(k.value,o),D=L+R,z=t(u(L),!o),$=n(h(L),o);let G=t(u(D),!o),N=n(h(D),o);G>E&&(G=E),S.value>k.value&&(o?N<P:N>P)&&(N=P);const q=[[z,$],[G,N]];return o&&q.forEach(At=>At.reverse()),_(q)},m={x:a.axis.getAxisType("x"),y:a.axis.getAxisType("y")};let b="";if(!e.length)return b;const y=a.$el.line.filter(({id:S})=>S===e[0].id),T=y.clone().style("display","none"),w=(S,k)=>S.attr("d",k).node().getTotalLength(),C={dash:[],lastLength:0};let A=!1;for(let S=0,k;k=e[S];S++){const L=e[S-1],R=L&&J(L.value);let E=a.isWithinRegions(k.x,c);if(J(k.value)){if(yt(c)||!E||!R)b+=`${S&&R?"L":"M"}${p(k)},${x(k)}`;else if(R)if(E=((E==null?void 0:E.dasharray)||l).split(" ").map(Number),u=Ie(m.x,L.x,k.x),h=Ie(m.y,L.value,k.value),d){const P=t(k.x)-t(L.x),D=n(k.value)-n(L.value),z=Math.sqrt(P*P+D*D);f=E[0]/z,g=f*E[1];for(let $=f;$<=1;$+=g)b+=v(L,k,$,f),$+g>=1&&(b+=v(L,k,1,0))}else{let P;if(A=k.x===e[e.length-1].x,r){const G=+L.x,N=new Date(G),q=new Date(G+(+k.x-G));P=[[t(N),n(h(0))],[t(q),n(h(1))]]}else P=[[t(u(0)),n(h(0))],[t(u(1)),n(h(1))]];o&&P.forEach(G=>G.reverse());const D=w(T,b),z=w(T,b+=`L${P[1].join(",")}`),$=bp(D-C.lastLength,z-C.lastLength,E,A);C.lastLength+=$.length,C.dash.push($.dash)}}}return C.dash.length&&(!A&&C.dash.push(w(T,b)),y.attr("stroke-dasharray",C.dash.join(" "))),T.remove(),b},isWithinRegions(e,t){return $s(e,t)},isWithinStep(e,t){return Math.abs(t-Jt(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||ot(t)&&t.indexOf(e.id)!==-1}};const bn=()=>he(),Zr=new WeakMap;function qr(e){const t=e.getAttribute("height"),n=e.getAttribute("width"),i=e.getAttribute("href")||e.getAttribute("xlink:href"),a=Zr.get(e);if(a&&a.attrHeight===t&&a.attrWidth===n&&a.href===i)return a;const{width:s,height:o}=Xe(e),r={attrHeight:t,attrWidth:n,height:o,href:i,width:s};return Zr.set(e,r),r}var Ai={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:n}}=this;let i=t.point_opacity;return yt(i)&&(i=this.getBaseValue(e)!==null&&n[e.id]?this.opacityForCircle(e):"0"),i},opacityForCircle(e){var t;const{config:n}=this;let i=n.point_opacity;return yt(i)&&(i=n.point_show&&!((t=this.isPointFocusOnly)!=null&&t.call(this))?null:"0",i=J(this.getBaseValue(e))?this.isBubbleType(e)||this.isScatterType(e)?"0.5":i:"0"),i},initCircle(){const e=this,{$el:{main:t}}=e;!e.point&&(e.point=e.generatePoint()),(e.hasType("bubble")||e.hasType("scatter"))&&t.select(`.${Y.chart} > .${Bt.chartCircles}`).empty()&&t.select(`.${Y.chart}`).append("g").attr("class",Bt.chartCircles)},updateTargetForCircle(e,t){const n=this,{config:i,data:a,$el:s}=n,o=i.interaction_enabled&&i.data_selection_enabled,r=o&&i.data_selection_isselectable,l=n.getClass("circles",!0);if(!i.point_show)return;n.initCircle();let c=e,d=t;if(!c){c=n.filterNullish(a.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const u=s.main.select(`.${Bt.chartCircles}`).style("pointer-events","none").selectAll(`.${Bt.circles}`).data(c);u.exit().remove(),d=u.enter()}o&&d.append("g").attr("class",u=>n.generateClass(xt.selectedCircles,u.id)),d.append("g").attr("class",l).call(u=>{n.setCssRule(!0,`.${Bt.circles}`,["cursor:pointer"],r)(u),n.setCssRule(!0,` .${Bt.circle}`,["fill","stroke"],n.color)(u)}).style("opacity",function(){return(0,F.select)(this.parentNode).classed(Bt.chartCircles)?"0":null}),o&&c.forEach(u=>{s.main.selectAll(`.${xt.selectedCircles}${n.getTargetSelectorSuffix(u.id)}`).selectAll(`${xt.selectedCircle}`).each(h=>{h.value=u.values[h.index].value})})},updateCircle(e=!1){const t=this,{config:n,state:i,$el:a}=t,s=t.isPointFocusOnly(),o=e?a.subchart:a;if(n.point_show&&!i.toggling){n.point_radialGradient&&t.updateLinearGradient();const r=o.main.selectAll(`.${Bt.circles}`).selectAll(`.${Bt.circle}`).data(u=>{const h=t.isLineType(u)&&t.shouldDrawPointsForLine(u)||t.isBubbleType(u)||t.isRadarType(u)||t.isScatterType(u)?s?[u.values[0]]:u.values:[];return t.filterNullish(h)});r.exit().remove();const l=t.pointR.bind(t),c=t.generateUpdateCircleColor(),d=t.initialOpacityForCircle.bind(t);r.enter().filter(Boolean).append(t.point("create",this,l,c)),o.circle=o.main.selectAll(`.${Bt.circles} .${Bt.circle}`).style("stroke",t.getStylePropValue(t.color)).style("opacity",d)}},generateUpdateCircleColor(){const e=this,t=e.getStylePropValue(e.color);return n=>e.config.point_radialGradient?e.getGradienColortUrl(n.id):t?t(n):null},updateCircleColor(e){return this.generateUpdateCircleColor()(e)},redrawCircle(e,t,n,i,a=!1){const s=this,{state:{rendered:o},$el:r,$T:l}=s,c=a?r.subchart:r,d=c.main.selectAll(`.${xt.selectedCircle}`);if(!s.config.point_show)return[];const u=s.isCirclePoint()?"c":"",h=he(),f=s.opacityForCircle.bind(s),g=s.generateUpdateCircleColor();if(s.isCirclePoint()){const _=c.circle;return s.hasType("bubble")&&_.attr("r",s.pointR.bind(s)),n?(i&&_.attr("cx",e),l(_.filter(function(){return!!this.getAttribute("cx")}),!0,`${h}-pos`).attr("cx",e).attr("cy",t).style("fill",g),_.filter(function(){return!this.getAttribute("cx")}).attr("cx",e).attr("cy",t).style("fill",g)):_.attr("cx",e).attr("cy",t).style("fill",g),[[l(_,n||!o,h).style("opacity",f)],l(d,n).attr("cx",e).attr("cy",t)]}const p=s.point("update",s,e,t,g,n,i,d),x=[];return c.circle.each(function(_){let v=p.bind(this)(_);v=l(v,n||!o,h).style("opacity",f),x.push(v)}),[x,l(d,n).attr(`${u}x`,e).attr(`${u}y`,t)]},showCircleFocus(e){const t=this,{state:{hasRadar:n,resizing:i,toggling:a,transiting:s},$el:o}=t;let{circle:r}=o;if(s===!1&&r&&t.isPointFocusOnly()){const l=(n?t.radarCircleX:t.circleX).bind(t),c=(n?t.radarCircleY:t.circleY).bind(t),d=a||yt(e),u=t.point("update",t,l,c,t.getStylePropValue(t.color),i?!1:d);e&&(r=r.filter(function(h){var f;const g=(f=e.filter)==null?void 0:f.call(e,p=>p.id===h.id);return g.length?(0,F.select)(this).datum(g[0]):!1})),r.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:f,index:g,value:p}=h;let x="hidden";J(p)&&(u.bind(this)(h),t.expandCircles(g,f),x=""),this.style.visibility=x})}},hideCircleFocus(){const e=this,{$el:{circle:t}}=e;e.isPointFocusOnly()&&t&&(e.unexpandCircles(),t.style("visibility","hidden"))},expandCircles(e,t,n){const i=this,a=i.pointExpandedR.bind(i);n&&i.unexpandCircles();const s=i.getShapeByIndex("circle",e,t).classed(Y.EXPANDED,!0),o=a(s)/i.config.point_r,r=1-o;i.isCirclePoint()?s.attr("r",a):s.each(function(){const l=(0,F.select)(this);if(this.tagName==="circle")l.attr("r",a);else{const{width:c,height:d}=qr(this),u=r*(+l.attr("x")+c/2),h=r*(+l.attr("y")+d/2);l.attr("transform",`translate(${u} ${h}) scale(${o})`)}})},unexpandCircles(e){const t=this,n=t.pointR.bind(t),i=t.getShapeByIndex("circle",e).filter(function(){return(0,F.select)(this).classed(Y.EXPANDED)}).classed(Y.EXPANDED,!1);if(i.attr("r",n),!t.isCirclePoint()){const a=n(i)/t.config.point_r;i.attr("transform",a!==1?`scale(${a})`:null)}},isWithinCircle(e,t){const{state:n}=this,i=Jt(n.event,e),a=(0,F.select)(e),s=this.isCirclePoint(e)?"c":"",o=this.getPointSensitivity(a==null?void 0:a.datum());let r=+a.attr(`${s}x`),l=+a.attr(`${s}y`);if(!(r||l)&&e.nodeType===1){const{x:u,y:h}=ht(e);r=u,l=h}const c=r-i[0],d=l-i[1];return Math.sqrt(c*c+d*d)<(t||o)},updatePointClass(e){const t=this,{circle:n}=t.$el;let i=!1;return(Q(e)||n)&&(i=e===!0?n.each(function(a){let s=t.getClass("circle",!0)(a);this.getAttribute("class").indexOf(Y.EXPANDED)>-1&&(s+=` ${Y.EXPANDED}`),this.setAttribute("class",s)}):t.getClass("circle",!0)(e)),i},custom:{create(e,t,n){return e.append("use").attr("xlink:href",`#${t}`).attr("class",this.updatePointClass.bind(this)).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,{width:l,height:c}=qr(e.node()),d=f=>J(f.value)?t(f)-l/2:0,u=f=>J(f.value)?n(f)-c/2:0;let h=e;return a&&(s&&h.attr("x",d),h=r.$T(h,a,bn()),o&&r.$T(o,a,bn())),h.attr("x",d).attr("y",u).style("fill",i)}},circle:{create(e,t,n){return e.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",t).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this;let l=e;return r.hasType("bubble")&&l.attr("r",r.pointR.bind(r)),a&&(s&&l.attr("cx",t),l.attr("cx")&&(l=r.$T(l,a,bn())),o&&r.$T(o,a,bn())),l.attr("cx",t).attr("cy",n).style("fill",i)}},rectangle:{create(e,t,n){const i=a=>t(a)*2;return e.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",i).attr("height",i).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,l=r.config.point_r,c=h=>t(h)-l,d=h=>n(h)-l;let u=e;return a&&(s&&u.attr("x",c),u=r.$T(u,a,bn()),o&&r.$T(o,a,bn())),u.attr("x",c).attr("y",d).style("fill",i)}}},en={point_show:!0,point_r:2.5,point_radialGradient:!1,point_sensitivity:10,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_focus_only:!1,point_opacity:void 0,point_pattern:[],point_select_r:void 0,point_type:"circle"},Tp={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0};function Jr(e,t,n){const{config:i}=e,a=(s,o)=>{const r=X(o)?o:o===!1?void 0:null;r!==null&&(i[`axis_${s}_${t}`]=r)};ct(n)&&(Yt(n)?Object.keys(n).forEach(s=>{a(s,n[s])}):(X(n)||n===!1)&&["y","y2"].forEach(s=>{a(s,n)}),e.state.dirty.data=!0,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function Qr(e,t){const{config:n}=e;return{x:n[`axis_x_${t}`],y:n[`axis_y_${t}`],y2:n[`axis_y2_${t}`]}}var wp={axis:{labels:function(e){var t;const n=this.internal;let i;return e&&(Object.keys(e).forEach(a=>{n.axis.setLabelText(a,e[a])}),n.state.isCanvasMode?(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1):n.axis.updateLabels()),["x","y","y2"].forEach(a=>{const s=n.axis.getLabelText(a);s&&(!i&&(i={}),i[a]=s)}),i},min:function(e){const t=this.internal;return J(e)||e===!1?Jr(t,"min",e):Qr(t,"min")},max:function(e){const t=this.internal;return J(e)||e===!1?Jr(t,"max",e):Qr(t,"max")},range:function(e){const{axis:t}=this;if(arguments.length){const{min:n,max:i}=e;ct(i)&&t.max(i),ct(n)&&t.min(n)}else return{max:t.max(),min:t.min()}}}},Cp={groups(e){const t=this.internal,{config:n}=t;return yt(e)||(n.data_groups=e,t.state.dirty.data=!0,t.redraw()),n.data_groups}},Sp={x(e){const t=this.internal,{axis:n,data:i}=t,a=n.isCustomX()&&n.isCategorized();return ot(e)&&(a?this.categories(e):(t.updateTargetX(i.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),a?this.categories():i.xs},xs(e){const t=this.internal;return Q(e)&&(t.updateTargetXs(t.data.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},yn=pt(10),Ap=Object.defineProperty,kp=(e,t,n)=>t in e?Ap(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ki=(e,t,n)=>kp(e,typeof t!="symbol"?t+"":t,n);class Lp{constructor(t){ki(this,"owner"),ki(this,"config"),ki(this,"scale"),ki(this,"charSize",{});const n=Ie(),{config:i,params:a}=t;this.owner=t,this.config=i,this.scale=n,(i.noTransition||!a.config.transition_duration)&&(i.withoutTransition=!0),i.range=this.scaleExtent((a.orgXScale||n).range())}getSizeFor1Char(t,n,i=!0){const a={w:5.5,h:11.5};return this.charSize[t]&&i?this.charSize[t]:(!n.empty()&&n.text("0").call(s=>{try{const{width:o,height:r}=Xe(s.node(),!0);o&&r&&(a.w=o,a.h=r)}finally{s.text("")}}),this.charSize[t]=a,a)}getTickTransformSetter(t){const{config:n}=this,i=t==="x"?a=>`translate(${a+n.tickOffset},0)`:a=>`translate(0,${a})`;return(a,s)=>{a.attr("transform",o=>{const r=s(o);return J(o)?i(r):null})}}scaleExtent(t){const n=t[0],i=t[t.length-1];return n<i?[n,i]:[i,n]}generateTicks(t,n){const{tickStepSize:i}=this.owner.params,[a,s]=t.domain();let o=[];if(n&&i){let r=Math.round(a);for(;r<=s;)o.push(r),r+=i}else if(t.ticks){const{tickArguments:r}=this.config;if(t.type==="log"&&!r){const l=Ie("_log").domain([a>0?a:1,s]).range(t.range());o=l.ticks();for(let c=s.toFixed().length;o.length>15;c--)o=l.ticks(c);o.splice(0,1,a),o.splice(o.length-1,1,s)}else o=t.ticks(...this.config.tickArguments||[])}return o}copyScale(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t}textFormatted(t){const n=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+String(t).replace(/0+\d$/,""):t,a=n?n(i):i;return ct(a)?a:""}transitionise(t){const{config:n}=this;let i=t;if(n.withoutTransition)i=t.interrupt();else if(n.transition||!this.owner.params.noTransition)try{i=t.transition(n.transition)}catch(a){}return i}}var Rp=Object.defineProperty,Ep=(e,t,n)=>t in e?Rp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hn=(e,t,n)=>Ep(e,typeof t!="symbol"?t+"":t,n);class Pp{constructor(t={}){Hn(this,"helper"),Hn(this,"config"),Hn(this,"params"),Hn(this,"g"),Hn(this,"generatedTicks",[]);const n={innerTickSize:rt,outerTickSize:t.outerTick?rt:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:lc,tickOffset:0,tickPadding:Ve,tickValues:null,transition:null,noTransition:t.noTransition};n.tickLength=Math.max(n.innerTickSize,0)+n.tickPadding,this.config=n,this.params=t,this.helper=new Lp(this)}canReuseTickTextOnResize(t){const{config:n,params:i}=this,{config:a,id:s,owner:o}=i,r=/^(x|subX)$/.test(s),c=s==="subX"?a.subchart_axis_x_tick_format||a.axis_x_tick_format:a[`axis_${s==="subX"?"x":s}_tick_format`],d=i.tickMultiline&&i.isCategory&&!t&&!(i.tickWidth>0);return!!(o.state.resizing&&!o.state.flowing&&!O(a.axis_evalTextSize)&&!c&&!i.tickTitle&&!(r&&a.axis_x_tick_autorotate)&&!d&&n.withoutTransition)}canReuseTickNodesOnResize(t,n,i,a){if(a.tick||!a.text||!this.canReuseTickTextOnResize(i)||t.size()!==n.length)return!1;const s=t.nodes();for(let o=0;o<n.length;o++){const r=s[o].__data__,l=n[o];if(r instanceof Date||l instanceof Date){if(+r!=+l)return!1}else if(r!==l)return!1}return!0}create(t){const n=this,{config:i,helper:a,params:s}=n,{scale:o}=a,{orient:r}=i,l=this.splitTickText.bind(n),c=/^(left|right)$/.test(r),d=/^(top|bottom)$/.test(r),u=a.getTickTransformSetter(d?"x":"y"),h=u===a.axisX?"y":"x",f=/^(top|left)$/.test(r)?-1:1,g=s.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():a.scaleExtent((s.orgXScale||o).range());const{innerTickSize:p,tickLength:x,range:_}=i,v=s.id,m=v&&/^(x|y|y2)$/.test(v)?s.config[`axis_${v}_tick_text_position`]:{x:0,y:0},b=v==="subX"?"subchart_axis_x":`axis_${v}`,y=s.config[`${b}_show`],T={tick:y?s.config[`${b}_tick_show`]:!1,text:y?s.config[`${b}_tick_text_show`]:!1},w=s.config.axis_evalTextSize;let C;t.each(function(){const A=(0,F.select)(this);let S=this.__chart__||o,k=a.copyScale();C=A,this.__chart__=k,i.tickOffset=s.isCategory?(k(1)-k(0))/2:0;const L=A.selectAll(".domain").data([0]);if(L.enter().append("path").attr("class","domain").merge(L).attr("d",()=>{const R=i.outerTickSize*f;return d?`M${_[0]},${R}V0H${_[1]}V${R}`:`M${R},${_[0]}H0V${_[1]}H${R}`}),T.tick||T.text){const R=i.tickValues||a.generateTicks(k,c||s.config.axis_rotated);n.generatedTicks=R;let E=A.selectAll(".tick");if(n.canReuseTickNodesOnResize(E,R,c||s.config.axis_rotated,T))u(E,k);else{E=E.data(R,k);const D=E.enter().insert("g",".domain").attr("class","tick"),z=E.exit().remove();E=D.merge(E),T.tick&&D.append("line"),T.text&&D.append("text");const $=!D.empty()||!z.empty(),G=T.text&&!$&&n.canReuseTickTextOnResize(c||s.config.axis_rotated);let N={w:0,h:0},q=E.selectAll("text.__bb-empty");if(T.text&&!G){const K=E.select("text"),lt=[];q=K,O(w)&&(N=w.bind(n.params.owner.api)(K.node(),v),this.classList.contains(Y.dummy)&&(this.sizeFor1Char=N)),(!N||N.w===0||N.h===0)&&(N=n.helper.getSizeFor1Char(r,K,!!w));let ft=K.selectAll("tspan").data((bt,$t)=>{let Et;if(s.tickMultiline)Et=l(bt,k,R,c,N.w);else{const kt=a.textFormatted(bt);Et=ot(kt)?kt.concat():[kt]}return lt[$t]=Et.length,Et.map(kt=>({index:$t,splitted:kt}))});ft.exit().remove(),ft=ft.enter().append("tspan").merge(ft).text(bt=>bt.splitted),ft.attr("x",d?0:x*f).attr("dx",(()=>{let bt=0;return/(top|bottom)/.test(r)&&g&&(bt=8*Math.sin(Math.PI*(g/180))*(r==="top"?-1:1)),bt+(m.x||0)})()).attr("dy",(bt,$t)=>{const Et=".71em";let kt=0;return r!=="top"&&(kt=N.h,$t===0&&(kt=c?-((lt[bt.index]-1)*(N.h/2)-3):m.y===0?Et:0)),X(kt)&&m.y?kt+m.y:kt||Et})}const At=E.select("line");if(D.select("line").attr(`${h}2`,p*f),D.select("text").attr(h,x*f),n.setTickLineTextPosition(At,q,N),s.tickTitle){const K=q.select("title"),lt=s.tickTitle;(K.empty()?q.append("title"):K).text(ft=>lt[Number(ft)])}if(k.bandwidth){const K=k,lt=K.bandwidth()/2;S=ft=>K(ft)+lt,k=S}else S.bandwidth?S=k:u(z,k);E=s.owner.state.flowing?a.transitionise(E):s.owner.$T(E),u(D,S),u(E.style("opacity",null),k)}}}),this.g=C}getGeneratedTicks(t){var n;const i=((n=this.generatedTicks)==null?void 0:n.length)-1;let a=this.generatedTicks;if(i>t){const s=Math.round(i/t+.1);a=this.generatedTicks.map((o,r)=>r%s===0?o:null).filter(o=>o!==null).splice(0,t)}return a}getTickXY(){const{config:t}=this,n={x:0,y:0};return this.params.isCategory&&(n.x=t.tickCentered?0:t.tickOffset,n.y=t.tickCentered?t.tickOffset:0),n}getTickSize(t){const{scale:n}=this.helper,{config:i}=this,{innerTickSize:a,range:s}=i,o=n(t)+(i.tickCentered?0:i.tickOffset);return s[0]<o&&o<s[1]?a:0}setTickLineTextPosition(t,n,i){const a=this.getTickXY(),{innerTickSize:s,orient:o,tickLength:r,tickOffset:l}=this.config,c=this.params.id,d=this.params.tickTextRotate,u=6,h=i.h/2-u,f=m=>{const b=["start","end"];return o==="top"&&b.reverse(),m?b[m>0?0:1]:"middle"},g=m=>m?`rotate(${m})`:null,p=m=>{const b=m/(o==="bottom"?15:23);return m?11.5-2.5*b*(m>0?1:-1):r},{config:{axis_rotated:x,axis_x_tick_text_inner:_}}=this.params.owner,v=this.params.config[`axis_${c}_tick_inner`];switch(o){case"bottom":t.attr("x1",a.x).attr("x2",a.x).attr("y2",m=>this.getTickSize.bind(this)(m)*(v?-1:1)),n.attr("x",0).attr("y",p(d)).style("text-anchor",(m,b,{length:y})=>!x&&b===0&&(_===!0||_.first)?"start":!x&&b===y-1&&(_===!0||_.last)?"end":f(d)).attr("transform",g(d));break;case"top":t.attr("x2",0).attr("y2",v?s:-s),n.attr("x",0).attr("y",-(p(d)+h+u)).style("text-anchor",f(d)).attr("transform",g(d));break;case"left":t.attr("x2",v?s:-s).attr("y1",a.y).attr("y2",a.y),n.attr("x",-r).attr("y",l+(x?h/4:h)).style("text-anchor","end");break;case"right":t.attr("x2",v?-s:s).attr("y2",0),n.attr("x",r).attr("y",h).style("text-anchor","start")}}splitTickText(t,n,i,a,s){const{params:o}=this,r=this.helper.textFormatted(t),l=nt(r)&&r.indexOf(`
37
+ </foreignObject></svg>`;return`data:image/svg+xml;base64,${$p(d)}`}function zp(e,t){const{top:n,left:i}=t,{x:a,y:s}=Ue(e,!0),{a:o,b:r,c:l,d:c,e:u,f:d}=e.getScreenCTM(),{width:h,height:f}=ht(e,!0);return{x:o*a+l*s+u-i,y:r*a+c*s+d-n+(f-Math.round(f/4)),width:h,height:f}}function Np(e){const{left:t,top:n}=ht(e),i=s=>s.textContent||s.childElementCount,a=[];return nn(e.querySelectorAll("text")).filter(i).forEach(s=>{const o=r=>{const{fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}=N.getComputedStyle(r),{x:f,y:g,width:p,height:_}=zp(r,{left:t,top:n});return{[r.textContent]:{x:f,y:g,width:p,height:_,fill:l,fontFamily:c,fontSize:u,textAnchor:d,transform:h}}};s.childElementCount>1?nn(s.querySelectorAll("tspan")).filter(i).forEach(r=>{a.push(o(r))}):a.push(o(s))}),a}function Xp(e,t){t.forEach(n=>{Object.keys(n).forEach(i=>{const{x:a,y:s,width:o,height:r,fill:l,fontFamily:c,fontSize:u,transform:d}=n[i];if(e.save(),e.font=`${u} ${c}`,e.fillStyle=l,d==="none")e.fillText(i,a,s);else{const h=d.replace(/(matrix|\(|\))/g,"").split(",");h.splice(4).every(f=>+f==0)?(h.push(a+o-o/4),h.push(s-r+r/3)):(h.push(a),h.push(s)),e.transform(...h),e.fillText(i,0,0)}e.restore()})})}function Gp(e,t,n){const{width:i,height:a}=t||n,s=nt.createElement("canvas"),o=s.getContext("2d");if(s.width=i,s.height=a,o){let l=0,c=i,u=a;if((t==null?void 0:t.preserveAspectRatio)!==!1){const d=Math.min(i/n.width,a/n.height);c=n.width*d,u=n.height*d,l=(a-u)/2}o.drawImage(e,0,0,e.width,e.height,0,l,c,u)}return s.toDataURL(t.mimeType)}var Vp={export(e,t){var n;const i=this.internal,{state:a,$el:{chart:s,svg:o}}=i,r=(n=i.canvasEngine)==null?void 0:n.canvas,l=a.isCanvasMode&&r?ht(r,!0):null,{width:c,height:u}=l&&l.width&&l.height?{width:l.width,height:l.height}:a.current,d=ke(Object.create(null),{width:c,height:u,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},e);if(a.isCanvasMode&&r){const g=Gp(r,d,{width:c,height:u});return t==null||t.bind(this)(g),g}const h=Bp(s.node(),d,{width:c,height:u}),f=d.preserveFontStyle?Np(o.node()):[];if(t&&z(t)){const g=new Image;g.crossOrigin="Anonymous",g.onload=()=>{const p=nt.createElement("canvas"),_=p.getContext("2d");p.width=d.width||c,p.height=d.height||u,_.drawImage(g,0,0),f.length&&(Xp(_,f),f.length=0),t.bind(this)(p.toDataURL(d.mimeType))},g.src=h}return h}};let dl=()=>(Ht.prototype.export=Vp.export,(dl=()=>({}))());var Wp={flow(e){const t=this.internal;let n;(e.json||e.rows||e.columns)&&t.convertData(e,a=>{n=a,i()});function i(){var a,s,o;let r,l=0,c=0,u,d;if(t.state.redrawing||!n||!qn())return;(a=t.flushCanvasFlow)==null||a.call(t);const h=[],f=t.getMaxDataCount(),g=t.convertDataToTargets(n,!0),p=t.axis.isTimeSeries();t.data.targets.forEach(m=>{let v=!1;for(let b=0;b<g.length;b++)if(m.id===g[b].id){v=!0,m.values[m.values.length-1]&&(c=m.values[m.values.length-1].index+1);const y=g[b].values;l=y.length;for(let T=0;T<l;T++)y[T].index=c+T,p||(y[T].x=c+T),m.values.push(y[T]);g.splice(b,1);break}!v&&h.push(m.id)}),t.data.targets.forEach(m=>{for(let v=0;v<h.length;v++)if(m.id===h[v]){if(!m.values[m.values.length-1])continue;c=m.values[m.values.length-1].index+1;for(let b=0;b<l;b++)m.values.push({id:m.id,index:c+b,x:p?t.getOtherTargetX(c+b):c+b,value:null})}}),t.data.targets.length&&g.forEach(m=>{const v=t.data.targets[0].values[0].index,b=m.values,y=b.length,T=Math.max(c-v,0);if(T){b.length=y+T;for(let w=y-1;w>=0;w--)b[w+T]=b[w];for(let w=0;w<T;w++){const C=v+w;b[w]={id:m.id,index:C,x:p?t.getOtherTargetX(C):C,value:null}}}for(let w=T;w<b.length;w++){const C=b[w];C.index+=c,p||(C.x+=c)}});for(let m=0;m<g.length;m++)t.data.targets.push(g[m]);const _=t.data.targets[0],x=_.values[0];if(ct(e.to)?(l=0,d=p?Wt.call(t,e.to):e.to,_.values.forEach(m=>{m.x<d&&l++})):ct(e.length)&&(l=e.length),f?f===1&&p&&(u=(_.values[_.values.length-1].x-x.x)/2,r=[new Date(+x.x-u),new Date(+x.x+u)]):(p?u=_.values.length>1?_.values[_.values.length-1].x-x.x:x.x-t.getXDomain(t.data.targets)[0]:u=1,r=[x.x-u,x.x]),r&&t.updateXDomain(null,!0,!0,!1,r),t.state.isCanvasMode){const m=J(e.duration)?e.duration:t.config.transition_duration;if((s=t.animateCanvasFlow)==null?void 0:s.call(t,{done:e.done,duration:m,length:l,orgDataCount:f}))return;l&&f&&t.data.targets.forEach(b=>{b.values.splice(0,l)}),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({withLegend:!0,withTransition:!1,withTrimXDomain:!1,withUpdateOrgXDomain:!0,withUpdateXAxis:!0,withUpdateXDomain:!0}),t.updateTypesElements(),(o=e.done)==null||o.call(t.api);return}t.updateTargets(t.data.targets),t.state.dirty.data=!0,t.state._eventRectFingerprint=null,t.redraw({flow:{index:x.index,length:l,duration:J(e.duration)?e.duration:t.config.transition_duration,done:e.done,orgDataCount:f},withLegend:!0,withTransition:f>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}},Yp={generateFlow(e){const t=this,{data:n,state:i,$el:a}=t;return function(){var s;const o=e.flow.length;i.flowing=!0,n.targets.forEach(l=>{l.values.splice(0,o)}),i.dataGeneration++,t.updateXGrid&&t.updateXGrid(!0);const r={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach(l=>{const c=l.split(".");let u=a[c[0]];u&&c.length>1&&(u=u[c[1]]),u!=null&&u.size()&&(r[l]=u)}),(s=t.hideGridFocus)==null||s.call(t),t.setFlowList(r,e)}},setFlowList(e,t){const n=this,{flow:i,targets:a}=t,{duration:s=t.duration,index:o,length:r,orgDataCount:l}=i,c=n.getFlowTransform(a,l,o,r),u=hr();let d;u.add(Object.keys(e).map(h=>(d=e[h].transition().ease(f=>+f).duration(s),h==="axis.x"?d=d.call(f=>{n.axis.x.setTransition(f).create(f)}):h==="region.list"?d=d.filter(n.isRegionOnX).attr("transform",c):d=d.attr("transform",c),d))),d.call(u,()=>{n.cleanUpFlow(e,t)})},cleanUpFlow(e,t){const n=this,{config:i,state:a,$el:{svg:s}}=n,o=i.axis_rotated,{flow:r,shape:l,xv:c}=t,{cx:u,cy:d,xForText:h,yForText:f}=l.pos,{done:g=()=>{},length:p}=r;p&&(["circle","text","shape","eventRect"].forEach(_=>{const x=[];for(let m=0;m<p;m++)x.push(`.${V[_]}-${m}`);s.selectAll(`.${V[`${_}s`]}`).selectAll(x).remove()}),s.select(`.${V.xgrid}`).remove()),Object.keys(e).forEach(_=>{const x=e[_];if(_!=="axis.x"&&x.attr("transform",null),_==="grid.x")x.attr(a.xgridAttr);else if(_==="gridLines.x")x.attr("x1",o?0:c).attr("x2",o?a.width:c),x.select("text").attr("x",o?a.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(_))x.attr("d",l.type[_]);else if(_==="text")x.attr("x",h).attr("y",f).style("fill-opacity",n.opacityForText.bind(n));else if(_==="circle")if(n.isCirclePoint())x.attr("cx",u).attr("cy",d);else{const m=b=>u(b)-i.point_r,v=b=>d(b)-i.point_r;x.attr("x",m).attr("y",v)}else _==="region.list"&&x.select("rect").filter(n.isRegionOnX).attr("x",n.regionX.bind(n)).attr("width",n.regionWidth.bind(n))}),i.interaction_enabled&&n.redrawEventRect(),g.call(n.api),a.flowing=!1},getFlowTransform(e,t,n,i){const a=this,{data:s,scale:{x:o}}=a,r=s.targets[0].values;let l=a.getValueOnIndex(r,n),c=a.getValueOnIndex(r,n+i),u;const d=o.domain(),h=a.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?u=o(d[0])-o(h[0]):u=a.axis.isTimeSeries()?o(d[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?u=o(d[0])-o(h[0]):a.axis.isTimeSeries()?(l=a.getValueOnIndex(r,0),c=a.getValueOnIndex(r,r.length-1),u=o(l.x)-o(c.x)):u=en(h)/2;const f=en(d)/en(h);return`translate(${u},0) scale(${f},1)`}};let hl=()=>(St(ge.prototype,Yp),Ht.prototype.flow=Wp.flow,(hl=()=>({}))());function fl(e){return Array.isArray(e)?e:[e]}function gl(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function Qa(e,t){const n=this.internal,{config:i}=n,a=i.transition_duration&&qn(),s=`grid_${t}_lines`;return e?(i[s]=fl(e),n.state.isCanvasMode?(gl(n),i[s]):(n.updateGrid(),n.redrawGrid(a),i[s])):i[s]}function pl(e,t){const n=`grid_${t}_lines`;return Qa.bind(this)(this.internal.config[n].concat(e?fl(e):[]),t)}function _l(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){const a=((n=i.getGridFilterToRemove)==null?void 0:n.call(i,e))||(()=>!0),s=`grid_${t?"x":"y"}_lines`;i.config[s]=i.config[s].filter(o=>!a(o)),gl(i);return}i.removeGridLines(e,t)}const xl=function(e){return Qa.bind(this)(e,"x")};St(xl,{add(e){return pl.bind(this)(e,"x")},remove(e){return _l.bind(this)(e,!0)}});const ml=function(e){return Qa.bind(this)(e,"y")};St(ml,{add(e){return pl.bind(this)(e,"y")},remove(e){return _l.bind(this)(e,!1)}});var vl={xgrids:xl,ygrids:ml};const Hp=`line.${lt.xgridFocus}:not(.${lt.xgridFocusContinuous}), line.${lt.ygridFocus}`,jp=e=>J(e.position)||"end",Up=e=>e.position==="start"?4:e.position==="middle"?0:-4;function bl(e){var t;const{state:n,$el:{main:i}}=e,a=n._gridFocusEl,s=i.node(),o=((t=a==null?void 0:a.nodes)==null?void 0:t.call(a))||[];return o.length&&o.every(r=>s==null?void 0:s.contains(r))?a:n._gridFocusEl=i.selectAll(Hp)}function yl(e){e.$el.main.select(`line.${lt.xgridFocusContinuous}`).style("visibility","hidden")}function Tl(e,t,n){return i=>{let a=e?0:t;return i.position==="start"?a=e?-n:0:i.position==="middle"&&(a=(e?-n:t)/2),a}}function wl(e,t){t==="grid"&&e.each(function(){const n=(0,O.select)(this);["x1","x2","y1","y2"].forEach(i=>n.attr(i,+n.attr(i)))})}var Kp={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:n},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${j.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",n.pathGrid).attr("class",`${kt.grid} ${kt.gridLines}`),i.gridLines.main.append("g").attr("class",kt.xgridLines),i.gridLines.main.append("g").attr("class",kt.ygridLines),i.gridLines.x=(0,O.selectAll)([]))},updateXGrid(e){const t=this,{config:n,scale:i,state:a,$el:{main:s,grid:o}}=t,r=n.axis_rotated,l=t.generateGridData(n.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,u=d=>(i.zoom||i.x)(d)+c*(r?-1:1);a.xgridAttr=r?{x1:0,x2:a.width,y1:u,y2:u}:{x1:u,x2:u,y1:0,y2:a.height},o.x=s.select(`.${kt.xgrids}`).selectAll(`.${kt.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",kt.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,O.select)(this);Object.keys(a.xgridAttr).forEach(h=>{d.attr(h,a.xgridAttr[h])}),d.style("opacity",()=>+d.attr(r?"y1":"x1")===(r?a.height:0)?"0":null)})},updateYGrid(){const e=this,{axis:t,config:n,scale:i,state:a,$el:{grid:s,main:o}}=e,r=n.axis_rotated,l=u=>i.y(u),c=t.y.getGeneratedTicks(n.grid_y_ticks)||e.scale.y.ticks(n.grid_y_ticks);s.y=o.select(`.${kt.ygrids}`).selectAll(`.${kt.ygrid}`).data(c),s.y.exit().remove(),s.y=s.y.enter().append("line").attr("class",kt.ygrid).merge(s.y),s.y.attr("x1",r?l:0).attr("x2",r?l:a.width).attr("y1",r?0:l).attr("y2",r?a.height:l),wl(s.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:n}}=e;!n.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:n,$el:{gridLines:i,main:a},$T:s}=t,o=n.axis_rotated,r=e==="x";n[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=a.select(`.${kt[`${e}gridLines`]}`).selectAll(`.${kt[`${e}gridLine`]}`).data(n[`grid_${e}_lines`]);s(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(u){const d=(0,O.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),s(l.attr("class",u=>`${kt[`${e}gridLine`]} ${u.class||""}`.trim()).select("text").attr("text-anchor",jp).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",Up).attr("dy",-5)).text(function(u){var d;return(d=u.text)!=null?d:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:n},state:{width:i,height:a},$el:{gridLines:s},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=s.x.select("line"),u=s.x.select("text"),d=s.y.select("line"),h=s.y.select("text");return c=o(c,e).attr("x1",n?0:r).attr("x2",n?i:r).attr("y1",n?r:0).attr("y2",n?r:a),u=o(u,e).attr("x",Tl(!n,i,a)).attr("y",r),d=o(d,e).attr("x1",n?l:0).attr("x2",n?l:i).attr("y1",n?0:l).attr("y2",n?a:l),h=o(h,e).attr("x",Tl(n,i,a)).attr("y",l),[c.style("opacity",null),u.style("opacity",null),d.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:n,state:{clip:i},$el:a}=e;n._gridFocusEl=null;const s=t.grid_front,o=`.${s&&a.gridLines.main?kt.gridLines:j.chart}${s?" + *":""}`,r=a.main.insert("g",o).attr("clip-path",i.pathGrid).attr("class",kt.grid);if(a.grid.main=r,t.grid_x_show&&r.append("g").attr("class",kt.xgrids),t.grid_y_show&&r.append("g").attr("class",kt.ygrids),t.axis_tooltip){const l=r.append("g").attr("class","bb-axis-tooltip");l.append("line").attr("class","bb-axis-tooltip-x"),l.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(r.append("g").attr("class",lt.xgridFocus).append("line").attr("class",lt.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&r.append("g").attr("class",lt.ygridFocus).append("line").attr("class",lt.ygridFocus),t.subchart_grid_focus_continuous&&t.subchart_grid_focus!==!1&&a.main.insert("g",o).attr("class",lt.xgridFocusContinuous).append("line").attr("class",`${lt.xgridFocus} ${lt.xgridFocusContinuous}`).style("visibility","hidden"))},showAxisGridFocus(){var e,t;const n=this,{config:i,format:a,state:{event:s,width:o,height:r}}=n,l=i.axis_rotated,[c,u]=qt(s,(e=n.$el.eventRect)==null?void 0:e.node()),d={x:c,y:u};for(const[h,f]of Object.entries(n.$el.axisTooltip)){const g=h==="x"&&!l||h!=="x"&&l?"x":"y",p=d[g];let _=(t=n.scale[h])==null?void 0:t.invert(p);_&&(_=h==="x"&&n.axis.isTimeSeries()?a.xAxisTick(_):_==null?void 0:_.toFixed(2),f==null||f.attr(g,p).text(_))}n.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,f){const g=(0,O.select)(this);f===0?g.attr("x1",c).attr("x2",c).attr("y1",f?0:r).attr("y2",f?r:0):g.attr("x1",f?0:o).attr("x2",f?o:0).attr("y1",u).attr("y2",u)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll(`line.${It.axisTooltipX}, line.${It.axisTooltipY}`).style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const n=this,{config:i,state:{width:a,height:s}}=n,o=i.axis_rotated,r=bl(n),l=(e||[r.datum()]).filter(d=>d&&J(n.getBaseValue(d)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&n.hasType("bubble")||n.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,u=n.xx.bind(n);r.style("visibility",null).data(l.concat(l)).each(function(d){const h=(0,O.select)(this),f={x:u(d),y:n.getYScaleById(d.id)(d.value)};let g;if(h.classed(lt.xgridFocus))g=o?[null,f.x,c?f.y:a,f.x]:[f.x,c?f.y:null,f.x,s];else{const p=n.axis.getId(d.id)==="y2";g=o?[f.y,c&&!p?f.x:null,f.y,c&&p?f.x:s]:[c&&p?f.x:null,f.y,c&&!p?f.x:a,f.y]}["x1","y1","x2","y2"].forEach((p,_)=>h.attr(p,g[_]))}),wl(r,"grid"),(t=n.showCircleFocus)==null||t.call(n,e)},hideGridFocus(e=!1){var t;const n=this,{state:{inputType:i,resizing:a}}=n;(e||i==="mouse"||!a)&&(bl(n).style("visibility","hidden"),yl(n),(t=n.hideCircleFocus)==null||t.call(n))},updateGridFocus(){var e;const t=this,{state:{inputType:n,width:i,height:a,resizing:s},$el:{grid:o}}=t,r=o.main.select(`line.${lt.xgridFocus}`);if(n==="touch")r.empty()?s&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:a),yl(t)}return!0},generateGridData(e,t){const n=this,i=n.$el.main.select(`.${It.axisX}`).selectAll(".tick").size();let a=[];if(e==="year"){const s=n.getXDomain(n.data.targets),[o,r]=s.map(l=>l.getFullYear());for(let l=o;l<=r;l++)a.push(new Date(`${l}-01-01 00:00:00`))}else a=t.ticks(_e),a.length>i&&(a=a.filter(s=>String(s).indexOf(".")<0));return a},getGridFilterToRemove(e){return e?t=>{let n=!1;return(ot(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(n=!0)}),n}:()=>!0},removeGridLines(e,t){const n=this,{config:i,$T:a}=n,s=n.getGridFilterToRemove(e),o=u=>!s(u),r=t?kt.xgridLines:kt.ygridLines,l=t?kt.xgridLine:kt.ygridLine;a(n.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(s)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},Zp={grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:void 0,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0};let Cl=()=>(St(ge.prototype,Kp),Ht.prototype.xgrids=vl.xgrids,Ht.prototype.ygrids=vl.ygrids,cn.setOptions([Zp]),(Cl=()=>({}))());function Sl(e,t,n,i){const a=this,{config:s,$el:{main:o}}=a,r=s.data_selection_grouped,l=s.data_selection_isselectable.bind(a.api),c=ct(t)?[].concat(t):null,u=e&&!s.data_selection_multiple;let d=!u;const h=(f,g,p)=>{a.unselectPoint(f,g,p),f.interrupt().remove()};a.getTargetsToShow().forEach(f=>{const{id:g}=f,p=r||!c||c.indexOf(g)>=0,_=o.select(`.${ut.selectedCircles}${a.getTargetSelectorSuffix(g)}`);f.values.forEach(x=>{const{index:m}=x,v=!n||n.indexOf(m)>=0,b=_.selectAll(`.${ut.selectedCircle}-${m}`),y=!b.empty();e?p&&v&&l(x)&&(!y||u)?(d||(Sl.call(a,!1),d=!0),a.selectPoint(null,x,m)):(!u||d)&&ct(i)&&i&&y&&h(b,x,m):p&&v&&y&&h(b,x,m)})})}function ts(e=!1,t,n,i){var a;const s=this,{config:o,$el:{main:r}}=s,l=o.data_selection_grouped,c=o.data_selection_isselectable.bind(s.api),u=e&&!o.data_selection_multiple;let d=!u;if(o.data_selection_enabled){if(u&&(n=n!=null&&n.length?[n[0]]:[0],l||(t=(ct(t)?[].concat(t):s.getTargetsToShow().map(f=>f.id)).slice(0,1))),(a=s.isPointFocusOnly)!=null&&a.call(s)){Sl.call(s,e,t,n,i);return}r.selectAll(`.${At.shapes}`).selectAll(`.${At.shape}`).each(function(h){const f=(0,O.select)(this),{id:g,index:p}=h.data?h.data:h,_=l||!t||t.indexOf(g)>=0,x=!n||n.indexOf(p)>=0;if(f.classed(we.line)||f.classed(Si.area))return;const m=s.getToggle(this,h).bind(s),v=f.classed(ut.SELECTED);e?_&&x&&c(h)&&(!v||u)?(d||(ts.call(s,!1),d=!0),!f.classed(ut.SELECTED)&&m(!0,f.classed(ut.SELECTED,!0),h,p)):(!u||d)&&ct(i)&&i&&v&&m(!1,f.classed(ut.SELECTED,!1),h,p):_&&x&&c(h)&&v&&m(!1,f.classed(ut.SELECTED,!1),h,p)})}}var qp={selected(e){var t,n;const i=this.internal,a=[];return i.state.isCanvasMode?((t=i.getCanvasSelectedData)==null?void 0:t.call(i,e))||a:(n=i.isPointFocusOnly)!=null&&n.call(i)?(i.$el.main.selectAll(`.${ut.selectedCircles+i.getTargetSelectorSuffix(e)}`).selectAll(`.${ut.selectedCircle}`).each(s=>a.push(s)),a):(i.$el.main.selectAll(`.${At.shapes+i.getTargetSelectorSuffix(e)}`).selectAll(`.${At.shape}`).filter(function(){return(0,O.select)(this).classed(ut.SELECTED)}).each(s=>a.push(s)),a)},select(e,t,n){var i;const a=this.internal;if(a.state.isCanvasMode){(i=a.setCanvasSelection)==null||i.call(a,!0,e,t,n);return}ts.bind(a)(!0,e,t,n)},unselect(e,t){var n;const i=this.internal;if(i.state.isCanvasMode){(n=i.setCanvasSelection)==null||n.call(i,!1,e,t);return}ts.bind(i)(!1,e,t)}},Jp={drag(e){const t=this,{config:n,state:i,$el:{main:a}}=t,s=n.data_selection_grouped,o=n.interaction_enabled&&n.data_selection_isselectable;if(t.hasArcType()||!n.data_selection_enabled||n.zoom_enabled&&!t.zoom.altDomain||!n.data_selection_multiple)return;const[r,l]=i.dragStart||[0,0],[c,u]=e,d=Math.min(r,c),h=Math.max(r,c),f=s?i.margin.top:Math.min(l,u),g=s?i.height:Math.max(l,u),p=()=>{!t||!t.$el||!t.$el.main||(a.select(`.${ln.dragarea}`).attr("x",d).attr("y",f).attr("width",h-d).attr("height",g-f),a.selectAll(`.${At.shapes}`).selectAll(`.${At.shape}`).filter(_=>o==null?void 0:o.bind(t.api)(_)).each(function(_,x){const m=(0,O.select)(this),v=m.classed(ut.SELECTED),b=m.classed(ln.INCLUDED);let y,T;if(m.classed(Xt.circle)){const w=+m.attr("cx"),C=+m.attr("cy");T=t.togglePoint,y=d<w&&w<h&&f<C&&C<g}else if(m.classed(ie.bar)){const{x:w,y:C,width:k,height:S}=cr(this);T=t.togglePath,y=!(h<w||w+k<d)&&!(g<C||C+S<f)}else return;y^b&&(m.classed(ln.INCLUDED,!b),m.classed(ut.SELECTED,!v),T.call(t,!v,m,_,x))}))};dr(t.state,p)},dragstart(e){const t=this,{config:n,state:i,$el:{main:a}}=t;t.hasArcType()||!n.data_selection_enabled||(i.dragStart=e,a.select(`.${j.chart}`).append("rect").attr("class",ln.dragarea).style("opacity","0.1"),t.setDragStatus(!0))},dragend(){const e=this,{config:t,$el:{main:n},$T:i}=e;e.hasArcType()||!t.data_selection_enabled||(i(n.select(`.${ln.dragarea}`)).style("opacity","0").remove(),n.selectAll(`.${At.shape}`).classed(ln.INCLUDED,!1),e.setDragStatus(!1))}},Qp=Object.defineProperty,t_=Object.defineProperties,e_=Object.getOwnPropertyDescriptors,kl=Object.getOwnPropertySymbols,n_=Object.prototype.hasOwnProperty,i_=Object.prototype.propertyIsEnumerable,Al=(e,t,n)=>t in e?Qp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,a_=(e,t)=>{for(var n in t||(t={}))n_.call(t,n)&&Al(e,n,t[n]);if(kl)for(var n of kl(t))i_.call(t,n)&&Al(e,n,t[n]);return e},s_=(e,t)=>t_(e,e_(t)),o_=s_(a_({},Jp),{selectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i,r=a.axis_rotated,l=(r?i.circleY:i.circleX).bind(i),c=(r?i.circleX:i.circleY).bind(i),u=i.pointSelectR.bind(i);Y(a.data_onselected,i.api,t,e==null?void 0:e.node()),o(s.select(`.${ut.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${ut.selectedCircle}-${n}`).data([t]).enter().append("circle").attr("class",()=>i.generateClass(ut.selectedCircle,n)).attr("cx",l).attr("cy",c).attr("stroke",i.color).attr("r",d=>i.pointSelectR(d)*1.4)).attr("r",u)},unselectPoint(e,t,n){const i=this,{config:a,$el:{main:s},$T:o}=i;Y(a.data_onunselected,i.api,t,e==null?void 0:e.node()),o(s.select(`.${ut.selectedCircles}${i.getTargetSelectorSuffix(t.id)}`).selectAll(`.${ut.selectedCircle}-${n}`)).attr("r",0).remove()},togglePoint(e,t,n,i){this[`${e?"":"un"}selectPoint`](t,n,i)},selectPath(e,t){const n=this,{config:i}=n;Y(i.data_onselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter","brightness(1.25)")},unselectPath(e,t){const n=this,{config:i}=n;Y(i.data_onunselected,n.api,t,e.node()),i.interaction_brighten&&e.style("filter",null)},togglePath(e,t,n,i){this[`${e?"":"un"}selectPath`](t,n,i)},getToggle(e,t){const n=this;return e.nodeName==="path"?n.togglePath:n.isStepType(t)?()=>{}:n.togglePoint},toggleShape(e,t,n){var i;const a=this,{config:s,$el:{main:o}}=a;if(s.data_selection_enabled&&s.data_selection_isselectable.bind(a.api)(t)){const r=(0,O.select)(e),l=r.classed(ut.SELECTED),c=a.getToggle(e,t).bind(a);let u;if(!s.data_selection_multiple){const d=(i=a.isPointFocusOnly)==null?void 0:i.call(a);let h=`.${d?ut.selectedCircles:At.shapes}`;s.data_selection_grouped&&(h+=a.getTargetSelectorSuffix(t.id)),o.selectAll(h).selectAll(d?`.${ut.selectedCircle}`:`.${At.shape}.${ut.SELECTED}`).classed(ut.SELECTED,!1).each(function(f){const g=(0,O.select)(this);u=g,c(!1,g,f,f.index)})}(!u||u.node()!==r.node())&&(r.classed(ut.SELECTED,!l),c(!l,r,t,n))}}}),r_={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:()=>!0,data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:()=>{},data_onunselected:()=>{}};let Ll=()=>(St(ge.prototype,o_),St(Ht.prototype,qp),cn.setOptions([r_]),(Ll=()=>!0)());const Rl=function(e){var t,n;const i=this.internal,{axis:a,brush:s,config:o,scale:{x:r,subX:l},state:c}=i;let u;return c.isCanvasMode?(o.subchart_show&&(u=e,Array.isArray(u)?(u=a.isTimeSeries()?u.map(d=>Wt.bind(i)(d)):u,u=i.setCanvasSubchartDomain(u)||c.domain):u=(t=c.domain)!=null?t:r.orgDomain()),u):(o.subchart_show&&(u=e,Array.isArray(u)?(a.isTimeSeries()&&(u=u.map(h=>Wt.bind(i)(h))),i.withinRange(u,i.getZoomDomain("subX",!0),i.getZoomDomain("subX"))&&(c.domain=u.slice(),s.move(s.getSelection(),u.map(l)))):u=(n=c.domain)!=null?n:r.orgDomain()),u)};St(Rl,{show(){var e,t,n;const i=this.internal,{$el:{subchart:a},config:s}=i,o=s.subchart_show;if(!o){if(i.state.isCanvasMode){(e=i.unbindZoomEvent)==null||e.call(i),s.subchart_show=!0,this.resize();return}i.unbindZoomEvent(),s.subchart_show=!o,!a.main&&i.initSubchart();let r=a.main.selectAll(`.${j.target}`);i.data.targets.length!==r.size()&&(i.updateSizes(),i.updateTargetsForSubchart(i.data.targets),r=(t=a.main)==null?void 0:t.selectAll(`.${j.target}`)),r==null||r.style("opacity",null),(n=a.main)==null||n.style("display",null),this.resize()}},hide(){var e;const t=this.internal,{$el:{subchart:{main:n}},config:i}=t;if(t.state.isCanvasMode){i.subchart_show&&(i.subchart_show=!1,this.resize(),(e=t.bindZoomEvent)==null||e.call(t));return}i.subchart_show&&(n==null?void 0:n.style("display"))!=="none"&&(i.subchart_show=!1,n.style("display","none"),this.resize())},toggle(){const e=this.internal,{config:t}=e;this.subchart[t.subchart_show?"hide":"show"]()},reset(){var e;const t=this.internal,{brush:n}=t;if(t.state.isCanvasMode){(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1);return}n.clear(n.getSelection())}});var l_={subchart:Rl};const El=["bar","line","bubble","candlestick","scatter"],c_=["opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width"];function Pl(e,t){var n,i;const a=(i=(n=e.$el.grid)==null?void 0:n.main)==null?void 0:i.select(`line.${V.xgridFocus}`).node();if(!a||!N.getComputedStyle)return;const s=N.getComputedStyle(a);c_.forEach(o=>{const r=s.getPropertyValue(o);r&&t.style(o,r)})}function kn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function u_(e){var t,n;if(!xa(e))return!1;const{config:i,state:a,$el:s}=e,o=(n=(t=s.grid)==null?void 0:t.main)==null?void 0:n.select(`line.${V.xgridFocus}:not(.${V.xgridFocusContinuous})`),r=s.main.select(`line.${V.xgridFocusContinuous}`);if(!(o!=null&&o.node())||!r.node())return!1;const l=a.margin2.left-a.margin.left+a.width2,c=a.margin2.top-a.margin.top+a.height2;return Pl(e,r),i.axis_rotated?r.attr("x1",kn(o.attr("x1"),0)).attr("x2",l).attr("y1",kn(o.attr("y1"),-10)).attr("y2",kn(o.attr("y2"),-10)):r.attr("x1",kn(o.attr("x1"),-10)).attr("x2",kn(o.attr("x2"),-10)).attr("y1",kn(o.attr("y1"),0)).attr("y2",c),r.style("visibility",null),o.style("visibility","hidden"),!0}function d_(e){var t;(t=e.$el.main)==null||t.select(`line.${V.xgridFocusContinuous}`).style("visibility","hidden")}function h_(e,t,n){const{config:i,state:a}=e,[s,o]=qt(t,n),r=ao(e,i.axis_rotated?o:s);return r===null?null:i.axis_rotated?[a.width/2,r]:[r,a.height/2]}function es(e,t,n,i){var a,s;const o=(s=(a=e.$el.eventRect)==null?void 0:a.node)==null?void 0:s.call(a);if(!o)return;const r=h_(e,n,i)||[0,0],l=ht(o,!0),c=l.left+r[0],u=l.top+r[1],d={bubbles:!0,cancelable:!0,screenX:c,screenY:u,clientX:c,clientY:u};/^touch/.test(t)?$a.touch(o,t,d):$a.mouse(o,t,d)}var f_={isSubchartBrushEnabled(){const{config:e}=this;return e.subchart_show&&e.subchart_brush_enabled!==!1},bindSubchartEventRect(e){const t=this,{config:n,state:i}=t;e.on("mouseover mousemove mouseout touchstart touchmove touchend",null),n.interaction_enabled&&(i.inputType==="mouse"?e.on("mouseover mousemove",function(a){t.isSubchartBrushEnabled()||es(t,a.type,a,this)}).on("mouseout",function(a){t.isSubchartBrushEnabled()||es(t,"mouseout",a,this)}):i.inputType==="touch"&&e.on("touchstart touchmove touchend",function(a){var s;t.isSubchartBrushEnabled()||((s=a.touches)==null?void 0:s.length)>1||es(t,a.type,a,this)}))},initBrush(){const e=this,{config:t,scale:n,$el:{subchart:i},state:a}=e,s=t.axis_rotated,o=t.subchart_size_height;let r,l,c;e.brush=(s?(0,Ei.brushY)():(0,Ei.brushX)()).handleSize(5),e.brush.on("start brush end",u=>{const{selection:d,sourceEvent:h,target:f,type:g}=u;g==="start"&&(e.state.inputType==="touch"&&e.hideTooltip(),l=h?d:null),/(start|brush)/.test(g)&&(g==="brush"&&h&&a.domain&&(l==null||l.forEach((p,_)=>{p!==d[_]&&(a.domain[_]=n.x.orgDomain()[_])})),e.redrawForBrush(g!=="start")),g==="end"&&(r=n.x.orgDomain()),f!=null&&f.handle&&(d===null?e.brush.handle.attr("display","none"):e.brush.handle.attr("display",null).attr("transform",(p,_)=>{const x=[d[_],o/2];return`translate(${s?x.reverse():x})`}))}),e.brush.updateResize=function(){c&&clearTimeout(c),c=setTimeout(()=>{const u=this.getSelection();r&&(0,Ei.brushSelection)(u.node())&&this.move(u,r.map(n.subX.orgScale()))},0)},e.brush.update=function(){var u;return this.extent()()[1].filter(h=>isNaN(h)).length===0&&((u=i.main)==null||u.select(`.${V.brush}`).call(this)),this},e.brush.scale=function(u){const d=t.subchart_size_height;let h=e.axis.getExtent();!h&&u.range?h=[[0,0],[u.range()[1],d]]:ot(h)&&(h=h.map((f,g)=>[f,g>0?d:g])),s&&h[1].reverse(),this.extent(h),this.update()},e.brush.getSelection=()=>i.main?i.main.select(`.${V.brush}`):(0,O.select)([])},initSubchart(){const e=this,{config:t,state:{clip:n,hasAxis:i},$el:{defs:a,svg:s,subchart:o,axis:r}}=e;if(!i)return;const l=t.subchart_show?null:"hidden",c=`${n.id}-subchart`,u=e.getClipPath(c);n.idSubchart=c,e.appendClip(a,c),e.initBrush(),o.main=s.append("g").classed(V.subchart,!0).attr("transform",e.getTranslate("context"));const{main:d}=o;d.style("visibility",l),d.append("g").attr("clip-path",u).attr("class",V.chart),e.withSubchartTypeContext(()=>{El.forEach(f=>{const g=$t(/^(bubble|scatter)$/.test(f)?"circle":f);if(e.hasType(f)||e.hasTypeOf(g)){const p=d.select(`.${V.chart}`),_=V[`chart${g}s`];p.select(`.${_}`).empty()&&p.append("g").attr("class",_)}})});const h=d.append("g").attr("clip-path",u).attr("class",V.brush).style("pointer-events",e.isSubchartBrushEnabled()?null:"none").call(e.brush);t.subchart_showHandle&&e.addBrushHandle(h),o.eventRect=d.append("g").attr("clip-path",u).attr("class",`${V.eventRects} ${V.eventRects}-subchart`).style("fill-opacity","0").style("pointer-events",e.isSubchartBrushEnabled()?"none":"all").append("rect").attr("class",`${V.eventRect} ${V.eventRect}-subchart`).attr("width",e.state.width2).attr("height",e.state.height2),e.bindSubchartEventRect(o.eventRect),d.append("g").attr("clip-path",u).attr("class",V.xgridFocus).append("line").attr("class",V.xgridFocus).style("visibility","hidden"),r.subX=d.append("g").attr("class",V.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",t.axis_rotated?"":n.pathXAxis).style("visibility",t.subchart_axis_x_show?l:"hidden"),r.subY=d.append("g").attr("class",V.axisY).attr("transform",e.getTranslate("subY")).style("visibility",t.subchart_axis_y_show?l:"hidden"),r.subY2=d.append("g").attr("class",V.axisY2).attr("transform",e.getTranslate("subY2")).style("visibility",t.subchart_axis_y2_show?l:"hidden")},addBrushHandle(e){const t=this,{config:n}=t,i=n.axis_rotated,a=n.subchart_init_range,s="handle--custom",o=bs[i?"y":"x"];t.brush.handle=e.selectAll(`.${s}`).data(i?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class",s).attr("cursor",`${i?"ns":"ew"}-resize`).attr("d",r=>o[/[se]/.test(r.type)?"end":"start"]).attr("display",a?null:"none")},updateTargetsForSubchart(e){var t;const n=this,{config:i,state:a,$el:{subchart:{main:s}}}=n;i.subchart_show&&(n.withSubchartTypeContext(()=>{El.filter(o=>n.hasType(o)||n.hasTypeOf($t(o))).forEach(o=>{const r=/^(bubble|scatter)$/.test(o),l=$t(r?"circle":o),c=n.getChartClass(l,!0),u=n.getClass(r?"circles":`${o}s`,!0),d=s.select(`.${V[`chart${`${l}s`}`]}`);if(r){const h=d.selectAll(`.${V.circles}`).data(e.filter(n[`is${$t(o)}Type`].bind(n))).attr("class",u);h.exit().remove(),h.enter().append("g").attr("class",u)}else{const h=d.selectAll(`.${V[`chart${l}`]}`).attr("class",c).data(e.filter(n[`is${l}Type`].bind(n))),f=h.enter().append("g").style("opacity","0").attr("class",c).append("g").attr("class",u);h.exit().remove(),o==="line"&&n.hasTypeOf("Area")&&f.append("g").attr("class",n.getClass("areas",!0))}})}),s.selectAll(`.${V.brush} rect`).attr(i.axis_rotated?"width":"height",i.axis_rotated?a.width2:a.height2),(t=n.$el.subchart.eventRect)==null||t.attr("width",a.width2).attr("height",a.height2).style("pointer-events",n.isSubchartBrushEnabled()?"none":"all"))},updateSubchartYDomain(e){var t,n;const i=this,{scale:a}=i,s=e||i.filterTargetsToShow(i.data.targets);(t=a.subY)==null||t.domain(i.getYDomain(s,"y")),(n=a.subY2)==null||n.domain(i.getYDomain(s,"y2"))},redrawSubchart(e,t){var n,i,a,s;const o=this,{config:r,$el:{subchart:{main:l}},state:c}=o,u=!!t;if(l.style("visibility",r.subchart_show?null:"hidden"),l.select(`.${V.brush}`).style("pointer-events",o.isSubchartBrushEnabled()?null:"none"),(n=o.$el.subchart.eventRect)==null||n.style("pointer-events",o.isSubchartBrushEnabled()?"none":"all"),(i=o.$el.axis.subY)==null||i.style("visibility",r.subchart_axis_y_show?null:"hidden"),(a=o.$el.axis.subY2)==null||a.style("visibility",r.subchart_axis_y2_show?null:"hidden"),r.subchart_show&&(((s=c.event)==null?void 0:s.type)==="zoom"&&o.brush.update(),e)){const d=r.subchart_init_range;!Lr(o)&&o.brush.update(),o.withSubchartTypeContext(()=>{const h=c._targetsToShow||o.filterTargetsToShow(o.data.targets);o.updateSubchartYDomain(h);const f=o.getDrawShape();if(Object.keys(f.type).forEach(g=>{const p=$t(g),_=o[`generateDraw${p}`](f.indices[g],!0);o[`update${p}`](u,!0),o[`redraw${p}`](_,u,!0)}),o.hasType("bubble")||o.hasType("scatter")){const{cx:g}=f.pos,p=o.updateCircleY(!0);o.updateCircle(!0),o.redrawCircle(g,p,u,void 0,!0)}}),!c.rendered&&d&&(c.domain=d,o.brush.move(o.brush.getSelection(),d.map(o.scale.x)))}},showSubchartGridFocus(e){const t=this,{config:n,state:i,$el:{subchart:{main:a}}}=t;if(!a||!n.subchart_show||t.isSubchartBrushEnabled()||n.grid_focus_show===!1||n.subchart_grid_focus===!1||!n.tooltip_show||n.axis_tooltip)return;const o=(Array.isArray(e)?e:[e]).find(c=>c&&t.getBaseValue(c)!=null);if(!o){t.hideSubchartGridFocus();return}const r=t.scale.subX(o.x);if(!Number.isFinite(r)){t.hideSubchartGridFocus();return}const l=a.select(`g.${V.xgridFocus} line.${V.xgridFocus}`);if(u_(t)){l.style("visibility","hidden");return}Pl(t,l),n.axis_rotated?l.attr("x1",0).attr("x2",i.width2).attr("y1",r).attr("y2",r):l.attr("x1",r).attr("x2",r).attr("y1",0).attr("y2",i.height2),l.style("visibility",null)},hideSubchartGridFocus(){var e;d_(this),(e=this.$el.subchart.main)==null||e.select(`g.${V.xgridFocus} line.${V.xgridFocus}`).style("visibility","hidden")},redrawForBrush(e=!0){var t;const n=this,{config:{subchart_onbrush:i,zoom_rescale:a},scale:s,state:o}=n;n.redraw({withTransition:!1,withY:a,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e&&o.rendered&&i.bind(n.api)((t=o.domain)!=null?t:s.x.orgDomain())},transformContext(e,t){const n=this,{$el:{subchart:i},$T:a}=n,s=t!=null&&t.axisSubX?t.axisSubX:a(i.main.select(`.${V.axisX}`),e),o=t!=null&&t.axisSubY?t.axisSubY:a(i.main.select(`.${V.axisY}`),e),r=t!=null&&t.axisSubY2?t.axisSubY2:a(i.main.select(`.${V.axisY2}`),e);i.main.attr("transform",n.getTranslate("context")),s.attr("transform",n.getTranslate("subX")),o.attr("transform",n.getTranslate("subY")),r.attr("transform",n.getTranslate("subY2"))}},g_={subchart_show:!1,subchart_type:void 0,subchart_types:{},subchart_brush_enabled:!0,subchart_showHandle:!1,subchart_size_height:60,subchart_grid_focus:!0,subchart_grid_focus_continuous:!1,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_count:void 0,subchart_axis_x_tick_values:void 0,subchart_axis_x_tick_culling:void 0,subchart_axis_x_tick_culling_max:void 0,subchart_axis_x_tick_culling_lines:void 0,subchart_axis_x_tick_culling_reverse:void 0,subchart_axis_x_tick_outer:void 0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_axis_y_show:!1,subchart_axis_y_tick_show:!0,subchart_axis_y_tick_count:void 0,subchart_axis_y_tick_values:void 0,subchart_axis_y_tick_culling:void 0,subchart_axis_y_tick_culling_max:void 0,subchart_axis_y_tick_culling_lines:void 0,subchart_axis_y_tick_culling_reverse:void 0,subchart_axis_y_tick_outer:void 0,subchart_axis_y_tick_format:void 0,subchart_axis_y_tick_text_show:!0,subchart_axis_y2_show:!1,subchart_axis_y2_tick_show:!0,subchart_axis_y2_tick_count:void 0,subchart_axis_y2_tick_values:void 0,subchart_axis_y2_tick_culling:void 0,subchart_axis_y2_tick_culling_max:void 0,subchart_axis_y2_tick_culling_lines:void 0,subchart_axis_y2_tick_culling_reverse:void 0,subchart_axis_y2_tick_outer:void 0,subchart_axis_y2_tick_format:void 0,subchart_axis_y2_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:()=>{}};let Dl=()=>(St(ge.prototype,f_),St(Ht.prototype,l_),cn.setOptions([g_]),(Dl=()=>!0)());var re=bt(9);const Il=function(e){var t,n;const i=this.internal,{axis:a,config:s,org:o,scale:r,state:l}=i;let c;if(!a)return;const u=a.isCategorized();if(s.zoom_enabled)if(c=e,Array.isArray(c)){if(a.isTimeSeries()&&(c=c.map(h=>Wt.bind(i)(h))),i.withinRange(c,i.getZoomDomain("zoom",!0),i.getZoomDomain("zoom"))){if(l.domain=c.slice(),c=i.getZoomDomainValue(c),i.api.tooltip.hide(),s.subchart_show)if(l.isCanvasMode)(t=i.setCanvasSubchartDomain)==null||t.call(i,c,!0,!1);else{const h=r.zoom||r.x;i.brush.getSelection().call(i.brush.move,c.map(h))}else{const h=u?r.x.orgScale():o.xScale||r.x;i.updateCurrentZoomTransform(h,c)}i.setZoomResetButton()}}else c=i.zoom.getDomain();return(n=l.domain)!=null?n:c};St(Il,{enable(e){var t;const n=this.internal,{axis:i,config:a}=n;if(!i){a.zoom_enabled=!1;return}/^(drag|wheel)$/.test(e)&&(a.zoom_type=e),a.zoom_enabled=!!e,n.zoom?e===!1&&n.bindZoomEvent(!1):n.initZoom(),e!==!1&&(a.zoom_type==="drag"&&!n.zoomBehaviour&&((t=n.initZoomBehaviour)==null||t.call(n)),n.bindZoomEvent()),n.updateAndRedraw()},max(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_max=ue("max",[i[1],e])),n.zoom_x_max},min(e){const t=this.internal,{config:n,org:{xDomain:i}}=t;return(e===0||e)&&(n.zoom_x_min=ue("min",[i[0],e])),n.zoom_x_min},range(e){const t=this.zoom;if(tt(e)){const{min:n,max:i}=e;ct(n)&&t.min(n),ct(i)&&t.max(i)}return{min:t.min(),max:t.max()}}});var p_={zoom:Il,unzoom(){var e;const t=this.internal,{config:n,$el:{canvas:i,eventRect:a,zoomResetBtn:s},scale:{zoom:o},state:r}=t,l=r.isCanvasMode?i:a;(o||r.isCanvasMode&&n.subchart_show&&r.domain)&&(n.subchart_show?r.isCanvasMode?(e=t.clearCanvasSubchartDomain)==null||e.call(t,!0,!1):t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(re.zoomIdentity),t.updateZoom(!0),s==null||s.style("display","none"),l!=null&&l.node()&&(0,re.zoomTransform)(l.node())!==re.zoomIdentity&&t.zoom.transform(l,re.zoomIdentity),r.domain=void 0)}};function Bi(e){return e.state.isCanvasMode?e.$el.canvas:e.$el.eventRect}function Ml(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return re.zoomIdentity.translate(t.x+(t.k-1)*n.left,t.y+(t.k-1)*n.top).scale(t.k)}function Fl(e,t){if(!e.state.isCanvasMode)return t;const{margin:n}=e.state;return re.zoomIdentity.translate(t.x-(t.k-1)*n.left,t.y-(t.k-1)*n.top).scale(t.k)}function Ol(e,t,n){const i=qt(t,n);if(e.state.isCanvasMode){const{margin:a}=e.state;i[0]-=a.left,i[1]-=a.top}return i}var __={initZoom(){const e=this;e.scale.zoom=null,e.generateZoom(),e.config.zoom_type==="drag"&&e.initZoomBehaviour()},bindZoomEvent(e=!0){const t=this,{config:n}=t;n.zoom_enabled&&e?!n.subchart_show&&t.bindZoomOnEventRect():e===!1&&(t.api.unzoom(),t.unbindZoomEvent())},generateZoom(){const e=this,{config:t,org:n,scale:i}=e,a=(0,re.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));a.orgScaleExtent=()=>{const s=t.zoom_extent||[1,10];return[s[0],Math.max(e.getMaxDataCount()/s[1],s[1])]},a.updateScaleExtent=function(){const s=en(e.scale.x.orgDomain())/en(e.getZoomDomain()),o=this.orgScaleExtent();return this.scaleExtent([o[0]*s,o[1]*s]),this},a.updateTransformScale=(s,o)=>{var r,l;const c=t.axis_rotated,u=Ml(e,s);(r=n.xScale)==null||r.range(i.x.range());const d=u[c?"rescaleY":"rescaleX"](n.xScale||i.x);if(d.domain().some(g=>/(Invalid Date|NaN)/.test(g.toString())))return;const h=e.trimXDomain(d.domain()),f=t.zoom_rescale;if(d.domain(h,n.xDomain),o){const g=d(i.x.domain()[0]),p=c?u.x:g,_=c?g:u.y,x=Fl(e,re.zoomIdentity.translate(p,_).scale(s.k));(l=Bi(e))==null||l.property("__zoom",x)}i.zoom=e.getCustomizedXScale(d),e.axis.x.scale(i.zoom),f?(!n.xScale&&(n.xScale=i.x.copy()),i.x.domain(h)):n.xScale&&(i.x.domain(n.xScale.domain()),n.xScale=null)},a.getDomain=()=>{const s=i[i.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(s[1]-=2),s},e.zoom=a},onZoomStart(e){const t=this,{sourceEvent:n}=e;n&&(t.zoom.startEvent=n,t.state.zooming=!0,Y(t.config.zoom_onzoomstart,t.api,e))},onZoom(e){const t=this,{config:n,scale:i,state:a,org:s}=t,{sourceEvent:o}=e,r=(e==null?void 0:e.transform)===re.zoomIdentity;if(!n.zoom_enabled||t.filterTargetsToShow(t.data.targets).length===0||!i.zoom&&(o==null?void 0:o.type.indexOf("touch"))>-1&&(o==null?void 0:o.touches.length)===1)return;e.sourceEvent&&(a.zooming=!0,a.domain=void 0);const l=(o==null?void 0:o.type)==="mousemove",c=(o==null?void 0:o.wheelDelta)<0,{transform:u}=e;!l&&c&&i.x.domain().every((g,p)=>g!==s.xDomain[p])&&i.x.domain(s.xDomain),t.zoom.updateTransformScale(u,n.zoom_type==="wheel"&&o);const d=n.transition_duration>0&&!n.subchart_show&&(a.dragging||r||!e.sourceEvent),h=o&&l&&n.zoom_type!=="wheel",f=()=>{var g;t.config&&(t.redraw({withTransition:d,withY:n.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.state.cancelClick=l,!r&&Y(n.zoom_onzoom,t.api,(g=t.state.domain)!=null?g:t.zoom.getDomain()))};h?dr(t.state,f):f()},onZoomEnd(e){var t,n;const i=this,{config:a,state:s}=i,o=i.zoom;if(!o)return;let{startEvent:r}=o,l=e==null?void 0:e.sourceEvent;const c=(e==null?void 0:e.transform)===re.zoomIdentity;(r==null?void 0:r.type.indexOf("touch"))>-1&&(r=r.changedTouches[0],l=(t=l==null?void 0:l.changedTouches)==null?void 0:t[0]),!(a.zoom_type==="drag"&&l&&r.clientX===l.clientX&&r.clientY===l.clientY)&&(s.zooming=!1,!s.isCanvasMode&&i.redrawEventRect(),i.updateZoom(),!c&&(l||s.dragging)&&Y(a.zoom_onzoomend,i.api,(n=i.state.domain)!=null?n:i.zoom.getDomain()))},updateZoom(e){const t=this,{subX:n,x:i,zoom:a}=t.scale;if(a){const s=a.domain(),o=n.domain(),r=.015,l=t.config.axis_x_inverted?(s[0]>=o[0]||s[0]+r>=o[0])&&(o[1]>=s[1]||o[1]>=s[1]+r):(s[0]<=o[0]||s[0]-r<=o[0])&&(o[1]<=s[1]||o[1]<=s[1]-r);(e||l)&&(t.axis.x.scale(n),i.domain(n.orgDomain()),t.scale.zoom=null)}},updateCurrentZoomTransform(e,t){var n;const i=this,{config:a}=i,s=a.axis_rotated,o=[-e(t[0]),0],r=re.zoomIdentity.scale(e.range()[1]/(e(t[1])-e(t[0]))).translate(...s?o.reverse():o);(n=Bi(i))==null||n.call(i.zoom.transform,Fl(i,r))},bindZoomOnEventRect(){var e,t;const n=this,{config:i,$el:{svg:a}}=n,s=Bi(n),o=i.zoom_type==="drag"?n.zoomBehaviour:n.zoom;n.state.isCanvasMode&&((e=o==null?void 0:o.touchable)==null||e.call(o,()=>i.interaction_inputType_touch!==!1)),!n.state.isCanvasMode&&N.GestureEvent&&/^((?!chrome|android|mobile).)*safari/i.test((t=N.navigator)==null?void 0:t.userAgent)&&a.on("wheel",()=>{}),s==null||s.call(o).on("dblclick.zoom",null)},initZoomBehaviour(){const e=this,{config:t,state:n}=e,i=t.axis_rotated;let a=0,s=0,o,r;const l={axis:i?"y":"x",attr:i?"height":"width",index:i?1:0},c=u=>{const[d,h]=r!=null?r:[0,i?n.height:n.width];return Math.min(Math.max(u,d),h)};e.zoomBehaviour=(0,kr.drag)().touchable(()=>!n.isCanvasMode||t.interaction_inputType_touch!==!1).clickDistance(4).on("start",function(u){var d;r=e.scale.zoom?null:e.axis.getExtent(),n.event=u,e.setDragStatus(!0),e.unselectRect(),!n.isCanvasMode&&!o&&(o=e.$el.main.append("rect").attr("clip-path",n.clip.path).attr("class",Ia.zoomBrush).attr("width",i?n.width:0).attr("height",i?0:n.height)),o==null||o.attr(i?"width":"height",i?n.width:n.height),a=c(Ol(e,u,this)[l.index]),s=a,n.isCanvasMode?(d=e.renderCanvasZoomBrush)==null||d.call(e,a,s):o.attr(l.axis,a).attr(l.attr,0),e.onZoomStart(u)}).on("drag",function(u){var d;s=c(Ol(e,u,this)[l.index]),n.isCanvasMode?(d=e.renderCanvasZoomBrush)==null||d.call(e,a,s):o.attr(l.axis,Math.min(a,s)).attr(l.attr,Math.abs(s-a))}).on("end",u=>{var d;const h=e.scale.zoom||e.scale.x;n.event=u,s=c(s),n.isCanvasMode?(d=e.clearCanvasZoomBrush)==null||d.call(e):o.attr(l.axis,0).attr(l.attr,0),a>s&&([a,s]=[s,a]),a<0&&(s+=Math.abs(a),a=0),a!==s&&e.api.zoom([a,s].map(f=>h.invert(f))),e.setDragStatus(!1)})},setZoomResetButton(){const e=this,{config:t,$el:n}=e,i=t.zoom_resetButton;i&&t.zoom_type==="drag"&&(n.zoomResetBtn?n.zoomResetBtn.style("display",null):n.zoomResetBtn=e.$el.chart.append("div").classed(j.button,!0).append("span").on("click",function(){z(i.onclick)&&i.onclick.bind(e.api)(this),e.api.unzoom()}).classed(Ia.buttonZoomReset,!0).text(i.text||"Reset Zoom"))},getZoomTransform(){const e=this,t=Bi(e),n=t==null?void 0:t.node();return n?Ml(e,(0,re.zoomTransform)(n)):{k:1}}},x_={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0};let $l=()=>(St(ge.prototype,__),St(Ht.prototype,p_),cn.setOptions([x_]),($l=()=>!0)());function Bl(e){var t;e.state.canvasShape=null,(t=e.renderCanvasFrame)==null||t.call(e,void 0,null,!1)}function zl(e,t=!1){const n=this.internal,{config:i}=n,a=i.transition_duration&&qn();return e?(i.regions=t?i.regions.concat(e):e,n.state.isCanvasMode?(Bl(n),i.regions):(n.updateRegion(),n.redrawRegion(a),i.regions)):i.regions}const Nl=function(e){return zl.bind(this)(e)};St(Nl,{add:function(e){return zl.bind(this)(e,!0)},remove:function(e){const t=this.internal,{config:n,$T:i}=t,a=e||{},s=Ne(a,"classes",[Zn.region]);let o=n.regions;if(t.state.isCanvasMode)return Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(u=>{s.indexOf(u)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],Bl(t),n.regions;const r=t.$el.main.select(`.${Zn.regions}`).selectAll(s.map(l=>`.${l}`));return i(r).style("opacity","0").remove(),Object.keys(a).length?(o=o.filter(l=>{let c=!1;return l.class?(l.class.split(" ").forEach(u=>{s.indexOf(u)>=0&&(c=!0)}),!c):!0}),n.regions=o):n.regions=[],o}});var m_={regions:Nl},v_={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",Zn.regions)},updateRegion(){const e=this,{config:t,$el:{region:n},$T:i}=e;n.main||e.initRegion(),n.main.style("visibility",e.hasArcType()?"hidden":null);const a=n.main.selectAll(`.${Zn.region}`).data(t.regions);i(a.exit()).style("opacity","0").remove();const s=a.enter().append("g");s.append("rect").style("fill-opacity","0"),n.list=s.merge(a).attr("class",e.classRegion.bind(e)),n.list.each(function(o){var r;(0,O.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,O.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:n},$T:i}=t,a=t.regionX.bind(t),s=t.regionY.bind(t),o=["width","height"];let r=n.list.select("rect"),l=n.list.selectAll("text");return r=i(r,e).attr("x",a).attr("y",s).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),l=i(l,e).text(c=>{var u;return(u=c.label)==null?void 0:u.text}).attr("transform",({label:c})=>c.rotated?" rotate(-90)":null).attr("transform",function(c){var u;const{x:d=0,y:h=0,center:f=!1,rotated:g=!1}=(u=c.label)!=null?u:{},p=this.previousElementSibling,_={x:0,y:0};return Q(f)&&["x","y"].forEach((x,m)=>{f.indexOf(x)>-1&&(_[x]=(+p.getAttribute(o[m])-ht(this)[o[m]])/2)}),`translate(${a(c)+_.x+d}, ${s(c)+_.y+h})${g?" rotate(-90)":""}`}).attr("text-anchor",({label:c})=>c!=null&&c.rotated?"end":null).attr("dy","1em").style("fill",({label:c})=>{var u;return(u=c==null?void 0:c.color)!=null?u:null}),[r.style("fill-opacity",c=>J(c.opacity)?c.opacity:null).on("end",function(){(0,O.select)(this.parentNode).selectAll("rect:not([x])").remove()}),l.style("opacity",null)]},regionX(e){return this.getRegionSize("x",e)},regionY(e){return this.getRegionSize("y",e)},regionWidth(e){return this.getRegionSize("width",e)},regionHeight(e){return this.getRegionSize("height",e)},getRegionSize(e,t){const n=this,{config:i,scale:a,state:s}=n,o=i.axis_rotated,r=/(x|y|y2)/.test(e),l=r?e==="x":e==="width",c=!r&&n[l?"regionX":"regionY"](t);let u=r?"start":"end",d=r?0:s[e],h;if(t.axis==="y"||t.axis==="y2"?(!r&&!l?u="start":r&&!l&&(u="end"),(l?o:!o)&&u in t&&(h=a[t.axis])):(l?!o:o)&&u in t&&(h=a.zoom||a.x),h){let f=0;d=t[u],n.axis.isTimeSeries(t.axis)?d=Wt.call(n,d):/(x|width)/.test(e)&&n.axis.isCategorized()&&isNaN(d)&&(d=i.axis_x_categories.indexOf(d),f=n.axis.x.tickOffset()*(u==="start"?-1:1)),d=h(d)+f}return r?d:d<c?0:d-c},isRegionOnX(e){return!e.axis||e.axis==="x"}};let Xl=()=>(St(ge.prototype,v_),Ht.prototype.regions=m_.regions,(Xl=()=>({}))());var An={initArea(e){const t=this,{config:n}=t;e.insert("g",`.${n.area_front?Xt.circles:we.lines}`).attr("class",t.getClass("areas",!0))},updateAreaColor(e){const t=this;return Gr.call(t,e,"area_linearGradient",t.color)},updateArea(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,state:a,$el:s,$T:o}=n,r=t?s.subchart:s;i.area_linearGradient&&n.updateLinearGradient();const l=r.main.selectAll(`.${Si.areas}`).selectAll(`.${Si.area}`).data(n.lineData.bind(n));o(l.exit(),e).style("opacity","0").remove(),r.area=l.enter().append("path").attr("class",n.getClass("area",!0)).style("fill",n.updateAreaColor.bind(n)).style("opacity",function(){return a.orgAreaOpacity=(0,O.select)(this).style("opacity"),"0"}).merge(l),l.style("opacity",a.orgAreaOpacity),n.setRatioForGroupedData(r.area.data())},redrawArea(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{area:a}=n?this.$el.subchart:this.$el,{orgAreaOpacity:s}=i.state;return[i.$T(a,t,xe()).attr("d",e).style("fill",i.updateAreaColor.bind(i)).style("opacity",o=>String(i.isAreaRangeType(o)?s/1.75:s))]},generateDrawArea(e,t){return mo(this,e,t)}},Ln={area_above:!1,area_below:!1,area_front:!0,area_linearGradient:!1,area_zerobased:!0},ns={spline_interpolation_type:"cardinal"};function b_(e){return Kt(e)&&z(e.create)&&z(e.update)}function y_(e,t){var n;const i=this,a=(l,c)=>{const u=l.attributes;for(let d=0,h;h=u[d];d++)h=h.name,c.setAttribute(h,l.getAttribute(h))},o=new DOMParser().parseFromString(Se(e),"image/svg+xml").documentElement,r=nt.createElementNS(O.namespaces.svg,o.nodeName.toLowerCase());if(r.id=t,r.style.fill="inherit",r.style.stroke="inherit",a(o,r),(n=o.childNodes)!=null&&n.length){const l=(0,O.select)(r);"innerHTML"in r?l.html(Se(o.innerHTML)):nn(o.childNodes).forEach(c=>{a(c,l.append(c.tagName).node())})}i.$el.defs.node().appendChild(r)}var Rn={hasValidPointType(e){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(e||this.config.point_type)},hasLegendDefsPoint(){var e;const{config:t}=this;return t.legend_show&&((e=t.point_pattern)==null?void 0:e.length)&&t.legend_usePoint},getDefsPointId(e){const{state:{datetimeId:t}}=this;return`${t}-point${e}`},getValidPointPattern(){const{config:e}=this,t=/^(circle|rect(angle)?)$/i.test(e.point_type)?e.point_type:"circle";return yt(e.point_pattern)?e.point_pattern:[t]},generatePoint(){const e=this,{$el:t,config:n}=e,i=[],a=e.getValidPointPattern();return function(s,o,...r){return function(l){var c,u,d,h;const f=e.getTargetSelectorSuffix(l.id||((c=l.data)==null?void 0:c.id)||l),g=(0,O.select)(this);i.indexOf(f)<0&&i.push(f);let p=a[i.indexOf(f)%a.length];if(e.hasValidPointType(p))p=e[p];else if(!b_(p||n.point_type)){const _=e.getDefsPointId(f);if(t.defs.select(`#${_}`).size()<1&&y_.call(e,p,_),s==="create")return(u=e.custom)==null?void 0:u.create.bind(o)(g,_,...r);if(s==="update")return(d=e.custom)==null?void 0:d.update.bind(o)(g,...r)}return(h=p[s])==null?void 0:h.bind(o)(g,...r)}}}};function T_(e,t,n,i=!1){const a=e?[e,0]:n;for(let s=e||n.reduce((o,r)=>o+r);s<=t;)n.forEach(o=>{s+o<=t&&a.push(o),s+=o});return a.length%2!==0&&a.push(i?n[1]:0),{dash:a.join(" "),length:a.reduce((s,o)=>s+o,0)}}var w_={initLine(){Vr.call(this,{elKey:"line",className:we.chartLines,cssRules:["pointer-events:none"]})},updateTargetsForLine(e){const t=this,{$el:{area:n,main:i}}=t,a=t.getClass("lines",!0),s=e.filter(r=>!(t.isScatterType(r)||t.isBubbleType(r))),o=Ha.call(t,s,{type:"Line",elKey:"line",containerClass:we.chartLines,itemClass:we.chartLine,initFn:t.initLine});if(o.append("g").attr("class",a),t.hasTypeOf("Area")){const r=i.select(`.${we.chartLines}`).selectAll(`.${we.chartLine}`),l=(!n&&o.empty()?r:o).filter(t.isAreaType.bind(t));t.initArea(l)}t.updateTargetForCircle(s,o)},updateLine(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{format:{extraLineClasses:i},$el:a,$T:s}=n,o=t?a.subchart:a,r=o.main.selectAll(`.${we.lines}`).selectAll(`.${we.line}`).data(n.lineData.bind(n));s(r.exit(),e).style("opacity","0").remove(),o.line=r.enter().append("path").attr("class",l=>`${n.getClass("line",!0)(l)} ${i(l)||""}`).style("stroke",n.color).merge(r).style("opacity",n.initialOpacity.bind(n)).attr("transform",null)},redrawLine(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{$el:a,$T:s}=i,{line:o}=n?a.subchart:a;return[s(o,t,xe()).attr("d",e).style("stroke",this.color).style("opacity",null)]},generateDrawLine(e,t){return xo(this,e,t)},lineWithRegions(e,t,n,i){const a=this,{config:s}=a,o=s.axis_rotated,r=a.axis.isTimeSeries(),l="2 2",c=ro(a,e,i),u=a.hasNullDataValue(e);let d,h,f,g;const p=o?S=>n(S.value):S=>t(S.x),_=o?S=>t(S.x):S=>n(S.value),x=S=>`M${S[0][0]},${S[0][1]}L${S[1][0]},${S[1][1]}`,m=r?(S,A,L,E)=>{const D=S.x.getTime(),R=A.x-S.x,P=new Date(D+R*L),B=new Date(D+R*(L+E)),M=o?[[n(h(L)),t(P)],[n(h(L+f)),t(B)]]:[[t(P),n(h(L))],[t(B),n(h(L+f))]];return x(M)}:(S,A,L,E)=>{const D=t(A.x,!o),R=n(A.value,o),P=L+E,B=t(d(L),!o),M=n(h(L),o);let X=t(d(P),!o),G=n(h(P),o);X>D&&(X=D),S.value>A.value&&(o?G<R:G>R)&&(G=R);const Z=[[B,M],[X,G]];return o&&Z.forEach(et=>et.reverse()),x(Z)},v={x:a.axis.getAxisType("x"),y:a.axis.getAxisType("y")};let b="";if(!e.length)return b;const y=a.$el.line.filter(({id:S})=>S===e[0].id),T=y.clone().style("display","none"),w=(S,A)=>S.attr("d",A).node().getTotalLength(),C={dash:[],lastLength:0};let k=!1;for(let S=0,A;A=e[S];S++){const L=e[S-1],E=L&&J(L.value);let D=a.isWithinRegions(A.x,c);if(J(A.value)){if(Ct(c)||!D||!E)b+=`${S&&E?"L":"M"}${p(A)},${_(A)}`;else if(E)if(D=((D==null?void 0:D.dasharray)||l).split(" ").map(Number),d=Xe(v.x,L.x,A.x),h=Xe(v.y,L.value,A.value),u){const R=t(A.x)-t(L.x),P=n(A.value)-n(L.value),B=Math.sqrt(R*R+P*P);f=D[0]/B,g=f*D[1];for(let M=f;M<=1;M+=g)b+=m(L,A,M,f),M+g>=1&&(b+=m(L,A,1,0))}else{let R;if(k=A.x===e[e.length-1].x,r){const X=+L.x,G=new Date(X),Z=new Date(X+(+A.x-X));R=[[t(G),n(h(0))],[t(Z),n(h(1))]]}else R=[[t(d(0)),n(h(0))],[t(d(1)),n(h(1))]];o&&R.forEach(X=>X.reverse());const P=w(T,b),B=w(T,b+=`L${R[1].join(",")}`),M=T_(P-C.lastLength,B-C.lastLength,D,k);C.lastLength+=M.length,C.dash.push(M.dash)}}}return C.dash.length&&(!k&&C.dash.push(w(T,b)),y.attr("stroke-dasharray",C.dash.join(" "))),T.remove(),b},isWithinRegions(e,t){return lo(e,t)},isWithinStep(e,t){return Math.abs(t-qt(this.state.event,e)[1])<30},shouldDrawPointsForLine(e){const t=this.config.line_point;return t===!0||ot(t)&&t.indexOf(e.id)!==-1}};const En=()=>xe(),Gl=new WeakMap;function Vl(e){const t=e.getAttribute("height"),n=e.getAttribute("width"),i=e.getAttribute("href")||e.getAttribute("xlink:href"),a=Gl.get(e);if(a&&a.attrHeight===t&&a.attrWidth===n&&a.href===i)return a;const{width:s,height:o}=Ue(e),r={attrHeight:t,attrWidth:n,height:o,href:i,width:s};return Gl.set(e,r),r}var zi={initialOpacityForCircle(e){const{config:t,state:{withoutFadeIn:n}}=this;let i=t.point_opacity;return Ct(i)&&(i=this.getBaseValue(e)!==null&&n[e.id]?this.opacityForCircle(e):"0"),i},opacityForCircle(e){var t;const{config:n}=this;let i=n.point_opacity;return Ct(i)&&(i=n.point_show&&!((t=this.isPointFocusOnly)!=null&&t.call(this))?null:"0",i=J(this.getBaseValue(e))?this.isBubbleType(e)||this.isScatterType(e)?"0.5":i:"0"),i},initCircle(){const e=this,{$el:{main:t}}=e;!e.point&&(e.point=e.generatePoint()),(e.hasType("bubble")||e.hasType("scatter"))&&t.select(`.${j.chart} > .${Xt.chartCircles}`).empty()&&t.select(`.${j.chart}`).append("g").attr("class",Xt.chartCircles)},updateTargetForCircle(e,t){const n=this,{config:i,data:a,$el:s}=n,o=i.interaction_enabled&&i.data_selection_enabled,r=o&&i.data_selection_isselectable,l=n.getClass("circles",!0);if(!i.point_show)return;n.initCircle();let c=e,u=t;if(!c){c=n.filterNullish(a.targets).filter(h=>this.isScatterType(h)||this.isBubbleType(h));const d=s.main.select(`.${Xt.chartCircles}`).style("pointer-events","none").selectAll(`.${Xt.circles}`).data(c);d.exit().remove(),u=d.enter()}o&&u.append("g").attr("class",d=>n.generateClass(ut.selectedCircles,d.id)),u.append("g").attr("class",l).call(d=>{n.setCssRule(!0,`.${Xt.circles}`,["cursor:pointer"],r)(d),n.setCssRule(!0,` .${Xt.circle}`,["fill","stroke"],n.color)(d)}).style("opacity",function(){return(0,O.select)(this.parentNode).classed(Xt.chartCircles)?"0":null}),o&&c.forEach(d=>{s.main.selectAll(`.${ut.selectedCircles}${n.getTargetSelectorSuffix(d.id)}`).selectAll(`${ut.selectedCircle}`).each(h=>{h.value=d.values[h.index].value})})},updateCircle(e=!1){const t=this,{config:n,state:i,$el:a}=t,s=t.isPointFocusOnly(),o=e?a.subchart:a;if(n.point_show&&!i.toggling){n.point_radialGradient&&t.updateLinearGradient();const r=o.main.selectAll(`.${Xt.circles}`).selectAll(`.${Xt.circle}`).data(d=>{const h=t.isLineType(d)&&t.shouldDrawPointsForLine(d)||t.isBubbleType(d)||t.isRadarType(d)||t.isScatterType(d)?s?[d.values[0]]:d.values:[];return t.filterNullish(h)});r.exit().remove();const l=t.pointR.bind(t),c=t.generateUpdateCircleColor(),u=t.initialOpacityForCircle.bind(t);r.enter().filter(Boolean).append(t.point("create",this,l,c)),o.circle=o.main.selectAll(`.${Xt.circles} .${Xt.circle}`).style("stroke",t.getStylePropValue(t.color)).style("opacity",u)}},generateUpdateCircleColor(){const e=this,t=e.getStylePropValue(e.color);return n=>e.config.point_radialGradient?e.getGradienColortUrl(n.id):t?t(n):null},updateCircleColor(e){return this.generateUpdateCircleColor()(e)},redrawCircle(e,t,n,i,a=!1){const s=this,{state:{rendered:o},$el:r,$T:l}=s,c=a?r.subchart:r,u=c.main.selectAll(`.${ut.selectedCircle}`);if(!s.config.point_show)return[];const d=s.isCirclePoint()?"c":"",h=xe(),f=s.opacityForCircle.bind(s),g=s.generateUpdateCircleColor();if(s.isCirclePoint()){const x=c.circle;return s.hasType("bubble")&&x.attr("r",s.pointR.bind(s)),n?(i&&x.attr("cx",e),l(x.filter(function(){return!!this.getAttribute("cx")}),!0,`${h}-pos`).attr("cx",e).attr("cy",t).style("fill",g),x.filter(function(){return!this.getAttribute("cx")}).attr("cx",e).attr("cy",t).style("fill",g)):x.attr("cx",e).attr("cy",t).style("fill",g),[[l(x,n||!o,h).style("opacity",f)],l(u,n).attr("cx",e).attr("cy",t)]}const p=s.point("update",s,e,t,g,n,i,u),_=[];return c.circle.each(function(x){let m=p.bind(this)(x);m=l(m,n||!o,h).style("opacity",f),_.push(m)}),[_,l(u,n).attr(`${d}x`,e).attr(`${d}y`,t)]},showCircleFocus(e){const t=this,{state:{hasRadar:n,resizing:i,toggling:a,transiting:s},$el:o}=t;let{circle:r}=o;if(s===!1&&r&&t.isPointFocusOnly()){const l=(n?t.radarCircleX:t.circleX).bind(t),c=(n?t.radarCircleY:t.circleY).bind(t),u=a||Ct(e),d=t.point("update",t,l,c,t.getStylePropValue(t.color),i?!1:u);e&&(r=r.filter(function(h){var f;const g=(f=e.filter)==null?void 0:f.call(e,p=>p.id===h.id);return g.length?(0,O.select)(this).datum(g[0]):!1})),r.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each(function(h){const{id:f,index:g,value:p}=h;let _="hidden";J(p)&&(d.bind(this)(h),t.expandCircles(g,f),_=""),this.style.visibility=_})}},hideCircleFocus(){const e=this,{$el:{circle:t}}=e;e.isPointFocusOnly()&&t&&(e.unexpandCircles(),t.style("visibility","hidden"))},expandCircles(e,t,n){const i=this,a=i.pointExpandedR.bind(i);n&&i.unexpandCircles();const s=i.getShapeByIndex("circle",e,t).classed(j.EXPANDED,!0),o=a(s)/i.config.point_r,r=1-o;i.isCirclePoint()?s.attr("r",a):s.each(function(){const l=(0,O.select)(this);if(this.tagName==="circle")l.attr("r",a);else{const{width:c,height:u}=Vl(this),d=r*(+l.attr("x")+c/2),h=r*(+l.attr("y")+u/2);l.attr("transform",`translate(${d} ${h}) scale(${o})`)}})},unexpandCircles(e){const t=this,n=t.pointR.bind(t),i=t.getShapeByIndex("circle",e).filter(function(){return(0,O.select)(this).classed(j.EXPANDED)}).classed(j.EXPANDED,!1);if(i.attr("r",n),!t.isCirclePoint()){const a=n(i)/t.config.point_r;i.attr("transform",a!==1?`scale(${a})`:null)}},isWithinCircle(e,t){const{state:n}=this,i=qt(n.event,e),a=(0,O.select)(e),s=this.isCirclePoint(e)?"c":"",o=this.getPointSensitivity(a==null?void 0:a.datum());let r=+a.attr(`${s}x`),l=+a.attr(`${s}y`);if(!(r||l)&&e.nodeType===1){const{x:d,y:h}=ht(e);r=d,l=h}const c=r-i[0],u=l-i[1];return Math.sqrt(c*c+u*u)<(t||o)},updatePointClass(e){const t=this,{circle:n}=t.$el;let i=!1;return(tt(e)||n)&&(i=e===!0?n.each(function(a){let s=t.getClass("circle",!0)(a);this.getAttribute("class").indexOf(j.EXPANDED)>-1&&(s+=` ${j.EXPANDED}`),this.setAttribute("class",s)}):t.getClass("circle",!0)(e)),i},custom:{create(e,t,n){return e.append("use").attr("xlink:href",`#${t}`).attr("class",this.updatePointClass.bind(this)).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,{width:l,height:c}=Vl(e.node()),u=f=>J(f.value)?t(f)-l/2:0,d=f=>J(f.value)?n(f)-c/2:0;let h=e;return a&&(s&&h.attr("x",u),h=r.$T(h,a,En()),o&&r.$T(o,a,En())),h.attr("x",u).attr("y",d).style("fill",i)}},circle:{create(e,t,n){return e.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",t).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this;let l=e;return r.hasType("bubble")&&l.attr("r",r.pointR.bind(r)),a&&(s&&l.attr("cx",t),l.attr("cx")&&(l=r.$T(l,a,En())),o&&r.$T(o,a,En())),l.attr("cx",t).attr("cy",n).style("fill",i)}},rectangle:{create(e,t,n){const i=a=>t(a)*2;return e.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",i).attr("height",i).style("fill",n).node()},update(e,t,n,i,a,s,o){const r=this,l=r.config.point_r,c=h=>t(h)-l,u=h=>n(h)-l;let d=e;return a&&(s&&d.attr("x",c),d=r.$T(d,a,En()),o&&r.$T(o,a,En())),d.attr("x",c).attr("y",u).style("fill",i)}}},dn={point_show:!0,point_r:2.5,point_radialGradient:!1,point_sensitivity:10,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_focus_only:!1,point_opacity:void 0,point_pattern:[],point_select_r:void 0,point_type:"circle"},C_={line_connectNull:!1,line_step_type:"step",line_step_tooltipMatch:!1,line_zerobased:!1,line_classes:void 0,line_point:!0};function Wl(e,t,n){const{config:i}=e,a=(s,o)=>{const r=$(o)?o:o===!1?void 0:null;r!==null&&(i[`axis_${s}_${t}`]=r)};ct(n)&&(Kt(n)?Object.keys(n).forEach(s=>{a(s,n[s])}):($(n)||n===!1)&&["y","y2"].forEach(s=>{a(s,n)}),e.state.dirty.data=!0,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function Yl(e,t){const{config:n}=e;return{x:n[`axis_x_${t}`],y:n[`axis_y_${t}`],y2:n[`axis_y2_${t}`]}}var S_={axis:{labels:function(e){var t;const n=this.internal;let i;return e&&(Object.keys(e).forEach(a=>{n.axis.setLabelText(a,e[a])}),n.state.isCanvasMode?(t=n.renderCanvasFrame)==null||t.call(n,void 0,null,!1):n.axis.updateLabels()),["x","y","y2"].forEach(a=>{const s=n.axis.getLabelText(a);s&&(!i&&(i={}),i[a]=s)}),i},min:function(e){const t=this.internal;return J(e)||e===!1?Wl(t,"min",e):Yl(t,"min")},max:function(e){const t=this.internal;return J(e)||e===!1?Wl(t,"max",e):Yl(t,"max")},range:function(e){const{axis:t}=this;if(arguments.length){const{min:n,max:i}=e;ct(i)&&t.max(i),ct(n)&&t.min(n)}else return{max:t.max(),min:t.min()}}}},k_={groups(e){const t=this.internal,{config:n}=t;return Ct(e)||(n.data_groups=e,t.state.dirty.data=!0,t.redraw()),n.data_groups}},A_={x(e){const t=this.internal,{axis:n,data:i}=t,a=n.isCustomX()&&n.isCategorized();return ot(e)&&(a?this.categories(e):(t.updateTargetX(i.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),a?this.categories():i.xs},xs(e){const t=this.internal;return tt(e)&&(t.updateTargetXs(t.data.targets,e),t.state.dirty.data=!0,t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),t.data.xs}},L_=Object.defineProperty,R_=(e,t,n)=>t in e?L_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ni=(e,t,n)=>R_(e,typeof t!="symbol"?t+"":t,n);class E_{constructor(t){Ni(this,"owner"),Ni(this,"config"),Ni(this,"scale"),Ni(this,"charSize",{});const n=Xe(),{config:i,params:a}=t;this.owner=t,this.config=i,this.scale=n,(i.noTransition||!a.config.transition_duration)&&(i.withoutTransition=!0),i.range=this.scaleExtent((a.orgXScale||n).range())}getSizeFor1Char(t,n,i=!0){const a={w:5.5,h:11.5};return this.charSize[t]&&i?this.charSize[t]:(!n.empty()&&n.text("0").call(s=>{try{const{width:o,height:r}=Ue(s.node(),!0);o&&r&&(a.w=o,a.h=r)}finally{s.text("")}}),this.charSize[t]=a,a)}getTickTransformSetter(t){const{config:n}=this,i=t==="x"?a=>`translate(${a+n.tickOffset},0)`:a=>`translate(0,${a})`;return(a,s)=>{a.attr("transform",o=>{const r=s(o);return J(o)?i(r):null})}}scaleExtent(t){const n=t[0],i=t[t.length-1];return n<i?[n,i]:[i,n]}generateTicks(t,n){const{tickStepSize:i}=this.owner.params,[a,s]=t.domain();let o=[];if(n&&i){let r=Math.round(a);for(;r<=s;)o.push(r),r+=i}else if(t.ticks){const{tickArguments:r}=this.config;if(t.type==="log"&&!r){const l=Xe("_log").domain([a>0?a:1,s]).range(t.range());o=l.ticks();for(let c=s.toFixed().length;o.length>15;c--)o=l.ticks(c);o.splice(0,1,a),o.splice(o.length-1,1,s)}else o=t.ticks(...this.config.tickArguments||[])}return o}copyScale(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t}textFormatted(t){const n=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+String(t).replace(/0+\d$/,""):t,a=n?n(i):i;return ct(a)?a:""}transitionise(t){const{config:n}=this;let i=t;if(n.withoutTransition)i=t.interrupt();else if(n.transition||!this.owner.params.noTransition)try{i=t.transition(n.transition)}catch(a){}return i}}var P_=Object.defineProperty,D_=(e,t,n)=>t in e?P_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ei=(e,t,n)=>D_(e,typeof t!="symbol"?t+"":t,n);function Xi(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function I_(e){const t=Xi(e);return/^sub/.test(e)?`subchart_axis_${t}`:`axis_${t}`}class Hl{constructor(t={}){ei(this,"helper"),ei(this,"config"),ei(this,"params"),ei(this,"g"),ei(this,"generatedTicks",[]);const n={innerTickSize:dt,outerTickSize:t.outerTick?dt:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:qc,tickOffset:0,tickPadding:Je,tickValues:null,transition:null,noTransition:t.noTransition};n.tickLength=Math.max(n.innerTickSize,0)+n.tickPadding,this.config=n,this.params=t,this.helper=new E_(this)}canReuseTickTextOnResize(t){const{config:n,params:i}=this,{config:a,id:s,owner:o}=i,r=/^(x|subX)$/.test(s),l=Xi(s),c=/^sub/.test(s)?a[`subchart_axis_${l}_tick_format`]||a[`axis_${l}_tick_format`]:a[`axis_${l}_tick_format`],u=i.tickMultiline&&i.isCategory&&!t&&!(i.tickWidth>0);return!!(o.state.resizing&&!o.state.flowing&&!z(a.axis_evalTextSize)&&!c&&!i.tickTitle&&!(r&&a.axis_x_tick_autorotate)&&!u&&n.withoutTransition)}canReuseTickNodesOnResize(t,n,i,a){if(a.tick||!a.text||!this.canReuseTickTextOnResize(i)||t.size()!==n.length)return!1;const s=t.nodes();for(let o=0;o<n.length;o++){const r=s[o].__data__,l=n[o];if(r instanceof Date||l instanceof Date){if(+r!=+l)return!1}else if(r!==l)return!1}return!0}create(t){const n=this,{config:i,helper:a,params:s}=n,{scale:o}=a,{orient:r}=i,l=this.splitTickText.bind(n),c=/^(left|right)$/.test(r),u=/^(top|bottom)$/.test(r),d=a.getTickTransformSetter(u?"x":"y"),h=d===a.axisX?"y":"x",f=/^(top|left)$/.test(r)?-1:1,g=s.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():a.scaleExtent((s.orgXScale||o).range());const{innerTickSize:p,tickLength:_,range:x}=i,m=s.id,v=Xi(m),{isSubAxes:b}=s,y=!b&&v&&/^(x|y|y2)$/.test(v)?s.config[`axis_${v}_tick_text_position`]:{x:0,y:0},T=I_(m),w=s.config[`${T}_show`],C=b?{tick:!0,text:!0}:{tick:w?s.config[`${T}_tick_show`]:!1,text:w?s.config[`${T}_tick_text_show`]:!1},k=s.config.axis_evalTextSize;let S;t.each(function(){const A=(0,O.select)(this);let L=this.__chart__||o,E=a.copyScale();S=A,this.__chart__=E,i.tickOffset=s.isCategory?(E(1)-E(0))/2:0;const D=A.selectAll(".domain").data([0]);if(D.enter().append("path").attr("class","domain").merge(D).attr("d",()=>{const R=i.outerTickSize*f;return u?`M${x[0]},${R}V0H${x[1]}V${R}`:`M${R},${x[0]}H0V${x[1]}H${R}`}),C.tick||C.text){const R=i.tickValues||a.generateTicks(E,c||s.config.axis_rotated);n.generatedTicks=R;let P=A.selectAll(".tick");if(n.canReuseTickNodesOnResize(P,R,c||s.config.axis_rotated,C))d(P,E);else{P=P.data(R,E);const M=P.enter().insert("g",".domain").attr("class","tick"),X=P.exit().remove();P=M.merge(P),C.tick&&M.append("line"),C.text&&M.append("text");const G=!M.empty()||!X.empty(),Z=C.text&&!G&&n.canReuseTickTextOnResize(c||s.config.axis_rotated);let et={w:0,h:0},rt=P.selectAll("text.__bb-empty");if(C.text&&!Z){const gt=P.select("text"),wt=[];rt=gt,z(k)&&(et=k.bind(n.params.owner.api)(gt.node(),m),this.classList.contains(j.dummy)&&(this.sizeFor1Char=et)),(!et||et.w===0||et.h===0)&&(et=n.helper.getSizeFor1Char(r,gt,!!k));let _t=gt.selectAll("tspan").data((mt,Pt)=>{let Dt;if(s.tickMultiline)Dt=l(mt,E,R,c,et.w);else{const Lt=a.textFormatted(mt);Dt=ot(Lt)?Lt.concat():[Lt]}return wt[Pt]=Dt.length,Dt.map(Lt=>({index:Pt,splitted:Lt}))});_t.exit().remove(),_t=_t.enter().append("tspan").merge(_t).text(mt=>mt.splitted),_t.attr("x",u?0:_*f).attr("dx",(()=>{let mt=0;return/(top|bottom)/.test(r)&&g&&(mt=8*Math.sin(Math.PI*(g/180))*(r==="top"?-1:1)),mt+(y.x||0)})()).attr("dy",(mt,Pt)=>{const Dt=".71em";let Lt=0;return r!=="top"&&(Lt=et.h,Pt===0&&(Lt=c?-((wt[mt.index]-1)*(et.h/2)-3):y.y===0?Dt:0)),$(Lt)&&y.y?Lt+y.y:Lt||Dt})}const xt=P.select("line");if(M.select("line").attr(`${h}2`,p*f),M.select("text").attr(h,_*f),n.setTickLineTextPosition(xt,rt,et),s.tickTitle){const gt=rt.select("title"),wt=s.tickTitle;(gt.empty()?rt.append("title"):gt).text(_t=>wt[Number(_t)])}if(E.bandwidth){const gt=E,wt=gt.bandwidth()/2;L=_t=>gt(_t)+wt,E=L}else L.bandwidth?L=E:d(X,E);P=s.owner.state.flowing?a.transitionise(P):s.owner.$T(P),d(M,L),d(P.style("opacity",null),E)}}}),this.g=S}getGeneratedTicks(t){var n;const i=((n=this.generatedTicks)==null?void 0:n.length)-1;let a=this.generatedTicks;if(i>t){const s=Math.round(i/t+.1);a=this.generatedTicks.map((o,r)=>r%s===0?o:null).filter(o=>o!==null).splice(0,t)}return a}getTickXY(){const{config:t}=this,n={x:0,y:0};return this.params.isCategory&&(n.x=t.tickCentered?0:t.tickOffset,n.y=t.tickCentered?t.tickOffset:0),n}getTickSize(t){const{scale:n}=this.helper,{config:i}=this,{innerTickSize:a,range:s}=i,o=n(t)+(i.tickCentered?0:i.tickOffset);return s[0]<o&&o<s[1]?a:0}setTickLineTextPosition(t,n,i){const a=this.getTickXY(),{innerTickSize:s,orient:o,tickLength:r,tickOffset:l}=this.config,c=this.params.id,u=this.params.tickTextRotate,d=6,h=i.h/2-d,f=v=>{const b=["start","end"];return o==="top"&&b.reverse(),v?b[v>0?0:1]:"middle"},g=v=>v?`rotate(${v})`:null,p=v=>{const b=v/(o==="bottom"?15:23);return v?11.5-2.5*b*(v>0?1:-1):r},{config:{axis_rotated:_,axis_x_tick_text_inner:x}}=this.params.owner,m=this.params.config[`axis_${Xi(c)}_tick_inner`];switch(o){case"bottom":t.attr("x1",a.x).attr("x2",a.x).attr("y2",v=>this.getTickSize.bind(this)(v)*(m?-1:1)),n.attr("x",0).attr("y",p(u)).style("text-anchor",(v,b,{length:y})=>!_&&b===0&&(x===!0||x.first)?"start":!_&&b===y-1&&(x===!0||x.last)?"end":f(u)).attr("transform",g(u));break;case"top":t.attr("x2",0).attr("y2",m?s:-s),n.attr("x",0).attr("y",-(p(u)+h+d)).style("text-anchor",f(u)).attr("transform",g(u));break;case"left":t.attr("x2",m?s:-s).attr("y1",a.y).attr("y2",a.y),n.attr("x",-r).attr("y",l+(_?h/4:h)).style("text-anchor","end");break;case"right":t.attr("x2",m?-s:s).attr("y2",0),n.attr("x",r).attr("y",h).style("text-anchor","start")}}splitTickText(t,n,i,a,s){const{params:o}=this,r=this.helper.textFormatted(t),l=Q(r)&&r.indexOf(`
43
38
  `)>-1?r.split(`
44
- `):[];if(l.length)return l;if(ot(r))return r;let c=o.tickWidth;(!c||c<=0)&&(c=a?95:o.isCategory?(o.isInverted?n(i[0])-n(i[1]):n(i[1])-n(i[0]))-12:110);function d(u,h){let f,g,p;for(let x=1;x<h.length;x++)if(h.charAt(x)===" "&&(g=x),f=h.substr(0,x+1),p=s*f.length,c<p)return d(u.concat(h.substr(0,g||x)),h.slice(g?g+1:x));return u.concat(h)}return d(l,String(r))}scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?String(t):"bottom",this):this.config.orient}tickFormat(t){const{config:n}=this;return arguments.length?(n.tickFormat=t,this):n.tickFormat}tickCentered(t){const{config:n}=this;return arguments.length?(n.tickCentered=t,this):n.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(t){var n,i,a;const{outerTickSize:s,tickOffset:o,tickValues:r}=this.config;let l;if(this.params.isCategory){const c=(n=this.params.owner.scale.zoom)!=null?n:this.helper.scale;l=o*2||Math.abs(c(1)-c(0))}else{const c=(i=this.params.owner.scale.zoom)!=null?i:this.helper.scale;if(l=(this.g?this.g.select("path.domain").node().getTotalLength()-s*2:Math.abs(c.range()[1]-c.range()[0]))/(t||((a=this.g)==null?void 0:a.selectAll("line").size())||1),r)for(let u=0;u<r.length-1;u++){const h=c(r[u+1])-c(r[u]);h&&h<l&&(l=h)}}return l===1/0?0:l}ticks(...t){const{config:n}=this;return t.length?(n.tickArguments=je(t),this):n.tickArguments}tickCulling(t){const{config:n}=this;return arguments.length?(n.tickCulling=t,this):n.tickCulling}tickValues(t){const{config:n}=this;if(O(t))n.tickValues=()=>t(this.helper.scale.domain());else{if(!arguments.length)return n.tickValues;n.tickValues=t}return this}setTransition(t){return this.config.transition=t,this}}var Dp=Object.defineProperty,Ip=Object.defineProperties,Mp=Object.getOwnPropertyDescriptors,tl=Object.getOwnPropertySymbols,$p=Object.prototype.hasOwnProperty,Fp=Object.prototype.propertyIsEnumerable,Oa=(e,t,n)=>t in e?Dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Op=(e,t)=>{for(var n in t||(t={}))$p.call(t,n)&&Oa(e,n,t[n]);if(tl)for(var n of tl(t))Fp.call(t,n)&&Oa(e,n,t[n]);return e},Bp=(e,t)=>Ip(e,Mp(t)),ke=(e,t,n)=>Oa(e,typeof t!="symbol"?t+"":t,n);function zp(e){var t,n;const i=[e[0],e[e.length-1]];let a=0,s=null;for(const r of e){const l=(n=(t=r.textContent)==null?void 0:t.length)!=null?n:0;l>a&&(a=l,s=r)}s&&!i.includes(s)&&i.push(s);const o=e[Math.floor(e.length/2)];return i.includes(o)||i.push(o),i}const Li=50,Ba=Symbol("tickWidthFallback");function Np(e){var t,n,i;const a=e.select("line").node(),s=(n=(t=a==null?void 0:a.ownerDocument)==null?void 0:t.defaultView)!=null&&n.getComputedStyle?parseFloat(a.ownerDocument.defaultView.getComputedStyle(a).strokeWidth):parseFloat((i=a==null?void 0:a.getAttribute)==null?void 0:i.call(a,"stroke-width"));return Number.isFinite(s)&&s>0?s:1}function Xp(e,t,n){var i;const a=(i=e==null?void 0:e.scale)==null?void 0:i.call(e);if(!a||t.length<2)return!1;const s=Math.max(1,n)/2,o=t.map(l=>+a(l)).filter(Number.isFinite).sort((l,c)=>l-c);if(o.length<2)return!1;let r=o[0]+s;for(let l=1;l<o.length;l++){const c=o[l]-s,d=o[l]+s;if(c<=r+qa)return!0;r=Math.max(r,d)}return!1}function Gp(e,t){if(e.length<=Li)return e;const n=new Map,i=r=>{r>=0&&r<e.length&&n.set(r,e[r])};i(0),i(e.length-1),i(Math.floor(e.length/2));const a=Math.max(1,Math.floor(e.length/(Li-3)));let s=-1,o=0;for(let r=0;r<e.length;r+=a){i(r);const l=e[r],c=t?t(l):l,d=Array.isArray(c)?c.join("").length:String(c!=null?c:"").length;d>s&&(s=d,o=r)}return i(o),Array.from(n.keys()).sort((r,l)=>r-l).map(r=>n.get(r))}function Wp(e){return O(e)?nl(e):!Array.isArray(e)||e.length<=Li?e:{length:e.length,first:e[0],middle:e[Math.floor(e.length/2)],last:e[e.length-1]}}function za(e){return e[Ba]}function Ri(e,t){X(t)?Object.defineProperty(e,Ba,{configurable:!0,value:t,writable:!0}):delete e[Ba]}function Na(e){e.length=0,Ri(e)}function Vp(e,t,n){Na(e),e.length=t,Ri(e,n)}function Hp(e){const t=[];return t.length=e.length,Object.keys(e).forEach(n=>{const i=+n;t[i]=e[i]}),Ri(t,za(e)),t}function Yp(e,t){Na(e),e.length=t.length,Object.keys(t).forEach(n=>{const i=+n;e[i]=t[i]}),Ri(e,za(t))}function jp(e,t,n){const i=e[t];if(X(i))return i;const a=Number(i);return Number.isFinite(a)?a:n}const el=new WeakMap;let Up=0;function nl(e){if(!e||!/^(function|object)$/.test(typeof e))return`${typeof e}:${String(e)}`;let t=el.get(e);return t||(t=++Up,el.set(e,t)),`${typeof e}:${t}`}function Xa(e){return e instanceof Date?`date:${+e}`:Array.isArray(e)?`[${e.map(t=>Xa(t)).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${t}:${Xa(e[t])}`).join(",")}}`:typeof e=="function"?nl(e):`${typeof e}:${String(e)}`}function Ga(e){return e instanceof Date?new Date(+e):Array.isArray(e)?e.map(t=>Ga(t)):e}function Kp(e){return{width:e.width,height:e.height,ticks:e.ticks&&Hp(e.ticks),clipPath:e.clipPath,domain:Ga(e.domain)}}function Zp(e,t){return e.width=t.width,e.height=t.height,e.clipPath=t.clipPath,e.domain=Ga(t.domain),e.ticks&&t.ticks&&Yp(e.ticks,t.ticks),e}var qp={getAxisInstance:function(){return this.axis||new Jp(this)}};class Jp{constructor(t){ke(this,"owner"),ke(this,"x"),ke(this,"subX"),ke(this,"y"),ke(this,"y2"),ke(this,"axesList",{}),ke(this,"tick",{x:null,y:null,y2:null}),ke(this,"xs",[]),ke(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${Rt.axis} ${Rt[`axis${Ot(t)}`]}`}isHorizontal(t,n){const i=t.config.axis_rotated;return n?i:!i}isCategorized(){const{config:t,state:n}=this.owner;return t.axis_x_type.indexOf("category")>=0||n.hasRadar}isCustomX(){const{config:t}=this.owner;return!this.isTimeSeries()&&(t.data_x||mt(t.data_xs))}isTimeSeries(t="x"){return this.owner.config[`axis_${t}_type`]==="timeseries"}isLog(t="x"){return this.owner.config[`axis_${t}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(t="x"){let n="linear";return this.isTimeSeries(t)?n=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(n="log"),n}getExtent(){const t=this.owner,{config:n,scale:i}=t;let a=n.axis_x_extent;if(a){if(O(a))a=a.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(this.isTimeSeries()&&a.every(isNaN)){const s=Xt.bind(t);a=a.map(o=>i.subX(s(o)))}}return a}init(){const t=this.owner,{config:n,$el:{main:i,axis:a},state:{clip:s}}=t,o=["x","y"];n.axis_y2_show&&o.push("y2"),o.forEach(r=>{const l=this.getAxisClassName(r);a[r]=i.append("g").attr("class",l).attr("clip-path",()=>{let c=null;return r==="x"?c=s.pathXAxis:r==="y"&&(c=s.pathYAxis),c}).attr("transform",t.getTranslate(r)).style("visibility",n[`axis_${r}_show`]?null:"hidden"),this.generateAxes(r)})}setOrient(){const t=this.owner,{axis_rotated:n,axis_y_inner:i,axis_y2_inner:a}=t.config;this.orient={x:n?"left":"bottom",y:n?i?"top":"bottom":i?"right":"left",y2:n?a?"bottom":"top":a?"left":"right",subX:n?"left":"bottom"}}generateAxes(t){const n=this.owner,{config:i}=n,a=[],s=i[`axis_${t}_axes`],o=i.axis_rotated;let r;t==="x"?r=o?yn.axisLeft:yn.axisBottom:t==="y"?r=o?yn.axisBottom:yn.axisLeft:t==="y2"&&(r=o?yn.axisTop:yn.axisRight),s.length&&s.forEach(l=>{const c=l.tick||{},d=n.scale[t].copy();l.domain&&d.domain(l.domain),a.push(r(d).ticks(c.count).tickFormat(O(c.format)?c.format.bind(n.api):(u=>u)).tickValues(c.values).tickSizeOuter(c.outer===!1?0:rt))}),this.axesList[t]=a}updateAxes(){const t=this.owner,{config:n,$el:{main:i},$T:a}=t;Object.keys(this.axesList).forEach(s=>{const o=n[`axis_${s}_axes`],r=t.scale[s].copy(),l=r.range();this.axesList[s].forEach((c,d)=>{const u=c.scale().range();l.every((g,p)=>g===u[p])||c.scale().range(l);const h=`${this.getAxisClassName(s)}-${d+1}`;let f=i.select(`.${h.replace(/\s/,".")}`);f.empty()?f=i.append("g").attr("class",h).style("visibility",n[`axis_${s}_show`]?null:"hidden").call(c):(o[d].domain&&r.domain(o[d].domain),a(f).call(c.scale(r))),f.attr("transform",t.getTranslate(s,d+1))})})}setAxis(t,n,i,a){const s=this.owner;t!=="subX"&&(this.tick[t]=this.getTickValues(t)),this[t]=this.getAxis(t,n,i,t==="x"&&(s.scale.zoom||s.config.subchart_show||s.state.resizing)?!0:a)}getAxis(t,n,i,a,s){const o=this.owner,{config:r}=o,l=/^(x|subX)$/.test(t),c=l?"x":t,d=l&&this.isCategorized(),u=this.orient[t],h=s?0:o.getAxisTickRotate(c);let f;if(l)f=t==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const v=r[`axis_${t}_tick_format`];O(v)&&(f=v.bind(o.api))}let g=this.tick[c];const p=ve({outerTick:i,noTransition:a,config:r,id:t,tickTextRotate:h,owner:o},l&&{isCategory:d,isInverted:r.axis_x_inverted,tickMultiline:r.axis_x_tick_multiline,tickWidth:r.axis_x_tick_width,tickTitle:d&&r.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const x=new Pp(p).scale(l&&o.scale.zoom||n).orient(u);if(l&&this.isTimeSeries()&&g&&!O(g)){const v=Xt.bind(o);g=g.map(m=>v(m))}else!l&&this.isTimeSeriesY()&&(x.ticks(r.axis_y_tick_time_value),g=null);g&&x.tickValues(g),x.tickFormat(f||!l&&o.isStackNormalized()&&o.hasAxisGroupedData(t)&&(v=>`${v}%`)),d&&(x.tickCentered(r.axis_x_tick_centered),Qt(r.axis_x_tick_culling)&&(r.axis_x_tick_culling=!1));const _=r[`axis_${c}_tick_count`];return _&&x.ticks(_),x}updateXAxisTickValues(t,n){var i;const a=this.owner,{config:s}=a,o=s.axis_x_tick_fit;let r=s.axis_x_tick_count,l;return o&&(l=a.mapTargetsToUniqueXs(t),this.isCategorized()&&r>l.length&&(r=l.length),l=this.generateTickValues(l,r,this.isTimeSeries())),n?n.tickValues(l):this.x&&(this.x.tickValues(l),(i=this.subX)==null||i.tickValues(l)),l}getId(t){const{config:n,scale:i}=this.owner;let a=n.data_axes[t];return(!a||!i[a])&&(a="y"),a}getXAxisTickFormat(t){const n=this.owner,{config:i,format:a}=n,s=t&&i.subchart_axis_x_tick_format||i.axis_x_tick_format,o=this.isTimeSeries(),r=this.isCategorized();let l;return s?O(s)?l=s.bind(n.api):o&&(l=c=>c?a.axisTime(s)(c):""):l=o?a.defaultAxisTime:r?n.categoryName:c=>c<0?c.toFixed(0):c,O(l)?c=>l.apply(n,r?[c,n.categoryName(c)]:[c]):l}getTickValues(t){const n=this.owner,i=n.config[`axis_${t}_tick_values`],a=n[`${t}Axis`];return(O(i)?i.call(n.api):i)||(a?a.tickValues():void 0)}getLabelOptionByAxisId(t){return this.owner.config[`axis_${t}_label`]}getLabelText(t){const n=this.getLabelOptionByAxisId(t);return nt(n)?n:n?n.text:null}setLabelText(t,n){const i=this.owner,{config:a}=i,s=this.getLabelOptionByAxisId(t);nt(s)?a[`axis_${t}_label`]=n:s&&(s.text=n)}getLabelPosition(t,n){const i=this.owner.config.axis_rotated,a=this.getLabelOptionByAxisId(t),s=Yt(a)&&a.position?a.position:n[+!i],o=r=>!!~s.indexOf(r);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}}getAxisLabelPosition(t){return this.getLabelPosition(t,t==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}xForAxisLabel(t){const n=this.owner,{state:{width:i,height:a}}=n,s=this.getAxisLabelPosition(t);let o=s.isMiddle?-a/2:0;return this.isHorizontal(n,t!=="x")?o=s.isLeft?0:s.isCenter?i/2:i:s.isBottom&&(o=-a),o}textAnchorForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isMiddle?"middle":"end";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(a="start"),a}dxForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isBottom?"0.5em":"0";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(a="-0.5em"),a}dyForAxisLabel(t){const n=this.owner,{config:i}=n,a=i.axis_rotated,s=this.getAxisLabelPosition(t).isInner,o=i[`axis_${t}_tick_rotate`]?n.getHorizontalAxisHeight(t):0,{width:r}=this.getMaxTickSize(t);let l;if(t==="x"){const c=i.axis_x_height;a?l=s?"1.2em":-25-r:s?l="-0.5em":c?l=c-10:o?l=o-10:l="3em"}else l={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],a?s?l=l[0]:o?l=o*(t==="y2"?-1:1)-l[1]:l=l[2]:l=s?l[3]:(l[4]+(i[`axis_${t}_inner`]?0:r+l[4]))*(t==="y"?-1:1);return l}getTickFormatCacheValue(t){const n=this.owner,{config:i}=n;return t==="x"?{format:i.axis_x_tick_format,type:i.axis_x_type,localtime:i.axis_x_localtime,categories:i.axis_x_categories}:{format:i[`axis_${t}_tick_format`],normalized:n.isStackNormalized(),grouped:n.hasAxisGroupedData(t),type:i[`axis_${t}_type`]}}getMaxTickSizeFingerprint(t,n,i,a,s,o){var r;const l=this.owner,{config:c,state:d}=l,u=t==="x",h=u?"axis_x":`axis_${t}`,f=a.tickValues();return Xa({id:t,withoutRecompute:!!o,dataGeneration:d.dataGeneration,size:[d.current.width,d.current.height],range:(r=n.range)==null?void 0:r.call(n),domain:i,type:n.type,orient:this.orient[t],axisRotated:c.axis_rotated,evalTextSize:c.axis_evalTextSize,format:this.getTickFormatCacheValue(t),ticks:{values:Wp(f),rawValues:c[`${h}_tick_values`],arguments:a.ticks(),count:c[`${h}_tick_count`],rotate:s,show:c[`${h}_tick_show`],textShow:c[`${h}_tick_text_show`],textPosition:c[`${h}_tick_text_position`],inner:c[`${h}_tick_inner`],culling:c[`${h}_tick_culling`],cullingMax:c[`${h}_tick_culling_max`],cullingLines:c[`${h}_tick_culling_lines`],cullingReverse:c[`${h}_tick_culling_reverse`],stepSize:!u&&c[`${h}_tick_stepSize`],timeValue:!u&&c[`${h}_tick_time_value`],fit:u&&c.axis_x_tick_fit,autorotate:u&&c.axis_x_tick_autorotate,centered:u&&c.axis_x_tick_centered,inverted:u&&c.axis_x_inverted,multiline:u&&c.axis_x_tick_multiline,width:u&&c.axis_x_tick_width}})}getMaxTickSize(t,n){var i;const a=this.owner,{config:s,state:o,$el:{svg:r,chart:l}}=a,{current:c,resizing:d}=o,u=c.maxTickSize[t],h=`${j.maxTickSize}_${t}_${!!n}`,f=a.cache.get(h);if(f&&f.generation===o.redrawGeneration)return u;const g=`axis_${t}`,p={width:0,height:0};let x;if(d||n||!s[`${g}_show`]||u.width>0&&a.filterTargetsToShow().length===0)return u;if((r||s.render_mode==="canvas")&&((i=a.scale[t])!=null&&i.copy)){const _=/^y2?$/.test(t),v=a.getTargetsToShow(),m=a.scale[t].copy().domain(a[`get${_?"Y":"X"}Domain`](v,t)),b=m.domain(),y=b[0]===b[1]&&b.every($=>$>0),T=ot(u.domain)&&u.domain[0]===u.domain[1]&&u.domain.every($=>$>0);if(y||T)return u;u.domain=b,_||Na(u.ticks);const w=this.getAxis(t,m,!1,!1,!0),C=s[`${g}_tick_rotate`],A=s[`${g}_tick_count`];if(!s[`${g}_tick_values`]&&A&&w.tickValues(this.generateTickValues(b,A,_?this.isTimeSeriesY():this.isTimeSeries())),!_&&this.updateXAxisTickValues(v,w),x=this.getMaxTickSizeFingerprint(t,m,b,w,C,n),(f==null?void 0:f.fingerprint)===x)return a.cache.add(h,Bp(Op({},f),{generation:o.redrawGeneration})),Zp(u,f.value);const k=w.tickValues(),L=!_&&Array.isArray(k)&&k.length>Li;L&&w.tickValues(Gp(k,w.tickFormat()));const R=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),E=R.append("g").attr("class",`${Rt[`axis${Ot(t)}`]} ${Y.dummy}`);w.create(E);const{sizeFor1Char:P}=E.node(),D=R.selectAll("text").attr("transform",X(C)?`rotate(${C})`:null),z=L?k.length:D.size();if(P)D.each(function($,G){const N=this.textContent.length*P.w,q=P.h;p.width=Math.max(p.width,N),p.height=Math.max(p.height,q),_||(u.ticks[G]=N)});else{const $=[];if(D.each(function(){$.push(this)}),($.length<=5?$:zp($)).map(N=>ht(N,!0)).forEach(N=>{p.width=Math.max(p.width,N.width),p.height=Math.max(p.height,N.height)}),!_)for(let N=0;N<$.length;N++)u.ticks[N]=p.width}!_&&L&&Vp(u.ticks,z,p.width),R.remove()}return Object.keys(p).forEach(_=>{p[_]>0&&(u[_]=p[_])}),a.cache.add(h,{fingerprint:x,generation:o.redrawGeneration,value:Kp(u)}),u}getXAxisTickTextY2Overflow(t){const n=this.owner,{axis:i,config:a,state:{current:s,isLegendRight:o,legendItemWidth:r}}=n,l=n.getAxisTickRotate("x"),c=l>0&&l<90;if((i.isCategorized()||i.isTimeSeries())&&a.axis_x_tick_fit&&(!a.axis_x_tick_culling||Qt(a.axis_x_tick_culling))&&!a.axis_x_tick_multiline&&c){const d=a.axis_y2_show&&s.maxTickSize.y2.width||0,u=o&&r||0,h=s.width-n.getCurrentPaddingByDirection("left"),f=this.getXAxisTickMaxOverflow(l,h-t)-d-u,g=Math.max(0,f)+t;return Math.min(g,h/2)}return 0}getXAxisTickMaxOverflow(t,n){var i;const a=this.owner,{axis:s,config:o,state:r}=a,l=s.isTimeSeries(),c=r.current.maxTickSize.x.ticks,d=c.length,u=(i=za(c))!=null?i:r.current.maxTickSize.x.width,{left:h,right:f}=r.axis.x.padding;let g=0;const p=d-(l&&o.axis_x_tick_fit?.5:0);for(let v=0;v<d;v++){const m=v+1,b=Math.cos(Math.PI*t/180)*jp(c,v,u),y=m-(l?1:.5)+h;if(y<=0)continue;const w=(n-b)/y,C=p-m,A=f*w,S=C*w+A,k=b-w/2-S;g=Math.max(g,k)}const x=a.getTargetsToShow();let _=0;if(!l&&o.axis_x_tick_count<=x.length&&x[0].values.length){const v=Ie(a.axis.getAxisType("x"),0,n-g).domain([h*-1,a.getXDomainMax(a.data.targets)+1+f]);_=(v(1)-v(0))/2}return g+_}updateLabels(t){const n=this.owner,{config:i,$el:{main:a},$T:s}=n,o=i.axis_rotated;["x","y","y2"].forEach(r=>{const l=this.getLabelText(r),c=`axis${Ot(r)}`,d=Rt[`${c}Label`];if(l){let u=a.select(`text.${d}`);u.empty()&&(u=a.select(`g.${Rt[c]}`).insert("text",":first-child").attr("class",d).attr("transform",["rotate(-90)",null][r==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(r))),s(u,t).attr("x",()=>this.xForAxisLabel(r)).attr("dx",()=>this.dxForAxisLabel(r)).attr("dy",()=>this.dyForAxisLabel(r)).text(l)}})}getPadding(t,n,i,a){const s=X(t)?t:t[n];return J(s)?this.owner.convertPixelToScale(/(bottom|top)/.test(n)?"y":"x",s,a):i}generateTickValues(t,n,i){let a=t;if(n){const s=O(n)?n():n;if(s===1)a=[t[0]];else if(s===2)a=[t[0],t[t.length-1]];else if(s>2){const o=this.isCategorized(),r=s-2,l=t[0],c=t[t.length-1],d=(c-l)/(r+1);let u;a=[l];for(let h=0;h<r;h++)u=+l+d*(h+1),a.push(i?new Date(u):o?Math.round(u):u);a.push(c)}}return i||(a=a.sort((s,o)=>s-o)),a}generateTransitions(t){const n=this.owner,{$el:{axis:i},$T:a}=n,[s,o,r,l]=["x","y","y2","subX"].map(c=>a(i[c],t));return{axisX:s,axisY:o,axisY2:r,axisSubX:l}}redraw(t,n,i){const a=this.owner,{config:s,state:o,$el:r}=a,l=n?"0":null;["x","y","y2","subX"].forEach(c=>{const d=this[c],u=r.axis[c];d&&u&&(!i&&!s.transition_duration&&(d.config.withoutTransition=!0),u.style("opacity",l),d.create(t[`axis${Ot(c)}`]))}),this.updateAxes(),!o.rendered&&s.axis_tooltip&&this.setAxisTooltip()}syncAxisDomains(t,n,i){var a,s,o;const r=this.owner,{config:l,scale:c,$el:d}=r,u=!!c.zoom;let h;!u&&this.isCategorized()&&t.length===0&&d.axis.x&&c.x.domain([0,d.axis.x.selectAll(".tick").size()]),c.x&&t.length?(!u&&r.updateXDomain(t,n.UpdateXDomain,n.UpdateOrgXDomain,n.TrimXDomain),l.axis_x_tick_values||this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),(a=this.subX)==null||a.tickValues([])),l.zoom_rescale&&!i&&(h=c.x.orgDomain()),["y","y2"].forEach(f=>{const g=`axis_${f}_`,p=c[f];if(p){const x=l[`${g}tick_values`],_=l[`${g}tick_count`];if(p.domain(r.getYDomain(t,f,h)),!x&&_){const v=r.axis[f],m=p.domain();v.tickValues(this.generateTickValues(m,m.every(b=>b===0)?1:_,this.isTimeSeriesY()))}}}),n.Y&&((s=c.subY)==null||s.domain(r.getYDomain(t,"y")),(o=c.subY2)==null||o.domain(r.getYDomain(t,"y2")))}redrawAxis(t,n,i,a,s){const o=this.owner;this.syncAxisDomains(t,n,a),this.redraw(i,o.hasArcType(),s),this.updateLabels(n.Transition),(n.UpdateXDomain||n.UpdateXAxis||n.Y)&&t.length&&this.setCulling()}setCulling(){const t=this.owner,{config:n,state:{clip:i,current:a},$el:s}=t;["subX","x","y","y2"].forEach(o=>{const r=s.axis[o],c=`axis_${o==="subX"?"x":o}_tick_culling`,d=n[c];if(r&&d){const u=r.selectAll(".tick"),h=on(u.data(),!n[`${c}_reverse`]),f=h.length,g=n[`${c}_max`],x=!n[`${c}_lines`]||Xp(this[o],h,Np(u));let _;if(f){for(let m=1;m<f;m++)if(f/m<g){_=m;break}_=_!=null?_:f;const v=new Map;for(let m=0;m<h.length;m++)v.set(h[m],m);u.each(function(m){var b;const y=x?this:this.querySelector("text");y&&(y.style.display=((b=v.get(m))!=null?b:0)%_?"none":null)})}else u.style("display",null);if(o==="x"){const v=a.maxTickSize.x.clipPath?i.pathXAxisTickTexts:null;s.svg.selectAll(`.${Rt.axisX} .tick text`).attr("clip-path",v)}}})}setAxisTooltip(){var t;const n=this.owner,{config:{axis_rotated:i,axis_tooltip:a},$el:{axis:s,axisTooltip:o}}=n,r=(t=a.backgroundColor)!=null?t:"black";n.generateTextBGColorFilter(r,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(l=>{var c,d,u;if(nt(r)||r[l])if(o[l]=(c=s[l])==null?void 0:c.append("text").classed(Rt[`axis${l.toUpperCase()}Tooltip`],!0).attr("filter",n.updateTextBGColor({id:l},r)),i){const h=l==="x"?"x":"y",f=l==="y"?"1.15em":l==="x"?"-0.3em":"-0.4em";(d=o[l])==null||d.attr(h,f).attr(`d${l==="x"?"y":"x"}`,l==="x"?"0.4em":"-1.3em").style("text-anchor",l==="x"?"end":null)}else{const h=l==="x"?"y":"x",f=l==="x"?"1.15em":`${l==="y"?"-":""}0.4em`;(u=o[l])==null||u.attr(h,f).attr(`d${l==="x"?"x":"y"}`,l==="x"?"-1em":"0.3em").style("text-anchor",l==="y"?"end":null)}})}}var il=Math.pow,Qp={initEventRect(){this.$el.main.select(`.${Y.chart}`).append("g").attr("class",Se.eventRects).style("fill-opacity","0")},redrawEventRect(){var e;const t=this,{config:n,state:i,$el:a}=t,s=t.isMultipleX(),o=n.axis_x_inverted;if(a.eventRect)t.updateEventRect(a.eventRect,!0);else if(t.data.targets.length){const l=t.$el.main.select(`.${Se.eventRects}`).style("cursor",n.zoom_enabled&&n.zoom_type!=="drag"?n.axis_rotated?"ns-resize":"ew-resize":null).classed(Se.eventRectsMultiple,s).classed(Se.eventRectsSingle,!s).selectAll(`.${Se.eventRect}`).data([0]).enter().append("rect");t.updateEventRect(l),t.updateEventType(l),l.call(t.getDraggableSelection()),a.eventRect=l,t.state.inputType==="touch"&&!a.svg.on("touchstart.eventRect")&&!t.hasArcType()&&t.bindTouchOnEventRect(),i.rendered&&t.updateEventRect(a.eventRect,!0)}if(!s){const r=t.getMaxDataCountTarget();(!n.data_xSort||o)&&r.sort((l,c)=>o?c.x-l.x:l.x-c.x),t.updateDataIndexByX(r),t.updateXs(r),(e=t.updatePointClass)==null||e.call(t,!0),i.eventReceiver.data=r}t.updateEventRectData()},bindTouchOnEventRect(){const e=this,{config:t,state:n,$el:{eventRect:i,svg:a}}=e,s=f=>{if(e.isMultipleX())e.selectRectForMultipleXs(f);else{const g=e.getDataIndexFromEvent(n.event);e.callOverOutForTouch(g),g===-1?e.unselectRect():e.selectRectForSingle(f,g)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=He(r)&&r||!1,c=!isNaN(r)&&r||null;let d;const u=!l&&c===null,h=f=>{const g=f.type,x=f.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];g==="touchstart"?l?f.preventDefault():c!==null&&(d=x):g==="touchmove"&&(l||d===!0||c!==null&&Math.abs(d-x)>=c)&&(d=!0,f.preventDefault())};i.on("touchstart",f=>{n.event=f,e.updateEventRect()},{passive:u}).on("touchstart.eventRect touchmove.eventRect",f=>{if(n.event=f,!i.empty()&&i.classed(Se.eventRect)){if(n.dragging||n.flowing||e.hasArcType()||f.touches.length>1)return;h(f),s(i.node())}else o()},{passive:u}).on("touchend.eventRect",f=>{n.event=f,!i.empty()&&i.classed(Se.eventRect)&&(e.hasArcType()||!e.toggleShape||n.cancelClick)&&n.cancelClick&&(n.cancelClick=!1)},{passive:u}),a.on("touchstart",f=>{n.event=f;const{target:g}=f;g&&g!==i.node()&&o()},{passive:u})},updateEventRect(e,t=!1){const n=this,{state:i,$el:a}=n,{eventReceiver:s,width:o,height:r,rendered:l,resizing:c}=i,d=e||a.eventRect,u=()=>{if(s){const h=Ro(a.chart.node());s.rect=ht(d.node(),!0).toJSON(),s.rect.top+=h.y,s.rect.left+=h.x}};(!l||c||t)&&(d.attr("x",0).attr("y",0).attr("width",o).attr("height",r),(!l||t)&&d.classed(Se.eventRect,!0)),u()},updateEventType(e){const t=this,n=He(e),i=n?t.$el.eventRect:e,a=n?e!==(i==null?void 0:i.datum().multipleX):!1;i&&(a&&(i==null||i.on("mouseover mousemove mouseout click",null)),t.isMultipleX()?t.generateEventRectsForMultipleXs(i):t.generateEventRectsForSingleX(i))},updateEventRectData(){const e=this,{config:t,scale:n,state:i}=e,a=n.zoom||n.x,s=t.axis_rotated,o=e.isMultipleX(),r=a==null?void 0:a.domain(),l=r?`${r[0]}_${r[1]}_${i.width}_${i.height}_${e.data.targets.length}_${i.dataGeneration}_${[...i.hiddenTargetIds].join(",")}`:null;if(l&&l===i._eventRectFingerprint)return;i._eventRectFingerprint=l;let c,d,u,h;if(e.updateEventType(o),o)c=0,d=0,u=i.width,h=i.height;else{let p,x;if(e.axis.isCategorized())p=e.getEventRectWidth(),x=_=>a(_.x)-p/2;else{const _=({index:v})=>({prev:e.getPrevX(v),next:e.getNextX(v)});p=v=>{const m=_(v),b=a.domain();let y;return m.prev===null&&m.next===null?y=s?i.height:i.width:m.prev===null?y=(a(m.next)+a(v.x))/2:m.next===null?y=a(b[1])-(a(m.prev)+a(v.x))/2:y=Math.max(0,(a(m.next)-a(m.prev))/2),y},x=v=>{const m=_(v);let b;return m.prev===null&&m.next===null?b=0:m.prev===null?b=a(a.domain()[0]):b=(a(v.x)+a(m.prev))/2,b}}c=s?0:x,d=s?x:0,u=s?i.width:p,h=s?p:i.height}const{eventReceiver:f}=i,g=(p,x)=>O(p)?p(x):p;f.coords.splice(f.data.length),f.data.forEach((p,x)=>{f.coords[x]={x:g(c,p),y:g(d,p),w:g(u,p),h:g(h,p)}})},selectRectForSingle(e,t){var n,i,a,s;const o=this,{config:r,state:l,$el:{main:c,circle:d}}=o,u=r.data_selection_enabled,h=r.data_selection_grouped,f=r.data_selection_isselectable,g=r.tooltip_grouped,p=o.getAllValuesOnIndex(t);if(g&&(o.showTooltip(p,e),(n=o.showGridFocus)==null||n.call(o,p),!u||h))return;!d&&c.selectAll(`.${Y.EXPANDED}:not(.${Ct.shape}-${t})`).classed(Y.EXPANDED,!1);const x=c.selectAll(`.${Ct.shape}-${t}`).classed(Y.EXPANDED,!0).style("cursor",f?"pointer":null).filter(function(_){return o.isWithinShape(this,_)});if(x.call(_=>{var v,m;const b=_.data();u&&(h||f!=null&&f.bind(o.api)(b))&&(e.style.cursor="pointer"),g||(o.showTooltip(b,e),(v=o.showGridFocus)==null||v.call(o,b),(m=o.unexpandCircles)==null||m.call(o),_.each(y=>o.setExpand(t,y.id)))}),!g&&x.empty()){const _=Jt(l.event,e),v=p.filter(m=>o.isTargetToShow(m.id)?o.dist(m,_)<o.getPointSensitivity(m):!1);if(v.length>0){let m=v[0],b=o.dist(m,_);for(let y=1;y<v.length;y++){const T=v[y],w=o.dist(T,_);w<b&&(b=w,m=T)}o.showTooltip([m],e),(i=o.showGridFocus)==null||i.call(o,[m]),(a=o.unexpandCircles)==null||a.call(o),o.setExpand(t,m.id,!0),u&&(h||f!=null&&f.bind(o.api)(m))&&(e.style.cursor="pointer")}else r.interaction_onout&&((s=o.hideGridFocus)==null||s.call(o),o.hideTooltip(),!h&&o.setExpand(t))}},selectRectForMultipleXs(e,t=!0){var n;const i=this,{config:a,state:s}=i,o=i.getTargetsToShow();if(s.dragging||i.hasArcType(o))return;const r=Jt(s.event,e),l=i.findClosestFromTargets(o,r);if(t&&s.mouseover&&(!l||l.id!==s.mouseover.id)&&(a.data_onout.call(i.api,s.mouseover),s.mouseover=void 0),!l){i.unselectRect();return}const d=(i.isBubbleType(l)||i.isScatterType(l)||!a.tooltip_grouped?[l]:i.filterByX(o,l.x)).map(h=>i.addName(h));i.showTooltip(d,e),i.setExpand(l.index,l.id,!0),(n=i.showGridFocus)==null||n.call(i,d);const u=i.dist(l,r);(i.isBarType(l.id)||u<i.getPointSensitivity(l))&&(i.$el.eventRect.style("cursor","pointer"),t&&(!s.mouseover||s.mouseover.x!==l.x||s.mouseover.id!==l.id)&&(a.data_onover.call(i.api,l),s.mouseover=l))},unselectRect(){var e,t,n;const i=this,{state:a,$el:{circle:s,tooltip:o}}=i;if(a._lastTooltipMouse=null,a.isCanvasMode){(e=i.clearCanvasFocus)==null||e.call(i),o&&i.hideTooltip();return}(t=i.$el.eventRect)==null||t.style("cursor",null),(n=i.hideGridFocus)==null||n.call(i),o&&(i.hideTooltip(),i._handleLinkedCharts(!1)),s&&!i.isPointFocusOnly()&&i.unexpandCircles(),i.expandBarTypeShapes(!1)},generateEventRectsForSingleX(e){const t=this,{config:n,state:i}=t,{eventReceiver:a}=i,s=e.style("cursor",n.data_selection_enabled&&n.data_selection_grouped?"pointer":null).on("click",function(o){i.event=o;const{currentIdx:r,data:l}=a,c=l[r===-1?t.getDataIndexFromEvent(o):r];t.clickHandlerForSingleX.bind(this)(c,t)}).datum({multipleX:!1});if(i.inputType==="mouse"){const o=r=>{const l=r?t.getDataIndexFromEvent(r):a.currentIdx;return l>-1?a.data[l]:null};s.on("mouseover",r=>{i.event=r,t.updateEventRect(),Object.values(t.$el.axisTooltip).forEach(l=>l==null?void 0:l.style("display",null))}).on("mousemove",function(r){const l=o(r);if(i.event=r,!l)return;let{index:c}=l;const d=n.line_step_type;if(n.line_step_tooltipMatch&&t.hasType("step")&&/^step\-(before|after)$/.test(d)){const h=t.scale.zoom||t.scale.x,f=t.axis.xs[c],g=h.invert(Jt(r,this)[0]);d==="step-after"&&g<f?c-=1:d==="step-before"&&g>f&&(c+=1)}t.showAxisGridFocus();const u=n.tooltip_grouped&&c===a.currentIdx;if(i.dragging||i.flowing||t.hasArcType()||u){if(n.tooltip_show&&u){const[h,f]=Jt(r,this),g=i._lastTooltipMouse;(!g||il(h-g[0],2)+il(f-g[1],2)>=9)&&(i._lastTooltipMouse=[h,f],t.setTooltipPosition())}return}c!==a.currentIdx&&(t.setOverOut(!1,a.currentIdx),a.currentIdx=c),c===-1?t.unselectRect():t.selectRectForSingle(this,c),t.setOverOut(c!==-1,c)}).on("mouseout",r=>{i.event=r,!(!t.config||t.hasArcType()||a.currentIdx===-1||!n.interaction_onout)&&(t.hideAxisGridFocus(),t.unselectRect(),t.setOverOut(!1,a.currentIdx),a.currentIdx=-1)})}return s},clickHandlerForSingleX(e,t){const n=t,{config:i,state:a,$el:{main:s}}=n;if(!e||n.hasArcType()||a.cancelClick){a.cancelClick&&(a.cancelClick=!1);return}const{index:o}=e;s.selectAll(`.${Ct.shape}-${o}`).each(function(r){var l;(i.data_selection_grouped||n.isWithinShape(this,r))&&((l=n.toggleShape)==null||l.call(n,this,r,o),i.data_onclick.bind(n.api)(r,this))})},generateEventRectsForMultipleXs(e){const t=this,{config:n,state:i}=t;e.on("click",function(a){i.event=a,t.clickHandlerForMultipleXS.bind(this)(t)}).datum({multipleX:!0}),i.inputType==="mouse"&&e.on("mouseover mousemove",function(a){i.event=a,t.selectRectForMultipleXs(this)}).on("mouseout",a=>{i.event=a,!(!t.config||t.hasArcType()||!n.interaction_onout)&&t.unselectRect()})},clickHandlerForMultipleXS(e){const t=e,{config:n,state:i}=t,a=t.getTargetsToShow();if(t.hasArcType(a))return;const s=Jt(i.event,this),o=t.findClosestFromTargets(a,s);if(!o)return;const r=t.getPointSensitivity(o);(t.isBarType(o.id)||t.dist(o,s)<r)&&t.$el.main.selectAll(`.${Ct.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${Ct.shape}-${o.index}`).each(function(){var l;(n.data_selection_grouped||t.isWithinShape(this,o))&&((l=t.toggleShape)==null||l.call(t,this,o,o.index),n.data_onclick.bind(t.api)(o,this))})}},tx={initClip(){const e=this,{clip:t,datetimeId:n}=e.state;t.id=`${n}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:n}=t;return!n.clipPath&&/-clip$/.test(e)||!n.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!n.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+s+10:i.bottom)+20,c=o?-(1+r):-(r-1),d=-15,u=o?i.left+20:a+10+r;e.attr("x",c).attr("y",d).attr("width",u).attr("height",l)},setYAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=n.axis_y_inner,c=l&&!o?n.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),d=-(o?20:i.top),u=(o?a+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+s)+10;e.attr("x",c).attr("y",d).attr("width",u).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:n,xAxisHeight:i},$el:{defs:a}}=e,s=e.getHorizontalAxisHeight("x");if(a&&!n.idXAxisTickTexts){const o=`${n.id}-xaxisticktexts`;e.appendClip(a,o),n.idXAxisTickTexts=o,n.pathXAxisTickTexts=e.getClipPath(n.idXAxisTickTexts)}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&s!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=s},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:n}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const a=Math.sin(Math.PI/180*Math.abs(i));n.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/a}else n.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:n},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",n.maxTickSize.x.clipPath).attr("height",30)}},ex={getAxisSize(e){const t=this,n=t.config.axis_rotated;return n&&e==="x"||!n&&/y2?/.test(e)?t.getAxisWidthByAxisId(e,!0):t.getHorizontalAxisHeight(e)},getAxisWidthByAxisId(e,t){var n,i;const a=this;if(a.axis){const s=(n=a.axis)==null?void 0:n.getAxisLabelPosition(e),{width:o}=a.axis.getMaxTickSize(e,t),r=o===0?.5:0;return o+(((i=a.config.padding)==null?void 0:i.mode)==="fit"?s.isInner?10+r:10:s.isInner?20+r:40)}else return 40},getHorizontalAxisHeight(e){var t,n;const i=this,{config:a,state:s}=i,{rotatedPadding:o,isLegendRight:r,isLegendInset:l}=s,c=a.axis_rotated,d=((t=a.padding)==null?void 0:t.mode)==="fit",u=a[`axis_${e}_inner`],h=a[`axis_${e}_label`].text,f=13;let g=((n=a.padding)==null?void 0:n.mode)==="fit"?u&&!h?e==="y"?1:0:20:30;if(e==="x"&&!a.axis_x_show)return 8;if(e==="x"&&X(a.axis_x_height))return a.axis_x_height;if(e==="y"&&!a.axis_y_show)return a.legend_show&&!r&&!l?10:1;if(e==="y2"&&!a.axis_y2_show)return d?0:o.top;const p=i.axis.getMaxTickSize(e),x=Math.abs(a.axis_x_tick_rotate)>0&&(!a.axis_x_tick_autorotate||i.needToRotateXAxisTickTexts());return(a.axis_x_tick_multiline||x)&&p.height>f&&(g+=p.height-f),g+(i.axis.getAxisLabelPosition(e).isInner?0:10)+(e==="y2"&&!c?-10:0)},getEventRectWidth(){const e=this,{config:t,axis:n}=e,i=t.axis_x_inverted,a=n.x.tickInterval();return Math.max(0,i?Math.abs(a):a)},getAxisTickRotate(e){const t=this,{axis:n,config:i,state:a,$el:s}=t;let o=i[`axis_${e}_tick_rotate`];if(e==="x"){const r=n.isCategorized()||n.isTimeSeries();if(i.axis_x_tick_fit&&r){const l=i.axis_x_tick_count,c=a.current.maxTickSize.x.ticks.length;let d=0;if(l?d=l>c?c:l:c&&(d=c),d!==a.axis.x.tickCount){const{targets:u}=t.data;a.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(u,"min"),t.getXDomainMinMax(u,"max")],d)}a.axis.x.tickCount=d}(s.svg||a.isCanvasMode)&&i.axis_x_tick_autorotate&&i.axis_x_tick_fit&&!i.axis_x_tick_multiline&&!i.axis_x_tick_culling&&r&&(o=t.needToRotateXAxisTickTexts()?i.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const e=this,{state:{axis:t,current:n,isLegendRight:i,legendItemWidth:a}}=e,s=i&&a,o=n.width-s-e.getCurrentPaddingByDirection("left")-e.getCurrentPaddingByDirection("right"),r=t.x.tickCount+t.x.padding.left+t.x.padding.right,{width:l}=e.axis.getMaxTickSize("x"),c=r?o/r:0;return l>c}},nx={axis_x_clipPath:!0,axis_x_show:!0,axis_x_forceAsSingle:!1,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_culling_lines:!0,axis_x_tick_culling_reverse:!1,axis_x_tick_count:void 0,axis_x_tick_inner:!1,axis_x_tick_show:!0,axis_x_tick_text_show:!0,axis_x_tick_text_inner:!1,axis_x_tick_text_position:{x:0,y:0},axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_autorotate:!1,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_tick_tooltip:!1,axis_x_max:void 0,axis_x_min:void 0,axis_x_inverted:!1,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_x_axes:[]},ix={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_culling_reverse:!1,axis_y_tick_inner:!1,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},ax={axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_culling_reverse:!1,axis_y2_tick_inner:!1,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]},sx=Object.defineProperty,al=Object.getOwnPropertySymbols,ox=Object.prototype.hasOwnProperty,rx=Object.prototype.propertyIsEnumerable,sl=(e,t,n)=>t in e?sx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wa=(e,t)=>{for(var n in t||(t={}))ox.call(t,n)&&sl(e,n,t[n]);if(al)for(var n of al(t))rx.call(t,n)&&sl(e,n,t[n]);return e},lx=Wa(Wa(Wa({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},nx),ix),ax),cx={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const dx=[wp,Cp,Sp],ol={axis:qp,clip:tx,eventrect:Qp,sizeAxis:ex},rl={optDataAxis:cx,optAxis:lx};function ll(e){return Object.keys(e).map(t=>e[t])}function cl(e=[],t=[]){Tt(de.prototype,ll(ol).concat(e)),Tt(Wt.prototype,dx),Qe.setOptions(ll(rl).concat(t))}function Yn(e=[],t=[]){cl(e,t)}function Le(e,t=[]){const n=Array.isArray(e)?e:e?[e]:[];cl([vn,Ai,yp].concat(n),[en,Tp].concat(t))}let dl=()=>(Le(_n,[mn]),(dl=()=>I.AREA)()),ul=()=>(Le(_n,[mn]),(ul=()=>I.AREA_LINE_RANGE)()),hl=()=>(Le(_n,[mn]),(hl=()=>I.AREA_STEP_RANGE)()),fl=()=>(Le(_n,[mn,Fa]),(fl=()=>I.AREA_SPLINE)()),gl=()=>(Le(_n,[mn,Fa]),(gl=()=>I.AREA_SPLINE_RANGE)()),pl=()=>(Le(_n,[mn]),(pl=()=>I.AREA_STEP)());function Va(e){const t=this.config.bar_connectLine,n=(t==null?void 0:t[e])||t;return/^(start|end)\-(start|end)$/.test(n)?n:null}var ux={initBar(){const{$el:e,config:t,state:{clip:n}}=this;e.bar=e.main.select(`.${Y.chart}`),e.bar=t.bar_front?e.bar.append("g"):e.bar.insert("g",":first-child"),e.bar.attr("class",Zt.chartBars).call(this.setCssRule(!1,`.${Zt.chartBars}`,["pointer-events:none"])),t.clipPath===!1&&(t.bar_radius||t.bar_radius_ratio)&&e.bar.attr("clip-path",n.pathXAxis.replace(/#[^)]*/,`#${n.id}`))},updateTargetsForBar(e){const t=this,{config:n}=t,i=t.getClass("bars",!0),a=n.interaction_enabled&&n.data_selection_isselectable;La.call(t,e,{type:"Bar",elKey:"bar",containerClass:Zt.chartBars,itemClass:Zt.chartBar,initFn:t.initBar}).append("g").attr("class",i).style("cursor",o=>{var r;return(r=a==null?void 0:a.bind)!=null&&r.call(a,t.api)(o)?"pointer":null}).call(o=>{t.setCssRule(!0,` .${Zt.bar}`,["fill"],t.color)(o),o.each(function(r){Va.call(t,r.id)&&(0,F.select)(this).append("path").attr("class",Zt.barConnectLine)})})},updateBar(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,$el:a,$T:s}=n,o=t?a.subchart:a,r=n.getClass("bar",!0),l=n.initialOpacity.bind(n);i.bar_linearGradient&&n.updateLinearGradient();const c=o.main.selectAll(`.${Zt.bars}`).selectAll(`.${Zt.bar}`).data(n.labelishData.bind(n));s(c.exit(),e).style("opacity","0").remove(),o.bar=c.enter().append("path").attr("class",r).style("fill",n.generateUpdateBarColor()).merge(c).style("opacity",l),n.setRatioForGroupedData(o.bar.data())},generateUpdateBarColor(){const e=this,t=e.getStylePropValue(e.color)||(()=>null);return n=>tr.call(e,n,"bar_linearGradient",t)},updateBarColor(e){return this.generateUpdateBarColor()(e)},redrawBar(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{bar:a}=n?i.$el.subchart:i.$el,s=[],o=new Map;return[i.$T(a,t,he()).attr("d",function(r,l,c){const d=(X(r.value)||i.isBarRangeType(r))&&e(r,l);let u=o.get(r.id);if(u===void 0&&(u=Va.call(i,r.id),o.set(r.id,u)),d.length>1&&s.push(d[1]),l===c.length-1&&s.length){const h=i.$T((0,F.select)(this.parentNode.querySelector(`.${Zt.barConnectLine}`)),t,he());i.updateConnectLine(h,u,s),s.splice(0)}return d[0]}).style("fill",i.generateUpdateBarColor()).style("clip-path",r=>r.clipPath).style("opacity",null)]},generateDrawBar(e,t){const n=this,{config:i}=n,a=n.generateGetBarPoints(e,t),s=ea(n),o=s?na(n):new Set,r=new Map;return(l,c)=>{const d=a(l,c),{indexX:u,indexY:h,isNegative:f,pos:g,radius:p,clipPath:x}=ia(n,l,d,s,o,n.isStackingRadiusData.bind(n)),_=["",""];if(l.clipPath=x,s){const y=`a${p} ${p} ${f?"1 0 0":"0 0 1"} `;_[h]=`${y}${p},${p}`,_[u]=`${y}${[-p,p][i.axis_rotated?"sort":"reverse"]()}`,f&&_.reverse()}const v=i.axis_rotated?`H${g} ${_[0]}V${d[2][h]-p} ${_[1]}H${d[3][u]}`:`V${g} ${_[0]}H${d[2][u]-p} ${_[1]}V${d[3][h]}`,m=[`M${d[0][u]},${d[0][h]}${v}z`];let b=r.get(l.id);return b===void 0&&(b=Va.call(n,l.id),r.set(l.id,b)),b&&m.push(i.axis_rotated?{x:d[0][u],y:d[0][h],width:d[0][u]-g,height:d[2][h]-d[0][h]}:{x:d[0][u],y:g,width:d[2][u]-d[0][u],height:d[3][h]-g}),m}},isStackingRadiusData(e){const t=this,{$el:n,config:i,data:a,state:s}=t,{id:o,index:r,value:l}=e;if(s.hiddenTargetIds.has(o)){const h=n.bar.filter(f=>f.id===o&&f.value===l);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const c=i.data_groups.find(h=>h.indexOf(o)>-1),u=t.orderTargets(t.filterTargetsToShow(a.targets.filter(t.isBarType,t))).filter(h=>c.indexOf(h.id)>-1).map(h=>{const f=h.values[r];if(f&&(X(l)&&l>0?f.value>0:f.value<0))return f}).filter(Boolean).map(h=>h.id);return l!==0&&u.indexOf(o)===u.length-1},updateConnectLine(e,t,n){const i=n.map((a,s,o)=>{const r=this.config.axis_rotated,l=/^start-(start|end)$/.test(t),c=/^end-(start|end)$/.test(t),d=[],u=r?c?a.x-a.width:a.x:a.x+a.width,h=r||l?a.y+a.height:a.y;return s===0?d.push(`${u},${h}`):(d.push(r?`L${a.x-(/\w+-end$/.test(t)?a.width:0)},${a.y}`:`L${a.x},${a.y+(/\w+-start$/.test(t)?a.height:0)}`),s<o.length-1&&d.push(`M${u},${h}`)),d.join(" ")});e.attr("d",`M${i.join("")}z`)}},hx={bar_connectLine:!1,bar_front:!1,bar_indices_removeNull:!1,bar_label_threshold:0,bar_linearGradient:!1,bar_overlap:!1,bar_padding:0,bar_radius:void 0,bar_radius_ratio:void 0,bar_sensitivity:2,bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0};let xl=()=>(Yn([ux,vn],[hx,en]),(xl=()=>I.BAR)());var fx={initBubble(){const e=this,{config:t}=e;e.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength(){const e=this,{width:t,height:n}=e.state,i=j.bubbleBaseLength;let a=e.cache.get(i);return a||e.cache.add(i,a=oe("min",[t,n])),a},getBubbleR(e){const t=this;let n=t.config.bubble_maxR;O(n)?n=n.bind(t.api)(e):X(n)||(n=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const i=j.bubbleMaxValue;let a=t.cache.get(i);a===null&&t.cache.add(i,a=oe("max",t.getMinMaxData().max.map(r=>t.isBubbleZType(r)?t.getBubbleZData(r.value,"y"):Q(r.value)?r.value.mid:r.value)));const s=n*n*Math.PI,o=(t.isBubbleZType(e)?t.getBubbleZData(e.value,"z"):e.value)*(s/a);return Math.sqrt(o/Math.PI)},getBubbleZData(e,t){return Q(e)?e[t]:e[t==="y"?0:1]}},gx=fx,px={bubble_maxR:35,bubble_zerobased:!1};let _l=()=>(Yn([vn,Ai,gx],[px,en]),(_l=()=>I.BUBBLE)());var xx=Object.defineProperty,ml=Object.getOwnPropertySymbols,_x=Object.prototype.hasOwnProperty,mx=Object.prototype.propertyIsEnumerable,vl=(e,t,n)=>t in e?xx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vx=(e,t)=>{for(var n in t||(t={}))_x.call(t,n)&&vl(e,n,t[n]);if(ml)for(var n of ml(t))mx.call(t,n)&&vl(e,n,t[n]);return e},bx={generateGetCandlestickPoints(e,t=!1){const n=this,i=t?n.axis.subX:n.axis.x,a=n.getIndicesMax(e)+1,s=n.getBarW("candlestick",i,a),o=n.getShapeX(s,e,!!t),r=n.getShapeY(!!t),l=n.getShapeOffset(n.isCandlestickType,e,!!t),c=n.getYScaleById.bind(n);return(d,u)=>{const h=c.call(n,d.id,t)(n.getShapeYMin(d.id)),f=l(d,u)||h,g=X(s)?s:s[d.id]||s._$width,p=n.getCandlestickData(d);let x;if(p&&X(p.open)&&X(p.close)){const _={start:o(d),end:0};_.end=_.start+g;const v={start:r(p.open),end:r(p.close)},m={x:_.start+g/2,high:r(p.high),low:r(p.low)},b=h-f;v.start-=b,v.end-=b,m.high-=b,m.low-=b,x=[[_.start,v.start],[_.end,v.end],[m.x,m.low,m.high]]}else x=[[0,0],[0,0],[0,0,0]];return x}},getCandlestickData({value:e}){let t;if(ot(e)){const[n,i,a,s,o=!1]=e;t={open:n,high:i,low:a,close:s},o!==!1&&(t.volume=o)}else Q(e)&&(t=vx({},e));return t&&(t._isUp=t.close>=t.open),t||null}},yx=Object.defineProperty,Tx=Object.defineProperties,wx=Object.getOwnPropertyDescriptors,bl=Object.getOwnPropertySymbols,Cx=Object.prototype.hasOwnProperty,Sx=Object.prototype.propertyIsEnumerable,yl=(e,t,n)=>t in e?yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ax=(e,t)=>{for(var n in t||(t={}))Cx.call(t,n)&&yl(e,n,t[n]);if(bl)for(var n of bl(t))Sx.call(t,n)&&yl(e,n,t[n]);return e},kx=(e,t)=>Tx(e,wx(t)),Lx=kx(Ax({},bx),{initCandlestick(){er.call(this,{elKey:"candlestick",className:Ce.chartCandlesticks})},updateTargetsForCandlestick(e){La.call(this,e,{type:"Candlestick",elKey:"candlestick",containerClass:Ce.chartCandlesticks,itemClass:Ce.chartCandlestick,initFn:this.initCandlestick,withFocus:!1,withStyles:!1}).style("pointer-events","none")},updateCandlestick(e,t=!1){const n=this,{$el:i,$T:a}=n,s=t?i.subchart:i,o=n.getClass("candlestick",!0),r=n.initialOpacity.bind(n),l=s.main.selectAll(`.${Ce.chartCandlestick}`).selectAll(`.${Ce.candlestick}`).data(n.labelishData.bind(n));a(l.exit(),e).style("opacity","0").remove();const c=l.enter().filter(d=>d.value).append("g").attr("class",o);c.append("line"),c.append("path"),s.candlestick=l.merge(c).style("opacity",r)},generateDrawCandlestick(e,t){const n=this,{config:i}=n,a=n.generateGetCandlestickPoints(e,t),s=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const d=a(r,l),u=n.getCandlestickData(r),h=u==null?void 0:u._isUp,f=+s,g=+!f;c.classed&&c.classed(Ce[h?"valueUp":"valueDown"],!0);const p=s?`H${d[1][1]} V${d[1][0]} H${d[0][1]}`:`V${d[1][1]} H${d[1][0]} V${d[0][1]}`;c.select("path").attr("d",`M${d[0][f]},${d[0][g]}${p}z`).style("fill",v=>(h?n.color(v):Q(o)?o[v.id]:o)||n.color(v));const x=c.select("line"),_=s?{x1:d[2][1],x2:d[2][2],y1:d[2][0],y2:d[2][0]}:{x1:d[2][0],x2:d[2][0],y1:d[2][1],y2:d[2][2]};for(const v in _)x.attr(v,_[v])}},redrawCandlestick(e,t,n=!1){const i=this,{$el:a,$T:s}=i,{candlestick:o}=n?a.subchart:a,r=he(!0);return[o.each(function(l,c){const d=s((0,F.select)(this),t,r);e(l,c,d)}).style("opacity",null)]}}),Rx={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"};let Tl=()=>(Yn([Lx,vn],[Rx,en]),(Tl=()=>I.CANDLESTICK)());var Ei={arc_cornerRadius:0,arc_cornerRadius_ratio:0,arc_needle_show:!1,arc_needle_color:void 0,arc_needle_value:void 0,arc_needle_path:void 0,arc_needle_length:100,arc_needle_top_rx:0,arc_needle_top_ry:0,arc_needle_top_width:0,arc_needle_bottom_rx:1,arc_needle_bottom_ry:1,arc_needle_bottom_width:15,arc_needle_bottom_len:0,arc_rangeText_values:void 0,arc_rangeText_unit:"absolute",arc_rangeText_fixed:!1,arc_rangeText_format:void 0,arc_rangeText_position:void 0},Ex={donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_label_line:!1,donut_label_image:void 0,donut_label_ratio:void 0,donut_width:void 0,donut_title:"",donut_expand:{},donut_expand_rate:.98,donut_expand_duration:50,donut_padAngle:0,donut_startingAngle:0},wl=pt(11);const Px=15,Cl=20,Sl=.35;function Dx(e=!1){const t=this;return["donut","pie","polar","gauge"].find(n=>t.hasType(n)&&!(n==="gauge"&&e&&t.hasMultiArcGauge()))}function Al(){const e=this,{config:t}=e,n=Dx.call(e,!0),i=n&&t[`${n}_label_line`],a=Yt(i),s=(l,c,d)=>d,o={show:i===!0||a&&(i==null?void 0:i.show)!==!1,distance:a&&(i==null?void 0:i.distance)||Cl};if(i===!0)return{chartType:n,line:o,text:{formatter:s}};if(!a)return{chartType:n,line:{show:!1,distance:Cl},text:{formatter:null}};let r=s;return O(i.text)?r=i.text:i.text===!1&&(r=null),{chartType:n,line:o,text:{formatter:r}}}function Ix(e,t){const n=this,{state:i}=n,a=n.updateAngle(e);if(!a)return null;let{outerRadius:s}=n.getRadius(e),o=s;n.hasType("polar")&&(o=n.getPolarOuterRadius(e,s),s=i.radius);let r=(a.startAngle+a.endAngle)/2;Math.abs(a.endAngle-a.startAngle-2*Math.PI)<.01&&(r=Math.PI/2);const c=Math.sin(r),d=-Math.cos(r),u={x:c*o,y:d*o},h=s+Px,f={x:c*h,y:d*h},g=c>=0,p={x:f.x+t*(g?1:-1),y:f.y};return{startPoint:u,breakPoint:f,endPoint:p,isRight:g,midAngle:r}}function kl(){return Al.call(this).line.show}function Mx(e){const t=this,{$el:{arcs:n},$T:i}=t,{line:a,text:s}=Al.call(t),o=a.distance;let r=null;n.selectAll(`.${et.chartArc}`).each(function(l){var c,d,u;const h=(0,F.select)(this),f=Ix.call(t,l,o),{ratio:g,meetsThreshold:p,updated:x}=(c=l._cache)!=null?c:{};if(!x||!f)return;const _=t.isTargetToShow(l.data.id)&&p,{startPoint:v,breakPoint:m,endPoint:b,isRight:y}=f,T=`${v.x},${v.y} ${m.x},${m.y} ${b.x},${b.y}`;if(a.show){let C=h.select(`.${et.arcLabelLine}`);C.empty()&&(C=h.append("polyline").attr("class",et.arcLabelLine)),i(C,e).attr("points",T).style("stroke",t.color(l.data)).style("opacity",_?null:"0")}let w=h.select(`.${et.arcLabelLineText}`);if(w.empty()&&(w=h.append("text").attr("class",et.arcLabelLineText).style("pointer-events","none")),_){const{value:C}=x,{id:A}=l.data,S=((u=(d=s.formatter)!=null?d:t.getArcLabelConfig("format"))!=null?u:t.defaultArcValueFormat)(C,g,A).toString();pn(w,S,[-1,1],!1);const k={x:b.x+5*(y?1:-1),y:b.y};w.style("text-anchor",y?"start":"end");const L=w.node(),R=L==null?void 0:L.querySelectorAll("tspan");if(r===null&&(r=parseFloat(B.getComputedStyle(L).fontSize)||12),R&&R.length>1){const P=(R.length-3)/2;k.y+=(-P+Sl)*r}else k.y+=Sl*r;i(w,e).attr("transform",`translate(${k.x},${k.y})`).style("opacity",null).style("fill",t.updateTextColor.bind(t)(l))}else i(w,e).style("opacity","0")})}var $x=Object.defineProperty,Fx=Object.defineProperties,Ox=Object.getOwnPropertyDescriptors,Ll=Object.getOwnPropertySymbols,Bx=Object.prototype.hasOwnProperty,zx=Object.prototype.propertyIsEnumerable,Rl=(e,t,n)=>t in e?$x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nx=(e,t)=>{for(var n in t||(t={}))Bx.call(t,n)&&Rl(e,n,t[n]);if(Ll)for(var n of Ll(t))zx.call(t,n)&&Rl(e,n,t[n]);return e},Xx=(e,t)=>Fx(e,Ox(t));const Ha=["donut","gauge","pie","polar"];function Gx(e){return["donut","pie","polar","gauge"].find(t=>e.hasType(t))}function Wx(e,t,n,i){var a,s;const{config:o,state:{radiusExpanded:r}}=e,l=n.endAngle-Math.PI/2,c=Math.sin(l),d={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const u=o.arc_rangeText_position;if(u){const h=o.arc_rangeText_values,f=O(u)?u(h[t.index]):u;d.x+=(a=f==null?void 0:f.x)!=null?a:0,d.y+=(s=f==null?void 0:f.y)!=null?s:0}}return d}function Vx(e,t,n,i){const{config:a}=e,s=Gx(e);let o=s?a[`${s}_label_ratio`]:void 0;if(o)o=O(o)?o.bind(e.api)(t,n,i):o;else{const u=36/n,h=u>.375;o=n&&i?(h?1.175-u:.8)*n/i:0}return o}function Hx(e,t,n){let{outerRadius:i}=e.getRadius(t);e.hasType("polar")&&(i=e.getPolarOuterRadius(t,i));const[a,s]=e.svgArc.centroid(n).map(l=>isNaN(l)?0:l),o=Math.sqrt(a*a+s*s),r=Vx(e,t,i,o);return{pos:{x:a,y:s},ratio:r}}function El(e=0){const t=this,{config:n,state:i}=t,a=t.hasMultiArcGauge(),s=i.gaugeArcWidth/t.getTargetsToShow().length,o=e?Math.min(i.radiusExpanded*e-i.radius,s*.8-(1-e)*100):0;return{inner(r){const{innerRadius:l}=t.getRadius(r);return a?i.radius-s*(r.index+1):X(l)?l:0},outer(r){const{outerRadius:l}=t.getRadius(r);let c;if(a)c=i.radius-s*r.index+o;else if(t.hasType("polar")&&!e)c=t.getPolarOuterRadius(r,l);else if(c=l,e){let{radiusExpanded:d}=i;i.radius!==l&&(d-=Math.abs(i.radius-l)),c=d*e}return c},corner(r,l){const{arc_cornerRadius_ratio:c=0,arc_cornerRadius:d=0}=n,{data:{id:u},value:h}=r;let f;return c?f=c*l:f=X(d)?d:d.call(t.api,u,h,l),f}}}function Ya(e){return function(t){const n=({startAngle:a=0,endAngle:s=0,padAngle:o=0})=>({startAngle:a,endAngle:s,padAngle:o}),i=(0,wl.interpolate)(n(this._current),n(t));return this._current=t,function(a){const s=i(a),{data:o,index:r,value:l}=t;return e(Xx(Nx({},s),{data:o,index:r,value:l}))}}}var Yx={initPie(){const e=this,{config:t}=e,n=t.data_type,i=t[`${n}_padding`],a=t[`${n}_startingAngle`]||0,s=(i?i*.01:t[`${n}_padAngle`])||0;e.pie=(0,gt.pie)().startAngle(a).endAngle(a+2*Math.PI).padAngle(s).value(o=>{var r,l;return(l=(r=o.values)==null?void 0:r.reduce((c,d)=>c+d.value,0))!=null?l:o}).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius(){const e=this,{config:t,state:n}=e,i=t.data_type,a=t[`${i}_padding`],s=t.gauge_width||t.donut_width,o=e.getTargetsToShow().length*t.gauge_arcs_minWidth,r=.85,l=kl.call(e)?r:1;n.radiusExpanded=Math.min(n.arcWidth,n.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?r:l),n.radius=n.radiusExpanded*.95,n.innerRadiusRatio=s?(n.radius-s)/n.radius:.6,n.gaugeArcWidth=s||(o<=n.radius-n.innerRadius?n.radius-n.innerRadius:o<=n.radius?o:n.radius);const c=t.pie_innerRadius||(a?a*(n.innerRadiusRatio+.1):0);n.outerRadius=t.pie_outerRadius,n.innerRadius=e.hasType("donut")||e.hasType("gauge")?n.radius*n.innerRadiusRatio:c},getRadius(e){const t=this,n=e==null?void 0:e.data;let{innerRadius:i,outerRadius:a}=t.state;return!X(i)&&n&&(i=i[n.id]||0),Q(a)&&n&&n.id in a?a=a[n.id]:X(a)||(a=t.state.radius),{innerRadius:i,outerRadius:a}},updateArc(){const e=this;e.updateRadius(),e.svgArc=e.getSvgArc(),e.svgArcExpanded=e.getSvgArcExpanded()},getArcLength(){const e=this,{config:t}=e,n=t.gauge_arcLength*3.6;let i=2*(n/360);return n<-360?i=-2:n>360&&(i=2),i*Math.PI},getStartingAngle(){const e=this,{config:t}=e,n=t.data_type,i=e.hasType("gauge")?t.gauge_fullCircle:!1,a=-1*Math.PI/2,s=Math.PI/2;let o=t[`${n}_startingAngle`]||0;return!i&&o<=a?o=a:!i&&o>=s?o=s:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(e,t=!1){var n;const i=this,{config:a,state:s}=i,o=t&&i.hasType("gauge");let{pie:r}=i,l=e,c=!1;if(!a)return null;const d=i.getStartingAngle(),u=a.gauge_fullCircle||t&&!o?i.getArcLength():d*-2,h=l.data&&i.isGaugeType(l.data)&&!i.hasMultiArcGauge();if(h){const{gauge_min:f,gauge_max:g}=a,p=i.getTotalDataSum(s.rendered),x=u*((p-f)/(g-f));r=r.startAngle(d).endAngle(x+d)}if(t===!1){let f;if(h)f=r(i.filterTargetsToShow());else{const g="$arcPieLayout";let p=i.cache.get(g);(!p||p.generation!==s.redrawGeneration)&&(p={generation:s.redrawGeneration,layout:r(i.filterTargetsToShow())},i.cache.add(g,p)),f=p.layout}f.forEach((g,p)=>{var x;!c&&g.data.id===((x=l.data)==null?void 0:x.id)&&(c=!0,l=g,l.index=p)})}if(isNaN(l.startAngle)&&(l.startAngle=0),isNaN(l.endAngle)&&(l.endAngle=l.startAngle),t||l.data&&(a.gauge_enforceMinMax||i.hasMultiArcGauge())){const{gauge_min:f,gauge_max:g}=a,p=t&&!o?i.getTotalDataSum(s.rendered):g,x=u/(p-f),_=(n=l.value)!=null?n:0,v=_<f?0:_<p?_-f:p-f;l.startAngle=d,l.endAngle=d+x*v}return c||t?l:null},getSvgArc(){const e=this,{inner:t,outer:n,corner:i}=El.call(e),a=(0,gt.arc)().innerRadius(t).outerRadius(n),s=function(o,r){var l;let c="M 0 0";if(o.value||o.data){const d=r?o:(l=e.updateAngle(o))!=null?l:null;d&&(c=a.cornerRadius(i(d,n(d)))(d))}return c};return s.centroid=a.centroid,s},getSvgArcExpanded(e=1){const t=this,{inner:n,outer:i,corner:a}=El.call(t,e),s=(0,gt.arc)().innerRadius(n).outerRadius(i);return o=>{const r=t.updateAngle(o),l=i(r);let c=0;return r&&(c=a(r,l)),r&&s.cornerRadius(c)(r)||"M 0 0"}},getArc(e,t,n){return n||this.isArcType(e.data)?this.svgArc(e,t):"M 0 0"},redrawArcRangeText(){const e=this,{config:t,$el:{arcs:n},state:i,$T:a}=e,s=t.arc_rangeText_format,o=e.hasType("gauge")&&t.arc_rangeText_fixed;let r=t.arc_rangeText_values;if(r!=null&&r.length){const l=t.arc_rangeText_unit==="%",c=e.getTotalDataSum(i.rendered);l&&(r=r.map(h=>c/100*h));const d=e.pie(r).map((h,f)=>(h.index=f,h));let u=n.selectAll(`.${et.arcRange}`).data(r);u.exit().remove(),u=a(u.enter().append("text").attr("class",et.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const f=l?h/c*100:h;return O(s)?s(f):`${f}${l?"%":""}`}).merge(u)),(!i.rendered||i.rendered&&!o)&&c>0&&u.attr("transform",function(h,f){return e.transformForArcLabel(this,d[f],!0)}),u.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t,n=!1){const i=this,a=i.updateAngle(t,n);if(!a)return"";let s,o=1;if(n||i.hasMultiArcGauge())s=Wx(i,t,a,n);else if(!i.hasType("gauge")||i.data.targets.length>1){const r=Hx(i,t,a);s=r.pos,o=r.ratio}else return"";return qo.call(i,e,s),`translate(${s.x*o},${s.y*o})`},convertToArcData(e){return this.addName({id:"data"in e?e.data.id:e.id,value:e.value,ratio:this.getRatio("arc",e),index:e.index})},textForArcLabel(e){var t;const n=this,i=n.hasType("gauge"),a=(t=Ha.filter(n.hasType.bind(n)))==null?void 0:t[0];n.shouldShowArcLabel()&&e.style("fill",n.updateTextColor.bind(n)).attr("filter",s=>n.updateTextBGColor.bind(n)(s,n.config.data_labels_backgroundColors)).each(function(s){const o=(0,F.select)(this),r=n.updateAngle(s),l=n.getRatio("arc",r),c=Sa.call(n,l,a);if(s._cache={updated:r,ratio:l,meetsThreshold:c},c){const{value:d}=r||s,u=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(d,l,s.data.id).toString();pn(o,u,[-1,1],i)}else o.text("")})},expandArc(e){const t=this,{state:{transiting:n},$el:i}=t;if(n){const s=setInterval(()=>{t.state.transiting||(clearInterval(s),i.legend.selectAll(`.${ut.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const a=t.mapToTargetIds(e);i.svg.selectAll(t.selectorTargets(a,`.${et.chartArc}`)).each(function(s){if(!t.shouldExpand(s.data.id))return;const o=t.getExpandConfig(s.data.id,"duration"),r=t.getSvgArcExpanded(t.getExpandConfig(s.data.id,"rate"));(0,F.select)(this).selectAll("path").transition().duration(o).attrTween("d",Ya(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",Ya(r.bind(t)))})},unexpandArc(e){const t=this,{state:{transiting:n},$el:{svg:i}}=t;if(n)return;const a=t.mapToTargetIds(e);i.selectAll(t.selectorTargets(a,`.${et.chartArc}`)).selectAll("path").transition().duration(s=>t.getExpandConfig(s.data.id,"duration")).attrTween("d",Ya(t.svgArc.bind(t))),i.selectAll(`${et.arc}`).style("opacity",null)},getExpandConfig(e,t){const n=this,{config:i}=n,a={duration:50,rate:.98};let s;return n.isDonutType(e)?s="donut":n.isGaugeType(e)?s="gauge":n.isPieType(e)&&(s="pie"),s?i[`${s}_expand_${t}`]:a[t]},shouldExpand(e){const t=this,{config:n}=t,i=t.isDonutType(e)?"donut":t.isGaugeType(e)?"gauge":t.isPieType(e)?"pie":null;return i?!!n[`${i}_expand`]:!1},shouldShowArcLabel(){const e=this,{config:t}=e;return Ha.some(n=>e.hasType(n)&&t[`${n}_label_show`])},getArcLabelConfig(e="format"){const t=this,{config:n}=t;let i=a=>a;return Ha.filter(t.hasType.bind(t)).forEach(a=>{i=n[`${a}_label_${e}`]}),e==="format"&&O(i)?i.bind(t.api):i},updateTargetsForArc(e){const t=this,{$el:n}=t,i=t.hasType("gauge"),a=t.getChartClass("Arc"),s=t.getClass("arcs",!0),o=t.classFocus.bind(t),r=n.main.select(`.${et.chartArcs}`),l=r.selectAll(`.${et.chartArc}`).data(t.pie(e)).attr("class",d=>a(d)+o(d.data)),c=l.enter().append("g").attr("class",a).call(this.setCssRule(!1,`.${et.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));c.append("g").attr("class",s).merge(l),c.append("text").attr("dy",i&&!t.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",t.getStylePropValue("middle")).style("pointer-events",t.getStylePropValue("none")),n.text=r.selectAll(`.${Y.target} text`)},initArc(){const e=this,{$el:t}=e;t.arcs=t.main.select(`.${Y.chart}`).append("g").attr("class",et.chartArcs).attr("transform",e.getTranslate("arc")),e.setArcTitle()},setArcTitle(e){const t=this,n=e||t.getArcTitle(),i=t.hasType("gauge");if(n){const a=i?qt.chartArcsGaugeTitle:et.chartArcsTitle;let s=t.$el.arcs.select(`.${a}`);s.empty()&&(s=t.$el.arcs.append("text").attr("class",a).style("text-anchor","middle")),i&&s.attr("dy","-0.3em"),pn(s,n,i?void 0:[-.6,1.35],!0)}},getArcTitle(){const e=this,t=e.hasType("donut")&&"donut"||e.hasType("gauge")&&"gauge";return t?e.config[`${t}_title`]:""},getArcTitleWithNeedleValue(){const e=this,{config:t,state:n}=e,i=e.getArcTitle();if(i&&e.config.arc_needle_show&&/{=[A-Z_]+}/.test(i)){let a=n.current.needle;return X(a)||(a=t.arc_needle_value),Ue(i,{NEEDLE_VALUE:~~a})}return!1},redrawArc(e,t,n){const i=this,{config:a,state:s,$el:{main:o}}=i,r=a.interaction_enabled,l=r&&a.data_selection_isselectable;let c=o.selectAll(`.${et.arcs}`).selectAll(`.${et.arc}`).data(i.arcData.bind(i));c.exit().transition().duration(t).style("opacity","0").remove(),c=c.enter().append("path").attr("class",i.getClass("arc",!0)).style("fill",d=>i.color(d.data)).style("cursor",d=>{var u;return(u=l==null?void 0:l.bind)!=null&&u.call(l,i.api)(d)?"pointer":null}).style("opacity","0").each(function(d){i.isGaugeType(d.data)&&(d.startAngle=a.gauge_startingAngle,d.endAngle=a.gauge_startingAngle),this._current=d}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",d=>!i.isGaugeType(d.data)&&n?"scale(0)":"").style("opacity",function(d){return d===this._current?"0":null}).each(()=>{s.transiting=!0}).transition().duration(e).attrTween("d",function(d){const u=i.updateAngle(d);if(!u)return()=>"M 0 0";isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const h=(0,wl.interpolate)(this._current,u);return this._current=h(0),function(f){const g=h(f);return g.data=d.data,i.getArc(g,!0)}}).attr("transform",n?"scale(1)":"").style("fill",d=>{let u;return i.levelColor?(u=i.levelColor(d.data.values[0].value),a.data_colors[d.data.id]=u):u=i.color(d.data),u}).style("opacity",null).call(Qn,function(){if(i.levelColor){const d=(0,F.select)(this),u=d.datum(this._current);i.updateLegendItemColor(u.data.id,d.style("fill"))}s.transiting=!1,s.redrawing&&(s.redrawing=!1,s._targetsToShow=null,s._cachedDrawShape=null),V(a.onrendered,i.api)}),r&&i.bindArcEvent(c),i.hasType("polar")&&i.redrawPolar(),i.hasType("gauge")&&i.redrawBackgroundArcs(),a.arc_needle_show&&i.redrawNeedle(),i.redrawArcText(e),i.redrawArcRangeText()},redrawNeedle(){const e=this,{$el:t,config:n,state:{hiddenTargetIds:i,radius:a}}=e,s=(a-1)/100*n.arc_needle_length,o=i.size!==e.data.targets.length;let r=e.$el.arcs.select(`.${et.needle}`);const l=n.arc_needle_path,c=n.arc_needle_bottom_width/2,d=n.arc_needle_top_width/2,u=n.arc_needle_top_rx,h=n.arc_needle_top_ry,f=n.arc_needle_bottom_len,g=n.arc_needle_bottom_rx,p=n.arc_needle_bottom_ry,x=e.getNeedleAngle(),_=()=>{const v=e.getArcTitleWithNeedleValue();v&&e.setArcTitle(v)};if(_(),r.empty()&&(r=t.arcs.append("path").classed(et.needle,!0),t.needle=r,t.needle.updateHelper=(v,m=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(v)}deg)`).call(Qn,()=>{m&&(n.arc_needle_value=v),_()})}),o){const v=O(l)?l.call(e,s):`M-${c} ${f} A${g} ${p} 0 0 0 ${c} ${f} L${d} -${s} A${u} ${h} 0 0 0 -${d} -${s} L-${c} ${f} Z`;e.$T(r).attr("d",v).style("fill",n.arc_needle_color).style("display",null).style("transform",`rotate(${x}deg)`)}else r.style("display","none")},getNeedleAngle(e){const t=this,{config:n,state:i}=t,a=t.getArcLength(),s=t.hasType("gauge"),o=t.getTotalDataSum(!0);let r=ct(e)?e:n.arc_needle_value,l=n[`${n.data_type}_startingAngle`]||0,c;if(X(r)||(r=s&&t.data.targets.length===1?o:0),i.current.needle=r,s){l=t.getStartingAngle();const d=n.gauge_fullCircle?a:l*-2,{gauge_min:u,gauge_max:h}=n;c=d*((r-u)/(h-u))}else c=o?a*(r/o):0;return(l+c)*(180/Math.PI)},redrawBackgroundArcs(){const e=this,{config:t,state:n}=e,i=e.hasMultiArcGauge(),a=t.gauge_fullCircle,s=e.getTargetsToShow().length===0&&!!t.data_empty_label_text,o=e.getStartingAngle(),r=a?o+e.getArcLength():o*-1;let l=e.$el.arcs.select(`${i?"g":""}.${et.chartArcsBackground}`);if(i){let c=0;l=l.selectAll(`path.${et.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(d,u)=>`${et.chartArcsBackground} ${et.chartArcsBackground}-${u}`).merge(l).style("fill",t.gauge_background||null).attr("d",({id:d})=>{if(s||n.hiddenTargetIds.has(d))return"M 0 0";const u={data:[{value:t.gauge_max}],startAngle:o,endAngle:r,index:c++};return e.getArc(u,!0,!0)}),l.exit().remove()}else l.attr("d",s?"M 0 0":()=>{const c={data:[{value:t.gauge_max}],startAngle:o,endAngle:r};return e.getArc(c,!0,!0)})},bindArcEvent(e){const t=this,{config:n,state:i}=t,a=i.inputType==="touch",s=i.inputType==="mouse",o=c=>{const d=t.updateAngle(c);return d?t.convertToArcData(d):null};function r(c,d,u){t.expandArc(u),t.api.focus(u),t.toggleFocusLegend(u,!0),t.showTooltip([d],c)}function l(c){const d=(c==null?void 0:c.id)||void 0;t.unexpandArc(d),t.api.revert(),t.revertLegend(),t.hideTooltip()}if(e.on("click",function(c,d,u){var h;const f=o(d);f&&((h=t.toggleShape)==null||h.call(t,this,f,u),n.data_onclick.bind(t.api)(f,this))}),s&&e.on("mouseover",function(c,d){if(i.transiting)return;i.event=c;const u=o(d),h=(u==null?void 0:u.id)||void 0;r(this,u,h),t.setOverOut(!0,u)}).on("mouseout",(c,d)=>{if(i.transiting||!n.interaction_onout)return;i.event=c;const u=o(d);l(),t.setOverOut(!1,u)}).on("mousemove",function(c,d){const u=o(d);i.event=c,t.showTooltip([u],this)}),a&&t.hasArcType()&&!t.radars){const c=d=>{var u,h;const{clientX:f,clientY:g}=(h=(u=d.changedTouches)==null?void 0:u[0])!=null?h:{clientX:0,clientY:0};return(0,F.select)(tt.elementFromPoint(f,g))};t.$el.svg.on("touchstart touchmove",function(d){if(i.transiting)return;i.event=d;const h=c(d).datum(),f=h!=null&&h.data&&h.data.id?t.updateAngle(h):null,g=f?t.convertToArcData(f):null,p=(g==null?void 0:g.id)||void 0;t.callOverOutForTouch(g),yt(p)?l():r(this,g,p)},{passive:!0})}},redrawArcText(e){const t=this,{config:n,state:i,$el:{main:a,arcs:s}}=t,o=t.hasType("gauge"),r=t.hasMultiArcGauge();let l;if(o&&t.data.targets.length===1&&n.gauge_title||(l=a.selectAll(`.${et.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?qt.gaugeValue:null).call(t.textForArcLabel.bind(t)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(i.radius/5)}px`:null),Zo.call(t),l.attr("transform",function(c){return t.transformForArcLabel.bind(t)(this,c)}).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),a.select(`.${et.chartArcsTitle}`).style("opacity",t.hasType("donut")||o?null:"0"),o){const c=n.gauge_fullCircle;c&&(l==null||l.attr("dy",`${r?0:Math.round(i.radius/14)}`)),n.gauge_label_show&&(s.select(`.${qt.chartArcsGaugeUnit}`).attr("dy",`${c?1.5:.75}em`).text(n.gauge_units),s.select(`.${qt.chartArcsGaugeMin}`).attr("dx",`${-1*(i.innerRadius+(i.radius-i.innerRadius)/(c?1:2))}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_min,!1)),!c&&s.select(`.${qt.chartArcsGaugeMax}`).attr("dx",`${i.innerRadius+(i.radius-i.innerRadius)/2}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_max,!0)))}kl.call(t)&&Mx.call(t,e)},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:n}}=t,i=X(e)?a=>a.index===e:a=>a.data.id===e;return n==null?void 0:n.selectAll(`.${Y.target} path`).filter(i)}};function Tn(e,t){Tt(de.prototype,[Yx,vn].concat(e||[])),Qe.setOptions([en].concat(t||[]))}let Pl=()=>(Tn(void 0,[Ei,Ex]),(Pl=()=>I.DONUT)());var jx=Object.defineProperty,Dl=Object.getOwnPropertySymbols,Ux=Object.prototype.hasOwnProperty,Kx=Object.prototype.propertyIsEnumerable,Il=(e,t,n)=>t in e?jx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zx=(e,t)=>{for(var n in t||(t={}))Ux.call(t,n)&&Il(e,n,t[n]);if(Dl)for(var n of Dl(t))Kx.call(t,n)&&Il(e,n,t[n]);return e};function wn(e=!1){const t=this,{config:n,state:{current:{width:i,height:a}}}=t,s=t.getCurrentPadding(),o=Zx({width:i-s.left-s.right,height:a-(n.legend_show?t.getLegendHeight()+10:0)-s.top-s.bottom},s);if(e){const r=ja.call(t,o),l=n.funnel_rotated;o.width=Math.max(o.width,l?r.height:r.width),o.height=Math.max(o.height,l?r.width:r.height)}return o}function ja(e){const t=this,{config:n}=t,i=n.funnel_rotated,[a,s]=[n.funnel_neck_width,n.funnel_neck_height].map((o,r)=>Q(o)?e[i!==!r?"width":"height"]*o.ratio:o);return{width:a,height:s}}function qx(e){const t=this,n=t.config.funnel_rotated,{width:i,height:a}=wn.call(t,!0),s=[];return e.forEach((o,r)=>{const{ratio:l=0}=o,c=r>0?s[r-1][2][n?0:1]:0,d=l+c;s.push(o.coords=n?[[c,0],[d,0],[d,a],[c,a],[c,0]]:[[0,c],[i,c],[i,d],[0,d],[0,c]])}),s}function Jx(){const e=this,t=e.config.funnel_rotated,{width:n,height:i}=wn.call(e,!0),a=ja.call(e,{width:n,height:i});let s;if(t){const o=(i-a.width)/2,r=n-a.height;s=[[r,o],[n,o],[n,i-o],[r,i-o],[0,i]]}else{const o=(n-a.width)/2,r=i-a.height;s=[[n,0],[n-o,r],[n-o,i],[o,i],[o,r]]}return`M${[[0,0],...s,[0,0]].join("L")}z`}function Qx(e){const t=this,{config:n}=t,i=e.map(a=>({id:a.id,value:a.values.reduce((s,o)=>s+o.value,0)}));return n.data_order&&i.sort(t.getSortCompareFn.bind(t)(!0)),Ml.call(t,i)}function Ml(e){const t=this,{width:n,height:i}=wn.call(t),a=t.getTotalDataSum(!0),s=t.config.funnel_rotated?n:i;return e.forEach(o=>{o.ratio=o.value/a*s}),e}function t_(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function $l(e,t,n,i,a){const s=[];for(let r=0;r<=20;r++){const l=r/20,c=e+(t-e)*l,d=n+(i-n)*t_(l);s.push(a?[c,d]:[d,c])}return s}function e_(){var e;const t=this,n=t.config.funnel_rotated,{width:i,height:a}=wn.call(t,!0),s=ja.call(t,{width:i,height:a}),o=(0,gt.line)().x(f=>f[0]).y(f=>f[1]).curve(gt.curveLinear),r=(n?a-s.width:i-s.width)/2,l=n?i-s.height:a-s.height,c=$l(0,l,n?0:i,n?r:i-r,n),d=[];if(s.height>0&&(c.push(n?[i,r]:[i-r,a]),d.push(n?[i,a-r]:[r,a])),d.push(...$l(l,0,n?a-r:r,n?a:0,n)),c.length>1){const[f,g]=n?[1,0]:[0,1];c.splice(1,0,[c[f][0],c[g][1]]);const p=d.length-1;p>0&&d.splice(p,0,[d[p-f][0],d[p-g][1]])}const u=o(c)||"",h=((e=o(d))==null?void 0:e.replace(/^M/,"L"))||"";return n?`${u}${h}z`:`M0,0${u.replace(/^M/,"L")}${h}z`}var n_={initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${Y.chart}`).append("g").classed(Nn.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(Nn.funnelBackground,!0),e.bindFunnelEvent()},bindFunnelEvent(){const e=this,{$el:{funnel:t},config:n,state:i}=e;if(!n.interaction_enabled)return;const a=o=>{var r;const l=o.isTrusted?o.target:(r=i.eventReceiver.rect)==null?void 0:r.node();if(l&&/^path$/i.test(l.tagName))return i.event=o,(0,F.select)(l).datum()},s=i.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.target),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})},updateTargetsForFunnel(e){const t=this,{$el:{funnel:n}}=t;n||t.initFunnel();const i=t.getChartClass("Funnel"),a=t.getClass("funnel",!0),s=Qx.call(t,e.filter(t.isFunnelType.bind(t))),o=t.filterNullish(s),r=n.selectAll(`.${Nn.chartFunnel}`).data(o);r.exit().remove();const l=r.enter().insert("g",`.${Nn.funnelBackground}`);l.append("path"),n.path=l.merge(r).attr("class",i).select("path").attr("class",a).style("opacity","0").style("fill",t.color)},updateFunnel(e){const t=this,{$el:{funnel:n}}=t,i=e.map(({id:a})=>a);n.path=n.path.filter(a=>i.includes(a.id))},generateGetFunnelPoints(){const e=this,{config:t,$el:{funnel:n}}=e,i=t.funnel_rotated,a=e.filterTargetsToShow(n.path),{top:s,left:o,width:r,height:l}=wn.call(e),c={};let d=0;return a.each(u=>{const h=d,{ratio:f}=u;d+=f;const g=i?o:s,p=g+h,x=g+d,_=(p+x)/2,v=i?s+l/2:o+r/2;c[u.id]=i?[[p,v],[x,v],[_,v]]:[[v,p],[v,x],[v,_]]}),u=>c[u.id]},redrawFunnel(){const e=this,{config:t,$T:n,$el:{funnel:i}}=e,a=e.filterTargetsToShow(i.path),s=qx.call(e,Ml.call(e,a.data())),{top:o,left:r}=wn.call(e),l=(t.funnel_spline?e_:Jx).call(e);i.attr("transform",`translate(${r}, ${o})`).attr("clip-path",`path('${l}')`),i.background.attr("d",l),n(a).attr("d",(c,d)=>`M${s[d].join("L")}z`).style("opacity","1"),i.selectAll("g").style("opacity",null)}},i_={funnel_neck_width:0,funnel_neck_height:0,funnel_rotated:!1,funnel_spline:!1};let Fl=()=>(Tn([n_],[i_]),(Fl=()=>I.FUNNEL)());var a_={initGauge(){const e=this,{config:t,$el:{arcs:n}}=e,i=(a=null,s="")=>{n.append("text").attr("class",a).style("text-anchor","middle").style("pointer-events","none").text(s)};if(e.hasType("gauge")){const a=e.hasMultiArcGauge();n.append(a?"g":"path").attr("class",et.chartArcsBackground).style("fill",!a&&t.gauge_background||null),t.gauge_units&&i(qt.chartArcsGaugeUnit),t.gauge_label_show&&(i(qt.chartArcsGaugeMin),!t.gauge_fullCircle&&i(qt.chartArcsGaugeMax))}},updateGaugeMax(){const e=this,{config:t,state:n}=e,a=e.hasMultiArcGauge()?e.getMinMaxData().max[0].value:e.getTotalDataSum(n.rendered);!t.gauge_enforceMinMax&&a+t.gauge_min*(t.gauge_min>0?-1:1)>t.gauge_max&&(t.gauge_max=a-t.gauge_min)},redrawArcGaugeLine(){const e=this,{config:t,state:n,$el:i}=e,{hiddenTargetIds:a}=e.state,s=i.main.selectAll(`.${et.arcs}`).selectAll(`.${et.arcLabelLine}`).data(e.arcData.bind(e));s.enter().append("rect").attr("class",r=>`${et.arcLabelLine} ${Y.target} ${Y.target}-${r.data.id}`).merge(s).style("fill",r=>e.levelColor?e.levelColor(r.data.values[0].value):e.color(r.data)).style("display",t.gauge_label_show?null:"none").each(function(r){let l=0;const c=2;let d=0,u=0,h="";if(!a.has(r.data.id)){const f=e.updateAngle(r),g=n.gaugeArcWidth/e.getTargetsToShow().length*(f.index+1),p=f.endAngle-Math.PI/2,x=n.radius-g,_=p-(x===0?0:1/x);l=n.radiusExpanded-n.radius+g,d=Math.cos(_)*x,u=Math.sin(_)*x,h=`rotate(${p*180/Math.PI}, ${d}, ${u})`}(0,F.select)(this).attr("x",d).attr("y",u).attr("width",l).attr("height",c).attr("transform",h).style("stroke-dasharray",`0, ${l+c}, 0`)})},textForGaugeMinMax(e,t){const n=this,{config:i}=n,a=i.gauge_label_extents;return O(a)?a.bind(n.api)(e,t):e},getGaugeLabelHeight(){const{config:e}=this;return this.config.gauge_label_show&&!e.gauge_fullCircle?20:0},getPaddingBottomForGauge(){return this.getGaugeLabelHeight()*2}},s_={gauge_background:"",gauge_fullCircle:!1,gauge_label_show:!0,gauge_label_extents:void 0,gauge_label_format:void 0,gauge_label_ratio:void 0,gauge_label_threshold:0,gauge_label_line:!1,gauge_label_image:void 0,gauge_enforceMinMax:!1,gauge_min:0,gauge_max:100,gauge_type:"single",gauge_startingAngle:-1*Math.PI/2,gauge_arcLength:100,gauge_title:"",gauge_units:void 0,gauge_width:void 0,gauge_arcs_minWidth:5,gauge_expand:{},gauge_expand_rate:.98,gauge_expand_duration:50};let Ol=()=>(Tn([a_],[Ei,s_]),(Ol=()=>I.GAUGE)()),Bl=()=>(Le(),(Bl=()=>I.LINE)()),zl=()=>(Le(void 0,[Fa]),(zl=()=>I.SPLINE)()),Nl=()=>(Le(),(Nl=()=>I.STEP)());var o_={pie_label_show:!0,pie_label_format:void 0,pie_label_ratio:void 0,pie_label_threshold:.05,pie_label_line:!1,pie_label_image:void 0,pie_expand:{},pie_expand_rate:.98,pie_expand_duration:50,pie_innerRadius:0,pie_outerRadius:void 0,pie_padAngle:0,pie_padding:0,pie_startingAngle:0};let Xl=()=>(Tn(void 0,[Ei,o_]),(Xl=()=>I.PIE)());function Gl(e){const t=e.config.polar_level_max;let n=e.getMinMaxData().max[0].value;return t&&t>n&&(n=t),n}var r_={initPolar(){const e=this,{$el:{arcs:t},config:n}=e,i=n.polar_level_text_show,a=n.polar_level_text_backgroundColor;t.levels=t.append("g").attr("class",Ae.levels),i&&a&&e.generateTextBGColorFilter(a)},getPolarOuterRadius(e,t){var n;const i=Gl(this);return((n=e==null?void 0:e.data.values[0].value)!=null?n:0)/i*t},updateTargetsForPolar(e){this.updateTargetsForArc(e)},redrawPolar(){const e=this,{config:t}=e;t.polar_level_show&&e.updatePolarLevel()},updatePolarLevel(){const e=this,{config:t,state:n,$el:{arcs:{levels:i}}}=e,a=t.polar_level_depth,s=Gl(e),o=ti(0,a),r=n.radius,l=o.map(h=>r*((h+1)/a)),c=(t.polar_level_text_format||function(){}).bind(e.api),d=i.selectAll(`.${Ae.level}`).data(o);d.exit().remove();const u=d.enter().append("g").attr("class",(h,f)=>`${Ae.level} ${Ae.level}-${f}`);if(u.append("circle"),u.merge(d).selectAll("circle").style("visibility",t.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>l[h]),t.polar_level_text_show){const h=t.polar_level_text_backgroundColor,f=`#${n.datetimeId}-labels-bg${e.getTargetSelectorSuffix(h)}`;u.append("text").style("text-anchor","middle"),u.merge(d).selectAll("text").attr("dy",g=>-l[g]+5).attr("filter",h?`url(${f})`:null).text(g=>c(s/o.length*(g+1)))}}},l_={polar_label_show:!0,polar_label_format:void 0,polar_label_threshold:.05,polar_label_line:!1,polar_label_image:void 0,polar_label_ratio:void 0,polar_level_depth:3,polar_level_max:void 0,polar_level_show:!0,polar_level_text_backgroundColor:"#fff",polar_level_text_format:e=>e%1===0?e:e.toFixed(2),polar_level_text_show:!0,polar_padAngle:0,polar_padding:0,polar_startingAngle:0};let Wl=()=>(Tn([r_],[Ei,l_]),(Wl=()=>I.POLAR)());function c_(e,t,n,i,a,s){const o=e&&i>0?n-i:i,r=2*Math.PI;return a*(1-s*(t==="x"?Math.sin:Math.cos)(o*r/n))}const Cn=j.radarPoints,Vl=j.radarTextWidth;var d_={initRadar(){const e=this,{config:t,state:{current:n},$el:i}=e;e.hasType("radar")&&(i.radar=i.main.select(`.${Y.chart}`).append("g").attr("class",vo.chartRadars),i.radar.levels=i.radar.append("g").attr("class",Ae.levels),i.radar.axes=i.radar.append("g").attr("class",Rt.axis),i.radar.shapes=i.radar.append("g").attr("class",Ct.shapes),n.dataMax=t.radar_axis_max||e.getMinMaxData().max[0].value,t.radar_axis_text_show&&(t.interaction_enabled&&e.bindRadarEvent(),e.updateRadarLevel(),e.updateRadarAxes()))},getRadarSize(){const e=this,{config:t,state:{arcWidth:n,arcHeight:i}}=e,a=t.axis_x_categories.length<4?-20:10,s=(Math.min(n,i)-a)/2;return[s,s]},updateTargetsForRadar(e){const t=this,{config:n}=t;Qt(n.axis_x_categories)&&(n.axis_x_categories=ti(0,oe("max",e.map(i=>i.values.length)))),t.generateRadarPoints()},getRadarPosition(e,t,n,i){const a=this,{config:s}=a,[o,r]=a.getRadarSize(),l=s.axis_x_categories.length,c=s.radar_direction_clockwise,d=je(e).map(u=>c_(c,u,l,t,ct(n)?n:e==="x"?o:r,X(i)?i:s.radar_size_ratio));return d.length===1?d[0]:d},generateRadarPoints(){const e=this,t=e.data.targets,[n,i]=e.getRadarSize(),a=e.cache.get(Cn)||{},s=a._size;(!s||s.width!==n&&s.height!==i)&&(t.forEach(o=>{a[o.id]=o.values.map((r,l)=>e.getRadarPosition(["x","y"],l,void 0,e.getRatio("radar",r)))}),a._size={width:n,height:i},e.cache.add(Cn,a))},redrawRadar(){const e=this,{radar:t,main:n}=e.$el,i=e.getTranslate("radar");i&&(t.attr("transform",i),n.select(`.${St.chartTexts}`).attr("transform",i),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(Cn);return(t,n)=>{const i=e[t.id][n];return[i,i,i,i]}},updateRadarLevel(){const e=this,{config:t,state:n,$el:{radar:i}}=e,[a,s]=e.getRadarSize(),o=t.radar_level_depth,r=t.axis_x_categories.length,l=t.radar_level_text_show,c=i.levels,d=ti(0,o),u=t.radar_size_ratio*Math.min(a,s),h=d.map(_=>u*((_+1)/o)),f=(t.radar_level_text_format||function(){}).bind(e.api),g=d.map(_=>{const v=h[_];return ti(0,r).map(b=>e.getRadarPosition(["x","y"],b,v,1).join(",")).join(" ")}),p=c.selectAll(`.${Ae.level}`).data(d);p.exit().remove();const x=p.enter().append("g").attr("class",(_,v)=>`${Ae.level} ${Ae.level}-${v}`);x.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),l&&(c.select("text").empty()&&c.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>f(0)),x.append("text").attr("dx","-.5em").style("text-anchor","end").text(_=>f(n.current.dataMax/d.length*(_+1)))),x.merge(p).attr("transform",_=>`translate(${a-h[_]}, ${s-h[_]})`).selectAll("polygon").attr("points",_=>g[_]),l&&c.selectAll("text").attr("x",_=>yt(_)?a:g[_].split(",")[0]).attr("y",_=>yt(_)?s:0)},updateRadarAxes(){const e=this,{config:t,$el:{radar:n}}=e,[i,a]=e.getRadarSize(),s=t.axis_x_categories;let o=n.axes.selectAll("g").data(s);o.exit().remove();const r=o.enter().append("g").attr("class",(l,c)=>`${Rt.axis}-${c}`);if(t.radar_axis_line_show&&r.append("line"),t.radar_axis_text_show&&r.append("text"),o=r.merge(o),t.radar_axis_line_show&&o.select("line").attr("x1",i).attr("y1",a).attr("x2",(l,c)=>e.getRadarPosition("x",c)).attr("y2",(l,c)=>e.getRadarPosition("y",c)),t.radar_axis_text_show){const{x:l=0,y:c=0}=t.radar_axis_text_position,d=e.cache.get(Vl)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(u=>{u.each(function(h){pn((0,F.select)(this),String(h),[-.6,1.2])})}).datum((u,h)=>({index:h})).attr("transform",function(u){yt(this.width)&&(this.width=ht(this,!0).width/2);let h=e.getRadarPosition("x",u.index,void 0,1),f=Math.round(e.getRadarPosition("y",u.index,void 0,1));return h>i?h+=this.width+l:Math.round(h)<i&&(h-=this.width+l),f>a?(f/2===a&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),f+=c):f<a&&(f-=c),`translate(${h} ${f})`}),!d){const u=[n.axes,n.levels].map(h=>Lo(h.node()).width);u.every(h=>h>0)&&e.cache.add(Vl,u[0]-u[1])}}},bindRadarEvent(){const e=this,{config:t,state:n,$el:{radar:i,svg:a}}=e,s=e.isPointFocusOnly(),{inputType:o,transiting:r}=n,l=o==="mouse",c=d=>{if(n.event=d,!t.interaction_onout)return;const u=e.getDataIndexFromEvent(d),h=yt(u);(l||h)&&(e.hideTooltip(),s?e.hideCircleFocus():e.unexpandCircles(),l?e.setOverOut(!1,u):h&&e.callOverOutForTouch())};i.axes.on(l?"mouseover ":"touchstart",d=>{if(r)return;n.event=d;const u=e.getDataIndexFromEvent(d);e.selectRectForSingle(a.node(),u),l?e.setOverOut(!0,u):e.callOverOutForTouch(u)},l?void 0:{passive:!0}).on("mouseout",l?c:null),l||a.on("touchstart",c,{passive:!0})},updateRadarShape(){const e=this,t=e.data.targets.filter(s=>e.isRadarType(s)),n=e.cache.get(Cn),i=e.$el.radar.shapes.selectAll("polygon").data(e.filterNullish(t)),a=i.enter().append("g").attr("class",e.getChartClass("Radar"));e.$T(i.exit()).remove(),a.append("polygon").merge(i).style("fill",e.color).style("stroke",e.color).attr("points",s=>n[s.id].join(" ")),e.updateTargetForCircle(t,a)},radarCircleX(e){return this.cache.get(Cn)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(Cn)[e.id][e.index][1]}},u_={radar_axis_max:void 0,radar_axis_line_show:!0,radar_axis_text_show:!0,radar_axis_text_position:{},radar_level_depth:3,radar_level_show:!0,radar_level_text_format:e=>e%1===0?e:e.toFixed(2),radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1};let Hl=()=>(Tn([ol.eventrect,Ai,d_],[en,u_,{axis_x_categories:rl.optAxis.axis_x_categories}]),(Hl=()=>I.RADAR)());var h_={scatter_zerobased:!1};let Yl=()=>(Yn([vn,Ai],[en,h_]),(Yl=()=>I.SCATTER)());var Re=pt(12);function f_(e){const t=this;return e.map(n=>{const{id:i,values:a}=n,{value:s}=a[0];return{name:i,id:i,value:s,ratio:t.getRatio("treemap",a[0])}})}var g_={initTreemapLayout(){this.treemap=(0,Re.treemap)().tile(this.getTreemapTile())},getTreemapTile(){var e,t;const n=this,{config:i,state:{current:{width:a,height:s}}}=n,o=(t={binary:Re.treemapBinary,dice:Re.treemapDice,slice:Re.treemapSlice,sliceDice:Re.treemapSliceDice,squarify:Re.treemapSquarify,resquarify:Re.treemapResquarify}[(e=i.treemap_tile)!=null?e:"binary"])!=null?t:Re.treemapBinary;return(r,l,c,d,u)=>{o(r,0,0,a,s);for(const h of r.children)h.x0=l+h.x0/a*(d-l),h.x1=l+h.x1/a*(d-l),h.y0=c+h.y0/s*(u-c),h.y1=c+h.y1/s*(u-c)}},getTreemapData(e){const t=this;return{name:"root",children:f_.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},getTreemapRoot(e){const t=this,n=t.getTreemapData(e!=null?e:t.data.targets),i=(0,Re.hierarchy)(n).sum(s=>s.value),a=t.getSortCompareFn(!0);return t.treemap||t.initTreemapLayout(),t.treemap(a?i.sort(a):i)}},p_=Object.defineProperty,x_=Object.defineProperties,__=Object.getOwnPropertyDescriptors,jl=Object.getOwnPropertySymbols,m_=Object.prototype.hasOwnProperty,v_=Object.prototype.propertyIsEnumerable,Ul=(e,t,n)=>t in e?p_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b_=(e,t)=>{for(var n in t||(t={}))m_.call(t,n)&&Ul(e,n,t[n]);if(jl)for(var n of jl(t))v_.call(t,n)&&Ul(e,n,t[n]);return e},y_=(e,t)=>x_(e,__(t));function T_(e,t){const n=this;e.selectAll("g").attr("transform",i=>{const a=dn(n,i,t);return`translate(${a.x},${a.y})`}).select("rect").attr("width",i=>dn(n,i,t).w).attr("height",i=>dn(n,i,t).h)}var w_=y_(b_({},g_),{initTreemap(){const e=this,{$el:t,state:{current:{width:n,height:i},clip:a,datetimeId:s}}=e;a.id=`${s}-clip`,e.initTreemapLayout(),t.defs.append("clipPath").attr("id",a.id).append("rect").attr("width",n).attr("height",i),t.treemap=t.main.select(`.${Y.chart}`).attr("clip-path",`url(#${a.id})`).append("g").classed(yo.chartTreemaps,!0),e.bindTreemapEvent()},bindTreemapEvent(){const e=this,{$el:t,config:n,state:i}=e,a=s=>{var o;const r=s.isTrusted?s.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return r&&/^rect$/i.test(r.tagName)&&(i.event=s,l=(0,F.select)(r).datum()),l==null?void 0:l.data};if(n.interaction_enabled){const s=i.inputType==="touch";t.treemap.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:n}}=t,i=[t.getTreemapRoot(e!=null?e:t.data.targets)];n.data(t.filterNullish(i))},updateTreemap(e){const t=this,{$el:n,$T:i}=t,a=n.treemap.datum(),s=t.getChartClass("Treemap"),o=t.getClass("treemap",!0),r=n.treemap.selectAll("g").data(a.children);i(r.exit(),e).style("opacity","0").remove(),r.enter().append("g").append("rect"),n.treemap.selectAll("g").attr("class",s).select("rect").attr("class",o).attr("fill",l=>t.color(l.data.name))},generateGetTreemapPoints(){const e=this,{$el:t}=e,n={};return t.treemap.selectAll("g").each(i=>{const a=dn(e,i);n[i.data.name]=[[a.x,a.y],[a.x+a.w,a.y+a.h]]}),i=>n[i.id]},redrawTreemap(e){const t=this,{$el:n,state:{current:{width:i,height:a}}}=t;return n.defs.select("rect").attr("width",i).attr("height",a),[t.$T(n.treemap,e,he()).call(T_.bind(t),n.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{$el:{treemap:n},config:i,scale:{x:a,y:s}}=t,{id:o,value:r}=e,l=i.treemap_label_format,c=t.getRatio("treemap",e),d=(c*100).toFixed(2),u=i.treemap_label_show&&Sa.call(t,c,"treemap")?null:"0",h=n.selectAll("g").filter(p=>p.data.id===o).datum();let f=0,g=0;if(h){const{x0:p,x1:x,y0:_,y1:v}=h;f=a(x)-a(p),g=s(v)-s(_)}return function(p){return p.style("opacity",u),O(l)?l.bind(t.api)(r,c,o,{width:f,height:g}):`${o}
45
- ${d}%`}}}),C_={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};let Kl=()=>(Yn([w_],[C_]),(Kl=()=>I.TREEMAP)()),Ua=Object.create(null);const Zl={version:"4.0.3",generate(e){const t=ve(Object.create(null),Ua,e),n=new Wt(t);return n.internal.charts=this.instance,this.instance.push(n),n},defaults(e){return Q(e)&&(Ua=e),Ua},instance:[],plugin:{}};Object.keys(Dt).forEach(e=>Dt[e]()),Object.keys(U).forEach(e=>U[e]()),Tr(),wr(),Mr(),Kr(),yr(),_r()})(),Di})()});
39
+ `):[];if(l.length)return l;if(ot(r))return r;let c=o.tickWidth;(!c||c<=0)&&(c=a?95:o.isCategory?(o.isInverted?n(i[0])-n(i[1]):n(i[1])-n(i[0]))-12:110);function u(d,h){let f,g,p;for(let _=1;_<h.length;_++)if(h.charAt(_)===" "&&(g=_),f=h.substr(0,_+1),p=s*f.length,c<p)return u(d.concat(h.substr(0,g||_)),h.slice(g?g+1:_));return d.concat(h)}return u(l,String(r))}scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?String(t):"bottom",this):this.config.orient}tickFormat(t){const{config:n}=this;return arguments.length?(n.tickFormat=t,this):n.tickFormat}tickCentered(t){const{config:n}=this;return arguments.length?(n.tickCentered=t,this):n.tickCentered}tickOffset(){return this.config.tickOffset}tickInterval(t){var n,i,a;const{outerTickSize:s,tickOffset:o,tickValues:r}=this.config;let l;if(this.params.isCategory){const c=(n=this.params.owner.scale.zoom)!=null?n:this.helper.scale;l=o*2||Math.abs(c(1)-c(0))}else{const c=(i=this.params.owner.scale.zoom)!=null?i:this.helper.scale;if(l=(this.g?this.g.select("path.domain").node().getTotalLength()-s*2:Math.abs(c.range()[1]-c.range()[0]))/(t||((a=this.g)==null?void 0:a.selectAll("line").size())||1),r)for(let d=0;d<r.length-1;d++){const h=c(r[d+1])-c(r[d]);h&&h<l&&(l=h)}}return l===1/0?0:l}ticks(...t){const{config:n}=this;return t.length?(n.tickArguments=nn(t),this):n.tickArguments}tickCulling(t){const{config:n}=this;return arguments.length?(n.tickCulling=t,this):n.tickCulling}tickValues(t){const{config:n}=this;if(z(t))n.tickValues=()=>t(this.helper.scale.domain());else{if(!arguments.length)return n.tickValues;n.tickValues=t}return this}setTransition(t){return this.config.transition=t,this}}var M_=Object.defineProperty,F_=Object.defineProperties,O_=Object.getOwnPropertyDescriptors,jl=Object.getOwnPropertySymbols,$_=Object.prototype.hasOwnProperty,B_=Object.prototype.propertyIsEnumerable,is=(e,t,n)=>t in e?M_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z_=(e,t)=>{for(var n in t||(t={}))$_.call(t,n)&&is(e,n,t[n]);if(jl)for(var n of jl(t))B_.call(t,n)&&is(e,n,t[n]);return e},N_=(e,t)=>F_(e,O_(t)),pe=(e,t,n)=>is(e,typeof t!="symbol"?t+"":t,n);function as(e){return e==="subX"?"x":e==="subY"?"y":e==="subY2"?"y2":e}function Gi(e){return/^sub/.test(e)}function Ze(e,t,n){const i=as(t),a=e[`subchart_axis_${i}_tick_${n}`];return Gi(t)&&a!==void 0?a:e[`axis_${i}_tick_${n}`]}function X_(e){var t,n;const i=[e[0],e[e.length-1]];let a=0,s=null;for(const r of e){const l=(n=(t=r.textContent)==null?void 0:t.length)!=null?n:0;l>a&&(a=l,s=r)}s&&!i.includes(s)&&i.push(s);const o=e[Math.floor(e.length/2)];return i.includes(o)||i.push(o),i}const Vi=50,ss=Symbol("tickWidthFallback");function G_(e){var t,n,i;const a=e.select("line").node(),s=(n=(t=a==null?void 0:a.ownerDocument)==null?void 0:t.defaultView)!=null&&n.getComputedStyle?parseFloat(a.ownerDocument.defaultView.getComputedStyle(a).strokeWidth):parseFloat((i=a==null?void 0:a.getAttribute)==null?void 0:i.call(a,"stroke-width"));return Number.isFinite(s)&&s>0?s:1}function V_(e,t,n){var i;const a=(i=e==null?void 0:e.scale)==null?void 0:i.call(e);if(!a||t.length<2)return!1;const s=Math.max(1,n)/2,o=t.map(l=>+a(l)).filter(Number.isFinite).sort((l,c)=>l-c);if(o.length<2)return!1;let r=o[0]+s;for(let l=1;l<o.length;l++){const c=o[l]-s,u=o[l]+s;if(c<=r+vs)return!0;r=Math.max(r,u)}return!1}function W_(e,t){if(e.length<=Vi)return e;const n=new Map,i=r=>{r>=0&&r<e.length&&n.set(r,e[r])};i(0),i(e.length-1),i(Math.floor(e.length/2));const a=Math.max(1,Math.floor(e.length/(Vi-3)));let s=-1,o=0;for(let r=0;r<e.length;r+=a){i(r);const l=e[r],c=t?t(l):l,u=Array.isArray(c)?c.join("").length:String(c!=null?c:"").length;u>s&&(s=u,o=r)}return i(o),Array.from(n.keys()).sort((r,l)=>r-l).map(r=>n.get(r))}function Y_(e){return z(e)?Kl(e):!Array.isArray(e)||e.length<=Vi?e:{length:e.length,first:e[0],middle:e[Math.floor(e.length/2)],last:e[e.length-1]}}function os(e){return e[ss]}function Wi(e,t){$(t)?Object.defineProperty(e,ss,{configurable:!0,value:t,writable:!0}):delete e[ss]}function rs(e){e.length=0,Wi(e)}function H_(e,t,n){rs(e),e.length=t,Wi(e,n)}function j_(e){const t=[];return t.length=e.length,Object.keys(e).forEach(n=>{const i=+n;t[i]=e[i]}),Wi(t,os(e)),t}function U_(e,t){rs(e),e.length=t.length,Object.keys(t).forEach(n=>{const i=+n;e[i]=t[i]}),Wi(e,os(t))}function K_(e,t,n){const i=e[t];if($(i))return i;const a=Number(i);return Number.isFinite(a)?a:n}const Ul=new WeakMap;let Z_=0;function Kl(e){if(!e||!/^(function|object)$/.test(typeof e))return`${typeof e}:${String(e)}`;let t=Ul.get(e);return t||(t=++Z_,Ul.set(e,t)),`${typeof e}:${t}`}function ls(e){return e instanceof Date?`date:${+e}`:Array.isArray(e)?`[${e.map(t=>ls(t)).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${t}:${ls(e[t])}`).join(",")}}`:typeof e=="function"?Kl(e):`${typeof e}:${String(e)}`}function cs(e){return e instanceof Date?new Date(+e):Array.isArray(e)?e.map(t=>cs(t)):e}function q_(e){return{width:e.width,height:e.height,ticks:e.ticks&&j_(e.ticks),clipPath:e.clipPath,domain:cs(e.domain)}}function J_(e,t){return e.width=t.width,e.height=t.height,e.clipPath=t.clipPath,e.domain=cs(t.domain),e.ticks&&t.ticks&&U_(e.ticks,t.ticks),e}var Q_={getAxisInstance:function(){return this.axis||new tx(this)}};class tx{constructor(t){pe(this,"owner"),pe(this,"x"),pe(this,"subX"),pe(this,"subY"),pe(this,"subY2"),pe(this,"y"),pe(this,"y2"),pe(this,"axesList",{}),pe(this,"tick",{x:null,y:null,y2:null}),pe(this,"xs",[]),pe(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom",subY:"left",subY2:"right"}),this.owner=t,this.setOrient()}getAxisClassName(t){return`${It.axis} ${It[`axis${$t(t)}`]}`}isHorizontal(t,n){const i=t.config.axis_rotated;return n?i:!i}isCategorized(){const{config:t,state:n}=this.owner;return t.axis_x_type.indexOf("category")>=0||n.hasRadar}isCustomX(){const{config:t}=this.owner;return!this.isTimeSeries()&&(t.data_x||yt(t.data_xs))}isTimeSeries(t="x"){return this.owner.config[`axis_${t}_type`]==="timeseries"}isLog(t="x"){return this.owner.config[`axis_${t}_type`]==="log"}isTimeSeriesY(){return this.isTimeSeries("y")}getAxisType(t="x"){let n="linear";return this.isTimeSeries(t)?n=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(n="log"),n}getExtent(){const t=this.owner,{config:n,scale:i}=t;let a=n.axis_x_extent;if(a){if(z(a))a=a.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(this.isTimeSeries()&&a.every(isNaN)){const s=Wt.bind(t);a=a.map(o=>i.subX(s(o)))}}return a}init(){const t=this.owner,{config:n,$el:{main:i,axis:a},state:{clip:s}}=t,o=["x","y"];n.axis_y2_show&&o.push("y2"),o.forEach(r=>{const l=this.getAxisClassName(r);a[r]=i.append("g").attr("class",l).attr("clip-path",()=>{let c=null;return r==="x"?c=s.pathXAxis:r==="y"&&(c=s.pathYAxis),c}).attr("transform",t.getTranslate(r)).style("visibility",n[`axis_${r}_show`]?null:"hidden"),this.generateAxes(r)})}setOrient(){const t=this.owner,{axis_rotated:n,axis_y_inner:i,axis_y2_inner:a}=t.config;this.orient={x:n?"left":"bottom",y:n?i?"top":"bottom":i?"right":"left",y2:n?a?"bottom":"top":a?"left":"right",subX:n?"left":"bottom",subY:n?i?"top":"bottom":i?"right":"left",subY2:n?a?"bottom":"top":a?"left":"right"}}generateAxes(t){const n=this.owner,{config:i}=n,a=[],s=i[`axis_${t}_axes`],o=i.axis_rotated;let r;t==="x"?r=o?"left":"bottom":t==="y"?r=o?"bottom":"left":t==="y2"&&(r=o?"top":"right"),s.length&&s.forEach(l=>{const c=l.tick||{},u=n.scale[t].copy();l.domain&&u.domain(l.domain);const d=new Hl({outerTick:c.outer!==!1,noTransition:!1,config:i,id:t,isSubAxes:!0,owner:n}).scale(u).orient(r).tickFormat(z(c.format)?c.format.bind(n.api):(h=>h));J(c.count)&&d.ticks(c.count),c.values&&d.tickValues(c.values),a.push(d)}),this.axesList[t]=a}updateAxes(){const t=this.owner,{config:n,$el:{main:i},$T:a}=t;Object.keys(this.axesList).forEach(s=>{const o=n[`axis_${s}_axes`],r=t.scale[s].copy(),l=r.range();this.axesList[s].forEach((c,u)=>{const d=c.scale().range();l.every((g,p)=>g===d[p])||c.scale().range(l);const h=`${this.getAxisClassName(s)}-${u+1}`;let f=i.select(`.${h.replace(/\s/,".")}`);f.empty()?(f=i.append("g").attr("class",h).style("visibility",n[`axis_${s}_show`]?null:"hidden"),c.create(f)):(o[u].domain&&r.domain(o[u].domain),c.scale(r).create(a(f))),f.attr("transform",t.getTranslate(s,u+1))})})}setAxis(t,n,i,a){const s=this.owner,o=as(t);Gi(t)||(this.tick[o]=this.getTickValues(o)),this[t]=this.getAxis(t,n,i,t==="x"&&(s.scale.zoom||s.config.subchart_show||s.state.resizing)?!0:a)}getAxis(t,n,i,a,s){const o=this.owner,{config:r}=o,l=/^(x|subX)$/.test(t),c=as(t),u=l&&this.isCategorized(),d=this.orient[t],h=s?0:o.getAxisTickRotate(c);let f;if(l)f=t==="subX"?o.format.subXAxisTick:o.format.xAxisTick;else{const m=Gi(t)?r[`subchart_axis_${c}_tick_format`]||r[`axis_${c}_tick_format`]:r[`axis_${c}_tick_format`];z(m)&&(f=m.bind(o.api))}let g=Gi(t)?this.getTickValues(c,!0):this.tick[c];const p=ke({outerTick:i,noTransition:a,config:r,id:t,tickTextRotate:h,owner:o},l&&{isCategory:u,isInverted:r.axis_x_inverted,tickMultiline:r.axis_x_tick_multiline,tickWidth:r.axis_x_tick_width,tickTitle:u&&r.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(p.tickStepSize=r[`axis_${c}_tick_stepSize`]);const _=new Hl(p).scale(l&&o.scale.zoom||n).orient(d);if(l&&this.isTimeSeries()&&g&&!z(g)){const m=Wt.bind(o);g=g.map(v=>m(v))}else!l&&this.isTimeSeriesY()&&(_.ticks(r.axis_y_tick_time_value),g=null);g&&_.tickValues(g),_.tickFormat(f||!l&&o.isStackNormalized()&&o.hasAxisGroupedData(c)&&(m=>`${m}%`)),u&&(_.tickCentered(r.axis_x_tick_centered),se(r.axis_x_tick_culling)&&(r.axis_x_tick_culling=!1));const x=Ze(r,t,"count");return x&&_.ticks(x),_}updateXAxisTickValues(t,n){var i;const a=this.owner,{config:s}=a,o=s.axis_x_tick_fit,r=(c=s.axis_x_tick_count)=>{let u=c,d;return o&&(d=a.mapTargetsToUniqueXs(t),this.isCategorized()&&u>d.length&&(u=d.length),d=this.generateTickValues(d,u,this.isTimeSeries())),d},l=r();if(n)n.tickValues(l);else if(this.x){const c=this.getTickValues("x",!0),u=Ze(s,"subX","count"),d=c!=null?c:u!==s.axis_x_tick_count?r(u):l;this.x.tickValues(l),(i=this.subX)==null||i.tickValues(d)}return l}getId(t){const{config:n,scale:i}=this.owner;let a=n.data_axes[t];return(!a||!i[a])&&(a="y"),a}getXAxisTickFormat(t){const n=this.owner,{config:i,format:a}=n,s=t&&i.subchart_axis_x_tick_format||i.axis_x_tick_format,o=this.isTimeSeries(),r=this.isCategorized();let l;return s?z(s)?l=s.bind(n.api):o&&(l=c=>c?a.axisTime(s)(c):""):l=o?a.defaultAxisTime:r?n.categoryName:c=>c<0?c.toFixed(0):c,z(l)?c=>l.apply(n,r?[c,n.categoryName(c)]:[c]):l}getTickValues(t,n=!1){const i=this.owner,a=n?Ze(i.config,`sub${$t(t)}`,"values"):i.config[`axis_${t}_tick_values`],s=z(a)?a.call(i.api):a,o=i[`${t}Axis`];return n?s!=null?s:void 0:s||(o?o.tickValues():void 0)}getLabelOptionByAxisId(t){return this.owner.config[`axis_${t}_label`]}getLabelText(t){const n=this.getLabelOptionByAxisId(t);return Q(n)?n:n?n.text:null}setLabelText(t,n){const i=this.owner,{config:a}=i,s=this.getLabelOptionByAxisId(t);Q(s)?a[`axis_${t}_label`]=n:s&&(s.text=n)}getLabelPosition(t,n){const i=this.owner.config.axis_rotated,a=this.getLabelOptionByAxisId(t),s=Kt(a)&&a.position?a.position:n[+!i],o=r=>!!~s.indexOf(r);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}}getAxisLabelPosition(t){return this.getLabelPosition(t,t==="x"?["inner-top","inner-right"]:["inner-right","inner-top"])}xForAxisLabel(t){const n=this.owner,{state:{width:i,height:a}}=n,s=this.getAxisLabelPosition(t);let o=s.isMiddle?-a/2:0;return this.isHorizontal(n,t!=="x")?o=s.isLeft?0:s.isCenter?i/2:i:s.isBottom&&(o=-a),o}textAnchorForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isMiddle?"middle":"end";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(a="start"),a}dxForAxisLabel(t){const n=this.owner,i=this.getAxisLabelPosition(t);let a=i.isBottom?"0.5em":"0";return this.isHorizontal(n,t!=="x")?a=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(a="-0.5em"),a}dyForAxisLabel(t){const n=this.owner,{config:i}=n,a=i.axis_rotated,s=this.getAxisLabelPosition(t).isInner,o=i[`axis_${t}_tick_rotate`]?n.getHorizontalAxisHeight(t):0,{width:r}=this.getMaxTickSize(t);let l;if(t==="x"){const c=i.axis_x_height;a?l=s?"1.2em":-25-r:s?l="-0.5em":c?l=c-10:o?l=o-10:l="3em"}else l={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],a?s?l=l[0]:o?l=o*(t==="y2"?-1:1)-l[1]:l=l[2]:l=s?l[3]:(l[4]+(i[`axis_${t}_inner`]?0:r+l[4]))*(t==="y"?-1:1);return l}getTickFormatCacheValue(t){const n=this.owner,{config:i}=n;return t==="x"?{format:i.axis_x_tick_format,type:i.axis_x_type,localtime:i.axis_x_localtime,categories:i.axis_x_categories}:{format:i[`axis_${t}_tick_format`],normalized:n.isStackNormalized(),grouped:n.hasAxisGroupedData(t),type:i[`axis_${t}_type`]}}getMaxTickSizeFingerprint(t,n,i,a,s,o){var r;const l=this.owner,{config:c,state:u}=l,d=t==="x",h=d?"axis_x":`axis_${t}`,f=a.tickValues();return ls({id:t,withoutRecompute:!!o,dataGeneration:u.dataGeneration,size:[u.current.width,u.current.height],range:(r=n.range)==null?void 0:r.call(n),domain:i,type:n.type,orient:this.orient[t],axisRotated:c.axis_rotated,evalTextSize:c.axis_evalTextSize,format:this.getTickFormatCacheValue(t),ticks:{values:Y_(f),rawValues:c[`${h}_tick_values`],arguments:a.ticks(),count:c[`${h}_tick_count`],rotate:s,show:c[`${h}_tick_show`],textShow:c[`${h}_tick_text_show`],textPosition:c[`${h}_tick_text_position`],inner:c[`${h}_tick_inner`],culling:c[`${h}_tick_culling`],cullingMax:c[`${h}_tick_culling_max`],cullingLines:c[`${h}_tick_culling_lines`],cullingReverse:c[`${h}_tick_culling_reverse`],stepSize:!d&&c[`${h}_tick_stepSize`],timeValue:!d&&c[`${h}_tick_time_value`],fit:d&&c.axis_x_tick_fit,autorotate:d&&c.axis_x_tick_autorotate,centered:d&&c.axis_x_tick_centered,inverted:d&&c.axis_x_inverted,multiline:d&&c.axis_x_tick_multiline,width:d&&c.axis_x_tick_width}})}getMaxTickSize(t,n){var i;const a=this.owner,{config:s,state:o,$el:{svg:r,chart:l}}=a,{current:c,resizing:u}=o,d=c.maxTickSize[t],h=`${U.maxTickSize}_${t}_${!!n}`,f=a.cache.get(h);if(f&&f.generation===o.redrawGeneration)return d;const g=`axis_${t}`,p={width:0,height:0};let _;if(u||n||!s[`${g}_show`]||d.width>0&&a.filterTargetsToShow().length===0)return d;if((r||s.render_mode==="canvas")&&((i=a.scale[t])!=null&&i.copy)){const x=/^y2?$/.test(t),m=a.getTargetsToShow(),v=a.scale[t].copy().domain(a[`get${x?"Y":"X"}Domain`](m,t)),b=v.domain(),y=b[0]===b[1]&&b.every(M=>M>0),T=ot(d.domain)&&d.domain[0]===d.domain[1]&&d.domain.every(M=>M>0);if(y||T)return d;d.domain=b,x||rs(d.ticks);const w=this.getAxis(t,v,!1,!1,!0),C=s[`${g}_tick_rotate`],k=s[`${g}_tick_count`];if(!s[`${g}_tick_values`]&&k&&w.tickValues(this.generateTickValues(b,k,x?this.isTimeSeriesY():this.isTimeSeries())),!x&&this.updateXAxisTickValues(m,w),_=this.getMaxTickSizeFingerprint(t,v,b,w,C,n),(f==null?void 0:f.fingerprint)===_)return a.cache.add(h,N_(z_({},f),{generation:o.redrawGeneration})),J_(d,f.value);const A=w.tickValues(),L=!x&&Array.isArray(A)&&A.length>Vi;L&&w.tickValues(W_(A,w.tickFormat()));const E=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0"),D=E.append("g").attr("class",`${It[`axis${$t(t)}`]} ${j.dummy}`);w.create(D);const{sizeFor1Char:R}=D.node(),P=E.selectAll("text").attr("transform",$(C)?`rotate(${C})`:null),B=L?A.length:P.size();if(R)P.each(function(M,X){const G=this.textContent.length*R.w,Z=R.h;p.width=Math.max(p.width,G),p.height=Math.max(p.height,Z),x||(d.ticks[X]=G)});else{const M=[];if(P.each(function(){M.push(this)}),(M.length<=5?M:X_(M)).map(G=>ht(G,!0)).forEach(G=>{p.width=Math.max(p.width,G.width),p.height=Math.max(p.height,G.height)}),!x)for(let G=0;G<M.length;G++)d.ticks[G]=p.width}!x&&L&&H_(d.ticks,B,p.width),E.remove()}return Object.keys(p).forEach(x=>{p[x]>0&&(d[x]=p[x])}),a.cache.add(h,{fingerprint:_,generation:o.redrawGeneration,value:q_(d)}),d}getXAxisTickTextY2Overflow(t){const n=this.owner,{axis:i,config:a,state:{current:s,isLegendRight:o,legendItemWidth:r}}=n,l=n.getAxisTickRotate("x"),c=l>0&&l<90;if((i.isCategorized()||i.isTimeSeries())&&a.axis_x_tick_fit&&(!a.axis_x_tick_culling||se(a.axis_x_tick_culling))&&!a.axis_x_tick_multiline&&c){const u=a.axis_y2_show&&s.maxTickSize.y2.width||0,d=o&&r||0,h=s.width-n.getCurrentPaddingByDirection("left"),f=this.getXAxisTickMaxOverflow(l,h-t)-u-d,g=Math.max(0,f)+t;return Math.min(g,h/2)}return 0}getXAxisTickMaxOverflow(t,n){var i;const a=this.owner,{axis:s,config:o,state:r}=a,l=s.isTimeSeries(),c=r.current.maxTickSize.x.ticks,u=c.length,d=(i=os(c))!=null?i:r.current.maxTickSize.x.width,{left:h,right:f}=r.axis.x.padding;let g=0;const p=u-(l&&o.axis_x_tick_fit?.5:0);for(let m=0;m<u;m++){const v=m+1,b=Math.cos(Math.PI*t/180)*K_(c,m,d),y=v-(l?1:.5)+h;if(y<=0)continue;const w=(n-b)/y,C=p-v,k=f*w,S=C*w+k,A=b-w/2-S;g=Math.max(g,A)}const _=a.getTargetsToShow();let x=0;if(!l&&o.axis_x_tick_count<=_.length&&_[0].values.length){const m=Xe(a.axis.getAxisType("x"),0,n-g).domain([h*-1,a.getXDomainMax(a.data.targets)+1+f]);x=(m(1)-m(0))/2}return g+x}updateLabels(t){const n=this.owner,{config:i,$el:{main:a},$T:s}=n,o=i.axis_rotated;["x","y","y2"].forEach(r=>{const l=this.getLabelText(r),c=`axis${$t(r)}`,u=It[`${c}Label`];if(l){let d=a.select(`text.${u}`);d.empty()&&(d=a.select(`g.${It[c]}`).insert("text",":first-child").attr("class",u).attr("transform",["rotate(-90)",null][r==="x"?+!o:+o]).style("text-anchor",()=>this.textAnchorForAxisLabel(r))),s(d,t).attr("x",()=>this.xForAxisLabel(r)).attr("dx",()=>this.dxForAxisLabel(r)).attr("dy",()=>this.dyForAxisLabel(r)).text(l)}})}getPadding(t,n,i,a){const s=$(t)?t:t[n];return J(s)?this.owner.convertPixelToScale(/(bottom|top)/.test(n)?"y":"x",s,a):i}generateTickValues(t,n,i){let a=t;if(n){const s=z(n)?n():n;if(s===1)a=[t[0]];else if(s===2)a=[t[0],t[t.length-1]];else if(s>2){const o=this.isCategorized(),r=s-2,l=t[0],c=t[t.length-1],u=(c-l)/(r+1);let d;a=[l];for(let h=0;h<r;h++)d=+l+u*(h+1),a.push(i?new Date(d):o?Math.round(d):d);a.push(c)}}return i||(a=a.sort((s,o)=>s-o)),a}generateTransitions(t){const n=this.owner,{$el:{axis:i},$T:a}=n,[s,o,r,l,c,u]=["x","y","y2","subX","subY","subY2"].map(d=>a(i[d],t));return{axisX:s,axisY:o,axisY2:r,axisSubX:l,axisSubY:c,axisSubY2:u}}redraw(t,n,i){const a=this.owner,{config:s,state:o,$el:r}=a,l=n?"0":null;["x","y","y2","subX","subY","subY2"].forEach(c=>{const u=this[c],d=r.axis[c];u&&d&&(!i&&!s.transition_duration&&(u.config.withoutTransition=!0),d.style("opacity",l),u.create(t[`axis${$t(c)}`]))}),this.updateAxes(),!o.rendered&&s.axis_tooltip&&this.setAxisTooltip()}syncAxisDomains(t,n,i){var a;const s=this.owner,{config:o,scale:r,$el:l}=s,c=!!r.zoom;let u;if(!c&&this.isCategorized()&&t.length===0&&l.axis.x&&r.x.domain([0,l.axis.x.selectAll(".tick").size()]),r.x&&t.length?(!c&&s.updateXDomain(t,n.UpdateXDomain,n.UpdateOrgXDomain,n.TrimXDomain),o.axis_x_tick_values||this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),(a=this.subX)==null||a.tickValues([])),o.zoom_rescale&&!i&&(u=r.x.orgDomain()),["y","y2"].forEach(d=>{const h=`axis_${d}_`,f=r[d];if(f){const g=o[`${h}tick_values`],p=o[`${h}tick_count`];if(f.domain(s.getYDomain(t,d,u)),!g&&p){const _=s.axis[d],x=f.domain();_.tickValues(this.generateTickValues(x,x.every(m=>m===0)?1:p,this.isTimeSeriesY()))}}}),n.Y){const d=()=>{var h,f;(h=r.subY)==null||h.domain(s.getYDomain(t,"y")),(f=r.subY2)==null||f.domain(s.getYDomain(t,"y2")),["y","y2"].forEach(g=>{const p=g==="y2"?"subY2":"subY",_=r[p],x=s.axis[p],m=this.getTickValues(g,!0),v=Ze(o,p,"count");if(!_||!x||m||!v)return;const b=_.domain();x.tickValues(this.generateTickValues(b,b.every(y=>y===0)?1:v,this.isTimeSeriesY()))})};o.subchart_show?s.withSubchartTypeContext(d):d()}}redrawAxis(t,n,i,a,s){const o=this.owner;this.syncAxisDomains(t,n,a),this.redraw(i,o.hasArcType(),s),this.updateLabels(n.Transition),(n.UpdateXDomain||n.UpdateXAxis||n.Y)&&t.length&&this.setCulling()}setCulling(){const t=this.owner,{config:n,state:{clip:i,current:a},$el:s}=t;["subX","x","y","y2","subY","subY2"].forEach(o=>{const r=s.axis[o],l=Ze(n,o,"culling");if(r&&l){const c=r.selectAll(".tick"),u=pn(c.data(),!Ze(n,o,"culling_reverse")),d=u.length,h=Ze(n,o,"culling_max"),g=!Ze(n,o,"culling_lines")||V_(this[o],u,G_(c));let p;if(d){for(let x=1;x<d;x++)if(d/x<h){p=x;break}p=p!=null?p:d;const _=new Map;for(let x=0;x<u.length;x++)_.set(u[x],x);c.each(function(x){var m;const v=g?this:this.querySelector("text");v&&(v.style.display=((m=_.get(x))!=null?m:0)%p?"none":null)})}else c.style("display",null);if(o==="x"){const _=a.maxTickSize.x.clipPath?i.pathXAxisTickTexts:null;s.svg.selectAll(`.${It.axisX} .tick text`).attr("clip-path",_)}}})}setAxisTooltip(){var t;const n=this.owner,{config:{axis_rotated:i,axis_tooltip:a},$el:{axis:s,axisTooltip:o}}=n,r=(t=a.backgroundColor)!=null?t:"black";n.generateTextBGColorFilter(r,{x:-.15,y:-.2,width:1.3,height:1.3}),["x","y","y2"].forEach(l=>{var c,u,d;if(Q(r)||r[l])if(o[l]=(c=s[l])==null?void 0:c.append("text").classed(It[`axis${l.toUpperCase()}Tooltip`],!0).attr("filter",n.updateTextBGColor({id:l},r)),i){const h=l==="x"?"x":"y",f=l==="y"?"1.15em":l==="x"?"-0.3em":"-0.4em";(u=o[l])==null||u.attr(h,f).attr(`d${l==="x"?"y":"x"}`,l==="x"?"0.4em":"-1.3em").style("text-anchor",l==="x"?"end":null)}else{const h=l==="x"?"y":"x",f=l==="x"?"1.15em":`${l==="y"?"-":""}0.4em`;(d=o[l])==null||d.attr(h,f).attr(`d${l==="x"?"x":"y"}`,l==="x"?"-1em":"0.3em").style("text-anchor",l==="y"?"end":null)}})}}var Zl=Math.pow,ex={initEventRect(){this.$el.main.select(`.${j.chart}`).append("g").attr("class",Ie.eventRects).style("fill-opacity","0")},redrawEventRect(){var e;const t=this,{config:n,state:i,$el:a}=t,s=t.isMultipleX(),o=n.axis_x_inverted;if(a.eventRect)t.updateEventRect(a.eventRect,!0);else if(t.data.targets.length){const l=t.$el.main.select(`.${Ie.eventRects}`).style("cursor",n.zoom_enabled&&n.zoom_type!=="drag"?n.axis_rotated?"ns-resize":"ew-resize":null).classed(Ie.eventRectsMultiple,s).classed(Ie.eventRectsSingle,!s).selectAll(`.${Ie.eventRect}`).data([0]).enter().append("rect");t.updateEventRect(l),t.updateEventType(l),l.call(t.getDraggableSelection()),a.eventRect=l,t.state.inputType==="touch"&&!a.svg.on("touchstart.eventRect")&&!t.hasArcType()&&t.bindTouchOnEventRect(),i.rendered&&t.updateEventRect(a.eventRect,!0)}if(!s){const r=t.getMaxDataCountTarget();(!n.data_xSort||o)&&r.sort((l,c)=>o?c.x-l.x:l.x-c.x),t.updateDataIndexByX(r),t.updateXs(r),(e=t.updatePointClass)==null||e.call(t,!0),i.eventReceiver.data=r}t.updateEventRectData()},bindTouchOnEventRect(){const e=this,{config:t,state:n,$el:{eventRect:i,svg:a}}=e,s=f=>{if(e.isMultipleX())e.selectRectForMultipleXs(f);else{const g=e.getDataIndexFromEvent(n.event);e.callOverOutForTouch(g),g===-1?e.unselectRect():e.selectRectForSingle(f,g)}},o=()=>{e.unselectRect(),e.callOverOutForTouch()},r=t.interaction_inputType_touch.preventDefault,l=tn(r)&&r||!1,c=!isNaN(r)&&r||null;let u;const d=!l&&c===null,h=f=>{const g=f.type,_=f.changedTouches[0][`client${t.axis_rotated?"Y":"X"}`];g==="touchstart"?l?f.preventDefault():c!==null&&(u=_):g==="touchmove"&&(l||u===!0||c!==null&&Math.abs(u-_)>=c)&&(u=!0,f.preventDefault())};i.on("touchstart",f=>{n.event=f,e.updateEventRect()},{passive:d}).on("touchstart.eventRect touchmove.eventRect",f=>{if(n.event=f,!i.empty()&&i.classed(Ie.eventRect)){if(n.dragging||n.flowing||e.hasArcType()||f.touches.length>1)return;h(f),s(i.node())}else o()},{passive:d}).on("touchend.eventRect",f=>{n.event=f,!i.empty()&&i.classed(Ie.eventRect)&&(e.hasArcType()||!e.toggleShape||n.cancelClick)&&n.cancelClick&&(n.cancelClick=!1)},{passive:d}),a.on("touchstart",f=>{n.event=f;const{target:g}=f;g&&g!==i.node()&&o()},{passive:d})},updateEventRect(e,t=!1){const n=this,{state:i,$el:a}=n,{eventReceiver:s,width:o,height:r,rendered:l,resizing:c}=i,u=e||a.eventRect,d=()=>{if(s){const h=ur(a.chart.node());s.rect=ht(u.node(),!0).toJSON(),s.rect.top+=h.y,s.rect.left+=h.x}};(!l||c||t)&&(u.attr("x",0).attr("y",0).attr("width",o).attr("height",r),(!l||t)&&u.classed(Ie.eventRect,!0)),d()},updateEventType(e){const t=this,n=tn(e),i=n?t.$el.eventRect:e,a=n?e!==(i==null?void 0:i.datum().multipleX):!1;i&&(a&&(i==null||i.on("mouseover mousemove mouseout click",null)),t.isMultipleX()?t.generateEventRectsForMultipleXs(i):t.generateEventRectsForSingleX(i))},updateEventRectData(){const e=this,{config:t,scale:n,state:i}=e,a=n.zoom||n.x,s=t.axis_rotated,o=e.isMultipleX(),r=a==null?void 0:a.domain(),l=r?`${r[0]}_${r[1]}_${i.width}_${i.height}_${e.data.targets.length}_${i.dataGeneration}_${[...i.hiddenTargetIds].join(",")}`:null;if(l&&l===i._eventRectFingerprint)return;i._eventRectFingerprint=l;let c,u,d,h;if(e.updateEventType(o),o)c=0,u=0,d=i.width,h=i.height;else{let p,_;if(e.axis.isCategorized())p=e.getEventRectWidth(),_=x=>a(x.x)-p/2;else{const x=({index:m})=>({prev:e.getPrevX(m),next:e.getNextX(m)});p=m=>{const v=x(m),b=a.domain();let y;return v.prev===null&&v.next===null?y=s?i.height:i.width:v.prev===null?y=(a(v.next)+a(m.x))/2:v.next===null?y=a(b[1])-(a(v.prev)+a(m.x))/2:y=Math.max(0,(a(v.next)-a(v.prev))/2),y},_=m=>{const v=x(m);let b;return v.prev===null&&v.next===null?b=0:v.prev===null?b=a(a.domain()[0]):b=(a(m.x)+a(v.prev))/2,b}}c=s?0:_,u=s?_:0,d=s?i.width:p,h=s?p:i.height}const{eventReceiver:f}=i,g=(p,_)=>z(p)?p(_):p;f.coords.splice(f.data.length),f.data.forEach((p,_)=>{f.coords[_]={x:g(c,p),y:g(u,p),w:g(d,p),h:g(h,p)}})},selectRectForSingle(e,t){var n,i,a,s,o,r,l;const c=this,{config:u,state:d,$el:{main:h,circle:f}}=c,g=u.data_selection_enabled,p=u.data_selection_grouped,_=u.data_selection_isselectable,x=u.tooltip_grouped,m=c.getAllValuesOnIndex(t);if(x&&(c.showTooltip(m,e),(n=c.showGridFocus)==null||n.call(c,m),(i=c.showSubchartGridFocus)==null||i.call(c,m),!g||p))return;!f&&h.selectAll(`.${j.EXPANDED}:not(.${At.shape}-${t})`).classed(j.EXPANDED,!1);const v=h.selectAll(`.${At.shape}-${t}`).classed(j.EXPANDED,!0).style("cursor",_?"pointer":null).filter(function(b){return c.isWithinShape(this,b)});if(v.call(b=>{var y,T,w;const C=b.data();g&&(p||_!=null&&_.bind(c.api)(C))&&(e.style.cursor="pointer"),x||(c.showTooltip(C,e),(y=c.showGridFocus)==null||y.call(c,C),(T=c.showSubchartGridFocus)==null||T.call(c,C),(w=c.unexpandCircles)==null||w.call(c),b.each(k=>c.setExpand(t,k.id)))}),!x&&v.empty()){const b=qt(d.event,e),y=m.filter(T=>c.isTargetToShow(T.id)?c.dist(T,b)<c.getPointSensitivity(T):!1);if(y.length>0){let T=y[0],w=c.dist(T,b);for(let C=1;C<y.length;C++){const k=y[C],S=c.dist(k,b);S<w&&(w=S,T=k)}c.showTooltip([T],e),(a=c.showGridFocus)==null||a.call(c,[T]),(s=c.showSubchartGridFocus)==null||s.call(c,[T]),(o=c.unexpandCircles)==null||o.call(c),c.setExpand(t,T.id,!0),g&&(p||_!=null&&_.bind(c.api)(T))&&(e.style.cursor="pointer")}else u.interaction_onout&&((r=c.hideGridFocus)==null||r.call(c),(l=c.hideSubchartGridFocus)==null||l.call(c),c.hideTooltip(),!p&&c.setExpand(t))}},selectRectForMultipleXs(e,t=!0){var n,i;const a=this,{config:s,state:o}=a,r=a.getTargetsToShow();if(o.dragging||a.hasArcType(r))return;const l=qt(o.event,e),c=a.findClosestFromTargets(r,l);if(t&&o.mouseover&&(!c||c.id!==o.mouseover.id)&&(s.data_onout.call(a.api,o.mouseover),o.mouseover=void 0),!c){a.unselectRect();return}const d=(a.isBubbleType(c)||a.isScatterType(c)||!s.tooltip_grouped?[c]:a.filterByX(r,c.x)).map(f=>a.addName(f));a.showTooltip(d,e),a.setExpand(c.index,c.id,!0),(n=a.showGridFocus)==null||n.call(a,d),(i=a.showSubchartGridFocus)==null||i.call(a,d);const h=a.dist(c,l);(a.isBarType(c.id)||h<a.getPointSensitivity(c))&&(a.$el.eventRect.style("cursor","pointer"),t&&(!o.mouseover||o.mouseover.x!==c.x||o.mouseover.id!==c.id)&&(s.data_onover.call(a.api,c),o.mouseover=c))},unselectRect(){var e,t,n,i;const a=this,{state:s,$el:{circle:o,tooltip:r}}=a;if(s._lastTooltipMouse=null,s.isCanvasMode){(e=a.clearCanvasFocus)==null||e.call(a),r&&a.hideTooltip();return}(t=a.$el.eventRect)==null||t.style("cursor",null),(n=a.hideGridFocus)==null||n.call(a),(i=a.hideSubchartGridFocus)==null||i.call(a),r&&(a.hideTooltip(),a._handleLinkedCharts(!1)),o&&!a.isPointFocusOnly()&&a.unexpandCircles(),a.expandBarTypeShapes(!1)},generateEventRectsForSingleX(e){const t=this,{config:n,state:i}=t,{eventReceiver:a}=i,s=e.style("cursor",n.data_selection_enabled&&n.data_selection_grouped?"pointer":null).on("click",function(o){i.event=o;const{currentIdx:r,data:l}=a,c=l[r===-1?t.getDataIndexFromEvent(o):r];t.clickHandlerForSingleX.bind(this)(c,t)}).datum({multipleX:!1});if(i.inputType==="mouse"){const o=r=>{const l=r?t.getDataIndexFromEvent(r):a.currentIdx;return l>-1?a.data[l]:null};s.on("mouseover",r=>{i.event=r,t.updateEventRect(),Object.values(t.$el.axisTooltip).forEach(l=>l==null?void 0:l.style("display",null))}).on("mousemove",function(r){const l=o(r);if(i.event=r,!l)return;let{index:c}=l;const u=n.line_step_type;if(n.line_step_tooltipMatch&&t.hasType("step")&&/^step\-(before|after)$/.test(u)){const h=t.scale.zoom||t.scale.x,f=t.axis.xs[c],g=h.invert(qt(r,this)[0]);u==="step-after"&&g<f?c-=1:u==="step-before"&&g>f&&(c+=1)}t.showAxisGridFocus();const d=n.tooltip_grouped&&c===a.currentIdx;if(i.dragging||i.flowing||t.hasArcType()||d){if(n.tooltip_show&&d){const[h,f]=qt(r,this),g=i._lastTooltipMouse;(!g||Zl(h-g[0],2)+Zl(f-g[1],2)>=9)&&(i._lastTooltipMouse=[h,f],t.setTooltipPosition())}return}c!==a.currentIdx&&(t.setOverOut(!1,a.currentIdx),a.currentIdx=c),c===-1?t.unselectRect():t.selectRectForSingle(this,c),t.setOverOut(c!==-1,c)}).on("mouseout",r=>{i.event=r,!(!t.config||t.hasArcType()||a.currentIdx===-1||!n.interaction_onout)&&(t.hideAxisGridFocus(),t.unselectRect(),t.setOverOut(!1,a.currentIdx),a.currentIdx=-1)})}return s},clickHandlerForSingleX(e,t){const n=t,{config:i,state:a,$el:{main:s}}=n;if(!e||n.hasArcType()||a.cancelClick){a.cancelClick&&(a.cancelClick=!1);return}const{index:o}=e;s.selectAll(`.${At.shape}-${o}`).each(function(r){var l;(i.data_selection_grouped||n.isWithinShape(this,r))&&((l=n.toggleShape)==null||l.call(n,this,r,o),i.data_onclick.bind(n.api)(r,this))})},generateEventRectsForMultipleXs(e){const t=this,{config:n,state:i}=t;e.on("click",function(a){i.event=a,t.clickHandlerForMultipleXS.bind(this)(t)}).datum({multipleX:!0}),i.inputType==="mouse"&&e.on("mouseover mousemove",function(a){i.event=a,t.selectRectForMultipleXs(this)}).on("mouseout",a=>{i.event=a,!(!t.config||t.hasArcType()||!n.interaction_onout)&&t.unselectRect()})},clickHandlerForMultipleXS(e){const t=e,{config:n,state:i}=t,a=t.getTargetsToShow();if(t.hasArcType(a))return;const s=qt(i.event,this),o=t.findClosestFromTargets(a,s);if(!o)return;const r=t.getPointSensitivity(o);(t.isBarType(o.id)||t.dist(o,s)<r)&&t.$el.main.selectAll(`.${At.shapes}${t.getTargetSelectorSuffix(o.id)}`).selectAll(`.${At.shape}-${o.index}`).each(function(){var l;(n.data_selection_grouped||t.isWithinShape(this,o))&&((l=t.toggleShape)==null||l.call(t,this,o,o.index),n.data_onclick.bind(t.api)(o,this))})}},nx={initClip(){const e=this,{clip:t,datetimeId:n}=e.state;t.id=`${n}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:n}=t;return!n.clipPath&&/-clip$/.test(e)||!n.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!n.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+s+10:i.bottom)+20,c=o?-(1+r):-(r-1),u=-15,d=o?i.left+20:a+10+r;e.attr("x",c).attr("y",u).attr("width",d).attr("height",l)},setYAxisClipPath(e){const t=this,{config:n,state:{margin:i,width:a,height:s}}=t,o=n.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=n.axis_y_inner,c=l&&!o?n.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),u=-(o?20:i.top),d=(o?a+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+s)+10;e.attr("x",c).attr("y",u).attr("width",d).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:n,xAxisHeight:i},$el:{defs:a}}=e,s=e.getHorizontalAxisHeight("x");if(a&&!n.idXAxisTickTexts){const o=`${n.id}-xaxisticktexts`;e.appendClip(a,o),n.idXAxisTickTexts=o,n.pathXAxisTickTexts=e.getClipPath(n.idXAxisTickTexts)}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&s!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=s},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:n}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const a=Math.sin(Math.PI/180*Math.abs(i));n.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/a}else n.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:n},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",n.maxTickSize.x.clipPath).attr("height",30)}},ix={getAxisSize(e){const t=this,n=t.config.axis_rotated;return n&&e==="x"||!n&&/y2?/.test(e)?t.getAxisWidthByAxisId(e,!0):t.getHorizontalAxisHeight(e)},getAxisWidthByAxisId(e,t){var n,i;const a=this;if(a.axis){const s=(n=a.axis)==null?void 0:n.getAxisLabelPosition(e),{width:o}=a.axis.getMaxTickSize(e,t),r=o===0?.5:0;return o+(((i=a.config.padding)==null?void 0:i.mode)==="fit"?s.isInner?10+r:10:s.isInner?20+r:40)}else return 40},getHorizontalAxisHeight(e){var t,n;const i=this,{config:a,state:s}=i,{rotatedPadding:o,isLegendRight:r,isLegendInset:l}=s,c=a.axis_rotated,u=((t=a.padding)==null?void 0:t.mode)==="fit",d=a[`axis_${e}_inner`],h=a[`axis_${e}_label`].text,f=13;let g=((n=a.padding)==null?void 0:n.mode)==="fit"?d&&!h?e==="y"?1:0:20:30;if(e==="x"&&!a.axis_x_show)return 8;if(e==="x"&&$(a.axis_x_height))return a.axis_x_height;if(e==="y"&&!a.axis_y_show)return a.legend_show&&!r&&!l?10:1;if(e==="y2"&&!a.axis_y2_show)return u?0:o.top;const p=i.axis.getMaxTickSize(e),_=Math.abs(a.axis_x_tick_rotate)>0&&(!a.axis_x_tick_autorotate||i.needToRotateXAxisTickTexts());return(a.axis_x_tick_multiline||_)&&p.height>f&&(g+=p.height-f),g+(i.axis.getAxisLabelPosition(e).isInner?0:10)+(e==="y2"&&!c?-10:0)},getEventRectWidth(){const e=this,{config:t,axis:n}=e,i=t.axis_x_inverted,a=n.x.tickInterval();return Math.max(0,i?Math.abs(a):a)},getAxisTickRotate(e){const t=this,{axis:n,config:i,state:a,$el:s}=t;let o=i[`axis_${e}_tick_rotate`];if(e==="x"){const r=n.isCategorized()||n.isTimeSeries();if(i.axis_x_tick_fit&&r){const l=i.axis_x_tick_count,c=a.current.maxTickSize.x.ticks.length;let u=0;if(l?u=l>c?c:l:c&&(u=c),u!==a.axis.x.tickCount){const{targets:d}=t.data;a.axis.x.padding=t.getXDomainPadding([t.getXDomainMinMax(d,"min"),t.getXDomainMinMax(d,"max")],u)}a.axis.x.tickCount=u}(s.svg||a.isCanvasMode)&&i.axis_x_tick_autorotate&&i.axis_x_tick_fit&&!i.axis_x_tick_multiline&&!i.axis_x_tick_culling&&r&&(o=t.needToRotateXAxisTickTexts()?i.axis_x_tick_rotate:0)}return o},needToRotateXAxisTickTexts(){const e=this,{state:{axis:t,current:n,isLegendRight:i,legendItemWidth:a}}=e,s=i&&a,o=n.width-s-e.getCurrentPaddingByDirection("left")-e.getCurrentPaddingByDirection("right"),r=t.x.tickCount+t.x.padding.left+t.x.padding.right,{width:l}=e.axis.getMaxTickSize("x"),c=r?o/r:0;return l>c}},ax={axis_x_clipPath:!0,axis_x_show:!0,axis_x_forceAsSingle:!1,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_culling_lines:!0,axis_x_tick_culling_reverse:!1,axis_x_tick_count:void 0,axis_x_tick_inner:!1,axis_x_tick_show:!0,axis_x_tick_text_show:!0,axis_x_tick_text_inner:!1,axis_x_tick_text_position:{x:0,y:0},axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_autorotate:!1,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_tick_tooltip:!1,axis_x_max:void 0,axis_x_min:void 0,axis_x_inverted:!1,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_x_axes:[]},sx={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_culling_reverse:!1,axis_y_tick_inner:!1,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},ox={axis_y2_clipPath:!0,axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_culling_reverse:!1,axis_y2_tick_inner:!1,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]},rx=Object.defineProperty,ql=Object.getOwnPropertySymbols,lx=Object.prototype.hasOwnProperty,cx=Object.prototype.propertyIsEnumerable,Jl=(e,t,n)=>t in e?rx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,us=(e,t)=>{for(var n in t||(t={}))lx.call(t,n)&&Jl(e,n,t[n]);if(ql)for(var n of ql(t))cx.call(t,n)&&Jl(e,n,t[n]);return e},ux=us(us(us({axis_evalTextSize:!0,axis_rotated:!1,axis_tooltip:!1},ax),sx),ox),dx={data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1};const hx=[S_,k_,A_],Ql={axis:Q_,clip:nx,eventrect:ex,sizeAxis:ix},tc={optDataAxis:dx,optAxis:ux};function ec(e){return Object.keys(e).map(t=>e[t])}function nc(e=[],t=[]){St(ge.prototype,ec(Ql).concat(e)),St(Ht.prototype,hx),cn.setOptions(ec(tc).concat(t))}function ni(e=[],t=[]){nc(e,t)}function Fe(e,t=[]){const n=Array.isArray(e)?e:e?[e]:[];nc([Rn,zi,w_].concat(n),[dn,C_].concat(t))}let ic=()=>(Fe(An,[Ln]),(ic=()=>I.AREA)()),ac=()=>(Fe(An,[Ln]),(ac=()=>I.AREA_LINE_RANGE)()),sc=()=>(Fe(An,[Ln]),(sc=()=>I.AREA_STEP_RANGE)()),oc=()=>(Fe(An,[Ln,ns]),(oc=()=>I.AREA_SPLINE)()),rc=()=>(Fe(An,[Ln,ns]),(rc=()=>I.AREA_SPLINE_RANGE)()),lc=()=>(Fe(An,[Ln]),(lc=()=>I.AREA_STEP)());function ds(e){const t=this.config.bar_connectLine,n=(t==null?void 0:t[e])||t;return/^(start|end)\-(start|end)$/.test(n)?n:null}var fx={initBar(){const{$el:e,config:t,state:{clip:n}}=this;e.bar=e.main.select(`.${j.chart}`),e.bar=t.bar_front?e.bar.append("g"):e.bar.insert("g",":first-child"),e.bar.attr("class",ie.chartBars).call(this.setCssRule(!1,`.${ie.chartBars}`,["pointer-events:none"])),t.clipPath===!1&&(t.bar_radius||t.bar_radius_ratio)&&e.bar.attr("clip-path",n.pathXAxis.replace(/#[^)]*/,`#${n.id}`))},updateTargetsForBar(e){const t=this,{config:n}=t,i=t.getClass("bars",!0),a=n.interaction_enabled&&n.data_selection_isselectable;Ha.call(t,e,{type:"Bar",elKey:"bar",containerClass:ie.chartBars,itemClass:ie.chartBar,initFn:t.initBar}).append("g").attr("class",i).style("cursor",o=>{var r;return(r=a==null?void 0:a.bind)!=null&&r.call(a,t.api)(o)?"pointer":null}).call(o=>{t.setCssRule(!0,` .${ie.bar}`,["fill"],t.color)(o),o.each(function(r){ds.call(t,r.id)&&(0,O.select)(this).append("path").attr("class",ie.barConnectLine)})})},updateBar(e,t=!1){const n=this;if(n.state.isCanvasMode)return;const{config:i,$el:a,$T:s}=n,o=t?a.subchart:a,r=n.getClass("bar",!0),l=n.initialOpacity.bind(n);i.bar_linearGradient&&n.updateLinearGradient();const c=o.main.selectAll(`.${ie.bars}`).selectAll(`.${ie.bar}`).data(n.labelishData.bind(n));s(c.exit(),e).style("opacity","0").remove(),o.bar=c.enter().append("path").attr("class",r).style("fill",n.generateUpdateBarColor()).merge(c).style("opacity",l),n.setRatioForGroupedData(o.bar.data())},generateUpdateBarColor(){const e=this,t=e.getStylePropValue(e.color)||(()=>null);return n=>Gr.call(e,n,"bar_linearGradient",t)},updateBarColor(e){return this.generateUpdateBarColor()(e)},redrawBar(e,t,n=!1){const i=this;if(i.state.isCanvasMode)return[];const{bar:a}=n?i.$el.subchart:i.$el,s=[],o=new Map,r=xi(i),l=i.generateUpdateBarColor(),c=function(d,h,f){var g;const _=$(d.value)||i.isBarRangeType(d)||((g=i.isSubchartCandlestickBarValue)==null?void 0:g.call(i,d,n))?e(d,h):[""];let x=o.get(d.id);if(x===void 0&&(x=ds.call(i,d.id),o.set(d.id,x)),_.length>1&&s.push(_[1]),h===f.length-1&&s.length){const m=i.$T((0,O.select)(this.parentNode.querySelector(`.${ie.barConnectLine}`)),t,xe());i.updateConnectLine(m,x,s),s.splice(0)}return _[0]},u=i.$T(a,t,xe());return r&&typeof u.attrTween=="function"?u.attrTween("d",function(d,h,f){var g;const p=c.call(this,d,h,f);return Td((g=this.getAttribute("d"))!=null?g:"",p)}):u.attr("d",c),[u.style("fill",d=>{var h;return((h=i.getSubchartCandlestickBarColor)==null?void 0:h.call(i,d,n))||l(d)}).style("clip-path",d=>d.clipPath).style("opacity",null)]},generateDrawBar(e,t){const n=this,{config:i}=n,a=n.generateGetBarPoints(e,t),s=xi(n),o=s?va(n):new Set,r=new Map;return(l,c)=>{const u=a(l,c),{indexX:d,indexY:h,isNegative:f,pos:g,radius:p,clipPath:_}=ba(n,l,u,s,o,n.isStackingRadiusData.bind(n)),x=["",""];if(l.clipPath=_,s){const y=`a${p} ${p} ${f?"1 0 0":"0 0 1"} `;x[h]=`${y}${p},${p}`,x[d]=`${y}${[-p,p][i.axis_rotated?"sort":"reverse"]()}`,f&&x.reverse()}const m=i.axis_rotated?`H${g} ${x[0]}V${u[2][h]-p} ${x[1]}H${u[3][d]}`:`V${g} ${x[0]}H${u[2][d]-p} ${x[1]}V${u[3][h]}`,v=[`M${u[0][d]},${u[0][h]}${m}z`];let b=r.get(l.id);return b===void 0&&(b=ds.call(n,l.id),r.set(l.id,b)),b&&v.push(i.axis_rotated?{x:u[0][d],y:u[0][h],width:u[0][d]-g,height:u[2][h]-u[0][h]}:{x:u[0][d],y:g,width:u[2][d]-u[0][d],height:u[3][h]-g}),v}},isStackingRadiusData(e){const t=this,{$el:n,config:i,data:a,state:s}=t,{id:o,index:r,value:l}=e;if(s.hiddenTargetIds.has(o)){const h=n.bar.filter(f=>f.id===o&&f.value===l);return!h.empty()&&/a\d+/i.test(h.attr("d"))}const c=i.data_groups.find(h=>h.indexOf(o)>-1),d=t.orderTargets(t.filterTargetsToShow(a.targets.filter(t.isBarType,t))).filter(h=>c.indexOf(h.id)>-1).map(h=>{const f=h.values[r];if(f&&($(l)&&l>0?f.value>0:f.value<0))return f}).filter(Boolean).map(h=>h.id);return l!==0&&d.indexOf(o)===d.length-1},updateConnectLine(e,t,n){const i=n.map((a,s,o)=>{const r=this.config.axis_rotated,l=/^start-(start|end)$/.test(t),c=/^end-(start|end)$/.test(t),u=[],d=r?c?a.x-a.width:a.x:a.x+a.width,h=r||l?a.y+a.height:a.y;return s===0?u.push(`${d},${h}`):(u.push(r?`L${a.x-(/\w+-end$/.test(t)?a.width:0)},${a.y}`:`L${a.x},${a.y+(/\w+-start$/.test(t)?a.height:0)}`),s<o.length-1&&u.push(`M${d},${h}`)),u.join(" ")});e.attr("d",`M${i.join("")}z`)}},gx={bar_connectLine:!1,bar_front:!1,bar_indices_removeNull:!1,bar_label_threshold:0,bar_linearGradient:!1,bar_overlap:!1,bar_padding:0,bar_radius:void 0,bar_radius_ratio:void 0,bar_sensitivity:2,bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0};let cc=()=>(ni([fx,Rn],[gx,dn]),(cc=()=>I.BAR)());var px={initBubble(){const e=this,{config:t}=e;e.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength(){const e=this,{width:t,height:n}=e.state,i=U.bubbleBaseLength;let a=e.cache.get(i);return a||e.cache.add(i,a=ue("min",[t,n])),a},getBubbleR(e){const t=this;let n=t.config.bubble_maxR;z(n)?n=n.bind(t.api)(e):$(n)||(n=t.getBaseLength()/(t.getMaxDataCount()*2)+12);const i=U.bubbleMaxValue;let a=t.cache.get(i);a===null&&t.cache.add(i,a=ue("max",t.getMinMaxData().max.map(r=>t.isBubbleZType(r)?t.getBubbleZData(r.value,"y"):tt(r.value)?r.value.mid:r.value)));const s=n*n*Math.PI,o=(t.isBubbleZType(e)?t.getBubbleZData(e.value,"z"):e.value)*(s/a);return Math.sqrt(o/Math.PI)},getBubbleZData(e,t){return tt(e)?e[t]:e[t==="y"?0:1]}},_x=px,xx={bubble_maxR:35,bubble_zerobased:!1};let uc=()=>(ni([Rn,zi,_x],[xx,dn]),(uc=()=>I.BUBBLE)());var mx=Object.defineProperty,dc=Object.getOwnPropertySymbols,vx=Object.prototype.hasOwnProperty,bx=Object.prototype.propertyIsEnumerable,hc=(e,t,n)=>t in e?mx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yx=(e,t)=>{for(var n in t||(t={}))vx.call(t,n)&&hc(e,n,t[n]);if(dc)for(var n of dc(t))bx.call(t,n)&&hc(e,n,t[n]);return e},Tx={generateGetCandlestickPoints(e,t=!1){const n=this,i=t?n.axis.subX:n.axis.x,a=n.getIndicesMax(e)+1,s=n.getBarW("candlestick",i,a),o=n.getShapeX(s,e,!!t),r=n.getShapeY(!!t),l=n.getShapeOffset(n.isCandlestickType,e,!!t),c=n.getYScaleById.bind(n);return(u,d)=>{const h=c.call(n,u.id,t)(n.getShapeYMin(u.id,t)),f=l(u,d)||h,g=$(s)?s:s[u.id]||s._$width,p=n.getCandlestickData(u);let _;if(p&&$(p.open)&&$(p.close)){const x={start:o(u),end:0};x.end=x.start+g;const m={start:r(p.open),end:r(p.close)},v={x:x.start+g/2,high:r(p.high),low:r(p.low)},b=h-f;m.start-=b,m.end-=b,v.high-=b,v.low-=b,_=[[x.start,m.start],[x.end,m.end],[v.x,v.low,v.high]]}else _=[[0,0],[0,0],[0,0,0]];return _}},getCandlestickData({value:e}){let t;if(ot(e)){const[n,i,a,s,o=!1]=e;t={open:n,high:i,low:a,close:s},o!==!1&&(t.volume=o)}else tt(e)&&(t=yx({},e));return t&&(t._isUp=t.close>=t.open),t||null}},wx=Object.defineProperty,Cx=Object.defineProperties,Sx=Object.getOwnPropertyDescriptors,fc=Object.getOwnPropertySymbols,kx=Object.prototype.hasOwnProperty,Ax=Object.prototype.propertyIsEnumerable,gc=(e,t,n)=>t in e?wx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lx=(e,t)=>{for(var n in t||(t={}))kx.call(t,n)&&gc(e,n,t[n]);if(fc)for(var n of fc(t))Ax.call(t,n)&&gc(e,n,t[n]);return e},Rx=(e,t)=>Cx(e,Sx(t)),Ex=Rx(Lx({},Tx),{initCandlestick(){Vr.call(this,{elKey:"candlestick",className:De.chartCandlesticks})},updateTargetsForCandlestick(e){Ha.call(this,e,{type:"Candlestick",elKey:"candlestick",containerClass:De.chartCandlesticks,itemClass:De.chartCandlestick,initFn:this.initCandlestick,withFocus:!1,withStyles:!1}).style("pointer-events","none")},updateCandlestick(e,t=!1){const n=this,{$el:i,$T:a}=n,s=t?i.subchart:i,o=n.getClass("candlestick",!0),r=n.initialOpacity.bind(n),l=s.main.selectAll(`.${De.chartCandlestick}`).selectAll(`.${De.candlestick}`).data(n.labelishData.bind(n));a(l.exit(),e).style("opacity","0").remove();const c=l.enter().filter(u=>u.value).append("g").attr("class",o);c.append("line"),c.append("path"),s.candlestick=l.merge(c).style("opacity",r)},generateDrawCandlestick(e,t){const n=this,{config:i}=n,a=n.generateGetCandlestickPoints(e,t),s=i.axis_rotated,o=i.candlestick_color_down;return(r,l,c)=>{const u=a(r,l),d=n.getCandlestickData(r),h=d==null?void 0:d._isUp,f=+s,g=+!f;c.classed&&c.classed(De[h?"valueUp":"valueDown"],!0);const p=s?`H${u[1][1]} V${u[1][0]} H${u[0][1]}`:`V${u[1][1]} H${u[1][0]} V${u[0][1]}`;c.select("path").attr("d",`M${u[0][f]},${u[0][g]}${p}z`).style("fill",m=>(h?n.color(m):tt(o)?o[m.id]:o)||n.color(m));const _=c.select("line"),x=s?{x1:u[2][1],x2:u[2][2],y1:u[2][0],y2:u[2][0]}:{x1:u[2][0],x2:u[2][0],y1:u[2][1],y2:u[2][2]};for(const m in x)_.attr(m,x[m])}},redrawCandlestick(e,t,n=!1){const i=this,{$el:a,$T:s}=i,{candlestick:o}=n?a.subchart:a,r=xe(!0);return[o.each(function(l,c){const u=s((0,O.select)(this),t,r);e(l,c,u)}).style("opacity",null)]}}),Px={candlestick_width:void 0,candlestick_width_ratio:.6,candlestick_width_max:void 0,candlestick_color_down:"red"};let pc=()=>(ni([Ex,Rn],[Px,dn]),(pc=()=>I.CANDLESTICK)());var Yi={arc_cornerRadius:0,arc_cornerRadius_ratio:0,arc_needle_show:!1,arc_needle_color:void 0,arc_needle_value:void 0,arc_needle_path:void 0,arc_needle_length:100,arc_needle_top_rx:0,arc_needle_top_ry:0,arc_needle_top_width:0,arc_needle_bottom_rx:1,arc_needle_bottom_ry:1,arc_needle_bottom_width:15,arc_needle_bottom_len:0,arc_rangeText_values:void 0,arc_rangeText_unit:"absolute",arc_rangeText_fixed:!1,arc_rangeText_format:void 0,arc_rangeText_position:void 0},Dx={donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_label_line:!1,donut_label_image:void 0,donut_label_ratio:void 0,donut_width:void 0,donut_title:"",donut_expand:{},donut_expand_rate:.98,donut_expand_duration:50,donut_padAngle:0,donut_startingAngle:0},_c=bt(10);const Ix=15,xc=20,mc=.35;function Mx(e=!1){const t=this;return["donut","pie","polar","gauge"].find(n=>t.hasType(n)&&!(n==="gauge"&&e&&t.hasMultiArcGauge()))}function vc(){const e=this,{config:t}=e,n=Mx.call(e,!0),i=n&&t[`${n}_label_line`],a=Kt(i),s=(l,c,u)=>u,o={show:i===!0||a&&(i==null?void 0:i.show)!==!1,distance:a&&(i==null?void 0:i.distance)||xc};if(i===!0)return{chartType:n,line:o,text:{formatter:s}};if(!a)return{chartType:n,line:{show:!1,distance:xc},text:{formatter:null}};let r=s;return z(i.text)?r=i.text:i.text===!1&&(r=null),{chartType:n,line:o,text:{formatter:r}}}function Fx(e,t){const n=this,{state:i}=n,a=n.updateAngle(e);if(!a)return null;let{outerRadius:s}=n.getRadius(e),o=s;n.hasType("polar")&&(o=n.getPolarOuterRadius(e,s),s=i.radius);let r=(a.startAngle+a.endAngle)/2;Math.abs(a.endAngle-a.startAngle-2*Math.PI)<.01&&(r=Math.PI/2);const c=Math.sin(r),u=-Math.cos(r),d={x:c*o,y:u*o},h=s+Ix,f={x:c*h,y:u*h},g=c>=0,p={x:f.x+t*(g?1:-1),y:f.y};return{startPoint:d,breakPoint:f,endPoint:p,isRight:g,midAngle:r}}function bc(){return vc.call(this).line.show}function Ox(e){const t=this,{$el:{arcs:n},$T:i}=t,{line:a,text:s}=vc.call(t),o=a.distance;let r=null;n.selectAll(`.${at.chartArc}`).each(function(l){var c,u,d;const h=(0,O.select)(this),f=Fx.call(t,l,o),{ratio:g,meetsThreshold:p,updated:_}=(c=l._cache)!=null?c:{};if(!_||!f)return;const x=t.isTargetToShow(l.data.id)&&p,{startPoint:m,breakPoint:v,endPoint:b,isRight:y}=f,T=`${m.x},${m.y} ${v.x},${v.y} ${b.x},${b.y}`;if(a.show){let C=h.select(`.${at.arcLabelLine}`);C.empty()&&(C=h.append("polyline").attr("class",at.arcLabelLine)),i(C,e).attr("points",T).style("stroke",t.color(l.data)).style("opacity",x?null:"0")}let w=h.select(`.${at.arcLabelLineText}`);if(w.empty()&&(w=h.append("text").attr("class",at.arcLabelLineText).style("pointer-events","none")),x){const{value:C}=_,{id:k}=l.data,S=((d=(u=s.formatter)!=null?u:t.getArcLabelConfig("format"))!=null?d:t.defaultArcValueFormat)(C,g,k).toString();Cn(w,S,[-1,1],!1);const A={x:b.x+5*(y?1:-1),y:b.y};w.style("text-anchor",y?"start":"end");const L=w.node(),E=L==null?void 0:L.querySelectorAll("tspan");if(r===null&&(r=parseFloat(N.getComputedStyle(L).fontSize)||12),E&&E.length>1){const R=(E.length-3)/2;A.y+=(-R+mc)*r}else A.y+=mc*r;i(w,e).attr("transform",`translate(${A.x},${A.y})`).style("opacity",null).style("fill",t.updateTextColor.bind(t)(l))}else i(w,e).style("opacity","0")})}var $x=Object.defineProperty,Bx=Object.defineProperties,zx=Object.getOwnPropertyDescriptors,yc=Object.getOwnPropertySymbols,Nx=Object.prototype.hasOwnProperty,Xx=Object.prototype.propertyIsEnumerable,Tc=(e,t,n)=>t in e?$x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gx=(e,t)=>{for(var n in t||(t={}))Nx.call(t,n)&&Tc(e,n,t[n]);if(yc)for(var n of yc(t))Xx.call(t,n)&&Tc(e,n,t[n]);return e},Vx=(e,t)=>Bx(e,zx(t));const hs=["donut","gauge","pie","polar"];function Wx(e){return["donut","pie","polar","gauge"].find(t=>e.hasType(t))}function Yx(e,t,n,i){var a,s;const{config:o,state:{radiusExpanded:r}}=e,l=n.endAngle-Math.PI/2,c=Math.sin(l),u={x:Math.cos(l)*(r+(i?5:25)),y:c*(r+15-Math.abs(c*10))+3};if(i){const d=o.arc_rangeText_position;if(d){const h=o.arc_rangeText_values,f=z(d)?d(h[t.index]):d;u.x+=(a=f==null?void 0:f.x)!=null?a:0,u.y+=(s=f==null?void 0:f.y)!=null?s:0}}return u}function Hx(e,t,n,i){const{config:a}=e,s=Wx(e);let o=s?a[`${s}_label_ratio`]:void 0;if(o)o=z(o)?o.bind(e.api)(t,n,i):o;else{const d=36/n,h=d>.375;o=n&&i?(h?1.175-d:.8)*n/i:0}return o}function jx(e,t,n){let{outerRadius:i}=e.getRadius(t);e.hasType("polar")&&(i=e.getPolarOuterRadius(t,i));const[a,s]=e.svgArc.centroid(n).map(l=>isNaN(l)?0:l),o=Math.sqrt(a*a+s*s),r=Hx(e,t,i,o);return{pos:{x:a,y:s},ratio:r}}function wc(e=0){const t=this,{config:n,state:i}=t,a=t.hasMultiArcGauge(),s=i.gaugeArcWidth/t.getTargetsToShow().length,o=e?Math.min(i.radiusExpanded*e-i.radius,s*.8-(1-e)*100):0;return{inner(r){const{innerRadius:l}=t.getRadius(r);return a?i.radius-s*(r.index+1):$(l)?l:0},outer(r){const{outerRadius:l}=t.getRadius(r);let c;if(a)c=i.radius-s*r.index+o;else if(t.hasType("polar")&&!e)c=t.getPolarOuterRadius(r,l);else if(c=l,e){let{radiusExpanded:u}=i;i.radius!==l&&(u-=Math.abs(i.radius-l)),c=u*e}return c},corner(r,l){const{arc_cornerRadius_ratio:c=0,arc_cornerRadius:u=0}=n,{data:{id:d},value:h}=r;let f;return c?f=c*l:f=$(u)?u:u.call(t.api,d,h,l),f}}}function fs(e){return function(t){const n=({startAngle:a=0,endAngle:s=0,padAngle:o=0})=>({startAngle:a,endAngle:s,padAngle:o}),i=(0,_c.interpolate)(n(this._current),n(t));return this._current=t,function(a){const s=i(a),{data:o,index:r,value:l}=t;return e(Vx(Gx({},s),{data:o,index:r,value:l}))}}}var Ux={initPie(){const e=this,{config:t}=e,n=t.data_type,i=t[`${n}_padding`],a=t[`${n}_startingAngle`]||0,s=(i?i*.01:t[`${n}_padAngle`])||0;e.pie=(0,pt.pie)().startAngle(a).endAngle(a+2*Math.PI).padAngle(s).value(o=>{var r,l;return(l=(r=o.values)==null?void 0:r.reduce((c,u)=>c+u.value,0))!=null?l:o}).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius(){const e=this,{config:t,state:n}=e,i=t.data_type,a=t[`${i}_padding`],s=t.gauge_width||t.donut_width,o=e.getTargetsToShow().length*t.gauge_arcs_minWidth,r=.85,l=bc.call(e)?r:1;n.radiusExpanded=Math.min(n.arcWidth,n.arcHeight)/2*(e.hasMultiArcGauge()&&t.gauge_label_show?r:l),n.radius=n.radiusExpanded*.95,n.innerRadiusRatio=s?(n.radius-s)/n.radius:.6,n.gaugeArcWidth=s||(o<=n.radius-n.innerRadius?n.radius-n.innerRadius:o<=n.radius?o:n.radius);const c=t.pie_innerRadius||(a?a*(n.innerRadiusRatio+.1):0);n.outerRadius=t.pie_outerRadius,n.innerRadius=e.hasType("donut")||e.hasType("gauge")?n.radius*n.innerRadiusRatio:c},getRadius(e){const t=this,n=e==null?void 0:e.data;let{innerRadius:i,outerRadius:a}=t.state;return!$(i)&&n&&(i=i[n.id]||0),tt(a)&&n&&n.id in a?a=a[n.id]:$(a)||(a=t.state.radius),{innerRadius:i,outerRadius:a}},updateArc(){const e=this;e.updateRadius(),e.svgArc=e.getSvgArc(),e.svgArcExpanded=e.getSvgArcExpanded()},getArcLength(){const e=this,{config:t}=e,n=t.gauge_arcLength*3.6;let i=2*(n/360);return n<-360?i=-2:n>360&&(i=2),i*Math.PI},getStartingAngle(){const e=this,{config:t}=e,n=t.data_type,i=e.hasType("gauge")?t.gauge_fullCircle:!1,a=-1*Math.PI/2,s=Math.PI/2;let o=t[`${n}_startingAngle`]||0;return!i&&o<=a?o=a:!i&&o>=s?o=s:(o>Math.PI||o<-1*Math.PI)&&(o=Math.PI),o},updateAngle(e,t=!1){var n;const i=this,{config:a,state:s}=i,o=t&&i.hasType("gauge");let{pie:r}=i,l=e,c=!1;if(!a)return null;const u=i.getStartingAngle(),d=a.gauge_fullCircle||t&&!o?i.getArcLength():u*-2,h=l.data&&i.isGaugeType(l.data)&&!i.hasMultiArcGauge();if(h){const{gauge_min:f,gauge_max:g}=a,p=i.getTotalDataSum(s.rendered),_=d*((p-f)/(g-f));r=r.startAngle(u).endAngle(_+u)}if(t===!1){let f;if(h)f=r(i.filterTargetsToShow());else{const g="$arcPieLayout";let p=i.cache.get(g);(!p||p.generation!==s.redrawGeneration)&&(p={generation:s.redrawGeneration,layout:r(i.filterTargetsToShow())},i.cache.add(g,p)),f=p.layout}f.forEach((g,p)=>{var _;!c&&g.data.id===((_=l.data)==null?void 0:_.id)&&(c=!0,l=g,l.index=p)})}if(isNaN(l.startAngle)&&(l.startAngle=0),isNaN(l.endAngle)&&(l.endAngle=l.startAngle),t||l.data&&(a.gauge_enforceMinMax||i.hasMultiArcGauge())){const{gauge_min:f,gauge_max:g}=a,p=t&&!o?i.getTotalDataSum(s.rendered):g,_=d/(p-f),x=(n=l.value)!=null?n:0,m=x<f?0:x<p?x-f:p-f;l.startAngle=u,l.endAngle=u+_*m}return c||t?l:null},getSvgArc(){const e=this,{inner:t,outer:n,corner:i}=wc.call(e),a=(0,pt.arc)().innerRadius(t).outerRadius(n),s=function(o,r){var l;let c="M 0 0";if(o.value||o.data){const u=r?o:(l=e.updateAngle(o))!=null?l:null;u&&(c=a.cornerRadius(i(u,n(u)))(u))}return c};return s.centroid=a.centroid,s},getSvgArcExpanded(e=1){const t=this,{inner:n,outer:i,corner:a}=wc.call(t,e),s=(0,pt.arc)().innerRadius(n).outerRadius(i);return o=>{const r=t.updateAngle(o),l=i(r);let c=0;return r&&(c=a(r,l)),r&&s.cornerRadius(c)(r)||"M 0 0"}},getArc(e,t,n){return n||this.isArcType(e.data)?this.svgArc(e,t):"M 0 0"},redrawArcRangeText(){const e=this,{config:t,$el:{arcs:n},state:i,$T:a}=e,s=t.arc_rangeText_format,o=e.hasType("gauge")&&t.arc_rangeText_fixed;let r=t.arc_rangeText_values;if(r!=null&&r.length){const l=t.arc_rangeText_unit==="%",c=e.getTotalDataSum(i.rendered);l&&(r=r.map(h=>c/100*h));const u=e.pie(r).map((h,f)=>(h.index=f,h));let d=n.selectAll(`.${at.arcRange}`).data(r);d.exit().remove(),d=a(d.enter().append("text").attr("class",at.arcRange).style("text-anchor","middle").style("pointer-events","none").style("opacity","0").text(h=>{const f=l?h/c*100:h;return z(s)?s(f):`${f}${l?"%":""}`}).merge(d)),(!i.rendered||i.rendered&&!o)&&c>0&&d.attr("transform",function(h,f){return e.transformForArcLabel(this,u[f],!0)}),d.style("opacity",h=>!o&&(h>c||c===0)?"0":null)}},transformForArcLabel(e,t,n=!1){const i=this,a=i.updateAngle(t,n);if(!a)return"";let s,o=1;if(n||i.hasMultiArcGauge())s=Yx(i,t,a,n);else if(!i.hasType("gauge")||i.data.targets.length>1){const r=jx(i,t,a);s=r.pos,o=r.ratio}else return"";return Br.call(i,e,s),`translate(${s.x*o},${s.y*o})`},convertToArcData(e){return this.addName({id:"data"in e?e.data.id:e.id,value:e.value,ratio:this.getRatio("arc",e),index:e.index})},textForArcLabel(e){var t;const n=this,i=n.hasType("gauge"),a=(t=hs.filter(n.hasType.bind(n)))==null?void 0:t[0];n.shouldShowArcLabel()&&e.style("fill",n.updateTextColor.bind(n)).attr("filter",s=>n.updateTextBGColor.bind(n)(s,n.config.data_labels_backgroundColors)).each(function(s){const o=(0,O.select)(this),r=n.updateAngle(s),l=n.getRatio("arc",r),c=Va.call(n,l,a);if(s._cache={updated:r,ratio:l,meetsThreshold:c},c){const{value:u}=r||s,d=(n.getArcLabelConfig("format")||n.defaultArcValueFormat)(u,l,s.data.id).toString();Cn(o,d,[-1,1],i)}else o.text("")})},expandArc(e){const t=this,{state:{transiting:n},$el:i}=t;if(n){const s=setInterval(()=>{t.state.transiting||(clearInterval(s),i.legend.selectAll(`.${lt.legendItemFocused}`).size()>0&&t.expandArc(e))},10);return}const a=t.mapToTargetIds(e);i.svg.selectAll(t.selectorTargets(a,`.${at.chartArc}`)).each(function(s){if(!t.shouldExpand(s.data.id))return;const o=t.getExpandConfig(s.data.id,"duration"),r=t.getSvgArcExpanded(t.getExpandConfig(s.data.id,"rate"));(0,O.select)(this).selectAll("path").transition().duration(o).attrTween("d",fs(t.svgArcExpanded.bind(t))).transition().duration(o*2).attrTween("d",fs(r.bind(t)))})},unexpandArc(e){const t=this,{state:{transiting:n},$el:{svg:i}}=t;if(n)return;const a=t.mapToTargetIds(e);i.selectAll(t.selectorTargets(a,`.${at.chartArc}`)).selectAll("path").transition().duration(s=>t.getExpandConfig(s.data.id,"duration")).attrTween("d",fs(t.svgArc.bind(t))),i.selectAll(`${at.arc}`).style("opacity",null)},getExpandConfig(e,t){const n=this,{config:i}=n,a={duration:50,rate:.98};let s;return n.isDonutType(e)?s="donut":n.isGaugeType(e)?s="gauge":n.isPieType(e)&&(s="pie"),s?i[`${s}_expand_${t}`]:a[t]},shouldExpand(e){const t=this,{config:n}=t,i=t.isDonutType(e)?"donut":t.isGaugeType(e)?"gauge":t.isPieType(e)?"pie":null;return i?!!n[`${i}_expand`]:!1},shouldShowArcLabel(){const e=this,{config:t}=e;return hs.some(n=>e.hasType(n)&&t[`${n}_label_show`])},getArcLabelConfig(e="format"){const t=this,{config:n}=t;let i=a=>a;return hs.filter(t.hasType.bind(t)).forEach(a=>{i=n[`${a}_label_${e}`]}),e==="format"&&z(i)?i.bind(t.api):i},updateTargetsForArc(e){const t=this,{$el:n}=t,i=t.hasType("gauge"),a=t.getChartClass("Arc"),s=t.getClass("arcs",!0),o=t.classFocus.bind(t),r=n.main.select(`.${at.chartArcs}`),l=r.selectAll(`.${at.chartArc}`).data(t.pie(e)).attr("class",u=>a(u)+o(u.data)),c=l.enter().append("g").attr("class",a).call(this.setCssRule(!1,`.${at.chartArcs} text`,["pointer-events:none","text-anchor:middle"]));c.append("g").attr("class",s).merge(l),c.append("text").attr("dy",i&&!t.hasMultiTargets()?"-.1em":null).style("opacity","0").style("text-anchor",t.getStylePropValue("middle")).style("pointer-events",t.getStylePropValue("none")),n.text=r.selectAll(`.${j.target} text`)},initArc(){const e=this,{$el:t}=e;t.arcs=t.main.select(`.${j.chart}`).append("g").attr("class",at.chartArcs).attr("transform",e.getTranslate("arc")),e.setArcTitle()},setArcTitle(e){const t=this,n=e||t.getArcTitle(),i=t.hasType("gauge");if(n){const a=i?ae.chartArcsGaugeTitle:at.chartArcsTitle;let s=t.$el.arcs.select(`.${a}`);s.empty()&&(s=t.$el.arcs.append("text").attr("class",a).style("text-anchor","middle")),i&&s.attr("dy","-0.3em"),Cn(s,n,i?void 0:[-.6,1.35],!0)}},getArcTitle(){const e=this,t=e.hasType("donut")&&"donut"||e.hasType("gauge")&&"gauge";return t?e.config[`${t}_title`]:""},getArcTitleWithNeedleValue(){const e=this,{config:t,state:n}=e,i=e.getArcTitle();if(i&&e.config.arc_needle_show&&/{=[A-Z_]+}/.test(i)){let a=n.current.needle;return $(a)||(a=t.arc_needle_value),an(i,{NEEDLE_VALUE:~~a})}return!1},redrawArc(e,t,n){const i=this,{config:a,state:s,$el:{main:o}}=i,r=a.interaction_enabled,l=r&&a.data_selection_isselectable;let c=o.selectAll(`.${at.arcs}`).selectAll(`.${at.arc}`).data(i.arcData.bind(i));c.exit().transition().duration(t).style("opacity","0").remove(),c=c.enter().append("path").attr("class",i.getClass("arc",!0)).style("fill",u=>i.color(u.data)).style("cursor",u=>{var d;return(d=l==null?void 0:l.bind)!=null&&d.call(l,i.api)(u)?"pointer":null}).style("opacity","0").each(function(u){i.isGaugeType(u.data)&&(u.startAngle=a.gauge_startingAngle,u.endAngle=a.gauge_startingAngle),this._current=u}).merge(c),i.hasType("gauge")&&(i.updateGaugeMax(),i.hasMultiArcGauge()&&i.redrawArcGaugeLine()),c.attr("transform",u=>!i.isGaugeType(u.data)&&n?"scale(0)":"").style("opacity",function(u){return u===this._current?"0":null}).each(()=>{s.transiting=!0}).transition().duration(e).attrTween("d",function(u){const d=i.updateAngle(u);if(!d)return()=>"M 0 0";isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const h=(0,_c.interpolate)(this._current,d);return this._current=h(0),function(f){const g=h(f);return g.data=u.data,i.getArc(g,!0)}}).attr("transform",n?"scale(1)":"").style("fill",u=>{let d;return i.levelColor?(d=i.levelColor(u.data.values[0].value),a.data_colors[u.data.id]=d):d=i.color(u.data),d}).style("opacity",null).call(li,function(){if(i.levelColor){const u=(0,O.select)(this),d=u.datum(this._current);i.updateLegendItemColor(d.data.id,u.style("fill"))}s.transiting=!1,s.redrawing&&(s.redrawing=!1,s._targetsToShow=null,s._cachedDrawShape=null),Y(a.onrendered,i.api)}),r&&i.bindArcEvent(c),i.hasType("polar")&&i.redrawPolar(),i.hasType("gauge")&&i.redrawBackgroundArcs(),a.arc_needle_show&&i.redrawNeedle(),i.redrawArcText(e),i.redrawArcRangeText()},redrawNeedle(){const e=this,{$el:t,config:n,state:{hiddenTargetIds:i,radius:a}}=e,s=(a-1)/100*n.arc_needle_length,o=i.size!==e.data.targets.length;let r=e.$el.arcs.select(`.${at.needle}`);const l=n.arc_needle_path,c=n.arc_needle_bottom_width/2,u=n.arc_needle_top_width/2,d=n.arc_needle_top_rx,h=n.arc_needle_top_ry,f=n.arc_needle_bottom_len,g=n.arc_needle_bottom_rx,p=n.arc_needle_bottom_ry,_=e.getNeedleAngle(),x=()=>{const m=e.getArcTitleWithNeedleValue();m&&e.setArcTitle(m)};if(x(),r.empty()&&(r=t.arcs.append("path").classed(at.needle,!0),t.needle=r,t.needle.updateHelper=(m,v=!1)=>{t.needle.style("display")!=="none"&&e.$T(t.needle).style("transform",`rotate(${e.getNeedleAngle(m)}deg)`).call(li,()=>{v&&(n.arc_needle_value=m),x()})}),o){const m=z(l)?l.call(e,s):`M-${c} ${f} A${g} ${p} 0 0 0 ${c} ${f} L${u} -${s} A${d} ${h} 0 0 0 -${u} -${s} L-${c} ${f} Z`;e.$T(r).attr("d",m).style("fill",n.arc_needle_color).style("display",null).style("transform",`rotate(${_}deg)`)}else r.style("display","none")},getNeedleAngle(e){const t=this,{config:n,state:i}=t,a=t.getArcLength(),s=t.hasType("gauge"),o=t.getTotalDataSum(!0);let r=ct(e)?e:n.arc_needle_value,l=n[`${n.data_type}_startingAngle`]||0,c;if($(r)||(r=s&&t.data.targets.length===1?o:0),i.current.needle=r,s){l=t.getStartingAngle();const u=n.gauge_fullCircle?a:l*-2,{gauge_min:d,gauge_max:h}=n;c=u*((r-d)/(h-d))}else c=o?a*(r/o):0;return(l+c)*(180/Math.PI)},redrawBackgroundArcs(){const e=this,{config:t,state:n}=e,i=e.hasMultiArcGauge(),a=t.gauge_fullCircle,s=e.getTargetsToShow().length===0&&!!t.data_empty_label_text,o=e.getStartingAngle(),r=a?o+e.getArcLength():o*-1;let l=e.$el.arcs.select(`${i?"g":""}.${at.chartArcsBackground}`);if(i){let c=0;l=l.selectAll(`path.${at.chartArcsBackground}`).data(e.data.targets),l.enter().append("path").attr("class",(u,d)=>`${at.chartArcsBackground} ${at.chartArcsBackground}-${d}`).merge(l).style("fill",t.gauge_background||null).attr("d",({id:u})=>{if(s||n.hiddenTargetIds.has(u))return"M 0 0";const d={data:[{value:t.gauge_max}],startAngle:o,endAngle:r,index:c++};return e.getArc(d,!0,!0)}),l.exit().remove()}else l.attr("d",s?"M 0 0":()=>{const c={data:[{value:t.gauge_max}],startAngle:o,endAngle:r};return e.getArc(c,!0,!0)})},bindArcEvent(e){const t=this,{config:n,state:i}=t,a=i.inputType==="touch",s=i.inputType==="mouse",o=c=>{const u=t.updateAngle(c);return u?t.convertToArcData(u):null};function r(c,u,d){t.expandArc(d),t.api.focus(d),t.toggleFocusLegend(d,!0),t.showTooltip([u],c)}function l(c){const u=(c==null?void 0:c.id)||void 0;t.unexpandArc(u),t.api.revert(),t.revertLegend(),t.hideTooltip()}if(e.on("click",function(c,u,d){var h;const f=o(u);f&&((h=t.toggleShape)==null||h.call(t,this,f,d),n.data_onclick.bind(t.api)(f,this))}),s&&e.on("mouseover",function(c,u){if(i.transiting)return;i.event=c;const d=o(u),h=(d==null?void 0:d.id)||void 0;r(this,d,h),t.setOverOut(!0,d)}).on("mouseout",(c,u)=>{if(i.transiting||!n.interaction_onout)return;i.event=c;const d=o(u);l(),t.setOverOut(!1,d)}).on("mousemove",function(c,u){const d=o(u);i.event=c,t.showTooltip([d],this)}),a&&t.hasArcType()&&!t.radars){const c=u=>{var d,h;const{clientX:f,clientY:g}=(h=(d=u.changedTouches)==null?void 0:d[0])!=null?h:{clientX:0,clientY:0};return(0,O.select)(nt.elementFromPoint(f,g))};t.$el.svg.on("touchstart touchmove",function(u){if(i.transiting)return;i.event=u;const h=c(u).datum(),f=h!=null&&h.data&&h.data.id?t.updateAngle(h):null,g=f?t.convertToArcData(f):null,p=(g==null?void 0:g.id)||void 0;t.callOverOutForTouch(g),Ct(p)?l():r(this,g,p)},{passive:!0})}},redrawArcText(e){const t=this,{config:n,state:i,$el:{main:a,arcs:s}}=t,o=t.hasType("gauge"),r=t.hasMultiArcGauge();let l;if(o&&t.data.targets.length===1&&n.gauge_title||(l=a.selectAll(`.${at.chartArc}`).select("text").style("opacity","0").attr("class",c=>t.isGaugeType(c.data)?ae.gaugeValue:null).call(t.textForArcLabel.bind(t)).style("font-size",c=>t.isGaugeType(c.data)&&t.data.targets.length===1&&!r?`${Math.round(i.radius/5)}px`:null),$r.call(t),l.attr("transform",function(c){return t.transformForArcLabel.bind(t)(this,c)}).transition().duration(e).style("opacity",c=>t.isTargetToShow(c.data.id)&&t.isArcType(c.data)?null:"0"),r&&l.attr("dy","-.1em")),a.select(`.${at.chartArcsTitle}`).style("opacity",t.hasType("donut")||o?null:"0"),o){const c=n.gauge_fullCircle;c&&(l==null||l.attr("dy",`${r?0:Math.round(i.radius/14)}`)),n.gauge_label_show&&(s.select(`.${ae.chartArcsGaugeUnit}`).attr("dy",`${c?1.5:.75}em`).text(n.gauge_units),s.select(`.${ae.chartArcsGaugeMin}`).attr("dx",`${-1*(i.innerRadius+(i.radius-i.innerRadius)/(c?1:2))}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_min,!1)),!c&&s.select(`.${ae.chartArcsGaugeMax}`).attr("dx",`${i.innerRadius+(i.radius-i.innerRadius)/2}px`).attr("dy","1.2em").text(t.textForGaugeMinMax(n.gauge_max,!0)))}bc.call(t)&&Ox.call(t,e)},getArcElementByIdOrIndex(e){const t=this,{$el:{arcs:n}}=t,i=$(e)?a=>a.index===e:a=>a.data.id===e;return n==null?void 0:n.selectAll(`.${j.target} path`).filter(i)}};function Pn(e,t){St(ge.prototype,[Ux,Rn].concat(e||[])),cn.setOptions([dn].concat(t||[]))}let Cc=()=>(Pn(void 0,[Yi,Dx]),(Cc=()=>I.DONUT)());var Kx=Object.defineProperty,Sc=Object.getOwnPropertySymbols,Zx=Object.prototype.hasOwnProperty,qx=Object.prototype.propertyIsEnumerable,kc=(e,t,n)=>t in e?Kx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jx=(e,t)=>{for(var n in t||(t={}))Zx.call(t,n)&&kc(e,n,t[n]);if(Sc)for(var n of Sc(t))qx.call(t,n)&&kc(e,n,t[n]);return e};function Dn(e=!1){const t=this,{config:n,state:{current:{width:i,height:a}}}=t,s=t.getCurrentPadding(),o=Jx({width:i-s.left-s.right,height:a-(n.legend_show?t.getLegendHeight()+10:0)-s.top-s.bottom},s);if(e){const r=gs.call(t,o),l=n.funnel_rotated;o.width=Math.max(o.width,l?r.height:r.width),o.height=Math.max(o.height,l?r.width:r.height)}return o}function gs(e){const t=this,{config:n}=t,i=n.funnel_rotated,[a,s]=[n.funnel_neck_width,n.funnel_neck_height].map((o,r)=>tt(o)?e[i!==!r?"width":"height"]*o.ratio:o);return{width:a,height:s}}function Qx(e){const t=this,n=t.config.funnel_rotated,{width:i,height:a}=Dn.call(t,!0),s=[];return e.forEach((o,r)=>{const{ratio:l=0}=o,c=r>0?s[r-1][2][n?0:1]:0,u=l+c;s.push(o.coords=n?[[c,0],[u,0],[u,a],[c,a],[c,0]]:[[0,c],[i,c],[i,u],[0,u],[0,c]])}),s}function tm(){const e=this,t=e.config.funnel_rotated,{width:n,height:i}=Dn.call(e,!0),a=gs.call(e,{width:n,height:i});let s;if(t){const o=(i-a.width)/2,r=n-a.height;s=[[r,o],[n,o],[n,i-o],[r,i-o],[0,i]]}else{const o=(n-a.width)/2,r=i-a.height;s=[[n,0],[n-o,r],[n-o,i],[o,i],[o,r]]}return`M${[[0,0],...s,[0,0]].join("L")}z`}function em(e){const t=this,{config:n}=t,i=e.map(a=>({id:a.id,value:a.values.reduce((s,o)=>s+o.value,0)}));return n.data_order&&i.sort(t.getSortCompareFn.bind(t)(!0)),Ac.call(t,i)}function Ac(e){const t=this,{width:n,height:i}=Dn.call(t),a=t.getTotalDataSum(!0),s=t.config.funnel_rotated?n:i;return e.forEach(o=>{o.ratio=o.value/a*s}),e}function nm(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Lc(e,t,n,i,a){const s=[];for(let r=0;r<=20;r++){const l=r/20,c=e+(t-e)*l,u=n+(i-n)*nm(l);s.push(a?[c,u]:[u,c])}return s}function im(){var e;const t=this,n=t.config.funnel_rotated,{width:i,height:a}=Dn.call(t,!0),s=gs.call(t,{width:i,height:a}),o=(0,pt.line)().x(f=>f[0]).y(f=>f[1]).curve(pt.curveLinear),r=(n?a-s.width:i-s.width)/2,l=n?i-s.height:a-s.height,c=Lc(0,l,n?0:i,n?r:i-r,n),u=[];if(s.height>0&&(c.push(n?[i,r]:[i-r,a]),u.push(n?[i,a-r]:[r,a])),u.push(...Lc(l,0,n?a-r:r,n?a:0,n)),c.length>1){const[f,g]=n?[1,0]:[0,1];c.splice(1,0,[c[f][0],c[g][1]]);const p=u.length-1;p>0&&u.splice(p,0,[u[p-f][0],u[p-g][1]])}const d=o(c)||"",h=((e=o(u))==null?void 0:e.replace(/^M/,"L"))||"";return n?`${d}${h}z`:`M0,0${d.replace(/^M/,"L")}${h}z`}var am={initFunnel(){const e=this,{$el:t}=e;t.funnel=t.main.select(`.${j.chart}`).append("g").classed(Kn.chartFunnels,!0),t.funnel.background=t.funnel.append("path").classed(Kn.funnelBackground,!0),e.bindFunnelEvent()},bindFunnelEvent(){const e=this,{$el:{funnel:t},config:n,state:i}=e;if(!n.interaction_enabled)return;const a=o=>{var r;const l=o.isTrusted?o.target:(r=i.eventReceiver.rect)==null?void 0:r.node();if(l&&/^path$/i.test(l.tagName))return i.event=o,(0,O.select)(l).datum()},s=i.inputType==="touch";t.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.target),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})},updateTargetsForFunnel(e){const t=this,{$el:{funnel:n}}=t;n||t.initFunnel();const i=t.getChartClass("Funnel"),a=t.getClass("funnel",!0),s=em.call(t,e.filter(t.isFunnelType.bind(t))),o=t.filterNullish(s),r=n.selectAll(`.${Kn.chartFunnel}`).data(o);r.exit().remove();const l=r.enter().insert("g",`.${Kn.funnelBackground}`);l.append("path"),n.path=l.merge(r).attr("class",i).select("path").attr("class",a).style("opacity","0").style("fill",t.color)},updateFunnel(e){const t=this,{$el:{funnel:n}}=t,i=e.map(({id:a})=>a);n.path=n.path.filter(a=>i.includes(a.id))},generateGetFunnelPoints(){const e=this,{config:t,$el:{funnel:n}}=e,i=t.funnel_rotated,a=e.filterTargetsToShow(n.path),{top:s,left:o,width:r,height:l}=Dn.call(e),c={};let u=0;return a.each(d=>{const h=u,{ratio:f}=d;u+=f;const g=i?o:s,p=g+h,_=g+u,x=(p+_)/2,m=i?s+l/2:o+r/2;c[d.id]=i?[[p,m],[_,m],[x,m]]:[[m,p],[m,_],[m,x]]}),d=>c[d.id]},redrawFunnel(){const e=this,{config:t,$T:n,$el:{funnel:i}}=e,a=e.filterTargetsToShow(i.path),s=Qx.call(e,Ac.call(e,a.data())),{top:o,left:r}=Dn.call(e),l=(t.funnel_spline?im:tm).call(e);i.attr("transform",`translate(${r}, ${o})`).attr("clip-path",`path('${l}')`),i.background.attr("d",l),n(a).attr("d",(c,u)=>`M${s[u].join("L")}z`).style("opacity","1"),i.selectAll("g").style("opacity",null)}},sm={funnel_neck_width:0,funnel_neck_height:0,funnel_rotated:!1,funnel_spline:!1};let Rc=()=>(Pn([am],[sm]),(Rc=()=>I.FUNNEL)());var om={initGauge(){const e=this,{config:t,$el:{arcs:n}}=e,i=(a=null,s="")=>{n.append("text").attr("class",a).style("text-anchor","middle").style("pointer-events","none").text(s)};if(e.hasType("gauge")){const a=e.hasMultiArcGauge();n.append(a?"g":"path").attr("class",at.chartArcsBackground).style("fill",!a&&t.gauge_background||null),t.gauge_units&&i(ae.chartArcsGaugeUnit),t.gauge_label_show&&(i(ae.chartArcsGaugeMin),!t.gauge_fullCircle&&i(ae.chartArcsGaugeMax))}},updateGaugeMax(){const e=this,{config:t,state:n}=e,a=e.hasMultiArcGauge()?e.getMinMaxData().max[0].value:e.getTotalDataSum(n.rendered);!t.gauge_enforceMinMax&&a+t.gauge_min*(t.gauge_min>0?-1:1)>t.gauge_max&&(t.gauge_max=a-t.gauge_min)},redrawArcGaugeLine(){const e=this,{config:t,state:n,$el:i}=e,{hiddenTargetIds:a}=e.state,s=i.main.selectAll(`.${at.arcs}`).selectAll(`.${at.arcLabelLine}`).data(e.arcData.bind(e));s.enter().append("rect").attr("class",r=>`${at.arcLabelLine} ${j.target} ${j.target}-${r.data.id}`).merge(s).style("fill",r=>e.levelColor?e.levelColor(r.data.values[0].value):e.color(r.data)).style("display",t.gauge_label_show?null:"none").each(function(r){let l=0;const c=2;let u=0,d=0,h="";if(!a.has(r.data.id)){const f=e.updateAngle(r),g=n.gaugeArcWidth/e.getTargetsToShow().length*(f.index+1),p=f.endAngle-Math.PI/2,_=n.radius-g,x=p-(_===0?0:1/_);l=n.radiusExpanded-n.radius+g,u=Math.cos(x)*_,d=Math.sin(x)*_,h=`rotate(${p*180/Math.PI}, ${u}, ${d})`}(0,O.select)(this).attr("x",u).attr("y",d).attr("width",l).attr("height",c).attr("transform",h).style("stroke-dasharray",`0, ${l+c}, 0`)})},textForGaugeMinMax(e,t){const n=this,{config:i}=n,a=i.gauge_label_extents;return z(a)?a.bind(n.api)(e,t):e},getGaugeLabelHeight(){const{config:e}=this;return this.config.gauge_label_show&&!e.gauge_fullCircle?20:0},getPaddingBottomForGauge(){return this.getGaugeLabelHeight()*2}},rm={gauge_background:"",gauge_fullCircle:!1,gauge_label_show:!0,gauge_label_extents:void 0,gauge_label_format:void 0,gauge_label_ratio:void 0,gauge_label_threshold:0,gauge_label_line:!1,gauge_label_image:void 0,gauge_enforceMinMax:!1,gauge_min:0,gauge_max:100,gauge_type:"single",gauge_startingAngle:-1*Math.PI/2,gauge_arcLength:100,gauge_title:"",gauge_units:void 0,gauge_width:void 0,gauge_arcs_minWidth:5,gauge_expand:{},gauge_expand_rate:.98,gauge_expand_duration:50};let Ec=()=>(Pn([om],[Yi,rm]),(Ec=()=>I.GAUGE)()),Pc=()=>(Fe(),(Pc=()=>I.LINE)()),Dc=()=>(Fe(void 0,[ns]),(Dc=()=>I.SPLINE)()),Ic=()=>(Fe(),(Ic=()=>I.STEP)());var lm={pie_label_show:!0,pie_label_format:void 0,pie_label_ratio:void 0,pie_label_threshold:.05,pie_label_line:!1,pie_label_image:void 0,pie_expand:{},pie_expand_rate:.98,pie_expand_duration:50,pie_innerRadius:0,pie_outerRadius:void 0,pie_padAngle:0,pie_padding:0,pie_startingAngle:0};let Mc=()=>(Pn(void 0,[Yi,lm]),(Mc=()=>I.PIE)());function Fc(e){const t=e.config.polar_level_max;let n=e.getMinMaxData().max[0].value;return t&&t>n&&(n=t),n}var cm={initPolar(){const e=this,{$el:{arcs:t},config:n}=e,i=n.polar_level_text_show,a=n.polar_level_text_backgroundColor;t.levels=t.append("g").attr("class",Me.levels),i&&a&&e.generateTextBGColorFilter(a)},getPolarOuterRadius(e,t){var n;const i=Fc(this);return((n=e==null?void 0:e.data.values[0].value)!=null?n:0)/i*t},updateTargetsForPolar(e){this.updateTargetsForArc(e)},redrawPolar(){const e=this,{config:t}=e;t.polar_level_show&&e.updatePolarLevel()},updatePolarLevel(){const e=this,{config:t,state:n,$el:{arcs:{levels:i}}}=e,a=t.polar_level_depth,s=Fc(e),o=ci(0,a),r=n.radius,l=o.map(h=>r*((h+1)/a)),c=(t.polar_level_text_format||function(){}).bind(e.api),u=i.selectAll(`.${Me.level}`).data(o);u.exit().remove();const d=u.enter().append("g").attr("class",(h,f)=>`${Me.level} ${Me.level}-${f}`);if(d.append("circle"),d.merge(u).selectAll("circle").style("visibility",t.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",h=>l[h]),t.polar_level_text_show){const h=t.polar_level_text_backgroundColor,f=`#${n.datetimeId}-labels-bg${e.getTargetSelectorSuffix(h)}`;d.append("text").style("text-anchor","middle"),d.merge(u).selectAll("text").attr("dy",g=>-l[g]+5).attr("filter",h?`url(${f})`:null).text(g=>c(s/o.length*(g+1)))}}},um={polar_label_show:!0,polar_label_format:void 0,polar_label_threshold:.05,polar_label_line:!1,polar_label_image:void 0,polar_label_ratio:void 0,polar_level_depth:3,polar_level_max:void 0,polar_level_show:!0,polar_level_text_backgroundColor:"#fff",polar_level_text_format:e=>e%1===0?e:e.toFixed(2),polar_level_text_show:!0,polar_padAngle:0,polar_padding:0,polar_startingAngle:0};let Oc=()=>(Pn([cm],[Yi,um]),(Oc=()=>I.POLAR)());function dm(e,t,n,i,a,s){const o=e&&i>0?n-i:i,r=2*Math.PI;return a*(1-s*(t==="x"?Math.sin:Math.cos)(o*r/n))}const In=U.radarPoints,$c=U.radarTextWidth;var hm={initRadar(){const e=this,{config:t,state:{current:n},$el:i}=e;e.hasType("radar")&&(i.radar=i.main.select(`.${j.chart}`).append("g").attr("class",tr.chartRadars),i.radar.levels=i.radar.append("g").attr("class",Me.levels),i.radar.axes=i.radar.append("g").attr("class",It.axis),i.radar.shapes=i.radar.append("g").attr("class",At.shapes),n.dataMax=t.radar_axis_max||e.getMinMaxData().max[0].value,t.radar_axis_text_show&&(t.interaction_enabled&&e.bindRadarEvent(),e.updateRadarLevel(),e.updateRadarAxes()))},getRadarSize(){const e=this,{config:t,state:{arcWidth:n,arcHeight:i}}=e,a=t.axis_x_categories.length<4?-20:10,s=(Math.min(n,i)-a)/2;return[s,s]},updateTargetsForRadar(e){const t=this,{config:n}=t;se(n.axis_x_categories)&&(n.axis_x_categories=ci(0,ue("max",e.map(i=>i.values.length)))),t.generateRadarPoints()},getRadarPosition(e,t,n,i){const a=this,{config:s}=a,[o,r]=a.getRadarSize(),l=s.axis_x_categories.length,c=s.radar_direction_clockwise,u=nn(e).map(d=>dm(c,d,l,t,ct(n)?n:e==="x"?o:r,$(i)?i:s.radar_size_ratio));return u.length===1?u[0]:u},generateRadarPoints(){const e=this,t=e.data.targets,[n,i]=e.getRadarSize(),a=e.cache.get(In)||{},s=a._size;(!s||s.width!==n&&s.height!==i)&&(t.forEach(o=>{a[o.id]=o.values.map((r,l)=>e.getRadarPosition(["x","y"],l,void 0,e.getRatio("radar",r)))}),a._size={width:n,height:i},e.cache.add(In,a))},redrawRadar(){const e=this,{radar:t,main:n}=e.$el,i=e.getTranslate("radar");i&&(t.attr("transform",i),n.select(`.${Et.chartTexts}`).attr("transform",i),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape())},generateGetRadarPoints(){const e=this.cache.get(In);return(t,n)=>{const i=e[t.id][n];return[i,i,i,i]}},updateRadarLevel(){const e=this,{config:t,state:n,$el:{radar:i}}=e,[a,s]=e.getRadarSize(),o=t.radar_level_depth,r=t.axis_x_categories.length,l=t.radar_level_text_show,c=i.levels,u=ci(0,o),d=t.radar_size_ratio*Math.min(a,s),h=u.map(x=>d*((x+1)/o)),f=(t.radar_level_text_format||function(){}).bind(e.api),g=u.map(x=>{const m=h[x];return ci(0,r).map(b=>e.getRadarPosition(["x","y"],b,m,1).join(",")).join(" ")}),p=c.selectAll(`.${Me.level}`).data(u);p.exit().remove();const _=p.enter().append("g").attr("class",(x,m)=>`${Me.level} ${Me.level}-${m}`);_.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),l&&(c.select("text").empty()&&c.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(()=>f(0)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(x=>f(n.current.dataMax/u.length*(x+1)))),_.merge(p).attr("transform",x=>`translate(${a-h[x]}, ${s-h[x]})`).selectAll("polygon").attr("points",x=>g[x]),l&&c.selectAll("text").attr("x",x=>Ct(x)?a:g[x].split(",")[0]).attr("y",x=>Ct(x)?s:0)},updateRadarAxes(){const e=this,{config:t,$el:{radar:n}}=e,[i,a]=e.getRadarSize(),s=t.axis_x_categories;let o=n.axes.selectAll("g").data(s);o.exit().remove();const r=o.enter().append("g").attr("class",(l,c)=>`${It.axis}-${c}`);if(t.radar_axis_line_show&&r.append("line"),t.radar_axis_text_show&&r.append("text"),o=r.merge(o),t.radar_axis_line_show&&o.select("line").attr("x1",i).attr("y1",a).attr("x2",(l,c)=>e.getRadarPosition("x",c)).attr("y2",(l,c)=>e.getRadarPosition("y",c)),t.radar_axis_text_show){const{x:l=0,y:c=0}=t.radar_axis_text_position,u=e.cache.get($c)||0;if(o.select("text").style("text-anchor","middle").attr("dy",".5em").call(d=>{d.each(function(h){Cn((0,O.select)(this),String(h),[-.6,1.2])})}).datum((d,h)=>({index:h})).attr("transform",function(d){Ct(this.width)&&(this.width=ht(this,!0).width/2);let h=e.getRadarPosition("x",d.index,void 0,1),f=Math.round(e.getRadarPosition("y",d.index,void 0,1));return h>i?h+=this.width+l:Math.round(h)<i&&(h-=this.width+l),f>a?(f/2===a&&this.firstChild.tagName==="tspan"&&this.firstChild.setAttribute("dy","0em"),f+=c):f<a&&(f-=c),`translate(${h} ${f})`}),!u){const d=[n.axes,n.levels].map(h=>cr(h.node()).width);d.every(h=>h>0)&&e.cache.add($c,d[0]-d[1])}}},bindRadarEvent(){const e=this,{config:t,state:n,$el:{radar:i,svg:a}}=e,s=e.isPointFocusOnly(),{inputType:o,transiting:r}=n,l=o==="mouse",c=u=>{if(n.event=u,!t.interaction_onout)return;const d=e.getDataIndexFromEvent(u),h=Ct(d);(l||h)&&(e.hideTooltip(),s?e.hideCircleFocus():e.unexpandCircles(),l?e.setOverOut(!1,d):h&&e.callOverOutForTouch())};i.axes.on(l?"mouseover ":"touchstart",u=>{if(r)return;n.event=u;const d=e.getDataIndexFromEvent(u);e.selectRectForSingle(a.node(),d),l?e.setOverOut(!0,d):e.callOverOutForTouch(d)},l?void 0:{passive:!0}).on("mouseout",l?c:null),l||a.on("touchstart",c,{passive:!0})},updateRadarShape(){const e=this,t=e.data.targets.filter(s=>e.isRadarType(s)),n=e.cache.get(In),i=e.$el.radar.shapes.selectAll("polygon").data(e.filterNullish(t)),a=i.enter().append("g").attr("class",e.getChartClass("Radar"));e.$T(i.exit()).remove(),a.append("polygon").merge(i).style("fill",e.color).style("stroke",e.color).attr("points",s=>n[s.id].join(" ")),e.updateTargetForCircle(t,a)},radarCircleX(e){return this.cache.get(In)[e.id][e.index][0]},radarCircleY(e){return this.cache.get(In)[e.id][e.index][1]}},fm={radar_axis_max:void 0,radar_axis_line_show:!0,radar_axis_text_show:!0,radar_axis_text_position:{},radar_level_depth:3,radar_level_show:!0,radar_level_text_format:e=>e%1===0?e:e.toFixed(2),radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1};let Bc=()=>(Pn([Ql.eventrect,zi,hm],[dn,fm,{axis_x_categories:tc.optAxis.axis_x_categories}]),(Bc=()=>I.RADAR)());var gm={scatter_zerobased:!1};let zc=()=>(ni([Rn,zi],[dn,gm]),(zc=()=>I.SCATTER)());var Oe=bt(11);function pm(e){const t=this;return e.map(n=>{const{id:i,values:a}=n,{value:s}=a[0];return{name:i,id:i,value:s,ratio:t.getRatio("treemap",a[0])}})}var _m={initTreemapLayout(){this.treemap=(0,Oe.treemap)().tile(this.getTreemapTile())},getTreemapTile(){var e,t;const n=this,{config:i,state:{current:{width:a,height:s}}}=n,o=(t={binary:Oe.treemapBinary,dice:Oe.treemapDice,slice:Oe.treemapSlice,sliceDice:Oe.treemapSliceDice,squarify:Oe.treemapSquarify,resquarify:Oe.treemapResquarify}[(e=i.treemap_tile)!=null?e:"binary"])!=null?t:Oe.treemapBinary;return(r,l,c,u,d)=>{o(r,0,0,a,s);for(const h of r.children)h.x0=l+h.x0/a*(u-l),h.x1=l+h.x1/a*(u-l),h.y0=c+h.y0/s*(d-c),h.y1=c+h.y1/s*(d-c)}},getTreemapData(e){const t=this;return{name:"root",children:pm.bind(t)(t.filterTargetsToShow(e.filter(t.isTreemapType,t)))}},getTreemapRoot(e){const t=this,n=t.getTreemapData(e!=null?e:t.data.targets),i=(0,Oe.hierarchy)(n).sum(s=>s.value),a=t.getSortCompareFn(!0);return t.treemap||t.initTreemapLayout(),t.treemap(a?i.sort(a):i)}},xm=Object.defineProperty,mm=Object.defineProperties,vm=Object.getOwnPropertyDescriptors,Nc=Object.getOwnPropertySymbols,bm=Object.prototype.hasOwnProperty,ym=Object.prototype.propertyIsEnumerable,Xc=(e,t,n)=>t in e?xm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tm=(e,t)=>{for(var n in t||(t={}))bm.call(t,n)&&Xc(e,n,t[n]);if(Nc)for(var n of Nc(t))ym.call(t,n)&&Xc(e,n,t[n]);return e},wm=(e,t)=>mm(e,vm(t));function Cm(e,t){const n=this;e.selectAll("g").attr("transform",i=>{const a=vn(n,i,t);return`translate(${a.x},${a.y})`}).select("rect").attr("width",i=>vn(n,i,t).w).attr("height",i=>vn(n,i,t).h)}var Sm=wm(Tm({},_m),{initTreemap(){const e=this,{$el:t,state:{current:{width:n,height:i},clip:a,datetimeId:s}}=e;a.id=`${s}-clip`,e.initTreemapLayout(),t.defs.append("clipPath").attr("id",a.id).append("rect").attr("width",n).attr("height",i),t.treemap=t.main.select(`.${j.chart}`).attr("clip-path",`url(#${a.id})`).append("g").classed(nr.chartTreemaps,!0),e.bindTreemapEvent()},bindTreemapEvent(){const e=this,{$el:t,config:n,state:i}=e,a=s=>{var o;const r=s.isTrusted?s.target:(o=i.eventReceiver.rect)==null?void 0:o.node();let l;return r&&/^rect$/i.test(r.tagName)&&(i.event=s,l=(0,O.select)(r).datum()),l==null?void 0:l.data};if(n.interaction_enabled){const s=i.inputType==="touch";t.treemap.on(s?"touchstart":"mouseover mousemove",o=>{const r=a(o);r&&(e.showTooltip([r],o.currentTarget),/^(touchstart|mouseover)$/.test(o.type)&&e.setOverOut(!0,r))},s?{passive:!0}:void 0).on(s?"touchend":"mouseout",o=>{const r=a(o);n.interaction_onout&&(e.hideTooltip(),e.setOverOut(!1,r))})}},updateTargetsForTreemap(e){const t=this,{$el:{treemap:n}}=t,i=[t.getTreemapRoot(e!=null?e:t.data.targets)];n.data(t.filterNullish(i))},updateTreemap(e){const t=this,{$el:n,$T:i}=t,a=n.treemap.datum(),s=t.getChartClass("Treemap"),o=t.getClass("treemap",!0),r=n.treemap.selectAll("g").data(a.children);i(r.exit(),e).style("opacity","0").remove(),r.enter().append("g").append("rect"),n.treemap.selectAll("g").attr("class",s).select("rect").attr("class",o).attr("fill",l=>t.color(l.data.name))},generateGetTreemapPoints(){const e=this,{$el:t}=e,n={};return t.treemap.selectAll("g").each(i=>{const a=vn(e,i);n[i.data.name]=[[a.x,a.y],[a.x+a.w,a.y+a.h]]}),i=>n[i.id]},redrawTreemap(e){const t=this,{$el:n,state:{current:{width:i,height:a}}}=t;return n.defs.select("rect").attr("width",i).attr("height",a),[t.$T(n.treemap,e,xe()).call(Cm.bind(t),n.treemap.datum())]},treemapDataLabelFormat(e){const t=this,{$el:{treemap:n},config:i,scale:{x:a,y:s}}=t,{id:o,value:r}=e,l=i.treemap_label_format,c=t.getRatio("treemap",e),u=(c*100).toFixed(2),d=i.treemap_label_show&&Va.call(t,c,"treemap")?null:"0",h=n.selectAll("g").filter(p=>p.data.id===o).datum();let f=0,g=0;if(h){const{x0:p,x1:_,y0:x,y1:m}=h;f=a(_)-a(p),g=s(m)-s(x)}return function(p){return p.style("opacity",d),z(l)?l.bind(t.api)(r,c,o,{width:f,height:g}):`${o}
40
+ ${u}%`}}}),km={treemap_tile:"binary",treemap_label_format:void 0,treemap_label_threshold:.05,treemap_label_show:!0};let Gc=()=>(ni([Sm],[km]),(Gc=()=>I.TREEMAP)()),ps=Object.create(null);const Vc={version:"4.1.0-next.1",generate(e){const t=ke(Object.create(null),ps,e),n=new Ht(t);return n.internal.charts=this.instance,this.instance.push(n),n},defaults(e){return tt(e)&&(ps=e),ps},instance:[],plugin:{}};Object.keys(Ft).forEach(e=>Ft[e]()),Object.keys(q).forEach(e=>q[e]()),dl(),hl(),Cl(),Xl(),ul(),ol()})(),Ui})()});