import{ai as v,_ as y,a as w}from"./app-QjDgb7aF.js";import{b,j as s,g as k,i as B,p as d,D as m,H as u,F as T,G as S,q as g,t as Y,o as x,a5 as D,a}from"./vue-Cm77DuTi.js";const M={key:0,class:"qpcyisrl"},O={key:0,class:"title"},X={class:"series"},q=b({__name:"MkChartTooltip",props:{showing:{type:Boolean},x:{},y:{},title:{},series:{}},emits:["closed"],setup(o,{emit:i}){const n=i;return(r,l)=>(s(),k(v,{ref:"tooltip",showing:o.showing,x:o.x,y:o.y,"max-width":340,direction:"top","inner-margin":16,onClosed:l[0]||(l[0]=e=>n("closed"))},{default:B(()=>[o.title||o.series?(s(),d("div",M,[o.title?(s(),d("div",O,m(o.title),1)):u("",!0),o.series?(s(!0),d(T,{key:1},S(o.series,e=>(s(),d("div",X,[g("span",{class:"color",style:Y({background:e.backgroundColor,borderColor:e.borderColor})},null,4),g("span",null,m(e.text),1)]))),256)):u("",!0)])):u("",!0)]),_:1},8,["showing","x","y"]))}}),F=y(q,[["__scopeId","data-v-1d727ab4"]]);function j(o={position:"top"}){const i=a(!1),n=a(0),r=a(0),l=a(null),e=a(null);let c;w(F,{showing:i,x:n,y:r,title:l,series:e},{}).then(({dispose:t})=>{c=t}),x(()=>{c&&c()}),D(()=>{i.value=!1});function C(t){if(t.tooltip.opacity===0){i.value=!1;return}l.value=t.tooltip.title[0],e.value=t.tooltip.body.map((h,f)=>({backgroundColor:t.tooltip.labelColors[f].backgroundColor,borderColor:t.tooltip.labelColors[f].borderColor,text:h.lines[0]}));const p=t.chart.canvas.getBoundingClientRect();i.value=!0,n.value=p.left+window.pageXOffset+t.tooltip.caretX,o.position==="top"?r.value=p.top+window.pageYOffset:o.position==="middle"&&(r.value=p.top+window.pageYOffset+t.tooltip.caretY)}return{handler:C}}export{j as u};
//# sourceMappingURL=use-chart-tooltip-CwWaLiz4.js.map
