@evergis/charts 3.0.20 → 3.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +15 -15
- package/dist/charts/BarChart/types.d.ts +3 -0
- package/dist/charts.cjs.development.js +23 -9
- package/dist/charts.cjs.development.js.map +1 -1
- package/dist/charts.cjs.production.min.js +1 -1
- package/dist/charts.cjs.production.min.js.map +1 -1
- package/dist/charts.esm.js +23 -9
- package/dist/charts.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,a=require("styled-components"),r=e(a),n=require("react"),l=e(n),o=require("d3"),i=e(require("react-dom/server")),s=require("react-dom");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var a,r,n={},l=Object.keys(e);for(r=0;r<l.length;r++)t.indexOf(a=l[r])>=0||(n[a]=e[a]);return n}function u(e,t){return t||(t=e.slice(0)),e.raw=t,e}const p=r.div(t||(t=u(["\n position: relative;\n width: 100%;\n box-sizing: border-box;\n"])));function h(){const[e,t]=n.useState(null);return[n.useCallback(t,[t]),e]}const m=(e,t,a)=>{const r=n.useMemo(()=>t?function(e,t){let a=!1;return function(){a||(e(...arguments),a=!0,setTimeout((function(){a=!1}),t))}}(t,a||44):void 0,[t,a]);n.useEffect(()=>(r&&"number"!=typeof e&&window.addEventListener("resize",r),()=>r&&window.removeEventListener("resize",r)),[e,r])},b=(e,t,a)=>(o.select(e).select("svg").remove(),o.select(e).append("svg").attr("width",t).attr("height",a));var g;const f=r.div(g||(g=u(["\n width: 100%;\n overflow: hidden;\n user-select: none;\n"]))),x=e=>e*(2-e),C=(e,t,a)=>Math.min(Math.max(e,t),a),y={animation:0,speed:0,timestamp:0,startX:0,currentX:0},v=["children","width","onSwipe"],L=e=>{let{children:t,width:a,onSwipe:r}=e,i=d(e,v);const[s,u]=h();return((e,t)=>{let{width:a,duration:r,animationFunc:l,onSwipe:i}=t;const s=o.select(e),c=o.select("body"),d=o.select(document),u=n.useRef(y);n.useEffect(()=>{a&&u.current.animation&&(cancelAnimationFrame(u.current.animation),u.current=y)},[a]);const p=n.useCallback(t=>{const{width:r}=e?e.getBoundingClientRect():{width:0},[n]=o.pointer(t.type.includes("touch")?t.touches[0]:t),l=C(n-u.current.startX,-(a-r),0);if(s.style("transform","translateX("+l+"px)"),u.current.currentX){const e=100,t=Date.now(),a=Math.round((l-u.current.currentX)/(t-u.current.timestamp)*e);u.current.speed=a,u.current.timestamp=t}u.current.currentX=l,i&&i(l,s)},[i,a,e,s]),h=n.useCallback(()=>{const{width:t}=e?e.getBoundingClientRect():{width:0};d.on("mousemove.swipe touchmove.swipe mouseup.swipe touchend.swipe",null),c.style("cursor",null),s.style("cursor",a>t?"grab":null),Date.now()-u.current.timestamp<44&&function(e){let{duration:t,timing:a,draw:r}=e;const n=performance.now();let l;requestAnimationFrame((function e(o){let i=(o-n)/t;i<1&&(l=requestAnimationFrame(e)),i>1&&cancelAnimationFrame(l);const s=a(i);r(s,l)}))}({duration:r,timing:l||x,draw:(e,r)=>{u.current.animation=r;const n=Math.round(2*u.current.speed*e),l=u.current.currentX+n,o=a-t,c=C(l,-o,0),d=Math.max(Math.min(l,o),0);u.current.currentX!==d&&(s.style("transform","translateX("+c+"px)"),i&&i(c,s))}})},[c,l,i,s,r,e,a,d]),m=n.useCallback(t=>{const a=t.type.includes("touch"),[r]=o.pointer(a?t.touches[0]:t,e),{left:n}=e&&e.parentElement?e.parentElement.getBoundingClientRect():{left:0};c.style("cursor","grabbing"),s.style("cursor","grabbing"),u.current.animation&&(cancelAnimationFrame(u.current.animation),u.current=y),u.current.startX=Math.max(r+n,0),d.on("mousemove.swipe touchmove.swipe",p),d.on("mouseup.swipe touchend.swipe",h)},[s,c,e,h,p,d]);n.useEffect(()=>{if(e){const{width:t}=e.getBoundingClientRect();a>t&&(s.style("cursor","grab"),s.on("mousedown.swipe touchstart.swipe",m))}},[s,m,e,a])})(u,c({width:a,onSwipe:r},i)),l.createElement(f,Object.assign({},i),l.createElement("div",{ref:s},t))};var T;L.defaultProps={duration:1400};const S=e=>{let{anchor:t,index:a,translateX:r,translateY:n}=e;return 0===a&&"middle"===t?"translate(calc(-50% + "+r+"px), calc(-100% + "+n+"px))":"middle"===t?"translate(calc(-50% + "+r+"px), calc("+n+"px))":"start"===t?"translate(calc("+r+"px), calc(-50% + "+n+"px))":"end"===t?"translate(calc(-100% + "+r+"px), calc(-50% + "+n+"px))":"translate("+r+"px, "+n+"px)"},k=r.div.attrs(e=>({style:{transform:S(e)}}))(T||(T=u(["\n position: absolute;\n"])));var w,B,M,A,N,E;const G=r.div(w||(w=u(["\n display: flex;\n align-items: center;\n font-size: 12px;\n"]))),z=r.div(B||(B=u(["\n text-align: center;\n max-width: 120px;\n"]))),Y=a.css(M||(M=u(["\n position: absolute;\n top: 50%;\n right: 0;\n transform: translate(calc(100% + 6px), -50%);\n"]))),R=r.div(A||(A=u(["\n display: flex;\n align-items: center;\n padding: 2px 4px;\n border-radius: 4px;\n color: rgb(255, 255, 255);\n background-color: rgb(144, 197, 61);\n margin-left: 8px;\n"]))),X=r(R)(N||(N=u(["\n ","\n"])),Y),I=r.div(E||(E=u(["\n margin-left: 4px;\n font-size: 10px;\n color: rgba(255, 255, 255, 0.54);\n"])));var P;const F={radar:"radar",radarAxis:"radarAxis",radarAxisTextGlobal:"radarAxisTextGlobal",radarAxisText:"radarAxisText",radarPolygon:"radarPolygon",radarLabel:"radarLabel",radarLabelName:"radarLabelName",radarLabelBadge:"radarLabelBadge",radarLabelBadgePrefix:"radarLabelBadgePrefix",radarCircle:"radarCircle"},D=r(p)(P||(P=u(["\n ."," {\n path,\n line,\n circle {\n fill: none;\n stroke-width: 1px;\n stroke: rgba(149, 149, 149, 0.18);\n }\n }\n ."," {\n font-size: 12px;\n fill-opacity: 0.56;\n }\n ."," {\n fill-opacity: 0.06;\n stroke-width: 2px;\n fill: rgb(144, 197, 61);\n stroke: rgb(144, 197, 61);\n }\n ."," {\n fill: rgb(144, 197, 61);\n }\n"])),F.radarAxis,F.radarAxisText,F.radarPolygon,F.radarCircle),V=(e,t)=>{const{data:a,curve:r,polar:n,formatValue:s,badgePrefix:d,labelOffset:u,circleRadius:p,svgElements:h,renderLabel:m,customize:g,formatAxisValue:f,radarStyles:x,labelIndex:C,selectLabel:y}=t;if(null!==e&&a.length){const v=10,L="number"==typeof t.bleedLength?t.bleedLength:v,{width:T}=e.getBoundingClientRect(),S=t.width||T,w=400,B=t.height||w,M=t.minValue||Math.min(0,o.min(a,e=>o.min(e.map(e=>{let{value:t}=e;return t})))),A=(t.maxValue||Math.max(0,o.max(a,e=>o.max(e.map(e=>{let{value:t}=e;return t})))))-M,N=t.paddingY||0,E=Math.min((S-2*(t.paddingX||0)-2*L)/2,(B-2*N-2*L)/2),Y=4,P=o.scaleLinear().domain([0,A||1]).range([]).ticks(t.levels||Y),D=P[P.length-1],V=D+(P[1]-P[0]);D<A&&P.push(V);const O=t.levels||P.length-1,j=P[P.length-1],W=2*Math.PI/a[0].length,q=o.scaleLinear().range([0,E]).domain([0,j]),Z=o.lineRadial().curve(o.curveLinearClosed).radius(e=>{let{value:t}=e;return q(t)}).angle((e,t)=>t*W),H=o.lineRadial().curve(r||o.curveLinearClosed).radius(e=>{let{value:t}=e;return q(t)}).angle((e,t)=>t*W),U=b(e,S,B),_=U.append("g"),J=o.range(1,O+1).reverse(),K=e=>-e*E/O,Q=e=>j*e/O,$=_.append("g").attr("class",F.radarAxis).selectAll().data([a[0]]).enter(),ee=_.append("g").attr("class",F.radar),te=$.selectAll().data(a[0].map(e=>{let{name:t}=e;return t})).enter();let ae=0;n?J.forEach(e=>{const t=$.append("circle").attr("cx",0).attr("cy",0).attr("r",()=>E/O*e).node().getBoundingClientRect().height;ae=Math.max(ae,t)}):J.map(Q).forEach(e=>{const t=$.append("path").attr("d",()=>Z(Array.from({length:a[0].length},()=>({value:e})))).node().getBoundingClientRect().height;ae=Math.max(ae,t)});const re=q(j)+L;te.append("line").attr("x1",0).attr("y1",0).attr("x2",(e,t)=>Math.round(re*Math.cos(W*t-Math.PI/2))).attr("y2",(e,t)=>Math.round(re*Math.sin(W*t-Math.PI/2))),ee.selectAll("path").data(a).join("path").attr("class",F.radarPolygon).attr("style",(e,t)=>(null==x?void 0:x[t])||"").attr("d",e=>H(e.map(e=>c({},e,{value:e.value-M}))));const ne=o.format(",");_.append("g").attr("class",F.radarAxisTextGlobal).selectAll("text").data(J).enter().append("text").attr("class",F.radarAxisText).attr("x","4").attr("y",K).attr("dy",0).attr("dominant-baseline","central").text((e,t)=>{const a=Q(e)+M;return f?f(a,t):ne(a)}),p&&a.forEach(e=>{const t=_.append("g").attr("class",F.radarCircle);e.forEach((e,a)=>{let{value:r}=e;t.append("circle").attr("cx",Math.round(q(r)*Math.cos(W*a-Math.PI/2))).attr("cy",Math.round(q(r*Math.sin(W*a-Math.PI/2)))).attr("r",p)})});const le=8,oe=B-L-N,ie=S/2,se=oe/2+(oe-ae)/2,ce=L+(u||le);if(_.attr("transform","translate("+ie+","+se+")"),(e=>{let{node:t,dataLength:a,radiusScale:r,maxValue:n,angleSlice:s,radius:c,xOffset:d,yOffset:u,translateX:p,translateY:h,renderLabel:m,selectLabel:b}=e;const g=o.select(t);g.selectAll(".d3-chart-label").remove();const f=e=>n/c*e,x=e=>r((n+f(u||0))*Math.sin(s*e-Math.PI/2));Array.from({length:a},(e,t)=>{return{x:Math.ceil((a=t,r(n+f(d||0))*Math.cos(s*a-Math.PI/2))),y:Math.ceil(x(t))};var a}).forEach((e,t)=>{let{x:r,y:n}=e;const o=((e,t)=>{const a=((e,t)=>360/t*e)(e,t),r=180;return[0,r].includes(a)?"middle":a<r?"start":"end"})(t,a),s=i.renderToString(l.createElement(k,{anchor:o,translateX:p||0,translateY:h||0,index:t,style:{left:r,top:n}},"function"==typeof m?m(o,t):m)),c=g.append("div").attr("class","d3-chart-label").html(s);b(c,o,t)})})({node:e,maxValue:j,translateX:ie,translateY:se,dataLength:a[C||0].length,angleSlice:W,radius:E,radiusScale:q,xOffset:ce,yOffset:ce,renderLabel:(e,t)=>{const r=a.map(e=>e[t]),n="middle"===e?X:R,o=a[C||0][t],{name:i,value:c}=o;return m?m({item:o,items:r,anchor:e,index:t}):l.createElement(G,{className:F.radarLabel},l.createElement(z,{className:F.radarLabelName},i),l.createElement(n,{className:F.radarLabelBadge},s?s(c,t):ne(c),d&&l.createElement(I,{className:F.radarLabelBadgePrefix},d)))},selectLabel:(e,t,r)=>{if(y){const n=a.map(e=>e[r]);y(e,{index:r,item:a[C||0][r],items:n,anchor:t})}}}),h){const e=i.renderToString(h);U.append("g").html(e)}g&&g(U)}},O=e=>{const{className:t,style:a}=e,[r,o]=h();return n.useEffect(()=>{o&&V(o,e)},[o,e]),m(e.width,()=>V(o,e)),l.createElement("div",{className:t,style:a},l.createElement(D,{ref:r}))};function j(e){return e*(Math.PI/180)}var W;O.defaultProps={height:400,data:[],curve:o.curveLinearClosed};const q={pieGlobal:"pieGlobal",pieSlice:"pieSlice",pieSliceLabel:"pieSliceLabel",pieSliceLabelValue:"pieSliceLabelValue",pieSliceLabelName:"pieSliceLabelName",pieRadialLabel:"pieRadialLabel",pieRadialLink:"pieRadialLink",pieTooltipContainer:"pieTooltipContainer",pieTooltipFlex:"pieTooltipFlex",pieTooltip:"pieTooltip",pieTooltipItem:"pieTooltipItem",pieTooltipName:"pieTooltipName",pieTooltipValue:"pieTooltipValue",pieTooltipColorBox:"pieTooltipColorBox",pieFullChartTooltipCircle:"pieFullChartTooltipCircle"},Z=r(p)(W||(W=u(["\n ."," {\n fill: #4a4a4a;\n }\n ."," {\n position: absolute;\n max-width: 128px;\n }\n ."," {\n stroke: #000;\n }\n ."," {\n fill: transparent;\n cursor: pointer;\n }\n"])),q.pieSliceLabel,q.pieRadialLabel,q.pieRadialLink,q.pieFullChartTooltipCircle),H=e=>e.startAngle+(e.endAngle-e.startAngle)/2<Math.PI?1:-1,U=e=>e.startAngle+(e.endAngle-e.startAngle)/2<Math.PI?"start":"end";var _,J,K,Q,$,ee,te,ae,re,ne,le,oe,ie,se;const ce=r.div(_||(_=u(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n pointer-events: none;\n white-space: nowrap;\n"]))),de=r(ce)(J||(J=u([""]))),ue=r(de)(K||(K=u(["\n align-items: center;\n"]))),pe=r.div(Q||(Q=u(["\n position: relative;\n font-size: 11px;\n color: #fff;\n margin-bottom: 8px;\n padding: 4px 6px;\n background-color: rgba(48, 69, 79, 1);\n border-radius: 4px;\n box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);\n :before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 100%);\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 4px 3px 0 3px;\n border-color: rgba(48, 69, 79, 1) transparent transparent transparent;\n }\n"]))),he=r.div($||($=u(["\n font-size: 14px;\n margin-bottom: 6px;\n"]))),me=r.div(ee||(ee=u(["\n display: flex;\n align-items: center;\n margin-bottom: 0.25rem;\n &:last-of-type {\n margin-bottom: 0;\n }\n"]))),be=r.div(te||(te=u(["\n display: flex;\n align-items: center;\n margin-right: 4px;\n"]))),ge=r.div(ae||(ae=u(["\n margin-right: 4px;\n width: 10px;\n height: 10px;\n border-radius: 2px;\n"]))),fe=r(ge)(re||(re=u(["\n height: 2px;\n border-radius: 0;\n"]))),xe=r.div(ne||(ne=u(["\n margin-right: 4px;\n"]))),Ce=r.div(le||(le=u(["\n text-align: right;\n flex-shrink: 0;\n flex-grow: 1;\n"]))),ye=r.div(oe||(oe=u(["\n position: relative;\n font-size: 11px;\n color: #fff;\n font-weight: bold;\n letter-spacing: 0.52px;\n"]))),ve=r(ye)(ie||(ie=u(["\n top: 6px;\n"]))),Le=r(ye)(se||(se=u(["\n bottom: 6px;\n"]))),Te=(e,t)=>{const{data:a,padAngle:r,onClick:n,outerRadius:s,startAngle:c,endAngle:d,cornerRadius:u,margin:p,enableSlicesLabels:h,formatSliceLabel:m,slicesLabelsSkipAngle:g,enableSlicesLabelsName:f,formatSliceLabelName:x,borderWidth:C,borderColor:y,enableRadialLabels:v,backgroundColor:L,radialLabelsLinkHorizontalLength:T,radialLabelsTextXOffset:S,formatRadialLabel:k,radialLabelYOffset:w,svgElements:B,formatSliceTitle:M,radialAngleXOffset:A,withTooltip:N,fullChartTooltip:E,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,tooltipStyle:R}=t;if(null!==e&&a.length){const X=p?p.top:0,I=p?p.right:0,P=p?p.bottom:0,F=p?p.left:0,{width:D}=e.getBoundingClientRect(),V=t.width||D,O=240,W=t.height||O,Z=(Math.min(V,W)-2*(C||0)-(V>W?X+P:I+F))/2,_=b(e,V,W),J=_.append("g").attr("class",q.pieGlobal).attr("transform","translate("+((V-(F+I))/2+F)+","+((W-(P+X))/2+X)+")"),K=45,Q=100,$=360,ee=o.pie().startAngle(-j(c||0)).endAngle(j(d||$)).padAngle(r?Math.max(Math.min(r/Q,K),0):0).sort(null).value(e=>{let{value:t}=e;return t})(a),te=.95,ae=o.arc().cornerRadius(u||0).innerRadius(Z).outerRadius(Z*Math.min(Math.max(s||0,0),te));"string"==typeof L&&J.append("path").attr("fill",L).attr("d",()=>ae({startAngle:j(0),endAngle:j($)}));const re=o.format(","),ne=J.selectAll("allSlices").data(ee).enter().append("path").attr("d",ae);if(ne.attr("class",q.pieSlice).attr("fill",e=>{let{index:t}=e;return a[t].color||""}).attr("stroke",y||"").attr("stroke-width",C||0).attr("style",n?"cursor: pointer":"").on("click",(e,t)=>n&&n(a[t.index])).append("svg:title").text(e=>M?M(e):E||N?"":(a[e.index].name||"")+" ("+re(a[e.index].value)+")"),h){const e=J.selectAll("allSlices").data(ee).enter().append("text").attr("class",q.pieSliceLabel).attr("text-anchor","middle").attr("dominant-baseline","central").attr("transform",e=>"translate("+ae.centroid(e)+")");e.append("tspan").attr("class",q.pieSliceLabelValue).text(e=>{const t=180*(e.endAngle-e.startAngle)/Math.PI;if(!g||t>g)return m?m(e):e.value}),f&&e.append("tspan").attr("class",q.pieSliceLabelName).text(e=>x?x(e):e.data.name).attr("x","0").attr("dy","1.2em")}if((e=>{let{arc:t,enableRadialLabels:a,global:r,node:n,radius:l,dataReady:s,radialLabelsLinkHorizontalLength:c,formatRadialLabel:d,radialLabelsTextXOffset:u,translateX:p,translateY:h,radialLabelYOffset:m,radialAngleXOffset:b}=e;const g=o.select(n);if(g.selectAll("."+q.pieRadialLabel).remove(),a){const e=4,a=o.arc().innerRadius(l).outerRadius(l);r.selectAll("allPolylines").data(s).enter().append("polyline").attr("class",q.pieRadialLink).style("fill","none").attr("points",r=>{const n=H(r),o=t.centroid(r),i=a.centroid(r),s=a.centroid(r),d=[(l+(c||e))*n,s[1]];return[[o[0],o[1]],[i[0]+(b||0)*n,i[1]-(m||0)*r.index],[d[0],d[1]-(m||0)*r.index]]});const n=t=>{const r=a.centroid(t);return[(l+(c||e))*H(t),r[1]]},f=4;g.selectAll("allLabels").data(s).enter().append("div").html(e=>i.renderToString(d?d(e):e.data.name)).attr("class",q.pieRadialLabel).style("transform",e=>(e=>{let{anchor:t,index:a,translateX:r,translateY:n}=e;return 0===a&&"middle"===t?"translate(calc(-50% + "+r+"px), calc(-100% + "+n+"px))":"middle"===t?"translate(calc(-50% + "+r+"px), calc("+n+"px))":"start"===t?"translate(calc("+r+"px), calc(-50% + "+n+"px))":"end"===t?"translate(calc(-100% + "+r+"px), calc(-50% + "+n+"px))":"translate("+r+"px, "+n+"px)"})({anchor:U(e),index:e.index,translateX:p,translateY:h-(m||0)*e.index})).style("left",e=>n(e)[0]-("start"===U(e)?-(u||f):u||f)+"px").style("top",e=>n(e)[1]+"px").style("text-align",U)}})({arc:ae,enableRadialLabels:v,global:J,radius:Z,node:e,dataReady:ee,translateX:(V-(F-I))/2,translateY:(W+(X-P))/2,radialLabelsLinkHorizontalLength:T,radialLabelsTextXOffset:S,formatRadialLabel:k,radialLabelYOffset:w,radialAngleXOffset:A}),(N||E)&&(e=>{let{fullChartTooltip:t,global:a,tooltipRoot:r,data:n,tooltipClassName:s,tooltipBind:c,renderTooltip:d,arc:u,allSlices:p,tooltipStyle:h,width:m,height:b,radius:g}=e;const f=r||document.querySelector("body"),x=o.format(","),C=o.select(f).select("."+q.pieTooltipContainer),y=C.empty()?o.select(f).append("div").attr("class",q.pieTooltipContainer+" "+(s||"")).style("position","absolute").style("opacity","0").style("z-index","103"):C;h&&Object.entries(h).forEach(e=>{let[t,a]=e;return y.style(t,a)}),y.html("");let v=!1;const L=e=>{v=Boolean(e),y.style("opacity",v?"1":"0")},T=(e,r)=>{let[n,l]=o.pointer(e,document);if(!c&&t){const[t,a]=o.pointer(e,e.target);n-=t,l-=a}else if(!c){const e=a.node(),{x:t,y:o,width:i,height:s}=e?e.getBoundingClientRect():{x:0,y:0,width:0,height:0},[c,d]=u.centroid(r);n=t+i/2+c,l=o+s/2+d}y.style("left",n+"px").style("top",l+"px")},S=(e,t)=>{L(!0),T(e,t);const a=t?[t.data]:n;y.html(()=>i.renderToString(l.createElement(ce,{className:q.pieTooltipFlex},l.createElement(pe,{className:q.pieTooltip},d?d(a):l.createElement(l.Fragment,null,a.map((e,t)=>{let{color:a,name:r,value:n}=e;return l.createElement(me,{key:r+"-"+t,className:q.pieTooltipItem},a&&l.createElement(ge,{className:q.pieTooltipColorBox,style:{backgroundColor:a}}),r&&l.createElement(xe,{className:q.pieTooltipName},r),l.createElement(Ce,{className:q.pieTooltipValue},x(n)))}))))))};t?(a.on("mouseover.fulltooltip",e=>S(e)),a.on("mouseout.fulltooltip",()=>{y.html(""),L()}),m&&b&&a.append("circle").attr("class",q.pieFullChartTooltipCircle).attr("r",g).attr("cx",0).attr("cy",0),c||a.on("touchmove.tooltipBind mousemove.tooltipBind",e=>T(e))):(p.on("mouseover.slice",S),c||p.on("touchmove.slice mousemove.slice",T),p.on("mouseout.slice",()=>{y.html(""),L()}))})({fullChartTooltip:E,global:J,data:a,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,allSlices:ne,arc:ae,tooltipStyle:R,width:V,height:W,radius:Z}),B){const e=i.renderToString(B);_.append("g").html(e)}}},Se=e=>{const{className:t,style:a,children:r}=e,[o,i]=h();return n.useEffect(()=>{i&&Te(i,e)},[i,e]),m(e.width,()=>Te(i,e)),l.createElement("div",{className:t,style:a},l.createElement(Z,{ref:o},r))};Se.defaultProps={data:[],startAngle:0,endAngle:360,slicesLabelsSkipAngle:0,radialLabelYOffset:16,radialAngleXOffset:8};const ke={legendContainer:"d3-legend-container",legendTitle:"d3-legend-title",legendTick:"d3-legend-tick",legendTickLine:"d3-legend-tick-line",legendTickText:"d3-legend-tick-text"};function we(e,t){void 0===t&&(t=256);const a=document.createElement("canvas");a.width=t,a.height=1;const r=a.getContext("2d");for(let a=0;a<t;++a)r.fillStyle=e(a/(t-1)),r.fillRect(a,0,1,1);return a}const Be={tickSize:6,height:44,width:320,marginTop:18,marginBottom:16,ticksDivier:64,titleMarginBottom:6};var Me;const Ae=c({calendarChart:"calendarChart",calendarYear:"calendarYear",calendarAxis:"calendarAxis",calendarBody:"calendarBody",calendarHeader:"calendarHeader",calendarYearTitle:"calendarYearTitle",calendarWeekDay:"calendarWeekDay",calendarMonth:"calendarMonth",calendarDays:"calendarDays",calendarDay:"calendarDay"},ke),Ne=r(p)(Me||(Me=u(["\n ."," {\n display: flex;\n margin-bottom: 16px;\n }\n ."," {\n display: inline-flex;\n align-items: flex-end;\n height: ",";\n margin-bottom: 4px;\n font-weight: bold;\n }\n ."," {\n height: ",";\n margin-bottom: 4px;\n position: relative;\n display: flex;\n }\n ."," {\n font-size: 14px;\n bottom: 0;\n position: absolute;\n }\n ."," {\n display: flex;\n flex-direction: column;\n margin-right: 10px;\n }\n ."," {\n font-size: 12px;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n ."," {\n position: relative;\n }\n ."," {\n position: absolute;\n }\n"])),Ae.calendarYear,Ae.calendarYearTitle,"20px",Ae.calendarHeader,"20px",Ae.calendarMonth,Ae.calendarAxis,Ae.calendarWeekDay,Ae.calendarDays,Ae.calendarDay),Ee=e=>{const{className:t,style:a,children:r,data:i,startSunday:s,weekdays:d,cellOffset:u,cellSize:p,interpolator:m,monthSpacing:b,colorRange:g,legendProps:f}=e,[x,C]=h();return n.useEffect(()=>{C&&((e,t)=>{const{data:a,startSunday:r,weekdays:n,interpolator:l,monthSpacing:i,onEachDay:s,colorRange:d,legendProps:u}=t;if(null!==e&&a.length){const p=o.group(a,e=>e.date.getUTCFullYear()),h="number"==typeof t.cellOffset?t.cellOffset:0,m=7,b=18,g=t.cellSize||b,f=e=>r?e:(e+(m-1))%m,x=n||["вс","пн","вт","ср","чт","пт","сб"],C=6,y=e=>r?x[e]:e===C?x[0]:x[e+1],v=o.utcFormat("%x"),L=r?o.utcSunday:o.utcMonday,T=(e,t)=>L.count(o.utcYear(e),t),S=e=>e.getUTCMonth()*(i||0),k=o.utcFormat("%b"),w=o.max(a.map(e=>{let{value:t}=e;return t})),B=o.min(a.map(e=>{let{value:t}=e;return t})),M=d?o.scaleLinear().domain([B,w]).range(d):o.scaleSequential(l||o.interpolateGreens).domain([B,+w]);let A=0;p.forEach((e,t)=>{const a=new Date(t,1),r=o.max(e.map(e=>e.date)),n=r.getUTCMonth()-a.getUTCMonth(),l=T(a,r)+1;A=Math.max(A,l*(g+h)+(i||0)*n)}),o.select(e).select("."+Ae.calendarChart).remove();const N=o.select(e).append("div").attr("class",Ae.calendarChart),E=N.selectAll("div").data(p).join("div").attr("class",Ae.calendarYear),G=E.append("div").attr("class",Ae.calendarAxis);G.append("div").attr("class",Ae.calendarYearTitle).text(e=>{let[t]=e;return t}),G.selectAll("span").data(o.range(m)).join("div").attr("class",Ae.calendarWeekDay).style("height",g+"px").style("margin-bottom",h+"px").text(y);const z=E.append("div").attr("class",Ae.calendarBody);if(z.append("div").attr("class",Ae.calendarHeader).selectAll("div").data(e=>{let[t,a]=e;return o.utcMonths(o.utcMonth(new Date(a[0].date.getUTCFullYear(),1,1)),o.utcMonth(new Date(a[0].date.getUTCFullYear(),12,31)))}).join("div").attr("class",Ae.calendarMonth).style("left",e=>T(e,L.ceil(e))*(g+h)+S(e)+"px").text(k),z.append("div").attr("class",Ae.calendarDays).style("height",(g+h)*m+"px").style("width",A+"px").selectAll("div").data(e=>{let[,t]=e;return t}).join("div").each((e,t,a)=>{if(s){const r=a[t],n=M(e.value);s(e,r,n)}}).attr("class",Ae.calendarDay).style("width",g+"px").style("height",g+"px").style("left",e=>T(e.date,e.date)*(g+h)+S(e.date)+"px").style("top",e=>f(e.date.getUTCDay())*(g+h)+"px").style("background-color",e=>M(e.value)).attr("title",e=>v(e.date)+" - "+e.value),"object"==typeof u){const e=(e=>{let{color:t,title:a,tickSize:r=Be.tickSize,width:n=Be.width,height:l=Be.height+r,marginTop:i=Be.marginTop,marginRight:s=0,marginBottom:c=Be.marginBottom+r,marginLeft:d=0,ticks:u=Be.width/Be.ticksDivier,tickFormat:p,tickValues:h,titleMarginBottom:m}=e;const b=o.create("svg").attr("width",n).attr("height",l).attr("viewBox",[0,0,n,l]).style("overflow","visible").style("display","block");let g;if(t.interpolate){const e=Math.min(t.domain().length,t.range().length);g=t.copy().rangeRound(o.quantize(o.interpolate(d,n-s),e)),b.append("image").attr("x",d).attr("y",i).attr("class",ke.legendContainer).attr("width",n-d-s).attr("height",l-i-c).attr("preserveAspectRatio","none").attr("xlink:href",we(t.copy().domain(o.quantize(o.interpolate(0,1),e))).toDataURL())}else if(t.interpolator&&(g=Object.assign(t.copy().interpolator(o.interpolateRound(d,n-s)),{range:()=>[d,n-s]}),b.append("image").attr("x",d).attr("y",i).attr("width",n-d-s).attr("height",l-i-c).attr("preserveAspectRatio","none").attr("xlink:href",we(t.interpolator()).toDataURL()),!g.ticks)){if(void 0===h){const e=Math.round(u+1);h=o.range(e).map(a=>o.quantile(t.domain(),a/(e-1)))}"function"!=typeof p&&(p=o.format(void 0===p?",f":p))}return b.append("g").attr("transform","translate(0,"+(l-c)+")").call(o.axisBottom(g).ticks(u,"string"==typeof p?p:void 0).tickFormat("function"==typeof p?p:void 0).tickSize(r).tickValues(h)).call(e=>{const t=e.selectAll(".tick");return t.selectAll(".tick line").attr("y1",i+c-l).attr("class",ke.legendTickLine),t.selectAll(".tick text").attr("class",ke.legendTickText),t.attr("class",ke.legendTick),t}).call(e=>e.select(".domain").remove()).call(e=>e.append("text").attr("x",d).attr("class",ke.legendTitle).attr("y",i+c-l-(m||Be.titleMarginBottom)).attr("fill","currentColor").attr("text-anchor","start").attr("font-weight","bold").text(a)),b})(c({color:M},u)),t=N.node(),a=e.node();t.appendChild(a)}}})(C,e)},[C,i,s,d,u,p,m,b,g,f]),l.createElement(Ne,{ref:x,className:t,style:a},r)};function Ge(e){let t;const a=e.node();return t=a instanceof SVGGraphicsElement?a.getBBox():a.getBoundingClientRect(),t}function ze(){}function Ye(e){return null==e||Number.isNaN(e)}var Re,Xe;Ee.defaultProps={data:[]};const Ie={lineChartYScaleGlobal:"lineChartYScaleGlobal",lineChartYScaleRight:"lineChartYScaleRight",lineChartXScaleGlobal:"lineChartXScaleGlobal",lineChartLinesGlobal:"lineChartLinesGlobal",lineChartLine:"lineChartLine",lineChartAreasGlobal:"lineChartAreasGlobal",lineChartArea:"lineChartArea",lineChartDotsGlobalContainer:"lineChartDotsGlobalContainer",lineChartDotsGlobal:"lineChartDotsGlobal",lineChartDot:"lineChartDot",lineChartGridGlobal:"lineChartGridGlobal",lineChartGridLineX:"lineChartGridLineX",lineChartGridLineY:"lineChartGridLineY",lineChartLabelContainer:"lineChartLabelContainer",lineChartLabelFlex:"lineChartLabelFlex",lineChartLabel:"lineChartLabel",lineChartMouseGlobal:"lineChartMouseGlobal",lineChartMouseLine:"lineChartMouseLine",lineChartMouseRect:"lineChartMouseRect",lineChartMouseCircle:"lineChartMouseCircle",lineChartMouseLabelContainer:"lineChartMouseLabelContainer",lineChartMouseLabel:"lineChartMouseLabel"},Pe=r(p)(Re||(Re=u(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n stroke: steelblue;\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n ."," {\n fill-opacity: 0.24;\n }\n .",",\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n .",",\n ."," {\n transition: opacity linear 200ms;\n pointer-events: none;\n stroke-width: 1px;\n }\n ."," {\n stroke: #fff;\n stroke-width: 2px;\n }\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n pointer-events: all;\n }\n"])),Ie.lineChartYScaleGlobal,Ie.lineChartXScaleGlobal,Ie.lineChartGridGlobal,Ie.lineChartLinesGlobal,Ie.lineChartArea,Ie.lineChartGridLineX,Ie.lineChartGridLineY,Ie.lineChartMouseLine,Ie.lineChartMouseLine,Ie.lineChartMouseCircle,Ie.lineChartDot,Ie.lineChartMouseLine,Ie.lineChartMouseRect),Fe=a.createGlobalStyle(Xe||(Xe=u(["\n ."," {\n transition: opacity linear 200ms;\n z-index: 100;\n ."," {\n justify-content: flex-start;\n align-items: center;\n pointer-events: none;\n }\n ."," {\n margin: 0 0 0 10px;\n }\n }\n"])),Ie.lineChartMouseLabel,Ie.lineChartLabelFlex,Ie.lineChartLabel);var De,Ve;const Oe=r.div(De||(De=u(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),je=r.div(Ve||(Ve=u(["\n margin-bottom: 4px;\n"]))),We=["values"],qe=(e,t)=>{const{data:a,labels:r,margin:n,customYAxisSelection:s,customXAxisSelection:u,customYAxis:p,customXAxis:h,curve:m,yAxisPadding:g,xAxisPadding:f,drawGridY:x,drawGridX:C,withLabels:y,formatLabel:v,eachLabel:L,stacked:T,dynamicTooltipEnable:S,dynamicCircleRadius:k,formatDynamicTooltip:w,renderTooltip:B,stackedTooltip:M,stackedTooltipIndex:A,tooltipLineTop:N,customize:E,customYScale:G,customLine:z,tooltipClassName:Y,xScaleItemWidth:R,areaCurve:X,dotSnapping:I,rightAxis:P}=t;if(null!==e&&a.length){const F=T?(e=>{const t={};return e.map((e,a)=>(t[a]={},a>0?c({},e,{values:e.values.map((e,r)=>{const n=t[a-1][r];return t[a][r]=Number(("number"!=typeof n?0:Math.abs(n))+("number"!=typeof e?0:Math.abs(e))),t[a][r]})}):(e.values.forEach((e,r)=>{t[a][r]=Number(e)}),e)))})(a):a,D=n?n.top:0,V=n?n.right:0,O=n?n.bottom:0,j=n?n.left:0,{width:W}=e.getBoundingClientRect(),q=t.width||W,Z=t.height||0,H="number"==typeof t.min?t.min:o.min(F,e=>{let{values:t}=e;return o.min(t)}),U="number"==typeof t.max?t.max:o.max(F,e=>{let{values:t}=e;return o.max(t)}),_=b(e,q,Z||0),J=[Z-D-O-(f||0),D],K=o.scaleLinear().domain([H||0,U||0]).range(J).nice();G&&G(K);const Q=8,$=o.axisLeft(K).ticks(Q);p&&p($);const ee=$.tickArguments()[0],te=_.append("g").attr("class",Ie.lineChartYScaleGlobal).call($).call(s||ze),{width:ae}=Ge(te);te.attr("transform","translate("+(j+ae)+", 0)");let re=0;if(P){const e=o.min(P),t=o.max(P),a=o.scaleLinear().domain([e||0,t||0]).range(J).nice(),r=o.axisRight(a).ticks(Q),n=_.append("g").attr("class",Ie.lineChartYScaleGlobal+" "+Ie.lineChartYScaleRight).call(r).call(s||ze);({width:re}=Ge(n)),n.attr("transform","translate("+(q-re)+", 0)")}const ne=r&&r.length?r.length-1:F.reduce((e,t)=>{let{values:a}=t;return Math.max(e,a.length)},0)-1,le=o.scaleLinear().domain([0,ne]).range([j+ae+(g||0),q-re-V]),oe=o.axisBottom(le).tickFormat(e=>r&&r.length>0?r[e]:0).ticks(ne);if("number"==typeof R){const[e,t]=le.range();oe.ticks(Math.round((t-e)/R)).tickSizeOuter(0)}if(h&&h(oe),(e=>{let{svg:t,yScale:a,xScale:r,yTicksCount:n,lastIndex:l,drawGridX:o,drawGridY:i}=e;if(!i&&!o)return;const s=t.append("g").attr("class",Ie.lineChartGridGlobal),c=a.ticks(n);o&&s.append("g").selectAll("line").data(c).join("line").attr("class",Ie.lineChartGridLineX).attr("x1",()=>r(0)).attr("x2",()=>r(l)).attr("y1",e=>Math.round(a(e))).attr("y2",e=>Math.round(a(e))),i&&s.append("g").selectAll("line").data(Array.from({length:l+1},(e,t)=>t)).join("line").attr("class",Ie.lineChartGridLineY).attr("x1",(e,t)=>Math.round(r(t))).attr("x2",(e,t)=>Math.round(r(t))).attr("y1",()=>Math.round(a(c[0]))).attr("y2",()=>Math.round(a(c[c.length-1])))})({svg:_,yScale:K,xScale:le,yTicksCount:ee,lastIndex:ne,drawGridY:x,drawGridX:C}),Array.isArray(r)&&r.length>0){const e=_.append("g").call(u||ze).attr("class",Ie.lineChartXScaleGlobal).call(oe),{height:t}=Ge(e);e.attr("transform","translate(0, "+(Z-Math.ceil(t)-O)+")")}const ie=o.line().defined(e=>null!==e).x((e,t)=>le(t)).y(e=>K(e)).curve(m||o.curveLinear);if(z&&z(ie),F.some(e=>{let{fill:t}=e;return t})){let e=-2;const t=t=>{const{minAreaValues:a}=t,r=K.ticks()[0];return o.area().defined(e=>null!==e).x((e,t)=>le(t)).y0((t,n)=>{0===n&&(e+=1);let l=r;a&&"number"==typeof a[n]?l=a[n]||l:a&&(l=K(l-t));const o=F[e];return K(T&&e>-1?"number"!=typeof o.values[n]?0:o.values[n]:l)}).y1(e=>K(e)).curve(X||m||o.curveLinear)};_.append("g").attr("class",Ie.lineChartAreasGlobal).selectAll("path").data(F.filter(e=>{let{fill:t}=e;return Boolean(t)})).join("path").attr("class",Ie.lineChartArea).attr("d",e=>t(e)(e.values)).attr("fill",e=>{let{fill:t}=e;return t||"none"}).attr("style",e=>{let{areaStyle:t}=e;return t||""})}_.append("g").attr("class",Ie.lineChartLinesGlobal).selectAll("path").data(F).join("path").attr("class",Ie.lineChartLine).attr("d",e=>ie(e.values)).attr("stroke",e=>{let{stroke:t}=e;return t||"steelblue"}).attr("style",e=>{let{style:t}=e;return t||""});const se=F.filter(e=>{let{dot:t}=e;return t});if(se.length>0){const e=_.append("g").attr("class",Ie.lineChartDotsGlobalContainer);se.forEach(t=>{const{values:a,dot:r}=t,{radius:n,style:l,filter:o}=r,i=e.append("g").attr("class",Ie.lineChartDotsGlobal);i.selectAll("circle").data(a).join("circle").attr("cx",(e,t)=>le(t)).attr("class",Ie.lineChartDot).attr("cy",e=>K(e)).attr("r",n||0).attr("style",l||""),o&&i.selectAll("circle").select((e,a,r)=>o(t,a,r)?r[a]:null).remove()})}o.select(e).select(".d3-chart-label").remove(),y&&(e=>{let{node:t,data:a,yScale:r,xScale:n,formatLabel:s,eachLabel:c}=e;const d=o.select(t).append("div").attr("class","d3-chart-label"),u=o.format(",");a.forEach(e=>{let{values:t}=e;d.append("div").selectAll("div").data(t).join("div").attr("class",Ie.lineChartLabelContainer).style("position","absolute").style("left",(e,t)=>n(t)+"px").style("top",e=>r(e)+"px").html((e,t,a)=>i.renderToString(l.createElement(Oe,{className:Ie.lineChartLabelFlex},l.createElement(je,{className:Ie.lineChartLabel},s?s(e,t,a):u(e))))).each(c||ze)})})({node:e,eachLabel:L,data:F,yScale:K,xScale:le,formatLabel:v}),S&&(e=>{let{svg:t,node:a,data:r,xScale:n,yScale:s,dynamicCircleRadius:u,formatDynamicTooltip:p,renderTooltip:h,stackedTooltipIndex:m,stackedTooltip:b,tooltipLineTop:g,tooltipRoot:f,tooltipClassName:x,dotSnapping:C,lastIndex:y}=e;const v=f||document.querySelector("body"),L=o.format(","),T=r.filter(e=>{let{tooltipOff:t}=e;return!t}),S="number"==typeof m?[T[m]]:b?[T[0]]:T,[k,w]=n.range(),[B,M]=s.range(),A=t.append("g").attr("class",Ie.lineChartMouseGlobal),N=A.append("rect").attr("width",w-k).attr("height",Math.abs(B-M)).attr("class",Ie.lineChartMouseRect).attr("transform","translate("+k+", "+M+")"),E=A.append("path").attr("class",Ie.lineChartMouseLine).style("opacity","0"),G=t.selectAll("."+Ie.lineChartLine).nodes(),z=A.selectAll("circle").data(T.filter(e=>{let{dynamicDotOff:t}=e;return!t})).join("circle").attr("class",Ie.lineChartMouseCircle).attr("r",u).attr("fill",e=>{let{stroke:t}=e;return t||"none"}).attr("stroke",e=>{let{stroke:t}=e;return t||"none"}).style("opacity","0");let Y=o.select("."+Ie.lineChartMouseLabelContainer);0===Y.size()&&(Y=o.select(v).append("div").attr("class",Ie.lineChartMouseLabelContainer));let R=null,X=!1;const I=e=>{X=Boolean(e);const t=X?"1":"0";E.style("opacity",t),z.style("opacity",t),R&&R.style("opacity",t)},P=e=>{const[u,f]=o.pointer(e,document),[x]=o.pointer(e,N),[v,S]=o.pointer(e,a),k=x-(x-v),w=v+(u-v),A=Math.abs(n.invert(k)),Y={},P=e=>e[Math.floor(A)];G.forEach((e,t)=>{let a={x:0,y:0};if(e.hasAttribute("d")&&!r[t].tooltipOff)if(C){const[e,a]=n.range(),l=(a-e)/y;Y[t]={x:e+Math.round(A)*l,y:"number"==typeof r[t].values[Math.round(A)]?s(r[t].values[Math.round(A)]):0}}else{let r=0,n=e.getTotalLength(),l=null;for(;l=Math.floor((r+n)/2),a=e.getPointAtLength(l),l!==n&&l!==r||a.x===k;)if(a.x>k)n=l;else{if(!(a.x<k))break;r=l}Y[t]=a}else Y[t]=a}),z.attr("transform",(e,t)=>{const a=P(e.values);return Y[t]&&a?"translate("+(C?Y[t].x:k)+","+Y[t].y+")":"translate(-9999, -9999)"}).attr("style",e=>{let{dynamicDotStyle:t}=e;return t||""});const F=T.map((e,t)=>{let{values:a}=e;return c({},d(e,We),{value:P(a),invertValue:Y[t]?s.invert(Y[t].y):0})}),D=F.every(e=>{let{value:t}=e;return Ye(t)});D&&X?I():X||D||I(!0);const V=Object.keys(Y).reduce((e,t,a)=>{var n,l;const o=null==(n=F[Number(e)])?void 0:n.value,i=null==(l=F[Number(t)])?void 0:l.value,s=null==r?void 0:r[a].dynamicDotOff;return 0===a||Ye(i)||s?e:Ye(o)||Y[e].y>Y[t].y?t:e},"0"),O=R&&R.style("left",(e,t)=>{var a,r;return C?(null!=(a=null==(r=Y[t])?void 0:r.x)?a:0)+"px":w+"px"}).style("top",(e,t)=>{var a,r;return(null!=(a=null==(r=Y["number"==typeof m?m:b?V:t])?void 0:r.y)?a:0)+(f-S)+"px"}).select("."+Ie.lineChartLabel);h&&R?R.html((a,r)=>i.renderToString(l.createElement(Oe,{className:Ie.lineChartLabelFlex},h(F,{indexX:Math.round(A),indexY:r,svg:t,event:e})))):O&&O.text((e,t)=>{const a=F[t].invertValue;return p?p(a,F[t].value):L(a)}),E.attr("d",()=>{var e;let t="M"+k+","+B;return t+=" "+k+","+(g?M:(null==(e=Y[V])?void 0:e.y)||0),t})};N.on("mouseover.tooltip",e=>{R=Y.selectAll("div").data(S).join("div").attr("class",Ie.lineChartMouseLabel+" "+(x||"")).style("opacity","0").style("position","absolute").html(()=>i.renderToString(l.createElement(Oe,{className:Ie.lineChartLabelFlex},l.createElement(je,{className:Ie.lineChartLabel})))),P(e)}),N.on("mouseout.tooltip",()=>{o.select("."+Ie.lineChartMouseLabelContainer).selectAll("*").remove(),I()}),N.on("touchmove.tooltip mousemove.tooltip",P)})({tooltipLineTop:N,stackedTooltip:M,renderTooltip:B,stackedTooltipIndex:A,formatDynamicTooltip:w,node:e,svg:_,data:F,xScale:le,yScale:K,dynamicCircleRadius:k,tooltipClassName:Y,dotSnapping:I,lastIndex:ne}),E&&E({svg:_,yScale:K,xScale:le})}},Ze=e=>{const{className:t,style:a,children:r}=e,[o,i]=h();return n.useEffect(()=>{i&&qe(i,e)},[i,e]),m(e.width,()=>qe(i,e)),l.createElement("div",{className:t,style:a},l.createElement(Fe,null),l.createElement(Pe,{ref:o},r))};Ze.defaultProps={data:[],labels:[],height:240,yAxisPadding:10,xAxisPadding:20,margin:{top:10,right:10,bottom:10,left:0},dynamicCircleRadius:4,stackedTooltip:!1};const He={barChartLinesGlobal:"barChartLinesGlobal",barChartLine:"barChartLine",barChartAreasGlobal:"barChartAreasGlobal",barChartArea:"barChartArea"};var Ue,_e;const Je=c({barChartBarGlobal:"barChartBarGlobal",barChartYScaleGlobal:"barChartYScaleGlobal",barChartYAxis:"barChartYAxis",barChartXAxis:"barChartXAxis",barChartYAxisZeroTick:"barChartYAxisZeroTick",barChartGridGlobal:"barChartGridGlobal",barChartGridLineX:"barChartGridLineX",barChartGridLineXZero:"barChartGridLineXZero",barChartGridLineYZero:"barChartGridLineYZero",barChartGridLineY:"barChartGridLineY",barChartSelection:"barChartSelection"},{barChartMouseRect:"barChartMouseRect",barChartMouseContainer:"barChartMouseContainer",barChartTooltipFlex:"barChartTooltipFlex",barChartMouseTooltip:"barChartMouseTooltip",barChartTooltip:"barChartTooltip",barChartTooltipItem:"barChartTooltipItem",barChartTooltipColFlex:"barChartTooltipColFlex",barChartTooltipGroupName:"barChartTooltipGroupName",barChartColorBox:"barChartColorBox",barChartColorLine:"barChartColorLine",barChartTooltipName:"barChartTooltipName",barChartTooltipValue:"barChartTooltipValue"},{barChartLabelContainer:"barChartLabelContainer",barChartLabelFlex:"barChartLabelFlex",barChartLabel:"barChartLabel"},He),Ke=r(p)(Ue||(Ue=u(["\n display: ",";\n user-select: ",";\n width: ",";\n\n line {\n stroke-width: 1px;\n shape-rendering: crispEdges;\n }\n\n .",",\n ."," {\n stroke: rgba(48, 69, 79, 0.06);\n }\n\n ."," {\n }\n\n ."," {\n fill: none;\n pointer-events: all;\n }\n\n ."," {\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n\n ."," {\n shape-rendering: auto;\n }\n\n ."," {\n fill-opacity: 0.24;\n }\n\n ."," {\n position: absolute;\n top: 0;\n width: 0;\n background: rgba(0, 170, 255, 0.06);\n box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;\n pointer-events: none;\n }\n"])),e=>{let{selectable:t}=e;return t&&"inline-block"},e=>{let{selectable:t}=e;return t&&"none"},e=>{let{selectable:t}=e;return t&&"auto"},Je.barChartGridLineX,Je.barChartGridLineY,Je.barChartMouseRect,Je.barChartMouseRect,Je.barChartLinesGlobal,Je.barChartLine,Je.barChartArea,Je.barChartSelection),Qe=a.createGlobalStyle(_e||(_e=u(["\n ."," {\n z-index: 100;\n transition: all linear 144ms;\n\n ."," {\n margin-bottom: 4px;\n :last-of-type {\n margin-bottom: 0;\n }\n }\n }\n"])),Je.barChartMouseTooltip,Je.barChartTooltipItem),$e=["groupName"],et=["groupName"],tt=["values"],at=["groupName"],rt=(e,t)=>{const{data:a,lineData:r=[],markers:n=[],barWidth:s,barPadding:u,colors:p,margin:h,xAxisPadding:m,yAxisPadding:g,drawGridY:f,drawGridX:x,customYScale:C,customXScale:y,customYAxisLeft:v,customXAxisBottom:L,customYAxis:T,customXAxis:S,customBars:k,customize:w,dynamicTooltipEnable:B,hideTooltipGroupName:M,renderTooltip:A,labelPosition:N,renderLabel:E,tooltipY:G,tooltipBind:z,stackedLine:Y,curve:R,formatTooltipValue:X,formatTooltipName:I,sectionPadding:P,minValuesLine:F,tooltipYDomain:D,marshalledMap:V,minValue:O,maxValue:j,minDomainValue:W,maxDomainValue:q,drawBars:Z,setTooltipPosition:H,onLabelItem:U,isBarTooltip:_,xScaleItemWidth:J,tooltipRoot:K,tooltipClassName:Q,onBarClick:$,onBarHover:ee}=t;if(null!==e&&a.length){const te=h?h.top:0,ae=h?h.right:0,re=h?h.bottom:0,ne=h?h.left:0,le=12,{width:oe}=e.getBoundingClientRect(),ie=t.width||oe,se=t.height||0,Te=(e=>{let{data:t,minDomainValue:a,maxDomainValue:r}=e,n=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return t.forEach(e=>{let t=d(e,$e),a=0,r=0;Object.keys(t).forEach(e=>{const n=t[e];let l=0,o=0;Object.keys(n).forEach(e=>{const t=n[e];t>0?l+=t:o+=t}),a=Math.min(a,o),r=Math.max(r,l)}),n=Math.min(n,a),l=Math.max(l,r)}),0===n&&0===l?{min:"number"==typeof a?a:0,max:"number"==typeof r?r:1}:{min:"number"==typeof a?a:n,max:"number"==typeof r?r:l}})({data:a,minDomainValue:W,maxDomainValue:q}),Se="number"==typeof O?O:Math.min(o.min(r,e=>{let{values:t}=e;return o.min(t)})||Number.POSITIVE_INFINITY,Te.min||0),ke="number"==typeof j?j:Math.max(o.max(r,e=>{let{values:t}=e;return o.max(t)})||Number.NEGATIVE_INFINITY,Te.max),we=b(e,ie,se||0),Be=6,Me=a.map(e=>e.groupName);let Ae=s||le;const Ne=o.scaleLinear().domain([Se,ke]).range([se-te-re-(m||0),te]).nice();C&&C(Ne);const Ee=Ne.ticks(),ze=o.axisLeft(Ne).ticks(Be);v&&v(ze);const Ye=ze.tickArguments()[0],Re=we.append("g").attr("class",Je.barChartYAxis).call(ze);Re.selectAll(".tick").attr("class",e=>0===e?"tick "+Je.barChartYAxisZeroTick:"tick"),T&&T(Re);const{width:Xe}=Ge(Re),Ie=[ne+Xe+(g||0),ie-ae],Pe=o.scaleBand().domain(o.range(a.length)).range(Ie);Ae=(e=>{let{data:t,range:a,barWidth:r,barPadding:n,sectionPadding:l}=e;const o="number"==typeof l?l:0,i=a[1]-a[0],s=t.reduce((e,t)=>{let a=d(t,at);return e+Object.keys(a).reduce((e,t,a)=>a>0?e+(r||0)+(n||0):e+r,0)+o},o);return i<s?Math.floor(r*(i/s)):r})({data:a,sectionPadding:P,range:Ie,barWidth:Ae,barPadding:u}),y&&y(Pe);const[Fe,De]=Pe.range(),Ve=o.axisBottom(Pe).tickFormat(e=>Me[Number(e)]);"number"==typeof J&&Ve.tickValues(Pe.domain().filter((e,t,a)=>{const r=Math.round((De-Fe)/J);return!(t%Math.round(a.length/r))})).tickSizeOuter(0),L&&L(Ve,{node:e,labels:Me});const Oe=we.append("g").call(Ve).attr("class",Je.barChartXAxis);S&&S(Oe);const je=(e=>{let{data:t,yScale:a,xScale:r,barWidth:n,barPadding:l,colors:o,marginTop:i}=e;return t.map((e,t)=>{let{groupName:s}=e,c=d(e,et);const u=[],p=r.bandwidth(),h=Object.keys(c);return h.forEach((e,r)=>{const d=c[e],m=Object.keys(d),b=(n+l)*h.length-(m.length>1?l:0);let g=0,f=0;m.forEach(e=>{const c=d[e],h=o[e],m=(n+l)*r+p/2-b/2,x=c>0,C=x?Math.abs(100*(a(g-c)-a(g)+Number.EPSILON)/100):Math.abs(100*(a(f-c)-a(f)+Number.EPSILON)/100);x&&(g+=c);const y=x?100*(a(g)+Number.EPSILON)/100:a(f)-a(0)+a(0);u.push({x:m,y:y+(i||0),height:C,color:h,value:c,groupName:s,name:e,stackIndex:r,groupIndex:t}),x||(f+=c)})}),u})})({data:a,yScale:Ne,xScale:Pe,barWidth:Ae,barPadding:"number"==typeof u?u:0,colors:p,marginTop:te}),We=V?V(je):je;Re.attr("transform","translate( "+(ne+Xe)+", 0)"),(e=>{let{svg:t,yScale:a,xScale:r,yTicksCount:n,drawGridX:l,drawGridY:o}=e;if(!o&&!l)return;const i=t.append("g").attr("class",Je.barChartGridGlobal),s=a.ticks(n),c=r.range(),d=r.domain();if(l&&i.append("g").selectAll("line").data(s).join("line").attr("class",e=>0===e?Je.barChartGridLineX+" "+Je.barChartGridLineXZero:Je.barChartGridLineX).attr("x1",()=>c[0]).attr("x2",()=>c[1]).attr("y1",e=>Math.round(a(e))).attr("y2",e=>Math.round(a(e))),o){const e=e=>void 0!==d[e]?0===e?c[0]:Math.round(r.step()*e+c[0]-r.step()/2*r.padding()):c[1];i.append("g").selectAll("line").data(Array.from({length:d.length+1},(e,t)=>t)).join("line").attr("class",e=>0===e?Je.barChartGridLineY+" "+Je.barChartGridLineYZero:Je.barChartGridLineY).attr("x1",e).attr("x2",e).attr("y1",()=>Math.round(a(s[0]))).attr("y2",()=>Math.round(a(s[s.length-1])))}})({svg:we,yScale:Ne,xScale:Pe,yTicksCount:Ye,drawGridY:f,drawGridX:x}),Oe.attr("transform","translate(0, "+(Ne(Ee[0])+(m||0))+")");const qe=we.append("g").attr("class",Je.barChartBarGlobal).selectAll("g").data(We).enter().append("g").attr("transform",(e,t)=>"translate("+Math.round(Pe(t))+","+-(te||0)+")"),Ze=Z?Z({groups:qe,yScale:Ne,marshalledData:We,barWidth:Ae}):(e=>{let{groups:t,barWidth:a}=e;return t.selectAll("rect").data(e=>e).join("rect").attr("x",e=>e.x).attr("y",e=>e.y).attr("width",a).attr("height",e=>e.height).style("fill",e=>e.color)})({groups:qe,barWidth:Ae});n.forEach(e=>{if(e){if(e.horizontal)return we.append("line").style("stroke",e.color||"inherit").style("stroke-width",1).style("stroke-dasharray","5, 3").attr("x1",ne+Xe).attr("y1",Ne(e.value)+1).attr("x2",ie).attr("y2",Ne(e.value)+1),void we.append("text").attr("y",Ne(e.value)+1).attr("x",ne+Xe).attr("text-anchor","middle").attr("class",["marker",e.className].filter(Boolean).join(" ")).style("fill",(null==e?void 0:e.color)||"inherit").text(e.label);we.append("line").style("stroke",e.color||"inherit").style("stroke-width",1).style("stroke-dasharray","5, 3").attr("x1",ie/a.length*e.value+1).attr("y1",0).attr("x2",ie/a.length*e.value+1).attr("y2",se-te-re+re/2),we.append("text").attr("y",se).attr("x",ie/a.length*e.value+1).attr("text-anchor","middle").attr("class",["marker",e.className].filter(Boolean).join(" ")).style("fill",(null==e?void 0:e.color)||"inherit").text(e.label)}});let Ue=null;Array.isArray(r)&&r.length>0&&(Ue=(e=>{let{svg:t,lineData:a,min:r,yScale:n,xScale:l,curve:i,stackedLine:s}=e,c=null,d=null,u=null;const p=o.line().defined(e=>null!==e).x((e,t)=>l(t)+h/2).y(e=>n(e)).curve(i||o.curveLinear),h=l.bandwidth(),m=a.filter(e=>{let{lineType:t}=e;return"line"===t}),b=a.filter(e=>{let{lineType:t}=e;return"area"===t});if(m.length>0&&(c=t.append("g").attr("class",He.barChartLinesGlobal).selectAll("path").data(m).join("path").attr("class",He.barChartLine).attr("d",e=>p(e.values)).attr("stroke",e=>{let{stroke:t}=e;return t||""}).attr("fill",e=>{let{fill:t}=e;return t||"none"})),b.length>0){let e=-2;u=o.area().x((e,t)=>l(t)+h/2).y0((t,l)=>(0===l&&(e+=1),n(s&&e>-1?"number"!=typeof a[e].values[l]?0:a[e].values[l]:r))).y1(e=>n(e)).curve(i||o.curveLinear),d=t.append("g").attr("class",He.barChartAreasGlobal).selectAll("path").data(b).join("path").attr("class",He.barChartArea).attr("d",e=>u&&u(e.values)).attr("fill",e=>{let{fill:t}=e;return t||"none"})}return{areasSelection:d,linesSelection:c,area:u}})({svg:we,lineData:r,xScale:Pe,yScale:Ne,min:"number"==typeof F?F:Se,stackedLine:Y,curve:R})),k&&k({bars:Ze,yScale:Ne,lines:Ue,marshalledData:We,lineData:r}),(B||N)&&(e=>{let{svg:t,node:a,data:r,marshalledData:n,xScale:s,yScale:u,renderTooltip:p,labelPosition:h,marginTop:m,renderLabel:b,barWidth:g,barPadding:f,dynamicTooltipEnable:x,hideTooltipGroupName:C,tooltipY:y,tooltipBind:v,lineData:L,formatTooltipValue:T,formatTooltipName:S,tooltipYDomain:k,setTooltipPosition:w,onLabelItem:B,isBarTooltip:M,bars:A,tooltipRoot:N,tooltipClassName:E,onBarClick:G,onBarHover:z}=e;o.select(a).select("."+Je.barChartMouseContainer).remove();const Y=s.domain(),[R,X]=s.range(),[I,P]=u.range(),F=s.bandwidth(),D=o.format(","),V=Y.map(e=>{return t=Number(e)+1,void 0!==Y[t]?0===t?R:Math.round(s.step()*t+R-s.step()/2*s.padding()):X;var t}),O=k?k({data:n,lineData:L,yScale:u}):n.reduce((e,t,a)=>{const r=o.min(L,e=>{let{values:t}=e;return"number"==typeof t[a]?u((t[a]||0)-P):Number.POSITIVE_INFINITY})||Number.POSITIVE_INFINITY;return e.push(t.reduce((e,t)=>{let{y:a}=t;return Math.min(e,a,r)},Number.POSITIVE_INFINITY)),e},[]),j=t.append("g").attr("class","lineChartMouseGlobal"),W=j.append("rect").attr("width",X-R).attr("height",Math.abs(I-P)).attr("class",Je.barChartMouseRect).attr("transform","translate("+R+", "+P+")");if(x){const e=N||document.querySelector("body");let u=o.select("."+Je.barChartMouseTooltip);0===u.size()&&(u=o.select(e).append("div").attr("class",Je.barChartMouseTooltip).style("opacity","0").style("position","absolute").html(()=>i.renderToString(l.createElement(ce,{className:Je.barChartTooltipFlex}))));const h=u.select("."+Je.barChartTooltipFlex);let m=!1,b=null;const f=e=>{m=Boolean(e),u.style("opacity",m?"1":"0"),m?(u.attr("class",Je.barChartMouseTooltip+" "+(E||"")),u.style("transition",null)):(u.attr("class",Je.barChartMouseTooltip),b=null,u.style("transition","none"),u.style("top",null),u.style("left",null))};W.on("mouseout.tooltip",()=>f()),W.on("touchmove.tooltip mousemove.tooltip",e=>{const[x,k]=o.pointer(e,document),[B]=o.pointer(e,W),[N,E]=o.pointer(e,a),G=B-(B-N),z=x-N,Y=k-E,R=V.findIndex(e=>G<=e);if(M){const t=document.elementsFromPoint(e.clientX,e.clientY),a=o.select(A.nodes()[R]).selectAll("rect").nodes();if(!t.some(e=>a.includes(e)))return m&&f(!1),void W.style("cursor","default");W.style("cursor","pointer")}const X=("number"==typeof y?y:O[R]-P)+Y,I=(v?(s(R)||0)+F/2:G)+z;if(v&&b===R)return;let j=n[R];if(Array.isArray(j)&&0===j.length)return;if(L){const e=L.map(e=>{let{values:t}=e;return c({},d(e,tt),{value:t[R],groupName:r[R]&&r[R].groupName})});Array.isArray(e)&&Array.isArray(j)&&(j=j.concat(e))}const q=t.node().getBoundingClientRect().width;"function"==typeof w?w({left:I,top:X,tooltip:u,svgWidth:q}):w||u.style("left",I+"px").style("top",X+"px"),p?h.html(()=>i.renderToString(l.createElement(l.Fragment,null,p(j,w?{left:I,top:X,tooltip:u,svgWidth:q}:void 0,g)))):(m||f(!0),h.html(()=>i.renderToString(l.createElement(pe,{className:Je.barChartTooltip},j&&j[0]&&!C&&l.createElement(he,{className:Je.barChartTooltipGroupName},j[0].groupName),j&&j.map(e=>{let{name:t,value:a,stroke:r,fill:n,color:o,lineType:i}=e;return l.createElement(me,{key:t,className:Je.barChartTooltipItem},l.createElement(be,{className:Je.barChartTooltipColFlex},i?l.createElement(fe,{className:Je.barChartColorLine,style:{backgroundColor:r||n}}):l.createElement(ge,{className:Je.barChartColorBox,style:{backgroundColor:o}}),l.createElement(xe,{className:Je.barChartTooltipName},S?S(t):t)),l.createElement(Ce,{className:Je.barChartTooltipValue},T?T(a,t):D(a)))}))))),b=R,m||f(!0)})}const q=o.select(a).append("div").attr("class",Je.barChartMouseContainer).append("div").attr("class",Je.barChartLabelContainer).style("position","absolute").style("top",P+"px"),Z=(e,t)=>{const[r,l]=o.pointer(e,W),[i,s]=o.pointer(e,a),c=r-(r-i),d=l-s,u=V.findIndex(e=>c<=e),p=n[u][0];p.height>=I-d&&t(p)};if(j.on("click",e=>Z(e,e=>G&&G(e))).on("mousemove",e=>Z(e,e=>z&&z(e))).on("mouseleave",()=>z&&z(void 0)),h){const e=L?n.map((e,t)=>e.concat(L.map(a=>{let{values:r,name:n,stroke:l}=a;const{stacksCount:o}=e.reduce((e,t)=>{let{stackIndex:a}=t;const{indexFlag:r,stacksCount:n}=e;return a!==r?{indexFlag:a,stacksCount:n+1}:e},{indexFlag:-1,stacksCount:0});return{x:e[0].x-g/2+(g*o+(f||0)*(o-1))/2,y:u(r[t])+m,height:0,color:l,value:r[t],groupName:e[0].groupName,name:n,stackIndex:0,groupIndex:t}}))):n,t=q.selectAll("div").data(e).enter().append("div").style("position","absolute").style("transform",(e,t)=>"translate("+Math.round(s(t))+"px,"+-(m||0)+"px)"),a="center"===h?ue:de,r=(e=>{switch(e){case"top":return ve;case"bottom":return Le;default:return ye}})(h);t.selectAll("span").data(e=>B?B(e):e).join("div").style("left",e=>Math.round(e.x+g/2)+"px").style("top",e=>((e,t,a)=>{switch(e){case"center":return a.y+a.height/2-t;case"bottom":return a.y+a.height-t;default:return a.y}})(h,P,e)+"px").style("position","absolute").html(e=>i.renderToString(l.createElement(a,{className:Je.barChartLabelFlex},b?b(c({},e,{barWidth:g})):l.createElement(r,{className:Je.barChartLabel},D(e.value)))))}})({svg:we,node:e,xScale:Pe,yScale:Ne,marshalledData:We,data:a,lineData:r,renderTooltip:A,labelPosition:N,marginTop:te,renderLabel:E,barWidth:Ae,barPadding:u,dynamicTooltipEnable:B,hideTooltipGroupName:M,tooltipY:G,tooltipBind:z,formatTooltipValue:X,formatTooltipName:I,tooltipYDomain:D,setTooltipPosition:H,onLabelItem:U,isBarTooltip:_,bars:qe,tooltipRoot:K,tooltipClassName:Q,onBarClick:$,onBarHover:ee}),w&&w({svg:we,marshalledData:We,yScale:Ne,xScale:Pe,lineData:r})}},nt=e=>{const{className:t,style:a,children:r,selectable:o}=e,[i,s]=h();return n.useEffect(()=>{s&&rt(s,e)},[s,e]),m(e.width,()=>rt(s,e)),((e,t)=>{const a=n.useRef(!1),r=n.useRef(0),l=n.useRef(),o=n.useCallback(n=>{const o=Boolean(n.touches);var i,s,c;n.stopPropagation(),e&&3!==n.which&&(l.current=document.createElement("div"),l.current.setAttribute("class",Je.barChartSelection),l.current.setAttribute("style","height: calc(100% - "+(null!=(i=null==(s=t.margin)?void 0:s.bottom)?i:0)+"px)"),e.appendChild(l.current),a.current=!0,r.current=o?(null==(c=n.touches[0])?void 0:c.pageX)-e.firstChild.getBoundingClientRect().left:n.offsetX,l.current.style.display="block",l.current.style.width="0px",l.current.style.left=r.current+"px")},[e]),i=n.useCallback(t=>{const n=Boolean(t.touches);if(t.stopPropagation(),e&&a.current&&l.current){var o;const a=e.firstChild.getBoundingClientRect().width,i=n?(null==(o=t.touches[0])?void 0:o.pageX)-e.firstChild.getBoundingClientRect().left:t.offsetX,s=i-r.current;i>=0&&(s>0?(l.current.style.marginLeft="0px",l.current.style.width=i<=a?s+"px":a-r.current+"px"):(l.current.style.right=a-r.current+"px",l.current.style.width=Math.abs(s)+"px",l.current.style.marginLeft=s+"px")),n&&e.offsetLeft>t.touches[0].pageX&&(l.current.style.right=a-r.current+"px",l.current.style.width=r.current+"px",l.current.style.marginLeft="-"+r.current+"px")}},[e]),s=n.useCallback(t=>{if(a.current&&e&&l.current){if(e.offsetLeft>t.pageX){const t=e.firstChild.getBoundingClientRect().width;l.current.style.right=t-r.current+"px",l.current.style.width=r.current+"px",l.current.style.marginLeft="-"+r.current+"px"}if(e.offsetLeft+e.offsetWidth<t.pageX){const t=e.firstChild.getBoundingClientRect().width;l.current.style.left=r.current+"px",l.current.style.width=t-r.current+"px",l.current.style.marginLeft="0px"}}},[e]),c=n.useCallback(()=>{if(e&&l.current){const r=e.firstChild.getBoundingClientRect().width,n=l.current.offsetLeft>=0?l.current.offsetLeft<=r?l.current.offsetLeft:r:0,o=l.current.getBoundingClientRect().right-l.current.getBoundingClientRect().left,i=l.current.offsetLeft+o<=r?l.current.offsetLeft+o>=0?l.current.offsetLeft+o:0:r,s=Math.round(n),c=Math.round(i);c-s>0&&t.onSelect&&t.onSelect([s,c]),a.current=!1,e.removeChild(l.current),l.current=void 0}},[e]);n.useEffect(()=>(e&&(e.childNodes.forEach(e=>{e.style.userSelect="none"}),e.addEventListener("mousedown",o),e.addEventListener("touchstart",o),e.addEventListener("mousemove",i),e.addEventListener("touchmove",i),e.addEventListener("mouseleave",s),e.addEventListener("mouseup",c),e.addEventListener("touchend",c),document.addEventListener("mouseup",c)),()=>{null==e||e.removeEventListener("mousedown",o),null==e||e.removeEventListener("touchstart",o),null==e||e.removeEventListener("mousemove",i),null==e||e.removeEventListener("touchmove",i),null==e||e.removeEventListener("mouseleave",s),null==e||e.removeEventListener("mouseup",c),null==e||e.removeEventListener("touchend",c),document.removeEventListener("mouseup",c)}),[e])})(o?s:null,e),l.createElement("div",{className:t,style:a},l.createElement(Qe,null),l.createElement(Ke,{ref:i,selectable:o},r))};nt.defaultProps={data:[],colors:{},margin:{top:10,right:10,bottom:10,left:0},barWidth:12,barPadding:0,height:320,yAxisPadding:0,xAxisPadding:0,tooltipBind:!0,sectionPadding:1};const lt=["value"];var ot,it,st,ct,dt,ut,pt,ht;const mt={horizontalBarChartButtonTd:"horizontalBarChartButtonTd",horizontalBarChartLabelTd:"horizontalBarChartLabelTd",horizontalBarChartLabelCell:"horizontalBarChartLabelCell",horizontalBarChartBarTd:"horizontalBarChartBarTd",horizontalBarChartBarFlex:"horizontalBarChartBarFlex",horizontalBarChartBar:"horizontalBarChartBar",horizontalBarChartBarFirst:"horizontalBarChartBarFirst",horizontalBarChartBarLast:"horizontalBarChartBarLast",horizontalBarChartBarOnly:"horizontalBarChartBarOnly",horizontalBarChartTooltipFlex:"horizontalBarChartTooltipFlex",horizontalBarChartStackWrapper:"horizontalBarChartStackWrapper",horizontalBarChartTooltipContainer:"horizontalBarChartTooltipContainer",horizontalBarChartStackSumContainer:"horizontalBarChartStackSumContainer",horizontalBarChartStackSum:"horizontalBarChartStackSum",horizontalBarChartXScaleTd:"horizontalBarChartXScaleTd",horizontalBarChartXScaleTicks:"horizontalBarChartXScaleTicks",horizontalBarChartXScaleTick:"horizontalBarChartXScaleTick",horizontalBarChartTooltipItem:"horizontalBarChartTooltipItem",horizontalBarChartTooltipName:"horizontalBarChartTooltipName",horizontalBarChartTooltipValue:"horizontalBarChartTooltipValue"},bt=r.table(ot||(ot=u(["\n width: 100%;\n"]))),gt=r.div(it||(it=u(["\n text-align: right;\n"]))),ft=r.div(st||(st=u(["\n width: 100%;\n display: flex;\n height: 1rem;\n"]))),xt=r.td(ct||(ct=u(["\n width: 100%;\n position: relative;\n vertical-align: middle;\n"]))),Ct=r(ce)(dt||(dt=u(["\n position: absolute;\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n will-change: left, top;\n"]))),yt=r.div(ut||(ut=u(["\n position: relative;\n"]))),vt=r.div(pt||(pt=u(["\n white-space: nowrap;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(0, -50%);\n"]))),Lt=r.div(ht||(ht=u(["\n position: absolute;\n top: 0;\n display: flex;\n justify-content: flex-start;\n height: 100%;\n"]))),Tt=e=>{let{renderTooltip:t,bars:a,style:r,className:n}=e;const i=o.format(",");return l.createElement(Ct,{className:mt.horizontalBarChartTooltipFlex+" "+(n||""),style:r},l.createElement(pe,{className:mt.horizontalBarChartTooltipContainer},t?t(a):a.map((e,t)=>{let{color:a,name:r,value:n,groupName:o}=e;return l.createElement(me,{key:(r||"")+"-"+t+"-"+o,className:mt.horizontalBarChartTooltipItem},a&&l.createElement(ge,{style:{backgroundColor:a}}),r&&l.createElement(xe,{className:mt.horizontalBarChartTooltipName},r),l.createElement(Ce,{className:mt.horizontalBarChartTooltipValue},i(n)))})))},St=document.createElement("div"),kt=["item","mouseMove","mouseLeave","tooltipBind"];var wt;const Bt=r.div(wt||(wt=u(["\n position: relative;\n display: inline-flex;\n height: 100%;\n"]))),Mt=e=>{let{withTooltip:t,bar:a,formatNativeTitle:r,tooltipBind:n,mouseMove:o,mouseLeave:i,pointerEventsNone:s,isFirstChild:c,isLastChild:d,isOnlyChild:u}=e;const{color:p,width:h}=a,m=Math.abs(h),b=t?e=>o(e,[a]):void 0,g=t?()=>i():void 0;return l.createElement(Bt,{className:mt.horizontalBarChartBar+" "+(c?mt.horizontalBarChartBarFirst:"")+" "+(d?mt.horizontalBarChartBarLast:"")+" "+(u?mt.horizontalBarChartBarOnly:""),style:{width:m+"%",backgroundColor:p,pointerEvents:s?"none":"auto"},title:r?r(a):"",onMouseOver:b,onMouseMove:n?b:void 0,onMouseOut:g})};var At,Nt,Et;const Gt=r.td(At||(At=u(["\n position: relative;\n"]))),zt=r.div(Nt||(Nt=u(["\n position: relative;\n height: 1rem;\n"]))),Yt=r.div(Et||(Et=u(["\n white-space: nowrap;\n width: 0;\n height: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n"]))),Rt=e=>{let{maxValue:t,scaleTicks:a,renderTicks:r,scaleDomain:i}=e;const s=(e=>{let{maxValue:t,scaleTicks:a,scaleDomain:r}=e;return n.useMemo(()=>{const e=o.scaleLinear().domain([0,t]).range([0,100]),n=e.ticks(a);return(r||n).map(t=>({value:t,x:e(t)}))},[t,a,r])})({maxValue:t,scaleTicks:a,scaleDomain:i}),c=o.format(",");return l.createElement("tr",null,l.createElement("td",null),l.createElement(Gt,{className:mt.horizontalBarChartXScaleTd},l.createElement(zt,{className:mt.horizontalBarChartXScaleTicks},s.map((e,t,a)=>{const{value:n,x:o}=e;return l.createElement(Yt,{key:n,className:mt.horizontalBarChartXScaleTick,style:{left:o+"%",justifyContent:0===t?"flex-start":t===a.length-1?"flex-end":""}},r?r(e):c(n))}))))},Xt=e=>{let{data:t,className:a,style:r,children:i,labels:u,fullExtent:p,maxValue:h,formatNativeTitle:m,renderTooltip:b,withTooltip:g,withStackSum:f,tooltipBind:x,scaleTicks:C,renderTicks:y,renderButton:v,tooltipStyle:L,tooltipClassName:T,scaleDomain:S,renderDataTable:k,thead:w,withoutXScale:B,stackedTooltip:M,fullChartTooltip:A,hideTooltip:N}=e;const{fullMax:E,data:G}=(e=>{let{data:t,fullExtent:a,maxValue:r,labels:l}=e;return n.useMemo(()=>{const e=o.max(t,e=>o.sum(e,e=>{let{value:t}=e;return t})),n=o.scaleLinear().domain([0,"number"==typeof r?r:e]).range([0,100]);return{fullMax:e,data:t.map((e,t)=>(a||n.domain([0,"number"==typeof r?r:o.sum(e,e=>{let{value:t}=e;return t})]),e.map(e=>{let{value:a}=e;return c({},d(e,lt),{value:a,width:n(a),groupName:l?l[t]:""})})))}},[t,a,r,l])})({data:t,fullExtent:p,maxValue:h,labels:u}),[z,Y]=(e=>{let{renderTooltip:t,tooltipBind:a,tooltipStyle:r,tooltipRoot:i,tooltipClassName:d,hideTooltip:u}=e;return n.useEffect(()=>{const e=i||document.querySelector("body");return e&&e.appendChild(St),()=>{s.unmountComponentAtNode(St)}},[i]),[n.useCallback((e,n)=>{let[i,u]=o.pointer(e,document);if(!a&&"getBoundingClientRect"in e.target){const{width:t,height:a}=e.target.getBoundingClientRect(),[r,n]=o.pointer(e,e.target);i=i-r+t/2,u=u-n+a/2}St&&(St.style.visibility="visible"),s.render(l.createElement(Tt,{style:c({left:i,top:u},r),bars:n,renderTooltip:t,className:d}),St)},[d,r,t,a]),n.useCallback(()=>{St&&(St.style.visibility="hidden",u&&u())},[u])]})({renderTooltip:b,tooltipBind:x,tooltipStyle:L,tooltipClassName:T,hideTooltip:N}),R=(e=>n.useMemo(()=>e?e=>{let{item:t,mouseMove:a,mouseLeave:r,tooltipBind:n}=e,o=d(e,kt);return l.createElement(Lt,Object.assign({className:mt.horizontalBarChartStackWrapper,onMouseOver:e=>a(e,t),onMouseMove:n?e=>a(e,t):void 0,onMouseOut:r},o))}:e=>{let{children:t}=e;return l.createElement(n.Fragment,null,t)},[e]))(M);return l.createElement(bt,{className:a,style:r,onMouseOver:A?e=>z(e,G.flat()):void 0,onMouseMove:A?e=>z(e,G.flat()):void 0,onMouseOut:A?Y:void 0},w,l.createElement("tbody",null,G.map((e,t)=>{const a=(f||k)&&o.sum(e,e=>{let{value:t}=e;return t}),r=o.sum(e,e=>{let{width:t}=e;return t});return l.createElement("tr",{key:"row-"+t},"function"==typeof v&&l.createElement("td",{className:mt.horizontalBarChartButtonTd},v(e,t)),l.createElement("td",{className:mt.horizontalBarChartLabelTd},u&&u[t]&&l.createElement(gt,{className:mt.horizontalBarChartLabelCell},u[t])),l.createElement(xt,{className:mt.horizontalBarChartBarTd,style:{pointerEvents:A?"none":"auto"}},l.createElement(ft,{className:mt.horizontalBarChartBarFlex,style:{pointerEvents:A?"none":"auto"}},l.createElement(R,{style:M?{width:r+"%"}:void 0,item:e,tooltipBind:x,mouseMove:z,mouseLeave:Y}),e.map((e,t,a)=>0!==e.value&&l.createElement(Mt,{key:"bar-"+(e.name||"")+"-"+t,formatNativeTitle:m,bar:e,tooltipBind:x,pointerEventsNone:M||A,withTooltip:g&&!M,mouseMove:z,mouseLeave:Y,isOnlyChild:1===a.length,isFirstChild:0===t&&a.length>1,isLastChild:a.length-1===t&&a.length>1})),f&&l.createElement(yt,{className:mt.horizontalBarChartStackSumContainer},l.createElement(vt,{className:mt.horizontalBarChartStackSum},a)))),k&&k(e,a,t))}),!B&&l.createElement(Rt,{maxValue:"number"==typeof h?h:E,scaleTicks:C,renderTicks:y,scaleDomain:S}),i))};Xt.defaultProps={fullExtent:!0,withTooltip:!1,withStackSum:!1,tooltipBind:!1,scaleTicks:4,withoutXScale:!1};const It={height:280,minSize:6,maxSize:30,margin:{top:10,right:15,bottom:10,left:0},yAxisPadding:10,xAxisPadding:10,yScaleLabelPadding:10};var Pt,Ft;const Dt={bubbleChartYAxis:"bubbleChartYAxis",bubbleChartYAxisZeroTick:"bubbleChartYAxisZeroTick",bubbleChartXAxis:"bubbleChartXAxis",bubbleChartGridGlobal:"bubbleChartGridGlobal",bubbleChartGridLineX:"bubbleChartGridLineX",bubbleChartGridLineY:"bubbleChartGridLineY",bubbleChartCircle:"bubbleChartCircle",bubbleChartYScaleLabel:"bubbleChartYScaleLabel",bubbleChartTooltip:"bubbleChartTooltip",bubbleChartTooltipContainer:"bubbleChartTooltipContainer",bubbleChartTooltipFlex:"bubbleChartTooltipFlex",bubbleChartTip:"bubbleChartTip"},Vt=r(p)(Pt||(Pt=u(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n\n ."," {\n font-size: 10px;\n }\n"])),Dt.bubbleChartYAxis,Dt.bubbleChartXAxis,Dt.bubbleChartGridGlobal,Dt.bubbleChartGridLineX,Dt.bubbleChartGridLineY,Dt.bubbleChartYScaleLabel),Ot=a.createGlobalStyle(Ft||(Ft=u(["\n ."," {\n position: absolute;\n transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);\n pointer-events: none;\n z-index: 1;\n }\n"])),Dt.bubbleChartTooltipContainer);var jt;const Wt=r.div(jt||(jt=u(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),qt=(e,t)=>{const{data:a,margin:r,xAxisPadding:n,yAxisPadding:s,customYScale:c,customYAxis:d,customXScale:u,customXAxis:p,minSize:h,maxSize:m,minYValue:g,maxYValue:f,drawGridY:x,drawGridX:C,scaleLog:y,xScaleItemWidth:v,bubbleStyle:L,customize:T,yScaleLabel:S,yScaleLabelPadding:k,enableTooltip:w,tooltipRoot:B,tooltipClassName:M,renderTooltip:A}=t;if(null!==e&&a.length){const N=r?r.top:0,E=r?r.right:0,G=r?r.bottom:0,z=r?r.left:0,{width:Y}=e.getBoundingClientRect(),R=t.width||Y,X=t.height||0,I=6,P="number"==typeof g?g:o.min(a,e=>{let{yValue:t}=e;return t}),F="number"==typeof f?f:o.max(a,e=>{let{yValue:t}=e;return t}),D=b(e,R,X||0),V=y?o.scaleLog().domain([o.min(a,e=>{let{sizeValue:t}=e;return t})||.1,o.max(a,e=>{let{sizeValue:t}=e;return t})||.1]).range([h||It.minSize||.1,m||It.maxSize||.1]):o.scaleLinear().domain([o.min(a,e=>{let{sizeValue:t}=e;return t}),o.max(a,e=>{let{sizeValue:t}=e;return t})]).range([h||It.minSize,m||It.maxSize]),O=X-N-G-(n||0),j=y?o.scaleLog().domain([P||.1,F||.1]).range([O||.1,N||.1]).nice():o.scaleLinear().domain([P,F]).range([O,N]).nice();c&&c(j);const W=j.ticks(),q=o.axisLeft(j).ticks(I),Z=q.tickArguments()[0],H=D.append("g").attr("class",Dt.bubbleChartYAxis).call(q);let U=k||0;if(S){const e=D.append("text").text(S).attr("class",Dt.bubbleChartYScaleLabel),{width:t,height:a}=Ge(e);U+=a,e.attr("transform","rotate(-90) translate(-"+(O+G+t)/2+", "+a+")")}H.selectAll(".tick").attr("class",e=>0===e?"tick "+Dt.bubbleChartYAxisZeroTick:"tick"),d&&d(H);const{width:_}=Ge(H),J=y?o.scaleLog().domain([o.min(a,e=>{let{xValue:t}=e;return t})||.1,o.max(a,e=>{let{xValue:t}=e;return t})||.1]).range([z+_+(s||0)+U||.1,R-E||.1]):o.scaleLinear().domain([o.min(a,e=>{let{xValue:t}=e;return t}),o.max(a,e=>{let{xValue:t}=e;return t})]).range([z+_+(s||0)+U,R-E]);u&&u(J);const K=o.axisBottom(J);if("number"==typeof v){const[e,t]=J.range();K.ticks(Math.round((t-e)/v)).tickSizeOuter(0)}const Q=D.append("g").call(K).attr("class",Dt.bubbleChartXAxis);p&&p(Q),H.attr("transform","translate("+(z+_+U)+", 0)"),(e=>{let{svg:t,yScale:a,xScale:r,yTicksCount:n,drawGridX:l,drawGridY:o}=e;if(!o&&!l)return;const[i,s]=r.domain(),c=t.append("g").attr("class",Dt.bubbleChartGridGlobal),d=a.ticks(n);l&&c.append("g").selectAll("line").data(d).join("line").attr("class",Dt.bubbleChartGridLineX).attr("x1",()=>r(i)).attr("x2",()=>r(s)).attr("y1",e=>Math.round(a(e))).attr("y2",e=>Math.round(a(e))),o&&c.append("g").selectAll("line").data(r.ticks(n)).join("line").attr("class",Dt.bubbleChartGridLineY).attr("x1",e=>Math.round(r(e))).attr("x2",e=>Math.round(r(e))).attr("y1",()=>Math.round(a(d[0]))).attr("y2",()=>Math.round(a(d[d.length-1])))})({svg:D,yScale:j,xScale:J,yTicksCount:Z,drawGridY:x,drawGridX:C}),Q.attr("transform","translate(0, "+(j(W[0])+(n||0))+")");const $=D.append("g").selectAll("dot").data(a).enter().append("circle").attr("class",Dt.bubbleChartCircle).attr("cx",e=>{let{xValue:t}=e;return J(t)}).attr("cy",e=>{let{yValue:t}=e;return j(t)}).attr("r",e=>{let{sizeValue:t}=e;return V(t)/2}).attr("fill",e=>{let{color:t}=e;return t||"rgba(0, 176, 113, 0.6)"}).attr("stroke",e=>{let{stroke:t}=e;return t||"transparent"}).attr("style",e=>{let{style:t}=e;return t||L||""});w&&(e=>{let{bubbles:t,tooltipRoot:a,tooltipClassName:r,renderTooltip:n}=e;const s=a||document.querySelector("body"),c=o.format(",");let d=o.select(s).select("."+Dt.bubbleChartTooltip);null===d.node()&&(d=o.select(s).append("div").attr("class",Dt.bubbleChartTooltip));let u=d.append("div").attr("class",Dt.bubbleChartTooltipContainer+" "+(r||"")).style("opacity","0");t.on("mouseover.tooltip",(e,t)=>{const{sizeValue:a}=t,r=e.currentTarget,{x:o,y:s,width:d}=r.getBoundingClientRect(),p=window.pageXOffset+o+d/2,h=window.pageYOffset+s;u.style("left",p+"px").style("top",h+"px").html(()=>i.renderToString(l.createElement(Wt,{className:Dt.bubbleChartTooltipFlex},l.createElement(pe,{className:Dt.bubbleChartTip},c(a))))),n&&n({tooltip:u,data:t,circle:r}),u.style("opacity","1")}),t.on("mouseout.tooltip",()=>{u.style("opacity","0")})})({bubbles:$,tooltipRoot:B,tooltipClassName:M,renderTooltip:A}),T&&T({svg:D,bubbles:$,yScale:j,xScale:J,sizeScale:V})}},Zt=e=>{const{className:t,style:a,children:r,tooltipRoot:i}=e,[s,c]=h();return n.useEffect(()=>{c&&qt(c,e)},[c,e]),n.useEffect(()=>()=>(e=>{const t=e||document.querySelector("body");o.select(t).select("."+Dt.bubbleChartTooltip).remove()})(i),[i]),m(e.width,()=>qt(c,e)),l.createElement("div",{className:t,style:a},l.createElement(Ot,null),l.createElement(Vt,{ref:s},r))};Zt.defaultProps=It,exports.BarChart=nt,exports.BubbleChart=Zt,exports.CalendarChart=Ee,exports.ChartWrapper=p,exports.HorizontalBarChart=Xt,exports.LineChart=Ze,exports.PieChart=Se,exports.RadarChart=O,exports.SwipeScroll=L,exports.appendSvg=b,exports.barChartClassNames=Je,exports.bubbleChartClassNames=Dt,exports.calendarChartClassNames=Ae,exports.horizontalBarChartClassNames=mt,exports.lineChartClassNames=Ie,exports.pieChartclassNames=q,exports.radarChartclassNames=F,exports.useNode=h,exports.useResize=m;
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,a=require("styled-components"),r=e(a),n=require("react"),l=e(n),o=require("d3"),i=e(require("react-dom/server")),s=require("react-dom");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var a,r,n={},l=Object.keys(e);for(r=0;r<l.length;r++)t.indexOf(a=l[r])>=0||(n[a]=e[a]);return n}function u(e,t){return t||(t=e.slice(0)),e.raw=t,e}const p=r.div(t||(t=u(["\n position: relative;\n width: 100%;\n box-sizing: border-box;\n"])));function h(){const[e,t]=n.useState(null);return[n.useCallback(t,[t]),e]}const m=(e,t,a)=>{const r=n.useMemo(()=>t?function(e,t){let a=!1;return function(){a||(e(...arguments),a=!0,setTimeout((function(){a=!1}),t))}}(t,a||44):void 0,[t,a]);n.useEffect(()=>(r&&"number"!=typeof e&&window.addEventListener("resize",r),()=>r&&window.removeEventListener("resize",r)),[e,r])},b=(e,t,a)=>(o.select(e).select("svg").remove(),o.select(e).append("svg").attr("width",t).attr("height",a));var g;const f=r.div(g||(g=u(["\n width: 100%;\n overflow: hidden;\n user-select: none;\n"]))),x=e=>e*(2-e),C=(e,t,a)=>Math.min(Math.max(e,t),a),y={animation:0,speed:0,timestamp:0,startX:0,currentX:0},v=["children","width","onSwipe"],L=e=>{let{children:t,width:a,onSwipe:r}=e,i=d(e,v);const[s,u]=h();return((e,t)=>{let{width:a,duration:r,animationFunc:l,onSwipe:i}=t;const s=o.select(e),c=o.select("body"),d=o.select(document),u=n.useRef(y);n.useEffect(()=>{a&&u.current.animation&&(cancelAnimationFrame(u.current.animation),u.current=y)},[a]);const p=n.useCallback(t=>{const{width:r}=e?e.getBoundingClientRect():{width:0},[n]=o.pointer(t.type.includes("touch")?t.touches[0]:t),l=C(n-u.current.startX,-(a-r),0);if(s.style("transform","translateX("+l+"px)"),u.current.currentX){const e=100,t=Date.now(),a=Math.round((l-u.current.currentX)/(t-u.current.timestamp)*e);u.current.speed=a,u.current.timestamp=t}u.current.currentX=l,i&&i(l,s)},[i,a,e,s]),h=n.useCallback(()=>{const{width:t}=e?e.getBoundingClientRect():{width:0};d.on("mousemove.swipe touchmove.swipe mouseup.swipe touchend.swipe",null),c.style("cursor",null),s.style("cursor",a>t?"grab":null),Date.now()-u.current.timestamp<44&&function(e){let{duration:t,timing:a,draw:r}=e;const n=performance.now();let l;requestAnimationFrame((function e(o){let i=(o-n)/t;i<1&&(l=requestAnimationFrame(e)),i>1&&cancelAnimationFrame(l);const s=a(i);r(s,l)}))}({duration:r,timing:l||x,draw:(e,r)=>{u.current.animation=r;const n=Math.round(2*u.current.speed*e),l=u.current.currentX+n,o=a-t,c=C(l,-o,0),d=Math.max(Math.min(l,o),0);u.current.currentX!==d&&(s.style("transform","translateX("+c+"px)"),i&&i(c,s))}})},[c,l,i,s,r,e,a,d]),m=n.useCallback(t=>{const a=t.type.includes("touch"),[r]=o.pointer(a?t.touches[0]:t,e),{left:n}=e&&e.parentElement?e.parentElement.getBoundingClientRect():{left:0};c.style("cursor","grabbing"),s.style("cursor","grabbing"),u.current.animation&&(cancelAnimationFrame(u.current.animation),u.current=y),u.current.startX=Math.max(r+n,0),d.on("mousemove.swipe touchmove.swipe",p),d.on("mouseup.swipe touchend.swipe",h)},[s,c,e,h,p,d]);n.useEffect(()=>{if(e){const{width:t}=e.getBoundingClientRect();a>t&&(s.style("cursor","grab"),s.on("mousedown.swipe touchstart.swipe",m))}},[s,m,e,a])})(u,c({width:a,onSwipe:r},i)),l.createElement(f,Object.assign({},i),l.createElement("div",{ref:s},t))};var T;L.defaultProps={duration:1400};const k=e=>{let{anchor:t,index:a,translateX:r,translateY:n}=e;return 0===a&&"middle"===t?"translate(calc(-50% + "+r+"px), calc(-100% + "+n+"px))":"middle"===t?"translate(calc(-50% + "+r+"px), calc("+n+"px))":"start"===t?"translate(calc("+r+"px), calc(-50% + "+n+"px))":"end"===t?"translate(calc(-100% + "+r+"px), calc(-50% + "+n+"px))":"translate("+r+"px, "+n+"px)"},S=r.div.attrs(e=>({style:{transform:k(e)}}))(T||(T=u(["\n position: absolute;\n"])));var w,B,M,A,N,E;const G=r.div(w||(w=u(["\n display: flex;\n align-items: center;\n font-size: 12px;\n"]))),z=r.div(B||(B=u(["\n text-align: center;\n max-width: 120px;\n"]))),Y=a.css(M||(M=u(["\n position: absolute;\n top: 50%;\n right: 0;\n transform: translate(calc(100% + 6px), -50%);\n"]))),R=r.div(A||(A=u(["\n display: flex;\n align-items: center;\n padding: 2px 4px;\n border-radius: 4px;\n color: rgb(255, 255, 255);\n background-color: rgb(144, 197, 61);\n margin-left: 8px;\n"]))),X=r(R)(N||(N=u(["\n ","\n"])),Y),I=r.div(E||(E=u(["\n margin-left: 4px;\n font-size: 10px;\n color: rgba(255, 255, 255, 0.54);\n"])));var P;const F={radar:"radar",radarAxis:"radarAxis",radarAxisTextGlobal:"radarAxisTextGlobal",radarAxisText:"radarAxisText",radarPolygon:"radarPolygon",radarLabel:"radarLabel",radarLabelName:"radarLabelName",radarLabelBadge:"radarLabelBadge",radarLabelBadgePrefix:"radarLabelBadgePrefix",radarCircle:"radarCircle"},D=r(p)(P||(P=u(["\n ."," {\n path,\n line,\n circle {\n fill: none;\n stroke-width: 1px;\n stroke: rgba(149, 149, 149, 0.18);\n }\n }\n ."," {\n font-size: 12px;\n fill-opacity: 0.56;\n }\n ."," {\n fill-opacity: 0.06;\n stroke-width: 2px;\n fill: rgb(144, 197, 61);\n stroke: rgb(144, 197, 61);\n }\n ."," {\n fill: rgb(144, 197, 61);\n }\n"])),F.radarAxis,F.radarAxisText,F.radarPolygon,F.radarCircle),V=(e,t)=>{const{data:a,curve:r,polar:n,formatValue:s,badgePrefix:d,labelOffset:u,circleRadius:p,svgElements:h,renderLabel:m,customize:g,formatAxisValue:f,radarStyles:x,labelIndex:C,selectLabel:y}=t;if(null!==e&&a.length){const v=10,L="number"==typeof t.bleedLength?t.bleedLength:v,{width:T}=e.getBoundingClientRect(),k=t.width||T,w=400,B=t.height||w,M=t.minValue||Math.min(0,o.min(a,e=>o.min(e.map(e=>{let{value:t}=e;return t})))),A=(t.maxValue||Math.max(0,o.max(a,e=>o.max(e.map(e=>{let{value:t}=e;return t})))))-M,N=t.paddingY||0,E=Math.min((k-2*(t.paddingX||0)-2*L)/2,(B-2*N-2*L)/2),Y=4,P=o.scaleLinear().domain([0,A||1]).range([]).ticks(t.levels||Y),D=P[P.length-1],V=D+(P[1]-P[0]);D<A&&P.push(V);const O=t.levels||P.length-1,j=P[P.length-1],W=2*Math.PI/a[0].length,q=o.scaleLinear().range([0,E]).domain([0,j]),Z=o.lineRadial().curve(o.curveLinearClosed).radius(e=>{let{value:t}=e;return q(t)}).angle((e,t)=>t*W),H=o.lineRadial().curve(r||o.curveLinearClosed).radius(e=>{let{value:t}=e;return q(t)}).angle((e,t)=>t*W),U=b(e,k,B),_=U.append("g"),J=o.range(1,O+1).reverse(),K=e=>-e*E/O,Q=e=>j*e/O,$=_.append("g").attr("class",F.radarAxis).selectAll().data([a[0]]).enter(),ee=_.append("g").attr("class",F.radar),te=$.selectAll().data(a[0].map(e=>{let{name:t}=e;return t})).enter();let ae=0;n?J.forEach(e=>{const t=$.append("circle").attr("cx",0).attr("cy",0).attr("r",()=>E/O*e).node().getBoundingClientRect().height;ae=Math.max(ae,t)}):J.map(Q).forEach(e=>{const t=$.append("path").attr("d",()=>Z(Array.from({length:a[0].length},()=>({value:e})))).node().getBoundingClientRect().height;ae=Math.max(ae,t)});const re=q(j)+L;te.append("line").attr("x1",0).attr("y1",0).attr("x2",(e,t)=>Math.round(re*Math.cos(W*t-Math.PI/2))).attr("y2",(e,t)=>Math.round(re*Math.sin(W*t-Math.PI/2))),ee.selectAll("path").data(a).join("path").attr("class",F.radarPolygon).attr("style",(e,t)=>(null==x?void 0:x[t])||"").attr("d",e=>H(e.map(e=>c({},e,{value:e.value-M}))));const ne=o.format(",");_.append("g").attr("class",F.radarAxisTextGlobal).selectAll("text").data(J).enter().append("text").attr("class",F.radarAxisText).attr("x","4").attr("y",K).attr("dy",0).attr("dominant-baseline","central").text((e,t)=>{const a=Q(e)+M;return f?f(a,t):ne(a)}),p&&a.forEach(e=>{const t=_.append("g").attr("class",F.radarCircle);e.forEach((e,a)=>{let{value:r}=e;t.append("circle").attr("cx",Math.round(q(r)*Math.cos(W*a-Math.PI/2))).attr("cy",Math.round(q(r*Math.sin(W*a-Math.PI/2)))).attr("r",p)})});const le=8,oe=B-L-N,ie=k/2,se=oe/2+(oe-ae)/2,ce=L+(u||le);if(_.attr("transform","translate("+ie+","+se+")"),(e=>{let{node:t,dataLength:a,radiusScale:r,maxValue:n,angleSlice:s,radius:c,xOffset:d,yOffset:u,translateX:p,translateY:h,renderLabel:m,selectLabel:b}=e;const g=o.select(t);g.selectAll(".d3-chart-label").remove();const f=e=>n/c*e,x=e=>r((n+f(u||0))*Math.sin(s*e-Math.PI/2));Array.from({length:a},(e,t)=>{return{x:Math.ceil((a=t,r(n+f(d||0))*Math.cos(s*a-Math.PI/2))),y:Math.ceil(x(t))};var a}).forEach((e,t)=>{let{x:r,y:n}=e;const o=((e,t)=>{const a=((e,t)=>360/t*e)(e,t),r=180;return[0,r].includes(a)?"middle":a<r?"start":"end"})(t,a),s=i.renderToString(l.createElement(S,{anchor:o,translateX:p||0,translateY:h||0,index:t,style:{left:r,top:n}},"function"==typeof m?m(o,t):m)),c=g.append("div").attr("class","d3-chart-label").html(s);b(c,o,t)})})({node:e,maxValue:j,translateX:ie,translateY:se,dataLength:a[C||0].length,angleSlice:W,radius:E,radiusScale:q,xOffset:ce,yOffset:ce,renderLabel:(e,t)=>{const r=a.map(e=>e[t]),n="middle"===e?X:R,o=a[C||0][t],{name:i,value:c}=o;return m?m({item:o,items:r,anchor:e,index:t}):l.createElement(G,{className:F.radarLabel},l.createElement(z,{className:F.radarLabelName},i),l.createElement(n,{className:F.radarLabelBadge},s?s(c,t):ne(c),d&&l.createElement(I,{className:F.radarLabelBadgePrefix},d)))},selectLabel:(e,t,r)=>{if(y){const n=a.map(e=>e[r]);y(e,{index:r,item:a[C||0][r],items:n,anchor:t})}}}),h){const e=i.renderToString(h);U.append("g").html(e)}g&&g(U)}},O=e=>{const{className:t,style:a}=e,[r,o]=h();return n.useEffect(()=>{o&&V(o,e)},[o,e]),m(e.width,()=>V(o,e)),l.createElement("div",{className:t,style:a},l.createElement(D,{ref:r}))};function j(e){return e*(Math.PI/180)}var W;O.defaultProps={height:400,data:[],curve:o.curveLinearClosed};const q={pieGlobal:"pieGlobal",pieSlice:"pieSlice",pieSliceLabel:"pieSliceLabel",pieSliceLabelValue:"pieSliceLabelValue",pieSliceLabelName:"pieSliceLabelName",pieRadialLabel:"pieRadialLabel",pieRadialLink:"pieRadialLink",pieTooltipContainer:"pieTooltipContainer",pieTooltipFlex:"pieTooltipFlex",pieTooltip:"pieTooltip",pieTooltipItem:"pieTooltipItem",pieTooltipName:"pieTooltipName",pieTooltipValue:"pieTooltipValue",pieTooltipColorBox:"pieTooltipColorBox",pieFullChartTooltipCircle:"pieFullChartTooltipCircle"},Z=r(p)(W||(W=u(["\n ."," {\n fill: #4a4a4a;\n }\n ."," {\n position: absolute;\n max-width: 128px;\n }\n ."," {\n stroke: #000;\n }\n ."," {\n fill: transparent;\n cursor: pointer;\n }\n"])),q.pieSliceLabel,q.pieRadialLabel,q.pieRadialLink,q.pieFullChartTooltipCircle),H=e=>e.startAngle+(e.endAngle-e.startAngle)/2<Math.PI?1:-1,U=e=>e.startAngle+(e.endAngle-e.startAngle)/2<Math.PI?"start":"end";var _,J,K,Q,$,ee,te,ae,re,ne,le,oe,ie,se;const ce=r.div(_||(_=u(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n pointer-events: none;\n white-space: nowrap;\n"]))),de=r(ce)(J||(J=u([""]))),ue=r(de)(K||(K=u(["\n align-items: center;\n"]))),pe=r.div(Q||(Q=u(["\n position: relative;\n font-size: 11px;\n color: #fff;\n margin-bottom: 8px;\n padding: 4px 6px;\n background-color: rgba(48, 69, 79, 1);\n border-radius: 4px;\n box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);\n :before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 100%);\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 4px 3px 0 3px;\n border-color: rgba(48, 69, 79, 1) transparent transparent transparent;\n }\n"]))),he=r.div($||($=u(["\n font-size: 14px;\n margin-bottom: 6px;\n"]))),me=r.div(ee||(ee=u(["\n display: flex;\n align-items: center;\n margin-bottom: 0.25rem;\n &:last-of-type {\n margin-bottom: 0;\n }\n"]))),be=r.div(te||(te=u(["\n display: flex;\n align-items: center;\n margin-right: 4px;\n"]))),ge=r.div(ae||(ae=u(["\n margin-right: 4px;\n width: 10px;\n height: 10px;\n border-radius: 2px;\n"]))),fe=r(ge)(re||(re=u(["\n height: 2px;\n border-radius: 0;\n"]))),xe=r.div(ne||(ne=u(["\n margin-right: 4px;\n"]))),Ce=r.div(le||(le=u(["\n text-align: right;\n flex-shrink: 0;\n flex-grow: 1;\n"]))),ye=r.div(oe||(oe=u(["\n position: relative;\n font-size: 11px;\n color: #fff;\n font-weight: bold;\n letter-spacing: 0.52px;\n"]))),ve=r(ye)(ie||(ie=u(["\n top: 6px;\n"]))),Le=r(ye)(se||(se=u(["\n bottom: 6px;\n"]))),Te=(e,t)=>{const{data:a,padAngle:r,onClick:n,outerRadius:s,startAngle:c,endAngle:d,cornerRadius:u,margin:p,enableSlicesLabels:h,formatSliceLabel:m,slicesLabelsSkipAngle:g,enableSlicesLabelsName:f,formatSliceLabelName:x,borderWidth:C,borderColor:y,enableRadialLabels:v,backgroundColor:L,radialLabelsLinkHorizontalLength:T,radialLabelsTextXOffset:k,formatRadialLabel:S,radialLabelYOffset:w,svgElements:B,formatSliceTitle:M,radialAngleXOffset:A,withTooltip:N,fullChartTooltip:E,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,tooltipStyle:R}=t;if(null!==e&&a.length){const X=p?p.top:0,I=p?p.right:0,P=p?p.bottom:0,F=p?p.left:0,{width:D}=e.getBoundingClientRect(),V=t.width||D,O=240,W=t.height||O,Z=(Math.min(V,W)-2*(C||0)-(V>W?X+P:I+F))/2,_=b(e,V,W),J=_.append("g").attr("class",q.pieGlobal).attr("transform","translate("+((V-(F+I))/2+F)+","+((W-(P+X))/2+X)+")"),K=45,Q=100,$=360,ee=o.pie().startAngle(-j(c||0)).endAngle(j(d||$)).padAngle(r?Math.max(Math.min(r/Q,K),0):0).sort(null).value(e=>{let{value:t}=e;return t})(a),te=.95,ae=o.arc().cornerRadius(u||0).innerRadius(Z).outerRadius(Z*Math.min(Math.max(s||0,0),te));"string"==typeof L&&J.append("path").attr("fill",L).attr("d",()=>ae({startAngle:j(0),endAngle:j($)}));const re=o.format(","),ne=J.selectAll("allSlices").data(ee).enter().append("path").attr("d",ae);if(ne.attr("class",q.pieSlice).attr("fill",e=>{let{index:t}=e;return a[t].color||""}).attr("stroke",y||"").attr("stroke-width",C||0).attr("style",n?"cursor: pointer":"").on("click",(e,t)=>n&&n(a[t.index])).append("svg:title").text(e=>M?M(e):E||N?"":(a[e.index].name||"")+" ("+re(a[e.index].value)+")"),h){const e=J.selectAll("allSlices").data(ee).enter().append("text").attr("class",q.pieSliceLabel).attr("text-anchor","middle").attr("dominant-baseline","central").attr("transform",e=>"translate("+ae.centroid(e)+")");e.append("tspan").attr("class",q.pieSliceLabelValue).text(e=>{const t=180*(e.endAngle-e.startAngle)/Math.PI;if(!g||t>g)return m?m(e):e.value}),f&&e.append("tspan").attr("class",q.pieSliceLabelName).text(e=>x?x(e):e.data.name).attr("x","0").attr("dy","1.2em")}if((e=>{let{arc:t,enableRadialLabels:a,global:r,node:n,radius:l,dataReady:s,radialLabelsLinkHorizontalLength:c,formatRadialLabel:d,radialLabelsTextXOffset:u,translateX:p,translateY:h,radialLabelYOffset:m,radialAngleXOffset:b}=e;const g=o.select(n);if(g.selectAll("."+q.pieRadialLabel).remove(),a){const e=4,a=o.arc().innerRadius(l).outerRadius(l);r.selectAll("allPolylines").data(s).enter().append("polyline").attr("class",q.pieRadialLink).style("fill","none").attr("points",r=>{const n=H(r),o=t.centroid(r),i=a.centroid(r),s=a.centroid(r),d=[(l+(c||e))*n,s[1]];return[[o[0],o[1]],[i[0]+(b||0)*n,i[1]-(m||0)*r.index],[d[0],d[1]-(m||0)*r.index]]});const n=t=>{const r=a.centroid(t);return[(l+(c||e))*H(t),r[1]]},f=4;g.selectAll("allLabels").data(s).enter().append("div").html(e=>i.renderToString(d?d(e):e.data.name)).attr("class",q.pieRadialLabel).style("transform",e=>(e=>{let{anchor:t,index:a,translateX:r,translateY:n}=e;return 0===a&&"middle"===t?"translate(calc(-50% + "+r+"px), calc(-100% + "+n+"px))":"middle"===t?"translate(calc(-50% + "+r+"px), calc("+n+"px))":"start"===t?"translate(calc("+r+"px), calc(-50% + "+n+"px))":"end"===t?"translate(calc(-100% + "+r+"px), calc(-50% + "+n+"px))":"translate("+r+"px, "+n+"px)"})({anchor:U(e),index:e.index,translateX:p,translateY:h-(m||0)*e.index})).style("left",e=>n(e)[0]-("start"===U(e)?-(u||f):u||f)+"px").style("top",e=>n(e)[1]+"px").style("text-align",U)}})({arc:ae,enableRadialLabels:v,global:J,radius:Z,node:e,dataReady:ee,translateX:(V-(F-I))/2,translateY:(W+(X-P))/2,radialLabelsLinkHorizontalLength:T,radialLabelsTextXOffset:k,formatRadialLabel:S,radialLabelYOffset:w,radialAngleXOffset:A}),(N||E)&&(e=>{let{fullChartTooltip:t,global:a,tooltipRoot:r,data:n,tooltipClassName:s,tooltipBind:c,renderTooltip:d,arc:u,allSlices:p,tooltipStyle:h,width:m,height:b,radius:g}=e;const f=r||document.querySelector("body"),x=o.format(","),C=o.select(f).select("."+q.pieTooltipContainer),y=C.empty()?o.select(f).append("div").attr("class",q.pieTooltipContainer+" "+(s||"")).style("position","absolute").style("opacity","0").style("z-index","103"):C;h&&Object.entries(h).forEach(e=>{let[t,a]=e;return y.style(t,a)}),y.html("");let v=!1;const L=e=>{v=Boolean(e),y.style("opacity",v?"1":"0")},T=(e,r)=>{let[n,l]=o.pointer(e,document);if(!c&&t){const[t,a]=o.pointer(e,e.target);n-=t,l-=a}else if(!c){const e=a.node(),{x:t,y:o,width:i,height:s}=e?e.getBoundingClientRect():{x:0,y:0,width:0,height:0},[c,d]=u.centroid(r);n=t+i/2+c,l=o+s/2+d}y.style("left",n+"px").style("top",l+"px")},k=(e,t)=>{L(!0),T(e,t);const a=t?[t.data]:n;y.html(()=>i.renderToString(l.createElement(ce,{className:q.pieTooltipFlex},l.createElement(pe,{className:q.pieTooltip},d?d(a):l.createElement(l.Fragment,null,a.map((e,t)=>{let{color:a,name:r,value:n}=e;return l.createElement(me,{key:r+"-"+t,className:q.pieTooltipItem},a&&l.createElement(ge,{className:q.pieTooltipColorBox,style:{backgroundColor:a}}),r&&l.createElement(xe,{className:q.pieTooltipName},r),l.createElement(Ce,{className:q.pieTooltipValue},x(n)))}))))))};t?(a.on("mouseover.fulltooltip",e=>k(e)),a.on("mouseout.fulltooltip",()=>{y.html(""),L()}),m&&b&&a.append("circle").attr("class",q.pieFullChartTooltipCircle).attr("r",g).attr("cx",0).attr("cy",0),c||a.on("touchmove.tooltipBind mousemove.tooltipBind",e=>T(e))):(p.on("mouseover.slice",k),c||p.on("touchmove.slice mousemove.slice",T),p.on("mouseout.slice",()=>{y.html(""),L()}))})({fullChartTooltip:E,global:J,data:a,tooltipClassName:G,tooltipBind:z,renderTooltip:Y,allSlices:ne,arc:ae,tooltipStyle:R,width:V,height:W,radius:Z}),B){const e=i.renderToString(B);_.append("g").html(e)}}},ke=e=>{const{className:t,style:a,children:r}=e,[o,i]=h();return n.useEffect(()=>{i&&Te(i,e)},[i,e]),m(e.width,()=>Te(i,e)),l.createElement("div",{className:t,style:a},l.createElement(Z,{ref:o},r))};ke.defaultProps={data:[],startAngle:0,endAngle:360,slicesLabelsSkipAngle:0,radialLabelYOffset:16,radialAngleXOffset:8};const Se={legendContainer:"d3-legend-container",legendTitle:"d3-legend-title",legendTick:"d3-legend-tick",legendTickLine:"d3-legend-tick-line",legendTickText:"d3-legend-tick-text"};function we(e,t){void 0===t&&(t=256);const a=document.createElement("canvas");a.width=t,a.height=1;const r=a.getContext("2d");for(let a=0;a<t;++a)r.fillStyle=e(a/(t-1)),r.fillRect(a,0,1,1);return a}const Be={tickSize:6,height:44,width:320,marginTop:18,marginBottom:16,ticksDivier:64,titleMarginBottom:6};var Me;const Ae=c({calendarChart:"calendarChart",calendarYear:"calendarYear",calendarAxis:"calendarAxis",calendarBody:"calendarBody",calendarHeader:"calendarHeader",calendarYearTitle:"calendarYearTitle",calendarWeekDay:"calendarWeekDay",calendarMonth:"calendarMonth",calendarDays:"calendarDays",calendarDay:"calendarDay"},Se),Ne=r(p)(Me||(Me=u(["\n ."," {\n display: flex;\n margin-bottom: 16px;\n }\n ."," {\n display: inline-flex;\n align-items: flex-end;\n height: ",";\n margin-bottom: 4px;\n font-weight: bold;\n }\n ."," {\n height: ",";\n margin-bottom: 4px;\n position: relative;\n display: flex;\n }\n ."," {\n font-size: 14px;\n bottom: 0;\n position: absolute;\n }\n ."," {\n display: flex;\n flex-direction: column;\n margin-right: 10px;\n }\n ."," {\n font-size: 12px;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n ."," {\n position: relative;\n }\n ."," {\n position: absolute;\n }\n"])),Ae.calendarYear,Ae.calendarYearTitle,"20px",Ae.calendarHeader,"20px",Ae.calendarMonth,Ae.calendarAxis,Ae.calendarWeekDay,Ae.calendarDays,Ae.calendarDay),Ee=e=>{const{className:t,style:a,children:r,data:i,startSunday:s,weekdays:d,cellOffset:u,cellSize:p,interpolator:m,monthSpacing:b,colorRange:g,legendProps:f}=e,[x,C]=h();return n.useEffect(()=>{C&&((e,t)=>{const{data:a,startSunday:r,weekdays:n,interpolator:l,monthSpacing:i,onEachDay:s,colorRange:d,legendProps:u}=t;if(null!==e&&a.length){const p=o.group(a,e=>e.date.getUTCFullYear()),h="number"==typeof t.cellOffset?t.cellOffset:0,m=7,b=18,g=t.cellSize||b,f=e=>r?e:(e+(m-1))%m,x=n||["вс","пн","вт","ср","чт","пт","сб"],C=6,y=e=>r?x[e]:e===C?x[0]:x[e+1],v=o.utcFormat("%x"),L=r?o.utcSunday:o.utcMonday,T=(e,t)=>L.count(o.utcYear(e),t),k=e=>e.getUTCMonth()*(i||0),S=o.utcFormat("%b"),w=o.max(a.map(e=>{let{value:t}=e;return t})),B=o.min(a.map(e=>{let{value:t}=e;return t})),M=d?o.scaleLinear().domain([B,w]).range(d):o.scaleSequential(l||o.interpolateGreens).domain([B,+w]);let A=0;p.forEach((e,t)=>{const a=new Date(t,1),r=o.max(e.map(e=>e.date)),n=r.getUTCMonth()-a.getUTCMonth(),l=T(a,r)+1;A=Math.max(A,l*(g+h)+(i||0)*n)}),o.select(e).select("."+Ae.calendarChart).remove();const N=o.select(e).append("div").attr("class",Ae.calendarChart),E=N.selectAll("div").data(p).join("div").attr("class",Ae.calendarYear),G=E.append("div").attr("class",Ae.calendarAxis);G.append("div").attr("class",Ae.calendarYearTitle).text(e=>{let[t]=e;return t}),G.selectAll("span").data(o.range(m)).join("div").attr("class",Ae.calendarWeekDay).style("height",g+"px").style("margin-bottom",h+"px").text(y);const z=E.append("div").attr("class",Ae.calendarBody);if(z.append("div").attr("class",Ae.calendarHeader).selectAll("div").data(e=>{let[t,a]=e;return o.utcMonths(o.utcMonth(new Date(a[0].date.getUTCFullYear(),1,1)),o.utcMonth(new Date(a[0].date.getUTCFullYear(),12,31)))}).join("div").attr("class",Ae.calendarMonth).style("left",e=>T(e,L.ceil(e))*(g+h)+k(e)+"px").text(S),z.append("div").attr("class",Ae.calendarDays).style("height",(g+h)*m+"px").style("width",A+"px").selectAll("div").data(e=>{let[,t]=e;return t}).join("div").each((e,t,a)=>{if(s){const r=a[t],n=M(e.value);s(e,r,n)}}).attr("class",Ae.calendarDay).style("width",g+"px").style("height",g+"px").style("left",e=>T(e.date,e.date)*(g+h)+k(e.date)+"px").style("top",e=>f(e.date.getUTCDay())*(g+h)+"px").style("background-color",e=>M(e.value)).attr("title",e=>v(e.date)+" - "+e.value),"object"==typeof u){const e=(e=>{let{color:t,title:a,tickSize:r=Be.tickSize,width:n=Be.width,height:l=Be.height+r,marginTop:i=Be.marginTop,marginRight:s=0,marginBottom:c=Be.marginBottom+r,marginLeft:d=0,ticks:u=Be.width/Be.ticksDivier,tickFormat:p,tickValues:h,titleMarginBottom:m}=e;const b=o.create("svg").attr("width",n).attr("height",l).attr("viewBox",[0,0,n,l]).style("overflow","visible").style("display","block");let g;if(t.interpolate){const e=Math.min(t.domain().length,t.range().length);g=t.copy().rangeRound(o.quantize(o.interpolate(d,n-s),e)),b.append("image").attr("x",d).attr("y",i).attr("class",Se.legendContainer).attr("width",n-d-s).attr("height",l-i-c).attr("preserveAspectRatio","none").attr("xlink:href",we(t.copy().domain(o.quantize(o.interpolate(0,1),e))).toDataURL())}else if(t.interpolator&&(g=Object.assign(t.copy().interpolator(o.interpolateRound(d,n-s)),{range:()=>[d,n-s]}),b.append("image").attr("x",d).attr("y",i).attr("width",n-d-s).attr("height",l-i-c).attr("preserveAspectRatio","none").attr("xlink:href",we(t.interpolator()).toDataURL()),!g.ticks)){if(void 0===h){const e=Math.round(u+1);h=o.range(e).map(a=>o.quantile(t.domain(),a/(e-1)))}"function"!=typeof p&&(p=o.format(void 0===p?",f":p))}return b.append("g").attr("transform","translate(0,"+(l-c)+")").call(o.axisBottom(g).ticks(u,"string"==typeof p?p:void 0).tickFormat("function"==typeof p?p:void 0).tickSize(r).tickValues(h)).call(e=>{const t=e.selectAll(".tick");return t.selectAll(".tick line").attr("y1",i+c-l).attr("class",Se.legendTickLine),t.selectAll(".tick text").attr("class",Se.legendTickText),t.attr("class",Se.legendTick),t}).call(e=>e.select(".domain").remove()).call(e=>e.append("text").attr("x",d).attr("class",Se.legendTitle).attr("y",i+c-l-(m||Be.titleMarginBottom)).attr("fill","currentColor").attr("text-anchor","start").attr("font-weight","bold").text(a)),b})(c({color:M},u)),t=N.node(),a=e.node();t.appendChild(a)}}})(C,e)},[C,i,s,d,u,p,m,b,g,f]),l.createElement(Ne,{ref:x,className:t,style:a},r)};function Ge(e){let t;const a=e.node();return t=a instanceof SVGGraphicsElement?a.getBBox():a.getBoundingClientRect(),t}function ze(){}function Ye(e){return null==e||Number.isNaN(e)}var Re,Xe;Ee.defaultProps={data:[]};const Ie={lineChartYScaleGlobal:"lineChartYScaleGlobal",lineChartYScaleRight:"lineChartYScaleRight",lineChartXScaleGlobal:"lineChartXScaleGlobal",lineChartLinesGlobal:"lineChartLinesGlobal",lineChartLine:"lineChartLine",lineChartAreasGlobal:"lineChartAreasGlobal",lineChartArea:"lineChartArea",lineChartDotsGlobalContainer:"lineChartDotsGlobalContainer",lineChartDotsGlobal:"lineChartDotsGlobal",lineChartDot:"lineChartDot",lineChartGridGlobal:"lineChartGridGlobal",lineChartGridLineX:"lineChartGridLineX",lineChartGridLineY:"lineChartGridLineY",lineChartLabelContainer:"lineChartLabelContainer",lineChartLabelFlex:"lineChartLabelFlex",lineChartLabel:"lineChartLabel",lineChartMouseGlobal:"lineChartMouseGlobal",lineChartMouseLine:"lineChartMouseLine",lineChartMouseRect:"lineChartMouseRect",lineChartMouseCircle:"lineChartMouseCircle",lineChartMouseLabelContainer:"lineChartMouseLabelContainer",lineChartMouseLabel:"lineChartMouseLabel"},Pe=r(p)(Re||(Re=u(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n stroke: steelblue;\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n ."," {\n fill-opacity: 0.24;\n }\n .",",\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n .",",\n ."," {\n transition: opacity linear 200ms;\n pointer-events: none;\n stroke-width: 1px;\n }\n ."," {\n stroke: #fff;\n stroke-width: 2px;\n }\n ."," {\n shape-rendering: crispEdges;\n }\n ."," {\n fill: none;\n pointer-events: all;\n }\n"])),Ie.lineChartYScaleGlobal,Ie.lineChartXScaleGlobal,Ie.lineChartGridGlobal,Ie.lineChartLinesGlobal,Ie.lineChartArea,Ie.lineChartGridLineX,Ie.lineChartGridLineY,Ie.lineChartMouseLine,Ie.lineChartMouseLine,Ie.lineChartMouseCircle,Ie.lineChartDot,Ie.lineChartMouseLine,Ie.lineChartMouseRect),Fe=a.createGlobalStyle(Xe||(Xe=u(["\n ."," {\n transition: opacity linear 200ms;\n z-index: 100;\n ."," {\n justify-content: flex-start;\n align-items: center;\n pointer-events: none;\n }\n ."," {\n margin: 0 0 0 10px;\n }\n }\n"])),Ie.lineChartMouseLabel,Ie.lineChartLabelFlex,Ie.lineChartLabel);var De,Ve;const Oe=r.div(De||(De=u(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),je=r.div(Ve||(Ve=u(["\n margin-bottom: 4px;\n"]))),We=["values"],qe=(e,t)=>{const{data:a,labels:r,margin:n,customYAxisSelection:s,customXAxisSelection:u,customYAxis:p,customXAxis:h,curve:m,yAxisPadding:g,xAxisPadding:f,drawGridY:x,drawGridX:C,withLabels:y,formatLabel:v,eachLabel:L,stacked:T,dynamicTooltipEnable:k,dynamicCircleRadius:S,formatDynamicTooltip:w,renderTooltip:B,stackedTooltip:M,stackedTooltipIndex:A,tooltipLineTop:N,customize:E,customYScale:G,customLine:z,tooltipClassName:Y,xScaleItemWidth:R,areaCurve:X,dotSnapping:I,rightAxis:P}=t;if(null!==e&&a.length){const F=T?(e=>{const t={};return e.map((e,a)=>(t[a]={},a>0?c({},e,{values:e.values.map((e,r)=>{const n=t[a-1][r];return t[a][r]=Number(("number"!=typeof n?0:Math.abs(n))+("number"!=typeof e?0:Math.abs(e))),t[a][r]})}):(e.values.forEach((e,r)=>{t[a][r]=Number(e)}),e)))})(a):a,D=n?n.top:0,V=n?n.right:0,O=n?n.bottom:0,j=n?n.left:0,{width:W}=e.getBoundingClientRect(),q=t.width||W,Z=t.height||0,H="number"==typeof t.min?t.min:o.min(F,e=>{let{values:t}=e;return o.min(t)}),U="number"==typeof t.max?t.max:o.max(F,e=>{let{values:t}=e;return o.max(t)}),_=b(e,q,Z||0),J=[Z-D-O-(f||0),D],K=o.scaleLinear().domain([H||0,U||0]).range(J).nice();G&&G(K);const Q=8,$=o.axisLeft(K).ticks(Q);p&&p($);const ee=$.tickArguments()[0],te=_.append("g").attr("class",Ie.lineChartYScaleGlobal).call($).call(s||ze),{width:ae}=Ge(te);te.attr("transform","translate("+(j+ae)+", 0)");let re=0;if(P){const e=o.min(P),t=o.max(P),a=o.scaleLinear().domain([e||0,t||0]).range(J).nice(),r=o.axisRight(a).ticks(Q),n=_.append("g").attr("class",Ie.lineChartYScaleGlobal+" "+Ie.lineChartYScaleRight).call(r).call(s||ze);({width:re}=Ge(n)),n.attr("transform","translate("+(q-re)+", 0)")}const ne=r&&r.length?r.length-1:F.reduce((e,t)=>{let{values:a}=t;return Math.max(e,a.length)},0)-1,le=o.scaleLinear().domain([0,ne]).range([j+ae+(g||0),q-re-V]),oe=o.axisBottom(le).tickFormat(e=>r&&r.length>0?r[e]:0).ticks(ne);if("number"==typeof R){const[e,t]=le.range();oe.ticks(Math.round((t-e)/R)).tickSizeOuter(0)}if(h&&h(oe),(e=>{let{svg:t,yScale:a,xScale:r,yTicksCount:n,lastIndex:l,drawGridX:o,drawGridY:i}=e;if(!i&&!o)return;const s=t.append("g").attr("class",Ie.lineChartGridGlobal),c=a.ticks(n);o&&s.append("g").selectAll("line").data(c).join("line").attr("class",Ie.lineChartGridLineX).attr("x1",()=>r(0)).attr("x2",()=>r(l)).attr("y1",e=>Math.round(a(e))).attr("y2",e=>Math.round(a(e))),i&&s.append("g").selectAll("line").data(Array.from({length:l+1},(e,t)=>t)).join("line").attr("class",Ie.lineChartGridLineY).attr("x1",(e,t)=>Math.round(r(t))).attr("x2",(e,t)=>Math.round(r(t))).attr("y1",()=>Math.round(a(c[0]))).attr("y2",()=>Math.round(a(c[c.length-1])))})({svg:_,yScale:K,xScale:le,yTicksCount:ee,lastIndex:ne,drawGridY:x,drawGridX:C}),Array.isArray(r)&&r.length>0){const e=_.append("g").call(u||ze).attr("class",Ie.lineChartXScaleGlobal).call(oe),{height:t}=Ge(e);e.attr("transform","translate(0, "+(Z-Math.ceil(t)-O)+")")}const ie=o.line().defined(e=>null!==e).x((e,t)=>le(t)).y(e=>K(e)).curve(m||o.curveLinear);if(z&&z(ie),F.some(e=>{let{fill:t}=e;return t})){let e=-2;const t=t=>{const{minAreaValues:a}=t,r=K.ticks()[0];return o.area().defined(e=>null!==e).x((e,t)=>le(t)).y0((t,n)=>{0===n&&(e+=1);let l=r;a&&"number"==typeof a[n]?l=a[n]||l:a&&(l=K(l-t));const o=F[e];return K(T&&e>-1?"number"!=typeof o.values[n]?0:o.values[n]:l)}).y1(e=>K(e)).curve(X||m||o.curveLinear)};_.append("g").attr("class",Ie.lineChartAreasGlobal).selectAll("path").data(F.filter(e=>{let{fill:t}=e;return Boolean(t)})).join("path").attr("class",Ie.lineChartArea).attr("d",e=>t(e)(e.values)).attr("fill",e=>{let{fill:t}=e;return t||"none"}).attr("style",e=>{let{areaStyle:t}=e;return t||""})}_.append("g").attr("class",Ie.lineChartLinesGlobal).selectAll("path").data(F).join("path").attr("class",Ie.lineChartLine).attr("d",e=>ie(e.values)).attr("stroke",e=>{let{stroke:t}=e;return t||"steelblue"}).attr("style",e=>{let{style:t}=e;return t||""});const se=F.filter(e=>{let{dot:t}=e;return t});if(se.length>0){const e=_.append("g").attr("class",Ie.lineChartDotsGlobalContainer);se.forEach(t=>{const{values:a,dot:r}=t,{radius:n,style:l,filter:o}=r,i=e.append("g").attr("class",Ie.lineChartDotsGlobal);i.selectAll("circle").data(a).join("circle").attr("cx",(e,t)=>le(t)).attr("class",Ie.lineChartDot).attr("cy",e=>K(e)).attr("r",n||0).attr("style",l||""),o&&i.selectAll("circle").select((e,a,r)=>o(t,a,r)?r[a]:null).remove()})}o.select(e).select(".d3-chart-label").remove(),y&&(e=>{let{node:t,data:a,yScale:r,xScale:n,formatLabel:s,eachLabel:c}=e;const d=o.select(t).append("div").attr("class","d3-chart-label"),u=o.format(",");a.forEach(e=>{let{values:t}=e;d.append("div").selectAll("div").data(t).join("div").attr("class",Ie.lineChartLabelContainer).style("position","absolute").style("left",(e,t)=>n(t)+"px").style("top",e=>r(e)+"px").html((e,t,a)=>i.renderToString(l.createElement(Oe,{className:Ie.lineChartLabelFlex},l.createElement(je,{className:Ie.lineChartLabel},s?s(e,t,a):u(e))))).each(c||ze)})})({node:e,eachLabel:L,data:F,yScale:K,xScale:le,formatLabel:v}),k&&(e=>{let{svg:t,node:a,data:r,xScale:n,yScale:s,dynamicCircleRadius:u,formatDynamicTooltip:p,renderTooltip:h,stackedTooltipIndex:m,stackedTooltip:b,tooltipLineTop:g,tooltipRoot:f,tooltipClassName:x,dotSnapping:C,lastIndex:y}=e;const v=f||document.querySelector("body"),L=o.format(","),T=r.filter(e=>{let{tooltipOff:t}=e;return!t}),k="number"==typeof m?[T[m]]:b?[T[0]]:T,[S,w]=n.range(),[B,M]=s.range(),A=t.append("g").attr("class",Ie.lineChartMouseGlobal),N=A.append("rect").attr("width",w-S).attr("height",Math.abs(B-M)).attr("class",Ie.lineChartMouseRect).attr("transform","translate("+S+", "+M+")"),E=A.append("path").attr("class",Ie.lineChartMouseLine).style("opacity","0"),G=t.selectAll("."+Ie.lineChartLine).nodes(),z=A.selectAll("circle").data(T.filter(e=>{let{dynamicDotOff:t}=e;return!t})).join("circle").attr("class",Ie.lineChartMouseCircle).attr("r",u).attr("fill",e=>{let{stroke:t}=e;return t||"none"}).attr("stroke",e=>{let{stroke:t}=e;return t||"none"}).style("opacity","0");let Y=o.select("."+Ie.lineChartMouseLabelContainer);0===Y.size()&&(Y=o.select(v).append("div").attr("class",Ie.lineChartMouseLabelContainer));let R=null,X=!1;const I=e=>{X=Boolean(e);const t=X?"1":"0";E.style("opacity",t),z.style("opacity",t),R&&R.style("opacity",t)},P=e=>{const[u,f]=o.pointer(e,document),[x]=o.pointer(e,N),[v,k]=o.pointer(e,a),S=x-(x-v),w=v+(u-v),A=Math.abs(n.invert(S)),Y={},P=e=>e[Math.floor(A)];G.forEach((e,t)=>{let a={x:0,y:0};if(e.hasAttribute("d")&&!r[t].tooltipOff)if(C){const[e,a]=n.range(),l=(a-e)/y;Y[t]={x:e+Math.round(A)*l,y:"number"==typeof r[t].values[Math.round(A)]?s(r[t].values[Math.round(A)]):0}}else{let r=0,n=e.getTotalLength(),l=null;for(;l=Math.floor((r+n)/2),a=e.getPointAtLength(l),l!==n&&l!==r||a.x===S;)if(a.x>S)n=l;else{if(!(a.x<S))break;r=l}Y[t]=a}else Y[t]=a}),z.attr("transform",(e,t)=>{const a=P(e.values);return Y[t]&&a?"translate("+(C?Y[t].x:S)+","+Y[t].y+")":"translate(-9999, -9999)"}).attr("style",e=>{let{dynamicDotStyle:t}=e;return t||""});const F=T.map((e,t)=>{let{values:a}=e;return c({},d(e,We),{value:P(a),invertValue:Y[t]?s.invert(Y[t].y):0})}),D=F.every(e=>{let{value:t}=e;return Ye(t)});D&&X?I():X||D||I(!0);const V=Object.keys(Y).reduce((e,t,a)=>{var n,l;const o=null==(n=F[Number(e)])?void 0:n.value,i=null==(l=F[Number(t)])?void 0:l.value,s=null==r?void 0:r[a].dynamicDotOff;return 0===a||Ye(i)||s?e:Ye(o)||Y[e].y>Y[t].y?t:e},"0"),O=R&&R.style("left",(e,t)=>{var a,r;return C?(null!=(a=null==(r=Y[t])?void 0:r.x)?a:0)+"px":w+"px"}).style("top",(e,t)=>{var a,r;return(null!=(a=null==(r=Y["number"==typeof m?m:b?V:t])?void 0:r.y)?a:0)+(f-k)+"px"}).select("."+Ie.lineChartLabel);h&&R?R.html((a,r)=>i.renderToString(l.createElement(Oe,{className:Ie.lineChartLabelFlex},h(F,{indexX:Math.round(A),indexY:r,svg:t,event:e})))):O&&O.text((e,t)=>{const a=F[t].invertValue;return p?p(a,F[t].value):L(a)}),E.attr("d",()=>{var e;let t="M"+S+","+B;return t+=" "+S+","+(g?M:(null==(e=Y[V])?void 0:e.y)||0),t})};N.on("mouseover.tooltip",e=>{R=Y.selectAll("div").data(k).join("div").attr("class",Ie.lineChartMouseLabel+" "+(x||"")).style("opacity","0").style("position","absolute").html(()=>i.renderToString(l.createElement(Oe,{className:Ie.lineChartLabelFlex},l.createElement(je,{className:Ie.lineChartLabel})))),P(e)}),N.on("mouseout.tooltip",()=>{o.select("."+Ie.lineChartMouseLabelContainer).selectAll("*").remove(),I()}),N.on("touchmove.tooltip mousemove.tooltip",P)})({tooltipLineTop:N,stackedTooltip:M,renderTooltip:B,stackedTooltipIndex:A,formatDynamicTooltip:w,node:e,svg:_,data:F,xScale:le,yScale:K,dynamicCircleRadius:S,tooltipClassName:Y,dotSnapping:I,lastIndex:ne}),E&&E({svg:_,yScale:K,xScale:le})}},Ze=e=>{const{className:t,style:a,children:r}=e,[o,i]=h();return n.useEffect(()=>{i&&qe(i,e)},[i,e]),m(e.width,()=>qe(i,e)),l.createElement("div",{className:t,style:a},l.createElement(Fe,null),l.createElement(Pe,{ref:o},r))};Ze.defaultProps={data:[],labels:[],height:240,yAxisPadding:10,xAxisPadding:20,margin:{top:10,right:10,bottom:10,left:0},dynamicCircleRadius:4,stackedTooltip:!1};const He={barChartLinesGlobal:"barChartLinesGlobal",barChartLine:"barChartLine",barChartAreasGlobal:"barChartAreasGlobal",barChartArea:"barChartArea"};var Ue,_e;const Je=c({barChartBarGlobal:"barChartBarGlobal",barChartYScaleGlobal:"barChartYScaleGlobal",barChartYAxis:"barChartYAxis",barChartXAxis:"barChartXAxis",barChartYAxisZeroTick:"barChartYAxisZeroTick",barChartGridGlobal:"barChartGridGlobal",barChartGridLineX:"barChartGridLineX",barChartGridLineXZero:"barChartGridLineXZero",barChartGridLineYZero:"barChartGridLineYZero",barChartGridLineY:"barChartGridLineY",barChartSelection:"barChartSelection"},{barChartMouseRect:"barChartMouseRect",barChartMouseContainer:"barChartMouseContainer",barChartTooltipFlex:"barChartTooltipFlex",barChartMouseTooltip:"barChartMouseTooltip",barChartTooltip:"barChartTooltip",barChartTooltipItem:"barChartTooltipItem",barChartTooltipColFlex:"barChartTooltipColFlex",barChartTooltipGroupName:"barChartTooltipGroupName",barChartColorBox:"barChartColorBox",barChartColorLine:"barChartColorLine",barChartTooltipName:"barChartTooltipName",barChartTooltipValue:"barChartTooltipValue"},{barChartLabelContainer:"barChartLabelContainer",barChartLabelFlex:"barChartLabelFlex",barChartLabel:"barChartLabel"},He),Ke=r(p)(Ue||(Ue=u(["\n display: ",";\n user-select: ",";\n width: ",";\n\n line {\n stroke-width: 1px;\n shape-rendering: crispEdges;\n }\n\n .",",\n ."," {\n stroke: rgba(48, 69, 79, 0.06);\n }\n\n ."," {\n }\n\n ."," {\n fill: none;\n pointer-events: all;\n }\n\n ."," {\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n\n ."," {\n shape-rendering: auto;\n }\n\n ."," {\n fill-opacity: 0.24;\n }\n\n ."," {\n position: absolute;\n top: 0;\n width: 0;\n background: rgba(0, 170, 255, 0.06);\n box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;\n pointer-events: none;\n }\n"])),e=>{let{selectable:t}=e;return t&&"inline-block"},e=>{let{selectable:t}=e;return t&&"none"},e=>{let{selectable:t}=e;return t&&"auto"},Je.barChartGridLineX,Je.barChartGridLineY,Je.barChartMouseRect,Je.barChartMouseRect,Je.barChartLinesGlobal,Je.barChartLine,Je.barChartArea,Je.barChartSelection),Qe=a.createGlobalStyle(_e||(_e=u(["\n ."," {\n z-index: 100;\n transition: all linear 144ms;\n\n ."," {\n margin-bottom: 4px;\n :last-of-type {\n margin-bottom: 0;\n }\n }\n }\n"])),Je.barChartMouseTooltip,Je.barChartTooltipItem),$e=["groupName"],et=["groupName"],tt=["values"],at=["groupName"],rt=(e,t)=>{const{data:a,lineData:r=[],markers:n=[],barWidth:s,barPadding:u,colors:p,margin:h,xAxisPadding:m,yAxisPadding:g,drawGridY:f,drawGridX:x,customYScale:C,customXScale:y,customYAxisLeft:v,customXAxisBottom:L,customYAxis:T,customXAxis:k,customBars:S,customize:w,dynamicTooltipEnable:B,hideTooltipGroupName:M,renderTooltip:A,labelPosition:N,renderLabel:E,tooltipY:G,tooltipBind:z,stackedLine:Y,curve:R,formatTooltipValue:X,formatTooltipName:I,sectionPadding:P,minValuesLine:F,tooltipYDomain:D,marshalledMap:V,minValue:O,maxValue:j,minDomainValue:W,maxDomainValue:q,drawBars:Z,setTooltipPosition:H,onLabelItem:U,isBarTooltip:_,xScaleItemWidth:J,tooltipRoot:K,tooltipClassName:Q,onBarClick:$,onBarHover:ee}=t;if(null!==e&&a.length){const te=h?h.top:0,ae=h?h.right:0,re=h?h.bottom:0,ne=h?h.left:0,le=12,{width:oe}=e.getBoundingClientRect(),ie=t.width||oe,se=t.height||0,Te=(e=>{let{data:t,minDomainValue:a,maxDomainValue:r}=e,n=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return t.forEach(e=>{let t=d(e,$e),a=0,r=0;Object.keys(t).forEach(e=>{const n=t[e];let l=0,o=0;Object.keys(n).forEach(e=>{const t=n[e];t>0?l+=t:o+=t}),a=Math.min(a,o),r=Math.max(r,l)}),n=Math.min(n,a),l=Math.max(l,r)}),0===n&&0===l?{min:"number"==typeof a?a:0,max:"number"==typeof r?r:1}:{min:"number"==typeof a?a:n,max:"number"==typeof r?r:l}})({data:a,minDomainValue:W,maxDomainValue:q}),ke="number"==typeof O?O:Math.min(o.min(r,e=>{let{values:t}=e;return o.min(t)})||Number.POSITIVE_INFINITY,Te.min||0),Se="number"==typeof j?j:Math.max(o.max(r,e=>{let{values:t}=e;return o.max(t)})||Number.NEGATIVE_INFINITY,Te.max),we=b(e,ie,se||0),Be=6,Me=a.map(e=>e.groupName);let Ae=s||le;const Ne=o.scaleLinear().domain([ke,Se]).range([se-te-re-(m||0),te]).nice();C&&C(Ne);const Ee=Ne.ticks(),ze=o.axisLeft(Ne).ticks(Be);v&&v(ze);const Ye=ze.tickArguments()[0],Re=we.append("g").attr("class",Je.barChartYAxis).call(ze);Re.selectAll(".tick").attr("class",e=>0===e?"tick "+Je.barChartYAxisZeroTick:"tick"),T&&T(Re);const{width:Xe}=Ge(Re),Ie=[ne+Xe+(g||0),ie-ae],Pe=o.scaleBand().domain(o.range(a.length)).range(Ie);Ae=(e=>{let{data:t,range:a,barWidth:r,barPadding:n,sectionPadding:l}=e;const o="number"==typeof l?l:0,i=a[1]-a[0],s=t.reduce((e,t)=>{let a=d(t,at);return e+Object.keys(a).reduce((e,t,a)=>a>0?e+(r||0)+(n||0):e+r,0)+o},o);return i<s?Math.floor(r*(i/s)):r})({data:a,sectionPadding:P,range:Ie,barWidth:Ae,barPadding:u}),y&&y(Pe);const[Fe,De]=Pe.range(),Ve=o.axisBottom(Pe).tickFormat(e=>Me[Number(e)]);"number"==typeof J&&Ve.tickValues(Pe.domain().filter((e,t,a)=>{const r=Math.round((De-Fe)/J);return!(t%Math.round(a.length/r))})).tickSizeOuter(0),L&&L(Ve,{node:e,labels:Me});const Oe=we.append("g").call(Ve).attr("class",Je.barChartXAxis);k&&k(Oe);const je=(e=>{let{data:t,yScale:a,xScale:r,barWidth:n,barPadding:l,colors:o,marginTop:i}=e;return t.map((e,t)=>{let{groupName:s}=e,c=d(e,et);const u=[],p=r.bandwidth(),h=Object.keys(c);return h.forEach((e,r)=>{const d=c[e],m=Object.keys(d),b=(n+l)*h.length-(m.length>1?l:0);let g=0,f=0;m.forEach(e=>{const c=d[e],h=o[e],m=(n+l)*r+p/2-b/2,x=c>0,C=x?Math.abs(100*(a(g-c)-a(g)+Number.EPSILON)/100):Math.abs(100*(a(f-c)-a(f)+Number.EPSILON)/100);x&&(g+=c);const y=x?100*(a(g)+Number.EPSILON)/100:a(f)-a(0)+a(0);u.push({x:m,y:y+(i||0),height:C,color:h,value:c,groupName:s,name:e,stackIndex:r,groupIndex:t}),x||(f+=c)})}),u})})({data:a,yScale:Ne,xScale:Pe,barWidth:Ae,barPadding:"number"==typeof u?u:0,colors:p,marginTop:te}),We=V?V(je):je;Re.attr("transform","translate( "+(ne+Xe)+", 0)"),(e=>{let{svg:t,yScale:a,xScale:r,yTicksCount:n,drawGridX:l,drawGridY:o}=e;if(!o&&!l)return;const i=t.append("g").attr("class",Je.barChartGridGlobal),s=a.ticks(n),c=r.range(),d=r.domain();if(l&&i.append("g").selectAll("line").data(s).join("line").attr("class",e=>0===e?Je.barChartGridLineX+" "+Je.barChartGridLineXZero:Je.barChartGridLineX).attr("x1",()=>c[0]).attr("x2",()=>c[1]).attr("y1",e=>Math.round(a(e))).attr("y2",e=>Math.round(a(e))),o){const e=e=>void 0!==d[e]?0===e?c[0]:Math.round(r.step()*e+c[0]-r.step()/2*r.padding()):c[1];i.append("g").selectAll("line").data(Array.from({length:d.length+1},(e,t)=>t)).join("line").attr("class",e=>0===e?Je.barChartGridLineY+" "+Je.barChartGridLineYZero:Je.barChartGridLineY).attr("x1",e).attr("x2",e).attr("y1",()=>Math.round(a(s[0]))).attr("y2",()=>Math.round(a(s[s.length-1])))}})({svg:we,yScale:Ne,xScale:Pe,yTicksCount:Ye,drawGridY:f,drawGridX:x}),Oe.attr("transform","translate(0, "+(Ne(Ee[0])+(m||0))+")"),we.append("defs").append("mask").attr("id","height-limit-mask").append("rect").attr("width","100%").attr("height",se-re+2).attr("fill","white");const qe=we.append("g").attr("class",Je.barChartBarGlobal).attr("mask","url(#height-limit-mask)").selectAll("g").data(We).enter().append("g").attr("transform",(e,t)=>"translate("+Math.round(Pe(t))+","+-(te||0)+")"),Ze=Z?Z({groups:qe,yScale:Ne,marshalledData:We,barWidth:Ae}):(e=>{let{groups:t,barWidth:a}=e;return t.selectAll("rect").data(e=>e).join("rect").attr("x",e=>e.x).attr("y",e=>e.y).attr("width",a).attr("height",e=>e.height).style("fill",e=>e.color)})({groups:qe,barWidth:Ae});n.forEach(e=>{if(e){if(e.horizontal)return e.line&&we.append("line").style("stroke",e.lineColor||e.color||"inherit").style("stroke-width",1).style("stroke-dasharray","5, 3").attr("x1",ne+Xe).attr("y1",Ne(e.value)+1).attr("x2",ie).attr("y2",Ne(e.value)+1),void we.append("text").attr("y",Ne(e.value)+1).attr("x",ne+Xe).attr("text-anchor","middle").attr("class",["marker",e.className].filter(Boolean).join(" ")).style("fill",(null==e?void 0:e.color)||"inherit").text(e.label);e.line&&we.append("line").style("stroke",e.lineColor||e.color||"inherit").style("stroke-width",1).style("stroke-dasharray","5, 3").attr("x1",ie/a.length*e.value+1).attr("y1",0).attr("x2",ie/a.length*e.value+1).attr("y2",se-te-re+re/2),we.append("text").attr("y",se-3).attr("x",ie/a.length*e.value+1).attr("text-anchor","right"===e.align?"end":"left"===e.align?"start":"middle").attr("class",["marker",e.className].filter(Boolean).join(" ")).style("fill",(null==e?void 0:e.color)||"inherit").text(e.label)}});let Ue=null;Array.isArray(r)&&r.length>0&&(Ue=(e=>{let{svg:t,lineData:a,min:r,yScale:n,xScale:l,curve:i,stackedLine:s}=e,c=null,d=null,u=null;const p=o.line().defined(e=>null!==e).x((e,t)=>l(t)+h/2).y(e=>n(e)).curve(i||o.curveLinear),h=l.bandwidth(),m=a.filter(e=>{let{lineType:t}=e;return"line"===t}),b=a.filter(e=>{let{lineType:t}=e;return"area"===t});if(m.length>0&&(c=t.append("g").attr("class",He.barChartLinesGlobal).selectAll("path").data(m).join("path").attr("class",He.barChartLine).attr("d",e=>p(e.values)).attr("stroke",e=>{let{stroke:t}=e;return t||""}).attr("fill",e=>{let{fill:t}=e;return t||"none"})),b.length>0){let e=-2;u=o.area().x((e,t)=>l(t)+h/2).y0((t,l)=>(0===l&&(e+=1),n(s&&e>-1?"number"!=typeof a[e].values[l]?0:a[e].values[l]:r))).y1(e=>n(e)).curve(i||o.curveLinear),d=t.append("g").attr("class",He.barChartAreasGlobal).selectAll("path").data(b).join("path").attr("class",He.barChartArea).attr("d",e=>u&&u(e.values)).attr("fill",e=>{let{fill:t}=e;return t||"none"})}return{areasSelection:d,linesSelection:c,area:u}})({svg:we,lineData:r,xScale:Pe,yScale:Ne,min:"number"==typeof F?F:ke,stackedLine:Y,curve:R})),S&&S({bars:Ze,yScale:Ne,lines:Ue,marshalledData:We,lineData:r}),(B||N)&&(e=>{let{svg:t,node:a,data:r,marshalledData:n,xScale:s,yScale:u,renderTooltip:p,labelPosition:h,marginTop:m,renderLabel:b,barWidth:g,barPadding:f,dynamicTooltipEnable:x,hideTooltipGroupName:C,tooltipY:y,tooltipBind:v,lineData:L,formatTooltipValue:T,formatTooltipName:k,tooltipYDomain:S,setTooltipPosition:w,onLabelItem:B,isBarTooltip:M,bars:A,tooltipRoot:N,tooltipClassName:E,onBarClick:G,onBarHover:z}=e;o.select(a).select("."+Je.barChartMouseContainer).remove();const Y=s.domain(),[R,X]=s.range(),[I,P]=u.range(),F=s.bandwidth(),D=o.format(","),V=Y.map(e=>{return t=Number(e)+1,void 0!==Y[t]?0===t?R:Math.round(s.step()*t+R-s.step()/2*s.padding()):X;var t}),O=S?S({data:n,lineData:L,yScale:u}):n.reduce((e,t,a)=>{const r=o.min(L,e=>{let{values:t}=e;return"number"==typeof t[a]?u((t[a]||0)-P):Number.POSITIVE_INFINITY})||Number.POSITIVE_INFINITY;return e.push(t.reduce((e,t)=>{let{y:a}=t;return Math.min(e,a,r)},Number.POSITIVE_INFINITY)),e},[]),j=t.append("g").attr("class","lineChartMouseGlobal"),W=j.append("rect").attr("width",X-R).attr("height",Math.abs(I-P)).attr("class",Je.barChartMouseRect).attr("transform","translate("+R+", "+P+")");if(x){const e=N||document.querySelector("body");let u=o.select("."+Je.barChartMouseTooltip);0===u.size()&&(u=o.select(e).append("div").attr("class",Je.barChartMouseTooltip).style("opacity","0").style("position","absolute").html(()=>i.renderToString(l.createElement(ce,{className:Je.barChartTooltipFlex}))));const h=u.select("."+Je.barChartTooltipFlex);let m=!1,b=null;const f=e=>{m=Boolean(e),u.style("opacity",m?"1":"0"),m?(u.attr("class",Je.barChartMouseTooltip+" "+(E||"")),u.style("transition",null)):(u.attr("class",Je.barChartMouseTooltip),b=null,u.style("transition","none"),u.style("top",null),u.style("left",null))};W.on("mouseout.tooltip",()=>f()),W.on("touchmove.tooltip mousemove.tooltip",e=>{const[x,S]=o.pointer(e,document),[B]=o.pointer(e,W),[N,E]=o.pointer(e,a),G=B-(B-N),z=x-N,Y=S-E,R=V.findIndex(e=>G<=e);if(M){const t=document.elementsFromPoint(e.clientX,e.clientY),a=o.select(A.nodes()[R]).selectAll("rect").nodes();if(!t.some(e=>a.includes(e)))return m&&f(!1),void W.style("cursor","default");W.style("cursor","pointer")}const X=("number"==typeof y?y:O[R]-P)+Y,I=(v?(s(R)||0)+F/2:G)+z;if(v&&b===R)return;let j=n[R];if(Array.isArray(j)&&0===j.length)return;if(L){const e=L.map(e=>{let{values:t}=e;return c({},d(e,tt),{value:t[R],groupName:r[R]&&r[R].groupName})});Array.isArray(e)&&Array.isArray(j)&&(j=j.concat(e))}const q=t.node().getBoundingClientRect().width;"function"==typeof w?w({left:I,top:X,tooltip:u,svgWidth:q}):w||u.style("left",I+"px").style("top",X+"px"),p?h.html(()=>i.renderToString(l.createElement(l.Fragment,null,p(j,w?{left:I,top:X,tooltip:u,svgWidth:q}:void 0,g)))):(m||f(!0),h.html(()=>i.renderToString(l.createElement(pe,{className:Je.barChartTooltip},j&&j[0]&&!C&&l.createElement(he,{className:Je.barChartTooltipGroupName},j[0].groupName),j&&j.map(e=>{let{name:t,value:a,stroke:r,fill:n,color:o,lineType:i}=e;return l.createElement(me,{key:t,className:Je.barChartTooltipItem},l.createElement(be,{className:Je.barChartTooltipColFlex},i?l.createElement(fe,{className:Je.barChartColorLine,style:{backgroundColor:r||n}}):l.createElement(ge,{className:Je.barChartColorBox,style:{backgroundColor:o}}),l.createElement(xe,{className:Je.barChartTooltipName},k?k(t):t)),l.createElement(Ce,{className:Je.barChartTooltipValue},T?T(a,t):D(a)))}))))),b=R,m||f(!0)})}const q=o.select(a).append("div").attr("class",Je.barChartMouseContainer).append("div").attr("class",Je.barChartLabelContainer).style("position","absolute").style("top",P+"px"),Z=(e,t)=>{const[r,l]=o.pointer(e,W),[i,s]=o.pointer(e,a),c=r-(r-i),d=l-s,u=V.findIndex(e=>c<=e),p=n[u][0];p.height>=I-d&&t(p)};if(j.on("click",e=>Z(e,e=>G&&G(e))).on("mousemove",e=>Z(e,e=>z&&z(e))).on("mouseleave",()=>z&&z(void 0)),h){const e=L?n.map((e,t)=>e.concat(L.map(a=>{let{values:r,name:n,stroke:l}=a;const{stacksCount:o}=e.reduce((e,t)=>{let{stackIndex:a}=t;const{indexFlag:r,stacksCount:n}=e;return a!==r?{indexFlag:a,stacksCount:n+1}:e},{indexFlag:-1,stacksCount:0});return{x:e[0].x-g/2+(g*o+(f||0)*(o-1))/2,y:u(r[t])+m,height:0,color:l,value:r[t],groupName:e[0].groupName,name:n,stackIndex:0,groupIndex:t}}))):n,t=q.selectAll("div").data(e).enter().append("div").style("position","absolute").style("transform",(e,t)=>"translate("+Math.round(s(t))+"px,"+-(m||0)+"px)"),a="center"===h?ue:de,r=(e=>{switch(e){case"top":return ve;case"bottom":return Le;default:return ye}})(h);t.selectAll("span").data(e=>B?B(e):e).join("div").style("left",e=>Math.round(e.x+g/2)+"px").style("top",e=>((e,t,a)=>{switch(e){case"center":return a.y+a.height/2-t;case"bottom":return a.y+a.height-t;default:return a.y}})(h,P,e)+"px").style("position","absolute").html(e=>i.renderToString(l.createElement(a,{className:Je.barChartLabelFlex},b?b(c({},e,{barWidth:g})):l.createElement(r,{className:Je.barChartLabel},D(e.value)))))}})({svg:we,node:e,xScale:Pe,yScale:Ne,marshalledData:We,data:a,lineData:r,renderTooltip:A,labelPosition:N,marginTop:te,renderLabel:E,barWidth:Ae,barPadding:u,dynamicTooltipEnable:B,hideTooltipGroupName:M,tooltipY:G,tooltipBind:z,formatTooltipValue:X,formatTooltipName:I,tooltipYDomain:D,setTooltipPosition:H,onLabelItem:U,isBarTooltip:_,bars:qe,tooltipRoot:K,tooltipClassName:Q,onBarClick:$,onBarHover:ee}),w&&w({svg:we,marshalledData:We,yScale:Ne,xScale:Pe,lineData:r})}},nt=e=>{const{className:t,style:a,children:r,selectable:o}=e,[i,s]=h();return n.useEffect(()=>{s&&rt(s,e)},[s,e]),m(e.width,()=>rt(s,e)),((e,t)=>{const a=n.useRef(!1),r=n.useRef(0),l=n.useRef(),o=n.useCallback(()=>{e&&l.current&&(a.current=!1,e.removeChild(l.current),l.current=void 0)},[e]),i=n.useCallback(n=>{const i=Boolean(n.touches);var s,c,d;n.stopPropagation(),e&&3!==n.which&&(o(),l.current=document.createElement("div"),l.current.setAttribute("class",Je.barChartSelection),l.current.setAttribute("style","height: calc(100% - "+(null!=(s=null==(c=t.margin)?void 0:c.bottom)?s:0)+"px)"),e.appendChild(l.current),a.current=!0,r.current=i?(null==(d=n.touches[0])?void 0:d.pageX)-e.firstChild.getBoundingClientRect().left:n.offsetX,l.current.style.display="block",l.current.style.width="0px",l.current.style.left=r.current+"px")},[e]),s=n.useCallback(t=>{const n=Boolean(t.touches);if(t.stopPropagation(),e&&a.current&&l.current){var o;const a=e.firstChild.getBoundingClientRect().width,i=n?(null==(o=t.touches[0])?void 0:o.pageX)-e.firstChild.getBoundingClientRect().left:t.offsetX,s=i-r.current;i>=0&&(s>0?(l.current.style.marginLeft="0px",l.current.style.width=i<=a?s+"px":a-r.current+"px"):(l.current.style.right=a-r.current+"px",l.current.style.width=Math.abs(s)+"px",l.current.style.marginLeft=s+"px")),n&&e.offsetLeft>t.touches[0].pageX&&(l.current.style.right=a-r.current+"px",l.current.style.width=r.current+"px",l.current.style.marginLeft="-"+r.current+"px")}},[e]),c=n.useCallback(t=>{if(a.current&&e&&l.current){if(e.offsetLeft>t.pageX){const t=e.firstChild.getBoundingClientRect().width;l.current.style.right=t-r.current+"px",l.current.style.width=r.current+"px",l.current.style.marginLeft="-"+r.current+"px"}if(e.offsetLeft+e.offsetWidth<t.pageX){const t=e.firstChild.getBoundingClientRect().width;l.current.style.left=r.current+"px",l.current.style.width=t-r.current+"px",l.current.style.marginLeft="0px"}}},[e]),d=n.useCallback(()=>{if(e&&l.current){const a=e.firstChild.getBoundingClientRect().width,r=l.current.offsetLeft>=0?l.current.offsetLeft<=a?l.current.offsetLeft:a:0,n=l.current.getBoundingClientRect().right-l.current.getBoundingClientRect().left,o=l.current.offsetLeft+n<=a?l.current.offsetLeft+n>=0?l.current.offsetLeft+n:0:a,i=Math.round(r),s=Math.round(o);s-i>0&&t.onSelect&&t.onSelect([i,s])}o()},[e,o]);n.useEffect(()=>(e&&(e.childNodes.forEach(e=>{e.style.userSelect="none"}),e.addEventListener("mousedown",i),e.addEventListener("touchstart",i),e.addEventListener("mousemove",s),e.addEventListener("touchmove",s),e.addEventListener("mouseleave",c),e.addEventListener("mouseup",d),e.addEventListener("touchend",d),document.addEventListener("mouseup",d)),()=>{null==e||e.removeEventListener("mousedown",i),null==e||e.removeEventListener("touchstart",i),null==e||e.removeEventListener("mousemove",s),null==e||e.removeEventListener("touchmove",s),null==e||e.removeEventListener("mouseleave",c),null==e||e.removeEventListener("mouseup",d),null==e||e.removeEventListener("touchend",d),document.removeEventListener("mouseup",d)}),[e])})(o?s:null,e),l.createElement("div",{className:t,style:a},l.createElement(Qe,null),l.createElement(Ke,{ref:i,selectable:o},r))};nt.defaultProps={data:[],colors:{},margin:{top:10,right:10,bottom:10,left:0},barWidth:12,barPadding:0,height:320,yAxisPadding:0,xAxisPadding:0,tooltipBind:!0,sectionPadding:1};const lt=["value"];var ot,it,st,ct,dt,ut,pt,ht;const mt={horizontalBarChartButtonTd:"horizontalBarChartButtonTd",horizontalBarChartLabelTd:"horizontalBarChartLabelTd",horizontalBarChartLabelCell:"horizontalBarChartLabelCell",horizontalBarChartBarTd:"horizontalBarChartBarTd",horizontalBarChartBarFlex:"horizontalBarChartBarFlex",horizontalBarChartBar:"horizontalBarChartBar",horizontalBarChartBarFirst:"horizontalBarChartBarFirst",horizontalBarChartBarLast:"horizontalBarChartBarLast",horizontalBarChartBarOnly:"horizontalBarChartBarOnly",horizontalBarChartTooltipFlex:"horizontalBarChartTooltipFlex",horizontalBarChartStackWrapper:"horizontalBarChartStackWrapper",horizontalBarChartTooltipContainer:"horizontalBarChartTooltipContainer",horizontalBarChartStackSumContainer:"horizontalBarChartStackSumContainer",horizontalBarChartStackSum:"horizontalBarChartStackSum",horizontalBarChartXScaleTd:"horizontalBarChartXScaleTd",horizontalBarChartXScaleTicks:"horizontalBarChartXScaleTicks",horizontalBarChartXScaleTick:"horizontalBarChartXScaleTick",horizontalBarChartTooltipItem:"horizontalBarChartTooltipItem",horizontalBarChartTooltipName:"horizontalBarChartTooltipName",horizontalBarChartTooltipValue:"horizontalBarChartTooltipValue"},bt=r.table(ot||(ot=u(["\n width: 100%;\n"]))),gt=r.div(it||(it=u(["\n text-align: right;\n"]))),ft=r.div(st||(st=u(["\n width: 100%;\n display: flex;\n height: 1rem;\n"]))),xt=r.td(ct||(ct=u(["\n width: 100%;\n position: relative;\n vertical-align: middle;\n"]))),Ct=r(ce)(dt||(dt=u(["\n position: absolute;\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n will-change: left, top;\n"]))),yt=r.div(ut||(ut=u(["\n position: relative;\n"]))),vt=r.div(pt||(pt=u(["\n white-space: nowrap;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(0, -50%);\n"]))),Lt=r.div(ht||(ht=u(["\n position: absolute;\n top: 0;\n display: flex;\n justify-content: flex-start;\n height: 100%;\n"]))),Tt=e=>{let{renderTooltip:t,bars:a,style:r,className:n}=e;const i=o.format(",");return l.createElement(Ct,{className:mt.horizontalBarChartTooltipFlex+" "+(n||""),style:r},l.createElement(pe,{className:mt.horizontalBarChartTooltipContainer},t?t(a):a.map((e,t)=>{let{color:a,name:r,value:n,groupName:o}=e;return l.createElement(me,{key:(r||"")+"-"+t+"-"+o,className:mt.horizontalBarChartTooltipItem},a&&l.createElement(ge,{style:{backgroundColor:a}}),r&&l.createElement(xe,{className:mt.horizontalBarChartTooltipName},r),l.createElement(Ce,{className:mt.horizontalBarChartTooltipValue},i(n)))})))},kt=document.createElement("div"),St=["item","mouseMove","mouseLeave","tooltipBind"];var wt;const Bt=r.div(wt||(wt=u(["\n position: relative;\n display: inline-flex;\n height: 100%;\n"]))),Mt=e=>{let{withTooltip:t,bar:a,formatNativeTitle:r,tooltipBind:n,mouseMove:o,mouseLeave:i,pointerEventsNone:s,isFirstChild:c,isLastChild:d,isOnlyChild:u}=e;const{color:p,width:h}=a,m=Math.abs(h),b=t?e=>o(e,[a]):void 0,g=t?()=>i():void 0;return l.createElement(Bt,{className:mt.horizontalBarChartBar+" "+(c?mt.horizontalBarChartBarFirst:"")+" "+(d?mt.horizontalBarChartBarLast:"")+" "+(u?mt.horizontalBarChartBarOnly:""),style:{width:m+"%",backgroundColor:p,pointerEvents:s?"none":"auto"},title:r?r(a):"",onMouseOver:b,onMouseMove:n?b:void 0,onMouseOut:g})};var At,Nt,Et;const Gt=r.td(At||(At=u(["\n position: relative;\n"]))),zt=r.div(Nt||(Nt=u(["\n position: relative;\n height: 1rem;\n"]))),Yt=r.div(Et||(Et=u(["\n white-space: nowrap;\n width: 0;\n height: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n"]))),Rt=e=>{let{maxValue:t,scaleTicks:a,renderTicks:r,scaleDomain:i}=e;const s=(e=>{let{maxValue:t,scaleTicks:a,scaleDomain:r}=e;return n.useMemo(()=>{const e=o.scaleLinear().domain([0,t]).range([0,100]),n=e.ticks(a);return(r||n).map(t=>({value:t,x:e(t)}))},[t,a,r])})({maxValue:t,scaleTicks:a,scaleDomain:i}),c=o.format(",");return l.createElement("tr",null,l.createElement("td",null),l.createElement(Gt,{className:mt.horizontalBarChartXScaleTd},l.createElement(zt,{className:mt.horizontalBarChartXScaleTicks},s.map((e,t,a)=>{const{value:n,x:o}=e;return l.createElement(Yt,{key:n,className:mt.horizontalBarChartXScaleTick,style:{left:o+"%",justifyContent:0===t?"flex-start":t===a.length-1?"flex-end":""}},r?r(e):c(n))}))))},Xt=e=>{let{data:t,className:a,style:r,children:i,labels:u,fullExtent:p,maxValue:h,formatNativeTitle:m,renderTooltip:b,withTooltip:g,withStackSum:f,tooltipBind:x,scaleTicks:C,renderTicks:y,renderButton:v,tooltipStyle:L,tooltipClassName:T,scaleDomain:k,renderDataTable:S,thead:w,withoutXScale:B,stackedTooltip:M,fullChartTooltip:A,hideTooltip:N}=e;const{fullMax:E,data:G}=(e=>{let{data:t,fullExtent:a,maxValue:r,labels:l}=e;return n.useMemo(()=>{const e=o.max(t,e=>o.sum(e,e=>{let{value:t}=e;return t})),n=o.scaleLinear().domain([0,"number"==typeof r?r:e]).range([0,100]);return{fullMax:e,data:t.map((e,t)=>(a||n.domain([0,"number"==typeof r?r:o.sum(e,e=>{let{value:t}=e;return t})]),e.map(e=>{let{value:a}=e;return c({},d(e,lt),{value:a,width:n(a),groupName:l?l[t]:""})})))}},[t,a,r,l])})({data:t,fullExtent:p,maxValue:h,labels:u}),[z,Y]=(e=>{let{renderTooltip:t,tooltipBind:a,tooltipStyle:r,tooltipRoot:i,tooltipClassName:d,hideTooltip:u}=e;return n.useEffect(()=>{const e=i||document.querySelector("body");return e&&e.appendChild(kt),()=>{s.unmountComponentAtNode(kt)}},[i]),[n.useCallback((e,n)=>{let[i,u]=o.pointer(e,document);if(!a&&"getBoundingClientRect"in e.target){const{width:t,height:a}=e.target.getBoundingClientRect(),[r,n]=o.pointer(e,e.target);i=i-r+t/2,u=u-n+a/2}kt&&(kt.style.visibility="visible"),s.render(l.createElement(Tt,{style:c({left:i,top:u},r),bars:n,renderTooltip:t,className:d}),kt)},[d,r,t,a]),n.useCallback(()=>{kt&&(kt.style.visibility="hidden",u&&u())},[u])]})({renderTooltip:b,tooltipBind:x,tooltipStyle:L,tooltipClassName:T,hideTooltip:N}),R=(e=>n.useMemo(()=>e?e=>{let{item:t,mouseMove:a,mouseLeave:r,tooltipBind:n}=e,o=d(e,St);return l.createElement(Lt,Object.assign({className:mt.horizontalBarChartStackWrapper,onMouseOver:e=>a(e,t),onMouseMove:n?e=>a(e,t):void 0,onMouseOut:r},o))}:e=>{let{children:t}=e;return l.createElement(n.Fragment,null,t)},[e]))(M);return l.createElement(bt,{className:a,style:r,onMouseOver:A?e=>z(e,G.flat()):void 0,onMouseMove:A?e=>z(e,G.flat()):void 0,onMouseOut:A?Y:void 0},w,l.createElement("tbody",null,G.map((e,t)=>{const a=(f||S)&&o.sum(e,e=>{let{value:t}=e;return t}),r=o.sum(e,e=>{let{width:t}=e;return t});return l.createElement("tr",{key:"row-"+t},"function"==typeof v&&l.createElement("td",{className:mt.horizontalBarChartButtonTd},v(e,t)),l.createElement("td",{className:mt.horizontalBarChartLabelTd},u&&u[t]&&l.createElement(gt,{className:mt.horizontalBarChartLabelCell},u[t])),l.createElement(xt,{className:mt.horizontalBarChartBarTd,style:{pointerEvents:A?"none":"auto"}},l.createElement(ft,{className:mt.horizontalBarChartBarFlex,style:{pointerEvents:A?"none":"auto"}},l.createElement(R,{style:M?{width:r+"%"}:void 0,item:e,tooltipBind:x,mouseMove:z,mouseLeave:Y}),e.map((e,t,a)=>0!==e.value&&l.createElement(Mt,{key:"bar-"+(e.name||"")+"-"+t,formatNativeTitle:m,bar:e,tooltipBind:x,pointerEventsNone:M||A,withTooltip:g&&!M,mouseMove:z,mouseLeave:Y,isOnlyChild:1===a.length,isFirstChild:0===t&&a.length>1,isLastChild:a.length-1===t&&a.length>1})),f&&l.createElement(yt,{className:mt.horizontalBarChartStackSumContainer},l.createElement(vt,{className:mt.horizontalBarChartStackSum},a)))),S&&S(e,a,t))}),!B&&l.createElement(Rt,{maxValue:"number"==typeof h?h:E,scaleTicks:C,renderTicks:y,scaleDomain:k}),i))};Xt.defaultProps={fullExtent:!0,withTooltip:!1,withStackSum:!1,tooltipBind:!1,scaleTicks:4,withoutXScale:!1};const It={height:280,minSize:6,maxSize:30,margin:{top:10,right:15,bottom:10,left:0},yAxisPadding:10,xAxisPadding:10,yScaleLabelPadding:10};var Pt,Ft;const Dt={bubbleChartYAxis:"bubbleChartYAxis",bubbleChartYAxisZeroTick:"bubbleChartYAxisZeroTick",bubbleChartXAxis:"bubbleChartXAxis",bubbleChartGridGlobal:"bubbleChartGridGlobal",bubbleChartGridLineX:"bubbleChartGridLineX",bubbleChartGridLineY:"bubbleChartGridLineY",bubbleChartCircle:"bubbleChartCircle",bubbleChartYScaleLabel:"bubbleChartYScaleLabel",bubbleChartTooltip:"bubbleChartTooltip",bubbleChartTooltipContainer:"bubbleChartTooltipContainer",bubbleChartTooltipFlex:"bubbleChartTooltipFlex",bubbleChartTip:"bubbleChartTip"},Vt=r(p)(Pt||(Pt=u(["\n .",",\n .",",\n ."," {\n shape-rendering: crispEdges;\n }\n\n .",",\n ."," {\n stroke: rgba(149, 149, 149, 0.24);\n }\n\n ."," {\n font-size: 10px;\n }\n"])),Dt.bubbleChartYAxis,Dt.bubbleChartXAxis,Dt.bubbleChartGridGlobal,Dt.bubbleChartGridLineX,Dt.bubbleChartGridLineY,Dt.bubbleChartYScaleLabel),Ot=a.createGlobalStyle(Ft||(Ft=u(["\n ."," {\n position: absolute;\n transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);\n pointer-events: none;\n z-index: 1;\n }\n"])),Dt.bubbleChartTooltipContainer);var jt;const Wt=r.div(jt||(jt=u(["\n width: 0;\n height: 0;\n display: flex;\n align-items: flex-end;\n justify-content: center;\n font-size: 12px;\n white-space: nowrap;\n"]))),qt=(e,t)=>{const{data:a,margin:r,xAxisPadding:n,yAxisPadding:s,customYScale:c,customYAxis:d,customXScale:u,customXAxis:p,minSize:h,maxSize:m,minYValue:g,maxYValue:f,drawGridY:x,drawGridX:C,scaleLog:y,xScaleItemWidth:v,bubbleStyle:L,customize:T,yScaleLabel:k,yScaleLabelPadding:S,enableTooltip:w,tooltipRoot:B,tooltipClassName:M,renderTooltip:A}=t;if(null!==e&&a.length){const N=r?r.top:0,E=r?r.right:0,G=r?r.bottom:0,z=r?r.left:0,{width:Y}=e.getBoundingClientRect(),R=t.width||Y,X=t.height||0,I=6,P="number"==typeof g?g:o.min(a,e=>{let{yValue:t}=e;return t}),F="number"==typeof f?f:o.max(a,e=>{let{yValue:t}=e;return t}),D=b(e,R,X||0),V=y?o.scaleLog().domain([o.min(a,e=>{let{sizeValue:t}=e;return t})||.1,o.max(a,e=>{let{sizeValue:t}=e;return t})||.1]).range([h||It.minSize||.1,m||It.maxSize||.1]):o.scaleLinear().domain([o.min(a,e=>{let{sizeValue:t}=e;return t}),o.max(a,e=>{let{sizeValue:t}=e;return t})]).range([h||It.minSize,m||It.maxSize]),O=X-N-G-(n||0),j=y?o.scaleLog().domain([P||.1,F||.1]).range([O||.1,N||.1]).nice():o.scaleLinear().domain([P,F]).range([O,N]).nice();c&&c(j);const W=j.ticks(),q=o.axisLeft(j).ticks(I),Z=q.tickArguments()[0],H=D.append("g").attr("class",Dt.bubbleChartYAxis).call(q);let U=S||0;if(k){const e=D.append("text").text(k).attr("class",Dt.bubbleChartYScaleLabel),{width:t,height:a}=Ge(e);U+=a,e.attr("transform","rotate(-90) translate(-"+(O+G+t)/2+", "+a+")")}H.selectAll(".tick").attr("class",e=>0===e?"tick "+Dt.bubbleChartYAxisZeroTick:"tick"),d&&d(H);const{width:_}=Ge(H),J=y?o.scaleLog().domain([o.min(a,e=>{let{xValue:t}=e;return t})||.1,o.max(a,e=>{let{xValue:t}=e;return t})||.1]).range([z+_+(s||0)+U||.1,R-E||.1]):o.scaleLinear().domain([o.min(a,e=>{let{xValue:t}=e;return t}),o.max(a,e=>{let{xValue:t}=e;return t})]).range([z+_+(s||0)+U,R-E]);u&&u(J);const K=o.axisBottom(J);if("number"==typeof v){const[e,t]=J.range();K.ticks(Math.round((t-e)/v)).tickSizeOuter(0)}const Q=D.append("g").call(K).attr("class",Dt.bubbleChartXAxis);p&&p(Q),H.attr("transform","translate("+(z+_+U)+", 0)"),(e=>{let{svg:t,yScale:a,xScale:r,yTicksCount:n,drawGridX:l,drawGridY:o}=e;if(!o&&!l)return;const[i,s]=r.domain(),c=t.append("g").attr("class",Dt.bubbleChartGridGlobal),d=a.ticks(n);l&&c.append("g").selectAll("line").data(d).join("line").attr("class",Dt.bubbleChartGridLineX).attr("x1",()=>r(i)).attr("x2",()=>r(s)).attr("y1",e=>Math.round(a(e))).attr("y2",e=>Math.round(a(e))),o&&c.append("g").selectAll("line").data(r.ticks(n)).join("line").attr("class",Dt.bubbleChartGridLineY).attr("x1",e=>Math.round(r(e))).attr("x2",e=>Math.round(r(e))).attr("y1",()=>Math.round(a(d[0]))).attr("y2",()=>Math.round(a(d[d.length-1])))})({svg:D,yScale:j,xScale:J,yTicksCount:Z,drawGridY:x,drawGridX:C}),Q.attr("transform","translate(0, "+(j(W[0])+(n||0))+")");const $=D.append("g").selectAll("dot").data(a).enter().append("circle").attr("class",Dt.bubbleChartCircle).attr("cx",e=>{let{xValue:t}=e;return J(t)}).attr("cy",e=>{let{yValue:t}=e;return j(t)}).attr("r",e=>{let{sizeValue:t}=e;return V(t)/2}).attr("fill",e=>{let{color:t}=e;return t||"rgba(0, 176, 113, 0.6)"}).attr("stroke",e=>{let{stroke:t}=e;return t||"transparent"}).attr("style",e=>{let{style:t}=e;return t||L||""});w&&(e=>{let{bubbles:t,tooltipRoot:a,tooltipClassName:r,renderTooltip:n}=e;const s=a||document.querySelector("body"),c=o.format(",");let d=o.select(s).select("."+Dt.bubbleChartTooltip);null===d.node()&&(d=o.select(s).append("div").attr("class",Dt.bubbleChartTooltip));let u=d.append("div").attr("class",Dt.bubbleChartTooltipContainer+" "+(r||"")).style("opacity","0");t.on("mouseover.tooltip",(e,t)=>{const{sizeValue:a}=t,r=e.currentTarget,{x:o,y:s,width:d}=r.getBoundingClientRect(),p=window.pageXOffset+o+d/2,h=window.pageYOffset+s;u.style("left",p+"px").style("top",h+"px").html(()=>i.renderToString(l.createElement(Wt,{className:Dt.bubbleChartTooltipFlex},l.createElement(pe,{className:Dt.bubbleChartTip},c(a))))),n&&n({tooltip:u,data:t,circle:r}),u.style("opacity","1")}),t.on("mouseout.tooltip",()=>{u.style("opacity","0")})})({bubbles:$,tooltipRoot:B,tooltipClassName:M,renderTooltip:A}),T&&T({svg:D,bubbles:$,yScale:j,xScale:J,sizeScale:V})}},Zt=e=>{const{className:t,style:a,children:r,tooltipRoot:i}=e,[s,c]=h();return n.useEffect(()=>{c&&qt(c,e)},[c,e]),n.useEffect(()=>()=>(e=>{const t=e||document.querySelector("body");o.select(t).select("."+Dt.bubbleChartTooltip).remove()})(i),[i]),m(e.width,()=>qt(c,e)),l.createElement("div",{className:t,style:a},l.createElement(Ot,null),l.createElement(Vt,{ref:s},r))};Zt.defaultProps=It,exports.BarChart=nt,exports.BubbleChart=Zt,exports.CalendarChart=Ee,exports.ChartWrapper=p,exports.HorizontalBarChart=Xt,exports.LineChart=Ze,exports.PieChart=ke,exports.RadarChart=O,exports.SwipeScroll=L,exports.appendSvg=b,exports.barChartClassNames=Je,exports.bubbleChartClassNames=Dt,exports.calendarChartClassNames=Ae,exports.horizontalBarChartClassNames=mt,exports.lineChartClassNames=Ie,exports.pieChartclassNames=q,exports.radarChartclassNames=F,exports.useNode=h,exports.useResize=m;
|
|
2
2
|
//# sourceMappingURL=charts.cjs.production.min.js.map
|