vue-data-ui 3.29.2 → 3.29.4

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 (193) hide show
  1. package/dist/{Arrow-CITPKnWF.js → Arrow-DhkzHBsL.js} +1 -1
  2. package/dist/{BaseDraggableDialog-DVstuNhT.js → BaseDraggableDialog-MyWIeEtr.js} +1 -1
  3. package/dist/{BaseIcon-CoY0vuL3.js → BaseIcon-CQFjKDhE.js} +1 -1
  4. package/dist/{BaseLegendToggle-VzX69MCo.js → BaseLegendToggle-CnQ_U5rI.js} +1 -1
  5. package/dist/{BaseZoomControls-D4i_j6vc.js → BaseZoomControls-OZwEB4vm.js} +1 -1
  6. package/dist/{ColorPicker-DmVnJGVv.js → ColorPicker-dbxPO2fg.js} +1 -1
  7. package/dist/{DataTable-KeuZB1JM.js → DataTable-BHW5xD9B.js} +1 -1
  8. package/dist/{HillActions-D--h5brJ.js → HillActions-KXWY_FyA.js} +1 -1
  9. package/dist/{Legend-W9YVYVX-.js → Legend-D5I3jeGD.js} +1 -1
  10. package/dist/{NonSvgPenAndPaper-B2kuh5Yb.js → NonSvgPenAndPaper-RQzq8DqO.js} +1 -1
  11. package/dist/{PackageVersion-C1vtZkKc.js → PackageVersion-B-1JX0wI.js} +1 -1
  12. package/dist/{PenAndPaper-BV5ODysA.js → PenAndPaper-B2UOwiJM.js} +1 -1
  13. package/dist/{Shape-CRe8woTu.js → Shape-DgpYvQc4.js} +1 -1
  14. package/dist/{SlicerPreview-BVgz_p4G.js → SlicerPreview-QaJuNJhX.js} +1 -1
  15. package/dist/{SparkTooltip-Ch06CV71.js → SparkTooltip-dnNSazTu.js} +1 -1
  16. package/dist/{StackChartTable-rTC6w378.js → StackChartTable-mMKxPOnc.js} +1 -1
  17. package/dist/{Title-BliHuXfT.js → Title-DlhGIAWX.js} +1 -1
  18. package/dist/{Tooltip-B432XpvC.js → Tooltip-CL3U31cL.js} +1 -1
  19. package/dist/UserOptions-B97cPcKc.js +1 -0
  20. package/dist/{XyAnalysisOptions-CD0cCtt5.js → XyAnalysisOptions-DeJOjnC3.js} +1 -1
  21. package/dist/{chartImage-DPGnEuYM.js → chartImage-Dvrx_F7P.js} +1 -1
  22. package/dist/components/arrow.js +1 -1
  23. package/dist/components/vue-ui-3d-bar.js +1 -1
  24. package/dist/components/vue-ui-accordion.js +1 -1
  25. package/dist/components/vue-ui-age-pyramid.js +1 -1
  26. package/dist/components/vue-ui-annotator.js +1 -1
  27. package/dist/components/vue-ui-bullet.js +1 -1
  28. package/dist/components/vue-ui-bump.js +1 -1
  29. package/dist/components/vue-ui-candlestick.js +1 -1
  30. package/dist/components/vue-ui-carousel-table.js +1 -1
  31. package/dist/components/vue-ui-chestnut.js +1 -1
  32. package/dist/components/vue-ui-chord.js +1 -1
  33. package/dist/components/vue-ui-circle-pack.js +1 -1
  34. package/dist/components/vue-ui-cursor.js +1 -1
  35. package/dist/components/vue-ui-dag.js +1 -1
  36. package/dist/components/vue-ui-dashboard.js +1 -1
  37. package/dist/components/vue-ui-digits.js +1 -1
  38. package/dist/components/vue-ui-donut-evolution.js +1 -1
  39. package/dist/components/vue-ui-donut.js +1 -1
  40. package/dist/components/vue-ui-dumbbell.js +1 -1
  41. package/dist/components/vue-ui-flow.js +1 -1
  42. package/dist/components/vue-ui-funnel.js +1 -1
  43. package/dist/components/vue-ui-galaxy.js +1 -1
  44. package/dist/components/vue-ui-gauge.js +1 -1
  45. package/dist/components/vue-ui-geo.js +1 -1
  46. package/dist/components/vue-ui-gizmo.js +1 -1
  47. package/dist/components/vue-ui-graph.js +1 -1
  48. package/dist/components/vue-ui-heatmap.js +1 -1
  49. package/dist/components/vue-ui-hill.js +1 -1
  50. package/dist/components/vue-ui-history-plot.js +1 -1
  51. package/dist/components/vue-ui-horizontal-bar.js +1 -1
  52. package/dist/components/vue-ui-icon.js +1 -1
  53. package/dist/components/vue-ui-kpi.js +1 -1
  54. package/dist/components/vue-ui-label.js +1 -1
  55. package/dist/components/vue-ui-mini-loader.js +1 -1
  56. package/dist/components/vue-ui-molecule.js +1 -1
  57. package/dist/components/vue-ui-mood-radar.js +1 -1
  58. package/dist/components/vue-ui-nested-donuts.js +1 -1
  59. package/dist/components/vue-ui-onion.js +1 -1
  60. package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
  61. package/dist/components/vue-ui-quadrant.js +1 -1
  62. package/dist/components/vue-ui-quick-chart.js +1 -1
  63. package/dist/components/vue-ui-radar.js +1 -1
  64. package/dist/components/vue-ui-rating.js +1 -1
  65. package/dist/components/vue-ui-relation-circle.js +1 -1
  66. package/dist/components/vue-ui-ridgeline.js +1 -1
  67. package/dist/components/vue-ui-rings.js +1 -1
  68. package/dist/components/vue-ui-scatter.js +1 -1
  69. package/dist/components/vue-ui-skeleton.js +1 -1
  70. package/dist/components/vue-ui-smiley.js +1 -1
  71. package/dist/components/vue-ui-spark-trend.js +1 -1
  72. package/dist/components/vue-ui-sparkbar.js +1 -1
  73. package/dist/components/vue-ui-sparkgauge.js +1 -1
  74. package/dist/components/vue-ui-sparkhistogram.js +1 -1
  75. package/dist/components/vue-ui-sparkline.js +1 -1
  76. package/dist/components/vue-ui-sparkstackbar.js +1 -1
  77. package/dist/components/vue-ui-stackbar.js +1 -1
  78. package/dist/components/vue-ui-stackline.js +1 -1
  79. package/dist/components/vue-ui-strip-plot.js +1 -1
  80. package/dist/components/vue-ui-table-heatmap.js +1 -1
  81. package/dist/components/vue-ui-table-sparkline.js +1 -1
  82. package/dist/components/vue-ui-table.js +1 -1
  83. package/dist/components/vue-ui-thermometer.js +1 -1
  84. package/dist/components/vue-ui-timer.js +1 -1
  85. package/dist/components/vue-ui-tiremarks.js +1 -1
  86. package/dist/components/vue-ui-treemap.js +1 -1
  87. package/dist/components/vue-ui-vertical-bar.js +1 -1
  88. package/dist/components/vue-ui-waffle.js +1 -1
  89. package/dist/components/vue-ui-wheel.js +1 -1
  90. package/dist/components/vue-ui-word-cloud.js +1 -1
  91. package/dist/components/vue-ui-world.js +1 -1
  92. package/dist/components/vue-ui-xy-canvas.js +1 -1
  93. package/dist/components/vue-ui-xy.js +1 -1
  94. package/dist/{dom-to-png-D56-Zgv4.js → dom-to-png-BciywWcQ.js} +1 -1
  95. package/dist/{exposedLib-BRtClmZy.js → exposedLib-BaycYTOv.js} +1 -1
  96. package/dist/{img-D4RQwASc.js → img-Dwb4XSud.js} +1 -1
  97. package/dist/{labelUtils-CdtU-yB_.js → labelUtils-D_AyGvLO.js} +1 -1
  98. package/dist/{lib-rPeBMZrn.js → lib-BaWaqwnJ.js} +7 -7
  99. package/dist/package-CfW2xYyy.js +1 -0
  100. package/dist/{pdf-CVdqBWVS.js → pdf-Bd6zav8D.js} +1 -1
  101. package/dist/{render-common-DNKT42_W.js → render-common-CxohOkPd.js} +1 -1
  102. package/dist/{resolveChartConfig-0IvbmIE_.js → resolveChartConfig-QgMumfgd.js} +1 -1
  103. package/dist/ssr/vue-ui-donut.js +1 -1
  104. package/dist/ssr/vue-ui-xy.js +1 -1
  105. package/dist/ssr.js +1 -1
  106. package/dist/style.css +1 -1
  107. package/dist/types/vue-data-ui.d.ts +29 -0
  108. package/dist/{useConfig-CXhXxWjB.js → useConfig-B-AzS3w-.js} +1 -1
  109. package/dist/{useNestedProp-DnGoh-XS.js → useNestedProp-ri-deXpG.js} +1 -1
  110. package/dist/{useObjectBindings-BCep9t8A.js → useObjectBindings-DsvXXciT.js} +1 -1
  111. package/dist/{usePrinter-DVf3YcG5.js → usePrinter-CUD8gosC.js} +1 -1
  112. package/dist/utils.js +1 -1
  113. package/dist/vue-data-ui-orKuQ-0A.js +1 -0
  114. package/dist/vue-data-ui.js +1 -1
  115. package/dist/{vue-ui-3d-bar-CNym5PLY.js → vue-ui-3d-bar-BxIOe5pW.js} +1 -1
  116. package/dist/{vue-ui-accordion-D3uT1Ynv.js → vue-ui-accordion-B8LYfVG9.js} +1 -1
  117. package/dist/{vue-ui-age-pyramid-zD6anIub.js → vue-ui-age-pyramid-CsQ6Zx79.js} +1 -1
  118. package/dist/{vue-ui-annotator-aP1DFNt9.js → vue-ui-annotator-xYv2xrXs.js} +1 -1
  119. package/dist/{vue-ui-bullet-CxhIb-XU.js → vue-ui-bullet-CsaTMHaa.js} +1 -1
  120. package/dist/{vue-ui-bump-B8WYM1RE.js → vue-ui-bump-BOVB5hWu.js} +1 -1
  121. package/dist/{vue-ui-candlestick-CwG1H80q.js → vue-ui-candlestick-C8W4sGST.js} +1 -1
  122. package/dist/{vue-ui-carousel-table-CdrxVrHZ.js → vue-ui-carousel-table-DAMT9bn5.js} +1 -1
  123. package/dist/{vue-ui-chestnut-CZG6Ep36.js → vue-ui-chestnut-XdPEyosT.js} +1 -1
  124. package/dist/{vue-ui-chord-DQS4tBWQ.js → vue-ui-chord-CeYpAizS.js} +1 -1
  125. package/dist/{vue-ui-circle-pack-BGbhvnE5.js → vue-ui-circle-pack-Brhoqu25.js} +1 -1
  126. package/dist/{vue-ui-cursor-DTRAPWBW.js → vue-ui-cursor-CieGBz32.js} +1 -1
  127. package/dist/{vue-ui-dag-BGNC8uRQ.js → vue-ui-dag-CC7fXGUn.js} +1 -1
  128. package/dist/{vue-ui-dashboard-DtPlz7y-.js → vue-ui-dashboard-C7oXScoZ.js} +1 -1
  129. package/dist/{vue-ui-digits-gtQiZcOT.js → vue-ui-digits-Cn_wqq4Y.js} +1 -1
  130. package/dist/{vue-ui-donut-COELw22T.js → vue-ui-donut-BHRes5Ak.js} +1 -1
  131. package/dist/{vue-ui-donut-_wqSXunY.js → vue-ui-donut-BXlWXh2v.js} +1 -1
  132. package/dist/{vue-ui-donut-evolution-CdztIQSl.js → vue-ui-donut-evolution-DHPd3KRv.js} +1 -1
  133. package/dist/{vue-ui-dumbbell-CpLMoEet.js → vue-ui-dumbbell-BmqFCL_t.js} +1 -1
  134. package/dist/{vue-ui-flow-DwG1MX2V.js → vue-ui-flow-CvRa8Ija.js} +1 -1
  135. package/dist/{vue-ui-funnel-CisiLlR9.js → vue-ui-funnel-Ds4JV24L.js} +1 -1
  136. package/dist/vue-ui-galaxy-DSHlkl9t.js +1 -0
  137. package/dist/{vue-ui-gauge-CVxKlU2U.js → vue-ui-gauge-2XPqwRR4.js} +1 -1
  138. package/dist/{vue-ui-geo-0PDP2JjE.js → vue-ui-geo-IDzNLYVX.js} +1 -1
  139. package/dist/{vue-ui-gizmo-mFeK8xP1.js → vue-ui-gizmo-BXEnFICN.js} +1 -1
  140. package/dist/{vue-ui-graph-Duw5qG0a.js → vue-ui-graph-DdY8jDH-.js} +2 -2
  141. package/dist/{vue-ui-heatmap-DZM9MvfE.js → vue-ui-heatmap-DmgXUHFz.js} +1 -1
  142. package/dist/{vue-ui-hill-BGQSrcHM.js → vue-ui-hill-CTuh5311.js} +1 -1
  143. package/dist/{vue-ui-history-plot-EGeDhkdS.js → vue-ui-history-plot-qpbsJ706.js} +1 -1
  144. package/dist/{vue-ui-horizontal-bar-CtONqcjG.js → vue-ui-horizontal-bar-BnIRG4Da.js} +1 -1
  145. package/dist/{vue-ui-kpi-BSRfwYk9.js → vue-ui-kpi-BvGMMvPY.js} +1 -1
  146. package/dist/{vue-ui-label-W0ITGnQa.js → vue-ui-label-CcVh3FeS.js} +1 -1
  147. package/dist/{vue-ui-mini-loader-BBsXG6nD.js → vue-ui-mini-loader-C7rLQ7JE.js} +1 -1
  148. package/dist/{vue-ui-molecule-DOQ8dsme.js → vue-ui-molecule-BLCwrefH.js} +1 -1
  149. package/dist/{vue-ui-mood-radar-BJeSC-Op.js → vue-ui-mood-radar-Bm12y-t8.js} +1 -1
  150. package/dist/{vue-ui-nested-donuts-DUUmc8K7.js → vue-ui-nested-donuts-BGz-1VHL.js} +1 -1
  151. package/dist/{vue-ui-onion-B8M1x8Jc.js → vue-ui-onion-C23btxVO.js} +1 -1
  152. package/dist/{vue-ui-parallel-coordinate-plot-Dv0eO4ZI.js → vue-ui-parallel-coordinate-plot-E17cuXGN.js} +1 -1
  153. package/dist/{vue-ui-quadrant-_QcgE234.js → vue-ui-quadrant-NJPbHq0p.js} +1 -1
  154. package/dist/{vue-ui-quick-chart-DzJx0LBu.js → vue-ui-quick-chart-CI1n75li.js} +1 -1
  155. package/dist/{vue-ui-radar-C-idGMCp.js → vue-ui-radar-CD1Ge3r9.js} +1 -1
  156. package/dist/{vue-ui-rating-CwD4CB9M.js → vue-ui-rating-mDoJ2Rkg.js} +1 -1
  157. package/dist/{vue-ui-relation-circle-Dl2XO5DU.js → vue-ui-relation-circle-CQPFqgsl.js} +1 -1
  158. package/dist/{vue-ui-ridgeline-SG44P21X.js → vue-ui-ridgeline-C0fxNnYy.js} +1 -1
  159. package/dist/{vue-ui-rings-b8Ms_mTp.js → vue-ui-rings-D2XUhWg-.js} +1 -1
  160. package/dist/{vue-ui-scatter-KPiaTVuv.js → vue-ui-scatter-DgfuFep8.js} +1 -1
  161. package/dist/{vue-ui-skeleton-Dg0tACvE.js → vue-ui-skeleton-BUMvfDJX.js} +1 -1
  162. package/dist/{vue-ui-smiley-B34VeonG.js → vue-ui-smiley-aTCVrK-n.js} +1 -1
  163. package/dist/{vue-ui-spark-trend-C3EXOm2F.js → vue-ui-spark-trend-B1S6SaGz.js} +1 -1
  164. package/dist/{vue-ui-sparkbar-CCjgG6pR.js → vue-ui-sparkbar-DtGqqvGS.js} +1 -1
  165. package/dist/{vue-ui-sparkgauge-DnxHmWiH.js → vue-ui-sparkgauge-yEOfuIEu.js} +1 -1
  166. package/dist/{vue-ui-sparkhistogram--QcZmUje.js → vue-ui-sparkhistogram-nM2G2AJx.js} +1 -1
  167. package/dist/{vue-ui-sparkline-D1BPdZdr.js → vue-ui-sparkline-B7ZZzccR.js} +1 -1
  168. package/dist/{vue-ui-sparkstackbar-CxF1OSDL.js → vue-ui-sparkstackbar-CTCvV0UA.js} +1 -1
  169. package/dist/{vue-ui-stackbar-yKTDxwXp.js → vue-ui-stackbar-DTlq5Fmr.js} +1 -1
  170. package/dist/{vue-ui-stackline-BPdR_8x0.js → vue-ui-stackline-DgV0GCOn.js} +1 -1
  171. package/dist/{vue-ui-strip-plot-CAmBydR2.js → vue-ui-strip-plot-DlIqyn9G.js} +1 -1
  172. package/dist/{vue-ui-table-BKfGLJgN.js → vue-ui-table-B1QawDAY.js} +1 -1
  173. package/dist/{vue-ui-table-heatmap-CpviNfWA.js → vue-ui-table-heatmap-DFjVopuI.js} +1 -1
  174. package/dist/{vue-ui-table-sparkline-CVomhgHC.js → vue-ui-table-sparkline-D15wq2iu.js} +1 -1
  175. package/dist/{vue-ui-thermometer-DNRR87NF.js → vue-ui-thermometer-gK8M0jyN.js} +1 -1
  176. package/dist/{vue-ui-timer-Bx5D4QsO.js → vue-ui-timer-Be4jnf30.js} +2 -2
  177. package/dist/{vue-ui-tiremarks-CnZqIcFq.js → vue-ui-tiremarks-B1PF45Fh.js} +1 -1
  178. package/dist/{vue-ui-treemap-D7k9vWC9.js → vue-ui-treemap-CProQJII.js} +1 -1
  179. package/dist/{vue-ui-waffle-BHcDq09N.js → vue-ui-waffle-C9QBRGRd.js} +1 -1
  180. package/dist/{vue-ui-wheel-Cd3P9Nq4.js → vue-ui-wheel-EBNVnATV.js} +1 -1
  181. package/dist/vue-ui-word-cloud-D_wT_OgE.js +4 -0
  182. package/dist/{vue-ui-world-bZ7gOrS1.js → vue-ui-world-CvjzqQPz.js} +1 -1
  183. package/dist/{vue-ui-xy-Y_MKCMGp.js → vue-ui-xy-B0z97XdU.js} +1 -1
  184. package/dist/{vue-ui-xy-BTGZ1NSt.js → vue-ui-xy-ZTbijg4Q.js} +3 -3
  185. package/dist/{vue-ui-xy-canvas-C8Xi5Bad.js → vue-ui-xy-canvas-QqaK6zlu.js} +1 -1
  186. package/dist/vue_ui_galaxy-fL8NyfDy.js +1 -0
  187. package/package.json +15 -15
  188. package/dist/UserOptions-K1N7zQRx.js +0 -1
  189. package/dist/package-BPQ4kSL9.js +0 -1
  190. package/dist/vue-data-ui-CeZQZazG.js +0 -1
  191. package/dist/vue-ui-galaxy-HndquOs-.js +0 -1
  192. package/dist/vue-ui-word-cloud-B7iGPkGe.js +0 -4
  193. package/dist/vue_ui_galaxy-iCWLHLBY.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{t as s}from"./chartImage-DPGnEuYM.js";import{$ as c,D as l,Ht as u,X as d,a as f,i as p,nn as m,nt as h,r as ee,x as te}from"./lib-rPeBMZrn.js";import{t as ne}from"./useConfig-CXhXxWjB.js";import{t as re}from"./usePrinter-DVf3YcG5.js";import{t as ie}from"./useNestedProp-DnGoh-XS.js";import{t as ae}from"./useThemeCheck-BKNRbGeC.js";import{t as oe}from"./useTransitions-ChGGrtrv.js";import{t as se}from"./useChartExport-BZts4KFb.js";import{t as ce}from"./useUserOptionState-CXlFnwPv.js";import{n as le,t as ue}from"./useHints-C-TwxM0Y.js";import{n as de}from"./Title-BliHuXfT.js";import{t as fe}from"./vue_ui_hill-B6vghkYj.js";import{t as pe}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as g,computed as _,createBlock as me,createCommentVNode as v,createElementBlock as y,createElementVNode as b,createSlots as he,createVNode as ge,defineAsyncComponent as _e,guardReactiveProps as ve,mergeProps as ye,nextTick as be,normalizeClass as xe,normalizeProps as Se,normalizeStyle as x,onBeforeUnmount as Ce,onMounted as we,openBlock as S,ref as C,renderList as w,renderSlot as T,shallowRef as Te,toDisplayString as E,unref as D,useTemplateRef as Ee,watch as De,withCtx as Oe,withKeys as ke,withModifiers as O}from"vue";var Ae=/* @__PURE__ */ e({default:()=>wt}),je=[`id`,`data-editing`],Me={key:0,ref:`chartTitle`,style:`width:100%;background:transparent;padding-bottom:24px`},Ne={key:3,class:`vue-ui-hill__toolbar`,"data-dom-to-png-ignore":``},Pe=[`viewBox`],Fe=[`width`,`height`],Ie=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],Le=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],Re=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],ze={key:0,"pointer-events":`none`},Be=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],Ve=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],He=[`transform`,`font-size`,`fill`,`stroke`],Ue=[`transform`,`data-datapoint-index`,`data-datapoint-id`,`tabindex`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`onFocus`,`onBlur`,`onKeydown`,`onPointerenter`,`onPointerleave`,`onClick`],We=[`r`,`onPointerdown`],Ge=[`r`,`fill`,`stroke`,`stroke-width`],Ke=[`stroke`,`stroke-width`],qe=[`d`],Je=[`x`,`y`,`text-anchor`,`fill`,`font-size`,`font-weight`,`stroke`,`stroke-width`],Ye=[`transform`,`tabindex`,`aria-label`,`aria-expanded`,`onClick`,`onFocus`,`onKeydown`],Xe={key:0,class:`vue-ui-hill__stack-overflow-collapse-ghosts`,"pointer-events":`none`,"aria-hidden":`true`},Ze=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Qe=[`from`,`dur`],$e=[`from`,`dur`],et=[`from`,`to`,`dur`],tt=[`dur`],nt=[`r`],rt=[`x`,`y`,`width`,`height`,`fill`,`stroke`,`stroke-width`],it=[`stroke`,`stroke-width`],at=[`d`],ot=[`y`,`fill`,`font-size`,`font-weight`,`stroke`],st=[`x`,`y`,`fill`,`font-size`,`font-weight`,`letter-spacing`],ct=[`x`,`y`,`fill`,`font-size`,`font-weight`,`letter-spacing`],lt=[`x`,`y`,`rx`,`width`,`height`,`fill`],ut=[`id`],dt=[`x`,`y`,`width`,`height`,`rx`,`ry`],ft=[`clip-path`],pt=[`width`,`x`,`y`,`fill`,`height`,`onPointerenter`,`onPointerleave`],mt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],ht=[`x`,`y`,`width`,`height`,`rx`,`ry`,`stroke`,`stroke-width`],gt=[`x`,`y`,`fill`,`font-size`],_t=[`aria-label`,`onKeydown`],vt={key:0,class:`vue-ui-hill__stack-overflow-menu-title`},yt=[`disabled`,`aria-label`,`onClick`],bt={class:`vue-ui-hill__stack-overflow-menu-label`},xt={class:`vue-ui-hill__stack-overflow-menu-value`},St={key:6,class:`vue-data-ui-watermark`},Ct={key:7,class:`vue-ui-hill__loading`,"data-dom-to-png-ignore":``},wt=/*#__PURE__*/ pe({__name:`vue-ui-hill`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`edit`,`save`,`cancel`,`copyAlt`,`change`,`dragStart`,`dragEnd`,`datapointEnter`,`datapointLeave`,`selectDatapoint`],setup(e,{expose:pe,emit:Ae}){let wt=_e(()=>import(`./HillActions-D--h5brJ.js`)),Tt=_e(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Et=_e(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),Dt=_e(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Ot=_e(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),{vue_ui_hill:kt}=ne(),{isThemeValid:At,warnInvalidTheme:jt}=ae(),Mt=e,Nt=C(d()),k=Te(null),Pt=Ee(`hillChartRef`),A=Ee(`svgRef`),Ft=Ee(`overflowMenuRef`),It=Ee(`userOptionsRef`),Lt=C(0),Rt=Ae;function zt(){let e=ie({userConfig:Mt.config,defaultConfig:kt}),t={},n=e.theme;if(!n)t=e;else if(!At.value(e))jt(e),t=e;else{let r=ie({userConfig:fe[n]||Mt.config,defaultConfig:e});t={...ie({userConfig:Mt.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:m[n]||nn}}return t}let j=C(zt()),M=_(()=>j.value.style.chart.layout.plots),N=_(()=>j.value.style.chart);le({config:()=>j.value,dataset:()=>Mt.dataset,component:`VueUiHill`,rules:[ue.emptyArray,ue.noHint]});let{transitionEnabled:P}=oe({config:()=>j.value.transitions,dataset:()=>Mt.dataset}),{userOptionsVisible:Bt,setUserOptionsVisibility:Vt,keepUserOptionState:Ht}=ce({config:j.value});function Ut(){Vt(!0)}function Wt(){Vt(!1),er.value=null,$.value=null,$n.value=null}let{isPrinting:Gt,isImaging:Kt,generatePdf:qt,generateImage:Jt}=re({elementId:`hill_${Nt.value}`,fileName:N.value.title.text||`vue-ui-hill`,options:j.value.userOptions.print}),Yt=_(()=>j.value.userOptions.useCursorPointer),Xt=C(0),Zt=C(!1);function Qt(e){Zt.value=e,Xt.value+=1}let $t=C(!1);function en(){$t.value=!$t.value}let tn=_(()=>j.value.userOptions.position===`left`?`right`:`left`);De(()=>Mt.config,()=>{k.value=null,j.value=zt(),Xt.value+=1,F.value!==j.value.editing&&(F.value=j.value.editing&&!j.value.readonly)},{deep:!0});let nn=_(()=>{let e=j.value.customPalette;return Array.isArray(e)&&e.length?e:u});function rn(e){let t=Number(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function an(e){if(e<=0)return`todo`;if(e>=1)return`done`;let t=.5,n=Math.min(t,Math.max(0,Number(j.value.interaction.peakTolerance)||0)),r=t-n,i=t+n;return e>=r&&e<=i?`top`:e<t?`left`:`right`}function on(e,t){let n=e&&typeof e==`object`?e:{},r=`Item ${t+1}`,i=String(n.name??n.label??r),a=rn(n.position??n.value??0);return{...n,id:String(n.id??`${i}-${t}`),name:i,label:String(n.label??i),position:a,color:n.color||nn.value[t%nn.value.length],muted:!!n.muted,disabled:!!n.disabled,status:an(e.position),labelSide:[`left`,`right`,`auto`].includes(n.labelSide)?n.labelSide:`auto`,__index:t}}let sn=_(()=>Array.isArray(Mt.dataset)?Mt.dataset.map(on):[]);function cn(e){return e.map(e=>({...e}))}function ln(e){let{__index:t,...n}=e;return Object.prototype.hasOwnProperty.call(n,`value`)&&(n.value=n.position),n}function un(e=I.value){return e.map(ln)}let dn=_(()=>j.value.editing&&!j.value.readonly),F=C(dn.value),I=C(cn(sn.value)),L=C(null);De(sn,e=>{F.value||(k.value=null,I.value=cn(e))},{deep:!0});let R=_(()=>!j.value.readonly);De(R,e=>{e||(L.value=null,k.value=null,F.value=!1,I.value=cn(sn.value))});function z(e,t){Rt(e,t);let n=j.value.events?.[e];typeof n==`function`&&n(t)}let B=_(()=>N.value),fn=_(()=>B.value.layout),V=_(()=>fn.value.hill),H=_(()=>fn.value.plots),U=_(()=>fn.value.labels.item),W=_(()=>fn.value.labels.phases),G=_(()=>B.value.toolbar),K=_(()=>fn.value.stackbar),q=_(()=>{let e=H.value.stacking?.overflow||{},t=Math.max(0,Number(H.value.radius)||0);return{show:e.show!==!1,marker:{radius:Math.max(4,Number(e.marker?.radius)||t),fill:e.marker.fill,stroke:e.marker?.stroke||H.value.stroke,strokeWidth:e.marker.strokeWidth,color:e.marker.labelColor,fontSize:e.marker.fontSize,bold:e.marker?.bold!==!1,offsetY:e.marker.labelOffsetY},hysteresis:t*1.5,transitionDuration:P.value?e.transitionDuration:0,menu:{width:Math.max(160,Number(e.menu?.width)||220),maxHeight:Math.max(96,Number(e.menu?.maxHeight)||220),backgroundColor:e.menu?.backgroundColor||B.value.backgroundColor,color:e.menu?.color||B.value.color,borderColor:e.menu?.borderColor||H.value.stroke,borderRadius:Math.max(0,Number(e.menu?.borderRadius)||6)}}});function pn(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.min(n,Math.max(0,r)):t}let J=_(()=>{let e=V.value.geometry||{},t=Math.max(0,Number(B.value.width)||0),n=Math.max(0,Number(B.value.height)||0),r=pn(e.horizontalPaddingRatio,.02,.49),i=pn(e.topPaddingRatio,.12,.49),a=pn(e.bottomPaddingRatio,.2,.49),o=pn(e.curvature,.65),s=t*r,c=t/2,l=t*(1-r),u=n*i,d=n*(1-a),f=c-s,p=l-c,m=s+f*o,h=c+p*(1-o);return{startX:s,centerX:c,endX:l,baseY:d,peakY:u,width:f+p,left:[{x:s,y:d},{x:m,y:d},{x:m,y:u},{x:c,y:u}],right:[{x:c,y:u},{x:h,y:u},{x:h,y:d},{x:l,y:d}]}}),mn=_(()=>{let{left:e,right:t}=J.value;return[`M${e[0].x} ${e[0].y}`,`C${e[1].x} ${e[1].y} ${e[2].x} ${e[2].y} ${e[3].x} ${e[3].y}`,`C${t[1].x} ${t[1].y} ${t[2].x} ${t[2].y} ${t[3].x} ${t[3].y}`].join(` `)});function hn(e,t,n,r,i){let a=1-i;return a**3*e+3*a**2*i*t+3*a*i**2*n+i**3*r}function gn(e,t,n,r,i){let a=1-i;return 3*a**2*(t-e)+6*a*i*(n-t)+3*i**2*(r-n)}function _n(e){let t=rn(e),{startX:n,centerX:r,endX:i,left:a,right:o}=J.value,s=n+(t-0)/1*(i-n),c=s<=r?a:o,l=0,u=1;for(let e=0;e<28;e+=1){let e=(l+u)/2;hn(c[0].x,c[1].x,c[2].x,c[3].x,e)<s?l=e:u=e}let d=(l+u)/2,f=hn(c[0].y,c[1].y,c[2].y,c[3].y,d),p=gn(c[0].x,c[1].x,c[2].x,c[3].x,d),m=gn(c[0].y,c[1].y,c[2].y,c[3].y,d),h=Math.hypot(p,m)||1;return{x:s,y:f,normalX:m/h,normalY:-p/h}}function vn(e){let t=Number(H.value.stacking.overlapThresholdRatio);return e*(2-(Number.isFinite(t)?Math.min(2,Math.max(0,t)):.5))}function yn(e,t){let n=/* @__PURE__ */ new Map,r=H.value.stacking;if(e.forEach(e=>{n.set(e.id,{position:e.position,index:0,size:1,stackId:`stack:${e.id}`})}),!r.show||e.length<2||t<=0)return n;let i=vn(t),a=e.map((e,t)=>({datapoint:e,index:t,point:_n(e.position)})).sort((e,t)=>e.point.x-t.point.x||e.datapoint.position-t.datapoint.position||e.index-t.index),o=0;for(;o<a.length;){let e=[a[o]],t=o+1;for(;t<a.length;){let n=e[e.length-1],r=a[t];if(Math.hypot(r.point.x-n.point.x,r.point.y-n.point.y)>=i)break;e.push(r),t+=1}if(e.length>1){let t=e[0].datapoint.position,r=`stack:${e.map(({datapoint:e})=>e.id).sort().join(`|`)}`;e.forEach(({datapoint:i},a)=>{n.set(i.id,{position:t,index:a,size:e.length,stackId:r})})}o=t}return n}function bn(e){let t=e+Math.max(0,Number(H.value.strokeWidth)||0)/2,n=H.value.stacking.gap??e/2;return t*2+n}let xn=C(null),Y=C(null),X=C(null),Sn=C(null),Cn=C(null),wn=/* @__PURE__ */ new Set,Tn=null,Z=null,Q=null;function En(e){let t=Math.max(0,Number(H.value.strokeWidth)||0),n=H.value.shadow.show?Math.max(0,Number(H.value.shadow.blur)||0)+Math.max(0,-(Number(H.value.shadow.offsetY)||0)):0;return e+t/2+n}function Dn(e,t,n){if(t<=1)return e-En(n);let r=bn(n);return e-(t-1)*r-En(n)}function On(e,t,n,r){if(n<=1)return wn.delete(e),!1;let i=Dn(t,n,r),a=wn.has(e),o=q.value.hysteresis,s=a?i<o:i<0;return s?wn.add(e):wn.delete(e),s}let kn=_(()=>{let e=Math.max(0,Number(H.value.radius)||0),t=bn(e),n=yn(I.value,e),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=[],o=/* @__PURE__ */ new Set,s=L.value?.id??null;q.value.show||wn.clear(),I.value.forEach(e=>{let t=n.get(e.id)||{position:e.position,index:0,size:1,stackId:`stack:${e.id}`};r.has(t.stackId)||r.set(t.stackId,[]),r.get(t.stackId).push({datapoint:e,stack:t})});let c=new Set(r.keys());return wn.forEach(e=>{c.has(e)||wn.delete(e)}),r.forEach((n,r)=>{let c=[...n].sort((e,t)=>e.stack.index-t.stack.index||e.datapoint.__index-t.datapoint.__index),l=c.reduce((e,t)=>e+(Number(t.datapoint.position)||0),0)/c.length,u=_n(l);if(!(q.value.show&&On(r,u.y,c.length,e))){c.forEach(e=>{i.set(e.datapoint.id,{hidden:!1,displayIndex:e.stack.index,stackId:r,stackSize:c.length,promotedFromOverflow:!1,renderPosition:e.stack.position})});return}c.forEach(({datapoint:e})=>{o.add(e.id)});let d=s?c.find(({datapoint:e})=>e.id===s):null,f=c.find(({datapoint:e})=>e.id===xn.value),p=d||f||null,m=p?c.filter(({datapoint:e})=>e.id!==p.datapoint.id):c,h=Y.value,ee=!(!f||h?.datapointId!==f.datapoint.id||h.moved),te=m.length?ee?l:m.reduce((e,t)=>e+(Number(t.datapoint.position)||0),0)/m.length:l,ne=_n(te);c.forEach(e=>{let t=p?.datapoint.id===e.datapoint.id,n=t&&f?.datapoint.id===e.datapoint.id;i.set(e.datapoint.id,{hidden:!t,displayIndex:+!!t,stackId:r,stackSize:c.length,promotedFromOverflow:n,renderPosition:te})}),m.length&&a.push({stackId:r,anchorPosition:te,x:ne.x,y:ne.y,hiddenCount:m.length,hiddenDatapoints:m.map(({datapoint:e})=>e),memberIds:c.map(({datapoint:e})=>e.id),collapseDatapoints:m.map(({datapoint:e,stack:n})=>{let r=_n(n.position);return{id:e.id,color:e.color,relativeX:r.x-ne.x,relativeY:r.y-n.index*t-ne.y}})})}),{layoutMap:n,displayMap:i,markers:a,overflowMemberIds:o}});function An(e){let t=Mn.value.filter(e=>!e.isStackOverflowHidden),n=t.find(t=>t.id===e),r=new Map(t.filter(t=>t.id!==e).map(e=>[e.id,{x:e.x,y:e.y}]));if(!n||!H.value.stacking.show)return r;let i=t.filter(e=>Math.abs(e.x-n.x)<.001).sort((e,t)=>t.y-e.y||e.datasetIndex-t.datasetIndex);if(i.length<2)return r;let a=bn(Math.max(0,Number(H.value.radius)||0)),o=Math.max(...i.map(e=>e.y));return i.filter(t=>t.id!==e).forEach((e,t)=>{r.set(e.id,{x:n.x,y:o-t*a})}),r}function jn(){return new Map(Mn.value.filter(e=>!e.isStackOverflowHidden).map(e=>[e.id,{x:e.x,y:e.y}]))}let Mn=_(()=>{let e=Math.max(0,Number(H.value.radius)||0),{layoutMap:t,displayMap:n,markers:r}=kn.value,i=bn(e),a=L.value,o=a?.stationaryLayout,s=o instanceof Map?o:k.value instanceof Map?k.value:null,c=null;if(a&&o instanceof Map&&H.value.stacking.show&&e>0){let t=I.value.find(e=>e.id===a.id);if(t){let n=r.find(e=>e.memberIds.includes(t.id));if(n)c={x:n.x,y:n.y-i};else{let n=_n(t.position),r=vn(e),s=I.value.filter(e=>e.id!==a.id&&o.has(e.id)).map(e=>{let t=_n(e.position);return{datapoint:e,distance:Math.hypot(t.x-n.x,t.y-n.y)}}).filter(({distance:e})=>e<r).sort((e,t)=>e.distance-t.distance)[0];if(s){let e=o.get(s.datapoint.id),t=[...o.values()].filter(t=>Math.abs(t.x-e.x)<.001),n=Math.min(e.y,...t.map(e=>e.y));c={x:e.x,y:n-i}}else c=n}}}return I.value.map((e,r)=>{let o=t.get(e.id)||{position:e.position,index:0,size:1,stackId:`stack:${e.id}`},l=n.get(e.id)||{hidden:!1,displayIndex:o.index,stackId:o.stackId,stackSize:o.size,renderPosition:o.position},u=_n(l.renderPosition??o.position),d=e.id!==a?.id&&!l.promotedFromOverflow&&s instanceof Map?s.get(e.id):null,f=e.id===a?.id&&c?c:d||{x:u.x,y:u.y-l.displayIndex*i},p=e.labelSide===`auto`?null:e.labelSide,m=te(U.value.autoSideThreshold,.5,1),h=p||(e.position>m?`left`:`right`),ee=Math.abs(Number(U.value.offsetX)||0)+H.value.radius+U.value.fontSize/2;return{...e,datasetIndex:r,x:f.x,y:f.y,stackId:l.stackId,stackSize:l.stackSize,stackDisplayIndex:l.displayIndex,isStackOverflowHidden:l.hidden,isPromotedFromStackOverflow:l.promotedFromOverflow,labelSide:h,labelX:h===`left`?-ee:ee,textAnchor:h===`left`?`end`:`start`}})});function Nn(e){return I.value.find(t=>t.id===e)}function Pn(e,t){let n=rn(t),r;I.value=I.value.map(t=>t.id===e?(r={...t,position:n},r):t),r&&(br(r.id,r.position),z(`change`,{datapoint:ln(r),dataset:un()}))}function Fn(e){let t=A.value;if(!t)return null;let n=t.getScreenCTM();if(!n)return null;let r=t.createSVGPoint();r.x=e,r.y=0;let i=r.matrixTransform(n.inverse()),{startX:a,endX:o}=J.value;return rn(0+(i.x-a)/(o-a)*1)}function In(){R.value&&(X.value=null,xn.value=null,Y.value=null,Cn.value=null,pr(),k.value=null,I.value=cn(sn.value),F.value=!0,z(`edit`,un()))}function Ln(){let e=un();X.value=null,xn.value=null,Y.value=null,Cn.value=null,pr(),L.value=null,F.value=!1,z(`save`,e)}function Rn(){X.value=null,xn.value=null,Y.value=null,Cn.value=null,pr(),L.value=null,k.value=null,I.value=cn(sn.value),F.value=!1,z(`cancel`,un())}function zn(e,t){if(!R.value||!F.value||t.disabled)return;X.value=null;let n=e.currentTarget.closest(`.vue-ui-hill__datapoint`);n&&typeof n.focus==`function`&&(n.focus(),$.value=t.id),e.preventDefault();let r=An(t.id),i=Y.value?.datapointId===t.id&&!Y.value?.moved;if(L.value={id:t.id,pointerId:e.pointerId,stationaryLayout:r,startClientX:e.clientX,hasMoved:!1,deferPositionUpdate:i},A.value?.setPointerCapture(e.pointerId),!i){let n=Fn(e.clientX);n!==null&&Pn(t.id,n)}let a=Nn(t.id);a&&z(`dragStart`,ln(a))}function Bn(e){if(!L.value||L.value.pointerId!==e.pointerId)return;e.preventDefault();let t=Math.abs(e.clientX-L.value.startClientX);if(L.value.deferPositionUpdate&&!L.value.hasMoved&&t<3)return;L.value.hasMoved||(L.value={...L.value,hasMoved:!0});let n=Fn(e.clientX);n!==null&&Pn(L.value.id,n)}function Vn(e){let t=L.value;if(!t||t.pointerId!==e.pointerId)return;A.value?.hasPointerCapture(e.pointerId)&&A.value.releasePointerCapture(e.pointerId);let n=e.type===`pointerup`&&!t.hasMoved,r=Nn(t.id);k.value=jn(),L.value=null,r&&(n&&z(`selectDatapoint`,Wn(r)),z(`dragEnd`,ln(r)))}function Hn(e,t){if(!R.value||!F.value||t.disabled)return;let n=Math.max(0,Number(j.value.interaction.keyboardStep)||0),r=null;switch(e.key){case`ArrowLeft`:case`ArrowDown`:r=t.position-n;break;case`ArrowRight`:case`ArrowUp`:r=t.position+n;break;case`Home`:r=0;break;case`End`:r=1;break;default:return}e.preventDefault();let i=e.currentTarget;$.value=t.id,L.value={id:t.id,pointerId:null,stationaryLayout:An(t.id)},Pn(t.id,r),k.value=jn(),L.value=null,be(()=>{i?.isConnected&&i.focus({preventScroll:!0})})}function Un(e){let t=.5,n=Math.max(0,Number(j.value.interaction.peakTolerance)||0);return Math.abs(e-t)<=n?j.value.a11y.translations.topOfHill:e<t?W.value.left.text:W.value.right.text}function Wn(e){return{datapoint:ln(e),index:e.__index}}function Gn(e){$.value=null,er.value=e.id,![0,1].includes(e.position)&&$.value!==e.id&&rr(e),z(`datapointEnter`,Wn(e))}function Kn(e){er.value===e.id&&(er.value=null),$n.value===e.id&&$.value!==e.id&&L.value?.id!==e.id&&($n.value=null),z(`datapointLeave`,Wn(e))}function qn(e){F.value&&R.value||z(`selectDatapoint`,Wn(e))}let Jn=_(()=>{let e=B.value;return{width:`100%`,maxWidth:`100%`,color:e.color,backgroundColor:e.backgroundColor,fontFamily:j.value.style.fontFamily,"--vue-ui-hill-button-hover-border":G.value.buttons.hoverBorderColor,"--vue-ui-hill-button-active-offset":`${G.value.buttons.activeTranslateY}px`}}),Yn=_(()=>({color:G.value.status.color,fontSize:`${G.value.status.fontSize}px`,fontWeight:G.value.status.bold?`bold`:`normal`,lineHeight:G.value.status.lineHeight}));_(()=>({color:B.value.title.color,fontSize:`${B.value.title.fontSize}px`,fontWeight:B.value.title.bold?`bold`:`normal`,textAlign:B.value.title.textAlign})),_(()=>({color:B.value.title.subtitle.color,fontSize:`${B.value.title.subtitle.fontSize}px`,fontWeight:B.value.title.subtitle.bold?`bold`:`normal`}));let Xn=_(()=>{let e=Math.max(0,Number(B.value.height)||0);return Math.min(e,J.value.baseY+e)+W.value.offsetY});function Zn(e){return W.value[e].text}function Qn(e){return e.position===0||e.position===1}let $n=C(null),er=C(null),$=C(null);function tr(e){$.value=e.id}function nr(e){$.value===e.id&&($.value=null),$n.value===e.id&&er.value!==e.id&&L.value?.id!==e.id&&($n.value=null)}function rr(e){e?.id&&($n.value=e.id)}let ir=_(()=>{let e=[],t=[],n=null;return Mn.value.forEach(r=>{r.isStackOverflowHidden||(r.id===$n.value?n=r:Qn(r)?e.push(r):t.push(r))}),[...e,...t,...n?[n]:[]]}),ar=_(()=>kn.value.markers),or=_(()=>ar.value.find(e=>e.stackId===X.value)||null),sr=_(()=>{let e=Math.max(160,Number(q.value.menu.width)||220),t=Math.max(80,Number(q.value.menu.maxHeight)||220);return{visibility:Sn.value?`visible`:`hidden`,width:`max-content`,minWidth:`${e}px`,maxWidth:`calc(100% - 16px)`,maxHeight:`${t}px`,backgroundColor:q.value.menu.backgroundColor,color:q.value.menu.color,borderColor:q.value.menu.borderColor,borderRadius:`${q.value.menu.borderRadius}px`}});function cr(e,t){let n=A.value,r=Pt.value;if(!n||!r)return null;let i=n.getScreenCTM();if(!i)return null;let a=n.createSVGPoint();a.x=e,a.y=t;let o=a.matrixTransform(i),s=r.getBoundingClientRect();return{x:o.x-s.left,y:o.y-s.top}}function lr(){let e=or.value,t=Ft.value,n=Pt.value;if(!e||!t||!n){Sn.value=null;return}let r=cr(e.x,e.y),i=cr(e.x,e.y+q.value.marker.radius);if(!r||!i){Sn.value=null;return}let a=n.getBoundingClientRect(),o=t.offsetWidth,s=t.offsetHeight,c=Math.abs(i.y-r.y),l=Math.max(0,a.width-16),u=Math.min(o,l),d=r.x;if(u>=l)d=a.width/2;else{let e=u/2;d=Math.min(a.width-8-e,Math.max(8+e,r.x))}let f=r.y+c+8,p=r.y-c-8-s,m=f+s<=a.height-8,h=p>=8,ee=f;!m&&h?ee=p:m||(ee=Math.min(Math.max(8,f),Math.max(8,a.height-s-8))),Sn.value={left:`${d}px`,top:`${ee}px`,transform:`translateX(-50%)`,visibility:`visible`}}function ur(){typeof window<`u`&&(Q!==null&&window.cancelAnimationFrame(Q),Q=window.requestAnimationFrame(()=>{Q=null,lr()}))}De(ar,e=>{X.value&&!e.some(e=>e.stackId===X.value)&&fr()}),De(()=>{let e=or.value;return e?[e.stackId,e.x,e.y,e.hiddenDatapoints.length,e.hiddenDatapoints.map(e=>`${e.id}:${e.label}:${e.position}`).join(`|`),q.value.marker.radius,q.value.menu.width,q.value.menu.maxHeight,q.value.menu.backgroundColor,q.value.menu.color,q.value.menu.borderColor,q.value.menu.borderRadius,Zt.value]:null},e=>{e?be(ur):Sn.value=null},{flush:`post`}),De(Ft,(e,t)=>{t&&Z&&Z.unobserve(t),e&&Z&&(Z.observe(e),be(ur))},{flush:`post`}),De(()=>{let e=xn.value;return!e||kn.value.overflowMemberIds.has(e)},e=>{e||(xn.value=null,Y.value=null)});function dr(e){e&&(X.value===e.stackId?ur():(Sn.value=null,X.value=e.stackId,be(ur)))}function fr(){X.value=null,Sn.value=null,typeof window<`u`&&Q!==null&&(window.cancelAnimationFrame(Q),Q=null)}function pr(){Tn!==null&&(clearTimeout(Tn),Tn=null)}function mr(){let e=Y.value;e&&!e.moved&&(pr(),Cn.value=e.stackId,xn.value=null,Y.value=null,fr(),Tn=setTimeout(()=>{Cn.value=null,Tn=null},q.value.transitionDuration+80))}function hr(e){if(!(e instanceof Element))return{isMenu:!1,isMarker:!1,isSelectedDatapoint:!1};let t=Y.value,n=e.closest(`[data-datapoint-id]`);return{isMenu:!!e.closest(`[data-stack-overflow-menu]`),isMarker:!!e.closest(`[data-stack-overflow-marker]`),isSelectedDatapoint:!!(t&&n?.getAttribute(`data-datapoint-id`)===t.datapointId)}}function gr(e){let t=hr(e.target);X.value&&!t.isMenu&&!t.isMarker&&fr(),!Y.value||Y.value.moved||t.isMenu||t.isMarker||t.isSelectedDatapoint||mr()}function _r(e){let t=Mn.value.find(t=>t.id===e);if(!t||t.isStackOverflowHidden)return;let n=A.value?.querySelector(`[data-datapoint-index="${t.__index}"]`);n&&typeof n.focus==`function`&&n.focus({preventScroll:!0})}function vr(e){if(!e||e.disabled||j.value.readonly)return;let t=or.value?.stackId;t&&(pr(),Cn.value=null,xn.value=e.id,Y.value={datapointId:e.id,stackId:t,initialPosition:e.position,moved:!1},fr(),be(()=>{_r(e.id);let t=Mn.value.find(t=>t.id===e.id);t&&z(`selectDatapoint`,Wn(t))}))}function yr(){let e=Math.max(1,Number(J.value.width)||1);return Math.max(1e-6,1/e*2)}function br(e,t){let n=Y.value;n&&n.datapointId===e&&!n.moved&&Math.abs(t-n.initialPosition)>=yr()&&(Y.value={...n,moved:!0})}we(()=>{document.addEventListener(`pointerdown`,gr),window.addEventListener(`resize`,ur,{passive:!0}),typeof ResizeObserver<`u`&&(Z=new ResizeObserver(()=>{or.value&&ur()}),Pt.value&&Z.observe(Pt.value),A.value&&Z.observe(A.value))}),Ce(()=>{document.removeEventListener(`pointerdown`,gr),window.removeEventListener(`resize`,ur),Z?.disconnect(),Z=null,Q!==null&&(window.cancelAnimationFrame(Q),Q=null),pr()});function xr(e){return L.value?L.value.id===e.id:er.value===e.id||$.value===e.id}function Sr(e){return p(M.value.dragMarker.positionIndicator.value.formatter,e.position,c({p:``,v:e.position*100,s:`%`,r:M.value.dragMarker.positionIndicator.value.rounding}))}let Cr=_(()=>N.value.backgroundColor),wr=_(()=>N.value.legend),Tr=_(()=>N.value.title),{isCallbackImaging:Er,isCallbackSvg:Dr,generateSvg:Or,onGenerateImage:kr}=se({svg:A,title:Tr,legend:wr,legendItems:null,backgroundColor:Cr,getSvgCallback:()=>j.value.userOptions.callbacks.svg,generateImage:Jt});function Ar(e=null){be(()=>{let t=un().map(e=>[[e.name],[e.position],[Sr(e)],[Un(e.position)]]),n=[[N.value.title.text],[N.value.title.subtitle.text],[[`Name`],[`Position`],[`Percentage`],[`Phase`]]].concat(t),r=l(n);e?e(r):h({csvContent:r,title:N.value.title.text||`vue-ui-hill`})})}let jr=_(()=>N.value.layout.stackbar.show),Mr=_(()=>{let e=Mn.value.length;Mn.value.reduce((e,t)=>e+(t?.position??0),0);let t=0,n=Mn.value.every(e=>e.position===1);return Mn.value.toSorted((e,t)=>{if(n)return e.__index-t.__index;let r=(e?.position??0)-(t?.position??0);return r===0?e.__index-t.__index:r}).map(n=>{let r=n?.position??0,i=e>0?r/e:0,a={...n,proportion:i,proportionStart:t};return t+=i,a})}),Nr=_(()=>Math.min(1,Math.max(0,Mr.value.reduce((e,t)=>e+t.proportion,0)))),Pr=_(()=>Nr.value*100),Fr=_(()=>J.value.left[0].x+J.value.width*Nr.value),Ir=_(()=>B.value.height+32+K.value.paddingTop);function Lr(){return p(K.value.label.formatter,Pr.value,c({p:``,v:Pr.value,s:`%`,r:0}))}let Rr=_(()=>`${Nt.value}-stackbar-clip`);async function zr(){let e=un();Rt(`copyAlt`,{config:j.value,dataset:e}),j.value.userOptions.callbacks.altCopy?await Promise.resolve(j.value.userOptions.callbacks.altCopy({config:j.value,dataset:e})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let Br=s(Pt,()=>N.value.title.text);function Vr(){return un()}return pe({isEditing:F,beginEditing:In,save:Ln,cancel:Rn,getData:Vr,copyAlt:zr,toggleFullscreen:Qt,toggleAnnotator:en,generateImage:Jt,generateSvg:Or,generatePdf:qt,generateCsv:Ar,getImage:Br}),(e,s)=>(S(),y(`div`,{ref_key:`hillChartRef`,ref:Pt,class:xe(`vue-data-ui-component vue-ui-hill`),style:x(Jn.value),id:`hill_${Nt.value}`,onMouseenter:Ut,onMouseleave:Wt,"data-editing":F.value},[N.value.title.text?(S(),y(`div`,Me,[(S(),me(de,{key:`title_${Lt.value}`,config:{title:{cy:`hill-div-title`,...N.value.title},subtitle:{cy:`hill-div-subtitle`,...N.value.title.subtitle}}},null,8,[`config`]))],512)):v(``,!0),j.value.userOptions.buttons.annotator&&A.value?(S(),me(D(Dt),ye({key:1},D(a)(j.value.userOptions.annotator),{color:N.value.color,backgroundColor:N.value.backgroundColor,active:$t.value,svgRef:A.value,isCursorPointer:Yt.value,palette:j.value.userOptions.annotatorPalette,onClose:en}),he({_:2},[w(D(o),t=>({name:t,fn:Oe(n=>[T(e.$slots,t,Se(ve(D(i)(t,n))),void 0,!0)])}))]),1040,[`color`,`backgroundColor`,`active`,`svgRef`,`isCursorPointer`,`palette`])):v(``,!0),G.value.show?(S(),me(D(wt),{key:2,"is-editing":F.value,"is-editable":R.value,"is-fullscreen":Zt.value,position:tn.value,color:N.value.color,"background-color":N.value.backgroundColor,translations:G.value.buttons.translations,"is-cursor-pointer":Yt.value,onUpdate:In,onCancel:Rn,onSave:Ln},{"hill-edit":Oe(()=>[T(e.$slots,`hill-edit`,{},void 0,!0)]),"hill-cancel":Oe(()=>[T(e.$slots,`hill-cancel`,{},void 0,!0)]),"hill-save":Oe(()=>[T(e.$slots,`hill-save`,{},void 0,!0)]),_:3},8,[`is-editing`,`is-editable`,`is-fullscreen`,`position`,`color`,`background-color`,`translations`,`is-cursor-pointer`])):v(``,!0),G.value.show?(S(),y(`div`,Ne,[b(`p`,{class:`vue-ui-hill__status`,style:x(Yn.value),"aria-live":`polite`},E(F.value?G.value.status.editInstruction:G.value.status.lastUpdated),5)])):v(``,!0),j.value.userOptions.show&&(D(Ht)||D(Bt))?(S(),me(D(Tt),ye({ref_key:`userOptionsRef`,ref:It,key:`uo_${Xt.value}`,backgroundColor:N.value.backgroundColor,color:N.value.color,isPrinting:D(Gt),isImaging:D(Kt),uid:Nt.value,hasTooltip:!1,isFullscreen:Zt.value,chartElement:Pt.value},D(n)(j.value.userOptions,`pdf csv img svg labels table fullscreen altCopy annotator`),{isAnnotation:$t.value,isCursorPointer:Yt.value,onToggleFullscreen:Qt,onGeneratePdf:D(qt),onGenerateCsv:Ar,onGenerateImage:D(kr),onGenerateSvg:D(Or),onToggleAnnotator:en,onCopyAlt:zr,style:{visibility:D(Ht)?D(Bt)?`visible`:`hidden`:`visible`}}),he({_:2},[w(D(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Oe(n=>[T(e.$slots,t,Se(ve(D(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):v(``,!0),(S(),y(`svg`,{ref_key:`svgRef`,ref:A,style:x({background:`transparent`,color:N.value.color,fontFamily:j.value.style.fontFamily}),class:xe({"vue-data-ui-no-transition":!D(P)}),viewBox:`0 0 ${B.value.width} ${B.value.height+(jr.value?32+K.value.paddingTop+K.value.paddingBottom+K.value.height:0)}`,role:`group`,"aria-live":`polite`,preserveAspectRatio:`xMidYMid meet`,onPointermove:Bn,onPointerup:Vn,onPointercancel:Vn},[ge(D(Et)),T(e.$slots,`svg-underlayer`,{svg:{drawingArea:J.value,isEditing:F.value,datapoints:ir.value,isPrintingImg:D(Gt)||D(Kt)||D(Er),isPrintingSvg:D(Dr)}},void 0,!0),e.$slots[`chart-background`]?(S(),y(`foreignObject`,{key:0,x:0,y:0,width:Math.max(.1,B.value.width),height:Math.max(.1,B.value.height+(jr.value?32+K.value.paddingTop+K.value.paddingBottom+K.value.height:0)),style:{pointerEvents:`none`}},[T(e.$slots,`chart-background`,{},void 0,!0)],8,Fe)):v(``,!0),V.value.baseline.show?(S(),y(`line`,{key:1,x1:J.value.startX,x2:J.value.endX,y1:J.value.baseY,y2:J.value.baseY,stroke:V.value.baseline.stroke,"stroke-width":V.value.baseline.strokeWidth,"stroke-dasharray":V.value.baseline.strokeDasharray,"vector-effect":`non-scaling-stroke`},null,8,Ie)):v(``,!0),V.value.midline.show?(S(),y(`line`,{key:2,x1:J.value.centerX,x2:J.value.centerX,y1:J.value.peakY,y2:J.value.baseY,stroke:V.value.midline.stroke,"stroke-width":V.value.midline.strokeWidth,"stroke-dasharray":V.value.midline.strokeDasharray,"vector-effect":`non-scaling-stroke`},null,8,Le)):v(``,!0),b(`path`,{d:mn.value,fill:`none`,stroke:V.value.curve.stroke,"stroke-width":V.value.curve.strokeWidth,"stroke-dasharray":V.value.curve.strokeDasharray,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`},null,8,Re),M.value.dragMarker.positionIndicator.show?(S(!0),y(g,{key:3},w(ir.value,e=>(S(),y(`g`,{key:`position-indicator-${e.id}`},[xr(e)&&H.value.dragMarker.show?(S(),y(`g`,ze,[b(`path`,{d:`M${e.x},${e.y} ${e.x},${J.value.baseY}`,stroke:M.value.dragMarker.positionIndicator.useSerieColor?e.color:M.value.dragMarker.positionIndicator.color,"stroke-width":M.value.dragMarker.positionIndicator.strokeWidth,"stroke-dasharray":M.value.dragMarker.positionIndicator.strokeDasharray,"stroke-linecap":`round`,"vector-effect":`non-scaling-stroke`,class:xe({"vue-data-ui-transition":D(P)&&L.value?.id!==e.id})},null,10,Be),M.value.dragMarker.positionIndicator.circle.show?(S(),y(`circle`,{key:0,cx:e.x,cy:J.value.baseY,r:M.value.dragMarker.positionIndicator.circle.radius,fill:M.value.dragMarker.positionIndicator.useSerieColor?e.color:M.value.dragMarker.positionIndicator.color,stroke:M.value.dragMarker.positionIndicator.circle.stroke,"stroke-width":M.value.dragMarker.positionIndicator.circle.strokeWidth,"vector-effect":`non-scaling-stroke`,"paint-order":`stroke fill`,class:xe({"vue-data-ui-transition":D(P)&&L.value?.id!==e.id})},null,10,Ve)):v(``,!0),M.value.dragMarker.positionIndicator.value.show?(S(),y(`text`,{key:1,"paint-order":`stroke fill`,"vector-effect":`non-scaling-stroke`,"text-anchor":`middle`,transform:`translate(${e.x}, ${J.value.baseY+M.value.radius+M.value.dragMarker.positionIndicator.value.offsetY+M.value.dragMarker.positionIndicator.value.fontSize})`,"font-size":M.value.dragMarker.positionIndicator.value.fontSize,fill:M.value.dragMarker.positionIndicator.value.useSerieColor?e.color:M.value.dragMarker.positionIndicator.value.color,stroke:N.value.backgroundColor,"stroke-width":`1`,class:xe({"vue-data-ui-transition":D(P)&&L.value?.id!==e.id})},E(Sr(e)),11,He)):v(``,!0)])):v(``,!0)]))),128)):v(``,!0),(S(!0),y(g,null,w(ir.value,e=>(S(),y(`g`,{key:e.id,"data-cy-datapoint":``,class:xe({"vue-ui-hill__datapoint":!0,"vue-data-ui-transition":D(P)&&L.value?.id!==e.id,"vue-ui-hill__datapoint--promoted":D(P)&&e.isPromotedFromStackOverflow}),style:x({opacity:[0,1].includes(e.position)||e?.muted?H.value.mutedOpacity:e?.disabled?H.value.disabledOpacity:1}),transform:`translate(${e.x} ${e.y})`,"data-datapoint-index":e.__index,"data-datapoint-id":e.id,role:`slider`,tabindex:F.value&&R.value&&!e.disabled?0:-1,"aria-orientation":`horizontal`,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-valuenow":Sr(e),"aria-valuetext":`${e.label}: ${Un(e.position)}, ${Sr(e)}`,"aria-label":e.label,onFocus:t=>tr(e),onBlur:t=>nr(e),onKeydown:t=>Hn(t,e),onPointerenter:t=>Gn(e),onPointerleave:t=>Kn(e),onClick:t=>qn(e)},[b(`circle`,{r:H.value.hitRadius,fill:`transparent`,class:xe({"vue-ui-hill__hit-area--active":F.value&&R.value&&!e.disabled,"vue-ui-hill__hit-area--dragging":L.value?.id===e.id}),onPointerdown:t=>zn(t,e)},null,42,We),b(`circle`,{class:`vue-ui-hill-circle`,r:H.value.radius,fill:e.color,stroke:H.value.stroke,"stroke-width":H.value.strokeWidth,style:x({filter:H.value.shadow.show?`drop-shadow(${H.value.shadow.offsetX}px ${H.value.shadow.offsetY}px ${H.value.shadow.blur}px ${H.value.shadow.color})`:`none`}),"vector-effect":`non-scaling-stroke`,"pointer-events":`none`},null,12,Ge),F.value&&(L.value?.id===e.id&&H.value.dragMarker.show||xr(e))&&!e?.disabled?(S(),y(`g`,{key:0,fill:`none`,stroke:D(ee)(e.color),"stroke-width":H.value.dragMarker.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`,"vector-effect":`non-scaling-stroke`,"aria-hidden":`true`},[b(`path`,{d:H.value.dragMarker.crossPath},null,8,qe)],8,Ke)):v(``,!0),U.value.show?(S(),y(`text`,{key:1,x:e.labelX,y:U.value.offsetY,"text-anchor":e.textAnchor,fill:U.value.useSerieColor?e.color:U.value.color,"font-size":U.value.fontSize,"font-weight":U.value.bold?`bold`:`normal`,"paint-order":`stroke fill`,stroke:U.value.stroke,"stroke-width":U.value.strokeWidth,"stroke-linejoin":`round`,"stroke-linecap":`round`,"pointer-events":`none`,style:{"user-select":`none`},"dominant-baseline":`central`},E(D(f)(e.label,U.value.ellipsisThresholdChars)),9,Je)):v(``,!0)],46,Ue))),128)),(S(!0),y(g,null,w(ar.value,e=>(S(),y(`g`,{key:`stack-overflow-${e.stackId}`,class:xe([`vue-ui-hill__stack-overflow-marker`,{"vue-ui-hill__stack-overflow-marker--animated":D(P),"vue-ui-hill__stack-overflow-marker--restored":Cn.value===e.stackId}]),style:x({"--vue-ui-hill-overflow-marker-duration":`${q.value.transitionDuration*.7}ms`,"--vue-ui-hill-overflow-marker-delay":`${q.value.transitionDuration*.3}ms`,"--vue-ui-hill-overflow-label-duration":`${q.value.transitionDuration*.55}ms`,"--vue-ui-hill-overflow-label-delay":`${q.value.transitionDuration*.45}ms`,cursor:Yt.value&&!j.value.readonly?`pointer`:`default`}),transform:`translate(${e.x} ${e.y})`,"data-stack-overflow-marker":``,role:`button`,tabindex:F.value&&R.value?0:-1,"aria-label":`${e.hiddenCount} stacked datapoints. Activate to choose one.`,"aria-expanded":X.value===e.stackId,onPointerdown:s[0]||=O(()=>{},[`stop`]),onClick:O(t=>dr(e),[`stop`]),onFocus:t=>dr(e),onKeydown:[ke(O(t=>dr(e),[`prevent`,`stop`]),[`enter`]),ke(O(t=>dr(e),[`prevent`,`stop`]),[`space`]),ke(O(fr,[`prevent`,`stop`]),[`esc`])]},[D(P)&&Cn.value!==e.stackId?(S(),y(`g`,Xe,[(S(!0),y(g,null,w(e.collapseDatapoints,t=>(S(),y(`circle`,{key:`overflow-ghost-${e.stackId}-${t.id}`,cx:t.relativeX,cy:t.relativeY,r:H.value.radius,fill:t.color,stroke:H.value.stroke,"stroke-width":H.value.strokeWidth,opacity:`0.8`,"vector-effect":`non-scaling-stroke`},[b(`animate`,{attributeName:`cx`,from:t.relativeX,to:`0`,dur:`${q.value.transitionDuration}ms`,fill:`freeze`,calcMode:`spline`,keyTimes:`0;1`,keySplines:`0.22 1 0.36 1`},null,8,Qe),b(`animate`,{attributeName:`cy`,from:t.relativeY,to:`0`,dur:`${q.value.transitionDuration}ms`,fill:`freeze`,calcMode:`spline`,keyTimes:`0;1`,keySplines:`0.22 1 0.36 1`},null,8,$e),b(`animate`,{attributeName:`r`,from:H.value.radius,to:q.value.marker.radius*.7,dur:`${q.value.transitionDuration}ms`,fill:`freeze`},null,8,et),b(`animate`,{attributeName:`opacity`,from:`0.8`,to:`0`,dur:`${q.value.transitionDuration*.85}ms`,fill:`freeze`},null,8,tt)],8,Ze))),128))])):v(``,!0),b(`circle`,{r:Math.max(H.value.hitRadius,q.value.marker.radius),fill:`transparent`,"pointer-events":`all`},null,8,nt),b(`rect`,{class:`vue-ui-hill__stack-overflow-marker-rect`,x:-q.value.marker.radius,y:-q.value.marker.radius,width:q.value.marker.radius*2,height:q.value.marker.radius*2,fill:q.value.marker.fill,stroke:q.value.marker.stroke,"stroke-width":q.value.marker.strokeWidth,"vector-effect":`non-scaling-stroke`,"pointer-events":`none`},null,8,rt),b(`g`,{class:`vue-ui-hill__stack-overflow-focus-cross`,fill:`none`,stroke:D(ee)(V.value.curve.stroke),"stroke-width":H.value.dragMarker.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`,"vector-effect":`non-scaling-stroke`,"aria-hidden":`true`},[b(`path`,{d:H.value.dragMarker.crossPath},null,8,at)],8,it),or.value?v(``,!0):(S(),y(`text`,{key:1,class:`vue-ui-hill__stack-overflow-marker-label`,"text-anchor":`middle`,y:q.value.marker.radius+q.value.marker.offsetY+q.value.marker.fontSize,fill:q.value.marker.color,"font-size":q.value.marker.fontSize,"font-weight":q.value.marker.bold?`bold`:`normal`,"pointer-events":`none`,style:{"user-select":`none`},"paint-order":`stroke fill`,"vector-effect":`non-scaling-stroke`,stroke:N.value.backgroundColor,"stroke-width":`3`},` +`+E(e.hiddenCount),9,ot))],46,Ye))),128)),W.value.show?(S(),y(g,{key:4},[b(`text`,{x:(J.value.startX+J.value.centerX)/2,y:Xn.value,"text-anchor":`middle`,fill:W.value.color,"font-size":W.value.fontSize,"font-weight":W.value.bold?`bold`:`normal`,"letter-spacing":W.value.letterSpacing},E(Zn(`left`)),9,st),b(`text`,{x:(J.value.centerX+J.value.endX)/2,y:Xn.value,"text-anchor":`middle`,fill:W.value.color,"font-size":W.value.fontSize,"font-weight":W.value.bold?`bold`:`normal`,"letter-spacing":W.value.letterSpacing},E(Zn(`right`)),9,ct)],64)):v(``,!0),jr.value?(S(),y(g,{key:5},[b(`rect`,{x:J.value.left[0].x,y:Ir.value,rx:K.value.height/2,width:J.value.width,height:K.value.height,fill:K.value.gutterColor},null,8,lt),b(`defs`,null,[b(`clipPath`,{id:Rr.value},[b(`rect`,{x:J.value.left[0].x,y:Ir.value,width:J.value.width*Nr.value,height:K.value.height,rx:Math.min(K.value.height/2,J.value.width*Nr.value/2),ry:Math.min(K.value.height/2,J.value.width*Nr.value/2)},null,8,dt)],8,ut)]),b(`g`,{"clip-path":`url(#${Rr.value})`},[(S(!0),y(g,null,w(Mr.value,e=>(S(),y(`rect`,{key:`bar_fill_${e.id}`,width:J.value.width*e.proportion,x:J.value.left[0].x+J.value.width*e.proportionStart,y:B.value.height+32+K.value.paddingTop,fill:e.color,height:K.value.height,onPointerenter:t=>Gn(e),onPointerleave:t=>Kn(e)},null,40,pt))),128))],8,ft),(S(!0),y(g,null,w(Mr.value.slice(1),e=>(S(),y(`line`,{key:`bar_separator_${e.id}`,x1:J.value.left[0].x+J.value.width*e.proportionStart,x2:J.value.left[0].x+J.value.width*e.proportionStart,y1:B.value.height+32+K.value.paddingTop,y2:B.value.height+32+K.value.paddingTop+K.value.height,stroke:K.value.stroke,"stroke-width":K.value.strokeWidth,"vector-effect":`non-scaling-stroke`},null,8,mt))),128)),b(`rect`,{x:J.value.left[0].x,y:B.value.height+32+K.value.paddingTop,width:J.value.width*Nr.value,height:K.value.height,rx:Math.min(K.value.height/2,J.value.width*Nr.value/2),ry:Math.min(K.value.height/2,J.value.width*Nr.value/2),fill:`none`,stroke:K.value.stroke,"stroke-width":K.value.strokeWidth,"vector-effect":`non-scaling-stroke`},null,8,ht),K.value.label.show&&Nr.value>0?(S(),y(`text`,{key:0,x:Fr.value,y:Ir.value-6,fill:K.value.label.color,"font-size":K.value.label.fontSize,"text-anchor":`end`,"dominant-baseline":`auto`,"pointer-events":`none`,style:{"user-select":`none`}},E(Lr()),9,gt)):v(``,!0)],64)):v(``,!0),T(e.$slots,`svg`,{svg:{drawingArea:J.value,isEditing:F.value,datapoints:ir.value,isPrintingImg:D(Gt)||D(Kt)||D(Er),isPrintingSvg:D(Dr)}},void 0,!0)],46,Pe)),or.value?(S(),y(`div`,{ref_key:`overflowMenuRef`,ref:Ft,key:`stack-overflow-menu-${or.value.stackId}`,class:`vue-ui-hill__stack-overflow-menu`,"data-stack-overflow-menu":``,"data-dom-to-png-ignore":``,style:x([sr.value,Sn.value]),role:`listbox`,"aria-label":`Choose one of ${or.value.hiddenCount} stacked datapoints`,onPointerdown:s[1]||=O(()=>{},[`stop`]),onClick:s[2]||=O(()=>{},[`stop`]),onKeydown:ke(O(fr,[`prevent`,`stop`]),[`esc`])},[M.value.stacking.overflow.menu.title?(S(),y(`div`,vt,E(M.value.stacking.overflow.menu.title),1)):v(``,!0),(S(!0),y(g,null,w(or.value.hiddenDatapoints,e=>(S(),y(`button`,{key:`hidden-${e.id}`,type:`button`,class:xe([`vue-ui-hill__stack-overflow-menu-item`,{readonly:j.value.readonly}]),role:`option`,disabled:e.disabled,"aria-label":`${e.label}, ${Sr(e)}`,onClick:O(t=>vr(e),[`stop`]),style:x({cursor:Yt.value&&!j.value.readonly?`pointer`:`default`})},[b(`span`,{class:`vue-ui-hill__stack-overflow-menu-swatch`,style:x({backgroundColor:e.color}),"aria-hidden":`true`},null,4),b(`span`,bt,E(D(f)(e.label,U.value.ellipsisThresholdChars)),1),b(`span`,xt,E(Sr(e)),1)],14,yt))),128))],44,_t)):v(``,!0),T(e.$slots,`analysis`,{data:{...Mr.value}},void 0,!0),e.$slots.watermark?(S(),y(`div`,St,[T(e.$slots,`watermark`,Se(ve({isPrinting:D(Gt)||D(Kt)||D(Er)||D(Dr)})),void 0,!0)])):v(``,!0),j.value.loading?(S(),y(`div`,Ct,[j.value.loading?T(e.$slots,`loading`,{},()=>[ge(D(Ot),{name:`spinner2`,stroke:N.value.color,"is-spin":!0},null,8,[`stroke`])],!0,0):v(``,!0)])):v(``,!0)],44,je))}},[[`__scopeId`,`data-v-7c4727e2`]]);export{Ae as n,wt as t};
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{t as s}from"./chartImage-Dvrx_F7P.js";import{$ as c,D as l,Ht as u,X as d,a as f,i as p,nn as m,nt as h,r as ee,x as te}from"./lib-BaWaqwnJ.js";import{t as ne}from"./useConfig-B-AzS3w-.js";import{t as re}from"./usePrinter-CUD8gosC.js";import{t as ie}from"./useNestedProp-ri-deXpG.js";import{t as ae}from"./useThemeCheck-BKNRbGeC.js";import{t as oe}from"./useTransitions-ChGGrtrv.js";import{t as se}from"./useChartExport-BZts4KFb.js";import{t as ce}from"./useUserOptionState-CXlFnwPv.js";import{n as le,t as ue}from"./useHints-C-TwxM0Y.js";import{n as de}from"./Title-DlhGIAWX.js";import{t as fe}from"./vue_ui_hill-B6vghkYj.js";import{t as pe}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as g,computed as _,createBlock as me,createCommentVNode as v,createElementBlock as y,createElementVNode as b,createSlots as he,createVNode as ge,defineAsyncComponent as _e,guardReactiveProps as ve,mergeProps as ye,nextTick as be,normalizeClass as xe,normalizeProps as Se,normalizeStyle as x,onBeforeUnmount as Ce,onMounted as we,openBlock as S,ref as C,renderList as w,renderSlot as T,shallowRef as Te,toDisplayString as E,unref as D,useTemplateRef as Ee,watch as De,withCtx as Oe,withKeys as ke,withModifiers as O}from"vue";var Ae=/* @__PURE__ */ e({default:()=>wt}),je=[`id`,`data-editing`],Me={key:0,ref:`chartTitle`,style:`width:100%;background:transparent;padding-bottom:24px`},Ne={key:3,class:`vue-ui-hill__toolbar`,"data-dom-to-png-ignore":``},Pe=[`viewBox`],Fe=[`width`,`height`],Ie=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],Le=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],Re=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],ze={key:0,"pointer-events":`none`},Be=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],Ve=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],He=[`transform`,`font-size`,`fill`,`stroke`],Ue=[`transform`,`data-datapoint-index`,`data-datapoint-id`,`tabindex`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`onFocus`,`onBlur`,`onKeydown`,`onPointerenter`,`onPointerleave`,`onClick`],We=[`r`,`onPointerdown`],Ge=[`r`,`fill`,`stroke`,`stroke-width`],Ke=[`stroke`,`stroke-width`],qe=[`d`],Je=[`x`,`y`,`text-anchor`,`fill`,`font-size`,`font-weight`,`stroke`,`stroke-width`],Ye=[`transform`,`tabindex`,`aria-label`,`aria-expanded`,`onClick`,`onFocus`,`onKeydown`],Xe={key:0,class:`vue-ui-hill__stack-overflow-collapse-ghosts`,"pointer-events":`none`,"aria-hidden":`true`},Ze=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Qe=[`from`,`dur`],$e=[`from`,`dur`],et=[`from`,`to`,`dur`],tt=[`dur`],nt=[`r`],rt=[`x`,`y`,`width`,`height`,`fill`,`stroke`,`stroke-width`],it=[`stroke`,`stroke-width`],at=[`d`],ot=[`y`,`fill`,`font-size`,`font-weight`,`stroke`],st=[`x`,`y`,`fill`,`font-size`,`font-weight`,`letter-spacing`],ct=[`x`,`y`,`fill`,`font-size`,`font-weight`,`letter-spacing`],lt=[`x`,`y`,`rx`,`width`,`height`,`fill`],ut=[`id`],dt=[`x`,`y`,`width`,`height`,`rx`,`ry`],ft=[`clip-path`],pt=[`width`,`x`,`y`,`fill`,`height`,`onPointerenter`,`onPointerleave`],mt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],ht=[`x`,`y`,`width`,`height`,`rx`,`ry`,`stroke`,`stroke-width`],gt=[`x`,`y`,`fill`,`font-size`],_t=[`aria-label`,`onKeydown`],vt={key:0,class:`vue-ui-hill__stack-overflow-menu-title`},yt=[`disabled`,`aria-label`,`onClick`],bt={class:`vue-ui-hill__stack-overflow-menu-label`},xt={class:`vue-ui-hill__stack-overflow-menu-value`},St={key:6,class:`vue-data-ui-watermark`},Ct={key:7,class:`vue-ui-hill__loading`,"data-dom-to-png-ignore":``},wt=/*#__PURE__*/ pe({__name:`vue-ui-hill`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`edit`,`save`,`cancel`,`copyAlt`,`change`,`dragStart`,`dragEnd`,`datapointEnter`,`datapointLeave`,`selectDatapoint`],setup(e,{expose:pe,emit:Ae}){let wt=_e(()=>import(`./HillActions-KXWY_FyA.js`)),Tt=_e(()=>import(`./UserOptions-B97cPcKc.js`).then(e=>e.n)),Et=_e(()=>import(`./PackageVersion-B-1JX0wI.js`).then(e=>e.t)),Dt=_e(()=>import(`./PenAndPaper-B2UOwiJM.js`).then(e=>e.t)),Ot=_e(()=>import(`./BaseIcon-CQFjKDhE.js`).then(e=>e.n)),{vue_ui_hill:kt}=ne(),{isThemeValid:At,warnInvalidTheme:jt}=ae(),Mt=e,Nt=C(d()),k=Te(null),Pt=Ee(`hillChartRef`),A=Ee(`svgRef`),Ft=Ee(`overflowMenuRef`),It=Ee(`userOptionsRef`),Lt=C(0),Rt=Ae;function zt(){let e=ie({userConfig:Mt.config,defaultConfig:kt}),t={},n=e.theme;if(!n)t=e;else if(!At.value(e))jt(e),t=e;else{let r=ie({userConfig:fe[n]||Mt.config,defaultConfig:e});t={...ie({userConfig:Mt.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:m[n]||nn}}return t}let j=C(zt()),M=_(()=>j.value.style.chart.layout.plots),N=_(()=>j.value.style.chart);le({config:()=>j.value,dataset:()=>Mt.dataset,component:`VueUiHill`,rules:[ue.emptyArray,ue.noHint]});let{transitionEnabled:P}=oe({config:()=>j.value.transitions,dataset:()=>Mt.dataset}),{userOptionsVisible:Bt,setUserOptionsVisibility:Vt,keepUserOptionState:Ht}=ce({config:j.value});function Ut(){Vt(!0)}function Wt(){Vt(!1),er.value=null,$.value=null,$n.value=null}let{isPrinting:Gt,isImaging:Kt,generatePdf:qt,generateImage:Jt}=re({elementId:`hill_${Nt.value}`,fileName:N.value.title.text||`vue-ui-hill`,options:j.value.userOptions.print}),Yt=_(()=>j.value.userOptions.useCursorPointer),Xt=C(0),Zt=C(!1);function Qt(e){Zt.value=e,Xt.value+=1}let $t=C(!1);function en(){$t.value=!$t.value}let tn=_(()=>j.value.userOptions.position===`left`?`right`:`left`);De(()=>Mt.config,()=>{k.value=null,j.value=zt(),Xt.value+=1,F.value!==j.value.editing&&(F.value=j.value.editing&&!j.value.readonly)},{deep:!0});let nn=_(()=>{let e=j.value.customPalette;return Array.isArray(e)&&e.length?e:u});function rn(e){let t=Number(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function an(e){if(e<=0)return`todo`;if(e>=1)return`done`;let t=.5,n=Math.min(t,Math.max(0,Number(j.value.interaction.peakTolerance)||0)),r=t-n,i=t+n;return e>=r&&e<=i?`top`:e<t?`left`:`right`}function on(e,t){let n=e&&typeof e==`object`?e:{},r=`Item ${t+1}`,i=String(n.name??n.label??r),a=rn(n.position??n.value??0);return{...n,id:String(n.id??`${i}-${t}`),name:i,label:String(n.label??i),position:a,color:n.color||nn.value[t%nn.value.length],muted:!!n.muted,disabled:!!n.disabled,status:an(e.position),labelSide:[`left`,`right`,`auto`].includes(n.labelSide)?n.labelSide:`auto`,__index:t}}let sn=_(()=>Array.isArray(Mt.dataset)?Mt.dataset.map(on):[]);function cn(e){return e.map(e=>({...e}))}function ln(e){let{__index:t,...n}=e;return Object.prototype.hasOwnProperty.call(n,`value`)&&(n.value=n.position),n}function un(e=I.value){return e.map(ln)}let dn=_(()=>j.value.editing&&!j.value.readonly),F=C(dn.value),I=C(cn(sn.value)),L=C(null);De(sn,e=>{F.value||(k.value=null,I.value=cn(e))},{deep:!0});let R=_(()=>!j.value.readonly);De(R,e=>{e||(L.value=null,k.value=null,F.value=!1,I.value=cn(sn.value))});function z(e,t){Rt(e,t);let n=j.value.events?.[e];typeof n==`function`&&n(t)}let B=_(()=>N.value),fn=_(()=>B.value.layout),V=_(()=>fn.value.hill),H=_(()=>fn.value.plots),U=_(()=>fn.value.labels.item),W=_(()=>fn.value.labels.phases),G=_(()=>B.value.toolbar),K=_(()=>fn.value.stackbar),q=_(()=>{let e=H.value.stacking?.overflow||{},t=Math.max(0,Number(H.value.radius)||0);return{show:e.show!==!1,marker:{radius:Math.max(4,Number(e.marker?.radius)||t),fill:e.marker.fill,stroke:e.marker?.stroke||H.value.stroke,strokeWidth:e.marker.strokeWidth,color:e.marker.labelColor,fontSize:e.marker.fontSize,bold:e.marker?.bold!==!1,offsetY:e.marker.labelOffsetY},hysteresis:t*1.5,transitionDuration:P.value?e.transitionDuration:0,menu:{width:Math.max(160,Number(e.menu?.width)||220),maxHeight:Math.max(96,Number(e.menu?.maxHeight)||220),backgroundColor:e.menu?.backgroundColor||B.value.backgroundColor,color:e.menu?.color||B.value.color,borderColor:e.menu?.borderColor||H.value.stroke,borderRadius:Math.max(0,Number(e.menu?.borderRadius)||6)}}});function pn(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.min(n,Math.max(0,r)):t}let J=_(()=>{let e=V.value.geometry||{},t=Math.max(0,Number(B.value.width)||0),n=Math.max(0,Number(B.value.height)||0),r=pn(e.horizontalPaddingRatio,.02,.49),i=pn(e.topPaddingRatio,.12,.49),a=pn(e.bottomPaddingRatio,.2,.49),o=pn(e.curvature,.65),s=t*r,c=t/2,l=t*(1-r),u=n*i,d=n*(1-a),f=c-s,p=l-c,m=s+f*o,h=c+p*(1-o);return{startX:s,centerX:c,endX:l,baseY:d,peakY:u,width:f+p,left:[{x:s,y:d},{x:m,y:d},{x:m,y:u},{x:c,y:u}],right:[{x:c,y:u},{x:h,y:u},{x:h,y:d},{x:l,y:d}]}}),mn=_(()=>{let{left:e,right:t}=J.value;return[`M${e[0].x} ${e[0].y}`,`C${e[1].x} ${e[1].y} ${e[2].x} ${e[2].y} ${e[3].x} ${e[3].y}`,`C${t[1].x} ${t[1].y} ${t[2].x} ${t[2].y} ${t[3].x} ${t[3].y}`].join(` `)});function hn(e,t,n,r,i){let a=1-i;return a**3*e+3*a**2*i*t+3*a*i**2*n+i**3*r}function gn(e,t,n,r,i){let a=1-i;return 3*a**2*(t-e)+6*a*i*(n-t)+3*i**2*(r-n)}function _n(e){let t=rn(e),{startX:n,centerX:r,endX:i,left:a,right:o}=J.value,s=n+(t-0)/1*(i-n),c=s<=r?a:o,l=0,u=1;for(let e=0;e<28;e+=1){let e=(l+u)/2;hn(c[0].x,c[1].x,c[2].x,c[3].x,e)<s?l=e:u=e}let d=(l+u)/2,f=hn(c[0].y,c[1].y,c[2].y,c[3].y,d),p=gn(c[0].x,c[1].x,c[2].x,c[3].x,d),m=gn(c[0].y,c[1].y,c[2].y,c[3].y,d),h=Math.hypot(p,m)||1;return{x:s,y:f,normalX:m/h,normalY:-p/h}}function vn(e){let t=Number(H.value.stacking.overlapThresholdRatio);return e*(2-(Number.isFinite(t)?Math.min(2,Math.max(0,t)):.5))}function yn(e,t){let n=/* @__PURE__ */ new Map,r=H.value.stacking;if(e.forEach(e=>{n.set(e.id,{position:e.position,index:0,size:1,stackId:`stack:${e.id}`})}),!r.show||e.length<2||t<=0)return n;let i=vn(t),a=e.map((e,t)=>({datapoint:e,index:t,point:_n(e.position)})).sort((e,t)=>e.point.x-t.point.x||e.datapoint.position-t.datapoint.position||e.index-t.index),o=0;for(;o<a.length;){let e=[a[o]],t=o+1;for(;t<a.length;){let n=e[e.length-1],r=a[t];if(Math.hypot(r.point.x-n.point.x,r.point.y-n.point.y)>=i)break;e.push(r),t+=1}if(e.length>1){let t=e[0].datapoint.position,r=`stack:${e.map(({datapoint:e})=>e.id).sort().join(`|`)}`;e.forEach(({datapoint:i},a)=>{n.set(i.id,{position:t,index:a,size:e.length,stackId:r})})}o=t}return n}function bn(e){let t=e+Math.max(0,Number(H.value.strokeWidth)||0)/2,n=H.value.stacking.gap??e/2;return t*2+n}let xn=C(null),Y=C(null),X=C(null),Sn=C(null),Cn=C(null),wn=/* @__PURE__ */ new Set,Tn=null,Z=null,Q=null;function En(e){let t=Math.max(0,Number(H.value.strokeWidth)||0),n=H.value.shadow.show?Math.max(0,Number(H.value.shadow.blur)||0)+Math.max(0,-(Number(H.value.shadow.offsetY)||0)):0;return e+t/2+n}function Dn(e,t,n){if(t<=1)return e-En(n);let r=bn(n);return e-(t-1)*r-En(n)}function On(e,t,n,r){if(n<=1)return wn.delete(e),!1;let i=Dn(t,n,r),a=wn.has(e),o=q.value.hysteresis,s=a?i<o:i<0;return s?wn.add(e):wn.delete(e),s}let kn=_(()=>{let e=Math.max(0,Number(H.value.radius)||0),t=bn(e),n=yn(I.value,e),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=[],o=/* @__PURE__ */ new Set,s=L.value?.id??null;q.value.show||wn.clear(),I.value.forEach(e=>{let t=n.get(e.id)||{position:e.position,index:0,size:1,stackId:`stack:${e.id}`};r.has(t.stackId)||r.set(t.stackId,[]),r.get(t.stackId).push({datapoint:e,stack:t})});let c=new Set(r.keys());return wn.forEach(e=>{c.has(e)||wn.delete(e)}),r.forEach((n,r)=>{let c=[...n].sort((e,t)=>e.stack.index-t.stack.index||e.datapoint.__index-t.datapoint.__index),l=c.reduce((e,t)=>e+(Number(t.datapoint.position)||0),0)/c.length,u=_n(l);if(!(q.value.show&&On(r,u.y,c.length,e))){c.forEach(e=>{i.set(e.datapoint.id,{hidden:!1,displayIndex:e.stack.index,stackId:r,stackSize:c.length,promotedFromOverflow:!1,renderPosition:e.stack.position})});return}c.forEach(({datapoint:e})=>{o.add(e.id)});let d=s?c.find(({datapoint:e})=>e.id===s):null,f=c.find(({datapoint:e})=>e.id===xn.value),p=d||f||null,m=p?c.filter(({datapoint:e})=>e.id!==p.datapoint.id):c,h=Y.value,ee=!(!f||h?.datapointId!==f.datapoint.id||h.moved),te=m.length?ee?l:m.reduce((e,t)=>e+(Number(t.datapoint.position)||0),0)/m.length:l,ne=_n(te);c.forEach(e=>{let t=p?.datapoint.id===e.datapoint.id,n=t&&f?.datapoint.id===e.datapoint.id;i.set(e.datapoint.id,{hidden:!t,displayIndex:+!!t,stackId:r,stackSize:c.length,promotedFromOverflow:n,renderPosition:te})}),m.length&&a.push({stackId:r,anchorPosition:te,x:ne.x,y:ne.y,hiddenCount:m.length,hiddenDatapoints:m.map(({datapoint:e})=>e),memberIds:c.map(({datapoint:e})=>e.id),collapseDatapoints:m.map(({datapoint:e,stack:n})=>{let r=_n(n.position);return{id:e.id,color:e.color,relativeX:r.x-ne.x,relativeY:r.y-n.index*t-ne.y}})})}),{layoutMap:n,displayMap:i,markers:a,overflowMemberIds:o}});function An(e){let t=Mn.value.filter(e=>!e.isStackOverflowHidden),n=t.find(t=>t.id===e),r=new Map(t.filter(t=>t.id!==e).map(e=>[e.id,{x:e.x,y:e.y}]));if(!n||!H.value.stacking.show)return r;let i=t.filter(e=>Math.abs(e.x-n.x)<.001).sort((e,t)=>t.y-e.y||e.datasetIndex-t.datasetIndex);if(i.length<2)return r;let a=bn(Math.max(0,Number(H.value.radius)||0)),o=Math.max(...i.map(e=>e.y));return i.filter(t=>t.id!==e).forEach((e,t)=>{r.set(e.id,{x:n.x,y:o-t*a})}),r}function jn(){return new Map(Mn.value.filter(e=>!e.isStackOverflowHidden).map(e=>[e.id,{x:e.x,y:e.y}]))}let Mn=_(()=>{let e=Math.max(0,Number(H.value.radius)||0),{layoutMap:t,displayMap:n,markers:r}=kn.value,i=bn(e),a=L.value,o=a?.stationaryLayout,s=o instanceof Map?o:k.value instanceof Map?k.value:null,c=null;if(a&&o instanceof Map&&H.value.stacking.show&&e>0){let t=I.value.find(e=>e.id===a.id);if(t){let n=r.find(e=>e.memberIds.includes(t.id));if(n)c={x:n.x,y:n.y-i};else{let n=_n(t.position),r=vn(e),s=I.value.filter(e=>e.id!==a.id&&o.has(e.id)).map(e=>{let t=_n(e.position);return{datapoint:e,distance:Math.hypot(t.x-n.x,t.y-n.y)}}).filter(({distance:e})=>e<r).sort((e,t)=>e.distance-t.distance)[0];if(s){let e=o.get(s.datapoint.id),t=[...o.values()].filter(t=>Math.abs(t.x-e.x)<.001),n=Math.min(e.y,...t.map(e=>e.y));c={x:e.x,y:n-i}}else c=n}}}return I.value.map((e,r)=>{let o=t.get(e.id)||{position:e.position,index:0,size:1,stackId:`stack:${e.id}`},l=n.get(e.id)||{hidden:!1,displayIndex:o.index,stackId:o.stackId,stackSize:o.size,renderPosition:o.position},u=_n(l.renderPosition??o.position),d=e.id!==a?.id&&!l.promotedFromOverflow&&s instanceof Map?s.get(e.id):null,f=e.id===a?.id&&c?c:d||{x:u.x,y:u.y-l.displayIndex*i},p=e.labelSide===`auto`?null:e.labelSide,m=te(U.value.autoSideThreshold,.5,1),h=p||(e.position>m?`left`:`right`),ee=Math.abs(Number(U.value.offsetX)||0)+H.value.radius+U.value.fontSize/2;return{...e,datasetIndex:r,x:f.x,y:f.y,stackId:l.stackId,stackSize:l.stackSize,stackDisplayIndex:l.displayIndex,isStackOverflowHidden:l.hidden,isPromotedFromStackOverflow:l.promotedFromOverflow,labelSide:h,labelX:h===`left`?-ee:ee,textAnchor:h===`left`?`end`:`start`}})});function Nn(e){return I.value.find(t=>t.id===e)}function Pn(e,t){let n=rn(t),r;I.value=I.value.map(t=>t.id===e?(r={...t,position:n},r):t),r&&(br(r.id,r.position),z(`change`,{datapoint:ln(r),dataset:un()}))}function Fn(e){let t=A.value;if(!t)return null;let n=t.getScreenCTM();if(!n)return null;let r=t.createSVGPoint();r.x=e,r.y=0;let i=r.matrixTransform(n.inverse()),{startX:a,endX:o}=J.value;return rn(0+(i.x-a)/(o-a)*1)}function In(){R.value&&(X.value=null,xn.value=null,Y.value=null,Cn.value=null,pr(),k.value=null,I.value=cn(sn.value),F.value=!0,z(`edit`,un()))}function Ln(){let e=un();X.value=null,xn.value=null,Y.value=null,Cn.value=null,pr(),L.value=null,F.value=!1,z(`save`,e)}function Rn(){X.value=null,xn.value=null,Y.value=null,Cn.value=null,pr(),L.value=null,k.value=null,I.value=cn(sn.value),F.value=!1,z(`cancel`,un())}function zn(e,t){if(!R.value||!F.value||t.disabled)return;X.value=null;let n=e.currentTarget.closest(`.vue-ui-hill__datapoint`);n&&typeof n.focus==`function`&&(n.focus(),$.value=t.id),e.preventDefault();let r=An(t.id),i=Y.value?.datapointId===t.id&&!Y.value?.moved;if(L.value={id:t.id,pointerId:e.pointerId,stationaryLayout:r,startClientX:e.clientX,hasMoved:!1,deferPositionUpdate:i},A.value?.setPointerCapture(e.pointerId),!i){let n=Fn(e.clientX);n!==null&&Pn(t.id,n)}let a=Nn(t.id);a&&z(`dragStart`,ln(a))}function Bn(e){if(!L.value||L.value.pointerId!==e.pointerId)return;e.preventDefault();let t=Math.abs(e.clientX-L.value.startClientX);if(L.value.deferPositionUpdate&&!L.value.hasMoved&&t<3)return;L.value.hasMoved||(L.value={...L.value,hasMoved:!0});let n=Fn(e.clientX);n!==null&&Pn(L.value.id,n)}function Vn(e){let t=L.value;if(!t||t.pointerId!==e.pointerId)return;A.value?.hasPointerCapture(e.pointerId)&&A.value.releasePointerCapture(e.pointerId);let n=e.type===`pointerup`&&!t.hasMoved,r=Nn(t.id);k.value=jn(),L.value=null,r&&(n&&z(`selectDatapoint`,Wn(r)),z(`dragEnd`,ln(r)))}function Hn(e,t){if(!R.value||!F.value||t.disabled)return;let n=Math.max(0,Number(j.value.interaction.keyboardStep)||0),r=null;switch(e.key){case`ArrowLeft`:case`ArrowDown`:r=t.position-n;break;case`ArrowRight`:case`ArrowUp`:r=t.position+n;break;case`Home`:r=0;break;case`End`:r=1;break;default:return}e.preventDefault();let i=e.currentTarget;$.value=t.id,L.value={id:t.id,pointerId:null,stationaryLayout:An(t.id)},Pn(t.id,r),k.value=jn(),L.value=null,be(()=>{i?.isConnected&&i.focus({preventScroll:!0})})}function Un(e){let t=.5,n=Math.max(0,Number(j.value.interaction.peakTolerance)||0);return Math.abs(e-t)<=n?j.value.a11y.translations.topOfHill:e<t?W.value.left.text:W.value.right.text}function Wn(e){return{datapoint:ln(e),index:e.__index}}function Gn(e){$.value=null,er.value=e.id,![0,1].includes(e.position)&&$.value!==e.id&&rr(e),z(`datapointEnter`,Wn(e))}function Kn(e){er.value===e.id&&(er.value=null),$n.value===e.id&&$.value!==e.id&&L.value?.id!==e.id&&($n.value=null),z(`datapointLeave`,Wn(e))}function qn(e){F.value&&R.value||z(`selectDatapoint`,Wn(e))}let Jn=_(()=>{let e=B.value;return{width:`100%`,maxWidth:`100%`,color:e.color,backgroundColor:e.backgroundColor,fontFamily:j.value.style.fontFamily,"--vue-ui-hill-button-hover-border":G.value.buttons.hoverBorderColor,"--vue-ui-hill-button-active-offset":`${G.value.buttons.activeTranslateY}px`}}),Yn=_(()=>({color:G.value.status.color,fontSize:`${G.value.status.fontSize}px`,fontWeight:G.value.status.bold?`bold`:`normal`,lineHeight:G.value.status.lineHeight}));_(()=>({color:B.value.title.color,fontSize:`${B.value.title.fontSize}px`,fontWeight:B.value.title.bold?`bold`:`normal`,textAlign:B.value.title.textAlign})),_(()=>({color:B.value.title.subtitle.color,fontSize:`${B.value.title.subtitle.fontSize}px`,fontWeight:B.value.title.subtitle.bold?`bold`:`normal`}));let Xn=_(()=>{let e=Math.max(0,Number(B.value.height)||0);return Math.min(e,J.value.baseY+e)+W.value.offsetY});function Zn(e){return W.value[e].text}function Qn(e){return e.position===0||e.position===1}let $n=C(null),er=C(null),$=C(null);function tr(e){$.value=e.id}function nr(e){$.value===e.id&&($.value=null),$n.value===e.id&&er.value!==e.id&&L.value?.id!==e.id&&($n.value=null)}function rr(e){e?.id&&($n.value=e.id)}let ir=_(()=>{let e=[],t=[],n=null;return Mn.value.forEach(r=>{r.isStackOverflowHidden||(r.id===$n.value?n=r:Qn(r)?e.push(r):t.push(r))}),[...e,...t,...n?[n]:[]]}),ar=_(()=>kn.value.markers),or=_(()=>ar.value.find(e=>e.stackId===X.value)||null),sr=_(()=>{let e=Math.max(160,Number(q.value.menu.width)||220),t=Math.max(80,Number(q.value.menu.maxHeight)||220);return{visibility:Sn.value?`visible`:`hidden`,width:`max-content`,minWidth:`${e}px`,maxWidth:`calc(100% - 16px)`,maxHeight:`${t}px`,backgroundColor:q.value.menu.backgroundColor,color:q.value.menu.color,borderColor:q.value.menu.borderColor,borderRadius:`${q.value.menu.borderRadius}px`}});function cr(e,t){let n=A.value,r=Pt.value;if(!n||!r)return null;let i=n.getScreenCTM();if(!i)return null;let a=n.createSVGPoint();a.x=e,a.y=t;let o=a.matrixTransform(i),s=r.getBoundingClientRect();return{x:o.x-s.left,y:o.y-s.top}}function lr(){let e=or.value,t=Ft.value,n=Pt.value;if(!e||!t||!n){Sn.value=null;return}let r=cr(e.x,e.y),i=cr(e.x,e.y+q.value.marker.radius);if(!r||!i){Sn.value=null;return}let a=n.getBoundingClientRect(),o=t.offsetWidth,s=t.offsetHeight,c=Math.abs(i.y-r.y),l=Math.max(0,a.width-16),u=Math.min(o,l),d=r.x;if(u>=l)d=a.width/2;else{let e=u/2;d=Math.min(a.width-8-e,Math.max(8+e,r.x))}let f=r.y+c+8,p=r.y-c-8-s,m=f+s<=a.height-8,h=p>=8,ee=f;!m&&h?ee=p:m||(ee=Math.min(Math.max(8,f),Math.max(8,a.height-s-8))),Sn.value={left:`${d}px`,top:`${ee}px`,transform:`translateX(-50%)`,visibility:`visible`}}function ur(){typeof window<`u`&&(Q!==null&&window.cancelAnimationFrame(Q),Q=window.requestAnimationFrame(()=>{Q=null,lr()}))}De(ar,e=>{X.value&&!e.some(e=>e.stackId===X.value)&&fr()}),De(()=>{let e=or.value;return e?[e.stackId,e.x,e.y,e.hiddenDatapoints.length,e.hiddenDatapoints.map(e=>`${e.id}:${e.label}:${e.position}`).join(`|`),q.value.marker.radius,q.value.menu.width,q.value.menu.maxHeight,q.value.menu.backgroundColor,q.value.menu.color,q.value.menu.borderColor,q.value.menu.borderRadius,Zt.value]:null},e=>{e?be(ur):Sn.value=null},{flush:`post`}),De(Ft,(e,t)=>{t&&Z&&Z.unobserve(t),e&&Z&&(Z.observe(e),be(ur))},{flush:`post`}),De(()=>{let e=xn.value;return!e||kn.value.overflowMemberIds.has(e)},e=>{e||(xn.value=null,Y.value=null)});function dr(e){e&&(X.value===e.stackId?ur():(Sn.value=null,X.value=e.stackId,be(ur)))}function fr(){X.value=null,Sn.value=null,typeof window<`u`&&Q!==null&&(window.cancelAnimationFrame(Q),Q=null)}function pr(){Tn!==null&&(clearTimeout(Tn),Tn=null)}function mr(){let e=Y.value;e&&!e.moved&&(pr(),Cn.value=e.stackId,xn.value=null,Y.value=null,fr(),Tn=setTimeout(()=>{Cn.value=null,Tn=null},q.value.transitionDuration+80))}function hr(e){if(!(e instanceof Element))return{isMenu:!1,isMarker:!1,isSelectedDatapoint:!1};let t=Y.value,n=e.closest(`[data-datapoint-id]`);return{isMenu:!!e.closest(`[data-stack-overflow-menu]`),isMarker:!!e.closest(`[data-stack-overflow-marker]`),isSelectedDatapoint:!!(t&&n?.getAttribute(`data-datapoint-id`)===t.datapointId)}}function gr(e){let t=hr(e.target);X.value&&!t.isMenu&&!t.isMarker&&fr(),!Y.value||Y.value.moved||t.isMenu||t.isMarker||t.isSelectedDatapoint||mr()}function _r(e){let t=Mn.value.find(t=>t.id===e);if(!t||t.isStackOverflowHidden)return;let n=A.value?.querySelector(`[data-datapoint-index="${t.__index}"]`);n&&typeof n.focus==`function`&&n.focus({preventScroll:!0})}function vr(e){if(!e||e.disabled||j.value.readonly)return;let t=or.value?.stackId;t&&(pr(),Cn.value=null,xn.value=e.id,Y.value={datapointId:e.id,stackId:t,initialPosition:e.position,moved:!1},fr(),be(()=>{_r(e.id);let t=Mn.value.find(t=>t.id===e.id);t&&z(`selectDatapoint`,Wn(t))}))}function yr(){let e=Math.max(1,Number(J.value.width)||1);return Math.max(1e-6,1/e*2)}function br(e,t){let n=Y.value;n&&n.datapointId===e&&!n.moved&&Math.abs(t-n.initialPosition)>=yr()&&(Y.value={...n,moved:!0})}we(()=>{document.addEventListener(`pointerdown`,gr),window.addEventListener(`resize`,ur,{passive:!0}),typeof ResizeObserver<`u`&&(Z=new ResizeObserver(()=>{or.value&&ur()}),Pt.value&&Z.observe(Pt.value),A.value&&Z.observe(A.value))}),Ce(()=>{document.removeEventListener(`pointerdown`,gr),window.removeEventListener(`resize`,ur),Z?.disconnect(),Z=null,Q!==null&&(window.cancelAnimationFrame(Q),Q=null),pr()});function xr(e){return L.value?L.value.id===e.id:er.value===e.id||$.value===e.id}function Sr(e){return p(M.value.dragMarker.positionIndicator.value.formatter,e.position,c({p:``,v:e.position*100,s:`%`,r:M.value.dragMarker.positionIndicator.value.rounding}))}let Cr=_(()=>N.value.backgroundColor),wr=_(()=>N.value.legend),Tr=_(()=>N.value.title),{isCallbackImaging:Er,isCallbackSvg:Dr,generateSvg:Or,onGenerateImage:kr}=se({svg:A,title:Tr,legend:wr,legendItems:null,backgroundColor:Cr,getSvgCallback:()=>j.value.userOptions.callbacks.svg,generateImage:Jt});function Ar(e=null){be(()=>{let t=un().map(e=>[[e.name],[e.position],[Sr(e)],[Un(e.position)]]),n=[[N.value.title.text],[N.value.title.subtitle.text],[[`Name`],[`Position`],[`Percentage`],[`Phase`]]].concat(t),r=l(n);e?e(r):h({csvContent:r,title:N.value.title.text||`vue-ui-hill`})})}let jr=_(()=>N.value.layout.stackbar.show),Mr=_(()=>{let e=Mn.value.length;Mn.value.reduce((e,t)=>e+(t?.position??0),0);let t=0,n=Mn.value.every(e=>e.position===1);return Mn.value.toSorted((e,t)=>{if(n)return e.__index-t.__index;let r=(e?.position??0)-(t?.position??0);return r===0?e.__index-t.__index:r}).map(n=>{let r=n?.position??0,i=e>0?r/e:0,a={...n,proportion:i,proportionStart:t};return t+=i,a})}),Nr=_(()=>Math.min(1,Math.max(0,Mr.value.reduce((e,t)=>e+t.proportion,0)))),Pr=_(()=>Nr.value*100),Fr=_(()=>J.value.left[0].x+J.value.width*Nr.value),Ir=_(()=>B.value.height+32+K.value.paddingTop);function Lr(){return p(K.value.label.formatter,Pr.value,c({p:``,v:Pr.value,s:`%`,r:0}))}let Rr=_(()=>`${Nt.value}-stackbar-clip`);async function zr(){let e=un();Rt(`copyAlt`,{config:j.value,dataset:e}),j.value.userOptions.callbacks.altCopy?await Promise.resolve(j.value.userOptions.callbacks.altCopy({config:j.value,dataset:e})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let Br=s(Pt,()=>N.value.title.text);function Vr(){return un()}return pe({isEditing:F,beginEditing:In,save:Ln,cancel:Rn,getData:Vr,copyAlt:zr,toggleFullscreen:Qt,toggleAnnotator:en,generateImage:Jt,generateSvg:Or,generatePdf:qt,generateCsv:Ar,getImage:Br}),(e,s)=>(S(),y(`div`,{ref_key:`hillChartRef`,ref:Pt,class:xe(`vue-data-ui-component vue-ui-hill`),style:x(Jn.value),id:`hill_${Nt.value}`,onMouseenter:Ut,onMouseleave:Wt,"data-editing":F.value},[N.value.title.text?(S(),y(`div`,Me,[(S(),me(de,{key:`title_${Lt.value}`,config:{title:{cy:`hill-div-title`,...N.value.title},subtitle:{cy:`hill-div-subtitle`,...N.value.title.subtitle}}},null,8,[`config`]))],512)):v(``,!0),j.value.userOptions.buttons.annotator&&A.value?(S(),me(D(Dt),ye({key:1},D(a)(j.value.userOptions.annotator),{color:N.value.color,backgroundColor:N.value.backgroundColor,active:$t.value,svgRef:A.value,isCursorPointer:Yt.value,palette:j.value.userOptions.annotatorPalette,onClose:en}),he({_:2},[w(D(o),t=>({name:t,fn:Oe(n=>[T(e.$slots,t,Se(ve(D(i)(t,n))),void 0,!0)])}))]),1040,[`color`,`backgroundColor`,`active`,`svgRef`,`isCursorPointer`,`palette`])):v(``,!0),G.value.show?(S(),me(D(wt),{key:2,"is-editing":F.value,"is-editable":R.value,"is-fullscreen":Zt.value,position:tn.value,color:N.value.color,"background-color":N.value.backgroundColor,translations:G.value.buttons.translations,"is-cursor-pointer":Yt.value,onUpdate:In,onCancel:Rn,onSave:Ln},{"hill-edit":Oe(()=>[T(e.$slots,`hill-edit`,{},void 0,!0)]),"hill-cancel":Oe(()=>[T(e.$slots,`hill-cancel`,{},void 0,!0)]),"hill-save":Oe(()=>[T(e.$slots,`hill-save`,{},void 0,!0)]),_:3},8,[`is-editing`,`is-editable`,`is-fullscreen`,`position`,`color`,`background-color`,`translations`,`is-cursor-pointer`])):v(``,!0),G.value.show?(S(),y(`div`,Ne,[b(`p`,{class:`vue-ui-hill__status`,style:x(Yn.value),"aria-live":`polite`},E(F.value?G.value.status.editInstruction:G.value.status.lastUpdated),5)])):v(``,!0),j.value.userOptions.show&&(D(Ht)||D(Bt))?(S(),me(D(Tt),ye({ref_key:`userOptionsRef`,ref:It,key:`uo_${Xt.value}`,backgroundColor:N.value.backgroundColor,color:N.value.color,isPrinting:D(Gt),isImaging:D(Kt),uid:Nt.value,hasTooltip:!1,isFullscreen:Zt.value,chartElement:Pt.value},D(n)(j.value.userOptions,`pdf csv img svg labels table fullscreen altCopy annotator`),{isAnnotation:$t.value,isCursorPointer:Yt.value,onToggleFullscreen:Qt,onGeneratePdf:D(qt),onGenerateCsv:Ar,onGenerateImage:D(kr),onGenerateSvg:D(Or),onToggleAnnotator:en,onCopyAlt:zr,style:{visibility:D(Ht)?D(Bt)?`visible`:`hidden`:`visible`}}),he({_:2},[w(D(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionSvg optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:Oe(n=>[T(e.$slots,t,Se(ve(D(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):v(``,!0),(S(),y(`svg`,{ref_key:`svgRef`,ref:A,style:x({background:`transparent`,color:N.value.color,fontFamily:j.value.style.fontFamily}),class:xe({"vue-data-ui-no-transition":!D(P)}),viewBox:`0 0 ${B.value.width} ${B.value.height+(jr.value?32+K.value.paddingTop+K.value.paddingBottom+K.value.height:0)}`,role:`group`,"aria-live":`polite`,preserveAspectRatio:`xMidYMid meet`,onPointermove:Bn,onPointerup:Vn,onPointercancel:Vn},[ge(D(Et)),T(e.$slots,`svg-underlayer`,{svg:{drawingArea:J.value,isEditing:F.value,datapoints:ir.value,isPrintingImg:D(Gt)||D(Kt)||D(Er),isPrintingSvg:D(Dr)}},void 0,!0),e.$slots[`chart-background`]?(S(),y(`foreignObject`,{key:0,x:0,y:0,width:Math.max(.1,B.value.width),height:Math.max(.1,B.value.height+(jr.value?32+K.value.paddingTop+K.value.paddingBottom+K.value.height:0)),style:{pointerEvents:`none`}},[T(e.$slots,`chart-background`,{},void 0,!0)],8,Fe)):v(``,!0),V.value.baseline.show?(S(),y(`line`,{key:1,x1:J.value.startX,x2:J.value.endX,y1:J.value.baseY,y2:J.value.baseY,stroke:V.value.baseline.stroke,"stroke-width":V.value.baseline.strokeWidth,"stroke-dasharray":V.value.baseline.strokeDasharray,"vector-effect":`non-scaling-stroke`},null,8,Ie)):v(``,!0),V.value.midline.show?(S(),y(`line`,{key:2,x1:J.value.centerX,x2:J.value.centerX,y1:J.value.peakY,y2:J.value.baseY,stroke:V.value.midline.stroke,"stroke-width":V.value.midline.strokeWidth,"stroke-dasharray":V.value.midline.strokeDasharray,"vector-effect":`non-scaling-stroke`},null,8,Le)):v(``,!0),b(`path`,{d:mn.value,fill:`none`,stroke:V.value.curve.stroke,"stroke-width":V.value.curve.strokeWidth,"stroke-dasharray":V.value.curve.strokeDasharray,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`},null,8,Re),M.value.dragMarker.positionIndicator.show?(S(!0),y(g,{key:3},w(ir.value,e=>(S(),y(`g`,{key:`position-indicator-${e.id}`},[xr(e)&&H.value.dragMarker.show?(S(),y(`g`,ze,[b(`path`,{d:`M${e.x},${e.y} ${e.x},${J.value.baseY}`,stroke:M.value.dragMarker.positionIndicator.useSerieColor?e.color:M.value.dragMarker.positionIndicator.color,"stroke-width":M.value.dragMarker.positionIndicator.strokeWidth,"stroke-dasharray":M.value.dragMarker.positionIndicator.strokeDasharray,"stroke-linecap":`round`,"vector-effect":`non-scaling-stroke`,class:xe({"vue-data-ui-transition":D(P)&&L.value?.id!==e.id})},null,10,Be),M.value.dragMarker.positionIndicator.circle.show?(S(),y(`circle`,{key:0,cx:e.x,cy:J.value.baseY,r:M.value.dragMarker.positionIndicator.circle.radius,fill:M.value.dragMarker.positionIndicator.useSerieColor?e.color:M.value.dragMarker.positionIndicator.color,stroke:M.value.dragMarker.positionIndicator.circle.stroke,"stroke-width":M.value.dragMarker.positionIndicator.circle.strokeWidth,"vector-effect":`non-scaling-stroke`,"paint-order":`stroke fill`,class:xe({"vue-data-ui-transition":D(P)&&L.value?.id!==e.id})},null,10,Ve)):v(``,!0),M.value.dragMarker.positionIndicator.value.show?(S(),y(`text`,{key:1,"paint-order":`stroke fill`,"vector-effect":`non-scaling-stroke`,"text-anchor":`middle`,transform:`translate(${e.x}, ${J.value.baseY+M.value.radius+M.value.dragMarker.positionIndicator.value.offsetY+M.value.dragMarker.positionIndicator.value.fontSize})`,"font-size":M.value.dragMarker.positionIndicator.value.fontSize,fill:M.value.dragMarker.positionIndicator.value.useSerieColor?e.color:M.value.dragMarker.positionIndicator.value.color,stroke:N.value.backgroundColor,"stroke-width":`1`,class:xe({"vue-data-ui-transition":D(P)&&L.value?.id!==e.id})},E(Sr(e)),11,He)):v(``,!0)])):v(``,!0)]))),128)):v(``,!0),(S(!0),y(g,null,w(ir.value,e=>(S(),y(`g`,{key:e.id,"data-cy-datapoint":``,class:xe({"vue-ui-hill__datapoint":!0,"vue-data-ui-transition":D(P)&&L.value?.id!==e.id,"vue-ui-hill__datapoint--promoted":D(P)&&e.isPromotedFromStackOverflow}),style:x({opacity:[0,1].includes(e.position)||e?.muted?H.value.mutedOpacity:e?.disabled?H.value.disabledOpacity:1}),transform:`translate(${e.x} ${e.y})`,"data-datapoint-index":e.__index,"data-datapoint-id":e.id,role:`slider`,tabindex:F.value&&R.value&&!e.disabled?0:-1,"aria-orientation":`horizontal`,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-valuenow":Sr(e),"aria-valuetext":`${e.label}: ${Un(e.position)}, ${Sr(e)}`,"aria-label":e.label,onFocus:t=>tr(e),onBlur:t=>nr(e),onKeydown:t=>Hn(t,e),onPointerenter:t=>Gn(e),onPointerleave:t=>Kn(e),onClick:t=>qn(e)},[b(`circle`,{r:H.value.hitRadius,fill:`transparent`,class:xe({"vue-ui-hill__hit-area--active":F.value&&R.value&&!e.disabled,"vue-ui-hill__hit-area--dragging":L.value?.id===e.id}),onPointerdown:t=>zn(t,e)},null,42,We),b(`circle`,{class:`vue-ui-hill-circle`,r:H.value.radius,fill:e.color,stroke:H.value.stroke,"stroke-width":H.value.strokeWidth,style:x({filter:H.value.shadow.show?`drop-shadow(${H.value.shadow.offsetX}px ${H.value.shadow.offsetY}px ${H.value.shadow.blur}px ${H.value.shadow.color})`:`none`}),"vector-effect":`non-scaling-stroke`,"pointer-events":`none`},null,12,Ge),F.value&&(L.value?.id===e.id&&H.value.dragMarker.show||xr(e))&&!e?.disabled?(S(),y(`g`,{key:0,fill:`none`,stroke:D(ee)(e.color),"stroke-width":H.value.dragMarker.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`,"vector-effect":`non-scaling-stroke`,"aria-hidden":`true`},[b(`path`,{d:H.value.dragMarker.crossPath},null,8,qe)],8,Ke)):v(``,!0),U.value.show?(S(),y(`text`,{key:1,x:e.labelX,y:U.value.offsetY,"text-anchor":e.textAnchor,fill:U.value.useSerieColor?e.color:U.value.color,"font-size":U.value.fontSize,"font-weight":U.value.bold?`bold`:`normal`,"paint-order":`stroke fill`,stroke:U.value.stroke,"stroke-width":U.value.strokeWidth,"stroke-linejoin":`round`,"stroke-linecap":`round`,"pointer-events":`none`,style:{"user-select":`none`},"dominant-baseline":`central`},E(D(f)(e.label,U.value.ellipsisThresholdChars)),9,Je)):v(``,!0)],46,Ue))),128)),(S(!0),y(g,null,w(ar.value,e=>(S(),y(`g`,{key:`stack-overflow-${e.stackId}`,class:xe([`vue-ui-hill__stack-overflow-marker`,{"vue-ui-hill__stack-overflow-marker--animated":D(P),"vue-ui-hill__stack-overflow-marker--restored":Cn.value===e.stackId}]),style:x({"--vue-ui-hill-overflow-marker-duration":`${q.value.transitionDuration*.7}ms`,"--vue-ui-hill-overflow-marker-delay":`${q.value.transitionDuration*.3}ms`,"--vue-ui-hill-overflow-label-duration":`${q.value.transitionDuration*.55}ms`,"--vue-ui-hill-overflow-label-delay":`${q.value.transitionDuration*.45}ms`,cursor:Yt.value&&!j.value.readonly?`pointer`:`default`}),transform:`translate(${e.x} ${e.y})`,"data-stack-overflow-marker":``,role:`button`,tabindex:F.value&&R.value?0:-1,"aria-label":`${e.hiddenCount} stacked datapoints. Activate to choose one.`,"aria-expanded":X.value===e.stackId,onPointerdown:s[0]||=O(()=>{},[`stop`]),onClick:O(t=>dr(e),[`stop`]),onFocus:t=>dr(e),onKeydown:[ke(O(t=>dr(e),[`prevent`,`stop`]),[`enter`]),ke(O(t=>dr(e),[`prevent`,`stop`]),[`space`]),ke(O(fr,[`prevent`,`stop`]),[`esc`])]},[D(P)&&Cn.value!==e.stackId?(S(),y(`g`,Xe,[(S(!0),y(g,null,w(e.collapseDatapoints,t=>(S(),y(`circle`,{key:`overflow-ghost-${e.stackId}-${t.id}`,cx:t.relativeX,cy:t.relativeY,r:H.value.radius,fill:t.color,stroke:H.value.stroke,"stroke-width":H.value.strokeWidth,opacity:`0.8`,"vector-effect":`non-scaling-stroke`},[b(`animate`,{attributeName:`cx`,from:t.relativeX,to:`0`,dur:`${q.value.transitionDuration}ms`,fill:`freeze`,calcMode:`spline`,keyTimes:`0;1`,keySplines:`0.22 1 0.36 1`},null,8,Qe),b(`animate`,{attributeName:`cy`,from:t.relativeY,to:`0`,dur:`${q.value.transitionDuration}ms`,fill:`freeze`,calcMode:`spline`,keyTimes:`0;1`,keySplines:`0.22 1 0.36 1`},null,8,$e),b(`animate`,{attributeName:`r`,from:H.value.radius,to:q.value.marker.radius*.7,dur:`${q.value.transitionDuration}ms`,fill:`freeze`},null,8,et),b(`animate`,{attributeName:`opacity`,from:`0.8`,to:`0`,dur:`${q.value.transitionDuration*.85}ms`,fill:`freeze`},null,8,tt)],8,Ze))),128))])):v(``,!0),b(`circle`,{r:Math.max(H.value.hitRadius,q.value.marker.radius),fill:`transparent`,"pointer-events":`all`},null,8,nt),b(`rect`,{class:`vue-ui-hill__stack-overflow-marker-rect`,x:-q.value.marker.radius,y:-q.value.marker.radius,width:q.value.marker.radius*2,height:q.value.marker.radius*2,fill:q.value.marker.fill,stroke:q.value.marker.stroke,"stroke-width":q.value.marker.strokeWidth,"vector-effect":`non-scaling-stroke`,"pointer-events":`none`},null,8,rt),b(`g`,{class:`vue-ui-hill__stack-overflow-focus-cross`,fill:`none`,stroke:D(ee)(V.value.curve.stroke),"stroke-width":H.value.dragMarker.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`,"vector-effect":`non-scaling-stroke`,"aria-hidden":`true`},[b(`path`,{d:H.value.dragMarker.crossPath},null,8,at)],8,it),or.value?v(``,!0):(S(),y(`text`,{key:1,class:`vue-ui-hill__stack-overflow-marker-label`,"text-anchor":`middle`,y:q.value.marker.radius+q.value.marker.offsetY+q.value.marker.fontSize,fill:q.value.marker.color,"font-size":q.value.marker.fontSize,"font-weight":q.value.marker.bold?`bold`:`normal`,"pointer-events":`none`,style:{"user-select":`none`},"paint-order":`stroke fill`,"vector-effect":`non-scaling-stroke`,stroke:N.value.backgroundColor,"stroke-width":`3`},` +`+E(e.hiddenCount),9,ot))],46,Ye))),128)),W.value.show?(S(),y(g,{key:4},[b(`text`,{x:(J.value.startX+J.value.centerX)/2,y:Xn.value,"text-anchor":`middle`,fill:W.value.color,"font-size":W.value.fontSize,"font-weight":W.value.bold?`bold`:`normal`,"letter-spacing":W.value.letterSpacing},E(Zn(`left`)),9,st),b(`text`,{x:(J.value.centerX+J.value.endX)/2,y:Xn.value,"text-anchor":`middle`,fill:W.value.color,"font-size":W.value.fontSize,"font-weight":W.value.bold?`bold`:`normal`,"letter-spacing":W.value.letterSpacing},E(Zn(`right`)),9,ct)],64)):v(``,!0),jr.value?(S(),y(g,{key:5},[b(`rect`,{x:J.value.left[0].x,y:Ir.value,rx:K.value.height/2,width:J.value.width,height:K.value.height,fill:K.value.gutterColor},null,8,lt),b(`defs`,null,[b(`clipPath`,{id:Rr.value},[b(`rect`,{x:J.value.left[0].x,y:Ir.value,width:J.value.width*Nr.value,height:K.value.height,rx:Math.min(K.value.height/2,J.value.width*Nr.value/2),ry:Math.min(K.value.height/2,J.value.width*Nr.value/2)},null,8,dt)],8,ut)]),b(`g`,{"clip-path":`url(#${Rr.value})`},[(S(!0),y(g,null,w(Mr.value,e=>(S(),y(`rect`,{key:`bar_fill_${e.id}`,width:J.value.width*e.proportion,x:J.value.left[0].x+J.value.width*e.proportionStart,y:B.value.height+32+K.value.paddingTop,fill:e.color,height:K.value.height,onPointerenter:t=>Gn(e),onPointerleave:t=>Kn(e)},null,40,pt))),128))],8,ft),(S(!0),y(g,null,w(Mr.value.slice(1),e=>(S(),y(`line`,{key:`bar_separator_${e.id}`,x1:J.value.left[0].x+J.value.width*e.proportionStart,x2:J.value.left[0].x+J.value.width*e.proportionStart,y1:B.value.height+32+K.value.paddingTop,y2:B.value.height+32+K.value.paddingTop+K.value.height,stroke:K.value.stroke,"stroke-width":K.value.strokeWidth,"vector-effect":`non-scaling-stroke`},null,8,mt))),128)),b(`rect`,{x:J.value.left[0].x,y:B.value.height+32+K.value.paddingTop,width:J.value.width*Nr.value,height:K.value.height,rx:Math.min(K.value.height/2,J.value.width*Nr.value/2),ry:Math.min(K.value.height/2,J.value.width*Nr.value/2),fill:`none`,stroke:K.value.stroke,"stroke-width":K.value.strokeWidth,"vector-effect":`non-scaling-stroke`},null,8,ht),K.value.label.show&&Nr.value>0?(S(),y(`text`,{key:0,x:Fr.value,y:Ir.value-6,fill:K.value.label.color,"font-size":K.value.label.fontSize,"text-anchor":`end`,"dominant-baseline":`auto`,"pointer-events":`none`,style:{"user-select":`none`}},E(Lr()),9,gt)):v(``,!0)],64)):v(``,!0),T(e.$slots,`svg`,{svg:{drawingArea:J.value,isEditing:F.value,datapoints:ir.value,isPrintingImg:D(Gt)||D(Kt)||D(Er),isPrintingSvg:D(Dr)}},void 0,!0)],46,Pe)),or.value?(S(),y(`div`,{ref_key:`overflowMenuRef`,ref:Ft,key:`stack-overflow-menu-${or.value.stackId}`,class:`vue-ui-hill__stack-overflow-menu`,"data-stack-overflow-menu":``,"data-dom-to-png-ignore":``,style:x([sr.value,Sn.value]),role:`listbox`,"aria-label":`Choose one of ${or.value.hiddenCount} stacked datapoints`,onPointerdown:s[1]||=O(()=>{},[`stop`]),onClick:s[2]||=O(()=>{},[`stop`]),onKeydown:ke(O(fr,[`prevent`,`stop`]),[`esc`])},[M.value.stacking.overflow.menu.title?(S(),y(`div`,vt,E(M.value.stacking.overflow.menu.title),1)):v(``,!0),(S(!0),y(g,null,w(or.value.hiddenDatapoints,e=>(S(),y(`button`,{key:`hidden-${e.id}`,type:`button`,class:xe([`vue-ui-hill__stack-overflow-menu-item`,{readonly:j.value.readonly}]),role:`option`,disabled:e.disabled,"aria-label":`${e.label}, ${Sr(e)}`,onClick:O(t=>vr(e),[`stop`]),style:x({cursor:Yt.value&&!j.value.readonly?`pointer`:`default`})},[b(`span`,{class:`vue-ui-hill__stack-overflow-menu-swatch`,style:x({backgroundColor:e.color}),"aria-hidden":`true`},null,4),b(`span`,bt,E(D(f)(e.label,U.value.ellipsisThresholdChars)),1),b(`span`,xt,E(Sr(e)),1)],14,yt))),128))],44,_t)):v(``,!0),T(e.$slots,`analysis`,{data:{...Mr.value}},void 0,!0),e.$slots.watermark?(S(),y(`div`,St,[T(e.$slots,`watermark`,Se(ve({isPrinting:D(Gt)||D(Kt)||D(Er)||D(Dr)})),void 0,!0)])):v(``,!0),j.value.loading?(S(),y(`div`,Ct,[j.value.loading?T(e.$slots,`loading`,{},()=>[ge(D(Ot),{name:`spinner2`,stroke:N.value.color,"is-spin":!0},null,8,[`stroke`])],!0,0):v(``,!0)])):v(``,!0)],44,je))}},[[`__scopeId`,`data-v-7c4727e2`]]);export{Ae as n,wt as t};
@@ -1,2 +1,2 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as ee}from"./tableIntegration-CNoJ1CIY.js";import{t as te}from"./chartImage-DPGnEuYM.js";import{n as ne}from"./resolveChartConfig-0IvbmIE_.js";import{$ as re,D as ie,Dt as ae,Et as oe,Ft as se,Ht as ce,J as le,Q as ue,S as de,T as fe,X as pe,_ as me,at as he,i as ge,in as _e,nt as ve,qt as ye,r as be,rn as xe,t as Se,tn as Ce,w as we}from"./lib-rPeBMZrn.js";import{n as Te,t as Ee}from"./useHints-C-TwxM0Y.js";import{t as De}from"./useConfig-CXhXxWjB.js";import{t as Oe}from"./useSvgLabelLayout-42Kats14.js";import{t as ke}from"./usePrinter-DVf3YcG5.js";import{t as Ae}from"./useResponsive-CENUxfEL.js";import{t as je}from"./useChartExport-BZts4KFb.js";import{t as Me}from"./useTransitions-ChGGrtrv.js";import{t as Ne}from"./useChartAccessibility-DOMuYJfm.js";import{t as Pe}from"./useTimeLabelCollider-BTybMUFi.js";import{n as Fe}from"./Title-BliHuXfT.js";import{t as Ie}from"./vue_ui_history_plot-BZ5TtPPB.js";import{t as Le}from"./Legend-W9YVYVX-.js";import{t as Re}from"./BaseScanner-m6QR9rwD.js";import{t as ze}from"./A11yDataTable-DWNlWXzs.js";import{t as Be}from"./BaseLegendToggle-VzX69MCo.js";import{t as Ve}from"./DefGrad-DKMq1REY.js";import{t as He}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as c,Teleport as Ue,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createSlots as We,createTextVNode as Ge,createVNode as Ke,defineAsyncComponent as m,guardReactiveProps as h,mergeProps as qe,nextTick as Je,normalizeClass as g,normalizeProps as _,normalizeStyle as v,onBeforeUnmount as Ye,onMounted as Xe,openBlock as y,reactive as Ze,ref as b,renderList as x,renderSlot as S,resolveDynamicComponent as Qe,shallowRef as $e,toDisplayString as C,unref as w,watch as T,withCtx as E}from"vue";var et=/* @__PURE__ */ e({default:()=>zt}),tt=[`id`],nt=[`id`],rt=[`id`],it={style:{position:`relative`}},at=[`xmlns`,`viewBox`,`aria-describedby`],ot=[`x`,`y`,`width`,`height`],st={key:1},ct=[`id`,`x1`,`y1`,`x2`,`y2`],lt=[`stop-color`,`offset`],ut={key:2},dt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],ft={key:3},pt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],mt=[`x`,`y`,`fill`,`font-size`],ht=[`transform`,`font-size`,`fill`,`font-weight`],gt={key:6},_t=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],vt={key:7},yt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],bt=[`transform`,`fill`,`font-size`,`text-anchor`],xt=[`x`,`y`,`font-size`,`fill`,`font-weight`],St=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Ct=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],wt=[`d`,`stroke`,`stroke-width`],Tt=[`d`,`stroke`,`stroke-width`],Et=[`cx`,`cy`,`fill`,`r`],Dt=[`cx`,`cy`,`fill`,`r`,`stroke`,`stroke-width`],Ot={key:1},kt=[`transform`,`font-size`,`fill`,`font-weight`],At=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],jt={key:2},Mt=[`transform`,`font-size`,`font-weight`,`fill`],Nt=[`cx`,`cy`,`r`,`onMouseenter`,`onMouseleave`,`onClick`],Pt={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Ft={key:5,class:`vue-data-ui-watermark`},It=[`id`],Lt=[`onClick`],Rt={style:{display:`flex`,"align-items":`center`}},zt=/*#__PURE__*/ He({__name:`vue-ui-history-plot`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:He,emit:et}){let zt=m(()=>import(`./Tooltip-B432XpvC.js`)),Bt=m(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),Vt=m(()=>import(`./vue-ui-accordion-D3uT1Ynv.js`).then(e=>e.n)),Ht=m(()=>import(`./DataTable-KeuZB1JM.js`)),Ut=m(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Wt=m(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Gt=m(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),Kt=m(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_history_plot:qt}=De(),D=e,O=b(null),Jt=b(null),Yt=b(null),Xt=b(0),Zt=$e(null),Qt=b(null),k=b(pe()),$t=b(!1),en=b(``),A=b([]),tn=b(!1),j=b(null),M=b(!1),nn=b(null),rn=b(!1),an=b(null),on=b(null),sn=b(null),cn=b(null),ln=b(null),un=b(null),N=b(null),P=b(null),dn=b({x:0,y:0}),fn=b(`pointer`),pn=b(!1),mn=l(()=>Array.from(D.dataset,e=>{let t=e&&typeof e==`object`?Object.keys(e):[],n=[`name`,`values`].filter(e=>!t.includes(e)),r=Array.isArray(e?.values),i=r?Array.from(e.values,e=>({x:Number.isFinite(e?.x),y:Number.isFinite(e?.y)})):[];return{missing:n,array:r,points:i,valid:!n.length&&r&&i.every(e=>e.x&&e.y)}})),hn=l(()=>D.dataset.length>0&&mn.value.every(e=>e.valid)),gn=et,_n=b(!1),F=null,vn=!1,yn=$e(null);function bn(){Zt.value?.disconnect(),Zt.value=null,F!==null&&cancelAnimationFrame(F),F=null}function xn(){if(bn(),yn.value=null,_n.value=!1,!L.value.responsive||!O.value?.parentNode)return;let e=new ResizeObserver(t);function t(){vn||Zt.value!==e||(F!==null&&cancelAnimationFrame(F),F=requestAnimationFrame(()=>{if(vn||Zt.value!==e)return;F=null;let{width:t,height:n}=Ae({chart:O.value,title:H.value.title.text?Jt.value:null,noTitle:Qt.value,legend:H.value.legend.show?Yt.value:null,source:nn.value});yn.value={width:Math.max(.1,t),height:Math.max(.1,n)},_n.value=!0}))}Zt.value=e,e.observe(O.value.parentNode);for(let t of[Jt.value,Yt.value,nn.value,Qt.value])t&&e.observe(t);t()}Xe(()=>{rn.value=!0,xn()}),Ye(()=>{vn=!0,bn()});function Sn(){return ne(D.config,qt,Ie)}let Cn=l(()=>Ze(Sn())),I=l(()=>!!D.config.loading||!hn.value),wn=l(()=>_e({defaultConfig:{userOptions:{show:!1},table:{show:!1},style:{chart:{backgroundColor:`#99999930`,axes:{x:{scaleMin:0,scaleMax:10,labels:{show:!1},name:{text:``}},y:{scaleMin:0,scaleMax:10,labels:{show:!1},name:{text:``}}},grid:{xAxis:{stroke:`#6A6A6A`},horizontalLines:{stroke:`#6A6A6A50`},yAxis:{stroke:`#6A6A6A`},verticalLines:{stroke:`#6A6A6A50`}},legend:{backgroundColor:`transparent`},paths:{useSerieColor:!1,stroke:`#6A6A6A`},plots:{stroke:`#6A6A6A`,indexLabels:{show:!1},labels:{show:!1}}}}},userConfig:Cn.value.skeletonConfig??{}})),L=l(()=>I.value?Ze(_e({defaultConfig:Cn.value,userConfig:wn.value})):Cn.value),Tn=l(()=>I.value?D.config.skeletonDataset??[{name:``,color:`#CACACA`,values:[{label:``,x:1,y:9},{label:``,x:4,y:1},{label:``,x:7,y:9},{label:``,x:9,y:4}]}]:D.dataset),R=l(()=>Cn.value.debug),z=l(()=>L.value.style.chart.plots),B=l(()=>L.value.style.chart.grid),V=l(()=>L.value.style.chart.axes),H=l(()=>L.value.style.chart);Te({config:()=>L.value,dataset:()=>D.dataset,component:`VueUiHistoryPlot`,rules:[Ee.emptyArray,{test:e=>e.length>6,message:[`👀 The number of series is > 6. Consider:`,``,`▶️ Using filters to let users choose a maximum number of series to display.`]}]});let{transitionEnabled:U}=Me({config:()=>L.value.transitions,dataset:()=>D.dataset}),En=l(()=>L.value.userOptions.useCursorPointer),Dn=b(!L.value.userOptions.showOnChartHover),On=l(()=>L.value.userOptions.keepStateOnChartLeave);function kn(e=!1){L.value.userOptions.showOnChartHover&&(Dn.value=e)}T(()=>L.value.userOptions.showOnChartHover,e=>{Dn.value=!e});let{svgRef:W}=Ne({config:H.value.title});T([mn,R],()=>{D.dataset.length||he({componentName:`VueUiHistoryPlot`,type:`dataset`,debug:R.value}),mn.value.forEach((e,t)=>{e.missing.forEach(e=>he({componentName:`VueUiHistoryPlot`,type:`datasetSerieAttribute`,property:e,index:t,debug:R.value})),R.value&&(!e.missing.includes(`values`)&&!e.array&&console.warn(`VueUiHistoryPlot: dataset[${t}].values must be an array.`),e.points.forEach((e,n)=>{for(let r of[`x`,`y`])e[r]||console.warn(`VueUiHistoryPlot: dataset[${t}].values[${n}].${r} must be a finite number.`)}))})},{immediate:!0}),T([()=>L.value.responsive,()=>H.value.title.text,()=>H.value.legend.show,()=>H.value.legend.position,Jt,Yt,nn,Qt],xn,{flush:`post`});let{isPrinting:An,isImaging:jn,generatePdf:Mn,generateImage:Nn}=ke({elementId:`history_plot_${k.value}`,fileName:H.value.title.text||`vue-ui-history-plot`,options:L.value.userOptions.print}),Pn=l(()=>L.value.userOptions.show&&!H.value.title.text),Fn=l(()=>we(L.value.customPalette)),G=b({showTable:L.value.table.show,showTooltip:H.value.tooltip.show});T(()=>L.value.table.show,e=>{G.value.showTable=e}),T(()=>H.value.tooltip.show,e=>{G.value.showTooltip=e});let K=l(()=>yn.value||{width:H.value.width,height:H.value.height}),In=l(()=>K.value.width),Ln=l(()=>K.value.height),{metrics:Rn,ready:zn,settling:q,update:Bn}=Oe({svgRef:W,canMeasure:()=>!L.value.responsive||_n.value,initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(un.value).textWidth,yAxisLabelWidth:e(cn.value).rotatedWidth,xAxisLabelHeight:e(sn.value).height,timeLabelsHeight:e(ln.value).height})});function Vn(){let e=Rn.value.scaleLabelsWidth,t=Rn.value.yAxisLabelWidth;return e+t+(t?24:0)}let Hn=l(()=>Rn.value.xAxisLabelHeight+Rn.value.timeLabelsHeight+(sn.value?Y.value.xAxisName/2:0)),J=l(()=>{let e=z.value.radius,t=H.value.padding.left+Vn()+V.value.y.name.offsetX,n=H.value.padding.top+e,r=K.value.width-H.value.padding.right-e-V.value.y.name.offsetX,i=K.value.height-H.value.padding.bottom-Hn.value-e-V.value.x.name.offsetY;return{left:t,top:n,right:r,bottom:i,width:r-t,height:i-n}}),Y=l(()=>{let e=(e,t)=>L.value.responsive&&L.value.responsiveProportionalSizing&&yn.value?xe({relator:Math.min(K.value.width,K.value.height),adjuster:600,source:e,threshold:t,fallback:t}):e;return{plots:e(z.value.radius,3),indexLabels:e(z.value.indexLabels.fontSize,6),labels:e(z.value.labels.fontSize,6),xAxisLabels:e(V.value.x.labels.fontSize,6),xAxisName:e(V.value.x.name.fontSize,6),yAxisLabels:e(V.value.y.labels.fontSize,6),yAxisName:e(V.value.y.name.fontSize,6)}}),Un=/* @__PURE__ */ new Map;function Wn(e){return Un.has(e)||Un.set(e,pe()),Un.get(e)}let Gn=/* @__PURE__ */ new Map,Kn=l(()=>{let e=/* @__PURE__ */ new Set;function t(t){return e.add(t),Wn(t)}let n=/* @__PURE__ */ new Map,r=Tn.value.map((e,r)=>{let i=e?.id==null?e?.name==null?`index:${r}`:`name:${e.name}`:`id:${typeof e.id}:${e.id}`,a=n.get(i)||0;return n.set(i,a+1),t(`${I.value?`skeleton`:`data`}:${i}:${a}`)}),i=Tn.value.map((e,n)=>{let i=/* @__PURE__ */ new Map;return(Array.isArray(e?.values)?e.values:[]).map((e,a)=>{let o=e?.id==null?e?.label?`label:${e.label}`:`index:${a}`:`id:${typeof e.id}:${e.id}`,s=i.get(o)||0;return i.set(o,s+1),t(`${r[n]}:${o}:${s}`)})});for(let t of Gn.get(I.value)||[])e.has(t)||Un.delete(t);return Gn.set(I.value,e),{series:r,plots:i}}),qn=l(()=>Kn.value.series),Jn=l(()=>Kn.value.plots),X=l(()=>qn.value.flatMap((e,t)=>A.value.includes(e)?[t]:[])),Yn=l(()=>Tn.value.map((e,t)=>{let n=Array.isArray(e.temperatureColors)&&e.temperatureColors.length?e.temperatureColors.map(e=>de(e)):void 0;return{...e,color:e.color?de(e.color):Fn.value[t]||ce[t]||ce[t%ce.length],temperatureColors:n,temperatureAngle:Xn(e.temperatureAngle),temperatureIndependant:e.temperatureIndependant===!0,usePlotTemperatureColors:e.usePlotTemperatureColors!==!1,seriesIndex:t}}));function Xn(e=0){let t=Number(e);return Number.isFinite(t)?(t%360+360)%360:0}let Zn=l(()=>Yn.value.filter(e=>!X.value.includes(e.seriesIndex))),Qn=l(()=>{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(let i of Zn.value)for(let a of i.values)e=Math.min(e,a.x),t=Math.max(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.y);return{minX:Math.min(0,Number.isFinite(e)?e:0),maxX:Number.isFinite(t)?t:1,minY:Math.min(0,Number.isFinite(n)?n:0),maxY:Number.isFinite(r)?r:1}});function $n(e,t,n){let r=Number.isFinite(e.scaleMin)?e.scaleMin:t,i=Number.isFinite(e.scaleMax)?e.scaleMax:n,a=Math.min(r,i),o=Math.max(r,i);return me(a===o?a-(a?Math.abs(a)*.1:0):a,a===o?o+(o?Math.abs(o)*.1:1):o,Math.max(2,e.ticks||2))}let Z=l(()=>{let e=$n(V.value.x,Qn.value.minX,Qn.value.maxX),t=$n(V.value.y,Qn.value.minY,Qn.value.maxY);return{x:e,y:t,tickX:e.ticks.map(t=>({x:J.value.left+(t-e.min)/(e.max-e.min)*J.value.width,y1:J.value.top,y2:J.value.bottom,value:t})),tickY:t.ticks.map(e=>({y:J.value.bottom-(e-t.min)/(t.max-t.min)*J.value.height,x1:J.value.left,x2:J.value.right,value:e}))}});function er(e){let t=Z.value.x.min<0?Math.abs(Z.value.x.min):Z.value.x.min>0?-Z.value.x.min:0;return J.value.left+((e||0)+t)/(Z.value.x.max+t)*J.value.width}function tr(e){let t=Z.value.y.min<0?Math.abs(Z.value.y.min):Z.value.y.min>0?-Z.value.y.min:0;return J.value.bottom-((e||0)+t)/(Z.value.y.max+t)*J.value.height}let Q=l(()=>Zn.value.map((e,t)=>{let n=e.values.map((t,n)=>({valueX:t.x,valueY:t.y,label:t.label,x:er(t.x),y:tr(t.y),color:e.color,seriesName:e.name,id:Jn.value[e.seriesIndex][n]})),r=e.smooth?fe(n):n.map(e=>`${e.x},${e.y} `).join(``).trim();return{...e,gradientIndex:t,plots:n,path:n.length?`M${r}`:``}})),nr=l(()=>{if(j.value===null||N.value===null)return Q.value;let e=Q.value.findIndex(e=>e.seriesIndex===N.value);if(e===-1)return Q.value;let t=Q.value[e];return[...Q.value.slice(0,e),...Q.value.slice(e+1),t]}),rr=l(()=>Q.value.some(e=>ir(e)));function ir(e){return Array.isArray(e?.temperatureColors)&&e.temperatureColors.length}function ar(e){return ir(e)&&e.usePlotTemperatureColors}function or(e){let t=Array.isArray(e?.plots)?e.plots:[];if(!t.length)return{minX:0,maxX:0,minY:0,maxY:0,width:0,height:0};let n=1/0,r=-1/0,i=1/0,a=-1/0;for(let e of t)n=Math.min(n,e.x),r=Math.max(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.y);return{minX:n,maxX:r,minY:i,maxY:a,width:r-n,height:a-i}}function sr(){let e=J.value;return{minX:e.left,maxX:e.right,minY:e.top,maxY:e.bottom,width:e.width,height:e.height}}function cr(e){return e?.temperatureIndependant?or(e):sr()}function lr(e){let t=Xn(e?.temperatureAngle)*Math.PI/180,n=Math.sin(t),r=Math.cos(t),i=cr(e),a=i.minX+i.width/2,o=i.minY+i.height/2,s=(Math.abs(n)*i.width+Math.abs(r)*i.height)/2||1;return{x1:a-n*s,y1:o-r*s,x2:a+n*s,y2:o+r*s}}let ur=l(()=>{let e=/* @__PURE__ */ new Map;for(let t of Q.value){if(!ir(t))continue;let n=lr(t),{x1:r,y1:i,x2:a,y2:o}=n,s=a-r,ee=o-i,te=s*s+ee*ee,ne=/* @__PURE__ */ new Map;if(ar(t))for(let e of t.plots){let n=te?Math.min(1,Math.max(0,((e.x-r)*s+(e.y-i)*ee)/te)):0;ne.set(e.id,oe({colors:t.temperatureColors,ratio:n}))}e.set(t.seriesIndex,{coordinates:n,colors:ne})}return e});function dr(e){return ur.value.get(e.seriesIndex)?.coordinates}function fr(e,t){return ur.value.get(e.seriesIndex)?.colors.get(t.id)??e.color}function pr(e,t){return`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${k.value}`}function mr(e,t,n){return ar(e)?z.value.gradient.show?`url(#${pr(e,t)})`:fr(e,t):z.value.gradient.show?`url(#gradient_${n}_${k.value})`:t.color}function hr(e,t){return ar(e)?fr(e,t):e.color}function gr(e,t){return z.value.indexLabels.adaptColorToBackground?be(hr(e,t)):z.value.indexLabels.color}function _r(e,t){let n=Q.value.find(t=>t.seriesIndex===e);return n&&ar(n)?fr(n,t):t.color}function vr(e){return ir(e)?`url(#temperature_grad_history_${e.seriesIndex}_${k.value})`:H.value.paths.useSerieColor?e.color:H.value.paths.stroke}function yr(e){return j.value===null||N.value===e?1:Math.min(1,z.value.unselectedOpacity)}function br(){X.value.length?A.value=[]:Dr.value.forEach(e=>{A.value.push(qn.value[e.seriesIndex])}),gn(`selectLegend`,Q.value)}function xr(e){X.value.includes(e)?A.value=A.value.filter(t=>t!==qn.value[e]):A.value.push(qn.value[e]),gn(`selectLegend`,Q.value)}function Sr(e){return Yn.value.length?Yn.value.find(t=>t.name===e)||(R.value&&console.warn(`VueUiHistoryPlot - Series name not found "${e}"`),null):(R.value&&console.warn(`VueUiHistoryPlot - There are no series to show.`),null)}function Cr(e){let t=Sr(e);t!==null&&X.value.includes(t.seriesIndex)&&xr(t.seriesIndex)}function wr(e){let t=Sr(e);t!==null&&(X.value.includes(t.seriesIndex)||xr(t.seriesIndex))}T(qn,e=>{I.value||(A.value=A.value.filter(t=>e.includes(t)))});let $=l(()=>Q.value.filter(e=>e.plots.length)),Tr=l(()=>{let e=/* @__PURE__ */ new Map;for(let t of Q.value)t.plots.forEach((n,r)=>e.set(n.id,{serie:t,plot:n,plotIndex:r}));return e}),Er=b(null),Dr=l(()=>Yn.value.map(e=>{let t=ir(e)?e.temperatureColors:null;return{...e,gradientColors:t,opacity:X.value.includes(e.seriesIndex)?.5:1,segregate:()=>xr(e.seriesIndex),isSegregated:X.value.includes(e.seriesIndex),shape:t?`gradient`:`circle`}})),Or=l(()=>({cy:`history-plot-div-legend`,backgroundColor:H.value.legend.backgroundColor,color:H.value.legend.color,fontSize:H.value.legend.fontSize,paddingBottom:12,fontWeight:H.value.legend.bold?`bold`:``}));function kr({datapoint:e,plotIndex:t,seriesIndex:n}){I.value||(L.value.events.datapointClick&&L.value.events.datapointClick({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),gn(`selectDatapoint`,e))}function Ar(e){tn.value=e,Xt.value+=1}let jr=b(null);function Mr({datapoint:e,plotIndex:t,seriesIndex:n}){L.value.events.datapointLeave&&L.value.events.datapointLeave({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),(fn.value!==`keyboard`||N.value!==n||P.value!==t)&&ii()}function Nr(e,t){if(vn||!W.value)return;let n=Q.value.find(t=>t.seriesIndex===e);if(!n)return;let r=n.plots[t];if(!r)return;let i=Ce(r.x,r.y,W.value);i&&(dn.value=i)}function Pr({datapoint:e,plotIndex:t,seriesIndex:n,triggerMode:r=`pointer`}){I.value||(L.value.events.datapointEnter&&L.value.events.datapointEnter({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),Er.value=e.id,N.value=n,P.value=t,fn.value=r,j.value=e,Fr({datapoint:e,plotIndex:t,seriesIndex:n}),$t.value=!0,r===`keyboard`&&Je(()=>{Er.value===e.id&&Nr(n,t)}))}function Fr({datapoint:e,plotIndex:t,seriesIndex:n}){let r=_r(n,e),i={...e,color:r};jr.value={datapoint:i,color:r,seriesIndex:n,plotIndex:t,config:L.value,series:Yn.value},j.value=e;let a=H.value.tooltip.customFormat;if(M.value=!1,ae(a))try{let e=a({seriesIndex:n,datapoint:i,color:r,plotIndex:t,series:Yn.value,config:L.value});typeof e==`string`&&(en.value=e,M.value=!0)}catch{console.warn(`Custom format cannot be applied.`),M.value=!1}if(!M.value){let t=``;t+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;border-bottom:1px solid ${H.value.tooltip.borderColor};margin-bottom:3px;padding-bottom:6px;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${r}"/></svg><span>${e.seriesName}</span></div>`,t+=`<div>${e.label}</div>`,t+=`<div>${V.value.x.name.text||`x`}: ${ge(V.value.x.labels.formatter,e.valueX,re({p:V.value.x.labels.prefix,v:e.valueX,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding}))}</div>`,t+=`<div>${V.value.y.name.text||`y`}: ${ge(V.value.y.labels.formatter,e.valueY,re({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))}</div>`,en.value=`<div>${t}</div>`}}T([Q,()=>H.value.tooltip,I],()=>{if(!Er.value)return;let e=Tr.value.get(Er.value);if(!e||I.value){ii();return}let{plot:t,serie:n,plotIndex:r}=e;j.value=t,N.value=n.seriesIndex,P.value=r,Fr({datapoint:t,seriesIndex:n.seriesIndex,plotIndex:r}),fn.value===`keyboard`&&Nr(n.seriesIndex,r)},{flush:`post`});let Ir=l(()=>{let e=[L.value.table.columnNames.series,L.value.table.columnNames.datapoint,L.value.table.columnNames.x,L.value.table.columnNames.y];return{head:e,body:Q.value.flatMap(e=>e.plots.map(e=>[{color:e.color,name:e.seriesName},e.label,ge(V.value.x.labels.formatter,e.valueX,re({p:V.value.x.labels.prefix,v:e.valueX,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding})),ge(V.value.y.labels.formatter,e.valueY,re({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))])),config:{th:{backgroundColor:L.value.table.th.backgroundColor,color:L.value.table.th.color,outline:L.value.table.th.outline},td:{backgroundColor:L.value.table.td.backgroundColor,color:L.value.table.td.color,outline:L.value.table.td.outline},breakpoint:L.value.table.responsiveBreakpoint},colNames:e}});function Lr(e=null){Je(()=>{let t=[[L.value.table.columnNames.series],[L.value.table.columnNames.datapoint],[L.value.table.columnNames.x],[L.value.table.columnNames.y]],n=Q.value.flatMap(e=>e.plots.map(e=>[[e.seriesName],[e.label],[e.valueX],[e.valueY]])),r=[[H.value.title.text],[H.value.title.subtitle.text],t].concat(n),i=ie(r);e?e(i):ve({csvContent:i,title:H.value.title.text||`vue-ui-history-plot`})})}let Rr=b(!1);function zr(){Rr.value=!Rr.value}function Br(){G.value.showTable=!G.value.showTable}function Vr(){G.value.showTooltip=!G.value.showTooltip}function Hr(){return Q.value}let Ur=te(O,()=>H.value.title.text),Wr=l(()=>Z.value.tickX),Gr=l(()=>({start:0,end:Z.value.tickX.length}));Pe({timeLabelsEls:ln,timeLabels:Wr,slicer:Gr,configRef:L,rotationPath:[`style`,`chart`,`axes`,`x`,`labels`,`rotation`],autoRotatePath:[`style`,`chart`,`axes`,`x`,`labels`,`autoRotate`,`enable`],isAutoSize:!1,width:In,height:Ln,targetClass:`.vue-ui-history-plot-x-axis-scale`,rotation:V.value.x.labels.autoRotate.angle});let Kr=l(()=>ee({config:L,style:H,mutableConfig:G,dialog:Kt,accordion:Vt,isFullscreen:tn,parent:O,maxWidth:800}));T([()=>G.value.showTable,an],([e])=>{an.value&&s(e,L,an)},{flush:`post`});function qr(){G.value.showTable=!1,on.value&&on.value.setTableIconState(!1)}let Jr=l(()=>H.value.backgroundColor),Yr=l(()=>H.value.legend),Xr=l(()=>H.value.title),{isCallbackImaging:Zr,isCallbackSvg:Qr,generateSvg:$r,onGenerateImage:ei}=je({svg:W,title:Xr,legend:Yr,legendItems:Dr,backgroundColor:Jr,getSvgCallback:()=>L.value.userOptions.callbacks.svg,generateImage:Nn});async function ti(){gn(`copyAlt`,{config:L.value,dataset:Q.value}),L.value.userOptions.callbacks.altCopy?await Promise.resolve(L.value.userOptions.callbacks.altCopy({config:L.value,dataset:Q.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let ni=l(()=>({head:Ir.value.head,body:Ir.value.body.map(e=>[e[0]?.name||``,e[1],e[2],e[3]]),caption:L.value.a11y.translations.tableCaption,notice:L.value.a11y.translations.tableAvailable}));function ri(e){return $.value.findIndex(t=>t.seriesIndex===e)}function ii(e=!1){e&&j.value&&L.value.events.datapointLeave&&L.value.events.datapointLeave({datapoint:{...j.value,plotIndex:P.value,seriesIndex:N.value},seriesIndex:N.value}),Er.value=null,N.value=null,P.value=null,fn.value=`pointer`,$t.value=!1,j.value=null,jr.value=null,en.value=``,M.value=!1}function ai(){ii(!0)}function oi(){ii(),pn.value=!0}function si(){ai(),pn.value=!1}function ci(e,t){if(!e?.plots?.length)return null;let n=e.plots.length;return(t%n+n)%n}function li({seriesIndex:e,plotIndex:t,direction:n}){if(!$.value.length)return null;let r=ri(e);if(r===-1)return null;if(n===`up`||n===`down`){let e=$.value[r];if(!e?.plots?.length)return null;let i=ci(e,t+(n===`up`?-1:1));return{seriesIndex:e.seriesIndex,plotIndex:i}}if(n===`left`||n===`right`){let e=((r+(n===`left`?-1:1))%$.value.length+$.value.length)%$.value.length,i=$.value[e];if(!i?.plots?.length)return null;let a=Math.min(t,i.plots.length-1);return{seriesIndex:i.seriesIndex,plotIndex:a}}return null}function ui(e){if(!W.value||Rr.value||I.value||document.activeElement!==W.value||!$.value.length)return;let t=e.key===`ArrowLeft`,n=e.key===`ArrowRight`,r=e.key===`ArrowUp`,i=e.key===`ArrowDown`,a=e.key===`Enter`||e.key===` `,o=e.key===`Escape`;if(!t&&!n&&!r&&!i&&!a&&!o)return;if(e.preventDefault(),e.stopPropagation(),o){ai();return}if(a){if(N.value===null||P.value===null)return;let e=$.value.find(e=>e.seriesIndex===N.value)?.plots?.[P.value];if(!e)return;kr({datapoint:e,plotIndex:P.value,seriesIndex:N.value});return}let s=null;if(N.value===null||P.value===null){let e=$.value[0];if(!e?.plots?.length)return;s={seriesIndex:e.seriesIndex,plotIndex:0}}else r?s=li({seriesIndex:N.value,plotIndex:P.value,direction:`up`}):i?s=li({seriesIndex:N.value,plotIndex:P.value,direction:`down`}):t?s=li({seriesIndex:N.value,plotIndex:P.value,direction:`left`}):n&&(s=li({seriesIndex:N.value,plotIndex:P.value,direction:`right`}));if(!s)return;let ee=$.value.find(e=>e.seriesIndex===s.seriesIndex)?.plots?.[s.plotIndex];ee&&Pr({datapoint:ee,plotIndex:s.plotIndex,seriesIndex:s.seriesIndex,triggerMode:`keyboard`})}return He({getData:Hr,getImage:Ur,generatePdf:Mn,generateCsv:Lr,generateImage:Nn,generateSvg:$r,hideSeries:wr,showSeries:Cr,toggleTable:Br,toggleTooltip:Vr,toggleAnnotator:zr,toggleFullscreen:Ar,copyAlt:ti}),T(()=>[K.value,Y.value,V.value,H.value,L.value.style.fontFamily,D.dataset,_n.value,un.value,ln.value,sn.value,cn.value],Bn,{flush:`post`,deep:!0}),(e,s)=>(y(),f(`div`,{id:`history_plot_${k.value}`,ref_key:`historyPlotChart`,ref:O,class:g({"vue-data-ui-component":!0,"vue-ui-history-plot":!0,"vue-data-ui-wrapper-fullscreen":tn.value}),style:v(`background:${H.value.backgroundColor};color:${H.value.color};font-family:${L.value.style.fontFamily}; position: relative; ${L.value.responsive?`height: 100%`:``}`),onMouseenter:s[2]||=()=>kn(!0),onMouseleave:s[3]||=()=>kn(!1)},[p(`div`,{id:`chart-instructions-${k.value}`,class:`sr-only`},[p(`p`,null,C(L.value.a11y.translations.keyboardNavigation),1)],8,nt),L.value.a11y.includeTable&&ni.value.body.length?(y(),u(ze,{key:0,uid:k.value,head:ni.value.head,body:ni.value.body,caption:ni.value.caption,notice:ni.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):d(``,!0),S(e.$slots,`userConfig`,{},void 0,!0),L.value.userOptions.buttons.annotator?(y(),u(w(Ut),qe({key:1},w(a)(L.value.userOptions.annotator),{svgRef:w(W),backgroundColor:H.value.backgroundColor,color:H.value.color,active:Rr.value,isCursorPointer:En.value,palette:L.value.userOptions.annotatorPalette,onClose:zr}),We({_:2},[x(w(o),t=>({name:t,fn:E(n=>[S(e.$slots,t,_(h(w(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):d(``,!0),Pn.value?(y(),f(`div`,{key:2,ref_key:`noTitle`,ref:Qt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):d(``,!0),H.value.title.text?(y(),f(`div`,{key:3,ref_key:`chartTitle`,ref:Jt,class:`vue-ui-xy-title`,style:v(`font-family:${L.value.style.fontFamily}`)},[Ke(Fe,{config:{title:{cy:`history-plot-div-title`,...H.value.title},subtitle:{cy:`history-plot-div-subtitle`,...H.value.title.subtitle}}},null,8,[`config`])],4)):d(``,!0),p(`div`,{id:`legend-top-${k.value}`},null,8,rt),L.value.userOptions.show&&hn.value&&(On.value||Dn.value)?(y(),u(w(Wt),qe({ref_key:`userOptionsRef`,ref:on,key:`user_option_${Xt.value}`,backgroundColor:H.value.backgroundColor,color:H.value.color,isPrinting:w(An),isImaging:w(jn),uid:k.value,hasTooltip:H.value.tooltip.show&&L.value.userOptions.buttons.tooltip,hasLabel:!1,isFullscreen:tn.value,chartElement:O.value},w(n)(L.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isTooltip:G.value.showTooltip,isAnnotation:Rr.value,tableDialog:L.value.table.useDialog,isCursorPointer:En.value,onToggleFullscreen:Ar,onGeneratePdf:w(Mn),onGenerateCsv:Lr,onGenerateImage:w(ei),onGenerateSvg:w($r),onToggleTable:Br,onToggleTooltip:Vr,onToggleAnnotator:zr,onCopyAlt:ti,style:{visibility:On.value?Dn.value?`visible`:`hidden`:`visible`}}),We({_:2},[x(w(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:E(n=>[S(e.$slots,t,_(h(w(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasTooltip`,`isFullscreen`,`chartElement`,`isTooltip`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):d(``,!0),p(`div`,it,[(y(),f(`svg`,{ref_key:`svgRef`,ref:W,xmlns:w(Se),viewBox:`0 0 ${K.value.width<0?.1:K.value.width} ${K.value.height<0?.1:K.value.height}`,style:v(`max-width:100%;overflow:visible;background:transparent;color:${H.value.color};visibility:${w(zn)?`visible`:`hidden`}`),"aria-describedby":`chart-instructions-${k.value}`,tabindex:`0`,onFocus:oi,onBlur:si,onKeydown:ui},[Ke(w(Gt)),S(e.$slots,`svg-underlayer`,{svg:{...K.value,drawingArea:J.value,isPrintingImg:w(An)||w(jn)||w(Zr),isPrintingSvg:w(Qr)}},void 0,!0),e.$slots[`chart-background`]?(y(),f(`foreignObject`,{key:0,x:J.value.left,y:J.value.top,width:J.value.width<=0?10:J.value.width,height:J.value.height<=0?10:J.value.height,style:{pointerEvents:`none`}},[S(e.$slots,`chart-background`,{},void 0,!0)],8,ot)):d(``,!0),z.value.gradient.show||rr.value?(y(),f(`defs`,st,[z.value.gradient.show?(y(!0),f(c,{key:0},x(Q.value,(e,t)=>(y(),u(Ve,{t:`radial`,key:`gradient_${t}_${k.value}`,id:`gradient_${t}_${k.value}`,fy:`30%`,stops:[[`10%`,w(se)(e.color,z.value.gradient.intensity/100),1],[`90%`,w(ue)(e.color,.1),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128)):d(``,!0),(y(!0),f(c,null,x(Q.value,e=>(y(),f(c,{key:`temperature_grad_history_template_${e.seriesIndex}_${k.value}`},[z.value.gradient.show&&ar(e)?(y(!0),f(c,{key:0},x(e.plots,t=>(y(),u(Ve,{t:`radial`,key:`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${k.value}`,id:pr(e,t),fy:`30%`,stops:[[`10%`,w(se)(fr(e,t),z.value.gradient.intensity/100),1],[`90%`,w(ue)(fr(e,t),.1),1],[`100%`,fr(e,t),1]]},null,8,[`id`,`stops`]))),128)):d(``,!0),ir(e)?(y(),f(`linearGradient`,{key:1,id:`temperature_grad_history_${e.seriesIndex}_${k.value}`,gradientUnits:`userSpaceOnUse`,x1:dr(e).x1,y1:dr(e).y1,x2:dr(e).x2,y2:dr(e).y2},[(y(!0),f(c,null,x(e.temperatureColors,(t,n)=>(y(),f(`stop`,{key:`temperature_grad_history_stop_${e.seriesIndex}_${n}_${k.value}`,"stop-color":t,offset:e.temperatureColors.length===1?`0%`:w(ye)(n,e.temperatureColors.length)},null,8,lt))),128))],8,ct)):d(``,!0)],64))),128))])):d(``,!0),B.value.verticalLines.show?(y(),f(`g`,ut,[(y(!0),f(c,null,x(Z.value.tickX,e=>(y(),f(`line`,{x1:e.x,x2:e.x,y1:e.y1,y2:e.y2,stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`},null,8,dt))),256))])):d(``,!0),V.value.y.labels.show?(y(),f(`g`,ft,[(y(!0),f(c,null,x(Z.value.tickY,e=>(y(),f(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:J.value.left-5,x2:J.value.left,y1:e.y,y2:e.y},null,8,pt))),256))])):d(``,!0),V.value.y.labels.show?(y(),f(`g`,{key:4,ref_key:`yAxisScales`,ref:un},[(y(!0),f(c,null,x(Z.value.tickY,e=>(y(),f(`text`,{x:J.value.left+V.value.y.labels.offsetX-4-z.value.radius,y:e.y+Y.value.yAxisLabels/3,fill:V.value.y.labels.color,"font-size":Y.value.yAxisLabels,"text-anchor":`end`},C(w(ge)(V.value.y.labels.formatter,e.value,w(re)({p:V.value.y.labels.prefix,v:e.value,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))),9,mt))),256))],512)):d(``,!0),V.value.y.name.text?(y(),f(`text`,{key:5,ref_key:`yAxisLabel`,ref:cn,transform:`translate(${Y.value.yAxisName}, ${K.value.height/2+V.value.y.name.offsetY}), rotate(-90)`,"font-size":Y.value.yAxisName,fill:V.value.y.name.color,"font-weight":V.value.y.name.bold?`bold`:`normal`,"text-anchor":`middle`},C(V.value.y.name.text),9,ht)):d(``,!0),B.value.horizontalLines.show?(y(),f(`g`,gt,[(y(!0),f(c,null,x(Z.value.tickY,e=>(y(),f(`line`,{x1:e.x1,x2:e.x2,y1:e.y,y2:e.y,stroke:B.value.horizontalLines.stroke,"stroke-width":B.value.horizontalLines.strokeWidth,"stroke-linecap":`round`},null,8,_t))),256))])):d(``,!0),V.value.x.labels.show?(y(),f(`g`,vt,[(y(!0),f(c,null,x(Z.value.tickX,e=>(y(),f(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:e.x,x2:e.x,y1:J.value.bottom,y2:J.value.bottom+5},null,8,yt))),256))])):d(``,!0),V.value.x.labels.show?(y(),f(`g`,{key:8,ref_key:`xAxisScales`,ref:ln},[(y(!0),f(c,null,x(Z.value.tickX,e=>(y(),f(`text`,{class:`vue-ui-history-plot-x-axis-scale`,transform:`translate(${e.x}, ${J.value.bottom+V.value.x.labels.offsetY+Y.value.xAxisLabels+z.value.radius}), rotate(${V.value.x.labels.rotation})`,fill:V.value.x.labels.color,"font-size":Y.value.xAxisLabels,"text-anchor":V.value.x.labels.rotation>0?`start`:V.value.x.labels.rotation<0?`end`:`middle`},C(w(ge)(V.value.x.labels.formatter,e.value,w(re)({p:V.value.x.labels.prefix,v:e.value,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding}))),9,bt))),256))],512)):d(``,!0),V.value.x.name.text?(y(),f(`text`,{key:9,ref_key:`xAxisLabel`,ref:sn,x:K.value.width/2+V.value.x.name.offsetX,y:K.value.height,"font-size":Y.value.xAxisName,fill:V.value.x.name.color,"font-weight":V.value.x.name.bold?`bold`:`normal`,"text-anchor":`middle`},C(V.value.x.name.text),9,xt)):d(``,!0),B.value.xAxis.show?(y(),f(`line`,{key:10,x1:J.value.left,x2:J.value.left+J.value.width,y1:J.value.bottom,y2:J.value.bottom,stroke:B.value.xAxis.stroke,"stroke-width":B.value.xAxis.strokeWidth,"stroke-linecap":`round`},null,8,St)):d(``,!0),B.value.yAxis.show?(y(),f(`line`,{key:11,x1:J.value.left,x2:J.value.left,y1:J.value.top,y2:J.value.bottom,stroke:B.value.yAxis.stroke,"stroke-width":B.value.yAxis.strokeWidth,"stroke-linecap":`round`},null,8,Ct)):d(``,!0),(y(!0),f(c,null,x(nr.value,e=>(y(),f(`g`,{key:`history_plot_serie_${e.seriesIndex}_${k.value}`},[H.value.paths.show?(y(),f(`g`,{key:0,style:v({opacity:yr(e.seriesIndex)})},[p(`path`,{class:g({"vue-data-ui-transition":w(U)&&!w(q)}),d:e.path,stroke:H.value.backgroundColor,"stroke-width":H.value.paths.strokeWidth+4,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,wt),p(`path`,{class:g({"vue-data-ui-transition":w(U)&&!w(q)}),d:e.path,stroke:vr(e),"stroke-width":H.value.paths.strokeWidth,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,Tt)],4)):d(``,!0),(y(!0),f(c,null,x(e.plots,e=>(y(),f(`circle`,{cx:e.x,cy:e.y,fill:H.value.backgroundColor,r:Y.value.plots,stroke:`none`,class:g({"vue-data-ui-transition":w(U)&&!w(q)})},null,10,Et))),256)),(y(!0),f(c,null,x(e.plots,t=>(y(),f(`circle`,{cx:t.x,cy:t.y,fill:mr(e,t,e.gradientIndex),r:Y.value.plots,stroke:z.value.stroke,"stroke-width":z.value.strokeWidth,class:g({"vue-data-ui-transition":w(U)&&!w(q)}),style:v({opacity:yr(e.seriesIndex)})},null,14,Dt))),256)),z.value.labels.show?(y(),f(`g`,Ot,[(y(!0),f(c,null,x(e.plots,(t,n)=>(y(),f(`g`,{key:`plab_${n}`},[String(t.label).includes(`
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as ee}from"./tableIntegration-CNoJ1CIY.js";import{t as te}from"./chartImage-Dvrx_F7P.js";import{n as ne}from"./resolveChartConfig-QgMumfgd.js";import{$ as re,D as ie,Dt as ae,Et as oe,Ft as se,Ht as ce,J as le,Q as ue,S as de,T as fe,X as pe,_ as me,at as he,i as ge,in as _e,nt as ve,qt as ye,r as be,rn as xe,t as Se,tn as Ce,w as we}from"./lib-BaWaqwnJ.js";import{n as Te,t as Ee}from"./useHints-C-TwxM0Y.js";import{t as De}from"./useConfig-B-AzS3w-.js";import{t as Oe}from"./useSvgLabelLayout-42Kats14.js";import{t as ke}from"./usePrinter-CUD8gosC.js";import{t as Ae}from"./useResponsive-CENUxfEL.js";import{t as je}from"./useChartExport-BZts4KFb.js";import{t as Me}from"./useTransitions-ChGGrtrv.js";import{t as Ne}from"./useChartAccessibility-DOMuYJfm.js";import{t as Pe}from"./useTimeLabelCollider-BTybMUFi.js";import{n as Fe}from"./Title-DlhGIAWX.js";import{t as Ie}from"./vue_ui_history_plot-BZ5TtPPB.js";import{t as Le}from"./Legend-D5I3jeGD.js";import{t as Re}from"./BaseScanner-m6QR9rwD.js";import{t as ze}from"./A11yDataTable-DWNlWXzs.js";import{t as Be}from"./BaseLegendToggle-CnQ_U5rI.js";import{t as Ve}from"./DefGrad-DKMq1REY.js";import{t as He}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as c,Teleport as Ue,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createSlots as We,createTextVNode as Ge,createVNode as Ke,defineAsyncComponent as m,guardReactiveProps as h,mergeProps as qe,nextTick as Je,normalizeClass as g,normalizeProps as _,normalizeStyle as v,onBeforeUnmount as Ye,onMounted as Xe,openBlock as y,reactive as Ze,ref as b,renderList as x,renderSlot as S,resolveDynamicComponent as Qe,shallowRef as $e,toDisplayString as C,unref as w,watch as T,withCtx as E}from"vue";var et=/* @__PURE__ */ e({default:()=>zt}),tt=[`id`],nt=[`id`],rt=[`id`],it={style:{position:`relative`}},at=[`xmlns`,`viewBox`,`aria-describedby`],ot=[`x`,`y`,`width`,`height`],st={key:1},ct=[`id`,`x1`,`y1`,`x2`,`y2`],lt=[`stop-color`,`offset`],ut={key:2},dt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],ft={key:3},pt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],mt=[`x`,`y`,`fill`,`font-size`],ht=[`transform`,`font-size`,`fill`,`font-weight`],gt={key:6},_t=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],vt={key:7},yt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],bt=[`transform`,`fill`,`font-size`,`text-anchor`],xt=[`x`,`y`,`font-size`,`fill`,`font-weight`],St=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Ct=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],wt=[`d`,`stroke`,`stroke-width`],Tt=[`d`,`stroke`,`stroke-width`],Et=[`cx`,`cy`,`fill`,`r`],Dt=[`cx`,`cy`,`fill`,`r`,`stroke`,`stroke-width`],Ot={key:1},kt=[`transform`,`font-size`,`fill`,`font-weight`],At=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],jt={key:2},Mt=[`transform`,`font-size`,`font-weight`,`fill`],Nt=[`cx`,`cy`,`r`,`onMouseenter`,`onMouseleave`,`onClick`],Pt={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Ft={key:5,class:`vue-data-ui-watermark`},It=[`id`],Lt=[`onClick`],Rt={style:{display:`flex`,"align-items":`center`}},zt=/*#__PURE__*/ He({__name:`vue-ui-history-plot`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:He,emit:et}){let zt=m(()=>import(`./Tooltip-CL3U31cL.js`)),Bt=m(()=>import(`./BaseIcon-CQFjKDhE.js`).then(e=>e.n)),Vt=m(()=>import(`./vue-ui-accordion-B8LYfVG9.js`).then(e=>e.n)),Ht=m(()=>import(`./DataTable-BHW5xD9B.js`)),Ut=m(()=>import(`./PenAndPaper-B2UOwiJM.js`).then(e=>e.t)),Wt=m(()=>import(`./UserOptions-B97cPcKc.js`).then(e=>e.n)),Gt=m(()=>import(`./PackageVersion-B-1JX0wI.js`).then(e=>e.t)),Kt=m(()=>import(`./BaseDraggableDialog-MyWIeEtr.js`).then(e=>e.n)),{vue_ui_history_plot:qt}=De(),D=e,O=b(null),Jt=b(null),Yt=b(null),Xt=b(0),Zt=$e(null),Qt=b(null),k=b(pe()),$t=b(!1),en=b(``),A=b([]),tn=b(!1),j=b(null),M=b(!1),nn=b(null),rn=b(!1),an=b(null),on=b(null),sn=b(null),cn=b(null),ln=b(null),un=b(null),N=b(null),P=b(null),dn=b({x:0,y:0}),fn=b(`pointer`),pn=b(!1),mn=l(()=>Array.from(D.dataset,e=>{let t=e&&typeof e==`object`?Object.keys(e):[],n=[`name`,`values`].filter(e=>!t.includes(e)),r=Array.isArray(e?.values),i=r?Array.from(e.values,e=>({x:Number.isFinite(e?.x),y:Number.isFinite(e?.y)})):[];return{missing:n,array:r,points:i,valid:!n.length&&r&&i.every(e=>e.x&&e.y)}})),hn=l(()=>D.dataset.length>0&&mn.value.every(e=>e.valid)),gn=et,_n=b(!1),F=null,vn=!1,yn=$e(null);function bn(){Zt.value?.disconnect(),Zt.value=null,F!==null&&cancelAnimationFrame(F),F=null}function xn(){if(bn(),yn.value=null,_n.value=!1,!L.value.responsive||!O.value?.parentNode)return;let e=new ResizeObserver(t);function t(){vn||Zt.value!==e||(F!==null&&cancelAnimationFrame(F),F=requestAnimationFrame(()=>{if(vn||Zt.value!==e)return;F=null;let{width:t,height:n}=Ae({chart:O.value,title:H.value.title.text?Jt.value:null,noTitle:Qt.value,legend:H.value.legend.show?Yt.value:null,source:nn.value});yn.value={width:Math.max(.1,t),height:Math.max(.1,n)},_n.value=!0}))}Zt.value=e,e.observe(O.value.parentNode);for(let t of[Jt.value,Yt.value,nn.value,Qt.value])t&&e.observe(t);t()}Xe(()=>{rn.value=!0,xn()}),Ye(()=>{vn=!0,bn()});function Sn(){return ne(D.config,qt,Ie)}let Cn=l(()=>Ze(Sn())),I=l(()=>!!D.config.loading||!hn.value),wn=l(()=>_e({defaultConfig:{userOptions:{show:!1},table:{show:!1},style:{chart:{backgroundColor:`#99999930`,axes:{x:{scaleMin:0,scaleMax:10,labels:{show:!1},name:{text:``}},y:{scaleMin:0,scaleMax:10,labels:{show:!1},name:{text:``}}},grid:{xAxis:{stroke:`#6A6A6A`},horizontalLines:{stroke:`#6A6A6A50`},yAxis:{stroke:`#6A6A6A`},verticalLines:{stroke:`#6A6A6A50`}},legend:{backgroundColor:`transparent`},paths:{useSerieColor:!1,stroke:`#6A6A6A`},plots:{stroke:`#6A6A6A`,indexLabels:{show:!1},labels:{show:!1}}}}},userConfig:Cn.value.skeletonConfig??{}})),L=l(()=>I.value?Ze(_e({defaultConfig:Cn.value,userConfig:wn.value})):Cn.value),Tn=l(()=>I.value?D.config.skeletonDataset??[{name:``,color:`#CACACA`,values:[{label:``,x:1,y:9},{label:``,x:4,y:1},{label:``,x:7,y:9},{label:``,x:9,y:4}]}]:D.dataset),R=l(()=>Cn.value.debug),z=l(()=>L.value.style.chart.plots),B=l(()=>L.value.style.chart.grid),V=l(()=>L.value.style.chart.axes),H=l(()=>L.value.style.chart);Te({config:()=>L.value,dataset:()=>D.dataset,component:`VueUiHistoryPlot`,rules:[Ee.emptyArray,{test:e=>e.length>6,message:[`👀 The number of series is > 6. Consider:`,``,`▶️ Using filters to let users choose a maximum number of series to display.`]}]});let{transitionEnabled:U}=Me({config:()=>L.value.transitions,dataset:()=>D.dataset}),En=l(()=>L.value.userOptions.useCursorPointer),Dn=b(!L.value.userOptions.showOnChartHover),On=l(()=>L.value.userOptions.keepStateOnChartLeave);function kn(e=!1){L.value.userOptions.showOnChartHover&&(Dn.value=e)}T(()=>L.value.userOptions.showOnChartHover,e=>{Dn.value=!e});let{svgRef:W}=Ne({config:H.value.title});T([mn,R],()=>{D.dataset.length||he({componentName:`VueUiHistoryPlot`,type:`dataset`,debug:R.value}),mn.value.forEach((e,t)=>{e.missing.forEach(e=>he({componentName:`VueUiHistoryPlot`,type:`datasetSerieAttribute`,property:e,index:t,debug:R.value})),R.value&&(!e.missing.includes(`values`)&&!e.array&&console.warn(`VueUiHistoryPlot: dataset[${t}].values must be an array.`),e.points.forEach((e,n)=>{for(let r of[`x`,`y`])e[r]||console.warn(`VueUiHistoryPlot: dataset[${t}].values[${n}].${r} must be a finite number.`)}))})},{immediate:!0}),T([()=>L.value.responsive,()=>H.value.title.text,()=>H.value.legend.show,()=>H.value.legend.position,Jt,Yt,nn,Qt],xn,{flush:`post`});let{isPrinting:An,isImaging:jn,generatePdf:Mn,generateImage:Nn}=ke({elementId:`history_plot_${k.value}`,fileName:H.value.title.text||`vue-ui-history-plot`,options:L.value.userOptions.print}),Pn=l(()=>L.value.userOptions.show&&!H.value.title.text),Fn=l(()=>we(L.value.customPalette)),G=b({showTable:L.value.table.show,showTooltip:H.value.tooltip.show});T(()=>L.value.table.show,e=>{G.value.showTable=e}),T(()=>H.value.tooltip.show,e=>{G.value.showTooltip=e});let K=l(()=>yn.value||{width:H.value.width,height:H.value.height}),In=l(()=>K.value.width),Ln=l(()=>K.value.height),{metrics:Rn,ready:zn,settling:q,update:Bn}=Oe({svgRef:W,canMeasure:()=>!L.value.responsive||_n.value,initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(un.value).textWidth,yAxisLabelWidth:e(cn.value).rotatedWidth,xAxisLabelHeight:e(sn.value).height,timeLabelsHeight:e(ln.value).height})});function Vn(){let e=Rn.value.scaleLabelsWidth,t=Rn.value.yAxisLabelWidth;return e+t+(t?24:0)}let Hn=l(()=>Rn.value.xAxisLabelHeight+Rn.value.timeLabelsHeight+(sn.value?Y.value.xAxisName/2:0)),J=l(()=>{let e=z.value.radius,t=H.value.padding.left+Vn()+V.value.y.name.offsetX,n=H.value.padding.top+e,r=K.value.width-H.value.padding.right-e-V.value.y.name.offsetX,i=K.value.height-H.value.padding.bottom-Hn.value-e-V.value.x.name.offsetY;return{left:t,top:n,right:r,bottom:i,width:r-t,height:i-n}}),Y=l(()=>{let e=(e,t)=>L.value.responsive&&L.value.responsiveProportionalSizing&&yn.value?xe({relator:Math.min(K.value.width,K.value.height),adjuster:600,source:e,threshold:t,fallback:t}):e;return{plots:e(z.value.radius,3),indexLabels:e(z.value.indexLabels.fontSize,6),labels:e(z.value.labels.fontSize,6),xAxisLabels:e(V.value.x.labels.fontSize,6),xAxisName:e(V.value.x.name.fontSize,6),yAxisLabels:e(V.value.y.labels.fontSize,6),yAxisName:e(V.value.y.name.fontSize,6)}}),Un=/* @__PURE__ */ new Map;function Wn(e){return Un.has(e)||Un.set(e,pe()),Un.get(e)}let Gn=/* @__PURE__ */ new Map,Kn=l(()=>{let e=/* @__PURE__ */ new Set;function t(t){return e.add(t),Wn(t)}let n=/* @__PURE__ */ new Map,r=Tn.value.map((e,r)=>{let i=e?.id==null?e?.name==null?`index:${r}`:`name:${e.name}`:`id:${typeof e.id}:${e.id}`,a=n.get(i)||0;return n.set(i,a+1),t(`${I.value?`skeleton`:`data`}:${i}:${a}`)}),i=Tn.value.map((e,n)=>{let i=/* @__PURE__ */ new Map;return(Array.isArray(e?.values)?e.values:[]).map((e,a)=>{let o=e?.id==null?e?.label?`label:${e.label}`:`index:${a}`:`id:${typeof e.id}:${e.id}`,s=i.get(o)||0;return i.set(o,s+1),t(`${r[n]}:${o}:${s}`)})});for(let t of Gn.get(I.value)||[])e.has(t)||Un.delete(t);return Gn.set(I.value,e),{series:r,plots:i}}),qn=l(()=>Kn.value.series),Jn=l(()=>Kn.value.plots),X=l(()=>qn.value.flatMap((e,t)=>A.value.includes(e)?[t]:[])),Yn=l(()=>Tn.value.map((e,t)=>{let n=Array.isArray(e.temperatureColors)&&e.temperatureColors.length?e.temperatureColors.map(e=>de(e)):void 0;return{...e,color:e.color?de(e.color):Fn.value[t]||ce[t]||ce[t%ce.length],temperatureColors:n,temperatureAngle:Xn(e.temperatureAngle),temperatureIndependant:e.temperatureIndependant===!0,usePlotTemperatureColors:e.usePlotTemperatureColors!==!1,seriesIndex:t}}));function Xn(e=0){let t=Number(e);return Number.isFinite(t)?(t%360+360)%360:0}let Zn=l(()=>Yn.value.filter(e=>!X.value.includes(e.seriesIndex))),Qn=l(()=>{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(let i of Zn.value)for(let a of i.values)e=Math.min(e,a.x),t=Math.max(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.y);return{minX:Math.min(0,Number.isFinite(e)?e:0),maxX:Number.isFinite(t)?t:1,minY:Math.min(0,Number.isFinite(n)?n:0),maxY:Number.isFinite(r)?r:1}});function $n(e,t,n){let r=Number.isFinite(e.scaleMin)?e.scaleMin:t,i=Number.isFinite(e.scaleMax)?e.scaleMax:n,a=Math.min(r,i),o=Math.max(r,i);return me(a===o?a-(a?Math.abs(a)*.1:0):a,a===o?o+(o?Math.abs(o)*.1:1):o,Math.max(2,e.ticks||2))}let Z=l(()=>{let e=$n(V.value.x,Qn.value.minX,Qn.value.maxX),t=$n(V.value.y,Qn.value.minY,Qn.value.maxY);return{x:e,y:t,tickX:e.ticks.map(t=>({x:J.value.left+(t-e.min)/(e.max-e.min)*J.value.width,y1:J.value.top,y2:J.value.bottom,value:t})),tickY:t.ticks.map(e=>({y:J.value.bottom-(e-t.min)/(t.max-t.min)*J.value.height,x1:J.value.left,x2:J.value.right,value:e}))}});function er(e){let t=Z.value.x.min<0?Math.abs(Z.value.x.min):Z.value.x.min>0?-Z.value.x.min:0;return J.value.left+((e||0)+t)/(Z.value.x.max+t)*J.value.width}function tr(e){let t=Z.value.y.min<0?Math.abs(Z.value.y.min):Z.value.y.min>0?-Z.value.y.min:0;return J.value.bottom-((e||0)+t)/(Z.value.y.max+t)*J.value.height}let Q=l(()=>Zn.value.map((e,t)=>{let n=e.values.map((t,n)=>({valueX:t.x,valueY:t.y,label:t.label,x:er(t.x),y:tr(t.y),color:e.color,seriesName:e.name,id:Jn.value[e.seriesIndex][n]})),r=e.smooth?fe(n):n.map(e=>`${e.x},${e.y} `).join(``).trim();return{...e,gradientIndex:t,plots:n,path:n.length?`M${r}`:``}})),nr=l(()=>{if(j.value===null||N.value===null)return Q.value;let e=Q.value.findIndex(e=>e.seriesIndex===N.value);if(e===-1)return Q.value;let t=Q.value[e];return[...Q.value.slice(0,e),...Q.value.slice(e+1),t]}),rr=l(()=>Q.value.some(e=>ir(e)));function ir(e){return Array.isArray(e?.temperatureColors)&&e.temperatureColors.length}function ar(e){return ir(e)&&e.usePlotTemperatureColors}function or(e){let t=Array.isArray(e?.plots)?e.plots:[];if(!t.length)return{minX:0,maxX:0,minY:0,maxY:0,width:0,height:0};let n=1/0,r=-1/0,i=1/0,a=-1/0;for(let e of t)n=Math.min(n,e.x),r=Math.max(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.y);return{minX:n,maxX:r,minY:i,maxY:a,width:r-n,height:a-i}}function sr(){let e=J.value;return{minX:e.left,maxX:e.right,minY:e.top,maxY:e.bottom,width:e.width,height:e.height}}function cr(e){return e?.temperatureIndependant?or(e):sr()}function lr(e){let t=Xn(e?.temperatureAngle)*Math.PI/180,n=Math.sin(t),r=Math.cos(t),i=cr(e),a=i.minX+i.width/2,o=i.minY+i.height/2,s=(Math.abs(n)*i.width+Math.abs(r)*i.height)/2||1;return{x1:a-n*s,y1:o-r*s,x2:a+n*s,y2:o+r*s}}let ur=l(()=>{let e=/* @__PURE__ */ new Map;for(let t of Q.value){if(!ir(t))continue;let n=lr(t),{x1:r,y1:i,x2:a,y2:o}=n,s=a-r,ee=o-i,te=s*s+ee*ee,ne=/* @__PURE__ */ new Map;if(ar(t))for(let e of t.plots){let n=te?Math.min(1,Math.max(0,((e.x-r)*s+(e.y-i)*ee)/te)):0;ne.set(e.id,oe({colors:t.temperatureColors,ratio:n}))}e.set(t.seriesIndex,{coordinates:n,colors:ne})}return e});function dr(e){return ur.value.get(e.seriesIndex)?.coordinates}function fr(e,t){return ur.value.get(e.seriesIndex)?.colors.get(t.id)??e.color}function pr(e,t){return`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${k.value}`}function mr(e,t,n){return ar(e)?z.value.gradient.show?`url(#${pr(e,t)})`:fr(e,t):z.value.gradient.show?`url(#gradient_${n}_${k.value})`:t.color}function hr(e,t){return ar(e)?fr(e,t):e.color}function gr(e,t){return z.value.indexLabels.adaptColorToBackground?be(hr(e,t)):z.value.indexLabels.color}function _r(e,t){let n=Q.value.find(t=>t.seriesIndex===e);return n&&ar(n)?fr(n,t):t.color}function vr(e){return ir(e)?`url(#temperature_grad_history_${e.seriesIndex}_${k.value})`:H.value.paths.useSerieColor?e.color:H.value.paths.stroke}function yr(e){return j.value===null||N.value===e?1:Math.min(1,z.value.unselectedOpacity)}function br(){X.value.length?A.value=[]:Dr.value.forEach(e=>{A.value.push(qn.value[e.seriesIndex])}),gn(`selectLegend`,Q.value)}function xr(e){X.value.includes(e)?A.value=A.value.filter(t=>t!==qn.value[e]):A.value.push(qn.value[e]),gn(`selectLegend`,Q.value)}function Sr(e){return Yn.value.length?Yn.value.find(t=>t.name===e)||(R.value&&console.warn(`VueUiHistoryPlot - Series name not found "${e}"`),null):(R.value&&console.warn(`VueUiHistoryPlot - There are no series to show.`),null)}function Cr(e){let t=Sr(e);t!==null&&X.value.includes(t.seriesIndex)&&xr(t.seriesIndex)}function wr(e){let t=Sr(e);t!==null&&(X.value.includes(t.seriesIndex)||xr(t.seriesIndex))}T(qn,e=>{I.value||(A.value=A.value.filter(t=>e.includes(t)))});let $=l(()=>Q.value.filter(e=>e.plots.length)),Tr=l(()=>{let e=/* @__PURE__ */ new Map;for(let t of Q.value)t.plots.forEach((n,r)=>e.set(n.id,{serie:t,plot:n,plotIndex:r}));return e}),Er=b(null),Dr=l(()=>Yn.value.map(e=>{let t=ir(e)?e.temperatureColors:null;return{...e,gradientColors:t,opacity:X.value.includes(e.seriesIndex)?.5:1,segregate:()=>xr(e.seriesIndex),isSegregated:X.value.includes(e.seriesIndex),shape:t?`gradient`:`circle`}})),Or=l(()=>({cy:`history-plot-div-legend`,backgroundColor:H.value.legend.backgroundColor,color:H.value.legend.color,fontSize:H.value.legend.fontSize,paddingBottom:12,fontWeight:H.value.legend.bold?`bold`:``}));function kr({datapoint:e,plotIndex:t,seriesIndex:n}){I.value||(L.value.events.datapointClick&&L.value.events.datapointClick({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),gn(`selectDatapoint`,e))}function Ar(e){tn.value=e,Xt.value+=1}let jr=b(null);function Mr({datapoint:e,plotIndex:t,seriesIndex:n}){L.value.events.datapointLeave&&L.value.events.datapointLeave({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),(fn.value!==`keyboard`||N.value!==n||P.value!==t)&&ii()}function Nr(e,t){if(vn||!W.value)return;let n=Q.value.find(t=>t.seriesIndex===e);if(!n)return;let r=n.plots[t];if(!r)return;let i=Ce(r.x,r.y,W.value);i&&(dn.value=i)}function Pr({datapoint:e,plotIndex:t,seriesIndex:n,triggerMode:r=`pointer`}){I.value||(L.value.events.datapointEnter&&L.value.events.datapointEnter({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),Er.value=e.id,N.value=n,P.value=t,fn.value=r,j.value=e,Fr({datapoint:e,plotIndex:t,seriesIndex:n}),$t.value=!0,r===`keyboard`&&Je(()=>{Er.value===e.id&&Nr(n,t)}))}function Fr({datapoint:e,plotIndex:t,seriesIndex:n}){let r=_r(n,e),i={...e,color:r};jr.value={datapoint:i,color:r,seriesIndex:n,plotIndex:t,config:L.value,series:Yn.value},j.value=e;let a=H.value.tooltip.customFormat;if(M.value=!1,ae(a))try{let e=a({seriesIndex:n,datapoint:i,color:r,plotIndex:t,series:Yn.value,config:L.value});typeof e==`string`&&(en.value=e,M.value=!0)}catch{console.warn(`Custom format cannot be applied.`),M.value=!1}if(!M.value){let t=``;t+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;border-bottom:1px solid ${H.value.tooltip.borderColor};margin-bottom:3px;padding-bottom:6px;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${r}"/></svg><span>${e.seriesName}</span></div>`,t+=`<div>${e.label}</div>`,t+=`<div>${V.value.x.name.text||`x`}: ${ge(V.value.x.labels.formatter,e.valueX,re({p:V.value.x.labels.prefix,v:e.valueX,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding}))}</div>`,t+=`<div>${V.value.y.name.text||`y`}: ${ge(V.value.y.labels.formatter,e.valueY,re({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))}</div>`,en.value=`<div>${t}</div>`}}T([Q,()=>H.value.tooltip,I],()=>{if(!Er.value)return;let e=Tr.value.get(Er.value);if(!e||I.value){ii();return}let{plot:t,serie:n,plotIndex:r}=e;j.value=t,N.value=n.seriesIndex,P.value=r,Fr({datapoint:t,seriesIndex:n.seriesIndex,plotIndex:r}),fn.value===`keyboard`&&Nr(n.seriesIndex,r)},{flush:`post`});let Ir=l(()=>{let e=[L.value.table.columnNames.series,L.value.table.columnNames.datapoint,L.value.table.columnNames.x,L.value.table.columnNames.y];return{head:e,body:Q.value.flatMap(e=>e.plots.map(e=>[{color:e.color,name:e.seriesName},e.label,ge(V.value.x.labels.formatter,e.valueX,re({p:V.value.x.labels.prefix,v:e.valueX,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding})),ge(V.value.y.labels.formatter,e.valueY,re({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))])),config:{th:{backgroundColor:L.value.table.th.backgroundColor,color:L.value.table.th.color,outline:L.value.table.th.outline},td:{backgroundColor:L.value.table.td.backgroundColor,color:L.value.table.td.color,outline:L.value.table.td.outline},breakpoint:L.value.table.responsiveBreakpoint},colNames:e}});function Lr(e=null){Je(()=>{let t=[[L.value.table.columnNames.series],[L.value.table.columnNames.datapoint],[L.value.table.columnNames.x],[L.value.table.columnNames.y]],n=Q.value.flatMap(e=>e.plots.map(e=>[[e.seriesName],[e.label],[e.valueX],[e.valueY]])),r=[[H.value.title.text],[H.value.title.subtitle.text],t].concat(n),i=ie(r);e?e(i):ve({csvContent:i,title:H.value.title.text||`vue-ui-history-plot`})})}let Rr=b(!1);function zr(){Rr.value=!Rr.value}function Br(){G.value.showTable=!G.value.showTable}function Vr(){G.value.showTooltip=!G.value.showTooltip}function Hr(){return Q.value}let Ur=te(O,()=>H.value.title.text),Wr=l(()=>Z.value.tickX),Gr=l(()=>({start:0,end:Z.value.tickX.length}));Pe({timeLabelsEls:ln,timeLabels:Wr,slicer:Gr,configRef:L,rotationPath:[`style`,`chart`,`axes`,`x`,`labels`,`rotation`],autoRotatePath:[`style`,`chart`,`axes`,`x`,`labels`,`autoRotate`,`enable`],isAutoSize:!1,width:In,height:Ln,targetClass:`.vue-ui-history-plot-x-axis-scale`,rotation:V.value.x.labels.autoRotate.angle});let Kr=l(()=>ee({config:L,style:H,mutableConfig:G,dialog:Kt,accordion:Vt,isFullscreen:tn,parent:O,maxWidth:800}));T([()=>G.value.showTable,an],([e])=>{an.value&&s(e,L,an)},{flush:`post`});function qr(){G.value.showTable=!1,on.value&&on.value.setTableIconState(!1)}let Jr=l(()=>H.value.backgroundColor),Yr=l(()=>H.value.legend),Xr=l(()=>H.value.title),{isCallbackImaging:Zr,isCallbackSvg:Qr,generateSvg:$r,onGenerateImage:ei}=je({svg:W,title:Xr,legend:Yr,legendItems:Dr,backgroundColor:Jr,getSvgCallback:()=>L.value.userOptions.callbacks.svg,generateImage:Nn});async function ti(){gn(`copyAlt`,{config:L.value,dataset:Q.value}),L.value.userOptions.callbacks.altCopy?await Promise.resolve(L.value.userOptions.callbacks.altCopy({config:L.value,dataset:Q.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let ni=l(()=>({head:Ir.value.head,body:Ir.value.body.map(e=>[e[0]?.name||``,e[1],e[2],e[3]]),caption:L.value.a11y.translations.tableCaption,notice:L.value.a11y.translations.tableAvailable}));function ri(e){return $.value.findIndex(t=>t.seriesIndex===e)}function ii(e=!1){e&&j.value&&L.value.events.datapointLeave&&L.value.events.datapointLeave({datapoint:{...j.value,plotIndex:P.value,seriesIndex:N.value},seriesIndex:N.value}),Er.value=null,N.value=null,P.value=null,fn.value=`pointer`,$t.value=!1,j.value=null,jr.value=null,en.value=``,M.value=!1}function ai(){ii(!0)}function oi(){ii(),pn.value=!0}function si(){ai(),pn.value=!1}function ci(e,t){if(!e?.plots?.length)return null;let n=e.plots.length;return(t%n+n)%n}function li({seriesIndex:e,plotIndex:t,direction:n}){if(!$.value.length)return null;let r=ri(e);if(r===-1)return null;if(n===`up`||n===`down`){let e=$.value[r];if(!e?.plots?.length)return null;let i=ci(e,t+(n===`up`?-1:1));return{seriesIndex:e.seriesIndex,plotIndex:i}}if(n===`left`||n===`right`){let e=((r+(n===`left`?-1:1))%$.value.length+$.value.length)%$.value.length,i=$.value[e];if(!i?.plots?.length)return null;let a=Math.min(t,i.plots.length-1);return{seriesIndex:i.seriesIndex,plotIndex:a}}return null}function ui(e){if(!W.value||Rr.value||I.value||document.activeElement!==W.value||!$.value.length)return;let t=e.key===`ArrowLeft`,n=e.key===`ArrowRight`,r=e.key===`ArrowUp`,i=e.key===`ArrowDown`,a=e.key===`Enter`||e.key===` `,o=e.key===`Escape`;if(!t&&!n&&!r&&!i&&!a&&!o)return;if(e.preventDefault(),e.stopPropagation(),o){ai();return}if(a){if(N.value===null||P.value===null)return;let e=$.value.find(e=>e.seriesIndex===N.value)?.plots?.[P.value];if(!e)return;kr({datapoint:e,plotIndex:P.value,seriesIndex:N.value});return}let s=null;if(N.value===null||P.value===null){let e=$.value[0];if(!e?.plots?.length)return;s={seriesIndex:e.seriesIndex,plotIndex:0}}else r?s=li({seriesIndex:N.value,plotIndex:P.value,direction:`up`}):i?s=li({seriesIndex:N.value,plotIndex:P.value,direction:`down`}):t?s=li({seriesIndex:N.value,plotIndex:P.value,direction:`left`}):n&&(s=li({seriesIndex:N.value,plotIndex:P.value,direction:`right`}));if(!s)return;let ee=$.value.find(e=>e.seriesIndex===s.seriesIndex)?.plots?.[s.plotIndex];ee&&Pr({datapoint:ee,plotIndex:s.plotIndex,seriesIndex:s.seriesIndex,triggerMode:`keyboard`})}return He({getData:Hr,getImage:Ur,generatePdf:Mn,generateCsv:Lr,generateImage:Nn,generateSvg:$r,hideSeries:wr,showSeries:Cr,toggleTable:Br,toggleTooltip:Vr,toggleAnnotator:zr,toggleFullscreen:Ar,copyAlt:ti}),T(()=>[K.value,Y.value,V.value,H.value,L.value.style.fontFamily,D.dataset,_n.value,un.value,ln.value,sn.value,cn.value],Bn,{flush:`post`,deep:!0}),(e,s)=>(y(),f(`div`,{id:`history_plot_${k.value}`,ref_key:`historyPlotChart`,ref:O,class:g({"vue-data-ui-component":!0,"vue-ui-history-plot":!0,"vue-data-ui-wrapper-fullscreen":tn.value}),style:v(`background:${H.value.backgroundColor};color:${H.value.color};font-family:${L.value.style.fontFamily}; position: relative; ${L.value.responsive?`height: 100%`:``}`),onMouseenter:s[2]||=()=>kn(!0),onMouseleave:s[3]||=()=>kn(!1)},[p(`div`,{id:`chart-instructions-${k.value}`,class:`sr-only`},[p(`p`,null,C(L.value.a11y.translations.keyboardNavigation),1)],8,nt),L.value.a11y.includeTable&&ni.value.body.length?(y(),u(ze,{key:0,uid:k.value,head:ni.value.head,body:ni.value.body,caption:ni.value.caption,notice:ni.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):d(``,!0),S(e.$slots,`userConfig`,{},void 0,!0),L.value.userOptions.buttons.annotator?(y(),u(w(Ut),qe({key:1},w(a)(L.value.userOptions.annotator),{svgRef:w(W),backgroundColor:H.value.backgroundColor,color:H.value.color,active:Rr.value,isCursorPointer:En.value,palette:L.value.userOptions.annotatorPalette,onClose:zr}),We({_:2},[x(w(o),t=>({name:t,fn:E(n=>[S(e.$slots,t,_(h(w(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):d(``,!0),Pn.value?(y(),f(`div`,{key:2,ref_key:`noTitle`,ref:Qt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):d(``,!0),H.value.title.text?(y(),f(`div`,{key:3,ref_key:`chartTitle`,ref:Jt,class:`vue-ui-xy-title`,style:v(`font-family:${L.value.style.fontFamily}`)},[Ke(Fe,{config:{title:{cy:`history-plot-div-title`,...H.value.title},subtitle:{cy:`history-plot-div-subtitle`,...H.value.title.subtitle}}},null,8,[`config`])],4)):d(``,!0),p(`div`,{id:`legend-top-${k.value}`},null,8,rt),L.value.userOptions.show&&hn.value&&(On.value||Dn.value)?(y(),u(w(Wt),qe({ref_key:`userOptionsRef`,ref:on,key:`user_option_${Xt.value}`,backgroundColor:H.value.backgroundColor,color:H.value.color,isPrinting:w(An),isImaging:w(jn),uid:k.value,hasTooltip:H.value.tooltip.show&&L.value.userOptions.buttons.tooltip,hasLabel:!1,isFullscreen:tn.value,chartElement:O.value},w(n)(L.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isTooltip:G.value.showTooltip,isAnnotation:Rr.value,tableDialog:L.value.table.useDialog,isCursorPointer:En.value,onToggleFullscreen:Ar,onGeneratePdf:w(Mn),onGenerateCsv:Lr,onGenerateImage:w(ei),onGenerateSvg:w($r),onToggleTable:Br,onToggleTooltip:Vr,onToggleAnnotator:zr,onCopyAlt:ti,style:{visibility:On.value?Dn.value?`visible`:`hidden`:`visible`}}),We({_:2},[x(w(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:E(n=>[S(e.$slots,t,_(h(w(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasTooltip`,`isFullscreen`,`chartElement`,`isTooltip`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):d(``,!0),p(`div`,it,[(y(),f(`svg`,{ref_key:`svgRef`,ref:W,xmlns:w(Se),viewBox:`0 0 ${K.value.width<0?.1:K.value.width} ${K.value.height<0?.1:K.value.height}`,style:v(`max-width:100%;overflow:visible;background:transparent;color:${H.value.color};visibility:${w(zn)?`visible`:`hidden`}`),"aria-describedby":`chart-instructions-${k.value}`,tabindex:`0`,onFocus:oi,onBlur:si,onKeydown:ui},[Ke(w(Gt)),S(e.$slots,`svg-underlayer`,{svg:{...K.value,drawingArea:J.value,isPrintingImg:w(An)||w(jn)||w(Zr),isPrintingSvg:w(Qr)}},void 0,!0),e.$slots[`chart-background`]?(y(),f(`foreignObject`,{key:0,x:J.value.left,y:J.value.top,width:J.value.width<=0?10:J.value.width,height:J.value.height<=0?10:J.value.height,style:{pointerEvents:`none`}},[S(e.$slots,`chart-background`,{},void 0,!0)],8,ot)):d(``,!0),z.value.gradient.show||rr.value?(y(),f(`defs`,st,[z.value.gradient.show?(y(!0),f(c,{key:0},x(Q.value,(e,t)=>(y(),u(Ve,{t:`radial`,key:`gradient_${t}_${k.value}`,id:`gradient_${t}_${k.value}`,fy:`30%`,stops:[[`10%`,w(se)(e.color,z.value.gradient.intensity/100),1],[`90%`,w(ue)(e.color,.1),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128)):d(``,!0),(y(!0),f(c,null,x(Q.value,e=>(y(),f(c,{key:`temperature_grad_history_template_${e.seriesIndex}_${k.value}`},[z.value.gradient.show&&ar(e)?(y(!0),f(c,{key:0},x(e.plots,t=>(y(),u(Ve,{t:`radial`,key:`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${k.value}`,id:pr(e,t),fy:`30%`,stops:[[`10%`,w(se)(fr(e,t),z.value.gradient.intensity/100),1],[`90%`,w(ue)(fr(e,t),.1),1],[`100%`,fr(e,t),1]]},null,8,[`id`,`stops`]))),128)):d(``,!0),ir(e)?(y(),f(`linearGradient`,{key:1,id:`temperature_grad_history_${e.seriesIndex}_${k.value}`,gradientUnits:`userSpaceOnUse`,x1:dr(e).x1,y1:dr(e).y1,x2:dr(e).x2,y2:dr(e).y2},[(y(!0),f(c,null,x(e.temperatureColors,(t,n)=>(y(),f(`stop`,{key:`temperature_grad_history_stop_${e.seriesIndex}_${n}_${k.value}`,"stop-color":t,offset:e.temperatureColors.length===1?`0%`:w(ye)(n,e.temperatureColors.length)},null,8,lt))),128))],8,ct)):d(``,!0)],64))),128))])):d(``,!0),B.value.verticalLines.show?(y(),f(`g`,ut,[(y(!0),f(c,null,x(Z.value.tickX,e=>(y(),f(`line`,{x1:e.x,x2:e.x,y1:e.y1,y2:e.y2,stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`},null,8,dt))),256))])):d(``,!0),V.value.y.labels.show?(y(),f(`g`,ft,[(y(!0),f(c,null,x(Z.value.tickY,e=>(y(),f(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:J.value.left-5,x2:J.value.left,y1:e.y,y2:e.y},null,8,pt))),256))])):d(``,!0),V.value.y.labels.show?(y(),f(`g`,{key:4,ref_key:`yAxisScales`,ref:un},[(y(!0),f(c,null,x(Z.value.tickY,e=>(y(),f(`text`,{x:J.value.left+V.value.y.labels.offsetX-4-z.value.radius,y:e.y+Y.value.yAxisLabels/3,fill:V.value.y.labels.color,"font-size":Y.value.yAxisLabels,"text-anchor":`end`},C(w(ge)(V.value.y.labels.formatter,e.value,w(re)({p:V.value.y.labels.prefix,v:e.value,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))),9,mt))),256))],512)):d(``,!0),V.value.y.name.text?(y(),f(`text`,{key:5,ref_key:`yAxisLabel`,ref:cn,transform:`translate(${Y.value.yAxisName}, ${K.value.height/2+V.value.y.name.offsetY}), rotate(-90)`,"font-size":Y.value.yAxisName,fill:V.value.y.name.color,"font-weight":V.value.y.name.bold?`bold`:`normal`,"text-anchor":`middle`},C(V.value.y.name.text),9,ht)):d(``,!0),B.value.horizontalLines.show?(y(),f(`g`,gt,[(y(!0),f(c,null,x(Z.value.tickY,e=>(y(),f(`line`,{x1:e.x1,x2:e.x2,y1:e.y,y2:e.y,stroke:B.value.horizontalLines.stroke,"stroke-width":B.value.horizontalLines.strokeWidth,"stroke-linecap":`round`},null,8,_t))),256))])):d(``,!0),V.value.x.labels.show?(y(),f(`g`,vt,[(y(!0),f(c,null,x(Z.value.tickX,e=>(y(),f(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:e.x,x2:e.x,y1:J.value.bottom,y2:J.value.bottom+5},null,8,yt))),256))])):d(``,!0),V.value.x.labels.show?(y(),f(`g`,{key:8,ref_key:`xAxisScales`,ref:ln},[(y(!0),f(c,null,x(Z.value.tickX,e=>(y(),f(`text`,{class:`vue-ui-history-plot-x-axis-scale`,transform:`translate(${e.x}, ${J.value.bottom+V.value.x.labels.offsetY+Y.value.xAxisLabels+z.value.radius}), rotate(${V.value.x.labels.rotation})`,fill:V.value.x.labels.color,"font-size":Y.value.xAxisLabels,"text-anchor":V.value.x.labels.rotation>0?`start`:V.value.x.labels.rotation<0?`end`:`middle`},C(w(ge)(V.value.x.labels.formatter,e.value,w(re)({p:V.value.x.labels.prefix,v:e.value,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding}))),9,bt))),256))],512)):d(``,!0),V.value.x.name.text?(y(),f(`text`,{key:9,ref_key:`xAxisLabel`,ref:sn,x:K.value.width/2+V.value.x.name.offsetX,y:K.value.height,"font-size":Y.value.xAxisName,fill:V.value.x.name.color,"font-weight":V.value.x.name.bold?`bold`:`normal`,"text-anchor":`middle`},C(V.value.x.name.text),9,xt)):d(``,!0),B.value.xAxis.show?(y(),f(`line`,{key:10,x1:J.value.left,x2:J.value.left+J.value.width,y1:J.value.bottom,y2:J.value.bottom,stroke:B.value.xAxis.stroke,"stroke-width":B.value.xAxis.strokeWidth,"stroke-linecap":`round`},null,8,St)):d(``,!0),B.value.yAxis.show?(y(),f(`line`,{key:11,x1:J.value.left,x2:J.value.left,y1:J.value.top,y2:J.value.bottom,stroke:B.value.yAxis.stroke,"stroke-width":B.value.yAxis.strokeWidth,"stroke-linecap":`round`},null,8,Ct)):d(``,!0),(y(!0),f(c,null,x(nr.value,e=>(y(),f(`g`,{key:`history_plot_serie_${e.seriesIndex}_${k.value}`},[H.value.paths.show?(y(),f(`g`,{key:0,style:v({opacity:yr(e.seriesIndex)})},[p(`path`,{class:g({"vue-data-ui-transition":w(U)&&!w(q)}),d:e.path,stroke:H.value.backgroundColor,"stroke-width":H.value.paths.strokeWidth+4,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,wt),p(`path`,{class:g({"vue-data-ui-transition":w(U)&&!w(q)}),d:e.path,stroke:vr(e),"stroke-width":H.value.paths.strokeWidth,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,Tt)],4)):d(``,!0),(y(!0),f(c,null,x(e.plots,e=>(y(),f(`circle`,{cx:e.x,cy:e.y,fill:H.value.backgroundColor,r:Y.value.plots,stroke:`none`,class:g({"vue-data-ui-transition":w(U)&&!w(q)})},null,10,Et))),256)),(y(!0),f(c,null,x(e.plots,t=>(y(),f(`circle`,{cx:t.x,cy:t.y,fill:mr(e,t,e.gradientIndex),r:Y.value.plots,stroke:z.value.stroke,"stroke-width":z.value.strokeWidth,class:g({"vue-data-ui-transition":w(U)&&!w(q)}),style:v({opacity:yr(e.seriesIndex)})},null,14,Dt))),256)),z.value.labels.show?(y(),f(`g`,Ot,[(y(!0),f(c,null,x(e.plots,(t,n)=>(y(),f(`g`,{key:`plab_${n}`},[String(t.label).includes(`
2
2
  `)?(y(),f(`text`,{key:1,class:g({"vue-data-ui-transition":w(U)&&!w(q)}),transform:`translate(${t.x+z.value.labels.offsetX}, ${t.y+z.value.labels.offsetY+Y.value.plots+Y.value.labels})`,"font-size":Y.value.labels,fill:z.value.labels.color,"font-weight":z.value.labels.bold?`bold`:`normal`,"text-anchor":`middle`,style:v({opacity:yr(e.seriesIndex)}),innerHTML:w(le)({content:String(t.label),fontSize:Y.value.labels,fill:z.value.labels.color,x:0,y:0})},null,14,At)):(y(),f(`text`,{key:0,class:g({"vue-data-ui-transition":w(U)&&!w(q)}),transform:`translate(${t.x+z.value.labels.offsetX}, ${t.y+z.value.labels.offsetY+Y.value.plots+Y.value.labels})`,"font-size":Y.value.labels,fill:z.value.labels.color,"font-weight":z.value.labels.bold?`bold`:`normal`,"text-anchor":`middle`,style:v({opacity:yr(e.seriesIndex)})},C(t.label),15,kt))]))),128))])):d(``,!0),z.value.indexLabels.show?(y(),f(`g`,jt,[(y(!0),f(c,null,x(e.plots,(t,n)=>(y(),f(`text`,{key:`lab_${n}`,class:g({"vue-data-ui-transition":w(U)&&!w(q)}),transform:`translate(${t.x+z.value.indexLabels.offsetX}, ${t.y+z.value.indexLabels.offsetY+Y.value.indexLabels/3})`,"font-size":Y.value.indexLabels,"font-weight":z.value.indexLabels.bold?`bold`:`normal`,fill:gr(e,t),"text-anchor":`middle`,style:v({opacity:yr(e.seriesIndex)})},C(z.value.indexLabels.startAtZero?n:n+1),15,Mt))),128))])):d(``,!0)]))),128)),(y(!0),f(c,null,x(nr.value,e=>(y(),f(`g`,{key:`history_plot_trap_serie_${e.seriesIndex}_${k.value}`},[(y(!0),f(c,null,x(e.plots,(t,n)=>(y(),f(`circle`,{cx:t.x,cy:t.y,fill:`transparent`,r:Y.value.plots,stroke:`none`,onMouseenter:r=>Pr({datapoint:t,plotIndex:n,seriesIndex:e.seriesIndex,triggerMode:`pointer`}),onMouseleave:r=>Mr({datapoint:t,plotIndex:n,seriesIndex:e.seriesIndex}),onClick:r=>kr({datapoint:t,plotIndex:n,seriesIndex:e.seriesIndex})},null,40,Nt))),256))]))),128)),S(e.$slots,`svg`,{svg:{...K.value,drawingArea:J.value,isPrintingImg:w(An)||w(jn)||w(Zr),isPrintingSvg:w(Qr)}},void 0,!0)],44,at)),e.$slots.hint?(y(),f(`div`,Pt,[S(e.$slots,`hint`,_(h({hint:L.value.a11y.translations.keyboardNavigation,isVisible:pn.value})),void 0,!0)])):d(``,!0)]),e.$slots.watermark?(y(),f(`div`,Ft,[S(e.$slots,`watermark`,_(h({isPrinting:w(An)||w(jn)||w(Zr)||w(Qr)})),void 0,!0)])):d(``,!0),p(`div`,{id:`legend-bottom-${k.value}`},null,8,It),rn.value&&(H.value.legend.show||e.$slots.legend)?(y(),u(Ue,{key:6,to:H.value.legend.position===`top`?`#legend-top-${k.value}`:`#legend-bottom-${k.value}`},[p(`div`,{ref_key:`chartLegend`,ref:Yt},[S(e.$slots,`legend`,{legend:Dr.value},()=>[H.value.legend.show&&hn.value?(y(),u(Le,{key:0,legendSet:Dr.value,config:Or.value,isCursorPointer:En.value,onClickMarker:s[0]||=({legend:e})=>{xr(e.seriesIndex)}},{item:E(({legend:e,index:t})=>[p(`div`,{onClick:t=>e.segregate(),style:v(`opacity:${X.value.includes(e.seriesIndex)?.5:1}`)},C(e.name),13,Lt)]),legendToggle:E(()=>[Dr.value.length>2&&H.value.legend.selectAllToggle.show&&!I.value?(y(),u(Be,{key:0,backgroundColor:H.value.legend.selectAllToggle.backgroundColor,color:H.value.legend.selectAllToggle.color,fontSize:H.value.legend.fontSize,checked:X.value.length>0,isCursorPointer:En.value,onToggle:br},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):d(``,!0)]),_:1},8,[`legendSet`,`config`,`isCursorPointer`])):d(``,!0)],!0)],512)],8,[`to`])):d(``,!0),e.$slots.source?(y(),f(`div`,{key:7,ref_key:`source`,ref:nn,dir:`auto`},[S(e.$slots,`source`,{},void 0,!0)],512)):d(``,!0),Ke(w(zt),{teleportTo:H.value.tooltip.teleportTo,show:G.value.showTooltip&&$t.value,backgroundColor:H.value.tooltip.backgroundColor,color:H.value.tooltip.color,fontSize:H.value.tooltip.fontSize,borderRadius:H.value.tooltip.borderRadius,borderColor:H.value.tooltip.borderColor,borderWidth:H.value.tooltip.borderWidth,backgroundOpacity:H.value.tooltip.backgroundOpacity,position:H.value.tooltip.position,offsetX:H.value.tooltip.offsetX,offsetY:H.value.tooltip.offsetY,parent:O.value,content:en.value,isCustom:M.value,isFullscreen:tn.value,smooth:H.value.tooltip.smooth,backdropFilter:H.value.tooltip.backdropFilter,smoothForce:H.value.tooltip.smoothForce,smoothSnapThreshold:H.value.tooltip.smoothSnapThreshold,isA11yMode:fn.value===`keyboard`,a11yPosition:dn.value},{"tooltip-before":E(()=>[S(e.$slots,`tooltip-before`,_(h({...jr.value})),void 0,!0)]),tooltip:E(()=>[S(e.$slots,`tooltip`,_(h({...jr.value})),void 0,!0)]),"tooltip-after":E(()=>[S(e.$slots,`tooltip-after`,_(h({...jr.value})),void 0,!0)]),_:3},8,[`teleportTo`,`show`,`backgroundColor`,`color`,`fontSize`,`borderRadius`,`borderColor`,`borderWidth`,`backgroundOpacity`,`position`,`offsetX`,`offsetY`,`parent`,`content`,`isCustom`,`isFullscreen`,`smooth`,`backdropFilter`,`smoothForce`,`smoothSnapThreshold`,`isA11yMode`,`a11yPosition`]),hn.value&&L.value.userOptions.buttons.table?(y(),u(Qe(Kr.value.component),qe({key:8},Kr.value.props,{ref_key:`tableUnit`,ref:an,onClose:qr}),We({content:E(()=>[Ke(w(Ht),{colNames:Ir.value.colNames,head:Ir.value.head,body:Ir.value.body,config:Ir.value.config,title:L.value.table.useDialog?``:Kr.value.title,withCloseButton:!L.value.table.useDialog,isCursorPointer:En.value,onClose:qr},{th:E(({th:e})=>[p(`div`,Rt,C(e),1)]),td:E(({td:e})=>[Ge(C(e.name||e),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`])]),_:2},[L.value.table.useDialog?{name:`title`,fn:E(()=>[Ge(C(Kr.value.title),1)]),key:`0`}:void 0,L.value.table.useDialog?{name:`actions`,fn:E(()=>[p(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[1]||=e=>Lr(L.value.userOptions.callbacks.csv),style:v({cursor:En.value?`pointer`:`default`})},[Ke(w(Bt),{name:`fileCsv`,stroke:Kr.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):d(``,!0),S(e.$slots,`skeleton`,{},()=>[I.value?(y(),u(Re,{key:0})):d(``,!0)],!0)],46,tt))}},[[`__scopeId`,`data-v-fa284a3f`]]);export{et as n,zt as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as c}from"./tableIntegration-CNoJ1CIY.js";import{t as ee}from"./chartImage-DPGnEuYM.js";import{$ as l,D as te,Dt as ne,Ht as u,J as re,Jt as ie,S as ae,X as oe,Yt as se,Zt as ce,at as le,b as d,i as ue,in as de,nn as fe,nt as pe,t as me,tn as he,vt as ge,w as _e,wt as ve,zt as ye}from"./lib-rPeBMZrn.js";import{c as be}from"./canvas-lib-22VpOI4_.js";import{n as xe,t as Se}from"./useHints-C-TwxM0Y.js";import{t as Ce}from"./useConfig-CXhXxWjB.js";import{t as we}from"./useLoading-DoqqfnmS.js";import{t as Te}from"./usePrinter-DVf3YcG5.js";import{t as Ee}from"./useResponsive-CENUxfEL.js";import{t as De}from"./useNestedProp-DnGoh-XS.js";import{t as Oe}from"./useThemeCheck-BKNRbGeC.js";import{t as ke}from"./useChartExport-BZts4KFb.js";import{t as Ae}from"./useTransitions-ChGGrtrv.js";import{t as je}from"./useTableResponsive-uSz_qZOB.js";import{t as Me}from"./useUserOptionState-CXlFnwPv.js";import{t as Ne}from"./useChartAccessibility-DOMuYJfm.js";import{t as Pe}from"./Shape-CRe8woTu.js";import{n as Fe}from"./Title-BliHuXfT.js";import{t as Ie}from"./vue_ui_horizontal_bar-_jcrdeQR.js";import{t as Le}from"./Legend-W9YVYVX-.js";import{t as Re}from"./vue-ui-accordion-D3uT1Ynv.js";import{t as ze}from"./BaseScanner-m6QR9rwD.js";import{t as Be}from"./BaseLegendToggle-VzX69MCo.js";import{t as Ve}from"./A11yDataTable-DWNlWXzs.js";import{t as He}from"./DefGrad-DKMq1REY.js";import{t as Ue}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as f,computed as p,createBlock as m,createCommentVNode as h,createElementBlock as g,createElementVNode as _,createSlots as We,createTextVNode as Ge,createVNode as Ke,defineAsyncComponent as qe,guardReactiveProps as v,mergeProps as y,nextTick as Je,normalizeClass as b,normalizeProps as Ye,normalizeStyle as x,onBeforeUnmount as Xe,onMounted as Ze,openBlock as S,ref as C,renderList as w,renderSlot as T,resolveDynamicComponent as Qe,toDisplayString as E,toRefs as $e,unref as D,useCssVars as et,useSlots as tt,watch as nt,withCtx as O,withKeys as rt}from"vue";var it=/* @__PURE__ */ e({default:()=>Ft}),at=[`id`],ot=[`id`],st=[`onClick`],ct={style:{position:`relative`}},lt=[`xmlns`,`viewBox`,`aria-describedby`],ut={class:`vue-data-ui-g`},dt=[`width`,`height`],ft={key:1},pt=[`y`,`width`,`height`,`fill`,`rx`],mt=[`fill`,`rx`],ht=[`fill`,`rx`,`stroke`,`stroke-width`],gt=[`fill`,`rx`,`stroke`,`stroke-width`],_t=[`stroke`,`stroke-width`,`d`],vt=[`stroke`,`stroke-width`,`d`],yt=[`y`,`height`,`width`,`fill`],bt=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],xt=[`transform`,`font-size`,`fill`,`font-weight`],St=[`transform`,`font-size`,`font-weight`,`innerHTML`],Ct=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],wt=[`transform`,`text-anchor`,`font-size`,`fill`,`font-weight`],Tt=[`y`,`width`,`height`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],Et={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Dt={key:7,class:`vue-data-ui-watermark`},Ot=[`onClick`],kt={style:`width:100%;padding-top: 36px;position:relative`},At={class:`vue-ui-data-table`},jt={key:0},Mt={style:{width:`100%`}},Nt=[`data-cell`],Pt={style:{display:`flex`,"align-items":`center`,gap:`5px`,"justify-content":`flex-end`,width:`100%`,"padding-right":`3px`}},Ft=/*#__PURE__*/ Ue({__name:`vue-ui-horizontal-bar`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`copyAlt`,`selectDatapoint`],setup(e,{expose:Ue,emit:it}){et(e=>({v4c8b2a51:e.tdo}));let Ft=qe(()=>import(`./Tooltip-B432XpvC.js`)),It=qe(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),Lt=qe(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Rt=qe(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),zt=qe(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),Bt=qe(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_vertical_bar:Vt}=Ce(),{isThemeValid:Ht,warnInvalidTheme:Ut}=Oe(),Wt=tt(),k=e,Gt=p(()=>!!k.dataset?.length),A=C(oe()),Kt=C(!1),qt=C(``),Jt=C(null),Yt=C(0),j=C(null),Xt=C(null),Zt=C(null),Qt=C(null),$t=C(null),en=C(0),tn=C(0),nn=C(null),rn=C(null),an=C(null),M=C([]),on={none:0,asc:1,desc:2},N=C(0),sn=C(0),cn=null,ln=null,P=C(null),un=C({x:0,y:0}),dn=C(`pointer`),fn=it,F=C(Sn()),I=p(()=>F.value.style.chart.layout.bars),L=p(()=>F.value.style.chart.layout),R=p(()=>F.value.style.chart.tooltip),z=p(()=>F.value.style.chart);xe({config:()=>F.value,dataset:()=>k.dataset,component:`VueUiHorizontalBar`,rules:[Se.emptyArray,{test:e=>e.length>50||e.some(e=>e.children&&e.children.length>50),message:[`👀 There are > 50 series / bars, which will probably force users to scroll. Consider:`,``,`▶️ Grouping small values into an "Other" category.`,``,`▶️ Using filters, or several instances of the component with subsets of related series.`]}]});let{transitionEnabled:B}=Ae({config:()=>F.value.transitions,dataset:()=>k.dataset}),V=p(()=>F.value.userOptions.useCursorPointer),pn=p(()=>k.config?.skeletonDataset??[{name:``,value:6,color:`#d9d9d9`},{name:``,value:5,color:`#d9d9d9`},{name:``,value:4,color:`#d9d9d9`},{name:``,value:3,color:`#d9d9d9`},{name:``,value:2,color:`#d9d9d9`},{name:``,value:1,color:`#d9d9d9`}]),mn=p(()=>de({defaultConfig:{useCssAnimation:!1,userOptions:{show:!1},table:{show:!1},style:{chart:{backgroundColor:`#99999930`,layout:{bars:{offsetX:110,dataLabels:{color:`transparent`,value:{prefix:``,suffix:``,formatter:null}},nameLabels:{color:`transparent`}},separators:{color:`#7A7A7A`}},legend:{show:!0,backgroundColor:`transparent`,color:`transparent`,prefix:``,suffix:``,formatter:null},title:{color:`#1A1A1A`,subtitle:{color:`#5A5A5A`}}}}},userConfig:F.value.skeletonConfig??{}})),{loading:hn,FINAL_DATASET:gn,manualLoading:_n}=we({...$e(k),FINAL_CONFIG:F,prepareConfig:Sn,callback:()=>{Promise.resolve().then(async()=>{K.value.showTable=F.value.table.show,Pn()})},skeletonDataset:pn.value,skeletonConfig:de({defaultConfig:F.value,userConfig:mn.value})}),{userOptionsVisible:vn,setUserOptionsVisibility:yn,keepUserOptionState:bn}=Me({config:F.value}),{svgRef:xn}=Ne({config:z.value.title});function Sn(){let e=De({userConfig:k.config,defaultConfig:Vt}),t={},n=e.theme;if(n){if(!Ht.value(e))Ut(e),t=e;else{let r=De({userConfig:Ie[n]||k.config,defaultConfig:e});t={...De({userConfig:k.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:fe[n]||u}}}else t=e;for(let e of[`datapointEnter`,`datapointLeave`,`datapointClick`])t.events[e]=ve(k.config,`events.${e}`)?k.config.events[e]:null;return t}let H=C(z.value.width),U=C(z.value.height),W=C(I.value.gap),Cn=ce(k.config);nt(()=>k.config,(e,t)=>{let n=ce(e),r=n!==Cn;Cn=n;let i=Sn();r?(hn.value||(F.value=i),vn.value=!F.value.userOptions.showOnChartHover,en.value+=1,tn.value+=1,K.value.showTable=F.value.table.show,N.value=on[I.value.sort]??0,K.value.showTooltip=R.value.show,H.value=z.value.width,U.value=z.value.height,W.value=I.value.gap):(F.value.style.chart.tooltip=i.style.chart.tooltip,K.value.showTooltip=F.value.style.chart.tooltip.show)},{deep:!0}),nt(()=>k.dataset,e=>{Array.isArray(e)&&e.length>0&&(_n.value=!1)},{deep:!0});let{isPrinting:wn,isImaging:Tn,generatePdf:En,generateImage:Dn}=Te({elementId:`vue-ui-vertical-bar_${A.value}`,fileName:z.value.title.text||`vue-ui-vertical-bar`,options:F.value.userOptions.print}),On=p(()=>F.value.userOptions.show&&!z.value.title.text),kn=p(()=>_e(F.value.customPalette)),An=C(null),jn=p(()=>F.value.table.responsiveBreakpoint),Mn=p(()=>F.value.debug),G=C(null),Nn=C(null);function Pn(){if(j.value&&(ye(k.dataset)&&(le({componentName:`VueUiVerticalBar`,type:`dataset`,debug:Mn.value}),_n.value=!0),ye(k.dataset)||(_n.value=F.value.loading),F.value.responsive)){let e=be(()=>{let{width:e,height:t}=Ee({chart:j.value,title:z.value.title.text?Xt.value:null,legend:z.value.legend.show?Zt.value:null,source:Qt.value,noTitle:$t.value});requestAnimationFrame(async()=>{U.value=t,H.value=e})});G.value&&(Nn.value&&G.value.unobserve(Nn.value),G.value.disconnect()),G.value=new ResizeObserver(e),Je(()=>{Nn.value=j.value?.parentNode,Nn.value&&G.value.observe(Nn.value)})}}Xe(()=>{G.value&&(Nn.value&&G.value.unobserve(Nn.value),G.value.disconnect())});let K=C({showTable:F.value.table.show,showTooltip:R.value.show}),Fn=p(()=>N.value===0),In=p(()=>N.value===2),q=p(()=>(gn.value.forEach((e,t)=>{!e.value&&!e.children&&le({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`value (index ${t})`,debug:Mn.value}),e.children&&(ye(e.children)?le({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`children (index ${t})`,debug:Mn.value}):e.children.forEach((e,t)=>{[null,void 0].includes(e.name)&&le({componentName:`VueUiVerticalBar`,type:`datasetSerieAttribute`,property:`name`,key:`children`,index:t,debug:Mn.value})}))}),gn.value.map((e,t)=>{let n=`vertical_parent_${t}_${A.value}`,r=e.children&&e.children.length>0,i=d(e.value?e.value:r?e.children.map(e=>e.value||0).reduce((e,t)=>e+t,0):0),a=i>=0?1:-1;return{...e,id:n,absoluteIndex:t,shape:`square`,opacity:M.value.includes(n)?.5:1,value:Math.abs(i),sign:a,hasChildren:r,isChild:!1,segregate:()=>$n(n),isSegregated:M.value.includes(n),color:ae(e.color)||kn.value[t]||u[t]||u[t%u.length],children:!e.children||!e.children.length?[]:e.children.toSorted(Fn.value?()=>0:(e,t)=>In.value?t.value-e.value:e.value-t.value).map((r,o)=>({...r,value:d(Math.abs(r.value)),absoluteIndex:t,sign:r.value>=0?1:-1,isChild:!0,parentId:n,parentName:e.name,parentValue:i,parentSign:a,id:`vertical_child_${t}_${o}_${A.value}`,childIndex:o,isFirstChild:o===0,isLastChild:o===e.children.length-1,color:ae(r.color)||ae(e.color)||kn.value[t]||u[t]||u[t%u.length]}))}}).toSorted(Fn.value?()=>0:(e,t)=>In.value?t.value-e.value:e.value-t.value))),J=p(()=>q.value.filter(e=>!M.value.includes(e.id)));function Ln(e){return e.flatMap(e=>e.hasChildren?e.children:e)}let Y=p(()=>Ln(J.value)),Rn=p(()=>Ln(q.value)),zn=p(()=>Y.value.length),Bn=p(()=>({cy:`vertical-bar-div-legend`,backgroundColor:z.value.legend.backgroundColor,color:z.value.legend.color,fontSize:z.value.legend.fontSize,paddingBottom:12,fontWeight:z.value.legend.bold?`bold`:``})),Vn=p(()=>I.value.parentLabels.show?I.value.parentLabels.fontSize*3+I.value.parentLabels.paddingBottom:0),Hn=p(()=>{let e=[],t=0;return Y.value.forEach((n,r)=>{n.isChild&&n.childIndex===0&&I.value.parentLabels.show&&(t+=1),e[r]=t}),e}),X=p(()=>{let e=Math.max(0,...Hn.value)*Vn.value;return(U.value-24-(zn.value-1)*W.value-e)/zn.value}),Z=p(()=>({width:H.value,height:U.value,padding:{top:12,left:128+I.value.offsetX,right:64+I.value.paddingRight,bottom:12}})),Un=C(0);function Wn(){Je(()=>{if(!an.value){Un.value=0;return}let e=Array.from(an.value.querySelectorAll(`text`)).reduce((e,t)=>{let n=t.getBBox?.().width??t.getComputedTextLength();return n>e?n:e},0);Un.value=e+12})}nt(()=>[Y.value,H.value,U.value,I.value.nameLabels,I.value.offsetX],()=>Wn(),{deep:!0}),Ze(()=>{Wn()});function Gn(){return typeof document>`u`?null:(cn||(cn=document.createElement(`canvas`),ln=cn.getContext(`2d`)),ln)}function Kn(e){let t=String(e??``),n=I.value,r=n.dataLabels.fontSize,i=n.dataLabels.bold?700:400,a=F.value.style.fontFamily,o=Gn();return o?(o.font=`${i} ${r}px ${a}`,o.measureText(t).width):t.length*r*.6}function qn(){return Y.value.length?Math.max(...Y.value.map(e=>Math.abs(e.value))):0}let Jn=p(()=>{sn.value;let e=I.value,t=Un.value+Math.abs(e.nameLabels.offsetX)+e.offsetX,n=Z.value.width-Z.value.padding.right,r=Math.max(0,n-t-e.offsetX),i=Z.value.width-40,a=qn(),o=Y.value.map((e,t)=>({serie:e,textWidth:Kn(xr(e.value,e,t,e.sign))}));if(!o.length||r<=0)return{left:0,right:0};if(!o.some(({serie:e})=>e.sign===-1)){let n=o.reduce((n,{serie:o,textWidth:s})=>{let c=a?Math.abs(o.value)/a:0;if(c<=0||s<=0)return n;let ee=(t+r*c+3+e.dataLabels.offsetX+s-i)/c;return Math.max(n,ee)},0);return{left:0,right:Math.ceil(Math.min(r,Math.max(0,n)))}}let s=t+r/2,c=-1/0,ee=1/0;o.forEach(({serie:t,textWidth:n})=>{if(t.sign===-1){let t=s+12+e.dataLabels.offsetX+n;ee=Math.min(ee,i-t);return}let r=s-12-e.dataLabels.offsetX-n;c=Math.max(c,40-r)});let l=0;l=c>ee?(c+ee)/2:Math.min(ee,Math.max(c,0));let te=l*2;return te>=0?{left:Math.ceil(Math.min(r,te)),right:0}:{left:0,right:Math.ceil(Math.min(r,-te))}}),Yn=p(()=>Jn.value.right),Xn=p(()=>Jn.value.left);function Zn(){sn.value+=1}Ze(()=>{typeof document<`u`&&document.fonts&&(document.fonts.ready.then(Zn),document.fonts.addEventListener?.(`loadingdone`,Zn))}),Xe(()=>{typeof document<`u`&&document.fonts&&document.fonts.removeEventListener?.(`loadingdone`,Zn),cn=null,ln=null});let Q=p(()=>{let e=Un.value+Math.abs(I.value.nameLabels.offsetX)+Xn.value+I.value.offsetX,t=Z.value.width-Z.value.padding.right,n=Math.max(0,t-e-Yn.value-I.value.offsetX);return{top:Z.value.padding.top,bottom:Z.value.padding.top+Z.value.height,left:e,right:t,width:n,fullHeight:Z.value.padding.top+Z.value.padding.bottom+Z.value.height}});function Qn(){M.value.length?M.value=[]:q.value.forEach(e=>{M.value.push(e.id)}),fn(`selectLegend`,J.value)}async function $n(e){if(M.value.includes(e))M.value=M.value.filter(t=>t!==e);else{if(M.value.length===q.value.length-1)return;M.value.push(e)}fn(`selectLegend`,J.value)}function er(e){return q.value.length?q.value.find(t=>t.name===e)||(Mn.value&&console.warn(`VueUiHorizontalBar - Series name not found "${e}"`),null):(Mn.value&&console.warn(`VueUiHorizontalBar - There are no series to show.`),null)}function tr(e){let t=er(e);t!==null&&M.value.includes(t.id)&&$n(t.id)}function nr(e){let t=er(e);t!==null&&(M.value.includes(t.id)||$n(t.id))}let $=p(()=>J.value.map(e=>Math.abs(e.value)).reduce((e,t)=>e+t,0));function rr(e,t=!1,n=0){return t?l({v:d(Math.abs(e)/$.value*100),s:`%`,r:n}):Math.abs(e)/$.value}let ir=p(()=>Y.value.some(e=>e.sign===-1)),ar=p(()=>Math.max(...Y.value.map(e=>e.value)));function or(e){let t=e/ar.value;return d(Q.value.width/(ir.value?2:1)*t)}function sr(e){return or(e)+Q.value.left}function cr(e){return Q.value.top+(W.value+X.value)*e+Hn.value[e]*Vn.value}let lr=p(()=>Y.value.map((e,t)=>{let n=or(e.value),r=n<=0?1e-4:n;return{x:d(ir.value?Q.value.left+Q.value.width/2-(e.sign===1?0:r):Q.value.left),y:cr(t),width:d(r),height:X.value<=0?1e-4:X.value}})),ur=p(()=>{let e=new Map(J.value.map(e=>[e.id,e]));return Y.value.map((t,n)=>{if(!t.isChild)return null;let r=e.get(t.parentId);return{y:cr(n)-Vn.value+I.value.parentLabels.fontSize,name:r.name,value:[void 0,NaN,null].includes(r.value)?``:r.sign===1?r.value:-r.value,percentageToTotal:isNaN(r.value/$.value)?``:rr(r.value,!0,I.value.dataLabels.percentage.roundingPercentage),sign:r.sign}})});function dr(e,t){return ur.value[t]}function fr(){return J.value}function pr(e,t){return dr(e,t).name}function mr(e,t){let n=dr(e,t);return xr(n.value,n,t,e.parentSign||e.sign)}let hr=C(null),gr=C(null);function _r({datapoint:e,seriesIndex:t}){fn(`selectDatapoint`,e),F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:e,seriesIndex:t})}function vr({datapoint:e,seriesIndex:t}){F.value.events.datapointLeave&&F.value.events.datapointLeave({datapoint:e,seriesIndex:t}),Jt.value=null,Kt.value=!1,hr.value=null,P.value===t&&(P.value=null)}function yr(e,t,n=`pointer`){dn.value=n,F.value.events.datapointEnter&&F.value.events.datapointEnter({datapoint:e,datpoint:e,seriesIndex:t}),P.value=t,Jt.value=e,gr.value={datapoint:e,seriesIndex:t,series:q.value,config:F.value},Kt.value=!0,hr.value=e.id;let r=``,i=e.isChild?e.parentName:e.name,a=e.isChild?e.name:``,o=R.value.customFormat,s=ne(o)?o({datapoint:e,series:q.value,config:F.value,seriesIndex:t}):null;typeof s==`string`?qt.value=s:(r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${R.value.borderColor};padding-bottom:6px;margin-bottom:3px;text-align:left;">
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as c}from"./tableIntegration-CNoJ1CIY.js";import{t as ee}from"./chartImage-Dvrx_F7P.js";import{$ as l,D as te,Dt as ne,Ht as u,J as re,Jt as ie,S as ae,X as oe,Yt as se,Zt as ce,at as le,b as d,i as ue,in as de,nn as fe,nt as pe,t as me,tn as he,vt as ge,w as _e,wt as ve,zt as ye}from"./lib-BaWaqwnJ.js";import{c as be}from"./canvas-lib-22VpOI4_.js";import{n as xe,t as Se}from"./useHints-C-TwxM0Y.js";import{t as Ce}from"./useConfig-B-AzS3w-.js";import{t as we}from"./useLoading-DoqqfnmS.js";import{t as Te}from"./usePrinter-CUD8gosC.js";import{t as Ee}from"./useResponsive-CENUxfEL.js";import{t as De}from"./useNestedProp-ri-deXpG.js";import{t as Oe}from"./useThemeCheck-BKNRbGeC.js";import{t as ke}from"./useChartExport-BZts4KFb.js";import{t as Ae}from"./useTransitions-ChGGrtrv.js";import{t as je}from"./useTableResponsive-uSz_qZOB.js";import{t as Me}from"./useUserOptionState-CXlFnwPv.js";import{t as Ne}from"./useChartAccessibility-DOMuYJfm.js";import{t as Pe}from"./Shape-DgpYvQc4.js";import{n as Fe}from"./Title-DlhGIAWX.js";import{t as Ie}from"./vue_ui_horizontal_bar-_jcrdeQR.js";import{t as Le}from"./Legend-D5I3jeGD.js";import{t as Re}from"./vue-ui-accordion-B8LYfVG9.js";import{t as ze}from"./BaseScanner-m6QR9rwD.js";import{t as Be}from"./BaseLegendToggle-CnQ_U5rI.js";import{t as Ve}from"./A11yDataTable-DWNlWXzs.js";import{t as He}from"./DefGrad-DKMq1REY.js";import{t as Ue}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as f,computed as p,createBlock as m,createCommentVNode as h,createElementBlock as g,createElementVNode as _,createSlots as We,createTextVNode as Ge,createVNode as Ke,defineAsyncComponent as qe,guardReactiveProps as v,mergeProps as y,nextTick as Je,normalizeClass as b,normalizeProps as Ye,normalizeStyle as x,onBeforeUnmount as Xe,onMounted as Ze,openBlock as S,ref as C,renderList as w,renderSlot as T,resolveDynamicComponent as Qe,toDisplayString as E,toRefs as $e,unref as D,useCssVars as et,useSlots as tt,watch as nt,withCtx as O,withKeys as rt}from"vue";var it=/* @__PURE__ */ e({default:()=>Ft}),at=[`id`],ot=[`id`],st=[`onClick`],ct={style:{position:`relative`}},lt=[`xmlns`,`viewBox`,`aria-describedby`],ut={class:`vue-data-ui-g`},dt=[`width`,`height`],ft={key:1},pt=[`y`,`width`,`height`,`fill`,`rx`],mt=[`fill`,`rx`],ht=[`fill`,`rx`,`stroke`,`stroke-width`],gt=[`fill`,`rx`,`stroke`,`stroke-width`],_t=[`stroke`,`stroke-width`,`d`],vt=[`stroke`,`stroke-width`,`d`],yt=[`y`,`height`,`width`,`fill`],bt=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],xt=[`transform`,`font-size`,`fill`,`font-weight`],St=[`transform`,`font-size`,`font-weight`,`innerHTML`],Ct=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],wt=[`transform`,`text-anchor`,`font-size`,`fill`,`font-weight`],Tt=[`y`,`width`,`height`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],Et={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Dt={key:7,class:`vue-data-ui-watermark`},Ot=[`onClick`],kt={style:`width:100%;padding-top: 36px;position:relative`},At={class:`vue-ui-data-table`},jt={key:0},Mt={style:{width:`100%`}},Nt=[`data-cell`],Pt={style:{display:`flex`,"align-items":`center`,gap:`5px`,"justify-content":`flex-end`,width:`100%`,"padding-right":`3px`}},Ft=/*#__PURE__*/ Ue({__name:`vue-ui-horizontal-bar`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`copyAlt`,`selectDatapoint`],setup(e,{expose:Ue,emit:it}){et(e=>({v4c8b2a51:e.tdo}));let Ft=qe(()=>import(`./Tooltip-CL3U31cL.js`)),It=qe(()=>import(`./BaseIcon-CQFjKDhE.js`).then(e=>e.n)),Lt=qe(()=>import(`./PenAndPaper-B2UOwiJM.js`).then(e=>e.t)),Rt=qe(()=>import(`./UserOptions-B97cPcKc.js`).then(e=>e.n)),zt=qe(()=>import(`./PackageVersion-B-1JX0wI.js`).then(e=>e.t)),Bt=qe(()=>import(`./BaseDraggableDialog-MyWIeEtr.js`).then(e=>e.n)),{vue_ui_vertical_bar:Vt}=Ce(),{isThemeValid:Ht,warnInvalidTheme:Ut}=Oe(),Wt=tt(),k=e,Gt=p(()=>!!k.dataset?.length),A=C(oe()),Kt=C(!1),qt=C(``),Jt=C(null),Yt=C(0),j=C(null),Xt=C(null),Zt=C(null),Qt=C(null),$t=C(null),en=C(0),tn=C(0),nn=C(null),rn=C(null),an=C(null),M=C([]),on={none:0,asc:1,desc:2},N=C(0),sn=C(0),cn=null,ln=null,P=C(null),un=C({x:0,y:0}),dn=C(`pointer`),fn=it,F=C(Sn()),I=p(()=>F.value.style.chart.layout.bars),L=p(()=>F.value.style.chart.layout),R=p(()=>F.value.style.chart.tooltip),z=p(()=>F.value.style.chart);xe({config:()=>F.value,dataset:()=>k.dataset,component:`VueUiHorizontalBar`,rules:[Se.emptyArray,{test:e=>e.length>50||e.some(e=>e.children&&e.children.length>50),message:[`👀 There are > 50 series / bars, which will probably force users to scroll. Consider:`,``,`▶️ Grouping small values into an "Other" category.`,``,`▶️ Using filters, or several instances of the component with subsets of related series.`]}]});let{transitionEnabled:B}=Ae({config:()=>F.value.transitions,dataset:()=>k.dataset}),V=p(()=>F.value.userOptions.useCursorPointer),pn=p(()=>k.config?.skeletonDataset??[{name:``,value:6,color:`#d9d9d9`},{name:``,value:5,color:`#d9d9d9`},{name:``,value:4,color:`#d9d9d9`},{name:``,value:3,color:`#d9d9d9`},{name:``,value:2,color:`#d9d9d9`},{name:``,value:1,color:`#d9d9d9`}]),mn=p(()=>de({defaultConfig:{useCssAnimation:!1,userOptions:{show:!1},table:{show:!1},style:{chart:{backgroundColor:`#99999930`,layout:{bars:{offsetX:110,dataLabels:{color:`transparent`,value:{prefix:``,suffix:``,formatter:null}},nameLabels:{color:`transparent`}},separators:{color:`#7A7A7A`}},legend:{show:!0,backgroundColor:`transparent`,color:`transparent`,prefix:``,suffix:``,formatter:null},title:{color:`#1A1A1A`,subtitle:{color:`#5A5A5A`}}}}},userConfig:F.value.skeletonConfig??{}})),{loading:hn,FINAL_DATASET:gn,manualLoading:_n}=we({...$e(k),FINAL_CONFIG:F,prepareConfig:Sn,callback:()=>{Promise.resolve().then(async()=>{K.value.showTable=F.value.table.show,Pn()})},skeletonDataset:pn.value,skeletonConfig:de({defaultConfig:F.value,userConfig:mn.value})}),{userOptionsVisible:vn,setUserOptionsVisibility:yn,keepUserOptionState:bn}=Me({config:F.value}),{svgRef:xn}=Ne({config:z.value.title});function Sn(){let e=De({userConfig:k.config,defaultConfig:Vt}),t={},n=e.theme;if(n){if(!Ht.value(e))Ut(e),t=e;else{let r=De({userConfig:Ie[n]||k.config,defaultConfig:e});t={...De({userConfig:k.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:fe[n]||u}}}else t=e;for(let e of[`datapointEnter`,`datapointLeave`,`datapointClick`])t.events[e]=ve(k.config,`events.${e}`)?k.config.events[e]:null;return t}let H=C(z.value.width),U=C(z.value.height),W=C(I.value.gap),Cn=ce(k.config);nt(()=>k.config,(e,t)=>{let n=ce(e),r=n!==Cn;Cn=n;let i=Sn();r?(hn.value||(F.value=i),vn.value=!F.value.userOptions.showOnChartHover,en.value+=1,tn.value+=1,K.value.showTable=F.value.table.show,N.value=on[I.value.sort]??0,K.value.showTooltip=R.value.show,H.value=z.value.width,U.value=z.value.height,W.value=I.value.gap):(F.value.style.chart.tooltip=i.style.chart.tooltip,K.value.showTooltip=F.value.style.chart.tooltip.show)},{deep:!0}),nt(()=>k.dataset,e=>{Array.isArray(e)&&e.length>0&&(_n.value=!1)},{deep:!0});let{isPrinting:wn,isImaging:Tn,generatePdf:En,generateImage:Dn}=Te({elementId:`vue-ui-vertical-bar_${A.value}`,fileName:z.value.title.text||`vue-ui-vertical-bar`,options:F.value.userOptions.print}),On=p(()=>F.value.userOptions.show&&!z.value.title.text),kn=p(()=>_e(F.value.customPalette)),An=C(null),jn=p(()=>F.value.table.responsiveBreakpoint),Mn=p(()=>F.value.debug),G=C(null),Nn=C(null);function Pn(){if(j.value&&(ye(k.dataset)&&(le({componentName:`VueUiVerticalBar`,type:`dataset`,debug:Mn.value}),_n.value=!0),ye(k.dataset)||(_n.value=F.value.loading),F.value.responsive)){let e=be(()=>{let{width:e,height:t}=Ee({chart:j.value,title:z.value.title.text?Xt.value:null,legend:z.value.legend.show?Zt.value:null,source:Qt.value,noTitle:$t.value});requestAnimationFrame(async()=>{U.value=t,H.value=e})});G.value&&(Nn.value&&G.value.unobserve(Nn.value),G.value.disconnect()),G.value=new ResizeObserver(e),Je(()=>{Nn.value=j.value?.parentNode,Nn.value&&G.value.observe(Nn.value)})}}Xe(()=>{G.value&&(Nn.value&&G.value.unobserve(Nn.value),G.value.disconnect())});let K=C({showTable:F.value.table.show,showTooltip:R.value.show}),Fn=p(()=>N.value===0),In=p(()=>N.value===2),q=p(()=>(gn.value.forEach((e,t)=>{!e.value&&!e.children&&le({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`value (index ${t})`,debug:Mn.value}),e.children&&(ye(e.children)?le({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`children (index ${t})`,debug:Mn.value}):e.children.forEach((e,t)=>{[null,void 0].includes(e.name)&&le({componentName:`VueUiVerticalBar`,type:`datasetSerieAttribute`,property:`name`,key:`children`,index:t,debug:Mn.value})}))}),gn.value.map((e,t)=>{let n=`vertical_parent_${t}_${A.value}`,r=e.children&&e.children.length>0,i=d(e.value?e.value:r?e.children.map(e=>e.value||0).reduce((e,t)=>e+t,0):0),a=i>=0?1:-1;return{...e,id:n,absoluteIndex:t,shape:`square`,opacity:M.value.includes(n)?.5:1,value:Math.abs(i),sign:a,hasChildren:r,isChild:!1,segregate:()=>$n(n),isSegregated:M.value.includes(n),color:ae(e.color)||kn.value[t]||u[t]||u[t%u.length],children:!e.children||!e.children.length?[]:e.children.toSorted(Fn.value?()=>0:(e,t)=>In.value?t.value-e.value:e.value-t.value).map((r,o)=>({...r,value:d(Math.abs(r.value)),absoluteIndex:t,sign:r.value>=0?1:-1,isChild:!0,parentId:n,parentName:e.name,parentValue:i,parentSign:a,id:`vertical_child_${t}_${o}_${A.value}`,childIndex:o,isFirstChild:o===0,isLastChild:o===e.children.length-1,color:ae(r.color)||ae(e.color)||kn.value[t]||u[t]||u[t%u.length]}))}}).toSorted(Fn.value?()=>0:(e,t)=>In.value?t.value-e.value:e.value-t.value))),J=p(()=>q.value.filter(e=>!M.value.includes(e.id)));function Ln(e){return e.flatMap(e=>e.hasChildren?e.children:e)}let Y=p(()=>Ln(J.value)),Rn=p(()=>Ln(q.value)),zn=p(()=>Y.value.length),Bn=p(()=>({cy:`vertical-bar-div-legend`,backgroundColor:z.value.legend.backgroundColor,color:z.value.legend.color,fontSize:z.value.legend.fontSize,paddingBottom:12,fontWeight:z.value.legend.bold?`bold`:``})),Vn=p(()=>I.value.parentLabels.show?I.value.parentLabels.fontSize*3+I.value.parentLabels.paddingBottom:0),Hn=p(()=>{let e=[],t=0;return Y.value.forEach((n,r)=>{n.isChild&&n.childIndex===0&&I.value.parentLabels.show&&(t+=1),e[r]=t}),e}),X=p(()=>{let e=Math.max(0,...Hn.value)*Vn.value;return(U.value-24-(zn.value-1)*W.value-e)/zn.value}),Z=p(()=>({width:H.value,height:U.value,padding:{top:12,left:128+I.value.offsetX,right:64+I.value.paddingRight,bottom:12}})),Un=C(0);function Wn(){Je(()=>{if(!an.value){Un.value=0;return}let e=Array.from(an.value.querySelectorAll(`text`)).reduce((e,t)=>{let n=t.getBBox?.().width??t.getComputedTextLength();return n>e?n:e},0);Un.value=e+12})}nt(()=>[Y.value,H.value,U.value,I.value.nameLabels,I.value.offsetX],()=>Wn(),{deep:!0}),Ze(()=>{Wn()});function Gn(){return typeof document>`u`?null:(cn||(cn=document.createElement(`canvas`),ln=cn.getContext(`2d`)),ln)}function Kn(e){let t=String(e??``),n=I.value,r=n.dataLabels.fontSize,i=n.dataLabels.bold?700:400,a=F.value.style.fontFamily,o=Gn();return o?(o.font=`${i} ${r}px ${a}`,o.measureText(t).width):t.length*r*.6}function qn(){return Y.value.length?Math.max(...Y.value.map(e=>Math.abs(e.value))):0}let Jn=p(()=>{sn.value;let e=I.value,t=Un.value+Math.abs(e.nameLabels.offsetX)+e.offsetX,n=Z.value.width-Z.value.padding.right,r=Math.max(0,n-t-e.offsetX),i=Z.value.width-40,a=qn(),o=Y.value.map((e,t)=>({serie:e,textWidth:Kn(xr(e.value,e,t,e.sign))}));if(!o.length||r<=0)return{left:0,right:0};if(!o.some(({serie:e})=>e.sign===-1)){let n=o.reduce((n,{serie:o,textWidth:s})=>{let c=a?Math.abs(o.value)/a:0;if(c<=0||s<=0)return n;let ee=(t+r*c+3+e.dataLabels.offsetX+s-i)/c;return Math.max(n,ee)},0);return{left:0,right:Math.ceil(Math.min(r,Math.max(0,n)))}}let s=t+r/2,c=-1/0,ee=1/0;o.forEach(({serie:t,textWidth:n})=>{if(t.sign===-1){let t=s+12+e.dataLabels.offsetX+n;ee=Math.min(ee,i-t);return}let r=s-12-e.dataLabels.offsetX-n;c=Math.max(c,40-r)});let l=0;l=c>ee?(c+ee)/2:Math.min(ee,Math.max(c,0));let te=l*2;return te>=0?{left:Math.ceil(Math.min(r,te)),right:0}:{left:0,right:Math.ceil(Math.min(r,-te))}}),Yn=p(()=>Jn.value.right),Xn=p(()=>Jn.value.left);function Zn(){sn.value+=1}Ze(()=>{typeof document<`u`&&document.fonts&&(document.fonts.ready.then(Zn),document.fonts.addEventListener?.(`loadingdone`,Zn))}),Xe(()=>{typeof document<`u`&&document.fonts&&document.fonts.removeEventListener?.(`loadingdone`,Zn),cn=null,ln=null});let Q=p(()=>{let e=Un.value+Math.abs(I.value.nameLabels.offsetX)+Xn.value+I.value.offsetX,t=Z.value.width-Z.value.padding.right,n=Math.max(0,t-e-Yn.value-I.value.offsetX);return{top:Z.value.padding.top,bottom:Z.value.padding.top+Z.value.height,left:e,right:t,width:n,fullHeight:Z.value.padding.top+Z.value.padding.bottom+Z.value.height}});function Qn(){M.value.length?M.value=[]:q.value.forEach(e=>{M.value.push(e.id)}),fn(`selectLegend`,J.value)}async function $n(e){if(M.value.includes(e))M.value=M.value.filter(t=>t!==e);else{if(M.value.length===q.value.length-1)return;M.value.push(e)}fn(`selectLegend`,J.value)}function er(e){return q.value.length?q.value.find(t=>t.name===e)||(Mn.value&&console.warn(`VueUiHorizontalBar - Series name not found "${e}"`),null):(Mn.value&&console.warn(`VueUiHorizontalBar - There are no series to show.`),null)}function tr(e){let t=er(e);t!==null&&M.value.includes(t.id)&&$n(t.id)}function nr(e){let t=er(e);t!==null&&(M.value.includes(t.id)||$n(t.id))}let $=p(()=>J.value.map(e=>Math.abs(e.value)).reduce((e,t)=>e+t,0));function rr(e,t=!1,n=0){return t?l({v:d(Math.abs(e)/$.value*100),s:`%`,r:n}):Math.abs(e)/$.value}let ir=p(()=>Y.value.some(e=>e.sign===-1)),ar=p(()=>Math.max(...Y.value.map(e=>e.value)));function or(e){let t=e/ar.value;return d(Q.value.width/(ir.value?2:1)*t)}function sr(e){return or(e)+Q.value.left}function cr(e){return Q.value.top+(W.value+X.value)*e+Hn.value[e]*Vn.value}let lr=p(()=>Y.value.map((e,t)=>{let n=or(e.value),r=n<=0?1e-4:n;return{x:d(ir.value?Q.value.left+Q.value.width/2-(e.sign===1?0:r):Q.value.left),y:cr(t),width:d(r),height:X.value<=0?1e-4:X.value}})),ur=p(()=>{let e=new Map(J.value.map(e=>[e.id,e]));return Y.value.map((t,n)=>{if(!t.isChild)return null;let r=e.get(t.parentId);return{y:cr(n)-Vn.value+I.value.parentLabels.fontSize,name:r.name,value:[void 0,NaN,null].includes(r.value)?``:r.sign===1?r.value:-r.value,percentageToTotal:isNaN(r.value/$.value)?``:rr(r.value,!0,I.value.dataLabels.percentage.roundingPercentage),sign:r.sign}})});function dr(e,t){return ur.value[t]}function fr(){return J.value}function pr(e,t){return dr(e,t).name}function mr(e,t){let n=dr(e,t);return xr(n.value,n,t,e.parentSign||e.sign)}let hr=C(null),gr=C(null);function _r({datapoint:e,seriesIndex:t}){fn(`selectDatapoint`,e),F.value.events.datapointClick&&F.value.events.datapointClick({datapoint:e,seriesIndex:t})}function vr({datapoint:e,seriesIndex:t}){F.value.events.datapointLeave&&F.value.events.datapointLeave({datapoint:e,seriesIndex:t}),Jt.value=null,Kt.value=!1,hr.value=null,P.value===t&&(P.value=null)}function yr(e,t,n=`pointer`){dn.value=n,F.value.events.datapointEnter&&F.value.events.datapointEnter({datapoint:e,datpoint:e,seriesIndex:t}),P.value=t,Jt.value=e,gr.value={datapoint:e,seriesIndex:t,series:q.value,config:F.value},Kt.value=!0,hr.value=e.id;let r=``,i=e.isChild?e.parentName:e.name,a=e.isChild?e.name:``,o=R.value.customFormat,s=ne(o)?o({datapoint:e,series:q.value,config:F.value,seriesIndex:t}):null;typeof s==`string`?qt.value=s:(r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${R.value.borderColor};padding-bottom:6px;margin-bottom:3px;text-align:left;">
2
2
  <div style="display:flex;align-items:center;gap:4px;"><svg viewBox="0 0 60 60" height="14" width="14"><rect x="0" y="0" height="60" width="60" rx="5" stroke="none" fill="${e.color}"/>${Wt.pattern?`<rect x="0" y="0" height="60" width="60" rx="5" stroke="none" fill="url(#pattern_${A.value}_${e.absoluteIndex})"/>`:``}</svg> ${i}</div>
3
3
  ${a?`<div>${a}</div>`:``}
4
4
  </div>`,R.value.showValue&&(r+=`<div>${F.value.translations.value}: <b>${ue(I.value.dataLabels.value.formatter,e.sign===1?e.value:-e.value,l({p:R.value.prefix,v:e.sign===1?e.value:-e.value,s:R.value.suffix,r:R.value.roundingValue}),{datapoint:e,seriesIndex:t})}</b></div>`),R.value.showPercentage&&(r+=`<div>${F.value.translations.percentageToTotal} : <b>${l({v:Math.abs(e.value)/$.value*100,s:`%`,r:R.value.roundingPercentage})}</b></div>`,e.isChild&&(r+=`<div>${F.value.translations.percentageToSerie}: <b>${l({v:Math.abs(e.value)/Math.abs(e.parentValue)*100,s:`%`,r:R.value.roundingPercentage})}</b></div>`)),qt.value=`<div style="text-align:left">${r}</div>`)}function br({legend:e,index:t}){let n=z.value.legend;return n.showValue?`${e.name}: ${ue(I.value.dataLabels.value.formatter,e.value,l({p:n.prefix,v:e.value,s:n.suffix,r:n.roundingValue}),{datapoint:e,seriesIndex:t})}`:e.name}function xr(e,t,n,r){if(!I.value.dataLabels.value.show)return``;let i=ue(I.value.dataLabels.value.formatter,d(r===-1&&e>=0?-e:e),l({p:I.value.dataLabels.value.prefix,v:d(r===-1&&e>=0?-e:e),s:I.value.dataLabels.value.suffix,r:I.value.dataLabels.value.roundingValue}),{datapoint:t,seriesIndex:n}),a=`(${rr(e,!0,I.value.dataLabels.percentage.roundingPercentage)})`;return`${i}${I.value.dataLabels.percentage.show?` ${a}`:``}`}let Sr=p(()=>({head:[F.value.translations.parentName,F.value.translations.value,F.value.translations.percentageToTotal,F.value.translations.childName,F.value.translations.value,F.value.translations.percentageToSerie,F.value.translations.percentageToTotal],body:Y.value.map(e=>e.isChild?{color:e.isFirstChild?e.color:``,parentName:e.isFirstChild?e.parentName:``,parentValue:e.isFirstChild?e.parentValue:``,percentageToTotal:e.isFirstChild?e.parentValue/$.value:``,childName:e.name,childValue:e.sign===1?e.value:-e.value,childPercentageToParent:Math.abs(e.value)/Math.abs(e.parentValue),childPercentageToTotal:Math.abs(e.value)/$.value}:{color:e.color,parentName:e.name,parentValue:e.sign===1?e.value:-e.value,percentageToTotal:Math.abs(e.value)/$.value,childName:``,childValue:``,childPercentageToParent:``,childPercentageToTotal:``})})),Cr=[{key:`parentName`,type:`name`},{key:`parentValue`,type:`value`},{key:`percentageToTotal`,type:`percentage`},{key:`childName`,type:`name`},{key:`childValue`,type:`value`},{key:`childPercentageToParent`,type:`percentage`},{key:`childPercentageToTotal`,type:`percentage`}];function wr(e,t){let n=e[t.key],r=F.value.table.td,i=[``,NaN,void 0].includes(n);return t.type===`value`?`${E(r.prefix)}${i?``:n.toFixed(r.roundingValue)}${E(r.suffix)}`:t.type===`percentage`?i?``:`${(n*100).toFixed(r.roundingPercentage)}%`:n}function Tr(e=null){let t=[[z.value.title.text],[z.value.title.subtitle.text],[``]],n=Sr.value.head,r=Sr.value.body.map(e=>Cr.map(t=>e[t.key])),i=t.concat([n]).concat(r),a=te(i);e?e(a):pe({csvContent:a,title:z.value.title.text||`vue-ui-vertical-bar`})}let Er=C(!1);function Dr(e){Er.value=e,Yt.value+=1}function Or(){K.value.showTable=!K.value.showTable}Ze(()=>{[`none`,`asc`,`desc`].includes(I.value.sort)||le({componentName:`VueUiVerticalBar`,type:`attributeWrongValue`,property:`style.chart.layout.bars.sort`,key:I.value.sort}),N.value=on[I.value.sort]??0});function kr(){N.value+=1,N.value>2&&(N.value=0)}function Ar(){kr()}function jr(){K.value.showTooltip=!K.value.showTooltip}let Mr=C(!1);function Nr(){Mr.value=!Mr.value}let Pr=ee(j,()=>z.value.title.text),Fr=p(()=>c({config:F,style:z,mutableConfig:K,dialog:Bt,accordion:Re,isFullscreen:Er,parent:j,maxWidth:800,isCursorPointer:V}));nt(()=>K.value.showTable,e=>s(e,F,nn));let{isResponsive:Ir}=je(An,jn);function Lr(){K.value.showTable=!1,rn.value&&rn.value.setTableIconState(!1)}let Rr=p(()=>q.value.map((e,t)=>({...e,shape:`square`,display:`${e.name}: ${ue(I.value.dataLabels.value.formatter,e.value,l({p:z.value.legend.prefix,v:e.value,s:z.value.legend.suffix,r:z.value.legend.roundingValue}),{datapoint:e,seriesIndex:t})}`}))),zr=p(()=>z.value.backgroundColor),Br=p(()=>z.value.legend),Vr=p(()=>z.value.title),Hr=p(()=>Rr.value.map(e=>({...e,name:e.display}))),{isCallbackImaging:Ur,isCallbackSvg:Wr,generateSvg:Gr,onGenerateImage:Kr}=ke({svg:xn,title:Vr,legend:Br,legendItems:Hr,backgroundColor:zr,getSvgCallback:()=>F.value.userOptions.callbacks.svg,generateImage:Dn});function qr(){console.warn(`[autoSize]: this legacy method can be safely removed as it has no impact.`)}async function Jr(){fn(`copyAlt`,{config:F.value,dataset:J.value}),F.value.userOptions.callbacks.altCopy?await Promise.resolve(F.value.userOptions.callbacks.altCopy({config:F.value,dataset:J.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let Yr=C(!1);function Xr(){P.value=null,Yr.value=!0}function Zr(){P.value=null,Kt.value=!1,Yr.value=!1}function Qr(){if(P.value===null)return;let e=Y.value[P.value];e&&vr({datapoint:e,seriesIndex:P.value}),P.value=null,dn.value=`pointer`}function $r(e){if(!xn.value||Mr.value||document.activeElement!==xn.value)return;let t=e.key===`ArrowRight`||e.key===`ArrowDown`,n=e.key===`ArrowLeft`||e.key===`ArrowUp`,r=e.key===`Enter`||e.key===` `,i=e.key===`Escape`;if(!t&&!n&&!r&&!i)return;let a=Y.value.length;if(!a)return;if(e.preventDefault(),e.stopPropagation(),i){Qr();return}if(r){if(P.value===null)return;let e=Y.value[P.value];if(!e)return;_r({datapoint:e,seriesIndex:P.value});return}let o=P.value,s=Jt.value?Y.value.findIndex(e=>e.id===Jt.value.id):null;o!==null&&o>=0&&o<a?t?(o+=1,o>=a&&(o=0)):n&&(--o,o<0&&(o=a-1)):s!==null&&s>=0&&s<a?(o=t?s+1:s-1,o>=a&&(o=0),o<0&&(o=a-1)):o=t?0:a-1;let c=Y.value[o];c&&(P.value=o,ei(c),yr(c,o,`keyboard`))}function ei(e){if(!e)return;let t=Y.value.findIndex(t=>t.id===e.id);if(t<0)return;let n=Q.value.right,r=lr.value[t].y;if(!Number.isFinite(n)||!Number.isFinite(r))return;let i=he(n,r,xn.value);i&&(un.value=i)}let ti=p(()=>({head:Sr.value.head,body:Sr.value.body.map(e=>[e.parentName,e.parentValue===``?``:l({v:e.parentValue,r:I.value.dataLabels.value.roundingValue,p:I.value.dataLabels.value.prefix,s:I.value.dataLabels.value.suffix}),e.percentageToTotal===``?``:l({v:e.percentageToTotal*100,r:I.value.dataLabels.percentage.roundingPercentage,s:`%`}),e.childName,e.childValue===``?``:l({v:e.childValue,r:I.value.dataLabels.value.roundingValue,p:I.value.dataLabels.value.prefix,s:I.value.dataLabels.value.suffix}),e.childPercentageToParent===``?``:l({v:e.childPercentageToParent*100,r:I.value.dataLabels.percentage.roundingPercentage,s:`%`}),e.childPercentageToTotal===``?``:l({v:e.childPercentageToTotal*100,r:I.value.dataLabels.percentage.roundingPercentage,s:`%`})]),caption:F.value.a11y.translations.tableCaption,notice:F.value.a11y.translations.tableAvailable}));return Ue({autoSize:qr,getData:fr,getImage:Pr,generatePdf:En,generateCsv:Tr,generateImage:Dn,generateSvg:Gr,hideSeries:nr,showSeries:tr,toggleTable:Or,toggleSort:Ar,toggleTooltip:jr,toggleAnnotator:Nr,toggleFullscreen:Dr,copyAlt:Jr}),(e,s)=>(S(),g(`div`,{class:b(`vue-data-ui-component vue-ui-vertical-bar ${Er.value?`vue-data-ui-wrapper-fullscreen`:``} ${F.value.useCssAnimation?``:`vue-ui-dna`} ${F.value.responsive?`vue-ui-vertical-bar-autosize`:``}`),ref_key:`verticalBarChart`,ref:j,id:`vue-ui-vertical-bar_${A.value}`,style:x(`font-family:${F.value.style.fontFamily};width:100%; text-align:center;background:${z.value.backgroundColor};height:100%`),onMouseenter:s[3]||=()=>D(yn)(!0),onMouseleave:s[4]||=()=>D(yn)(!1)},[_(`p`,{id:`chart-instructions-${A.value}`,class:`sr-only`},E(F.value.a11y.translations.keyboardNavigation),9,ot),F.value.a11y.includeTable&&ti.value.body.length?(S(),m(Ve,{key:0,uid:A.value,head:ti.value.head,body:ti.value.body,caption:ti.value.caption,notice:ti.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):h(``,!0),F.value.userOptions.buttons.annotator?(S(),m(D(Lt),y({key:1},D(a)(F.value.userOptions.annotator),{svgRef:D(xn),backgroundColor:z.value.backgroundColor,color:z.value.color,active:Mr.value,isCursorPointer:V.value,palette:F.value.userOptions.annotatorPalette,onClose:Nr}),We({_:2},[w(D(o),t=>({name:t,fn:O(n=>[T(e.$slots,t,Ye(v(D(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):h(``,!0),On.value?(S(),g(`div`,{key:2,ref_key:`noTitle`,ref:$t,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):h(``,!0),z.value.title.text?(S(),g(`div`,{key:3,ref_key:`chartTitle`,ref:Xt,style:`width:100%;background:transparent;padding-bottom:12px`},[(S(),m(Fe,{key:`title_${en.value}`,config:{title:{cy:`vertical-bar-div-title`,...z.value.title},subtitle:{cy:`vertical-bar-div-subtitle`,...z.value.title.subtitle}}},null,8,[`config`]))],512)):h(``,!0),F.value.userOptions.show&&Gt.value&&(D(bn)||D(vn))?(S(),m(D(Rt),y({ref_key:`userOptionsRef`,ref:rn,backgroundColor:z.value.backgroundColor,color:z.value.color,key:`user_options_${Yt.value}`,isImaging:D(Tn),isPrinting:D(wn),uid:A.value,hasTooltip:F.value.userOptions.buttons.tooltip&&R.value.show,isFullscreen:Er.value,isTooltip:K.value.showTooltip,chartElement:j.value},D(n)(F.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator sort`),{isAnnotation:Mr.value,tableDialog:F.value.table.useDialog,isCursorPointer:V.value,onToggleFullscreen:Dr,onGeneratePdf:D(En),onGenerateCsv:Tr,onGenerateImage:D(Kr),onGenerateSvg:D(Gr),onToggleTable:Or,onToggleSort:Ar,onToggleTooltip:jr,onToggleAnnotator:Nr,onCopyAlt:Jr,style:{visibility:D(bn)?D(vn)?`visible`:`hidden`:`visible`}}),We({_:2},[w(D(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionLabels optionSort optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:O(n=>[T(e.$slots,t,Ye(v(D(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isImaging`,`isPrinting`,`uid`,`hasTooltip`,`isFullscreen`,`isTooltip`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):h(``,!0),e.$slots.legend&&z.value.legend.show&&z.value.legend.position===`top`?T(e.$slots,`legend`,{legend:q.value},void 0,!0,5):h(``,!0),!e.$slots.legend&&z.value.legend.show&&z.value.legend.position===`top`?(S(),g(`div`,{key:6,ref_key:`chartLegend`,ref:Zt},[(S(),m(Le,{key:`legend_top_${tn.value}`,legendSet:q.value,config:Bn.value,onClickMarker:s[0]||=({legend:e})=>$n(e.id)},We({item:O(({legend:e,index:t})=>[_(`div`,{onClick:t=>$n(e.id),style:x(`opacity:${M.value.includes(e.id)?.5:1}`)},E(br({legend:e,index:t})),13,st)]),legendToggle:O(()=>[q.value.length>2&&z.value.legend.selectAllToggle.show&&!D(hn)?(S(),m(Be,{key:0,backgroundColor:z.value.legend.selectAllToggle.backgroundColor,color:z.value.legend.selectAllToggle.color,fontSize:z.value.legend.fontSize,checked:M.value.length>0,onToggle:Qn},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`])):h(``,!0)]),_:2},[e.$slots.pattern?{name:`legend-pattern`,fn:O(({legend:e,index:t})=>[Ke(Pe,{shape:e.shape,radius:30,stroke:`none`,plot:{x:30,y:30},fill:`url(#pattern_${A.value}_${t})`},null,8,[`shape`,`fill`])]),key:`0`}:void 0]),1032,[`legendSet`,`config`]))],512)):h(``,!0),_(`div`,ct,[(S(),g(`svg`,{ref_key:`svgRef`,ref:xn,xmlns:D(me),class:b({"vue-data-ui-fullscreen--on":Er.value,"vue-data-ui-fulscreen--off":!Er.value,"vue-data-ui-no-transition":!D(B)}),viewBox:`0 0 ${H.value} ${U.value}`,style:x(`max-width:100%;overflow:visible;background:transparent;color:${z.value.color}`),tabindex:`0`,"aria-describedby":`chart-instructions-${A.value}`,onFocus:Xr,onBlur:Zr,onKeydown:$r},[_(`g`,ut,[Ke(D(zt)),T(e.$slots,`svg-underlayer`,{svg:{...Z.value,drawingArea:Q.value,isPrintingImg:D(wn)||D(Tn)||D(Ur),isPrintingSvg:D(Wr)}},void 0,!0),e.$slots[`chart-background`]?(S(),g(`foreignObject`,{key:0,x:0,y:0,width:H.value,height:U.value,style:{pointerEvents:`none`}},[T(e.$slots,`chart-background`,{},void 0,!0)],8,dt)):h(``,!0),_(`defs`,null,[(S(!0),g(f,null,w(Y.value,(e,t)=>(S(),m(He,{t:`linear`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,id:`vertical_bar_gradient_${A.value}_${t}`,key:`vertical_bar_gradient_${A.value}_${t}`,stops:[[`0%`,e.color,1],[`100%`,D(ie)(D(se)(e.color,.03),100-I.value.gradientIntensity),1]]},null,8,[`id`,`stops`]))),128))]),e.$slots.pattern?(S(),g(`g`,ft,[(S(!0),g(f,null,w(Y.value,t=>(S(),g(`defs`,null,[T(e.$slots,`pattern`,y({ref_for:!0},{seriesIndex:t.absoluteIndex,patternId:`pattern_${A.value}_${t.absoluteIndex}`}),void 0,!0)]))),256))])):h(``,!0),I.value.rowColor?(S(!0),g(f,{key:2},w(Y.value,(e,t)=>(S(),g(`g`,{key:`row_${e.id}`},[_(`rect`,{x:0,y:cr(t),width:H.value,height:X.value<=0?1e-4:X.value,fill:I.value.rowColor,rx:I.value.rowRadius,style:{pointerEvents:`none`},class:b({"vue-data-ui-transition":D(B)})},null,10,pt)]))),128)):h(``,!0),(S(!0),g(f,null,w(Y.value,(e,t)=>(S(),g(`g`,{key:`underlayer_${e.id}`},[_(`rect`,y({ref_for:!0},lr.value[t],{fill:I.value.underlayerColor,rx:I.value.borderRadius,class:{"vue-data-ui-transition":D(B)}}),null,16,mt)]))),128)),(S(!0),g(f,null,w(Y.value,(t,n)=>(S(),g(`g`,{key:`barloop_${t.id}`},[_(`rect`,y({ref_for:!0},lr.value[n],{fill:I.value.useGradient?`url(#vertical_bar_gradient_${A.value}_${n})`:D(ie)(t.color,I.value.fillOpacity),rx:I.value.borderRadius,stroke:I.value.useStroke?t.color:`none`,"stroke-width":I.value.useStroke?I.value.strokeWidth:0,class:{"vue-data-ui-transition":D(B)}}),null,16,ht),e.$slots.pattern?(S(),g(`rect`,y({key:0,ref_for:!0},lr.value[n],{fill:`url(#pattern_${A.value}_${t.absoluteIndex})`,rx:I.value.borderRadius,stroke:I.value.useStroke?t.color:`none`,"stroke-width":I.value.useStroke?I.value.strokeWidth:0,class:{"vue-data-ui-transition":D(B)}}),null,16,gt)):h(``,!0),(!t.isChild||t.isLastChild)&&L.value.separators.show&&n!==Y.value.length-1?(S(),g(`path`,{key:1,stroke:L.value.separators.color,"stroke-width":L.value.separators.strokeWidth,"stroke-linecap":`round`,class:b({"vue-data-ui-transition":D(B)}),d:`M${H.value}, ${X.value+W.value/2+cr(n)} ${L.value.separators.fullWidth?0:Q.value.left}, ${X.value+W.value/2+cr(n)}`},null,10,_t)):h(``,!0),ir.value&&L.value.separators.show?(S(),g(`path`,{key:2,stroke:L.value.separators.color,"stroke-width":L.value.separators.strokeWidth,"stroke-linecap":`round`,class:b({"vue-data-ui-transition":D(B)}),d:`M${Q.value.left+Q.value.width/2}, ${Q.value.top} ${Q.value.left+Q.value.width/2}, ${Q.value.bottom}`},null,10,vt)):h(``,!0)]))),128)),_(`g`,null,[(S(!0),g(f,null,w(Y.value,(e,t)=>(S(),g(`g`,{key:`pn_${e.id}`,class:`vue-ui-horizontal-bar-parent-label`},[e.isChild&&e.childIndex===0&&I.value.parentLabels.show?(S(),g(`rect`,{key:0,class:b([`vue-ui-horizontal-bar-parent-marker`,{"vue-data-ui-transition":D(B)}]),x:2,y:dr(e,t).y-I.value.parentLabels.fontSize/1.5,height:I.value.parentLabels.fontSize/1.5,width:I.value.parentLabels.fontSize/1.5,rx:1,fill:e.color},null,10,yt)):h(``,!0),e.isChild&&e.childIndex===0&&I.value.parentLabels.show?(S(),g(`text`,{key:1,class:b({"vue-data-ui-transition":D(B)}),transform:`translate(${I.value.parentLabels.offsetX+I.value.parentLabels.fontSize}, ${dr(e,t).y})`,"font-size":I.value.parentLabels.fontSize,fill:I.value.parentLabels.color,"font-weight":I.value.parentLabels.bold?`bold`:`normal`,"text-anchor":`start`,innerHTML:D(re)({content:`${pr(e,t)}`,fontSize:I.value.parentLabels.fontSize,fill:L.value.bars.parentLabels.color,x:0,y:0,translateY:!1})},null,10,bt)):h(``,!0),e.isChild&&e.childIndex===0&&I.value.parentLabels.show?(S(),g(`text`,{key:2,class:b({"vue-data-ui-transition":D(B)}),transform:`translate(${I.value.parentLabels.offsetX+I.value.parentLabels.fontSize}, ${dr(e,t).y+D(ge)(pr(e,t))*I.value.parentLabels.fontSize*1.1})`,"font-size":I.value.parentLabels.fontSize,fill:I.value.parentLabels.color,"font-weight":I.value.dataLabels.bold?`bold`:`normal`,"text-anchor":`start`},E(mr(e,t)),11,xt)):h(``,!0)]))),128))]),_(`g`,{ref_key:`childLabels`,ref:an},[(S(!0),g(f,null,w(Rn.value,(e,t)=>(S(),g(`g`,{key:`cl_${e.id}`,class:`vue-ui-horizontal-bar-child-label`},[(e.isChild||!e.hasChildren)&&I.value.nameLabels.show?(S(),g(`text`,{key:0,"text-anchor":`start`,class:b({"vue-data-ui-transition":D(B)}),transform:`translate(${Math.abs(I.value.nameLabels.offsetX)}, ${D(d)(Q.value.top+(W.value+X.value)*t+X.value/2+I.value.nameLabels.fontSize/2+Hn.value[t]*Vn.value)})`,"font-size":I.value.nameLabels.fontSize,fill:`transparent`,"font-weight":I.value.nameLabels.bold?`bold`:`normal`,style:{"user-select":`none`},innerHTML:D(re)({content:e.name,fontSize:I.value.nameLabels.fontSize,fill:`transparent`,x:0,y:0,translateY:!0})},null,10,St)):h(``,!0)]))),128))],512),_(`g`,null,[(S(!0),g(f,null,w(Y.value,(e,t)=>(S(),g(`g`,{key:`vislab_${e.id}`,class:`vue-ui-horizontal-bar-child-label`},[(e.isChild||!e.hasChildren)&&I.value.nameLabels.show?(S(),g(`text`,{key:0,class:b({"vue-data-ui-transition":D(B)}),"text-anchor":`end`,transform:`translate(${Q.value.left+I.value.nameLabels.offsetX-6}, ${Q.value.top+(W.value+X.value)*t+X.value/2+I.value.nameLabels.fontSize/3+Hn.value[t]*Vn.value})`,"font-size":I.value.nameLabels.fontSize,fill:I.value.nameLabels.color,"font-weight":I.value.nameLabels.bold?`bold`:`normal`,innerHTML:D(re)({content:e.name,fontSize:I.value.nameLabels.fontSize,fill:L.value.bars.nameLabels.color,x:0,y:0,translateY:!0})},null,10,Ct)):h(``,!0)]))),128))]),_(`g`,null,[(S(!0),g(f,null,w(Y.value,(e,t)=>(S(),g(`g`,{key:`sdl_${e.id}`,class:`vue-ui-horizontal-bar-child-label`},[_(`text`,{class:b({"vue-data-ui-transition":D(B)}),transform:`translate(${ir.value?Q.value.left+Q.value.width/2+(e.sign===1?-12:12)+(e.sign===1?-L.value.bars.dataLabels.offsetX:L.value.bars.dataLabels.offsetX):Math.min(sr(e.value)+3+z.value.layout.bars.dataLabels.offsetX,Q.value.right-2)},${Q.value.top+(W.value+X.value)*t+X.value/2+Hn.value[t]*Vn.value+I.value.dataLabels.fontSize/3})`,"text-anchor":!ir.value||e.sign===-1?`start`:`end`,"font-size":I.value.dataLabels.fontSize,fill:I.value.dataLabels.color,"font-weight":I.value.dataLabels.bold?`bold`:`normal`},E(xr(e.value,e,t,e.sign)),11,wt)]))),128))]),(S(!0),g(f,null,w(Y.value,(e,t)=>(S(),g(`g`,null,[_(`rect`,{x:0,y:Q.value.top+(W.value+X.value)*t-W.value/2+Hn.value[t]*Vn.value,width:H.value,height:X.value+W.value<=0?1e-4:X.value+W.value,fill:hr.value===e.id?D(ie)(L.value.highlighter.color,L.value.highlighter.opacity):`transparent`,onMouseenter:n=>yr(e,t,`pointer`),onMouseleave:n=>vr({datapoint:e,seriesIndex:t}),onClick:n=>_r({datapoint:e,seriesIndex:t})},null,40,Tt)]))),256)),T(e.$slots,`svg`,{svg:{...Z.value,drawingArea:Q.value,isPrintingImg:D(wn)||D(Tn)||D(Ur),isPrintingSvg:D(Wr)}},void 0,!0)])],46,lt)),e.$slots.hint?(S(),g(`div`,Et,[T(e.$slots,`hint`,Ye(v({hint:F.value.a11y.translations.keyboardNavigation,isVisible:Yr.value})),void 0,!0)])):h(``,!0)]),e.$slots.watermark?(S(),g(`div`,Dt,[T(e.$slots,`watermark`,Ye(v({isPrinting:D(wn)||D(Tn)||D(Ur)||D(Wr)})),void 0,!0)])):h(``,!0),e.$slots.legend&&z.value.legend.show&&z.value.legend.position===`bottom`?T(e.$slots,`legend`,{legend:q.value},void 0,!0,8):h(``,!0),!e.$slots.legend&&z.value.legend.show&&z.value.legend.position===`bottom`?(S(),g(`div`,{key:9,ref_key:`chartLegend`,ref:Zt},[(S(),m(Le,{key:`legend_bottom_${tn.value}`,legendSet:q.value,config:Bn.value,isCursorPointer:V.value,onClickMarker:s[1]||=({legend:e})=>$n(e.id)},We({item:O(({legend:e,index:t})=>[_(`div`,{onClick:t=>$n(e.id),style:x(`opacity:${M.value.includes(e.id)?.5:1}`)},E(br({legend:e,index:t})),13,Ot)]),legendToggle:O(()=>[q.value.length>2&&z.value.legend.selectAllToggle.show&&!D(hn)?(S(),m(Be,{key:0,backgroundColor:z.value.legend.selectAllToggle.backgroundColor,color:z.value.legend.selectAllToggle.color,fontSize:z.value.legend.fontSize,checked:M.value.length>0,isCursorPointer:V.value,onToggle:Qn},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):h(``,!0)]),_:2},[e.$slots.pattern?{name:`legend-pattern`,fn:O(({legend:e,index:t})=>[Ke(Pe,{shape:e.shape,radius:30,stroke:`none`,plot:{x:30,y:30},fill:`url(#pattern_${A.value}_${t})`},null,8,[`shape`,`fill`])]),key:`0`}:void 0]),1032,[`legendSet`,`config`,`isCursorPointer`]))],512)):h(``,!0),e.$slots.source?(S(),g(`div`,{key:10,ref_key:`source`,ref:Qt,dir:`auto`},[T(e.$slots,`source`,{},void 0,!0)],512)):h(``,!0),Ke(D(Ft),{teleportTo:R.value.teleportTo,show:K.value.showTooltip&&Kt.value&&M.value.length<k.dataset.length,backgroundColor:R.value.backgroundColor,color:R.value.color,borderRadius:R.value.borderRadius,borderColor:R.value.borderColor,borderWidth:R.value.borderWidth,fontSize:R.value.fontSize,backgroundOpacity:R.value.backgroundOpacity,position:R.value.position,offsetX:R.value.offsetX,offsetY:R.value.offsetY,parent:j.value,content:qt.value,isFullscreen:Er.value,isCustom:R.value.customFormat&&typeof R.value.customFormat==`function`,smooth:R.value.smooth,backdropFilter:R.value.backdropFilter,smoothForce:R.value.smoothForce,smoothSnapThreshold:R.value.smoothSnapThreshold,isA11yMode:dn.value===`keyboard`,a11yPosition:un.value},{"tooltip-before":O(()=>[T(e.$slots,`tooltip-before`,Ye(v({...gr.value})),void 0,!0)]),tooltip:O(()=>[T(e.$slots,`tooltip`,Ye(v({...gr.value})),void 0,!0)]),"tooltip-after":O(()=>[T(e.$slots,`tooltip-after`,Ye(v({...gr.value})),void 0,!0)]),_:3},8,[`teleportTo`,`show`,`backgroundColor`,`color`,`borderRadius`,`borderColor`,`borderWidth`,`fontSize`,`backgroundOpacity`,`position`,`offsetX`,`offsetY`,`parent`,`content`,`isFullscreen`,`isCustom`,`smooth`,`backdropFilter`,`smoothForce`,`smoothSnapThreshold`,`isA11yMode`,`a11yPosition`]),Gt.value&&F.value.userOptions.buttons.table?(S(),m(Qe(Fr.value.component),y({key:11},Fr.value.props,{ref_key:`tableUnit`,ref:nn,onClose:Lr}),We({content:O(()=>[_(`div`,{ref_key:`tableContainer`,ref:An,class:`vue-ui-vertical-bar-table atom-data-table`,style:x(`${F.value.table.useDialog?``:`max-height: 300px; margin-top: 24px`}`)},[_(`div`,kt,[F.value.table.useDialog?h(``,!0):(S(),g(`div`,{key:0,role:`button`,tabindex:`0`,style:x(`width:32px; position: absolute; top: 0; right:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:${V.value?`pointer`:`default`}; background:${F.value.table.th.backgroundColor};`),onClick:Lr,onKeypress:rt(Lr,[`enter`])},[Ke(D(It),{name:`close`,stroke:F.value.table.th.color,"stroke-width":2},null,8,[`stroke`])],36)),_(`div`,{style:{width:`100%`,"container-type":`inline-size`},class:b({"vue-ui-responsive":D(Ir)})},[_(`table`,At,[F.value.table.useDialog?h(``,!0):(S(),g(`caption`,{key:0,style:x({backgroundColor:F.value.table.th.backgroundColor,color:F.value.table.th.color,outline:F.value.table.th.outline}),class:`vue-ui-data-table__caption`},[Ge(E(z.value.title.text)+` `,1),z.value.title.subtitle.text?(S(),g(`span`,jt,E(z.value.title.subtitle.text),1)):h(``,!0)],4)),_(`thead`,null,[_(`tr`,{role:`row`,style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color}`)},[(S(!0),g(f,null,w(Sr.value.head,e=>(S(),g(`th`,{style:x(`outline:${F.value.table.th.outline}`)},[_(`div`,Mt,E(e),1)],4))),256))],4),_(`tr`,null,[_(`th`,{style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color};outline:${F.value.table.th.outline}`)},null,4),_(`th`,{style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color};outline:${F.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)},` ∑ `+E(F.value.table.td.prefix)+E(isNaN($.value)?``:$.value.toFixed(F.value.table.td.roundingValue))+E(F.value.table.td.suffix),5),_(`th`,{style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color};outline:${F.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)},` 100% `,4),_(`th`,{style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color};outline:${F.value.table.th.outline}`)},null,4),_(`th`,{style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color};outline:${F.value.table.th.outline}`)},null,4),_(`th`,{style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color};outline:${F.value.table.th.outline}`)},null,4),_(`th`,{style:x(`background:${F.value.table.th.backgroundColor};color:${F.value.table.th.color};outline:${F.value.table.th.outline}`)},null,4)])]),_(`tbody`,null,[(S(!0),g(f,null,w(Sr.value.body,(e,t)=>(S(),g(`tr`,{class:b({"vue-ui-data-table__tbody__row":!0,"vue-ui-data-table__tbody__row-even":t%2==0,"vue-ui-data-table__tbody__row-odd":t%2!=0}),style:x(`background:${F.value.table.td.backgroundColor};color:${F.value.table.td.color}`)},[(S(),g(f,null,w(Cr,(t,n)=>_(`td`,{key:t.key,class:`vue-ui-data-table__tbody__td`,style:x(n===0?`outline:${F.value.table.td.outline};font-variant-numeric: tabular-nums;`:`outline:${F.value.table.td.outline}`),"data-cell":Sr.value.head[n]??``},[_(`div`,Pt,[n===0?(S(),g(f,{key:0},[e.color?(S(),g(`span`,{key:0,style:x(`color:${e.color};margin-right:3px`)},`⬤`,4)):h(``,!0),_(`span`,null,E(e.parentName),1)],64)):(S(),g(f,{key:1},[Ge(E(wr(e,t)),1)],64))])],12,Nt)),64))],6))),256))])])],2)])],4)]),_:2},[F.value.table.useDialog?{name:`title`,fn:O(()=>[Ge(E(Fr.value.title),1)]),key:`0`}:void 0,F.value.table.useDialog?{name:`actions`,fn:O(()=>[_(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[2]||=e=>Tr(F.value.userOptions.callbacks.csv),style:x({cursor:V.value?`pointer`:`default`})},[Ke(D(It),{name:`fileCsv`,stroke:Fr.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):h(``,!0),T(e.$slots,`skeleton`,{},()=>[D(hn)?(S(),m(ze,{key:0})):h(``,!0)],!0)],46,at))}},[[`__scopeId`,`data-v-8c7e8645`]]);export{it as n,Ft as t};
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useAnimationFrame-D8gcRfnW.js";import{t as n}from"./useNestedProp-DnGoh-XS.js";import{$ as r,X as i,i as a}from"./lib-rPeBMZrn.js";import{t as o}from"./useConfig-CXhXxWjB.js";import{n as s,t as c}from"./useHints-C-TwxM0Y.js";import{t as l}from"./usePrefersMotion-XLHwega2.js";import{Fragment as u,computed as d,createCommentVNode as f,createElementBlock as p,createElementVNode as m,createTextVNode as h,createVNode as g,defineAsyncComponent as _,normalizeClass as v,normalizeStyle as y,onMounted as b,openBlock as x,ref as S,renderSlot as C,toDisplayString as w,unref as T,useSlots as E,watch as D}from"vue";var O=/* @__PURE__ */ e({default:()=>M}),k=[`aria-labelledby`],A=[`id`],j=[`aria-label`],M={__name:`vue-ui-kpi`,props:{config:{type:Object,default(){return{}}},dataset:{type:Number,default:0}},setup(e){let O=_(()=>import(`./vue-ui-digits-gtQiZcOT.js`).then(e=>e.n)),{vue_ui_kpi:M}=o(),N=l(),P=e,F=d({get:()=>z(),set:e=>e});s({config:()=>F.value,dataset:()=>P.dataset,component:`VueUiKpi`,rules:[c.noHint]});let I=E(),L=d(()=>F.value.debug),R=S(i());b(()=>{I[`chart-background`]&&L.value&&console.warn(`VueUiKpi does not support the #chart-background slot.`)});function z(){return n({userConfig:P.config,defaultConfig:M})}D(()=>P.config,e=>{F.value=z(),W()},{deep:!0});let B=S((P.dataset,P.dataset)),V=S(F.value.useAnimation?F.value.animationValueStart:B.value),H=t(),U=e=>{if(H.cancel(),H.isDisposed())return;let t=F.value.animationFrames,n=Math.abs(e-V.value)/t;if(!F.value.useAnimation||N.value||!Number.isFinite(n)||n<=0){V.value=e;return}function r(){V.value<e?V.value=Math.min(V.value+n,e):V.value>e&&(V.value=Math.max(V.value-n,e)),V.value!==e&&H.request(r)}r()};b(()=>{W()});function W(){H.cancel(),F.value.useAnimation&&!N.value?(V.value=F.value.animationValueStart,U(P.dataset)):V.value=P.dataset}return D(()=>P.dataset,e=>{F.value.useAnimation&&!N.value?U(e):(H.cancel(),V.value=e)}),D(N,e=>{e&&(H.cancel(),V.value=P.dataset)}),(t,n)=>(x(),p(`div`,{class:v(`vue-data-ui-component vue-ui-kpi ${F.value.layoutClass}`),style:y(`background:${F.value.backgroundColor}; ${F.value.layoutCss}`),"aria-labelledby":`kpi-title-${R.value}`},[F.value.title||t.$slots.title?(x(),p(`div`,{key:0,class:v(`vue-ui-kpi-title ${F.value.titleClass}`),style:y(`font-family: ${F.value.fontFamily}; font-size:${F.value.titleFontSize}px; color:${F.value.titleColor}; font-weight:${F.value.titleBold?`bold`:`normal`}; ${F.value.titleCss}`),id:`kpi-title-${R.value}`},[C(t.$slots,`title`,{comment:e.dataset}),h(` `+w(F.value.title),1)],14,A)):f(``,!0),C(t.$slots,`comment-before`,{comment:e.dataset}),m(`div`,{class:v(`vue-ui-kpi-value ${F.value.valueClass}`),style:y(`font-family: ${F.value.fontFamily}; font-size:${F.value.valueFontSize}px; color:${F.value.valueColor}; font-weight:${F.value.valueBold?`bold`:`normal`}; ${F.value.valueCss}`),role:`status`,"aria-live":`polite`,"aria-atomic":`true`,"aria-label":V.value.toFixed(F.value.valueRounding)},[C(t.$slots,`value`,{comment:e.dataset}),F.value.analogDigits.show?(x(),p(`div`,{key:0,style:y({height:F.value.analogDigits.height+`px`})},[g(T(O),{dataset:Number(V.value.toFixed(F.value.valueRounding)),config:{backgroundColor:F.value.backgroundColor,digits:{color:F.value.analogDigits.color,skeletonColor:F.value.analogDigits.skeletonColor}}},null,8,[`dataset`,`config`])],4)):(x(),p(u,{key:1},[h(w(T(a)(F.value.formatter,V.value,T(r)({p:F.value.prefix,v:V.value,s:F.value.suffix,r:F.value.valueRounding}))),1)],64))],14,j),C(t.$slots,`comment-after`,{comment:e.dataset})],14,k))}};export{O as n,M as t};
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useAnimationFrame-D8gcRfnW.js";import{t as n}from"./useNestedProp-ri-deXpG.js";import{$ as r,X as i,i as a}from"./lib-BaWaqwnJ.js";import{t as o}from"./useConfig-B-AzS3w-.js";import{n as s,t as c}from"./useHints-C-TwxM0Y.js";import{t as l}from"./usePrefersMotion-XLHwega2.js";import{Fragment as u,computed as d,createCommentVNode as f,createElementBlock as p,createElementVNode as m,createTextVNode as h,createVNode as g,defineAsyncComponent as _,normalizeClass as v,normalizeStyle as y,onMounted as b,openBlock as x,ref as S,renderSlot as C,toDisplayString as w,unref as T,useSlots as E,watch as D}from"vue";var O=/* @__PURE__ */ e({default:()=>M}),k=[`aria-labelledby`],A=[`id`],j=[`aria-label`],M={__name:`vue-ui-kpi`,props:{config:{type:Object,default(){return{}}},dataset:{type:Number,default:0}},setup(e){let O=_(()=>import(`./vue-ui-digits-Cn_wqq4Y.js`).then(e=>e.n)),{vue_ui_kpi:M}=o(),N=l(),P=e,F=d({get:()=>z(),set:e=>e});s({config:()=>F.value,dataset:()=>P.dataset,component:`VueUiKpi`,rules:[c.noHint]});let I=E(),L=d(()=>F.value.debug),R=S(i());b(()=>{I[`chart-background`]&&L.value&&console.warn(`VueUiKpi does not support the #chart-background slot.`)});function z(){return n({userConfig:P.config,defaultConfig:M})}D(()=>P.config,e=>{F.value=z(),W()},{deep:!0});let B=S((P.dataset,P.dataset)),V=S(F.value.useAnimation?F.value.animationValueStart:B.value),H=t(),U=e=>{if(H.cancel(),H.isDisposed())return;let t=F.value.animationFrames,n=Math.abs(e-V.value)/t;if(!F.value.useAnimation||N.value||!Number.isFinite(n)||n<=0){V.value=e;return}function r(){V.value<e?V.value=Math.min(V.value+n,e):V.value>e&&(V.value=Math.max(V.value-n,e)),V.value!==e&&H.request(r)}r()};b(()=>{W()});function W(){H.cancel(),F.value.useAnimation&&!N.value?(V.value=F.value.animationValueStart,U(P.dataset)):V.value=P.dataset}return D(()=>P.dataset,e=>{F.value.useAnimation&&!N.value?U(e):(H.cancel(),V.value=e)}),D(N,e=>{e&&(H.cancel(),V.value=P.dataset)}),(t,n)=>(x(),p(`div`,{class:v(`vue-data-ui-component vue-ui-kpi ${F.value.layoutClass}`),style:y(`background:${F.value.backgroundColor}; ${F.value.layoutCss}`),"aria-labelledby":`kpi-title-${R.value}`},[F.value.title||t.$slots.title?(x(),p(`div`,{key:0,class:v(`vue-ui-kpi-title ${F.value.titleClass}`),style:y(`font-family: ${F.value.fontFamily}; font-size:${F.value.titleFontSize}px; color:${F.value.titleColor}; font-weight:${F.value.titleBold?`bold`:`normal`}; ${F.value.titleCss}`),id:`kpi-title-${R.value}`},[C(t.$slots,`title`,{comment:e.dataset}),h(` `+w(F.value.title),1)],14,A)):f(``,!0),C(t.$slots,`comment-before`,{comment:e.dataset}),m(`div`,{class:v(`vue-ui-kpi-value ${F.value.valueClass}`),style:y(`font-family: ${F.value.fontFamily}; font-size:${F.value.valueFontSize}px; color:${F.value.valueColor}; font-weight:${F.value.valueBold?`bold`:`normal`}; ${F.value.valueCss}`),role:`status`,"aria-live":`polite`,"aria-atomic":`true`,"aria-label":V.value.toFixed(F.value.valueRounding)},[C(t.$slots,`value`,{comment:e.dataset}),F.value.analogDigits.show?(x(),p(`div`,{key:0,style:y({height:F.value.analogDigits.height+`px`})},[g(T(O),{dataset:Number(V.value.toFixed(F.value.valueRounding)),config:{backgroundColor:F.value.backgroundColor,digits:{color:F.value.analogDigits.color,skeletonColor:F.value.analogDigits.skeletonColor}}},null,8,[`dataset`,`config`])],4)):(x(),p(u,{key:1},[h(w(T(a)(F.value.formatter,V.value,T(r)({p:F.value.prefix,v:V.value,s:F.value.suffix,r:F.value.valueRounding}))),1)],64))],14,j),C(t.$slots,`comment-after`,{comment:e.dataset})],14,k))}};export{O as n,M as t};