@oliasoft-open-source/charts-library 5.1.3 → 5.1.4-beta-2

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.
Files changed (25) hide show
  1. package/dist/assets/{Color-YHDXOIA2-C13o5BEK.js → Color-YHDXOIA2-CVL3yqvq.js} +1 -1
  2. package/dist/assets/{DocsRenderer-CFRXHY34-C8MDfQlB.js → DocsRenderer-CFRXHY34-BVHN4IgT.js} +3 -3
  3. package/dist/assets/{bar-chart.stories-5CuN6VFG.js → bar-chart.stories-DquA7ACv.js} +1 -1
  4. package/dist/assets/{entry-preview-Bg8Fv40s.js → entry-preview-DZ_R6dYr.js} +1 -1
  5. package/dist/assets/{get-draggableData-eD2Xdq-6.js → get-draggableData-B6vSKEXH.js} +1 -1
  6. package/dist/assets/{iframe-D3u0vI49.js → iframe-C_yRnxwh.js} +2 -2
  7. package/dist/assets/{legend-Cgq98xea.js → legend-DOA3L9eH.js} +88 -88
  8. package/dist/assets/{legend-context-PSa8HhGj.js → legend-context-Ck5tFDGN.js} +12 -12
  9. package/dist/assets/line-chart-CpA-Dt9p.js +6 -0
  10. package/dist/assets/{line-chart.stories-BM8uf3sT.js → line-chart.stories-CcH00UaJ.js} +1 -1
  11. package/dist/assets/{line-chart.test-case.stories-Cy5EhpJz.js → line-chart.test-case.stories-D7ekx7KO.js} +1 -1
  12. package/dist/assets/{pie-chart.stories-C3l9VGYJ.js → pie-chart.stories-BxRNBusg.js} +1 -1
  13. package/dist/assets/{preview-Cq-c5HAX.js → preview-DY34liza.js} +1 -1
  14. package/dist/assets/{preview-FuT2SsKI.js → preview-Da3Tuoe0.js} +2 -2
  15. package/dist/assets/{scatter-chart.stories-U-tLziOZ.js → scatter-chart.stories-DVIcv9-6.js} +1 -1
  16. package/dist/common/common.interface.d.ts +1 -0
  17. package/dist/common/legend-component/state/legend-context.d.ts +3 -1
  18. package/dist/common/legend-component/state/legend-state-reducer.d.ts +2 -1
  19. package/dist/iframe.html +1 -1
  20. package/dist/index.js +10 -0
  21. package/dist/line-chart/utils/line-chart-utils.d.ts +1 -2
  22. package/dist/pie-chart/use-pie-chart-config.d.ts +3 -2
  23. package/dist/project.json +1 -1
  24. package/package.json +1 -1
  25. package/dist/assets/line-chart-Bgiqk66s.js +0 -6
