vue-data-ui 3.28.11 → 3.28.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PackageVersion-ksOit8fp.js → PackageVersion-PdpqwkYX.js} +1 -1
- package/dist/{XyAnalysisOptions-CUtj1x2f.js → XyAnalysisOptions-DmKfwSu6.js} +1 -1
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-bump.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dag.js +1 -1
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-geo.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-graph.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-hill.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-stackline.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/package-DWjs4THo.js +1 -0
- package/dist/{render-common-CPA2hfDW.js → render-common-C9aE_Va1.js} +1 -1
- package/dist/ssr/vue-ui-donut.js +1 -1
- package/dist/ssr/vue-ui-xy.js +1 -1
- package/dist/ssr.js +1 -1
- package/dist/style.css +1 -1
- package/dist/vue-data-ui-Da3HK_wb.js +1 -0
- package/dist/vue-data-ui.js +1 -1
- package/dist/{vue-ui-3d-bar-Cs-_W1Av.js → vue-ui-3d-bar-D1XfKXhp.js} +1 -1
- package/dist/{vue-ui-age-pyramid-cWWVFoCj.js → vue-ui-age-pyramid-CJqqtEIh.js} +1 -1
- package/dist/{vue-ui-bullet-CMQzoLKs.js → vue-ui-bullet-CxyL5Bdm.js} +1 -1
- package/dist/{vue-ui-bump-SSu5eVbF.js → vue-ui-bump-BWWMzAN_.js} +1 -1
- package/dist/{vue-ui-candlestick-Cm9jS3n7.js → vue-ui-candlestick-CQXdyPEt.js} +1 -1
- package/dist/{vue-ui-carousel-table-D-F54W90.js → vue-ui-carousel-table-DwsfnL_l.js} +1 -1
- package/dist/{vue-ui-chestnut-DNe1s8TT.js → vue-ui-chestnut-DV7XKL7g.js} +1 -1
- package/dist/{vue-ui-chord-DGzpBpuI.js → vue-ui-chord-DRNn_E6i.js} +1 -1
- package/dist/{vue-ui-circle-pack--iJQtXys.js → vue-ui-circle-pack-BcA9ZxZS.js} +1 -1
- package/dist/{vue-ui-cursor-B7DJRSGD.js → vue-ui-cursor-DSgVvP1L.js} +1 -1
- package/dist/{vue-ui-dag-tsM65e_V.js → vue-ui-dag-CWpyU7AJ.js} +1 -1
- package/dist/{vue-ui-dashboard-CC7IhQZu.js → vue-ui-dashboard-Dh_Zi8oG.js} +1 -1
- package/dist/{vue-ui-digits-hv2QeC-H.js → vue-ui-digits-Cy3Y6qro.js} +1 -1
- package/dist/{vue-ui-donut-iyVVIGoJ.js → vue-ui-donut-BqnLIKwZ.js} +1 -1
- package/dist/vue-ui-donut-DasGeYdl.js +47 -0
- package/dist/{vue-ui-donut-evolution-Wz_-FYab.js → vue-ui-donut-evolution-Bw7ilDYR.js} +1 -1
- package/dist/{vue-ui-dumbbell-p3Q2LkBV.js → vue-ui-dumbbell-BPvvKhag.js} +1 -1
- package/dist/{vue-ui-flow-BCH8YU8H.js → vue-ui-flow-XI5Y3qdk.js} +1 -1
- package/dist/{vue-ui-funnel-DdrBD9oX.js → vue-ui-funnel-DqoQogQE.js} +1 -1
- package/dist/{vue-ui-galaxy-DYKEOEL-.js → vue-ui-galaxy-NRaBIHpn.js} +1 -1
- package/dist/{vue-ui-gauge-CPgvR_YB.js → vue-ui-gauge-DX4SBIKS.js} +1 -1
- package/dist/{vue-ui-geo-DhJ3Wr_5.js → vue-ui-geo-C3e4J_kw.js} +1 -1
- package/dist/{vue-ui-gizmo-BTy4Vr1e.js → vue-ui-gizmo-C9ls2b4h.js} +1 -1
- package/dist/{vue-ui-graph-C4kfE4G8.js → vue-ui-graph-CBkbFJIA.js} +1 -1
- package/dist/{vue-ui-heatmap-lti43RhW.js → vue-ui-heatmap-D6KP1N8f.js} +1 -1
- package/dist/{vue-ui-hill-3GVfKQmi.js → vue-ui-hill-8c-9u8eg.js} +1 -1
- package/dist/{vue-ui-history-plot-DMTPygZA.js → vue-ui-history-plot-CowxWkEd.js} +1 -1
- package/dist/{vue-ui-horizontal-bar-DwWo0CvX.js → vue-ui-horizontal-bar-CVP5jBNJ.js} +1 -1
- package/dist/{vue-ui-kpi-BTMK37Ix.js → vue-ui-kpi-D1MUlURM.js} +1 -1
- package/dist/{vue-ui-molecule-rbDnRA7c.js → vue-ui-molecule-BRB54XBD.js} +1 -1
- package/dist/{vue-ui-mood-radar-8s1jnO3P.js → vue-ui-mood-radar-CkHJdUyF.js} +1 -1
- package/dist/{vue-ui-nested-donuts-8bY4HvC-.js → vue-ui-nested-donuts-C-7VZO11.js} +1 -1
- package/dist/{vue-ui-onion-CgLNDFrZ.js → vue-ui-onion-erpKpDKg.js} +1 -1
- package/dist/{vue-ui-parallel-coordinate-plot-ms14eLus.js → vue-ui-parallel-coordinate-plot-BDg0pRkN.js} +1 -1
- package/dist/{vue-ui-quadrant-6GgQZ8fW.js → vue-ui-quadrant-CUdNxC6W.js} +1 -1
- package/dist/{vue-ui-quick-chart-CzRbFXIS.js → vue-ui-quick-chart-DE5Zwioe.js} +1 -1
- package/dist/{vue-ui-radar-BxsD2JBj.js → vue-ui-radar-6y6er9ND.js} +1 -1
- package/dist/{vue-ui-relation-circle-BFPAlaWQ.js → vue-ui-relation-circle-CjnG9G7s.js} +1 -1
- package/dist/{vue-ui-ridgeline-G2m7eFWe.js → vue-ui-ridgeline-B4qi2Ajl.js} +1 -1
- package/dist/{vue-ui-rings-l_BLWL48.js → vue-ui-rings-EYfCkNB6.js} +1 -1
- package/dist/{vue-ui-scatter-C4hXe3DM.js → vue-ui-scatter-Tw-5uRac.js} +1 -1
- package/dist/{vue-ui-skeleton-BLyh-ESb.js → vue-ui-skeleton-CZMyXM-1.js} +1 -1
- package/dist/{vue-ui-spark-trend-D0hz9kNt.js → vue-ui-spark-trend-Cmj4aWcQ.js} +1 -1
- package/dist/{vue-ui-sparkbar-Dweyr8h-.js → vue-ui-sparkbar-Crq1Vui3.js} +1 -1
- package/dist/{vue-ui-sparkgauge-DQfCXKFj.js → vue-ui-sparkgauge-CN_9yenn.js} +1 -1
- package/dist/{vue-ui-sparkhistogram-DOfAu86W.js → vue-ui-sparkhistogram-CK7JmyCw.js} +1 -1
- package/dist/{vue-ui-sparkline-DuX09S8A.js → vue-ui-sparkline-2_RlGrAT.js} +1 -1
- package/dist/{vue-ui-sparkstackbar-vXOpiyrI.js → vue-ui-sparkstackbar-Dwdn2_9q.js} +1 -1
- package/dist/{vue-ui-stackbar-DsrwNY0p.js → vue-ui-stackbar-BVmQJn2b.js} +1 -1
- package/dist/{vue-ui-stackline-e7EYZet7.js → vue-ui-stackline-nvhui30B.js} +1 -1
- package/dist/{vue-ui-strip-plot-2DxzeUXU.js → vue-ui-strip-plot-Dig2RljR.js} +1 -1
- package/dist/{vue-ui-table-B344jLaG.js → vue-ui-table-_qSw3iGd.js} +1 -1
- package/dist/{vue-ui-table-sparkline-itq8yRCe.js → vue-ui-table-sparkline-39sKOqcp.js} +1 -1
- package/dist/{vue-ui-thermometer-BSRjS7l3.js → vue-ui-thermometer-CoVrrzHW.js} +1 -1
- package/dist/{vue-ui-timer-DM-urc2D.js → vue-ui-timer-DoR5PqOa.js} +1 -1
- package/dist/{vue-ui-tiremarks-CbIOAO3F.js → vue-ui-tiremarks-9tPPNGiq.js} +1 -1
- package/dist/{vue-ui-treemap-Cgal4H5O.js → vue-ui-treemap-D3mZkT4P.js} +1 -1
- package/dist/{vue-ui-waffle-BZFI7JLd.js → vue-ui-waffle-D2GfM_Se.js} +1 -1
- package/dist/{vue-ui-wheel-DdKm_Vd8.js → vue-ui-wheel-CYBaqHm6.js} +1 -1
- package/dist/{vue-ui-word-cloud-D40vUb5e.js → vue-ui-word-cloud-ClGL6iKL.js} +1 -1
- package/dist/{vue-ui-world-BseI3A0C.js → vue-ui-world-Dm7LSNB2.js} +1 -1
- package/dist/{vue-ui-xy-Bl-DUFcf.js → vue-ui-xy-2VCMSzeE.js} +2 -2
- package/dist/{vue-ui-xy-DNVd3FPA.js → vue-ui-xy-DUlJcC9R.js} +1 -1
- package/package.json +1 -1
- package/dist/package-vXTjpYqq.js +0 -1
- package/dist/vue-data-ui-0NKIVNqt.js +0 -1
- package/dist/vue-ui-donut-B9WXaiPn.js +0 -47
|
@@ -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-_JwRfIqE.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-Dbv_VVlr.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-ksOit8fp.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-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-_JwRfIqE.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-Dbv_VVlr.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-PdpqwkYX.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,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{$ as c,D as ne,Dt as re,Et as ie,Ft as ae,Ht as oe,J as se,Q as ce,S as le,T as ue,X as de,Zt as fe,_ as pe,at as me,i as l,in as he,nn as ge,nt as _e,qt as ve,r as ye,rn as u,t as be,tn as xe,w as Se,yt as Ce,zt as we}from"./lib-rPeBMZrn.js";import{n as Te,t as Ee}from"./useHints-C-TwxM0Y.js";import{t as De}from"./useConfig-_JwRfIqE.js";import{t as Oe}from"./useSvgLabelLayout-42Kats14.js";import{n as ke,t as Ae}from"./BaseScanner-8NdoBs7B.js";import{t as je}from"./usePrinter-DVf3YcG5.js";import{t as Me}from"./useNestedProp-DnGoh-XS.js";import{t as Ne}from"./useResponsive-CENUxfEL.js";import{t as Pe}from"./useThemeCheck-BKNRbGeC.js";import{t as Fe}from"./useChartExport-BZts4KFb.js";import{t as Ie}from"./useTransitions-ChGGrtrv.js";import{t as Le}from"./useUserOptionState-CXlFnwPv.js";import{t as Re}from"./useChartAccessibility-DOMuYJfm.js";import{t as ze}from"./useTimeLabelCollider-BTybMUFi.js";import{n as Be}from"./Title-BliHuXfT.js";import{t as Ve}from"./vue_ui_history_plot-C0kFJh-f.js";import{t as He}from"./Legend-W9YVYVX-.js";import{t as Ue}from"./A11yDataTable-DWNlWXzs.js";import{t as We}from"./BaseLegendToggle-VzX69MCo.js";import{t as Ge}from"./DefGrad-DKMq1REY.js";import{t as Ke}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as d,Teleport as qe,computed as f,createBlock as p,createCommentVNode as m,createElementBlock as h,createElementVNode as g,createSlots as Je,createTextVNode as Ye,createVNode as Xe,defineAsyncComponent as _,guardReactiveProps as v,mergeProps as Ze,nextTick as Qe,normalizeClass as y,normalizeProps as b,normalizeStyle as x,onBeforeUnmount as $e,onMounted as et,openBlock as S,ref as C,renderList as w,renderSlot as T,resolveDynamicComponent as tt,shallowRef as nt,toDisplayString as E,toRefs as rt,unref as D,watch as it,withCtx as O}from"vue";var at=/* @__PURE__ */ e({default:()=>Wt}),ot=[`id`],st=[`id`],ct=[`id`],lt={style:{position:`relative`}},ut=[`xmlns`,`viewBox`,`aria-describedby`],dt=[`x`,`y`,`width`,`height`],ft={key:1},pt=[`id`,`x1`,`y1`,`x2`,`y2`],mt=[`stop-color`,`offset`],ht={key:2},gt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],_t={key:3},vt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],yt=[`x`,`y`,`fill`,`font-size`],bt=[`transform`,`font-size`,`fill`,`font-weight`],xt={key:6},St=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Ct={key:7},wt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],Tt=[`transform`,`fill`,`font-size`,`text-anchor`],Et=[`x`,`y`,`font-size`,`fill`,`font-weight`],Dt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Ot=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],kt=[`d`,`stroke`,`stroke-width`],At=[`d`,`stroke`,`stroke-width`],jt=[`cx`,`cy`,`fill`,`r`],Mt=[`cx`,`cy`,`fill`,`r`,`stroke`,`stroke-width`],Nt={key:1},Pt=[`transform`,`font-size`,`fill`,`font-weight`],Ft=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],It={key:2},Lt=[`transform`,`font-size`,`font-weight`,`fill`],Rt=[`cx`,`cy`,`r`,`onMouseenter`,`onMouseleave`,`onClick`],zt={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Bt={key:5,class:`vue-data-ui-watermark`},Vt=[`id`],Ht=[`onClick`],Ut={style:{display:`flex`,"align-items":`center`}},Wt=/*#__PURE__*/ Ke({__name:`vue-ui-history-plot`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:Ke,emit:at}){let Wt=_(()=>import(`./Tooltip-C1q0Qoh7.js`)),Gt=_(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),Kt=_(()=>import(`./vue-ui-accordion-DxGxf-Rm.js`).then(e=>e.n)),qt=_(()=>import(`./DataTable-KeuZB1JM.js`)),Jt=_(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Yt=_(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Xt=_(()=>import(`./PackageVersion-ksOit8fp.js`).then(e=>e.t)),Zt=_(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_history_plot:Qt}=De(),{isThemeValid:$t,warnInvalidTheme:en}=Pe(),k=e,A=C(null),tn=C(null),nn=C(0),rn=C(null),an=C(0),on=C(0),sn=C(0),j=nt(null),M=nt(null),cn=C(null),N=C(de()),ln=C(!1),un=C(``),P=C([]),dn=C(!1),F=C(null),fn=C(!1),pn=C(null),mn=C(!1),hn=C(null),gn=C(null),_n=C(null),vn=C(null),yn=C(null),bn=C(null),I=C(null),L=C(null),xn=C({x:0,y:0}),Sn=C(`pointer`),Cn=C(!1),wn=f({get:()=>!!k.dataset&&k.dataset.length,set:e=>e}),Tn=at,En=C(!1),Dn=0;et(()=>{mn.value=!0,kn()});let On=f(()=>R.value.debug);function kn(){we(k.dataset)?(me({componentName:`VueUiHistoryPlot`,type:`dataset`,debug:On.value}),Pn.value=!0):k.dataset.forEach((e,t)=>{Ce({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{wn.value=!1,me({componentName:`VueUiHistoryPlot`,type:`datasetSerieAttribute`,property:e,index:t,debug:On.value})})}),we(k.dataset)||(Pn.value=R.value.loading),R.value.responsive&&(j.value&&(M.value&&j.value.unobserve(M.value),j.value.disconnect()),j.value=new ResizeObserver(()=>{let{width:e,height:t}=Ne({chart:A.value,title:H.value.title.text?tn.value:null,noTitle:cn.value,legend:H.value.legend.show?rn.value:null,source:pn.value});cancelAnimationFrame(Dn),Dn=requestAnimationFrame(()=>{q.value.width=e,q.value.height=t,En.value=!0,R.value.responsiveProportionalSizing?(X.value.plots=u({relator:Math.min(e,t),adjuster:600,source:z.value.radius,threshold:3,fallback:3}),X.value.indexLabels=u({relator:Math.min(e,t),adjuster:600,source:z.value.indexLabels.fontSize,threshold:6,fallback:6}),X.value.labels=u({relator:Math.min(e,t),adjuster:600,source:z.value.labels.fontSize,threshold:6,fallback:6}),X.value.xAxisLabels=u({relator:Math.min(e,t),adjuster:600,source:V.value.x.labels.fontSize,threshold:6,fallback:6}),X.value.xAxisName=u({relator:Math.min(e,t),adjuster:600,source:V.value.x.name.fontSize,threshold:6,fallback:6}),X.value.yAxisLabels=u({relator:Math.min(e,t),adjuster:600,source:V.value.y.labels.fontSize,threshold:6,fallback:6}),X.value.yAxisName=u({relator:Math.min(e,t),adjuster:600,source:V.value.y.name.fontSize,threshold:6,fallback:6})):(X.value.plots=z.value.radius,X.value.indexLabels=z.value.indexLabels.fontSize,X.value.labels=z.value.labels.fontSize,X.value.xAxisLabels=V.value.x.labels.fontSize,X.value.xAxisName=V.value.x.name.fontSize,X.value.yAxisLabels=V.value.y.labels.fontSize,X.value.yAxisName=V.value.y.name.fontSize)})}),M.value=A.value.parentNode,j.value.observe(M.value))}$e(()=>{cancelAnimationFrame(Dn),j.value&&(M.value&&j.value.unobserve(M.value),j.value.disconnect())});function An(){let e=Me({userConfig:k.config,defaultConfig:Qt}),t={},n=e.theme;if(n){if(!$t.value(e))en(e),t=e;else{let r=Me({userConfig:Ve[n]||k.config,defaultConfig:e});t={...Me({userConfig:k.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:ge[n]||oe}}}else t=e;return t}let R=C(An()),z=f(()=>R.value.style.chart.plots),B=f(()=>R.value.style.chart.grid),V=f(()=>R.value.style.chart.axes),H=f(()=>R.value.style.chart);Te({config:()=>R.value,dataset:()=>k.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}=Ie({config:()=>R.value.transitions,dataset:()=>k.dataset}),W=f(()=>R.value.userOptions.useCursorPointer),jn=f(()=>he({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:R.value.skeletonConfig??{}})),{loading:Mn,FINAL_DATASET:Nn,manualLoading:Pn}=ke({...rt(k),FINAL_CONFIG:R,prepareConfig:An,skeletonDataset:k.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}]}],skeletonConfig:he({defaultConfig:R.value,userConfig:jn.value})}),{userOptionsVisible:Fn,setUserOptionsVisibility:In,keepUserOptionState:Ln}=Le({config:R.value}),{svgRef:G}=Re({config:H.value.title}),Rn=fe(k.config);it(()=>k.config,(e,t)=>{let n=fe(e),r=n!==Rn;Rn=n;let i=An();r?(Mn.value||(R.value=i),Fn.value=!R.value.userOptions.showOnChartHover,kn(),nn.value+=1,on.value+=1,an.value+=1,q.value.height=H.value.height,q.value.width=H.value.width,X.value.plots=z.value.radius,X.value.indexLabels=z.value.indexLabels.fontSize,X.value.labels=z.value.labels.fontSize,X.value.xAxisLabels=V.value.x.labels.fontSize,X.value.xAxisName=V.value.x.name.fontSize,X.value.yAxisLabels=V.value.y.labels.fontSize,X.value.yAxisName=V.value.y.name.fontSize,K.value.showTable=R.value.table.show,K.value.showTooltip=H.value.tooltip.show):(R.value.style.chart.tooltip=i.style.chart.tooltip,K.value.showTooltip=R.value.style.chart.tooltip.show)},{deep:!0}),it(()=>k.dataset,e=>{Array.isArray(e)&&e.length>0&&(Pn.value=!1)},{deep:!0});let{isPrinting:zn,isImaging:Bn,generatePdf:Vn,generateImage:Hn}=je({elementId:`history_plot_${N.value}`,fileName:H.value.title.text||`vue-ui-history-plot`,options:R.value.userOptions.print}),Un=f(()=>R.value.userOptions.show&&!H.value.title.text),Wn=f(()=>Se(R.value.customPalette)),K=C({showTable:R.value.table.show,showTooltip:H.value.tooltip.show});it(R,()=>{K.value={showTable:R.value.table.show,showTooltip:H.value.tooltip.show}},{immediate:!0});let q=C({height:H.value.height,width:H.value.width}),Gn=f(()=>q.value.width),Kn=f(()=>q.value.height),{metrics:qn,ready:Jn,settling:J,update:Yn}=Oe({svgRef:G,canMeasure:()=>!R.value.responsive||En.value,initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(bn.value).textWidth,yAxisLabelWidth:e(vn.value).rotatedWidth,xAxisLabelHeight:e(_n.value).height,timeLabelsHeight:e(yn.value).height})});function Xn(){let e=qn.value.scaleLabelsWidth,t=qn.value.yAxisLabelWidth;return e+t+(t?24:0)}let Zn=f(()=>qn.value.xAxisLabelHeight+qn.value.timeLabelsHeight+(_n.value?X.value.xAxisName/2:0)),Y=f(()=>{let e=H.value.padding.left,t=H.value.padding.top,n=Xn(),r=z.value.radius;return{left:e+n+V.value.y.name.offsetX,top:t+r,right:q.value.width-H.value.padding.right-r-V.value.y.name.offsetX,bottom:q.value.height-H.value.padding.bottom-Zn.value-r-V.value.x.name.offsetY,width:q.value.width-e-H.value.padding.right-n-r-V.value.y.name.offsetX,height:q.value.height-t-H.value.padding.bottom-Zn.value-r*2-V.value.x.name.offsetY}}),X=C({plots:z.value.radius,indexLabels:z.value.indexLabels.fontSize,labels:z.value.labels.fontSize,xAxisLabels:V.value.x.labels.fontSize,xAxisName:V.value.x.name.fontSize,yAxisLabels:V.value.y.labels.fontSize,yAxisName:V.value.y.name.fontSize}),Z=f(()=>Nn.value.map((e,t)=>{let n=Array.isArray(e.temperatureColors)&&e.temperatureColors.length?e.temperatureColors.map(e=>le(e)):void 0;return{...e,color:e.color?le(e.color):Wn.value[t]||oe[t]||oe[t%oe.length],temperatureColors:n,temperatureAngle:Qn(e.temperatureAngle),temperatureIndependant:e.temperatureIndependant===!0,usePlotTemperatureColors:e.usePlotTemperatureColors!==!1,seriesIndex:t}}));function Qn(e=0){let t=Number(e);return Number.isFinite(t)?(t%360+360)%360:0}let $n=f(()=>Math.max(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.x)))),er=f(()=>{let e=Math.min(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.x)));return e<0?e:0}),tr=f(()=>Math.max(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.y)))),nr=f(()=>{let e=Math.min(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.y)));return e<0?e:0}),Q=f(()=>{let e=pe(V.value.x.scaleMin??er.value,V.value.x.scaleMax??$n.value,V.value.x.ticks),t=pe(V.value.y.scaleMin??nr.value,V.value.y.scaleMax??tr.value,V.value.y.ticks);return{x:e,y:t,tickX:e.ticks.map(t=>({x:Y.value.left+(t-e.min)/(e.max-e.min)*Y.value.width,y1:Y.value.top,y2:Y.value.bottom,value:t})),tickY:t.ticks.map(e=>({y:Y.value.bottom-(e-t.min)/(t.max-t.min)*Y.value.height,x1:Y.value.left,x2:Y.value.right,value:e}))}});function rr(e){let t=Q.value.x.min<0?Math.abs(Q.value.x.min):Q.value.x.min>0?-Q.value.x.min:0;return Y.value.left+((e||0)+t)/(Q.value.x.max+t)*Y.value.width}function ir(e){let t=Q.value.y.min<0?Math.abs(Q.value.y.min):Q.value.y.min>0?-Q.value.y.min:0;return Y.value.bottom-((e||0)+t)/(Q.value.y.max+t)*Y.value.height}let $=f(()=>Z.value.filter(e=>!P.value.includes(e.seriesIndex)).map((e,t)=>{let n=e.values.map((t,n)=>({valueX:t.x,valueY:t.y,label:t.label,x:rr(t.x),y:ir(t.y),color:e.color,seriesName:e.name,id:de()})),r=e.smooth?ue(n):n.map(e=>`${e.x},${e.y} `).join(``).trim();return{...e,gradientIndex:t,plots:n,path:`M${r}`}})),ar=f(()=>{if(F.value===null||I.value===null)return $.value;let e=$.value.findIndex(e=>e.seriesIndex===I.value);if(e===-1)return $.value;let t=$.value[e];return[...$.value.slice(0,e),...$.value.slice(e+1),t]}),or=f(()=>$.value.some(e=>sr(e)));function sr(e){return Array.isArray(e?.temperatureColors)&&e.temperatureColors.length}function cr(e){return sr(e)&&e.usePlotTemperatureColors}function lr(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=t.map(e=>e.x),r=t.map(e=>e.y),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r);return{minX:i,maxX:a,minY:o,maxY:s,width:a-i,height:s-o}}function ur(){let e=Y.value;return{minX:e.left,maxX:e.right,minY:e.top,maxY:e.bottom,width:e.width,height:e.height}}function dr(e){return e?.temperatureIndependant?lr(e):ur()}function fr(e){let t=Qn(e?.temperatureAngle)*Math.PI/180,n=Math.sin(t),r=Math.cos(t),i=dr(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}}function pr(e,t){let{x1:n,y1:r,x2:i,y2:a}=fr(e),o=i-n,s=a-r,ee=o*o+s*s;if(!ee)return 0;let te=((t.x-n)*o+(t.y-r)*s)/ee;return Math.min(1,Math.max(0,te))}function mr(e,t){return ie({colors:e.temperatureColors,ratio:pr(e,t)})}function hr(e,t){return`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${N.value}`}function gr(e,t,n){return cr(e)?z.value.gradient.show?`url(#${hr(e,t)})`:mr(e,t):z.value.gradient.show?`url(#gradient_${n}_${N.value})`:t.color}function _r(e,t){return cr(e)?mr(e,t):e.color}function vr(e,t){return z.value.indexLabels.adaptColorToBackground?ye(_r(e,t)):z.value.indexLabels.color}function yr(e,t){let n=$.value.find(t=>t.seriesIndex===e);return n&&cr(n)?mr(n,t):t.color}function br(e){return sr(e)?`url(#temperature_grad_history_${e.seriesIndex}_${N.value})`:H.value.paths.useSerieColor?e.color:H.value.paths.stroke}function xr(e){return F.value===null||I.value===e?1:Math.min(1,z.value.unselectedOpacity)}f(()=>F.value!==null&&I.value!==null);let Sr=C(!1);function Cr(){P.value.length?P.value=[]:Or.value.forEach(e=>{P.value.push(e.seriesIndex)}),Tn(`selectLegend`,$.value)}function wr(e){P.value.includes(e)?P.value=P.value.filter(t=>t!==e):P.value.push(e),Tn(`selectLegend`,$.value)}function Tr(e){return Z.value.length?Z.value.find(t=>t.name===e)||(On.value&&console.warn(`VueUiHistoryPlot - Series name not found "${e}"`),null):(On.value&&console.warn(`VueUiHistoryPlot - There are no series to show.`),null)}function Er(e){let t=Tr(e);t!==null&&P.value.includes(t.seriesIndex)&&wr(t.seriesIndex)}function Dr(e){let t=Tr(e);t!==null&&(P.value.includes(t.seriesIndex)||wr(t.seriesIndex))}let Or=f(()=>Z.value.map(e=>{let t=sr(e)?e.temperatureColors:null;return{...e,gradientColors:t,opacity:P.value.includes(e.seriesIndex)?.5:1,segregate:()=>wr(e.seriesIndex),isSegregated:P.value.includes(e.seriesIndex),shape:t?`gradient`:`circle`}})),kr=f(()=>({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 Ar({datapoint:e,plotIndex:t,seriesIndex:n}){R.value.events.datapointClick&&R.value.events.datapointClick({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),Tn(`selectDatapoint`,e)}function jr(e){dn.value=e,sn.value+=1}let Mr=C(null);function Nr({datapoint:e,plotIndex:t,seriesIndex:n}){R.value.events.datapointLeave&&R.value.events.datapointLeave({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),(Sn.value!==`keyboard`||I.value!==n||L.value!==t)&&(ln.value=!1,F.value=null)}function Pr(e,t){if(!G.value)return;let n=$.value.find(t=>t.seriesIndex===e);if(!n)return;let r=n.plots[t];if(!r)return;let i=xe(r.x,r.y,G.value);i&&(xn.value=i)}function Fr({datapoint:e,plotIndex:t,seriesIndex:n,triggerMode:r=`pointer`}){R.value.events.datapointEnter&&R.value.events.datapointEnter({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),I.value=n,L.value=t,Sn.value=r,Sr.value=!0;let i=yr(n,e),a={...e,color:i};Mr.value={datapoint:a,color:i,seriesIndex:n,plotIndex:t,config:R.value,series:Z.value},F.value=e;let o=H.value.tooltip.customFormat;if(fn.value=!1,re(o))try{let e=o({seriesIndex:n,datapoint:a,color:i,plotIndex:t,series:Z.value,config:R.value});typeof e==`string`&&(un.value=e,fn.value=!0)}catch{console.warn(`Custom format cannot be applied.`),fn.value=!1}if(!fn.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="${i}"/></svg><span>${e.seriesName}</span></div>`,t+=`<div>${e.label}</div>`,t+=`<div>${V.value.x.name.text||`x`}: ${l(V.value.x.labels.formatter,e.valueX,c({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`}: ${l(V.value.y.labels.formatter,e.valueY,c({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))}</div>`,un.value=`<div>${t}</div>`}ln.value=!0,r===`keyboard`&&Qe(()=>{Pr(n,t)})}f(()=>({head:$.value.map(e=>({name:e.name,color:e.color}))}));let Ir=f(()=>{let e=[R.value.table.columnNames.series,R.value.table.columnNames.datapoint,R.value.table.columnNames.x,R.value.table.columnNames.y];return{head:e,body:$.value.flatMap(e=>e.plots.map(e=>[{color:e.color,name:e.seriesName},e.label,l(V.value.x.labels.formatter,e.valueX,c({p:V.value.x.labels.prefix,v:e.valueX,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding})),l(V.value.y.labels.formatter,e.valueY,c({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))])),config:{th:{backgroundColor:R.value.table.th.backgroundColor,color:R.value.table.th.color,outline:R.value.table.th.outline},td:{backgroundColor:R.value.table.td.backgroundColor,color:R.value.table.td.color,outline:R.value.table.td.outline},breakpoint:R.value.table.responsiveBreakpoint},colNames:e}});function Lr(e=null){Qe(()=>{let t=[[R.value.table.columnNames.series],[R.value.table.columnNames.datapoint],[R.value.table.columnNames.x],[R.value.table.columnNames.y]],n=$.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=ne(r);e?e(i):_e({csvContent:i,title:H.value.title.text||`vue-ui-history-plot`})})}let Rr=C(!1);function zr(){Rr.value=!Rr.value}function Br(){K.value.showTable=!K.value.showTable}function Vr(){K.value.showTooltip=!K.value.showTooltip}function Hr(){return $.value}let Ur=te(A,()=>H.value.title.text),Wr=f(()=>Q.value.tickX),Gr=f(()=>({start:0,end:Q.value.tickX.length}));ze({timeLabelsEls:yn,timeLabels:Wr,slicer:Gr,configRef:R,rotationPath:[`style`,`chart`,`axes`,`x`,`labels`,`rotation`],autoRotatePath:[`style`,`chart`,`axes`,`x`,`labels`,`autoRotate`,`enable`],isAutoSize:!1,width:Gn,height:Kn,targetClass:`.vue-ui-history-plot-x-axis-scale`,rotation:V.value.x.labels.autoRotate.angle});let Kr=f(()=>ee({config:R,style:H,mutableConfig:K,dialog:Zt,accordion:Kt,isFullscreen:dn,parent:A,maxWidth:800}));it(()=>K.value.showTable,e=>s(e,R,hn));function qr(){K.value.showTable=!1,gn.value&&gn.value.setTableIconState(!1)}let Jr=f(()=>H.value.backgroundColor),Yr=f(()=>H.value.legend),Xr=f(()=>H.value.title),{isCallbackImaging:Zr,isCallbackSvg:Qr,generateSvg:$r,onGenerateImage:ei}=Fe({svg:G,title:Xr,legend:Yr,legendItems:Or,backgroundColor:Jr,getSvgCallback:()=>R.value.userOptions.callbacks.svg,generateImage:Hn});async function ti(){Tn(`copyAlt`,{config:R.value,dataset:$.value}),R.value.userOptions.callbacks.altCopy?await Promise.resolve(R.value.userOptions.callbacks.altCopy({config:R.value,dataset:$.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let ni=f(()=>({head:Ir.value.head,body:Ir.value.body.map(e=>[e[0]?.name||``,e[1],e[2],e[3]]),caption:R.value.a11y.translations.tableCaption,notice:R.value.a11y.translations.tableAvailable}));function ri(e){return $.value.findIndex(t=>t.seriesIndex===e)}function ii(){if(I.value!==null&&L.value!==null){let e=$.value.find(e=>e.seriesIndex===I.value)?.plots?.[L.value];e&&Nr({datapoint:e,plotIndex:L.value,seriesIndex:I.value})}I.value=null,L.value=null,Sn.value=`pointer`,ln.value=!1,F.value=null}function ai(){I.value=null,L.value=null,Cn.value=!0}function oi(){ii(),Cn.value=!1}function si(e,t){if(!e?.plots?.length)return null;let n=e.plots.length;return(t%n+n)%n}function ci({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=si(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 li(e){if(!G.value||Rr.value||document.activeElement!==G.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){ii();return}if(a){if(I.value===null||L.value===null)return;let e=$.value.find(e=>e.seriesIndex===I.value)?.plots?.[L.value];if(!e)return;Ar({datapoint:e,plotIndex:L.value,seriesIndex:I.value});return}let s=null;if(I.value===null||L.value===null){let e=$.value[0];if(!e?.plots?.length)return;s={seriesIndex:e.seriesIndex,plotIndex:0}}else r?s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`up`}):i?s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`down`}):t?s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`left`}):n&&(s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`right`}));if(!s)return;let ee=$.value.find(e=>e.seriesIndex===s.seriesIndex)?.plots?.[s.plotIndex];ee&&Fr({datapoint:ee,plotIndex:s.plotIndex,seriesIndex:s.seriesIndex,triggerMode:`keyboard`})}return Ke({getData:Hr,getImage:Ur,generatePdf:Vn,generateCsv:Lr,generateImage:Hn,generateSvg:$r,hideSeries:Dr,showSeries:Er,toggleTable:Br,toggleTooltip:Vr,toggleAnnotator:zr,toggleFullscreen:jr,copyAlt:ti}),it(()=>[q.value,X.value,V.value,H.value,R.value.style.fontFamily,k.dataset,En.value,bn.value,yn.value,_n.value,vn.value],Yn,{flush:`post`,deep:!0}),(e,s)=>(S(),h(`div`,{id:`history_plot_${N.value}`,ref_key:`historyPlotChart`,ref:A,class:y({"vue-data-ui-component":!0,"vue-ui-history-plot":!0,"vue-data-ui-wrapper-fullscreen":dn.value}),style:x(`background:${H.value.backgroundColor};color:${H.value.color};font-family:${R.value.style.fontFamily}; position: relative; ${R.value.responsive?`height: 100%`:``}`),onMouseenter:s[2]||=()=>D(In)(!0),onMouseleave:s[3]||=()=>D(In)(!1)},[g(`div`,{id:`chart-instructions-${N.value}`,class:`sr-only`},[g(`p`,null,E(R.value.a11y.translations.keyboardNavigation),1)],8,st),ni.value.body.length?(S(),p(Ue,{key:0,uid:N.value,head:ni.value.head,body:ni.value.body,caption:ni.value.caption,notice:ni.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):m(``,!0),T(e.$slots,`userConfig`,{},void 0,!0),R.value.userOptions.buttons.annotator?(S(),p(D(Jt),Ze({key:1},D(a)(R.value.userOptions.annotator),{svgRef:D(G),backgroundColor:H.value.backgroundColor,color:H.value.color,active:Rr.value,isCursorPointer:W.value,palette:R.value.userOptions.annotatorPalette,onClose:zr}),Je({_:2},[w(D(o),t=>({name:t,fn:O(n=>[T(e.$slots,t,b(v(D(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):m(``,!0),Un.value?(S(),h(`div`,{key:2,ref_key:`noTitle`,ref:cn,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):m(``,!0),H.value.title.text?(S(),h(`div`,{key:3,ref_key:`chartTitle`,ref:tn,class:`vue-ui-xy-title`,style:x(`font-family:${R.value.style.fontFamily}`)},[(S(),p(Be,{key:`title_${nn.value}`,config:{title:{cy:`history-plot-div-title`,...H.value.title},subtitle:{cy:`history-plot-div-subtitle`,...H.value.title.subtitle}}},null,8,[`config`]))],4)):m(``,!0),g(`div`,{id:`legend-top-${N.value}`},null,8,ct),R.value.userOptions.show&&wn.value&&(D(Ln)||D(Fn))?(S(),p(D(Yt),Ze({ref_key:`userOptionsRef`,ref:gn,key:`user_option_${sn.value}`,backgroundColor:H.value.backgroundColor,color:H.value.color,isPrinting:D(zn),isImaging:D(Bn),uid:N.value,hasTooltip:H.value.tooltip.show&&R.value.userOptions.buttons.tooltip,hasLabel:!1,isFullscreen:dn.value,chartElement:A.value},D(n)(R.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isTooltip:K.value.showTooltip,isAnnotation:Rr.value,tableDialog:R.value.table.useDialog,isCursorPointer:W.value,onToggleFullscreen:jr,onGeneratePdf:D(Vn),onGenerateCsv:Lr,onGenerateImage:D(ei),onGenerateSvg:D($r),onToggleTable:Br,onToggleTooltip:Vr,onToggleAnnotator:zr,onCopyAlt:ti,style:{visibility:D(Ln)?D(Fn)?`visible`:`hidden`:`visible`}}),Je({_:2},[w(D(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:O(n=>[T(e.$slots,t,b(v(D(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasTooltip`,`isFullscreen`,`chartElement`,`isTooltip`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):m(``,!0),g(`div`,lt,[(S(),h(`svg`,{ref_key:`svgRef`,ref:G,xmlns:D(be),viewBox:`0 0 ${q.value.width<0?.1:q.value.width} ${q.value.height<0?.1:q.value.height}`,style:x(`max-width:100%;overflow:visible;background:transparent;color:${H.value.color};visibility:${D(Jn)?`visible`:`hidden`}`),"aria-describedby":`chart-instructions-${N.value}`,tabindex:`0`,onFocus:ai,onBlur:oi,onKeydown:li},[Xe(D(Xt)),T(e.$slots,`svg-underlayer`,{svg:{...q.value,drawingArea:Y.value,isPrintingImg:D(zn)||D(Bn)||D(Zr),isPrintingSvg:D(Qr)}},void 0,!0),e.$slots[`chart-background`]?(S(),h(`foreignObject`,{key:0,x:Y.value.left,y:Y.value.top,width:Y.value.width<=0?10:Y.value.width,height:Y.value.height<=0?10:Y.value.height,style:{pointerEvents:`none`}},[T(e.$slots,`chart-background`,{},void 0,!0)],8,dt)):m(``,!0),z.value.gradient.show||or.value?(S(),h(`defs`,ft,[z.value.gradient.show?(S(!0),h(d,{key:0},w($.value,(e,t)=>(S(),p(Ge,{t:`radial`,key:`gradient_${t}_${N.value}`,id:`gradient_${t}_${N.value}`,fy:`30%`,stops:[[`10%`,D(ae)(e.color,z.value.gradient.intensity/100),1],[`90%`,D(ce)(e.color,.1),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128)):m(``,!0),(S(!0),h(d,null,w($.value,e=>(S(),h(d,{key:`temperature_grad_history_template_${e.seriesIndex}_${N.value}`},[z.value.gradient.show&&cr(e)?(S(!0),h(d,{key:0},w(e.plots,t=>(S(),p(Ge,{t:`radial`,key:`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${N.value}`,id:hr(e,t),fy:`30%`,stops:[[`10%`,D(ae)(mr(e,t),z.value.gradient.intensity/100),1],[`90%`,D(ce)(mr(e,t),.1),1],[`100%`,mr(e,t),1]]},null,8,[`id`,`stops`]))),128)):m(``,!0),sr(e)?(S(),h(`linearGradient`,{key:1,id:`temperature_grad_history_${e.seriesIndex}_${N.value}`,gradientUnits:`userSpaceOnUse`,x1:fr(e).x1,y1:fr(e).y1,x2:fr(e).x2,y2:fr(e).y2},[(S(!0),h(d,null,w(e.temperatureColors,(t,n)=>(S(),h(`stop`,{key:`temperature_grad_history_stop_${e.seriesIndex}_${n}_${N.value}`,"stop-color":t,offset:e.temperatureColors.length===1?`0%`:D(ve)(n,e.temperatureColors.length)},null,8,mt))),128))],8,pt)):m(``,!0)],64))),128))])):m(``,!0),B.value.verticalLines.show?(S(),h(`g`,ht,[(S(!0),h(d,null,w(Q.value.tickX,e=>(S(),h(`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,gt))),256))])):m(``,!0),V.value.y.labels.show?(S(),h(`g`,_t,[(S(!0),h(d,null,w(Q.value.tickY,e=>(S(),h(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:Y.value.left-5,x2:Y.value.left,y1:e.y,y2:e.y},null,8,vt))),256))])):m(``,!0),V.value.y.labels.show?(S(),h(`g`,{key:4,ref_key:`yAxisScales`,ref:bn},[(S(!0),h(d,null,w(Q.value.tickY,e=>(S(),h(`text`,{x:Y.value.left+V.value.y.labels.offsetX-4-z.value.radius,y:e.y+X.value.yAxisLabels/3,fill:V.value.y.labels.color,"font-size":X.value.yAxisLabels,"text-anchor":`end`},E(D(l)(V.value.y.labels.formatter,e.value,D(c)({p:V.value.y.labels.prefix,v:e.value,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))),9,yt))),256))],512)):m(``,!0),V.value.y.name.text?(S(),h(`text`,{key:5,ref_key:`yAxisLabel`,ref:vn,transform:`translate(${X.value.yAxisName}, ${q.value.height/2+V.value.y.name.offsetY}), rotate(-90)`,"font-size":X.value.yAxisName,fill:V.value.y.name.color,"font-weight":V.value.y.name.bold?`bold`:`normal`,"text-anchor":`middle`},E(V.value.y.name.text),9,bt)):m(``,!0),B.value.horizontalLines.show?(S(),h(`g`,xt,[(S(!0),h(d,null,w(Q.value.tickY,e=>(S(),h(`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,St))),256))])):m(``,!0),V.value.x.labels.show?(S(),h(`g`,Ct,[(S(!0),h(d,null,w(Q.value.tickX,e=>(S(),h(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:e.x,x2:e.x,y1:Y.value.bottom,y2:Y.value.bottom+5},null,8,wt))),256))])):m(``,!0),V.value.x.labels.show?(S(),h(`g`,{key:8,ref_key:`xAxisScales`,ref:yn},[(S(!0),h(d,null,w(Q.value.tickX,e=>(S(),h(`text`,{class:`vue-ui-history-plot-x-axis-scale`,transform:`translate(${e.x}, ${Y.value.bottom+V.value.x.labels.offsetY+X.value.xAxisLabels+z.value.radius}), rotate(${V.value.x.labels.rotation})`,fill:V.value.x.labels.color,"font-size":X.value.xAxisLabels,"text-anchor":V.value.x.labels.rotation>0?`start`:V.value.x.labels.rotation<0?`end`:`middle`},E(D(l)(V.value.x.labels.formatter,e.value,D(c)({p:V.value.x.labels.prefix,v:e.value,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding}))),9,Tt))),256))],512)):m(``,!0),V.value.x.name.text?(S(),h(`text`,{key:9,ref_key:`xAxisLabel`,ref:_n,x:q.value.width/2+V.value.x.name.offsetX,y:q.value.height,"font-size":X.value.xAxisName,fill:V.value.x.name.color,"font-weight":V.value.x.name.bold?`bold`:`normal`,"text-anchor":`middle`},E(V.value.x.name.text),9,Et)):m(``,!0),B.value.xAxis.show?(S(),h(`line`,{key:10,x1:Y.value.left,x2:Y.value.left+Y.value.width,y1:Y.value.bottom,y2:Y.value.bottom,stroke:B.value.xAxis.stroke,"stroke-width":B.value.xAxis.strokeWidth,"stroke-linecap":`round`},null,8,Dt)):m(``,!0),B.value.yAxis.show?(S(),h(`line`,{key:11,x1:Y.value.left,x2:Y.value.left,y1:Y.value.top,y2:Y.value.bottom,stroke:B.value.yAxis.stroke,"stroke-width":B.value.yAxis.strokeWidth,"stroke-linecap":`round`},null,8,Ot)):m(``,!0),(S(!0),h(d,null,w(ar.value,e=>(S(),h(`g`,{key:`history_plot_serie_${e.seriesIndex}_${N.value}`},[H.value.paths.show?(S(),h(`g`,{key:0,style:x({opacity:xr(e.seriesIndex)})},[g(`path`,{class:y({"vue-data-ui-transition":D(U)&&!D(J)}),d:e.path,stroke:H.value.backgroundColor,"stroke-width":H.value.paths.strokeWidth+4,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,kt),g(`path`,{class:y({"vue-data-ui-transition":D(U)&&!D(J)}),d:e.path,stroke:br(e),"stroke-width":H.value.paths.strokeWidth,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,At)],4)):m(``,!0),(S(!0),h(d,null,w(e.plots,e=>(S(),h(`circle`,{cx:e.x,cy:e.y,fill:H.value.backgroundColor,r:X.value.plots,stroke:`none`,class:y({"vue-data-ui-transition":D(U)&&!D(J)})},null,10,jt))),256)),(S(!0),h(d,null,w(e.plots,t=>(S(),h(`circle`,{cx:t.x,cy:t.y,fill:gr(e,t,e.gradientIndex),r:X.value.plots,stroke:z.value.stroke,"stroke-width":z.value.strokeWidth,class:y({"vue-data-ui-transition":D(U)&&!D(J)}),style:x({opacity:xr(e.seriesIndex)})},null,14,Mt))),256)),z.value.labels.show?(S(),h(`g`,Nt,[(S(!0),h(d,null,w(e.plots,(t,n)=>(S(),h(`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-DPGnEuYM.js";import{$ as c,D as ne,Dt as re,Et as ie,Ft as ae,Ht as oe,J as se,Q as ce,S as le,T as ue,X as de,Zt as fe,_ as pe,at as me,i as l,in as he,nn as ge,nt as _e,qt as ve,r as ye,rn as u,t as be,tn as xe,w as Se,yt as Ce,zt as we}from"./lib-rPeBMZrn.js";import{n as Te,t as Ee}from"./useHints-C-TwxM0Y.js";import{t as De}from"./useConfig-_JwRfIqE.js";import{t as Oe}from"./useSvgLabelLayout-42Kats14.js";import{n as ke,t as Ae}from"./BaseScanner-8NdoBs7B.js";import{t as je}from"./usePrinter-DVf3YcG5.js";import{t as Me}from"./useNestedProp-DnGoh-XS.js";import{t as Ne}from"./useResponsive-CENUxfEL.js";import{t as Pe}from"./useThemeCheck-BKNRbGeC.js";import{t as Fe}from"./useChartExport-BZts4KFb.js";import{t as Ie}from"./useTransitions-ChGGrtrv.js";import{t as Le}from"./useUserOptionState-CXlFnwPv.js";import{t as Re}from"./useChartAccessibility-DOMuYJfm.js";import{t as ze}from"./useTimeLabelCollider-BTybMUFi.js";import{n as Be}from"./Title-BliHuXfT.js";import{t as Ve}from"./vue_ui_history_plot-C0kFJh-f.js";import{t as He}from"./Legend-W9YVYVX-.js";import{t as Ue}from"./A11yDataTable-DWNlWXzs.js";import{t as We}from"./BaseLegendToggle-VzX69MCo.js";import{t as Ge}from"./DefGrad-DKMq1REY.js";import{t as Ke}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as d,Teleport as qe,computed as f,createBlock as p,createCommentVNode as m,createElementBlock as h,createElementVNode as g,createSlots as Je,createTextVNode as Ye,createVNode as Xe,defineAsyncComponent as _,guardReactiveProps as v,mergeProps as Ze,nextTick as Qe,normalizeClass as y,normalizeProps as b,normalizeStyle as x,onBeforeUnmount as $e,onMounted as et,openBlock as S,ref as C,renderList as w,renderSlot as T,resolveDynamicComponent as tt,shallowRef as nt,toDisplayString as E,toRefs as rt,unref as D,watch as it,withCtx as O}from"vue";var at=/* @__PURE__ */ e({default:()=>Wt}),ot=[`id`],st=[`id`],ct=[`id`],lt={style:{position:`relative`}},ut=[`xmlns`,`viewBox`,`aria-describedby`],dt=[`x`,`y`,`width`,`height`],ft={key:1},pt=[`id`,`x1`,`y1`,`x2`,`y2`],mt=[`stop-color`,`offset`],ht={key:2},gt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],_t={key:3},vt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],yt=[`x`,`y`,`fill`,`font-size`],bt=[`transform`,`font-size`,`fill`,`font-weight`],xt={key:6},St=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Ct={key:7},wt=[`stroke`,`stroke-width`,`x1`,`x2`,`y1`,`y2`],Tt=[`transform`,`fill`,`font-size`,`text-anchor`],Et=[`x`,`y`,`font-size`,`fill`,`font-weight`],Dt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Ot=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],kt=[`d`,`stroke`,`stroke-width`],At=[`d`,`stroke`,`stroke-width`],jt=[`cx`,`cy`,`fill`,`r`],Mt=[`cx`,`cy`,`fill`,`r`,`stroke`,`stroke-width`],Nt={key:1},Pt=[`transform`,`font-size`,`fill`,`font-weight`],Ft=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],It={key:2},Lt=[`transform`,`font-size`,`font-weight`,`fill`],Rt=[`cx`,`cy`,`r`,`onMouseenter`,`onMouseleave`,`onClick`],zt={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Bt={key:5,class:`vue-data-ui-watermark`},Vt=[`id`],Ht=[`onClick`],Ut={style:{display:`flex`,"align-items":`center`}},Wt=/*#__PURE__*/ Ke({__name:`vue-ui-history-plot`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:Ke,emit:at}){let Wt=_(()=>import(`./Tooltip-C1q0Qoh7.js`)),Gt=_(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),Kt=_(()=>import(`./vue-ui-accordion-DxGxf-Rm.js`).then(e=>e.n)),qt=_(()=>import(`./DataTable-KeuZB1JM.js`)),Jt=_(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Yt=_(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Xt=_(()=>import(`./PackageVersion-PdpqwkYX.js`).then(e=>e.t)),Zt=_(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_history_plot:Qt}=De(),{isThemeValid:$t,warnInvalidTheme:en}=Pe(),k=e,A=C(null),tn=C(null),nn=C(0),rn=C(null),an=C(0),on=C(0),sn=C(0),j=nt(null),M=nt(null),cn=C(null),N=C(de()),ln=C(!1),un=C(``),P=C([]),dn=C(!1),F=C(null),fn=C(!1),pn=C(null),mn=C(!1),hn=C(null),gn=C(null),_n=C(null),vn=C(null),yn=C(null),bn=C(null),I=C(null),L=C(null),xn=C({x:0,y:0}),Sn=C(`pointer`),Cn=C(!1),wn=f({get:()=>!!k.dataset&&k.dataset.length,set:e=>e}),Tn=at,En=C(!1),Dn=0;et(()=>{mn.value=!0,kn()});let On=f(()=>R.value.debug);function kn(){we(k.dataset)?(me({componentName:`VueUiHistoryPlot`,type:`dataset`,debug:On.value}),Pn.value=!0):k.dataset.forEach((e,t)=>{Ce({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{wn.value=!1,me({componentName:`VueUiHistoryPlot`,type:`datasetSerieAttribute`,property:e,index:t,debug:On.value})})}),we(k.dataset)||(Pn.value=R.value.loading),R.value.responsive&&(j.value&&(M.value&&j.value.unobserve(M.value),j.value.disconnect()),j.value=new ResizeObserver(()=>{let{width:e,height:t}=Ne({chart:A.value,title:H.value.title.text?tn.value:null,noTitle:cn.value,legend:H.value.legend.show?rn.value:null,source:pn.value});cancelAnimationFrame(Dn),Dn=requestAnimationFrame(()=>{q.value.width=e,q.value.height=t,En.value=!0,R.value.responsiveProportionalSizing?(X.value.plots=u({relator:Math.min(e,t),adjuster:600,source:z.value.radius,threshold:3,fallback:3}),X.value.indexLabels=u({relator:Math.min(e,t),adjuster:600,source:z.value.indexLabels.fontSize,threshold:6,fallback:6}),X.value.labels=u({relator:Math.min(e,t),adjuster:600,source:z.value.labels.fontSize,threshold:6,fallback:6}),X.value.xAxisLabels=u({relator:Math.min(e,t),adjuster:600,source:V.value.x.labels.fontSize,threshold:6,fallback:6}),X.value.xAxisName=u({relator:Math.min(e,t),adjuster:600,source:V.value.x.name.fontSize,threshold:6,fallback:6}),X.value.yAxisLabels=u({relator:Math.min(e,t),adjuster:600,source:V.value.y.labels.fontSize,threshold:6,fallback:6}),X.value.yAxisName=u({relator:Math.min(e,t),adjuster:600,source:V.value.y.name.fontSize,threshold:6,fallback:6})):(X.value.plots=z.value.radius,X.value.indexLabels=z.value.indexLabels.fontSize,X.value.labels=z.value.labels.fontSize,X.value.xAxisLabels=V.value.x.labels.fontSize,X.value.xAxisName=V.value.x.name.fontSize,X.value.yAxisLabels=V.value.y.labels.fontSize,X.value.yAxisName=V.value.y.name.fontSize)})}),M.value=A.value.parentNode,j.value.observe(M.value))}$e(()=>{cancelAnimationFrame(Dn),j.value&&(M.value&&j.value.unobserve(M.value),j.value.disconnect())});function An(){let e=Me({userConfig:k.config,defaultConfig:Qt}),t={},n=e.theme;if(n){if(!$t.value(e))en(e),t=e;else{let r=Me({userConfig:Ve[n]||k.config,defaultConfig:e});t={...Me({userConfig:k.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:ge[n]||oe}}}else t=e;return t}let R=C(An()),z=f(()=>R.value.style.chart.plots),B=f(()=>R.value.style.chart.grid),V=f(()=>R.value.style.chart.axes),H=f(()=>R.value.style.chart);Te({config:()=>R.value,dataset:()=>k.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}=Ie({config:()=>R.value.transitions,dataset:()=>k.dataset}),W=f(()=>R.value.userOptions.useCursorPointer),jn=f(()=>he({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:R.value.skeletonConfig??{}})),{loading:Mn,FINAL_DATASET:Nn,manualLoading:Pn}=ke({...rt(k),FINAL_CONFIG:R,prepareConfig:An,skeletonDataset:k.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}]}],skeletonConfig:he({defaultConfig:R.value,userConfig:jn.value})}),{userOptionsVisible:Fn,setUserOptionsVisibility:In,keepUserOptionState:Ln}=Le({config:R.value}),{svgRef:G}=Re({config:H.value.title}),Rn=fe(k.config);it(()=>k.config,(e,t)=>{let n=fe(e),r=n!==Rn;Rn=n;let i=An();r?(Mn.value||(R.value=i),Fn.value=!R.value.userOptions.showOnChartHover,kn(),nn.value+=1,on.value+=1,an.value+=1,q.value.height=H.value.height,q.value.width=H.value.width,X.value.plots=z.value.radius,X.value.indexLabels=z.value.indexLabels.fontSize,X.value.labels=z.value.labels.fontSize,X.value.xAxisLabels=V.value.x.labels.fontSize,X.value.xAxisName=V.value.x.name.fontSize,X.value.yAxisLabels=V.value.y.labels.fontSize,X.value.yAxisName=V.value.y.name.fontSize,K.value.showTable=R.value.table.show,K.value.showTooltip=H.value.tooltip.show):(R.value.style.chart.tooltip=i.style.chart.tooltip,K.value.showTooltip=R.value.style.chart.tooltip.show)},{deep:!0}),it(()=>k.dataset,e=>{Array.isArray(e)&&e.length>0&&(Pn.value=!1)},{deep:!0});let{isPrinting:zn,isImaging:Bn,generatePdf:Vn,generateImage:Hn}=je({elementId:`history_plot_${N.value}`,fileName:H.value.title.text||`vue-ui-history-plot`,options:R.value.userOptions.print}),Un=f(()=>R.value.userOptions.show&&!H.value.title.text),Wn=f(()=>Se(R.value.customPalette)),K=C({showTable:R.value.table.show,showTooltip:H.value.tooltip.show});it(R,()=>{K.value={showTable:R.value.table.show,showTooltip:H.value.tooltip.show}},{immediate:!0});let q=C({height:H.value.height,width:H.value.width}),Gn=f(()=>q.value.width),Kn=f(()=>q.value.height),{metrics:qn,ready:Jn,settling:J,update:Yn}=Oe({svgRef:G,canMeasure:()=>!R.value.responsive||En.value,initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(bn.value).textWidth,yAxisLabelWidth:e(vn.value).rotatedWidth,xAxisLabelHeight:e(_n.value).height,timeLabelsHeight:e(yn.value).height})});function Xn(){let e=qn.value.scaleLabelsWidth,t=qn.value.yAxisLabelWidth;return e+t+(t?24:0)}let Zn=f(()=>qn.value.xAxisLabelHeight+qn.value.timeLabelsHeight+(_n.value?X.value.xAxisName/2:0)),Y=f(()=>{let e=H.value.padding.left,t=H.value.padding.top,n=Xn(),r=z.value.radius;return{left:e+n+V.value.y.name.offsetX,top:t+r,right:q.value.width-H.value.padding.right-r-V.value.y.name.offsetX,bottom:q.value.height-H.value.padding.bottom-Zn.value-r-V.value.x.name.offsetY,width:q.value.width-e-H.value.padding.right-n-r-V.value.y.name.offsetX,height:q.value.height-t-H.value.padding.bottom-Zn.value-r*2-V.value.x.name.offsetY}}),X=C({plots:z.value.radius,indexLabels:z.value.indexLabels.fontSize,labels:z.value.labels.fontSize,xAxisLabels:V.value.x.labels.fontSize,xAxisName:V.value.x.name.fontSize,yAxisLabels:V.value.y.labels.fontSize,yAxisName:V.value.y.name.fontSize}),Z=f(()=>Nn.value.map((e,t)=>{let n=Array.isArray(e.temperatureColors)&&e.temperatureColors.length?e.temperatureColors.map(e=>le(e)):void 0;return{...e,color:e.color?le(e.color):Wn.value[t]||oe[t]||oe[t%oe.length],temperatureColors:n,temperatureAngle:Qn(e.temperatureAngle),temperatureIndependant:e.temperatureIndependant===!0,usePlotTemperatureColors:e.usePlotTemperatureColors!==!1,seriesIndex:t}}));function Qn(e=0){let t=Number(e);return Number.isFinite(t)?(t%360+360)%360:0}let $n=f(()=>Math.max(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.x)))),er=f(()=>{let e=Math.min(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.x)));return e<0?e:0}),tr=f(()=>Math.max(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.y)))),nr=f(()=>{let e=Math.min(...Z.value.filter(e=>!P.value.includes(e.seriesIndex)).flatMap(e=>e.values.map(e=>e.y)));return e<0?e:0}),Q=f(()=>{let e=pe(V.value.x.scaleMin??er.value,V.value.x.scaleMax??$n.value,V.value.x.ticks),t=pe(V.value.y.scaleMin??nr.value,V.value.y.scaleMax??tr.value,V.value.y.ticks);return{x:e,y:t,tickX:e.ticks.map(t=>({x:Y.value.left+(t-e.min)/(e.max-e.min)*Y.value.width,y1:Y.value.top,y2:Y.value.bottom,value:t})),tickY:t.ticks.map(e=>({y:Y.value.bottom-(e-t.min)/(t.max-t.min)*Y.value.height,x1:Y.value.left,x2:Y.value.right,value:e}))}});function rr(e){let t=Q.value.x.min<0?Math.abs(Q.value.x.min):Q.value.x.min>0?-Q.value.x.min:0;return Y.value.left+((e||0)+t)/(Q.value.x.max+t)*Y.value.width}function ir(e){let t=Q.value.y.min<0?Math.abs(Q.value.y.min):Q.value.y.min>0?-Q.value.y.min:0;return Y.value.bottom-((e||0)+t)/(Q.value.y.max+t)*Y.value.height}let $=f(()=>Z.value.filter(e=>!P.value.includes(e.seriesIndex)).map((e,t)=>{let n=e.values.map((t,n)=>({valueX:t.x,valueY:t.y,label:t.label,x:rr(t.x),y:ir(t.y),color:e.color,seriesName:e.name,id:de()})),r=e.smooth?ue(n):n.map(e=>`${e.x},${e.y} `).join(``).trim();return{...e,gradientIndex:t,plots:n,path:`M${r}`}})),ar=f(()=>{if(F.value===null||I.value===null)return $.value;let e=$.value.findIndex(e=>e.seriesIndex===I.value);if(e===-1)return $.value;let t=$.value[e];return[...$.value.slice(0,e),...$.value.slice(e+1),t]}),or=f(()=>$.value.some(e=>sr(e)));function sr(e){return Array.isArray(e?.temperatureColors)&&e.temperatureColors.length}function cr(e){return sr(e)&&e.usePlotTemperatureColors}function lr(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=t.map(e=>e.x),r=t.map(e=>e.y),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r);return{minX:i,maxX:a,minY:o,maxY:s,width:a-i,height:s-o}}function ur(){let e=Y.value;return{minX:e.left,maxX:e.right,minY:e.top,maxY:e.bottom,width:e.width,height:e.height}}function dr(e){return e?.temperatureIndependant?lr(e):ur()}function fr(e){let t=Qn(e?.temperatureAngle)*Math.PI/180,n=Math.sin(t),r=Math.cos(t),i=dr(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}}function pr(e,t){let{x1:n,y1:r,x2:i,y2:a}=fr(e),o=i-n,s=a-r,ee=o*o+s*s;if(!ee)return 0;let te=((t.x-n)*o+(t.y-r)*s)/ee;return Math.min(1,Math.max(0,te))}function mr(e,t){return ie({colors:e.temperatureColors,ratio:pr(e,t)})}function hr(e,t){return`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${N.value}`}function gr(e,t,n){return cr(e)?z.value.gradient.show?`url(#${hr(e,t)})`:mr(e,t):z.value.gradient.show?`url(#gradient_${n}_${N.value})`:t.color}function _r(e,t){return cr(e)?mr(e,t):e.color}function vr(e,t){return z.value.indexLabels.adaptColorToBackground?ye(_r(e,t)):z.value.indexLabels.color}function yr(e,t){let n=$.value.find(t=>t.seriesIndex===e);return n&&cr(n)?mr(n,t):t.color}function br(e){return sr(e)?`url(#temperature_grad_history_${e.seriesIndex}_${N.value})`:H.value.paths.useSerieColor?e.color:H.value.paths.stroke}function xr(e){return F.value===null||I.value===e?1:Math.min(1,z.value.unselectedOpacity)}f(()=>F.value!==null&&I.value!==null);let Sr=C(!1);function Cr(){P.value.length?P.value=[]:Or.value.forEach(e=>{P.value.push(e.seriesIndex)}),Tn(`selectLegend`,$.value)}function wr(e){P.value.includes(e)?P.value=P.value.filter(t=>t!==e):P.value.push(e),Tn(`selectLegend`,$.value)}function Tr(e){return Z.value.length?Z.value.find(t=>t.name===e)||(On.value&&console.warn(`VueUiHistoryPlot - Series name not found "${e}"`),null):(On.value&&console.warn(`VueUiHistoryPlot - There are no series to show.`),null)}function Er(e){let t=Tr(e);t!==null&&P.value.includes(t.seriesIndex)&&wr(t.seriesIndex)}function Dr(e){let t=Tr(e);t!==null&&(P.value.includes(t.seriesIndex)||wr(t.seriesIndex))}let Or=f(()=>Z.value.map(e=>{let t=sr(e)?e.temperatureColors:null;return{...e,gradientColors:t,opacity:P.value.includes(e.seriesIndex)?.5:1,segregate:()=>wr(e.seriesIndex),isSegregated:P.value.includes(e.seriesIndex),shape:t?`gradient`:`circle`}})),kr=f(()=>({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 Ar({datapoint:e,plotIndex:t,seriesIndex:n}){R.value.events.datapointClick&&R.value.events.datapointClick({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),Tn(`selectDatapoint`,e)}function jr(e){dn.value=e,sn.value+=1}let Mr=C(null);function Nr({datapoint:e,plotIndex:t,seriesIndex:n}){R.value.events.datapointLeave&&R.value.events.datapointLeave({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),(Sn.value!==`keyboard`||I.value!==n||L.value!==t)&&(ln.value=!1,F.value=null)}function Pr(e,t){if(!G.value)return;let n=$.value.find(t=>t.seriesIndex===e);if(!n)return;let r=n.plots[t];if(!r)return;let i=xe(r.x,r.y,G.value);i&&(xn.value=i)}function Fr({datapoint:e,plotIndex:t,seriesIndex:n,triggerMode:r=`pointer`}){R.value.events.datapointEnter&&R.value.events.datapointEnter({datapoint:{...e,plotIndex:t,seriesIndex:n},seriesIndex:n}),I.value=n,L.value=t,Sn.value=r,Sr.value=!0;let i=yr(n,e),a={...e,color:i};Mr.value={datapoint:a,color:i,seriesIndex:n,plotIndex:t,config:R.value,series:Z.value},F.value=e;let o=H.value.tooltip.customFormat;if(fn.value=!1,re(o))try{let e=o({seriesIndex:n,datapoint:a,color:i,plotIndex:t,series:Z.value,config:R.value});typeof e==`string`&&(un.value=e,fn.value=!0)}catch{console.warn(`Custom format cannot be applied.`),fn.value=!1}if(!fn.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="${i}"/></svg><span>${e.seriesName}</span></div>`,t+=`<div>${e.label}</div>`,t+=`<div>${V.value.x.name.text||`x`}: ${l(V.value.x.labels.formatter,e.valueX,c({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`}: ${l(V.value.y.labels.formatter,e.valueY,c({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))}</div>`,un.value=`<div>${t}</div>`}ln.value=!0,r===`keyboard`&&Qe(()=>{Pr(n,t)})}f(()=>({head:$.value.map(e=>({name:e.name,color:e.color}))}));let Ir=f(()=>{let e=[R.value.table.columnNames.series,R.value.table.columnNames.datapoint,R.value.table.columnNames.x,R.value.table.columnNames.y];return{head:e,body:$.value.flatMap(e=>e.plots.map(e=>[{color:e.color,name:e.seriesName},e.label,l(V.value.x.labels.formatter,e.valueX,c({p:V.value.x.labels.prefix,v:e.valueX,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding})),l(V.value.y.labels.formatter,e.valueY,c({p:V.value.y.labels.prefix,v:e.valueY,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))])),config:{th:{backgroundColor:R.value.table.th.backgroundColor,color:R.value.table.th.color,outline:R.value.table.th.outline},td:{backgroundColor:R.value.table.td.backgroundColor,color:R.value.table.td.color,outline:R.value.table.td.outline},breakpoint:R.value.table.responsiveBreakpoint},colNames:e}});function Lr(e=null){Qe(()=>{let t=[[R.value.table.columnNames.series],[R.value.table.columnNames.datapoint],[R.value.table.columnNames.x],[R.value.table.columnNames.y]],n=$.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=ne(r);e?e(i):_e({csvContent:i,title:H.value.title.text||`vue-ui-history-plot`})})}let Rr=C(!1);function zr(){Rr.value=!Rr.value}function Br(){K.value.showTable=!K.value.showTable}function Vr(){K.value.showTooltip=!K.value.showTooltip}function Hr(){return $.value}let Ur=te(A,()=>H.value.title.text),Wr=f(()=>Q.value.tickX),Gr=f(()=>({start:0,end:Q.value.tickX.length}));ze({timeLabelsEls:yn,timeLabels:Wr,slicer:Gr,configRef:R,rotationPath:[`style`,`chart`,`axes`,`x`,`labels`,`rotation`],autoRotatePath:[`style`,`chart`,`axes`,`x`,`labels`,`autoRotate`,`enable`],isAutoSize:!1,width:Gn,height:Kn,targetClass:`.vue-ui-history-plot-x-axis-scale`,rotation:V.value.x.labels.autoRotate.angle});let Kr=f(()=>ee({config:R,style:H,mutableConfig:K,dialog:Zt,accordion:Kt,isFullscreen:dn,parent:A,maxWidth:800}));it(()=>K.value.showTable,e=>s(e,R,hn));function qr(){K.value.showTable=!1,gn.value&&gn.value.setTableIconState(!1)}let Jr=f(()=>H.value.backgroundColor),Yr=f(()=>H.value.legend),Xr=f(()=>H.value.title),{isCallbackImaging:Zr,isCallbackSvg:Qr,generateSvg:$r,onGenerateImage:ei}=Fe({svg:G,title:Xr,legend:Yr,legendItems:Or,backgroundColor:Jr,getSvgCallback:()=>R.value.userOptions.callbacks.svg,generateImage:Hn});async function ti(){Tn(`copyAlt`,{config:R.value,dataset:$.value}),R.value.userOptions.callbacks.altCopy?await Promise.resolve(R.value.userOptions.callbacks.altCopy({config:R.value,dataset:$.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let ni=f(()=>({head:Ir.value.head,body:Ir.value.body.map(e=>[e[0]?.name||``,e[1],e[2],e[3]]),caption:R.value.a11y.translations.tableCaption,notice:R.value.a11y.translations.tableAvailable}));function ri(e){return $.value.findIndex(t=>t.seriesIndex===e)}function ii(){if(I.value!==null&&L.value!==null){let e=$.value.find(e=>e.seriesIndex===I.value)?.plots?.[L.value];e&&Nr({datapoint:e,plotIndex:L.value,seriesIndex:I.value})}I.value=null,L.value=null,Sn.value=`pointer`,ln.value=!1,F.value=null}function ai(){I.value=null,L.value=null,Cn.value=!0}function oi(){ii(),Cn.value=!1}function si(e,t){if(!e?.plots?.length)return null;let n=e.plots.length;return(t%n+n)%n}function ci({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=si(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 li(e){if(!G.value||Rr.value||document.activeElement!==G.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){ii();return}if(a){if(I.value===null||L.value===null)return;let e=$.value.find(e=>e.seriesIndex===I.value)?.plots?.[L.value];if(!e)return;Ar({datapoint:e,plotIndex:L.value,seriesIndex:I.value});return}let s=null;if(I.value===null||L.value===null){let e=$.value[0];if(!e?.plots?.length)return;s={seriesIndex:e.seriesIndex,plotIndex:0}}else r?s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`up`}):i?s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`down`}):t?s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`left`}):n&&(s=ci({seriesIndex:I.value,plotIndex:L.value,direction:`right`}));if(!s)return;let ee=$.value.find(e=>e.seriesIndex===s.seriesIndex)?.plots?.[s.plotIndex];ee&&Fr({datapoint:ee,plotIndex:s.plotIndex,seriesIndex:s.seriesIndex,triggerMode:`keyboard`})}return Ke({getData:Hr,getImage:Ur,generatePdf:Vn,generateCsv:Lr,generateImage:Hn,generateSvg:$r,hideSeries:Dr,showSeries:Er,toggleTable:Br,toggleTooltip:Vr,toggleAnnotator:zr,toggleFullscreen:jr,copyAlt:ti}),it(()=>[q.value,X.value,V.value,H.value,R.value.style.fontFamily,k.dataset,En.value,bn.value,yn.value,_n.value,vn.value],Yn,{flush:`post`,deep:!0}),(e,s)=>(S(),h(`div`,{id:`history_plot_${N.value}`,ref_key:`historyPlotChart`,ref:A,class:y({"vue-data-ui-component":!0,"vue-ui-history-plot":!0,"vue-data-ui-wrapper-fullscreen":dn.value}),style:x(`background:${H.value.backgroundColor};color:${H.value.color};font-family:${R.value.style.fontFamily}; position: relative; ${R.value.responsive?`height: 100%`:``}`),onMouseenter:s[2]||=()=>D(In)(!0),onMouseleave:s[3]||=()=>D(In)(!1)},[g(`div`,{id:`chart-instructions-${N.value}`,class:`sr-only`},[g(`p`,null,E(R.value.a11y.translations.keyboardNavigation),1)],8,st),ni.value.body.length?(S(),p(Ue,{key:0,uid:N.value,head:ni.value.head,body:ni.value.body,caption:ni.value.caption,notice:ni.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):m(``,!0),T(e.$slots,`userConfig`,{},void 0,!0),R.value.userOptions.buttons.annotator?(S(),p(D(Jt),Ze({key:1},D(a)(R.value.userOptions.annotator),{svgRef:D(G),backgroundColor:H.value.backgroundColor,color:H.value.color,active:Rr.value,isCursorPointer:W.value,palette:R.value.userOptions.annotatorPalette,onClose:zr}),Je({_:2},[w(D(o),t=>({name:t,fn:O(n=>[T(e.$slots,t,b(v(D(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):m(``,!0),Un.value?(S(),h(`div`,{key:2,ref_key:`noTitle`,ref:cn,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):m(``,!0),H.value.title.text?(S(),h(`div`,{key:3,ref_key:`chartTitle`,ref:tn,class:`vue-ui-xy-title`,style:x(`font-family:${R.value.style.fontFamily}`)},[(S(),p(Be,{key:`title_${nn.value}`,config:{title:{cy:`history-plot-div-title`,...H.value.title},subtitle:{cy:`history-plot-div-subtitle`,...H.value.title.subtitle}}},null,8,[`config`]))],4)):m(``,!0),g(`div`,{id:`legend-top-${N.value}`},null,8,ct),R.value.userOptions.show&&wn.value&&(D(Ln)||D(Fn))?(S(),p(D(Yt),Ze({ref_key:`userOptionsRef`,ref:gn,key:`user_option_${sn.value}`,backgroundColor:H.value.backgroundColor,color:H.value.color,isPrinting:D(zn),isImaging:D(Bn),uid:N.value,hasTooltip:H.value.tooltip.show&&R.value.userOptions.buttons.tooltip,hasLabel:!1,isFullscreen:dn.value,chartElement:A.value},D(n)(R.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isTooltip:K.value.showTooltip,isAnnotation:Rr.value,tableDialog:R.value.table.useDialog,isCursorPointer:W.value,onToggleFullscreen:jr,onGeneratePdf:D(Vn),onGenerateCsv:Lr,onGenerateImage:D(ei),onGenerateSvg:D($r),onToggleTable:Br,onToggleTooltip:Vr,onToggleAnnotator:zr,onCopyAlt:ti,style:{visibility:D(Ln)?D(Fn)?`visible`:`hidden`:`visible`}}),Je({_:2},[w(D(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:O(n=>[T(e.$slots,t,b(v(D(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`hasTooltip`,`isFullscreen`,`chartElement`,`isTooltip`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):m(``,!0),g(`div`,lt,[(S(),h(`svg`,{ref_key:`svgRef`,ref:G,xmlns:D(be),viewBox:`0 0 ${q.value.width<0?.1:q.value.width} ${q.value.height<0?.1:q.value.height}`,style:x(`max-width:100%;overflow:visible;background:transparent;color:${H.value.color};visibility:${D(Jn)?`visible`:`hidden`}`),"aria-describedby":`chart-instructions-${N.value}`,tabindex:`0`,onFocus:ai,onBlur:oi,onKeydown:li},[Xe(D(Xt)),T(e.$slots,`svg-underlayer`,{svg:{...q.value,drawingArea:Y.value,isPrintingImg:D(zn)||D(Bn)||D(Zr),isPrintingSvg:D(Qr)}},void 0,!0),e.$slots[`chart-background`]?(S(),h(`foreignObject`,{key:0,x:Y.value.left,y:Y.value.top,width:Y.value.width<=0?10:Y.value.width,height:Y.value.height<=0?10:Y.value.height,style:{pointerEvents:`none`}},[T(e.$slots,`chart-background`,{},void 0,!0)],8,dt)):m(``,!0),z.value.gradient.show||or.value?(S(),h(`defs`,ft,[z.value.gradient.show?(S(!0),h(d,{key:0},w($.value,(e,t)=>(S(),p(Ge,{t:`radial`,key:`gradient_${t}_${N.value}`,id:`gradient_${t}_${N.value}`,fy:`30%`,stops:[[`10%`,D(ae)(e.color,z.value.gradient.intensity/100),1],[`90%`,D(ce)(e.color,.1),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128)):m(``,!0),(S(!0),h(d,null,w($.value,e=>(S(),h(d,{key:`temperature_grad_history_template_${e.seriesIndex}_${N.value}`},[z.value.gradient.show&&cr(e)?(S(!0),h(d,{key:0},w(e.plots,t=>(S(),p(Ge,{t:`radial`,key:`temperature_plot_grad_history_${e.seriesIndex}_${t.id}_${N.value}`,id:hr(e,t),fy:`30%`,stops:[[`10%`,D(ae)(mr(e,t),z.value.gradient.intensity/100),1],[`90%`,D(ce)(mr(e,t),.1),1],[`100%`,mr(e,t),1]]},null,8,[`id`,`stops`]))),128)):m(``,!0),sr(e)?(S(),h(`linearGradient`,{key:1,id:`temperature_grad_history_${e.seriesIndex}_${N.value}`,gradientUnits:`userSpaceOnUse`,x1:fr(e).x1,y1:fr(e).y1,x2:fr(e).x2,y2:fr(e).y2},[(S(!0),h(d,null,w(e.temperatureColors,(t,n)=>(S(),h(`stop`,{key:`temperature_grad_history_stop_${e.seriesIndex}_${n}_${N.value}`,"stop-color":t,offset:e.temperatureColors.length===1?`0%`:D(ve)(n,e.temperatureColors.length)},null,8,mt))),128))],8,pt)):m(``,!0)],64))),128))])):m(``,!0),B.value.verticalLines.show?(S(),h(`g`,ht,[(S(!0),h(d,null,w(Q.value.tickX,e=>(S(),h(`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,gt))),256))])):m(``,!0),V.value.y.labels.show?(S(),h(`g`,_t,[(S(!0),h(d,null,w(Q.value.tickY,e=>(S(),h(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:Y.value.left-5,x2:Y.value.left,y1:e.y,y2:e.y},null,8,vt))),256))])):m(``,!0),V.value.y.labels.show?(S(),h(`g`,{key:4,ref_key:`yAxisScales`,ref:bn},[(S(!0),h(d,null,w(Q.value.tickY,e=>(S(),h(`text`,{x:Y.value.left+V.value.y.labels.offsetX-4-z.value.radius,y:e.y+X.value.yAxisLabels/3,fill:V.value.y.labels.color,"font-size":X.value.yAxisLabels,"text-anchor":`end`},E(D(l)(V.value.y.labels.formatter,e.value,D(c)({p:V.value.y.labels.prefix,v:e.value,s:V.value.y.labels.suffix,r:V.value.y.labels.rounding}))),9,yt))),256))],512)):m(``,!0),V.value.y.name.text?(S(),h(`text`,{key:5,ref_key:`yAxisLabel`,ref:vn,transform:`translate(${X.value.yAxisName}, ${q.value.height/2+V.value.y.name.offsetY}), rotate(-90)`,"font-size":X.value.yAxisName,fill:V.value.y.name.color,"font-weight":V.value.y.name.bold?`bold`:`normal`,"text-anchor":`middle`},E(V.value.y.name.text),9,bt)):m(``,!0),B.value.horizontalLines.show?(S(),h(`g`,xt,[(S(!0),h(d,null,w(Q.value.tickY,e=>(S(),h(`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,St))),256))])):m(``,!0),V.value.x.labels.show?(S(),h(`g`,Ct,[(S(!0),h(d,null,w(Q.value.tickX,e=>(S(),h(`line`,{stroke:B.value.verticalLines.stroke,"stroke-width":B.value.verticalLines.strokeWidth,"stroke-linecap":`round`,x1:e.x,x2:e.x,y1:Y.value.bottom,y2:Y.value.bottom+5},null,8,wt))),256))])):m(``,!0),V.value.x.labels.show?(S(),h(`g`,{key:8,ref_key:`xAxisScales`,ref:yn},[(S(!0),h(d,null,w(Q.value.tickX,e=>(S(),h(`text`,{class:`vue-ui-history-plot-x-axis-scale`,transform:`translate(${e.x}, ${Y.value.bottom+V.value.x.labels.offsetY+X.value.xAxisLabels+z.value.radius}), rotate(${V.value.x.labels.rotation})`,fill:V.value.x.labels.color,"font-size":X.value.xAxisLabels,"text-anchor":V.value.x.labels.rotation>0?`start`:V.value.x.labels.rotation<0?`end`:`middle`},E(D(l)(V.value.x.labels.formatter,e.value,D(c)({p:V.value.x.labels.prefix,v:e.value,s:V.value.x.labels.suffix,r:V.value.x.labels.rounding}))),9,Tt))),256))],512)):m(``,!0),V.value.x.name.text?(S(),h(`text`,{key:9,ref_key:`xAxisLabel`,ref:_n,x:q.value.width/2+V.value.x.name.offsetX,y:q.value.height,"font-size":X.value.xAxisName,fill:V.value.x.name.color,"font-weight":V.value.x.name.bold?`bold`:`normal`,"text-anchor":`middle`},E(V.value.x.name.text),9,Et)):m(``,!0),B.value.xAxis.show?(S(),h(`line`,{key:10,x1:Y.value.left,x2:Y.value.left+Y.value.width,y1:Y.value.bottom,y2:Y.value.bottom,stroke:B.value.xAxis.stroke,"stroke-width":B.value.xAxis.strokeWidth,"stroke-linecap":`round`},null,8,Dt)):m(``,!0),B.value.yAxis.show?(S(),h(`line`,{key:11,x1:Y.value.left,x2:Y.value.left,y1:Y.value.top,y2:Y.value.bottom,stroke:B.value.yAxis.stroke,"stroke-width":B.value.yAxis.strokeWidth,"stroke-linecap":`round`},null,8,Ot)):m(``,!0),(S(!0),h(d,null,w(ar.value,e=>(S(),h(`g`,{key:`history_plot_serie_${e.seriesIndex}_${N.value}`},[H.value.paths.show?(S(),h(`g`,{key:0,style:x({opacity:xr(e.seriesIndex)})},[g(`path`,{class:y({"vue-data-ui-transition":D(U)&&!D(J)}),d:e.path,stroke:H.value.backgroundColor,"stroke-width":H.value.paths.strokeWidth+4,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,kt),g(`path`,{class:y({"vue-data-ui-transition":D(U)&&!D(J)}),d:e.path,stroke:br(e),"stroke-width":H.value.paths.strokeWidth,fill:`none`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,At)],4)):m(``,!0),(S(!0),h(d,null,w(e.plots,e=>(S(),h(`circle`,{cx:e.x,cy:e.y,fill:H.value.backgroundColor,r:X.value.plots,stroke:`none`,class:y({"vue-data-ui-transition":D(U)&&!D(J)})},null,10,jt))),256)),(S(!0),h(d,null,w(e.plots,t=>(S(),h(`circle`,{cx:t.x,cy:t.y,fill:gr(e,t,e.gradientIndex),r:X.value.plots,stroke:z.value.stroke,"stroke-width":z.value.strokeWidth,class:y({"vue-data-ui-transition":D(U)&&!D(J)}),style:x({opacity:xr(e.seriesIndex)})},null,14,Mt))),256)),z.value.labels.show?(S(),h(`g`,Nt,[(S(!0),h(d,null,w(e.plots,(t,n)=>(S(),h(`g`,{key:`plab_${n}`},[String(t.label).includes(`
|
|
2
2
|
`)?(S(),h(`text`,{key:1,class:y({"vue-data-ui-transition":D(U)&&!D(J)}),transform:`translate(${t.x+z.value.labels.offsetX}, ${t.y+z.value.labels.offsetY+X.value.plots+X.value.labels})`,"font-size":X.value.labels,fill:z.value.labels.color,"font-weight":z.value.labels.bold?`bold`:`normal`,"text-anchor":`middle`,style:x({opacity:xr(e.seriesIndex)}),innerHTML:D(se)({content:String(t.label),fontSize:X.value.labels,fill:z.value.labels.color,x:0,y:0})},null,14,Ft)):(S(),h(`text`,{key:0,class:y({"vue-data-ui-transition":D(U)&&!D(J)}),transform:`translate(${t.x+z.value.labels.offsetX}, ${t.y+z.value.labels.offsetY+X.value.plots+X.value.labels})`,"font-size":X.value.labels,fill:z.value.labels.color,"font-weight":z.value.labels.bold?`bold`:`normal`,"text-anchor":`middle`,style:x({opacity:xr(e.seriesIndex)})},E(t.label),15,Pt))]))),128))])):m(``,!0),z.value.indexLabels.show?(S(),h(`g`,It,[(S(!0),h(d,null,w(e.plots,(t,n)=>(S(),h(`text`,{key:`lab_${n}`,class:y({"vue-data-ui-transition":D(U)&&!D(J)}),transform:`translate(${t.x+z.value.indexLabels.offsetX}, ${t.y+z.value.indexLabels.offsetY+X.value.indexLabels/3})`,"font-size":X.value.indexLabels,"font-weight":z.value.indexLabels.bold?`bold`:`normal`,fill:vr(e,t),"text-anchor":`middle`,style:x({opacity:xr(e.seriesIndex)})},E(z.value.indexLabels.startAtZero?n:n+1),15,Lt))),128))])):m(``,!0)]))),128)),(S(!0),h(d,null,w(ar.value,e=>(S(),h(`g`,{key:`history_plot_trap_serie_${e.seriesIndex}_${N.value}`},[(S(!0),h(d,null,w(e.plots,(t,n)=>(S(),h(`circle`,{cx:t.x,cy:t.y,fill:`transparent`,r:X.value.plots,stroke:`none`,onMouseenter:r=>Fr({datapoint:t,plotIndex:n,seriesIndex:e.seriesIndex,triggerMode:`pointer`}),onMouseleave:r=>Nr({datapoint:t,plotIndex:n,seriesIndex:e.seriesIndex}),onClick:r=>Ar({datapoint:t,plotIndex:n,seriesIndex:e.seriesIndex})},null,40,Rt))),256))]))),128)),T(e.$slots,`svg`,{svg:{...q.value,drawingArea:Y.value,isPrintingImg:D(zn)||D(Bn)||D(Zr),isPrintingSvg:D(Qr)}},void 0,!0)],44,ut)),e.$slots.hint?(S(),h(`div`,zt,[T(e.$slots,`hint`,b(v({hint:R.value.a11y.translations.keyboardNavigation,isVisible:Cn.value})),void 0,!0)])):m(``,!0)]),e.$slots.watermark?(S(),h(`div`,Bt,[T(e.$slots,`watermark`,b(v({isPrinting:D(zn)||D(Bn)||D(Zr)||D(Qr)})),void 0,!0)])):m(``,!0),g(`div`,{id:`legend-bottom-${N.value}`},null,8,Vt),mn.value&&(H.value.legend.show||e.$slots.legend)?(S(),p(qe,{key:6,to:H.value.legend.position===`top`?`#legend-top-${N.value}`:`#legend-bottom-${N.value}`},[g(`div`,{ref_key:`chartLegend`,ref:rn},[T(e.$slots,`legend`,{legend:Or.value},()=>[H.value.legend.show&&wn.value?(S(),p(He,{key:`legend_${an.value}`,legendSet:Or.value,config:kr.value,isCursorPointer:W.value,onClickMarker:s[0]||=({legend:e})=>{wr(e.seriesIndex)}},{item:O(({legend:e,index:t})=>[g(`div`,{onClick:t=>e.segregate(),style:x(`opacity:${P.value.includes(e.seriesIndex)?.5:1}`)},E(e.name),13,Ht)]),legendToggle:O(()=>[Or.value.length>2&&H.value.legend.selectAllToggle.show&&!D(Mn)?(S(),p(We,{key:0,backgroundColor:H.value.legend.selectAllToggle.backgroundColor,color:H.value.legend.selectAllToggle.color,fontSize:H.value.legend.fontSize,checked:P.value.length>0,isCursorPointer:W.value,onToggle:Cr},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):m(``,!0)]),_:1},8,[`legendSet`,`config`,`isCursorPointer`])):m(``,!0)],!0)],512)],8,[`to`])):m(``,!0),e.$slots.source?(S(),h(`div`,{key:7,ref_key:`source`,ref:pn,dir:`auto`},[T(e.$slots,`source`,{},void 0,!0)],512)):m(``,!0),Xe(D(Wt),{teleportTo:H.value.tooltip.teleportTo,show:K.value.showTooltip&&ln.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:A.value,content:un.value,isCustom:fn.value,isFullscreen:dn.value,smooth:H.value.tooltip.smooth,backdropFilter:H.value.tooltip.backdropFilter,smoothForce:H.value.tooltip.smoothForce,smoothSnapThreshold:H.value.tooltip.smoothSnapThreshold,isA11yMode:Sn.value===`keyboard`,a11yPosition:xn.value},{"tooltip-before":O(()=>[T(e.$slots,`tooltip-before`,b(v({...Mr.value})),void 0,!0)]),tooltip:O(()=>[T(e.$slots,`tooltip`,b(v({...Mr.value})),void 0,!0)]),"tooltip-after":O(()=>[T(e.$slots,`tooltip-after`,b(v({...Mr.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`]),wn.value&&R.value.userOptions.buttons.table?(S(),p(tt(Kr.value.component),Ze({key:8},Kr.value.props,{ref_key:`tableUnit`,ref:hn,onClose:qr}),Je({content:O(()=>[(S(),p(D(qt),{key:`table_${on.value}`,colNames:Ir.value.colNames,head:Ir.value.head,body:Ir.value.body,config:Ir.value.config,title:R.value.table.useDialog?``:Kr.value.title,withCloseButton:!R.value.table.useDialog,isCursorPointer:W.value,onClose:qr},{th:O(({th:e})=>[g(`div`,Ut,E(e),1)]),td:O(({td:e})=>[Ye(E(e.name||e),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`]))]),_:2},[R.value.table.useDialog?{name:`title`,fn:O(()=>[Ye(E(Kr.value.title),1)]),key:`0`}:void 0,R.value.table.useDialog?{name:`actions`,fn:O(()=>[g(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[1]||=e=>Lr(R.value.userOptions.callbacks.csv),style:x({cursor:W.value?`pointer`:`default`})},[Xe(D(Gt),{name:`fileCsv`,stroke:Kr.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):m(``,!0),T(e.$slots,`skeleton`,{},()=>[D(Mn)?(S(),p(Ae,{key:0})):m(``,!0)],!0)],46,ot))}},[[`__scopeId`,`data-v-4f8ecec6`]]);export{at as n,Wt 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 re,J as ie,Jt as ae,S as oe,X as se,Yt as ce,Zt as le,at as ue,b as u,i as de,in as fe,nn as pe,nt as me,pt as he,t as ge,tn as _e,vt as ve,w as ye,wt as be,zt as xe}from"./lib-rPeBMZrn.js";import{c as Se}from"./canvas-lib-22VpOI4_.js";import{n as Ce,t as we}from"./useHints-C-TwxM0Y.js";import{t as Te}from"./useConfig-_JwRfIqE.js";import{n as Ee,t as De}from"./BaseScanner-8NdoBs7B.js";import{t as Oe}from"./usePrinter-DVf3YcG5.js";import{t as ke}from"./useResponsive-CENUxfEL.js";import{t as Ae}from"./useNestedProp-DnGoh-XS.js";import{t as je}from"./useThemeCheck-BKNRbGeC.js";import{t as Me}from"./useChartExport-BZts4KFb.js";import{t as Ne}from"./useTransitions-ChGGrtrv.js";import{t as Pe}from"./useTableResponsive-uSz_qZOB.js";import{t as Fe}from"./useUserOptionState-CXlFnwPv.js";import{t as Ie}from"./useChartAccessibility-DOMuYJfm.js";import{t as Le}from"./Shape-CRe8woTu.js";import{n as Re}from"./Title-BliHuXfT.js";import{t as ze}from"./vue_ui_horizontal_bar-uuJ0_9O6.js";import{t as Be}from"./Legend-W9YVYVX-.js";import{t as Ve}from"./vue-ui-accordion-DxGxf-Rm.js";import{t as He}from"./BaseLegendToggle-VzX69MCo.js";import{t as Ue}from"./A11yDataTable-DWNlWXzs.js";import{t as We}from"./DefGrad-DKMq1REY.js";import{t as Ge}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as d,computed as f,createBlock as p,createCommentVNode as m,createElementBlock as h,createElementVNode as g,createSlots as Ke,createTextVNode as qe,createVNode as Je,defineAsyncComponent as Ye,guardReactiveProps as _,mergeProps as Xe,nextTick as Ze,normalizeClass as v,normalizeProps as Qe,normalizeStyle as y,onBeforeUnmount as $e,onMounted as et,openBlock as b,ref as x,renderList as S,renderSlot as C,resolveDynamicComponent as tt,toDisplayString as w,toRefs as nt,unref as T,useCssVars as rt,useSlots as it,watch as at,withCtx as E,withKeys as ot}from"vue";var st=/* @__PURE__ */ e({default:()=>Lt}),ct=[`id`],lt=[`id`],ut=[`onClick`],dt={style:{position:`relative`}},ft=[`xmlns`,`viewBox`,`aria-describedby`],pt=[`width`,`height`],mt={key:1},ht=[`y`,`width`,`height`,`fill`,`rx`],gt=[`x`,`y`,`width`,`height`,`fill`,`rx`],_t=[`x`,`y`,`width`,`height`,`fill`,`rx`,`stroke`,`stroke-width`],vt=[`x`,`y`,`width`,`height`,`fill`,`rx`,`stroke`,`stroke-width`],yt=[`stroke`,`stroke-width`,`d`],bt=[`stroke`,`stroke-width`,`d`],xt=[`y`,`height`,`width`,`fill`],St=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],Ct=[`transform`,`font-size`,`fill`,`font-weight`],wt=[`transform`,`font-size`,`font-weight`,`innerHTML`],Tt=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],Et=[`transform`,`text-anchor`,`font-size`,`fill`,`font-weight`],Dt=[`y`,`width`,`height`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],Ot={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},kt={key:7,class:`vue-data-ui-watermark`},At=[`onClick`],jt={style:`width:100%;padding-top: 36px;position:relative`},Mt={class:`vue-ui-data-table`},Nt={key:0},Pt={style:{width:`100%`}},Ft=[`data-cell`],It={style:{display:`flex`,"align-items":`center`,gap:`5px`,"justify-content":`flex-end`,width:`100%`,"padding-right":`3px`}},Lt=/*#__PURE__*/ Ge({__name:`vue-ui-horizontal-bar`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`copyAlt`,`selectDatapoint`],setup(e,{expose:Ge,emit:st}){rt(e=>({v417199f3:e.tdo}));let Lt=Ye(()=>import(`./Tooltip-C1q0Qoh7.js`)),Rt=Ye(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),zt=Ye(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Bt=Ye(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Vt=Ye(()=>import(`./PackageVersion-ksOit8fp.js`).then(e=>e.t)),Ht=Ye(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_vertical_bar:Ut}=Te(),{isThemeValid:Wt,warnInvalidTheme:Gt}=je(),Kt=it(),D=e,qt=f({get(){return!!D.dataset&&D.dataset.length},set(e){return e}}),O=x(se()),Jt=x(!1),Yt=x(``),Xt=x(null),Zt=x(0),k=x(null),Qt=x(null),$t=x(null),en=x(null),tn=x(null),nn=x(0),rn=x(0),an=x(null),on=x(null),sn=x(null),cn=x(null),ln=x(null),A=x([]),un=x({none:0,asc:1,desc:2}),j=x(0),dn=x(0),fn=null,pn=null,M=x(null),mn=x({x:0,y:0}),hn=x(`pointer`),gn=st,N=x(Dn()),P=f(()=>N.value.style.chart.layout.bars),F=f(()=>N.value.style.chart.layout),I=f(()=>N.value.style.chart.tooltip),L=f(()=>N.value.style.chart);Ce({config:()=>N.value,dataset:()=>D.dataset,component:`VueUiHorizontalBar`,rules:[we.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:R}=Ne({config:()=>N.value.transitions,dataset:()=>D.dataset}),_n=f(()=>N.value.userOptions.useCursorPointer),vn=f(()=>D.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`}]),yn=f(()=>fe({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:N.value.skeletonConfig??{}})),{loading:bn,FINAL_DATASET:xn,manualLoading:Sn}=Ee({...nt(D),FINAL_CONFIG:N,prepareConfig:Dn,callback:()=>{Promise.resolve().then(async()=>{H.value.showTable=N.value.table.show,Vn()})},skeletonDataset:vn.value,skeletonConfig:fe({defaultConfig:N.value,userConfig:yn.value})}),{userOptionsVisible:Cn,setUserOptionsVisibility:wn,keepUserOptionState:Tn}=Fe({config:N.value}),{svgRef:En}=Ie({config:L.value.title});function Dn(){let e=Ae({userConfig:D.config,defaultConfig:Ut}),t={},n=e.theme;if(n){if(!Wt.value(e))Gt(e),t=e;else{let r=Ae({userConfig:ze[n]||D.config,defaultConfig:e});t={...Ae({userConfig:D.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:pe[n]||re}}}else t=e;return D.config&&be(D.config,`events.datapointEnter`)?t.events.datapointEnter=D.config.events.datapointEnter:t.events.datapointEnter=null,D.config&&be(D.config,`events.datapointLeave`)?t.events.datapointLeave=D.config.events.datapointLeave:t.events.datapointLeave=null,D.config&&be(D.config,`events.datapointClick`)?t.events.datapointClick=D.config.events.datapointClick:t.events.datapointClick=null,t}let z=x(L.value.width),On=x(L.value.height),B=x(P.value.gap),kn=le(D.config);at(()=>D.config,(e,t)=>{let n=le(e),r=n!==kn;kn=n;let i=Dn();r?(bn.value||(N.value=i),Cn.value=!N.value.userOptions.showOnChartHover,nn.value+=1,rn.value+=1,H.value.showTable=N.value.table.show,j.value=un.value[P.value.sort]??0,H.value.showTooltip=I.value.show,z.value=L.value.width,On.value=L.value.height,B.value=P.value.gap):(N.value.style.chart.tooltip=i.style.chart.tooltip,H.value.showTooltip=N.value.style.chart.tooltip.show)},{deep:!0}),at(()=>D.dataset,e=>{Array.isArray(e)&&e.length>0&&(Sn.value=!1)},{deep:!0});let{isPrinting:An,isImaging:jn,generatePdf:Mn,generateImage:Nn}=Oe({elementId:`vue-ui-vertical-bar_${O.value}`,fileName:L.value.title.text||`vue-ui-vertical-bar`,options:N.value.userOptions.print}),Pn=f(()=>N.value.userOptions.show&&!L.value.title.text),Fn=f(()=>ye(N.value.customPalette)),In=x(null),Ln=f(()=>N.value.table.responsiveBreakpoint),Rn=f(()=>N.value.debug),zn=x(0),V=x(null),Bn=x(null);function Vn(){if(k.value&&(xe(D.dataset)&&(ue({componentName:`VueUiVerticalBar`,type:`dataset`,debug:Rn.value}),qt.value=!1,Sn.value=!0),xe(D.dataset)||(Sn.value=N.value.loading),N.value.responsive)){let e=Se(()=>{let{width:e,height:t}=ke({chart:k.value,title:L.value.title.text?Qt.value:null,legend:L.value.legend.show?$t.value:null,source:en.value,noTitle:tn.value});zn.value=t/3,requestAnimationFrame(async()=>{On.value=t,z.value=e})});V.value&&(Bn.value&&V.value.unobserve(Bn.value),V.value.disconnect()),V.value=new ResizeObserver(e),Ze(()=>{Bn.value=k.value?.parentNode,Bn.value&&V.value.observe(Bn.value)})}}$e(()=>{V.value&&(Bn.value&&V.value.unobserve(Bn.value),V.value.disconnect())});let H=x({showTable:N.value.table.show,showTooltip:I.value.show}),Hn=f(()=>j.value===0),Un=f(()=>j.value===2),U=f(()=>(xn.value.forEach((e,t)=>{!e.value&&!e.children&&ue({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`value (index ${t})`,debug:Rn.value}),e.children&&(xe(e.children)?ue({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`children (index ${t})`,debug:Rn.value}):e.children.forEach((e,t)=>{[null,void 0].includes(e.name)&&ue({componentName:`VueUiVerticalBar`,type:`datasetSerieAttribute`,property:`name`,key:`children`,index:t,debug:Rn.value})}))}),xn.value.map((e,t)=>{let n=`vertical_parent_${t}_${O.value}`,r=e.children&&e.children.length>0,i=u(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:A.value.includes(n)?.5:1,value:Math.abs(i),sign:a,hasChildren:r,isChild:!1,segregate:()=>rr(n),isSegregated:A.value.includes(n),color:oe(e.color)||Fn.value[t]||re[t]||re[t%re.length],children:!e.children||!e.children.length?[]:e.children.toSorted(Hn.value?()=>0:(e,t)=>Un.value?t.value-e.value:e.value-t.value).map((r,o)=>({...r,value:u(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}_${O.value}`,childIndex:o,color:oe(r.color)||oe(e.color)||Fn.value[t]||re[t]||re[t%re.length]})).map((t,n)=>({...t,isFirstChild:n===0,isLastChild:n===e.children.length-1}))}}).toSorted(Hn.value?()=>0:(e,t)=>Un.value?t.value-e.value:e.value-t.value))),W=f(()=>U.value.filter(e=>!A.value.includes(e.id))),G=f(()=>W.value.flatMap(e=>e.hasChildren?e.children:e)),Wn=f(()=>U.value.flatMap(e=>e.hasChildren?e.children:e)),Gn=f(()=>W.value.flatMap(e=>e.children&&e.children.length>0?e.children.length:1).reduce((e,t)=>e+t,0)),Kn=f(()=>({cy:`vertical-bar-div-legend`,backgroundColor:L.value.legend.backgroundColor,color:L.value.legend.color,fontSize:L.value.legend.fontSize,paddingBottom:12,fontWeight:L.value.legend.bold?`bold`:``})),K=f(()=>P.value.parentLabels.show?P.value.parentLabels.fontSize*3+P.value.parentLabels.paddingBottom:0),q=f(()=>{let e=[],t=0;return G.value.forEach((n,r)=>{n.isChild&&n.childIndex===0&&P.value.parentLabels.show&&(t+=1),e[r]=t}),e}),J=f(()=>{let e=Math.max(0,...q.value)*K.value;return(On.value-24-(Gn.value-1)*B.value-e)/Gn.value}),Y=f(()=>({width:z.value,height:On.value,padding:{top:12,left:128+P.value.offsetX,right:64+P.value.paddingRight,bottom:12}})),qn=x(0);function Jn(){Ze(()=>{if(!ln.value){qn.value=0;return}let e=Array.from(ln.value.querySelectorAll(`text`)).reduce((e,t)=>{let n=t.getBBox?.().width??t.getComputedTextLength();return n>e?n:e},0);qn.value=e+12})}at(()=>[G.value,z.value,On.value,P.value.nameLabels,P.value.offsetX],()=>Jn(),{deep:!0}),et(()=>{Jn()});function Yn(){return typeof document>`u`?null:(fn||(fn=document.createElement(`canvas`),pn=fn.getContext(`2d`)),pn)}function Xn(e){let t=String(e??``),n=P.value,r=n.dataLabels.fontSize,i=n.dataLabels.bold?700:400,a=N.value.style.fontFamily,o=Yn();return o?(o.font=`${i} ${r}px ${a}`,o.measureText(t).width):t.length*r*.6}function Zn(){let e=W.value.flatMap(e=>e.children&&e.children.length?e.children.map(e=>Math.abs(e.value)):Math.abs(e.value));return e.length?Math.max(...e):0}let Qn=f(()=>{dn.value;let e=P.value,t=qn.value+Math.abs(e.nameLabels.offsetX)+e.offsetX,n=Y.value.width-Y.value.padding.right,r=Math.max(0,n-t-e.offsetX),i=Y.value.width-40,a=Zn(),o=G.value.map((e,t)=>({serie:e,textWidth:Xn(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))}}),$n=f(()=>Qn.value.right),er=f(()=>Qn.value.left);function tr(){dn.value+=1}et(()=>{typeof document<`u`&&document.fonts&&(document.fonts.ready.then(tr),document.fonts.addEventListener?.(`loadingdone`,tr))}),$e(()=>{typeof document<`u`&&document.fonts&&document.fonts.removeEventListener?.(`loadingdone`,tr),fn=null,pn=null});let X=f(()=>{let e=qn.value+Math.abs(P.value.nameLabels.offsetX)+er.value+P.value.offsetX,t=Y.value.width-Y.value.padding.right,n=Math.max(0,t-e-$n.value-P.value.offsetX);return{top:Y.value.padding.top,bottom:Y.value.padding.top+Y.value.height,left:e,right:t,width:n,fullHeight:Y.value.padding.top+Y.value.padding.bottom+Y.value.height}});function nr(){A.value.length?A.value=[]:U.value.forEach(e=>{A.value.push(e.id)}),gn(`selectLegend`,W.value)}async function rr(e){if(A.value.includes(e))A.value=A.value.filter(t=>t!==e);else{if(A.value.length===U.value.length-1)return;A.value.push(e)}gn(`selectLegend`,W.value)}function ir(e){return U.value.length?U.value.find(t=>t.name===e)||(Rn.value&&console.warn(`VueUiHorizontalBar - Series name not found "${e}"`),null):(Rn.value&&console.warn(`VueUiHorizontalBar - There are no series to show.`),null)}function ar(e){let t=ir(e);t!==null&&A.value.includes(t.id)&&rr(t.id)}function or(e){let t=ir(e);t!==null&&(A.value.includes(t.id)||rr(t.id))}let Z=f(()=>W.value.map(e=>Math.abs(e.value)).reduce((e,t)=>e+t,0));function sr(e,t=!1,n=0){return t?l({v:u(Math.abs(e)/Z.value*100),s:`%`,r:n}):Math.abs(e)/Z.value}let cr=f(()=>G.value.map(e=>e.sign).includes(-1)),lr=f(()=>Math.max(...W.value.flatMap(e=>e.children&&e.children.length?Math.max(...e.children.map(e=>e.value)):e.value)));function Q(e){let t=e/lr.value;return u(X.value.width/(cr.value?2:1)*t)}function ur(e){return Q(e)+X.value.left}function dr(e,t){let n=W.value.find(t=>t.id===e.parentId);return{y:X.value.top+(B.value+J.value)*t+q.value[t]*K.value-K.value+P.value.parentLabels.fontSize,name:n.name,value:[void 0,NaN,null].includes(n.value)?``:n.sign===1?n.value:-n.value,percentageToTotal:isNaN(n.value/Z.value)?``:sr(n.value,!0,P.value.dataLabels.percentage.roundingPercentage),sign:n.sign}}function fr(){return W.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=x(null),gr=x(null);function _r({datapoint:e,seriesIndex:t}){gn(`selectDatapoint`,e),N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t})}function vr({datapoint:e,seriesIndex:t}){N.value.events.datapointLeave&&N.value.events.datapointLeave({datapoint:e,seriesIndex:t}),Xt.value=null,Jt.value=!1,hr.value=null,M.value===t&&(M.value=null)}function yr(e,t,n=`pointer`){hn.value=n,N.value.events.datapointEnter&&N.value.events.datapointEnter({datpoint:e,seriesIndex:t}),M.value=t,Xt.value=e,gr.value={datapoint:e,seriesIndex:t,series:U.value,config:N.value},Jt.value=!0,hr.value=e.id;let r=``,i=e.isChild?e.parentName:e.name,a=e.isChild?e.name:``,o=I.value.customFormat;ne(o)&&he(()=>o({datapoint:e,series:U.value,config:N.value,seriesIndex:t}))?Yt.value=o({datapoint:e,series:U.value,config:N.value,seriesIndex:t}):(r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${I.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-DPGnEuYM.js";import{$ as l,D as te,Dt as ne,Ht as re,J as ie,Jt as ae,S as oe,X as se,Yt as ce,Zt as le,at as ue,b as u,i as de,in as fe,nn as pe,nt as me,pt as he,t as ge,tn as _e,vt as ve,w as ye,wt as be,zt as xe}from"./lib-rPeBMZrn.js";import{c as Se}from"./canvas-lib-22VpOI4_.js";import{n as Ce,t as we}from"./useHints-C-TwxM0Y.js";import{t as Te}from"./useConfig-_JwRfIqE.js";import{n as Ee,t as De}from"./BaseScanner-8NdoBs7B.js";import{t as Oe}from"./usePrinter-DVf3YcG5.js";import{t as ke}from"./useResponsive-CENUxfEL.js";import{t as Ae}from"./useNestedProp-DnGoh-XS.js";import{t as je}from"./useThemeCheck-BKNRbGeC.js";import{t as Me}from"./useChartExport-BZts4KFb.js";import{t as Ne}from"./useTransitions-ChGGrtrv.js";import{t as Pe}from"./useTableResponsive-uSz_qZOB.js";import{t as Fe}from"./useUserOptionState-CXlFnwPv.js";import{t as Ie}from"./useChartAccessibility-DOMuYJfm.js";import{t as Le}from"./Shape-CRe8woTu.js";import{n as Re}from"./Title-BliHuXfT.js";import{t as ze}from"./vue_ui_horizontal_bar-uuJ0_9O6.js";import{t as Be}from"./Legend-W9YVYVX-.js";import{t as Ve}from"./vue-ui-accordion-DxGxf-Rm.js";import{t as He}from"./BaseLegendToggle-VzX69MCo.js";import{t as Ue}from"./A11yDataTable-DWNlWXzs.js";import{t as We}from"./DefGrad-DKMq1REY.js";import{t as Ge}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as d,computed as f,createBlock as p,createCommentVNode as m,createElementBlock as h,createElementVNode as g,createSlots as Ke,createTextVNode as qe,createVNode as Je,defineAsyncComponent as Ye,guardReactiveProps as _,mergeProps as Xe,nextTick as Ze,normalizeClass as v,normalizeProps as Qe,normalizeStyle as y,onBeforeUnmount as $e,onMounted as et,openBlock as b,ref as x,renderList as S,renderSlot as C,resolveDynamicComponent as tt,toDisplayString as w,toRefs as nt,unref as T,useCssVars as rt,useSlots as it,watch as at,withCtx as E,withKeys as ot}from"vue";var st=/* @__PURE__ */ e({default:()=>Lt}),ct=[`id`],lt=[`id`],ut=[`onClick`],dt={style:{position:`relative`}},ft=[`xmlns`,`viewBox`,`aria-describedby`],pt=[`width`,`height`],mt={key:1},ht=[`y`,`width`,`height`,`fill`,`rx`],gt=[`x`,`y`,`width`,`height`,`fill`,`rx`],_t=[`x`,`y`,`width`,`height`,`fill`,`rx`,`stroke`,`stroke-width`],vt=[`x`,`y`,`width`,`height`,`fill`,`rx`,`stroke`,`stroke-width`],yt=[`stroke`,`stroke-width`,`d`],bt=[`stroke`,`stroke-width`,`d`],xt=[`y`,`height`,`width`,`fill`],St=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],Ct=[`transform`,`font-size`,`fill`,`font-weight`],wt=[`transform`,`font-size`,`font-weight`,`innerHTML`],Tt=[`transform`,`font-size`,`fill`,`font-weight`,`innerHTML`],Et=[`transform`,`text-anchor`,`font-size`,`fill`,`font-weight`],Dt=[`y`,`width`,`height`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],Ot={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},kt={key:7,class:`vue-data-ui-watermark`},At=[`onClick`],jt={style:`width:100%;padding-top: 36px;position:relative`},Mt={class:`vue-ui-data-table`},Nt={key:0},Pt={style:{width:`100%`}},Ft=[`data-cell`],It={style:{display:`flex`,"align-items":`center`,gap:`5px`,"justify-content":`flex-end`,width:`100%`,"padding-right":`3px`}},Lt=/*#__PURE__*/ Ge({__name:`vue-ui-horizontal-bar`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`copyAlt`,`selectDatapoint`],setup(e,{expose:Ge,emit:st}){rt(e=>({v417199f3:e.tdo}));let Lt=Ye(()=>import(`./Tooltip-C1q0Qoh7.js`)),Rt=Ye(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),zt=Ye(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Bt=Ye(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Vt=Ye(()=>import(`./PackageVersion-PdpqwkYX.js`).then(e=>e.t)),Ht=Ye(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_vertical_bar:Ut}=Te(),{isThemeValid:Wt,warnInvalidTheme:Gt}=je(),Kt=it(),D=e,qt=f({get(){return!!D.dataset&&D.dataset.length},set(e){return e}}),O=x(se()),Jt=x(!1),Yt=x(``),Xt=x(null),Zt=x(0),k=x(null),Qt=x(null),$t=x(null),en=x(null),tn=x(null),nn=x(0),rn=x(0),an=x(null),on=x(null),sn=x(null),cn=x(null),ln=x(null),A=x([]),un=x({none:0,asc:1,desc:2}),j=x(0),dn=x(0),fn=null,pn=null,M=x(null),mn=x({x:0,y:0}),hn=x(`pointer`),gn=st,N=x(Dn()),P=f(()=>N.value.style.chart.layout.bars),F=f(()=>N.value.style.chart.layout),I=f(()=>N.value.style.chart.tooltip),L=f(()=>N.value.style.chart);Ce({config:()=>N.value,dataset:()=>D.dataset,component:`VueUiHorizontalBar`,rules:[we.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:R}=Ne({config:()=>N.value.transitions,dataset:()=>D.dataset}),_n=f(()=>N.value.userOptions.useCursorPointer),vn=f(()=>D.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`}]),yn=f(()=>fe({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:N.value.skeletonConfig??{}})),{loading:bn,FINAL_DATASET:xn,manualLoading:Sn}=Ee({...nt(D),FINAL_CONFIG:N,prepareConfig:Dn,callback:()=>{Promise.resolve().then(async()=>{H.value.showTable=N.value.table.show,Vn()})},skeletonDataset:vn.value,skeletonConfig:fe({defaultConfig:N.value,userConfig:yn.value})}),{userOptionsVisible:Cn,setUserOptionsVisibility:wn,keepUserOptionState:Tn}=Fe({config:N.value}),{svgRef:En}=Ie({config:L.value.title});function Dn(){let e=Ae({userConfig:D.config,defaultConfig:Ut}),t={},n=e.theme;if(n){if(!Wt.value(e))Gt(e),t=e;else{let r=Ae({userConfig:ze[n]||D.config,defaultConfig:e});t={...Ae({userConfig:D.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:pe[n]||re}}}else t=e;return D.config&&be(D.config,`events.datapointEnter`)?t.events.datapointEnter=D.config.events.datapointEnter:t.events.datapointEnter=null,D.config&&be(D.config,`events.datapointLeave`)?t.events.datapointLeave=D.config.events.datapointLeave:t.events.datapointLeave=null,D.config&&be(D.config,`events.datapointClick`)?t.events.datapointClick=D.config.events.datapointClick:t.events.datapointClick=null,t}let z=x(L.value.width),On=x(L.value.height),B=x(P.value.gap),kn=le(D.config);at(()=>D.config,(e,t)=>{let n=le(e),r=n!==kn;kn=n;let i=Dn();r?(bn.value||(N.value=i),Cn.value=!N.value.userOptions.showOnChartHover,nn.value+=1,rn.value+=1,H.value.showTable=N.value.table.show,j.value=un.value[P.value.sort]??0,H.value.showTooltip=I.value.show,z.value=L.value.width,On.value=L.value.height,B.value=P.value.gap):(N.value.style.chart.tooltip=i.style.chart.tooltip,H.value.showTooltip=N.value.style.chart.tooltip.show)},{deep:!0}),at(()=>D.dataset,e=>{Array.isArray(e)&&e.length>0&&(Sn.value=!1)},{deep:!0});let{isPrinting:An,isImaging:jn,generatePdf:Mn,generateImage:Nn}=Oe({elementId:`vue-ui-vertical-bar_${O.value}`,fileName:L.value.title.text||`vue-ui-vertical-bar`,options:N.value.userOptions.print}),Pn=f(()=>N.value.userOptions.show&&!L.value.title.text),Fn=f(()=>ye(N.value.customPalette)),In=x(null),Ln=f(()=>N.value.table.responsiveBreakpoint),Rn=f(()=>N.value.debug),zn=x(0),V=x(null),Bn=x(null);function Vn(){if(k.value&&(xe(D.dataset)&&(ue({componentName:`VueUiVerticalBar`,type:`dataset`,debug:Rn.value}),qt.value=!1,Sn.value=!0),xe(D.dataset)||(Sn.value=N.value.loading),N.value.responsive)){let e=Se(()=>{let{width:e,height:t}=ke({chart:k.value,title:L.value.title.text?Qt.value:null,legend:L.value.legend.show?$t.value:null,source:en.value,noTitle:tn.value});zn.value=t/3,requestAnimationFrame(async()=>{On.value=t,z.value=e})});V.value&&(Bn.value&&V.value.unobserve(Bn.value),V.value.disconnect()),V.value=new ResizeObserver(e),Ze(()=>{Bn.value=k.value?.parentNode,Bn.value&&V.value.observe(Bn.value)})}}$e(()=>{V.value&&(Bn.value&&V.value.unobserve(Bn.value),V.value.disconnect())});let H=x({showTable:N.value.table.show,showTooltip:I.value.show}),Hn=f(()=>j.value===0),Un=f(()=>j.value===2),U=f(()=>(xn.value.forEach((e,t)=>{!e.value&&!e.children&&ue({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`value (index ${t})`,debug:Rn.value}),e.children&&(xe(e.children)?ue({componentName:`VueUiVerticalBar`,type:`datasetAttributeEmpty`,property:`children (index ${t})`,debug:Rn.value}):e.children.forEach((e,t)=>{[null,void 0].includes(e.name)&&ue({componentName:`VueUiVerticalBar`,type:`datasetSerieAttribute`,property:`name`,key:`children`,index:t,debug:Rn.value})}))}),xn.value.map((e,t)=>{let n=`vertical_parent_${t}_${O.value}`,r=e.children&&e.children.length>0,i=u(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:A.value.includes(n)?.5:1,value:Math.abs(i),sign:a,hasChildren:r,isChild:!1,segregate:()=>rr(n),isSegregated:A.value.includes(n),color:oe(e.color)||Fn.value[t]||re[t]||re[t%re.length],children:!e.children||!e.children.length?[]:e.children.toSorted(Hn.value?()=>0:(e,t)=>Un.value?t.value-e.value:e.value-t.value).map((r,o)=>({...r,value:u(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}_${O.value}`,childIndex:o,color:oe(r.color)||oe(e.color)||Fn.value[t]||re[t]||re[t%re.length]})).map((t,n)=>({...t,isFirstChild:n===0,isLastChild:n===e.children.length-1}))}}).toSorted(Hn.value?()=>0:(e,t)=>Un.value?t.value-e.value:e.value-t.value))),W=f(()=>U.value.filter(e=>!A.value.includes(e.id))),G=f(()=>W.value.flatMap(e=>e.hasChildren?e.children:e)),Wn=f(()=>U.value.flatMap(e=>e.hasChildren?e.children:e)),Gn=f(()=>W.value.flatMap(e=>e.children&&e.children.length>0?e.children.length:1).reduce((e,t)=>e+t,0)),Kn=f(()=>({cy:`vertical-bar-div-legend`,backgroundColor:L.value.legend.backgroundColor,color:L.value.legend.color,fontSize:L.value.legend.fontSize,paddingBottom:12,fontWeight:L.value.legend.bold?`bold`:``})),K=f(()=>P.value.parentLabels.show?P.value.parentLabels.fontSize*3+P.value.parentLabels.paddingBottom:0),q=f(()=>{let e=[],t=0;return G.value.forEach((n,r)=>{n.isChild&&n.childIndex===0&&P.value.parentLabels.show&&(t+=1),e[r]=t}),e}),J=f(()=>{let e=Math.max(0,...q.value)*K.value;return(On.value-24-(Gn.value-1)*B.value-e)/Gn.value}),Y=f(()=>({width:z.value,height:On.value,padding:{top:12,left:128+P.value.offsetX,right:64+P.value.paddingRight,bottom:12}})),qn=x(0);function Jn(){Ze(()=>{if(!ln.value){qn.value=0;return}let e=Array.from(ln.value.querySelectorAll(`text`)).reduce((e,t)=>{let n=t.getBBox?.().width??t.getComputedTextLength();return n>e?n:e},0);qn.value=e+12})}at(()=>[G.value,z.value,On.value,P.value.nameLabels,P.value.offsetX],()=>Jn(),{deep:!0}),et(()=>{Jn()});function Yn(){return typeof document>`u`?null:(fn||(fn=document.createElement(`canvas`),pn=fn.getContext(`2d`)),pn)}function Xn(e){let t=String(e??``),n=P.value,r=n.dataLabels.fontSize,i=n.dataLabels.bold?700:400,a=N.value.style.fontFamily,o=Yn();return o?(o.font=`${i} ${r}px ${a}`,o.measureText(t).width):t.length*r*.6}function Zn(){let e=W.value.flatMap(e=>e.children&&e.children.length?e.children.map(e=>Math.abs(e.value)):Math.abs(e.value));return e.length?Math.max(...e):0}let Qn=f(()=>{dn.value;let e=P.value,t=qn.value+Math.abs(e.nameLabels.offsetX)+e.offsetX,n=Y.value.width-Y.value.padding.right,r=Math.max(0,n-t-e.offsetX),i=Y.value.width-40,a=Zn(),o=G.value.map((e,t)=>({serie:e,textWidth:Xn(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))}}),$n=f(()=>Qn.value.right),er=f(()=>Qn.value.left);function tr(){dn.value+=1}et(()=>{typeof document<`u`&&document.fonts&&(document.fonts.ready.then(tr),document.fonts.addEventListener?.(`loadingdone`,tr))}),$e(()=>{typeof document<`u`&&document.fonts&&document.fonts.removeEventListener?.(`loadingdone`,tr),fn=null,pn=null});let X=f(()=>{let e=qn.value+Math.abs(P.value.nameLabels.offsetX)+er.value+P.value.offsetX,t=Y.value.width-Y.value.padding.right,n=Math.max(0,t-e-$n.value-P.value.offsetX);return{top:Y.value.padding.top,bottom:Y.value.padding.top+Y.value.height,left:e,right:t,width:n,fullHeight:Y.value.padding.top+Y.value.padding.bottom+Y.value.height}});function nr(){A.value.length?A.value=[]:U.value.forEach(e=>{A.value.push(e.id)}),gn(`selectLegend`,W.value)}async function rr(e){if(A.value.includes(e))A.value=A.value.filter(t=>t!==e);else{if(A.value.length===U.value.length-1)return;A.value.push(e)}gn(`selectLegend`,W.value)}function ir(e){return U.value.length?U.value.find(t=>t.name===e)||(Rn.value&&console.warn(`VueUiHorizontalBar - Series name not found "${e}"`),null):(Rn.value&&console.warn(`VueUiHorizontalBar - There are no series to show.`),null)}function ar(e){let t=ir(e);t!==null&&A.value.includes(t.id)&&rr(t.id)}function or(e){let t=ir(e);t!==null&&(A.value.includes(t.id)||rr(t.id))}let Z=f(()=>W.value.map(e=>Math.abs(e.value)).reduce((e,t)=>e+t,0));function sr(e,t=!1,n=0){return t?l({v:u(Math.abs(e)/Z.value*100),s:`%`,r:n}):Math.abs(e)/Z.value}let cr=f(()=>G.value.map(e=>e.sign).includes(-1)),lr=f(()=>Math.max(...W.value.flatMap(e=>e.children&&e.children.length?Math.max(...e.children.map(e=>e.value)):e.value)));function Q(e){let t=e/lr.value;return u(X.value.width/(cr.value?2:1)*t)}function ur(e){return Q(e)+X.value.left}function dr(e,t){let n=W.value.find(t=>t.id===e.parentId);return{y:X.value.top+(B.value+J.value)*t+q.value[t]*K.value-K.value+P.value.parentLabels.fontSize,name:n.name,value:[void 0,NaN,null].includes(n.value)?``:n.sign===1?n.value:-n.value,percentageToTotal:isNaN(n.value/Z.value)?``:sr(n.value,!0,P.value.dataLabels.percentage.roundingPercentage),sign:n.sign}}function fr(){return W.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=x(null),gr=x(null);function _r({datapoint:e,seriesIndex:t}){gn(`selectDatapoint`,e),N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t})}function vr({datapoint:e,seriesIndex:t}){N.value.events.datapointLeave&&N.value.events.datapointLeave({datapoint:e,seriesIndex:t}),Xt.value=null,Jt.value=!1,hr.value=null,M.value===t&&(M.value=null)}function yr(e,t,n=`pointer`){hn.value=n,N.value.events.datapointEnter&&N.value.events.datapointEnter({datpoint:e,seriesIndex:t}),M.value=t,Xt.value=e,gr.value={datapoint:e,seriesIndex:t,series:U.value,config:N.value},Jt.value=!0,hr.value=e.id;let r=``,i=e.isChild?e.parentName:e.name,a=e.isChild?e.name:``,o=I.value.customFormat;ne(o)&&he(()=>o({datapoint:e,series:U.value,config:N.value,seriesIndex:t}))?Yt.value=o({datapoint:e,series:U.value,config:N.value,seriesIndex:t}):(r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${I.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}"/>${Kt.pattern?`<rect x="0" y="0" height="60" width="60" rx="5" stroke="none" fill="url(#pattern_${O.value}_${e.absoluteIndex})"/>`:``}</svg> ${i}</div>
|
|
3
3
|
${a?`<div>${a}</div>`:``}
|
|
4
4
|
</div>`,I.value.showValue&&(r+=`<div>${N.value.translations.value}: <b>${de(P.value.dataLabels.value.formatter,e.sign===1?e.value:-e.value,l({p:I.value.prefix,v:e.sign===1?e.value:-e.value,s:I.value.suffix,r:I.value.roundingValue}),{datapoint:e,seriesIndex:t})}</b></div>`),I.value.showPercentage&&(r+=`<div>${N.value.translations.percentageToTotal} : <b>${l({v:Math.abs(e.value)/Z.value*100,s:`%`,r:I.value.roundingPercentage})}</b></div>`,e.isChild&&(r+=`<div>${N.value.translations.percentageToSerie}: <b>${l({v:Math.abs(e.value)/Math.abs(e.parentValue)*100,s:`%`,r:I.value.roundingPercentage})}</b></div>`)),Yt.value=`<div style="text-align:left">${r}</div>`)}function br({legend:e,index:t}){let n=L.value.legend;return n.showValue?`${e.name}: ${de(P.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(!P.value.dataLabels.value.show)return``;let i=de(P.value.dataLabels.value.formatter,u(r===-1&&e>=0?-e:e),l({p:P.value.dataLabels.value.prefix,v:u(r===-1&&e>=0?-e:e),s:P.value.dataLabels.value.suffix,r:P.value.dataLabels.value.roundingValue}),{datapoint:t,seriesIndex:n}),a=`(${sr(e,!0,P.value.dataLabels.percentage.roundingPercentage)})`;return`${i}${P.value.dataLabels.percentage.show?` ${a}`:``}`}let Sr=f(()=>({head:[N.value.translations.parentName,N.value.translations.value,N.value.translations.percentageToTotal,N.value.translations.childName,N.value.translations.value,N.value.translations.percentageToSerie,N.value.translations.percentageToTotal],body:G.value.map(e=>e.isChild?e.isFirstChild?{color:e.color,parentName:e.parentName,parentValue:e.parentValue,percentageToTotal:e.parentValue/Z.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)/Z.value}:{color:``,parentName:``,parentValue:``,percentageToTotal:``,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)/Z.value}:{color:e.color,parentName:e.name,parentValue:e.sign===1?e.value:-e.value,percentageToTotal:Math.abs(e.value)/Z.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=N.value.table.td,i=[``,NaN,void 0].includes(n);return t.type===`value`?`${w(r.prefix)}${i?``:n.toFixed(r.roundingValue)}${w(r.suffix)}`:t.type===`percentage`?i?``:`${(n*100).toFixed(r.roundingPercentage)}%`:n}function Tr(e=null){let t=[[L.value.title.text],[L.value.title.subtitle.text],[``]],n=Sr.value.head,r=Sr.value.body.map(e=>[e.parentName,e.parentValue,e.percentageToTotal,e.childName,e.childValue,e.childPercentageToParent,e.childPercentageToTotal]),i=t.concat([n]).concat(r),a=te(i);e?e(a):me({csvContent:a,title:L.value.title.text||`vue-ui-vertical-bar`})}let $=x(!1);function Er(e){$.value=e,Zt.value+=1}function Dr(){H.value.showTable=!H.value.showTable}et(()=>{[`none`,`asc`,`desc`].includes(P.value.sort)||ue({componentName:`VueUiVerticalBar`,type:`attributeWrongValue`,property:`style.chart.layout.bars.sort`,key:P.value.sort}),j.value=un.value[P.value.sort]??0});function Or(){j.value+=1,j.value>2&&(j.value=0)}function kr(){Or()}function Ar(){H.value.showTooltip=!H.value.showTooltip}let jr=x(!1);function Mr(){jr.value=!jr.value}let Nr=ee(k,()=>L.value.title.text),Pr=f(()=>c({config:N,style:L,mutableConfig:H,dialog:Ht,accordion:Ve,isFullscreen:$,parent:k,maxWidth:800,isCursorPointer:_n}));at(()=>H.value.showTable,e=>s(e,N,on));let{isResponsive:Fr}=Pe(In,Ln);function Ir(){H.value.showTable=!1,sn.value&&sn.value.setTableIconState(!1)}let Lr=f(()=>U.value.map((e,t)=>({...e,shape:`square`,display:`${e.name}: ${de(P.value.dataLabels.value.formatter,e.value,l({p:L.value.legend.prefix,v:e.value,s:L.value.legend.suffix,r:L.value.legend.roundingValue}),{datapoint:e,seriesIndex:t})}`}))),Rr=f(()=>L.value.backgroundColor),zr=f(()=>L.value.legend),Br=f(()=>L.value.title),Vr=f(()=>Lr.value.map(e=>({...e,name:e.display}))),{isCallbackImaging:Hr,isCallbackSvg:Ur,generateSvg:Wr,onGenerateImage:Gr}=Me({svg:En,title:Br,legend:zr,legendItems:Vr,backgroundColor:Rr,getSvgCallback:()=>N.value.userOptions.callbacks.svg,generateImage:Nn});function Kr(){console.warn(`[autoSize]: this legacy method can be safely removed as it has no impact.`)}async function qr(){gn(`copyAlt`,{config:N.value,dataset:W.value}),N.value.userOptions.callbacks.altCopy?await Promise.resolve(N.value.userOptions.callbacks.altCopy({config:N.value,dataset:W.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}let Jr=x(!1);function Yr(){M.value=null,Jr.value=!0}function Xr(){M.value=null,Jt.value=!1,Jr.value=!1}function Zr(){if(M.value===null)return;let e=G.value[M.value];e&&vr({datapoint:e,seriesIndex:M.value}),M.value=null,hn.value=`pointer`}function Qr(e){if(!En.value||jr.value||document.activeElement!==En.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=G.value.length;if(!a)return;if(e.preventDefault(),e.stopPropagation(),i){Zr();return}if(r){if(M.value===null)return;let e=G.value[M.value];if(!e)return;_r({datapoint:e,seriesIndex:M.value});return}let o=M.value,s=Xt.value?G.value.findIndex(e=>e.id===Xt.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=G.value[o];c&&(M.value=o,$r(c),yr(c,o,`keyboard`))}function $r(e){if(!e)return;let t=X.value.right,n=X.value.top+(B.value+J.value)*e.absoluteIndex+q.value[e.absoluteIndex]*K.value;if(!Number.isFinite(t)||!Number.isFinite(n))return;let r=_e(t,n,En.value);r&&(mn.value=r)}let ei=f(()=>({head:Sr.value.head,body:Sr.value.body.map(e=>[e.parentName,e.parentValue===``?``:l({v:e.parentValue,r:P.value.dataLabels.value.roundingValue,p:P.value.dataLabels.prefix,s:P.value.dataLabels.suffix}),e.percentageToTotal===``?``:l({v:e.percentageToTotal*100,r:P.value.dataLabels.percentage.roundingPercentage,s:`%`}),e.childName,e.childValue===``?``:l({v:e.childValue,r:P.value.dataLabels.value.roundingValue,p:P.value.dataLabels.prefix,s:P.value.dataLabels.suffix}),e.childPercentageToParent===``?``:l({v:e.childPercentageToParent*100,r:P.value.dataLabels.percentage.roundingPercentage,s:`%`}),e.childPercentageToTotal===``?``:l({v:e.childPercentageToTotal*100,r:P.value.dataLabels.percentage.roundingPercentage,s:`%`})]),caption:N.value.a11y.translations.tableCaption,notice:N.value.a11y.translations.tableAvailable}));return Ge({autoSize:Kr,getData:fr,getImage:Nr,generatePdf:Mn,generateCsv:Tr,generateImage:Nn,generateSvg:Wr,hideSeries:or,showSeries:ar,toggleTable:Dr,toggleSort:kr,toggleTooltip:Ar,toggleAnnotator:Mr,toggleFullscreen:Er,copyAlt:qr}),(e,s)=>(b(),h(`div`,{class:v(`vue-data-ui-component vue-ui-vertical-bar ${$.value?`vue-data-ui-wrapper-fullscreen`:``} ${N.value.useCssAnimation?``:`vue-ui-dna`} ${N.value.responsive?`vue-ui-vertical-bar-autosize`:``}`),ref_key:`verticalBarChart`,ref:k,id:`vue-ui-vertical-bar_${O.value}`,style:y(`font-family:${N.value.style.fontFamily};width:100%; text-align:center;background:${L.value.backgroundColor};height:100%`),onMouseenter:s[3]||=()=>T(wn)(!0),onMouseleave:s[4]||=()=>T(wn)(!1)},[g(`p`,{id:`chart-instructions-${O.value}`,class:`sr-only`},w(N.value.a11y.translations.keyboardNavigation),9,lt),ei.value.body.length?(b(),p(Ue,{key:0,uid:O.value,head:ei.value.head,body:ei.value.body,caption:ei.value.caption,notice:ei.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):m(``,!0),N.value.userOptions.buttons.annotator?(b(),p(T(zt),Xe({key:1},T(a)(N.value.userOptions.annotator),{svgRef:T(En),backgroundColor:L.value.backgroundColor,color:L.value.color,active:jr.value,isCursorPointer:_n.value,palette:N.value.userOptions.annotatorPalette,onClose:Mr}),Ke({_:2},[S(T(o),t=>({name:t,fn:E(n=>[C(e.$slots,t,Qe(_(T(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):m(``,!0),Pn.value?(b(),h(`div`,{key:2,ref_key:`noTitle`,ref:tn,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):m(``,!0),L.value.title.text?(b(),h(`div`,{key:3,ref_key:`chartTitle`,ref:Qt,style:`width:100%;background:transparent;padding-bottom:12px`},[(b(),p(Re,{key:`title_${nn.value}`,config:{title:{cy:`vertical-bar-div-title`,...L.value.title},subtitle:{cy:`vertical-bar-div-subtitle`,...L.value.title.subtitle}}},null,8,[`config`]))],512)):m(``,!0),N.value.userOptions.show&&qt.value&&(T(Tn)||T(Cn))?(b(),p(T(Bt),Xe({ref_key:`userOptionsRef`,ref:sn,backgroundColor:L.value.backgroundColor,color:L.value.color,key:`user_options_${Zt.value}`,isImaging:T(jn),isPrinting:T(An),uid:O.value,hasTooltip:N.value.userOptions.buttons.tooltip&&I.value.show,isFullscreen:$.value,isTooltip:H.value.showTooltip,chartElement:k.value},T(n)(N.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator sort`),{isAnnotation:jr.value,tableDialog:N.value.table.useDialog,isCursorPointer:_n.value,onToggleFullscreen:Er,onGeneratePdf:T(Mn),onGenerateCsv:Tr,onGenerateImage:T(Gr),onGenerateSvg:T(Wr),onToggleTable:Dr,onToggleSort:kr,onToggleTooltip:Ar,onToggleAnnotator:Mr,onCopyAlt:qr,style:{visibility:T(Tn)?T(Cn)?`visible`:`hidden`:`visible`}}),Ke({_:2},[S(T(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:E(n=>[C(e.$slots,t,Qe(_(T(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isImaging`,`isPrinting`,`uid`,`hasTooltip`,`isFullscreen`,`isTooltip`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):m(``,!0),e.$slots.legend&&L.value.legend.show&&L.value.legend.position===`top`?C(e.$slots,`legend`,{legend:U.value},void 0,!0,5):m(``,!0),!e.$slots.legend&&L.value.legend.show&&L.value.legend.position===`top`?(b(),h(`div`,{key:6,ref_key:`chartLegend`,ref:$t},[(b(),p(Be,{key:`legend_top_${rn.value}`,legendSet:U.value,config:Kn.value,onClickMarker:s[0]||=({legend:e})=>rr(e.id)},Ke({item:E(({legend:e,index:t})=>[g(`div`,{onClick:t=>rr(e.id),style:y(`opacity:${A.value.includes(e.id)?.5:1}`)},w(br({legend:e,index:t})),13,ut)]),legendToggle:E(()=>[U.value.length>2&&L.value.legend.selectAllToggle.show&&!T(bn)?(b(),p(He,{key:0,backgroundColor:L.value.legend.selectAllToggle.backgroundColor,color:L.value.legend.selectAllToggle.color,fontSize:L.value.legend.fontSize,checked:A.value.length>0,onToggle:nr},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`])):m(``,!0)]),_:2},[e.$slots.pattern?{name:`legend-pattern`,fn:E(({legend:e,index:t})=>[Je(Le,{shape:e.shape,radius:30,stroke:`none`,plot:{x:30,y:30},fill:`url(#pattern_${O.value}_${t})`},null,8,[`shape`,`fill`])]),key:`0`}:void 0]),1032,[`legendSet`,`config`]))],512)):m(``,!0),g(`div`,dt,[(b(),h(`svg`,{ref_key:`svgRef`,ref:En,xmlns:T(ge),class:v({"vue-data-ui-fullscreen--on":$.value,"vue-data-ui-fulscreen--off":!$.value,"vue-data-ui-no-transition":!T(R)}),viewBox:`0 0 ${z.value} ${On.value}`,style:y(`max-width:100%;overflow:visible;background:transparent;color:${L.value.color}`),tabindex:`0`,"aria-describedby":`chart-instructions-${O.value}`,onFocus:Yr,onBlur:Xr,onKeydown:Qr},[g(`g`,{ref_key:`G`,ref:an,class:`vue-data-ui-g`},[Je(T(Vt)),C(e.$slots,`svg-underlayer`,{svg:{...Y.value,drawingArea:X.value,isPrintingImg:T(An)||T(jn)||T(Hr),isPrintingSvg:T(Ur)}},void 0,!0),e.$slots[`chart-background`]?(b(),h(`foreignObject`,{key:0,x:0,y:0,width:z.value,height:On.value,style:{pointerEvents:`none`}},[C(e.$slots,`chart-background`,{},void 0,!0)],8,pt)):m(``,!0),g(`defs`,null,[(b(!0),h(d,null,S(G.value,(e,t)=>(b(),p(We,{t:`linear`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,id:`vertical_bar_gradient_${O.value}_${t}`,key:`vertical_bar_gradient_${O.value}_${t}`,stops:[[`0%`,e.color,1],[`100%`,T(ae)(T(ce)(e.color,.03),100-P.value.gradientIntensity),1]]},null,8,[`id`,`stops`]))),128))]),e.$slots.pattern?(b(),h(`g`,mt,[(b(!0),h(d,null,S(G.value,t=>(b(),h(`defs`,null,[C(e.$slots,`pattern`,Xe({ref_for:!0},{seriesIndex:t.absoluteIndex,patternId:`pattern_${O.value}_${t.absoluteIndex}`}),void 0,!0)]))),256))])):m(``,!0),P.value.rowColor?(b(!0),h(d,{key:2},S(G.value,(e,t)=>(b(),h(`g`,{key:`row_${e.id}`},[g(`rect`,{x:0,y:X.value.top+(B.value+J.value)*t+q.value[t]*K.value,width:z.value,height:J.value<=0?1e-4:J.value,fill:P.value.rowColor,rx:P.value.rowRadius,style:{pointerEvents:`none`},class:v({"vue-data-ui-transition":T(R)})},null,10,ht)]))),128)):m(``,!0),(b(!0),h(d,null,S(G.value,(e,t)=>(b(),h(`g`,{key:`underlayer_${e.id}`},[g(`rect`,{x:T(u)(cr.value?X.value.left+X.value.width/2-(e.sign===1?0:Q(e.value)<=0?1e-4:Q(e.value)):X.value.left),y:X.value.top+(B.value+J.value)*t+q.value[t]*K.value,width:T(u)(Q(e.value)<=0?1e-4:Q(e.value)),height:J.value<=0?1e-4:J.value,fill:P.value.underlayerColor,rx:P.value.borderRadius,class:v({"vue-data-ui-transition":T(R)})},null,10,gt)]))),128)),(b(!0),h(d,null,S(G.value,(t,n)=>(b(),h(`g`,{key:`barloop_${t.id}`},[g(`rect`,{x:T(u)(cr.value?X.value.left+X.value.width/2-(t.sign===1?0:Q(t.value)<=0?1e-4:Q(t.value)):X.value.left),y:X.value.top+(B.value+J.value)*n+q.value[n]*K.value,width:T(u)(Q(t.value)<=0?1e-4:Q(t.value)),height:J.value<=0?1e-4:J.value,fill:P.value.useGradient?`url(#vertical_bar_gradient_${O.value}_${n})`:T(ae)(t.color,P.value.fillOpacity),rx:P.value.borderRadius,stroke:P.value.useStroke?t.color:`none`,"stroke-width":P.value.useStroke?P.value.strokeWidth:0,class:v({"vue-data-ui-transition":T(R)})},null,10,_t),e.$slots.pattern?(b(),h(`rect`,{key:0,x:T(u)(cr.value?X.value.left+X.value.width/2-(t.sign===1?0:Q(t.value)<=0?1e-4:Q(t.value)):X.value.left),y:X.value.top+(B.value+J.value)*n+q.value[n]*K.value,width:T(u)(Q(t.value)<=0?1e-4:Q(t.value)),height:J.value<=0?1e-4:J.value,fill:`url(#pattern_${O.value}_${t.absoluteIndex})`,rx:P.value.borderRadius,stroke:P.value.useStroke?t.color:`none`,"stroke-width":P.value.useStroke?P.value.strokeWidth:0,class:v({"vue-data-ui-transition":T(R)})},null,10,vt)):m(``,!0),(!t.isChild||t.isLastChild)&&F.value.separators.show&&n!==G.value.length-1?(b(),h(`path`,{key:1,stroke:F.value.separators.color,"stroke-width":F.value.separators.strokeWidth,"stroke-linecap":`round`,class:v({"vue-data-ui-transition":T(R)}),d:`M${z.value}, ${J.value+B.value/2+X.value.top+(B.value+J.value)*n+q.value[n]*K.value} ${F.value.separators.fullWidth?0:X.value.left}, ${J.value+B.value/2+X.value.top+(B.value+J.value)*n+q.value[n]*K.value}`},null,10,yt)):m(``,!0),cr.value&&F.value.separators.show?(b(),h(`path`,{key:2,stroke:F.value.separators.color,"stroke-width":F.value.separators.strokeWidth,"stroke-linecap":`round`,class:v({"vue-data-ui-transition":T(R)}),d:`M${X.value.left+X.value.width/2}, ${X.value.top} ${X.value.left+X.value.width/2}, ${X.value.bottom}`},null,10,bt)):m(``,!0)]))),128)),g(`g`,{ref_key:`parentLabels`,ref:cn},[(b(!0),h(d,null,S(G.value,(e,t)=>(b(),h(`g`,{key:`pn_${e.id}`,class:`vue-ui-horizontal-bar-parent-label`},[e.isChild&&e.childIndex===0&&P.value.parentLabels.show?(b(),h(`rect`,{key:0,class:v([`vue-ui-horizontal-bar-parent-marker`,{"vue-data-ui-transition":T(R)}]),x:2,y:dr(e,t).y-P.value.parentLabels.fontSize/1.5,height:P.value.parentLabels.fontSize/1.5,width:P.value.parentLabels.fontSize/1.5,rx:1,fill:e.color},null,10,xt)):m(``,!0),e.isChild&&e.childIndex===0&&P.value.parentLabels.show?(b(),h(`text`,{key:1,class:v({"vue-data-ui-transition":T(R)}),transform:`translate(${P.value.parentLabels.offsetX+P.value.parentLabels.fontSize}, ${dr(e,t).y})`,"font-size":P.value.parentLabels.fontSize,fill:P.value.parentLabels.color,"font-weight":P.value.parentLabels.bold?`bold`:`normal`,"text-anchor":`start`,innerHTML:T(ie)({content:`${pr(e,t)}`,fontSize:P.value.parentLabels.fontSize,fill:F.value.bars.parentLabels.color,x:0,y:0,translateY:!1})},null,10,St)):m(``,!0),e.isChild&&e.childIndex===0&&P.value.parentLabels.show?(b(),h(`text`,{key:2,class:v({"vue-data-ui-transition":T(R)}),transform:`translate(${P.value.parentLabels.offsetX+P.value.parentLabels.fontSize}, ${dr(e,t).y+T(ve)(pr(e,t))*P.value.parentLabels.fontSize*1.1})`,"font-size":P.value.parentLabels.fontSize,fill:P.value.parentLabels.color,"font-weight":P.value.dataLabels.bold?`bold`:`normal`,"text-anchor":`start`},w(mr(e,t)),11,Ct)):m(``,!0)]))),128))],512),g(`g`,{ref_key:`childLabels`,ref:ln},[(b(!0),h(d,null,S(Wn.value,(e,t)=>(b(),h(`g`,{key:`cl_${e.id}`,class:`vue-ui-horizontal-bar-child-label`},[(e.isChild||!e.hasChildren)&&P.value.nameLabels.show?(b(),h(`text`,{key:0,"text-anchor":`start`,class:v({"vue-data-ui-transition":T(R)}),transform:`translate(${Math.abs(P.value.nameLabels.offsetX)}, ${T(u)(X.value.top+(B.value+J.value)*t+J.value/2+P.value.nameLabels.fontSize/2+q.value[t]*K.value)})`,"font-size":P.value.nameLabels.fontSize,fill:`transparent`,"font-weight":P.value.nameLabels.bold?`bold`:`normal`,style:{"user-select":`none`},innerHTML:T(ie)({content:e.name,fontSize:P.value.nameLabels.fontSize,fill:`transparent`,x:0,y:0,translateY:!0})},null,10,wt)):m(``,!0)]))),128))],512),g(`g`,null,[(b(!0),h(d,null,S(G.value,(e,t)=>(b(),h(`g`,{key:`vislab_${e.id}`,class:`vue-ui-horizontal-bar-child-label`},[(e.isChild||!e.hasChildren)&&P.value.nameLabels.show?(b(),h(`text`,{key:0,class:v({"vue-data-ui-transition":T(R)}),"text-anchor":`end`,transform:`translate(${X.value.left+P.value.nameLabels.offsetX-6}, ${X.value.top+(B.value+J.value)*t+J.value/2+P.value.nameLabels.fontSize/3+q.value[t]*K.value})`,"font-size":P.value.nameLabels.fontSize,fill:P.value.nameLabels.color,"font-weight":P.value.nameLabels.bold?`bold`:`normal`,innerHTML:T(ie)({content:e.name,fontSize:P.value.nameLabels.fontSize,fill:F.value.bars.nameLabels.color,x:0,y:0,translateY:!0})},null,10,Tt)):m(``,!0)]))),128))]),g(`g`,null,[(b(!0),h(d,null,S(G.value,(e,t)=>(b(),h(`g`,{key:`sdl_${e.id}`,class:`vue-ui-horizontal-bar-child-label`},[g(`text`,{class:v({"vue-data-ui-transition":T(R)}),transform:`translate(${cr.value?X.value.left+X.value.width/2+(e.sign===1?-12:12)+(e.sign===1?-F.value.bars.dataLabels.offsetX:F.value.bars.dataLabels.offsetX):Math.min(ur(e.value)+3+L.value.layout.bars.dataLabels.offsetX,X.value.right-2)},${X.value.top+(B.value+J.value)*t+J.value/2+q.value[t]*K.value+P.value.dataLabels.fontSize/3})`,"text-anchor":!cr.value||e.sign===-1?`start`:`end`,"font-size":P.value.dataLabels.fontSize,fill:P.value.dataLabels.color,"font-weight":P.value.dataLabels.bold?`bold`:`normal`},w(xr(e.value,e,t,e.sign)),11,Et)]))),128))]),(b(!0),h(d,null,S(G.value,(e,t)=>(b(),h(`g`,null,[g(`rect`,{x:0,y:X.value.top+(B.value+J.value)*t-B.value/2+q.value[t]*K.value,width:z.value,height:J.value+B.value<=0?1e-4:J.value+B.value,fill:hr.value===e.id?T(ae)(F.value.highlighter.color,F.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,Dt)]))),256)),C(e.$slots,`svg`,{svg:{...Y.value,drawingArea:X.value,isPrintingImg:T(An)||T(jn)||T(Hr),isPrintingSvg:T(Ur)}},void 0,!0)],512)],46,ft)),e.$slots.hint?(b(),h(`div`,Ot,[C(e.$slots,`hint`,Qe(_({hint:N.value.a11y.translations.keyboardNavigation,isVisible:Jr.value})),void 0,!0)])):m(``,!0)]),e.$slots.watermark?(b(),h(`div`,kt,[C(e.$slots,`watermark`,Qe(_({isPrinting:T(An)||T(jn)||T(Hr)||T(Ur)})),void 0,!0)])):m(``,!0),e.$slots.legend&&L.value.legend.show&&L.value.legend.position===`bottom`?C(e.$slots,`legend`,{legend:U.value},void 0,!0,8):m(``,!0),!e.$slots.legend&&L.value.legend.show&&L.value.legend.position===`bottom`?(b(),h(`div`,{key:9,ref_key:`chartLegend`,ref:$t},[(b(),p(Be,{key:`legend_bottom_${rn.value}`,legendSet:U.value,config:Kn.value,isCursorPointer:_n.value,onClickMarker:s[1]||=({legend:e})=>rr(e.id)},Ke({item:E(({legend:e,index:t})=>[g(`div`,{onClick:t=>rr(e.id),style:y(`opacity:${A.value.includes(e.id)?.5:1}`)},w(br({legend:e,index:t})),13,At)]),legendToggle:E(()=>[U.value.length>2&&L.value.legend.selectAllToggle.show&&!T(bn)?(b(),p(He,{key:0,backgroundColor:L.value.legend.selectAllToggle.backgroundColor,color:L.value.legend.selectAllToggle.color,fontSize:L.value.legend.fontSize,checked:A.value.length>0,isCursorPointer:_n.value,onToggle:nr},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`,`isCursorPointer`])):m(``,!0)]),_:2},[e.$slots.pattern?{name:`legend-pattern`,fn:E(({legend:e,index:t})=>[Je(Le,{shape:e.shape,radius:30,stroke:`none`,plot:{x:30,y:30},fill:`url(#pattern_${O.value}_${t})`},null,8,[`shape`,`fill`])]),key:`0`}:void 0]),1032,[`legendSet`,`config`,`isCursorPointer`]))],512)):m(``,!0),e.$slots.source?(b(),h(`div`,{key:10,ref_key:`source`,ref:en,dir:`auto`},[C(e.$slots,`source`,{},void 0,!0)],512)):m(``,!0),Je(T(Lt),{teleportTo:I.value.teleportTo,show:H.value.showTooltip&&Jt.value&&A.value.length<D.dataset.length,backgroundColor:I.value.backgroundColor,color:I.value.color,borderRadius:I.value.borderRadius,borderColor:I.value.borderColor,borderWidth:I.value.borderWidth,fontSize:I.value.fontSize,backgroundOpacity:I.value.backgroundOpacity,position:I.value.position,offsetX:I.value.offsetX,offsetY:I.value.offsetY,parent:k.value,content:Yt.value,isFullscreen:$.value,isCustom:I.value.customFormat&&typeof I.value.customFormat==`function`,smooth:I.value.smooth,backdropFilter:I.value.backdropFilter,smoothForce:I.value.smoothForce,smoothSnapThreshold:I.value.smoothSnapThreshold,isA11yMode:hn.value===`keyboard`,a11yPosition:mn.value},{"tooltip-before":E(()=>[C(e.$slots,`tooltip-before`,Qe(_({...gr.value})),void 0,!0)]),tooltip:E(()=>[C(e.$slots,`tooltip`,Qe(_({...gr.value})),void 0,!0)]),"tooltip-after":E(()=>[C(e.$slots,`tooltip-after`,Qe(_({...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`]),qt.value&&N.value.userOptions.buttons.table?(b(),p(tt(Pr.value.component),Xe({key:11},Pr.value.props,{ref_key:`tableUnit`,ref:on,onClose:Ir}),Ke({content:E(()=>[g(`div`,{ref_key:`tableContainer`,ref:In,class:`vue-ui-vertical-bar-table atom-data-table`,style:y(`${N.value.table.useDialog?``:`max-height: 300px; margin-top: 24px`}`)},[g(`div`,jt,[N.value.table.useDialog?m(``,!0):(b(),h(`div`,{key:0,role:`button`,tabindex:`0`,style:y(`width:32px; position: absolute; top: 0; right:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:${_n.value?`pointer`:`default`}; background:${N.value.table.th.backgroundColor};`),onClick:Ir,onKeypress:ot(Ir,[`enter`])},[Je(T(Rt),{name:`close`,stroke:N.value.table.th.color,"stroke-width":2},null,8,[`stroke`])],36)),g(`div`,{style:{width:`100%`,"container-type":`inline-size`},class:v({"vue-ui-responsive":T(Fr)})},[g(`table`,Mt,[N.value.table.useDialog?m(``,!0):(b(),h(`caption`,{key:0,style:y({backgroundColor:N.value.table.th.backgroundColor,color:N.value.table.th.color,outline:N.value.table.th.outline}),class:`vue-ui-data-table__caption`},[qe(w(L.value.title.text)+` `,1),L.value.title.subtitle.text?(b(),h(`span`,Nt,w(L.value.title.subtitle.text),1)):m(``,!0)],4)),g(`thead`,null,[g(`tr`,{role:`row`,style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color}`)},[(b(!0),h(d,null,S(Sr.value.head,e=>(b(),h(`th`,{style:y(`outline:${N.value.table.th.outline}`)},[g(`div`,Pt,w(e),1)],4))),256))],4),g(`tr`,null,[g(`th`,{style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color};outline:${N.value.table.th.outline}`)},null,4),g(`th`,{style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color};outline:${N.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)},` ∑ `+w(N.value.table.td.prefix)+w(isNaN(Z.value)?``:Z.value.toFixed(N.value.table.td.roundingValue))+w(N.value.table.td.suffix),5),g(`th`,{style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color};outline:${N.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`)},` 100% `,4),g(`th`,{style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color};outline:${N.value.table.th.outline}`)},null,4),g(`th`,{style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color};outline:${N.value.table.th.outline}`)},null,4),g(`th`,{style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color};outline:${N.value.table.th.outline}`)},null,4),g(`th`,{style:y(`background:${N.value.table.th.backgroundColor};color:${N.value.table.th.color};outline:${N.value.table.th.outline}`)},null,4)])]),g(`tbody`,null,[(b(!0),h(d,null,S(Sr.value.body,(e,t)=>(b(),h(`tr`,{class:v({"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:y(`background:${N.value.table.td.backgroundColor};color:${N.value.table.td.color}`)},[(b(),h(d,null,S(Cr,(t,n)=>g(`td`,{key:t.key,class:`vue-ui-data-table__tbody__td`,style:y(n===0?`outline:${N.value.table.td.outline};font-variant-numeric: tabular-nums;`:`outline:${N.value.table.td.outline}`),"data-cell":Sr.value.head[n]??``},[g(`div`,It,[n===0?(b(),h(d,{key:0},[e.color?(b(),h(`span`,{key:0,style:y(`color:${e.color};margin-right:3px`)},`⬤`,4)):m(``,!0),g(`span`,null,w(e.parentName),1)],64)):(b(),h(d,{key:1},[qe(w(wr(e,t)),1)],64))])],12,Ft)),64))],6))),256))])])],2)])],4)]),_:2},[N.value.table.useDialog?{name:`title`,fn:E(()=>[qe(w(Pr.value.title),1)]),key:`0`}:void 0,N.value.table.useDialog?{name:`actions`,fn:E(()=>[g(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[2]||=e=>Tr(N.value.userOptions.callbacks.csv),style:y({cursor:_n.value?`pointer`:`default`})},[Je(T(Rt),{name:`fileCsv`,stroke:Pr.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):m(``,!0),C(e.$slots,`skeleton`,{},()=>[T(bn)?(b(),p(De,{key:0})):m(``,!0)],!0)],46,ct))}},[[`__scopeId`,`data-v-d99b9aa1`]]);export{st as n,Lt as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useNestedProp-DnGoh-XS.js";import{$ as n,X as r,i}from"./lib-rPeBMZrn.js";import{t as a}from"./useConfig-_JwRfIqE.js";import{n as o,t as s}from"./useHints-C-TwxM0Y.js";import{t as c}from"./usePrefersMotion-XLHwega2.js";import{Fragment as l,computed as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createTextVNode as m,createVNode as h,defineAsyncComponent as g,normalizeClass as _,normalizeStyle as v,onMounted as y,openBlock as b,ref as x,renderSlot as S,toDisplayString as C,unref as w,useSlots as T,watch as E}from"vue";var D=/* @__PURE__ */ e({default:()=>j}),O=[`aria-labelledby`],k=[`id`],A=[`aria-label`],j={__name:`vue-ui-kpi`,props:{config:{type:Object,default(){return{}}},dataset:{type:Number,default:0}},setup(e){let D=g(()=>import(`./vue-ui-digits-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./useNestedProp-DnGoh-XS.js";import{$ as n,X as r,i}from"./lib-rPeBMZrn.js";import{t as a}from"./useConfig-_JwRfIqE.js";import{n as o,t as s}from"./useHints-C-TwxM0Y.js";import{t as c}from"./usePrefersMotion-XLHwega2.js";import{Fragment as l,computed as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createTextVNode as m,createVNode as h,defineAsyncComponent as g,normalizeClass as _,normalizeStyle as v,onMounted as y,openBlock as b,ref as x,renderSlot as S,toDisplayString as C,unref as w,useSlots as T,watch as E}from"vue";var D=/* @__PURE__ */ e({default:()=>j}),O=[`aria-labelledby`],k=[`id`],A=[`aria-label`],j={__name:`vue-ui-kpi`,props:{config:{type:Object,default(){return{}}},dataset:{type:Number,default:0}},setup(e){let D=g(()=>import(`./vue-ui-digits-Cy3Y6qro.js`).then(e=>e.n)),{vue_ui_kpi:j}=a(),M=c(),N=e,P=u({get:()=>R(),set:e=>e});o({config:()=>P.value,dataset:()=>N.dataset,component:`VueUiKpi`,rules:[s.noHint]});let F=T(),I=u(()=>P.value.debug),L=x(r());y(()=>{F[`chart-background`]&&I.value&&console.warn(`VueUiKpi does not support the #chart-background slot.`)});function R(){return t({userConfig:N.config,defaultConfig:j})}E(()=>N.config,e=>{P.value=R(),H()},{deep:!0});let z=x((N.dataset,N.dataset)),B=x(P.value.useAnimation?P.value.animationValueStart:z.value),V=e=>{let t=P.value.animationFrames,n=Math.abs(e-B.value)/t;function r(){B.value<e?B.value=Math.min(B.value+n,e):B.value>e&&(B.value=Math.max(B.value-n,e)),B.value!==e&&requestAnimationFrame(r)}r()};y(()=>{H()});function H(){P.value.useAnimation&&!M.value?(B.value=P.value.animationValueStart,V(N.dataset)):B.value=N.dataset}return E(()=>N.dataset,e=>{P.value.useAnimation&&!M.value?V(e):B.value=e}),(t,r)=>(b(),f(`div`,{class:_(`vue-data-ui-component vue-ui-kpi ${P.value.layoutClass}`),style:v(`background:${P.value.backgroundColor}; ${P.value.layoutCss}`),"aria-labelledby":`kpi-title-${L.value}`},[P.value.title||t.$slots.title?(b(),f(`div`,{key:0,class:_(`vue-ui-kpi-title ${P.value.titleClass}`),style:v(`font-family: ${P.value.fontFamily}; font-size:${P.value.titleFontSize}px; color:${P.value.titleColor}; font-weight:${P.value.titleBold?`bold`:`normal`}; ${P.value.titleCss}`),id:`kpi-title-${L.value}`},[S(t.$slots,`title`,{comment:e.dataset}),m(` `+C(P.value.title),1)],14,k)):d(``,!0),S(t.$slots,`comment-before`,{comment:e.dataset}),p(`div`,{class:_(`vue-ui-kpi-value ${P.value.valueClass}`),style:v(`font-family: ${P.value.fontFamily}; font-size:${P.value.valueFontSize}px; color:${P.value.valueColor}; font-weight:${P.value.valueBold?`bold`:`normal`}; ${P.value.valueCss}`),role:`status`,"aria-live":`polite`,"aria-atomic":`true`,"aria-label":B.value.toFixed(P.value.valueRounding)},[S(t.$slots,`value`,{comment:e.dataset}),P.value.analogDigits.show?(b(),f(`div`,{key:0,style:v({height:P.value.analogDigits.height+`px`})},[h(w(D),{dataset:Number(B.value.toFixed(P.value.valueRounding)),config:{backgroundColor:P.value.backgroundColor,digits:{color:P.value.analogDigits.color,skeletonColor:P.value.analogDigits.skeletonColor}}},null,8,[`dataset`,`config`])],4)):(b(),f(l,{key:1},[m(C(w(i)(P.value.formatter,B.value,w(n)({p:P.value.prefix,v:B.value,s:P.value.suffix,r:P.value.valueRounding}))),1)],64))],14,A),S(t.$slots,`comment-after`,{comment:e.dataset})],14,O))}};export{D as n,j as t};
|