@canplot/react 0.1.10 → 0.1.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/canplot.cjs +4 -4
- package/dist/canplot.cjs.map +1 -1
- package/dist/canplot.mjs +655 -663
- package/dist/canplot.mjs.map +1 -1
- package/dist/helpers.d.ts +0 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/interactions/positioning.d.ts +1 -1
- package/dist/interactions/positioning.d.ts.map +1 -1
- package/dist/interactions/types.d.ts +12 -8
- package/dist/interactions/types.d.ts.map +1 -1
- package/dist/tickUtils.d.ts +2 -1
- package/dist/tickUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/canplot.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react/jsx-runtime"),S=require("react"),J=require("zustand"),B=(t,s,e)=>Math.min(Math.max(t,s),e),Tt=t=>t.reduce((s,e)=>s+(e??0),0),kt=(t,s)=>{let e=0;for(let c=0;c<t.length;c++)Math.abs(t[c]-s)<Math.abs(t[e]-s)&&(e=c);return e},pt=(t,s,e,c)=>{const{min:o,max:n}=_(t,e),l=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,r=(V(t,e)?l.width:l.height)/(n-o);return s/r},_=(t,s)=>{const e=t.scales.find(c=>c.id===s);if(!e)throw new Error(`Scale ${s} not found`);return e},V=(t,s)=>t.scales.find(e=>e.id===s)?.origin==="x",Et=(t,s)=>t.scales.find(e=>e.id===s)?.origin==="y",L=(t,s)=>{const e=window.devicePixelRatio||1;t.lineCap=s?.lineCap??"butt",t.lineDashOffset=e*(s?.lineDashOffset??0),t.lineJoin=s?.lineJoin??"miter",t.lineWidth=e*(s?.lineWidth??1),t.miterLimit=e*(s?.miterLimit??10),t.strokeStyle=s?.strokeStyle??"black",t.fillStyle=s?.fillStyle??t.strokeStyle,t.font=s?.font??`${10*e}px sans-serif`,t.textAlign=s?.textAlign??"start",t.direction=s?.direction??"inherit",t.textBaseline=s?.textBaseline??"alphabetic",t.fontKerning=s?.fontKerning??"auto"},Q=(t,s,e,c)=>{const o=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,{min:n,max:l}=_(t,e),r=(V(t,e)?o.width:o.height)/(l-n);return s*r},$=(t,s,e,c)=>{const{min:o}=_(t,e),n=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,l=Q(t,s-o,e,c);return V(t,e)?B(n.x+l,n.x-10*n.width,n.x+11*n.width):B(n.y+n.height-l,n.y-10*n.height,n.y+11*n.height)},Pt=(t,s,e)=>{const{min:c,max:o}=_(t,e);return B(s,c,o)},j=(t,s,e)=>{const c=e==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS;return B(s,c.x,c.x+c.width)},O=(t,s,e)=>{const c=e==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS;return B(s,c.y,c.y+c.height)},G=(t,s,e)=>{const{min:c,max:o}=_(t,e);return s>=c&&s<=o},U=(t,s,e,c)=>{const{min:o,max:n}=_(t,e),l=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,r=V(t,e)?(s-l.x)/l.width:(l.height-s+l.y)/l.height;return o+r*(n-o)},Mt=t=>{const{ctx:s,scales:e}=t;for(const c of e){if(!c.axis)continue;s.save(),L(s,{strokeStyle:"black",fillStyle:"black",lineWidth:1,...c.axis.style});const o=c.axis.canvasRect;if(c.origin==="x"){if(c.axis.position==="bottom")s.beginPath(),s.moveTo(o.x,o.y),s.lineTo(o.x+o.width,o.y),s.stroke();else if(c.axis.position==="top"){const n=o.y+o.height;s.beginPath(),s.moveTo(o.x,n),s.lineTo(o.x+o.width,n),s.stroke()}}else if(c.axis.position==="left"){const n=o.x+o.width;s.beginPath(),s.moveTo(n,o.y),s.lineTo(n,o.y+o.height),s.stroke()}else c.axis.position==="right"&&(s.beginPath(),s.moveTo(o.x,o.y),s.lineTo(o.x,o.y+o.height),s.stroke());s.restore()}},At=()=>J.createStore((t,s)=>{const e=()=>{const c=s()._frame;if(!c)throw new Error("No frame set in frame store");return c};return{_frame:null,getFrame:e,getCtx:()=>e().ctx,clampXPosToChartArea:(c,o)=>j(e(),c,o??"canvas"),clampYPosToChartArea:(c,o)=>O(e(),c,o??"canvas"),valToPos:(c,o,n)=>$(e(),c,o,n??"canvas"),valToPxDistance:(c,o,n)=>Q(e(),c,o,n??"canvas"),valFits:(c,o)=>G(e(),c,o),getScale:c=>_(e(),c)}}),Rt=()=>J.createStore(t=>({notify:()=>{t(s=>({version:s.version+1}))},version:0})),lt=S.createContext(null),yt=S.createContext(null),K=(t,s)=>{const e=S.useContext(lt),c=S.useContext(yt);if(!e||!c)throw new Error("useFrame must be used within a CanPlot component");const o=S.useRef(t);o.current=t,S.useLayoutEffect(()=>{o.current(e.getState()),e.subscribe(n=>{n._frame&&o.current(n)})},[e]),S.useEffect(()=>{c.getState().notify()},[c,...s])},tt=t=>{const s=S.useContext(lt);if(!s)throw new Error("useFrame must be used within a CanPlot component");return J.useStore(s,t??(e=>e.getFrame()))};function _t(t){return s=>{for(const e of t)at(e,s)}}function Lt(t){return s=>{const e=[];for(const c of t){const o=at(c,s),n=typeof o=="function";e.push(n?o:()=>at(c,null))}return()=>{for(const c of e)c()}}}function at(t,s){if(typeof t=="function")return t(s);t&&(t.current=s)}var Ut=parseInt(S.version.split(".")[0],10)>=19?Lt:_t;const Dt=S.forwardRef(({configuration:t,children:s,style:e,className:c},o)=>{const n=S.useRef(null),l=S.useRef(null),r=It(l),d=S.useMemo(At,[]),u=S.useMemo(Rt,[]);S.useLayoutEffect(()=>{d.setState({_frame:Ft(t,r,n.current)})},[t,r,n,d]),S.useLayoutEffect(()=>d.subscribe(p=>{p._frame&&Kt(p._frame)}),[d]),S.useLayoutEffect(()=>{let p=!1;return u.subscribe(()=>{p||(p=!0,window.requestAnimationFrame(()=>{p=!1,d.setState(f=>({_frame:f._frame?{...f._frame}:null}))}))})},[u,d]);const a=window.devicePixelRatio||1;return A.jsxs("div",{ref:Ut([o,l]),className:c,style:{position:"relative",overflow:"hidden",...e},"data-canplotroot":!0,children:[A.jsx("canvas",{ref:n,width:r.width*a,height:r.height*a,style:{inset:0,position:"absolute",width:`${r.width}px`,height:`${r.height}px`}}),A.jsx(Xt,{frameStore:d,updateRequestStore:u,children:s})]})}),Xt=({frameStore:t,updateRequestStore:s,children:e})=>J.useStore(t,o=>!!o._frame)?A.jsx(yt.Provider,{value:s,children:A.jsx(lt.Provider,{value:t,children:e})}):null,It=t=>{const[s,e]=S.useState({width:0,height:0}),[c]=S.useState(()=>new ResizeObserver(o=>{for(const n of o){const l=Math.round(n.contentRect.width),r=Math.round(n.contentRect.height);e(d=>d.width!==l||d.height!==r?{...d,width:l,height:r}:d)}}));return S.useLayoutEffect(()=>{if(!t.current)return;const o=t.current.clientWidth,n=t.current.clientHeight;return e(l=>l.width!==o||l.height!==n?{...l,width:o,height:n}:l),c.observe(t.current,{box:"border-box"}),()=>c.disconnect()},[c,t]),s},Ft=(t,s,e)=>{const c=e?.getContext("2d");if(!c)return null;const o=window.devicePixelRatio||1;if(s.width===0||s.height===0)return null;const n={x:t.padding.left,y:t.padding.top,width:s.width-t.padding.left-t.padding.right,height:s.height-t.padding.top-t.padding.bottom};for(const m of t.scales)m.axis&&(m.origin==="x"?(m.axis.position==="bottom"||m.axis.position==="top")&&(n.height=Math.max(0,n.height-m.axis.size),m.axis.position==="top"&&(n.y+=m.axis.size)):(m.axis.position==="left"||m.axis.position==="right")&&(n.width=Math.max(0,n.width-m.axis.size),m.axis.position==="left"&&(n.x+=m.axis.size)));const l={x:n.x*o,y:n.y*o,width:n.width*o,height:n.height*o},r=[];let d=t.padding.left*o,u=c.canvas.width-t.padding.right*o,a=c.canvas.height-t.padding.bottom*o,p=t.padding.top*o;for(const m of t.scales){if(!m.axis){r.push({...m,axis:null});continue}let i;if(m.origin==="x")switch(m.axis.position){case"bottom":a-=m.axis.size*o,i={x:n.x,y:a/o,width:n.width,height:m.axis.size};break;case"top":p+=m.axis.size*o,i={x:n.x,y:p/o-m.axis.size,width:n.width,height:m.axis.size};break;case"left":case"right":throw new Error("Invalid axis position for x origin")}else switch(m.axis.position){case"left":d+=m.axis.size*o,i={x:d/o-m.axis.size,y:n.y,width:m.axis.size,height:n.height};break;case"right":u-=m.axis.size*o,i={x:u/o,y:n.y,width:m.axis.size,height:n.height};break;case"top":case"bottom":throw new Error("Invalid axis position for y origin")}const h={x:i.x*o,y:i.y*o,width:i.width*o,height:i.height*o};r.push({...m,axis:{...m.axis,cssRect:i,canvasRect:h}})}return{ctx:c,dpr:o,padding:t.padding,scales:r,chartAreaCSS:n,chartAreaCanvasPX:l}},Kt=t=>{t.ctx.clearRect(0,0,t.ctx.canvas.width,t.ctx.canvas.height),Mt(t)},Yt=({data:t,xScaleId:s,yScaleId:e,style:c})=>(K(({getCtx:o,clampXPosToChartArea:n,clampYPosToChartArea:l,valToPos:r})=>{const d=o();d.save(),d.beginPath(),L(d,c);for(const u of t){const a=n(r(u.x,s)),p=l(r(u.y,e));d.lineTo(a,p)}d.stroke(),d.restore()},[t,s,e,c]),null),zt=({data:t,xScaleId:s,yScaleId:e,radius:c=5,style:o})=>(K(({getCtx:n,valToPos:l,valFits:r})=>{const d=n();d.save(),d.beginPath(),L(d,o);for(const u of t){if(!r(u.x,s)||!r(u.y,e))continue;const a=l(u.x,s),p=l(u.y,e);d.moveTo(a+c,p),d.arc(a,p,c,0,Math.PI*2)}d.stroke(),d.fill(),d.restore()},[t,s,e,c,o]),null),jt=({data:t,xScaleId:s,yScaleId:e,style:c,barWidth:o,xPositionOffset:n,radius:l})=>(K(({getCtx:r,valToPxDistance:d,valToPos:u,clampXPosToChartArea:a,clampYPosToChartArea:p})=>{if(t.length===0)return;const f=r();f.save(),L(f,c);const m=d(o,s);f.beginPath();for(const i of t){const y=u(i.x,s)-m/2+n*m,x=p(u(0,e)),w=p(u(i.y,e)),v=x-w,g=a(y),k=a(y+m)-g;l?f.roundRect(g,w,k,v,l):f.rect(g,w,k,v)}f.closePath(),f.fill(),c?.strokeStyle&&f.stroke(),f.restore()},[t,s,e,c,o,n,l]),null),Ot=({data:t,xScaleId:s,yScaleId:e,style:c})=>(K(({getCtx:o,clampXPosToChartArea:n,clampYPosToChartArea:l,valToPos:r})=>{const d=[];for(const a of t){const p=n(r(a.x,s)),f=l(r(a.y[0],e)),m=l(r(a.y[1],e));d.push({x:p,y:f}),d.unshift({x:p,y:m})}const u=o();if(d.length>0){u.save(),u.beginPath(),L(u,c),u.moveTo(d[0].x,d[0].y);for(const a of d)u.lineTo(a.x,a.y);u.closePath(),u.fill(),u.restore()}},[t,s,e,c]),null),Bt=({data:t,stroked:s,xScaleId:e,yScaleId:c,style:o})=>(K(({getCtx:n,clampXPosToChartArea:l,clampYPosToChartArea:r,valToPos:d})=>{const u=[],a=n();for(const i of t){const h=l(d(i.x,e)),y=r(d(i.y,c));u.push({x:h,y})}const p=u.at(0),f=u.at(-1);if(!p||!f)return;const m=r(d(0,c));a.save(),a.beginPath(),L(a,o),a.moveTo(p.x,m);for(const i of u)a.lineTo(i.x,i.y);if(a.lineTo(f.x,m),a.closePath(),a.fill(),s){a.beginPath(),a.moveTo(p.x,p.y);for(const i of u)a.lineTo(i.x,i.y);a.stroke()}a.restore()},[t,s,e,c,o]),null),$t=(t,s)=>tt(({clampXPosToChartArea:e,clampYPosToChartArea:c,getScale:o,valToPos:n,valFits:l})=>{const r={};for(const d in t){const u=t[d];switch(u.exceeding){case"discard":{if(l(u.value,u.scaleId)){const a=n(u.value,u.scaleId,s);r[d]=a}break}case"clamp":{const a=n(u.value,u.scaleId,s);r[d]=o(u.scaleId)?.origin==="x"?e(a,s):c(a,s);break}}}return r}),Nt=({scaleId:t,tickStyle:s,labelStyle:e,labelGap:c,tickSize:o,ticks:n})=>(K(({getCtx:l,valToPos:r,getScale:d,getFrame:u})=>{const a=l(),p=d(t);if(!p||!p.axis||p.origin!=="x")return;const f=p.axis,m=f.position==="top"?f.canvasRect.y+f.canvasRect.height:f.canvasRect.y,i=window.devicePixelRatio||1,h=m,y=(o??6)*i,x=f.position==="top"?m-y:m+y,w=(c??12)*i;a.save(),a.fontKerning="auto",L(a,{...s}),a.beginPath();const v=Array.isArray(n)?n:n({...p,axis:f},u());for(const{value:g}of v){const k=r(g,t,"canvas");a.moveTo(k,h),a.lineTo(k,x)}a.stroke(),a.restore(),a.save(),L(a,{textBaseline:f.position==="top"?"bottom":"top",textAlign:"center",...s,...e});for(const{value:g,label:k}of v){const C=r(g,t,"canvas"),T=k.split(`
|
|
2
|
-
`);for(let E=0;E<
|
|
3
|
-
`);for(let T=0;T<C.length;T++)a.fillText(` ${C[T]} `,y,k+T*x)}a.restore()},[n,t,s,e]),null),P=()=>{const t=[];return{addEventListener:(s,e)=>(t.push({syncKey:s,callback:e}),()=>{const c=t.findIndex(o=>o.callback===e);c!==-1&&t.splice(c,1)}),dispatchEvent:(s,e)=>{for(const c of t)c.syncKey===s&&c.callback(s,e)}}},b={dblclick:P(),click:P(),contextmenu:P(),move:P(),mousedown:P(),mouseup:P(),spanselect:P(),documentmouseup:P(),pressandwheel:P(),sync_dblclick:P(),sync_click:P(),sync_move:P(),sync_mousedown:P(),sync_mouseup:P(),sync_spanselect:P(),sync_pressandwheel:P(),sync_contextmenu:P()},M=(t,s,e)=>{const c=S.useRef(e);c.current=e,S.useEffect(()=>b[t].addEventListener(s,(n,l)=>{c.current(l,n)}),[s,t,c])},ut=S.createContext(""),et=(t,s)=>{const e=S.useContext(ut);return M(t,e,s)},Ht=(t,s,e,c,o)=>{if(!s)return;const n=c??e.scales.find(p=>p.origin==="x")?.id,l=o??e.scales.find(p=>p.origin==="y")?.id;if(!n||!l)return;const r=t.clientX-s.left,d={scaleId:n,value:U(e,r,n,"css")},u=t.clientY-s.top,a={scaleId:l,value:U(e,u,l,"css")};return{pointerSyncPosition:{x:d,y:a},cssX:r,cssY:u}},z=(t,s)=>{const e=t.x?$(s,t.x.value,t.x.scaleId,"css"):0,c=t.y?$(s,t.y.value,t.y.scaleId,"css"):0;return{cssX:e,cssY:c,scaled:Object.fromEntries(s.scales.map(o=>{const n=o.origin==="y"?c:e;return[o.id,U(s,n,o.id,"css")]}))}},ft=(t,s,e)=>{if(!s){const l=t==="x"?e.chartAreaCSS.x:e.chartAreaCSS.y,r=t==="x"?e.chartAreaCSS.x+e.chartAreaCSS.width:e.chartAreaCSS.y+e.chartAreaCSS.height;return{fromCSS:l,toCSS:r,scaled:e.scales.flatMap(d=>{if(d.origin!==t)return[];const{min:u,max:a}=_(e,d.id);return[{scaleId:d.id,from:u,to:a}]})}}const c=$(e,s.from,s.scaleId,"css"),o=$(e,s.to,s.scaleId,"css"),n=e.scales.flatMap(l=>{if(l.origin!==t)return[];const r=U(e,c,l.id,"css"),d=U(e,o,l.id,"css");return[{scaleId:l.id,from:r,to:d}]});return{fromCSS:c,toCSS:o,scaled:n}},qt=({id:t,onClick:s,onDblClick:e,onMouseMove:c,onMouseDown:o,onMouseUp:n,onDocumentMouseUp:l,onSpanSelect:r,onContextMenu:d,className:u,style:a,sync:p,children:f})=>{const m=S.useId(),i=t||m;return M("dblclick",i,h=>{e?.(h)}),M("click",i,h=>{s?.(h)}),M("move",i,h=>{c?.(h)}),M("mousedown",i,h=>{o?.(h)}),M("mouseup",i,h=>{n?.(h)}),M("documentmouseup",i,h=>{l?.(h)}),M("spanselect",i,h=>{r?.(h)}),M("contextmenu",i,h=>{d?.(h)}),A.jsxs(ut.Provider,{value:i,children:[A.jsx(Wt,{className:u,style:a,sync:p}),f]})},Wt=({className:t,style:s,sync:e})=>{const c=S.useRef(null),o=tt(),n=S.useRef(o);n.current=o;const l=S.useContext(ut),r=e?.key||l,d=S.useRef(null),u=S.useRef(null),a=S.useRef(null),p=()=>{const i=c.current?.parentElement;if(i){if(i.dataset.canplotroot===void 0)throw new Error("ChartAreaInteractions must be used within a CanPlot component");return i.getBoundingClientRect()}},f=(i,h)=>{const y=Ht(i,p(),n.current,e?.xViaScaleId,e?.yViaScaleId);y&&h(y.pointerSyncPosition,{cssX:y.cssX,cssY:y.cssY},{ctrlKey:i.ctrlKey,altKey:i.altKey,shiftKey:i.shiftKey,metaKey:i.metaKey})},m=S.useRef(f);return m.current=f,S.useEffect(()=>{const i=v=>{const g=u.current;g&&b.sync_spanselect.dispatchEvent(r,{...g,completed:!0}),b.documentmouseup.dispatchEvent(r,{frame:n.current,keys:{ctrlKey:v.ctrlKey,altKey:v.altKey,shiftKey:v.shiftKey,metaKey:v.metaKey}})},h=v=>{const g={ctrlKey:v.ctrlKey,altKey:v.altKey,shiftKey:v.shiftKey,metaKey:v.metaKey},k=a.current;if(k&&Object.entries(g).some(([T,E])=>k.keys[T]!==E)){const T={...k,keys:g};a.current=T,b.sync_move.dispatchEvent(r,T)}const C=u.current;if(C&&Object.entries(g).some(([T,E])=>C.keys[T]!==E)){v.stopPropagation(),v.preventDefault();const T={...C,keys:g};u.current=T,b.sync_spanselect.dispatchEvent(r,T)}},y=v=>{m.current(v,(g,{cssX:k,cssY:C},T)=>{const E=d.current;if(!E||!g.x||!g.y)return;const D=n.current,R=E.xRangeCss.start,N=k,Y=E.yRangeCss.start,nt=C,ot=_(D,g.x.scaleId),ct=_(D,g.y.scaleId);d.current={xRangeCss:{start:R,end:N},yRangeCss:{start:Y,end:nt}};let X="none";const it=Math.abs(Y-nt),rt=Math.abs(R-N);it<10&&rt<10?X="none":it>30&&rt>30?X="box":it>rt?X="y":X="x";const Ct=X==="x"||X==="box"?{scaleId:ot.id,from:U(D,j(n.current,R,"css"),ot.id,"css"),to:U(D,j(n.current,N,"css"),ot.id,"css")}:void 0,bt=X==="y"||X==="box"?{scaleId:ct.id,from:U(D,O(n.current,Y,"css"),ct.id,"css"),to:U(D,O(n.current,nt,"css"),ct.id,"css")}:void 0,ht={mode:X,xRange:Ct,yRange:bt,completed:!1,keys:T};u.current=ht,b.sync_spanselect.dispatchEvent(r,ht)})},x=v=>{m.current(v,(g,k,C)=>{if(Object.values(C).some(E=>E)){v.preventDefault();const E=Math.abs(v.deltaY)>Math.abs(v.deltaX)?v.deltaY:v.deltaX;b.sync_pressandwheel.dispatchEvent(r,{positions:g,keys:C,deltaX:v.deltaX,deltaY:v.deltaY,deltaAbs:E})}})};document.addEventListener("mouseup",i),document.addEventListener("keydown",h),document.addEventListener("keyup",h),document.addEventListener("mousemove",y);const w=c.current;return w?.addEventListener("wheel",x,{passive:!1}),()=>{document.removeEventListener("mouseup",i),document.removeEventListener("keydown",h),document.removeEventListener("keyup",h),document.removeEventListener("mousemove",y),w?.removeEventListener("wheel",x)}},[n,r,m]),M("sync_dblclick",r,i=>{const h=z(i.positions,n.current);h&&b.dblclick.dispatchEvent(l,{frame:n.current,pointer:h,keys:i.keys})}),M("sync_click",r,i=>{const h=z(i.positions,n.current);h&&b.click.dispatchEvent(l,{frame:n.current,pointer:h,keys:i.keys})}),M("sync_contextmenu",r,i=>{const h=z(i.positions,n.current);h&&b.contextmenu.dispatchEvent(l,{frame:n.current,pointer:h,keys:i.keys})}),M("sync_move",r,i=>{const h=i.positions?z(i.positions,n.current):null;a.current=i,b.move.dispatchEvent(l,{frame:n.current,pointer:h??null,keys:i.keys})}),M("sync_mousedown",r,i=>{const h=z(i.positions,n.current);h&&b.mousedown.dispatchEvent(l,{frame:n.current,pointer:h,keys:i.keys})}),M("sync_mouseup",r,i=>{const h=z(i.positions,n.current);h&&b.mouseup.dispatchEvent(l,{frame:n.current,pointer:h,keys:i.keys})}),M("sync_pressandwheel",r,i=>{const h=z(i.positions,n.current);h&&b.pressandwheel.dispatchEvent(l,{frame:n.current,pointer:h,keys:i.keys,deltaX:i.deltaX,deltaY:i.deltaY,deltaAbs:i.deltaAbs})}),M("sync_spanselect",r,i=>{const h=ft("x",i.xRange,n.current),y=ft("y",i.yRange,n.current),x=h.scaled,w=y.scaled;i.completed&&(d.current=null),b.spanselect.dispatchEvent(l,{mode:i.mode,frame:n.current,xRanges:x,yRanges:w,completed:i.completed,x:{fromCSS:h.fromCSS,toCSS:h.toCSS},y:{fromCSS:y.fromCSS,toCSS:y.toCSS},keys:i.keys})}),A.jsx("div",{ref:c,id:"interactions",className:t,style:{position:"absolute",left:o.chartAreaCSS.x,top:o.chartAreaCSS.y,width:o.chartAreaCSS.width,height:o.chartAreaCSS.height,zIndex:25,...s},onDragStart:i=>{i.preventDefault()},onClick:i=>{f(i,(h,y,x)=>{b.sync_click.dispatchEvent(r,{positions:h,keys:x})})},onMouseLeave:i=>{f(i,(h,y,x)=>{b.sync_move.dispatchEvent(r,{positions:null,keys:x})})},onMouseMove:i=>{f(i,(h,y,x)=>{b.sync_move.dispatchEvent(r,{positions:h,keys:x})})},onMouseDown:i=>{f(i,(h,{cssX:y,cssY:x},w)=>{b.sync_mousedown.dispatchEvent(r,{positions:h,keys:w}),u.current=null,d.current={xRangeCss:{start:y,end:y},yRangeCss:{start:x,end:x}}})},onMouseUp:i=>{f(i,(h,y,x)=>{b.sync_mouseup.dispatchEvent(r,{positions:h,keys:x});const w=u.current;u.current=null;const v=d.current;if(d.current=null,v&&w){const g={...w,keys:x,completed:!0};b.sync_spanselect.dispatchEvent(r,g)}})},onContextMenu:i=>{i.preventDefault(),f(i,(h,y,x)=>{b.sync_contextmenu.dispatchEvent(r,{positions:h,keys:x})})},onDoubleClick:i=>{f(i,(h,y,x)=>{b.sync_dblclick.dispatchEvent(r,{positions:h,keys:x})})}})},Gt=({data:t,renderTooltip:s,xScaleId:e})=>{const[c,o]=S.useState(null);et("move",l=>{o(l)});const n=S.useMemo(()=>{if(!c)return null;const{frame:l,pointer:r}=c,d=r?.scaled[e];if(d===void 0)return null;const u=[];let a=d;for(const p of t){let f=null,m=1/0;for(const[h,y]of p.points.entries()){if(!G(l,y.x,e)||!G(l,y.y,p.yScaleId))continue;const x=Math.abs(y.x-d);x<m&&(m=x,f=h)}const i=p.points[f??-1];if(!i||Q(l,m,e,"css")>30){u.push({seriesId:p.seriesId,y:null});continue}a=i.x,u.push({seriesId:p.seriesId,y:i.y})}return{frame:l,x:a,points:u}},[t,c,e]);return s(n)},Zt=({makeXStyle:t,makeXClassName:s,makeYStyle:e,makeYClassName:c})=>{const[o,n]=S.useState(null);if(et("move",a=>{n(a)}),!o)return null;const{frame:l,pointer:r}=o,d=j(l,r?.cssX??0,"css"),u=O(l,r?.cssY??0,"css");return A.jsxs(A.Fragment,{children:[A.jsx("div",{"data-show":!!r,className:s?.(o),style:{position:"absolute",left:0,top:l.chartAreaCSS.y,height:l.chartAreaCSS.height,borderColor:"red",borderLeftWidth:"1px",borderLeftStyle:"solid",pointerEvents:"none",opacity:r?1:0,transform:`translateX(${d}px)`,...t?.(o)}}),A.jsx("div",{className:c?.(o),"data-show":!!r,style:{position:"absolute",top:0,height:0,borderTop:"solid 1px red",left:l.chartAreaCSS.x,width:l.chartAreaCSS.width,pointerEvents:"none",opacity:r?1:0,transform:`translateY(${u}px)`,...e?.(o)}})]})},Jt=({makeClassName:t,makeStyle:s})=>{const[e,c]=S.useState(null);et("spanselect",n=>{c(n.mode==="none"||n.completed?null:n)});const o=S.useMemo(()=>{if(!e)return null;const n=j(e.frame,e.x.fromCSS,"css"),l=j(e.frame,e.x.toCSS,"css"),r=O(e.frame,e.y.fromCSS,"css"),d=O(e.frame,e.y.toCSS,"css"),u=Math.min(n,l),a=Math.min(r,d),p=Math.abs(l-n),f=Math.abs(d-r);return{leftPx:u,topPx:a,widthPx:p,heightPx:f}},[e]);return A.jsx("div",{className:e?t?.(e):void 0,style:{position:"absolute",visibility:e?"visible":"hidden",left:`${o?.leftPx??0}px`,top:`${o?.topPx??0}px`,width:`${o?.widthPx??0}px`,height:`${o?.heightPx??0}px`,pointerEvents:"none",...e?s?.(e):void 0}})},Qt=({style:t,children:s,scaleId:e,...c})=>{const o=tt(n=>n.getScale(e)?.axis);return o?A.jsx("div",{style:{position:"absolute",backgroundColor:"#0000ff11",left:o.cssRect.x,top:o.cssRect.y,height:o.cssRect.height,width:o.cssRect.width,...t},...c,children:s}):null},xt=60,te=30,St="UTC",ee="en-GB",se=({space:t,formatter:s}={})=>(e,c)=>{const{min:o,max:n}=e,l=[],r=window.devicePixelRatio||1,d=(t??(e.origin==="x"?xt:te))*r,u=pt(c,d,e.id,"canvas"),a=H.find(f=>f>u)??1;let p=o%a<Number.EPSILON?o:o+a-o%a;for(;p<=n;)l.push(p),p+=a;return(s??vt)(l)},vt=t=>{const s=Math.max(0,Math.ceil(-Math.log10(t[1]-t[0])));return t.map(e=>({value:e,label:e.toFixed(s)}))},H=[];for(let t=-12;t<=12;t++)H.push(1*10**t),H.push(2*10**t),H.push(5*10**t);const ne=1,gt=1e3*ne,dt=60*gt,Z=60*dt,st=24*Z,oe=30*st,ce=365*st,ie=[[1,"milliseconds"],[2,"milliseconds"],[5,"milliseconds"],[10,"milliseconds"],[20,"milliseconds"],[50,"milliseconds"],[100,"milliseconds"],[200,"milliseconds"],[500,"milliseconds"],[1,"seconds"],[5,"seconds"],[10,"seconds"],[15,"seconds"],[30,"seconds"],[1,"minutes"],[5,"minutes"],[10,"minutes"],[15,"minutes"],[30,"minutes"],[1,"hours"],[2,"hours"],[3,"hours"],[4,"hours"],[6,"hours"],[8,"hours"],[12,"hours"],[1,"days"],[3,"days"],[5,"days"],[7,"days"],[10,"days"],[15,"days"],[1,"months"],[2,"months"],[3,"months"],[4,"months"],[6,"months"],[1,"years"],[2,"years"],[5,"years"],[10,"years"],[25,"years"],[50,"years"],[100,"years"]],q=t=>{const[s,e]=t;switch(e){case"milliseconds":return s;case"seconds":return s*gt;case"minutes":return s*dt;case"hours":return s*Z;case"days":return s*st;case"months":return s*oe;case"years":return s*ce}},re=(t,s)=>{const e=new Date(t);return e.setUTCMilliseconds(e.getUTCMilliseconds()+s),e.getTime()},ae=(t,s)=>{const e=new Date(t);return e.setUTCSeconds(e.getUTCSeconds()+s),e.getTime()},le=(t,s)=>{const e=new Date(t);return e.setUTCMinutes(e.getUTCMinutes()+s),e.getTime()},ue=(t,s)=>{const e=new Date(t);return e.setUTCHours(e.getUTCHours()+s),e.getTime()},de=(t,s)=>{const e=new Date(t);return e.setUTCDate(e.getUTCDate()+s),e.getTime()},mt=(t,s)=>{const e=new Date(t);return e.setUTCMonth(e.getUTCMonth()+s),e.getTime()},F=(t,s)=>{const[e,c]=s;switch(c){case"milliseconds":return re(t,e);case"seconds":return ae(t,e);case"minutes":return le(t,e);case"hours":return ue(t,e);case"days":return de(t,e);case"months":return mt(t,e);case"years":return mt(t,e*12)}};function W(t,s){const e=new Date(t),c=new Date(e.toLocaleString("en-US",{timeZone:s})),o=new Date(e.toLocaleString("en-US",{timeZone:"UTC"}));return(c.getTime()-o.getTime())/(3600*1e3)}const he=(t,s,e="UTC")=>{const[c,o]=s;let n=new Date(t);const l=()=>{n.setUTCHours(-W(n,e),0,0,0)};switch(o){case"milliseconds":n.setUTCMilliseconds(Math.ceil(n.getUTCMilliseconds()/c)*c);break;case"seconds":n.setUTCSeconds(Math.ceil(n.getUTCSeconds()/c)*c,0);break;case"minutes":n.setUTCMinutes(Math.ceil(n.getTime()%Z/dt/c)*c,0,0);break;case"hours":n.setUTCHours(Math.ceil(n.getTime()%st/Z/c)*c,0,0,0);break;case"days":case"months":case"years":o==="months"?n.setUTCDate(1):o==="years"&&n.setUTCMonth(0,1),l(),n.getTime()<t&&(n=new Date(F(n,[1,o])));break}return n.getTime()},fe=({timeZone:t=St,space:s=xt,formatter:e,locale:c,showTimezone:o}={})=>(n,l)=>{const{min:r,max:d}=n,u=Math.floor(l.chartAreaCanvasPX.width/s)+1,p=(d-r)/u,[f,m]=ie.find(w=>q(w)>=p)??[1,"milliseconds"],i=he(r,[f,m],t),h=W(i,t),y=[i];let x;for(;;){switch(m){case"milliseconds":case"seconds":case"minutes":case"hours":{x=F(i,[y.length*f,m]);break}case"days":{const w=F(i,[y.length*f,m]);x=F(w,[h-W(w,t),"hours"]);break}case"months":case"years":{const w=F(F(F(i,[h,"hours"]),[y.length*f,m]),[-h,"hours"]);x=F(w,[h-W(w,t),"hours"]);break}}if(x>d)break;y.push(x)}return(e??wt({locale:c,showTimezone:o,timeZone:t}))(y)},I=(t,s,e)=>t.find(c=>c.type===e)?.value!==s.find(c=>c.type===e)?.value,wt=({timeZone:t=St,locale:s=ee,showTimezone:e=!0})=>{const c=new Intl.DateTimeFormat(s,{year:"numeric",day:"numeric",month:"short",hour:"numeric",hourCycle:"h23",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZoneName:"short",timeZone:t});return o=>{const n=o[1]-o[0],l=n<q([1,"days"]),r=n<q([1,"minutes"]),d=n<q([1,"seconds"]);return o.map(u=>({value:u,label:c.formatToParts(new Date(u))})).map((u,a,p)=>{const f=p[a-1],m=a===0||I(u.label,f.label,"year"),i=a===0||I(u.label,f.label,"day"),h=a===0||I(u.label,f.label,"month"),y=a===0||I(u.label,f.label,"hour"),x=a===0||I(u.label,f.label,"timeZoneName"),w=a===0||I(u.label,f.label,"minute"),v=a===0||I(u.label,f.label,"second"),g=a===0||I(u.label,f.label,"fractionalSecond"),k=[];if(l&&(y||w||x||v||g)){const C=u.label.find(R=>R.type==="hour")?.value,T=u.label.find(R=>R.type==="minute")?.value,E=u.label.find(R=>R.type==="timeZoneName")?.value;let D="";if(r){const R=u.label.find(Y=>Y.type==="second")?.value,N=u.label.find(Y=>Y.type==="fractionalSecond")?.value;D=`:${R}`+(d?`.${N}`:"")}k.push(`${C}:${T}${D}`+(e&&x?` ${E}`:""))}return(i||h)&&k.push([u.label.find(C=>C.type==="month")?.value,i&&u.label.find(C=>C.type==="day")?.value].filter(Boolean).join(" ")),m&&k.push(u.label.find(C=>C.type==="year")?.value),{value:u.value,label:k.filter(C=>C).join(`
|
|
4
|
-
`)}})}};exports.AreaPlot=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),g=require("react"),Z=require("zustand"),B=(e,s,t)=>Math.min(Math.max(e,s),t),Te=e=>e.reduce((s,t)=>s+(t??0),0),Ce=(e,s)=>{let t=0;for(let o=0;o<e.length;o++)Math.abs(e[o]-s)<Math.abs(e[t]-s)&&(t=o);return t},me=(e,s,t,o)=>{const{min:n,max:c,origin:a}=U(e,t),r=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,d=(a==="x"?r.width:r.height)/(c-n);return s/d},U=(e,s)=>{const t=e.scales.find(o=>o.id===s);if(!t)throw new Error(`Scale ${s} not found`);return t},A=(e,s)=>{const t=window.devicePixelRatio||1;e.lineCap=s?.lineCap??"butt",e.lineDashOffset=t*(s?.lineDashOffset??0),e.lineJoin=s?.lineJoin??"miter",e.lineWidth=t*(s?.lineWidth??1),e.miterLimit=t*(s?.miterLimit??10),e.strokeStyle=s?.strokeStyle??"black",e.fillStyle=s?.fillStyle??e.strokeStyle,e.font=s?.font??`${10*t}px sans-serif`,e.textAlign=s?.textAlign??"start",e.direction=s?.direction??"inherit",e.textBaseline=s?.textBaseline??"alphabetic",e.fontKerning=s?.fontKerning??"auto"},J=(e,s,t,o)=>{const n=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,{min:c,max:a,origin:r}=U(e,t),d=(r==="x"?n.width:n.height)/(a-c);return s*d},N=(e,s,t,o)=>{const{min:n,origin:c}=U(e,t),a=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,r=J(e,s-n,t,o);return c==="x"?B(a.x+r,a.x-10*a.width,a.x+11*a.width):B(a.y+a.height-r,a.y-10*a.height,a.y+11*a.height)},ke=(e,s,t)=>{const{min:o,max:n}=U(e,t);return B(s,o,n)},j=(e,s,t)=>{const o=t==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS;return B(s,o.x,o.x+o.width)},O=(e,s,t)=>{const o=t==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS;return B(s,o.y,o.y+o.height)},W=(e,s,t)=>{const{min:o,max:n}=U(e,t);return s>=o&&s<=n},L=(e,s,t,o)=>{const{min:n,max:c,origin:a}=U(e,t),r=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,d=a==="x"?(s-r.x)/r.width:(r.height-s+r.y)/r.height;return n+d*(c-n)},Ee=e=>{const{ctx:s,scales:t}=e;for(const o of t){if(!o.axis)continue;s.save(),A(s,{strokeStyle:"black",fillStyle:"black",lineWidth:1,...o.axis.style});const n=o.axis.canvasRect;if(o.origin==="x"){if(o.axis.position==="bottom")s.beginPath(),s.moveTo(n.x,n.y),s.lineTo(n.x+n.width,n.y),s.stroke();else if(o.axis.position==="top"){const c=n.y+n.height;s.beginPath(),s.moveTo(n.x,c),s.lineTo(n.x+n.width,c),s.stroke()}}else if(o.axis.position==="left"){const c=n.x+n.width;s.beginPath(),s.moveTo(c,n.y),s.lineTo(c,n.y+n.height),s.stroke()}else o.axis.position==="right"&&(s.beginPath(),s.moveTo(n.x,n.y),s.lineTo(n.x,n.y+n.height),s.stroke());s.restore()}},Pe=()=>Z.createStore((e,s)=>{const t=()=>{const o=s()._frame;if(!o)throw new Error("No frame set in frame store");return o};return{_frame:null,getFrame:t,getCtx:()=>t().ctx,clampXPosToChartArea:(o,n)=>j(t(),o,n??"canvas"),clampYPosToChartArea:(o,n)=>O(t(),o,n??"canvas"),valToPos:(o,n,c)=>N(t(),o,n,c??"canvas"),valToPxDistance:(o,n,c)=>J(t(),o,n,c??"canvas"),valFits:(o,n)=>W(t(),o,n),getScale:o=>U(t(),o)}}),Re=()=>Z.createStore(e=>({notify:()=>{e(s=>({version:s.version+1}))},version:0})),ae=g.createContext(null),pe=g.createContext(null),K=(e,s)=>{const t=g.useContext(ae),o=g.useContext(pe);if(!t||!o)throw new Error("useFrame must be used within a CanPlot component");const n=g.useRef(e);n.current=e,g.useLayoutEffect(()=>{n.current(t.getState()),t.subscribe(c=>{c._frame&&n.current(c)})},[t]),g.useEffect(()=>{o.getState().notify()},[o,...s])},Q=e=>{const s=g.useContext(ae);if(!s)throw new Error("useFrame must be used within a CanPlot component");return Z.useStore(s,e??(t=>t.getFrame()))};function Me(e){return s=>{for(const t of e)re(t,s)}}function _e(e){return s=>{const t=[];for(const o of e){const n=re(o,s),c=typeof n=="function";t.push(c?n:()=>re(o,null))}return()=>{for(const o of t)o()}}}function re(e,s){if(typeof e=="function")return e(s);e&&(e.current=s)}var Ae=parseInt(g.version.split(".")[0],10)>=19?_e:Me;const Le=g.forwardRef(({configuration:e,children:s,style:t,className:o},n)=>{const c=g.useRef(null),a=g.useRef(null),r=De(a),d=g.useMemo(Pe,[]),u=g.useMemo(Re,[]);g.useLayoutEffect(()=>{d.setState({_frame:Ie(e,r,c.current)})},[e,r,c,d]),g.useLayoutEffect(()=>d.subscribe(p=>{p._frame&&Xe(p._frame)}),[d]),g.useLayoutEffect(()=>{let p=!1;return u.subscribe(()=>{p||(p=!0,window.requestAnimationFrame(()=>{p=!1,d.setState(m=>({_frame:m._frame?{...m._frame}:null}))}))})},[u,d]);const l=window.devicePixelRatio||1;return M.jsxs("div",{ref:Ae([n,a]),className:o,style:{position:"relative",overflow:"hidden",...t},"data-canplotroot":!0,children:[M.jsx("canvas",{ref:c,width:r.width*l,height:r.height*l,style:{inset:0,position:"absolute",width:`${r.width}px`,height:`${r.height}px`}}),M.jsx(Ue,{frameStore:d,updateRequestStore:u,children:s})]})}),Ue=({frameStore:e,updateRequestStore:s,children:t})=>Z.useStore(e,n=>!!n._frame)?M.jsx(pe.Provider,{value:s,children:M.jsx(ae.Provider,{value:e,children:t})}):null,De=e=>{const[s,t]=g.useState({width:0,height:0}),[o]=g.useState(()=>new ResizeObserver(n=>{for(const c of n){const a=Math.round(c.contentRect.width),r=Math.round(c.contentRect.height);t(d=>d.width!==a||d.height!==r?{...d,width:a,height:r}:d)}}));return g.useLayoutEffect(()=>{if(!e.current)return;const n=e.current.clientWidth,c=e.current.clientHeight;return t(a=>a.width!==n||a.height!==c?{...a,width:n,height:c}:a),o.observe(e.current,{box:"border-box"}),()=>o.disconnect()},[o,e]),s},Ie=(e,s,t)=>{const o=t?.getContext("2d");if(!o)return null;const n=window.devicePixelRatio||1;if(s.width===0||s.height===0)return null;const c={x:e.padding.left,y:e.padding.top,width:s.width-e.padding.left-e.padding.right,height:s.height-e.padding.top-e.padding.bottom};for(const f of e.scales)f.axis&&(f.origin==="x"?(f.axis.position==="bottom"||f.axis.position==="top")&&(c.height=Math.max(0,c.height-f.axis.size),f.axis.position==="top"&&(c.y+=f.axis.size)):(f.axis.position==="left"||f.axis.position==="right")&&(c.width=Math.max(0,c.width-f.axis.size),f.axis.position==="left"&&(c.x+=f.axis.size)));const a={x:c.x*n,y:c.y*n,width:c.width*n,height:c.height*n},r=[];let d=e.padding.left*n,u=o.canvas.width-e.padding.right*n,l=o.canvas.height-e.padding.bottom*n,p=e.padding.top*n;for(const f of e.scales){if(!f.axis){r.push({...f,axis:null});continue}let i;if(f.origin==="x")switch(f.axis.position){case"bottom":l-=f.axis.size*n,i={x:c.x,y:l/n,width:c.width,height:f.axis.size};break;case"top":p+=f.axis.size*n,i={x:c.x,y:p/n-f.axis.size,width:c.width,height:f.axis.size};break;case"left":case"right":throw new Error("Invalid axis position for x origin")}else switch(f.axis.position){case"left":d+=f.axis.size*n,i={x:d/n-f.axis.size,y:c.y,width:f.axis.size,height:c.height};break;case"right":u-=f.axis.size*n,i={x:u/n,y:c.y,width:f.axis.size,height:c.height};break;case"top":case"bottom":throw new Error("Invalid axis position for y origin")}const h={x:i.x*n,y:i.y*n,width:i.width*n,height:i.height*n};r.push({...f,axis:{...f.axis,cssRect:i,canvasRect:h}})}return{ctx:o,dpr:n,padding:e.padding,scales:r,chartAreaCSS:c,chartAreaCanvasPX:a}},Xe=e=>{e.ctx.clearRect(0,0,e.ctx.canvas.width,e.ctx.canvas.height),Ee(e)},Fe=({data:e,xScaleId:s,yScaleId:t,style:o})=>(K(({getCtx:n,clampXPosToChartArea:c,clampYPosToChartArea:a,valToPos:r})=>{const d=n();d.save(),d.beginPath(),A(d,o);for(const u of e){const l=c(r(u.x,s)),p=a(r(u.y,t));d.lineTo(l,p)}d.stroke(),d.restore()},[e,s,t,o]),null),Ke=({data:e,xScaleId:s,yScaleId:t,radius:o=5,style:n})=>(K(({getCtx:c,valToPos:a,valFits:r})=>{const d=c();d.save(),d.beginPath(),A(d,n);for(const u of e){if(!r(u.x,s)||!r(u.y,t))continue;const l=a(u.x,s),p=a(u.y,t);d.moveTo(l+o,p),d.arc(l,p,o,0,Math.PI*2)}d.stroke(),d.fill(),d.restore()},[e,s,t,o,n]),null),ze=({data:e,xScaleId:s,yScaleId:t,style:o,barWidth:n,xPositionOffset:c,radius:a})=>(K(({getCtx:r,valToPxDistance:d,valToPos:u,clampXPosToChartArea:l,clampYPosToChartArea:p})=>{if(e.length===0)return;const m=r();m.save(),A(m,o);const f=d(n,s);m.beginPath();for(const i of e){const y=u(i.x,s)-f/2+c*f,x=p(u(0,t)),S=p(u(i.y,t)),v=x-S,w=l(y),k=l(y+f)-w;a?m.roundRect(w,S,k,v,a):m.rect(w,S,k,v)}m.closePath(),m.fill(),o?.strokeStyle&&m.stroke(),m.restore()},[e,s,t,o,n,c,a]),null),Ye=({data:e,xScaleId:s,yScaleId:t,style:o})=>(K(({getCtx:n,clampXPosToChartArea:c,clampYPosToChartArea:a,valToPos:r})=>{const d=[];for(const l of e){const p=c(r(l.x,s)),m=a(r(l.y[0],t)),f=a(r(l.y[1],t));d.push({x:p,y:m}),d.unshift({x:p,y:f})}const u=n();if(d.length>0){u.save(),u.beginPath(),A(u,o),u.moveTo(d[0].x,d[0].y);for(const l of d)u.lineTo(l.x,l.y);u.closePath(),u.fill(),u.restore()}},[e,s,t,o]),null),je=({data:e,stroked:s,xScaleId:t,yScaleId:o,style:n})=>(K(({getCtx:c,clampXPosToChartArea:a,clampYPosToChartArea:r,valToPos:d})=>{const u=[],l=c();for(const i of e){const h=a(d(i.x,t)),y=r(d(i.y,o));u.push({x:h,y})}const p=u.at(0),m=u.at(-1);if(!p||!m)return;const f=r(d(0,o));l.save(),l.beginPath(),A(l,n),l.moveTo(p.x,f);for(const i of u)l.lineTo(i.x,i.y);if(l.lineTo(m.x,f),l.closePath(),l.fill(),s){l.beginPath(),l.moveTo(p.x,p.y);for(const i of u)l.lineTo(i.x,i.y);l.stroke()}l.restore()},[e,s,t,o,n]),null),Oe=(e,s)=>Q(({clampXPosToChartArea:t,clampYPosToChartArea:o,getScale:n,valToPos:c,valFits:a})=>{const r={};for(const d in e){const u=e[d];switch(u.exceeding){case"discard":{if(a(u.value,u.scaleId)){const l=c(u.value,u.scaleId,s);r[d]=l}break}case"clamp":{const l=c(u.value,u.scaleId,s);r[d]=n(u.scaleId)?.origin==="x"?t(l,s):o(l,s);break}}}return r}),Be=({scaleId:e,tickStyle:s,labelStyle:t,labelGap:o,tickSize:n,ticks:c})=>(K(({getCtx:a,valToPos:r,getScale:d,getFrame:u})=>{const l=a(),p=d(e);if(!p||!p.axis||p.origin!=="x")return;const m=p.axis,f=m.position==="top"?m.canvasRect.y+m.canvasRect.height:m.canvasRect.y,i=window.devicePixelRatio||1,h=f,y=(n??6)*i,x=m.position==="top"?f-y:f+y,S=(o??12)*i;l.save(),l.fontKerning="auto",A(l,{...s}),l.beginPath();const v=Array.isArray(c)?c:c({...p,axis:m},u());for(const{value:w}of v){const k=r(w,e,"canvas");l.moveTo(k,h),l.lineTo(k,x)}l.stroke(),l.restore(),l.save(),A(l,{textBaseline:m.position==="top"?"bottom":"top",textAlign:"center",...s,...t});for(const{value:w,label:k}of v){const b=r(w,e,"canvas"),C=k.split(`
|
|
2
|
+
`);for(let E=0;E<C.length;E++)l.fillText(C[E],b,x+i*2+E*S)}l.restore()},[c,e,s,t]),null),Ne=({scaleId:e,tickStyle:s,labelStyle:t,labelGap:o,tickSize:n,ticks:c})=>(K(({getCtx:a,valToPos:r,getScale:d,getFrame:u})=>{const l=a(),p=d(e);if(!p||!p.axis||p.origin!=="y")return;const m=p.axis,f=m.position==="left"?m.canvasRect.x+m.canvasRect.width:m.canvasRect.x,i=f,h=n??6,y=m.position==="left"?f-h:f+h,x=o??12,S=Array.isArray(c)?c:c({...p,axis:m},u());l.save(),l.fontKerning="auto",A(l,{...s}),l.beginPath();for(const{value:v}of S){const w=r(v,e,"canvas");l.moveTo(i,w),l.lineTo(y,w)}l.stroke(),l.restore(),l.save(),A(l,{textBaseline:"middle",textAlign:m.position==="left"?"right":"left",...s,...t});for(const{value:v,label:w}of S){const k=r(v,e,"canvas"),b=w.split(`
|
|
3
|
+
`);for(let C=0;C<b.length;C++)l.fillText(` ${b[C]} `,y,k+C*x)}l.restore()},[c,e,s,t]),null),P=()=>{const e=[];return{addEventListener:(s,t)=>(e.push({syncKey:s,callback:t}),()=>{const o=e.findIndex(n=>n.callback===t);o!==-1&&e.splice(o,1)}),dispatchEvent:(s,t)=>{for(const o of e)o.syncKey===s&&o.callback(s,t)}}},T={dblclick:P(),click:P(),contextmenu:P(),move:P(),mousedown:P(),mouseup:P(),spanselect:P(),documentmouseup:P(),pressandwheel:P(),sync_dblclick:P(),sync_click:P(),sync_move:P(),sync_mousedown:P(),sync_mouseup:P(),sync_spanselect:P(),sync_pressandwheel:P(),sync_contextmenu:P()},R=(e,s,t)=>{const o=g.useRef(t);o.current=t,g.useEffect(()=>T[e].addEventListener(s,(c,a)=>{o.current(a,c)}),[s,e,o])},le=g.createContext(""),ee=(e,s)=>{const t=g.useContext(le);return R(e,t,s)},$e=(e,s,t,o,n)=>{if(!s)return;const c=o??t.scales.find(p=>p.origin==="x")?.id,a=n??t.scales.find(p=>p.origin==="y")?.id;if(!c||!a)return;const r=e.clientX-s.left,d={scaleId:c,value:L(t,r,c,"css")},u=e.clientY-s.top,l={scaleId:a,value:L(t,u,a,"css")};return{pointerSyncPosition:{x:d,y:l},cssX:r,cssY:u}},Y=(e,s)=>{const t=e.x?N(s,e.x.value,e.x.scaleId,"css"):0,o=e.y?N(s,e.y.value,e.y.scaleId,"css"):0;return{cssX:t,cssY:o,scaled:Object.fromEntries(s.scales.map(n=>{const c=n.origin==="y"?o:t;return[n.id,L(s,c,n.id,"css")]}))}},he=(e,s,t)=>{const o=N(t,s.from,s.scaleId,"css"),n=N(t,s.to,s.scaleId,"css"),c=t.scales.flatMap(a=>{if(a.origin!==e)return[];const r=L(t,o,a.id,"css"),d=L(t,n,a.id,"css");return[{scaleId:a.id,from:r,to:d}]});return{fromCSS:o,toCSS:n,scaled:c}},Ve=({id:e,onClick:s,onDblClick:t,onMouseMove:o,onMouseDown:n,onMouseUp:c,onDocumentMouseUp:a,onSpanSelect:r,onContextMenu:d,className:u,style:l,sync:p,children:m})=>{const f=g.useId(),i=e||f;return R("dblclick",i,h=>{t?.(h)}),R("click",i,h=>{s?.(h)}),R("move",i,h=>{o?.(h)}),R("mousedown",i,h=>{n?.(h)}),R("mouseup",i,h=>{c?.(h)}),R("documentmouseup",i,h=>{a?.(h)}),R("spanselect",i,h=>{r?.(h)}),R("contextmenu",i,h=>{d?.(h)}),M.jsxs(le.Provider,{value:i,children:[M.jsx(He,{className:u,style:l,sync:p}),m]})},He=({className:e,style:s,sync:t})=>{const o=g.useRef(null),n=Q(),c=g.useRef(n);c.current=n;const a=g.useContext(le),r=t?.key||a,d=g.useRef(null),u=g.useRef(null),l=g.useRef(null),p=()=>{const i=o.current?.parentElement;if(i){if(i.dataset.canplotroot===void 0)throw new Error("ChartAreaInteractions must be used within a CanPlot component");return i.getBoundingClientRect()}},m=(i,h)=>{const y=$e(i,p(),c.current,t?.xViaScaleId,t?.yViaScaleId);y&&h(y.pointerSyncPosition,{cssX:y.cssX,cssY:y.cssY},{ctrlKey:i.ctrlKey,altKey:i.altKey,shiftKey:i.shiftKey,metaKey:i.metaKey})},f=g.useRef(m);return f.current=m,g.useEffect(()=>{const i=v=>{const w=u.current;w&&T.sync_spanselect.dispatchEvent(r,{...w,completed:!0}),T.documentmouseup.dispatchEvent(r,{frame:c.current,keys:{ctrlKey:v.ctrlKey,altKey:v.altKey,shiftKey:v.shiftKey,metaKey:v.metaKey}})},h=v=>{const w={ctrlKey:v.ctrlKey,altKey:v.altKey,shiftKey:v.shiftKey,metaKey:v.metaKey},k=l.current;if(k&&Object.entries(w).some(([C,E])=>k.keys[C]!==E)){const C={...k,keys:w};l.current=C,T.sync_move.dispatchEvent(r,C)}const b=u.current;if(b&&Object.entries(w).some(([C,E])=>b.keys[C]!==E)){v.stopPropagation(),v.preventDefault();const C={...b,keys:w};u.current=C,T.sync_spanselect.dispatchEvent(r,C)}},y=v=>{f.current(v,(w,{cssX:k,cssY:b},C)=>{const E=d.current;if(!E||!w.x||!w.y)return;const D=c.current,_=E.xRangeCss.start,$=k,z=E.yRangeCss.start,se=b,ne=U(D,w.x.scaleId),oe=U(D,w.y.scaleId);d.current={xRangeCss:{start:_,end:$},yRangeCss:{start:z,end:se}};let I="below_threshold";const ce=Math.abs(z-se),ie=Math.abs(_-$);ce<10&&ie<10?I="below_threshold":ce>30&&ie>30?I="box":ce>ie?I="y":I="x";const Se=I==="x"||I==="box"?{scaleId:ne.id,from:L(D,j(c.current,_,"css"),ne.id,"css"),to:L(D,j(c.current,$,"css"),ne.id,"css")}:void 0,be=I==="y"||I==="box"?{scaleId:oe.id,from:L(D,O(c.current,z,"css"),oe.id,"css"),to:L(D,O(c.current,se,"css"),oe.id,"css")}:void 0,de={mode:I,xRange:Se,yRange:be,completed:!1,keys:C};u.current=de,T.sync_spanselect.dispatchEvent(r,de)})},x=v=>{f.current(v,(w,k,b)=>{if(Object.values(b).some(E=>E)){v.preventDefault();const E=Math.abs(v.deltaY)>Math.abs(v.deltaX)?v.deltaY:v.deltaX;T.sync_pressandwheel.dispatchEvent(r,{positions:w,keys:b,deltaX:v.deltaX,deltaY:v.deltaY,deltaAbs:E})}})};document.addEventListener("mouseup",i),document.addEventListener("keydown",h),document.addEventListener("keyup",h),document.addEventListener("mousemove",y);const S=o.current;return S?.addEventListener("wheel",x,{passive:!1}),()=>{document.removeEventListener("mouseup",i),document.removeEventListener("keydown",h),document.removeEventListener("keyup",h),document.removeEventListener("mousemove",y),S?.removeEventListener("wheel",x)}},[c,r,f]),R("sync_dblclick",r,i=>{const h=Y(i.positions,c.current);h&&T.dblclick.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_click",r,i=>{const h=Y(i.positions,c.current);h&&T.click.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_contextmenu",r,i=>{const h=Y(i.positions,c.current);h&&T.contextmenu.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_move",r,i=>{const h=i.positions?Y(i.positions,c.current):null;l.current=i,T.move.dispatchEvent(a,{frame:c.current,pointer:h??null,keys:i.keys})}),R("sync_mousedown",r,i=>{const h=Y(i.positions,c.current);h&&T.mousedown.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_mouseup",r,i=>{const h=Y(i.positions,c.current);h&&T.mouseup.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_pressandwheel",r,i=>{const h=Y(i.positions,c.current);h&&T.pressandwheel.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys,deltaX:i.deltaX,deltaY:i.deltaY,deltaAbs:i.deltaAbs})}),R("sync_spanselect",r,i=>{const h=i.xRange&&he("x",i.xRange,c.current),y=i.yRange&&he("y",i.yRange,c.current),x=h?.scaled,S=y?.scaled;i.completed&&(d.current=null),T.spanselect.dispatchEvent(a,{mode:i.mode,frame:c.current,completed:i.completed,x:{css:h&&{from:h.fromCSS,to:h.toCSS},scaled:x??[]},y:{css:y&&{from:y.fromCSS,to:y.toCSS},scaled:S??[]},keys:i.keys})}),M.jsx("div",{ref:o,id:"interactions",className:e,style:{position:"absolute",left:n.chartAreaCSS.x,top:n.chartAreaCSS.y,width:n.chartAreaCSS.width,height:n.chartAreaCSS.height,zIndex:25,...s},onDragStart:i=>{i.preventDefault()},onClick:i=>{m(i,(h,y,x)=>{T.sync_click.dispatchEvent(r,{positions:h,keys:x})})},onMouseLeave:i=>{m(i,(h,y,x)=>{T.sync_move.dispatchEvent(r,{positions:null,keys:x})})},onMouseMove:i=>{m(i,(h,y,x)=>{T.sync_move.dispatchEvent(r,{positions:h,keys:x})})},onMouseDown:i=>{m(i,(h,{cssX:y,cssY:x},S)=>{T.sync_mousedown.dispatchEvent(r,{positions:h,keys:S}),u.current=null,d.current={xRangeCss:{start:y,end:y},yRangeCss:{start:x,end:x}}})},onMouseUp:i=>{m(i,(h,y,x)=>{T.sync_mouseup.dispatchEvent(r,{positions:h,keys:x});const S=u.current;u.current=null;const v=d.current;if(d.current=null,v&&S){const w={...S,keys:x,completed:!0};T.sync_spanselect.dispatchEvent(r,w)}})},onContextMenu:i=>{i.preventDefault(),m(i,(h,y,x)=>{T.sync_contextmenu.dispatchEvent(r,{positions:h,keys:x})})},onDoubleClick:i=>{m(i,(h,y,x)=>{T.sync_dblclick.dispatchEvent(r,{positions:h,keys:x})})}})},qe=({data:e,renderTooltip:s,xScaleId:t})=>{const[o,n]=g.useState(null);ee("move",a=>{n(a)});const c=g.useMemo(()=>{if(!o)return null;const{frame:a,pointer:r}=o,d=r?.scaled[t];if(d===void 0)return null;const u=[];let l=d;for(const p of e){let m=null,f=1/0;for(const[h,y]of p.points.entries()){if(!W(a,y.x,t)||!W(a,y.y,p.yScaleId))continue;const x=Math.abs(y.x-d);x<f&&(f=x,m=h)}const i=p.points[m??-1];if(!i||J(a,f,t,"css")>30){u.push({seriesId:p.seriesId,y:null});continue}l=i.x,u.push({seriesId:p.seriesId,y:i.y})}return{frame:a,x:l,points:u}},[e,o,t]);return s(c)},We=({makeXStyle:e,makeXClassName:s,makeYStyle:t,makeYClassName:o})=>{const[n,c]=g.useState(null);if(ee("move",l=>{c(l)}),!n)return null;const{frame:a,pointer:r}=n,d=j(a,r?.cssX??0,"css"),u=O(a,r?.cssY??0,"css");return M.jsxs(M.Fragment,{children:[M.jsx("div",{"data-show":!!r,className:s?.(n),style:{position:"absolute",left:0,top:a.chartAreaCSS.y,height:a.chartAreaCSS.height,borderColor:"red",borderLeftWidth:"1px",borderLeftStyle:"solid",pointerEvents:"none",opacity:r?1:0,transform:`translateX(${d}px)`,...e?.(n)}}),M.jsx("div",{className:o?.(n),"data-show":!!r,style:{position:"absolute",top:0,height:0,borderTop:"solid 1px red",left:a.chartAreaCSS.x,width:a.chartAreaCSS.width,pointerEvents:"none",opacity:r?1:0,transform:`translateY(${u}px)`,...t?.(n)}})]})},Ge=({makeClassName:e,makeStyle:s})=>{const[t,o]=g.useState(null);ee("spanselect",c=>{o(c.mode==="below_threshold"||c.completed?null:c)});const n=g.useMemo(()=>{if(!t||t.mode==="below_threshold")return null;const c=j(t.frame,t.x.css?.from??-1/0,"css"),a=j(t.frame,t.x.css?.to??1/0,"css"),r=O(t.frame,t.y.css?.from??-1/0,"css"),d=O(t.frame,t.y.css?.to??1/0,"css"),u=Math.min(c,a),l=Math.min(r,d),p=Math.abs(a-c),m=Math.abs(d-r);return{leftPx:u,topPx:l,widthPx:p,heightPx:m}},[t]);return M.jsx("div",{className:t?e?.(t):void 0,style:{position:"absolute",visibility:t?"visible":"hidden",left:`${n?.leftPx??0}px`,top:`${n?.topPx??0}px`,width:`${n?.widthPx??0}px`,height:`${n?.heightPx??0}px`,pointerEvents:"none",...t?s?.(t):void 0}})},Ze=({style:e,children:s,scaleId:t,...o})=>{const n=Q(c=>c.getScale(t)?.axis);return n?M.jsx("div",{style:{position:"absolute",backgroundColor:"#0000ff11",left:n.cssRect.x,top:n.cssRect.y,height:n.cssRect.height,width:n.cssRect.width,...e},...o,children:s}):null},ye=60,Je=30,xe="UTC",Qe="en-GB",et=({space:e,formatter:s,acceptableIncrements:t}={})=>(o,n)=>{const{min:c,max:a}=o,r=[],d=window.devicePixelRatio||1,u=(e??(o.origin==="x"?ye:Je))*d,l=me(n,u,o.id,"canvas"),p=t??V,m=p.find(i=>i>l)??p.at(-1)??1;let f=c;if(Math.abs(f%m)>Number.EPSILON){const i=(m-f%m)%m;f+=i}for(;f<=a&&r.length<1e3;)r.push(f),f+=m;return(s??ge)(r)},ge=e=>{const s=Math.max(0,Math.ceil(-Math.log10(e[1]-e[0])));return e.map(t=>({value:t,label:t.toFixed(s)}))},V=[];for(let e=-12;e<=12;e++)V.push(1*10**e),V.push(2*10**e),V.push(5*10**e);const tt=1,ve=1e3*tt,ue=60*ve,G=60*ue,te=24*G,st=30*te,nt=365*te,ot=[[1,"milliseconds"],[2,"milliseconds"],[5,"milliseconds"],[10,"milliseconds"],[20,"milliseconds"],[50,"milliseconds"],[100,"milliseconds"],[200,"milliseconds"],[500,"milliseconds"],[1,"seconds"],[5,"seconds"],[10,"seconds"],[15,"seconds"],[30,"seconds"],[1,"minutes"],[5,"minutes"],[10,"minutes"],[15,"minutes"],[30,"minutes"],[1,"hours"],[2,"hours"],[3,"hours"],[4,"hours"],[6,"hours"],[8,"hours"],[12,"hours"],[1,"days"],[3,"days"],[5,"days"],[7,"days"],[10,"days"],[15,"days"],[1,"months"],[2,"months"],[3,"months"],[4,"months"],[6,"months"],[1,"years"],[2,"years"],[5,"years"],[10,"years"],[25,"years"],[50,"years"],[100,"years"]],H=e=>{const[s,t]=e;switch(t){case"milliseconds":return s;case"seconds":return s*ve;case"minutes":return s*ue;case"hours":return s*G;case"days":return s*te;case"months":return s*st;case"years":return s*nt}},ct=(e,s)=>{const t=new Date(e);return t.setUTCMilliseconds(t.getUTCMilliseconds()+s),t.getTime()},it=(e,s)=>{const t=new Date(e);return t.setUTCSeconds(t.getUTCSeconds()+s),t.getTime()},rt=(e,s)=>{const t=new Date(e);return t.setUTCMinutes(t.getUTCMinutes()+s),t.getTime()},at=(e,s)=>{const t=new Date(e);return t.setUTCHours(t.getUTCHours()+s),t.getTime()},lt=(e,s)=>{const t=new Date(e);return t.setUTCDate(t.getUTCDate()+s),t.getTime()},fe=(e,s)=>{const t=new Date(e);return t.setUTCMonth(t.getUTCMonth()+s),t.getTime()},F=(e,s)=>{const[t,o]=s;switch(o){case"milliseconds":return ct(e,t);case"seconds":return it(e,t);case"minutes":return rt(e,t);case"hours":return at(e,t);case"days":return lt(e,t);case"months":return fe(e,t);case"years":return fe(e,t*12)}};function q(e,s){const t=new Date(e),o=new Date(t.toLocaleString("en-US",{timeZone:s})),n=new Date(t.toLocaleString("en-US",{timeZone:"UTC"}));return(o.getTime()-n.getTime())/(3600*1e3)}const ut=(e,s,t="UTC")=>{const[o,n]=s;let c=new Date(e);const a=()=>{c.setUTCHours(-q(c,t),0,0,0)};switch(n){case"milliseconds":c.setUTCMilliseconds(Math.ceil(c.getUTCMilliseconds()/o)*o);break;case"seconds":c.setUTCSeconds(Math.ceil(c.getUTCSeconds()/o)*o,0);break;case"minutes":c.setUTCMinutes(Math.ceil(c.getTime()%G/ue/o)*o,0,0);break;case"hours":c.setUTCHours(Math.ceil(c.getTime()%te/G/o)*o,0,0,0);break;case"days":case"months":case"years":n==="months"?c.setUTCDate(1):n==="years"&&c.setUTCMonth(0,1),a(),c.getTime()<e&&(c=new Date(F(c,[1,n])));break}return c.getTime()},dt=({timeZone:e=xe,space:s=ye,formatter:t,locale:o,showTimezone:n}={})=>(c,a)=>{const{min:r,max:d}=c,u=Math.floor(a.chartAreaCanvasPX.width/s)+1,p=(d-r)/u,[m,f]=ot.find(S=>H(S)>=p)??[1,"milliseconds"],i=ut(r,[m,f],e),h=q(i,e),y=[i];let x;for(;;){switch(f){case"milliseconds":case"seconds":case"minutes":case"hours":{x=F(i,[y.length*m,f]);break}case"days":{const S=F(i,[y.length*m,f]);x=F(S,[h-q(S,e),"hours"]);break}case"months":case"years":{const S=F(F(F(i,[h,"hours"]),[y.length*m,f]),[-h,"hours"]);x=F(S,[h-q(S,e),"hours"]);break}}if(x>d)break;y.push(x)}return(t??we({locale:o,showTimezone:n,timeZone:e}))(y)},X=(e,s,t)=>e.find(o=>o.type===t)?.value!==s.find(o=>o.type===t)?.value,we=({timeZone:e=xe,locale:s=Qe,showTimezone:t=!0})=>{const o=new Intl.DateTimeFormat(s,{year:"numeric",day:"numeric",month:"short",hour:"numeric",hourCycle:"h23",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZoneName:"short",timeZone:e});return n=>{const c=n[1]-n[0],a=c<H([1,"days"]),r=c<H([1,"minutes"]),d=c<H([1,"seconds"]);return n.map(u=>({value:u,label:o.formatToParts(new Date(u))})).map((u,l,p)=>{const m=p[l-1],f=l===0||X(u.label,m.label,"year"),i=l===0||X(u.label,m.label,"day"),h=l===0||X(u.label,m.label,"month"),y=l===0||X(u.label,m.label,"hour"),x=l===0||X(u.label,m.label,"timeZoneName"),S=l===0||X(u.label,m.label,"minute"),v=l===0||X(u.label,m.label,"second"),w=l===0||X(u.label,m.label,"fractionalSecond"),k=[];if(a&&(y||S||x||v||w)){const b=u.label.find(_=>_.type==="hour")?.value,C=u.label.find(_=>_.type==="minute")?.value,E=u.label.find(_=>_.type==="timeZoneName")?.value;let D="";if(r){const _=u.label.find(z=>z.type==="second")?.value,$=u.label.find(z=>z.type==="fractionalSecond")?.value;D=`:${_}`+(d?`.${$}`:"")}k.push(`${b}:${C}${D}`+(t&&x?` ${E}`:""))}return(i||h)&&k.push([u.label.find(b=>b.type==="month")?.value,i&&u.label.find(b=>b.type==="day")?.value].filter(Boolean).join(" ")),f&&k.push(u.label.find(b=>b.type==="year")?.value),{value:u.value,label:k.filter(b=>b).join(`
|
|
4
|
+
`)}})}};exports.AreaPlot=Ye;exports.AxisOverlay=Ze;exports.BarPlot=ze;exports.CanPlot=Le;exports.ChartAreaInteractions=Ve;exports.Crosshair=We;exports.LinePlot=Fe;exports.ScatterPlot=Ke;exports.SelectBox=Ge;exports.SparklinePlot=je;exports.TooltipsX=qe;exports.XTicks=Be;exports.YTicks=Ne;exports.applyStyles=A;exports.clamp=B;exports.clampUnfit=ke;exports.clampXPosToChartArea=j;exports.clampYPosToChartArea=O;exports.defaultNumericalTicksFormatter=ge;exports.findClosestIndex=Ce;exports.getScale=U;exports.makeLinearTicks=et;exports.makeTimeTickFormat=we;exports.makeTimeTicks=dt;exports.posToVal=L;exports.pxToValDistance=me;exports.sum=Te;exports.useDrawEffect=K;exports.useFrameState=Q;exports.useInteractionsEvent=ee;exports.useXPositioned=Oe;exports.valFits=W;exports.valToPos=N;exports.valToPxDistance=J;
|
|
5
5
|
//# sourceMappingURL=canplot.cjs.map
|