@@ -1,4 +1,4 @@
1
- import{j as a}from"./jsx-runtime-W3oueGCa.js";import{r as s}from"./index-YTOF1_EJ.js";import{D as ea,B as l}from"./legend-Cgq98xea.js";import{L as c}from"./line-chart-Bgiqk66s.js";import{D as la}from"./legend-context-PSa8HhGj.js";import"./index-DHw5ixvP.js";import"./index-BhTLYoCu.js";import"./index-CgYGpm1H.js";import"./get-draggableData-eD2Xdq-6.js";const ta="chartOne-plan-view-chart-controls",na={datasets:[{label:"CH-4ST",lineTension:0,borderColor:"#a30125",pointBackgroundColor:"#a30125",pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:2,fill:!1,data:[{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:.3927,label:[]},{x:0,y:2.4838,label:[]},{x:0,y:7.1727,label:[]},{x:0,y:14.4238,label:[]},{x:0,y:24.1818,label:[]},{x:0,y:36.3728,label:[]},{x:0,y:50.9039,label:[]},{x:0,y:67.6648,label:[]},{x:0,y:86.528,label:[]},{x:0,y:107.3503,label:[]},{x:0,y:129.9733,label:[]},{x:0,y:154.2251,label:[]},{x:0,y:179.9215,label:[]},{x:0,y:206.867,label:[]},{x:0,y:234.8569,label:[]},{x:0,y:263.6785,label:[]},{x:0,y:293.1127,label:[]},{x:0,y:322.9358,label:[]},{x:0,y:344.2833,label:[]},{x:0,y:352.9221,label:[]},{x:0,y:382.9221,label:[]},{x:0,y:412.9221,label:[]},{x:0,y:442.9221,label:[]},{x:0,y:472.9221,label:[]},{x:0,y:502.9221,label:[]},{x:0,y:532.9221,label:[]},{x:0,y:562.9221,label:[]},{x:0,y:592.9221,label:[]},{x:0,y:622.9221,label:[]},{x:0,y:644.2821,label:[]}]},{label:"CH-4",lineTension:0,borderColor:"#0154a3",pointBackgroundColor:"#0154a3",pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:2,fill:!1,data:[{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]}]}]},oa={direction:"vertical",axes:{x:[{label:"E/W [m]",position:"top"}],y:[{label:"N/S [m]",position:"left"}]},additionalAxesOptions:{chartScaleType:"linear"},graph:{showDataLabels:!0,showMinorGridlines:!0,lineTension:0},chartStyling:{height:"100%"},annotations:{showAnnotations:!0,enableDragAnnotation:!0,annotationsData:[]}},sa={controlsPortalId:ta,data:na,options:oa},m=[{label:"Dataset 1",data:[{x:0,y:0},{x:5,y:25}]}],ra={data:{datasets:m},options:{title:"Chart title",chartStyling:{height:"100%"}}},ma={title:"LineChart / Test Cases",component:c,args:{chart:ra}},y=()=>a.jsx(c,{chart:{data:{datasets:[{label:"Duration %",lineTension:"0",pointHitRadius:10,borderColor:"#dc3912",pointBackgroundColor:"#dc3912",borderWidth:2,pointRadius:4,data:[{x:3,y:0},{x:3,y:100}],yAxisID:"y2"}]},options:{direction:"vertical",axes:{x:[{label:"Duration (TempSim long) [d]",position:"bottom"}],y:[{label:"Probability"},{label:"Percentage [%]"}]},annotations:{annotationsData:[{annotationAxis:"y2",color:"darkgrey",value:16},{displayDragCoordinates:!1,color:"#ff9900",label:"P16",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:17,yMin:15,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:66},{displayDragCoordinates:!1,color:"#109618",label:"P66",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:67,yMin:65,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:78},{displayDragCoordinates:!1,color:"#990099",label:"P78",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:79,yMin:77,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:90},{displayDragCoordinates:!1,color:"#0099c6",label:"P90",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:91,yMin:89,yScaleID:"y2"}],enableDragAnnotation:!0,showAnnotations:!0},additionalAxesOptions:{range:{x:{min:3}},chartScaleType:"linear",reverse:!1},graph:{showMinorGridlines:!0},chartStyling:{height:"100%"},chartOptions:{showPoints:!1,enableDragAnnotation:!0}}}}),b=()=>a.jsx(c,{chart:sa}),x=()=>{const[u,n]=s.useState(m),[L,d]=s.useState(0),[g,_]=s.useState(!1),[D,i]=s.useState(!0),[O,C]=s.useState(!1),[f,W]=s.useState(!0),[A,E]=s.useState("linear"),[S,p]=s.useState(!1),M=s.useMemo(()=>({title:"Stress Tester",axes:{x:[{label:"X Axis"}],y:[{label:"Y Axis"}]},chartOptions:{enableDragAnnotation:!0},annotations:{showAnnotations:!0,enableDragAnnotation:!0,annotationsData:[{enableDrag:!0,type:"box",xMin:3.5,xMax:4,yMin:5,yMax:10,color:"rgba(255, 0, 0, 0.3)",label:"DRAG ME!"},{type:"point",enableDrag:!0,xValue:1,yValue:10,radius:ea,color:"red",label:"Draggable Point",labelConfig:{font:`bold 8px ${la}`,color:"rgba(0,0,0,0.7)"}}]},chartStyling:{height:"100%",squareAspectRatio:f},additionalAxesOptions:{chartScaleType:A},legend:{display:!1}}),[u,f,A]),U=s.useMemo(()=>({data:{datasets:u},options:M}),[u,M]),V=()=>{p(!0),i(!0),setTimeout(()=>{i(!1),p(!1)},5e3)},F=()=>{n(m),d(e=>e+1),i(!0),p(!1)},$=()=>{C(!0);const e=[],o=50,r=40;for(let t=0;t<o;t++)setTimeout(()=>{e.push({label:`DS ${t+1}`,data:[{x:t,y:Math.random()*100},{x:t+1,y:Math.random()*100}],borderColor:`hsl(${t*(360/o)}, 100%, 50%)`}),n([...e]),t===15&&(console.warn("Forcing unmount mid-update"),i(!1)),t===25&&(console.warn("Remounting chart"),i(!0),d(h=>h+1)),t===o-1&&(console.log("Async injection complete"),C(!1))},t*r)},z=()=>{n([{label:"Broken Dataset",borderColor:"red"}])},X=()=>{n([])},Y=()=>{n([{label:"X/Y Points",data:[{x:0,y:0},{x:1,y:1}],borderColor:"green"},{label:"Y Only Array",data:[2,4,6],borderColor:"blue"}])},K=()=>{n([{label:"Bad Y Axis Ref",yAxisID:"y-missing",data:[{x:1,y:1},{x:2,y:2}],borderColor:"purple"}])},H=()=>{const e=Array.from({length:5e3},(o,r)=>({x:r,y:Math.sin(r/100)*100}));n([{label:"Big 5k Points",data:e,borderColor:"orange"}])},N=()=>{n([{label:"Corrupt Point Dataset",data:[{x:0,y:10},{x:1},{y:20},null,void 0,"bad-value",{x:5,y:50}],borderColor:"red"}])},G=()=>{n([{label:"Valid A",data:[{x:0,y:1},{x:1,y:2}],borderColor:"blue"},{label:"Corrupt",data:"not-an-array",borderColor:"red"},{label:"Valid B",data:[{x:0,y:3},{x:1,y:4}],borderColor:"green"}])},q=()=>{const e=[];for(let t=0;t<4;t++){const h=Array.from({length:3e3},(ia,aa)=>({x:aa,y:Math.random()*100}));e.push({label:`Stream DS ${t+1}`,data:h,borderColor:`hsl(${t*90}, 100%, 50%)`})}let o=0;const r=setInterval(()=>{n(e.slice(0,o+1)),o++,o===e.length&&clearInterval(r)},500)},J=()=>{E(e=>e==="linear"?"logarithmic":"linear")},Q=()=>{W(e=>!e)},Z=()=>{let e=0;const o=setInterval(()=>{d(r=>r+1),e++,e===100&&clearInterval(o)},30)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:16},children:[a.jsx(l,{label:"Reset to Initial State",colored:!0,onClick:F}),a.jsx(l,{label:"Async Dataset + Unmount",onClick:$,disabled:O}),a.jsx(l,{label:"Set Invalid Dataset",onClick:z}),a.jsx(l,{label:"Set Empty Dataset",onClick:X}),a.jsx(l,{label:"Mixed Data Formats",onClick:Y}),a.jsx(l,{label:"Bad Axis Ref",onClick:K}),a.jsx(l,{label:"Toggle size",onClick:()=>_(!g)}),a.jsx(l,{label:"Toggle Axis Type",onClick:J}),a.jsx(l,{label:"Toggle Aspect Ratio",onClick:Q}),a.jsx(l,{label:"Spam Re-renders",onClick:Z}),a.jsx(l,{label:D?"Unmount Chart":"Remount Chart",onClick:()=>i(e=>!e)}),a.jsx(l,{label:"Manual Re-render",onClick:()=>d(e=>e+1)}),a.jsx(l,{label:"Empty Dataset",onClick:()=>n([])}),a.jsx(l,{label:"Add 5k Points Slowly",onClick:H}),a.jsx(l,{label:"Dataset With Invalid Point",onClick:N}),a.jsx(l,{label:"Malformed Dataset Combo",onClick:G}),a.jsx(l,{label:"Cycle Big Load (Async)",onClick:q}),a.jsx(l,{label:"Timed Unmount During Drag",onClick:V,disabled:S})]}),S&&a.jsx("span",{style:{color:"crimson",fontWeight:"bold"},children:"⏱ Unmounting in 5s – start dragging!"}),a.jsx("div",{style:{height:g?300:null,width:g?300:null,padding:"var(--padding)",overflow:"auto"},children:D?a.jsx(c,{chart:U},L):a.jsx("div",{style:{padding:40,textAlign:"center"},children:"Chart unmounted"})})]})};y.__docgenInfo={description:"",methods:[],displayName:"PartialRangeWithSimilarValues"};b.__docgenInfo={description:"",methods:[],displayName:"closeToValueInDifferentAxes"};x.__docgenInfo={description:"",methods:[],displayName:"StressTest"};var T,v,R;y.parameters={...y.parameters,docs:{...(T=y.parameters)==null?void 0:T.docs,source:{originalSource:`() => {
1
+ import{j as a}from"./jsx-runtime-W3oueGCa.js";import{r as s}from"./index-YTOF1_EJ.js";import{D as ea,B as l}from"./legend-DOA3L9eH.js";import{L as c}from"./line-chart-CpA-Dt9p.js";import{D as la}from"./legend-context-Ck5tFDGN.js";import"./index-DHw5ixvP.js";import"./index-BhTLYoCu.js";import"./index-CgYGpm1H.js";import"./get-draggableData-B6vSKEXH.js";const ta="chartOne-plan-view-chart-controls",na={datasets:[{label:"CH-4ST",lineTension:0,borderColor:"#a30125",pointBackgroundColor:"#a30125",pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:2,fill:!1,data:[{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:.3927,label:[]},{x:0,y:2.4838,label:[]},{x:0,y:7.1727,label:[]},{x:0,y:14.4238,label:[]},{x:0,y:24.1818,label:[]},{x:0,y:36.3728,label:[]},{x:0,y:50.9039,label:[]},{x:0,y:67.6648,label:[]},{x:0,y:86.528,label:[]},{x:0,y:107.3503,label:[]},{x:0,y:129.9733,label:[]},{x:0,y:154.2251,label:[]},{x:0,y:179.9215,label:[]},{x:0,y:206.867,label:[]},{x:0,y:234.8569,label:[]},{x:0,y:263.6785,label:[]},{x:0,y:293.1127,label:[]},{x:0,y:322.9358,label:[]},{x:0,y:344.2833,label:[]},{x:0,y:352.9221,label:[]},{x:0,y:382.9221,label:[]},{x:0,y:412.9221,label:[]},{x:0,y:442.9221,label:[]},{x:0,y:472.9221,label:[]},{x:0,y:502.9221,label:[]},{x:0,y:532.9221,label:[]},{x:0,y:562.9221,label:[]},{x:0,y:592.9221,label:[]},{x:0,y:622.9221,label:[]},{x:0,y:644.2821,label:[]}]},{label:"CH-4",lineTension:0,borderColor:"#0154a3",pointBackgroundColor:"#0154a3",pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:2,fill:!1,data:[{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]},{x:0,y:0,label:[]}]}]},oa={direction:"vertical",axes:{x:[{label:"E/W [m]",position:"top"}],y:[{label:"N/S [m]",position:"left"}]},additionalAxesOptions:{chartScaleType:"linear"},graph:{showDataLabels:!0,showMinorGridlines:!0,lineTension:0},chartStyling:{height:"100%"},annotations:{showAnnotations:!0,enableDragAnnotation:!0,annotationsData:[]}},sa={controlsPortalId:ta,data:na,options:oa},m=[{label:"Dataset 1",data:[{x:0,y:0},{x:5,y:25}]}],ra={data:{datasets:m},options:{title:"Chart title",chartStyling:{height:"100%"}}},ma={title:"LineChart / Test Cases",component:c,args:{chart:ra}},y=()=>a.jsx(c,{chart:{data:{datasets:[{label:"Duration %",lineTension:"0",pointHitRadius:10,borderColor:"#dc3912",pointBackgroundColor:"#dc3912",borderWidth:2,pointRadius:4,data:[{x:3,y:0},{x:3,y:100}],yAxisID:"y2"}]},options:{direction:"vertical",axes:{x:[{label:"Duration (TempSim long) [d]",position:"bottom"}],y:[{label:"Probability"},{label:"Percentage [%]"}]},annotations:{annotationsData:[{annotationAxis:"y2",color:"darkgrey",value:16},{displayDragCoordinates:!1,color:"#ff9900",label:"P16",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:17,yMin:15,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:66},{displayDragCoordinates:!1,color:"#109618",label:"P66",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:67,yMin:65,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:78},{displayDragCoordinates:!1,color:"#990099",label:"P78",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:79,yMin:77,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:90},{displayDragCoordinates:!1,color:"#0099c6",label:"P90",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:91,yMin:89,yScaleID:"y2"}],enableDragAnnotation:!0,showAnnotations:!0},additionalAxesOptions:{range:{x:{min:3}},chartScaleType:"linear",reverse:!1},graph:{showMinorGridlines:!0},chartStyling:{height:"100%"},chartOptions:{showPoints:!1,enableDragAnnotation:!0}}}}),b=()=>a.jsx(c,{chart:sa}),x=()=>{const[u,n]=s.useState(m),[L,d]=s.useState(0),[g,_]=s.useState(!1),[D,i]=s.useState(!0),[O,C]=s.useState(!1),[f,W]=s.useState(!0),[A,E]=s.useState("linear"),[S,p]=s.useState(!1),M=s.useMemo(()=>({title:"Stress Tester",axes:{x:[{label:"X Axis"}],y:[{label:"Y Axis"}]},chartOptions:{enableDragAnnotation:!0},annotations:{showAnnotations:!0,enableDragAnnotation:!0,annotationsData:[{enableDrag:!0,type:"box",xMin:3.5,xMax:4,yMin:5,yMax:10,color:"rgba(255, 0, 0, 0.3)",label:"DRAG ME!"},{type:"point",enableDrag:!0,xValue:1,yValue:10,radius:ea,color:"red",label:"Draggable Point",labelConfig:{font:`bold 8px ${la}`,color:"rgba(0,0,0,0.7)"}}]},chartStyling:{height:"100%",squareAspectRatio:f},additionalAxesOptions:{chartScaleType:A},legend:{display:!1}}),[u,f,A]),U=s.useMemo(()=>({data:{datasets:u},options:M}),[u,M]),V=()=>{p(!0),i(!0),setTimeout(()=>{i(!1),p(!1)},5e3)},F=()=>{n(m),d(e=>e+1),i(!0),p(!1)},$=()=>{C(!0);const e=[],o=50,r=40;for(let t=0;t<o;t++)setTimeout(()=>{e.push({label:`DS ${t+1}`,data:[{x:t,y:Math.random()*100},{x:t+1,y:Math.random()*100}],borderColor:`hsl(${t*(360/o)}, 100%, 50%)`}),n([...e]),t===15&&(console.warn("Forcing unmount mid-update"),i(!1)),t===25&&(console.warn("Remounting chart"),i(!0),d(h=>h+1)),t===o-1&&(console.log("Async injection complete"),C(!1))},t*r)},z=()=>{n([{label:"Broken Dataset",borderColor:"red"}])},X=()=>{n([])},Y=()=>{n([{label:"X/Y Points",data:[{x:0,y:0},{x:1,y:1}],borderColor:"green"},{label:"Y Only Array",data:[2,4,6],borderColor:"blue"}])},K=()=>{n([{label:"Bad Y Axis Ref",yAxisID:"y-missing",data:[{x:1,y:1},{x:2,y:2}],borderColor:"purple"}])},H=()=>{const e=Array.from({length:5e3},(o,r)=>({x:r,y:Math.sin(r/100)*100}));n([{label:"Big 5k Points",data:e,borderColor:"orange"}])},N=()=>{n([{label:"Corrupt Point Dataset",data:[{x:0,y:10},{x:1},{y:20},null,void 0,"bad-value",{x:5,y:50}],borderColor:"red"}])},G=()=>{n([{label:"Valid A",data:[{x:0,y:1},{x:1,y:2}],borderColor:"blue"},{label:"Corrupt",data:"not-an-array",borderColor:"red"},{label:"Valid B",data:[{x:0,y:3},{x:1,y:4}],borderColor:"green"}])},q=()=>{const e=[];for(let t=0;t<4;t++){const h=Array.from({length:3e3},(ia,aa)=>({x:aa,y:Math.random()*100}));e.push({label:`Stream DS ${t+1}`,data:h,borderColor:`hsl(${t*90}, 100%, 50%)`})}let o=0;const r=setInterval(()=>{n(e.slice(0,o+1)),o++,o===e.length&&clearInterval(r)},500)},J=()=>{E(e=>e==="linear"?"logarithmic":"linear")},Q=()=>{W(e=>!e)},Z=()=>{let e=0;const o=setInterval(()=>{d(r=>r+1),e++,e===100&&clearInterval(o)},30)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:16},children:[a.jsx(l,{label:"Reset to Initial State",colored:!0,onClick:F}),a.jsx(l,{label:"Async Dataset + Unmount",onClick:$,disabled:O}),a.jsx(l,{label:"Set Invalid Dataset",onClick:z}),a.jsx(l,{label:"Set Empty Dataset",onClick:X}),a.jsx(l,{label:"Mixed Data Formats",onClick:Y}),a.jsx(l,{label:"Bad Axis Ref",onClick:K}),a.jsx(l,{label:"Toggle size",onClick:()=>_(!g)}),a.jsx(l,{label:"Toggle Axis Type",onClick:J}),a.jsx(l,{label:"Toggle Aspect Ratio",onClick:Q}),a.jsx(l,{label:"Spam Re-renders",onClick:Z}),a.jsx(l,{label:D?"Unmount Chart":"Remount Chart",onClick:()=>i(e=>!e)}),a.jsx(l,{label:"Manual Re-render",onClick:()=>d(e=>e+1)}),a.jsx(l,{label:"Empty Dataset",onClick:()=>n([])}),a.jsx(l,{label:"Add 5k Points Slowly",onClick:H}),a.jsx(l,{label:"Dataset With Invalid Point",onClick:N}),a.jsx(l,{label:"Malformed Dataset Combo",onClick:G}),a.jsx(l,{label:"Cycle Big Load (Async)",onClick:q}),a.jsx(l,{label:"Timed Unmount During Drag",onClick:V,disabled:S})]}),S&&a.jsx("span",{style:{color:"crimson",fontWeight:"bold"},children:"⏱ Unmounting in 5s – start dragging!"}),a.jsx("div",{style:{height:g?300:null,width:g?300:null,padding:"var(--padding)",overflow:"auto"},children:D?a.jsx(c,{chart:U},L):a.jsx("div",{style:{padding:40,textAlign:"center"},children:"Chart unmounted"})})]})};y.__docgenInfo={description:"",methods:[],displayName:"PartialRangeWithSimilarValues"};b.__docgenInfo={description:"",methods:[],displayName:"closeToValueInDifferentAxes"};x.__docgenInfo={description:"",methods:[],displayName:"StressTest"};var T,v,R;y.parameters={...y.parameters,docs:{...(T=y.parameters)==null?void 0:T.docs,source:{originalSource:`() => {
2
2
  return <LineChart chart={{
3
3
  data: {
4
4
  datasets: [{
@@ -1,4 +1,4 @@
1
- import{j as H}from"./jsx-runtime-W3oueGCa.js";import{r as Le}from"./index-YTOF1_EJ.js";import{A as Oe,P as He,C as w,g as je,T as Ie,L as B,a as Ae,d as ve,r as Ne,b as we,s as Me,c as $e,e as ye,f as We,h as Re,i as Ee,j as Ue,k as Be,l as Fe,p as Ve,m as Ge,n as Ze,o as qe,q as Xe,t as Ye}from"./legend-context-PSa8HhGj.js";import{D as ze,a as Je}from"./bar-chart-const-Cgj9sgUU.js";import"./index-CgYGpm1H.js";const Ke="_chart_1jdnu_1",Qe="_fixedHeight_1jdnu_13",ea="_stretchHeight_1jdnu_19",M={chart:Ke,fixedHeight:Qe,stretchHeight:ea},aa=e=>({width:e==null?void 0:e.width,height:e==null?void 0:e.height,maintainAspectRatio:(e==null?void 0:e.maintainAspectRatio)||!1,staticChartHeight:(e==null?void 0:e.staticChartHeight)||!1,performanceMode:(e==null?void 0:e.performanceMode)??!0}),ta=e=>({tooltips:(e==null?void 0:e.tooltips)??!0,showLabelsInTooltips:(e==null?void 0:e.showLabelsInTooltips)||!1,scientificNotation:(e==null?void 0:e.scientificNotation)??!0}),sa=e=>({showDataLabels:(e==null?void 0:e.showDataLabels)||!1,stacked:(e==null?void 0:e.stacked)||!1,cutout:(e==null?void 0:e.cutout)||0}),ra=e=>({display:(e==null?void 0:e.display)??!0,useDataset:(e==null?void 0:e.useDataset)||!1,position:(e==null?void 0:e.position)||He.Bottom,align:(e==null?void 0:e.align)||Oe.Center}),na=e=>({enableZoom:(e==null?void 0:e.enableZoom)||!1,enablePan:(e==null?void 0:e.enablePan)||!1}),oa=e=>({onLegendClick:e==null?void 0:e.onLegendClick,onHover:e==null?void 0:e.onHover,onUnhover:e==null?void 0:e.onUnhover}),la=e=>({labels:(e==null?void 0:e.labels)||[],datasets:(e==null?void 0:e.datasets)||[]}),Pe=e=>{const l=(e==null?void 0:e.chart)||{},s=(l==null?void 0:l.options)||{};return{testId:(l==null?void 0:l.testId)??null,data:la(l==null?void 0:l.data),options:{title:(s==null?void 0:s.title)||"",chartStyling:aa(s==null?void 0:s.chartStyling),tooltip:ta(s==null?void 0:s.tooltip),graph:sa(s==null?void 0:s.graph),legend:ra(s==null?void 0:s.legend),chartOptions:na(s==null?void 0:s.chartOptions),interactions:oa(s==null?void 0:s.interactions)}}},ia=e=>{const[l,s]=Le.useState(!1),{data:i,options:t}=e,j=(u=>{var n;const a=[...u];if(t.graph.stacked){const o={label:((n=a==null?void 0:a[0])==null?void 0:n.label)??"",backgroundColor:[],borderColor:"",borderWidth:Number(a[0].borderWidth)||1,data:[],borderDash:[]};return i.labels.map((c,d)=>{a.map((g,b)=>{o.data.push(g.data[d]);const{backgroundColor:x}=g,{borderColor:f}=g;o.backgroundColor.push((Array.isArray(x)?x[d%((f==null?void 0:f.length)||1)]:x)||w[d]+`${99-10*b}`),o.borderColor=f??""})}),[o]}return a.map((o,c)=>{const{borderWidth:d="1"}=o??{},g=parseFloat(String(d))||1,b=w[c],x=o.borderColor||b,f=o.backgroundColor||je(w);return{...o,borderWidth:g,borderColor:x,backgroundColor:f}})})(i.datasets),N=()=>t.title!==""?{display:!0,text:e.options.title}:{},I=(u,a,r)=>{var o;const{chart:n}=r??{};if(a&&n){const{index:c=0}=a;if(n.toggleDataVisibility(c),n.update(),(o=t.interactions)!=null&&o.onLegendClick){const d=n.isDatasetVisible(c);t.interactions.onLegendClick(a.text,!d)}}};return{generatedDatasets:j,getTitle:N,legendClick:I,onClick:(u,a,r)=>{r.resetZoom()},onHover:(u,a)=>{if(l&&!(a!=null&&a.length)&&(s(!1),t.interactions.onUnhover&&t.interactions.onUnhover(u)),!l&&(a!=null&&a.length)&&(s(!0),t.interactions.onHover)){const{index:r,datasetIndex:n}=a[0],o=j;t.interactions.onHover(u,n,r,o)}},getDatalabels:()=>t.graph.showDataLabels?{display:"auto",align:"center",anchor:"center",formatter:(u,a)=>{if(a.chart.getDatasetMeta(t.graph.stacked?0:a.datasetIndex).data[a.dataIndex].hidden)return"";const r=a.dataset.data[a.dataIndex],n=(r==null?void 0:r.label)||(typeof r=="number"?r:Array.isArray(r)?r.reduce((c,d,g)=>g===0?`${c} ${d}`:`${c}, ${d}`,""):"");return typeof r=="number"?Number.isInteger(n)?n:n.toFixed(2):n}}:{display:!1},getLegend:()=>({position:t.legend.position,display:t.legend.display,align:t.legend.align,labels:{boxHeight:6,boxWidth:6,usePointStyle:!0,filter:u=>{var a;return t.legend.useDataset?!((a=i.datasets[u.index])!=null&&a.hideLegend):!0}},onClick:I}),getToolTips:()=>{const u=a=>{var n;let r={};return(n=t==null?void 0:t.tooltip)!=null&&n.scientificNotation?(Math.abs(a)<ze||Math.abs(a)>Je)&&(r={roundScientificCoefficient:3}):r={scientific:!1},ve(Ne(a),r)};return{callbacks:{title:a=>{const{dataIndex:r}=a[0],n=t.graph.stacked?parseInt(String(r/i.labels.length)):r;return`${i.labels[n]}`},label:a=>{var b;const{dataIndex:r}=a,n=t.graph.stacked?r%i.datasets.length:a.datasetIndex,o=i.datasets.length>1?`${(b=i.datasets[n])==null?void 0:b.label}: `:"",c=a.dataset.data[r],d=typeof c=="object"?`${c.value||""} ${t.tooltip.showLabelsInTooltips&&c.label?"("+c.label+")":""}`:c,g=i!=null&&i.yUnit?`[${i==null?void 0:i.yUnit}]`:"";return`${o} ${u(d)} ${g}`}},padding:Ae,boxWidth:B,boxHeight:B,boxPadding:Ie,usePointStyle:!0}}}};Re.register(Ee,Ue,Be,Fe,Ve,Ge,Ze,qe,Xe,Ye);const ca=e=>{Me();const l=Pe(e),s=Le.useRef(null),{data:i,options:t,testId:y}=l,{generatedDatasets:j,getTitle:N,onClick:I,onHover:W,getDatalabels:R,getLegend:E,getToolTips:U}=ia(l);return H.jsx("div",{className:$e(M.chart,!t.chartStyling.width||!t.chartStyling.height?t.chartStyling.staticChartHeight?M.fixedHeight:M.stretchHeight:""),style:{width:t.chartStyling.width||"auto",height:t.chartStyling.height||"auto"},"data-testid":y,children:H.jsx(ye,{ref:s,data:{datasets:j,labels:t.graph.stacked?void 0:i.labels},options:{cutout:t.graph.cutout,onClick:I,responsive:!0,maintainAspectRatio:t.chartStyling.maintainAspectRatio,animation:t.chartStyling.performanceMode?!1:{duration:We.FAST},hover:{mode:"nearest",intersect:!0},onHover:W,plugins:{annotation:!1,title:N(),datalabels:R(),tooltip:U(),legend:E()}}})})},$=e=>{const{options:l}=Pe(e);return H.jsx(we,{options:l,children:H.jsx(ca,{...e})})};$.__docgenInfo={description:"",methods:[],displayName:"PieChartWithLegend",props:{chart:{required:!0,tsType:{name:"IPieChartData"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""}}};const h=["label 1","label 2","label 3"],C={label:"data1",data:[3,8,7]},_e={label:"data2",data:[1,2,3]},Te={label:"data3",data:[5,0,4]},da={label:"spacing data",offset:40,data:[3,8,7]},ua={label:"hover data",data:[3,8,7],hoverOffset:40},ke={label:"data",data:[{value:210,label:"label"},{value:333,label:"labal"},{value:248,label:"lebel"}]},ha={label:"data",data:[210,333,248]},pa={data:{labels:h,datasets:[C]}},ga={data:{labels:h,datasets:[C,_e,Te]}},ba={data:{labels:h,datasets:[C,_e,Te]},options:{title:"Stacked",graph:{stacked:!0}}},fa={data:{labels:h,datasets:[ke]},options:{title:"With custom datalabels",graph:{showDataLabels:!0}}},ma={data:{labels:h,datasets:[ha]},options:{title:"With value as datalabels",graph:{showDataLabels:!0}}},Ca={data:{labels:h,datasets:[ke]},options:{title:"With datalabels in tooltips",tooltip:{showLabelsInTooltips:!0}}},xa={data:{labels:h,datasets:[ua]},options:{title:"Hover offset"}},Da={data:{labels:h,datasets:[da]},options:{title:"Segment offset"}},Sa={data:{labels:h,datasets:[C]},options:{chartStyling:{performanceMode:!1}}},La={data:{labels:h,datasets:[C]},options:{title:"Cutout 50%",graph:{cutout:"50%"}}},Pa={data:{labels:h,datasets:[C]},options:{title:"Cutout 20 pixels",graph:{cutout:20}}},Ia={title:"PieChart",component:$,args:{chart:pa}},p=e=>H.jsx($,{...e}),A=p.bind({}),D=p.bind({});D.args={chart:ga};const S=p.bind({});S.args={chart:ba};const L=p.bind({});L.args={chart:fa};const P=p.bind({});P.args={chart:ma};const _=p.bind({});_.args={chart:Ca};const T=p.bind({});T.args={chart:Sa};const k=p.bind({});k.args={chart:La};const O=p.bind({});O.args={chart:Pa};const m=p.bind({});m.args={chart:xa};const v=p.bind({});m.args={chart:Da};var F,V,G;A.parameters={...A.parameters,docs:{...(F=A.parameters)==null?void 0:F.docs,source:{originalSource:`args => {
1
+ import{j as H}from"./jsx-runtime-W3oueGCa.js";import{r as Le}from"./index-YTOF1_EJ.js";import{A as Oe,P as He,C as w,g as je,T as Ie,L as B,a as Ae,d as ve,r as Ne,b as we,s as Me,c as $e,e as ye,f as We,h as Re,i as Ee,j as Ue,k as Be,l as Fe,p as Ve,m as Ge,n as Ze,o as qe,q as Xe,t as Ye}from"./legend-context-Ck5tFDGN.js";import{D as ze,a as Je}from"./bar-chart-const-Cgj9sgUU.js";import"./index-CgYGpm1H.js";const Ke="_chart_1jdnu_1",Qe="_fixedHeight_1jdnu_13",ea="_stretchHeight_1jdnu_19",M={chart:Ke,fixedHeight:Qe,stretchHeight:ea},aa=e=>({width:e==null?void 0:e.width,height:e==null?void 0:e.height,maintainAspectRatio:(e==null?void 0:e.maintainAspectRatio)||!1,staticChartHeight:(e==null?void 0:e.staticChartHeight)||!1,performanceMode:(e==null?void 0:e.performanceMode)??!0}),ta=e=>({tooltips:(e==null?void 0:e.tooltips)??!0,showLabelsInTooltips:(e==null?void 0:e.showLabelsInTooltips)||!1,scientificNotation:(e==null?void 0:e.scientificNotation)??!0}),sa=e=>({showDataLabels:(e==null?void 0:e.showDataLabels)||!1,stacked:(e==null?void 0:e.stacked)||!1,cutout:(e==null?void 0:e.cutout)||0}),ra=e=>({display:(e==null?void 0:e.display)??!0,useDataset:(e==null?void 0:e.useDataset)||!1,position:(e==null?void 0:e.position)||He.Bottom,align:(e==null?void 0:e.align)||Oe.Center}),na=e=>({enableZoom:(e==null?void 0:e.enableZoom)||!1,enablePan:(e==null?void 0:e.enablePan)||!1}),oa=e=>({onLegendClick:e==null?void 0:e.onLegendClick,onHover:e==null?void 0:e.onHover,onUnhover:e==null?void 0:e.onUnhover}),la=e=>({labels:(e==null?void 0:e.labels)||[],datasets:(e==null?void 0:e.datasets)||[]}),Pe=e=>{const l=(e==null?void 0:e.chart)||{},s=(l==null?void 0:l.options)||{};return{testId:(l==null?void 0:l.testId)??null,data:la(l==null?void 0:l.data),options:{title:(s==null?void 0:s.title)||"",chartStyling:aa(s==null?void 0:s.chartStyling),tooltip:ta(s==null?void 0:s.tooltip),graph:sa(s==null?void 0:s.graph),legend:ra(s==null?void 0:s.legend),chartOptions:na(s==null?void 0:s.chartOptions),interactions:oa(s==null?void 0:s.interactions)}}},ia=e=>{const[l,s]=Le.useState(!1),{data:i,options:t}=e,j=(u=>{var n;const a=[...u];if(t.graph.stacked){const o={label:((n=a==null?void 0:a[0])==null?void 0:n.label)??"",backgroundColor:[],borderColor:"",borderWidth:Number(a[0].borderWidth)||1,data:[],borderDash:[]};return i.labels.map((c,d)=>{a.map((g,b)=>{o.data.push(g.data[d]);const{backgroundColor:x}=g,{borderColor:f}=g;o.backgroundColor.push((Array.isArray(x)?x[d%((f==null?void 0:f.length)||1)]:x)||w[d]+`${99-10*b}`),o.borderColor=f??""})}),[o]}return a.map((o,c)=>{const{borderWidth:d="1"}=o??{},g=parseFloat(String(d))||1,b=w[c],x=o.borderColor||b,f=o.backgroundColor||je(w);return{...o,borderWidth:g,borderColor:x,backgroundColor:f}})})(i.datasets),N=()=>t.title!==""?{display:!0,text:e.options.title}:{},I=(u,a,r)=>{var o;const{chart:n}=r??{};if(a&&n){const{index:c=0}=a;if(n.toggleDataVisibility(c),n.update(),(o=t.interactions)!=null&&o.onLegendClick){const d=n.isDatasetVisible(c);t.interactions.onLegendClick(a.text,!d)}}};return{generatedDatasets:j,getTitle:N,legendClick:I,onClick:(u,a,r)=>{r.resetZoom()},onHover:(u,a)=>{if(l&&!(a!=null&&a.length)&&(s(!1),t.interactions.onUnhover&&t.interactions.onUnhover(u)),!l&&(a!=null&&a.length)&&(s(!0),t.interactions.onHover)){const{index:r,datasetIndex:n}=a[0],o=j;t.interactions.onHover(u,n,r,o)}},getDatalabels:()=>t.graph.showDataLabels?{display:"auto",align:"center",anchor:"center",formatter:(u,a)=>{if(a.chart.getDatasetMeta(t.graph.stacked?0:a.datasetIndex).data[a.dataIndex].hidden)return"";const r=a.dataset.data[a.dataIndex],n=(r==null?void 0:r.label)||(typeof r=="number"?r:Array.isArray(r)?r.reduce((c,d,g)=>g===0?`${c} ${d}`:`${c}, ${d}`,""):"");return typeof r=="number"?Number.isInteger(n)?n:n.toFixed(2):n}}:{display:!1},getLegend:()=>({position:t.legend.position,display:t.legend.display,align:t.legend.align,labels:{boxHeight:6,boxWidth:6,usePointStyle:!0,filter:u=>{var a;return t.legend.useDataset?!((a=i.datasets[u.index])!=null&&a.hideLegend):!0}},onClick:I}),getToolTips:()=>{const u=a=>{var n;let r={};return(n=t==null?void 0:t.tooltip)!=null&&n.scientificNotation?(Math.abs(a)<ze||Math.abs(a)>Je)&&(r={roundScientificCoefficient:3}):r={scientific:!1},ve(Ne(a),r)};return{callbacks:{title:a=>{const{dataIndex:r}=a[0],n=t.graph.stacked?parseInt(String(r/i.labels.length)):r;return`${i.labels[n]}`},label:a=>{var b;const{dataIndex:r}=a,n=t.graph.stacked?r%i.datasets.length:a.datasetIndex,o=i.datasets.length>1?`${(b=i.datasets[n])==null?void 0:b.label}: `:"",c=a.dataset.data[r],d=typeof c=="object"?`${c.value||""} ${t.tooltip.showLabelsInTooltips&&c.label?"("+c.label+")":""}`:c,g=i!=null&&i.yUnit?`[${i==null?void 0:i.yUnit}]`:"";return`${o} ${u(d)} ${g}`}},padding:Ae,boxWidth:B,boxHeight:B,boxPadding:Ie,usePointStyle:!0}}}};Re.register(Ee,Ue,Be,Fe,Ve,Ge,Ze,qe,Xe,Ye);const ca=e=>{Me();const l=Pe(e),s=Le.useRef(null),{data:i,options:t,testId:y}=l,{generatedDatasets:j,getTitle:N,onClick:I,onHover:W,getDatalabels:R,getLegend:E,getToolTips:U}=ia(l);return H.jsx("div",{className:$e(M.chart,!t.chartStyling.width||!t.chartStyling.height?t.chartStyling.staticChartHeight?M.fixedHeight:M.stretchHeight:""),style:{width:t.chartStyling.width||"auto",height:t.chartStyling.height||"auto"},"data-testid":y,children:H.jsx(ye,{ref:s,data:{datasets:j,labels:t.graph.stacked?void 0:i.labels},options:{cutout:t.graph.cutout,onClick:I,responsive:!0,maintainAspectRatio:t.chartStyling.maintainAspectRatio,animation:t.chartStyling.performanceMode?!1:{duration:We.FAST},hover:{mode:"nearest",intersect:!0},onHover:W,plugins:{annotation:!1,title:N(),datalabels:R(),tooltip:U(),legend:E()}}})})},$=e=>{const{options:l}=Pe(e);return H.jsx(we,{options:l,children:H.jsx(ca,{...e})})};$.__docgenInfo={description:"",methods:[],displayName:"PieChartWithLegend",props:{chart:{required:!0,tsType:{name:"IPieChartData"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""}}};const h=["label 1","label 2","label 3"],C={label:"data1",data:[3,8,7]},_e={label:"data2",data:[1,2,3]},Te={label:"data3",data:[5,0,4]},da={label:"spacing data",offset:40,data:[3,8,7]},ua={label:"hover data",data:[3,8,7],hoverOffset:40},ke={label:"data",data:[{value:210,label:"label"},{value:333,label:"labal"},{value:248,label:"lebel"}]},ha={label:"data",data:[210,333,248]},pa={data:{labels:h,datasets:[C]}},ga={data:{labels:h,datasets:[C,_e,Te]}},ba={data:{labels:h,datasets:[C,_e,Te]},options:{title:"Stacked",graph:{stacked:!0}}},fa={data:{labels:h,datasets:[ke]},options:{title:"With custom datalabels",graph:{showDataLabels:!0}}},ma={data:{labels:h,datasets:[ha]},options:{title:"With value as datalabels",graph:{showDataLabels:!0}}},Ca={data:{labels:h,datasets:[ke]},options:{title:"With datalabels in tooltips",tooltip:{showLabelsInTooltips:!0}}},xa={data:{labels:h,datasets:[ua]},options:{title:"Hover offset"}},Da={data:{labels:h,datasets:[da]},options:{title:"Segment offset"}},Sa={data:{labels:h,datasets:[C]},options:{chartStyling:{performanceMode:!1}}},La={data:{labels:h,datasets:[C]},options:{title:"Cutout 50%",graph:{cutout:"50%"}}},Pa={data:{labels:h,datasets:[C]},options:{title:"Cutout 20 pixels",graph:{cutout:20}}},Ia={title:"PieChart",component:$,args:{chart:pa}},p=e=>H.jsx($,{...e}),A=p.bind({}),D=p.bind({});D.args={chart:ga};const S=p.bind({});S.args={chart:ba};const L=p.bind({});L.args={chart:fa};const P=p.bind({});P.args={chart:ma};const _=p.bind({});_.args={chart:Ca};const T=p.bind({});T.args={chart:Sa};const k=p.bind({});k.args={chart:La};const O=p.bind({});O.args={chart:Pa};const m=p.bind({});m.args={chart:xa};const v=p.bind({});m.args={chart:Da};var F,V,G;A.parameters={...A.parameters,docs:{...(F=A.parameters)==null?void 0:F.docs,source:{originalSource:`args => {
2
2
  return <PieChart
3
3
  // eslint-disable-next-line react/jsx-props-no-spreading
4
4
  {...args} />;
@@ -1,3 +1,3 @@
1
- import{j as c}from"./jsx-runtime-W3oueGCa.js";import{r as v}from"./index-YTOF1_EJ.js";import{c as p,D as j}from"./DocsRenderer-CFRXHY34-C8MDfQlB.js";import{e as E}from"./index-CgYGpm1H.js";import"./preview-FuT2SsKI.js";import"./iframe-D3u0vI49.js";import"./index-DHw5ixvP.js";import"./index-BhTLYoCu.js";import"./index-Dytf1aFS.js";import"./client-DnE3718B.js";var g="DARK_MODE";function f(t){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},f(t)}var b;function A(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,n)}return e}function D(t){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?arguments[r]:{};r%2?A(Object(e),!0).forEach(function(n){I(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):A(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function I(t,r,e){return r=M(r),r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function M(t){var r=R(t,"string");return f(r)==="symbol"?r:String(r)}function R(t,r){if(f(t)!=="object"||t===null)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var n=e.call(t,r);if(f(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function y(t){return L(t)||N(t)||K(t)||x()}function x(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{j as c}from"./jsx-runtime-W3oueGCa.js";import{r as v}from"./index-YTOF1_EJ.js";import{c as p,D as j}from"./DocsRenderer-CFRXHY34-BVHN4IgT.js";import{e as E}from"./index-CgYGpm1H.js";import"./preview-Da3Tuoe0.js";import"./iframe-C_yRnxwh.js";import"./index-DHw5ixvP.js";import"./index-BhTLYoCu.js";import"./index-Dytf1aFS.js";import"./client-DnE3718B.js";var g="DARK_MODE";function f(t){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},f(t)}var b;function A(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,n)}return e}function D(t){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?arguments[r]:{};r%2?A(Object(e),!0).forEach(function(n){I(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):A(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function I(t,r,e){return r=M(r),r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function M(t){var r=R(t,"string");return f(r)==="symbol"?r:String(r)}function R(t,r){if(f(t)!=="object"||t===null)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var n=e.call(t,r);if(f(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function y(t){return L(t)||N(t)||K(t)||x()}function x(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(t,r){if(t){if(typeof t=="string")return O(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return O(t,r)}}function N(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function L(t){if(Array.isArray(t))return O(t)}function O(t,r){(r==null||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}const{global:U}=__STORYBOOK_MODULE_GLOBAL__,{STORY_CHANGED:st,SET_STORIES:ct,DOCS_RENDERED:ft}=__STORYBOOK_MODULE_CORE_EVENTS__;var T=U,Y=T.document,h=T.window,C="sb-addon-themes-3";(b=h.matchMedia)===null||b===void 0||b.call(h,"(prefers-color-scheme: dark)");var S={classTarget:"body",dark:p.dark,darkClass:["dark"],light:p.light,lightClass:["light"],stylePreview:!1,userHasExplicitlySetTheTheme:!1},k=function(r){h.localStorage.setItem(C,JSON.stringify(r))},B=function(r,e){var n=e.current,a=e.darkClass,l=a===void 0?S.darkClass:a,o=e.lightClass,i=o===void 0?S.lightClass:o;if(n==="dark"){var u,s;(u=r.classList).remove.apply(u,y(d(i))),(s=r.classList).add.apply(s,y(d(l)))}else{var m,_;(m=r.classList).remove.apply(m,y(d(l))),(_=r.classList).add.apply(_,y(d(i)))}},d=function(r){var e=[];return e.concat(r).map(function(n){return n})},W=function(r){var e=Y.querySelector(r.classTarget);e&&B(e,r)},P=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=h.localStorage.getItem(C);if(typeof e=="string"){var n=JSON.parse(e);return r&&(r.dark&&!E(n.dark,r.dark)&&(n.dark=r.dark,k(n)),r.light&&!E(n.light,r.light)&&(n.light=r.light,k(n))),n}return D(D({},S),r)};W(P());function H(t,r){return q(t)||G(t,r)||$(t,r)||V()}function V(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $(t,r){if(t){if(typeof t=="string")return w(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return w(t,r)}}function w(t,r){(r==null||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function G(t,r){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var n,a,l,o,i=[],u=!0,s=!1;try{if(l=(e=e.call(t)).next,r!==0)for(;!(u=(n=l.call(e)).done)&&(i.push(n.value),i.length!==r);u=!0);}catch(m){s=!0,a=m}finally{try{if(!u&&e.return!=null&&(o=e.return(),Object(o)!==o))return}finally{if(s)throw a}}return i}}function q(t){if(Array.isArray(t))return t}const{addons:J,useState:F,useEffect:z}=__STORYBOOK_MODULE_PREVIEW_API__;function Q(){var t=F(P().current==="dark"),r=H(t,2),e=r[0],n=r[1];return z(function(){var a=J.getChannel();return a.on(g,n),function(){return a.off(g,n)}},[]),e}const{definePreview:mt}=__STORYBOOK_MODULE_PREVIEW_API__,yt=[t=>c.jsx(c.Fragment,{children:c.jsx(t,{})}),t=>{const r=Q();return v.useEffect(()=>(document.documentElement.dataset.theme=r?"dark":"default",()=>{delete document.documentElement.dataset.theme}),[r]),c.jsx(t,{})}],X=t=>{const[r,e]=v.useState(!1);return v.useEffect(()=>{const n=a=>e(a);return t.context.channel.on(g,n),()=>{t.context.channel.off(g,n)}},[t.context.channel]),c.jsx(j,{...t,theme:r?p.dark:p.light})},dt={docs:{container:X},darkMode:{current:"light",stylePreview:!0}},pt=["autodocs"];export{yt as decorators,dt as parameters,pt as tags};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-CFRXHY34-C8MDfQlB.js","./iframe-D3u0vI49.js","./index-YTOF1_EJ.js","./jsx-runtime-W3oueGCa.js","./index-DHw5ixvP.js","./index-BhTLYoCu.js","./index-Dytf1aFS.js","./client-DnE3718B.js"])))=>i.map(i=>d[i]);
2
- import{_ as o}from"./iframe-D3u0vI49.js";var s=Object.defineProperty,i=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},n={};i(n,{parameters:()=>d});var _=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((e,r)=>{let[t,a]=r;return a.excludeFromDocsStories&&(e[t]=!0),e},{}),d={docs:{renderer:async()=>{let{DocsRenderer:e}=await o(async()=>{const{DocsRenderer:r}=await import("./DocsRenderer-CFRXHY34-C8MDfQlB.js").then(t=>t.e);return{DocsRenderer:r}},__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url);return new e},stories:{filter:e=>{var r;return(e.tags||[]).filter(t=>_[t]).length===0&&!((r=e.parameters.docs)!=null&&r.disable)}}}};export{d as parameters};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-CFRXHY34-BVHN4IgT.js","./iframe-C_yRnxwh.js","./index-YTOF1_EJ.js","./jsx-runtime-W3oueGCa.js","./index-DHw5ixvP.js","./index-BhTLYoCu.js","./index-Dytf1aFS.js","./client-DnE3718B.js"])))=>i.map(i=>d[i]);
2
+ import{_ as o}from"./iframe-C_yRnxwh.js";var s=Object.defineProperty,i=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},n={};i(n,{parameters:()=>d});var _=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((e,r)=>{let[t,a]=r;return a.excludeFromDocsStories&&(e[t]=!0),e},{}),d={docs:{renderer:async()=>{let{DocsRenderer:e}=await o(async()=>{const{DocsRenderer:r}=await import("./DocsRenderer-CFRXHY34-BVHN4IgT.js").then(t=>t.e);return{DocsRenderer:r}},__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url);return new e},stories:{filter:e=>{var r;return(e.tags||[]).filter(t=>_[t]).length===0&&!((r=e.parameters.docs)!=null&&r.disable)}}}};export{d as parameters};
@@ -1,4 +1,4 @@
1
- import{j as g}from"./jsx-runtime-W3oueGCa.js";import{r as ye}from"./index-YTOF1_EJ.js";import{d as ve,r as Ae,z as ke,B as u,S as De,E as je,O as He,N as we,f as q,C as Me,A as Ee,P as Ne,Y as Pe,G as z,b as Ie,s as Ue,Q as qe,Z as ze,U as Ze,h as Fe,i as Ye,V as Ve,j as Xe,p as $e,m as Je,n as Qe,q as Ke,t as Ge}from"./legend-context-PSa8HhGj.js";import{j as et,u as tt,t as at,o as st,p as rt,l as lt,H as ot,L as nt,m as ct,n as dt}from"./legend-Cgq98xea.js";import{D as it,a as ut}from"./bar-chart-const-Cgj9sgUU.js";import"./index-CgYGpm1H.js";import"./index-DHw5ixvP.js";import"./index-BhTLYoCu.js";const Z=(e,t)=>{let a={};return t?(Math.abs(e)<it||Math.abs(e)>ut)&&(a={roundScientificCoefficient:3}):a={scientific:!1},ve(Ae(e),a)},gt=(e,t)=>{var a;if((a=t==null?void 0:t.tooltip)!=null&&a.showLabelsInTooltips){const r=e[0],{label:s}=(r==null?void 0:r.dataset)??{};return s}},ht=(e,t)=>{var o;const{raw:a,dataset:r}=e??{},s=a==null?void 0:a.label,n=(o=t==null?void 0:t.tooltip)==null?void 0:o.scientificNotation;return`${s??(r==null?void 0:r.label)} ( x: ${Z(a==null?void 0:a.x,n)} , y: ${Z(a==null?void 0:a.y,n)} )`},mt=e=>{var t,a,r;return{enabled:(t=e==null?void 0:e.tooltip)==null?void 0:t.enabled,callbacks:{title:s=>gt(s,e),label:s=>ht(s,e)},backgroundColor:(a=e==null?void 0:e.tooltip)==null?void 0:a.backgroundColor,displayColors:(r=e==null?void 0:e.tooltip)==null?void 0:r.displayColors,padding:7}},F=({options:e,axisType:t=u.X,currentScale:a})=>{var C,T,p,b,L,f,w,y,M;const r=ke(e.direction),s=a||((T=(C=e==null?void 0:e.axes)==null?void 0:C[t])==null?void 0:T[0]),n=r&&t===u.Y||!r&&t===u.X,o=(s==null?void 0:s.gridLines)||{},x=()=>{var l;const c=r?u.Y:u.X;return t===c?(l=e==null?void 0:e.additionalAxesOptions)==null?void 0:l.reverse:!1},S=()=>{const c=e==null?void 0:e.additionalAxesOptions;return{...{stepSize:(s==null?void 0:s.stepSize)??(t===u.Y?c==null?void 0:c.stepSize:void 0)},includeBounds:!1,font:{size:je}}};return{type:De.Linear,position:s==null?void 0:s.position,beginAtZero:(p=e==null?void 0:e.additionalAxesOptions)==null?void 0:p.beginAtZero,reverse:x(),suggestedMax:(b=e==null?void 0:e.additionalAxesOptions)==null?void 0:b.suggestedMax,suggestedMin:(L=e==null?void 0:e.additionalAxesOptions)==null?void 0:L.suggestedMin,min:n?(f=e==null?void 0:e.additionalAxesOptions)==null?void 0:f.min:void 0,max:n?(w=e==null?void 0:e.additionalAxesOptions)==null?void 0:w.max:void 0,title:{display:!!((y=s==null?void 0:s.label)!=null&&y.length)||!!((M=s==null?void 0:s.unit)!=null&&M.length),text:(s==null?void 0:s.label)||(s==null?void 0:s.unit),padding:0},ticks:S(),grid:{...o}}},bt=e=>{const t=F({options:e,axisType:u.X}),a=F({options:e,axisType:u.Y});return{x:t,y:a}},ft=(e,t)=>{const{data:a,options:r}=e,{interactions:s,chartStyling:n}=r,[o,x]=ye.useState(!1),{legend:S,customLegendPlugin:C,legendClick:T}=et({chartRef:t,options:r}),{state:p}=tt(),{annotation:b}=p,f=(c=>c.map((l,R)=>{const{borderWidth:E=st}=l??{},_e=parseFloat(String(E))||1,U=Me[R],We=l.borderColor??U,Be=l.backgroundColor??U;return{...l,borderWidth:_e,borderColor:We,backgroundColor:Be}}))(a.datasets),w=(c,l,R)=>{R.resetZoom()},y=(c,l)=>{if(o&&!(l!=null&&l.length)&&(x(!1),s.onUnhover&&s.onUnhover(c)),!o&&(l!=null&&l.length)&&(x(!0),s.onHover)){const{index:R,datasetIndex:E}=l[0];s.onHover(c,E,R,f)}},M={onClick:w,onHover:y,...n,interactions:{onLegendClick:T,onHover:y},scales:bt(e==null?void 0:e.options),animation:n.performanceMode?{duration:q.NO}:{duration:q.FAST,onComplete:s==null?void 0:s.onAnimationComplete},plugins:{legend:{...S,display:!1,events:[]},customLegendPlugin:C,title:He(r),annotation:at(b),chartAreaBorder:{borderColor:we},datalabels:{display:r.graph.showDataLabels},tooltip:mt(r)}};return{generatedDatasets:f,scatterOptions:M}};var d=(e=>(e[e.TopToBottom=0]="TopToBottom",e[e.BottomToTop=1]="BottomToTop",e[e.LeftToRight=2]="LeftToRight",e[e.RightToLeft=3]="RightToLeft",e[e.TopLeftToBottomRight=4]="TopLeftToBottomRight",e[e.BottomRightToTopLeft=5]="BottomRightToTopLeft",e[e.BottomLeftToTopRight=6]="BottomLeftToTopRight",e[e.TopRightToBottomLeft=7]="TopRightToBottomLeft",e))(d||{});const xt=e=>({display:(e==null?void 0:e.display)??!1,gradientColors:(e==null?void 0:e.gradientColors)??Pe,direction:(e==null?void 0:e.direction)??d.BottomLeftToTopRight}),Ct=e=>({width:(e==null?void 0:e.width)??z,height:(e==null?void 0:e.height)??z,maintainAspectRatio:(e==null?void 0:e.maintainAspectRatio)||!1,staticChartHeight:(e==null?void 0:e.staticChartHeight)||!1,performanceMode:(e==null?void 0:e.performanceMode)??!0,gradient:xt(e==null?void 0:e.gradient)}),Tt=e=>({enabled:(e==null?void 0:e.enabled)??!0,tooltips:(e==null?void 0:e.tooltips)??!0,showLabelsInTooltips:(e==null?void 0:e.showLabelsInTooltips)||!1,backgroundColor:(e==null?void 0:e.backgroundColor)||"#333",displayColors:(e==null?void 0:e.displayColors)||!1,scientificNotation:(e==null?void 0:e.scientificNotation)??!0}),pt=e=>({showMinorGridlines:(e==null?void 0:e.showMinorGridlines)??!1,showDataLabels:(e==null?void 0:e.showDataLabels)??!1}),St=e=>({display:(e==null?void 0:e.display)??!0,useDataset:(e==null?void 0:e.useDataset)||!1,position:(e==null?void 0:e.position)||Ne.BottomLeft,align:(e==null?void 0:e.align)||Ee.Center}),Lt=e=>({enableZoom:(e==null?void 0:e.enableZoom)||!1,enablePan:(e==null?void 0:e.enablePan)||!1}),yt=e=>({onLegendClick:e==null?void 0:e.onLegendClick,onHover:e==null?void 0:e.onHover,onUnhover:e==null?void 0:e.onUnhover,onAnimationComplete:e==null?void 0:e.onAnimationComplete}),Rt=e=>({labels:(e==null?void 0:e.labels)||[],datasets:(e==null?void 0:e.datasets)||[]}),Ot=e=>e?e.map(t=>({...t,display:(t==null?void 0:t.display)??!0})):[],_t=e=>({showAnnotations:(e==null?void 0:e.showAnnotations)??!0,controlAnnotation:(e==null?void 0:e.controlAnnotation)||!1,annotationsData:Ot(e==null?void 0:e.annotationsData)}),Wt=e=>({x:(e==null?void 0:e.x)||[{}],y:(e==null?void 0:e.y)||[{}]}),Bt=e=>({reverse:(e==null?void 0:e.reverse)||!1,stacked:(e==null?void 0:e.stacked)||!1,beginAtZero:(e==null?void 0:e.beginAtZero)??!0,stepSize:e==null?void 0:e.stepSize,suggestedMin:e==null?void 0:e.suggestedMin,suggestedMax:e==null?void 0:e.suggestedMax,min:e==null?void 0:e.min,max:e==null?void 0:e.max}),Re=e=>{const t=(e==null?void 0:e.chart)||{},a=(t==null?void 0:t.options)||{};return{testId:(t==null?void 0:t.testId)??null,data:Rt(t==null?void 0:t.data),options:{title:(a==null?void 0:a.title)||"",axes:Wt(a==null?void 0:a.axes),additionalAxesOptions:Bt(a==null?void 0:a.additionalAxesOptions),direction:(a==null?void 0:a.direction)||rt.VERTICAL,chartStyling:Ct(a==null?void 0:a.chartStyling),tooltip:Tt(a==null?void 0:a.tooltip),graph:pt(a==null?void 0:a.graph),legend:St(a==null?void 0:a.legend),annotations:_t(a==null?void 0:a.annotations),chartOptions:Lt(a==null?void 0:a.chartOptions),interactions:yt(a==null?void 0:a.interactions)}}},vt=(e,t)=>{switch(e){case d.TopToBottom:return[t.left,t.top,t.left,t.bottom];case d.BottomToTop:return[t.left,t.bottom,t.left,t.top];case d.LeftToRight:return[t.left,t.top,t.right,t.top];case d.RightToLeft:return[t.right,t.top,t.left,t.top];case d.TopLeftToBottomRight:return[t.left,t.top,t.right,t.bottom];case d.BottomRightToTopLeft:return[t.right,t.bottom,t.left,t.top];case d.BottomLeftToTopRight:return[t.left,t.bottom,t.right,t.top];case d.TopRightToBottomLeft:return[t.right,t.top,t.left,t.bottom];default:return[t.left,t.bottom,t.right,t.top]}},At={id:"gradientBackgroundPlugin",beforeDraw:e=>{const{ctx:t,chartArea:a,options:r}=e;if(!t||!a)return;const s=r==null?void 0:r.gradient,{display:n=!1,gradientColors:o,direction:x=d.BottomLeftToTopRight}=s??{};if(!n||!o||o.length===0)return;const[S,C,T,p]=vt(x,a),b=t.createLinearGradient(S,C,T,p);o.forEach(({offset:L,color:f})=>{b.addColorStop(L,f)}),t.save(),t.globalCompositeOperation="destination-over",t.fillStyle=b,t.fillRect(a.left,a.top,a.right-a.left,a.bottom-a.top),t.restore()}},kt="_chart_1qlu1_1",Dt="_canvas_1qlu1_11",jt="_fixedHeight_1qlu1_20",Ht="_stretchHeight_1qlu1_26",wt="_squareAspectRatio_1qlu1_32",Y={chart:kt,canvas:Dt,fixedHeight:jt,stretchHeight:Ht,squareAspectRatio:wt};Fe.register(Ye,Ve,Xe,$e,Je,Qe,Ke,Ge,dt,At);const Mt=e=>{Ue();const t=ye.useRef(null),a=Re(e),{options:r,testId:s}=a,{scatterOptions:n,generatedDatasets:o}=ft(a,t);return g.jsx("div",{className:qe(r.chartStyling,Y),style:{width:r.chartStyling.width,height:r.chartStyling.height},"data-testid":s,children:g.jsx(lt,{backend:ot,context:window,children:g.jsxs("div",{className:Y.canvas,id:"canvas",children:[g.jsx(ze,{ref:t,data:{datasets:o},options:n,plugins:Ze(r.graph,r.legend)}),!!o.length&&g.jsx(nt,{chartRef:t,legendConfig:{options:r,generatedDatasets:o,chartType:ct.SCATTER}})]})})})},N=e=>{const{options:t}=Re(e);return g.jsx(Ie,{options:t,children:g.jsx(Mt,{...e})})};N.__docgenInfo={description:"",methods:[],displayName:"ScatterChartWithLegend",props:{chart:{required:!0,tsType:{name:"IScatterChartData"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""}}};const h=["label 1","label 2","label 3"],m={label:"Dataset 1",data:[{x:1,y:5},{x:3,y:7},{x:6,y:2},{x:8,y:6},{x:9,y:4}]},P={label:"Dataset 2",data:[{x:1,y:3},{x:4,y:5},{x:7,y:9},{x:10,y:2},{x:12,y:7}]},Et={label:"Dataset 3",data:[{x:2,y:8},{x:5,y:6},{x:8,y:10},{x:11,y:5},{x:14,y:9}]},Oe={label:"Dataset 4",data:[{x:2,y:8},{x:14,y:9}]},Nt={label:"Dataset 5",data:[{x:14,y:7,label:"Echo"},{x:3,y:18,label:"Lima"},{x:19,y:2,label:"Romeo"},{x:8,y:11,label:"Charlie"},{x:12,y:9,label:"Oscar"}]},Pt={label:"Dataset 6",data:[{x:15,y:3,label:"Hotel"},{x:9,y:14,label:"Tango"},{x:4,y:17,label:"Whiskey"},{x:11,y:7,label:"Juliet"},{x:13,y:1,label:"Zulu"}]},It={label:"Dataset Decimals",data:[{x:4.30021321123002,y:2.30021321123005},{x:5.12321321000003,y:3.23213210000037}]},I={data:{labels:h,datasets:[m]}},Ut={data:{labels:h,datasets:[m]},options:{chartStyling:{height:300,width:700}}},qt={data:{labels:h,datasets:[m,P,Et]}},zt={data:{labels:h,datasets:[m]},options:{title:"With Data Labels",graph:{showDataLabels:!0}}},Zt={data:{labels:h,datasets:[m,P,It]},options:{title:"With Tooltips",tooltip:{title:"Tooltip",showLabelsInTooltips:!0}}},Ft={data:{labels:h,datasets:[{...m,backgroundColor:"red",borderColor:"red"}]}},Yt={data:{labels:h,datasets:[m]},options:{title:"With Annotation",annotations:{showAnnotations:!0,annotationsData:[{annotationAxis:"y",label:"Horizontal Annotation",value:2.5,color:"rgba(96, 32, 196, 0.5)"}]}}},Vt={data:{labels:h,datasets:[m,P,Oe]},options:{title:"With Axes Labels",axes:{x:[{label:"x axis"}],y:[{label:"y axis"}]}}},Xt={...I,options:{title:"With Gradient",chartStyling:{gradient:{display:!0}}}},$t={data:{datasets:[Nt,Pt,Oe]},options:{title:"With datapoint label showing when hovered",tooltip:{showLabelsInTooltips:!0}}},ra={title:"ScatterChart",component:N,args:{chart:I}},i=e=>g.jsx(N,{...e}),O=i.bind({});O.args={chart:I};const _=i.bind({});_.args={chart:Ut};const W=i.bind({});W.args={chart:qt};const B=i.bind({});B.args={chart:zt};const v=i.bind({});v.args={chart:Zt};const A=i.bind({});A.args={chart:Yt};const k=i.bind({});k.args={chart:Vt};const D=i.bind({});D.args={chart:Xt};const j=i.bind({});j.args={chart:$t};const H=i.bind({});H.args={chart:Ft};var V,X,$;O.parameters={...O.parameters,docs:{...(V=O.parameters)==null?void 0:V.docs,source:{originalSource:`args => {
1
+ import{j as g}from"./jsx-runtime-W3oueGCa.js";import{r as ye}from"./index-YTOF1_EJ.js";import{d as ve,r as Ae,z as ke,B as u,S as De,E as je,O as He,N as we,f as q,C as Me,A as Ee,P as Ne,Y as Pe,G as z,b as Ie,s as Ue,Q as qe,Z as ze,U as Ze,h as Fe,i as Ye,V as Ve,j as Xe,p as $e,m as Je,n as Qe,q as Ke,t as Ge}from"./legend-context-Ck5tFDGN.js";import{j as et,u as tt,t as at,o as st,p as rt,l as lt,H as ot,L as nt,m as ct,n as dt}from"./legend-DOA3L9eH.js";import{D as it,a as ut}from"./bar-chart-const-Cgj9sgUU.js";import"./index-CgYGpm1H.js";import"./index-DHw5ixvP.js";import"./index-BhTLYoCu.js";const Z=(e,t)=>{let a={};return t?(Math.abs(e)<it||Math.abs(e)>ut)&&(a={roundScientificCoefficient:3}):a={scientific:!1},ve(Ae(e),a)},gt=(e,t)=>{var a;if((a=t==null?void 0:t.tooltip)!=null&&a.showLabelsInTooltips){const r=e[0],{label:s}=(r==null?void 0:r.dataset)??{};return s}},ht=(e,t)=>{var o;const{raw:a,dataset:r}=e??{},s=a==null?void 0:a.label,n=(o=t==null?void 0:t.tooltip)==null?void 0:o.scientificNotation;return`${s??(r==null?void 0:r.label)} ( x: ${Z(a==null?void 0:a.x,n)} , y: ${Z(a==null?void 0:a.y,n)} )`},mt=e=>{var t,a,r;return{enabled:(t=e==null?void 0:e.tooltip)==null?void 0:t.enabled,callbacks:{title:s=>gt(s,e),label:s=>ht(s,e)},backgroundColor:(a=e==null?void 0:e.tooltip)==null?void 0:a.backgroundColor,displayColors:(r=e==null?void 0:e.tooltip)==null?void 0:r.displayColors,padding:7}},F=({options:e,axisType:t=u.X,currentScale:a})=>{var C,T,p,b,L,f,w,y,M;const r=ke(e.direction),s=a||((T=(C=e==null?void 0:e.axes)==null?void 0:C[t])==null?void 0:T[0]),n=r&&t===u.Y||!r&&t===u.X,o=(s==null?void 0:s.gridLines)||{},x=()=>{var l;const c=r?u.Y:u.X;return t===c?(l=e==null?void 0:e.additionalAxesOptions)==null?void 0:l.reverse:!1},S=()=>{const c=e==null?void 0:e.additionalAxesOptions;return{...{stepSize:(s==null?void 0:s.stepSize)??(t===u.Y?c==null?void 0:c.stepSize:void 0)},includeBounds:!1,font:{size:je}}};return{type:De.Linear,position:s==null?void 0:s.position,beginAtZero:(p=e==null?void 0:e.additionalAxesOptions)==null?void 0:p.beginAtZero,reverse:x(),suggestedMax:(b=e==null?void 0:e.additionalAxesOptions)==null?void 0:b.suggestedMax,suggestedMin:(L=e==null?void 0:e.additionalAxesOptions)==null?void 0:L.suggestedMin,min:n?(f=e==null?void 0:e.additionalAxesOptions)==null?void 0:f.min:void 0,max:n?(w=e==null?void 0:e.additionalAxesOptions)==null?void 0:w.max:void 0,title:{display:!!((y=s==null?void 0:s.label)!=null&&y.length)||!!((M=s==null?void 0:s.unit)!=null&&M.length),text:(s==null?void 0:s.label)||(s==null?void 0:s.unit),padding:0},ticks:S(),grid:{...o}}},bt=e=>{const t=F({options:e,axisType:u.X}),a=F({options:e,axisType:u.Y});return{x:t,y:a}},ft=(e,t)=>{const{data:a,options:r}=e,{interactions:s,chartStyling:n}=r,[o,x]=ye.useState(!1),{legend:S,customLegendPlugin:C,legendClick:T}=et({chartRef:t,options:r}),{state:p}=tt(),{annotation:b}=p,f=(c=>c.map((l,R)=>{const{borderWidth:E=st}=l??{},_e=parseFloat(String(E))||1,U=Me[R],We=l.borderColor??U,Be=l.backgroundColor??U;return{...l,borderWidth:_e,borderColor:We,backgroundColor:Be}}))(a.datasets),w=(c,l,R)=>{R.resetZoom()},y=(c,l)=>{if(o&&!(l!=null&&l.length)&&(x(!1),s.onUnhover&&s.onUnhover(c)),!o&&(l!=null&&l.length)&&(x(!0),s.onHover)){const{index:R,datasetIndex:E}=l[0];s.onHover(c,E,R,f)}},M={onClick:w,onHover:y,...n,interactions:{onLegendClick:T,onHover:y},scales:bt(e==null?void 0:e.options),animation:n.performanceMode?{duration:q.NO}:{duration:q.FAST,onComplete:s==null?void 0:s.onAnimationComplete},plugins:{legend:{...S,display:!1,events:[]},customLegendPlugin:C,title:He(r),annotation:at(b),chartAreaBorder:{borderColor:we},datalabels:{display:r.graph.showDataLabels},tooltip:mt(r)}};return{generatedDatasets:f,scatterOptions:M}};var d=(e=>(e[e.TopToBottom=0]="TopToBottom",e[e.BottomToTop=1]="BottomToTop",e[e.LeftToRight=2]="LeftToRight",e[e.RightToLeft=3]="RightToLeft",e[e.TopLeftToBottomRight=4]="TopLeftToBottomRight",e[e.BottomRightToTopLeft=5]="BottomRightToTopLeft",e[e.BottomLeftToTopRight=6]="BottomLeftToTopRight",e[e.TopRightToBottomLeft=7]="TopRightToBottomLeft",e))(d||{});const xt=e=>({display:(e==null?void 0:e.display)??!1,gradientColors:(e==null?void 0:e.gradientColors)??Pe,direction:(e==null?void 0:e.direction)??d.BottomLeftToTopRight}),Ct=e=>({width:(e==null?void 0:e.width)??z,height:(e==null?void 0:e.height)??z,maintainAspectRatio:(e==null?void 0:e.maintainAspectRatio)||!1,staticChartHeight:(e==null?void 0:e.staticChartHeight)||!1,performanceMode:(e==null?void 0:e.performanceMode)??!0,gradient:xt(e==null?void 0:e.gradient)}),Tt=e=>({enabled:(e==null?void 0:e.enabled)??!0,tooltips:(e==null?void 0:e.tooltips)??!0,showLabelsInTooltips:(e==null?void 0:e.showLabelsInTooltips)||!1,backgroundColor:(e==null?void 0:e.backgroundColor)||"#333",displayColors:(e==null?void 0:e.displayColors)||!1,scientificNotation:(e==null?void 0:e.scientificNotation)??!0}),pt=e=>({showMinorGridlines:(e==null?void 0:e.showMinorGridlines)??!1,showDataLabels:(e==null?void 0:e.showDataLabels)??!1}),St=e=>({display:(e==null?void 0:e.display)??!0,useDataset:(e==null?void 0:e.useDataset)||!1,position:(e==null?void 0:e.position)||Ne.BottomLeft,align:(e==null?void 0:e.align)||Ee.Center}),Lt=e=>({enableZoom:(e==null?void 0:e.enableZoom)||!1,enablePan:(e==null?void 0:e.enablePan)||!1}),yt=e=>({onLegendClick:e==null?void 0:e.onLegendClick,onHover:e==null?void 0:e.onHover,onUnhover:e==null?void 0:e.onUnhover,onAnimationComplete:e==null?void 0:e.onAnimationComplete}),Rt=e=>({labels:(e==null?void 0:e.labels)||[],datasets:(e==null?void 0:e.datasets)||[]}),Ot=e=>e?e.map(t=>({...t,display:(t==null?void 0:t.display)??!0})):[],_t=e=>({showAnnotations:(e==null?void 0:e.showAnnotations)??!0,controlAnnotation:(e==null?void 0:e.controlAnnotation)||!1,annotationsData:Ot(e==null?void 0:e.annotationsData)}),Wt=e=>({x:(e==null?void 0:e.x)||[{}],y:(e==null?void 0:e.y)||[{}]}),Bt=e=>({reverse:(e==null?void 0:e.reverse)||!1,stacked:(e==null?void 0:e.stacked)||!1,beginAtZero:(e==null?void 0:e.beginAtZero)??!0,stepSize:e==null?void 0:e.stepSize,suggestedMin:e==null?void 0:e.suggestedMin,suggestedMax:e==null?void 0:e.suggestedMax,min:e==null?void 0:e.min,max:e==null?void 0:e.max}),Re=e=>{const t=(e==null?void 0:e.chart)||{},a=(t==null?void 0:t.options)||{};return{testId:(t==null?void 0:t.testId)??null,data:Rt(t==null?void 0:t.data),options:{title:(a==null?void 0:a.title)||"",axes:Wt(a==null?void 0:a.axes),additionalAxesOptions:Bt(a==null?void 0:a.additionalAxesOptions),direction:(a==null?void 0:a.direction)||rt.VERTICAL,chartStyling:Ct(a==null?void 0:a.chartStyling),tooltip:Tt(a==null?void 0:a.tooltip),graph:pt(a==null?void 0:a.graph),legend:St(a==null?void 0:a.legend),annotations:_t(a==null?void 0:a.annotations),chartOptions:Lt(a==null?void 0:a.chartOptions),interactions:yt(a==null?void 0:a.interactions)}}},vt=(e,t)=>{switch(e){case d.TopToBottom:return[t.left,t.top,t.left,t.bottom];case d.BottomToTop:return[t.left,t.bottom,t.left,t.top];case d.LeftToRight:return[t.left,t.top,t.right,t.top];case d.RightToLeft:return[t.right,t.top,t.left,t.top];case d.TopLeftToBottomRight:return[t.left,t.top,t.right,t.bottom];case d.BottomRightToTopLeft:return[t.right,t.bottom,t.left,t.top];case d.BottomLeftToTopRight:return[t.left,t.bottom,t.right,t.top];case d.TopRightToBottomLeft:return[t.right,t.top,t.left,t.bottom];default:return[t.left,t.bottom,t.right,t.top]}},At={id:"gradientBackgroundPlugin",beforeDraw:e=>{const{ctx:t,chartArea:a,options:r}=e;if(!t||!a)return;const s=r==null?void 0:r.gradient,{display:n=!1,gradientColors:o,direction:x=d.BottomLeftToTopRight}=s??{};if(!n||!o||o.length===0)return;const[S,C,T,p]=vt(x,a),b=t.createLinearGradient(S,C,T,p);o.forEach(({offset:L,color:f})=>{b.addColorStop(L,f)}),t.save(),t.globalCompositeOperation="destination-over",t.fillStyle=b,t.fillRect(a.left,a.top,a.right-a.left,a.bottom-a.top),t.restore()}},kt="_chart_1qlu1_1",Dt="_canvas_1qlu1_11",jt="_fixedHeight_1qlu1_20",Ht="_stretchHeight_1qlu1_26",wt="_squareAspectRatio_1qlu1_32",Y={chart:kt,canvas:Dt,fixedHeight:jt,stretchHeight:Ht,squareAspectRatio:wt};Fe.register(Ye,Ve,Xe,$e,Je,Qe,Ke,Ge,dt,At);const Mt=e=>{Ue();const t=ye.useRef(null),a=Re(e),{options:r,testId:s}=a,{scatterOptions:n,generatedDatasets:o}=ft(a,t);return g.jsx("div",{className:qe(r.chartStyling,Y),style:{width:r.chartStyling.width,height:r.chartStyling.height},"data-testid":s,children:g.jsx(lt,{backend:ot,context:window,children:g.jsxs("div",{className:Y.canvas,id:"canvas",children:[g.jsx(ze,{ref:t,data:{datasets:o},options:n,plugins:Ze(r.graph,r.legend)}),!!o.length&&g.jsx(nt,{chartRef:t,legendConfig:{options:r,generatedDatasets:o,chartType:ct.SCATTER}})]})})})},N=e=>{const{options:t}=Re(e);return g.jsx(Ie,{options:t,children:g.jsx(Mt,{...e})})};N.__docgenInfo={description:"",methods:[],displayName:"ScatterChartWithLegend",props:{chart:{required:!0,tsType:{name:"IScatterChartData"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""}}};const h=["label 1","label 2","label 3"],m={label:"Dataset 1",data:[{x:1,y:5},{x:3,y:7},{x:6,y:2},{x:8,y:6},{x:9,y:4}]},P={label:"Dataset 2",data:[{x:1,y:3},{x:4,y:5},{x:7,y:9},{x:10,y:2},{x:12,y:7}]},Et={label:"Dataset 3",data:[{x:2,y:8},{x:5,y:6},{x:8,y:10},{x:11,y:5},{x:14,y:9}]},Oe={label:"Dataset 4",data:[{x:2,y:8},{x:14,y:9}]},Nt={label:"Dataset 5",data:[{x:14,y:7,label:"Echo"},{x:3,y:18,label:"Lima"},{x:19,y:2,label:"Romeo"},{x:8,y:11,label:"Charlie"},{x:12,y:9,label:"Oscar"}]},Pt={label:"Dataset 6",data:[{x:15,y:3,label:"Hotel"},{x:9,y:14,label:"Tango"},{x:4,y:17,label:"Whiskey"},{x:11,y:7,label:"Juliet"},{x:13,y:1,label:"Zulu"}]},It={label:"Dataset Decimals",data:[{x:4.30021321123002,y:2.30021321123005},{x:5.12321321000003,y:3.23213210000037}]},I={data:{labels:h,datasets:[m]}},Ut={data:{labels:h,datasets:[m]},options:{chartStyling:{height:300,width:700}}},qt={data:{labels:h,datasets:[m,P,Et]}},zt={data:{labels:h,datasets:[m]},options:{title:"With Data Labels",graph:{showDataLabels:!0}}},Zt={data:{labels:h,datasets:[m,P,It]},options:{title:"With Tooltips",tooltip:{title:"Tooltip",showLabelsInTooltips:!0}}},Ft={data:{labels:h,datasets:[{...m,backgroundColor:"red",borderColor:"red"}]}},Yt={data:{labels:h,datasets:[m]},options:{title:"With Annotation",annotations:{showAnnotations:!0,annotationsData:[{annotationAxis:"y",label:"Horizontal Annotation",value:2.5,color:"rgba(96, 32, 196, 0.5)"}]}}},Vt={data:{labels:h,datasets:[m,P,Oe]},options:{title:"With Axes Labels",axes:{x:[{label:"x axis"}],y:[{label:"y axis"}]}}},Xt={...I,options:{title:"With Gradient",chartStyling:{gradient:{display:!0}}}},$t={data:{datasets:[Nt,Pt,Oe]},options:{title:"With datapoint label showing when hovered",tooltip:{showLabelsInTooltips:!0}}},ra={title:"ScatterChart",component:N,args:{chart:I}},i=e=>g.jsx(N,{...e}),O=i.bind({});O.args={chart:I};const _=i.bind({});_.args={chart:Ut};const W=i.bind({});W.args={chart:qt};const B=i.bind({});B.args={chart:zt};const v=i.bind({});v.args={chart:Zt};const A=i.bind({});A.args={chart:Yt};const k=i.bind({});k.args={chart:Vt};const D=i.bind({});D.args={chart:Xt};const j=i.bind({});j.args={chart:$t};const H=i.bind({});H.args={chart:Ft};var V,X,$;O.parameters={...O.parameters,docs:{...(V=O.parameters)==null?void 0:V.docs,source:{originalSource:`args => {
2
2
  return <ScatterChart
3
3
  // eslint-disable-next-line react/jsx-props-no-spreading
4
4
  {...args} />;
@@ -15,6 +15,7 @@ export interface ICommonDataset {
15
15
  backgroundColor?: string | string[];
16
16
  borderWidth?: number;
17
17
  data: ICommonDataValue[];
18
+ hidden?: boolean;
18
19
  }
19
20
  export interface ICommonScales extends Partial<Record<string, LinearScaleOptions>> {
20
21
  x: LinearScaleOptions;
@@ -1,6 +1,7 @@
1
1
  import { default as React, ReactNode } from '../../../../../node_modules/react';
2
2
  import { ILegendState } from './legend-state-reducer';
3
3
  import { TChartsOption } from '../legend-interface';
4
+ import { ICommonDataset } from '../../common.interface';
4
5
  export declare const LegendContext: React.Context<{
5
6
  state: ILegendState;
6
7
  dispatch: React.Dispatch<any>;
@@ -8,5 +9,6 @@ export declare const LegendContext: React.Context<{
8
9
  export interface ILegendProviderProps {
9
10
  children: ReactNode;
10
11
  options: TChartsOption;
12
+ datasets?: ICommonDataset[];
11
13
  }
12
- export declare const LegendProvider: ({ children, options }: ILegendProviderProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const LegendProvider: ({ children, options, datasets, }: ILegendProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import { Chart } from 'chart.js';
2
2
  import { TLegendDataset, TLegendDatasets } from '../legend-interface';
3
3
  import { RESET_STATE, TOGGLE_DATA_VISIBILITY } from './legend-action-types';
4
- import { ICommonAnnotationElement } from '../../common.interface';
4
+ import { ICommonAnnotationElement, ICommonDataset } from '../../common.interface';
5
5
  export interface ILegendState {
6
+ datasets: ICommonDataset[];
6
7
  annotation: ICommonAnnotationElement[];
7
8
  }
8
9
  export type TLegendAction = {
package/dist/iframe.html CHANGED
@@ -509,7 +509,7 @@
509
509
  }
510
510
  </script>
511
511
 
512
- <script type="module" crossorigin src="./assets/iframe-D3u0vI49.js"></script>
512
+ <script type="module" crossorigin src="./assets/iframe-C_yRnxwh.js"></script>
513
513
  </head>
514
514
 
515
515
  <body>
package/dist/index.js CHANGED
@@ -26927,6 +26927,15 @@ const getAnnotation = ({
26927
26927
  const shouldGenerateAnnotations = showAnnotations && annotationsData && (annotationsData == null ? void 0 : annotationsData.length);
26928
26928
  return shouldGenerateAnnotations ? generateAnnotations(annotationsData) ?? [] : [];
26929
26929
  };
26930
+ const useReset = (state, dispatch, dependencies) => {
26931
+ const prevState = useRef(state);
26932
+ useEffect(() => {
26933
+ if (!isEqual(state, prevState == null ? void 0 : prevState.current)) {
26934
+ dispatch({ type: "RESET_STATE", payload: state });
26935
+ prevState.current = state;
26936
+ }
26937
+ }, [...dependencies]);
26938
+ };
26930
26939
  const LegendContext = createContext$1(void 0);
26931
26940
  const LegendProvider = ({
26932
26941
  children,
@@ -26954,6 +26963,7 @@ const LegendProvider = ({
26954
26963
  () => ({ state, dispatch }),
26955
26964
  [state, options, dispatch]
26956
26965
  );
26966
+ useReset(initialState2, dispatch, [annotationsData]);
26957
26967
  return /* @__PURE__ */ jsx(LegendContext.Provider, { value: contextValue, children });
26958
26968
  };
26959
26969
  const useLegend = () => {
@@ -1,4 +1,3 @@
1
- import { ILineChartOptions } from '../line-chart.interface';
2
1
  import { TPrimitive } from '../../common/common.interface';
3
2
  import { IState } from '../state/state.interfaces';
4
3
  export declare const toNum: (value: string | number) => any;
@@ -22,4 +21,4 @@ export declare const getAxisTypeFromKey: (string: string) => string;
22
21
  * Checks if a value is a primitive value (which includes strings, numbers, booleans, and null).
23
22
  */
24
23
  export declare const isPrimitiveValue: (value: TPrimitive) => value is string | number | boolean | null;
25
- export declare const getChartKey: (state: IState, options: ILineChartOptions, languageKey: string) => string;
24
+ export declare const getChartKey: (state: IState, languageKey: string) => string;
@@ -1,18 +1,19 @@
1
1
  import { ActiveElement, Chart, Chart as ChartJS, ChartEvent, LegendItem, Plugin, TooltipItem } from 'chart.js';
2
- import { IPieDataValue, IPiesDataLabelsOptions } from './pie-chart.interface';
2
+ import { IGeneratedPieChartDataset, IPieDataValue, IPiesDataLabelsOptions } from './pie-chart.interface';
3
3
  import { IPieChartDefaultProps } from './pie-chart-defalut-props.interface';
4
4
  import { UnusedParameter } from '../common/common.interface';
5
5
  interface ILegendPlugin extends Plugin {
6
6
  chart?: Chart;
7
7
  }
8
8
  export declare const usePieChartConfig: (chart: IPieChartDefaultProps) => {
9
- generatedDatasets: {
9
+ generatedDatasets: IGeneratedPieChartDataset[] | {
10
10
  borderWidth: number;
11
11
  borderColor: string;
12
12
  backgroundColor: string | string[];
13
13
  data: IPieDataValue[];
14
14
  hideLegend?: boolean;
15
15
  label?: string;
16
+ hidden?: boolean;
16
17
  }[];
17
18
  getTitle: () => {
18
19
  display: boolean;
package/dist/project.json CHANGED
@@ -1 +1 @@
1
- {"generatedAt":1747138154049,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@storybook/testing-library":"0.2.2","eslint-plugin-vitest":null,"eslint-plugin-vitest-globals":"1.5.0","vitest":"3.1.3"},"hasRouterPackage":false,"packageManager":{"type":"yarn","agent":"yarn"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"8.6.12","storybookVersionSpecifier":"^8.6.12","language":"javascript","storybookPackages":{"@storybook/blocks":{"version":"8.6.12"},"@storybook/react":{"version":"8.6.12"},"@storybook/react-vite":{"version":"8.6.12"},"@storybook/testing-library":{"version":"0.2.2"},"eslint-plugin-storybook":{"version":"0.12.0"},"storybook":{"version":"8.6.12"}},"addons":{"@storybook/addon-actions":{"version":"8.6.12"},"@storybook/addon-docs":{"version":"8.6.12"},"storybook-dark-mode":{"version":"4.0.2"},"@storybook/addon-mdx-gfm":{"version":"8.6.12"}}}
1
+ {"generatedAt":1748349669073,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@storybook/testing-library":"0.2.2","eslint-plugin-vitest":null,"eslint-plugin-vitest-globals":"1.5.0","vitest":"3.1.3"},"hasRouterPackage":false,"packageManager":{"type":"yarn","agent":"yarn"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"8.6.12","storybookVersionSpecifier":"^8.6.12","language":"javascript","storybookPackages":{"@storybook/blocks":{"version":"8.6.12"},"@storybook/react":{"version":"8.6.12"},"@storybook/react-vite":{"version":"8.6.12"},"@storybook/testing-library":{"version":"0.2.2"},"eslint-plugin-storybook":{"version":"0.12.0"},"storybook":{"version":"8.6.12"}},"addons":{"@storybook/addon-actions":{"version":"8.6.12"},"@storybook/addon-docs":{"version":"8.6.12"},"storybook-dark-mode":{"version":"4.0.2"},"@storybook/addon-mdx-gfm":{"version":"8.6.12"}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "5.1.3",
3
+ "version": "5.1.4-beta-2",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "resolutions": {
@@ -1,6 +0,0 @@
1
- import{j as F}from"./jsx-runtime-W3oueGCa.js";import{r as G,g as ft}from"./index-YTOF1_EJ.js";import{$ as dt,a0 as bn,a1 as we,B as ce,a2 as gt,v as Y,A as ie,P as Ce,C as _e,a3 as an,a4 as ht,g as Ke,y as pt,S as mt,E as bt,F as yt,a5 as Se,a6 as Ie,H as Ee,a7 as Ne,G as Je,I as wt,T as _t,L as yn,a as Et,J as Be,K as xt,M as be,d as Tt,r as Lt,N as wn,a8 as vt,f as At,a9 as Ct,U as St,aa as le,ab as cn,ac as Ae,D as It,ad as ye,b as Pt,s as Ot,Q as Nt,ae as Mt,h as Dt,i as Bt,V as jt,W as Ft,j as kt,k as Ut,p as Rt,m as Gt,n as Yt,o as zt,q as Vt,t as Xt}from"./legend-context-PSa8HhGj.js";import{r as He,M as fn,k as je,B as fe,s as Ht,v as qt,w as _n,x as Wt,y as $t,z as Zt,A as Kt,E as Jt,N as En,G as Qt,S as er,g as nr,e as tr,F as rr,T as Un,J as or,K as sr,D as ir,O as lr,Q as ur,o as ar,q as cr,U as fr,j as dr,u as gr,Z as hr,t as pr,R as mr,l as br,H as yr,L as wr,m as _r,n as Er}from"./legend-Cgq98xea.js";import{c as xr,C as Tr,f as xn,a as Lr,b as vr}from"./get-draggableData-eD2Xdq-6.js";import{e as Ar}from"./index-CgYGpm1H.js";const Cr=(e,n,t)=>{const[o,r]=e.major,[d,f]=e.minor,h=(o.x+r.x+d.x+f.x)/4,w=(o.y+r.y+d.y+f.y)/4,C=r.x-o.x,E=r.y-o.y,S=Math.atan2(t.getPixelForValue(w+E/2)-t.getPixelForValue(w-E/2),n.getPixelForValue(h+C/2)-n.getPixelForValue(h-C/2)),M=Math.hypot(n.getPixelForValue(o.x)-n.getPixelForValue(r.x),t.getPixelForValue(o.y)-t.getPixelForValue(r.y))/2,N=Math.hypot(n.getPixelForValue(d.x)-n.getPixelForValue(f.x),t.getPixelForValue(d.y)-t.getPixelForValue(f.y))/2,T=n.getPixelForValue(h),A=t.getPixelForValue(w);return{cx:T,cy:A,radiusX:M,radiusY:N,angle:S}},Sr={id:"ellipsisAnnotationPlugin",afterDatasetsDraw(e){var d,f;const n=e==null?void 0:e.ctx,t=(d=e==null?void 0:e.scales)==null?void 0:d.x,o=(f=e==null?void 0:e.scales)==null?void 0:f.y;n.save();const r=e==null?void 0:e.chartArea;r&&(n.beginPath(),n.rect(r.left,r.top,r.right-r.left,r.bottom-r.top),n.clip()),e.data.datasets.forEach(h=>{const w=h;w.data.forEach(C=>{const{ellipsePoints:E}=C;if(!E)return;const{cx:S,cy:M,radiusX:N,radiusY:T,angle:A}=Cr(E,t,o);n.save(),n.beginPath(),n.ellipse(S,M,N,T,A,0,2*Math.PI),n.strokeStyle=w.borderColor||dt,n.lineWidth=w.borderWidth||1,n.stroke(),n.restore()})})}},Ir="_chart_e3qdd_1",Pr="_canvas_e3qdd_11",Or="_fixedHeight_e3qdd_20",Nr="_stretchHeight_e3qdd_26",Mr="_squareAspectRatio_e3qdd_32",Dr="_table_e3qdd_62",qe={chart:Ir,canvas:Pr,fixedHeight:Or,stretchHeight:Nr,squareAspectRatio:Mr,table:Dr};var Rn=Symbol.for("immer-nothing"),Tn=Symbol.for("immer-draftable"),ne=Symbol.for("immer-state");function oe(e,...n){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var xe=Object.getPrototypeOf;function Te(e){return!!e&&!!e[ne]}function he(e){var n;return e?Gn(e)||Array.isArray(e)||!!e[Tn]||!!((n=e.constructor)!=null&&n[Tn])||ze(e)||Ve(e):!1}var Br=Object.prototype.constructor.toString();function Gn(e){if(!e||typeof e!="object")return!1;const n=xe(e);if(n===null)return!0;const t=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return t===Object?!0:typeof t=="function"&&Function.toString.call(t)===Br}function Fe(e,n){Ye(e)===0?Reflect.ownKeys(e).forEach(t=>{n(t,e[t],e)}):e.forEach((t,o)=>n(o,t,e))}function Ye(e){const n=e[ne];return n?n.type_:Array.isArray(e)?1:ze(e)?2:Ve(e)?3:0}function Qe(e,n){return Ye(e)===2?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function Yn(e,n,t){const o=Ye(e);o===2?e.set(n,t):o===3?e.add(t):e[n]=t}function jr(e,n){return e===n?e!==0||1/e===1/n:e!==e&&n!==n}function ze(e){return e instanceof Map}function Ve(e){return e instanceof Set}function ge(e){return e.copy_||e.base_}function en(e,n){if(ze(e))return new Map(e);if(Ve(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const t=Gn(e);if(n===!0||n==="class_only"&&!t){const o=Object.getOwnPropertyDescriptors(e);delete o[ne];let r=Reflect.ownKeys(o);for(let d=0;d<r.length;d++){const f=r[d],h=o[f];h.writable===!1&&(h.writable=!0,h.configurable=!0),(h.get||h.set)&&(o[f]={configurable:!0,writable:!0,enumerable:h.enumerable,value:e[f]})}return Object.create(xe(e),o)}else{const o=xe(e);if(o!==null&&t)return{...e};const r=Object.create(o);return Object.assign(r,e)}}function dn(e,n=!1){return Xe(e)||Te(e)||!he(e)||(Ye(e)>1&&(e.set=e.add=e.clear=e.delete=Fr),Object.freeze(e),n&&Object.entries(e).forEach(([t,o])=>dn(o,!0))),e}function Fr(){oe(2)}function Xe(e){return Object.isFrozen(e)}var kr={};function pe(e){const n=kr[e];return n||oe(0,e),n}var Pe;function zn(){return Pe}function Ur(e,n){return{drafts_:[],parent_:e,immer_:n,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ln(e,n){n&&(pe("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=n)}function nn(e){tn(e),e.drafts_.forEach(Rr),e.drafts_=null}function tn(e){e===Pe&&(Pe=e.parent_)}function vn(e){return Pe=Ur(Pe,e)}function Rr(e){const n=e[ne];n.type_===0||n.type_===1?n.revoke_():n.revoked_=!0}function An(e,n){n.unfinalizedDrafts_=n.drafts_.length;const t=n.drafts_[0];return e!==void 0&&e!==t?(t[ne].modified_&&(nn(n),oe(4)),he(e)&&(e=ke(n,e),n.parent_||Ue(n,e)),n.patches_&&pe("Patches").generateReplacementPatches_(t[ne].base_,e,n.patches_,n.inversePatches_)):e=ke(n,t,[]),nn(n),n.patches_&&n.patchListener_(n.patches_,n.inversePatches_),e!==Rn?e:void 0}function ke(e,n,t){if(Xe(n))return n;const o=n[ne];if(!o)return Fe(n,(r,d)=>Cn(e,o,n,r,d,t)),n;if(o.scope_!==e)return n;if(!o.modified_)return Ue(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const r=o.copy_;let d=r,f=!1;o.type_===3&&(d=new Set(r),r.clear(),f=!0),Fe(d,(h,w)=>Cn(e,o,r,h,w,t,f)),Ue(e,r,!1),t&&e.patches_&&pe("Patches").generatePatches_(o,t,e.patches_,e.inversePatches_)}return o.copy_}function Cn(e,n,t,o,r,d,f){if(Te(r)){const h=d&&n&&n.type_!==3&&!Qe(n.assigned_,o)?d.concat(o):void 0,w=ke(e,r,h);if(Yn(t,o,w),Te(w))e.canAutoFreeze_=!1;else return}else f&&t.add(r);if(he(r)&&!Xe(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ke(e,r),(!n||!n.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(t,o)&&Ue(e,r)}}function Ue(e,n,t=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&dn(n,t)}function Gr(e,n){const t=Array.isArray(e),o={type_:t?1:0,scope_:n?n.scope_:zn(),modified_:!1,finalized_:!1,assigned_:{},parent_:n,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,d=gn;t&&(r=[o],d=Oe);const{revoke:f,proxy:h}=Proxy.revocable(r,d);return o.draft_=h,o.revoke_=f,h}var gn={get(e,n){if(n===ne)return e;const t=ge(e);if(!Qe(t,n))return Yr(e,t,n);const o=t[n];return e.finalized_||!he(o)?o:o===We(e.base_,n)?($e(e),e.copy_[n]=on(o,e)):o},has(e,n){return n in ge(e)},ownKeys(e){return Reflect.ownKeys(ge(e))},set(e,n,t){const o=Vn(ge(e),n);if(o!=null&&o.set)return o.set.call(e.draft_,t),!0;if(!e.modified_){const r=We(ge(e),n),d=r==null?void 0:r[ne];if(d&&d.base_===t)return e.copy_[n]=t,e.assigned_[n]=!1,!0;if(jr(t,r)&&(t!==void 0||Qe(e.base_,n)))return!0;$e(e),rn(e)}return e.copy_[n]===t&&(t!==void 0||n in e.copy_)||Number.isNaN(t)&&Number.isNaN(e.copy_[n])||(e.copy_[n]=t,e.assigned_[n]=!0),!0},deleteProperty(e,n){return We(e.base_,n)!==void 0||n in e.base_?(e.assigned_[n]=!1,$e(e),rn(e)):delete e.assigned_[n],e.copy_&&delete e.copy_[n],!0},getOwnPropertyDescriptor(e,n){const t=ge(e),o=Reflect.getOwnPropertyDescriptor(t,n);return o&&{writable:!0,configurable:e.type_!==1||n!=="length",enumerable:o.enumerable,value:t[n]}},defineProperty(){oe(11)},getPrototypeOf(e){return xe(e.base_)},setPrototypeOf(){oe(12)}},Oe={};Fe(gn,(e,n)=>{Oe[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}});Oe.deleteProperty=function(e,n){return Oe.set.call(this,e,n,void 0)};Oe.set=function(e,n,t){return gn.set.call(this,e[0],n,t,e[0])};function We(e,n){const t=e[ne];return(t?ge(t):e)[n]}function Yr(e,n,t){var r;const o=Vn(n,t);return o?"value"in o?o.value:(r=o.get)==null?void 0:r.call(e.draft_):void 0}function Vn(e,n){if(!(n in e))return;let t=xe(e);for(;t;){const o=Object.getOwnPropertyDescriptor(t,n);if(o)return o;t=xe(t)}}function rn(e){e.modified_||(e.modified_=!0,e.parent_&&rn(e.parent_))}function $e(e){e.copy_||(e.copy_=en(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var zr=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(n,t,o)=>{if(typeof n=="function"&&typeof t!="function"){const d=t;t=n;const f=this;return function(w=d,...C){return f.produce(w,E=>t.call(this,E,...C))}}typeof t!="function"&&oe(6),o!==void 0&&typeof o!="function"&&oe(7);let r;if(he(n)){const d=vn(this),f=on(n,void 0);let h=!0;try{r=t(f),h=!1}finally{h?nn(d):tn(d)}return Ln(d,o),An(r,d)}else if(!n||typeof n!="object"){if(r=t(n),r===void 0&&(r=n),r===Rn&&(r=void 0),this.autoFreeze_&&dn(r,!0),o){const d=[],f=[];pe("Patches").generateReplacementPatches_(n,r,d,f),o(d,f)}return r}else oe(1,n)},this.produceWithPatches=(n,t)=>{if(typeof n=="function")return(f,...h)=>this.produceWithPatches(f,w=>n(w,...h));let o,r;return[this.produce(n,t,(f,h)=>{o=f,r=h}),o,r]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){he(e)||oe(8),Te(e)&&(e=Vr(e));const n=vn(this),t=on(e,void 0);return t[ne].isManual_=!0,tn(n),t}finishDraft(e,n){const t=e&&e[ne];(!t||!t.isManual_)&&oe(9);const{scope_:o}=t;return Ln(o,n),An(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,n){let t;for(t=n.length-1;t>=0;t--){const r=n[t];if(r.path.length===0&&r.op==="replace"){e=r.value;break}}t>-1&&(n=n.slice(t+1));const o=pe("Patches").applyPatches_;return Te(e)?o(e,n):this.produce(e,r=>o(r,n))}};function on(e,n){const t=ze(e)?pe("MapSet").proxyMap_(e,n):Ve(e)?pe("MapSet").proxySet_(e,n):Gr(e,n);return(n?n.scope_:zn()).drafts_.push(t),t}function Vr(e){return Te(e)||oe(10,e),Xn(e)}function Xn(e){if(!he(e)||Xe(e))return e;const n=e[ne];let t;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,t=en(e,n.scope_.immer_.useStrictShallowCopy_)}else t=en(e,!0);return Fe(t,(o,r)=>{Yn(t,o,Xn(r))}),n&&(n.finalized_=!1),t}var te=new zr,Xr=te.produce;te.produceWithPatches.bind(te);te.setAutoFreeze.bind(te);te.setUseStrictShallowCopy.bind(te);te.applyPatches.bind(te);te.createDraft.bind(te);te.finishDraft.bind(te);const Hn="TOGGLE_ZOOM",qn="TOGGLE_PAN",Wn="TOGGLE_POINTS",$n="TOGGLE_LINE",Zn="TOGGLE_LEGEND",Kn="TOGGLE_TABLE",sn="RESET_AXES_RANGES",ln="UPDATE_AXES_RANGES",Jn="TOGGLE_DRAG_POINTS",Qn="TOGGLE_DRAG_ANNOTATION",et="DISABLE_DRAG_OPTIONS",De="UPDATE_EDITED",Hr=(e,n)=>Xr(e,t=>{switch(n.type){case Hn:{t.zoomEnabled=!t.zoomEnabled,t.panEnabled&&(t.panEnabled=!1),t.enableDragPoints&&(t.enableDragPoints=!1),t.enableDragAnnotation&&(t.enableDragAnnotation=!1);break}case qn:{t.panEnabled=!t.panEnabled,t.zoomEnabled&&(t.zoomEnabled=!1),t.enableDragPoints&&(t.enableDragPoints=!1),t.enableDragAnnotation&&(t.enableDragAnnotation=!1);break}case Wn:{t.pointsEnabled=!t.pointsEnabled;break}case $n:{t.lineEnabled=!t.lineEnabled;break}case Zn:{t.legendEnabled=!t.legendEnabled;break}case Kn:{t.showTable=!t.showTable;break}case ln:{const{axes:o}=n.payload;t.axes=o;break}case sn:{const{axes:o}=n.payload;t.axes=o;break}case Jn:{t.enableDragPoints=!t.enableDragPoints,t.panEnabled&&(t.panEnabled=!1),t.zoomEnabled&&(t.zoomEnabled=!1),t.enableDragAnnotation&&(t.enableDragAnnotation=!1);break}case Qn:{t.enableDragAnnotation=!t.enableDragAnnotation,t.panEnabled&&(t.panEnabled=!1),t.zoomEnabled&&(t.zoomEnabled=!1);break}case et:{(t.enableDragAnnotation||t.enableDragPoints||t.panEnabled||t.zoomEnabled)&&(t.enableDragAnnotation=!1,t.enableDragPoints=!1,t.panEnabled=!1,t.zoomEnabled=!1);break}case De:{t.edited=n.payload;break}}}),qr=e=>{if(!e)return null;const n=`line-chart-state-${e}`,t=localStorage.getItem(n);return t?JSON.parse(t).state:null},Wr=(e=72)=>{const n=new Date().getTime(),t=e*60*60*1e3;for(let o=0;o<localStorage.length;o++){const r=localStorage.key(o);if(r!=null&&r.includes("line-chart-state-")){const d=localStorage.getItem(r);if(d){const h=JSON.parse(d).timestamp;h&&n-h>t&&localStorage.removeItem(r)}}}},$r=(e,n)=>{if(!n)return;const t=new Date().getTime(),o=`line-chart-state-${n}`,r={state:e,timestamp:t};localStorage.setItem(o,JSON.stringify(r)),Wr()},Zr=({options:e,persistenceId:n})=>{const{chartOptions:{enableZoom:t,enablePan:o,showPoints:r,showLine:d,enableDragAnnotation:f},legend:{display:h},dragData:w}=e,{zoomEnabled:C,panEnabled:E,pointsEnabled:S,lineEnabled:M,legendEnabled:N,enableDragPoints:T,enableDragAnnotation:A}=qr(n)||{};return{zoomEnabled:f??A?!1:C??t,panEnabled:E??o,pointsEnabled:S??r,lineEnabled:M??d,legendEnabled:N??h,axes:[],showTable:!1,enableDragPoints:(w==null?void 0:w.enableDragData)&&T,enableDragAnnotation:f??A,edited:!1}},Kr=e=>G.createElement("svg",{fill:"currentColor",height:"1em",viewBox:"0 0 12 12",width:"1em",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...e},G.createElement("clipPath",{id:"a"},G.createElement("path",{d:"m0 0h12v12h-12z"})),G.createElement("g",{clipPath:"url(#a)"},G.createElement("path",{d:"m.5 6.5v-1h11v1c-4.16104 0-6.63549 0-11 0z"}))),Jr=e=>G.createElement("svg",{fill:"currentColor",height:"1em",viewBox:"0 0 12 12",width:"1em",xmlns:"http://www.w3.org/2000/svg",...e},G.createElement("circle",{cx:6,cy:6,r:2})),Qr=e=>G.createElement("svg",{fill:"currentColor",height:"1em",viewBox:"0 0 12 12",width:"1em",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...e},G.createElement("clipPath",{id:"a"},G.createElement("path",{d:"m0 0h12v12h-12z"})),G.createElement("g",{clipPath:"url(#a)"},G.createElement("path",{d:"m7.937 6.5c-.11122.42912-.36179.80916-.71237 1.08047-.35058.2713-.78133.4185-1.22463.4185s-.87405-.1472-1.22463-.4185c-.35058-.27131-.60115-.65135-.71237-1.08047h-3.563v-1h3.563c.11122-.42912.36179-.80916.71237-1.08046s.78133-.41851 1.22463-.41851.87405.14721 1.22463.41851.60115.65134.71237 1.08046h3.563v1z"})));function eo({lineEnabled:e,onToggleLine:n,onTogglePoints:t,pointsEnabled:o,translations:r}){return[{type:"Option",label:r.pointsLines,icon:F.jsx(He,{icon:F.jsx(Qr,{})}),selected:o&&e,onClick:()=>{o||t(),e||n()}},{type:"Option",label:r.linesOnly,icon:F.jsx(He,{icon:F.jsx(Kr,{})}),selected:!o&&e,onClick:()=>{o&&t(),e||n()}},{type:"Option",label:r.pointsOnly,icon:F.jsx(He,{icon:F.jsx(Jr,{})}),selected:o&&!e,onClick:()=>{o||t(),e&&n()}}]}const nt=({options:e})=>{const[n,t]=G.useState(!1),o=e.find(r=>r.selected);return F.jsx(fn,{open:n,setOpen:t,menu:{sections:e,trigger:"Component",component:F.jsx(je,{display:"inline-flex",text:o==null?void 0:o.label,placement:"bottom-start",enabled:!n,children:F.jsx(fe,{colored:"muted",basic:!0,small:!0,round:!0,icon:o==null?void 0:o.icon})})}})};nt.__docgenInfo={description:"",methods:[],displayName:"LineOptions",props:{options:{required:!0,tsType:{name:"Array",elements:[{name:"IMenuSection"}],raw:"IMenuSection[]"},description:""}}};function no({onTogglePan:e,onToggleZoom:n,panEnabled:t,zoomEnabled:o,enableDragPoints:r,enableDragAnnotation:d,isDragDataAllowed:f,isDragAnnotationAllowed:h,onToggleDragAnnotation:w,onToggleDragPoints:C,onDisableDragOptions:E,translations:{dragToZoom:S,doubleClickToReset:M,dragToPan:N,dragToMovePoints:T,dragDisabled:A,dragToMoveAnnotation:p}}){return[{label:S,description:M,icon:F.jsx(Ht,{}),selected:o,type:"Option",onClick:()=>{o||n()}},{label:N,description:M,icon:F.jsx(qt,{}),selected:t,type:"Option",onClick:()=>{t||e()}},...f?[{label:T,icon:F.jsx(_n,{}),selected:r,type:"Option",onClick:()=>{r||C()}}]:[],...h?[{label:p,icon:F.jsx(_n,{}),selected:d,type:"Option",onClick:()=>{d||w()}}]:[],{label:A,icon:F.jsx(Wt,{}),selected:!o&&!t&&!r&&!d,type:"Option",onClick:E}]}const tt=({options:e})=>{const n=e.find(t=>t.selected);return F.jsx(fn,{menu:{sections:e,trigger:"Component",component:F.jsx(fe,{colored:"muted",basic:!0,small:!0,label:n==null?void 0:n.label,icon:n==null?void 0:n.icon})}})};tt.__docgenInfo={description:"@param {import('./drag-options-interfaces').IDragOptions} obj",methods:[],displayName:"DragOptions",props:{options:{required:!0,tsType:{name:"Array",elements:[{name:"IMenuSection"}],raw:"IMenuSection[]"},description:""}}};const to="_controls_1edjs_1",ro="_buttons_1edjs_6",Sn={controls:to,buttons:ro},oo=e=>{const n=G.useCallback(t=>()=>{e({type:t})},[e]);return{onToggleLegend:n(Zn),onToggleLine:n($n),onTogglePan:n(qn),onTogglePoints:n(Wn),onToggleTable:n(Kn),onToggleZoom:n(Hn),onToggleDragPoints:n(Jn),onToggleDragAnnotation:n(Qn),onDisableDragOptions:n(et)}};function Me(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ze={exports:{}},In;function so(){return In||(In=1,function(e,n){(function(t){e.exports=t()})(function(){return function t(o,r,d){function f(C,E){if(!r[C]){if(!o[C]){var S=typeof Me=="function"&&Me;if(!E&&S)return S(C,!0);if(h)return h(C,!0);throw new Error("Cannot find module '"+C+"'")}E=r[C]={exports:{}},o[C][0].call(E.exports,function(M){var N=o[C][1][M];return f(N||M)},E,E.exports,t,o,r,d)}return r[C].exports}for(var h=typeof Me=="function"&&Me,w=0;w<d.length;w++)f(d[w]);return f}({1:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){var T=t("crypto");function A(c,g){g=b(c,g);var l;return(l=g.algorithm!=="passthrough"?T.createHash(g.algorithm):new I).write===void 0&&(l.write=l.update,l.end=l.update),y(g,l).dispatch(c),l.update||l.end(""),l.digest?l.digest(g.encoding==="buffer"?void 0:g.encoding):(c=l.read(),g.encoding!=="buffer"?c.toString(g.encoding):c)}(r=o.exports=A).sha1=function(c){return A(c)},r.keys=function(c){return A(c,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},r.MD5=function(c){return A(c,{algorithm:"md5",encoding:"hex"})},r.keysMD5=function(c){return A(c,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=T.getHashes?T.getHashes().slice():["sha1","md5"],v=(p.push("passthrough"),["buffer","hex","binary","base64"]);function b(c,g){var l={};if(l.algorithm=(g=g||{}).algorithm||"sha1",l.encoding=g.encoding||"hex",l.excludeValues=!!g.excludeValues,l.algorithm=l.algorithm.toLowerCase(),l.encoding=l.encoding.toLowerCase(),l.ignoreUnknown=g.ignoreUnknown===!0,l.respectType=g.respectType!==!1,l.respectFunctionNames=g.respectFunctionNames!==!1,l.respectFunctionProperties=g.respectFunctionProperties!==!1,l.unorderedArrays=g.unorderedArrays===!0,l.unorderedSets=g.unorderedSets!==!1,l.unorderedObjects=g.unorderedObjects!==!1,l.replacer=g.replacer||void 0,l.excludeKeys=g.excludeKeys||void 0,c===void 0)throw new Error("Object argument required.");for(var u=0;u<p.length;++u)p[u].toLowerCase()===l.algorithm.toLowerCase()&&(l.algorithm=p[u]);if(p.indexOf(l.algorithm)===-1)throw new Error('Algorithm "'+l.algorithm+'" not supported. supported values: '+p.join(", "));if(v.indexOf(l.encoding)===-1&&l.algorithm!=="passthrough")throw new Error('Encoding "'+l.encoding+'" not supported. supported values: '+v.join(", "));return l}function L(c){if(typeof c=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(c))!=null}function y(c,g,l){l=l||[];function u(i){return g.update?g.update(i,"utf8"):g.write(i,"utf8")}return{dispatch:function(i){return this["_"+((i=c.replacer?c.replacer(i):i)===null?"null":typeof i)](i)},_object:function(i){var _,x=Object.prototype.toString.call(i),U=/\[object (.*)\]/i.exec(x);if(U=(U=U?U[1]:"unknown:["+x+"]").toLowerCase(),0<=(x=l.indexOf(i)))return this.dispatch("[CIRCULAR:"+x+"]");if(l.push(i),h!==void 0&&h.isBuffer&&h.isBuffer(i))return u("buffer:"),u(i);if(U==="object"||U==="function"||U==="asyncfunction")return x=Object.keys(i),c.unorderedObjects&&(x=x.sort()),c.respectType===!1||L(i)||x.splice(0,0,"prototype","__proto__","constructor"),c.excludeKeys&&(x=x.filter(function(k){return!c.excludeKeys(k)})),u("object:"+x.length+":"),_=this,x.forEach(function(k){_.dispatch(k),u(":"),c.excludeValues||_.dispatch(i[k]),u(",")});if(!this["_"+U]){if(c.ignoreUnknown)return u("["+U+"]");throw new Error('Unknown object type "'+U+'"')}this["_"+U](i)},_array:function(i,k){k=k!==void 0?k:c.unorderedArrays!==!1;var x=this;if(u("array:"+i.length+":"),!k||i.length<=1)return i.forEach(function(R){return x.dispatch(R)});var U=[],k=i.map(function(R){var D=new I,z=l.slice();return y(c,D,z).dispatch(R),U=U.concat(z.slice(l.length)),D.read().toString()});return l=l.concat(U),k.sort(),this._array(k,!1)},_date:function(i){return u("date:"+i.toJSON())},_symbol:function(i){return u("symbol:"+i.toString())},_error:function(i){return u("error:"+i.toString())},_boolean:function(i){return u("bool:"+i.toString())},_string:function(i){u("string:"+i.length+":"),u(i.toString())},_function:function(i){u("fn:"),L(i)?this.dispatch("[native]"):this.dispatch(i.toString()),c.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(i.name)),c.respectFunctionProperties&&this._object(i)},_number:function(i){return u("number:"+i.toString())},_xml:function(i){return u("xml:"+i.toString())},_null:function(){return u("Null")},_undefined:function(){return u("Undefined")},_regexp:function(i){return u("regex:"+i.toString())},_uint8array:function(i){return u("uint8array:"),this.dispatch(Array.prototype.slice.call(i))},_uint8clampedarray:function(i){return u("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(i))},_int8array:function(i){return u("int8array:"),this.dispatch(Array.prototype.slice.call(i))},_uint16array:function(i){return u("uint16array:"),this.dispatch(Array.prototype.slice.call(i))},_int16array:function(i){return u("int16array:"),this.dispatch(Array.prototype.slice.call(i))},_uint32array:function(i){return u("uint32array:"),this.dispatch(Array.prototype.slice.call(i))},_int32array:function(i){return u("int32array:"),this.dispatch(Array.prototype.slice.call(i))},_float32array:function(i){return u("float32array:"),this.dispatch(Array.prototype.slice.call(i))},_float64array:function(i){return u("float64array:"),this.dispatch(Array.prototype.slice.call(i))},_arraybuffer:function(i){return u("arraybuffer:"),this.dispatch(new Uint8Array(i))},_url:function(i){return u("url:"+i.toString())},_map:function(i){return u("map:"),i=Array.from(i),this._array(i,c.unorderedSets!==!1)},_set:function(i){return u("set:"),i=Array.from(i),this._array(i,c.unorderedSets!==!1)},_file:function(i){return u("file:"),this.dispatch([i.name,i.size,i.type,i.lastModfied])},_blob:function(){if(c.ignoreUnknown)return u("[blob]");throw Error(`Hashing Blob objects is currently not supported
2
- (see https://github.com/puleos/object-hash/issues/26)
3
- Use "options.replacer" or "options.ignoreUnknown"
4
- `)},_domwindow:function(){return u("domwindow")},_bigint:function(i){return u("bigint:"+i.toString())},_process:function(){return u("process")},_timer:function(){return u("timer")},_pipe:function(){return u("pipe")},_tcp:function(){return u("tcp")},_udp:function(){return u("udp")},_tty:function(){return u("tty")},_statwatcher:function(){return u("statwatcher")},_securecontext:function(){return u("securecontext")},_connection:function(){return u("connection")},_zlib:function(){return u("zlib")},_context:function(){return u("context")},_nodescript:function(){return u("nodescript")},_httpparser:function(){return u("httpparser")},_dataview:function(){return u("dataview")},_signal:function(){return u("signal")},_fsevent:function(){return u("fsevent")},_tlswrap:function(){return u("tlswrap")}}}function I(){return{buf:"",write:function(c){this.buf+=c},end:function(c){this.buf+=c},read:function(){return this.buf}}}r.writeToStream=function(c,g,l){return l===void 0&&(l=g,g={}),y(g=b(c,g),l).dispatch(c)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){(function(T){var A=typeof Uint8Array<"u"?Uint8Array:Array,p=43,v=47,b=48,L=97,y=65,I=45,c=95;function g(l){return l=l.charCodeAt(0),l===p||l===I?62:l===v||l===c?63:l<b?-1:l<b+10?l-b+26+26:l<y+26?l-y:l<L+26?l-L+26:void 0}T.toByteArray=function(l){var u,i;if(0<l.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var _=l.length,_=l.charAt(_-2)==="="?2:l.charAt(_-1)==="="?1:0,x=new A(3*l.length/4-_),U=0<_?l.length-4:l.length,k=0;function R(D){x[k++]=D}for(u=0;u<U;u+=4,0)R((16711680&(i=g(l.charAt(u))<<18|g(l.charAt(u+1))<<12|g(l.charAt(u+2))<<6|g(l.charAt(u+3))))>>16),R((65280&i)>>8),R(255&i);return _==2?R(255&(i=g(l.charAt(u))<<2|g(l.charAt(u+1))>>4)):_==1&&(R((i=g(l.charAt(u))<<10|g(l.charAt(u+1))<<4|g(l.charAt(u+2))>>2)>>8&255),R(255&i)),x},T.fromByteArray=function(l){var u,i,_,x,U=l.length%3,k="";function R(D){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(D)}for(u=0,_=l.length-U;u<_;u+=3)i=(l[u]<<16)+(l[u+1]<<8)+l[u+2],k+=R((x=i)>>18&63)+R(x>>12&63)+R(x>>6&63)+R(63&x);switch(U){case 1:k=(k+=R((i=l[l.length-1])>>2))+R(i<<4&63)+"==";break;case 2:k=(k=(k+=R((i=(l[l.length-2]<<8)+l[l.length-1])>>10))+R(i>>4&63))+R(i<<2&63)+"="}return k}})(r===void 0?this.base64js={}:r)}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,o,r){(function(d,f,p,w,C,E,S,M,N){var T=t("base64-js"),A=t("ieee754");function p(s,a,m){if(!(this instanceof p))return new p(s,a,m);var O,P,j,V,W=typeof s;if(a==="base64"&&W=="string")for(s=(V=s).trim?V.trim():V.replace(/^\s+|\s+$/g,"");s.length%4!=0;)s+="=";if(W=="number")O=q(s);else if(W=="string")O=p.byteLength(s,a);else{if(W!="object")throw new Error("First argument needs to be a number, array or string.");O=q(s.length)}if(p._useTypedArrays?P=p._augment(new Uint8Array(O)):((P=this).length=O,P._isBuffer=!0),p._useTypedArrays&&typeof s.byteLength=="number")P._set(s);else if(H(V=s)||p.isBuffer(V)||V&&typeof V=="object"&&typeof V.length=="number")for(j=0;j<O;j++)p.isBuffer(s)?P[j]=s.readUInt8(j):P[j]=s[j];else if(W=="string")P.write(s,0,a);else if(W=="number"&&!p._useTypedArrays&&!m)for(j=0;j<O;j++)P[j]=0;return P}function v(s,a,m,O){return p._charsWritten=de(function(P){for(var j=[],V=0;V<P.length;V++)j.push(255&P.charCodeAt(V));return j}(a),s,m,O)}function b(s,a,m,O){return p._charsWritten=de(function(P){for(var j,V,W=[],K=0;K<P.length;K++)V=P.charCodeAt(K),j=V>>8,V=V%256,W.push(V),W.push(j);return W}(a),s,m,O)}function L(s,a,m){var O="";m=Math.min(s.length,m);for(var P=a;P<m;P++)O+=String.fromCharCode(s[P]);return O}function y(s,a,m,j){j||(B(typeof m=="boolean","missing or invalid endian"),B(a!=null,"missing offset"),B(a+1<s.length,"Trying to read beyond buffer length"));var P,j=s.length;if(!(j<=a))return m?(P=s[a],a+1<j&&(P|=s[a+1]<<8)):(P=s[a]<<8,a+1<j&&(P|=s[a+1])),P}function I(s,a,m,j){j||(B(typeof m=="boolean","missing or invalid endian"),B(a!=null,"missing offset"),B(a+3<s.length,"Trying to read beyond buffer length"));var P,j=s.length;if(!(j<=a))return m?(a+2<j&&(P=s[a+2]<<16),a+1<j&&(P|=s[a+1]<<8),P|=s[a],a+3<j&&(P+=s[a+3]<<24>>>0)):(a+1<j&&(P=s[a+1]<<16),a+2<j&&(P|=s[a+2]<<8),a+3<j&&(P|=s[a+3]),P+=s[a]<<24>>>0),P}function c(s,a,m,O){if(O||(B(typeof m=="boolean","missing or invalid endian"),B(a!=null,"missing offset"),B(a+1<s.length,"Trying to read beyond buffer length")),!(s.length<=a))return O=y(s,a,m,!0),32768&O?-1*(65535-O+1):O}function g(s,a,m,O){if(O||(B(typeof m=="boolean","missing or invalid endian"),B(a!=null,"missing offset"),B(a+3<s.length,"Trying to read beyond buffer length")),!(s.length<=a))return O=I(s,a,m,!0),2147483648&O?-1*(4294967295-O+1):O}function l(s,a,m,O){return O||(B(typeof m=="boolean","missing or invalid endian"),B(a+3<s.length,"Trying to read beyond buffer length")),A.read(s,a,m,23,4)}function u(s,a,m,O){return O||(B(typeof m=="boolean","missing or invalid endian"),B(a+7<s.length,"Trying to read beyond buffer length")),A.read(s,a,m,52,8)}function i(s,a,m,O,P){if(P||(B(a!=null,"missing value"),B(typeof O=="boolean","missing or invalid endian"),B(m!=null,"missing offset"),B(m+1<s.length,"trying to write beyond buffer length"),ue(a,65535)),P=s.length,!(P<=m))for(var j=0,V=Math.min(P-m,2);j<V;j++)s[m+j]=(a&255<<8*(O?j:1-j))>>>8*(O?j:1-j)}function _(s,a,m,O,P){if(P||(B(a!=null,"missing value"),B(typeof O=="boolean","missing or invalid endian"),B(m!=null,"missing offset"),B(m+3<s.length,"trying to write beyond buffer length"),ue(a,4294967295)),P=s.length,!(P<=m))for(var j=0,V=Math.min(P-m,4);j<V;j++)s[m+j]=a>>>8*(O?j:3-j)&255}function x(s,a,m,O,P){P||(B(a!=null,"missing value"),B(typeof O=="boolean","missing or invalid endian"),B(m!=null,"missing offset"),B(m+1<s.length,"Trying to write beyond buffer length"),ae(a,32767,-32768)),s.length<=m||i(s,0<=a?a:65535+a+1,m,O,P)}function U(s,a,m,O,P){P||(B(a!=null,"missing value"),B(typeof O=="boolean","missing or invalid endian"),B(m!=null,"missing offset"),B(m+3<s.length,"Trying to write beyond buffer length"),ae(a,2147483647,-2147483648)),s.length<=m||_(s,0<=a?a:4294967295+a+1,m,O,P)}function k(s,a,m,O,P){P||(B(a!=null,"missing value"),B(typeof O=="boolean","missing or invalid endian"),B(m!=null,"missing offset"),B(m+3<s.length,"Trying to write beyond buffer length"),pn(a,34028234663852886e22,-34028234663852886e22)),s.length<=m||A.write(s,a,m,O,23,4)}function R(s,a,m,O,P){P||(B(a!=null,"missing value"),B(typeof O=="boolean","missing or invalid endian"),B(m!=null,"missing offset"),B(m+7<s.length,"Trying to write beyond buffer length"),pn(a,17976931348623157e292,-17976931348623157e292)),s.length<=m||A.write(s,a,m,O,52,8)}r.Buffer=p,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50,p.poolSize=8192,p._useTypedArrays=function(){try{var s=new ArrayBuffer(0),a=new Uint8Array(s);return a.foo=function(){return 42},a.foo()===42&&typeof a.subarray=="function"}catch{return!1}}(),p.isEncoding=function(s){switch(String(s).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.isBuffer=function(s){return!(s==null||!s._isBuffer)},p.byteLength=function(s,a){var m;switch(s+="",a||"utf8"){case"hex":m=s.length/2;break;case"utf8":case"utf-8":m=Z(s).length;break;case"ascii":case"binary":case"raw":m=s.length;break;case"base64":m=Le(s).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=2*s.length;break;default:throw new Error("Unknown encoding")}return m},p.concat=function(s,a){if(B(H(s),`Usage: Buffer.concat(list, [totalLength])
5
- list should be an Array.`),s.length===0)return new p(0);if(s.length===1)return s[0];if(typeof a!="number")for(P=a=0;P<s.length;P++)a+=s[P].length;for(var m=new p(a),O=0,P=0;P<s.length;P++){var j=s[P];j.copy(m,O),O+=j.length}return m},p.prototype.write=function(s,a,m,O){isFinite(a)?isFinite(m)||(O=m,m=void 0):(K=O,O=a,a=m,m=K),a=Number(a)||0;var P,j,V,W,K=this.length-a;switch((!m||K<(m=Number(m)))&&(m=K),O=String(O||"utf8").toLowerCase()){case"hex":P=function(re,Q,ee,J){ee=Number(ee)||0;var $=re.length-ee;(!J||$<(J=Number(J)))&&(J=$),B(($=Q.length)%2==0,"Invalid hex string"),$/2<J&&(J=$/2);for(var me=0;me<J;me++){var mn=parseInt(Q.substr(2*me,2),16);B(!isNaN(mn),"Invalid hex string"),re[ee+me]=mn}return p._charsWritten=2*me,me}(this,s,a,m);break;case"utf8":case"utf-8":j=this,V=a,W=m,P=p._charsWritten=de(Z(s),j,V,W);break;case"ascii":case"binary":P=v(this,s,a,m);break;case"base64":j=this,V=a,W=m,P=p._charsWritten=de(Le(s),j,V,W);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":P=b(this,s,a,m);break;default:throw new Error("Unknown encoding")}return P},p.prototype.toString=function(s,a,m){var O,P,j,V,W=this;if(s=String(s||"utf8").toLowerCase(),a=Number(a)||0,(m=m!==void 0?Number(m):W.length)===a)return"";switch(s){case"hex":O=function(K,re,Q){var ee=K.length;(!re||re<0)&&(re=0),(!Q||Q<0||ee<Q)&&(Q=ee);for(var J="",$=re;$<Q;$++)J+=X(K[$]);return J}(W,a,m);break;case"utf8":case"utf-8":O=function(K,re,Q){var ee="",J="";Q=Math.min(K.length,Q);for(var $=re;$<Q;$++)K[$]<=127?(ee+=ve(J)+String.fromCharCode(K[$]),J=""):J+="%"+K[$].toString(16);return ee+ve(J)}(W,a,m);break;case"ascii":case"binary":O=L(W,a,m);break;case"base64":P=W,V=m,O=(j=a)===0&&V===P.length?T.fromByteArray(P):T.fromByteArray(P.slice(j,V));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":O=function(K,re,Q){for(var ee=K.slice(re,Q),J="",$=0;$<ee.length;$+=2)J+=String.fromCharCode(ee[$]+256*ee[$+1]);return J}(W,a,m);break;default:throw new Error("Unknown encoding")}return O},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},p.prototype.copy=function(s,a,m,O){if(a=a||0,(O=O||O===0?O:this.length)!==(m=m||0)&&s.length!==0&&this.length!==0){B(m<=O,"sourceEnd < sourceStart"),B(0<=a&&a<s.length,"targetStart out of bounds"),B(0<=m&&m<this.length,"sourceStart out of bounds"),B(0<=O&&O<=this.length,"sourceEnd out of bounds"),O>this.length&&(O=this.length);var P=(O=s.length-a<O-m?s.length-a+m:O)-m;if(P<100||!p._useTypedArrays)for(var j=0;j<P;j++)s[j+a]=this[j+m];else s._set(this.subarray(m,m+P),a)}},p.prototype.slice=function(s,a){var m=this.length;if(s=z(s,m,0),a=z(a,m,m),p._useTypedArrays)return p._augment(this.subarray(s,a));for(var O=a-s,P=new p(O,void 0,!0),j=0;j<O;j++)P[j]=this[j+s];return P},p.prototype.get=function(s){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(s)},p.prototype.set=function(s,a){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(s,a)},p.prototype.readUInt8=function(s,a){if(a||(B(s!=null,"missing offset"),B(s<this.length,"Trying to read beyond buffer length")),!(s>=this.length))return this[s]},p.prototype.readUInt16LE=function(s,a){return y(this,s,!0,a)},p.prototype.readUInt16BE=function(s,a){return y(this,s,!1,a)},p.prototype.readUInt32LE=function(s,a){return I(this,s,!0,a)},p.prototype.readUInt32BE=function(s,a){return I(this,s,!1,a)},p.prototype.readInt8=function(s,a){if(a||(B(s!=null,"missing offset"),B(s<this.length,"Trying to read beyond buffer length")),!(s>=this.length))return 128&this[s]?-1*(255-this[s]+1):this[s]},p.prototype.readInt16LE=function(s,a){return c(this,s,!0,a)},p.prototype.readInt16BE=function(s,a){return c(this,s,!1,a)},p.prototype.readInt32LE=function(s,a){return g(this,s,!0,a)},p.prototype.readInt32BE=function(s,a){return g(this,s,!1,a)},p.prototype.readFloatLE=function(s,a){return l(this,s,!0,a)},p.prototype.readFloatBE=function(s,a){return l(this,s,!1,a)},p.prototype.readDoubleLE=function(s,a){return u(this,s,!0,a)},p.prototype.readDoubleBE=function(s,a){return u(this,s,!1,a)},p.prototype.writeUInt8=function(s,a,m){m||(B(s!=null,"missing value"),B(a!=null,"missing offset"),B(a<this.length,"trying to write beyond buffer length"),ue(s,255)),a>=this.length||(this[a]=s)},p.prototype.writeUInt16LE=function(s,a,m){i(this,s,a,!0,m)},p.prototype.writeUInt16BE=function(s,a,m){i(this,s,a,!1,m)},p.prototype.writeUInt32LE=function(s,a,m){_(this,s,a,!0,m)},p.prototype.writeUInt32BE=function(s,a,m){_(this,s,a,!1,m)},p.prototype.writeInt8=function(s,a,m){m||(B(s!=null,"missing value"),B(a!=null,"missing offset"),B(a<this.length,"Trying to write beyond buffer length"),ae(s,127,-128)),a>=this.length||(0<=s?this.writeUInt8(s,a,m):this.writeUInt8(255+s+1,a,m))},p.prototype.writeInt16LE=function(s,a,m){x(this,s,a,!0,m)},p.prototype.writeInt16BE=function(s,a,m){x(this,s,a,!1,m)},p.prototype.writeInt32LE=function(s,a,m){U(this,s,a,!0,m)},p.prototype.writeInt32BE=function(s,a,m){U(this,s,a,!1,m)},p.prototype.writeFloatLE=function(s,a,m){k(this,s,a,!0,m)},p.prototype.writeFloatBE=function(s,a,m){k(this,s,a,!1,m)},p.prototype.writeDoubleLE=function(s,a,m){R(this,s,a,!0,m)},p.prototype.writeDoubleBE=function(s,a,m){R(this,s,a,!1,m)},p.prototype.fill=function(s,a,m){if(a=a||0,m=m||this.length,B(typeof(s=typeof(s=s||0)=="string"?s.charCodeAt(0):s)=="number"&&!isNaN(s),"value is not a number"),B(a<=m,"end < start"),m!==a&&this.length!==0){B(0<=a&&a<this.length,"start out of bounds"),B(0<=m&&m<=this.length,"end out of bounds");for(var O=a;O<m;O++)this[O]=s}},p.prototype.inspect=function(){for(var s=[],a=this.length,m=0;m<a;m++)if(s[m]=X(this[m]),m===r.INSPECT_MAX_BYTES){s[m+1]="...";break}return"<Buffer "+s.join(" ")+">"},p.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(p._useTypedArrays)return new p(this).buffer;for(var s=new Uint8Array(this.length),a=0,m=s.length;a<m;a+=1)s[a]=this[a];return s.buffer};var D=p.prototype;function z(s,a,m){return typeof s!="number"?m:a<=(s=~~s)?a:0<=s||0<=(s+=a)?s:0}function q(s){return(s=~~Math.ceil(+s))<0?0:s}function H(s){return(Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"})(s)}function X(s){return s<16?"0"+s.toString(16):s.toString(16)}function Z(s){for(var a=[],m=0;m<s.length;m++){var O=s.charCodeAt(m);if(O<=127)a.push(s.charCodeAt(m));else for(var P=m,j=(55296<=O&&O<=57343&&m++,encodeURIComponent(s.slice(P,m+1)).substr(1).split("%")),V=0;V<j.length;V++)a.push(parseInt(j[V],16))}return a}function Le(s){return T.toByteArray(s)}function de(s,a,m,O){for(var P=0;P<O&&!(P+m>=a.length||P>=s.length);P++)a[P+m]=s[P];return P}function ve(s){try{return decodeURIComponent(s)}catch{return"�"}}function ue(s,a){B(typeof s=="number","cannot write a non-number as a number"),B(0<=s,"specified a negative value for writing an unsigned value"),B(s<=a,"value is larger than maximum value for type"),B(Math.floor(s)===s,"value has a fractional component")}function ae(s,a,m){B(typeof s=="number","cannot write a non-number as a number"),B(s<=a,"value larger than maximum allowed value"),B(m<=s,"value smaller than minimum allowed value"),B(Math.floor(s)===s,"value has a fractional component")}function pn(s,a,m){B(typeof s=="number","cannot write a non-number as a number"),B(s<=a,"value larger than maximum allowed value"),B(m<=s,"value smaller than minimum allowed value")}function B(s,a){if(!s)throw new Error(a||"Failed assertion")}p._augment=function(s){return s._isBuffer=!0,s._get=s.get,s._set=s.set,s.get=D.get,s.set=D.set,s.write=D.write,s.toString=D.toString,s.toLocaleString=D.toString,s.toJSON=D.toJSON,s.copy=D.copy,s.slice=D.slice,s.readUInt8=D.readUInt8,s.readUInt16LE=D.readUInt16LE,s.readUInt16BE=D.readUInt16BE,s.readUInt32LE=D.readUInt32LE,s.readUInt32BE=D.readUInt32BE,s.readInt8=D.readInt8,s.readInt16LE=D.readInt16LE,s.readInt16BE=D.readInt16BE,s.readInt32LE=D.readInt32LE,s.readInt32BE=D.readInt32BE,s.readFloatLE=D.readFloatLE,s.readFloatBE=D.readFloatBE,s.readDoubleLE=D.readDoubleLE,s.readDoubleBE=D.readDoubleBE,s.writeUInt8=D.writeUInt8,s.writeUInt16LE=D.writeUInt16LE,s.writeUInt16BE=D.writeUInt16BE,s.writeUInt32LE=D.writeUInt32LE,s.writeUInt32BE=D.writeUInt32BE,s.writeInt8=D.writeInt8,s.writeInt16LE=D.writeInt16LE,s.writeInt16BE=D.writeInt16BE,s.writeInt32LE=D.writeInt32LE,s.writeInt32BE=D.writeInt32BE,s.writeFloatLE=D.writeFloatLE,s.writeFloatBE=D.writeFloatBE,s.writeDoubleLE=D.writeDoubleLE,s.writeDoubleBE=D.writeDoubleBE,s.fill=D.fill,s.inspect=D.inspect,s.toArrayBuffer=D.toArrayBuffer,s}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,o,r){(function(d,f,T,w,C,E,S,M,N){var T=t("buffer").Buffer,A=4,p=new T(A);p.fill(0),o.exports={hash:function(v,b,L,y){for(var I=b(function(i,_){i.length%A!=0&&(x=i.length+(A-i.length%A),i=T.concat([i,p],x));for(var x,U=[],k=_?i.readInt32BE:i.readInt32LE,R=0;R<i.length;R+=A)U.push(k.call(i,R));return U}(v=T.isBuffer(v)?v:new T(v),y),8*v.length),b=y,c=new T(L),g=b?c.writeInt32BE:c.writeInt32LE,l=0;l<I.length;l++)g.call(c,I[l],4*l,!0);return c}}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(t,o,r){(function(d,f,T,w,C,E,S,M,N){var T=t("buffer").Buffer,A=t("./sha"),p=t("./sha256"),v=t("./rng"),b={sha1:A,sha256:p,md5:t("./md5")},L=64,y=new T(L);function I(i,_){var x=b[i=i||"sha1"],U=[];return x||c("algorithm:",i,"is not yet supported"),{update:function(k){return T.isBuffer(k)||(k=new T(k)),U.push(k),k.length,this},digest:function(k){var R=T.concat(U),R=_?function(D,z,q){T.isBuffer(z)||(z=new T(z)),T.isBuffer(q)||(q=new T(q)),z.length>L?z=D(z):z.length<L&&(z=T.concat([z,y],L));for(var H=new T(L),X=new T(L),Z=0;Z<L;Z++)H[Z]=54^z[Z],X[Z]=92^z[Z];return q=D(T.concat([H,q])),D(T.concat([X,q]))}(x,_,R):x(R);return U=null,k?R.toString(k):R}}}function c(){var i=[].slice.call(arguments).join(" ");throw new Error([i,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
6
- `))}y.fill(0),r.createHash=function(i){return I(i)},r.createHmac=I,r.randomBytes=function(i,_){if(!_||!_.call)return new T(v(i));try{_.call(this,void 0,new T(v(i)))}catch(x){_(x)}};var g,l=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],u=function(i){r[i]=function(){c("sorry,",i,"is not implemented yet")}};for(g in l)u(l[g])}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){var T=t("./helpers");function A(c,g){c[g>>5]|=128<<g%32,c[14+(g+64>>>9<<4)]=g;for(var l=1732584193,u=-271733879,i=-1732584194,_=271733878,x=0;x<c.length;x+=16){var U=l,k=u,R=i,D=_,l=v(l,u,i,_,c[x+0],7,-680876936),_=v(_,l,u,i,c[x+1],12,-389564586),i=v(i,_,l,u,c[x+2],17,606105819),u=v(u,i,_,l,c[x+3],22,-1044525330);l=v(l,u,i,_,c[x+4],7,-176418897),_=v(_,l,u,i,c[x+5],12,1200080426),i=v(i,_,l,u,c[x+6],17,-1473231341),u=v(u,i,_,l,c[x+7],22,-45705983),l=v(l,u,i,_,c[x+8],7,1770035416),_=v(_,l,u,i,c[x+9],12,-1958414417),i=v(i,_,l,u,c[x+10],17,-42063),u=v(u,i,_,l,c[x+11],22,-1990404162),l=v(l,u,i,_,c[x+12],7,1804603682),_=v(_,l,u,i,c[x+13],12,-40341101),i=v(i,_,l,u,c[x+14],17,-1502002290),l=b(l,u=v(u,i,_,l,c[x+15],22,1236535329),i,_,c[x+1],5,-165796510),_=b(_,l,u,i,c[x+6],9,-1069501632),i=b(i,_,l,u,c[x+11],14,643717713),u=b(u,i,_,l,c[x+0],20,-373897302),l=b(l,u,i,_,c[x+5],5,-701558691),_=b(_,l,u,i,c[x+10],9,38016083),i=b(i,_,l,u,c[x+15],14,-660478335),u=b(u,i,_,l,c[x+4],20,-405537848),l=b(l,u,i,_,c[x+9],5,568446438),_=b(_,l,u,i,c[x+14],9,-1019803690),i=b(i,_,l,u,c[x+3],14,-187363961),u=b(u,i,_,l,c[x+8],20,1163531501),l=b(l,u,i,_,c[x+13],5,-1444681467),_=b(_,l,u,i,c[x+2],9,-51403784),i=b(i,_,l,u,c[x+7],14,1735328473),l=L(l,u=b(u,i,_,l,c[x+12],20,-1926607734),i,_,c[x+5],4,-378558),_=L(_,l,u,i,c[x+8],11,-2022574463),i=L(i,_,l,u,c[x+11],16,1839030562),u=L(u,i,_,l,c[x+14],23,-35309556),l=L(l,u,i,_,c[x+1],4,-1530992060),_=L(_,l,u,i,c[x+4],11,1272893353),i=L(i,_,l,u,c[x+7],16,-155497632),u=L(u,i,_,l,c[x+10],23,-1094730640),l=L(l,u,i,_,c[x+13],4,681279174),_=L(_,l,u,i,c[x+0],11,-358537222),i=L(i,_,l,u,c[x+3],16,-722521979),u=L(u,i,_,l,c[x+6],23,76029189),l=L(l,u,i,_,c[x+9],4,-640364487),_=L(_,l,u,i,c[x+12],11,-421815835),i=L(i,_,l,u,c[x+15],16,530742520),l=y(l,u=L(u,i,_,l,c[x+2],23,-995338651),i,_,c[x+0],6,-198630844),_=y(_,l,u,i,c[x+7],10,1126891415),i=y(i,_,l,u,c[x+14],15,-1416354905),u=y(u,i,_,l,c[x+5],21,-57434055),l=y(l,u,i,_,c[x+12],6,1700485571),_=y(_,l,u,i,c[x+3],10,-1894986606),i=y(i,_,l,u,c[x+10],15,-1051523),u=y(u,i,_,l,c[x+1],21,-2054922799),l=y(l,u,i,_,c[x+8],6,1873313359),_=y(_,l,u,i,c[x+15],10,-30611744),i=y(i,_,l,u,c[x+6],15,-1560198380),u=y(u,i,_,l,c[x+13],21,1309151649),l=y(l,u,i,_,c[x+4],6,-145523070),_=y(_,l,u,i,c[x+11],10,-1120210379),i=y(i,_,l,u,c[x+2],15,718787259),u=y(u,i,_,l,c[x+9],21,-343485551),l=I(l,U),u=I(u,k),i=I(i,R),_=I(_,D)}return Array(l,u,i,_)}function p(c,g,l,u,i,_){return I((g=I(I(g,c),I(u,_)))<<i|g>>>32-i,l)}function v(c,g,l,u,i,_,x){return p(g&l|~g&u,c,g,i,_,x)}function b(c,g,l,u,i,_,x){return p(g&u|l&~u,c,g,i,_,x)}function L(c,g,l,u,i,_,x){return p(g^l^u,c,g,i,_,x)}function y(c,g,l,u,i,_,x){return p(l^(g|~u),c,g,i,_,x)}function I(c,g){var l=(65535&c)+(65535&g);return(c>>16)+(g>>16)+(l>>16)<<16|65535&l}o.exports=function(c){return T.hash(c,A,16)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){o.exports=function(T){for(var A,p=new Array(T),v=0;v<T;v++)(3&v)==0&&(A=4294967296*Math.random()),p[v]=A>>>((3&v)<<3)&255;return p}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){var T=t("./helpers");function A(b,L){b[L>>5]|=128<<24-L%32,b[15+(L+64>>9<<4)]=L;for(var y,I,c,g=Array(80),l=1732584193,u=-271733879,i=-1732584194,_=271733878,x=-1009589776,U=0;U<b.length;U+=16){for(var k=l,R=u,D=i,z=_,q=x,H=0;H<80;H++){g[H]=H<16?b[U+H]:v(g[H-3]^g[H-8]^g[H-14]^g[H-16],1);var X=p(p(v(l,5),(X=u,I=i,c=_,(y=H)<20?X&I|~X&c:!(y<40)&&y<60?X&I|X&c|I&c:X^I^c)),p(p(x,g[H]),(y=H)<20?1518500249:y<40?1859775393:y<60?-1894007588:-899497514)),x=_,_=i,i=v(u,30),u=l,l=X}l=p(l,k),u=p(u,R),i=p(i,D),_=p(_,z),x=p(x,q)}return Array(l,u,i,_,x)}function p(b,L){var y=(65535&b)+(65535&L);return(b>>16)+(L>>16)+(y>>16)<<16|65535&y}function v(b,L){return b<<L|b>>>32-L}o.exports=function(b){return T.hash(b,A,20,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){function T(L,y){var I=(65535&L)+(65535&y);return(L>>16)+(y>>16)+(I>>16)<<16|65535&I}function A(L,y){var I,c=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),g=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),l=new Array(64);L[y>>5]|=128<<24-y%32,L[15+(y+64>>9<<4)]=y;for(var u,i,_=0;_<L.length;_+=16){for(var x=g[0],U=g[1],k=g[2],R=g[3],D=g[4],z=g[5],q=g[6],H=g[7],X=0;X<64;X++)l[X]=X<16?L[X+_]:T(T(T((i=l[X-2],v(i,17)^v(i,19)^b(i,10)),l[X-7]),(i=l[X-15],v(i,7)^v(i,18)^b(i,3))),l[X-16]),I=T(T(T(T(H,v(i=D,6)^v(i,11)^v(i,25)),D&z^~D&q),c[X]),l[X]),u=T(v(u=x,2)^v(u,13)^v(u,22),x&U^x&k^U&k),H=q,q=z,z=D,D=T(R,I),R=k,k=U,U=x,x=T(I,u);g[0]=T(x,g[0]),g[1]=T(U,g[1]),g[2]=T(k,g[2]),g[3]=T(R,g[3]),g[4]=T(D,g[4]),g[5]=T(z,g[5]),g[6]=T(q,g[6]),g[7]=T(H,g[7])}return g}var p=t("./helpers"),v=function(L,y){return L>>>y|L<<32-y},b=function(L,y){return L>>>y};o.exports=function(L){return p.hash(L,A,32,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){r.read=function(T,A,p,v,_){var L,y,I=8*_-v-1,c=(1<<I)-1,g=c>>1,l=-7,u=p?_-1:0,i=p?-1:1,_=T[A+u];for(u+=i,L=_&(1<<-l)-1,_>>=-l,l+=I;0<l;L=256*L+T[A+u],u+=i,l-=8);for(y=L&(1<<-l)-1,L>>=-l,l+=v;0<l;y=256*y+T[A+u],u+=i,l-=8);if(L===0)L=1-g;else{if(L===c)return y?NaN:1/0*(_?-1:1);y+=Math.pow(2,v),L-=g}return(_?-1:1)*y*Math.pow(2,L-v)},r.write=function(T,A,p,v,b,x){var y,I,c=8*x-b-1,g=(1<<c)-1,l=g>>1,u=b===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=v?0:x-1,_=v?1:-1,x=A<0||A===0&&1/A<0?1:0;for(A=Math.abs(A),isNaN(A)||A===1/0?(I=isNaN(A)?1:0,y=g):(y=Math.floor(Math.log(A)/Math.LN2),A*(v=Math.pow(2,-y))<1&&(y--,v*=2),2<=(A+=1<=y+l?u/v:u*Math.pow(2,1-l))*v&&(y++,v/=2),g<=y+l?(I=0,y=g):1<=y+l?(I=(A*v-1)*Math.pow(2,b),y+=l):(I=A*Math.pow(2,l-1)*Math.pow(2,b),y=0));8<=b;T[p+i]=255&I,i+=_,I/=256,b-=8);for(y=y<<b|I,c+=b;0<c;T[p+i]=255&y,i+=_,y/=256,c-=8);T[p+i-_]|=128*x}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(t,o,r){(function(d,f,h,w,C,E,S,M,N){var T,A,p;function v(){}(d=o.exports={}).nextTick=(A=typeof window<"u"&&window.setImmediate,p=typeof window<"u"&&window.postMessage&&window.addEventListener,A?function(b){return window.setImmediate(b)}:p?(T=[],window.addEventListener("message",function(b){var L=b.source;L!==window&&L!==null||b.data!=="process-tick"||(b.stopPropagation(),0<T.length&&T.shift()())},!0),function(b){T.push(b),window.postMessage("process-tick","*")}):function(b){setTimeout(b,0)}),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=v,d.addListener=v,d.once=v,d.off=v,d.removeListener=v,d.removeAllListeners=v,d.emit=v,d.binding=function(b){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(b){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}(Ze)),Ze.exports}var io=so();const lo=ft(io),uo=(e,n)=>e===void 0||n===void 0||Number(e)<Number(n),ao=(e,n)=>e===void 0||n===void 0||Number(e)>Number(n),rt=(e,n=0,t=!1)=>{const o=t&&n!==0?n+1:"";return`${e}${o}`},co=e=>{var n;return((n=e==null?void 0:e.match(/[^0-9/]+/gi))==null?void 0:n[0])??""},ms=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null,fo=(e,n,t)=>lo({state:e,options:n,languageKey:t},{unorderedObjects:!0}),hn=({chartRef:e,state:n,options:t,dispatch:o,generatedDatasets:r})=>{const{interactions:{onHover:d,onUnhover:f},axes:h}=t,w=G.useCallback(()=>{var L,y;const b=e==null?void 0:e.current;b&&(n!=null&&n.edited)&&((L=b==null?void 0:b.resetZoom)==null||L.call(b),(y=b==null?void 0:b.reset)==null||y.call(b),o({type:sn,payload:{axes:[]}}),o({type:De,payload:!1}))},[e==null?void 0:e.current,o,n]),C=G.useCallback((b,L,y)=>(I,c)=>{if(!(c!=null&&c.length)&&f&&b&&(L(null),f(I)),c!=null&&c.length&&d){const{index:g,datasetIndex:l}=c[0],u=y[l],i=u==null?void 0:u.data[g];i&&!Ar(b,i)&&(L(i),d(I,l,g,y))}},[d,f,r]),E=G.useCallback(()=>xr(e),[e==null?void 0:e.current]),S=G.useCallback(b=>{var L,y,I,c,g;if(b.key===bn.Shift){const l=e.current,u=(I=(y=(L=l==null?void 0:l.config)==null?void 0:L.options)==null?void 0:y.plugins)==null?void 0:I.zoom;(c=u==null?void 0:u.zoom)!=null&&c.mode&&((g=u==null?void 0:u.pan)!=null&&g.mode)&&(u.zoom.mode=we.Y,u.pan.mode=we.Y,l==null||l.update())}},[e==null?void 0:e.current]),M=G.useCallback(b=>{var L,y,I,c,g;if(b.key===bn.Shift){const l=e.current,u=(I=(y=(L=l==null?void 0:l.config)==null?void 0:L.options)==null?void 0:y.plugins)==null?void 0:I.zoom;(c=u==null?void 0:u.zoom)!=null&&c.mode&&((g=u==null?void 0:u.pan)!=null&&g.mode)&&(u.zoom.mode=we.XY,u.pan.mode=we.XY,l==null||l.update())}},[e==null?void 0:e.current]),N=G.useCallback(b=>{var y;if(!((y=Object.keys(b))!=null&&y.length))return[];const L=(I,c)=>{var g;return!I[c]||!((g=I[c])!=null&&g.length)?[]:I[c].map((l,u)=>({id:rt(c,u,I[c].length>1),label:(l==null?void 0:l.label)||""}))};return[...L(b,ce.X),...L(b,ce.Y)]},[h]),T=G.useCallback(()=>{var y;const{scales:b={}}=(e==null?void 0:e.current)||{},L=(y=Object.entries(b))==null?void 0:y.map(([I,{min:c,max:g}])=>({id:I,min:c??0,max:g??0}));o({type:ln,payload:{axes:L}})},[h]),A=G.useCallback(()=>{var L,y;const b=e==null?void 0:e.current;b&&n.edited&&((L=b==null?void 0:b.resetZoom)==null||L.call(b),(y=b==null?void 0:b.reset)==null||y.call(b),o({type:sn,payload:{axes:[]}}),o({type:De,payload:!1}))},[e==null?void 0:e.current]),p=G.useCallback(({axes:b})=>{o({type:ln,payload:{axes:b}})},[]),v=G.useCallback(b=>{o({type:De,payload:b})},[n]);return{resetZoom:w,onHover:C,handleDownload:E,handleKeyDown:S,handleKeyUp:M,controlsAxesLabels:N(h),updateAxesRangesFromChart:T,onResetAxes:A,onUpdateAxes:p,onUpdateEdited:v}},Pn=(e,n,t)=>{const o=[];return gt(e)&&o.push("mustHaveAValue"),t==="min"&&!uo(e,n)?o.push("mustBeLessThanMax"):t==="max"&&!ao(e,n)&&o.push("mustBeGreaterThanMin"),o},go=e=>{const n=e.map(({id:o,min:r,max:d})=>({id:o,min:Pn(String(r),String(d),"min"),max:Pn(String(d),String(r),"max")})),t=n.every(o=>o.min.length===0&&o.max.length===0);return{errors:n,valid:t}},On=1,Nn=({chartRef:e,state:n})=>{const t=e==null?void 0:e.current;if(!t)return[];const o=(t==null?void 0:t.getInitialScaleBounds())??{};return Object.entries(o).map(([r,{min:d="",max:f=""}])=>{var E;let h=Number(d),w=Number(f);isNaN(h)&&(h=0),isNaN(w)&&(w=h+On),h===w&&(w+=On);const{unit:C}=((E=n==null?void 0:n.axes)==null?void 0:E.find(S=>S.id===r))??{};return{id:r,min:h,max:w,unit:C}})},ho=e=>{var L;const{state:n,controlsAxesLabels:t,onUpdateAxes:o,onResetAxes:r,onUpdateEdited:d,depthType:f,translations:h,close:w,chartRef:C}=e??{},[E,S]=G.useState({localAxes:Nn({chartRef:C,state:n}),depthType:f==null?void 0:f.selectedDepthType,edited:n.edited}),{errors:M,valid:N}=go(E.localAxes),T=({name:y,value:I,id:c})=>{S(g=>({...g,localAxes:g.localAxes.map(l=>l.id===c?{...l,[y]:I}:l),edited:!0}))},A=({name:y,value:I,id:c})=>{S(g=>({...g,localAxes:g.localAxes.map(l=>l.id===c&&typeof l.unit=="object"?{...l,unit:{...l.unit,[y]:I}}:l),edited:!0}))},p=y=>{y.preventDefault(),N&&(o({axes:E.localAxes}),w==null||w()),f&&(f!=null&&f.setSelectedDepthType)&&(f==null||f.setSelectedDepthType(E.depthType)),d(E.edited)},v=()=>{S({localAxes:Nn({chartRef:C,state:n}),depthType:f==null?void 0:f.selectedDepthType,edited:!1}),r(),d(!1),w==null||w()},b=y=>y.target.select();return F.jsxs("form",{onSubmit:p,children:[E.localAxes.map(y=>{var l,u;const I=t.find(i=>i.id===y.id),c=(I==null?void 0:I.label)||Y.startCase(y.id),g=M.find(i=>i.id===y.id);return F.jsx(Kt,{label:c,children:F.jsxs(Jt,{small:!0,width:"300px",children:[F.jsx(En,{name:"min",value:y.min,error:(l=g==null?void 0:g.min)!=null&&l[0]?h[g.min[0]]:null,width:"100%",onChange:i=>T({name:i.target.name,value:i.target.value,id:y.id}),onFocus:b}),F.jsx(Qt,{children:"to"}),F.jsx(En,{name:"max",value:y.max,error:(u=g==null?void 0:g.max)!=null&&u[0]?h[g.max[0]]:null,width:"100%",onChange:i=>T({name:i.target.name,value:i.target.value,id:y.id}),onFocus:b}),y.unit?F.jsx(er,{name:"selectedUnit",options:typeof y.unit!="string"?y.unit.options:[],value:typeof y.unit!="string"?y.unit.selectedUnit:void 0,onChange:i=>A({name:i.target.name,value:i.target.value,id:y.id}),autoLayerWidth:!0,width:"15%"}):null]})},y.id)}),((L=f==null?void 0:f.options)==null?void 0:L.length)>0&&F.jsxs(F.Fragment,{children:[F.jsx(nr,{items:f.options.map((y,I)=>({key:I,label:y})),onSelected:y=>{S(I=>({...I,depthType:f.options[y],edited:!0}))},small:!0,value:f.options.indexOf(E.depthType)}),F.jsx(tr,{})]}),F.jsxs(rr,{gap:"8px",alignItems:"center",children:[F.jsx(fe,{type:"submit",small:!0,colored:!0,label:h.done,disabled:!N||!E.edited}),F.jsx(fe,{small:!0,name:"resetAxes",label:h.resetAxes,onClick:v}),F.jsx(Un,{small:!0,muted:!0,children:h.orDoubleClickToCanvas})]})]})},ot=e=>F.jsx($t,{placement:"bottom-start",overflowContainer:!0,content:F.jsx(ho,{...e}),children:F.jsx(je,{text:e.translations.axesOptions,placement:"bottom-start",display:"inline-flex",children:F.jsx(fe,{small:!0,basic:!0,colored:"muted",round:!0,icon:F.jsx(Zt,{})})})});ot.__docgenInfo={description:"",methods:[],displayName:"AxesOptions",props:{chartRef:{required:!0,tsType:{name:"RefObject",elements:[{name:"Chart"}],raw:"RefObject<Chart>"},description:""},state:{required:!0,tsType:{name:"IState"},description:""},controlsAxesLabels:{required:!0,tsType:{name:"Array",elements:[{name:"IAxisControlLabel"}],raw:"IAxisControlLabel[]"},description:""},onUpdateAxes:{required:!0,tsType:{name:"signature",type:"function",raw:"({ axes }: { axes: IAxisState }) => void",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ axes: IAxisState }",signature:{properties:[{key:"axes",value:{name:"IAxisState",required:!0}}]}},name:""}],return:{name:"void"}}},description:""},onResetAxes:{required:!0,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onUpdateEdited:{required:!0,tsType:{name:"signature",type:"function",raw:"(edited: boolean) => void",signature:{arguments:[{type:{name:"boolean"},name:"edited"}],return:{name:"void"}}},description:""},depthType:{required:!1,tsType:{name:"union",raw:"IDepthType | object",elements:[{name:"IDepthType"},{name:"object"}]},description:""},close:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},translations:{required:!0,tsType:{name:"Record",elements:[{name:"string"},{name:"string"}],raw:"Record<string, string>"},description:""}}};const st=({table:e,headerComponent:n,subheaderComponent:t,chartRef:o,state:r,options:d,dispatch:f,generatedDatasets:h,translations:w,controlsPortalId:C})=>{const{enableDragPoints:E,lineEnabled:S,panEnabled:M,pointsEnabled:N,showTable:T,zoomEnabled:A,enableDragAnnotation:p}=r,{dragData:v,depthType:b,annotations:L}=d,{onToggleLine:y,onTogglePan:I,onTogglePoints:c,onToggleTable:g,onToggleZoom:l,onToggleDragPoints:u,onToggleDragAnnotation:i,onDisableDragOptions:_}=oo(f),{handleDownload:x,controlsAxesLabels:U,onResetAxes:k,onUpdateAxes:R,onUpdateEdited:D}=hn({chartRef:o,state:r,options:d,dispatch:f,generatedDatasets:h}),[z,{width:q}]=or(),H=q<200,X=G.useMemo(()=>eo({lineEnabled:S,onToggleLine:y,onTogglePoints:c,pointsEnabled:N,translations:w}),[S,N]),Z=G.useMemo(()=>no({onTogglePan:I,onToggleZoom:l,panEnabled:M,zoomEnabled:A,enableDragPoints:E,enableDragAnnotation:p,isDragDataAllowed:v==null?void 0:v.enableDragData,isDragAnnotationAllowed:L==null?void 0:L.enableDragAnnotation,onToggleDragAnnotation:i,onToggleDragPoints:u,onDisableDragOptions:_,translations:w}),[A,M,E,v==null?void 0:v.enableDragData,L==null?void 0:L.enableDragAnnotation]);return F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:Sn.controls,children:[!!d.title&&F.jsx(Un,{bold:!0,children:d.title}),n,F.jsx(Tr,{controlsPortalId:C??"",children:F.jsxs("div",{className:Sn.buttons,ref:z,children:[!T&&F.jsxs(F.Fragment,{children:[F.jsx(ot,{chartRef:o,state:r,controlsAxesLabels:U,onUpdateAxes:R,onResetAxes:k,onUpdateEdited:D,depthType:b,translations:w}),H?F.jsx(fn,{menu:{placement:"bottom-end",sections:[...X,{type:"Divider"},...Z,{type:"Divider"},{icon:"download",label:w.downloadAsPNG,type:"Option",onClick:x}],trigger:"Component",component:F.jsx(fe,{colored:"muted",basic:!0,small:!0,round:!0,icon:"menu"})}}):F.jsxs(F.Fragment,{children:[F.jsx(nt,{options:X}),F.jsx(je,{display:"inline-flex",text:w.downloadAsPNG,placement:"bottom-end",children:F.jsx(fe,{small:!0,basic:!0,colored:"muted",round:!0,icon:"download",onClick:x})}),F.jsx(tt,{options:Z})]})]}),e?F.jsx(je,{display:"inline-flex",text:T?w.showChart:w.showTable,placement:"bottom-end",children:F.jsx(fe,{small:!0,basic:!0,colored:"muted",round:!0,icon:T?"chart":"table",onClick:g})}):null]})})]}),t]})};st.__docgenInfo={description:"",methods:[],displayName:"Controls",props:{headerComponent:{required:!1,tsType:{name:"ReactNode"},description:""},subheaderComponent:{required:!1,tsType:{name:"ReactNode"},description:""},table:{required:!1,tsType:{name:"ReactNode"},description:""},chartRef:{required:!0,tsType:{name:"RefObject",elements:[{name:"Chart"}],raw:"RefObject<Chart>"},description:""},state:{required:!0,tsType:{name:"IState"},description:""},options:{required:!0,tsType:{name:"ILineChartOptions"},description:""},dispatch:{required:!0,tsType:{name:"Dispatch",elements:[{name:"any"}],raw:"Dispatch<any>"},description:""},generatedDatasets:{required:!0,tsType:{name:"Array",elements:[{name:"IGeneratedLineChartDataset"}],raw:"IGeneratedLineChartDataset[]"},description:""},translations:{required:!0,tsType:{name:"Record",elements:[{name:"string"},{name:"string"}],raw:"Record<string, string>"},description:""},controlsPortalId:{required:!1,tsType:{name:"string"},description:""}}};const se={TOP_LEFT:"top-left",TOP_CENTER:"top-center",TOP_RIGHT:"top-right",MIDDLE_LEFT:"middle-left",MIDDLE_CENTER:"middle-center",MIDDLE_RIGHT:"middle-right",BOTTOM_LEFT:"bottom-left",BOTTOM_CENTER:"bottom-center",BOTTOM_RIGHT:"bottom-right"},Mn=e=>({label:"",position:e,color:"",unit:{options:[],selectedUnit:"",setSelectedUnit:()=>{}}}),po=e=>({x:(e==null?void 0:e.x)||[Mn("bottom")],y:(e==null?void 0:e.y)||[Mn("left")]}),mo=e=>({chartScaleType:(e==null?void 0:e.chartScaleType)||"linear",reverse:(e==null?void 0:e.reverse)||!1,beginAtZero:(e==null?void 0:e.beginAtZero)??!1,stepSize:e==null?void 0:e.stepSize,suggestedMin:e==null?void 0:e.suggestedMin,suggestedMax:e==null?void 0:e.suggestedMax,range:e==null?void 0:e.range,autoAxisPadding:(e==null?void 0:e.autoAxisPadding)??!1}),bo=e=>({width:e==null?void 0:e.width,height:e==null?void 0:e.height,maintainAspectRatio:(e==null?void 0:e.maintainAspectRatio)??!1,staticChartHeight:(e==null?void 0:e.staticChartHeight)??!1,performanceMode:(e==null?void 0:e.performanceMode)??!0,squareAspectRatio:(e==null?void 0:e.squareAspectRatio)??!1,layoutPadding:(e==null?void 0:e.layoutPadding)||{top:0,bottom:20,left:0,right:0}}),yo=e=>({tooltips:(e==null?void 0:e.tooltips)??!0,showLabelsInTooltips:(e==null?void 0:e.showLabelsInTooltips)??!1,hideSimulationName:(e==null?void 0:e.hideSimulationName)??!1,scientificNotation:(e==null?void 0:e.scientificNotation)??!0}),wo=e=>({lineTension:(e==null?void 0:e.lineTension)??.01,spanGaps:(e==null?void 0:e.spanGaps)??!1,showDataLabels:(e==null?void 0:e.showDataLabels)??!1,showMinorGridlines:(e==null?void 0:e.showMinorGridlines)??!1}),_o=e=>e?e.map(n=>({...n,display:(n==null?void 0:n.display)??!0})):[],Eo=e=>{var n,t,o,r,d,f,h,w;return{labelAnnotation:{showLabel:((n=e==null?void 0:e.labelAnnotation)==null?void 0:n.showLabel)??!1,text:((t=e==null?void 0:e.labelAnnotation)==null?void 0:t.text)??"",position:((o=e==null?void 0:e.labelAnnotation)==null?void 0:o.position)??se.BOTTOM_RIGHT,fontSize:((r=e==null?void 0:e.labelAnnotation)==null?void 0:r.fontSize)??12,xOffset:((d=e==null?void 0:e.labelAnnotation)==null?void 0:d.xOffset)??5,yOffset:((f=e==null?void 0:e.labelAnnotation)==null?void 0:f.yOffset)??5,maxWidth:((h=e==null?void 0:e.labelAnnotation)==null?void 0:h.maxWidth)??300,lineHeight:((w=e==null?void 0:e.labelAnnotation)==null?void 0:w.lineHeight)??12},showAnnotations:(e==null?void 0:e.showAnnotations)??!1,controlAnnotation:(e==null?void 0:e.controlAnnotation)??!1,enableDragAnnotation:(e==null?void 0:e.enableDragAnnotation)??!1,annotationsData:_o(e==null?void 0:e.annotationsData)}},xo=e=>({display:(e==null?void 0:e.display)??!0,position:(e==null?void 0:e.position)??Ce.BottomLeft,align:(e==null?void 0:e.align)??ie.Center,customLegend:(e==null?void 0:e.customLegend)??{customLegendPlugin:null,customLegendContainerID:""},usePointStyle:(e==null?void 0:e.usePointStyle)??!0}),To=e=>({showPoints:(e==null?void 0:e.showPoints)??!0,showLine:(e==null?void 0:e.showLine)??!0,enableZoom:(e==null?void 0:e.enableZoom)??!0,enablePan:(e==null?void 0:e.enablePan)??!1,enableDragAnnotation:(e==null?void 0:e.enableDragAnnotation)??!1,closeOnOutsideClick:(e==null?void 0:e.closeOnOutsideClick)??!1}),Lo=e=>({onLegendClick:e==null?void 0:e.onLegendClick,onHover:e==null?void 0:e.onHover,onUnhover:e==null?void 0:e.onUnhover,onAnimationComplete:e==null?void 0:e.onAnimationComplete}),vo=e=>({enableDragData:(e==null?void 0:e.enableDragData)??!1,showTooltip:(e==null?void 0:e.showTooltip)??!0,roundPoints:(e==null?void 0:e.roundPoints)??!0,dragX:(e==null?void 0:e.dragX)??!0,dragY:(e==null?void 0:e.dragY)??!0,onDragStart:e==null?void 0:e.onDragStart,onDrag:e==null?void 0:e.onDrag,onDragEnd:e==null?void 0:e.onDragEnd}),it=e=>{const n=(e==null?void 0:e.chart)||{},t=(n==null?void 0:n.options)||{};return{persistenceId:(n==null?void 0:n.persistenceId)??"",controlsPortalId:(n==null?void 0:n.controlsPortalId)??"",testId:(n==null?void 0:n.testId)??void 0,data:(n==null?void 0:n.data)??{datasets:[]},options:{title:(t==null?void 0:t.title)??"",scales:(t==null?void 0:t.scales)??{},axes:po(t==null?void 0:t.axes),additionalAxesOptions:mo(t==null?void 0:t.additionalAxesOptions),chartStyling:bo(t==null?void 0:t.chartStyling),tooltip:yo(t==null?void 0:t.tooltip),graph:wo(t==null?void 0:t.graph),annotations:Eo(t==null?void 0:t.annotations),legend:xo(t==null?void 0:t.legend),chartOptions:To(t==null?void 0:t.chartOptions),interactions:Lo(t==null?void 0:t.interactions),dragData:vo(t==null?void 0:t.dragData),depthType:(t==null?void 0:t.depthType)??{}}}},Ao=(e,n)=>{if(Y.isEmpty(e)||Y.isEmpty(n))return!1;const t=o=>typeof n=="string"?o&&Y.has(o,n):Y.isArray(n)?o&&Y.some(n,r=>o&&Y.has(o,r)):o&&Y.some(Object.values(n),r=>o&&Y.has(o,r));return Y.isArray(e)?Y.some(e,t):t(e)};var lt=(e=>(e.showLine="showLine",e.showPoints="showPoints",e))(lt||{});const Co=(e,n,t,{label:o})=>{const r=[...e??[]],{annotations:d,graph:f}=t??{},{controlAnnotation:h,showAnnotations:w,annotationsData:C=[]}=d??{};if(h&&w){const E=C.map((S,M)=>{const{type:N,...T}=S,A=T.color??_e[M],p=ht,v=an.INITIAL;return{...T,isAnnotation:!0,annotationType:N,label:T.label,annotationIndex:M,backgroundColor:A,pointBackgroundColor:A,borderColor:A,borderDash:p,borderWidth:v,data:[{}]}});r.push(...E)}return r==null?void 0:r.map((E,S)=>{var Z,Le;const{formation:M,data:N=[],pointRadius:T,pointHoverRadius:A,borderWidth:p,borderColor:v,backgroundColor:b,pointBackgroundColor:L,borderDash:y,showPoints:I,showLine:c}=E??{},{lineEnabled:g,pointsEnabled:l,axes:u=[]}=n??{},{lineTension:i,spanGaps:_}=f??{},x=Array.isArray(N)?N:[];if(M&&(x!=null&&x.length)){const de=Number((Z=u[0])==null?void 0:Z.min),ve=Number((Le=u[0])==null?void 0:Le.max),[ue,ae]=x;de&&(ue!=null&&ue.x)&&(x[0].x=Math.max(de,ue.x)),ve&&(ae!=null&&ae.x)&&(x[2].x=Math.min(ve,ae.x))}const U=Ao(E,lt),k=(x==null?void 0:x.filter(Boolean))||[],R=(k==null?void 0:k.length)===1;let D,z;I!==void 0?D=I:c===!1?D=!0:D=l||R,c!==void 0?z=c:I===!1?z=!0:z=g;const q=parseFloat(T)||ir,H=parseFloat(A)||sr,X=_e[S];return{...E,label:(E==null?void 0:E.label)??`${o} ${S+1}`,data:k,showLine:z,lineTension:(E==null?void 0:E.lineTension)??i,spanGaps:_,borderWidth:parseFloat(p)||ar,borderDash:y||[],borderJoinStyle:ur,borderColor:v??X??Ke(_e),backgroundColor:b??lr,pointBackgroundColor:L??X??Ke(_e),pointRadius:D?q:0,pointHoverRadius:H,pointHitRadius:(E==null?void 0:E.pointHitRadius)??H,...U?{hasCustomOpt:U}:{}}})},un=(e,n,t,o,r=0)=>{var E,S,M,N,T,A,p;const d=o||e.axes[n][0]||{},f=t==null?void 0:t.axes.filter(v=>{var b;return(b=v==null?void 0:v.id)==null?void 0:b.startsWith(n)})[r],h=(S=(E=e==null?void 0:e.scales)==null?void 0:E[`${r===0?n:n+r}`])==null?void 0:S.ticks,{additionalAxesOptions:w}=e,C=()=>{const v=(w==null?void 0:w.chartScaleType)===mt.Logarithmic,b=(I,c,g)=>v?yt.includes(I)?xn(I,g):"":xn(I,g);return{...v?{}:{stepSize:d.stepSize??(n===ce.Y?w.stepSize:null)},callback:b,includeBounds:!1,...h,font:{size:bt}}};return{display:!0,type:w.chartScaleType,position:d.position,beginAtZero:w.beginAtZero,reverse:n===ce.Y?w.reverse:!1,suggestedMax:w.suggestedMax,suggestedMin:w.suggestedMin,min:(f==null?void 0:f.min)??((N=(M=w==null?void 0:w.range)==null?void 0:M[n])==null?void 0:N.min),max:(f==null?void 0:f.max)??((A=(T=w==null?void 0:w.range)==null?void 0:T[n])==null?void 0:A.max),title:{display:(p=d.label)==null?void 0:p.length,text:d.label,padding:0},ticks:C(),grid:{...d.gridLines}}},Dn=(e,n,t)=>e.axes[n].reduce((d,f,h)=>{const w=f;w.color=f.color||_e[h]||Ke(_e),w.position=f.position||pt(n,h);const C=un(e,n,t,w,h),E=rt(n,h,!0);return{...d,[E]:C}},{}),So=(e,n)=>{var f,h;const t=((f=e.axes.x)==null?void 0:f.length)>1,o=((h=e.axes.y)==null?void 0:h.length)>1,r=t?Dn(e,ce.X,n):{x:un(e,ce.X,n)},d=o?Dn(e,ce.Y,n):{y:un(e,ce.Y,n)};return{...r,...d}},Io=e=>{var t;if(!Array.isArray(e)||!(e!=null&&e.length))return!1;const n=e==null?void 0:e.reduce((o,r)=>{var w,C,E,S;const d=(r==null?void 0:r.xAxisID)??"x",f=(r==null?void 0:r.yAxisID)??"y",h=(r==null?void 0:r.data)??[];if(h&&(h!=null&&h.length)){const{x:M,y:N}=(h==null?void 0:h[0])??{},{x:T=0,y:A=0}=(h==null?void 0:h.at(-1))??{},p=((w=o==null?void 0:o[d])==null?void 0:w.xFirst)??M,v=((C=o==null?void 0:o[d])==null?void 0:C.xLast)??T,b=((E=o==null?void 0:o[f])==null?void 0:E.yFirst)??N,L=((S=o==null?void 0:o[f])==null?void 0:S.yLast)??A,y=Math.min(M,p),I=Math.max(T,v),c=Math.min(N,b),g=Math.max(A,L);o={...o,[d]:{...o[d],xFirst:y,xLast:I},[f]:{yFirst:c,yLast:g}}}return o},{});return(t=Object.values(n))==null?void 0:t.some(({xFirst:o,xLast:r,yFirst:d,yLast:f})=>Se(o,r,{absoluteDiff:Ie})||Se(d,f,{absoluteDiff:Ie}))},Bn=.05,Po={min:-1,max:1},Oo=({data:e,beginAtZero:n=!1,autoAxisPadding:t=!1})=>{const o=Math.min(...e.filter(N=>N!=null&&!isNaN(N))),r=Math.max(...e.filter(N=>N!=null&&!isNaN(N))),d=Math.sign(o)===-1||Math.sign(r)===-1,f=Se(o,0,{absoluteDiff:Ie})&&Se(r,0,{absoluteDiff:Ie});if(!(e!=null&&e.length)||f)return Po;if(Se(o,r,{absoluteDiff:Ie})){const N=r,T=N*Bn,A=n&&!d?0:N-T,p=n&&d?0:N+T,v=Ee(p,Ne),b=Ee(A,Ne);return{min:v<0?v:b,max:b<0?b:v}}if(!t)return{min:void 0,max:void 0};const h=o===0||r===0||n,w=Math.sign(o)===-1&&Math.sign(r)===1,C=Math.abs(r-o),E=t?C*Bn:0,S=!w&&h&&n&&!d?0:o-E,M=!w&&h&&n&&d?0:r+E;return{min:Ee(S,Ne),max:Ee(M,Ne)}},No=e=>e==null?void 0:e.reduce((n,t)=>({...n,[t.annotationAxis]:[...n[t.annotationAxis]||[],+t.value]}),{}),Mo=(e,n,t)=>{if(!Array.isArray(e)||!Array.isArray(n))return{};const o=No(t);return n.reduce((r,d)=>{const f=co(d),h=e.filter(C=>(C[`${f}AxisID`]??f)===d).flatMap(C=>((C==null?void 0:C.data)??[]).map(S=>S[f])),w=(o==null?void 0:o[d])??[];return r[d]=[...new Set([...h,...w])],r},{})},jn=(e,n)=>!Y.isNil(e)||!Y.isNil(n),Do=(e,n,t)=>{const{additionalAxesOptions:o,annotations:{annotationsData:r=[],controlAnnotation:d=!1}={}}=e||{},f=So(e,n)||{},h=d?t.filter(({isAnnotation:S})=>!S):t;if(!(o!=null&&o.autoAxisPadding)&&!Io(h))return f;const w=Object.keys(f)??[],C=Mo(t,w,r);return(C&&(w==null?void 0:w.reduce((S,M)=>{const N=f[M],{min:T=void 0,max:A=void 0}=N,{min:p,max:v}=Oo({data:C[M],beginAtZero:o==null?void 0:o.beginAtZero,autoAxisPadding:o==null?void 0:o.autoAxisPadding}),b={[M]:{...N,min:T??(jn(T,A)?void 0:p),max:A??(jn(T,A)?void 0:v)}};return{...S,...b}},{})))??f},Bo=(e,n,t,o,r)=>{const f=e??0,h=n??0,w=t??0,C=o??0,E=r??0,S=f-100<=w,M=f+100>=C,N=f+100>=w&&f+100<C&&h+100>=E;return{overLeftSide:S,overRightSide:M,overBottomSide:N}},jo=e=>{var M,N;const n=e==null?void 0:e.chart,t=(e==null?void 0:e.dataIndex)??0,o=(e==null?void 0:e.datasetIndex)??0,r=(n==null?void 0:n.chartArea)??{},{left:d=null,right:f=null,bottom:h=null}=r,w=(M=n==null?void 0:n.getDatasetMeta)==null?void 0:M.call(n,o),C=(N=w==null?void 0:w.data)==null?void 0:N[t],E=(C==null?void 0:C.x)??null,S=(C==null?void 0:C.y)??null;return{x:E,y:S,left:d,right:f,bottom:h}},Fo=()=>e=>{const{x:n,y:t,left:o,right:r,bottom:d}=jo(e),{overLeftSide:f=!1,overRightSide:h=!1,overBottomSide:w=!1}=Bo(n,t,o,r,d);return f&&ie.Right||h&&ie.Left||w&&ie.End||ie.Start},ko=e=>{var n;return(n=e==null?void 0:e.graph)!=null&&n.showDataLabels?{display:Je,align:Fo(),formatter:(t,o)=>{var d,f;const r=(f=(d=o==null?void 0:o.dataset)==null?void 0:d.data)==null?void 0:f[o.dataIndex];return!r||r.label==null?"":typeof r.label=="string"?r.label:Array.isArray(r.label)?r.label.map(String):String(r.label)}}:{display:!1}},Uo=e=>{const n=e==null?void 0:e.match(/\[(.*)\]/g);return n&&(n==null?void 0:n.length)>0?n==null?void 0:n[0]:""},Fn=(e,n)=>{let t={};return n?(Math.abs(e)<cr||Math.abs(e)>fr)&&(t={roundScientificCoefficient:3}):t={scientific:!1},Tt(Lt(e),t)},Ro=e=>{var d,f,h,w,C;if(!((f=(d=e==null?void 0:e.axes)==null?void 0:d.x)!=null&&f.length)||!((w=(h=e==null?void 0:e.axes)==null?void 0:h.y)!=null&&w.length))return console.warn("Tooltip config fallback: missing axes",e),{enabled:!1,callbacks:{}};const{scientificNotation:n}=(e==null?void 0:e.tooltip)??{},t=({xAxisID:E="",yAxisID:S=""})=>{var p,v,b,L,y,I,c;const M=(E==null?void 0:E.length)>1?Number(E==null?void 0:E[1])-1:0,N=(S==null?void 0:S.length)>1?Number(S==null?void 0:S[1])-1:0,T=(v=(p=e==null?void 0:e.axes)==null?void 0:p.x)==null?void 0:v[M],A=(L=(b=e==null?void 0:e.axes)==null?void 0:b.y)==null?void 0:L[N];return((c=(I=(y=e==null?void 0:e.axes)==null?void 0:y.x)==null?void 0:I[0])==null?void 0:c.position)===Ce.Top?{titleAxisLabel:(A==null?void 0:A.label)||"",valueAxisLabel:(T==null?void 0:T.label)||"",titleLabel:be.Y,valueLabel:be.X}:{titleAxisLabel:(T==null?void 0:T.label)||"",valueAxisLabel:(A==null?void 0:A.label)||"",titleLabel:be.X,valueLabel:be.Y}},o=E=>{var p,v,b,L;if(!(E!=null&&E[0]))return"";const S=t(E[0].dataset),{titleLabel:M="",titleAxisLabel:N=""}=S??{},T=M===be.Y?(v=(p=E==null?void 0:E[0])==null?void 0:p.parsed)==null?void 0:v.y:(L=(b=E==null?void 0:E[0])==null?void 0:b.parsed)==null?void 0:L.x;return`${Fn(T,n)} ${N}`},r=E=>{var y;const{showLabelsInTooltips:S}=(e==null?void 0:e.tooltip)??{};let M=((y=E==null?void 0:E.dataset)==null?void 0:y.label)||"";const N=t(E==null?void 0:E.dataset),{valueLabel:T="",valueAxisLabel:A=""}=N??{},v=(()=>{var c,g;const I=T===be.X?(c=E==null?void 0:E.parsed)==null?void 0:c.x:(g=E==null?void 0:E.parsed)==null?void 0:g.y;return Fn(I,n)})(),b=Uo(A),L=xt(E,S);return`${M}: ${v} ${b} ${L}`};return{enabled:(C=e==null?void 0:e.tooltip)==null?void 0:C.tooltips,mode:Be.Nearest,intersect:!0,padding:Et,usePointStyle:!0,boxWidth:yn,boxHeight:yn,boxPadding:_t,callbacks:{title:o,label:r,afterLabel:wt}}},Go=({chartRef:e,state:n,options:t,dispatch:o,generatedDatasets:r})=>{const{interactions:{onAnimationComplete:d},annotations:{labelAnnotation:{showLabel:f,text:h,position:w,fontSize:C,xOffset:E,yOffset:S,maxWidth:M,lineHeight:N}={}},chartStyling:{layoutPadding:T}}=t,{enableDragPoints:A,zoomEnabled:p,panEnabled:v,lineEnabled:b}=n,[L,y]=G.useState(null),{updateAxesRangesFromChart:I,onHover:c,onUpdateEdited:g}=hn({chartRef:e,state:n,options:t,dispatch:o,generatedDatasets:r}),{legend:l,customLegendPlugin:u}=dr({chartRef:e,options:t})??{},{state:i}=gr()??{},{annotation:_}=i??{},x=ko(t)??{},U=Ro(t)??{},k=G.useMemo(()=>Do(t,n,r),[t,n,r,e]),R=G.useMemo(()=>A&&Lr(t),[A,t]),D=G.useMemo(()=>({enabled:v,mode:we.XY,onPanComplete(){I(),g(!0)}}),[v]),z=G.useMemo(()=>({mode:we.XY,drag:{enabled:p,threshold:3,backgroundColor:hr,borderColor:wn,borderWidth:1},onZoomComplete(){I(),g(!0)}}),[p]),q={datalabels:x,annotationDraggerPlugin:{enabled:n==null?void 0:n.enableDragAnnotation},annotation:pr(_),zoom:{pan:D,zoom:z},tooltip:U,legend:{...l,display:!1,events:[]},customLegendPlugin:u,chartAreaBorder:{borderColor:wn},chartAreaText:{showLabel:f,text:h,position:w,fontSize:C,xOffset:E,yOffset:S,maxWidth:M,lineHeight:N},...R};return G.useMemo(()=>{var H,X,Z;return{layout:{padding:T},onHover:c(L,y,r),maintainAspectRatio:(H=t==null?void 0:t.chartStyling)==null?void 0:H.maintainAspectRatio,aspectRatio:(X=t==null?void 0:t.chartStyling)!=null&&X.squareAspectRatio?1:0,animation:(Z=t==null?void 0:t.chartStyling)!=null&&Z.performanceMode?!1:{duration:At.FAST,onComplete:d},hover:{mode:Be.Nearest,intersect:!0},elements:{line:{pointStyle:vt.Circle,showLine:b,tension:0}},scales:k,plugins:q,events:Object.values(Ct)}},[n,t,e,r])},Yo=({options:e,resetZoom:n})=>{const{graph:t,legend:o}=e,r=G.useCallback((d,f)=>{const{event:h}=f;return h.type===mr?(n(),!1):!0},[n]);return G.useMemo(()=>[...St(t,o),{id:"customEventCatcher",beforeEvent:r}],[r])},zo=(e,n)=>{var t,o;G.useEffect(()=>{var r,d;if((d=(r=n==null?void 0:n.legend)==null?void 0:r.customLegend)!=null&&d.customLegendPlugin){const f=document.getElementById(n.legend.customLegend.customLegendContainerID);f!==null&&(f.style.visibility=e.legendEnabled?"visible":"hidden")}},[(o=(t=n==null?void 0:n.legend)==null?void 0:t.customLegend)==null?void 0:o.customLegendPlugin,e.legendEnabled])},Vo=(e,n)=>{G.useEffect(()=>{$r(e,n)},[e.panEnabled,e.lineEnabled,e.pointsEnabled,e.legendEnabled,e.enableDragPoints,e.zoomEnabled])},Xo=({options:e,state:n,persistenceId:t})=>{const o=G.useMemo(()=>n,[n]),r=G.useMemo(()=>e,[e]);Vo(o,t),zo(o,r)},Re=" ",Ho="rgba(0, 0, 0, 0.5)",qo=e=>{var n;return(n=Array.isArray(e)?e.join(Re):e)==null?void 0:n.split(Re)},Wo=({ctx:e,lines:n,lineHeight:t,x:o,y:r,position:d})=>{n==null||n.forEach((f,h)=>{const w=d!=null&&d.includes("top")?r+t*(h+1)-5:r-(n.length-1-h)*t;e==null||e.fillText(f,o,w)})},$o=(e,n)=>{const r=n<500?.5:n<700?.7:1;return e*r},Zo=e=>{var r,d,f,h,w,C,E;const{legend:n}=e??{},t=n&&(n!=null&&n.display)&&((r=n==null?void 0:n.options)==null?void 0:r.position)==="left"?(n==null?void 0:n.width)+((f=(d=n==null?void 0:n.options)==null?void 0:d.labels)==null?void 0:f.padding)*2:0,o=n&&n.display&&(((h=n==null?void 0:n.options)==null?void 0:h.position)==="top"||((w=n==null?void 0:n.options)==null?void 0:w.position)==="bottom")?(n==null?void 0:n.height)+((E=(C=n==null?void 0:n.options)==null?void 0:C.labels)==null?void 0:E.padding)*2:0;return{legendWidth:t,legendHeight:o}},Ko=(e,n,t,o)=>{const{chartArea:r,width:d}=n??{},f=d-8,{legendWidth:h,legendHeight:w}=Zo(n)??{};switch(e){case se.TOP_LEFT:return[(r==null?void 0:r.left)+t+h,(r==null?void 0:r.top)+o+w];case se.TOP_CENTER:return[(r==null?void 0:r.left)+(r==null?void 0:r.width)/2,(r==null?void 0:r.top)+o+w];case se.TOP_RIGHT:return[f-t,(r==null?void 0:r.top)+o+w];case se.MIDDLE_LEFT:return[(r==null?void 0:r.left)+t+h,(r==null?void 0:r.top)+(r==null?void 0:r.height)/2];case se.MIDDLE_CENTER:return[(r==null?void 0:r.left)+(r==null?void 0:r.width)/2,(r==null?void 0:r.top)+(r==null?void 0:r.height)/2];case se.MIDDLE_RIGHT:return[f-t-h,(r==null?void 0:r.top)+(r==null?void 0:r.height)/2];case se.BOTTOM_LEFT:return[(r==null?void 0:r.left)+t+h,(r==null?void 0:r.bottom)-o-w];case se.BOTTOM_CENTER:return[(r==null?void 0:r.left)+(r==null?void 0:r.width)/2,(r==null?void 0:r.bottom)-o-w];case se.BOTTOM_RIGHT:default:return[f-t-h,(r==null?void 0:r.bottom)-o-w]}},Jo=e=>e!=null&&e.includes(ie.Center)?ie.Center:e!=null&&e.includes(ie.Left)?ie.Left:ie.Right,Qo=(e,n,t)=>{let o="",r=[];for(let d=0;d<e.length;d++){const f=`${o}${e==null?void 0:e[d]}${Re}`,{width:h}=(t==null?void 0:t.measureText(f))??{};h>n?(r.push(o==null?void 0:o.trim()),o=`${e==null?void 0:e[d]}${Re}`):o=f}return r.push(o.trim()),r},es=(e,n)=>{var S,M;if(!e)return;const{text:t,maxWidth:o,fontSize:r,lineHeight:d,x:f,y:h,position:w}=n??{},C=qo(t),E=Qo(C,o,e);(S=e==null?void 0:e.save)==null||S.call(e),e.font=`${r}px Arial`,e.fillStyle=Ho,e.textAlign=Jo(w),Wo({ctx:e,lines:E,lineHeight:d,x:f,y:h,position:w}),(M=e==null?void 0:e.restore)==null||M.call(e)},ns={id:"chartAreaText",beforeDraw:(e,n,t)=>{const{showLabel:o,text:r,fontSize:d,xOffset:f,yOffset:h,lineHeight:w,maxWidth:C,position:E}=t??{};if(!o||!r)return;const{ctx:S,chartArea:M}=e??{};if(!S||!M)return;const N=$o(C,M.width),[T,A]=Ko(E,e,f,h);es(S,{text:r,maxWidth:N,fontSize:d,lineHeight:w,x:T,y:A,position:E})}},ut=(e,n,t,o,r)=>{const d=n.getBoundingClientRect(),f=e.clientX-d.left,h=e.clientY-d.top,w=t==null?void 0:t[o],C=t==null?void 0:t[r],E=(w==null?void 0:w.getValueForPixel(f))??-1,S=(C==null?void 0:C.getValueForPixel(h))??-1;return{x:E,y:S}},Ge=e=>{const{xMin:n,xMax:t,yMin:o,yMax:r,xValue:d,yValue:f,type:h}=e??{};let w,C,E,S;return!Y.isNil(n)&&!Y.isNil(t)&&!Y.isNil(o)&&!Y.isNil(r)&&h===le.BOX?(w=(n+t)/2,C=(o+r)/2,E=t-n,S=r-o):!Y.isNil(d)&&!Y.isNil(f)&&h===le.POINT&&(w=d,C=f,E=0,S=0),{centerX:w,centerY:C,width:E,height:S}},at=(e,n,t,o)=>{const{xMin:r,xMax:d,yMin:f,yMax:h,xValue:w,yValue:C,type:E}=e??{};let S,M,N,T;const A=n==null?void 0:n[t],p=n==null?void 0:n[o];if(!A||!p)return{centerX:-1,centerY:-1,width:0,height:0};if(!Y.isNil(r)&&!Y.isNil(d)&&!Y.isNil(f)&&!Y.isNil(h)&&E===le.BOX){const v=(r+d)/2,b=(f+h)/2,L=(A==null?void 0:A.getPixelForValue(r))??0,y=(A==null?void 0:A.getPixelForValue(d))??0,I=(p==null?void 0:p.getPixelForValue(f))??0,c=(p==null?void 0:p.getPixelForValue(h))??0;N=L-y,T=I-c,S=(A==null?void 0:A.getPixelForValue(v))??-1,M=(p==null?void 0:p.getPixelForValue(b))??-1}else!Y.isNil(w)&&!Y.isNil(C)&&E===le.POINT&&(N=0,T=0,S=(A==null?void 0:A.getPixelForValue(w))??-1,M=(p==null?void 0:p.getPixelForValue(C))??-1);return{centerX:S,centerY:M,width:N,height:T}},ts=({x:e,y:n,chartArea:t,scales:o,metrics:r,resizable:d=!1,dragRange:f,annotationType:h,xScaleID:w,yScaleID:C})=>{if(d&&!f)return!0;if(f){const p=e!==void 0&&f.x?e>=f.x[0]&&e<=f.x[1]:!0,v=n!==void 0&&f.y?n>=f.y[0]&&n<=f.y[1]:!0;return p&&v}const E=o==null?void 0:o[w],S=o==null?void 0:o[C];if(!(o!=null&&o[w])||!(o!=null&&o[C]))return!1;const M=(E==null?void 0:E.getValueForPixel(t.left))??Number.NEGATIVE_INFINITY,N=(E==null?void 0:E.getValueForPixel(t.right))??Number.POSITIVE_INFINITY,T=(S==null?void 0:S.getValueForPixel(t.bottom))??Number.NEGATIVE_INFINITY,A=(S==null?void 0:S.getValueForPixel(t.top))??Number.POSITIVE_INFINITY;if(h===le.POINT){const p=e!==void 0?e>=M&&e<=N:!0,v=n!==void 0?n>=T&&n<=A:!0;return p&&v}if(h===le.BOX&&r.width!==void 0&&r.height!==void 0){const p=e!==void 0?e-r.width/2:void 0,v=e!==void 0?e+r.width/2:void 0,b=n!==void 0?n-r.height/2:void 0,L=n!==void 0?n+r.height/2:void 0,y=p!==void 0&&v!==void 0?p>=M&&v<=N:!0,I=b!==void 0&&L!==void 0?b>=T&&L<=A:!0;return y&&I}return!0},kn=(e,n,t,o,r,d,f,h)=>{if(!(o!=null&&o.chartArea))return;const{resizable:w,dragRange:C=null}=t??{};ts({[e]:n,chartArea:o.chartArea,scales:r,resizable:w,dragRange:C,metrics:h||{},annotationType:t.type,xScaleID:d,yScaleID:f})&&(t.type===le.POINT?e==="x"?t.xValue=n:e==="y"&&(t.yValue=n):t.type===le.BOX&&h&&(e==="x"&&h.width&&(t.xMin=n-h.width/2,t.xMax=n+h.width/2),e==="y"&&h.height&&(t.yMin=n-h.height/2,t.yMax=n+h.height/2)))},ct=(e,n,t)=>{var r,d,f;if(!n)return;const o=(f=(d=(r=e==null?void 0:e.options)==null?void 0:r.plugins)==null?void 0:d.annotation)==null?void 0:f.annotations;o&&n&&o[n]&&(o[n].borderWidth=t)},rs=(e,n,t,o,r,d)=>{const f=d?o==null?void 0:o[d]:null;if(!f)return;const{xScaleID:h="x",yScaleID:w="y"}=f,{x:C,y:E}=ut(e,n,t,h,w),S=Ge(f);if(f&&f.enableDrag&&!Y.isNil(S.centerY)&&!Y.isNil(S.centerX)){!Y.isNil(n)&&!Y.isNil(n.style)&&(n.style.cursor=cn.Move);const M=C-S.centerX,N=E-S.centerY;r(!0,f,M,N),f!=null&&f.onDragStart&&f.onDragStart({x:C,y:E},f)}},os=(e,n,t,o,r,d,f,h)=>{var w,C,E,S,M,N;if(o&&r){!Y.isNil(n)&&!Y.isNil(n.style)&&(n.style.cursor=cn.Move);const T=r==null?void 0:r.id;ct(h,T,an.HOVERED);const A=(r==null?void 0:r.dragAxis)??Ae.Both,{xScaleID:p="x",yScaleID:v="y"}=r,{x:b,y:L}=ut(e,n,t,p,v),y=Ge(r);let I=b-d,c=L-f;A!==Ae.Y&&kn(Ae.X,I,r,h,t,p,v,y),A!==Ae.X&&kn(Ae.Y,c,r,h,t,p,v,y),(w=h==null?void 0:h.update)==null||w.call(h),r!=null&&r.onDrag&&r.onDrag({x:b,y:L},r);const{ctx:g,width:l,height:u}=h,{centerX:i,centerY:_}=Ge(r)??{},{centerX:x,centerY:U}=at(r,t,p,v);if(!Y.isNil(i)&&!Y.isNil(_)&&!Y.isNil(x)&&!Y.isNil(U)&&((C=g==null?void 0:g.save)==null||C.call(g),(E=g==null?void 0:g.clearRect)==null||E.call(g,0,0,l,u),(S=h==null?void 0:h.draw)==null||S.call(h),g.font=It,g.fillStyle="black",r!=null&&r.displayDragCoordinates)){let k=x-45,R=U-20;const D=`X: ${Ee(i,2)}, Y: ${Ee(_,2)}`,z=14;R-z<0&&(R=U+z+15),R>u&&(R=u-7),(M=g==null?void 0:g.fillText)==null||M.call(g,D,k,R),(N=g==null?void 0:g.restore)==null||N.call(g)}}},ss=(e,n,t,o,r)=>{if(e&&n){const d=n==null?void 0:n.id;ct(t,d,an.ZERO);const{centerX:f=-1,centerY:h=-1}=Ge(n)??{};Y.isNil(n==null?void 0:n.onDragEnd)||n==null||n.onDragEnd({x:f,y:h},n),!Y.isNil(o)&&!Y.isNil(o.style)&&(o.style.cursor=cn.Pointer),r(!1,null)}},is=(e,n,t)=>{!e||!n||Object.values(n).forEach(o=>{var r,d,f,h;if(o.type===le.POINT&&!Y.isNil(o==null?void 0:o.label)&&((r=o==null?void 0:o.label)!=null&&r.display)){const{content:w,font:C,color:E,position:S,padding:M}=(o==null?void 0:o.label)??{},{xScaleID:N="x",yScaleID:T="y"}=o;(d=e==null?void 0:e.save)==null||d.call(e),e.font=C,e.fillStyle=E;const{centerX:A=-1,centerY:p=-1}=at(o,t,N,T),v=e.measureText(w).width;let b=A-v/2,L=p+20;switch(S){case Ce.Top:L=p-20;break;case Ce.Left:b=A-v-M,L=p;break;case Ce.Right:b=A+M,L=p;break}(f=e==null?void 0:e.fillText)==null||f.call(e,w,b,L),(h=e==null?void 0:e.restore)==null||h.call(e)}})},ls={id:"annotationDraggerPlugin",beforeDraw(e){var r,d,f,h,w,C,E,S;const n=e==null?void 0:e.ctx;let t=((d=(r=e.options.plugins)==null?void 0:r.annotation)==null?void 0:d.annotations)??{};if(!t||!n||!t)return;is(e.ctx,t,e.scales),(((h=(f=e==null?void 0:e.options)==null?void 0:f.plugins)==null?void 0:h.annotationDraggerPlugin)||{enabled:!1}).enabled?((C=(w=e==null?void 0:e.options)==null?void 0:w.plugins)!=null&&C.tooltip&&(e.options.plugins.tooltip.enabled=!1),e.options.hover={mode:void 0,intersect:!1}):((S=(E=e==null?void 0:e.options)==null?void 0:E.plugins)!=null&&S.tooltip&&(e.options.plugins.tooltip.enabled=!0),e.options.hover={mode:Be.Nearest,intersect:!0})},afterUpdate(e){var M,N,T,A,p,v,b,L;const{canvas:n,scales:t,hoveredAnnotationId:o}=e??{},r=((N=(M=e==null?void 0:e.options)==null?void 0:M.plugins)==null?void 0:N.annotationDraggerPlugin)||{enabled:!1};if(!n||!t||!r)return;const d={...t,x:t.x,y:t.y};let f=((A=(T=e.options.plugins)==null?void 0:T.annotation)==null?void 0:A.annotations)??{};if(!e&&!f)return;r.enabled?((v=(p=e==null?void 0:e.options)==null?void 0:p.plugins)!=null&&v.tooltip&&(e.options.plugins.tooltip.enabled=!1),e.options.hover={mode:void 0,intersect:!1}):((L=(b=e==null?void 0:e.options)==null?void 0:b.plugins)!=null&&L.tooltip&&(e.options.plugins.tooltip.enabled=!0),e.options.hover={mode:Be.Nearest,intersect:!0});let h=!1,w,C,E=null;const S=(y,I,c,g)=>{h=y,E=I,c!==void 0&&g!==void 0&&(w=c,C=g)};!n.dataset.annotationDraggerInitialized&&r.enabled&&o&&(n.addEventListener(ye.MOUSEDOWN,y=>{var I,c,g;rs(y,n,d,(g=(c=(I=e==null?void 0:e.options)==null?void 0:I.plugins)==null?void 0:c.annotation)==null?void 0:g.annotations,S,e.hoveredAnnotationId)}),n.addEventListener(ye.MOUSEMOVE,y=>{Y.debounce(()=>os(y,n,d,h,E,w,C,e),5)()}),n.addEventListener(ye.MOUSEUP,y=>{const I=y.currentTarget;ss(h,E,e,I,S)}),n.dataset.annotationDraggerInitialized="true"),r.enabled||(n.removeEventListener(ye.MOUSEDOWN,()=>{}),n.removeEventListener(ye.MOUSEMOVE,()=>{}),n.removeEventListener(ye.MOUSEUP,()=>{}),n.dataset.annotationDraggerInitialized="")}};Dt.register(Bt,jt,Ft,kt,Ut,Rt,Gt,Yt,zt,Vt,Xt,Er,ns,ls,Sr);const us=e=>{var i,_;Ot();const n=G.useRef(null),{table:t,headerComponent:o,subheaderComponent:r}=e??{},{translations:d,languageKey:f}=vr(),h=it(e),{data:{datasets:w}={datasets:[]},options:C,testId:E,persistenceId:S,controlsPortalId:M}=h,{annotations:N,axes:T,chartStyling:A,graph:p}=C??{},v=!((_=(i=C==null?void 0:C.legend)==null?void 0:i.customLegend)!=null&&_.customLegendContainerID),[b,L]=G.useReducer(Hr,{options:C,persistenceId:S},Zr),y=G.useMemo(()=>Co(w,b,C,d),[b.lineEnabled,b.pointsEnabled,w,T,N,p]);Xo({options:C,state:b,persistenceId:S});const{resetZoom:I,handleKeyDown:c,handleKeyUp:g}=hn({chartRef:n,state:b,options:C,dispatch:L,generatedDatasets:y}),l=Go({chartRef:n,state:b,options:C,dispatch:L,generatedDatasets:y}),u=Yo({options:C,resetZoom:I});return F.jsxs("div",{className:Nt(A,qe),style:{width:A.width||Je,height:A.height||Je},tabIndex:0,onKeyDown:c,onKeyUp:g,"data-testid":E,children:[F.jsx(st,{table:t,headerComponent:o,subheaderComponent:r,chartRef:n,state:b,options:C,dispatch:L,generatedDatasets:y,translations:d,controlsPortalId:M}),t&&b.showTable?F.jsx("div",{className:qe.table,children:t}):F.jsx(br,{backend:yr,context:window,children:F.jsxs("div",{className:qe.canvas,id:"canvas",children:[F.jsx(Mt,{ref:n,data:{datasets:y},options:l,plugins:u}),v&&!!y.length&&F.jsx(wr,{chartRef:n,legendConfig:{options:C,generatedDatasets:y,chartType:_r.LINE}})]})})]},fo(b,C,f))},as=e=>{const{options:n}=it(e);return F.jsx(Pt,{options:n,children:F.jsx(us,{...e})})};as.__docgenInfo={description:"",methods:[],displayName:"LineChartWithLegend",props:{chart:{required:!0,tsType:{name:"ILineChartData"},description:""},table:{required:!1,tsType:{name:"ReactNode"},description:""},headerComponent:{required:!1,tsType:{name:"ReactNode"},description:""},subheaderComponent:{required:!1,tsType:{name:"ReactNode"},description:""}}};export{as as L,ms as i};