import{u,Q as V,d as A,S as X}from"./index.09a12f75.js";function Z(d,c,w,p,M,y){return d>=w&&d<=M&&c>=p&&c<=y}function ee(d){let c,w,{ignore:p=[]}=d,M=d.radius??0;function y(){c=devicePixelRatio,w=Math.round(10*c)+"px Arial"}y(),window.addEventListener("dppxchange",y);const f=d.ori,z=d.dir,L=d.stacked,E=.9,S=X,N=1,O=X;function Q(e,t,n=!0,i=E){let s=Array.from({length:t},()=>({offs:Array(e).fill(0),size:Array(e).fill(0)}));return A(e,i,S,null,(r,l,o)=>{A(t,N,O,null,(a,v,h)=>{s[a].offs[r]=l+(n?o*v:0),s[a].size[r]=o*(n?h:1)})}),s}let x,T,q=u.paths.bars({radius:M,disp:{x0:{unit:2,values:(e,t,n,i)=>x[t].offs},size:{unit:2,values:(e,t,n,i)=>x[t].size},...d.disp},each:(e,t,n,i,s,r,l)=>{i-=e.bbox.left,s-=e.bbox.top,g.add({x:i,y:s,w:r,h:l,sidx:t,didx:n})}});function H(e,t,n,i){e.ctx.save(),e.ctx.font=w,e.ctx.fillStyle="black",u.orient(e,t,(s,r,l,o,a,v,h,P,C,k,F,$,D,I)=>{const G=z*(f==0?1:-1),W=Math.round(x[t].size[0]*k);x[t].offs.forEach((J,b)=>{if(l[b]!=null){let _=k*J,B=Math.round(P+(G==1?_:k-_-W)),R=Math.round(W),m=h(l[b],a,F,C),K=f==0?Math.round(B+R/2):Math.round(m),U=f==0?Math.round(m):Math.round(B+R/2);e.ctx.textAlign=f==0?"center":l[b]>=0?"left":"right",e.ctx.textBaseline=f==1?"middle":l[b]>=0?"bottom":"top",e.ctx.fillText(l[b],K,U)}})}),e.ctx.restore()}function j(e,t,n){let[i,s]=u.rangeNum(0,n,.05,!0);return[0,s]}let g;return{hooks:{drawClear:e=>{if(g=g||new V(0,0,e.bbox.width,e.bbox.height),g.clear(),e.series.forEach(t=>{t._paths=null}),x=[null].concat(Q(e.data[0].length,e.series.length-1-p.length,!L,E)),d.disp?.fill!=null){T=[null];for(let t=1;t<e.data.length;t++)T.push({fill:d.disp.fill.values(e,t),stroke:d.disp.stroke.values(e,t)})}}},opts:(e,t)=>{const n={range:j,ori:f==0?1:0};let i;u.assign(t,{select:{show:!1},cursor:{x:!1,y:!1,dataIdx:(s,r)=>{if(r==1){i=null;let l=s.cursor.left*c,o=s.cursor.top*c;g.get(l,o,1,1,a=>{Z(l,o,a.x,a.y,a.x+a.w,a.y+a.h)&&(i=a)})}return i&&r==i.sidx?i.didx:null},points:{fill:"rgba(255,255,255, 0.3)",bbox:(s,r)=>{let l=i&&r==i.sidx;return{left:l?i.x/c:-10,top:l?i.y/c:-10,width:l?i.w/c:0,height:l?i.h/c:0}}}},scales:{x:{time:!1,distr:2,ori:f,dir:z,range:(s,r,l)=>{r=0,l=Math.max(1,s.data[0].length-1);let o=0;A(s.data[0].length,E,S,0,(v,h,P)=>{o=h+P/2});let a=l-r;if(o==.5)r-=a;else{let h=(1/(1-o*2)*a-a)/2;r-=h,l+=h}return[r,l]}},rend:n,size:n,mem:n,inter:n,toggle:n}}),f==1&&(t.padding=[0,null,0,null]),u.assign(t.axes[0],{splits:(s,r)=>{const l=z*(f==0?1:-1),o=s._data[0].slice();return l==1?o:o.reverse()},values:s=>s.data[0],gap:15,size:f==0?40:150,labelSize:20,grid:{show:!1},ticks:{show:!1},side:f==0?2:3}),t.series.forEach((s,r)=>{r>0&&!p.includes(r)&&u.assign(s,{paths:q,points:{show:H}})})}}}export{ee as default};
