uplot-plus 0.5.3 → 0.5.5
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/annotations.d.ts.map +1 -0
- package/dist/axes/layout.d.ts.map +1 -0
- package/dist/axes/ticks.d.ts.map +1 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/components/Axis.d.ts.map +1 -0
- package/dist/components/Band.d.ts.map +1 -0
- package/dist/components/BoxWhisker.d.ts.map +1 -0
- package/dist/components/Candlestick.d.ts.map +1 -0
- package/dist/components/Chart.d.ts.map +1 -0
- package/dist/components/FloatingLegend.d.ts.map +1 -0
- package/dist/components/Heatmap.d.ts.map +1 -0
- package/dist/components/HoverLabel.d.ts.map +1 -0
- package/dist/components/Legend.d.ts.map +1 -0
- package/dist/components/Scale.d.ts.map +1 -0
- package/dist/components/Series.d.ts.map +1 -0
- package/dist/components/Sparkline.d.ts.map +1 -0
- package/dist/components/Timeline.d.ts.map +1 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Vector.d.ts.map +1 -0
- package/dist/components/ZoomRanger.d.ts.map +1 -0
- package/dist/components/annotations/AnnotationLabel.d.ts.map +1 -0
- package/dist/components/annotations/HLine.d.ts.map +1 -0
- package/dist/components/annotations/Region.d.ts.map +1 -0
- package/dist/components/annotations/VLine.d.ts.map +1 -0
- package/dist/components/annotations/index.d.ts.map +1 -0
- package/dist/components/annotations/useAnnotationDraw.d.ts.map +1 -0
- package/dist/components/overlay/SeriesPanel.d.ts.map +1 -0
- package/dist/core/BlockMinMax.d.ts.map +1 -0
- package/dist/core/CursorManager.d.ts.map +1 -0
- package/dist/core/DataStore.d.ts.map +1 -0
- package/dist/core/RenderScheduler.d.ts.map +1 -0
- package/dist/core/Scale.d.ts.map +1 -0
- package/dist/core/ScaleManager.d.ts.map +1 -0
- package/dist/core/normalizeData.d.ts.map +1 -0
- package/dist/formatters.d.ts.map +1 -0
- package/dist/hooks/useChart.d.ts.map +1 -0
- package/dist/hooks/useChartStore.d.ts.map +1 -0
- package/dist/hooks/useDrawHook.d.ts.map +1 -0
- package/dist/hooks/useInteraction.d.ts.map +1 -0
- package/dist/hooks/useRegisterConfig.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1786 -1768
- package/dist/math/align.d.ts.map +1 -0
- package/dist/math/increments.d.ts.map +1 -0
- package/dist/math/lttb.d.ts.map +1 -0
- package/dist/math/stack.d.ts.map +1 -0
- package/dist/math/utils.d.ts.map +1 -0
- package/dist/paths/bars.d.ts.map +1 -0
- package/dist/paths/catmullRom.d.ts.map +1 -0
- package/dist/paths/linear.d.ts.map +1 -0
- package/dist/paths/lttbLinear.d.ts.map +1 -0
- package/dist/paths/monotoneCubic.d.ts.map +1 -0
- package/dist/paths/points.d.ts.map +1 -0
- package/dist/paths/spline.d.ts.map +1 -0
- package/dist/paths/stepped.d.ts.map +1 -0
- package/dist/paths/types.d.ts.map +1 -0
- package/dist/paths/utils.d.ts.map +1 -0
- package/dist/rendering/CanvasRenderer.d.ts.map +1 -0
- package/dist/rendering/drawAxes.d.ts.map +1 -0
- package/dist/rendering/drawBands.d.ts.map +1 -0
- package/dist/rendering/drawCursor.d.ts.map +1 -0
- package/dist/rendering/drawPoints.d.ts.map +1 -0
- package/dist/rendering/drawRangeBox.d.ts.map +1 -0
- package/dist/rendering/drawSelect.d.ts.map +1 -0
- package/dist/rendering/drawSeries.d.ts.map +1 -0
- package/dist/sync/SyncGroup.d.ts.map +1 -0
- package/dist/sync/useSyncGroup.d.ts.map +1 -0
- package/dist/time/fmtDate.d.ts.map +1 -0
- package/dist/time/timeIncrs.d.ts.map +1 -0
- package/dist/time/timeSplits.d.ts.map +1 -0
- package/dist/time/timeVals.d.ts.map +1 -0
- package/dist/types/axes.d.ts.map +1 -0
- package/dist/types/bands.d.ts.map +1 -0
- package/dist/types/chart.d.ts.map +1 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/cursor.d.ts.map +1 -0
- package/dist/types/data.d.ts.map +1 -0
- package/dist/types/downsample.d.ts.map +1 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/interaction.d.ts.map +1 -0
- package/dist/types/legend.d.ts.map +1 -0
- package/dist/types/scales.d.ts.map +1 -0
- package/dist/types/series.d.ts.map +1 -0
- package/dist/types/timeline.d.ts.map +1 -0
- package/dist/types/tooltip.d.ts.map +1 -0
- package/dist/utils/shallowEqual.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/src/annotations.d.ts.map +0 -1
- package/dist/src/axes/layout.d.ts.map +0 -1
- package/dist/src/axes/ticks.d.ts.map +0 -1
- package/dist/src/colors.d.ts.map +0 -1
- package/dist/src/components/Axis.d.ts.map +0 -1
- package/dist/src/components/Band.d.ts.map +0 -1
- package/dist/src/components/BoxWhisker.d.ts.map +0 -1
- package/dist/src/components/Candlestick.d.ts.map +0 -1
- package/dist/src/components/Chart.d.ts.map +0 -1
- package/dist/src/components/FloatingLegend.d.ts.map +0 -1
- package/dist/src/components/Heatmap.d.ts.map +0 -1
- package/dist/src/components/HoverLabel.d.ts.map +0 -1
- package/dist/src/components/Legend.d.ts.map +0 -1
- package/dist/src/components/Scale.d.ts.map +0 -1
- package/dist/src/components/Series.d.ts.map +0 -1
- package/dist/src/components/Sparkline.d.ts.map +0 -1
- package/dist/src/components/Timeline.d.ts.map +0 -1
- package/dist/src/components/Tooltip.d.ts.map +0 -1
- package/dist/src/components/Vector.d.ts.map +0 -1
- package/dist/src/components/ZoomRanger.d.ts.map +0 -1
- package/dist/src/components/annotations/AnnotationLabel.d.ts.map +0 -1
- package/dist/src/components/annotations/HLine.d.ts.map +0 -1
- package/dist/src/components/annotations/Region.d.ts.map +0 -1
- package/dist/src/components/annotations/VLine.d.ts.map +0 -1
- package/dist/src/components/annotations/index.d.ts.map +0 -1
- package/dist/src/components/annotations/useAnnotationDraw.d.ts.map +0 -1
- package/dist/src/components/overlay/SeriesPanel.d.ts.map +0 -1
- package/dist/src/core/BlockMinMax.d.ts.map +0 -1
- package/dist/src/core/CursorManager.d.ts.map +0 -1
- package/dist/src/core/DataStore.d.ts.map +0 -1
- package/dist/src/core/RenderScheduler.d.ts.map +0 -1
- package/dist/src/core/Scale.d.ts.map +0 -1
- package/dist/src/core/ScaleManager.d.ts.map +0 -1
- package/dist/src/core/normalizeData.d.ts.map +0 -1
- package/dist/src/formatters.d.ts.map +0 -1
- package/dist/src/hooks/useChart.d.ts.map +0 -1
- package/dist/src/hooks/useChartStore.d.ts.map +0 -1
- package/dist/src/hooks/useDrawHook.d.ts.map +0 -1
- package/dist/src/hooks/useInteraction.d.ts.map +0 -1
- package/dist/src/hooks/useRegisterConfig.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/math/align.d.ts.map +0 -1
- package/dist/src/math/increments.d.ts.map +0 -1
- package/dist/src/math/lttb.d.ts.map +0 -1
- package/dist/src/math/stack.d.ts.map +0 -1
- package/dist/src/math/utils.d.ts.map +0 -1
- package/dist/src/paths/bars.d.ts.map +0 -1
- package/dist/src/paths/catmullRom.d.ts.map +0 -1
- package/dist/src/paths/linear.d.ts.map +0 -1
- package/dist/src/paths/lttbLinear.d.ts.map +0 -1
- package/dist/src/paths/monotoneCubic.d.ts.map +0 -1
- package/dist/src/paths/points.d.ts.map +0 -1
- package/dist/src/paths/spline.d.ts.map +0 -1
- package/dist/src/paths/stepped.d.ts.map +0 -1
- package/dist/src/paths/types.d.ts.map +0 -1
- package/dist/src/paths/utils.d.ts.map +0 -1
- package/dist/src/rendering/CanvasRenderer.d.ts.map +0 -1
- package/dist/src/rendering/drawAxes.d.ts.map +0 -1
- package/dist/src/rendering/drawBands.d.ts.map +0 -1
- package/dist/src/rendering/drawCursor.d.ts.map +0 -1
- package/dist/src/rendering/drawPoints.d.ts.map +0 -1
- package/dist/src/rendering/drawRangeBox.d.ts.map +0 -1
- package/dist/src/rendering/drawSelect.d.ts.map +0 -1
- package/dist/src/rendering/drawSeries.d.ts.map +0 -1
- package/dist/src/sync/SyncGroup.d.ts.map +0 -1
- package/dist/src/sync/useSyncGroup.d.ts.map +0 -1
- package/dist/src/time/fmtDate.d.ts.map +0 -1
- package/dist/src/time/timeIncrs.d.ts.map +0 -1
- package/dist/src/time/timeSplits.d.ts.map +0 -1
- package/dist/src/time/timeVals.d.ts.map +0 -1
- package/dist/src/types/axes.d.ts.map +0 -1
- package/dist/src/types/bands.d.ts.map +0 -1
- package/dist/src/types/chart.d.ts.map +0 -1
- package/dist/src/types/common.d.ts.map +0 -1
- package/dist/src/types/cursor.d.ts.map +0 -1
- package/dist/src/types/data.d.ts.map +0 -1
- package/dist/src/types/downsample.d.ts.map +0 -1
- package/dist/src/types/events.d.ts.map +0 -1
- package/dist/src/types/hooks.d.ts.map +0 -1
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/interaction.d.ts.map +0 -1
- package/dist/src/types/legend.d.ts.map +0 -1
- package/dist/src/types/scales.d.ts.map +0 -1
- package/dist/src/types/series.d.ts.map +0 -1
- package/dist/src/types/timeline.d.ts.map +0 -1
- package/dist/src/types/tooltip.d.ts.map +0 -1
- package/dist/src/utils/shallowEqual.d.ts.map +0 -1
- /package/dist/{src/annotations.d.ts → annotations.d.ts} +0 -0
- /package/dist/{src/axes → axes}/layout.d.ts +0 -0
- /package/dist/{src/axes → axes}/ticks.d.ts +0 -0
- /package/dist/{src/colors.d.ts → colors.d.ts} +0 -0
- /package/dist/{src/components → components}/Axis.d.ts +0 -0
- /package/dist/{src/components → components}/Band.d.ts +0 -0
- /package/dist/{src/components → components}/BoxWhisker.d.ts +0 -0
- /package/dist/{src/components → components}/Candlestick.d.ts +0 -0
- /package/dist/{src/components → components}/Chart.d.ts +0 -0
- /package/dist/{src/components → components}/FloatingLegend.d.ts +0 -0
- /package/dist/{src/components → components}/Heatmap.d.ts +0 -0
- /package/dist/{src/components → components}/HoverLabel.d.ts +0 -0
- /package/dist/{src/components → components}/Legend.d.ts +0 -0
- /package/dist/{src/components → components}/Scale.d.ts +0 -0
- /package/dist/{src/components → components}/Series.d.ts +0 -0
- /package/dist/{src/components → components}/Sparkline.d.ts +0 -0
- /package/dist/{src/components → components}/Timeline.d.ts +0 -0
- /package/dist/{src/components → components}/Tooltip.d.ts +0 -0
- /package/dist/{src/components → components}/Vector.d.ts +0 -0
- /package/dist/{src/components → components}/ZoomRanger.d.ts +0 -0
- /package/dist/{src/components → components}/annotations/AnnotationLabel.d.ts +0 -0
- /package/dist/{src/components → components}/annotations/HLine.d.ts +0 -0
- /package/dist/{src/components → components}/annotations/Region.d.ts +0 -0
- /package/dist/{src/components → components}/annotations/VLine.d.ts +0 -0
- /package/dist/{src/components → components}/annotations/index.d.ts +0 -0
- /package/dist/{src/components → components}/annotations/useAnnotationDraw.d.ts +0 -0
- /package/dist/{src/components → components}/overlay/SeriesPanel.d.ts +0 -0
- /package/dist/{src/core → core}/BlockMinMax.d.ts +0 -0
- /package/dist/{src/core → core}/CursorManager.d.ts +0 -0
- /package/dist/{src/core → core}/DataStore.d.ts +0 -0
- /package/dist/{src/core → core}/RenderScheduler.d.ts +0 -0
- /package/dist/{src/core → core}/Scale.d.ts +0 -0
- /package/dist/{src/core → core}/ScaleManager.d.ts +0 -0
- /package/dist/{src/core → core}/normalizeData.d.ts +0 -0
- /package/dist/{src/formatters.d.ts → formatters.d.ts} +0 -0
- /package/dist/{src/hooks → hooks}/useChart.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useChartStore.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useDrawHook.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useInteraction.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/useRegisterConfig.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/math → math}/align.d.ts +0 -0
- /package/dist/{src/math → math}/increments.d.ts +0 -0
- /package/dist/{src/math → math}/lttb.d.ts +0 -0
- /package/dist/{src/math → math}/stack.d.ts +0 -0
- /package/dist/{src/math → math}/utils.d.ts +0 -0
- /package/dist/{src/paths → paths}/bars.d.ts +0 -0
- /package/dist/{src/paths → paths}/catmullRom.d.ts +0 -0
- /package/dist/{src/paths → paths}/linear.d.ts +0 -0
- /package/dist/{src/paths → paths}/lttbLinear.d.ts +0 -0
- /package/dist/{src/paths → paths}/monotoneCubic.d.ts +0 -0
- /package/dist/{src/paths → paths}/points.d.ts +0 -0
- /package/dist/{src/paths → paths}/spline.d.ts +0 -0
- /package/dist/{src/paths → paths}/stepped.d.ts +0 -0
- /package/dist/{src/paths → paths}/types.d.ts +0 -0
- /package/dist/{src/paths → paths}/utils.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/CanvasRenderer.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/drawAxes.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/drawBands.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/drawCursor.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/drawPoints.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/drawRangeBox.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/drawSelect.d.ts +0 -0
- /package/dist/{src/rendering → rendering}/drawSeries.d.ts +0 -0
- /package/dist/{src/sync → sync}/SyncGroup.d.ts +0 -0
- /package/dist/{src/sync → sync}/useSyncGroup.d.ts +0 -0
- /package/dist/{src/time → time}/fmtDate.d.ts +0 -0
- /package/dist/{src/time → time}/timeIncrs.d.ts +0 -0
- /package/dist/{src/time → time}/timeSplits.d.ts +0 -0
- /package/dist/{src/time → time}/timeVals.d.ts +0 -0
- /package/dist/{src/types → types}/axes.d.ts +0 -0
- /package/dist/{src/types → types}/bands.d.ts +0 -0
- /package/dist/{src/types → types}/chart.d.ts +0 -0
- /package/dist/{src/types → types}/common.d.ts +0 -0
- /package/dist/{src/types → types}/cursor.d.ts +0 -0
- /package/dist/{src/types → types}/data.d.ts +0 -0
- /package/dist/{src/types → types}/downsample.d.ts +0 -0
- /package/dist/{src/types → types}/events.d.ts +0 -0
- /package/dist/{src/types → types}/hooks.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/interaction.d.ts +0 -0
- /package/dist/{src/types → types}/legend.d.ts +0 -0
- /package/dist/{src/types → types}/scales.d.ts +0 -0
- /package/dist/{src/types → types}/series.d.ts +0 -0
- /package/dist/{src/types → types}/timeline.d.ts +0 -0
- /package/dist/{src/types → types}/tooltip.d.ts +0 -0
- /package/dist/{src/utils → utils}/shallowEqual.d.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var wn=Object.defineProperty;var Sn=(t,e,n)=>e in t?wn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var j=(t,e,n)=>Sn(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),D=require("react");function vn(t=.15){return e=>{e.focusAlpha=t}}const Rt=[["leftDrag","zoomX"],["leftDblclick","reset"],["wheel","zoomX"],["xGutterDrag","panX"],["yGutterDrag","panY"],["pinch","zoomX"],["touchDrag","zoomX"]];var Y=(t=>(t[t.Top=0]="Top",t[t.Right=1]="Right",t[t.Bottom=2]="Bottom",t[t.Left=3]="Left",t))(Y||{}),H=(t=>(t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical",t))(H||{}),O=(t=>(t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward",t))(O||{}),K=(t=>(t[t.Linear=1]="Linear",t[t.Ordinal=2]="Ordinal",t[t.Log=3]="Log",t[t.Asinh=4]="Asinh",t))(K||{}),xt=(t=>(t[t.Ascending=1]="Ascending",t[t.Descending=-1]="Descending",t[t.Unsorted=0]="Unsorted",t))(xt||{});function St(t){return t%2}var tt=(t=>(t[t.None=0]="None",t[t.Scales=1]="Scales",t[t.Axes=2]="Axes",t[t.Paths=4]="Paths",t[t.Cursor=8]="Cursor",t[t.Select=16]="Select",t[t.Size=32]="Size",t[t.Full=63]="Full",t))(tt||{});const J=Math,Xt=J.PI,et=J.abs,st=J.floor,B=J.round,It=J.ceil,te=J.min,yt=J.max,pt=J.pow,be=J.sign,nt=J.log10,kt=J.log2,bn=(t,e=1)=>J.sinh(t)*e,oe=(t,e=1)=>J.asinh(t/e),q=1/0,je=Number.isInteger;function jt(t,e){return t[e]??0}function ft(t,e,n=0,o=e.length-1){let s;const r=o<=2147483647;for(;o-n>1;)s=r?n+o>>1:st((n+o)/2),jt(e,s)<t?n=s:o=s;return t-jt(e,n)<=jt(e,o)-t?n:o}const Ye=t=>t!=null,Ne=t=>t!=null&&t>0;function Ue(t){return(e,n,o)=>{let s=-1,r=-1;for(let i=n;i<=o;i++)if(t(e[i])){s=i;break}for(let i=o;i>=n;i--)if(t(e[i])){r=i;break}return[s,r]}}const Ht=Ue(Ye),Oe=Ue(Ne);function Mn(t,e,n,o=xt.Unsorted,s=!1){const r=s?Oe:Ht,i=s?Ne:Ye,[l,c]=r(t,e,n);let f=t[l]??q,a=t[l]??-q;if(l>-1)if(o===xt.Ascending)f=t[l]??q,a=t[c]??-q;else if(o===xt.Descending)f=t[c]??q,a=t[l]??-q;else for(let d=l;d<=c;d++){const u=t[d];u!=null&&i(u)&&(u<f?f=u:u>a&&(a=u))}return[f,a]}function it(t,e=0){if(je(t))return t;const n=10**e,o=t*n*(1+Number.EPSILON);return B(o)/n}const Ct=new Map;function xn(t){return(String(t).split(".")[1]??"").length}const yn=/\.\d*?(?=9{6,}|0{6,})/gm;function wt(t){if(je(t)||Ct.has(t))return t;const e=`${t}`,n=e.match(yn);if(n==null)return t;const o=n[0].length-1;if(e.indexOf("e-")!==-1){const s=e.split("e"),r=s[0]??"0",i=s[1]??"0";return+`${wt(+r)}e${i}`}return it(t,o)}function Cn(t,e,n=!0){return n?wt(it(wt(t/e))*e):it(t/e)*e}function se(t,e,n=!0){return n?wt(It(wt(t/e))*e):It(t/e)*e}function Ke(t,e,n=!0){return n?wt(st(wt(t/e))*e):st(t/e)*e}function kn(t){return t===0?e=>e:t===1?B:e=>Cn(e,t)}function qe(t,e,n,o){const s=[],r=o.map(xn);for(let i=e;i<n;i++){const l=et(i);for(let c=0;c<o.length;c++){const f=o[c]??0,a=r[c]??0,d=+`${f}e${i}`,u=(i>=0?0:l)+(i>=a?0:a),h=d;s.push(h),Ct.set(h,u)}}return s}function Z(t,e,n){return te(yt(t,e),n)}const Tn=new Intl.NumberFormat,Ze=t=>Tn.format(t);function Me(t,e,n){for(;e<=n;){if(t[e]!=null)return!0;e++}return!1}const An=.1,ct={mode:3,pad:An,soft:null},At={pad:0,soft:null,mode:0},In={min:At,max:At};function Yt(t,e,n,o){let s;typeof n=="number"?(At.pad=n,At.soft=null,At.mode=0,s=In):s=n;const r=s.min,i=s.max,l=r.pad,c=i.pad,f=r.hard??-q,a=i.hard??q,d=r.soft??q,u=i.soft??-q,h=r.mode,p=i.mode;let w=e-t;const x=nt(w),g=yt(et(t),et(e)),S=nt(g),C=et(S-x);(w<1e-24||C>10)&&(w=0,(t===0||e===0)&&(w=1e-24));const M=w||g||1e3,P=nt(M),A=pt(10,st(P)),k=M*(w===0?t===0?.1:1:l),T=it(Ke(t-k,A/10),24),I=h===1||h===3&&T<=d||h===2&&T>=d,L=t>=d&&I?d:q,m=yt(f,T<L&&t>=L?L:te(L,T)),b=M*(w===0?e===0?.1:1:c),v=it(se(e+b,A/10),24),y=p===1||p===3&&v>=u||p===2&&v<=u,_=e<=u&&y?u:-q,E=te(a,v>_&&e<=_?_:yt(_,v));return m===E&&m===0?[-1,1]:[m,E]}function Je(t,e,n,o){n===2&&(o=!0);const s=be(t),r=be(e);t===e&&(s===-1?(t*=n,e/=n):(t/=n,e*=n));const i=n===10?nt:kt,l=s===1?st:It,c=r===1?It:st,f=i(et(t)),a=i(et(e)),d=l(f),u=c(a);let h=pt(n,d),p=pt(n,u);return n===10&&(d<0&&(h=it(h,-d)),u<0&&(p=it(p,-u))),o?(t=h*s,e=p*r):(t=Ke(t,pt(n,st(f)),!1),e=se(e,pt(n,st(a)),!1)),[t,e]}function Ln(t,e,n,o){const s=Je(t,e,n,o);return t===0&&(s[0]=0),e===0&&(s[1]=0),s}function xe(t){return(nt((t^t>>31)-(t>>31))|0)+1}function Pn(t,e,n,o,s){const r=yt(xe(t),xe(e)),i=e-t;let l=yt(0,ft(s/o*i,n)-1);do{const c=n[l]??0,f=o*c/i;if(f>=s*.9&&r+(c<5?Ct.get(c)??0:0)<=17)return[c,f]}while(++l<n.length);return[0,0]}function En(t){return{id:t.id,min:t.min??null,max:t.max??null,distr:t.distr??K.Linear,log:t.log??10,asinh:t.asinh??1,ori:t.ori??(t.id==="x"?H.Horizontal:H.Vertical),dir:t.dir??O.Forward,time:t.time??!1,auto:t.auto??!0,range:t.range??null,_discrete:!1,_cfgMin:t.min??null,_cfgMax:t.max??null,_min:null,_max:null}}function N(t){return t.min!=null&&t.max!=null}function rt(t){t._min=null,t._max=null}function Qe(t){if(t._min!=null)return t._min;const{min:e,distr:n}=t;if(e==null)return 0;if(n===K.Log){e<=0&&console.warn(`[uPlot+] Log scale "${t.id}": min value ${e} <= 0, clamping to 1e-10`);const o=e>0?e:1e-10;t._min=(t.log===10?nt:kt)(o)}else n===K.Asinh?t._min=oe(e,t.asinh):t._min=e;return t._min}function tn(t){if(t._max!=null)return t._max;const{max:e,distr:n}=t;if(e==null)return 0;if(n===K.Log){e<=0&&console.warn(`[uPlot+] Log scale "${t.id}": max value ${e} <= 0, clamping to 1e-10`);const o=e>0?e:1e-10;t._max=(t.log===10?nt:kt)(o)}else n===K.Asinh?t._max=oe(e,t.asinh):t._max=e;return t._max}function _n(t,e){if(e.min==null||e.max==null)return 0;const n=Qe(e),s=tn(e)-n;if(s===0)return 0;const{distr:r}=e;if(r===K.Log){const i=e.log===10?nt:kt,l=t>0?t:1e-10;return(i(l)-n)/s}return r===K.Asinh?(oe(t,e.asinh)-n)/s:(t-n)/s}function Dn(t,e){if(e.min==null||e.max==null)return 0;const n=Qe(e),o=tn(e);if(o===n)return e.min;const{distr:s}=e;return s===K.Log?Math.pow(e.log,n+t*(o-n)):s===K.Asinh?bn(n+t*(o-n),e.asinh):n+t*(o-n)}function X(t,e,n,o){const s=_n(t,e);let r;return e.ori===H.Horizontal?r=e.dir===O.Forward?s:1-s:r=e.dir===O.Forward?1-s:s,o+r*n}function lt(t,e,n,o){if(n===0)return e.min??0;let s=(t-o)/n;return e.ori===H.Horizontal?e.dir===O.Backward&&(s=1-s):e.dir!==O.Backward&&(s=1-s),Dn(s,e)}class Fn{constructor(){j(this,"scales",new Map);j(this,"groupXScales",new Map)}addScale(e){this.scales.set(e.id,En(e))}removeScale(e){this.scales.delete(e)}getScale(e){return this.scales.get(e)}getAllScales(){return this.scales.values()}setGroupXScale(e,n){this.groupXScales.set(e,n)}getGroupXScaleKey(e){return this.groupXScales.get(e)}setRange(e,n,o){const s=this.scales.get(e);s&&(s.min=n,s.max=o,rt(s))}autoRangeX(e){var o,s,r,i,l,c;const n=new Map;for(const[f,a]of this.groupXScales){const d=this.scales.get(a);if(!d||!d.auto)continue;const u=e[f];if(!u||u.x.length===0)continue;const h=u.x[0],p=u.x[u.x.length-1];if(h==null||p==null)continue;const w=n.get(a);w?(w.dataMin=Math.min(w.dataMin,h),w.dataMax=Math.max(w.dataMax,p),w.groups.push(f)):n.set(a,{dataMin:h,dataMax:p,groups:[f]})}for(const[f,{dataMin:a,dataMax:d,groups:u}]of n){const h=this.scales.get(f);if(!h)continue;let p=!0,w=q;for(const x of u){const g=e[x];if(g){for(let S=0;S<g.x.length;S++)if(Number.isInteger(g.x[S])||(p=!1),S>0){const C=g.x[S]-g.x[S-1];C>0&&C<w&&(w=C)}}}if(h._discrete=p,h.range){const[x,g]=Yt(a,d,{min:{pad:((o=h.range.min)==null?void 0:o.pad)??0,soft:((s=h.range.min)==null?void 0:s.soft)??null,mode:((r=h.range.min)==null?void 0:r.mode)??0},max:{pad:((i=h.range.max)==null?void 0:i.pad)??0,soft:((l=h.range.max)==null?void 0:l.soft)??null,mode:((c=h.range.max)==null?void 0:c.mode)??0}});h.min=x,h.max=g}else if(a===d)[h.min,h.max]=Yt(a,d,{min:{pad:.1,soft:null,mode:0},max:{pad:.1,soft:null,mode:0}});else if(w<q){const x=w/2;h.min=a-x,h.max=d+x}else h.min=a,h.max=d;h._cfgMin!=null&&(h.min=h._cfgMin),h._cfgMax!=null&&(h.max=h._cfgMax),rt(h)}}autoRange(e,n,o){var i,l,c,f,a,d;const s=new Map,r=new Map;for(const{group:u,index:h,yScale:p}of n){const w=e[u];if(!w)continue;const x=w.series[h];if(!x||x.length===0)continue;const g=o.windows.get(u),S=g?g[0]:0,C=g?g[1]:x.length-1,M=this.scales.get(p),P=(M==null?void 0:M.distr)===K.Log,[A,k]=o.getCachedMinMax(u,h,S,C,0,P),T=s.get(p),I=r.get(p);s.set(p,T!=null?Math.min(T,A):A),r.set(p,I!=null?Math.max(I,k):k)}for(const[u,h]of s){const p=this.scales.get(u);if(!p||!p.auto)continue;const w=r.get(u)??-q;if(h===q)continue;let x,g;if(p.distr===K.Log)[x,g]=Je(h,w,p.log,!1);else if(p.distr===K.Asinh)[x,g]=Ln(h,w,p.log,!1);else{const S=p.range??{min:ct,max:ct};[x,g]=Yt(h,w,{min:{pad:((i=S.min)==null?void 0:i.pad)??ct.pad,soft:((l=S.min)==null?void 0:l.soft)??ct.soft,mode:((c=S.min)==null?void 0:c.mode)??ct.mode},max:{pad:((f=S.max)==null?void 0:f.pad)??ct.pad,soft:((a=S.max)==null?void 0:a.soft)??ct.soft,mode:((d=S.max)==null?void 0:d.mode)??ct.mode}})}p._cfgMin!=null&&(x=p._cfgMin),p._cfgMax!=null&&(g=p._cfgMax),p.min=x,p.max=g,rt(p)}}}const Rn=1024;class zn{constructor(e,n=Rn){j(this,"blocks");j(this,"nBlocks");j(this,"blockSize");j(this,"data");j(this,"len");this.data=e,this.len=e.length,this.blockSize=n,this.nBlocks=Math.ceil(e.length/n),this.blocks=new Float64Array(this.nBlocks*2),this.buildAll()}buildAll(){const{data:e,blockSize:n,nBlocks:o,blocks:s,len:r}=this;for(let i=0;i<o;i++){const l=i*n,c=Math.min(l+n,r);let f=1/0,a=-1/0;for(let d=l;d<c;d++){const u=e[d];u!=null&&(u<f&&(f=u),u>a&&(a=u))}s[i*2]=f,s[i*2+1]=a}}rangeMinMax(e,n){const{data:o,blockSize:s,blocks:r}=this;let i=1/0,l=-1/0;const c=Math.floor(e/s),f=Math.floor(n/s);if(c===f){for(let u=e;u<=n;u++){const h=o[u];h!=null&&(h<i&&(i=h),h>l&&(l=h))}return[i,l]}const a=(c+1)*s-1;for(let u=e;u<=a;u++){const h=o[u];h!=null&&(h<i&&(i=h),h>l&&(l=h))}for(let u=c+1;u<f;u++){const h=r[u*2]??1/0,p=r[u*2+1]??-1/0;h<i&&(i=h),p>l&&(l=p)}const d=f*s;for(let u=d;u<=n;u++){const h=o[u];h!=null&&(h<i&&(i=h),h>l&&(l=h))}return[i,l]}updateBlock(e){const{data:n,blockSize:o,blocks:s,len:r}=this;if(e>=this.nBlocks)return;const i=e*o,l=Math.min(i+o,r);let c=1/0,f=-1/0;for(let a=i;a<l;a++){const d=n[a];d!=null&&(d<c&&(c=d),d>f&&(f=d))}s[e*2]=c,s[e*2+1]=f}grow(e){const n=this.nBlocks;if(this.len=e,this.nBlocks=Math.ceil(e/this.blockSize),this.nBlocks>n){const s=new Float64Array(this.nBlocks*2);s.set(this.blocks),this.blocks=s}const o=Math.max(0,n-1);for(let s=o;s<this.nBlocks;s++)this.updateBlock(s)}setData(e){this.data=e}}class Hn{constructor(){j(this,"data",[]);j(this,"windows",new Map);j(this,"minMaxCache",new Map);j(this,"blockTrees",new Map)}setData(e){this.data=e,this.windows.clear();for(const n of this.minMaxCache.values())n.clear();this.minMaxCache.clear(),this.blockTrees.clear()}getOrBuildTree(e,n){const o=`${e}:${n}`;let s=this.blockTrees.get(o);if(s)return s;const r=this.data[e];if(!r)return;const i=r.series[n];if(!(!i||i.length===0))return s=new zn(i),this.blockTrees.set(o,s),s}updateWindows(e){var o;let n=!1;for(let s=0;s<this.data.length;s++){const r=this.data[s],i=e(s),l=this.windows.get(s);let c,f;if(!r||!i||!N(i))c=0,f=Math.max(0,((r==null?void 0:r.x.length)??1)-1);else{const a=r.x;if(a.length===0)c=0,f=0;else{c=ft(i.min,a),f=ft(i.max,a);const d=a[c],u=a[f];c>0&&d!=null&&d>i.min&&c--,f<a.length-1&&u!=null&&u<i.max&&f++}}(!l||l[0]!==c||l[1]!==f)&&(n=!0,(o=this.minMaxCache.get(s))==null||o.clear()),this.windows.set(s,[c,f])}return n}getWindow(e){var n;return this.windows.get(e)??[0,(((n=this.data[e])==null?void 0:n.x.length)||1)-1]}getXValues(e){var n;return((n=this.data[e])==null?void 0:n.x)??[]}getYValues(e,n){var o;return((o=this.data[e])==null?void 0:o.series[n])??[]}getCachedMinMax(e,n,o,s,r,i){let l=this.minMaxCache.get(e);const c=`${n}:${o}:${s}`;if(l){const h=l.get(c);if(h!=null)return h}else l=new Map,this.minMaxCache.set(e,l);const f=this.data[e];if(!f)return[1/0,-1/0];const a=f.series[n];if(!a||a.length===0)return[1/0,-1/0];let d;const u=!i&&r===xt.Unsorted?this.getOrBuildTree(e,n):void 0;return u?d=u.rangeMinMax(o,s):d=Mn(a,o,s,r,i),l.set(c,d),d}getBlockTree(e,n){return this.getOrBuildTree(e,n)}appendData(e,n,o){var i;const s=this.data[e];if(!s)return;let r;Array.isArray(s.x)?r=s.x:(r=Array.from(s.x),s.x=r);for(let l=0;l<n.length;l++){const c=n[l];c!=null&&r.push(c)}for(let l=0;l<s.series.length;l++){let c=s.series[l];if(!c)continue;Array.isArray(c)||(c=Array.from(c),s.series[l]=c);const f=o[l];if(f){const d=c;for(let u=0;u<f.length;u++)d.push(f[u]??null)}const a=this.blockTrees.get(`${e}:${l}`);a&&(a.setData(c),a.grow(c.length))}(i=this.minMaxCache.get(e))==null||i.clear()}static toTypedX(e){for(const n of e)Array.isArray(n.x)&&(n.x=Float64Array.from(n.x));return e}}const Et=-10;class Wn{constructor(){j(this,"state",{left:Et,top:Et,activeGroup:-1,activeSeriesIdx:-1,activeDataIdx:-1});j(this,"_groupedConfigs",new Map);j(this,"_groupedConfigsSource",null)}getGroupedConfigs(e){if(this._groupedConfigsSource!==e){this._groupedConfigsSource=e,this._groupedConfigs.clear();for(const n of e){if(n.show===!1)continue;let o=this._groupedConfigs.get(n.group);o==null&&(o=[],this._groupedConfigs.set(n.group,o)),o.push(n)}}return this._groupedConfigs}invalidateGroupedConfigs(){this._groupedConfigsSource=null}hide(){this.state.left=Et,this.state.top=Et,this.state.activeGroup=-1,this.state.activeSeriesIdx=-1,this.state.activeDataIdx=-1}update(e,n,o,s,r,i,l,c){this.state.left=e,this.state.top=n;let f=1/0,a=-1,d=-1,u=-1;const h=this.getGroupedConfigs(r);for(let p=0;p<s.length;p++){const w=s[p];if(w==null)continue;const x=w.x;if(x.length===0)continue;const g=c(p);if(g==null)continue;const S=i(g);if(S==null||!N(S))continue;const[C,M]=l(p),P=o.width,A=o.left,k=lt(e+A,S,P,A),T=ft(k,x,C,M),I=[T];T>C&&I.push(T-1),T<M&&I.push(T+1);const L=new Map;for(const m of I){const b=x[m];if(b==null)continue;const v=X(b,S,P,A);for(const y of h.get(p)??[]){const _=w.series[y.index];if(_==null)continue;const E=_[m];if(E==null)continue;let R=L.get(y.yScale);if(R==null&&!L.has(y.yScale)&&(R=i(y.yScale),L.set(y.yScale,R)),R==null||!N(R))continue;const z=o.height,F=o.top,$=X(E,R,z,F),G=e+A-v,V=n+F-$,U=G*G+V*V;if(U<f&&(f=U,a=p,d=y.index,u=m,U===0))break}if(f===0)break}}this.state.activeGroup=a,this.state.activeSeriesIdx=d,this.state.activeDataIdx=u}syncToValue(e,n){const o=n.dataStore.data;if(o.length===0)return;const s=o[0];if(s==null)return;const r=n.scaleManager.getGroupXScaleKey(0);if(r==null)return;const i=n.scaleManager.getScale(r);if(i==null||!N(i))return;const[l,c]=n.dataStore.getWindow(0),f=ft(e,s.x,l,c),a=s.x[f];if(a==null)return;const d=X(a,i,n.plotBox.width,n.plotBox.left);this.state.left=d-n.plotBox.left,this.state.activeGroup=0,this.state.activeDataIdx=f;let u=0,h=n.plotBox.height/2;for(const p of n.seriesConfigs){if(p.group!==0||p.show===!1)continue;const w=s.series[p.index];if(w==null)continue;const x=w[f];if(x==null)continue;const g=n.scaleManager.getScale(p.yScale);if(!(g==null||!N(g))){h=X(x,g,n.plotBox.height,n.plotBox.top)-n.plotBox.top,u=p.index;break}}this.state.top=h,this.state.activeSeriesIdx=u}}class $n{constructor(){j(this,"flags",tt.None);j(this,"frameId",null);j(this,"callback",null)}mark(e){this.flags|=e,this.scheduleFrame()}has(e){return(this.flags&e)!==0}get dirty(){return this.flags}clear(){this.flags=tt.None}onRedraw(e){this.callback=e}scheduleFrame(){this.frameId==null&&(this.frameId=requestAnimationFrame(()=>{this.frameId=null;const e=this.callback;e!=null&&e(),this.clear()}))}cancel(){this.frameId!=null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}dispose(){this.cancel(),this.callback=null,this.flags=tt.None}}const Wt={width:1},Gn={width:0,fill:"auto",fillTo:0,points:{show:!1},cursor:{show:!1}},Vn={width:0,cursor:{show:!1}};function $t(t,e,n){t.lineTo(e,n)}function Gt(t,e,n){t.lineTo(n,e)}function ie(t,e,n,o,s,r){const i=[];let l=-1;const c=s===O.Forward?n:o,f=s===O.Forward?o:n,a=s;for(let d=c;s===O.Forward?d<=f:d>=f;d+=a)if(e[d]===null||e[d]===void 0){if(l===-1){const u=Z(d-s,n,o);l=r(t[u])}}else l!==-1&&(i.push([l,r(t[d])]),l=-1);return l!==-1&&i.push([l,r(t[o])]),i}function re(t,e,n,o,s,r){const i=new Path2D;let l=e===H.Horizontal?n:o;const c=e===H.Horizontal?n+s:o+r,f=e===H.Horizontal?o:n,a=e===H.Horizontal?r:s;for(const[d,u]of t)d>l&&(e===H.Horizontal?i.rect(l,f,d-l,a):i.rect(f,l,a,d-l)),l=u;return l<c&&(e===H.Horizontal?i.rect(l,f,c-l,a):i.rect(f,l,a,c-l)),i}function en(t){return(e,n,o,s,r,i)=>{o!==s&&(r!==o&&i!==o&&t(e,n,o),r!==s&&i!==s&&t(e,n,s),t(e,n,i))}}const Bn=en($t),Xn=en(Gt);function nn(){const t=(e,n,o,s,r,i,l,c,f,a,d,u,h)=>{const p=(h==null?void 0:h.spanGaps)??!1;if([f,a]=(s.distr===K.Log?Oe:Ht)(n,f,a),f===-1)return{stroke:new Path2D,fill:null,clip:null,band:null,gaps:null};const x=T=>u(X(T,o,r,l)),g=T=>u(X(T,s,i,c));let S,C;o.ori===H.Horizontal?(S=$t,C=Bn):(S=Gt,C=Xn);const M={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null},P=M.stroke;let A=!1;if(a-f>=r*4){const T=R=>lt(R,o,r,l);let I=null,L=0,m=0,b=0,v=x(e[d===O.Forward?f:a]);const y=x(e[f]),_=x(e[a]);let E=T(d===O.Forward?y+1:_-1);for(let R=d===O.Forward?f:a;R>=f&&R<=a;R+=d){const z=e[R],$=(d===O.Forward?z<E:z>E)?v:x(z),G=n[R];$===v?G!=null?(b=G,I==null?(S(P,$,g(b)),m=I=L=b):b<I?I=b:b>L&&(L=b)):G===null&&!p&&(A=!0):(I!=null&&C(P,v,g(I),g(L),g(m),g(b)),G!=null?(b=G,S(P,$,g(b)),I=L=m=b):(I=null,L=0,G===null&&!p&&(A=!0)),v=$,E=T(v+d))}I!=null&&(I!==L?C(P,v,g(I),g(L),g(m),g(b)):S(P,v,g(b)))}else for(let T=d===O.Forward?f:a;T>=f&&T<=a;T+=d){const I=n[T];I===null&&!p?A=!0:I!=null&&S(P,x(e[T]),g(I))}{const T=M.fill=new Path2D(P),I=(h==null?void 0:h.fillTo)??s.min??0,L=g(I);let m=x(e[f]),b=x(e[a]);d===O.Backward&&([b,m]=[m,b]),S(T,b,L),S(T,m,L)}if(A){const T=ie(e,n,f,a,d,x);M.gaps=T,M.clip=re(T,o.ori,l,c,r,i)}return M};return t.defaults=Wt,t}function le(t,e,n){const o=t.length;if(n=Math.max(2,Math.round(n)),o<=n){const u=new Uint32Array(o),h=new Float64Array(o),p=new Array(o);for(let w=0;w<o;w++)u[w]=w,h[w]=t[w],p[w]=e[w]??null;return{indices:u,x:h,y:p}}const s=[];let r=-1,i=0;for(let u=0;u<o;u++)e[u]!=null?(r===-1&&(r=u),i++):r!==-1&&(s.push([r,u-1]),r=-1);if(r!==-1&&s.push([r,o-1]),i===0)return{indices:new Uint32Array(0),x:new Float64Array(0),y:[]};if(i<=n){const u=new Uint32Array(i),h=new Float64Array(i),p=new Array(i);let w=0;for(let x=0;x<o;x++)e[x]!=null&&(u[w]=x,h[w]=t[x],p[w]=e[x],w++);return{indices:u,x:h,y:p}}const l=[];for(const[u,h]of s){const p=h-u+1,w=Math.max(2,Math.round(n*(p/i))),x=jn(t,e,u,h,w);for(const g of x)l.push(g)}const c=l.length,f=new Uint32Array(c),a=new Float64Array(c),d=new Array(c);for(let u=0;u<c;u++){const h=l[u];f[u]=h,a[u]=t[h],d[u]=e[h]}return{indices:f,x:a,y:d}}function jn(t,e,n,o,s){const r=o-n+1;if(r<=s){const a=[];for(let d=n;d<=o;d++)a.push(d);return a}const i=[];i.push(n);const l=s-2,c=(r-2)/l;let f=n;for(let a=0;a<l;a++){const d=n+1+Math.floor(a*c),u=Math.min(n+1+Math.floor((a+1)*c)-1,o-1);let h=0,p=0,w=0;if(a<l-1){const M=n+1+Math.floor((a+1)*c),P=Math.min(n+1+Math.floor((a+2)*c)-1,o-1);for(let A=M;A<=P;A++)h+=t[A],p+=e[A],w++}else h=t[o],p=e[o],w=1;w>0&&(h/=w,p/=w);const x=t[f],g=e[f];let S=d,C=-1;for(let M=d;M<=u;M++){const P=t[M],A=e[M],k=Math.abs(x*(A-p)+P*(p-g)+h*(g-A));k>C&&(C=k,S=M)}i.push(S),f=S}return i.push(o),i}function Yn(t,e){const n=t.x.length;if(e=Math.max(2,Math.round(e)),n<=e)return t;const o=new Set;for(const c of t.series){const f=le(t.x,c,e);for(let a=0;a<f.indices.length;a++)o.add(f.indices[a])}const s=Array.from(o).sort((c,f)=>c-f),r=s.length,i=new Float64Array(r);for(let c=0;c<r;c++)i[c]=t.x[s[c]];const l=[];for(const c of t.series)if(Array.isArray(c)&&c.some(a=>a===null)){const a=new Array(r);for(let d=0;d<r;d++)a[d]=c[s[d]]??null;l.push(a)}else{const a=new Float64Array(r);for(let d=0;d<r;d++)a[d]=c[s[d]];l.push(a)}return{x:i,series:l}}function Nn(t){const n=nn(),o=(s,r,i,l,c,f,a,d,u,h,p,w,x)=>{const g=h-u+1,S=Math.round(c*1);if(g>S*2){const C=h-u+1,M=new Float64Array(C),P=new Array(C);for(let k=0;k<C;k++)M[k]=s[u+k],P[k]=r[u+k]??null;const A=le(M,P,S);return n(A.x,A.y,i,l,c,f,a,d,0,A.x.length-1,p,w,x)}return n(s,r,i,l,c,f,a,d,u,h,p,w,x)};return o.defaults=Wt,o}const ye=new WeakMap;function Ce(t,e,n){return typeof e=="string"?e:Un(t,e,n)}function Un(t,e,n){const o=ye.get(e);if(o!=null&&o.left===n.left&&o.top===n.top&&o.width===n.width&&o.height===n.height)return o.grad;const s=t.createLinearGradient(0,n.top,0,n.top+n.height);for(const[r,i]of e.stops)s.addColorStop(r,i);return ye.set(e,{grad:s,left:n.left,top:n.top,width:n.width,height:n.height}),s}function On(t,e,n,o,s){if(e.show===!1)return;const r=e.alpha??1;t.save(),r<1&&(t.globalAlpha=r),n.clip&&t.clip(n.clip);const i=s??{left:0,top:0,width:t.canvas.width/o,height:t.canvas.height/o};if(e.fill&&n.fill&&(t.fillStyle=Ce(t,e.fill,i),t.fill(n.fill)),e.stroke){const l=(e.width??1)*o;t.strokeStyle=Ce(t,e.stroke,i),t.lineWidth=l,t.lineJoin=e.join??"round",t.lineCap=e.cap??"butt",e.dash&&t.setLineDash(e.dash.map(d=>d*o));const c=e.pxAlign??0,f=l%2/2;c===1&&f>0&&t.translate(f,f),t.stroke(n.stroke)}t.restore()}const Kn=Nn(),ke=64;class qn{constructor(){j(this,"ctx",null);j(this,"pxRatio",1);j(this,"pathCache",new Map);j(this,"bandCache",new Map);j(this,"scaleStamp","");j(this,"snapshotCanvas",null);j(this,"snapshotValid",!1)}setContext(e,n){this.ctx=e,this.pxRatio=n}saveSnapshot(e,n,o){const s=e.canvas;(this.snapshotCanvas==null||this.snapshotCanvas.width!==n||this.snapshotCanvas.height!==o)&&(this.snapshotCanvas=typeof OffscreenCanvas<"u"?new OffscreenCanvas(n,o):document.createElement("canvas"),this.snapshotCanvas.width=n,this.snapshotCanvas.height=o);const r=this.snapshotCanvas.getContext("2d");r!=null&&typeof r.drawImage=="function"&&(r.clearRect(0,0,n,o),r.drawImage(s,0,0),this.snapshotValid=!0)}restoreSnapshot(e){return!this.snapshotValid||this.snapshotCanvas==null||typeof e.drawImage!="function"?!1:(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.drawImage(this.snapshotCanvas,0,0),!0)}invalidateSnapshot(){this.snapshotValid=!1}checkScaleStamp(e){let n="";const o=new Set;for(const s of e)for(const r of[s.xScale,s.yScale])o.has(r.id)||(o.add(r.id),n+=`${r.id}:${r.min}:${r.max};`);n!==this.scaleStamp&&(this.scaleStamp!==""&&this.clearCache(),this.scaleStamp=n)}cacheKey(e,n,o,s){return`${e}:${n}:${o}:${s}`}promote(e,n){this.pathCache.delete(e),this.pathCache.set(e,n)}getCachedPaths(e,n,o,s){const r=this.cacheKey(e,n,o,s),i=this.pathCache.get(r);if(i!=null)return this.promote(r,i),i;const l=`${e}:${n}:`;for(const[c,f]of this.pathCache){if(!c.startsWith(l))continue;const a=c.slice(l.length),d=a.indexOf(":"),u=+a.slice(0,d),h=+a.slice(d+1);if(u<=o&&h>=s)return this.promote(c,f),f}}setCachedPaths(e,n,o,s,r){if(this.pathCache.size>=ke){const l=ke>>2,c=this.pathCache.keys();for(let f=0;f<l;f++){const a=c.next().value;a!=null&&this.pathCache.delete(a)}}const i=this.cacheKey(e,n,o,s);this.pathCache.delete(i),this.pathCache.set(i,r)}invalidateSeries(e,n){const o=`${e}:${n}:`;for(const s of this.pathCache.keys())s.startsWith(o)&&this.pathCache.delete(s)}clearGroupCache(e){const n=`${e}:`;for(const o of this.pathCache.keys())o.startsWith(n)&&this.pathCache.delete(o);for(const o of this.bandCache.keys())o.startsWith(n)&&this.bandCache.delete(o);this.invalidateSnapshot()}clearCache(){this.pathCache.clear(),this.bandCache.clear(),this.invalidateSnapshot()}bandKey(e,n,o,s,r){return`${e}:${n}:${o}:${s}:${r}`}getCachedBandPath(e,n,o,s,r){return this.bandCache.get(this.bandKey(e,n,o,s,r))}setCachedBandPath(e,n,o,s,r,i){this.bandCache.set(this.bandKey(e,n,o,s,r),i)}drawSeries(e,n,o){const s=this.ctx;if(s==null||e.config.show===!1)return;const r=e.config.group,i=e.config.index,[l,c]=e.window;let f=this.getCachedPaths(r,i,l,c);if(f==null){const a=e.config.paths??Kn,d=e.xScale.dir,u=kn(e.config.pxAlign??0),h=c-l,p=Math.max(1,Math.ceil(h*.1)),w=e.dataX.length,x=Math.max(0,l-p),g=Math.min(w-1,c+p),S=e.config.fillTo;let C;typeof S=="function"?C=S(e.yScale.min??0,e.yScale.max??0):S===0&&e.yScale.distr===K.Log?C=1:C=S,f=a(e.dataX,e.dataY,e.xScale,e.yScale,n.width,n.height,n.left,n.top,x,g,d,u,{fillTo:C,spanGaps:e.config.spanGaps}),this.setCachedPaths(r,i,x,g,f)}On(s,e.config,f,o,n)}draw(e,n,o,s){const r=this.ctx;if(r==null)return;const i=this.pxRatio;r.clearRect(0,0,e*i,n*i),r.save(),r.scale(i,i),r.beginPath(),r.rect(o.left,o.top,o.width,o.height),r.clip();for(const l of s)this.drawSeries(l,o,1);r.restore()}}const on=[1,2,2.5,5],Zn=qe(10,-32,0,on),Jn=qe(10,0,32,on),dt=Zn.concat(Jn);function Qn(t,e,n,o,s){if(n<=0||e<t)return[];const r=[],i=Ct.get(n)??0,l=s?Math.ceil(t/n)*n:it(se(t,n),i);for(let c=l;c<=e;c=it(c+n,i))r.push(Object.is(c,-0)?0:c);return r}function Nt(t){return t.map(e=>Ze(e))}function to(t,e,n){if(t<=0||e<=0||t>=e)return[];const o=[],r=st((n===10?nt:kt)(t));let i=pt(n,r);n===10&&(i=dt[ft(i,dt)]??i);let l=i,c=i*n;n===10&&(c=dt[ft(c,dt)]??c);let f=0;do{if(l>=t&&o.push(l),l=l+i,n===10&&!Ct.has(l)){const a=Ct.get(i)??0;l=it(l,a)}l>=c*(1-1e-10)&&(i=l,c=i*n,n===10&&(c=dt[ft(c,dt)]??c))}while(l<=e&&++f<1e4);return o}function eo(t,e,n=1){const o=[];if(Math.max(et(t),et(e))===0)return[0];if(t<0){const i=et(t);let l=pt(10,st(nt(Math.max(i,n))));for(;l>=n;){const c=-l;c>=t&&c<=e&&o.push(c),l/=10}}if(t<=0&&e>=0&&o.push(0),e>0){let i=n;const l=e;for(;i<=l;)i>=t&&i<=e&&o.push(i),i*=10}o.sort((i,l)=>i-l);const r=[];for(const i of o){const l=r[r.length-1];(r.length===0||l!=null&&et(i-l)>1e-10)&&r.push(i)}return r}function no(t,e){const n=e===10?nt:kt;return t.map(o=>{if(o===0)return!0;if(o<0)return!1;const s=n(o);return et(s-Math.round(s))<1e-10})}const oo=7,so=50,io=16;function ro(t,e){const o=Ze(Math.max(Math.abs(t),Math.abs(e))).length*oo;return Math.max(so,o+io)}function lo(t,e,n,o){if(o<=0)return[0,0];const s=St(t.side)===H.Vertical,r=t.space??(s?30:ro(e,n)),i=t.incrs??dt;return Pn(e,n,i,o,r)}const co=50;function ao(t,e,n){var l,c;if(t.size!=null)return t.size;const o=((l=t.ticks)==null?void 0:l.show)!==!1?((c=t.ticks)==null?void 0:c.size)??10:0,s=t.gap??5,r=12;if(St(t.side)===H.Vertical&&e!=null){let f=0;for(const d of e)d.length>f&&(f=d.length);const a=f*7;return Math.max(50,o+s+a+4)}return Math.max(50,o+s+r+3)}function uo(t){return{config:t,_show:t.show!==!1,_size:t.size??co,_pos:0,_lpos:0,_splits:null,_values:null,_incr:0,_space:0,_rotate:0}}const fo=1,Mt=60,gt=3600,ut=86400,ho=604800,mt=2592e3,Lt=31536e3,go=[fo,5,10,15,30,Mt,5*Mt,10*Mt,15*Mt,30*Mt,gt,2*gt,3*gt,4*gt,6*gt,12*gt,ut,2*ut,3*ut,7*ut,14*ut,mt,2*mt,3*mt,6*mt,Lt];function po(t,e,n){const o=[];if(n<=0||t>=e)return o;let s;if(n>=Lt){const r=new Date(t*1e3);for(r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0),s=r.getTime()/1e3,s<t&&(r.setUTCFullYear(r.getUTCFullYear()+1),s=r.getTime()/1e3);s<=e;)o.push(s),r.setUTCFullYear(r.getUTCFullYear()+Math.round(n/Lt)),s=r.getTime()/1e3;return o}if(n>=mt){const r=new Date(t*1e3);r.setUTCDate(1),r.setUTCHours(0,0,0,0),s=r.getTime()/1e3;const i=Math.max(1,Math.round(n/mt));if(s<t&&(r.setUTCMonth(r.getUTCMonth()+1),s=r.getTime()/1e3),i>1){const l=r.getUTCMonth(),c=Math.ceil((l+1)/i)*i;r.setUTCMonth(c-1),s=r.getTime()/1e3}for(;s<=e;)o.push(s),r.setUTCMonth(r.getUTCMonth()+i),s=r.getTime()/1e3;return o}if(n>=ut){const r=new Date(t*1e3);r.setUTCHours(0,0,0,0),s=r.getTime()/1e3,s<t&&(s+=ut)}else s=Math.ceil(t/n)*n;for(let r=0;;r++){const i=s+r*n;if(i>e)break;o.push(i)}return o}const Te=new Map;function mo(t,e){const n=JSON.stringify(t)+(e??"");let o=Te.get(n);return o==null&&(o=new Intl.DateTimeFormat(void 0,{...t,timeZone:e}),Te.set(n,o)),o}function ot(t,e,n){const o=new Date(t*1e3);return mo(e,n).format(o)}function wo(t,e){return ot(t,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},e)}function So(t,e){return ot(t,{year:"numeric",month:"2-digit",day:"2-digit"},e)}function vo(t,e){return ot(t,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},e)}function bo(t,e){return ot(t,{hour:"2-digit",minute:"2-digit",hour12:!1},e)}function Mo(t,e){return ot(t,{month:"short",day:"numeric"},e)}function xo(t,e){return ot(t,{year:"numeric"},e)}function yo(t,e){return ot(t,{year:"numeric",month:"short"},e)}function Co(t,e,n){let o;return e>=Lt?o=xo:e>=mt?o=yo:e>=ho?o=So:e>=ut?o=Mo:e>=gt?o=bo:e>=Mt?o=vo:o=wo,t.map(s=>o(s,n))}function ko(t,e,n,o,s){const r=e-t;if(r<=0||o<=0)return[0,0];for(const l of n){const c=r/l,f=o/c;if(f>=s)return[l,f]}const i=n[n.length-1]??Lt;return[i,o/(r/i)]}const To=3;function Ao(t,e,n,o,s){let r=!0;for(const i of t){const l=i.config;if(l.show===!1)continue;const c=e(l.scale);if(!c||!N(c)){i._show&&(r=!1,i._show=!1);continue}else i._show||(r=!1,i._show=!0);const f=l.side,d=St(f)===H.Horizontal?n:o,u=c.min,h=c.max;let p,w;if(c.time){const g=l.space??80;[p,w]=ko(u,h,go,d,g)}else[p,w]=lo(l,u,h,d);if(c._discrete&&p>0&&p<1&&(p=1),i._incr=p,i._space=w,w===0)continue;if(l.splits)i._splits=l.splits(u,h,p,w);else if(c.time)i._splits=po(u,h,p);else if(c.distr===K.Log)i._splits=to(u,h,c.log);else if(c.distr===K.Asinh)i._splits=eo(u,h,c.asinh);else{const g=c.distr===K.Ordinal||c._discrete;i._splits=Qn(u,h,p,w,g)}if(l.values)i._values=l.values(i._splits,w,p);else if(c.time)i._values=Co(i._splits,p);else if(c.distr===K.Log){const g=no(i._splits,c.log),S=Nt(i._splits);i._values=S.map((C,M)=>g[M]?C:"")}else c.distr,K.Asinh,i._values=Nt(i._splits);i._rotate=f===Y.Bottom?l.rotate??0:0;const x=i._size;i._size=It(ao(l,i._values)),x!==i._size&&(r=!1)}return r}function Ae(t,e,n,o=0){let s=t,r=e-o,i=0,l=o;for(const f of n){if(!f._show)continue;const a=f.config.side,d=St(a)===H.Vertical,u=f.config.label!=null?f.config.labelSize??20:0,h=f._size+u;h>0&&(d?(s-=h,a===Y.Left&&(i+=h)):(r-=h,a===Y.Top&&(l+=h)))}return!n.some(f=>f._show&&f.config.side===Y.Top)&&l<=o&&(l+=8,r-=8),{left:i,top:l,width:Math.max(s,0),height:Math.max(r,0)}}function Io(t,e){let n=e.top,o=e.left+e.width,s=e.top+e.height,r=e.left;function i(l,c){switch(l){case Y.Top:return n-=c,n+c;case Y.Right:{const f=o;return o+=c,f}case Y.Bottom:{const f=s;return s+=c,f}case Y.Left:return r-=c,r+c;default:return 0}}for(const l of t){if(!l._show)continue;const c=l.config.side;if(l._pos=i(c,l._size),l.config.label!=null){const f=l.config.labelSize??20;l._lpos=i(c,f)}}}function Lo(t,e,n,o,s=0){for(const c of n)c._size=0;let r=!1,i=0,l={left:0,top:0,width:t,height:e};for(;!r;){i++;const c=Ao(n,o,l.width,l.height);r=i===To||c,r||(l=Ae(t,e,n,s))}return l=Ae(t,e,n,s),Io(n,l),l}const Ie="top",Le="bottom",Po="left",Eo="right";function Ut(t,e){return e===1?t:t.replace(/(\d+(?:\.\d+)?)px/,(n,o)=>`${Math.round(Number(o)*e)}px`)}function Pe(t,e,n,o,s,r,i,l,c,f,a){const d=l%2/2;t.save(),t.translate(d,d),t.strokeStyle=c,t.lineWidth=l,f.length>0&&t.setLineDash(f),t.beginPath();let u=0,h=0,p=0,w=0;const x=r+(s===Y.Top||s===Y.Left?-i:i);o===H.Horizontal?(h=r,w=x):(u=r,p=x);for(let g=0;g<e.length;g++)n[g]!=null&&(o===H.Horizontal?u=p=e[g]??0:h=w=e[g]??0,t.moveTo(u,h),t.lineTo(p,w));t.stroke(),t.restore()}function _o(t,e,n,o,s,r){const i=B(o.left*s),l=B(o.top*s),c=B(o.width*s),f=B(o.height*s);for(const a of e){if(!a._show)continue;const d=a.config,u=d.side,h=St(u),p=n(d.scale);if(!p||!N(p))continue;const w=d.stroke??"#000",x=u===Y.Top||u===Y.Left?-1:1,g=a._splits,S=a._values;if(!g||!S||a._space===0)continue;const C=h===H.Horizontal?o.width:o.height,M=h===H.Horizontal?o.left:o.top,P=g.map(L=>B(X(L,p,C,M)*s)),A=S.map(L=>L===""?null:L),k=d.grid;if((k==null?void 0:k.show)!==!1){const L=(k==null?void 0:k.stroke)??"rgba(0,0,0,0.12)",m=B(((k==null?void 0:k.width)??2)*s),b=((k==null?void 0:k.dash)??[]).map(_=>_*s),v=h===H.Horizontal?l:i,y=h===H.Horizontal?f:c;Pe(t,P,A,h,2,v,y,m,L,b)}const T=d.ticks;if((T==null?void 0:T.show)!==!1){const L=(T==null?void 0:T.stroke)??w,m=B(((T==null?void 0:T.width)??1)*s),b=B(((T==null?void 0:T.size)??10)*s),v=((T==null?void 0:T.dash)??[]).map(_=>_*s),y=B(a._pos*s);Pe(t,P,A,h,u,y,b,m,L,v)}{const L=(T==null?void 0:T.show)!==!1?((T==null?void 0:T.size)??10)*s:0,m=B((d.gap??5)*s),b=B(a._pos*s),v=(L+m)*x,y=b+v,_=Ut(d.font??"12px system-ui, sans-serif",s),E=h===H.Horizontal?"center":u===Y.Left?Eo:Po,R=h===H.Horizontal?u===Y.Bottom?Ie:Le:"middle";t.font=_,t.fillStyle=w,t.textAlign=E,t.textBaseline=R;const z=a._rotate*-Xt/180;if(z!==0){const F=Math.cos(z),$=Math.sin(z);for(let G=0;G<S.length;G++){const V=S[G];if(V==null||V==="")continue;const U=P[G]??0;t.setTransform(F,$,-$,F,U,y),t.fillText(V,0,0)}t.setTransform(1,0,0,1,0,0)}else for(let F=0;F<S.length;F++){const $=S[F];if($==null||$==="")continue;const G=P[F]??0,V=h===H.Horizontal?G:y,U=h===H.Horizontal?y:G;t.fillText($,V,U)}}if(d.label!=null){const L=Ut(d.labelFont??"bold 12px system-ui, sans-serif",s);t.font=L,t.fillStyle=w,t.textAlign="center",t.textBaseline=u===Y.Bottom?Ie:Le;const m=B((a._lpos+(d.labelGap??0)*x)*s);h===H.Vertical?(t.save(),t.translate(m,B(l+f/2)),t.rotate((u===Y.Left?-Xt:Xt)/2),t.fillText(d.label,0,0),t.restore()):t.fillText(d.label,B(i+c/2),m)}const I=d.border;if((I==null?void 0:I.show)!==!1&&I!=null){const L=I.stroke??w,m=B((I.width??1)*s),b=(I.dash??[]).map(y=>y*s),v=B(a._pos*s);t.strokeStyle=L,t.lineWidth=m,b.length>0&&t.setLineDash(b),t.beginPath(),h===H.Horizontal?(t.moveTo(i,v),t.lineTo(i+c,v)):(t.moveTo(v,l),t.lineTo(v,l+f)),t.stroke(),b.length>0&&t.setLineDash([])}}if(r!=null){const a=Ut("bold 14px system-ui, sans-serif",s);t.font=a,t.fillStyle="#000",t.textAlign="center",t.textBaseline="top",t.fillText(r,B(i+c/2),B(4*s))}}const Do=2,Fo="#fff",Ro={stroke:"#607D8B",width:1,dash:[5,3],pointRadius:4,showX:!0,showY:!0};function Ee(t,e,n,o,s,r,i,l,c,f){var M;if(e.left<0||e.top<0)return;const a={...Ro,...c},d=o,u=B(n.left*d),h=B(n.top*d),p=B(n.width*d),w=B(n.height*d),x=B(a.width*d),g=x%2/2,S=B((n.left+e.left)*d)+g,C=B((n.top+e.top)*d)+g;if(t.save(),t.strokeStyle=a.stroke,t.lineWidth=x,t.setLineDash(a.dash.map(P=>P*d)),a.showX&&(t.beginPath(),t.moveTo(S,h),t.lineTo(S,h+w),t.stroke()),a.showY&&(t.beginPath(),t.moveTo(u,C),t.lineTo(u+p,C),t.stroke()),t.setLineDash([]),e.activeGroup>=0&&e.activeDataIdx>=0){const P=e.activeGroup,A=e.activeSeriesIdx,k=e.activeDataIdx,T=s[P];if(T!=null&&A>=0&&A<T.series.length&&k<T.x.length){const I=T.x[k],L=T.series[A],m=L!=null?L[k]:null;if(I!=null&&m!=null){let b=a.stroke,v=!0;const y=f==null?void 0:f.get(`${P}:${A}`);if(y!=null){const _=y.stroke;b=(typeof _=="string"?_:void 0)??a.stroke,v=((M=y.cursor)==null?void 0:M.show)!==!1}if(v){const _=l(P),E=_!=null?i(_):void 0,R=(y==null?void 0:y.yScale)??zo(r,P,A),z=R!=null?i(R):void 0;if(E!=null&&z!=null&&N(E)&&N(z)){const F=B(X(I,E,n.width,n.left)*d),$=B(X(m,z,n.height,n.top)*d),G=a.pointRadius*d,V=B(Do*d);t.beginPath(),t.arc(F,$,G,0,Math.PI*2),t.fillStyle=Fo,t.fill(),t.strokeStyle=b,t.lineWidth=V,t.stroke()}}}}}t.restore()}function zo(t,e,n){for(const o of t)if(o.group===e&&o.index===n)return o.yScale}const Ho={fill:"rgba(0,0,0,0.07)",stroke:"rgba(0,0,0,0.15)",width:1};function _e(t,e,n,o,s){if(!e.show||e.width<=0)return;const r={...Ho,...s},i=o,l=B((n.left+e.left)*i),c=B((n.top+e.top)*i),f=B(e.width*i),a=B(e.height*i);t.save(),t.fillStyle=r.fill,t.fillRect(l,c,f,a),r.width>0&&(t.strokeStyle=r.stroke,t.lineWidth=B(r.width*i),t.strokeRect(l,c,f,a)),t.restore()}function Wo(t,e,n,o,s,r,i,l,c,f,a,d){const u=a/2*i,h=Math.max(1,B(a*.2))*i,p=(f==null?void 0:f.stroke)??d,w=(f==null?void 0:f.fill)??"#fff";t.save(),t.strokeStyle=p,t.fillStyle=w,t.lineWidth=h,(f==null?void 0:f.dash)!=null&&t.setLineDash(f.dash.map(x=>x*i));for(let x=l;x<=c;x++){const g=n[x];if(g==null)continue;const S=e[x];if(S==null)continue;const C=B(X(S,o,r.width,r.left)*i),M=B(X(g,s,r.height,r.top)*i);t.beginPath(),t.arc(C,M,u,0,Math.PI*2),t.fill(),t.stroke()}t.restore()}function $o(t,e,n,o,s,r,i){if(typeof t=="function")return t(e,n,o,s,r);if(t===!0)return!0;if(t===!1)return!1;const l=s-o;return l>0&&l<=r/i}function Go(t,e,n,o,s,r,i,l,c){if(l>c||l<0||!Me(e,l,c)&&!Me(n,l,c))return null;const f=h=>X(h,o,r.width,r.left)*i,a=h=>X(h,s,r.height,r.top)*i,d=new Path2D;let u=!1;for(let h=l;h<=c;h++){const p=e[h],w=t[h];if(p==null||w==null)continue;const x=f(w),g=a(p);u?d.lineTo(x,g):(d.moveTo(x,g),u=!0)}if(!u)return null;for(let h=c;h>=l;h--){const p=n[h],w=t[h];p==null||w==null||d.lineTo(f(w),a(p))}return d.closePath(),d}function Vo(t,e,n){t.save(),t.fillStyle=e.fill??"rgba(0, 120, 255, 0.1)",t.fill(n),t.restore()}function Bo(t){const e=t.dataStore.data;if(e.length===0)return;if(!t.scaleManager.getScale("x")){const i={id:"x",auto:!0};t.scaleConfigs.push(i),t.scaleManager.addScale(i)}for(let i=0;i<e.length;i++)t.scaleManager.getGroupXScaleKey(i)||t.scaleManager.setGroupXScale(i,"x");const n=new Set(t.scaleConfigs.map(i=>i.id)),o=new Set;for(const i of t.seriesConfigs)o.add(i.yScale);o.size===0&&!n.has("y")&&o.add("y");for(const i of o)if(!n.has(i)){const l={id:i,auto:!0};t.scaleConfigs.push(l),t.scaleManager.addScale(l),n.add(i)}t.axisConfigs.some(i=>i.scale==="x")||t.axisConfigs.push({scale:"x",side:Y.Bottom,show:!0,label:t.xlabel??"X Axis"});const r=new Set(t.axisConfigs.map(i=>i.scale));for(const i of o)r.has(i)||(t.axisConfigs.push({scale:i,side:Y.Left,show:!0,label:t.ylabel??"Y Axis"}),r.add(i))}function Ot(t,e,n,o){return{ctx:t,plotBox:e,pxRatio:n,getScale:o,valToX:(i,l="x")=>{const c=o(l);return c==null||!N(c)?null:X(i,c,e.width,e.left)},valToY:(i,l)=>{const c=o(l);return c==null||!N(c)?null:X(i,c,e.height,e.top)}}}const Xo={left:-10,top:-10,activeGroup:-1,activeSeriesIdx:-1,activeDataIdx:-1,plotLeft:0,plotTop:0,plotWidth:0,plotHeight:0,seriesCount:0,revision:-1};function De(t){const{left:e,top:n,activeGroup:o,activeSeriesIdx:s,activeDataIdx:r}=t.cursorManager.state,{left:i,top:l,width:c,height:f}=t.plotBox,a=t.seriesConfigs.length,{revision:d}=t,u=t.snapshot;u.left===e&&u.top===n&&u.activeGroup===o&&u.activeSeriesIdx===s&&u.activeDataIdx===r&&u.plotLeft===i&&u.plotTop===l&&u.plotWidth===c&&u.plotHeight===f&&u.seriesCount===a&&u.revision===d||(t.snapshot={left:e,top:n,activeGroup:o,activeSeriesIdx:s,activeDataIdx:r,plotLeft:i,plotTop:l,plotWidth:c,plotHeight:f,seriesCount:a,revision:d})}function Kt(t){t.seriesConfigMap.clear();for(const e of t.seriesConfigs)t.seriesConfigMap.set(`${e.group}:${e.index}`,e)}function jo(){const t={scaleManager:new Fn,dataStore:new Hn,renderer:new qn,cursorManager:new Wn,selectState:{show:!1,left:0,top:0,width:0,height:0},scaleConfigs:[],seriesConfigs:[],axisConfigs:[],bandConfigs:[],axisStates:[],width:0,height:0,pxRatio:typeof window<"u"&&window.devicePixelRatio||1,plotBox:{left:0,top:0,width:0,height:0},canvas:null,listeners:new Set,cursorListeners:new Set,scheduler:new $n,drawHooks:new Set,cursorDrawHooks:new Set,focusedSeries:null,focusAlpha:1,actionMap:new Map(Rt),title:void 0,xlabel:void 0,ylabel:void 0,snapshot:Xo,revision:0,eventCallbacks:{},_prevScaleRanges:new Map,seriesConfigMap:new Map,registerScale(e){t.scaleConfigs=t.scaleConfigs.filter(n=>n.id!==e.id),t.scaleConfigs.push(e),t.scaleManager.addScale(e)},unregisterScale(e){t.scaleConfigs=t.scaleConfigs.filter(n=>n.id!==e),t.scaleManager.removeScale(e)},registerSeries(e){t.seriesConfigs=t.seriesConfigs.filter(n=>!(n.group===e.group&&n.index===e.index)),t.seriesConfigs.push(e),Kt(t),t.renderer.clearGroupCache(e.group)},unregisterSeries(e,n){t.seriesConfigs=t.seriesConfigs.filter(o=>!(o.group===e&&o.index===n)),Kt(t),t.renderer.clearGroupCache(e)},toggleSeries(e,n){const o=t.seriesConfigMap.get(`${e}:${n}`);o!=null&&(o.show=o.show===!1,t.revision++,t.cursorManager.invalidateGroupedConfigs(),t.renderer.invalidateSeries(e,n),t.renderer.invalidateSnapshot(),t.scheduleRedraw())},setFocus(e){t.focusedSeries=e,t.scheduleRedraw()},setSize(e,n){t.width===e&&t.height===n||(t.width=e,t.height=n,t.canvas&&(t.canvas.width=e*t.pxRatio,t.canvas.height=n*t.pxRatio,t.canvas.style.width=`${e}px`,t.canvas.style.height=`${n}px`),t.renderer.clearCache())},scheduleRedraw(){t.scheduler.mark(tt.Full)},scheduleCursorRedraw(){t.scheduler.mark(tt.Cursor)},subscribe(e){return t.listeners.add(e),()=>{t.listeners.delete(e)}},subscribeCursor(e){return t.cursorListeners.add(e),()=>{t.cursorListeners.delete(e)}},redraw(){const{scaleManager:e,dataStore:n,renderer:o,seriesConfigs:s,width:r,height:i,pxRatio:l,canvas:c,scheduler:f}=t;if(c==null||r===0||i===0)return;const a=c.getContext("2d");if(a==null)return;o.setContext(a,l);const u=(f.dirty&~(tt.Cursor|tt.Select))===0,h=g=>e.getScale(g);if(u&&o.restoreSnapshot(a)){if(Ee(a,t.cursorManager.state,t.plotBox,l,n.data,s,h,g=>e.getGroupXScaleKey(g),void 0,t.seriesConfigMap),_e(a,t.selectState,t.plotBox,l),t.cursorDrawHooks.size>0){a.save(),a.scale(l,l);const g=Ot(a,t.plotBox,l,h);for(const S of t.cursorDrawHooks)try{S(g,t.cursorManager.state)}catch(C){console.warn("[uPlot+] draw hook error:",C)}a.restore()}De(t);for(const g of t.cursorListeners)g();return}Bo(t),e.autoRangeX(n.data),n.updateWindows(g=>{const S=e.getGroupXScaleKey(g);return S!=null?e.getScale(S):void 0});const p=s.map(g=>({group:g.group,index:g.index,yScale:g.yScale}));if(e.autoRange(n.data,p,n),Yo(t),t.axisStates.length>0){const g=t.title!=null?20:0;t.plotBox=Lo(r,i,t.axisStates,h,g)}else t.plotBox={left:10,top:10,width:r-20,height:i-20};a.clearRect(0,0,r*l,i*l),t.axisStates.length>0&&_o(a,t.axisStates,h,t.plotBox,l,t.title);const w=[];for(const g of s){const S=e.getGroupXScaleKey(g.group),C=S!=null?e.getScale(S):void 0,M=e.getScale(g.yScale);C==null||M==null||w.push({config:g,dataX:n.getXValues(g.group),dataY:n.getYValues(g.group,g.index),xScale:C,yScale:M,window:n.getWindow(g.group)})}o.checkScaleStamp(w),a.save(),a.scale(l,l),a.beginPath(),a.rect(t.plotBox.left,t.plotBox.top,t.plotBox.width,t.plotBox.height),a.clip();for(let g=0;g<w.length;g++){const S=w[g];S!=null&&(t.focusedSeries!=null&&g!==t.focusedSeries?(a.globalAlpha=t.focusAlpha,o.drawSeries(S,t.plotBox,1),a.globalAlpha=1):o.drawSeries(S,t.plotBox,1))}const x=new Map;for(const g of s)x.set(`${g.group}-${g.index}`,g);for(const g of t.bandConfigs){const S=e.getGroupXScaleKey(g.group),C=S!=null?e.getScale(S):void 0,M=x.get(`${g.group}-${g.series[0]}`),P=x.get(`${g.group}-${g.series[1]}`);if(C==null||M==null||P==null)continue;const A=e.getScale(M.yScale);if(A==null)continue;const[k,T]=n.getWindow(g.group),I=g.series[0],L=g.series[1];let m=o.getCachedBandPath(g.group,I,L,k,T);m==null&&(m=Go(n.getXValues(g.group),n.getYValues(g.group,I),n.getYValues(g.group,L),C,A,t.plotBox,l,k,T)??void 0,m!=null&&o.setCachedBandPath(g.group,I,L,k,T,m)),m!=null&&Vo(a,g,m)}for(const g of w){const S=g.config;if(S.show===!1)continue;const C=S.points,M=S.width??1,P=(C==null?void 0:C.size)??3+M*2,A=(C==null?void 0:C.space)??P*2,[k,T]=g.window;$o(C==null?void 0:C.show,S.group,S.index,k,T,t.plotBox.width,A)&&Wo(a,g.dataX,g.dataY,g.xScale,g.yScale,t.plotBox,l,k,T,C,P,(typeof S.stroke=="string"?S.stroke:null)??"#000")}if(a.restore(),t.drawHooks.size>0){a.save(),a.beginPath(),a.rect(t.plotBox.left*l,t.plotBox.top*l,t.plotBox.width*l,t.plotBox.height*l),a.clip(),a.scale(l,l);const g=Ot(a,t.plotBox,l,h);for(const S of t.drawHooks)try{S(g)}catch(C){console.warn("[uPlot+] draw hook error:",C)}a.restore()}if(t.cursorManager.state.left>=0&&(o.saveSnapshot(a,r*l,i*l),t.cursorManager.update(t.cursorManager.state.left,t.cursorManager.state.top,t.plotBox,n.data,s,h,g=>n.getWindow(g),g=>e.getGroupXScaleKey(g))),Ee(a,t.cursorManager.state,t.plotBox,l,n.data,s,h,g=>e.getGroupXScaleKey(g),void 0,t.seriesConfigMap),_e(a,t.selectState,t.plotBox,l),t.cursorDrawHooks.size>0){a.save(),a.scale(l,l);const g=Ot(a,t.plotBox,l,h);for(const S of t.cursorDrawHooks)try{S(g,t.cursorManager.state)}catch(C){console.warn("[uPlot+] draw hook error:",C)}a.restore()}De(t);for(const g of t.listeners)g();for(const g of t.cursorListeners)g();if(t._prevScaleRanges.size>0&&t.eventCallbacks.onScaleChange!=null)for(const g of e.getAllScales()){if(!N(g))continue;const S=t._prevScaleRanges.get(g.id);if(S==null||S.min!==g.min||S.max!==g.max)try{t.eventCallbacks.onScaleChange(g.id,g.min,g.max)}catch(C){console.warn("[uPlot+] event callback error:",C)}}t._prevScaleRanges.clear();for(const g of e.getAllScales())N(g)&&t._prevScaleRanges.set(g.id,{min:g.min,max:g.max})},getSnapshot:()=>t.snapshot,updateScale(e){t.scaleConfigs=t.scaleConfigs.map(n=>n.id===e.id?e:n),t.scaleManager.addScale(e),t.renderer.clearCache()},updateSeries(e){t.seriesConfigs=t.seriesConfigs.map(n=>n.group===e.group&&n.index===e.index?e:n),Kt(t),t.renderer.invalidateSeries(e.group,e.index)},registerAxis(e){t.axisConfigs=t.axisConfigs.filter(n=>!(n.scale===e.scale&&n.side===e.side)),t.axisConfigs.push(e)},unregisterAxis(e,n){t.axisConfigs=t.axisConfigs.filter(o=>!(o.scale===e&&o.side===n))},updateAxis(e){t.axisConfigs=t.axisConfigs.map(n=>n.scale===e.scale&&n.side===e.side?e:n)},registerBand(e){t.bandConfigs.push(e)},unregisterBand(e){t.bandConfigs=t.bandConfigs.filter(n=>n!==e)},setData(e){t.dataStore.setData(e),t.renderer.clearCache()},setCanvas(e){t.canvas=e},setLabels(e,n,o){t.title=e,t.xlabel=n,t.ylabel=o},redrawSync(){t.scheduler.cancel(),t.scheduler.mark(tt.Full),t.redraw(),t.scheduler.clear()}};return t.scheduler.onRedraw(()=>t.redraw()),t}function Yo(t){const{axisConfigs:e,axisStates:n}=t,o=new Map;for(const s of n)o.set(`${s.config.scale}:${s.config.side}`,s);t.axisStates=e.map(s=>{const r=`${s.scale}:${s.side}`,i=o.get(r);return i!=null?(i.config=s,i):uo(s)})}function No(){const t=D.useRef(null);return t.current===null&&(t.current=jo()),t.current}const sn=D.createContext(null);function Q(){const t=D.useContext(sn);if(!t)throw new Error("useChart must be used within a <Chart> component");return t}function Uo(t="cursor"){const e=Q(),n=t==="full"?e.subscribe:e.subscribeCursor,o=D.useSyncExternalStore(n,e.getSnapshot);return{left:o.left,top:o.top,activeGroup:o.activeGroup,activeSeriesIdx:o.activeSeriesIdx,activeDataIdx:o.activeDataIdx,plotLeft:o.plotLeft,plotTop:o.plotTop,plotWidth:o.plotWidth,plotHeight:o.plotHeight,seriesCount:o.seriesCount,revision:o.revision,getScale:s=>e.scaleManager.getScale(s),getPlotBox:()=>e.plotBox,getSeriesConfigs:()=>e.seriesConfigs,getDataX:s=>e.dataStore.getXValues(s),getDataY:(s,r)=>e.dataStore.getYValues(s,r),toggleSeries:(s,r)=>e.toggleSeries(s,r),setFocus:s=>e.setFocus(s)}}const Fe=5,rn=.001,Oo=.1,Ko=10;function ce(t,e){const n=t.shiftKey?"shift":t.altKey?"alt":t.ctrlKey?"ctrl":"",o=t.button===1?"Middle":t.button===2?"Right":"Left";return n?`${n}${o}${e}`:`${o.toLowerCase()}${e}`}function qo(t){return ce(t,"Drag")}function Zo(t){return ce(t,"Click")}function Jo(t){return ce(t,"Dblclick")}function Qo(t){const e=t.shiftKey?"shift":t.altKey?"alt":t.ctrlKey?"ctrl":"";return e?`${e}Wheel`:"wheel"}function ts(t){const e=t.shiftKey?"shift":t.altKey?"alt":t.ctrlKey?"ctrl":"",n=t.key.length===1?t.key.toUpperCase():t.key;return e?`${e}Key${n}`:`key${n}`}function es(t,e,n,o,s=!0){const r=t.get(e);if(r!=null)return r;if(s){for(const[i,l]of t)if(typeof i=="function"&&i(n,o))return l}}function ns(t,e){const n=[];for(const o of t.scaleManager.getAllScales())N(o)&&(e!=null&&!e(o.ori)||n.push({id:o.id,ori:o.ori,startMin:o.min,startMax:o.max}));return n}function Tt(t){const e=t.eventCallbacks.onScaleChange;if(e!=null)for(const n of t.scaleManager.getAllScales()){if(!N(n))continue;const o=t._prevScaleRanges.get(n.id);(o==null||o.min!==n.min||o.max!==n.max)&&e(n.id,n.min,n.max)}}function qt(t,e,n,o){if(!(e instanceof WheelEvent))return;const s=Z(1-e.deltaY*rn,Oo,Ko),r=t.plotBox;for(const i of t.scaleManager.getAllScales()){if(!N(i)||!o(i.ori))continue;const l=i.ori===H.Horizontal,c=l?r.width:r.height,f=l?r.left:r.top,a=l?n.cx+r.left:n.cy+r.top,d=lt(a,i,c,f),u=d-(d-i.min)*s,h=d+(i.max-d)*s;i.min=Math.min(u,h),i.max=Math.max(u,h),i.auto=!1,rt(i)}t.scheduleRedraw(),Tt(t)}function Zt(t,e,n){const o={show:!1,left:0,top:0,width:0,height:0},s=e.cx,r=e.cy;return{onMove(i,l,c){const f=t.plotBox,a=Z(c.cx,0,f.width),d=Z(c.cy,0,f.height);o.show=!0,o.left=Math.min(s,a),o.top=Math.min(r,d),o.width=Math.abs(a-s),o.height=Math.abs(d-r),n(H.Vertical)||(o.top=0,o.height=f.height),n(H.Horizontal)||(o.left=0,o.width=f.width),t.selectState=o,t.scheduler.mark(tt.Cursor|tt.Select)},onEnd(i,l,c){const f=n(H.Horizontal)&&o.width>Fe,a=n(H.Vertical)&&o.height>Fe;if(f||a){let d=!0;if(t.eventCallbacks.onSelect!=null){const u=is(t,o);let h;try{h=t.eventCallbacks.onSelect(u)}catch(p){console.warn("[uPlot+] event callback error:",p)}h===!1&&(d=!1)}d&&(os(t,o,n),Tt(t))}o.show=!1,o.left=0,o.width=0,t.selectState=o,t.scheduleRedraw()}}}function os(t,e,n){const o=t.plotBox;for(const s of t.scaleManager.getAllScales()){if(!N(s)||!n(s.ori))continue;const r=s.ori===H.Horizontal,i=r?o.width:o.height,l=r?o.left:o.top,c=r?e.left:e.top,f=r?e.width:e.height,a=c/i,d=(c+f)/i,u=lt(l+a*i,s,i,l),h=lt(l+d*i,s,i,l);s.min=Math.min(u,h),s.max=Math.max(u,h),s.auto=!1,rt(s)}}function Jt(t,e,n,o){const s=ns(t,n),r=e.clientX,i=e.clientY;return{onMove(l,c){const f=t.plotBox,a=c;for(const d of s){const u=t.scaleManager.getScale(d.id);if(u==null)continue;const h=d.ori===H.Horizontal,p=h?f.width:f.height,w=h?a.clientX-r:a.clientY-i,x=h?-1:1,g=d.startMax-d.startMin;u.min=d.startMin+x*(w/p)*g,u.max=d.startMax+x*(w/p)*g,u.auto=!1,rt(u)}t.renderer.clearCache(),t.scheduleRedraw()},onEnd(){Tt(t)}}}function Re(t,e,n){var a;if(n.scaleId==null||n.ori==null)return;const o=t.scaleManager.getScale(n.scaleId);if(o==null||!N(o))return;const s=n.ori===H.Vertical,r=(a=e.target.closest("div"))==null?void 0:a.getBoundingClientRect();if(r==null)return;const i=s?e.clientY-r.top:e.clientX-r.left,l=o.min,c=o.max,f=n.scaleId;return{onMove(d,u){var A;const h=t.plotBox,p=u,w=(A=p.target.closest("div"))==null?void 0:A.getBoundingClientRect();if(w==null)return;const x=s?h.height:h.width,S=((s?p.clientY-w.top:p.clientX-w.left)-i)/x,C=s?1:-1,M=c-l,P=t.scaleManager.getScale(f);P!=null&&(P.min=l+C*S*M,P.max=c+C*S*M,P.auto=!1,rt(P),t.renderer.clearCache(),t.scheduleRedraw())},onEnd(){Tt(t)}}}function Qt(t,e,n){if(!(e instanceof WheelEvent))return;const o=e.deltaY*rn*10;for(const s of t.scaleManager.getAllScales()){if(!N(s)||!n(s.ori))continue;const r=s.max-s.min;s.min+=o*r,s.max+=o*r,s.auto=!1,rt(s)}t.renderer.clearCache(),t.scheduleRedraw(),Tt(t)}const _t=t=>t===H.Horizontal,Dt=t=>t===H.Vertical,Ft=()=>!0;function ss(t){switch(t){case"zoomX":return(e,n,o)=>{if(n instanceof WheelEvent){qt(e,n,o,_t);return}return Zt(e,o,_t)};case"zoomY":return(e,n,o)=>{if(n instanceof WheelEvent){qt(e,n,o,Dt);return}return Zt(e,o,Dt)};case"zoomXY":return(e,n,o)=>{if(n instanceof WheelEvent){qt(e,n,o,Ft);return}return Zt(e,o,Ft)};case"panX":return(e,n,o)=>{if(n instanceof WheelEvent){Qt(e,n,_t);return}return o.scaleId!=null?Re(e,n,o):Jt(e,n,_t)};case"panY":return(e,n,o)=>{if(n instanceof WheelEvent){Qt(e,n,Dt);return}return o.scaleId!=null?Re(e,n,o):Jt(e,n,Dt)};case"panXY":return(e,n,o)=>{if(n instanceof WheelEvent){Qt(e,n,Ft);return}return Jt(e,n,Ft)};case"reset":return e=>{for(const n of e.scaleConfigs)e.scaleManager.addScale(n);e.renderer.clearCache(),e.scheduleRedraw()};case"none":return()=>{};default:return}}function ze(t){return typeof t=="function"?t:ss(t)}function is(t,e){const n=t.plotBox,o=e.left/n.width,s=(e.left+e.width)/n.width,r={};for(const i of t.scaleManager.getAllScales()){if(i.ori!==H.Horizontal||!N(i))continue;const l=lt(n.left+o*n.width,i,n.width,n.left),c=lt(n.left+s*n.width,i,n.width,n.left);r[i.id]={min:Math.min(l,c),max:Math.max(l,c)}}return{left:o,right:s,ranges:r}}function rs(t,e){D.useEffect(()=>{if(e!=null)return ls(t,e)},[t,e])}function ls(t,e){let n=null,o=!1,s=null,r=-1,i=-1;function l(m){const b=e.getBoundingClientRect(),v=t.plotBox;return{cx:m.clientX-b.left-v.left,cy:m.clientY-b.top-v.top}}function c(m,b){const v=t.plotBox;return m>=0&&m<=v.width&&b>=0&&b<=v.height}function f(m,b){const v=e.getBoundingClientRect(),y=m-v.left,_=b-v.top,E=t.plotBox;for(const R of t.axisStates){const z=R.config,F=z.side;if(R._size<=0)continue;const G=_>=E.top&&_<=E.top+E.height,V=y>=E.left&&y<=E.left+E.width;if(F===Y.Left&&y<E.left&&G||F===Y.Right&&y>E.left+E.width&&G||F===Y.Top&&_<E.top&&V||F===Y.Bottom&&_>E.top+E.height&&V)return{scaleId:z.scale,ori:St(F)}}return null}function a(m){const{cx:b,cy:v}=l(m);return{cx:b,cy:v,inPlot:c(b,v)}}function d(m,b,v){const y=t.cursorManager.state;let _=null;if(y.activeGroup>=0&&y.activeDataIdx>=0){const E=t.dataStore.data[y.activeGroup];if(E!=null){const R=E.x[y.activeDataIdx],z=E.series[y.activeSeriesIdx],F=z!=null?z[y.activeDataIdx]:void 0;if(R!=null&&F!=null){const $=t.plotBox,G=t.scaleManager.getGroupXScaleKey(y.activeGroup),V=G!=null?t.scaleManager.getScale(G):void 0,U=t.seriesConfigMap.get(`${y.activeGroup}:${y.activeSeriesIdx}`),vt=U!=null?t.scaleManager.getScale(U.yScale):void 0;let bt=b,Bt=v;V!=null&&N(V)&&(bt=X(R,V,$.width,$.left)-$.left),vt!=null&&N(vt)&&(Bt=X(F,vt,$.height,$.top)-$.top);const Se=b-bt,ve=v-Bt;_={group:y.activeGroup,seriesIdx:y.activeSeriesIdx,dataIdx:y.activeDataIdx,xVal:R,yVal:F,pxX:bt,pxY:Bt,dist:Math.sqrt(Se*Se+ve*ve)}}}}return{plotX:b,plotY:v,point:_,srcEvent:m}}function u(m,b,v,y=!0){const _=es(t.actionMap,m,b,v,y);if(!(_==null||_==="none"))return ze(_)}function h(m,b){const{cx:v,cy:y}=l(m);if(!c(v,y)&&n==null){r=-1,i=-1,t.cursorManager.hide(),t.focusedSeries!=null&&t.setFocus(null),t.scheduleCursorRedraw();return}const _=v!==r||y!==i;if(r=v,i=y,t.cursorManager.update(v,y,t.plotBox,t.dataStore.data,t.seriesConfigs,E=>t.scaleManager.getScale(E),E=>t.dataStore.getWindow(E),E=>t.scaleManager.getGroupXScaleKey(E)),_){const E={cx:v,cy:y,inPlot:c(v,y)},R=t.actionMap.get("hover");if(R!=null&&R!=="none"){const z=ze(R);if(z!=null&&z(t,b??m,E),t.focusAlpha<1){const F=t.cursorManager.state;if(F.activeGroup>=0&&F.activeSeriesIdx>=0){const $=t.seriesConfigs.findIndex(G=>G.group===F.activeGroup&&G.index===F.activeSeriesIdx);$>=0&&t.focusedSeries!==$&&(t.focusedSeries=$,t.scheduleRedraw())}}}}if(b!=null&&t.eventCallbacks.onCursorMove!=null&&c(v,y))try{t.eventCallbacks.onCursorMove(d(b,v,y))}catch(E){console.warn("[uPlot+] event callback error:",E)}t.scheduleCursorRedraw()}function p(){document.activeElement!==e&&e.focus()}function w(m){const b=a(m),v=f(m.clientX,m.clientY);let y;if(v!=null&&m.button===0)y=v.ori===H.Horizontal?"xGutterDrag":"yGutterDrag",b.scaleId=v.scaleId,b.ori=v.ori;else if(y=qo(m),!b.inPlot)return;b.action=y;const _=u(y,m,b,!1);if(_==null)return;(m.button!==0||v!=null)&&m.preventDefault();const E=_(t,m,b);E!=null&&(n=E,o=!1)}function x(m){if(n!=null){o=!0,n.onMove(t,m,a(m)),h(m,m);return}h(m,m)}function g(m){if(n!=null){n.onEnd(t,m,a(m)),n=null;return}}function S(m){if(o){o=!1;return}const b=a(m);if(!b.inPlot)return;const v=Zo(m);b.action=v;const y=u(v,m,b);y!=null&&y(t,m,b);const _=t.eventCallbacks.onClick;if(_!=null)try{_(d(m,b.cx,b.cy))}catch(E){console.warn("[uPlot+] event callback error:",E)}}function C(m){if(n!=null){m.preventDefault();return}const b=a(m);if(!b.inPlot)return;m.preventDefault(),b.action="rightClick";const v=u("rightClick",m,b);v!=null&&v(t,m,b);const y=t.eventCallbacks.onContextMenu;if(y!=null)try{y(d(m,b.cx,b.cy))}catch(_){console.warn("[uPlot+] event callback error:",_)}}function M(m){var b,v;r=-1,i=-1,t.cursorManager.hide(),t.focusedSeries!=null&&t.setFocus(null),n!=null&&(n=null),t.scheduleCursorRedraw();try{(v=(b=t.eventCallbacks).onCursorLeave)==null||v.call(b)}catch(y){console.warn("[uPlot+] event callback error:",y)}}function P(m){const b=a(m);if(!b.inPlot)return;if(t.eventCallbacks.onDblClick!=null){let _;try{_=t.eventCallbacks.onDblClick(d(m,b.cx,b.cy))}catch(E){console.warn("[uPlot+] event callback error:",E)}if(_===!1)return}const v=Jo(m);b.action=v;const y=u(v,m,b,!1);y!=null&&y(t,m,b)}function A(m){const b=a(m);if(!b.inPlot)return;const v=Qo(m);b.action=v;const y=u(v,m,b);y!=null&&(m.preventDefault(),y(t,m,b))}function k(m){if(m.touches.length===2){const E=m.touches[0],R=m.touches[1],z=R.clientX-E.clientX,F=R.clientY-E.clientY;s={dist:Math.sqrt(z*z+F*F),midX:(E.clientX+R.clientX)/2,midY:(E.clientY+R.clientY)/2},n=null;return}const b=m.touches[0];if(b==null)return;const v=a(b);if(!v.inPlot)return;const y=u("touchDrag",m,v);if(y==null)return;const _=y(t,m,v);_!=null&&(n=_,o=!1)}function T(m){if(m.touches.length===2&&s!=null){m.preventDefault();const v=m.touches[0],y=m.touches[1],_=y.clientX-v.clientX,E=y.clientY-v.clientY,R=Math.sqrt(_*_+E*E),z=a({clientX:s.midX,clientY:s.midY});if(u("pinch",m,z)!=null){const $=R/s.dist,G=t.plotBox;for(const V of t.scaleManager.getAllScales()){if(V.ori!==H.Horizontal||!N(V))continue;const U=lt(z.cx+G.left,V,G.width,G.left),vt=U-(U-V.min)/$,bt=U+(V.max-U)/$;V.min=Math.min(vt,bt),V.max=Math.max(vt,bt),V.auto=!1,rt(V)}s.dist=R,t.renderer.clearCache(),t.scheduleRedraw(),Tt(t)}return}const b=m.touches[0];if(b!=null){if(n!=null){o=!0,n.onMove(t,m,a(b)),h(b,m),m.preventDefault();return}h(b,m)}}function I(m){if(s!=null){s=null;return}const b=m.changedTouches[0];b!=null&&n!=null&&(n.onEnd(t,m,a(b)),n=null)}function L(m){const b={cx:r,cy:i,inPlot:r>=0&&i>=0},v=ts(m);b.action=v;const y=u(v,m,b);y!=null&&(m.preventDefault(),y(t,m,b))}return e.addEventListener("mouseenter",p),e.addEventListener("mousemove",x),e.addEventListener("mousedown",w),e.addEventListener("mouseup",g),e.addEventListener("click",S),e.addEventListener("contextmenu",C),e.addEventListener("mouseleave",M),e.addEventListener("dblclick",P),e.addEventListener("wheel",A,{passive:!1}),e.addEventListener("touchstart",k,{passive:!0}),e.addEventListener("touchmove",T,{passive:!1}),e.addEventListener("touchend",I),e.addEventListener("keydown",L),()=>{e.removeEventListener("mouseenter",p),e.removeEventListener("mousemove",x),e.removeEventListener("mousedown",w),e.removeEventListener("mouseup",g),e.removeEventListener("click",S),e.removeEventListener("contextmenu",C),e.removeEventListener("mouseleave",M),e.removeEventListener("dblclick",P),e.removeEventListener("wheel",A),e.removeEventListener("touchstart",k),e.removeEventListener("touchmove",T),e.removeEventListener("touchend",I),e.removeEventListener("keydown",L)}}const ee=new Map;function cs(t){let e=ee.get(t);return e==null&&(e=new as(t),ee.set(t,e)),e}class as{constructor(e){j(this,"key");j(this,"members",new Set);j(this,"publishing",!1);j(this,"syncedStores",new WeakSet);this.key=e}join(e){this.members.add(e)}leave(e){this.members.delete(e),this.members.size===0&&ee.delete(this.key)}pub(e){if(this.publishing)return;if(this.syncedStores.has(e)){this.syncedStores.delete(e);return}this.publishing=!0;const n=e.cursorManager.state,{activeGroup:o,activeDataIdx:s}=n;if(o<0||s<0){for(const l of this.members)l!==e&&(this.syncedStores.add(l),l.cursorManager.hide(),l.scheduleCursorRedraw());this.publishing=!1;return}const i=e.dataStore.getXValues(o)[s];if(i==null){this.publishing=!1;return}for(const l of this.members)l!==e&&(this.syncedStores.add(l),l.cursorManager.syncToValue(i,l),l.scheduleCursorRedraw());this.publishing=!1}}function us(t,e){D.useEffect(()=>{if(e==null)return;const n=cs(e);n.join(t);let o=-1,s=-1;const r=t.subscribeCursor(()=>{const{activeGroup:i,activeDataIdx:l}=t.cursorManager.state;i===o&&l===s||(o=i,s=l,n.pub(t))});return()=>{r(),n.leave(t)}},[t,e])}function ln(t){return t instanceof Float64Array?t:new Float64Array(t)}function cn(t){return t instanceof Float64Array||t.some(e=>e==null)?t:new Float64Array(t)}function He(t){return{x:ln(t.x),series:[cn(t.y)]}}function fs(t){return{x:ln(t.x),series:t.series.map(cn)}}function ne(t){if(!Array.isArray(t))return[He(t)];if(t.length===0)return[];const e=t[0];return e==null?[]:"series"in e?t.map(fs):t.map(He)}function ae({width:t,height:e,data:n,children:o,className:s,pxRatio:r,title:i,xlabel:l,ylabel:c,onDraw:f,onCursorDraw:a,syncKey:d,actions:u,onClick:h,onContextMenu:p,onDblClick:w,onCursorMove:x,onCursorLeave:g,onScaleChange:S,onSelect:C}){const M=No(),[P,A]=D.useState(null),k=r??(typeof window<"u"&&window.devicePixelRatio||1);D.useEffect(()=>{M.actionMap=u!=null?new Map([...Rt,...u]):new Map(Rt)},[M,u]),D.useEffect(()=>{M.setLabels(i,l,c)},[M,i,l,c]);const T=M.eventCallbacks;T.onClick=h,T.onContextMenu=p,T.onDblClick=w,T.onCursorMove=x,T.onCursorLeave=g,T.onScaleChange=S,T.onSelect=C,rs(M,P),us(M,d);const I=D.useRef(null),L=F=>{I.current!==F&&(I.current=F,M.setCanvas(F),F&&M.scheduleRedraw())},m=D.useRef(null),b=F=>{m.current!==F&&(m.current=F,A(F))};D.useLayoutEffect(()=>{M.pxRatio=k,M.setSize(t,e),M.redrawSync()},[M,t,e,k]),D.useEffect(()=>()=>{M.setCanvas(null),M.scheduler.cancel(),M.focusedSeries=null,M.eventCallbacks={}},[M]),D.useEffect(()=>{if(P==null||typeof ResizeObserver>"u")return;const F=new ResizeObserver($=>{const G=$[0];if(G==null)return;const{width:V,height:U}=G.contentRect;V>0&&U>0&&(V!==M.width||U!==M.height)&&(M.setSize(Math.round(V),Math.round(U)),M.scheduleRedraw())});return F.observe(P),()=>{F.disconnect()}},[M,P]);const v=D.useRef(void 0),y=D.useRef(ne(n));n!==v.current&&(v.current=n,y.current=ne(n));const _=y.current,E=D.useRef(n);D.useEffect(()=>{n===E.current&&M.dataStore.data.length>0||(E.current=n,M.setData(_),M.scheduleRedraw())},[M,n,_]);const R=D.useRef(f);R.current=f,D.useEffect(()=>{const F=$=>{var G;(G=R.current)==null||G.call(R,$)};return M.drawHooks.add(F),()=>{M.drawHooks.delete(F)}},[M]);const z=D.useRef(a);return z.current=a,D.useEffect(()=>{const F=($,G)=>{var V;(V=z.current)==null||V.call(z,$,G)};return M.cursorDrawHooks.add(F),()=>{M.cursorDrawHooks.delete(F)}},[M]),W.jsx(sn.Provider,{value:M,children:W.jsxs("div",{className:s,style:{position:"relative",display:"flex",flexDirection:"column",width:`${t}px`},children:[W.jsx("div",{ref:b,tabIndex:-1,style:{position:"relative",width:`${t}px`,height:`${e}px`,cursor:"crosshair",outline:"none",order:0},children:W.jsx("canvas",{ref:L,style:{position:"absolute",left:0,top:0}})}),o]})})}function We(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}function hs(t,e){const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const s of o)if(t[s]!==e[s])return!1;return!0}function ds(t,e){if(t===null)return!1;const n=t,o=e,s=Object.keys(n),r=Object.keys(o);if(s.length!==r.length)return!1;for(const i of r){const l=n[i],c=o[i];if(l!==c)if(We(l)&&We(c)){if(!hs(l,c))return!1}else return!1}return!0}function ue(t,e,n,o,s){const r=Q(),i=D.useRef(t);i.current=t,D.useEffect(()=>{const c=i.current;return n(r,c),r.scheduleRedraw(),()=>{o(r,c),r.scheduleRedraw()}},[r,...e]);const l=D.useRef(null);D.useEffect(()=>{ds(l.current,t)||(l.current=t,s(r,t),r.scheduleRedraw())})}function gs(t){return ue(t,[t.id],(e,n)=>e.registerScale(n),(e,n)=>e.unregisterScale(n.id),(e,n)=>e.updateScale(n)),null}function ps(t,e,n){e/=100,n/=100;const o=(1-Math.abs(2*n-1))*e,s=o*(1-Math.abs(t/60%2-1)),r=n-o/2;let i=0,l=0,c=0;return t<60?(i=o,l=s):t<120?(i=s,l=o):t<180?(l=o,c=s):t<240?(l=s,c=o):t<300?(i=s,c=o):(i=o,c=s),[Math.round((i+r)*255),Math.round((l+r)*255),Math.round((c+r)*255)]}function an(t){const e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);if(e)return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)];const n=/^#([0-9a-f])([0-9a-f])([0-9a-f])/i.exec(t);if(n)return[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];const o=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(t);if(o)return[Number(o[1]),Number(o[2]),Number(o[3])];const s=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%/i.exec(t);return s?ps(Number(s[1]),Number(s[2]),Number(s[3])):null}function ms(t,e=.8,n=0){const o=an(t);if(o==null)return{type:"linear",stops:[[0,t],[1,t]]};const[s,r,i]=o;return{type:"linear",stops:[[0,`rgba(${s},${r},${i},${e})`],[1,`rgba(${s},${r},${i},${n})`]]}}function un(t,e){const n=an(t);if(n==null)return t;const[o,s,r]=n;return`rgba(${o},${s},${r},${e})`}function ws(t,e=65,n=50){const o=[];for(let r=0;r<t;r++){const i=r*137.508%360;o.push(`hsl(${i.toFixed(1)},${e}%,${n}%)`)}return o}const $e=["#e74c3c","#3498db","#2ecc71","#f39c12","#9b59b6","#1abc9c","#e67e22","#34495e","#16a085","#c0392b","#2980b9","#27ae60","#f1c40f","#8e44ad","#d35400"];function Ge(t,e){var i;const n=(i=t.paths)==null?void 0:i.defaults,o=t.stroke??$e[e%$e.length]??"#000",s=t.fill??(n==null?void 0:n.fill),r=s==="auto"&&typeof o=="string"?un(o,.5):s==="auto"?void 0:s;return{...n,...t,yScale:t.yScale??"y",show:t.show??!0,stroke:o,fill:r}}function fe(t){return ue(t,[t.group,t.index],(e,n)=>e.registerSeries(Ge(n,e.seriesConfigs.length)),(e,n)=>e.unregisterSeries(n.group,n.index),(e,n)=>{const o=e.seriesConfigs.findIndex(s=>s.group===n.group&&s.index===n.index);e.updateSeries(Ge(n,o>=0?o:e.seriesConfigs.length))}),null}function Ss(t){return{...t,side:t.side??(t.scale==="x"?Y.Bottom:Y.Left),show:t.show??!0}}function Pt(t){const e=Ss(t);return ue(e,[e.scale,e.side],(n,o)=>n.registerAxis(o),(n,o)=>n.unregisterAxis(o.scale,o.side),(n,o)=>n.updateAxis(o)),null}function vs({series:t,group:e,fill:n,dir:o}){const s=Q(),r=D.useRef(null),i=t[0],l=t[1];return D.useEffect(()=>{const c={series:[i,l],group:e,fill:n,dir:o};return r.current!=null&&s.unregisterBand(r.current),r.current=c,s.registerBand(c),s.scheduleRedraw(),()=>{r.current!=null&&s.unregisterBand(r.current),r.current=null,s.scheduleRedraw()}},[s,i,l,e,n,o]),null}const bs={width:12,height:3,borderRadius:1,display:"inline-block"},Ms={fontWeight:600},fn={display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",cursor:"pointer",fontSize:12,fontFamily:"sans-serif"},xs={...fn,opacity:1},ys={...fn,opacity:.4},Ve=new Map,Cs={display:"flex",flexWrap:"wrap",justifyContent:"center",order:-1,padding:"4px 0"},ks={display:"flex",flexWrap:"wrap",justifyContent:"center",order:1,padding:"4px 0"};function Ts({group:t,index:e,label:n,color:o,isHidden:s,valueStr:r,store:i}){let l=Ve.get(o);return l==null&&(l={...bs,backgroundColor:o},Ve.set(o,l)),W.jsxs("span",{onClick:()=>i.toggleSeries(t,e),style:s?ys:xs,children:[W.jsx("span",{style:l}),W.jsx("span",{children:n}),r&&W.jsx("span",{style:Ms,children:r})]})}function As({show:t=!0,position:e="bottom",className:n}){const o=Q(),s=D.useSyncExternalStore(o.subscribeCursor,o.getSnapshot);if(!t)return null;const{activeGroup:r,activeDataIdx:i}=s;return W.jsx("div",{className:n,style:e==="top"?Cs:ks,children:o.seriesConfigs.map(l=>{if(l.legend===!1)return null;const c=typeof l.stroke=="string"?l.stroke:"#000";let f="";if(i>=0&&r>=0&&l.group===r){const d=o.dataStore.getYValues(l.group,l.index)[i];d!=null&&(f=typeof d=="number"?d.toPrecision(4):String(d))}return W.jsx(Ts,{group:l.group,index:l.index,label:l.label??`Series ${l.index}`,color:c,isHidden:l.show===!1,valueStr:f,store:o},`${l.group}:${l.index}`)})})}const Is={position:"absolute",zIndex:50,background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:4,padding:"4px 6px",fontSize:12,fontFamily:"sans-serif",userSelect:"none",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",whiteSpace:"nowrap"},Ls={width:12,height:3,borderRadius:1,display:"inline-block",flexShrink:0},Ps={fontWeight:600},Vt={display:"flex",alignItems:"center",gap:4,padding:"1px 4px"},Es={...Vt,opacity:1,cursor:"pointer"},_s={...Vt,opacity:1,cursor:"default"},Ds={...Vt,opacity:.4,cursor:"pointer"},Fs={...Vt,opacity:.4,cursor:"default"},Be=new Map;function Rs(t){let e=Be.get(t);return e==null&&(e={...Ls,backgroundColor:t},Be.set(t,e)),e}function he({label:t,color:e,value:n,isHidden:o,onClick:s}){const r=o?s?Ds:Fs:s?Es:_s;return W.jsxs("div",{onClick:s,style:r,children:[W.jsx("span",{style:Rs(e)}),W.jsx("span",{children:t}),n&&W.jsx("span",{style:Ps,children:n})]})}const zt=D.forwardRef(function({left:e,top:n,children:o,className:s,style:r,onMouseDown:i,onMouseEnter:l,onMouseLeave:c},f){return W.jsx("div",{ref:f,className:s,onMouseDown:i,onMouseEnter:l,onMouseLeave:c,style:{...Is,left:e,top:n,...r},children:o})});function zs(t,e,n,o,s){if(s<0||o<0)return"";const i=t.dataStore.getYValues(e,n)[s];return i==null?"":typeof i=="number"?i.toPrecision(4):String(i)}const Hs={},Ws={pointerEvents:"none",zIndex:100},$s={fontWeight:600,marginBottom:2,padding:"0 4px"};function Gs({show:t=!0,className:e,children:n,offset:o=Hs}){var I,L;const s=Q(),r=D.useSyncExternalStore(s.subscribeCursor,s.getSnapshot),i=D.useRef(null);if(!t||r.activeDataIdx<0||r.activeGroup<0||r.left<0)return null;const{activeGroup:l,activeDataIdx:c}=r,f=s.plotBox,a=s.dataStore.data[l],d=a!=null?a.x[c]??null:null,u=d!=null?parseFloat(d.toPrecision(6)).toString():"",h=[];for(const m of s.seriesConfigs){if(m.show===!1||m.legend===!1)continue;const b=s.dataStore.getYValues(m.group,m.index),v=m.group===l?b[c]:null;h.push({label:m.label??`Series ${m.index}`,value:v,color:typeof m.stroke=="string"?m.stroke:"#000",group:m.group,index:m.index})}const p={x:d,xLabel:u,items:h,left:r.left+f.left,top:r.top+f.top},w=o.x??12,x=o.y??-12,g=((I=i.current)==null?void 0:I.offsetWidth)??0,S=((L=i.current)==null?void 0:L.offsetHeight)??0,C=r.left+f.left,M=r.top+f.top,P=f.left+f.width,A=f.top+f.height,k=Z(C+w,f.left,P-g),T=Z(M+x,f.top,A-S);return n?W.jsx("div",{ref:i,className:e,style:{position:"absolute",left:k,top:T,whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},children:n(p)}):W.jsxs(zt,{ref:i,left:k,top:T,className:e,style:Ws,children:[W.jsx("div",{style:$s,children:u}),h.map(m=>W.jsx(he,{label:m.label,color:m.color,value:m.value!=null?m.value.toPrecision(4):"—"},`${m.group}:${m.index}`))]})}const Vs=8,Xe=.01,Bs=[.25,.75];function Xs({width:t,height:e,data:n,onRangeChange:o,initialRange:s,className:r,colors:i,grips:l=!1}){const c=D.useRef(null),f=D.useMemo(()=>ne(n),[n]),[a,d]=D.useState(()=>{if(s!=null&&f.length>0){const A=f[0];if(A!=null&&A.x.length>1){const k=A.x[0],I=A.x[A.x.length-1]-k;if(I>0)return[Math.max(0,(s[0]-k)/I),Math.min(1,(s[1]-k)/I)]}}return Bs}),u=D.useRef(null);D.useEffect(()=>{if(o==null||f.length===0)return;const A=f[0];if(A==null||A.x.length<2)return;const k=A.x[0],I=A.x[A.x.length-1]-k,L=k+a[0]*I,m=k+a[1]*I,b=u.current,v=Math.max(1e-10,Math.abs(m-L)*1e-12);b!=null&&Math.abs(b[0]-L)<v&&Math.abs(b[1]-m)<v||(u.current=[L,m],o(L,m))},[a,f,o]);const h=D.useRef(null),p=D.useCallback(A=>{const k=c.current;if(k==null)return 0;const T=k.getBoundingClientRect();return Z((A-T.left)/T.width,0,1)},[]),w=D.useCallback(A=>{const k=c.current;if(k==null)return;const T=p(A.clientX),I=k.getBoundingClientRect().width,L=I>0?Vs/I:0;let m;if(Math.abs(T-a[0])<L)m="left";else if(Math.abs(T-a[1])<L)m="right";else if(T>=a[0]&&T<=a[1])m="move";else{const b=a[1]-a[0],v=b/2,y=Z(T-v,0,1-b);d([y,y+b]),m="move"}h.current={mode:m,startX:A.clientX,startFrac:[...a]},k.setPointerCapture(A.pointerId),A.preventDefault()},[a,p]),x=D.useCallback(A=>{const k=h.current;if(k==null)return;const T=p(A.clientX),I=p(k.startX),L=T-I;if(k.mode==="move"){const m=k.startFrac[1]-k.startFrac[0],b=Z(k.startFrac[0]+L,0,1-m);d([b,b+m])}else if(k.mode==="left"){const m=Z(k.startFrac[0]+L,0,k.startFrac[1]-Xe);d([m,k.startFrac[1]])}else{const m=Z(k.startFrac[1]+L,k.startFrac[0]+Xe,1);d([k.startFrac[0],m])}},[p]),g=D.useCallback(A=>{h.current=null;const k=c.current;k!=null&&k.releasePointerCapture(A.pointerId)},[]),S=`${a[0]*100}%`,C=`${(a[1]-a[0])*100}%`,M=f[0],P=M!=null?M.series.length:0;return W.jsxs("div",{className:r,style:{position:"relative",width:t,height:e},children:[W.jsxs(ae,{width:t,height:e,data:n,children:[W.jsx(Pt,{scale:"x",show:!1}),W.jsx(Pt,{scale:"y",show:!1}),Array.from({length:P},(A,k)=>W.jsx(fe,{group:0,index:k,yScale:"y",stroke:i!=null&&i[k]!=null?i[k]:`hsl(${k*137}, 60%, 50%)`,width:1},`0:${k}`))]}),W.jsxs("div",{ref:c,onPointerDown:w,onPointerMove:x,onPointerUp:g,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:"default",touchAction:"none"},children:[W.jsx("div",{style:{position:"absolute",top:0,left:0,width:S,height:"100%",background:"rgba(0,0,0,0.3)",pointerEvents:"none"}}),W.jsx("div",{style:{position:"absolute",top:0,left:`${a[1]*100}%`,right:0,height:"100%",background:"rgba(0,0,0,0.3)",pointerEvents:"none"}}),W.jsx("div",{style:{position:"absolute",top:0,left:S,width:C,height:"100%",borderLeft:"2px solid rgba(0,100,255,0.8)",borderRight:"2px solid rgba(0,100,255,0.8)",boxSizing:"border-box",cursor:"grab",pointerEvents:"none"},children:l&&W.jsxs(W.Fragment,{children:[W.jsx("div",{style:{position:"absolute",left:-5,top:"50%",transform:"translateY(-50%)",width:8,height:24,borderRadius:3,background:"rgba(0,100,255,0.8)",cursor:"ew-resize",pointerEvents:"auto"}}),W.jsx("div",{style:{position:"absolute",right:-5,top:"50%",transform:"translateY(-50%)",width:8,height:24,borderRadius:3,background:"rgba(0,100,255,0.8)",cursor:"ew-resize",pointerEvents:"auto"}})]})})]})]})}function ht(t){const e=Q(),n=D.useRef(t);n.current=t,D.useEffect(()=>{const o=s=>n.current(s);return e.drawHooks.add(o),()=>{e.drawHooks.delete(o)}},[e])}function js(t){const e=Q(),n=D.useRef(t);n.current=t,D.useEffect(()=>{const o=(s,r)=>n.current(s,r);return e.cursorDrawHooks.add(o),()=>{e.cursorDrawHooks.delete(o)}},[e])}function Ys({lanes:t,laneHeight:e=24,gap:n=2,scaleId:o="x"}){const s=Q();return ht(({ctx:r,plotBox:i,pxRatio:l})=>{const c=s.scaleManager.getScale(o);if(c==null||!N(c))return;r.save(),r.beginPath(),r.rect(i.left*l,i.top*l,i.width*l,i.height*l),r.clip();const f=(e+n)*l,a=e*l,d=i.top*l;for(let u=0;u<t.length;u++){const h=t[u];if(h==null)continue;const p=d+u*f;r.fillStyle="#666",r.font=`${11*l}px sans-serif`,r.textAlign="right",r.textBaseline="middle",r.fillText(h.label,(i.left-6)*l,p+a/2);for(const w of h.segments){const x=X(w.start,c,i.width,i.left)*l,S=X(w.end,c,i.width,i.left)*l-x;S<=0||(r.fillStyle=w.color??"#4dabf7",r.fillRect(x,p,S,a),w.label!=null&&S>20*l&&(r.fillStyle="#fff",r.font=`${10*l}px sans-serif`,r.textAlign="center",r.textBaseline="middle",r.fillText(w.label,x+S/2,p+a/2,S-4*l)))}}r.restore()}),null}function Ns({data:t,width:e=150,height:n=30,stroke:o="#03a9f4",fill:s,lineWidth:r=1,paths:i,fillTo:l,className:c}){return W.jsx("div",{style:{pointerEvents:"none"},className:c,children:W.jsxs(ae,{width:e,height:n,data:t,children:[W.jsx(Pt,{scale:"x",show:!1}),W.jsx(Pt,{scale:"y",show:!1}),W.jsx(fe,{group:0,index:0,yScale:"y",stroke:o,fill:s,width:r,paths:i,fillTo:l})]})})}const at=8,Us={x:12,y:-12},Os={pointerEvents:"none"};function Ks(t,e,n,o){if(t!=null&&typeof t=="object")return t;switch(t){case"top-left":return{x:e.left+at,y:e.top+at};case"bottom-left":return{x:e.left+at,y:e.top+e.height-o-at};case"bottom-right":return{x:e.left+e.width-n-at,y:e.top+e.height-o-at};case"top-right":default:return{x:e.left+e.width-n-at,y:e.top+at}}}function qs({mode:t="draggable",position:e="top-right",offset:n=Us,idleOpacity:o=.3,show:s=!0,className:r}){var m,b;const i=Q(),l=D.useSyncExternalStore(i.subscribeCursor,i.getSnapshot),[c,f]=D.useState(null),[a,d]=D.useState(!1),[u,h]=D.useState(!1),p=D.useRef(!1),w=D.useRef(!1),x=D.useRef({dx:0,dy:0}),[g,S]=D.useState(!1),C=D.useRef(null);D.useLayoutEffect(()=>{if(t!=="draggable"||g||l.plotWidth<=0)return;S(!0);const v=C.current,y=(v==null?void 0:v.offsetWidth)??0,_=(v==null?void 0:v.offsetHeight)??0;f(Ks(e,i.plotBox,y,_))},[t,g,l.plotWidth,e,i.plotBox]);const M=(v,y)=>{w.current||i.toggleSeries(v,y)},P=v=>{if(t!=="draggable")return;v.stopPropagation(),v.preventDefault(),p.current=!0,h(!0),w.current=!1;const y=v.currentTarget.getBoundingClientRect();x.current={dx:v.clientX-y.left,dy:v.clientY-y.top}};if(D.useEffect(()=>{if(!s||t!=="draggable")return;const v=_=>{var z;if(!p.current)return;w.current=!0;const E=(z=i.canvas)==null?void 0:z.parentElement;if(!E)return;const R=E.getBoundingClientRect();f({x:_.clientX-R.left-x.current.dx,y:_.clientY-R.top-x.current.dy})},y=()=>{p.current=!1,h(!1)};return window.addEventListener("mousemove",v),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",y)}},[i,s,t]),!s)return null;const{activeGroup:A,activeDataIdx:k,left:T,top:I}=l,L=i.seriesConfigs.filter(v=>v.legend!==!1).map(v=>{const y=typeof v.stroke=="string"?v.stroke:"#000",_=zs(i,v.group,v.index,A,k),E=t==="draggable";return W.jsx(he,{label:v.label??`Series ${v.index}`,color:y,value:_,isHidden:v.show===!1,onClick:E?()=>M(v.group,v.index):void 0},`${v.group}:${v.index}`)});if(t==="cursor"){if(T<0)return null;const v=((m=C.current)==null?void 0:m.offsetWidth)??0,y=((b=C.current)==null?void 0:b.offsetHeight)??0,_=l.plotLeft+l.plotWidth,E=l.plotTop+l.plotHeight,R=Z(T+l.plotLeft+n.x,l.plotLeft,_-v),z=Z(I+l.plotTop+n.y,l.plotTop,E-y);return W.jsx(zt,{ref:C,left:R,top:z,className:r,style:Os,children:L})}return c==null?null:W.jsx(zt,{ref:C,left:c.x,top:c.y,className:r,onMouseDown:P,onMouseEnter:()=>d(!0),onMouseLeave:()=>{d(!1),w.current=!1},style:{pointerEvents:"auto",cursor:u?"grabbing":"grab",opacity:a||u?1:o,transition:"opacity 0.2s ease"},children:L})}const Zs={pointerEvents:"none"};function Js({delay:t=1e3,show:e=!0,className:n}){var S,C;const o=Q(),s=D.useSyncExternalStore(o.subscribe,o.getSnapshot),[r,i]=D.useState(!1),l=D.useRef(-1),c=D.useRef(0),f=D.useRef(null);if(D.useEffect(()=>{const M=s.activeSeriesIdx;M!==l.current&&(l.current=M,i(!1),window.clearTimeout(c.current),M>=0&&(c.current=window.setTimeout(()=>i(!0),t)))},[s.activeSeriesIdx,t]),D.useEffect(()=>()=>{window.clearTimeout(c.current)},[]),!e||!r||s.left<0)return null;const a=o.seriesConfigs.find(M=>M.group===s.activeGroup&&M.index===s.activeSeriesIdx);if(!(a!=null&&a.label)||a.legend===!1)return null;const d=typeof a.stroke=="string"?a.stroke:"#000",u=((S=f.current)==null?void 0:S.offsetWidth)??80,h=((C=f.current)==null?void 0:C.offsetHeight)??24,p=s.left+s.plotLeft,w=s.top+s.plotTop,x=Z(p-u/2,s.plotLeft,s.plotLeft+s.plotWidth-u),g=Z(w-h-12,s.plotTop,s.plotTop+s.plotHeight-h);return W.jsx(zt,{ref:f,left:x,top:g,className:n,style:Zs,children:W.jsx(he,{label:a.label,color:d})})}function hn(t,e,n,o,s,r,i,l,c){const f=i/2;if(c.wickColor!=null&&(t.strokeStyle=c.wickColor,t.lineWidth=c.wickWidth??1,t.beginPath(),t.moveTo(e,n),t.lineTo(e,o),t.stroke()),c.capWidth!=null&&c.capWidth>0){const u=c.capWidth/2;t.strokeStyle=c.wickColor??"#555",t.lineWidth=c.wickWidth??1,t.beginPath(),t.moveTo(e-u,n),t.lineTo(e+u,n),t.moveTo(e-u,o),t.lineTo(e+u,o),t.stroke()}const a=Math.min(s,r),d=Math.abs(r-s);t.fillStyle=c.bodyFill,t.fillRect(e-f,a,i,d),c.bodyStroke!=null&&(t.strokeStyle=c.bodyStroke,t.lineWidth=c.bodyStrokeWidth??1.5,t.strokeRect(e-f,a,i,d)),l!=null&&c.midColor!=null&&(t.strokeStyle=c.midColor,t.lineWidth=c.midWidth??2.5,t.beginPath(),t.moveTo(e-f,l),t.lineTo(e+f,l),t.stroke())}function Qs({boxes:t,yScale:e="y",boxWidth:n=.5,fill:o="rgba(52, 152, 219, 0.4)",stroke:s="#2980b9",medianColor:r="#e74c3c",whiskerColor:i="#555"}){return ht(({ctx:l,plotBox:c,valToX:f,valToY:a})=>{const d=c.width/t.length*n,u=d*.3;for(let h=0;h<t.length;h++){const p=t[h];if(p==null)continue;const w=f(h+1),x=a(p.min,e),g=a(p.q1,e),S=a(p.median,e),C=a(p.q3,e),M=a(p.max,e);w==null||x==null||g==null||S==null||C==null||M==null||hn(l,w,x,M,g,C,d,S,{wickColor:i,bodyFill:o,bodyStroke:s,capWidth:u,midColor:r})}}),null}function ti(t){const e=Math.max(0,Math.min(1,t)),n=[[0,15,30,80],[.15,30,100,200],[.3,40,190,210],[.45,50,200,80],[.6,230,220,40],[.75,240,140,30],[.9,220,40,30],[1,120,10,10]];let o=n[0],s=n[n.length-1];for(let f=0;f<n.length-1;f++){const a=n[f],d=n[f+1];if(a!=null&&d!=null&&e>=a[0]&&e<=d[0]){o=a,s=d;break}}const r=s[0]===o[0]?0:(e-o[0])/(s[0]-o[0]),i=Math.round(o[1]+r*(s[1]-o[1])),l=Math.round(o[2]+r*(s[2]-o[2])),c=Math.round(o[3]+r*(s[3]-o[3]));return`rgb(${i},${l},${c})`}function ei({grid:t,xRange:e,yRange:n,colorMap:o=ti,yScale:s="y"}){return ht(({ctx:r,valToX:i,valToY:l})=>{var g;if(t.length===0)return;const c=t.length,f=((g=t[0])==null?void 0:g.length)??0;if(f===0)return;const a=(e==null?void 0:e[0])??0,d=(e==null?void 0:e[1])??c,u=(n==null?void 0:n[0])??0,h=(n==null?void 0:n[1])??f,p=(d-a)/c,w=(h-u)/f;let x=0;for(const S of t)for(const C of S)C>x&&(x=C);if(x!==0)for(let S=0;S<c;S++){const C=t[S];if(C==null)continue;const M=i(a+S*p),P=i(a+(S+1)*p);if(M==null||P==null)continue;const A=P-M;for(let k=0;k<f;k++){const T=C[k]??0,I=u+k*w,L=u+(k+1)*w,m=l(L,s),b=l(I,s);if(m==null||b==null)continue;const v=b-m;r.fillStyle=o(T/x),r.fillRect(M,m,A,v)}}}),null}function ni(t,e,n,o,s){const r=(o-90)*(Math.PI/180),i=s,l=i*.35,c=Math.PI/6,f=e+Math.cos(r)*i,a=n+Math.sin(r)*i,d=e-Math.cos(r)*i*.5,u=n-Math.sin(r)*i*.5;t.beginPath(),t.moveTo(d,u),t.lineTo(f,a),t.stroke(),t.beginPath(),t.moveTo(f,a),t.lineTo(f-l*Math.cos(r-c),a-l*Math.sin(r-c)),t.moveTo(f,a),t.lineTo(f-l*Math.cos(r+c),a-l*Math.sin(r+c)),t.stroke()}function oi({directions:t,group:e=0,index:n=0,color:o="#c0392b",minSize:s=4,maxSize:r=10}){const i=Q();return ht(({ctx:l,valToX:c,valToY:f})=>{var g;const a=i.dataStore.data[e];if(a==null)return;const d=a.x,u=a.series[n];if(u==null)return;let h=1/0,p=-1/0;for(let S=0;S<u.length;S++){const C=u[S];C!=null&&(C<h&&(h=C),C>p&&(p=C))}const w=p-h||1,x=((g=i.seriesConfigs.find(S=>S.group===e&&S.index===n))==null?void 0:g.yScale)??"y";l.strokeStyle=o,l.lineWidth=1.5,l.lineCap="round";for(let S=0;S<d.length;S++){const C=u[S],M=t[S];if(C==null||M==null)continue;const P=c(d[S]),A=f(C,x);if(P==null||A==null)continue;const k=(C-h)/w,T=s+k*(r-s);ni(l,P,A,M,T)}}),null}const si=4;function de(t,e){t.strokeStyle=e.stroke??"red",t.lineWidth=e.width??1,e.dash&&t.setLineDash(e.dash)}function ge(t,e){e.dash&&t.setLineDash([])}function dn(t,e,n,o={}){const{ctx:s,plotBox:r}=t,i=X(n,e,r.height,r.top);s.beginPath(),s.moveTo(r.left,i),s.lineTo(r.left+r.width,i),de(s,o),s.stroke(),ge(s,o)}function gn(t,e,n,o={}){const{ctx:s,plotBox:r}=t,i=X(n,e,r.width,r.left);s.beginPath(),s.moveTo(i,r.top),s.lineTo(i,r.top+r.height),de(s,o),s.stroke(),ge(s,o)}function ii(t,e,n,o,s,r,i={}){const{ctx:l,plotBox:c}=t,f=X(o,e,c.width,c.left),a=X(s,n,c.height,c.top);l.font=i.font??"12px sans-serif",l.fillStyle=i.fill??"#000",l.textBaseline="bottom",l.fillText(r,f,a-si)}function pn(t,e,n,o,s={}){const{ctx:r,plotBox:i}=t,l=X(o,e,i.height,i.top),c=X(n,e,i.height,i.top);r.fillStyle=s.fill??"rgba(255,0,0,0.1)",r.fillRect(i.left,Math.min(l,c),i.width,Math.abs(c-l)),s.stroke&&(de(r,s),r.strokeRect(i.left,Math.min(l,c),i.width,Math.abs(c-l)),ge(r,s))}function pe(t,e,n){const o=D.useRef(t);D.useLayoutEffect(()=>{o.current=t},[t]),ht(s=>{const r=s.getScale(e);r!=null&&n(s,r,o.current)})}function ri(t){return pe(t,t.yScale??"y",(e,n,o)=>{if(dn(e,n,o.value,{stroke:o.stroke,width:o.width,dash:o.dash}),o.label!=null){const s=e.valToY(o.value,o.yScale??"y");if(s==null)return;const{ctx:r,plotBox:i}=e;r.font=o.labelFont??"11px sans-serif",r.fillStyle=o.stroke??"red",r.textAlign="left",r.textBaseline="bottom",r.fillText(o.label,i.left+4,s-4)}}),null}function li(t){return pe(t,t.xScale??"x",(e,n,o)=>{if(gn(e,n,o.value,{stroke:o.stroke,width:o.width,dash:o.dash}),o.label!=null){const s=e.valToX(o.value,o.xScale??"x");if(s==null)return;const{ctx:r,plotBox:i}=e;r.font=o.labelFont??"11px sans-serif",r.fillStyle=o.stroke??"red",r.textAlign="center",r.textBaseline="bottom",r.fillText(o.label,s,i.top-4)}}),null}function ci(t){return pe(t,t.yScale??"y",(e,n,o)=>{pn(e,n,o.yMin,o.yMax,{fill:o.fill,stroke:o.stroke,width:o.strokeWidth,dash:o.dash})}),null}function ai(t){const e=D.useRef(t);return D.useLayoutEffect(()=>{e.current=t}),ht(n=>{const o=e.current,s=n.valToX(o.x,o.xScale??"x"),r=n.valToY(o.y,o.yScale??"y");if(s==null||r==null)return;const{ctx:i}=n;i.font=o.font??"12px sans-serif",i.fillStyle=o.fill??"#000",i.textAlign=o.align??"left",i.textBaseline=o.baseline??"bottom",i.fillText(o.text,s,r-4)}),null}function ui(t){const e=(n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w=(p==null?void 0:p.align)??t??1,x=(p==null?void 0:p.spanGaps)??!1;if([a,d]=Ht(o,a,d),a===-1)return{stroke:new Path2D,fill:null,clip:null,band:null,gaps:null};const g=L=>h(X(L,s,i,c)),S=L=>h(X(L,r,l,f)),C=s.ori===H.Horizontal?$t:Gt,M={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null},P=M.stroke;let A=!1;const k=u===O.Forward?a:d;let T=S(o[k]),I=g(n[k]);C(P,I,T);for(let L=k;L>=a&&L<=d;L+=u){const m=o[L];if(m==null){m===null&&!x&&(A=!0);continue}const b=g(n[L]),v=S(m);if(w===1)C(P,b,T);else if(w===-1)C(P,I,v);else{const y=h((I+b)/2);C(P,y,T),C(P,y,v)}C(P,b,v),T=v,I=b}{const L=M.fill=new Path2D(P),m=(p==null?void 0:p.fillTo)??r.min??0,b=S(m);let v=g(n[a]),y=g(n[d]);u===O.Backward&&([y,v]=[v,y]),C(L,y,b),C(L,v,b)}if(A){const L=ie(n,o,a,d,u,g);M.gaps=L,M.clip=re(L,s.ori,c,f,i,l)}return M};return e.defaults=Wt,e}function me(t){return t.defaults=Gn,t}function we(){return me((e,n,o,s,r,i,l,c,f,a,d,u,h)=>{const p=(h==null?void 0:h.barWidth)??.6,w=(h==null?void 0:h.barGap)??0,x=(h==null?void 0:h.barRadius)??0,g=(h==null?void 0:h.barGroupIdx)??0,S=(h==null?void 0:h.barGroupCount)??1,C=y=>u(X(y,o,r,l)),M=y=>u(X(y,s,i,c));let P=r;if(a>f){let y=1/0,_=-1;for(let E=f;E<=a;E++)if(n[E]!=null){if(_>=0){const R=e[E],z=e[_],F=Math.abs(C(R)-C(z));F<y&&(y=F)}_=E}y<1/0&&(P=y)}const A=P*(1-p),k=Math.max(0,A+w),T=Math.max(1,u(P-k)),I=S>1?Math.max(1,u(T/Math.max(1,S))):T,L=(h==null?void 0:h.fillTo)??s.min??0,m=M(L),b=new Path2D,v=o.ori===H.Horizontal;for(let y=d===O.Forward?f:a;y>=f&&y<=a;y+=d){const _=n[y];if(_==null)continue;const E=C(e[y]),R=M(_),z=S>1?(g-(S-1)/2)*I:0,F=u(E-I/2+z),$=Math.min(R,m),V=Math.max(R,m)-$;if(V!==0)if(x>0){const U=Math.min(x*I,V/2);di(b,v,F,$,I,V,U,_<L)}else v?b.rect(F,$,I,V):b.rect($,F,V,I)}return{stroke:b,fill:b,clip:null,band:null,gaps:null}})}function fi(t,e){const n=we();return me((s,r,i,l,c,f,a,d,u,h,p,w,x)=>{const g={...x,barGroupIdx:t,barGroupCount:e};return n(s,r,i,l,c,f,a,d,u,h,p,w,g)})}function hi(){const t=we();return me((n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w={barWidth:.8,...p};return t(n,o,s,r,i,l,c,f,a,d,u,h,w)})}function di(t,e,n,o,s,r,i,l){i=Math.min(i,s/2,r/2),e?l?(t.moveTo(n,o),t.lineTo(n+s,o),t.lineTo(n+s,o+r-i),t.arc(n+s-i,o+r-i,i,0,Math.PI/2),t.lineTo(n+i,o+r),t.arc(n+i,o+r-i,i,Math.PI/2,Math.PI),t.closePath()):(t.moveTo(n,o+r),t.lineTo(n,o+i),t.arc(n+i,o+i,i,Math.PI,Math.PI*1.5),t.lineTo(n+s-i,o),t.arc(n+s-i,o+i,i,Math.PI*1.5,0),t.lineTo(n+s,o+r),t.closePath()):l?(t.moveTo(o,n),t.lineTo(o,n+s),t.lineTo(o+r-i,n+s),t.arc(o+r-i,n+s-i,i,Math.PI/2,0,!0),t.lineTo(o+r,n+i),t.arc(o+r-i,n+i,i,0,-Math.PI/2,!0),t.closePath()):(t.moveTo(o+r,n),t.lineTo(o+i,n),t.arc(o+i,n+i,i,-Math.PI/2,Math.PI,!0),t.lineTo(o,n+s-i),t.arc(o+i,n+s-i,i,Math.PI,Math.PI/2,!0),t.lineTo(o+r,n+s),t.closePath())}function mn(t){const e=(n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w=(p==null?void 0:p.spanGaps)??!1;if([a,d]=Ht(o,a,d),a===-1)return{stroke:new Path2D,fill:null,clip:null,band:null,gaps:null};const x=I=>h(X(I,s,i,c)),g=I=>h(X(I,r,l,f)),S=s.ori===H.Horizontal?$t:Gt,C=[],M=[];let P=!1;for(let I=u===O.Forward?a:d;I>=a&&I<=d;I+=u){const L=o[I];L!=null?(C.push(x(n[I])),M.push(g(L))):L===null&&!w&&(P=!0)}const A=s.ori===H.Horizontal,k=t(C,M,A,h),T={stroke:k??new Path2D,fill:null,clip:null,band:null,gaps:null};if(k!=null){const I=T.fill=new Path2D(k),L=(p==null?void 0:p.fillTo)??r.min??0,m=g(L);let b=x(n[a]),v=x(n[d]);u===O.Backward&&([v,b]=[b,v]),S(I,v,m),S(I,b,m)}if(P){const I=ie(n,o,a,d,u,x);T.gaps=I,T.clip=re(I,s.ori,c,f,i,l)}return T};return e.defaults=Wt,e}function gi(){return mn(pi)}const pi=(t,e,n,o)=>{const s=t.length;if(s<2)return null;const r=new Path2D,i=t[0]??0,l=e[0]??0;if(n?r.moveTo(i,l):r.moveTo(l,i),s===2){const u=t[1]??0,h=e[1]??0;return n?r.lineTo(u,h):r.lineTo(h,u),r}const c=new Array(s),f=new Array(s-1),a=new Array(s-1),d=new Array(s-1);for(let u=0;u<s-1;u++)a[u]=(e[u+1]??0)-(e[u]??0),d[u]=(t[u+1]??0)-(t[u]??0),f[u]=d[u]!==0?(a[u]??0)/(d[u]??1):0;c[0]=f[0]??0;for(let u=1;u<s-1;u++){const h=f[u]??0,p=f[u-1]??0;if(h===0||p===0||p>0!=h>0)c[u]=0;else{const w=d[u]??1,x=d[u-1]??1;c[u]=3*(x+w)/((2*w+x)/p+(w+2*x)/h),isFinite(c[u]??0)||(c[u]=0)}}c[s-1]=f[s-2]??0;for(let u=0;u<s-1;u++){const h=d[u]??1,p=t[u]??0,w=e[u]??0,x=t[u+1]??0,g=e[u+1]??0,S=c[u]??0,C=c[u+1]??0,M=p+h/3,P=w+S*h/3,A=x-h/3,k=g-C*h/3;n?r.bezierCurveTo(M,P,A,k,x,g):r.bezierCurveTo(P,M,k,A,g,x)}return r};function mi(){return mn(wi)}const wi=(t,e,n,o)=>{const s=t.length;if(s<2)return null;const r=new Path2D,i=o(t[0]??0),l=o(e[0]??0);if(n?r.moveTo(i,l):r.moveTo(l,i),s===2){const c=o(t[1]??0),f=o(e[1]??0);return n?r.lineTo(c,f):r.lineTo(f,c),r}for(let c=0;c<s-1;c++){const f=c===0?0:c-1,a=t[f]??0,d=e[f]??0,u=t[c]??0,h=e[c]??0,p=t[c+1]??0,w=e[c+1]??0,x=c+2<s?t[c+2]??0:p,g=c+2<s?e[c+2]??0:w,S=Math.hypot(a-u,d-h),C=Math.hypot(u-p,h-w),M=Math.hypot(p-x,w-g),P=Math.sqrt(M),A=M,k=Math.sqrt(C),T=C,I=Math.sqrt(S),L=S,m=2*L+3*I*k+T,b=2*A+3*P*k+T,v=3*I*(I+k),y=3*P*(P+k);let _,E,R,z;if(v>0){const F=1/v;_=(-T*a+m*u+L*p)*F,E=(-T*d+m*h+L*w)*F}else _=u,E=h;if(y>0){const F=1/y;R=(A*u+b*p-T*x)*F,z=(A*h+b*w-T*g)*F}else R=p,z=w;n?r.bezierCurveTo(_,E,R,z,p,w):r.bezierCurveTo(E,_,z,R,w,p)}return r};function Si(t=4){const e=(n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w=M=>h(X(M,s,i,c)),x=M=>h(X(M,r,l,f)),g=t/2,S=new Path2D,C=s.ori===H.Horizontal;for(let M=u===O.Forward?a:d;M>=a&&M<=d;M+=u){const P=o[M];if(P==null)continue;const A=w(n[M]),k=x(P);C?(S.moveTo(A+g,k),S.arc(A,k,g,0,Math.PI*2)):(S.moveTo(k+g,A),S.arc(k,A,g,0,Math.PI*2))}return{stroke:S,fill:S,clip:null,band:null,gaps:null}};return e.defaults=Vn,e}function vi({group:t=0,series:e=[0,1,2,3],yScale:n="y",upColor:o="#26a69a",downColor:s="#ef5350",bodyWidth:r=.6,wickWidth:i=1}){const l=Q();return ht(({ctx:c,plotBox:f,valToX:a,valToY:d})=>{const u=l.dataStore.data[t];if(u==null)return;const h=u.x,p=u.series[e[0]],w=u.series[e[1]],x=u.series[e[2]],g=u.series[e[3]];if(p==null||w==null||x==null||g==null)return;const S=h.length;if(S===0)return;const C=Math.max(2,f.width/S*r);for(let M=0;M<S;M++){const P=h[M],A=p[M],k=w[M],T=x[M],I=g[M];if(P==null||A==null||k==null||T==null||I==null)continue;const L=a(P),m=d(k,n),b=d(T,n),v=d(A,n),y=d(I,n);if(L==null||m==null||b==null||v==null||y==null)continue;const E=I>=A?o:s;hn(c,L,m,b,v,y,C,null,{wickColor:E,wickWidth:i,bodyFill:E})}}),null}function bi(t,e,n=0){const o=e??t.series.map((a,d)=>d),s=t.x.length,r=[],i=new Float64Array(s);for(let a=0;a<o.length;a++){const d=o[a];if(d==null)continue;const u=t.series[d];if(u==null)continue;const h=new Array(s);for(let p=0;p<s;p++){const w=u[p];w!=null?(i[p]=i[p]+w,h[p]=i[p]):h[p]=null}r.push(h)}const l=new Map;for(let a=0;a<o.length;a++){const d=o[a];d!=null&&l.set(d,a)}const c=[];for(let a=0;a<t.series.length;a++){const d=l.get(a)??-1,u=d>=0?r[d]:void 0;u!=null?c.push(u):c.push(t.series[a]??[])}const f=[];for(let a=o.length-1;a>0;a--){const d=o[a],u=o[a-1];d!=null&&u!=null&&f.push({group:n,series:[d,u]})}return{group:{x:t.x,series:c},bands:f}}function Mi(t){const e=new Set;for(const[r]of t)for(let i=0;i<r.length;i++){const l=r[i];l!=null&&e.add(l)}const n=Float64Array.from([...e].sort((r,i)=>r-i)),o=new Map;for(let r=0;r<n.length;r++){const i=n[r];i!=null&&o.set(i,r)}const s=[];for(const[r,i]of t){const l=new Array(n.length).fill(null);for(let c=0;c<r.length;c++){const f=r[c];if(f==null)continue;const a=o.get(f);a!=null&&(l[a]=i[c]??null)}s.push(l)}return[{x:n,series:s}]}function xi(t){const e=(t==null?void 0:t.decimals)??1;return n=>n.map(o=>{const s=Math.abs(o);return s>=1e9?(o/1e9).toFixed(e)+"B":s>=1e6?(o/1e6).toFixed(e)+"M":s>=1e3?(o/1e3).toFixed(e)+"K":o.toFixed(s>=1?0:e)})}function yi(t,e=0){return n=>n.map(o=>o.toFixed(e)+t)}function Ci(t,e=0){return n=>n.map(o=>t+o.toFixed(e))}function ki(t,e,n=0){return o=>o.map(s=>t+s.toFixed(n)+e)}function Ti(t){const e=(t==null?void 0:t.utc)??!1;return n=>n.map(o=>e?ot(o,{hour:"2-digit",minute:"2-digit",hour12:!1},"UTC"):ot(o,{hour:"2-digit",minute:"2-digit",hour12:!1}))}function Ai(t){const e=t!=null&&t.utc?"UTC":void 0,n=(t==null?void 0:t.format)??"short";return o=>o.map(s=>ot(s,{month:n},e))}function Ii(t){const{tz:e,...n}=t??{};return o=>o.map(s=>ot(s,n,e))}function Li(t,e=0){return n=>n.map(o=>{const s=Math.round(o)-e;return t[s]??String(o)})}exports.AnnotationLabel=ai;exports.Axis=Pt;exports.Band=vs;exports.BoxWhisker=Qs;exports.Candlestick=vi;exports.Chart=ae;exports.DEFAULT_ACTIONS=Rt;exports.Direction=O;exports.Distribution=K;exports.FloatingLegend=qs;exports.HLine=ri;exports.Heatmap=ei;exports.HoverLabel=Js;exports.Legend=As;exports.Orientation=H;exports.Region=ci;exports.Scale=gs;exports.Series=fe;exports.Side=Y;exports.SortOrder=xt;exports.Sparkline=Ns;exports.Timeline=Ys;exports.Tooltip=Gs;exports.VLine=li;exports.Vector=oi;exports.ZoomRanger=Xs;exports.alignData=Mi;exports.bars=we;exports.catmullRom=mi;exports.drawHLine=dn;exports.drawLabel=ii;exports.drawRegion=pn;exports.drawVLine=gn;exports.fadeGradient=ms;exports.fmtCompact=xi;exports.fmtDateStr=Ii;exports.fmtHourMin=Ti;exports.fmtLabels=Li;exports.fmtMonthName=Ai;exports.fmtPrefix=Ci;exports.fmtSuffix=yi;exports.fmtWrap=ki;exports.focus=vn;exports.groupedBars=fi;exports.linear=nn;exports.lttb=le;exports.lttbGroup=Yn;exports.monotoneCubic=gi;exports.palette=ws;exports.points=Si;exports.posToVal=lt;exports.sideOrientation=St;exports.stackGroup=bi;exports.stackedBars=hi;exports.stepped=ui;exports.useChart=Uo;exports.useCursorDrawHook=js;exports.useDrawHook=ht;exports.valToPos=X;exports.withAlpha=un;
|
|
1
|
+
"use strict";var xn=Object.defineProperty;var yn=(t,e,n)=>e in t?xn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var j=(t,e,n)=>yn(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react/jsx-runtime"),z=require("react");function Cn(t=.15){return e=>{e.focusAlpha=t}}const Gt=[["leftDrag","zoomX"],["leftDblclick","reset"],["wheel","zoomX"],["xGutterDrag","panX"],["yGutterDrag","panY"],["pinch","zoomX"],["touchDrag","zoomX"]];var N=(t=>(t[t.Top=0]="Top",t[t.Right=1]="Right",t[t.Bottom=2]="Bottom",t[t.Left=3]="Left",t))(N||{}),$=(t=>(t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical",t))($||{}),O=(t=>(t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward",t))(O||{}),K=(t=>(t[t.Linear=1]="Linear",t[t.Ordinal=2]="Ordinal",t[t.Log=3]="Log",t[t.Asinh=4]="Asinh",t))(K||{}),At=(t=>(t[t.Ascending=1]="Ascending",t[t.Descending=-1]="Descending",t[t.Unsorted=0]="Unsorted",t))(At||{});function yt(t){return t%2}var st=(t=>(t[t.None=0]="None",t[t.Scales=1]="Scales",t[t.Axes=2]="Axes",t[t.Paths=4]="Paths",t[t.Cursor=8]="Cursor",t[t.Select=16]="Select",t[t.Size=32]="Size",t[t.Full=63]="Full",t))(st||{});const et=Math,Ot=et.PI,it=et.abs,ct=et.floor,B=et.round,Dt=et.ceil,ie=et.min,It=et.max,bt=et.pow,ke=et.sign,rt=et.log10,Pt=et.log2,kn=(t,e=1)=>et.sinh(t)*e,ce=(t,e=1)=>et.asinh(t/e),J=1/0,Ke=Number.isInteger;function Kt(t,e){return t[e]??0}function mt(t,e,n=0,o=e.length-1){let s;const r=o<=2147483647;for(;o-n>1;)s=r?n+o>>1:ct((n+o)/2),Kt(e,s)<t?n=s:o=s;return t-Kt(e,n)<=Kt(e,o)-t?n:o}const qe=t=>t!=null,Ze=t=>t!=null&&t>0;function Je(t){return(e,n,o)=>{let s=-1,r=-1;for(let i=n;i<=o;i++)if(t(e[i])){s=i;break}for(let i=o;i>=n;i--)if(t(e[i])){r=i;break}return[s,r]}}const Bt=Je(qe),Qe=Je(Ze);function Tn(t,e,n,o=At.Unsorted,s=!1){const r=s?Qe:Bt,i=s?Ze:qe,[l,c]=r(t,e,n);let f=t[l]??J,a=t[l]??-J;if(l>-1)if(o===At.Ascending)f=t[l]??J,a=t[c]??-J;else if(o===At.Descending)f=t[c]??J,a=t[l]??-J;else for(let d=l;d<=c;d++){const u=t[d];u!=null&&i(u)&&(u<f?f=u:u>a&&(a=u))}return[f,a]}function at(t,e=0){if(Ke(t))return t;const n=10**e,o=t*n*(1+Number.EPSILON);return B(o)/n}const Lt=new Map;function An(t){return(String(t).split(".")[1]??"").length}const In=/\.\d*?(?=9{6,}|0{6,})/gm;function xt(t){if(Ke(t)||Lt.has(t))return t;const e=`${t}`,n=e.match(In);if(n==null)return t;const o=n[0].length-1;if(e.indexOf("e-")!==-1){const s=e.split("e"),r=s[0]??"0",i=s[1]??"0";return+`${xt(+r)}e${i}`}return at(t,o)}function Ln(t,e,n=!0){return n?xt(at(xt(t/e))*e):at(t/e)*e}function ae(t,e,n=!0){return n?xt(Dt(xt(t/e))*e):Dt(t/e)*e}function tn(t,e,n=!0){return n?xt(ct(xt(t/e))*e):ct(t/e)*e}function Pn(t){return t===0?e=>e:t===1?B:e=>Ln(e,t)}function en(t,e,n,o){const s=[],r=o.map(An);for(let i=e;i<n;i++){const l=it(i);for(let c=0;c<o.length;c++){const f=o[c]??0,a=r[c]??0,d=+`${f}e${i}`,u=(i>=0?0:l)+(i>=a?0:a),h=d;s.push(h),Lt.set(h,u)}}return s}function Q(t,e,n){return ie(It(t,e),n)}const En=new Intl.NumberFormat,nn=t=>En.format(t);function Te(t,e,n){for(;e<=n;){if(t[e]!=null)return!0;e++}return!1}const _n=.1,dt={mode:3,pad:_n,soft:null},_t={pad:0,soft:null,mode:0},Dn={min:_t,max:_t};function qt(t,e,n,o){let s;typeof n=="number"?(_t.pad=n,_t.soft=null,_t.mode=0,s=Dn):s=n;const r=s.min,i=s.max,l=r.pad,c=i.pad,f=r.hard??-J,a=i.hard??J,d=r.soft??J,u=i.soft??-J,h=r.mode,p=i.mode;let w=e-t;const b=rt(w),g=It(it(t),it(e)),m=rt(g),M=it(m-b);(w<1e-24||M>10)&&(w=0,(t===0||e===0)&&(w=1e-24));const S=w||g||1e3,_=rt(S),T=bt(10,ct(_)),x=S*(w===0?t===0?.1:1:l),y=at(tn(t-x,T/10),24),A=h===1||h===3&&y<=d||h===2&&y>=d,L=t>=d&&A?d:J,k=It(f,y<L&&t>=L?L:ie(L,y)),D=S*(w===0?e===0?.1:1:c),P=at(ae(e+D,T/10),24),F=p===1||p===3&&P>=u||p===2&&P<=u,W=e<=u&&F?u:-J,v=ie(a,P>W&&e<=W?W:It(W,P));return k===v&&k===0?[-1,1]:[k,v]}function on(t,e,n,o){n===2&&(o=!0);const s=ke(t),r=ke(e);t===e&&(s===-1?(t*=n,e/=n):(t/=n,e*=n));const i=n===10?rt:Pt,l=s===1?ct:Dt,c=r===1?Dt:ct,f=i(it(t)),a=i(it(e)),d=l(f),u=c(a);let h=bt(n,d),p=bt(n,u);return n===10&&(d<0&&(h=at(h,-d)),u<0&&(p=at(p,-u))),o?(t=h*s,e=p*r):(t=tn(t,bt(n,ct(f)),!1),e=ae(e,bt(n,ct(a)),!1)),[t,e]}function Fn(t,e,n,o){const s=on(t,e,n,o);return t===0&&(s[0]=0),e===0&&(s[1]=0),s}function Ae(t){return(rt((t^t>>31)-(t>>31))|0)+1}function Rn(t,e,n,o,s){const r=It(Ae(t),Ae(e)),i=e-t;let l=It(0,mt(s/o*i,n)-1);do{const c=n[l]??0,f=o*c/i;if(f>=s*.9&&r+(c<5?Lt.get(c)??0:0)<=17)return[c,f]}while(++l<n.length);return[0,0]}function zn(t){return{id:t.id,min:t.min??null,max:t.max??null,distr:t.distr??K.Linear,log:t.log??10,asinh:t.asinh??1,ori:t.ori??(t.id==="x"?$.Horizontal:$.Vertical),dir:t.dir??O.Forward,time:t.time??!1,auto:t.auto??!0,range:t.range??null,_discrete:!1,_cfgMin:t.min??null,_cfgMax:t.max??null,_min:null,_max:null}}function U(t){return t.min!=null&&t.max!=null}function ut(t){t._min=null,t._max=null}function sn(t){if(t._min!=null)return t._min;const{min:e,distr:n}=t;if(e==null)return 0;if(n===K.Log){e<=0&&console.warn(`[uPlot+] Log scale "${t.id}": min value ${e} <= 0, clamping to 1e-10`);const o=e>0?e:1e-10;t._min=(t.log===10?rt:Pt)(o)}else n===K.Asinh?t._min=ce(e,t.asinh):t._min=e;return t._min}function rn(t){if(t._max!=null)return t._max;const{max:e,distr:n}=t;if(e==null)return 0;if(n===K.Log){e<=0&&console.warn(`[uPlot+] Log scale "${t.id}": max value ${e} <= 0, clamping to 1e-10`);const o=e>0?e:1e-10;t._max=(t.log===10?rt:Pt)(o)}else n===K.Asinh?t._max=ce(e,t.asinh):t._max=e;return t._max}function Hn(t,e){if(e.min==null||e.max==null)return 0;const n=sn(e),s=rn(e)-n;if(s===0)return 0;const{distr:r}=e;if(r===K.Log){const i=e.log===10?rt:Pt,l=t>0?t:1e-10;return(i(l)-n)/s}return r===K.Asinh?(ce(t,e.asinh)-n)/s:(t-n)/s}function Wn(t,e){if(e.min==null||e.max==null)return 0;const n=sn(e),o=rn(e);if(o===n)return e.min;const{distr:s}=e;return s===K.Log?Math.pow(e.log,n+t*(o-n)):s===K.Asinh?kn(n+t*(o-n),e.asinh):n+t*(o-n)}function X(t,e,n,o){const s=Hn(t,e);let r;return e.ori===$.Horizontal?r=e.dir===O.Forward?s:1-s:r=e.dir===O.Forward?1-s:s,o+r*n}function ft(t,e,n,o){if(n===0)return e.min??0;let s=(t-o)/n;return e.ori===$.Horizontal?e.dir===O.Backward&&(s=1-s):e.dir!==O.Backward&&(s=1-s),Wn(s,e)}class $n{constructor(){j(this,"scales",new Map);j(this,"groupXScales",new Map)}addScale(e){this.scales.set(e.id,zn(e))}removeScale(e){this.scales.delete(e)}getScale(e){return this.scales.get(e)}getAllScales(){return this.scales.values()}setGroupXScale(e,n){this.groupXScales.set(e,n)}getGroupXScaleKey(e){return this.groupXScales.get(e)}setRange(e,n,o){const s=this.scales.get(e);s&&(s.min=n,s.max=o,ut(s))}autoRangeX(e){var o,s,r,i,l,c;const n=new Map;for(const[f,a]of this.groupXScales){const d=this.scales.get(a);if(!d||!d.auto)continue;const u=e[f];if(!u||u.x.length===0)continue;const h=u.x[0],p=u.x[u.x.length-1];if(h==null||p==null)continue;const w=n.get(a);w?(w.dataMin=Math.min(w.dataMin,h),w.dataMax=Math.max(w.dataMax,p),w.groups.push(f)):n.set(a,{dataMin:h,dataMax:p,groups:[f]})}for(const[f,{dataMin:a,dataMax:d,groups:u}]of n){const h=this.scales.get(f);if(!h)continue;let p=!0,w=J;for(const b of u){const g=e[b];if(g){for(let m=0;m<g.x.length;m++)if(Number.isInteger(g.x[m])||(p=!1),m>0){const M=g.x[m]-g.x[m-1];M>0&&M<w&&(w=M)}}}if(h._discrete=p,h.range){const[b,g]=qt(a,d,{min:{pad:((o=h.range.min)==null?void 0:o.pad)??0,soft:((s=h.range.min)==null?void 0:s.soft)??null,mode:((r=h.range.min)==null?void 0:r.mode)??0},max:{pad:((i=h.range.max)==null?void 0:i.pad)??0,soft:((l=h.range.max)==null?void 0:l.soft)??null,mode:((c=h.range.max)==null?void 0:c.mode)??0}});h.min=b,h.max=g}else if(a===d)[h.min,h.max]=qt(a,d,{min:{pad:.1,soft:null,mode:0},max:{pad:.1,soft:null,mode:0}});else if(w<J){const b=w/2;h.min=a-b,h.max=d+b}else h.min=a,h.max=d;h._cfgMin!=null&&(h.min=h._cfgMin),h._cfgMax!=null&&(h.max=h._cfgMax),ut(h)}}autoRange(e,n,o){var i,l,c,f,a,d;const s=new Map,r=new Map;for(const{group:u,index:h,yScale:p}of n){const w=e[u];if(!w)continue;const b=w.series[h];if(!b||b.length===0)continue;const g=o.windows.get(u),m=g?g[0]:0,M=g?g[1]:b.length-1,S=this.scales.get(p),_=(S==null?void 0:S.distr)===K.Log,[T,x]=o.getCachedMinMax(u,h,m,M,0,_),y=s.get(p),A=r.get(p);s.set(p,y!=null?Math.min(y,T):T),r.set(p,A!=null?Math.max(A,x):x)}for(const[u,h]of s){const p=this.scales.get(u);if(!p||!p.auto)continue;const w=r.get(u)??-J;if(h===J)continue;let b,g;if(p.distr===K.Log)[b,g]=on(h,w,p.log,!1);else if(p.distr===K.Asinh)[b,g]=Fn(h,w,p.log,!1);else{const m=p.range??{min:dt,max:dt};[b,g]=qt(h,w,{min:{pad:((i=m.min)==null?void 0:i.pad)??dt.pad,soft:((l=m.min)==null?void 0:l.soft)??dt.soft,mode:((c=m.min)==null?void 0:c.mode)??dt.mode},max:{pad:((f=m.max)==null?void 0:f.pad)??dt.pad,soft:((a=m.max)==null?void 0:a.soft)??dt.soft,mode:((d=m.max)==null?void 0:d.mode)??dt.mode}})}p._cfgMin!=null&&(b=p._cfgMin),p._cfgMax!=null&&(g=p._cfgMax),p.min=b,p.max=g,ut(p)}}}const Gn=1024;class Vn{constructor(e,n=Gn){j(this,"blocks");j(this,"nBlocks");j(this,"blockSize");j(this,"data");j(this,"len");this.data=e,this.len=e.length,this.blockSize=n,this.nBlocks=Math.ceil(e.length/n),this.blocks=new Float64Array(this.nBlocks*2),this.buildAll()}buildAll(){const{data:e,blockSize:n,nBlocks:o,blocks:s,len:r}=this;for(let i=0;i<o;i++){const l=i*n,c=Math.min(l+n,r);let f=1/0,a=-1/0;for(let d=l;d<c;d++){const u=e[d];u!=null&&(u<f&&(f=u),u>a&&(a=u))}s[i*2]=f,s[i*2+1]=a}}rangeMinMax(e,n){const{data:o,blockSize:s,blocks:r}=this;let i=1/0,l=-1/0;const c=Math.floor(e/s),f=Math.floor(n/s);if(c===f){for(let u=e;u<=n;u++){const h=o[u];h!=null&&(h<i&&(i=h),h>l&&(l=h))}return[i,l]}const a=(c+1)*s-1;for(let u=e;u<=a;u++){const h=o[u];h!=null&&(h<i&&(i=h),h>l&&(l=h))}for(let u=c+1;u<f;u++){const h=r[u*2]??1/0,p=r[u*2+1]??-1/0;h<i&&(i=h),p>l&&(l=p)}const d=f*s;for(let u=d;u<=n;u++){const h=o[u];h!=null&&(h<i&&(i=h),h>l&&(l=h))}return[i,l]}updateBlock(e){const{data:n,blockSize:o,blocks:s,len:r}=this;if(e>=this.nBlocks)return;const i=e*o,l=Math.min(i+o,r);let c=1/0,f=-1/0;for(let a=i;a<l;a++){const d=n[a];d!=null&&(d<c&&(c=d),d>f&&(f=d))}s[e*2]=c,s[e*2+1]=f}grow(e){const n=this.nBlocks;if(this.len=e,this.nBlocks=Math.ceil(e/this.blockSize),this.nBlocks>n){const s=new Float64Array(this.nBlocks*2);s.set(this.blocks),this.blocks=s}const o=Math.max(0,n-1);for(let s=o;s<this.nBlocks;s++)this.updateBlock(s)}setData(e){this.data=e}}class Bn{constructor(){j(this,"data",[]);j(this,"windows",new Map);j(this,"minMaxCache",new Map);j(this,"blockTrees",new Map)}setData(e){this.data=e,this.windows.clear();for(const n of this.minMaxCache.values())n.clear();this.minMaxCache.clear(),this.blockTrees.clear()}getOrBuildTree(e,n){const o=`${e}:${n}`;let s=this.blockTrees.get(o);if(s)return s;const r=this.data[e];if(!r)return;const i=r.series[n];if(!(!i||i.length===0))return s=new Vn(i),this.blockTrees.set(o,s),s}updateWindows(e){var o;let n=!1;for(let s=0;s<this.data.length;s++){const r=this.data[s],i=e(s),l=this.windows.get(s);let c,f;if(!r||!i||!U(i))c=0,f=Math.max(0,((r==null?void 0:r.x.length)??1)-1);else{const a=r.x;if(a.length===0)c=0,f=0;else{c=mt(i.min,a),f=mt(i.max,a);const d=a[c],u=a[f];c>0&&d!=null&&d>i.min&&c--,f<a.length-1&&u!=null&&u<i.max&&f++}}(!l||l[0]!==c||l[1]!==f)&&(n=!0,(o=this.minMaxCache.get(s))==null||o.clear()),this.windows.set(s,[c,f])}return n}getWindow(e){var n;return this.windows.get(e)??[0,(((n=this.data[e])==null?void 0:n.x.length)||1)-1]}getXValues(e){var n;return((n=this.data[e])==null?void 0:n.x)??[]}getYValues(e,n){var o;return((o=this.data[e])==null?void 0:o.series[n])??[]}getCachedMinMax(e,n,o,s,r,i){let l=this.minMaxCache.get(e);const c=`${n}:${o}:${s}`;if(l){const h=l.get(c);if(h!=null)return h}else l=new Map,this.minMaxCache.set(e,l);const f=this.data[e];if(!f)return[1/0,-1/0];const a=f.series[n];if(!a||a.length===0)return[1/0,-1/0];let d;const u=!i&&r===At.Unsorted?this.getOrBuildTree(e,n):void 0;return u?d=u.rangeMinMax(o,s):d=Tn(a,o,s,r,i),l.set(c,d),d}getBlockTree(e,n){return this.getOrBuildTree(e,n)}appendData(e,n,o){var i;const s=this.data[e];if(!s)return;let r;Array.isArray(s.x)?r=s.x:(r=Array.from(s.x),s.x=r);for(let l=0;l<n.length;l++){const c=n[l];c!=null&&r.push(c)}for(let l=0;l<s.series.length;l++){let c=s.series[l];if(!c)continue;Array.isArray(c)||(c=Array.from(c),s.series[l]=c);const f=o[l];if(f){const d=c;for(let u=0;u<f.length;u++)d.push(f[u]??null)}const a=this.blockTrees.get(`${e}:${l}`);a&&(a.setData(c),a.grow(c.length))}(i=this.minMaxCache.get(e))==null||i.clear()}static toTypedX(e){for(const n of e)Array.isArray(n.x)&&(n.x=Float64Array.from(n.x));return e}}const zt=-10;class Xn{constructor(){j(this,"state",{left:zt,top:zt,activeGroup:-1,activeSeriesIdx:-1,activeDataIdx:-1});j(this,"_groupedConfigs",new Map);j(this,"_groupedConfigsSource",null)}getGroupedConfigs(e){if(this._groupedConfigsSource!==e){this._groupedConfigsSource=e,this._groupedConfigs.clear();for(const n of e){if(n.show===!1)continue;let o=this._groupedConfigs.get(n.group);o==null&&(o=[],this._groupedConfigs.set(n.group,o)),o.push(n)}}return this._groupedConfigs}invalidateGroupedConfigs(){this._groupedConfigsSource=null}hide(){this.state.left=zt,this.state.top=zt,this.state.activeGroup=-1,this.state.activeSeriesIdx=-1,this.state.activeDataIdx=-1}update(e,n,o,s,r,i,l,c){this.state.left=e,this.state.top=n;let f=1/0,a=-1,d=-1,u=-1;const h=this.getGroupedConfigs(r);for(let p=0;p<s.length;p++){const w=s[p];if(w==null)continue;const b=w.x;if(b.length===0)continue;const g=c(p);if(g==null)continue;const m=i(g);if(m==null||!U(m))continue;const[M,S]=l(p),_=o.width,T=o.left,x=ft(e+T,m,_,T),y=mt(x,b,M,S),A=[y];y>M&&A.push(y-1),y<S&&A.push(y+1);const L=new Map;for(const k of A){const D=b[k];if(D==null)continue;const P=X(D,m,_,T);for(const F of h.get(p)??[]){const W=w.series[F.index];if(W==null)continue;const v=W[k];if(v==null)continue;let C=L.get(F.yScale);if(C==null&&!L.has(F.yScale)&&(C=i(F.yScale),L.set(F.yScale,C)),C==null||!U(C))continue;const E=o.height,I=o.top,H=X(v,C,E,I),R=e+T-P,G=n+I-H,Y=R*R+G*G;if(Y<f&&(f=Y,a=p,d=F.index,u=k,Y===0))break}if(f===0)break}}this.state.activeGroup=a,this.state.activeSeriesIdx=d,this.state.activeDataIdx=u}syncToValue(e,n){const o=n.dataStore.data;if(o.length===0)return;const s=o[0];if(s==null)return;const r=n.scaleManager.getGroupXScaleKey(0);if(r==null)return;const i=n.scaleManager.getScale(r);if(i==null||!U(i))return;const[l,c]=n.dataStore.getWindow(0),f=mt(e,s.x,l,c),a=s.x[f];if(a==null)return;const d=X(a,i,n.plotBox.width,n.plotBox.left);this.state.left=d-n.plotBox.left,this.state.activeGroup=0,this.state.activeDataIdx=f;let u=0,h=n.plotBox.height/2;for(const p of n.seriesConfigs){if(p.group!==0||p.show===!1)continue;const w=s.series[p.index];if(w==null)continue;const b=w[f];if(b==null)continue;const g=n.scaleManager.getScale(p.yScale);if(!(g==null||!U(g))){h=X(b,g,n.plotBox.height,n.plotBox.top)-n.plotBox.top,u=p.index;break}}this.state.top=h,this.state.activeSeriesIdx=u}}class jn{constructor(){j(this,"flags",st.None);j(this,"frameId",null);j(this,"callback",null)}mark(e){this.flags|=e,this.scheduleFrame()}has(e){return(this.flags&e)!==0}get dirty(){return this.flags}clear(){this.flags=st.None}onRedraw(e){this.callback=e}scheduleFrame(){this.frameId==null&&(this.frameId=requestAnimationFrame(()=>{this.frameId=null;const e=this.callback;e!=null&&e(),this.clear()}))}cancel(){this.frameId!=null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}dispose(){this.cancel(),this.callback=null,this.flags=st.None}}const Xt={width:1},Yn={width:0,fill:"auto",fillTo:0,points:{show:!1},cursor:{show:!1}},Nn={width:0,cursor:{show:!1}};function jt(t,e,n){t.lineTo(e,n)}function Yt(t,e,n){t.lineTo(n,e)}function ue(t,e,n,o,s,r){const i=[];let l=-1;const c=s===O.Forward?n:o,f=s===O.Forward?o:n,a=s;for(let d=c;s===O.Forward?d<=f:d>=f;d+=a)if(e[d]===null||e[d]===void 0){if(l===-1){const u=Q(d-s,n,o);l=r(t[u])}}else l!==-1&&(i.push([l,r(t[d])]),l=-1);return l!==-1&&i.push([l,r(t[o])]),i}function fe(t,e,n,o,s,r){const i=new Path2D;let l=e===$.Horizontal?n:o;const c=e===$.Horizontal?n+s:o+r,f=e===$.Horizontal?o:n,a=e===$.Horizontal?r:s;for(const[d,u]of t)d>l&&(e===$.Horizontal?i.rect(l,f,d-l,a):i.rect(f,l,a,d-l)),l=u;return l<c&&(e===$.Horizontal?i.rect(l,f,c-l,a):i.rect(f,l,a,c-l)),i}function ln(t){return(e,n,o,s,r,i)=>{o!==s&&(r!==o&&i!==o&&t(e,n,o),r!==s&&i!==s&&t(e,n,s),t(e,n,i))}}const Un=ln(jt),On=ln(Yt);function cn(){const t=(e,n,o,s,r,i,l,c,f,a,d,u,h)=>{const p=(h==null?void 0:h.spanGaps)??!1;if([f,a]=(s.distr===K.Log?Qe:Bt)(n,f,a),f===-1)return{stroke:new Path2D,fill:null,clip:null,band:null,gaps:null};const b=y=>u(X(y,o,r,l)),g=y=>u(X(y,s,i,c));let m,M;o.ori===$.Horizontal?(m=jt,M=Un):(m=Yt,M=On);const S={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null},_=S.stroke;let T=!1;if(a-f>=r*4){const y=C=>ft(C,o,r,l);let A=null,L=0,k=0,D=0,P=b(e[d===O.Forward?f:a]);const F=b(e[f]),W=b(e[a]);let v=y(d===O.Forward?F+1:W-1);for(let C=d===O.Forward?f:a;C>=f&&C<=a;C+=d){const E=e[C],H=(d===O.Forward?E<v:E>v)?P:b(E),R=n[C];H===P?R!=null?(D=R,A==null?(m(_,H,g(D)),k=A=L=D):D<A?A=D:D>L&&(L=D)):R===null&&!p&&(T=!0):(A!=null&&M(_,P,g(A),g(L),g(k),g(D)),R!=null?(D=R,m(_,H,g(D)),A=L=k=D):(A=null,L=0,R===null&&!p&&(T=!0)),P=H,v=y(P+d))}A!=null&&(A!==L?M(_,P,g(A),g(L),g(k),g(D)):m(_,P,g(D)))}else for(let y=d===O.Forward?f:a;y>=f&&y<=a;y+=d){const A=n[y];A===null&&!p?T=!0:A!=null&&m(_,b(e[y]),g(A))}{const y=S.fill=new Path2D(_),A=(h==null?void 0:h.fillTo)??s.min??0,L=g(A);let k=b(e[f]),D=b(e[a]);d===O.Backward&&([D,k]=[k,D]),m(y,D,L),m(y,k,L)}if(T){const y=ue(e,n,f,a,d,b);S.gaps=y,S.clip=fe(y,o.ori,l,c,r,i)}return S};return t.defaults=Xt,t}function he(t,e,n){const o=t.length;if(n=Math.max(2,Math.round(n)),o<=n){const u=new Uint32Array(o),h=new Float64Array(o),p=new Array(o);for(let w=0;w<o;w++)u[w]=w,h[w]=t[w],p[w]=e[w]??null;return{indices:u,x:h,y:p}}const s=[];let r=-1,i=0;for(let u=0;u<o;u++)e[u]!=null?(r===-1&&(r=u),i++):r!==-1&&(s.push([r,u-1]),r=-1);if(r!==-1&&s.push([r,o-1]),i===0)return{indices:new Uint32Array(0),x:new Float64Array(0),y:[]};if(i<=n){const u=new Uint32Array(i),h=new Float64Array(i),p=new Array(i);let w=0;for(let b=0;b<o;b++)e[b]!=null&&(u[w]=b,h[w]=t[b],p[w]=e[b],w++);return{indices:u,x:h,y:p}}const l=[];for(const[u,h]of s){const p=h-u+1,w=Math.max(2,Math.round(n*(p/i))),b=Kn(t,e,u,h,w);for(const g of b)l.push(g)}const c=l.length,f=new Uint32Array(c),a=new Float64Array(c),d=new Array(c);for(let u=0;u<c;u++){const h=l[u];f[u]=h,a[u]=t[h],d[u]=e[h]}return{indices:f,x:a,y:d}}function Kn(t,e,n,o,s){const r=o-n+1;if(r<=s){const a=[];for(let d=n;d<=o;d++)a.push(d);return a}const i=[];i.push(n);const l=s-2,c=(r-2)/l;let f=n;for(let a=0;a<l;a++){const d=n+1+Math.floor(a*c),u=Math.min(n+1+Math.floor((a+1)*c)-1,o-1);let h=0,p=0,w=0;if(a<l-1){const S=n+1+Math.floor((a+1)*c),_=Math.min(n+1+Math.floor((a+2)*c)-1,o-1);for(let T=S;T<=_;T++)h+=t[T],p+=e[T],w++}else h=t[o],p=e[o],w=1;w>0&&(h/=w,p/=w);const b=t[f],g=e[f];let m=d,M=-1;for(let S=d;S<=u;S++){const _=t[S],T=e[S],x=Math.abs(b*(T-p)+_*(p-g)+h*(g-T));x>M&&(M=x,m=S)}i.push(m),f=m}return i.push(o),i}function qn(t,e){const n=t.x.length;if(e=Math.max(2,Math.round(e)),n<=e)return t;const o=new Set;for(const c of t.series){const f=he(t.x,c,e);for(let a=0;a<f.indices.length;a++)o.add(f.indices[a])}const s=Array.from(o).sort((c,f)=>c-f),r=s.length,i=new Float64Array(r);for(let c=0;c<r;c++)i[c]=t.x[s[c]];const l=[];for(const c of t.series)if(Array.isArray(c)&&c.some(a=>a===null)){const a=new Array(r);for(let d=0;d<r;d++)a[d]=c[s[d]]??null;l.push(a)}else{const a=new Float64Array(r);for(let d=0;d<r;d++)a[d]=c[s[d]];l.push(a)}return{x:i,series:l}}function Zn(t){const n=cn(),o=(s,r,i,l,c,f,a,d,u,h,p,w,b)=>{const g=h-u+1,m=Math.round(c*1);if(g>m*2){const M=h-u+1,S=new Float64Array(M),_=new Array(M);for(let x=0;x<M;x++)S[x]=s[u+x],_[x]=r[u+x]??null;const T=he(S,_,m);return n(T.x,T.y,i,l,c,f,a,d,0,T.x.length-1,p,w,b)}return n(s,r,i,l,c,f,a,d,u,h,p,w,b)};return o.defaults=Xt,o}const Ie=new WeakMap;function Le(t,e,n){return typeof e=="string"?e:Jn(t,e,n)}function Jn(t,e,n){const o=Ie.get(e);if(o!=null&&o.left===n.left&&o.top===n.top&&o.width===n.width&&o.height===n.height)return o.grad;const s=t.createLinearGradient(0,n.top,0,n.top+n.height);for(const[r,i]of e.stops)s.addColorStop(r,i);return Ie.set(e,{grad:s,left:n.left,top:n.top,width:n.width,height:n.height}),s}function Qn(t,e,n,o,s){if(e.show===!1)return;const r=e.alpha??1;t.save(),r<1&&(t.globalAlpha=r),n.clip&&t.clip(n.clip);const i=s??{left:0,top:0,width:t.canvas.width/o,height:t.canvas.height/o};if(e.fill&&n.fill&&(t.fillStyle=Le(t,e.fill,i),t.fill(n.fill)),e.stroke){const l=(e.width??1)*o;t.strokeStyle=Le(t,e.stroke,i),t.lineWidth=l,t.lineJoin=e.join??"round",t.lineCap=e.cap??"butt",e.dash&&t.setLineDash(e.dash.map(d=>d*o));const c=e.pxAlign??0,f=l%2/2;c===1&&f>0&&t.translate(f,f),t.stroke(n.stroke)}t.restore()}const to=Zn(),Pe=64;class eo{constructor(){j(this,"ctx",null);j(this,"pxRatio",1);j(this,"pathCache",new Map);j(this,"bandCache",new Map);j(this,"scaleStamp","");j(this,"snapshotCanvas",null);j(this,"snapshotValid",!1)}setContext(e,n){this.ctx=e,this.pxRatio=n}saveSnapshot(e,n,o){const s=e.canvas;(this.snapshotCanvas==null||this.snapshotCanvas.width!==n||this.snapshotCanvas.height!==o)&&(this.snapshotCanvas=typeof OffscreenCanvas<"u"?new OffscreenCanvas(n,o):document.createElement("canvas"),this.snapshotCanvas.width=n,this.snapshotCanvas.height=o);const r=this.snapshotCanvas.getContext("2d");r!=null&&typeof r.drawImage=="function"&&(r.clearRect(0,0,n,o),r.drawImage(s,0,0),this.snapshotValid=!0)}restoreSnapshot(e){return!this.snapshotValid||this.snapshotCanvas==null||typeof e.drawImage!="function"?!1:(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.drawImage(this.snapshotCanvas,0,0),!0)}invalidateSnapshot(){this.snapshotValid=!1}checkScaleStamp(e){let n="";const o=new Set;for(const s of e)for(const r of[s.xScale,s.yScale])o.has(r.id)||(o.add(r.id),n+=`${r.id}:${r.min}:${r.max};`);n!==this.scaleStamp&&(this.scaleStamp!==""&&this.clearCache(),this.scaleStamp=n)}cacheKey(e,n,o,s){return`${e}:${n}:${o}:${s}`}promote(e,n){this.pathCache.delete(e),this.pathCache.set(e,n)}getCachedPaths(e,n,o,s){const r=this.cacheKey(e,n,o,s),i=this.pathCache.get(r);if(i!=null)return this.promote(r,i),i;const l=`${e}:${n}:`;for(const[c,f]of this.pathCache){if(!c.startsWith(l))continue;const a=c.slice(l.length),d=a.indexOf(":"),u=+a.slice(0,d),h=+a.slice(d+1);if(u<=o&&h>=s)return this.promote(c,f),f}}setCachedPaths(e,n,o,s,r){if(this.pathCache.size>=Pe){const l=Pe>>2,c=this.pathCache.keys();for(let f=0;f<l;f++){const a=c.next().value;a!=null&&this.pathCache.delete(a)}}const i=this.cacheKey(e,n,o,s);this.pathCache.delete(i),this.pathCache.set(i,r)}invalidateSeries(e,n){const o=`${e}:${n}:`;for(const s of this.pathCache.keys())s.startsWith(o)&&this.pathCache.delete(s)}clearGroupCache(e){const n=`${e}:`;for(const o of this.pathCache.keys())o.startsWith(n)&&this.pathCache.delete(o);for(const o of this.bandCache.keys())o.startsWith(n)&&this.bandCache.delete(o);this.invalidateSnapshot()}clearCache(){this.pathCache.clear(),this.bandCache.clear(),this.invalidateSnapshot()}bandKey(e,n,o,s,r){return`${e}:${n}:${o}:${s}:${r}`}getCachedBandPath(e,n,o,s,r){return this.bandCache.get(this.bandKey(e,n,o,s,r))}setCachedBandPath(e,n,o,s,r,i){this.bandCache.set(this.bandKey(e,n,o,s,r),i)}drawSeries(e,n,o){const s=this.ctx;if(s==null||e.config.show===!1)return;const r=e.config.group,i=e.config.index,[l,c]=e.window;let f=this.getCachedPaths(r,i,l,c);if(f==null){const a=e.config.paths??to,d=e.xScale.dir,u=Pn(e.config.pxAlign??0),h=c-l,p=Math.max(1,Math.ceil(h*.1)),w=e.dataX.length,b=Math.max(0,l-p),g=Math.min(w-1,c+p),m=e.config.fillTo;let M;typeof m=="function"?M=m(e.yScale.min??0,e.yScale.max??0):m===0&&e.yScale.distr===K.Log?M=1:M=m,f=a(e.dataX,e.dataY,e.xScale,e.yScale,n.width,n.height,n.left,n.top,b,g,d,u,{fillTo:M,spanGaps:e.config.spanGaps}),this.setCachedPaths(r,i,b,g,f)}Qn(s,e.config,f,o,n)}draw(e,n,o,s){const r=this.ctx;if(r==null)return;const i=this.pxRatio;r.clearRect(0,0,e*i,n*i),r.save(),r.scale(i,i),r.beginPath(),r.rect(o.left,o.top,o.width,o.height),r.clip();for(const l of s)this.drawSeries(l,o,1);r.restore()}}const an=[1,2,2.5,5],no=en(10,-32,0,an),oo=en(10,0,32,an),St=no.concat(oo);function so(t,e,n,o,s){if(n<=0||e<t)return[];const r=[],i=Lt.get(n)??0,l=s?Math.ceil(t/n)*n:at(ae(t,n),i);for(let c=l;c<=e;c=at(c+n,i))r.push(Object.is(c,-0)?0:c);return r}function Zt(t){return t.map(e=>nn(e))}function io(t,e,n){if(t<=0||e<=0||t>=e)return[];const o=[],r=ct((n===10?rt:Pt)(t));let i=bt(n,r);n===10&&(i=St[mt(i,St)]??i);let l=i,c=i*n;n===10&&(c=St[mt(c,St)]??c);let f=0;do{if(l>=t&&o.push(l),l=l+i,n===10&&!Lt.has(l)){const a=Lt.get(i)??0;l=at(l,a)}l>=c*(1-1e-10)&&(i=l,c=i*n,n===10&&(c=St[mt(c,St)]??c))}while(l<=e&&++f<1e4);return o}function ro(t,e,n=1){const o=[];if(Math.max(it(t),it(e))===0)return[0];if(t<0){const i=it(t);let l=bt(10,ct(rt(Math.max(i,n))));for(;l>=n;){const c=-l;c>=t&&c<=e&&o.push(c),l/=10}}if(t<=0&&e>=0&&o.push(0),e>0){let i=n;const l=e;for(;i<=l;)i>=t&&i<=e&&o.push(i),i*=10}o.sort((i,l)=>i-l);const r=[];for(const i of o){const l=r[r.length-1];(r.length===0||l!=null&&it(i-l)>1e-10)&&r.push(i)}return r}function lo(t,e){const n=e===10?rt:Pt;return t.map(o=>{if(o===0)return!0;if(o<0)return!1;const s=n(o);return it(s-Math.round(s))<1e-10})}const co=7,ao=50,uo=16;function fo(t,e){const o=nn(Math.max(Math.abs(t),Math.abs(e))).length*co;return Math.max(ao,o+uo)}function ho(t,e,n,o){if(o<=0)return[0,0];const s=yt(t.side)===$.Vertical,r=t.space??(s?30:fo(e,n)),i=t.incrs??St;return Rn(e,n,i,o,r)}const go=50;function po(t,e,n){var l,c;if(t.size!=null)return t.size;const o=((l=t.ticks)==null?void 0:l.show)!==!1?((c=t.ticks)==null?void 0:c.size)??10:0,s=t.gap??5,r=12;if(yt(t.side)===$.Vertical&&e!=null){let f=0;for(const d of e)d.length>f&&(f=d.length);const a=f*7;return Math.max(50,o+s+a+4)}return Math.max(50,o+s+r+3)}function mo(t){return{config:t,_show:t.show!==!1,_size:t.size??go,_pos:0,_lpos:0,_splits:null,_values:null,_incr:0,_space:0,_rotate:0}}const wo=1,Tt=60,vt=3600,pt=86400,So=604800,Mt=2592e3,Ft=31536e3,vo=[wo,5,10,15,30,Tt,5*Tt,10*Tt,15*Tt,30*Tt,vt,2*vt,3*vt,4*vt,6*vt,12*vt,pt,2*pt,3*pt,7*pt,14*pt,Mt,2*Mt,3*Mt,6*Mt,Ft];function bo(t,e,n){const o=[];if(n<=0||t>=e)return o;let s;if(n>=Ft){const r=new Date(t*1e3);for(r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0),s=r.getTime()/1e3,s<t&&(r.setUTCFullYear(r.getUTCFullYear()+1),s=r.getTime()/1e3);s<=e;)o.push(s),r.setUTCFullYear(r.getUTCFullYear()+Math.round(n/Ft)),s=r.getTime()/1e3;return o}if(n>=Mt){const r=new Date(t*1e3);r.setUTCDate(1),r.setUTCHours(0,0,0,0),s=r.getTime()/1e3;const i=Math.max(1,Math.round(n/Mt));if(s<t&&(r.setUTCMonth(r.getUTCMonth()+1),s=r.getTime()/1e3),i>1){const l=r.getUTCMonth(),c=Math.ceil((l+1)/i)*i;r.setUTCMonth(c-1),s=r.getTime()/1e3}for(;s<=e;)o.push(s),r.setUTCMonth(r.getUTCMonth()+i),s=r.getTime()/1e3;return o}if(n>=pt){const r=new Date(t*1e3);r.setUTCHours(0,0,0,0),s=r.getTime()/1e3,s<t&&(s+=pt)}else s=Math.ceil(t/n)*n;for(let r=0;;r++){const i=s+r*n;if(i>e)break;o.push(i)}return o}const Ee=new Map;function Mo(t,e){const n=JSON.stringify(t)+(e??"");let o=Ee.get(n);return o==null&&(o=new Intl.DateTimeFormat(void 0,{...t,timeZone:e}),Ee.set(n,o)),o}function lt(t,e,n){const o=new Date(t*1e3);return Mo(e,n).format(o)}function xo(t,e){return lt(t,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},e)}function yo(t,e){return lt(t,{year:"numeric",month:"2-digit",day:"2-digit"},e)}function Co(t,e){return lt(t,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},e)}function ko(t,e){return lt(t,{hour:"2-digit",minute:"2-digit",hour12:!1},e)}function To(t,e){return lt(t,{month:"short",day:"numeric"},e)}function Ao(t,e){return lt(t,{year:"numeric"},e)}function Io(t,e){return lt(t,{year:"numeric",month:"short"},e)}function Lo(t,e,n){let o;return e>=Ft?o=Ao:e>=Mt?o=Io:e>=So?o=yo:e>=pt?o=To:e>=vt?o=ko:e>=Tt?o=Co:o=xo,t.map(s=>o(s,n))}function Po(t,e,n,o,s){const r=e-t;if(r<=0||o<=0)return[0,0];for(const l of n){const c=r/l,f=o/c;if(f>=s)return[l,f]}const i=n[n.length-1]??Ft;return[i,o/(r/i)]}const Eo=3;function _o(t,e,n,o,s){let r=!0;for(const i of t){const l=i.config;if(l.show===!1)continue;const c=e(l.scale);if(!c||!U(c)){i._show&&(r=!1,i._show=!1);continue}else i._show||(r=!1,i._show=!0);const f=l.side,d=yt(f)===$.Horizontal?n:o,u=c.min,h=c.max;let p,w;if(c.time){const g=l.space??80;[p,w]=Po(u,h,vo,d,g)}else[p,w]=ho(l,u,h,d);if(c._discrete&&p>0&&p<1&&(p=1),i._incr=p,i._space=w,w===0)continue;if(l.splits)i._splits=l.splits(u,h,p,w);else if(c.time)i._splits=bo(u,h,p);else if(c.distr===K.Log)i._splits=io(u,h,c.log);else if(c.distr===K.Asinh)i._splits=ro(u,h,c.asinh);else{const g=c.distr===K.Ordinal||c._discrete;i._splits=so(u,h,p,w,g)}if(l.values)i._values=l.values(i._splits,w,p);else if(c.time)i._values=Lo(i._splits,p);else if(c.distr===K.Log){const g=lo(i._splits,c.log),m=Zt(i._splits);i._values=m.map((M,S)=>g[S]?M:"")}else c.distr,K.Asinh,i._values=Zt(i._splits);i._rotate=f===N.Bottom?l.rotate??0:0;const b=i._size;i._size=Dt(po(l,i._values)),b!==i._size&&(r=!1)}return r}function _e(t,e,n,o=0){let s=t,r=e-o,i=0,l=o;for(const f of n){if(!f._show)continue;const a=f.config.side,d=yt(a)===$.Vertical,u=f.config.label!=null?f.config.labelSize??20:0,h=f._size+u;h>0&&(d?(s-=h,a===N.Left&&(i+=h)):(r-=h,a===N.Top&&(l+=h)))}return!n.some(f=>f._show&&f.config.side===N.Top)&&l<=o&&(l+=8,r-=8),{left:i,top:l,width:Math.max(s,0),height:Math.max(r,0)}}function Do(t,e){let n=e.top,o=e.left+e.width,s=e.top+e.height,r=e.left;function i(l,c){switch(l){case N.Top:return n-=c,n+c;case N.Right:{const f=o;return o+=c,f}case N.Bottom:{const f=s;return s+=c,f}case N.Left:return r-=c,r+c;default:return 0}}for(const l of t){if(!l._show)continue;const c=l.config.side;if(l._pos=i(c,l._size),l.config.label!=null){const f=l.config.labelSize??20;l._lpos=i(c,f)}}}function Fo(t,e,n,o,s=0){for(const c of n)c._size=0;let r=!1,i=0,l={left:0,top:0,width:t,height:e};for(;!r;){i++;const c=_o(n,o,l.width,l.height);r=i===Eo||c,r||(l=_e(t,e,n,s))}return l=_e(t,e,n,s),Do(n,l),l}const De="top",Fe="bottom",Ro="left",zo="right";function Jt(t,e){return e===1?t:t.replace(/(\d+(?:\.\d+)?)px/,(n,o)=>`${Math.round(Number(o)*e)}px`)}function Re(t,e,n,o,s,r,i,l,c,f,a){const d=l%2/2;t.save(),t.translate(d,d),t.strokeStyle=c,t.lineWidth=l,f.length>0&&t.setLineDash(f),t.beginPath();let u=0,h=0,p=0,w=0;const b=r+(s===N.Top||s===N.Left?-i:i);o===$.Horizontal?(h=r,w=b):(u=r,p=b);for(let g=0;g<e.length;g++)n[g]!=null&&(o===$.Horizontal?u=p=e[g]??0:h=w=e[g]??0,t.moveTo(u,h),t.lineTo(p,w));t.stroke(),t.restore()}function Ho(t,e,n,o,s,r){const i=B(o.left*s),l=B(o.top*s),c=B(o.width*s),f=B(o.height*s);for(const a of e){if(!a._show)continue;const d=a.config,u=d.side,h=yt(u),p=n(d.scale);if(!p||!U(p))continue;const w=d.stroke??"#000",b=u===N.Top||u===N.Left?-1:1,g=a._splits,m=a._values;if(!g||!m||a._space===0)continue;const M=h===$.Horizontal?o.width:o.height,S=h===$.Horizontal?o.left:o.top,_=g.map(L=>B(X(L,p,M,S)*s)),T=m.map(L=>L===""?null:L),x=d.grid;if((x==null?void 0:x.show)!==!1){const L=(x==null?void 0:x.stroke)??"rgba(0,0,0,0.12)",k=B(((x==null?void 0:x.width)??2)*s),D=((x==null?void 0:x.dash)??[]).map(W=>W*s),P=h===$.Horizontal?l:i,F=h===$.Horizontal?f:c;Re(t,_,T,h,2,P,F,k,L,D)}const y=d.ticks;if((y==null?void 0:y.show)!==!1){const L=(y==null?void 0:y.stroke)??w,k=B(((y==null?void 0:y.width)??1)*s),D=B(((y==null?void 0:y.size)??10)*s),P=((y==null?void 0:y.dash)??[]).map(W=>W*s),F=B(a._pos*s);Re(t,_,T,h,u,F,D,k,L,P)}{const L=(y==null?void 0:y.show)!==!1?((y==null?void 0:y.size)??10)*s:0,k=B((d.gap??5)*s),D=B(a._pos*s),P=(L+k)*b,F=D+P,W=Jt(d.font??"12px system-ui, sans-serif",s),v=h===$.Horizontal?"center":u===N.Left?zo:Ro,C=h===$.Horizontal?u===N.Bottom?De:Fe:"middle";t.font=W,t.fillStyle=w,t.textAlign=v,t.textBaseline=C;const E=a._rotate*-Ot/180;if(E!==0){const I=Math.cos(E),H=Math.sin(E);for(let R=0;R<m.length;R++){const G=m[R];if(G==null||G==="")continue;const Y=_[R]??0;t.setTransform(I,H,-H,I,Y,F),t.fillText(G,0,0)}t.setTransform(1,0,0,1,0,0)}else for(let I=0;I<m.length;I++){const H=m[I];if(H==null||H==="")continue;const R=_[I]??0,G=h===$.Horizontal?R:F,Y=h===$.Horizontal?F:R;t.fillText(H,G,Y)}}if(d.label!=null){const L=Jt(d.labelFont??"bold 12px system-ui, sans-serif",s);t.font=L,t.fillStyle=w,t.textAlign="center",t.textBaseline=u===N.Bottom?De:Fe;const k=B((a._lpos+(d.labelGap??0)*b)*s);h===$.Vertical?(t.save(),t.translate(k,B(l+f/2)),t.rotate((u===N.Left?-Ot:Ot)/2),t.fillText(d.label,0,0),t.restore()):t.fillText(d.label,B(i+c/2),k)}const A=d.border;if((A==null?void 0:A.show)!==!1&&A!=null){const L=A.stroke??w,k=B((A.width??1)*s),D=(A.dash??[]).map(F=>F*s),P=B(a._pos*s);t.strokeStyle=L,t.lineWidth=k,D.length>0&&t.setLineDash(D),t.beginPath(),h===$.Horizontal?(t.moveTo(i,P),t.lineTo(i+c,P)):(t.moveTo(P,l),t.lineTo(P,l+f)),t.stroke(),D.length>0&&t.setLineDash([])}}if(r!=null){const a=Jt("bold 14px system-ui, sans-serif",s);t.font=a,t.fillStyle="#000",t.textAlign="center",t.textBaseline="top",t.fillText(r,B(i+c/2),B(4*s))}}const Wo=2,$o="#fff",Go={stroke:"#607D8B",width:1,dash:[5,3],pointRadius:4,showX:!0,showY:!0};function ze(t,e,n,o,s,r,i,l,c,f){var S;if(e.left<0||e.top<0)return;const a={...Go,...c},d=o,u=B(n.left*d),h=B(n.top*d),p=B(n.width*d),w=B(n.height*d),b=B(a.width*d),g=b%2/2,m=B((n.left+e.left)*d)+g,M=B((n.top+e.top)*d)+g;if(t.save(),t.strokeStyle=a.stroke,t.lineWidth=b,t.setLineDash(a.dash.map(_=>_*d)),a.showX&&(t.beginPath(),t.moveTo(m,h),t.lineTo(m,h+w),t.stroke()),a.showY&&(t.beginPath(),t.moveTo(u,M),t.lineTo(u+p,M),t.stroke()),t.setLineDash([]),e.activeGroup>=0&&e.activeDataIdx>=0){const _=e.activeGroup,T=e.activeSeriesIdx,x=e.activeDataIdx,y=s[_];if(y!=null&&T>=0&&T<y.series.length&&x<y.x.length){const A=y.x[x],L=y.series[T],k=L!=null?L[x]:null;if(A!=null&&k!=null){let D=a.stroke,P=!0;const F=f==null?void 0:f.get(`${_}:${T}`);if(F!=null){const W=F.stroke;D=(typeof W=="string"?W:void 0)??a.stroke,P=((S=F.cursor)==null?void 0:S.show)!==!1}if(P){const W=l(_),v=W!=null?i(W):void 0,C=(F==null?void 0:F.yScale)??Vo(r,_,T),E=C!=null?i(C):void 0;if(v!=null&&E!=null&&U(v)&&U(E)){const I=B(X(A,v,n.width,n.left)*d),H=B(X(k,E,n.height,n.top)*d),R=a.pointRadius*d,G=B(Wo*d);t.beginPath(),t.arc(I,H,R,0,Math.PI*2),t.fillStyle=$o,t.fill(),t.strokeStyle=D,t.lineWidth=G,t.stroke()}}}}}t.restore()}function Vo(t,e,n){for(const o of t)if(o.group===e&&o.index===n)return o.yScale}const Bo={fill:"rgba(0,0,0,0.07)",stroke:"rgba(0,0,0,0.15)",width:1};function He(t,e,n,o,s){if(!e.show||e.width<=0)return;const r={...Bo,...s},i=o,l=B((n.left+e.left)*i),c=B((n.top+e.top)*i),f=B(e.width*i),a=B(e.height*i);t.save(),t.fillStyle=r.fill,t.fillRect(l,c,f,a),r.width>0&&(t.strokeStyle=r.stroke,t.lineWidth=B(r.width*i),t.strokeRect(l,c,f,a)),t.restore()}function Xo(t,e,n,o,s,r,i,l,c,f,a,d){const u=a/2*i,h=Math.max(1,B(a*.2))*i,p=(f==null?void 0:f.stroke)??d,w=(f==null?void 0:f.fill)??"#fff";t.save(),t.strokeStyle=p,t.fillStyle=w,t.lineWidth=h,(f==null?void 0:f.dash)!=null&&t.setLineDash(f.dash.map(b=>b*i));for(let b=l;b<=c;b++){const g=n[b];if(g==null)continue;const m=e[b];if(m==null)continue;const M=B(X(m,o,r.width,r.left)*i),S=B(X(g,s,r.height,r.top)*i);t.beginPath(),t.arc(M,S,u,0,Math.PI*2),t.fill(),t.stroke()}t.restore()}function jo(t,e,n,o,s,r,i){if(typeof t=="function")return t(e,n,o,s,r);if(t===!0)return!0;if(t===!1)return!1;const l=s-o;return l>0&&l<=r/i}function Yo(t,e,n,o,s,r,i,l,c){if(l>c||l<0||!Te(e,l,c)&&!Te(n,l,c))return null;const f=h=>X(h,o,r.width,r.left)*i,a=h=>X(h,s,r.height,r.top)*i,d=new Path2D;let u=!1;for(let h=l;h<=c;h++){const p=e[h],w=t[h];if(p==null||w==null)continue;const b=f(w),g=a(p);u?d.lineTo(b,g):(d.moveTo(b,g),u=!0)}if(!u)return null;for(let h=c;h>=l;h--){const p=n[h],w=t[h];p==null||w==null||d.lineTo(f(w),a(p))}return d.closePath(),d}function No(t,e,n){t.save(),t.fillStyle=e.fill??"rgba(0, 120, 255, 0.1)",t.fill(n),t.restore()}function Uo(t){const e=t.dataStore.data;if(e.length===0)return;if(!t.scaleManager.getScale("x")){const i={id:"x",auto:!0};t.scaleConfigs.push(i),t.scaleManager.addScale(i)}for(let i=0;i<e.length;i++)t.scaleManager.getGroupXScaleKey(i)||t.scaleManager.setGroupXScale(i,"x");const n=new Set(t.scaleConfigs.map(i=>i.id)),o=new Set;for(const i of t.seriesConfigs)o.add(i.yScale);o.size===0&&!n.has("y")&&o.add("y");for(const i of o)if(!n.has(i)){const l={id:i,auto:!0};t.scaleConfigs.push(l),t.scaleManager.addScale(l),n.add(i)}t.axisConfigs.some(i=>i.scale==="x")||t.axisConfigs.push({scale:"x",side:N.Bottom,show:!0,label:t.xlabel??"X Axis"});const r=new Set(t.axisConfigs.map(i=>i.scale));for(const i of o)r.has(i)||(t.axisConfigs.push({scale:i,side:N.Left,show:!0,label:t.ylabel??"Y Axis"}),r.add(i))}function Qt(t,e,n,o){return{ctx:t,plotBox:e,pxRatio:n,getScale:o,valToX:(i,l="x")=>{const c=o(l);return c==null||!U(c)?null:X(i,c,e.width,e.left)},valToY:(i,l)=>{const c=o(l);return c==null||!U(c)?null:X(i,c,e.height,e.top)}}}const Oo={left:-10,top:-10,activeGroup:-1,activeSeriesIdx:-1,activeDataIdx:-1,plotLeft:0,plotTop:0,plotWidth:0,plotHeight:0,seriesCount:0,revision:-1};function We(t){const{left:e,top:n,activeGroup:o,activeSeriesIdx:s,activeDataIdx:r}=t.cursorManager.state,{left:i,top:l,width:c,height:f}=t.plotBox,a=t.seriesConfigs.length,{revision:d}=t,u=t.snapshot;u.left===e&&u.top===n&&u.activeGroup===o&&u.activeSeriesIdx===s&&u.activeDataIdx===r&&u.plotLeft===i&&u.plotTop===l&&u.plotWidth===c&&u.plotHeight===f&&u.seriesCount===a&&u.revision===d||(t.snapshot={left:e,top:n,activeGroup:o,activeSeriesIdx:s,activeDataIdx:r,plotLeft:i,plotTop:l,plotWidth:c,plotHeight:f,seriesCount:a,revision:d})}function te(t){t.seriesConfigMap.clear();for(const e of t.seriesConfigs)t.seriesConfigMap.set(`${e.group}:${e.index}`,e)}function Ko(){const t={scaleManager:new $n,dataStore:new Bn,renderer:new eo,cursorManager:new Xn,selectState:{show:!1,left:0,top:0,width:0,height:0},scaleConfigs:[],seriesConfigs:[],axisConfigs:[],bandConfigs:[],axisStates:[],width:0,height:0,pxRatio:typeof window<"u"&&window.devicePixelRatio||1,plotBox:{left:0,top:0,width:0,height:0},canvas:null,listeners:new Set,cursorListeners:new Set,scheduler:new jn,drawHooks:new Set,cursorDrawHooks:new Set,focusedSeries:null,focusAlpha:1,actionMap:new Map(Gt),title:void 0,xlabel:void 0,ylabel:void 0,snapshot:Oo,revision:0,eventCallbacks:{},_prevScaleRanges:new Map,seriesConfigMap:new Map,registerScale(e){t.scaleConfigs=t.scaleConfigs.filter(n=>n.id!==e.id),t.scaleConfigs.push(e),t.scaleManager.addScale(e)},unregisterScale(e){t.scaleConfigs=t.scaleConfigs.filter(n=>n.id!==e),t.scaleManager.removeScale(e)},registerSeries(e){t.seriesConfigs=t.seriesConfigs.filter(n=>!(n.group===e.group&&n.index===e.index)),t.seriesConfigs.push(e),te(t),t.renderer.clearGroupCache(e.group)},unregisterSeries(e,n){t.seriesConfigs=t.seriesConfigs.filter(o=>!(o.group===e&&o.index===n)),te(t),t.renderer.clearGroupCache(e)},toggleSeries(e,n){const o=t.seriesConfigMap.get(`${e}:${n}`);o!=null&&(o.show=o.show===!1,t.revision++,t.cursorManager.invalidateGroupedConfigs(),t.renderer.invalidateSeries(e,n),t.renderer.invalidateSnapshot(),t.scheduleRedraw())},setFocus(e){t.focusedSeries=e,t.scheduleRedraw()},setSize(e,n){t.width===e&&t.height===n||(t.width=e,t.height=n,t.canvas&&(t.canvas.width=e*t.pxRatio,t.canvas.height=n*t.pxRatio,t.canvas.style.width=`${e}px`,t.canvas.style.height=`${n}px`),t.renderer.clearCache())},scheduleRedraw(){t.scheduler.mark(st.Full)},scheduleCursorRedraw(){t.scheduler.mark(st.Cursor)},subscribe(e){return t.listeners.add(e),()=>{t.listeners.delete(e)}},subscribeCursor(e){return t.cursorListeners.add(e),()=>{t.cursorListeners.delete(e)}},redraw(){const{scaleManager:e,dataStore:n,renderer:o,seriesConfigs:s,width:r,height:i,pxRatio:l,canvas:c,scheduler:f}=t;if(c==null||r===0||i===0)return;const a=c.getContext("2d");if(a==null)return;o.setContext(a,l);const u=(f.dirty&~(st.Cursor|st.Select))===0,h=g=>e.getScale(g);if(u&&o.restoreSnapshot(a)){if(ze(a,t.cursorManager.state,t.plotBox,l,n.data,s,h,g=>e.getGroupXScaleKey(g),void 0,t.seriesConfigMap),He(a,t.selectState,t.plotBox,l),t.cursorDrawHooks.size>0){a.save(),a.scale(l,l);const g=Qt(a,t.plotBox,l,h);for(const m of t.cursorDrawHooks)try{m(g,t.cursorManager.state)}catch(M){console.warn("[uPlot+] draw hook error:",M)}a.restore()}We(t);for(const g of t.cursorListeners)g();return}Uo(t),e.autoRangeX(n.data),n.updateWindows(g=>{const m=e.getGroupXScaleKey(g);return m!=null?e.getScale(m):void 0});const p=s.map(g=>({group:g.group,index:g.index,yScale:g.yScale}));if(e.autoRange(n.data,p,n),qo(t),t.axisStates.length>0){const g=t.title!=null?20:0;t.plotBox=Fo(r,i,t.axisStates,h,g)}else t.plotBox={left:10,top:10,width:r-20,height:i-20};a.clearRect(0,0,r*l,i*l),t.axisStates.length>0&&Ho(a,t.axisStates,h,t.plotBox,l,t.title);const w=[];for(const g of s){const m=e.getGroupXScaleKey(g.group),M=m!=null?e.getScale(m):void 0,S=e.getScale(g.yScale);M==null||S==null||w.push({config:g,dataX:n.getXValues(g.group),dataY:n.getYValues(g.group,g.index),xScale:M,yScale:S,window:n.getWindow(g.group)})}o.checkScaleStamp(w),a.save(),a.scale(l,l),a.beginPath(),a.rect(t.plotBox.left,t.plotBox.top,t.plotBox.width,t.plotBox.height),a.clip();for(let g=0;g<w.length;g++){const m=w[g];m!=null&&(t.focusedSeries!=null&&g!==t.focusedSeries?(a.globalAlpha=t.focusAlpha,o.drawSeries(m,t.plotBox,1),a.globalAlpha=1):o.drawSeries(m,t.plotBox,1))}const b=new Map;for(const g of s)b.set(`${g.group}-${g.index}`,g);for(const g of t.bandConfigs){const m=e.getGroupXScaleKey(g.group),M=m!=null?e.getScale(m):void 0,S=b.get(`${g.group}-${g.series[0]}`),_=b.get(`${g.group}-${g.series[1]}`);if(M==null||S==null||_==null)continue;const T=e.getScale(S.yScale);if(T==null)continue;const[x,y]=n.getWindow(g.group),A=g.series[0],L=g.series[1];let k=o.getCachedBandPath(g.group,A,L,x,y);k==null&&(k=Yo(n.getXValues(g.group),n.getYValues(g.group,A),n.getYValues(g.group,L),M,T,t.plotBox,l,x,y)??void 0,k!=null&&o.setCachedBandPath(g.group,A,L,x,y,k)),k!=null&&No(a,g,k)}for(const g of w){const m=g.config;if(m.show===!1)continue;const M=m.points,S=m.width??1,_=(M==null?void 0:M.size)??3+S*2,T=(M==null?void 0:M.space)??_*2,[x,y]=g.window;jo(M==null?void 0:M.show,m.group,m.index,x,y,t.plotBox.width,T)&&Xo(a,g.dataX,g.dataY,g.xScale,g.yScale,t.plotBox,l,x,y,M,_,(typeof m.stroke=="string"?m.stroke:null)??"#000")}if(a.restore(),t.drawHooks.size>0){a.save(),a.beginPath(),a.rect(t.plotBox.left*l,t.plotBox.top*l,t.plotBox.width*l,t.plotBox.height*l),a.clip(),a.scale(l,l);const g=Qt(a,t.plotBox,l,h);for(const m of t.drawHooks)try{m(g)}catch(M){console.warn("[uPlot+] draw hook error:",M)}a.restore()}if(t.cursorManager.state.left>=0&&(o.saveSnapshot(a,r*l,i*l),t.cursorManager.update(t.cursorManager.state.left,t.cursorManager.state.top,t.plotBox,n.data,s,h,g=>n.getWindow(g),g=>e.getGroupXScaleKey(g))),ze(a,t.cursorManager.state,t.plotBox,l,n.data,s,h,g=>e.getGroupXScaleKey(g),void 0,t.seriesConfigMap),He(a,t.selectState,t.plotBox,l),t.cursorDrawHooks.size>0){a.save(),a.scale(l,l);const g=Qt(a,t.plotBox,l,h);for(const m of t.cursorDrawHooks)try{m(g,t.cursorManager.state)}catch(M){console.warn("[uPlot+] draw hook error:",M)}a.restore()}We(t);for(const g of t.listeners)g();for(const g of t.cursorListeners)g();if(t._prevScaleRanges.size>0&&t.eventCallbacks.onScaleChange!=null)for(const g of e.getAllScales()){if(!U(g))continue;const m=t._prevScaleRanges.get(g.id);if(m==null||m.min!==g.min||m.max!==g.max)try{t.eventCallbacks.onScaleChange(g.id,g.min,g.max)}catch(M){console.warn("[uPlot+] event callback error:",M)}}t._prevScaleRanges.clear();for(const g of e.getAllScales())U(g)&&t._prevScaleRanges.set(g.id,{min:g.min,max:g.max})},getSnapshot:()=>t.snapshot,updateScale(e){t.scaleConfigs=t.scaleConfigs.map(n=>n.id===e.id?e:n),t.scaleManager.addScale(e),t.renderer.clearCache()},updateSeries(e){t.seriesConfigs=t.seriesConfigs.map(n=>n.group===e.group&&n.index===e.index?e:n),te(t),t.renderer.invalidateSeries(e.group,e.index)},registerAxis(e){t.axisConfigs=t.axisConfigs.filter(n=>!(n.scale===e.scale&&n.side===e.side)),t.axisConfigs.push(e)},unregisterAxis(e,n){t.axisConfigs=t.axisConfigs.filter(o=>!(o.scale===e&&o.side===n))},updateAxis(e){t.axisConfigs=t.axisConfigs.map(n=>n.scale===e.scale&&n.side===e.side?e:n)},registerBand(e){t.bandConfigs.push(e)},unregisterBand(e){t.bandConfigs=t.bandConfigs.filter(n=>n!==e)},setData(e){t.dataStore.setData(e),t.renderer.clearCache()},setCanvas(e){t.canvas=e},setLabels(e,n,o){t.title=e,t.xlabel=n,t.ylabel=o},redrawSync(){t.scheduler.cancel(),t.scheduler.mark(st.Full),t.redraw(),t.scheduler.clear()}};return t.scheduler.onRedraw(()=>t.redraw()),t}function qo(t){const{axisConfigs:e,axisStates:n}=t,o=new Map;for(const s of n)o.set(`${s.config.scale}:${s.config.side}`,s);t.axisStates=e.map(s=>{const r=`${s.scale}:${s.side}`,i=o.get(r);return i!=null?(i.config=s,i):mo(s)})}function Zo(){const t=z.useRef(null);return t.current===null&&(t.current=Ko()),t.current}const un=z.createContext(null);function ot(){const t=z.useContext(un);if(!t)throw new Error("useChart must be used within a <Chart> component");return t}function Jo(t="cursor"){const e=ot(),n=t==="full"?e.subscribe:e.subscribeCursor,o=z.useSyncExternalStore(n,e.getSnapshot);return{left:o.left,top:o.top,activeGroup:o.activeGroup,activeSeriesIdx:o.activeSeriesIdx,activeDataIdx:o.activeDataIdx,plotLeft:o.plotLeft,plotTop:o.plotTop,plotWidth:o.plotWidth,plotHeight:o.plotHeight,seriesCount:o.seriesCount,revision:o.revision,getScale:s=>e.scaleManager.getScale(s),getPlotBox:()=>e.plotBox,getSeriesConfigs:()=>e.seriesConfigs,getDataX:s=>e.dataStore.getXValues(s),getDataY:(s,r)=>e.dataStore.getYValues(s,r),toggleSeries:(s,r)=>e.toggleSeries(s,r),setFocus:s=>e.setFocus(s)}}const $e=5,fn=.001,Qo=.1,ts=10;function de(t,e){const n=t.shiftKey?"shift":t.altKey?"alt":t.ctrlKey?"ctrl":"",o=t.button===1?"Middle":t.button===2?"Right":"Left";return n?`${n}${o}${e}`:`${o.toLowerCase()}${e}`}function es(t){return de(t,"Drag")}function ns(t){return de(t,"Click")}function os(t){return de(t,"Dblclick")}function ss(t){const e=t.shiftKey?"shift":t.altKey?"alt":t.ctrlKey?"ctrl":"";return e?`${e}Wheel`:"wheel"}function is(t){const e=t.shiftKey?"shift":t.altKey?"alt":t.ctrlKey?"ctrl":"",n=t.key.length===1?t.key.toUpperCase():t.key;return e?`${e}Key${n}`:`key${n}`}function rs(t,e,n,o,s=!0){const r=t.get(e);if(r!=null)return r;if(s){for(const[i,l]of t)if(typeof i=="function"&&i(n,o))return l}}function ls(t,e){const n=[];for(const o of t.scaleManager.getAllScales())U(o)&&(e!=null&&!e(o.ori)||n.push({id:o.id,ori:o.ori,startMin:o.min,startMax:o.max}));return n}function Et(t){const e=t.eventCallbacks.onScaleChange;if(e!=null)for(const n of t.scaleManager.getAllScales()){if(!U(n))continue;const o=t._prevScaleRanges.get(n.id);(o==null||o.min!==n.min||o.max!==n.max)&&e(n.id,n.min,n.max)}}function ee(t,e,n,o){if(!(e instanceof WheelEvent))return;const s=Q(1-e.deltaY*fn,Qo,ts),r=t.plotBox;for(const i of t.scaleManager.getAllScales()){if(!U(i)||!o(i.ori))continue;const l=i.ori===$.Horizontal,c=l?r.width:r.height,f=l?r.left:r.top,a=l?n.cx+r.left:n.cy+r.top,d=ft(a,i,c,f),u=d-(d-i.min)*s,h=d+(i.max-d)*s;i.min=Math.min(u,h),i.max=Math.max(u,h),i.auto=!1,ut(i)}t.scheduleRedraw(),Et(t)}function ne(t,e,n){const o={show:!1,left:0,top:0,width:0,height:0},s=e.cx,r=e.cy;return{onMove(i,l,c){const f=t.plotBox,a=Q(c.cx,0,f.width),d=Q(c.cy,0,f.height);o.show=!0,o.left=Math.min(s,a),o.top=Math.min(r,d),o.width=Math.abs(a-s),o.height=Math.abs(d-r),n($.Vertical)||(o.top=0,o.height=f.height),n($.Horizontal)||(o.left=0,o.width=f.width),t.selectState=o,t.scheduler.mark(st.Cursor|st.Select)},onEnd(i,l,c){const f=n($.Horizontal)&&o.width>$e,a=n($.Vertical)&&o.height>$e;if(f||a){let d=!0;if(t.eventCallbacks.onSelect!=null){const u=us(t,o);let h;try{h=t.eventCallbacks.onSelect(u)}catch(p){console.warn("[uPlot+] event callback error:",p)}h===!1&&(d=!1)}d&&(cs(t,o,n),Et(t))}o.show=!1,o.left=0,o.width=0,t.selectState=o,t.scheduleRedraw()}}}function cs(t,e,n){const o=t.plotBox;for(const s of t.scaleManager.getAllScales()){if(!U(s)||!n(s.ori))continue;const r=s.ori===$.Horizontal,i=r?o.width:o.height,l=r?o.left:o.top,c=r?e.left:e.top,f=r?e.width:e.height,a=c/i,d=(c+f)/i,u=ft(l+a*i,s,i,l),h=ft(l+d*i,s,i,l);s.min=Math.min(u,h),s.max=Math.max(u,h),s.auto=!1,ut(s)}}function oe(t,e,n,o){const s=ls(t,n),r=e.clientX,i=e.clientY;return{onMove(l,c){const f=t.plotBox,a=c;for(const d of s){const u=t.scaleManager.getScale(d.id);if(u==null)continue;const h=d.ori===$.Horizontal,p=h?f.width:f.height,w=h?a.clientX-r:a.clientY-i,b=h?-1:1,g=d.startMax-d.startMin;u.min=d.startMin+b*(w/p)*g,u.max=d.startMax+b*(w/p)*g,u.auto=!1,ut(u)}t.renderer.clearCache(),t.scheduleRedraw()},onEnd(){Et(t)}}}function Ge(t,e,n){var a;if(n.scaleId==null||n.ori==null)return;const o=t.scaleManager.getScale(n.scaleId);if(o==null||!U(o))return;const s=n.ori===$.Vertical,r=(a=e.target.closest("div"))==null?void 0:a.getBoundingClientRect();if(r==null)return;const i=s?e.clientY-r.top:e.clientX-r.left,l=o.min,c=o.max,f=n.scaleId;return{onMove(d,u){const h=t.plotBox,p=u,w=s?h.height:h.width,g=((s?p.clientY-r.top:p.clientX-r.left)-i)/w,m=s?1:-1,M=c-l,S=t.scaleManager.getScale(f);S!=null&&(S.min=l+m*g*M,S.max=c+m*g*M,S.auto=!1,ut(S),t.renderer.clearCache(),t.scheduleRedraw())},onEnd(){Et(t)}}}function se(t,e,n){if(!(e instanceof WheelEvent))return;const o=e.deltaY*fn*10;for(const s of t.scaleManager.getAllScales()){if(!U(s)||!n(s.ori))continue;const r=s.max-s.min;s.min+=o*r,s.max+=o*r,s.auto=!1,ut(s)}t.renderer.clearCache(),t.scheduleRedraw(),Et(t)}const Ht=t=>t===$.Horizontal,Wt=t=>t===$.Vertical,$t=()=>!0;function as(t){switch(t){case"zoomX":return(e,n,o)=>{if(n instanceof WheelEvent){ee(e,n,o,Ht);return}return ne(e,o,Ht)};case"zoomY":return(e,n,o)=>{if(n instanceof WheelEvent){ee(e,n,o,Wt);return}return ne(e,o,Wt)};case"zoomXY":return(e,n,o)=>{if(n instanceof WheelEvent){ee(e,n,o,$t);return}return ne(e,o,$t)};case"panX":return(e,n,o)=>{if(n instanceof WheelEvent){se(e,n,Ht);return}return o.scaleId!=null?Ge(e,n,o):oe(e,n,Ht)};case"panY":return(e,n,o)=>{if(n instanceof WheelEvent){se(e,n,Wt);return}return o.scaleId!=null?Ge(e,n,o):oe(e,n,Wt)};case"panXY":return(e,n,o)=>{if(n instanceof WheelEvent){se(e,n,$t);return}return oe(e,n,$t)};case"reset":return e=>{for(const n of e.scaleConfigs)e.scaleManager.addScale(n);e.renderer.clearCache(),e.scheduleRedraw()};case"none":return()=>{};default:return}}function Ve(t){return typeof t=="function"?t:as(t)}function us(t,e){const n=t.plotBox,o=e.left/n.width,s=(e.left+e.width)/n.width,r={};for(const i of t.scaleManager.getAllScales()){if(i.ori!==$.Horizontal||!U(i))continue;const l=ft(n.left+o*n.width,i,n.width,n.left),c=ft(n.left+s*n.width,i,n.width,n.left);r[i.id]={min:Math.min(l,c),max:Math.max(l,c)}}return{left:o,right:s,ranges:r}}function fs(t,e){z.useEffect(()=>{if(e!=null)return hs(t,e)},[t,e])}function hs(t,e){let n=null,o=!1,s=null,r=-1,i=-1;function l(v){const C=e.getBoundingClientRect(),E=t.plotBox;return{cx:v.clientX-C.left-E.left,cy:v.clientY-C.top-E.top}}function c(v,C){const E=t.plotBox;return v>=0&&v<=E.width&&C>=0&&C<=E.height}function f(v,C){const E=e.getBoundingClientRect(),I=v-E.left,H=C-E.top,R=t.plotBox;for(const G of t.axisStates){const Y=G.config,q=Y.side;if(G._size<=0)continue;const nt=H>=R.top&&H<=R.top+R.height,Z=I>=R.left&&I<=R.left+R.width;if(q===N.Left&&I<R.left&&nt||q===N.Right&&I>R.left+R.width&&nt||q===N.Top&&H<R.top&&Z||q===N.Bottom&&H>R.top+R.height&&Z)return{scaleId:Y.scale,ori:yt(q)}}return null}function a(v){const{cx:C,cy:E}=l(v);return{cx:C,cy:E,inPlot:c(C,E)}}function d(v){if(n==null){p();return}e.contains(v.target)||(o=!0,n.onMove(t,v,a(v)),m(v,v))}function u(v){p(),n!=null&&(e.contains(v.target)||(n.onEnd(t,v,a(v)),n=null,r=-1,i=-1,t.cursorManager.hide(),t.focusedSeries!=null&&t.setFocus(null),t.scheduleCursorRedraw()))}function h(){document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}function p(){document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)}function w(){n!=null&&(n=null,p(),t.cursorManager.hide(),t.scheduleCursorRedraw())}function b(v,C,E){const I=t.cursorManager.state;let H=null;if(I.activeGroup>=0&&I.activeDataIdx>=0){const R=t.dataStore.data[I.activeGroup];if(R!=null){const G=R.x[I.activeDataIdx],Y=R.series[I.activeSeriesIdx],q=Y!=null?Y[I.activeDataIdx]:void 0;if(G!=null&&q!=null){const tt=t.plotBox,nt=t.scaleManager.getGroupXScaleKey(I.activeGroup),Z=nt!=null?t.scaleManager.getScale(nt):void 0,ht=t.seriesConfigMap.get(`${I.activeGroup}:${I.activeSeriesIdx}`),Ct=ht!=null?t.scaleManager.getScale(ht.yScale):void 0;let kt=C,Ut=E;Z!=null&&U(Z)&&(kt=X(G,Z,tt.width,tt.left)-tt.left),Ct!=null&&U(Ct)&&(Ut=X(q,Ct,tt.height,tt.top)-tt.top);const ye=C-kt,Ce=E-Ut;H={group:I.activeGroup,seriesIdx:I.activeSeriesIdx,dataIdx:I.activeDataIdx,xVal:G,yVal:q,pxX:kt,pxY:Ut,dist:Math.sqrt(ye*ye+Ce*Ce)}}}}return{plotX:C,plotY:E,point:H,srcEvent:v}}function g(v,C,E,I=!0){const H=rs(t.actionMap,v,C,E,I);if(!(H==null||H==="none"))return Ve(H)}function m(v,C){const{cx:E,cy:I}=l(v);if(!c(E,I)&&n==null){r=-1,i=-1,t.cursorManager.hide(),t.focusedSeries!=null&&t.setFocus(null),t.scheduleCursorRedraw();return}const H=E!==r||I!==i;if(r=E,i=I,t.cursorManager.update(E,I,t.plotBox,t.dataStore.data,t.seriesConfigs,R=>t.scaleManager.getScale(R),R=>t.dataStore.getWindow(R),R=>t.scaleManager.getGroupXScaleKey(R)),H){const R={cx:E,cy:I,inPlot:c(E,I)},G=t.actionMap.get("hover");if(G!=null&&G!=="none"){const Y=Ve(G);if(Y!=null&&Y(t,C??v,R),t.focusAlpha<1){const q=t.cursorManager.state;if(q.activeGroup>=0&&q.activeSeriesIdx>=0){const tt=t.seriesConfigs.findIndex(nt=>nt.group===q.activeGroup&&nt.index===q.activeSeriesIdx);tt>=0&&t.focusedSeries!==tt&&(t.focusedSeries=tt,t.scheduleRedraw())}}}}if(C!=null&&t.eventCallbacks.onCursorMove!=null&&c(E,I))try{t.eventCallbacks.onCursorMove(b(C,E,I))}catch(R){console.warn("[uPlot+] event callback error:",R)}t.scheduleCursorRedraw()}function M(){document.activeElement!==e&&e.focus()}function S(v){const C=a(v),E=f(v.clientX,v.clientY);let I;if(E!=null&&v.button===0)I=E.ori===$.Horizontal?"xGutterDrag":"yGutterDrag",C.scaleId=E.scaleId,C.ori=E.ori;else if(I=es(v),!C.inPlot)return;C.action=I;const H=g(I,v,C,!1);if(H==null)return;(v.button!==0||E!=null)&&v.preventDefault();const R=H(t,v,C);R!=null&&(n=R,o=!1,h())}function _(v){if(n!=null){o=!0,n.onMove(t,v,a(v)),m(v,v);return}m(v,v)}function T(v){if(n!=null){n.onEnd(t,v,a(v)),n=null;return}}function x(v){if(o){o=!1;return}const C=a(v);if(!C.inPlot)return;const E=ns(v);C.action=E;const I=g(E,v,C);I!=null&&I(t,v,C);const H=t.eventCallbacks.onClick;if(H!=null)try{H(b(v,C.cx,C.cy))}catch(R){console.warn("[uPlot+] event callback error:",R)}}function y(v){if(n!=null){v.preventDefault();return}const C=a(v);if(!C.inPlot)return;v.preventDefault(),C.action="rightClick";const E=g("rightClick",v,C);E!=null&&E(t,v,C);const I=t.eventCallbacks.onContextMenu;if(I!=null)try{I(b(v,C.cx,C.cy))}catch(H){console.warn("[uPlot+] event callback error:",H)}}function A(v){var C,E;if(n==null){r=-1,i=-1,t.cursorManager.hide(),t.focusedSeries!=null&&t.setFocus(null),t.scheduleCursorRedraw();try{(E=(C=t.eventCallbacks).onCursorLeave)==null||E.call(C)}catch(I){console.warn("[uPlot+] event callback error:",I)}}}function L(v){const C=a(v);if(!C.inPlot)return;if(t.eventCallbacks.onDblClick!=null){let H;try{H=t.eventCallbacks.onDblClick(b(v,C.cx,C.cy))}catch(R){console.warn("[uPlot+] event callback error:",R)}if(H===!1)return}const E=os(v);C.action=E;const I=g(E,v,C,!1);I!=null&&I(t,v,C)}function k(v){const C=a(v);if(!C.inPlot)return;const E=ss(v);C.action=E;const I=g(E,v,C);I!=null&&(v.preventDefault(),I(t,v,C))}function D(v){if(v.touches.length===2){const R=v.touches[0],G=v.touches[1],Y=G.clientX-R.clientX,q=G.clientY-R.clientY;s={dist:Math.sqrt(Y*Y+q*q),midX:(R.clientX+G.clientX)/2,midY:(R.clientY+G.clientY)/2},n=null;return}const C=v.touches[0];if(C==null)return;const E=a(C);if(!E.inPlot)return;const I=g("touchDrag",v,E);if(I==null)return;const H=I(t,v,E);H!=null&&(n=H,o=!1)}function P(v){if(v.touches.length===2&&s!=null){v.preventDefault();const E=v.touches[0],I=v.touches[1],H=I.clientX-E.clientX,R=I.clientY-E.clientY,G=Math.sqrt(H*H+R*R),Y=a({clientX:s.midX,clientY:s.midY});if(g("pinch",v,Y)!=null){const tt=G/s.dist,nt=t.plotBox;for(const Z of t.scaleManager.getAllScales()){if(Z.ori!==$.Horizontal||!U(Z))continue;const ht=ft(Y.cx+nt.left,Z,nt.width,nt.left),Ct=ht-(ht-Z.min)/tt,kt=ht+(Z.max-ht)/tt;Z.min=Math.min(Ct,kt),Z.max=Math.max(Ct,kt),Z.auto=!1,ut(Z)}s.dist=G,t.renderer.clearCache(),t.scheduleRedraw(),Et(t)}return}const C=v.touches[0];if(C!=null){if(n!=null){o=!0,n.onMove(t,v,a(C)),m(C,v),v.preventDefault();return}m(C,v)}}function F(v){if(s!=null){s=null;return}const C=v.changedTouches[0];C!=null&&n!=null&&(n.onEnd(t,v,a(C)),n=null)}function W(v){const C={cx:r,cy:i,inPlot:r>=0&&i>=0},E=is(v);C.action=E;const I=g(E,v,C);I!=null&&(v.preventDefault(),I(t,v,C))}return e.addEventListener("mouseenter",M),e.addEventListener("mousemove",_),e.addEventListener("mousedown",S),e.addEventListener("mouseup",T),e.addEventListener("click",x),e.addEventListener("contextmenu",y),e.addEventListener("mouseleave",A),e.addEventListener("dblclick",L),e.addEventListener("wheel",k,{passive:!1}),e.addEventListener("touchstart",D,{passive:!0}),e.addEventListener("touchmove",P,{passive:!1}),e.addEventListener("touchend",F),e.addEventListener("keydown",W),window.addEventListener("blur",w),()=>{p(),e.removeEventListener("mouseenter",M),e.removeEventListener("mousemove",_),e.removeEventListener("mousedown",S),e.removeEventListener("mouseup",T),e.removeEventListener("click",x),e.removeEventListener("contextmenu",y),e.removeEventListener("mouseleave",A),e.removeEventListener("dblclick",L),e.removeEventListener("wheel",k),e.removeEventListener("touchstart",D),e.removeEventListener("touchmove",P),e.removeEventListener("touchend",F),e.removeEventListener("keydown",W),window.removeEventListener("blur",w)}}const re=new Map;function ds(t){let e=re.get(t);return e==null&&(e=new gs(t),re.set(t,e)),e}class gs{constructor(e){j(this,"key");j(this,"members",new Set);j(this,"publishing",!1);j(this,"syncedStores",new WeakSet);this.key=e}join(e){this.members.add(e)}leave(e){this.members.delete(e),this.members.size===0&&re.delete(this.key)}pub(e){if(this.publishing)return;if(this.syncedStores.has(e)){this.syncedStores.delete(e);return}this.publishing=!0;const n=e.cursorManager.state,{activeGroup:o,activeDataIdx:s}=n;if(o<0||s<0){for(const l of this.members)l!==e&&(this.syncedStores.add(l),l.cursorManager.hide(),l.scheduleCursorRedraw());this.publishing=!1;return}const i=e.dataStore.getXValues(o)[s];if(i==null){this.publishing=!1;return}for(const l of this.members)l!==e&&(this.syncedStores.add(l),l.cursorManager.syncToValue(i,l),l.scheduleCursorRedraw());this.publishing=!1}}function ps(t,e){z.useEffect(()=>{if(e==null)return;const n=ds(e);n.join(t);let o=-1,s=-1;const r=t.subscribeCursor(()=>{const{activeGroup:i,activeDataIdx:l}=t.cursorManager.state;i===o&&l===s||(o=i,s=l,n.pub(t))});return()=>{r(),n.leave(t)}},[t,e])}function hn(t){return t instanceof Float64Array?t:new Float64Array(t)}function dn(t){return t instanceof Float64Array||t.some(e=>e==null)?t:new Float64Array(t)}function Be(t){return{x:hn(t.x),series:[dn(t.y)]}}function ms(t){return{x:hn(t.x),series:t.series.map(dn)}}function le(t){if(!Array.isArray(t))return[Be(t)];if(t.length===0)return[];const e=t[0];return e==null?[]:"series"in e?t.map(ms):t.map(Be)}function ge({width:t,height:e,data:n,children:o,className:s,pxRatio:r,title:i,xlabel:l,ylabel:c,onDraw:f,onCursorDraw:a,syncKey:d,actions:u,onClick:h,onContextMenu:p,onDblClick:w,onCursorMove:b,onCursorLeave:g,onScaleChange:m,onSelect:M}){const S=Zo(),[_,T]=z.useState(null),x=r??(typeof window<"u"&&window.devicePixelRatio||1);z.useEffect(()=>{S.actionMap=u!=null?new Map([...Gt,...u]):new Map(Gt)},[S,u]),z.useEffect(()=>{S.setLabels(i,l,c)},[S,i,l,c]);const y=S.eventCallbacks;y.onClick=h,y.onContextMenu=p,y.onDblClick=w,y.onCursorMove=b,y.onCursorLeave=g,y.onScaleChange=m,y.onSelect=M,fs(S,_),ps(S,d);const A=z.useRef(null),L=I=>{A.current!==I&&(A.current=I,S.setCanvas(I),I&&S.scheduleRedraw())},k=z.useRef(null),D=I=>{k.current!==I&&(k.current=I,T(I))};z.useLayoutEffect(()=>{S.pxRatio=x,S.setSize(t,e),S.redrawSync()},[S,t,e,x]),z.useEffect(()=>()=>{S.setCanvas(null),S.scheduler.cancel(),S.focusedSeries=null,S.eventCallbacks={}},[S]),z.useEffect(()=>{if(_==null||typeof ResizeObserver>"u")return;const I=new ResizeObserver(H=>{const R=H[0];if(R==null)return;const{width:G,height:Y}=R.contentRect;G>0&&Y>0&&(G!==S.width||Y!==S.height)&&(S.setSize(Math.round(G),Math.round(Y)),S.scheduleRedraw())});return I.observe(_),()=>{I.disconnect()}},[S,_]);const P=z.useRef(void 0),F=z.useRef(le(n));n!==P.current&&(P.current=n,F.current=le(n));const W=F.current,v=z.useRef(n);z.useEffect(()=>{n===v.current&&S.dataStore.data.length>0||(v.current=n,S.setData(W),S.scheduleRedraw())},[S,n,W]);const C=z.useRef(f);C.current=f,z.useEffect(()=>{const I=H=>{var R;(R=C.current)==null||R.call(C,H)};return S.drawHooks.add(I),()=>{S.drawHooks.delete(I)}},[S]);const E=z.useRef(a);return E.current=a,z.useEffect(()=>{const I=(H,R)=>{var G;(G=E.current)==null||G.call(E,H,R)};return S.cursorDrawHooks.add(I),()=>{S.cursorDrawHooks.delete(I)}},[S]),V.jsx(un.Provider,{value:S,children:V.jsxs("div",{className:s,style:{position:"relative",display:"flex",flexDirection:"column",width:`${t}px`},children:[V.jsx("div",{ref:D,tabIndex:-1,style:{position:"relative",width:`${t}px`,height:`${e}px`,cursor:"crosshair",outline:"none",order:0},children:V.jsx("canvas",{ref:L,style:{position:"absolute",left:0,top:0}})}),o]})})}function Xe(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}function ws(t,e){const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const s of o)if(t[s]!==e[s])return!1;return!0}function Ss(t,e){if(t===null)return!1;const n=t,o=e,s=Object.keys(n),r=Object.keys(o);if(s.length!==r.length)return!1;for(const i of r){const l=n[i],c=o[i];if(l!==c)if(Xe(l)&&Xe(c)){if(!ws(l,c))return!1}else return!1}return!0}function pe(t,e,n,o,s){const r=ot(),i=z.useRef(t);i.current=t,z.useEffect(()=>{const c=i.current;return n(r,c),r.scheduleRedraw(),()=>{o(r,c),r.scheduleRedraw()}},[r,...e]);const l=z.useRef(null);z.useEffect(()=>{Ss(l.current,t)||(l.current=t,s(r,t),r.scheduleRedraw())})}function vs(t){return pe(t,[t.id],(e,n)=>e.registerScale(n),(e,n)=>e.unregisterScale(n.id),(e,n)=>e.updateScale(n)),null}function bs(t,e,n){e/=100,n/=100;const o=(1-Math.abs(2*n-1))*e,s=o*(1-Math.abs(t/60%2-1)),r=n-o/2;let i=0,l=0,c=0;return t<60?(i=o,l=s):t<120?(i=s,l=o):t<180?(l=o,c=s):t<240?(l=s,c=o):t<300?(i=s,c=o):(i=o,c=s),[Math.round((i+r)*255),Math.round((l+r)*255),Math.round((c+r)*255)]}function gn(t){const e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);if(e)return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)];const n=/^#([0-9a-f])([0-9a-f])([0-9a-f])/i.exec(t);if(n)return[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];const o=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(t);if(o)return[Number(o[1]),Number(o[2]),Number(o[3])];const s=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%/i.exec(t);return s?bs(Number(s[1]),Number(s[2]),Number(s[3])):null}function Ms(t,e=.8,n=0){const o=gn(t);if(o==null)return{type:"linear",stops:[[0,t],[1,t]]};const[s,r,i]=o;return{type:"linear",stops:[[0,`rgba(${s},${r},${i},${e})`],[1,`rgba(${s},${r},${i},${n})`]]}}function pn(t,e){const n=gn(t);if(n==null)return t;const[o,s,r]=n;return`rgba(${o},${s},${r},${e})`}function xs(t,e=65,n=50){const o=[];for(let r=0;r<t;r++){const i=r*137.508%360;o.push(`hsl(${i.toFixed(1)},${e}%,${n}%)`)}return o}const je=["#e74c3c","#3498db","#2ecc71","#f39c12","#9b59b6","#1abc9c","#e67e22","#34495e","#16a085","#c0392b","#2980b9","#27ae60","#f1c40f","#8e44ad","#d35400"];function Ye(t,e){var i;const n=(i=t.paths)==null?void 0:i.defaults,o=t.stroke??je[e%je.length]??"#000",s=t.fill??(n==null?void 0:n.fill),r=s==="auto"&&typeof o=="string"?pn(o,.5):s==="auto"?void 0:s;return{...n,...t,yScale:t.yScale??"y",show:t.show??!0,stroke:o,fill:r}}function me(t){return pe(t,[t.group,t.index],(e,n)=>e.registerSeries(Ye(n,e.seriesConfigs.length)),(e,n)=>e.unregisterSeries(n.group,n.index),(e,n)=>{const o=e.seriesConfigs.findIndex(s=>s.group===n.group&&s.index===n.index);e.updateSeries(Ye(n,o>=0?o:e.seriesConfigs.length))}),null}function ys(t){return{...t,side:t.side??(t.scale==="x"?N.Bottom:N.Left),show:t.show??!0}}function Rt(t){const e=ys(t);return pe(e,[e.scale,e.side],(n,o)=>n.registerAxis(o),(n,o)=>n.unregisterAxis(o.scale,o.side),(n,o)=>n.updateAxis(o)),null}function Cs({series:t,group:e,fill:n,dir:o}){const s=ot(),r=z.useRef(null),i=t[0],l=t[1];return z.useEffect(()=>{const c={series:[i,l],group:e,fill:n,dir:o};return r.current!=null&&s.unregisterBand(r.current),r.current=c,s.registerBand(c),s.scheduleRedraw(),()=>{r.current!=null&&s.unregisterBand(r.current),r.current=null,s.scheduleRedraw()}},[s,i,l,e,n,o]),null}const ks={width:12,height:3,borderRadius:1,display:"inline-block"},Ts={fontWeight:600},mn={display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",cursor:"pointer",fontSize:12,fontFamily:"sans-serif"},As={...mn,opacity:1},Is={...mn,opacity:.4},Ne=new Map,Ls={display:"flex",flexWrap:"wrap",justifyContent:"center",order:-1,padding:"4px 0"},Ps={display:"flex",flexWrap:"wrap",justifyContent:"center",order:1,padding:"4px 0"};function Es({group:t,index:e,label:n,color:o,isHidden:s,valueStr:r,store:i}){let l=Ne.get(o);return l==null&&(l={...ks,backgroundColor:o},Ne.set(o,l)),V.jsxs("span",{onClick:()=>i.toggleSeries(t,e),style:s?Is:As,children:[V.jsx("span",{style:l}),V.jsx("span",{children:n}),r&&V.jsx("span",{style:Ts,children:r})]})}function _s({show:t=!0,position:e="bottom",className:n}){const o=ot(),s=z.useSyncExternalStore(o.subscribeCursor,o.getSnapshot);if(!t)return null;const{activeGroup:r,activeDataIdx:i}=s;return V.jsx("div",{className:n,style:e==="top"?Ls:Ps,children:o.seriesConfigs.map(l=>{if(l.legend===!1)return null;const c=typeof l.stroke=="string"?l.stroke:"#000";let f="";if(i>=0&&r>=0&&l.group===r){const d=o.dataStore.getYValues(l.group,l.index)[i];d!=null&&(f=typeof d=="number"?d.toPrecision(4):String(d))}return V.jsx(Es,{group:l.group,index:l.index,label:l.label??`Series ${l.index}`,color:c,isHidden:l.show===!1,valueStr:f,store:o},`${l.group}:${l.index}`)})})}const Ds={position:"absolute",zIndex:50,background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:4,padding:"4px 6px",fontSize:12,fontFamily:"sans-serif",userSelect:"none",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",whiteSpace:"nowrap"},Fs={width:12,height:3,borderRadius:1,display:"inline-block",flexShrink:0},Rs={fontWeight:600},Nt={display:"flex",alignItems:"center",gap:4,padding:"1px 4px"},zs={...Nt,opacity:1,cursor:"pointer"},Hs={...Nt,opacity:1,cursor:"default"},Ws={...Nt,opacity:.4,cursor:"pointer"},$s={...Nt,opacity:.4,cursor:"default"},Ue=new Map;function Gs(t){let e=Ue.get(t);return e==null&&(e={...Fs,backgroundColor:t},Ue.set(t,e)),e}function we({label:t,color:e,value:n,isHidden:o,onClick:s}){const r=o?s?Ws:$s:s?zs:Hs;return V.jsxs("div",{onClick:s,style:r,children:[V.jsx("span",{style:Gs(e)}),V.jsx("span",{children:t}),n&&V.jsx("span",{style:Rs,children:n})]})}const Vt=z.forwardRef(function({left:e,top:n,children:o,className:s,style:r,onMouseDown:i,onMouseEnter:l,onMouseLeave:c},f){return V.jsx("div",{ref:f,className:s,onMouseDown:i,onMouseEnter:l,onMouseLeave:c,style:{...Ds,left:e,top:n,...r},children:o})});function Vs(t,e,n,o,s){if(s<0||o<0)return"";const i=t.dataStore.getYValues(e,n)[s];return i==null?"":typeof i=="number"?i.toPrecision(4):String(i)}const Bs={},Xs={pointerEvents:"none",zIndex:100},js={fontWeight:600,marginBottom:2,padding:"0 4px"};function Ys({show:t=!0,className:e,children:n,offset:o=Bs}){var A,L;const s=ot(),r=z.useSyncExternalStore(s.subscribeCursor,s.getSnapshot),i=z.useRef(null);if(!t||r.activeDataIdx<0||r.activeGroup<0||r.left<0)return null;const{activeGroup:l,activeDataIdx:c}=r,f=s.plotBox,a=s.dataStore.data[l],d=a!=null?a.x[c]??null:null,u=d!=null?parseFloat(d.toPrecision(6)).toString():"",h=[];for(const k of s.seriesConfigs){if(k.show===!1||k.legend===!1)continue;const D=s.dataStore.getYValues(k.group,k.index),P=k.group===l?D[c]:null;h.push({label:k.label??`Series ${k.index}`,value:P,color:typeof k.stroke=="string"?k.stroke:"#000",group:k.group,index:k.index})}const p={x:d,xLabel:u,items:h,left:r.left+f.left,top:r.top+f.top},w=o.x??12,b=o.y??-12,g=((A=i.current)==null?void 0:A.offsetWidth)??0,m=((L=i.current)==null?void 0:L.offsetHeight)??0,M=r.left+f.left,S=r.top+f.top,_=f.left+f.width,T=f.top+f.height,x=Q(M+w,f.left,_-g),y=Q(S+b,f.top,T-m);return n?V.jsx("div",{ref:i,className:e,style:{position:"absolute",left:x,top:y,whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},children:n(p)}):V.jsxs(Vt,{ref:i,left:x,top:y,className:e,style:Xs,children:[V.jsx("div",{style:js,children:u}),h.map(k=>V.jsx(we,{label:k.label,color:k.color,value:k.value!=null?k.value.toPrecision(4):"—"},`${k.group}:${k.index}`))]})}const Ns=8,Oe=.01,Us=[.25,.75];function Os({width:t,height:e,data:n,onRangeChange:o,initialRange:s,className:r,colors:i,grips:l=!1}){const c=z.useRef(null),f=z.useMemo(()=>le(n),[n]),[a,d]=z.useState(()=>{if(s!=null&&f.length>0){const T=f[0];if(T!=null&&T.x.length>1){const x=T.x[0],A=T.x[T.x.length-1]-x;if(A>0)return[Math.max(0,(s[0]-x)/A),Math.min(1,(s[1]-x)/A)]}}return Us}),u=z.useRef(null);z.useEffect(()=>{if(o==null||f.length===0)return;const T=f[0];if(T==null||T.x.length<2)return;const x=T.x[0],A=T.x[T.x.length-1]-x,L=x+a[0]*A,k=x+a[1]*A,D=u.current,P=Math.max(1e-10,Math.abs(k-L)*1e-12);D!=null&&Math.abs(D[0]-L)<P&&Math.abs(D[1]-k)<P||(u.current=[L,k],o(L,k))},[a,f,o]);const h=z.useRef(null),p=z.useCallback(T=>{const x=c.current;if(x==null)return 0;const y=x.getBoundingClientRect();return Q((T-y.left)/y.width,0,1)},[]),w=z.useCallback(T=>{const x=c.current;if(x==null)return;const y=p(T.clientX),A=x.getBoundingClientRect().width,L=A>0?Ns/A:0;let k;if(Math.abs(y-a[0])<L)k="left";else if(Math.abs(y-a[1])<L)k="right";else if(y>=a[0]&&y<=a[1])k="move";else{const D=a[1]-a[0],P=D/2,F=Q(y-P,0,1-D);d([F,F+D]),k="move"}h.current={mode:k,startX:T.clientX,startFrac:[...a]},x.setPointerCapture(T.pointerId),T.preventDefault()},[a,p]),b=z.useCallback(T=>{const x=h.current;if(x==null)return;const y=p(T.clientX),A=p(x.startX),L=y-A;if(x.mode==="move"){const k=x.startFrac[1]-x.startFrac[0],D=Q(x.startFrac[0]+L,0,1-k);d([D,D+k])}else if(x.mode==="left"){const k=Q(x.startFrac[0]+L,0,x.startFrac[1]-Oe);d([k,x.startFrac[1]])}else{const k=Q(x.startFrac[1]+L,x.startFrac[0]+Oe,1);d([x.startFrac[0],k])}},[p]),g=z.useCallback(T=>{h.current=null;const x=c.current;x!=null&&x.releasePointerCapture(T.pointerId)},[]),m=`${a[0]*100}%`,M=`${(a[1]-a[0])*100}%`,S=f[0],_=S!=null?S.series.length:0;return V.jsxs("div",{className:r,style:{position:"relative",width:t,height:e},children:[V.jsxs(ge,{width:t,height:e,data:n,children:[V.jsx(Rt,{scale:"x",show:!1}),V.jsx(Rt,{scale:"y",show:!1}),Array.from({length:_},(T,x)=>V.jsx(me,{group:0,index:x,yScale:"y",stroke:i!=null&&i[x]!=null?i[x]:`hsl(${x*137}, 60%, 50%)`,width:1},`0:${x}`))]}),V.jsxs("div",{ref:c,onPointerDown:w,onPointerMove:b,onPointerUp:g,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:"default",touchAction:"none"},children:[V.jsx("div",{style:{position:"absolute",top:0,left:0,width:m,height:"100%",background:"rgba(0,0,0,0.3)",pointerEvents:"none"}}),V.jsx("div",{style:{position:"absolute",top:0,left:`${a[1]*100}%`,right:0,height:"100%",background:"rgba(0,0,0,0.3)",pointerEvents:"none"}}),V.jsx("div",{style:{position:"absolute",top:0,left:m,width:M,height:"100%",borderLeft:"2px solid rgba(0,100,255,0.8)",borderRight:"2px solid rgba(0,100,255,0.8)",boxSizing:"border-box",cursor:"grab",pointerEvents:"none"},children:l&&V.jsxs(V.Fragment,{children:[V.jsx("div",{style:{position:"absolute",left:-5,top:"50%",transform:"translateY(-50%)",width:8,height:24,borderRadius:3,background:"rgba(0,100,255,0.8)",cursor:"ew-resize",pointerEvents:"auto"}}),V.jsx("div",{style:{position:"absolute",right:-5,top:"50%",transform:"translateY(-50%)",width:8,height:24,borderRadius:3,background:"rgba(0,100,255,0.8)",cursor:"ew-resize",pointerEvents:"auto"}})]})})]})]})}function wt(t){const e=ot(),n=z.useRef(t);n.current=t,z.useEffect(()=>{const o=s=>n.current(s);return e.drawHooks.add(o),()=>{e.drawHooks.delete(o)}},[e])}function Ks(t){const e=ot(),n=z.useRef(t);n.current=t,z.useEffect(()=>{const o=(s,r)=>n.current(s,r);return e.cursorDrawHooks.add(o),()=>{e.cursorDrawHooks.delete(o)}},[e])}function qs({lanes:t,laneHeight:e=24,gap:n=2,scaleId:o="x"}){const s=ot();return wt(({ctx:r,plotBox:i,pxRatio:l})=>{const c=s.scaleManager.getScale(o);if(c==null||!U(c))return;r.save(),r.beginPath(),r.rect(i.left*l,i.top*l,i.width*l,i.height*l),r.clip();const f=(e+n)*l,a=e*l,d=i.top*l;for(let u=0;u<t.length;u++){const h=t[u];if(h==null)continue;const p=d+u*f;r.fillStyle="#666",r.font=`${11*l}px sans-serif`,r.textAlign="right",r.textBaseline="middle",r.fillText(h.label,(i.left-6)*l,p+a/2);for(const w of h.segments){const b=X(w.start,c,i.width,i.left)*l,m=X(w.end,c,i.width,i.left)*l-b;m<=0||(r.fillStyle=w.color??"#4dabf7",r.fillRect(b,p,m,a),w.label!=null&&m>20*l&&(r.fillStyle="#fff",r.font=`${10*l}px sans-serif`,r.textAlign="center",r.textBaseline="middle",r.fillText(w.label,b+m/2,p+a/2,m-4*l)))}}r.restore()}),null}function Zs({data:t,width:e=150,height:n=30,stroke:o="#03a9f4",fill:s,lineWidth:r=1,paths:i,fillTo:l,className:c}){return V.jsx("div",{style:{pointerEvents:"none"},className:c,children:V.jsxs(ge,{width:e,height:n,data:t,children:[V.jsx(Rt,{scale:"x",show:!1}),V.jsx(Rt,{scale:"y",show:!1}),V.jsx(me,{group:0,index:0,yScale:"y",stroke:o,fill:s,width:r,paths:i,fillTo:l})]})})}const gt=8,Js={x:12,y:-12},Qs={pointerEvents:"none"};function ti(t,e,n,o){if(t!=null&&typeof t=="object")return t;switch(t){case"top-left":return{x:e.left+gt,y:e.top+gt};case"bottom-left":return{x:e.left+gt,y:e.top+e.height-o-gt};case"bottom-right":return{x:e.left+e.width-n-gt,y:e.top+e.height-o-gt};case"top-right":default:return{x:e.left+e.width-n-gt,y:e.top+gt}}}function ei({mode:t="draggable",position:e="top-right",offset:n=Js,idleOpacity:o=.3,show:s=!0,className:r}){var k,D;const i=ot(),l=z.useSyncExternalStore(i.subscribeCursor,i.getSnapshot),[c,f]=z.useState(null),[a,d]=z.useState(!1),[u,h]=z.useState(!1),p=z.useRef(!1),w=z.useRef(!1),b=z.useRef({dx:0,dy:0}),[g,m]=z.useState(!1),M=z.useRef(null);z.useLayoutEffect(()=>{if(t!=="draggable"||g||l.plotWidth<=0)return;m(!0);const P=M.current,F=(P==null?void 0:P.offsetWidth)??0,W=(P==null?void 0:P.offsetHeight)??0;f(ti(e,i.plotBox,F,W))},[t,g,l.plotWidth,e,i.plotBox]);const S=(P,F)=>{w.current||i.toggleSeries(P,F)},_=P=>{if(t!=="draggable")return;P.stopPropagation(),P.preventDefault(),p.current=!0,h(!0),w.current=!1;const F=P.currentTarget.getBoundingClientRect();b.current={dx:P.clientX-F.left,dy:P.clientY-F.top}};if(z.useEffect(()=>{if(!s||t!=="draggable")return;const P=W=>{var E;if(!p.current)return;w.current=!0;const v=(E=i.canvas)==null?void 0:E.parentElement;if(!v)return;const C=v.getBoundingClientRect();f({x:W.clientX-C.left-b.current.dx,y:W.clientY-C.top-b.current.dy})},F=()=>{p.current=!1,h(!1)};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",F),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",F)}},[i,s,t]),!s)return null;const{activeGroup:T,activeDataIdx:x,left:y,top:A}=l,L=i.seriesConfigs.filter(P=>P.legend!==!1).map(P=>{const F=typeof P.stroke=="string"?P.stroke:"#000",W=Vs(i,P.group,P.index,T,x),v=t==="draggable";return V.jsx(we,{label:P.label??`Series ${P.index}`,color:F,value:W,isHidden:P.show===!1,onClick:v?()=>S(P.group,P.index):void 0},`${P.group}:${P.index}`)});if(t==="cursor"){if(y<0)return null;const P=((k=M.current)==null?void 0:k.offsetWidth)??0,F=((D=M.current)==null?void 0:D.offsetHeight)??0,W=l.plotLeft+l.plotWidth,v=l.plotTop+l.plotHeight,C=Q(y+l.plotLeft+n.x,l.plotLeft,W-P),E=Q(A+l.plotTop+n.y,l.plotTop,v-F);return V.jsx(Vt,{ref:M,left:C,top:E,className:r,style:Qs,children:L})}return c==null?null:V.jsx(Vt,{ref:M,left:c.x,top:c.y,className:r,onMouseDown:_,onMouseEnter:()=>d(!0),onMouseLeave:()=>{d(!1),w.current=!1},style:{pointerEvents:"auto",cursor:u?"grabbing":"grab",opacity:a||u?1:o,transition:"opacity 0.2s ease"},children:L})}const ni={pointerEvents:"none"};function oi({delay:t=1e3,show:e=!0,className:n}){var m,M;const o=ot(),s=z.useSyncExternalStore(o.subscribe,o.getSnapshot),[r,i]=z.useState(!1),l=z.useRef(-1),c=z.useRef(0),f=z.useRef(null);if(z.useEffect(()=>{const S=s.activeSeriesIdx;S!==l.current&&(l.current=S,i(!1),window.clearTimeout(c.current),S>=0&&(c.current=window.setTimeout(()=>i(!0),t)))},[s.activeSeriesIdx,t]),z.useEffect(()=>()=>{window.clearTimeout(c.current)},[]),!e||!r||s.left<0)return null;const a=o.seriesConfigs.find(S=>S.group===s.activeGroup&&S.index===s.activeSeriesIdx);if(!(a!=null&&a.label)||a.legend===!1)return null;const d=typeof a.stroke=="string"?a.stroke:"#000",u=((m=f.current)==null?void 0:m.offsetWidth)??80,h=((M=f.current)==null?void 0:M.offsetHeight)??24,p=s.left+s.plotLeft,w=s.top+s.plotTop,b=Q(p-u/2,s.plotLeft,s.plotLeft+s.plotWidth-u),g=Q(w-h-12,s.plotTop,s.plotTop+s.plotHeight-h);return V.jsx(Vt,{ref:f,left:b,top:g,className:n,style:ni,children:V.jsx(we,{label:a.label,color:d})})}function wn(t,e,n,o,s,r,i,l,c){const f=i/2;if(c.wickColor!=null&&(t.strokeStyle=c.wickColor,t.lineWidth=c.wickWidth??1,t.beginPath(),t.moveTo(e,n),t.lineTo(e,o),t.stroke()),c.capWidth!=null&&c.capWidth>0){const u=c.capWidth/2;t.strokeStyle=c.wickColor??"#555",t.lineWidth=c.wickWidth??1,t.beginPath(),t.moveTo(e-u,n),t.lineTo(e+u,n),t.moveTo(e-u,o),t.lineTo(e+u,o),t.stroke()}const a=Math.min(s,r),d=Math.abs(r-s);t.fillStyle=c.bodyFill,t.fillRect(e-f,a,i,d),c.bodyStroke!=null&&(t.strokeStyle=c.bodyStroke,t.lineWidth=c.bodyStrokeWidth??1.5,t.strokeRect(e-f,a,i,d)),l!=null&&c.midColor!=null&&(t.strokeStyle=c.midColor,t.lineWidth=c.midWidth??2.5,t.beginPath(),t.moveTo(e-f,l),t.lineTo(e+f,l),t.stroke())}function si({boxes:t,yScale:e="y",boxWidth:n=.5,fill:o="rgba(52, 152, 219, 0.4)",stroke:s="#2980b9",medianColor:r="#e74c3c",whiskerColor:i="#555"}){return wt(({ctx:l,plotBox:c,valToX:f,valToY:a})=>{const d=c.width/t.length*n,u=d*.3;for(let h=0;h<t.length;h++){const p=t[h];if(p==null)continue;const w=f(h+1),b=a(p.min,e),g=a(p.q1,e),m=a(p.median,e),M=a(p.q3,e),S=a(p.max,e);w==null||b==null||g==null||m==null||M==null||S==null||wn(l,w,b,S,g,M,d,m,{wickColor:i,bodyFill:o,bodyStroke:s,capWidth:u,midColor:r})}}),null}function ii(t){const e=Math.max(0,Math.min(1,t)),n=[[0,15,30,80],[.15,30,100,200],[.3,40,190,210],[.45,50,200,80],[.6,230,220,40],[.75,240,140,30],[.9,220,40,30],[1,120,10,10]];let o=n[0],s=n[n.length-1];for(let f=0;f<n.length-1;f++){const a=n[f],d=n[f+1];if(a!=null&&d!=null&&e>=a[0]&&e<=d[0]){o=a,s=d;break}}const r=s[0]===o[0]?0:(e-o[0])/(s[0]-o[0]),i=Math.round(o[1]+r*(s[1]-o[1])),l=Math.round(o[2]+r*(s[2]-o[2])),c=Math.round(o[3]+r*(s[3]-o[3]));return`rgb(${i},${l},${c})`}function ri({grid:t,xRange:e,yRange:n,colorMap:o=ii,yScale:s="y"}){return wt(({ctx:r,valToX:i,valToY:l})=>{var g;if(t.length===0)return;const c=t.length,f=((g=t[0])==null?void 0:g.length)??0;if(f===0)return;const a=(e==null?void 0:e[0])??0,d=(e==null?void 0:e[1])??c,u=(n==null?void 0:n[0])??0,h=(n==null?void 0:n[1])??f,p=(d-a)/c,w=(h-u)/f;let b=0;for(const m of t)for(const M of m)M>b&&(b=M);if(b!==0)for(let m=0;m<c;m++){const M=t[m];if(M==null)continue;const S=i(a+m*p),_=i(a+(m+1)*p);if(S==null||_==null)continue;const T=_-S;for(let x=0;x<f;x++){const y=M[x]??0,A=u+x*w,L=u+(x+1)*w,k=l(L,s),D=l(A,s);if(k==null||D==null)continue;const P=D-k;r.fillStyle=o(y/b),r.fillRect(S,k,T,P)}}}),null}function li(t,e,n,o,s){const r=(o-90)*(Math.PI/180),i=s,l=i*.35,c=Math.PI/6,f=e+Math.cos(r)*i,a=n+Math.sin(r)*i,d=e-Math.cos(r)*i*.5,u=n-Math.sin(r)*i*.5;t.beginPath(),t.moveTo(d,u),t.lineTo(f,a),t.stroke(),t.beginPath(),t.moveTo(f,a),t.lineTo(f-l*Math.cos(r-c),a-l*Math.sin(r-c)),t.moveTo(f,a),t.lineTo(f-l*Math.cos(r+c),a-l*Math.sin(r+c)),t.stroke()}function ci({directions:t,group:e=0,index:n=0,color:o="#c0392b",minSize:s=4,maxSize:r=10}){const i=ot();return wt(({ctx:l,valToX:c,valToY:f})=>{var g;const a=i.dataStore.data[e];if(a==null)return;const d=a.x,u=a.series[n];if(u==null)return;let h=1/0,p=-1/0;for(let m=0;m<u.length;m++){const M=u[m];M!=null&&(M<h&&(h=M),M>p&&(p=M))}const w=p-h||1,b=((g=i.seriesConfigs.find(m=>m.group===e&&m.index===n))==null?void 0:g.yScale)??"y";l.strokeStyle=o,l.lineWidth=1.5,l.lineCap="round";for(let m=0;m<d.length;m++){const M=u[m],S=t[m];if(M==null||S==null)continue;const _=c(d[m]),T=f(M,b);if(_==null||T==null)continue;const x=(M-h)/w,y=s+x*(r-s);li(l,_,T,S,y)}}),null}const ai=4;function Se(t,e){t.strokeStyle=e.stroke??"red",t.lineWidth=e.width??1,e.dash&&t.setLineDash(e.dash)}function ve(t,e){e.dash&&t.setLineDash([])}function Sn(t,e,n,o={}){const{ctx:s,plotBox:r}=t,i=X(n,e,r.height,r.top);s.beginPath(),s.moveTo(r.left,i),s.lineTo(r.left+r.width,i),Se(s,o),s.stroke(),ve(s,o)}function vn(t,e,n,o={}){const{ctx:s,plotBox:r}=t,i=X(n,e,r.width,r.left);s.beginPath(),s.moveTo(i,r.top),s.lineTo(i,r.top+r.height),Se(s,o),s.stroke(),ve(s,o)}function ui(t,e,n,o,s,r,i={}){const{ctx:l,plotBox:c}=t,f=X(o,e,c.width,c.left),a=X(s,n,c.height,c.top);l.font=i.font??"12px sans-serif",l.fillStyle=i.fill??"#000",l.textBaseline="bottom",l.fillText(r,f,a-ai)}function bn(t,e,n,o,s={}){const{ctx:r,plotBox:i}=t,l=X(o,e,i.height,i.top),c=X(n,e,i.height,i.top);r.fillStyle=s.fill??"rgba(255,0,0,0.1)",r.fillRect(i.left,Math.min(l,c),i.width,Math.abs(c-l)),s.stroke&&(Se(r,s),r.strokeRect(i.left,Math.min(l,c),i.width,Math.abs(c-l)),ve(r,s))}function be(t,e,n){const o=z.useRef(t);z.useLayoutEffect(()=>{o.current=t},[t]),wt(s=>{const r=s.getScale(e);r!=null&&n(s,r,o.current)})}function fi(t){return be(t,t.yScale??"y",(e,n,o)=>{if(Sn(e,n,o.value,{stroke:o.stroke,width:o.width,dash:o.dash}),o.label!=null){const s=e.valToY(o.value,o.yScale??"y");if(s==null)return;const{ctx:r,plotBox:i}=e;r.font=o.labelFont??"11px sans-serif",r.fillStyle=o.stroke??"red",r.textAlign="left",r.textBaseline="bottom",r.fillText(o.label,i.left+4,s-4)}}),null}function hi(t){return be(t,t.xScale??"x",(e,n,o)=>{if(vn(e,n,o.value,{stroke:o.stroke,width:o.width,dash:o.dash}),o.label!=null){const s=e.valToX(o.value,o.xScale??"x");if(s==null)return;const{ctx:r,plotBox:i}=e;r.font=o.labelFont??"11px sans-serif",r.fillStyle=o.stroke??"red",r.textAlign="center",r.textBaseline="bottom",r.fillText(o.label,s,i.top-4)}}),null}function di(t){return be(t,t.yScale??"y",(e,n,o)=>{bn(e,n,o.yMin,o.yMax,{fill:o.fill,stroke:o.stroke,width:o.strokeWidth,dash:o.dash})}),null}function gi(t){const e=z.useRef(t);return z.useLayoutEffect(()=>{e.current=t}),wt(n=>{const o=e.current,s=n.valToX(o.x,o.xScale??"x"),r=n.valToY(o.y,o.yScale??"y");if(s==null||r==null)return;const{ctx:i}=n;i.font=o.font??"12px sans-serif",i.fillStyle=o.fill??"#000",i.textAlign=o.align??"left",i.textBaseline=o.baseline??"bottom",i.fillText(o.text,s,r-4)}),null}function pi(t){const e=(n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w=(p==null?void 0:p.align)??t??1,b=(p==null?void 0:p.spanGaps)??!1;if([a,d]=Bt(o,a,d),a===-1)return{stroke:new Path2D,fill:null,clip:null,band:null,gaps:null};const g=L=>h(X(L,s,i,c)),m=L=>h(X(L,r,l,f)),M=s.ori===$.Horizontal?jt:Yt,S={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null},_=S.stroke;let T=!1;const x=u===O.Forward?a:d;let y=m(o[x]),A=g(n[x]);M(_,A,y);for(let L=x;L>=a&&L<=d;L+=u){const k=o[L];if(k==null){k===null&&!b&&(T=!0);continue}const D=g(n[L]),P=m(k);if(w===1)M(_,D,y);else if(w===-1)M(_,A,P);else{const F=h((A+D)/2);M(_,F,y),M(_,F,P)}M(_,D,P),y=P,A=D}{const L=S.fill=new Path2D(_),k=(p==null?void 0:p.fillTo)??r.min??0,D=m(k);let P=g(n[a]),F=g(n[d]);u===O.Backward&&([F,P]=[P,F]),M(L,F,D),M(L,P,D)}if(T){const L=ue(n,o,a,d,u,g);S.gaps=L,S.clip=fe(L,s.ori,c,f,i,l)}return S};return e.defaults=Xt,e}function Me(t){return t.defaults=Yn,t}function xe(){return Me((e,n,o,s,r,i,l,c,f,a,d,u,h)=>{const p=(h==null?void 0:h.barWidth)??.6,w=(h==null?void 0:h.barGap)??0,b=(h==null?void 0:h.barRadius)??0,g=(h==null?void 0:h.barGroupIdx)??0,m=(h==null?void 0:h.barGroupCount)??1,M=F=>u(X(F,o,r,l)),S=F=>u(X(F,s,i,c));let _=r;if(a>f){let F=1/0,W=-1;for(let v=f;v<=a;v++)if(n[v]!=null){if(W>=0){const C=e[v],E=e[W],I=Math.abs(M(C)-M(E));I<F&&(F=I)}W=v}F<1/0&&(_=F)}const T=_*(1-p),x=Math.max(0,T+w),y=Math.max(1,u(_-x)),A=m>1?Math.max(1,u(y/Math.max(1,m))):y,L=(h==null?void 0:h.fillTo)??s.min??0,k=S(L),D=new Path2D,P=o.ori===$.Horizontal;for(let F=d===O.Forward?f:a;F>=f&&F<=a;F+=d){const W=n[F];if(W==null)continue;const v=M(e[F]),C=S(W),E=m>1?(g-(m-1)/2)*A:0,I=u(v-A/2+E),H=Math.min(C,k),G=Math.max(C,k)-H;if(G!==0)if(b>0){const Y=Math.min(b*A,G/2);Si(D,P,I,H,A,G,Y,W<L)}else P?D.rect(I,H,A,G):D.rect(H,I,G,A)}return{stroke:D,fill:D,clip:null,band:null,gaps:null}})}function mi(t,e){const n=xe();return Me((s,r,i,l,c,f,a,d,u,h,p,w,b)=>{const g={...b,barGroupIdx:t,barGroupCount:e};return n(s,r,i,l,c,f,a,d,u,h,p,w,g)})}function wi(){const t=xe();return Me((n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w={barWidth:.8,...p};return t(n,o,s,r,i,l,c,f,a,d,u,h,w)})}function Si(t,e,n,o,s,r,i,l){i=Math.min(i,s/2,r/2),e?l?(t.moveTo(n,o),t.lineTo(n+s,o),t.lineTo(n+s,o+r-i),t.arc(n+s-i,o+r-i,i,0,Math.PI/2),t.lineTo(n+i,o+r),t.arc(n+i,o+r-i,i,Math.PI/2,Math.PI),t.closePath()):(t.moveTo(n,o+r),t.lineTo(n,o+i),t.arc(n+i,o+i,i,Math.PI,Math.PI*1.5),t.lineTo(n+s-i,o),t.arc(n+s-i,o+i,i,Math.PI*1.5,0),t.lineTo(n+s,o+r),t.closePath()):l?(t.moveTo(o,n),t.lineTo(o,n+s),t.lineTo(o+r-i,n+s),t.arc(o+r-i,n+s-i,i,Math.PI/2,0,!0),t.lineTo(o+r,n+i),t.arc(o+r-i,n+i,i,0,-Math.PI/2,!0),t.closePath()):(t.moveTo(o+r,n),t.lineTo(o+i,n),t.arc(o+i,n+i,i,-Math.PI/2,Math.PI,!0),t.lineTo(o,n+s-i),t.arc(o+i,n+s-i,i,Math.PI,Math.PI/2,!0),t.lineTo(o+r,n+s),t.closePath())}function Mn(t){const e=(n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w=(p==null?void 0:p.spanGaps)??!1;if([a,d]=Bt(o,a,d),a===-1)return{stroke:new Path2D,fill:null,clip:null,band:null,gaps:null};const b=A=>h(X(A,s,i,c)),g=A=>h(X(A,r,l,f)),m=s.ori===$.Horizontal?jt:Yt,M=[],S=[];let _=!1;for(let A=u===O.Forward?a:d;A>=a&&A<=d;A+=u){const L=o[A];L!=null?(M.push(b(n[A])),S.push(g(L))):L===null&&!w&&(_=!0)}const T=s.ori===$.Horizontal,x=t(M,S,T,h),y={stroke:x??new Path2D,fill:null,clip:null,band:null,gaps:null};if(x!=null){const A=y.fill=new Path2D(x),L=(p==null?void 0:p.fillTo)??r.min??0,k=g(L);let D=b(n[a]),P=b(n[d]);u===O.Backward&&([P,D]=[D,P]),m(A,P,k),m(A,D,k)}if(_){const A=ue(n,o,a,d,u,b);y.gaps=A,y.clip=fe(A,s.ori,c,f,i,l)}return y};return e.defaults=Xt,e}function vi(){return Mn(bi)}const bi=(t,e,n,o)=>{const s=t.length;if(s<2)return null;const r=new Path2D,i=t[0]??0,l=e[0]??0;if(n?r.moveTo(i,l):r.moveTo(l,i),s===2){const u=t[1]??0,h=e[1]??0;return n?r.lineTo(u,h):r.lineTo(h,u),r}const c=new Array(s),f=new Array(s-1),a=new Array(s-1),d=new Array(s-1);for(let u=0;u<s-1;u++)a[u]=(e[u+1]??0)-(e[u]??0),d[u]=(t[u+1]??0)-(t[u]??0),f[u]=d[u]!==0?(a[u]??0)/(d[u]??1):0;c[0]=f[0]??0;for(let u=1;u<s-1;u++){const h=f[u]??0,p=f[u-1]??0;if(h===0||p===0||p>0!=h>0)c[u]=0;else{const w=d[u]??1,b=d[u-1]??1;c[u]=3*(b+w)/((2*w+b)/p+(w+2*b)/h),isFinite(c[u]??0)||(c[u]=0)}}c[s-1]=f[s-2]??0;for(let u=0;u<s-1;u++){const h=d[u]??1,p=t[u]??0,w=e[u]??0,b=t[u+1]??0,g=e[u+1]??0,m=c[u]??0,M=c[u+1]??0,S=p+h/3,_=w+m*h/3,T=b-h/3,x=g-M*h/3;n?r.bezierCurveTo(S,_,T,x,b,g):r.bezierCurveTo(_,S,x,T,g,b)}return r};function Mi(){return Mn(xi)}const xi=(t,e,n,o)=>{const s=t.length;if(s<2)return null;const r=new Path2D,i=o(t[0]??0),l=o(e[0]??0);if(n?r.moveTo(i,l):r.moveTo(l,i),s===2){const c=o(t[1]??0),f=o(e[1]??0);return n?r.lineTo(c,f):r.lineTo(f,c),r}for(let c=0;c<s-1;c++){const f=c===0?0:c-1,a=t[f]??0,d=e[f]??0,u=t[c]??0,h=e[c]??0,p=t[c+1]??0,w=e[c+1]??0,b=c+2<s?t[c+2]??0:p,g=c+2<s?e[c+2]??0:w,m=Math.hypot(a-u,d-h),M=Math.hypot(u-p,h-w),S=Math.hypot(p-b,w-g),_=Math.sqrt(S),T=S,x=Math.sqrt(M),y=M,A=Math.sqrt(m),L=m,k=2*L+3*A*x+y,D=2*T+3*_*x+y,P=3*A*(A+x),F=3*_*(_+x);let W,v,C,E;if(P>0){const I=1/P;W=(-y*a+k*u+L*p)*I,v=(-y*d+k*h+L*w)*I}else W=u,v=h;if(F>0){const I=1/F;C=(T*u+D*p-y*b)*I,E=(T*h+D*w-y*g)*I}else C=p,E=w;n?r.bezierCurveTo(W,v,C,E,p,w):r.bezierCurveTo(v,W,E,C,w,p)}return r};function yi(t=4){const e=(n,o,s,r,i,l,c,f,a,d,u,h,p)=>{const w=S=>h(X(S,s,i,c)),b=S=>h(X(S,r,l,f)),g=t/2,m=new Path2D,M=s.ori===$.Horizontal;for(let S=u===O.Forward?a:d;S>=a&&S<=d;S+=u){const _=o[S];if(_==null)continue;const T=w(n[S]),x=b(_);M?(m.moveTo(T+g,x),m.arc(T,x,g,0,Math.PI*2)):(m.moveTo(x+g,T),m.arc(x,T,g,0,Math.PI*2))}return{stroke:m,fill:m,clip:null,band:null,gaps:null}};return e.defaults=Nn,e}function Ci({group:t=0,series:e=[0,1,2,3],yScale:n="y",upColor:o="#26a69a",downColor:s="#ef5350",bodyWidth:r=.6,wickWidth:i=1}){const l=ot();return wt(({ctx:c,plotBox:f,valToX:a,valToY:d})=>{const u=l.dataStore.data[t];if(u==null)return;const h=u.x,p=u.series[e[0]],w=u.series[e[1]],b=u.series[e[2]],g=u.series[e[3]];if(p==null||w==null||b==null||g==null)return;const m=h.length;if(m===0)return;const M=Math.max(2,f.width/m*r);for(let S=0;S<m;S++){const _=h[S],T=p[S],x=w[S],y=b[S],A=g[S];if(_==null||T==null||x==null||y==null||A==null)continue;const L=a(_),k=d(x,n),D=d(y,n),P=d(T,n),F=d(A,n);if(L==null||k==null||D==null||P==null||F==null)continue;const v=A>=T?o:s;wn(c,L,k,D,P,F,M,null,{wickColor:v,wickWidth:i,bodyFill:v})}}),null}function ki(t,e,n=0){const o=e??t.series.map((a,d)=>d),s=t.x.length,r=[],i=new Float64Array(s);for(let a=0;a<o.length;a++){const d=o[a];if(d==null)continue;const u=t.series[d];if(u==null)continue;const h=new Array(s);for(let p=0;p<s;p++){const w=u[p];w!=null?(i[p]=i[p]+w,h[p]=i[p]):h[p]=null}r.push(h)}const l=new Map;for(let a=0;a<o.length;a++){const d=o[a];d!=null&&l.set(d,a)}const c=[];for(let a=0;a<t.series.length;a++){const d=l.get(a)??-1,u=d>=0?r[d]:void 0;u!=null?c.push(u):c.push(t.series[a]??[])}const f=[];for(let a=o.length-1;a>0;a--){const d=o[a],u=o[a-1];d!=null&&u!=null&&f.push({group:n,series:[d,u]})}return{group:{x:t.x,series:c},bands:f}}function Ti(t){const e=new Set;for(const[r]of t)for(let i=0;i<r.length;i++){const l=r[i];l!=null&&e.add(l)}const n=Float64Array.from([...e].sort((r,i)=>r-i)),o=new Map;for(let r=0;r<n.length;r++){const i=n[r];i!=null&&o.set(i,r)}const s=[];for(const[r,i]of t){const l=new Array(n.length).fill(null);for(let c=0;c<r.length;c++){const f=r[c];if(f==null)continue;const a=o.get(f);a!=null&&(l[a]=i[c]??null)}s.push(l)}return[{x:n,series:s}]}function Ai(t){const e=(t==null?void 0:t.decimals)??1;return n=>n.map(o=>{const s=Math.abs(o);return s>=1e9?(o/1e9).toFixed(e)+"B":s>=1e6?(o/1e6).toFixed(e)+"M":s>=1e3?(o/1e3).toFixed(e)+"K":o.toFixed(s>=1?0:e)})}function Ii(t,e=0){return n=>n.map(o=>o.toFixed(e)+t)}function Li(t,e=0){return n=>n.map(o=>t+o.toFixed(e))}function Pi(t,e,n=0){return o=>o.map(s=>t+s.toFixed(n)+e)}function Ei(t){const e=(t==null?void 0:t.utc)??!1;return n=>n.map(o=>e?lt(o,{hour:"2-digit",minute:"2-digit",hour12:!1},"UTC"):lt(o,{hour:"2-digit",minute:"2-digit",hour12:!1}))}function _i(t){const e=t!=null&&t.utc?"UTC":void 0,n=(t==null?void 0:t.format)??"short";return o=>o.map(s=>lt(s,{month:n},e))}function Di(t){const{tz:e,...n}=t??{};return o=>o.map(s=>lt(s,n,e))}function Fi(t,e=0){return n=>n.map(o=>{const s=Math.round(o)-e;return t[s]??String(o)})}exports.AnnotationLabel=gi;exports.Axis=Rt;exports.Band=Cs;exports.BoxWhisker=si;exports.Candlestick=Ci;exports.Chart=ge;exports.DEFAULT_ACTIONS=Gt;exports.Direction=O;exports.Distribution=K;exports.FloatingLegend=ei;exports.HLine=fi;exports.Heatmap=ri;exports.HoverLabel=oi;exports.Legend=_s;exports.Orientation=$;exports.Region=di;exports.Scale=vs;exports.Series=me;exports.Side=N;exports.SortOrder=At;exports.Sparkline=Zs;exports.Timeline=qs;exports.Tooltip=Ys;exports.VLine=hi;exports.Vector=ci;exports.ZoomRanger=Os;exports.alignData=Ti;exports.bars=xe;exports.catmullRom=Mi;exports.drawHLine=Sn;exports.drawLabel=ui;exports.drawRegion=bn;exports.drawVLine=vn;exports.fadeGradient=Ms;exports.fmtCompact=Ai;exports.fmtDateStr=Di;exports.fmtHourMin=Ei;exports.fmtLabels=Fi;exports.fmtMonthName=_i;exports.fmtPrefix=Li;exports.fmtSuffix=Ii;exports.fmtWrap=Pi;exports.focus=Cn;exports.groupedBars=mi;exports.linear=cn;exports.lttb=he;exports.lttbGroup=qn;exports.monotoneCubic=vi;exports.palette=xs;exports.points=yi;exports.posToVal=ft;exports.sideOrientation=yt;exports.stackGroup=ki;exports.stackedBars=wi;exports.stepped=pi;exports.useChart=Jo;exports.useCursorDrawHook=Ks;exports.useDrawHook=wt;exports.valToPos=X;exports.withAlpha=pn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGjF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGrE,YAAY,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACN,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9E,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnF,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzI,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACrF,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC1G,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG5E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGjG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1H,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG5D,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|