@atlasinc/nivo-bar-ssr
Advanced tools
Comparing version 0.79.2 to 0.79.3
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@nivo/axes"),a=require("@nivo/annotations"),n=require("react/jsx-dev-runtime"),i=require("@nivo/legends"),r=require("@nivo/core"),t=require("react"),l=require("@react-spring/web"),o=require("@nivo/tooltip"),d=require("@nivo/colors"),u=require("@nivo/scales"),s=require("d3-shape");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(require("lodash/uniqBy"));function b(){return b=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},b.apply(this,arguments)}function m(e,a){if(null==e)return{};var n,i,r={},t=Object.keys(e);for(i=0;i<t.length;i++)n=t[i],a.indexOf(n)>=0||(r[n]=e[n]);return r}var v,f=function(e){var i=e.bars,r=e.annotations,t=a.useAnnotations({data:i,annotations:r,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var a=e.height,n=e.width;return{width:n,height:a,size:Math.max(n,a)}}});return n.jsxDEV(n.Fragment,{children:t.map((function(e,i){return n.jsxDEV(a.Annotation,b({},e),i,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarAnnotations.tsx",lineNumber:22,columnNumber:17},undefined)}))},void 0,!1)},g=function(e){var a=e.width,r=e.height,t=e.legends,l=e.toggleSerie;return n.jsxDEV(n.Fragment,{children:t.map((function(e,t){var o,d=e[0],u=e[1];return n.jsxDEV(i.BoxLegendSvg,b({},d,{containerWidth:a,containerHeight:r,data:null!=(o=d.data)?o:u,toggleSerie:d.toggleSerie&&"keys"===d.dataFrom?l:void 0}),t,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarLegends.tsx",lineNumber:14,columnNumber:13},undefined)}))},void 0,!1)},p=["data"],x="/home/oleksandr/code/atlas/nivo/packages/bar/src/BarItem.tsx",y=function(e){var a,i=e.bar,d=i.data,u=m(i,p),s=e.style,c=s.borderColor,h=s.color,v=s.height,f=s.labelColor,g=s.labelOpacity,y=s.labelX,k=s.labelY,S=s.transform,C=s.width,V=e.borderRadius,L=e.borderWidth,N=e.label,w=e.shouldRenderLabel,B=e.isInteractive,E=e.onClick,M=e.onMouseEnter,W=e.onMouseLeave,T=e.tooltip,D=e.isFocusable,I=e.ariaLabel,R=e.ariaLabelledBy,j=e.ariaDescribedBy,P=r.useTheme(),F=o.useTooltip(),H=F.showTooltipFromEvent,A=F.showTooltipAt,X=F.hideTooltip,Y=t.useMemo((function(){return function(){return t.createElement(T,b({},u,d))}}),[T,u,d]),q=t.useCallback((function(e){null==E||E(b({color:u.color},d),e)}),[u,d,E]),O=t.useCallback((function(e){return H(Y(),e)}),[H,Y]),G=t.useCallback((function(e){null==M||M(d,e),H(Y(),e)}),[d,M,H,Y]),z=t.useCallback((function(e){null==W||W(d,e),X()}),[d,X,W]),K=t.useCallback((function(){A(Y(),[u.absX+u.width/2,u.absY])}),[A,Y,u]),_=t.useCallback((function(){X()}),[X]);return n.jsxDEV(l.animated.g,{transform:S,children:[n.jsxDEV(l.animated.rect,{width:l.to(C,(function(e){return Math.max(e,0)})),height:l.to(v,(function(e){return Math.max(e,0)})),rx:V,ry:V,fill:null!=(a=d.fill)?a:h,strokeWidth:L,stroke:c,focusable:D,tabIndex:D?0:void 0,"aria-label":I?I(d):void 0,"aria-labelledby":R?R(d):void 0,"aria-describedby":j?j(d):void 0,onMouseEnter:B?G:void 0,onMouseMove:B?O:void 0,onMouseLeave:B?z:void 0,onClick:B?q:void 0,onFocus:B&&D?K:void 0,onBlur:B&&D?_:void 0},void 0,!1,{fileName:x,lineNumber:83,columnNumber:13},undefined),w&&n.jsxDEV(l.animated.text,{x:y,y:k,textAnchor:"middle",dominantBaseline:"central",fillOpacity:g,style:b({},P.labels.text,{pointerEvents:"none",fill:f}),children:N},void 0,!1,{fileName:x,lineNumber:104,columnNumber:17},undefined)]},void 0,!0,{fileName:x,lineNumber:82,columnNumber:9},undefined)},k=["color","label"],S={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(e){var a=e.color,i=e.label,r=m(e,k);return n.jsxDEV(o.BasicTooltip,{id:i,value:r.formattedValue,enableChip:!0,color:a},void 0,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarTooltip.tsx",lineNumber:5,columnNumber:12},undefined)},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[]},C=b({},S,{layers:["grid","axes","bars","markers","legends","annotations"],barComponent:y,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),V=b({},S,{layers:["grid","axes","bars","legends","annotations"],pixelRatio:"undefined"!=typeof window&&null!=(v=window.devicePixelRatio)?v:1}),L=function(e,a,n,i,r,t){return u.computeScale(i,{all:e.map(a),min:0,max:0},r,t).padding(n)},N=function(e,a){return e.map((function(e){return b({},a.reduce((function(e,a){return e[a]=null,e}),{}),e)}))},w=function(e){return Object.keys(e).reduce((function(a,n){return e[n]&&(a[n]=e[n]),a}),{})},B=function(e){return[e,Number(e)]},E=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],M=function(e,a){return e>a},W=function(e,a){return e<a},T=function(e,a){return Array.from(" ".repeat(a-e),(function(a,n){return e+n}))},D=function(e){return M(e,0)?0:e},I=function(e,a,n,i){var r=e.data,t=e.formatValue,l=e.getColor,o=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,s=void 0===u?0:u,c=e.keys,h=e.xScale,b=e.yScale,m=e.margin,v=n?W:M,f=r.map(w),g=[];return c.forEach((function(e,n){return T(0,h.domain().length).forEach((function(u){var c,p,x,y=B(r[u][e]),k=y[0],S=y[1],C=o(r[u]),V=(null!=(c=h(C))?c:0)+a*n+s*n,L=v(p=S,0)?null!=(x=b(p))?x:0:i,N=function(e,a){var n;return v(e,0)?i-a:(null!=(n=b(e))?n:0)-i}(S,L),w={id:e,value:null===k?k:S,formattedValue:t(S),hidden:!1,index:u,indexValue:C,data:f[u]};g.push({key:e+"."+w.indexValue,index:g.length,data:w,x:V,y:L,absX:m.left+V,absY:m.top+L,width:a,height:N,color:l(w),label:d(w)})}))})),g},R=function(e,a,n,i){var r=e.data,t=e.formatValue,l=e.getIndex,o=e.getColor,d=e.getTooltipLabel,u=e.keys,s=e.innerPadding,c=void 0===s?0:s,h=e.xScale,b=e.yScale,m=e.margin,v=n?W:M,f=r.map(w),g=[];return u.forEach((function(e,n){return T(0,b.domain().length).forEach((function(u){var s,p,x,y=B(r[u][e]),k=y[0],S=y[1],C=l(r[u]),V=v(p=S,0)?i:null!=(x=h(p))?x:0,L=(null!=(s=b(C))?s:0)+a*n+c*n,N=function(e,a){var n;return v(e,0)?(null!=(n=h(e))?n:0)-i:i-a}(S,V),w={id:e,value:null===k?k:S,formattedValue:t(S),hidden:!1,index:u,indexValue:C,data:f[u]};g.push({key:e+"."+w.indexValue,index:g.length,data:w,x:V,y:L,absX:m.left+V,absY:m.top+L,width:N,height:a,color:o(w),label:d(w)})}))})),g},j=function(e){var a,n,i=e.layout,r=e.minValue,t=e.maxValue,l=e.reverse,o=e.width,d=e.height,s=e.padding,c=void 0===s?0:s,h=e.innerPadding,v=void 0===h?0:h,f=e.valueScale,g=e.indexScale,p=e.hiddenIds,x=void 0===p?[]:p,y=m(e,E),k=y.keys.filter((function(e){return!x.includes(e)})),S=N(y.data,k),C="vertical"===i?["y","x",o]:["x","y",d],V=C[0],w=C[1],B=C[2],M=L(S,y.getIndex,c,g,B,w),W=b({max:t,min:r,reverse:l},f),T="auto"===W.min?D:function(e){return e},j=S.reduce((function(e,a){return[].concat(e,k.map((function(e){return a[e]})))}),[]).filter(Boolean),P=T(Math.min.apply(Math,j)),F=(n=Math.max.apply(Math,j),isFinite(n)?n:0),H=u.computeScale(W,{all:j,min:P,max:F},"x"===V?o:d,V),A="vertical"===i?[M,H]:[H,M],X=A[0],Y=A[1],q=(M.bandwidth()-v*(k.length-1))/k.length,O=[b({},y,{data:S,keys:k,innerPadding:v,xScale:X,yScale:Y}),q,W.reverse,null!=(a=H(0))?a:0];return{xScale:X,yScale:Y,bars:q>0?"vertical"===i?I.apply(void 0,O):R.apply(void 0,O):[]}},P=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],F=function e(a){var n;return a.some(Array.isArray)?e((n=[]).concat.apply(n,a)):a},H=function(e,a,n){var i=e.formatValue,r=e.getColor,t=e.getIndex,l=e.getTooltipLabel,o=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,b){var m,v,f=e[b],g=null!=(m=u(t(f.data)))?m:0,p=(null!=(v=function(e){return s(e[n?0:1])}(f))?v:0)+.5*o,x=function(e,a){var i;return(null!=(i=s(e[n?1:0]))?i:0)-a}(f,p)-o,y=B(f.data[e.key]),k=y[0],S=y[1],C={id:e.key,value:null===k?k:S,formattedValue:i(S),hidden:!1,index:b,indexValue:d,data:w(f.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:g,y:p,absX:c.left+g,absY:c.top+p,width:a,height:x,color:r(C),label:l(C)})}))})),h},A=function(e,a,n){var i=e.formatValue,r=e.getColor,t=e.getIndex,l=e.getTooltipLabel,o=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return s.domain().forEach((function(d,b){var m,v,f=e[b],g=null!=(m=s(t(f.data)))?m:0,p=(null!=(v=function(e){return u(e[n?1:0])}(f))?v:0)+.5*o,x=function(e,a){var i;return(null!=(i=u(e[n?0:1]))?i:0)-a}(f,p)-o,y=B(f.data[e.key]),k=y[0],S=y[1],C={id:e.key,value:null===k?k:S,formattedValue:i(S),hidden:!1,index:b,indexValue:d,data:w(f.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:p,y:g,absX:c.left+p,absY:c.top+g,width:x,height:a,color:r(C),label:l(C)})}))})),h},X=function(e){var a,n=e.data,i=e.layout,r=e.minValue,t=e.maxValue,l=e.reverse,o=e.width,d=e.height,c=e.padding,h=void 0===c?0:c,v=e.valueScale,f=e.indexScale,g=e.hiddenIds,p=void 0===g?[]:g,x=m(e,P),y=x.keys.filter((function(e){return!p.includes(e)})),k=s.stack().keys(y).offset(s.stackOffsetDiverging)(N(n,y)),S="vertical"===i?["y","x",o]:["x","y",d],C=S[0],V=S[1],w=S[2],B=L(n,x.getIndex,h,f,w,V),E=b({max:t,min:r,reverse:l},v),M=(a=F(k),"log"===v.type?a.filter((function(e){return 0!==e})):a),W=Math.min.apply(Math,M),T=Math.max.apply(Math,M),D=u.computeScale(E,{all:M,min:W,max:T},"x"===C?o:d,C),I="vertical"===i?[B,D]:[D,B],R=I[0],j=I[1],X=x.innerPadding>0?x.innerPadding:0,Y=B.bandwidth(),q=[b({},x,{innerPadding:X,stackedData:k,xScale:R,yScale:j}),Y,E.reverse];return{xScale:R,yScale:j,bars:Y>0?"vertical"===i?H.apply(void 0,q):A.apply(void 0,q):[]}},Y=function(e){var a=e.bars,n=e.direction,i=e.from,t=e.groupMode,l=e.layout,o=e.legendLabel,d=e.reverse,u=r.getPropertyAccessor(null!=o?o:"indexes"===i?"indexValue":"id");return"indexes"===i?function(e,a,n){var i=h.default(e.map((function(e){var a,i;return{id:null!=(a=e.data.indexValue)?a:"",label:n(e.data),hidden:e.data.hidden,color:null!=(i=e.color)?i:"#000"}})),(function(e){return e.id}));return"horizontal"===a&&i.reverse(),i}(a,l,u):function(e,a,n,i,r,t){var l=h.default(e.map((function(e){var a;return{id:e.data.id,label:t(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return("vertical"===a&&"stacked"===i&&"column"===n&&!0!==r||"horizontal"===a&&"stacked"===i&&!0===r)&&l.reverse(),l}(a,l,n,t,d,u)},q=function(e){var a=e.indexBy,n=void 0===a?S.indexBy:a,i=e.keys,l=void 0===i?S.keys:i,o=e.label,u=void 0===o?S.label:o,s=e.tooltipLabel,c=void 0===s?S.tooltipLabel:s,h=e.valueFormat,m=e.colors,v=void 0===m?S.colors:m,f=e.colorBy,g=void 0===f?S.colorBy:f,p=e.borderColor,x=void 0===p?S.borderColor:p,y=e.labelTextColor,k=void 0===y?S.labelTextColor:y,C=e.groupMode,V=void 0===C?S.groupMode:C,L=e.layout,N=void 0===L?S.layout:L,w=e.reverse,B=void 0===w?S.reverse:w,E=e.data,M=e.minValue,W=void 0===M?S.minValue:M,T=e.maxValue,D=void 0===T?S.maxValue:T,I=e.margin,R=e.width,P=e.height,F=e.padding,H=void 0===F?S.padding:F,A=e.innerPadding,q=void 0===A?S.innerPadding:A,O=e.valueScale,G=void 0===O?S.valueScale:O,z=e.indexScale,K=void 0===z?S.indexScale:z,_=e.initialHiddenIds,J=void 0===_?S.initialHiddenIds:_,Q=e.enableLabel,U=void 0===Q?S.enableLabel:Q,Z=e.labelSkipWidth,$=void 0===Z?S.labelSkipWidth:Z,ee=e.labelSkipHeight,ae=void 0===ee?S.labelSkipHeight:ee,ne=e.legends,ie=void 0===ne?S.legends:ne,re=e.legendLabel,te=t.useState(null!=J?J:[]),le=te[0],oe=te[1],de=t.useCallback((function(e){oe((function(a){return a.indexOf(e)>-1?a.filter((function(a){return a!==e})):[].concat(a,[e])}))}),[]),ue=r.usePropertyAccessor(n),se=r.usePropertyAccessor(u),ce=r.usePropertyAccessor(c),he=r.useValueFormatter(h),be=r.useTheme(),me=d.useOrdinalColorScale(v,g),ve=d.useInheritedColor(x,be),fe=d.useInheritedColor(k,be),ge=("grouped"===V?j:X)({layout:N,reverse:B,data:E,getIndex:ue,keys:l,minValue:W,maxValue:D,width:R,height:P,getColor:me,padding:H,innerPadding:q,valueScale:G,indexScale:K,hiddenIds:le,formatValue:he,getTooltipLabel:ce,margin:I}),pe=ge.bars,xe=ge.xScale,ye=ge.yScale,ke=t.useMemo((function(){return pe.filter((function(e){return null!==e.data.value})).map((function(e,a){return b({},e,{index:a})}))}),[pe]),Se=t.useCallback((function(e){var a=e.width,n=e.height;return!!U&&(!($>0&&a<$)&&!(ae>0&&n<ae))}),[U,$,ae]),Ce=t.useMemo((function(){return l.map((function(e){var a=pe.find((function(a){return a.data.id===e}));return b({},a,{data:b({id:e},null==a?void 0:a.data,{hidden:le.includes(e)})})}))}),[le,l,pe]),Ve=t.useMemo((function(){return ie.map((function(e){return[e,Y({bars:"keys"===e.dataFrom?Ce:pe,direction:e.direction,from:e.dataFrom,groupMode:V,layout:N,legendLabel:re,reverse:B})]}))}),[ie,Ce,pe,V,N,re,B]);return{bars:pe,barsWithValue:ke,xScale:xe,yScale:ye,getIndex:ue,getLabel:se,getTooltipLabel:ce,formatValue:he,getColor:me,getBorderColor:ve,getLabelColor:fe,shouldRenderBarLabel:Se,hiddenIds:le,toggleSerie:de,legendsWithData:Ve}},O=["isInteractive","animate","motionConfig","theme","renderWrapper"],G="/home/oleksandr/code/atlas/nivo/packages/bar/src/Bar.tsx",z=function(a){var i=a.data,o=a.indexBy,d=a.keys,u=a.margin,s=a.width,c=a.height,h=a.groupMode,m=a.layout,v=a.reverse,p=a.minValue,x=a.maxValue,y=a.valueScale,k=a.indexScale,S=a.padding,V=a.innerPadding,L=a.axisTop,N=a.axisRight,w=a.axisBottom,B=void 0===w?C.axisBottom:w,E=a.axisLeft,M=void 0===E?C.axisLeft:E,W=a.enableGridX,T=void 0===W?C.enableGridX:W,D=a.enableGridY,I=void 0===D?C.enableGridY:D,R=a.gridXValues,j=a.gridYValues,P=a.layers,F=void 0===P?C.layers:P,H=a.barComponent,A=void 0===H?C.barComponent:H,X=a.enableLabel,Y=a.label,O=a.labelSkipWidth,z=a.labelSkipHeight,K=a.labelTextColor,_=a.markers,J=void 0===_?C.markers:_,Q=a.colorBy,U=a.colors,Z=a.defs,$=void 0===Z?C.defs:Z,ee=a.fill,ae=void 0===ee?C.fill:ee,ne=a.borderRadius,ie=void 0===ne?C.borderRadius:ne,re=a.borderWidth,te=void 0===re?C.borderWidth:re,le=a.borderColor,oe=a.annotations,de=void 0===oe?C.annotations:oe,ue=a.legendLabel,se=a.tooltipLabel,ce=a.valueFormat,he=a.isInteractive,be=void 0===he?C.isInteractive:he,me=a.tooltip,ve=void 0===me?C.tooltip:me,fe=a.onClick,ge=a.onMouseEnter,pe=a.onMouseLeave,xe=a.legends,ye=a.role,ke=void 0===ye?C.role:ye,Se=a.ariaLabel,Ce=a.ariaLabelledBy,Ve=a.ariaDescribedBy,Le=a.isFocusable,Ne=void 0===Le?C.isFocusable:Le,we=a.barAriaLabel,Be=a.barAriaLabelledBy,Ee=a.barAriaDescribedBy,Me=a.initialHiddenIds,We=r.useMotionConfig(),Te=We.animate,De=We.config,Ie=r.useDimensions(s,c,u),Re=Ie.outerWidth,je=Ie.outerHeight,Pe=Ie.margin,Fe=Ie.innerWidth,He=Ie.innerHeight,Ae=q({indexBy:o,label:Y,tooltipLabel:se,valueFormat:ce,colors:U,colorBy:Q,borderColor:le,labelTextColor:K,groupMode:h,layout:m,reverse:v,data:i,keys:d,minValue:p,maxValue:x,margin:Pe,width:Fe,height:He,padding:S,innerPadding:V,valueScale:y,indexScale:k,enableLabel:X,labelSkipWidth:O,labelSkipHeight:z,legends:xe,legendLabel:ue,initialHiddenIds:Me}),Xe=Ae.bars,Ye=Ae.barsWithValue,qe=Ae.xScale,Oe=Ae.yScale,Ge=Ae.getLabel,ze=Ae.getTooltipLabel,Ke=Ae.getBorderColor,_e=Ae.getLabelColor,Je=Ae.shouldRenderBarLabel,Qe=Ae.toggleSerie,Ue=Ae.legendsWithData,Ze=l.useTransition(Ye,{keys:function(e){return e.key},from:function(e){return b({borderColor:Ke(e),color:e.color,height:0,labelColor:_e(e),labelOpacity:0,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===m?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return{borderColor:Ke(e),color:e.color,height:e.height,labelColor:_e(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},update:function(e){return{borderColor:Ke(e),color:e.color,height:e.height,labelColor:_e(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},leave:function(e){return b({borderColor:Ke(e),color:e.color,height:0,labelColor:_e(e),labelOpacity:0,labelX:e.width/2,labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===m?{}:{labelX:0,labelY:e.height/2,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},config:De,immediate:!Te,initial:Te?void 0:null}),$e=t.useMemo((function(){return{borderRadius:ie,borderWidth:te,enableLabel:X,isInteractive:be,labelSkipWidth:O,labelSkipHeight:z,onClick:fe,onMouseEnter:ge,onMouseLeave:pe,getTooltipLabel:ze,tooltip:ve,isFocusable:Ne,ariaLabel:we,ariaLabelledBy:Be,ariaDescribedBy:Ee}}),[ie,te,X,ze,be,z,O,fe,ge,pe,ve,Ne,we,Be,Ee]),ea=r.bindDefs($,Xe,ae,{dataKey:"data",targetKey:"data.fill"}),aa={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null};F.includes("annotations")&&(aa.annotations=n.jsxDEV(f,{bars:Xe,annotations:de},"annotations",!1,{fileName:G,lineNumber:283,columnNumber:13},undefined)),F.includes("axes")&&(aa.axes=n.jsxDEV(e.Axes,{xScale:qe,yScale:Oe,width:Fe,height:He,top:L,right:N,bottom:B,left:M},"axes",!1,{fileName:G,lineNumber:289,columnNumber:13},undefined)),F.includes("bars")&&(aa.bars=n.jsxDEV(t.Fragment,{children:Ze((function(e,a){return t.createElement(A,b({},$e,{bar:a,style:e,shouldRenderLabel:Je(a),label:Ge(a.data)}))}))},"bars",!1,{fileName:G,lineNumber:305,columnNumber:13},undefined)),F.includes("grid")&&(aa.grid=n.jsxDEV(e.Grid,{width:Fe,height:He,xScale:T?qe:null,yScale:I?Oe:null,xValues:R,yValues:j},"grid",!1,{fileName:G,lineNumber:321,columnNumber:13},undefined)),F.includes("legends")&&(aa.legends=n.jsxDEV(g,{width:Fe,height:He,legends:Ue,toggleSerie:Qe},"legends",!1,{fileName:G,lineNumber:335,columnNumber:13},undefined)),F.includes("markers")&&(aa.markers=n.jsxDEV(r.CartesianMarkers,{markers:J,width:Fe,height:He,xScale:qe,yScale:Oe},"markers",!1,{fileName:G,lineNumber:347,columnNumber:13},undefined));var na=t.useMemo((function(){return b({},$e,{margin:Pe,innerWidth:Fe,innerHeight:He,width:s,height:c,bars:Xe,xScale:qe,yScale:Oe})}),[$e,Pe,Fe,He,s,c,Xe,qe,Oe]);return n.jsxDEV(r.SvgWrapper,{width:Re,height:je,margin:Pe,defs:ea,role:ke,ariaLabel:Se,ariaLabelledBy:Ce,ariaDescribedBy:Ve,isFocusable:Ne,children:F.map((function(e,a){var i;return"function"==typeof e?n.jsxDEV(t.Fragment,{children:t.createElement(e,na)},a,!1,{fileName:G,lineNumber:388,columnNumber:28},undefined):null!=(i=null==aa?void 0:aa[e])?i:null}))},void 0,!1,{fileName:G,lineNumber:375,columnNumber:9},undefined)},K=function(e){var a=e.isInteractive,i=void 0===a?C.isInteractive:a,t=e.animate,l=void 0===t?C.animate:t,o=e.motionConfig,d=void 0===o?C.motionConfig:o,u=e.theme,s=e.renderWrapper,c=m(e,O);return n.jsxDEV(r.Container,{animate:l,isInteractive:i,motionConfig:d,renderWrapper:s,theme:u,children:n.jsxDEV(z,b({isInteractive:i},c),void 0,!1,{fileName:G,lineNumber:414,columnNumber:9},undefined)},void 0,!1,{fileName:G,lineNumber:405,columnNumber:5},undefined)},_=["isInteractive","renderWrapper","theme"],J="/home/oleksandr/code/atlas/nivo/packages/bar/src/BarCanvas.tsx",Q=function(e,a,n,i){return e.find((function(e){return r.isCursorInRect(e.x+a.left,e.y+a.top,e.width,e.height,n,i)}))},U=function(l){var d=l.data,u=l.indexBy,s=l.keys,c=l.margin,h=l.width,m=l.height,v=l.groupMode,f=l.layout,g=l.reverse,p=l.minValue,x=l.maxValue,y=l.valueScale,k=l.indexScale,S=l.padding,C=l.innerPadding,L=l.axisTop,N=l.axisRight,w=l.axisBottom,B=void 0===w?V.axisBottom:w,E=l.axisLeft,M=void 0===E?V.axisLeft:E,W=l.enableGridX,T=void 0===W?V.enableGridX:W,D=l.enableGridY,I=void 0===D?V.enableGridY:D,R=l.gridXValues,j=l.gridYValues,P=l.layers,F=void 0===P?V.layers:P,H=l.renderBar,A=void 0===H?function(e,a){var n=a.bar,i=n.color,r=n.height,t=n.width,l=n.x,o=n.y,d=a.borderColor,u=a.borderRadius,s=a.borderWidth,c=a.label,h=a.labelColor,b=a.shouldRenderLabel;if(e.fillStyle=i,s>0&&(e.strokeStyle=d,e.lineWidth=s),e.beginPath(),u>0){var m=Math.min(u,r);e.moveTo(l+m,o),e.lineTo(l+t-m,o),e.quadraticCurveTo(l+t,o,l+t,o+m),e.lineTo(l+t,o+r-m),e.quadraticCurveTo(l+t,o+r,l+t-m,o+r),e.lineTo(l+m,o+r),e.quadraticCurveTo(l,o+r,l,o+r-m),e.lineTo(l,o+m),e.quadraticCurveTo(l,o,l+m,o),e.closePath()}else e.rect(l,o,t,r);e.fill(),s>0&&e.stroke(),b&&(e.textBaseline="middle",e.textAlign="center",e.fillStyle=h,e.fillText(c,l+t/2,o+r/2))}:H,X=l.enableLabel,Y=l.label,O=l.labelSkipWidth,G=l.labelSkipHeight,z=l.labelTextColor,K=l.colorBy,_=l.colors,U=l.borderRadius,Z=void 0===U?V.borderRadius:U,$=l.borderWidth,ee=void 0===$?V.borderWidth:$,ae=l.borderColor,ne=l.annotations,ie=void 0===ne?V.annotations:ne,re=l.legendLabel,te=l.tooltipLabel,le=l.valueFormat,oe=l.isInteractive,de=void 0===oe?V.isInteractive:oe,ue=l.tooltip,se=void 0===ue?V.tooltip:ue,ce=l.onClick,he=l.onMouseEnter,be=l.onMouseLeave,me=l.legends,ve=l.pixelRatio,fe=void 0===ve?V.pixelRatio:ve,ge=l.canvasRef,pe=t.useRef(null),xe=r.useTheme(),ye=r.useDimensions(h,m,c),ke=ye.margin,Se=ye.innerWidth,Ce=ye.innerHeight,Ve=ye.outerWidth,Le=ye.outerHeight,Ne=q({indexBy:u,label:Y,tooltipLabel:te,valueFormat:le,colors:_,colorBy:K,borderColor:ae,labelTextColor:z,groupMode:v,layout:f,reverse:g,data:d,keys:s,minValue:p,maxValue:x,margin:ke,width:Se,height:Ce,padding:S,innerPadding:C,valueScale:y,indexScale:k,enableLabel:X,labelSkipWidth:O,labelSkipHeight:G,legends:me,legendLabel:re}),we=Ne.bars,Be=Ne.barsWithValue,Ee=Ne.xScale,Me=Ne.yScale,We=Ne.getLabel,Te=Ne.getTooltipLabel,De=Ne.getBorderColor,Ie=Ne.getLabelColor,Re=Ne.shouldRenderBarLabel,je=Ne.legendsWithData,Pe=o.useTooltip(),Fe=Pe.showTooltipFromEvent,He=Pe.hideTooltip,Ae=a.useComputedAnnotations({annotations:a.useAnnotations({data:we,annotations:ie,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var a=e.width,n=e.height;return{width:a,height:n,size:Math.max(a,n)}}})}),Xe=t.useMemo((function(){return{borderRadius:Z,borderWidth:ee,enableLabel:X,isInteractive:de,labelSkipWidth:O,labelSkipHeight:G,onClick:ce,onMouseEnter:he,onMouseLeave:be,getTooltipLabel:Te,tooltip:se,margin:ke,innerWidth:Se,innerHeight:Ce,width:h,height:m,bars:we,xScale:Ee,yScale:Me}}),[Z,ee,X,Te,m,Ce,Se,de,G,O,ke,ce,he,be,we,Ee,Me,se,h]);t.useEffect((function(){var n,r=null==(n=pe.current)?void 0:n.getContext("2d");pe.current&&r&&(pe.current.width=Ve*fe,pe.current.height=Le*fe,r.scale(fe,fe),r.fillStyle=xe.background,r.fillRect(0,0,Ve,Le),r.translate(ke.left,ke.top),F.forEach((function(n){"grid"===n?"number"==typeof xe.grid.line.strokeWidth&&xe.grid.line.strokeWidth>0&&(r.lineWidth=xe.grid.line.strokeWidth,r.strokeStyle=xe.grid.line.stroke,T&&e.renderGridLinesToCanvas(r,{width:h,height:m,scale:Ee,axis:"x",values:R}),I&&e.renderGridLinesToCanvas(r,{width:h,height:m,scale:Me,axis:"y",values:j})):"axes"===n?e.renderAxesToCanvas(r,{xScale:Ee,yScale:Me,width:Se,height:Ce,top:L,right:N,bottom:B,left:M,theme:xe}):"bars"===n?Be.forEach((function(e){A(r,{bar:e,borderColor:De(e),borderRadius:Z,borderWidth:ee,label:We(e.data),labelColor:Ie(e),shouldRenderLabel:Re(e)})})):"legends"===n?je.forEach((function(e){var a=e[0],n=e[1];i.renderLegendToCanvas(r,b({},a,{data:n,containerWidth:Se,containerHeight:Ce,theme:xe}))})):"annotations"===n?a.renderAnnotationsToCanvas(r,{annotations:Ae,theme:xe}):"function"==typeof n&&n(r,Xe)})),r.save())}),[B,M,N,L,Be,Z,ee,Ae,T,I,De,We,Ie,R,j,v,m,Ce,Se,Xe,F,f,je,ke.left,ke.top,Le,Ve,fe,A,Ee,Me,g,Re,xe,h]);var Ye=t.useCallback((function(e){if(we&&pe.current){var a=r.getRelativeCursor(pe.current,e),n=a[0],i=a[1],l=Q(we,ke,n,i);void 0!==l?(Fe(t.createElement(se,b({},l.data,{color:l.color,label:l.label,value:Number(l.data.value)})),e),"mouseenter"===e.type&&(null==he||he(l.data,e))):He()}}),[He,ke,he,we,Fe,se]),qe=t.useCallback((function(e){if(we&&pe.current){He();var a=r.getRelativeCursor(pe.current,e),n=a[0],i=a[1],t=Q(we,ke,n,i);t&&(null==be||be(t.data,e))}}),[He,ke,be,we]),Oe=t.useCallback((function(e){if(we&&pe.current){var a=r.getRelativeCursor(pe.current,e),n=a[0],i=a[1],t=Q(we,ke,n,i);void 0!==t&&(null==ce||ce(b({},t.data,{color:t.color}),e))}}),[ke,ce,we]);return n.jsxDEV("canvas",{ref:function(e){pe.current=e,ge&&"current"in ge&&(ge.current=e)},width:Ve*fe,height:Le*fe,style:{width:Ve,height:Le,cursor:de?"auto":"normal"},onMouseEnter:de?Ye:void 0,onMouseMove:de?Ye:void 0,onMouseLeave:de?qe:void 0,onClick:de?Oe:void 0},void 0,!1,{fileName:J,lineNumber:462,columnNumber:9},undefined)},Z=t.forwardRef((function(e,a){var i=e.isInteractive,t=e.renderWrapper,l=e.theme,o=m(e,_);return n.jsxDEV(r.Container,{isInteractive:i,renderWrapper:t,theme:l,animate:!1,children:n.jsxDEV(U,b({},o,{canvasRef:a}),void 0,!1,{fileName:J,lineNumber:488,columnNumber:13},undefined)},void 0,!1,{fileName:J,lineNumber:487,columnNumber:9},undefined)})),$="/home/oleksandr/code/atlas/nivo/packages/bar/src/ResponsiveBar.tsx",ee="/home/oleksandr/code/atlas/nivo/packages/bar/src/ResponsiveBarCanvas.tsx",ae=t.forwardRef((function(e,a){var i=this;return n.jsxDEV(r.ResponsiveWrapper,{children:function(r){var t=r.width,l=r.height;return n.jsxDEV(Z,b({width:t,height:l},e,{ref:a}),void 0,!1,{fileName:ee,lineNumber:12,columnNumber:17},i)}},void 0,!1,{fileName:ee,lineNumber:10,columnNumber:9},this)}));exports.Bar=K,exports.BarCanvas=Z,exports.BarItem=y,exports.ResponsiveBar=function(e){return n.jsxDEV(r.ResponsiveWrapper,{children:function(a){var i=a.width,r=a.height;return n.jsxDEV(K,b({width:i,height:r},e),void 0,!1,{fileName:$,lineNumber:9,columnNumber:33},undefined)}},void 0,!1,{fileName:$,lineNumber:8,columnNumber:5},undefined)},exports.ResponsiveBarCanvas=ae,exports.canvasDefaultProps=V,exports.defaultProps=S,exports.svgDefaultProps=C; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@nivo/axes"),a=require("@nivo/annotations"),t=require("react/jsx-runtime"),i=require("@nivo/legends"),n=require("@nivo/core"),r=require("react"),o=require("@react-spring/web"),l=require("@nivo/tooltip"),d=require("@nivo/colors"),u=require("@nivo/scales"),s=require("d3-shape");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(require("lodash/uniqBy"));function b(){return b=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},b.apply(this,arguments)}function g(e,a){if(null==e)return{};var t,i,n={},r=Object.keys(e);for(i=0;i<r.length;i++)t=r[i],a.indexOf(t)>=0||(n[t]=e[t]);return n}var v,f=function(e){var i=e.bars,n=e.annotations,r=a.useAnnotations({data:i,annotations:n,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var a=e.height,t=e.width;return{width:t,height:a,size:Math.max(t,a)}}});return t.jsx(t.Fragment,{children:r.map((function(e,i){return t.jsx(a.Annotation,b({},e),i)}))})},m=function(e){var a=e.width,n=e.height,r=e.legends,o=e.toggleSerie;return t.jsx(t.Fragment,{children:r.map((function(e,r){var l,d=e[0],u=e[1];return t.jsx(i.BoxLegendSvg,b({},d,{containerWidth:a,containerHeight:n,data:null!=(l=d.data)?l:u,toggleSerie:d.toggleSerie&&"keys"===d.dataFrom?o:void 0}),r)}))})},x=["data"],p=function(e){var a,i=e.bar,d=i.data,u=g(i,x),s=e.style,c=s.borderColor,h=s.color,v=s.height,f=s.labelColor,m=s.labelOpacity,p=s.labelX,y=s.labelY,S=s.transform,k=s.width,C=e.borderRadius,L=e.borderWidth,w=e.label,V=e.shouldRenderLabel,M=e.isInteractive,B=e.onClick,W=e.onMouseEnter,T=e.onMouseLeave,I=e.tooltip,R=e.isFocusable,j=e.ariaLabel,P=e.ariaLabelledBy,E=e.ariaDescribedBy,F=n.useTheme(),H=l.useTooltip(),A=H.showTooltipFromEvent,D=H.showTooltipAt,X=H.hideTooltip,Y=r.useMemo((function(){return function(){return r.createElement(I,b({},u,d))}}),[I,u,d]),q=r.useCallback((function(e){null==B||B(b({color:u.color},d),e)}),[u,d,B]),O=r.useCallback((function(e){return A(Y(),e)}),[A,Y]),G=r.useCallback((function(e){null==W||W(d,e),A(Y(),e)}),[d,W,A,Y]),z=r.useCallback((function(e){null==T||T(d,e),X()}),[d,X,T]),K=r.useCallback((function(){D(Y(),[u.absX+u.width/2,u.absY])}),[D,Y,u]),N=r.useCallback((function(){X()}),[X]);return t.jsxs(o.animated.g,{transform:S,children:[t.jsx(o.animated.rect,{width:o.to(k,(function(e){return Math.max(e,0)})),height:o.to(v,(function(e){return Math.max(e,0)})),rx:C,ry:C,fill:null!=(a=d.fill)?a:h,strokeWidth:L,stroke:c,focusable:R,tabIndex:R?0:void 0,"aria-label":j?j(d):void 0,"aria-labelledby":P?P(d):void 0,"aria-describedby":E?E(d):void 0,onMouseEnter:M?G:void 0,onMouseMove:M?O:void 0,onMouseLeave:M?z:void 0,onClick:M?q:void 0,onFocus:M&&R?K:void 0,onBlur:M&&R?N:void 0}),V&&t.jsx(o.animated.text,{x:p,y:y,textAnchor:"middle",dominantBaseline:"central",fillOpacity:m,style:b({},F.labels.text,{pointerEvents:"none",fill:f}),children:w})]})},y=["color","label"],S={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(e){var a=e.color,i=e.label,n=g(e,y);return t.jsx(l.BasicTooltip,{id:i,value:n.formattedValue,enableChip:!0,color:a})},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[]},k=b({},S,{layers:["grid","axes","bars","markers","legends","annotations"],barComponent:p,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),C=b({},S,{layers:["grid","axes","bars","legends","annotations"],pixelRatio:"undefined"!=typeof window&&null!=(v=window.devicePixelRatio)?v:1}),L=function(e,a,t,i,n,r){return u.computeScale(i,{all:e.map(a),min:0,max:0},n,r).padding(t)},w=function(e,a){return e.map((function(e){return b({},a.reduce((function(e,a){return e[a]=null,e}),{}),e)}))},V=function(e){return Object.keys(e).reduce((function(a,t){return e[t]&&(a[t]=e[t]),a}),{})},M=function(e){return[e,Number(e)]},B=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],W=function(e,a){return e>a},T=function(e,a){return e<a},I=function(e,a){return Array.from(" ".repeat(a-e),(function(a,t){return e+t}))},R=function(e){return W(e,0)?0:e},j=function(e,a,t,i){var n=e.data,r=e.formatValue,o=e.getColor,l=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,s=void 0===u?0:u,c=e.keys,h=e.xScale,b=e.yScale,g=e.margin,v=t?T:W,f=n.map(V),m=[];return c.forEach((function(e,t){return I(0,h.domain().length).forEach((function(u){var c,x,p,y=M(n[u][e]),S=y[0],k=y[1],C=l(n[u]),L=(null!=(c=h(C))?c:0)+a*t+s*t,w=v(x=k,0)?null!=(p=b(x))?p:0:i,V=function(e,a){var t;return v(e,0)?i-a:(null!=(t=b(e))?t:0)-i}(k,w),B={id:e,value:null===S?S:k,formattedValue:r(k),hidden:!1,index:u,indexValue:C,data:f[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:L,y:w,absX:g.left+L,absY:g.top+w,width:a,height:V,color:o(B),label:d(B)})}))})),m},P=function(e,a,t,i){var n=e.data,r=e.formatValue,o=e.getIndex,l=e.getColor,d=e.getTooltipLabel,u=e.keys,s=e.innerPadding,c=void 0===s?0:s,h=e.xScale,b=e.yScale,g=e.margin,v=t?T:W,f=n.map(V),m=[];return u.forEach((function(e,t){return I(0,b.domain().length).forEach((function(u){var s,x,p,y=M(n[u][e]),S=y[0],k=y[1],C=o(n[u]),L=v(x=k,0)?i:null!=(p=h(x))?p:0,w=(null!=(s=b(C))?s:0)+a*t+c*t,V=function(e,a){var t;return v(e,0)?(null!=(t=h(e))?t:0)-i:i-a}(k,L),B={id:e,value:null===S?S:k,formattedValue:r(k),hidden:!1,index:u,indexValue:C,data:f[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:L,y:w,absX:g.left+L,absY:g.top+w,width:V,height:a,color:l(B),label:d(B)})}))})),m},E=function(e){var a,t,i=e.layout,n=e.minValue,r=e.maxValue,o=e.reverse,l=e.width,d=e.height,s=e.padding,c=void 0===s?0:s,h=e.innerPadding,v=void 0===h?0:h,f=e.valueScale,m=e.indexScale,x=e.hiddenIds,p=void 0===x?[]:x,y=g(e,B),S=y.keys.filter((function(e){return!p.includes(e)})),k=w(y.data,S),C="vertical"===i?["y","x",l]:["x","y",d],V=C[0],M=C[1],W=C[2],T=L(k,y.getIndex,c,m,W,M),I=b({max:r,min:n,reverse:o},f),E="auto"===I.min?R:function(e){return e},F=k.reduce((function(e,a){return[].concat(e,S.map((function(e){return a[e]})))}),[]).filter(Boolean),H=E(Math.min.apply(Math,F)),A=(t=Math.max.apply(Math,F),isFinite(t)?t:0),D=u.computeScale(I,{all:F,min:H,max:A},"x"===V?l:d,V),X="vertical"===i?[T,D]:[D,T],Y=X[0],q=X[1],O=(T.bandwidth()-v*(S.length-1))/S.length,G=[b({},y,{data:k,keys:S,innerPadding:v,xScale:Y,yScale:q}),O,I.reverse,null!=(a=D(0))?a:0];return{xScale:Y,yScale:q,bars:O>0?"vertical"===i?j.apply(void 0,G):P.apply(void 0,G):[]}},F=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],H=function e(a){var t;return a.some(Array.isArray)?e((t=[]).concat.apply(t,a)):a},A=function(e,a,t){var i=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,b){var g,v,f=e[b],m=null!=(g=u(r(f.data)))?g:0,x=(null!=(v=function(e){return s(e[t?0:1])}(f))?v:0)+.5*l,p=function(e,a){var i;return(null!=(i=s(e[t?1:0]))?i:0)-a}(f,x)-l,y=M(f.data[e.key]),S=y[0],k=y[1],C={id:e.key,value:null===S?S:k,formattedValue:i(k),hidden:!1,index:b,indexValue:d,data:V(f.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:m,y:x,absX:c.left+m,absY:c.top+x,width:a,height:p,color:n(C),label:o(C)})}))})),h},D=function(e,a,t){var i=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return s.domain().forEach((function(d,b){var g,v,f=e[b],m=null!=(g=s(r(f.data)))?g:0,x=(null!=(v=function(e){return u(e[t?1:0])}(f))?v:0)+.5*l,p=function(e,a){var i;return(null!=(i=u(e[t?0:1]))?i:0)-a}(f,x)-l,y=M(f.data[e.key]),S=y[0],k=y[1],C={id:e.key,value:null===S?S:k,formattedValue:i(k),hidden:!1,index:b,indexValue:d,data:V(f.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:x,y:m,absX:c.left+x,absY:c.top+m,width:p,height:a,color:n(C),label:o(C)})}))})),h},X=function(e){var a,t=e.data,i=e.layout,n=e.minValue,r=e.maxValue,o=e.reverse,l=e.width,d=e.height,c=e.padding,h=void 0===c?0:c,v=e.valueScale,f=e.indexScale,m=e.hiddenIds,x=void 0===m?[]:m,p=g(e,F),y=p.keys.filter((function(e){return!x.includes(e)})),S=s.stack().keys(y).offset(s.stackOffsetDiverging)(w(t,y)),k="vertical"===i?["y","x",l]:["x","y",d],C=k[0],V=k[1],M=k[2],B=L(t,p.getIndex,h,f,M,V),W=b({max:r,min:n,reverse:o},v),T=(a=H(S),"log"===v.type?a.filter((function(e){return 0!==e})):a),I=Math.min.apply(Math,T),R=Math.max.apply(Math,T),j=u.computeScale(W,{all:T,min:I,max:R},"x"===C?l:d,C),P="vertical"===i?[B,j]:[j,B],E=P[0],X=P[1],Y=p.innerPadding>0?p.innerPadding:0,q=B.bandwidth(),O=[b({},p,{innerPadding:Y,stackedData:S,xScale:E,yScale:X}),q,W.reverse];return{xScale:E,yScale:X,bars:q>0?"vertical"===i?A.apply(void 0,O):D.apply(void 0,O):[]}},Y=function(e){var a=e.bars,t=e.direction,i=e.from,r=e.groupMode,o=e.layout,l=e.legendLabel,d=e.reverse,u=n.getPropertyAccessor(null!=l?l:"indexes"===i?"indexValue":"id");return"indexes"===i?function(e,a,t){var i=h.default(e.map((function(e){var a,i;return{id:null!=(a=e.data.indexValue)?a:"",label:t(e.data),hidden:e.data.hidden,color:null!=(i=e.color)?i:"#000"}})),(function(e){return e.id}));return"horizontal"===a&&i.reverse(),i}(a,o,u):function(e,a,t,i,n,r){var o=h.default(e.map((function(e){var a;return{id:e.data.id,label:r(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return("vertical"===a&&"stacked"===i&&"column"===t&&!0!==n||"horizontal"===a&&"stacked"===i&&!0===n)&&o.reverse(),o}(a,o,t,r,d,u)},q=function(e){var a=e.indexBy,t=void 0===a?S.indexBy:a,i=e.keys,o=void 0===i?S.keys:i,l=e.label,u=void 0===l?S.label:l,s=e.tooltipLabel,c=void 0===s?S.tooltipLabel:s,h=e.valueFormat,g=e.colors,v=void 0===g?S.colors:g,f=e.colorBy,m=void 0===f?S.colorBy:f,x=e.borderColor,p=void 0===x?S.borderColor:x,y=e.labelTextColor,k=void 0===y?S.labelTextColor:y,C=e.groupMode,L=void 0===C?S.groupMode:C,w=e.layout,V=void 0===w?S.layout:w,M=e.reverse,B=void 0===M?S.reverse:M,W=e.data,T=e.minValue,I=void 0===T?S.minValue:T,R=e.maxValue,j=void 0===R?S.maxValue:R,P=e.margin,F=e.width,H=e.height,A=e.padding,D=void 0===A?S.padding:A,q=e.innerPadding,O=void 0===q?S.innerPadding:q,G=e.valueScale,z=void 0===G?S.valueScale:G,K=e.indexScale,N=void 0===K?S.indexScale:K,_=e.initialHiddenIds,J=void 0===_?S.initialHiddenIds:_,Q=e.enableLabel,U=void 0===Q?S.enableLabel:Q,Z=e.labelSkipWidth,$=void 0===Z?S.labelSkipWidth:Z,ee=e.labelSkipHeight,ae=void 0===ee?S.labelSkipHeight:ee,te=e.legends,ie=void 0===te?S.legends:te,ne=e.legendLabel,re=r.useState(null!=J?J:[]),oe=re[0],le=re[1],de=r.useCallback((function(e){le((function(a){return a.indexOf(e)>-1?a.filter((function(a){return a!==e})):[].concat(a,[e])}))}),[]),ue=n.usePropertyAccessor(t),se=n.usePropertyAccessor(u),ce=n.usePropertyAccessor(c),he=n.useValueFormatter(h),be=n.useTheme(),ge=d.useOrdinalColorScale(v,m),ve=d.useInheritedColor(p,be),fe=d.useInheritedColor(k,be),me=("grouped"===L?E:X)({layout:V,reverse:B,data:W,getIndex:ue,keys:o,minValue:I,maxValue:j,width:F,height:H,getColor:ge,padding:D,innerPadding:O,valueScale:z,indexScale:N,hiddenIds:oe,formatValue:he,getTooltipLabel:ce,margin:P}),xe=me.bars,pe=me.xScale,ye=me.yScale,Se=r.useMemo((function(){return xe.filter((function(e){return null!==e.data.value})).map((function(e,a){return b({},e,{index:a})}))}),[xe]),ke=r.useCallback((function(e){var a=e.width,t=e.height;return!!U&&(!($>0&&a<$)&&!(ae>0&&t<ae))}),[U,$,ae]),Ce=r.useMemo((function(){return o.map((function(e){var a=xe.find((function(a){return a.data.id===e}));return b({},a,{data:b({id:e},null==a?void 0:a.data,{hidden:oe.includes(e)})})}))}),[oe,o,xe]),Le=r.useMemo((function(){return ie.map((function(e){return[e,Y({bars:"keys"===e.dataFrom?Ce:xe,direction:e.direction,from:e.dataFrom,groupMode:L,layout:V,legendLabel:ne,reverse:B})]}))}),[ie,Ce,xe,L,V,ne,B]);return{bars:xe,barsWithValue:Se,xScale:pe,yScale:ye,getIndex:ue,getLabel:se,getTooltipLabel:ce,formatValue:he,getColor:ge,getBorderColor:ve,getLabelColor:fe,shouldRenderBarLabel:ke,hiddenIds:oe,toggleSerie:de,legendsWithData:Le}},O=["isInteractive","animate","motionConfig","theme","renderWrapper"],G=function(a){var i=a.data,l=a.indexBy,d=a.keys,u=a.margin,s=a.width,c=a.height,h=a.groupMode,g=a.layout,v=a.reverse,x=a.minValue,p=a.maxValue,y=a.valueScale,S=a.indexScale,C=a.padding,L=a.innerPadding,w=a.axisTop,V=a.axisRight,M=a.axisBottom,B=void 0===M?k.axisBottom:M,W=a.axisLeft,T=void 0===W?k.axisLeft:W,I=a.enableGridX,R=void 0===I?k.enableGridX:I,j=a.enableGridY,P=void 0===j?k.enableGridY:j,E=a.gridXValues,F=a.gridYValues,H=a.layers,A=void 0===H?k.layers:H,D=a.barComponent,X=void 0===D?k.barComponent:D,Y=a.enableLabel,O=a.label,G=a.labelSkipWidth,z=a.labelSkipHeight,K=a.labelTextColor,N=a.markers,_=void 0===N?k.markers:N,J=a.colorBy,Q=a.colors,U=a.defs,Z=void 0===U?k.defs:U,$=a.fill,ee=void 0===$?k.fill:$,ae=a.borderRadius,te=void 0===ae?k.borderRadius:ae,ie=a.borderWidth,ne=void 0===ie?k.borderWidth:ie,re=a.borderColor,oe=a.annotations,le=void 0===oe?k.annotations:oe,de=a.legendLabel,ue=a.tooltipLabel,se=a.valueFormat,ce=a.isInteractive,he=void 0===ce?k.isInteractive:ce,be=a.tooltip,ge=void 0===be?k.tooltip:be,ve=a.onClick,fe=a.onMouseEnter,me=a.onMouseLeave,xe=a.legends,pe=a.role,ye=void 0===pe?k.role:pe,Se=a.ariaLabel,ke=a.ariaLabelledBy,Ce=a.ariaDescribedBy,Le=a.isFocusable,we=void 0===Le?k.isFocusable:Le,Ve=a.barAriaLabel,Me=a.barAriaLabelledBy,Be=a.barAriaDescribedBy,We=a.initialHiddenIds,Te=n.useMotionConfig(),Ie=Te.animate,Re=Te.config,je=n.useDimensions(s,c,u),Pe=je.outerWidth,Ee=je.outerHeight,Fe=je.margin,He=je.innerWidth,Ae=je.innerHeight,De=q({indexBy:l,label:O,tooltipLabel:ue,valueFormat:se,colors:Q,colorBy:J,borderColor:re,labelTextColor:K,groupMode:h,layout:g,reverse:v,data:i,keys:d,minValue:x,maxValue:p,margin:Fe,width:He,height:Ae,padding:C,innerPadding:L,valueScale:y,indexScale:S,enableLabel:Y,labelSkipWidth:G,labelSkipHeight:z,legends:xe,legendLabel:de,initialHiddenIds:We}),Xe=De.bars,Ye=De.barsWithValue,qe=De.xScale,Oe=De.yScale,Ge=De.getLabel,ze=De.getTooltipLabel,Ke=De.getBorderColor,Ne=De.getLabelColor,_e=De.shouldRenderBarLabel,Je=De.toggleSerie,Qe=De.legendsWithData,Ue=o.useTransition(Ye,{keys:function(e){return e.key},from:function(e){return b({borderColor:Ke(e),color:e.color,height:0,labelColor:Ne(e),labelOpacity:0,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===g?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return{borderColor:Ke(e),color:e.color,height:e.height,labelColor:Ne(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},update:function(e){return{borderColor:Ke(e),color:e.color,height:e.height,labelColor:Ne(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},leave:function(e){return b({borderColor:Ke(e),color:e.color,height:0,labelColor:Ne(e),labelOpacity:0,labelX:e.width/2,labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===g?{}:{labelX:0,labelY:e.height/2,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},config:Re,immediate:!Ie,initial:Ie?void 0:null}),Ze=r.useMemo((function(){return{borderRadius:te,borderWidth:ne,enableLabel:Y,isInteractive:he,labelSkipWidth:G,labelSkipHeight:z,onClick:ve,onMouseEnter:fe,onMouseLeave:me,getTooltipLabel:ze,tooltip:ge,isFocusable:we,ariaLabel:Ve,ariaLabelledBy:Me,ariaDescribedBy:Be}}),[te,ne,Y,ze,he,z,G,ve,fe,me,ge,we,Ve,Me,Be]),$e=n.bindDefs(Z,Xe,ee,{dataKey:"data",targetKey:"data.fill"}),ea={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null};A.includes("annotations")&&(ea.annotations=t.jsx(f,{bars:Xe,annotations:le},"annotations")),A.includes("axes")&&(ea.axes=t.jsx(e.Axes,{xScale:qe,yScale:Oe,width:He,height:Ae,top:w,right:V,bottom:B,left:T},"axes")),A.includes("bars")&&(ea.bars=t.jsx(r.Fragment,{children:Ue((function(e,a){return r.createElement(X,b({},Ze,{bar:a,style:e,shouldRenderLabel:_e(a),label:Ge(a.data)}))}))},"bars")),A.includes("grid")&&(ea.grid=t.jsx(e.Grid,{width:He,height:Ae,xScale:R?qe:null,yScale:P?Oe:null,xValues:E,yValues:F},"grid")),A.includes("legends")&&(ea.legends=t.jsx(m,{width:He,height:Ae,legends:Qe,toggleSerie:Je},"legends")),A.includes("markers")&&(ea.markers=t.jsx(n.CartesianMarkers,{markers:_,width:He,height:Ae,xScale:qe,yScale:Oe},"markers"));var aa=r.useMemo((function(){return b({},Ze,{margin:Fe,innerWidth:He,innerHeight:Ae,width:s,height:c,bars:Xe,xScale:qe,yScale:Oe})}),[Ze,Fe,He,Ae,s,c,Xe,qe,Oe]);return t.jsx(n.SvgWrapper,{width:Pe,height:Ee,margin:Fe,defs:$e,role:ye,ariaLabel:Se,ariaLabelledBy:ke,ariaDescribedBy:Ce,isFocusable:we,children:A.map((function(e,a){var i;return"function"==typeof e?t.jsx(r.Fragment,{children:r.createElement(e,aa)},a):null!=(i=null==ea?void 0:ea[e])?i:null}))})},z=function(e){var a=e.isInteractive,i=void 0===a?k.isInteractive:a,r=e.animate,o=void 0===r?k.animate:r,l=e.motionConfig,d=void 0===l?k.motionConfig:l,u=e.theme,s=e.renderWrapper,c=g(e,O);return t.jsx(n.Container,{animate:o,isInteractive:i,motionConfig:d,renderWrapper:s,theme:u,children:t.jsx(G,b({isInteractive:i},c))})},K=["isInteractive","renderWrapper","theme"],N=function(e,a,t,i){return e.find((function(e){return n.isCursorInRect(e.x+a.left,e.y+a.top,e.width,e.height,t,i)}))},_=function(o){var d=o.data,u=o.indexBy,s=o.keys,c=o.margin,h=o.width,g=o.height,v=o.groupMode,f=o.layout,m=o.reverse,x=o.minValue,p=o.maxValue,y=o.valueScale,S=o.indexScale,k=o.padding,L=o.innerPadding,w=o.axisTop,V=o.axisRight,M=o.axisBottom,B=void 0===M?C.axisBottom:M,W=o.axisLeft,T=void 0===W?C.axisLeft:W,I=o.enableGridX,R=void 0===I?C.enableGridX:I,j=o.enableGridY,P=void 0===j?C.enableGridY:j,E=o.gridXValues,F=o.gridYValues,H=o.layers,A=void 0===H?C.layers:H,D=o.renderBar,X=void 0===D?function(e,a){var t=a.bar,i=t.color,n=t.height,r=t.width,o=t.x,l=t.y,d=a.borderColor,u=a.borderRadius,s=a.borderWidth,c=a.label,h=a.labelColor,b=a.shouldRenderLabel;if(e.fillStyle=i,s>0&&(e.strokeStyle=d,e.lineWidth=s),e.beginPath(),u>0){var g=Math.min(u,n);e.moveTo(o+g,l),e.lineTo(o+r-g,l),e.quadraticCurveTo(o+r,l,o+r,l+g),e.lineTo(o+r,l+n-g),e.quadraticCurveTo(o+r,l+n,o+r-g,l+n),e.lineTo(o+g,l+n),e.quadraticCurveTo(o,l+n,o,l+n-g),e.lineTo(o,l+g),e.quadraticCurveTo(o,l,o+g,l),e.closePath()}else e.rect(o,l,r,n);e.fill(),s>0&&e.stroke(),b&&(e.textBaseline="middle",e.textAlign="center",e.fillStyle=h,e.fillText(c,o+r/2,l+n/2))}:D,Y=o.enableLabel,O=o.label,G=o.labelSkipWidth,z=o.labelSkipHeight,K=o.labelTextColor,_=o.colorBy,J=o.colors,Q=o.borderRadius,U=void 0===Q?C.borderRadius:Q,Z=o.borderWidth,$=void 0===Z?C.borderWidth:Z,ee=o.borderColor,ae=o.annotations,te=void 0===ae?C.annotations:ae,ie=o.legendLabel,ne=o.tooltipLabel,re=o.valueFormat,oe=o.isInteractive,le=void 0===oe?C.isInteractive:oe,de=o.tooltip,ue=void 0===de?C.tooltip:de,se=o.onClick,ce=o.onMouseEnter,he=o.onMouseLeave,be=o.legends,ge=o.pixelRatio,ve=void 0===ge?C.pixelRatio:ge,fe=o.canvasRef,me=r.useRef(null),xe=n.useTheme(),pe=n.useDimensions(h,g,c),ye=pe.margin,Se=pe.innerWidth,ke=pe.innerHeight,Ce=pe.outerWidth,Le=pe.outerHeight,we=q({indexBy:u,label:O,tooltipLabel:ne,valueFormat:re,colors:J,colorBy:_,borderColor:ee,labelTextColor:K,groupMode:v,layout:f,reverse:m,data:d,keys:s,minValue:x,maxValue:p,margin:ye,width:Se,height:ke,padding:k,innerPadding:L,valueScale:y,indexScale:S,enableLabel:Y,labelSkipWidth:G,labelSkipHeight:z,legends:be,legendLabel:ie}),Ve=we.bars,Me=we.barsWithValue,Be=we.xScale,We=we.yScale,Te=we.getLabel,Ie=we.getTooltipLabel,Re=we.getBorderColor,je=we.getLabelColor,Pe=we.shouldRenderBarLabel,Ee=we.legendsWithData,Fe=l.useTooltip(),He=Fe.showTooltipFromEvent,Ae=Fe.hideTooltip,De=a.useComputedAnnotations({annotations:a.useAnnotations({data:Ve,annotations:te,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var a=e.width,t=e.height;return{width:a,height:t,size:Math.max(a,t)}}})}),Xe=r.useMemo((function(){return{borderRadius:U,borderWidth:$,enableLabel:Y,isInteractive:le,labelSkipWidth:G,labelSkipHeight:z,onClick:se,onMouseEnter:ce,onMouseLeave:he,getTooltipLabel:Ie,tooltip:ue,margin:ye,innerWidth:Se,innerHeight:ke,width:h,height:g,bars:Ve,xScale:Be,yScale:We}}),[U,$,Y,Ie,g,ke,Se,le,z,G,ye,se,ce,he,Ve,Be,We,ue,h]);r.useEffect((function(){var t,n=null==(t=me.current)?void 0:t.getContext("2d");me.current&&n&&(me.current.width=Ce*ve,me.current.height=Le*ve,n.scale(ve,ve),n.fillStyle=xe.background,n.fillRect(0,0,Ce,Le),n.translate(ye.left,ye.top),A.forEach((function(t){"grid"===t?"number"==typeof xe.grid.line.strokeWidth&&xe.grid.line.strokeWidth>0&&(n.lineWidth=xe.grid.line.strokeWidth,n.strokeStyle=xe.grid.line.stroke,R&&e.renderGridLinesToCanvas(n,{width:h,height:g,scale:Be,axis:"x",values:E}),P&&e.renderGridLinesToCanvas(n,{width:h,height:g,scale:We,axis:"y",values:F})):"axes"===t?e.renderAxesToCanvas(n,{xScale:Be,yScale:We,width:Se,height:ke,top:w,right:V,bottom:B,left:T,theme:xe}):"bars"===t?Me.forEach((function(e){X(n,{bar:e,borderColor:Re(e),borderRadius:U,borderWidth:$,label:Te(e.data),labelColor:je(e),shouldRenderLabel:Pe(e)})})):"legends"===t?Ee.forEach((function(e){var a=e[0],t=e[1];i.renderLegendToCanvas(n,b({},a,{data:t,containerWidth:Se,containerHeight:ke,theme:xe}))})):"annotations"===t?a.renderAnnotationsToCanvas(n,{annotations:De,theme:xe}):"function"==typeof t&&t(n,Xe)})),n.save())}),[B,T,V,w,Me,U,$,De,R,P,Re,Te,je,E,F,v,g,ke,Se,Xe,A,f,Ee,ye.left,ye.top,Le,Ce,ve,X,Be,We,m,Pe,xe,h]);var Ye=r.useCallback((function(e){if(Ve&&me.current){var a=n.getRelativeCursor(me.current,e),t=a[0],i=a[1],o=N(Ve,ye,t,i);void 0!==o?(He(r.createElement(ue,b({},o.data,{color:o.color,label:o.label,value:Number(o.data.value)})),e),"mouseenter"===e.type&&(null==ce||ce(o.data,e))):Ae()}}),[Ae,ye,ce,Ve,He,ue]),qe=r.useCallback((function(e){if(Ve&&me.current){Ae();var a=n.getRelativeCursor(me.current,e),t=a[0],i=a[1],r=N(Ve,ye,t,i);r&&(null==he||he(r.data,e))}}),[Ae,ye,he,Ve]),Oe=r.useCallback((function(e){if(Ve&&me.current){var a=n.getRelativeCursor(me.current,e),t=a[0],i=a[1],r=N(Ve,ye,t,i);void 0!==r&&(null==se||se(b({},r.data,{color:r.color}),e))}}),[ye,se,Ve]);return t.jsx("canvas",{ref:function(e){me.current=e,fe&&"current"in fe&&(fe.current=e)},width:Ce*ve,height:Le*ve,style:{width:Ce,height:Le,cursor:le?"auto":"normal"},onMouseEnter:le?Ye:void 0,onMouseMove:le?Ye:void 0,onMouseLeave:le?qe:void 0,onClick:le?Oe:void 0})},J=r.forwardRef((function(e,a){var i=e.isInteractive,r=e.renderWrapper,o=e.theme,l=g(e,K);return t.jsx(n.Container,{isInteractive:i,renderWrapper:r,theme:o,animate:!1,children:t.jsx(_,b({},l,{canvasRef:a}))})})),Q=r.forwardRef((function(e,a){return t.jsx(n.ResponsiveWrapper,{children:function(i){var n=i.width,r=i.height;return t.jsx(J,b({width:n,height:r},e,{ref:a}))}})}));exports.Bar=z,exports.BarCanvas=J,exports.BarItem=p,exports.ResponsiveBar=function(e){return t.jsx(n.ResponsiveWrapper,{children:function(a){var i=a.width,n=a.height;return t.jsx(z,b({width:i,height:n},e))}})},exports.ResponsiveBarCanvas=Q,exports.canvasDefaultProps=C,exports.defaultProps=S,exports.svgDefaultProps=k; | ||
//# sourceMappingURL=nivo-bar.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{Axes as e,Grid as a,renderGridLinesToCanvas as i,renderAxesToCanvas as n}from"@nivo/axes";import{useAnnotations as r,Annotation as t,useComputedAnnotations as l,renderAnnotationsToCanvas as o}from"@nivo/annotations";import{jsxDEV as d,Fragment as u}from"react/jsx-dev-runtime";import{BoxLegendSvg as c,renderLegendToCanvas as s}from"@nivo/legends";import{useTheme as h,getPropertyAccessor as b,usePropertyAccessor as m,useValueFormatter as f,Container as v,useMotionConfig as g,useDimensions as p,bindDefs as x,CartesianMarkers as y,SvgWrapper as k,getRelativeCursor as S,isCursorInRect as N,ResponsiveWrapper as L}from"@nivo/core";import{useMemo as w,createElement as C,useCallback as V,useState as B,Fragment as W,forwardRef as M,useRef as I,useEffect as T}from"react";import{animated as R,to as P,useTransition as H}from"@react-spring/web";import{useTooltip as E,BasicTooltip as F}from"@nivo/tooltip";import{useOrdinalColorScale as X,useInheritedColor as Y}from"@nivo/colors";import{computeScale as D}from"@nivo/scales";import{stack as O,stackOffsetDiverging as A}from"d3-shape";import G from"lodash/uniqBy";function j(){return j=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},j.apply(this,arguments)}function q(e,a){if(null==e)return{};var i,n,r={},t=Object.keys(e);for(n=0;n<t.length;n++)i=t[n],a.indexOf(i)>=0||(r[i]=e[i]);return r}var z,K=function(e){var a=e.bars,i=e.annotations,n=r({data:a,annotations:i,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var a=e.height,i=e.width;return{width:i,height:a,size:Math.max(i,a)}}});return d(u,{children:n.map((function(e,a){return d(t,j({},e),a,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarAnnotations.tsx",lineNumber:22,columnNumber:17},undefined)}))},void 0,!1)},J=function(e){var a=e.width,i=e.height,n=e.legends,r=e.toggleSerie;return d(u,{children:n.map((function(e,n){var t,l=e[0],o=e[1];return d(c,j({},l,{containerWidth:a,containerHeight:i,data:null!=(t=l.data)?t:o,toggleSerie:l.toggleSerie&&"keys"===l.dataFrom?r:void 0}),n,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarLegends.tsx",lineNumber:14,columnNumber:13},undefined)}))},void 0,!1)},Q=["data"],U="/home/oleksandr/code/atlas/nivo/packages/bar/src/BarItem.tsx",Z=function(e){var a,i=e.bar,n=i.data,r=q(i,Q),t=e.style,l=t.borderColor,o=t.color,u=t.height,c=t.labelColor,s=t.labelOpacity,b=t.labelX,m=t.labelY,f=t.transform,v=t.width,g=e.borderRadius,p=e.borderWidth,x=e.label,y=e.shouldRenderLabel,k=e.isInteractive,S=e.onClick,N=e.onMouseEnter,L=e.onMouseLeave,B=e.tooltip,W=e.isFocusable,M=e.ariaLabel,I=e.ariaLabelledBy,T=e.ariaDescribedBy,H=h(),F=E(),X=F.showTooltipFromEvent,Y=F.showTooltipAt,D=F.hideTooltip,O=w((function(){return function(){return C(B,j({},r,n))}}),[B,r,n]),A=V((function(e){null==S||S(j({color:r.color},n),e)}),[r,n,S]),G=V((function(e){return X(O(),e)}),[X,O]),z=V((function(e){null==N||N(n,e),X(O(),e)}),[n,N,X,O]),K=V((function(e){null==L||L(n,e),D()}),[n,D,L]),J=V((function(){Y(O(),[r.absX+r.width/2,r.absY])}),[Y,O,r]),Z=V((function(){D()}),[D]);return d(R.g,{transform:f,children:[d(R.rect,{width:P(v,(function(e){return Math.max(e,0)})),height:P(u,(function(e){return Math.max(e,0)})),rx:g,ry:g,fill:null!=(a=n.fill)?a:o,strokeWidth:p,stroke:l,focusable:W,tabIndex:W?0:void 0,"aria-label":M?M(n):void 0,"aria-labelledby":I?I(n):void 0,"aria-describedby":T?T(n):void 0,onMouseEnter:k?z:void 0,onMouseMove:k?G:void 0,onMouseLeave:k?K:void 0,onClick:k?A:void 0,onFocus:k&&W?J:void 0,onBlur:k&&W?Z:void 0},void 0,!1,{fileName:U,lineNumber:83,columnNumber:13},undefined),y&&d(R.text,{x:b,y:m,textAnchor:"middle",dominantBaseline:"central",fillOpacity:s,style:j({},H.labels.text,{pointerEvents:"none",fill:c}),children:x},void 0,!1,{fileName:U,lineNumber:104,columnNumber:17},undefined)]},void 0,!0,{fileName:U,lineNumber:82,columnNumber:9},undefined)},$=["color","label"],_={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(e){var a=e.color,i=e.label,n=q(e,$);return d(F,{id:i,value:n.formattedValue,enableChip:!0,color:a},void 0,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarTooltip.tsx",lineNumber:5,columnNumber:12},undefined)},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[]},ee=j({},_,{layers:["grid","axes","bars","markers","legends","annotations"],barComponent:Z,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),ae=j({},_,{layers:["grid","axes","bars","legends","annotations"],pixelRatio:"undefined"!=typeof window&&null!=(z=window.devicePixelRatio)?z:1}),ie=function(e,a,i,n,r,t){return D(n,{all:e.map(a),min:0,max:0},r,t).padding(i)},ne=function(e,a){return e.map((function(e){return j({},a.reduce((function(e,a){return e[a]=null,e}),{}),e)}))},re=function(e){return Object.keys(e).reduce((function(a,i){return e[i]&&(a[i]=e[i]),a}),{})},te=function(e){return[e,Number(e)]},le=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],oe=function(e,a){return e>a},de=function(e,a){return e<a},ue=function(e,a){return Array.from(" ".repeat(a-e),(function(a,i){return e+i}))},ce=function(e){return oe(e,0)?0:e},se=function(e,a,i,n){var r=e.data,t=e.formatValue,l=e.getColor,o=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,c=void 0===u?0:u,s=e.keys,h=e.xScale,b=e.yScale,m=e.margin,f=i?de:oe,v=r.map(re),g=[];return s.forEach((function(e,i){return ue(0,h.domain().length).forEach((function(u){var s,p,x,y=te(r[u][e]),k=y[0],S=y[1],N=o(r[u]),L=(null!=(s=h(N))?s:0)+a*i+c*i,w=f(p=S,0)?null!=(x=b(p))?x:0:n,C=function(e,a){var i;return f(e,0)?n-a:(null!=(i=b(e))?i:0)-n}(S,w),V={id:e,value:null===k?k:S,formattedValue:t(S),hidden:!1,index:u,indexValue:N,data:v[u]};g.push({key:e+"."+V.indexValue,index:g.length,data:V,x:L,y:w,absX:m.left+L,absY:m.top+w,width:a,height:C,color:l(V),label:d(V)})}))})),g},he=function(e,a,i,n){var r=e.data,t=e.formatValue,l=e.getIndex,o=e.getColor,d=e.getTooltipLabel,u=e.keys,c=e.innerPadding,s=void 0===c?0:c,h=e.xScale,b=e.yScale,m=e.margin,f=i?de:oe,v=r.map(re),g=[];return u.forEach((function(e,i){return ue(0,b.domain().length).forEach((function(u){var c,p,x,y=te(r[u][e]),k=y[0],S=y[1],N=l(r[u]),L=f(p=S,0)?n:null!=(x=h(p))?x:0,w=(null!=(c=b(N))?c:0)+a*i+s*i,C=function(e,a){var i;return f(e,0)?(null!=(i=h(e))?i:0)-n:n-a}(S,L),V={id:e,value:null===k?k:S,formattedValue:t(S),hidden:!1,index:u,indexValue:N,data:v[u]};g.push({key:e+"."+V.indexValue,index:g.length,data:V,x:L,y:w,absX:m.left+L,absY:m.top+w,width:C,height:a,color:o(V),label:d(V)})}))})),g},be=function(e){var a,i,n=e.layout,r=e.minValue,t=e.maxValue,l=e.reverse,o=e.width,d=e.height,u=e.padding,c=void 0===u?0:u,s=e.innerPadding,h=void 0===s?0:s,b=e.valueScale,m=e.indexScale,f=e.hiddenIds,v=void 0===f?[]:f,g=q(e,le),p=g.keys.filter((function(e){return!v.includes(e)})),x=ne(g.data,p),y="vertical"===n?["y","x",o]:["x","y",d],k=y[0],S=y[1],N=y[2],L=ie(x,g.getIndex,c,m,N,S),w=j({max:t,min:r,reverse:l},b),C="auto"===w.min?ce:function(e){return e},V=x.reduce((function(e,a){return[].concat(e,p.map((function(e){return a[e]})))}),[]).filter(Boolean),B=C(Math.min.apply(Math,V)),W=(i=Math.max.apply(Math,V),isFinite(i)?i:0),M=D(w,{all:V,min:B,max:W},"x"===k?o:d,k),I="vertical"===n?[L,M]:[M,L],T=I[0],R=I[1],P=(L.bandwidth()-h*(p.length-1))/p.length,H=[j({},g,{data:x,keys:p,innerPadding:h,xScale:T,yScale:R}),P,w.reverse,null!=(a=M(0))?a:0];return{xScale:T,yScale:R,bars:P>0?"vertical"===n?se.apply(void 0,H):he.apply(void 0,H):[]}},me=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],fe=function e(a){var i;return a.some(Array.isArray)?e((i=[]).concat.apply(i,a)):a},ve=function(e,a,i){var n=e.formatValue,r=e.getColor,t=e.getIndex,l=e.getTooltipLabel,o=e.innerPadding,d=e.stackedData,u=e.xScale,c=e.yScale,s=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,b){var m,f,v=e[b],g=null!=(m=u(t(v.data)))?m:0,p=(null!=(f=function(e){return c(e[i?0:1])}(v))?f:0)+.5*o,x=function(e,a){var n;return(null!=(n=c(e[i?1:0]))?n:0)-a}(v,p)-o,y=te(v.data[e.key]),k=y[0],S=y[1],N={id:e.key,value:null===k?k:S,formattedValue:n(S),hidden:!1,index:b,indexValue:d,data:re(v.data)};h.push({key:e.key+"."+d,index:h.length,data:N,x:g,y:p,absX:s.left+g,absY:s.top+p,width:a,height:x,color:r(N),label:l(N)})}))})),h},ge=function(e,a,i){var n=e.formatValue,r=e.getColor,t=e.getIndex,l=e.getTooltipLabel,o=e.innerPadding,d=e.stackedData,u=e.xScale,c=e.yScale,s=e.margin,h=[];return d.forEach((function(e){return c.domain().forEach((function(d,b){var m,f,v=e[b],g=null!=(m=c(t(v.data)))?m:0,p=(null!=(f=function(e){return u(e[i?1:0])}(v))?f:0)+.5*o,x=function(e,a){var n;return(null!=(n=u(e[i?0:1]))?n:0)-a}(v,p)-o,y=te(v.data[e.key]),k=y[0],S=y[1],N={id:e.key,value:null===k?k:S,formattedValue:n(S),hidden:!1,index:b,indexValue:d,data:re(v.data)};h.push({key:e.key+"."+d,index:h.length,data:N,x:p,y:g,absX:s.left+p,absY:s.top+g,width:x,height:a,color:r(N),label:l(N)})}))})),h},pe=function(e){var a,i=e.data,n=e.layout,r=e.minValue,t=e.maxValue,l=e.reverse,o=e.width,d=e.height,u=e.padding,c=void 0===u?0:u,s=e.valueScale,h=e.indexScale,b=e.hiddenIds,m=void 0===b?[]:b,f=q(e,me),v=f.keys.filter((function(e){return!m.includes(e)})),g=O().keys(v).offset(A)(ne(i,v)),p="vertical"===n?["y","x",o]:["x","y",d],x=p[0],y=p[1],k=p[2],S=ie(i,f.getIndex,c,h,k,y),N=j({max:t,min:r,reverse:l},s),L=(a=fe(g),"log"===s.type?a.filter((function(e){return 0!==e})):a),w=Math.min.apply(Math,L),C=Math.max.apply(Math,L),V=D(N,{all:L,min:w,max:C},"x"===x?o:d,x),B="vertical"===n?[S,V]:[V,S],W=B[0],M=B[1],I=f.innerPadding>0?f.innerPadding:0,T=S.bandwidth(),R=[j({},f,{innerPadding:I,stackedData:g,xScale:W,yScale:M}),T,N.reverse];return{xScale:W,yScale:M,bars:T>0?"vertical"===n?ve.apply(void 0,R):ge.apply(void 0,R):[]}},xe=function(e){var a=e.bars,i=e.direction,n=e.from,r=e.groupMode,t=e.layout,l=e.legendLabel,o=e.reverse,d=b(null!=l?l:"indexes"===n?"indexValue":"id");return"indexes"===n?function(e,a,i){var n=G(e.map((function(e){var a,n;return{id:null!=(a=e.data.indexValue)?a:"",label:i(e.data),hidden:e.data.hidden,color:null!=(n=e.color)?n:"#000"}})),(function(e){return e.id}));return"horizontal"===a&&n.reverse(),n}(a,t,d):function(e,a,i,n,r,t){var l=G(e.map((function(e){var a;return{id:e.data.id,label:t(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return("vertical"===a&&"stacked"===n&&"column"===i&&!0!==r||"horizontal"===a&&"stacked"===n&&!0===r)&&l.reverse(),l}(a,t,i,r,o,d)},ye=function(e){var a=e.indexBy,i=void 0===a?_.indexBy:a,n=e.keys,r=void 0===n?_.keys:n,t=e.label,l=void 0===t?_.label:t,o=e.tooltipLabel,d=void 0===o?_.tooltipLabel:o,u=e.valueFormat,c=e.colors,s=void 0===c?_.colors:c,b=e.colorBy,v=void 0===b?_.colorBy:b,g=e.borderColor,p=void 0===g?_.borderColor:g,x=e.labelTextColor,y=void 0===x?_.labelTextColor:x,k=e.groupMode,S=void 0===k?_.groupMode:k,N=e.layout,L=void 0===N?_.layout:N,C=e.reverse,W=void 0===C?_.reverse:C,M=e.data,I=e.minValue,T=void 0===I?_.minValue:I,R=e.maxValue,P=void 0===R?_.maxValue:R,H=e.margin,E=e.width,F=e.height,D=e.padding,O=void 0===D?_.padding:D,A=e.innerPadding,G=void 0===A?_.innerPadding:A,q=e.valueScale,z=void 0===q?_.valueScale:q,K=e.indexScale,J=void 0===K?_.indexScale:K,Q=e.initialHiddenIds,U=void 0===Q?_.initialHiddenIds:Q,Z=e.enableLabel,$=void 0===Z?_.enableLabel:Z,ee=e.labelSkipWidth,ae=void 0===ee?_.labelSkipWidth:ee,ie=e.labelSkipHeight,ne=void 0===ie?_.labelSkipHeight:ie,re=e.legends,te=void 0===re?_.legends:re,le=e.legendLabel,oe=B(null!=U?U:[]),de=oe[0],ue=oe[1],ce=V((function(e){ue((function(a){return a.indexOf(e)>-1?a.filter((function(a){return a!==e})):[].concat(a,[e])}))}),[]),se=m(i),he=m(l),me=m(d),fe=f(u),ve=h(),ge=X(s,v),ye=Y(p,ve),ke=Y(y,ve),Se=("grouped"===S?be:pe)({layout:L,reverse:W,data:M,getIndex:se,keys:r,minValue:T,maxValue:P,width:E,height:F,getColor:ge,padding:O,innerPadding:G,valueScale:z,indexScale:J,hiddenIds:de,formatValue:fe,getTooltipLabel:me,margin:H}),Ne=Se.bars,Le=Se.xScale,we=Se.yScale,Ce=w((function(){return Ne.filter((function(e){return null!==e.data.value})).map((function(e,a){return j({},e,{index:a})}))}),[Ne]),Ve=V((function(e){var a=e.width,i=e.height;return!!$&&(!(ae>0&&a<ae)&&!(ne>0&&i<ne))}),[$,ae,ne]),Be=w((function(){return r.map((function(e){var a=Ne.find((function(a){return a.data.id===e}));return j({},a,{data:j({id:e},null==a?void 0:a.data,{hidden:de.includes(e)})})}))}),[de,r,Ne]),We=w((function(){return te.map((function(e){return[e,xe({bars:"keys"===e.dataFrom?Be:Ne,direction:e.direction,from:e.dataFrom,groupMode:S,layout:L,legendLabel:le,reverse:W})]}))}),[te,Be,Ne,S,L,le,W]);return{bars:Ne,barsWithValue:Ce,xScale:Le,yScale:we,getIndex:se,getLabel:he,getTooltipLabel:me,formatValue:fe,getColor:ge,getBorderColor:ye,getLabelColor:ke,shouldRenderBarLabel:Ve,hiddenIds:de,toggleSerie:ce,legendsWithData:We}},ke=["isInteractive","animate","motionConfig","theme","renderWrapper"],Se="/home/oleksandr/code/atlas/nivo/packages/bar/src/Bar.tsx",Ne=function(i){var n=i.data,r=i.indexBy,t=i.keys,l=i.margin,o=i.width,u=i.height,c=i.groupMode,s=i.layout,h=i.reverse,b=i.minValue,m=i.maxValue,f=i.valueScale,v=i.indexScale,S=i.padding,N=i.innerPadding,L=i.axisTop,V=i.axisRight,B=i.axisBottom,M=void 0===B?ee.axisBottom:B,I=i.axisLeft,T=void 0===I?ee.axisLeft:I,R=i.enableGridX,P=void 0===R?ee.enableGridX:R,E=i.enableGridY,F=void 0===E?ee.enableGridY:E,X=i.gridXValues,Y=i.gridYValues,D=i.layers,O=void 0===D?ee.layers:D,A=i.barComponent,G=void 0===A?ee.barComponent:A,q=i.enableLabel,z=i.label,Q=i.labelSkipWidth,U=i.labelSkipHeight,Z=i.labelTextColor,$=i.markers,_=void 0===$?ee.markers:$,ae=i.colorBy,ie=i.colors,ne=i.defs,re=void 0===ne?ee.defs:ne,te=i.fill,le=void 0===te?ee.fill:te,oe=i.borderRadius,de=void 0===oe?ee.borderRadius:oe,ue=i.borderWidth,ce=void 0===ue?ee.borderWidth:ue,se=i.borderColor,he=i.annotations,be=void 0===he?ee.annotations:he,me=i.legendLabel,fe=i.tooltipLabel,ve=i.valueFormat,ge=i.isInteractive,pe=void 0===ge?ee.isInteractive:ge,xe=i.tooltip,ke=void 0===xe?ee.tooltip:xe,Ne=i.onClick,Le=i.onMouseEnter,we=i.onMouseLeave,Ce=i.legends,Ve=i.role,Be=void 0===Ve?ee.role:Ve,We=i.ariaLabel,Me=i.ariaLabelledBy,Ie=i.ariaDescribedBy,Te=i.isFocusable,Re=void 0===Te?ee.isFocusable:Te,Pe=i.barAriaLabel,He=i.barAriaLabelledBy,Ee=i.barAriaDescribedBy,Fe=i.initialHiddenIds,Xe=g(),Ye=Xe.animate,De=Xe.config,Oe=p(o,u,l),Ae=Oe.outerWidth,Ge=Oe.outerHeight,je=Oe.margin,qe=Oe.innerWidth,ze=Oe.innerHeight,Ke=ye({indexBy:r,label:z,tooltipLabel:fe,valueFormat:ve,colors:ie,colorBy:ae,borderColor:se,labelTextColor:Z,groupMode:c,layout:s,reverse:h,data:n,keys:t,minValue:b,maxValue:m,margin:je,width:qe,height:ze,padding:S,innerPadding:N,valueScale:f,indexScale:v,enableLabel:q,labelSkipWidth:Q,labelSkipHeight:U,legends:Ce,legendLabel:me,initialHiddenIds:Fe}),Je=Ke.bars,Qe=Ke.barsWithValue,Ue=Ke.xScale,Ze=Ke.yScale,$e=Ke.getLabel,_e=Ke.getTooltipLabel,ea=Ke.getBorderColor,aa=Ke.getLabelColor,ia=Ke.shouldRenderBarLabel,na=Ke.toggleSerie,ra=Ke.legendsWithData,ta=H(Qe,{keys:function(e){return e.key},from:function(e){return j({borderColor:ea(e),color:e.color,height:0,labelColor:aa(e),labelOpacity:0,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===s?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return{borderColor:ea(e),color:e.color,height:e.height,labelColor:aa(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},update:function(e){return{borderColor:ea(e),color:e.color,height:e.height,labelColor:aa(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},leave:function(e){return j({borderColor:ea(e),color:e.color,height:0,labelColor:aa(e),labelOpacity:0,labelX:e.width/2,labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===s?{}:{labelX:0,labelY:e.height/2,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},config:De,immediate:!Ye,initial:Ye?void 0:null}),la=w((function(){return{borderRadius:de,borderWidth:ce,enableLabel:q,isInteractive:pe,labelSkipWidth:Q,labelSkipHeight:U,onClick:Ne,onMouseEnter:Le,onMouseLeave:we,getTooltipLabel:_e,tooltip:ke,isFocusable:Re,ariaLabel:Pe,ariaLabelledBy:He,ariaDescribedBy:Ee}}),[de,ce,q,_e,pe,U,Q,Ne,Le,we,ke,Re,Pe,He,Ee]),oa=x(re,Je,le,{dataKey:"data",targetKey:"data.fill"}),da={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null};O.includes("annotations")&&(da.annotations=d(K,{bars:Je,annotations:be},"annotations",!1,{fileName:Se,lineNumber:283,columnNumber:13},undefined)),O.includes("axes")&&(da.axes=d(e,{xScale:Ue,yScale:Ze,width:qe,height:ze,top:L,right:V,bottom:M,left:T},"axes",!1,{fileName:Se,lineNumber:289,columnNumber:13},undefined)),O.includes("bars")&&(da.bars=d(W,{children:ta((function(e,a){return C(G,j({},la,{bar:a,style:e,shouldRenderLabel:ia(a),label:$e(a.data)}))}))},"bars",!1,{fileName:Se,lineNumber:305,columnNumber:13},undefined)),O.includes("grid")&&(da.grid=d(a,{width:qe,height:ze,xScale:P?Ue:null,yScale:F?Ze:null,xValues:X,yValues:Y},"grid",!1,{fileName:Se,lineNumber:321,columnNumber:13},undefined)),O.includes("legends")&&(da.legends=d(J,{width:qe,height:ze,legends:ra,toggleSerie:na},"legends",!1,{fileName:Se,lineNumber:335,columnNumber:13},undefined)),O.includes("markers")&&(da.markers=d(y,{markers:_,width:qe,height:ze,xScale:Ue,yScale:Ze},"markers",!1,{fileName:Se,lineNumber:347,columnNumber:13},undefined));var ua=w((function(){return j({},la,{margin:je,innerWidth:qe,innerHeight:ze,width:o,height:u,bars:Je,xScale:Ue,yScale:Ze})}),[la,je,qe,ze,o,u,Je,Ue,Ze]);return d(k,{width:Ae,height:Ge,margin:je,defs:oa,role:Be,ariaLabel:We,ariaLabelledBy:Me,ariaDescribedBy:Ie,isFocusable:Re,children:O.map((function(e,a){var i;return"function"==typeof e?d(W,{children:C(e,ua)},a,!1,{fileName:Se,lineNumber:388,columnNumber:28},undefined):null!=(i=null==da?void 0:da[e])?i:null}))},void 0,!1,{fileName:Se,lineNumber:375,columnNumber:9},undefined)},Le=function(e){var a=e.isInteractive,i=void 0===a?ee.isInteractive:a,n=e.animate,r=void 0===n?ee.animate:n,t=e.motionConfig,l=void 0===t?ee.motionConfig:t,o=e.theme,u=e.renderWrapper,c=q(e,ke);return d(v,{animate:r,isInteractive:i,motionConfig:l,renderWrapper:u,theme:o,children:d(Ne,j({isInteractive:i},c),void 0,!1,{fileName:Se,lineNumber:414,columnNumber:9},undefined)},void 0,!1,{fileName:Se,lineNumber:405,columnNumber:5},undefined)},we=["isInteractive","renderWrapper","theme"],Ce="/home/oleksandr/code/atlas/nivo/packages/bar/src/BarCanvas.tsx",Ve=function(e,a,i,n){return e.find((function(e){return N(e.x+a.left,e.y+a.top,e.width,e.height,i,n)}))},Be=function(e){var a=e.data,t=e.indexBy,u=e.keys,c=e.margin,b=e.width,m=e.height,f=e.groupMode,v=e.layout,g=e.reverse,x=e.minValue,y=e.maxValue,k=e.valueScale,N=e.indexScale,L=e.padding,B=e.innerPadding,W=e.axisTop,M=e.axisRight,R=e.axisBottom,P=void 0===R?ae.axisBottom:R,H=e.axisLeft,F=void 0===H?ae.axisLeft:H,X=e.enableGridX,Y=void 0===X?ae.enableGridX:X,D=e.enableGridY,O=void 0===D?ae.enableGridY:D,A=e.gridXValues,G=e.gridYValues,q=e.layers,z=void 0===q?ae.layers:q,K=e.renderBar,J=void 0===K?function(e,a){var i=a.bar,n=i.color,r=i.height,t=i.width,l=i.x,o=i.y,d=a.borderColor,u=a.borderRadius,c=a.borderWidth,s=a.label,h=a.labelColor,b=a.shouldRenderLabel;if(e.fillStyle=n,c>0&&(e.strokeStyle=d,e.lineWidth=c),e.beginPath(),u>0){var m=Math.min(u,r);e.moveTo(l+m,o),e.lineTo(l+t-m,o),e.quadraticCurveTo(l+t,o,l+t,o+m),e.lineTo(l+t,o+r-m),e.quadraticCurveTo(l+t,o+r,l+t-m,o+r),e.lineTo(l+m,o+r),e.quadraticCurveTo(l,o+r,l,o+r-m),e.lineTo(l,o+m),e.quadraticCurveTo(l,o,l+m,o),e.closePath()}else e.rect(l,o,t,r);e.fill(),c>0&&e.stroke(),b&&(e.textBaseline="middle",e.textAlign="center",e.fillStyle=h,e.fillText(s,l+t/2,o+r/2))}:K,Q=e.enableLabel,U=e.label,Z=e.labelSkipWidth,$=e.labelSkipHeight,_=e.labelTextColor,ee=e.colorBy,ie=e.colors,ne=e.borderRadius,re=void 0===ne?ae.borderRadius:ne,te=e.borderWidth,le=void 0===te?ae.borderWidth:te,oe=e.borderColor,de=e.annotations,ue=void 0===de?ae.annotations:de,ce=e.legendLabel,se=e.tooltipLabel,he=e.valueFormat,be=e.isInteractive,me=void 0===be?ae.isInteractive:be,fe=e.tooltip,ve=void 0===fe?ae.tooltip:fe,ge=e.onClick,pe=e.onMouseEnter,xe=e.onMouseLeave,ke=e.legends,Se=e.pixelRatio,Ne=void 0===Se?ae.pixelRatio:Se,Le=e.canvasRef,we=I(null),Be=h(),We=p(b,m,c),Me=We.margin,Ie=We.innerWidth,Te=We.innerHeight,Re=We.outerWidth,Pe=We.outerHeight,He=ye({indexBy:t,label:U,tooltipLabel:se,valueFormat:he,colors:ie,colorBy:ee,borderColor:oe,labelTextColor:_,groupMode:f,layout:v,reverse:g,data:a,keys:u,minValue:x,maxValue:y,margin:Me,width:Ie,height:Te,padding:L,innerPadding:B,valueScale:k,indexScale:N,enableLabel:Q,labelSkipWidth:Z,labelSkipHeight:$,legends:ke,legendLabel:ce}),Ee=He.bars,Fe=He.barsWithValue,Xe=He.xScale,Ye=He.yScale,De=He.getLabel,Oe=He.getTooltipLabel,Ae=He.getBorderColor,Ge=He.getLabelColor,je=He.shouldRenderBarLabel,qe=He.legendsWithData,ze=E(),Ke=ze.showTooltipFromEvent,Je=ze.hideTooltip,Qe=l({annotations:r({data:Ee,annotations:ue,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var a=e.width,i=e.height;return{width:a,height:i,size:Math.max(a,i)}}})}),Ue=w((function(){return{borderRadius:re,borderWidth:le,enableLabel:Q,isInteractive:me,labelSkipWidth:Z,labelSkipHeight:$,onClick:ge,onMouseEnter:pe,onMouseLeave:xe,getTooltipLabel:Oe,tooltip:ve,margin:Me,innerWidth:Ie,innerHeight:Te,width:b,height:m,bars:Ee,xScale:Xe,yScale:Ye}}),[re,le,Q,Oe,m,Te,Ie,me,$,Z,Me,ge,pe,xe,Ee,Xe,Ye,ve,b]);T((function(){var e,a=null==(e=we.current)?void 0:e.getContext("2d");we.current&&a&&(we.current.width=Re*Ne,we.current.height=Pe*Ne,a.scale(Ne,Ne),a.fillStyle=Be.background,a.fillRect(0,0,Re,Pe),a.translate(Me.left,Me.top),z.forEach((function(e){"grid"===e?"number"==typeof Be.grid.line.strokeWidth&&Be.grid.line.strokeWidth>0&&(a.lineWidth=Be.grid.line.strokeWidth,a.strokeStyle=Be.grid.line.stroke,Y&&i(a,{width:b,height:m,scale:Xe,axis:"x",values:A}),O&&i(a,{width:b,height:m,scale:Ye,axis:"y",values:G})):"axes"===e?n(a,{xScale:Xe,yScale:Ye,width:Ie,height:Te,top:W,right:M,bottom:P,left:F,theme:Be}):"bars"===e?Fe.forEach((function(e){J(a,{bar:e,borderColor:Ae(e),borderRadius:re,borderWidth:le,label:De(e.data),labelColor:Ge(e),shouldRenderLabel:je(e)})})):"legends"===e?qe.forEach((function(e){var i=e[0],n=e[1];s(a,j({},i,{data:n,containerWidth:Ie,containerHeight:Te,theme:Be}))})):"annotations"===e?o(a,{annotations:Qe,theme:Be}):"function"==typeof e&&e(a,Ue)})),a.save())}),[P,F,M,W,Fe,re,le,Qe,Y,O,Ae,De,Ge,A,G,f,m,Te,Ie,Ue,z,v,qe,Me.left,Me.top,Pe,Re,Ne,J,Xe,Ye,g,je,Be,b]);var Ze=V((function(e){if(Ee&&we.current){var a=S(we.current,e),i=a[0],n=a[1],r=Ve(Ee,Me,i,n);void 0!==r?(Ke(C(ve,j({},r.data,{color:r.color,label:r.label,value:Number(r.data.value)})),e),"mouseenter"===e.type&&(null==pe||pe(r.data,e))):Je()}}),[Je,Me,pe,Ee,Ke,ve]),$e=V((function(e){if(Ee&&we.current){Je();var a=S(we.current,e),i=a[0],n=a[1],r=Ve(Ee,Me,i,n);r&&(null==xe||xe(r.data,e))}}),[Je,Me,xe,Ee]),_e=V((function(e){if(Ee&&we.current){var a=S(we.current,e),i=a[0],n=a[1],r=Ve(Ee,Me,i,n);void 0!==r&&(null==ge||ge(j({},r.data,{color:r.color}),e))}}),[Me,ge,Ee]);return d("canvas",{ref:function(e){we.current=e,Le&&"current"in Le&&(Le.current=e)},width:Re*Ne,height:Pe*Ne,style:{width:Re,height:Pe,cursor:me?"auto":"normal"},onMouseEnter:me?Ze:void 0,onMouseMove:me?Ze:void 0,onMouseLeave:me?$e:void 0,onClick:me?_e:void 0},void 0,!1,{fileName:Ce,lineNumber:462,columnNumber:9},undefined)},We=M((function(e,a){var i=e.isInteractive,n=e.renderWrapper,r=e.theme,t=q(e,we);return d(v,{isInteractive:i,renderWrapper:n,theme:r,animate:!1,children:d(Be,j({},t,{canvasRef:a}),void 0,!1,{fileName:Ce,lineNumber:488,columnNumber:13},undefined)},void 0,!1,{fileName:Ce,lineNumber:487,columnNumber:9},undefined)})),Me="/home/oleksandr/code/atlas/nivo/packages/bar/src/ResponsiveBar.tsx",Ie=function(e){return d(L,{children:function(a){var i=a.width,n=a.height;return d(Le,j({width:i,height:n},e),void 0,!1,{fileName:Me,lineNumber:9,columnNumber:33},undefined)}},void 0,!1,{fileName:Me,lineNumber:8,columnNumber:5},undefined)},Te="/home/oleksandr/code/atlas/nivo/packages/bar/src/ResponsiveBarCanvas.tsx",Re=M((function(e,a){var i=this;return d(L,{children:function(n){var r=n.width,t=n.height;return d(We,j({width:r,height:t},e,{ref:a}),void 0,!1,{fileName:Te,lineNumber:12,columnNumber:17},i)}},void 0,!1,{fileName:Te,lineNumber:10,columnNumber:9},this)}));export{Le as Bar,We as BarCanvas,Z as BarItem,Ie as ResponsiveBar,Re as ResponsiveBarCanvas,ae as canvasDefaultProps,_ as defaultProps,ee as svgDefaultProps}; | ||
import{Axes as e,Grid as a,renderGridLinesToCanvas as i,renderAxesToCanvas as t}from"@nivo/axes";import{useAnnotations as n,Annotation as r,useComputedAnnotations as l,renderAnnotationsToCanvas as o}from"@nivo/annotations";import{jsx as d,Fragment as u,jsxs as c}from"react/jsx-runtime";import{BoxLegendSvg as s,renderLegendToCanvas as h}from"@nivo/legends";import{useTheme as b,getPropertyAccessor as g,usePropertyAccessor as v,useValueFormatter as f,Container as m,useMotionConfig as p,useDimensions as x,bindDefs as y,CartesianMarkers as S,SvgWrapper as k,getRelativeCursor as w,isCursorInRect as L,ResponsiveWrapper as C}from"@nivo/core";import{useMemo as V,createElement as W,useCallback as B,useState as M,Fragment as I,forwardRef as T,useRef as R,useEffect as P}from"react";import{animated as H,to as E,useTransition as F}from"@react-spring/web";import{useTooltip as X,BasicTooltip as Y}from"@nivo/tooltip";import{useOrdinalColorScale as D,useInheritedColor as O}from"@nivo/colors";import{computeScale as G}from"@nivo/scales";import{stack as A,stackOffsetDiverging as j}from"d3-shape";import q from"lodash/uniqBy";function z(){return z=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}return e},z.apply(this,arguments)}function K(e,a){if(null==e)return{};var i,t,n={},r=Object.keys(e);for(t=0;t<r.length;t++)i=r[t],a.indexOf(i)>=0||(n[i]=e[i]);return n}var N,J=function(e){var a=e.bars,i=e.annotations,t=n({data:a,annotations:i,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var a=e.height,i=e.width;return{width:i,height:a,size:Math.max(i,a)}}});return d(u,{children:t.map((function(e,a){return d(r,z({},e),a)}))})},Q=function(e){var a=e.width,i=e.height,t=e.legends,n=e.toggleSerie;return d(u,{children:t.map((function(e,t){var r,l=e[0],o=e[1];return d(s,z({},l,{containerWidth:a,containerHeight:i,data:null!=(r=l.data)?r:o,toggleSerie:l.toggleSerie&&"keys"===l.dataFrom?n:void 0}),t)}))})},U=["data"],Z=function(e){var a,i=e.bar,t=i.data,n=K(i,U),r=e.style,l=r.borderColor,o=r.color,u=r.height,s=r.labelColor,h=r.labelOpacity,g=r.labelX,v=r.labelY,f=r.transform,m=r.width,p=e.borderRadius,x=e.borderWidth,y=e.label,S=e.shouldRenderLabel,k=e.isInteractive,w=e.onClick,L=e.onMouseEnter,C=e.onMouseLeave,M=e.tooltip,I=e.isFocusable,T=e.ariaLabel,R=e.ariaLabelledBy,P=e.ariaDescribedBy,F=b(),Y=X(),D=Y.showTooltipFromEvent,O=Y.showTooltipAt,G=Y.hideTooltip,A=V((function(){return function(){return W(M,z({},n,t))}}),[M,n,t]),j=B((function(e){null==w||w(z({color:n.color},t),e)}),[n,t,w]),q=B((function(e){return D(A(),e)}),[D,A]),N=B((function(e){null==L||L(t,e),D(A(),e)}),[t,L,D,A]),J=B((function(e){null==C||C(t,e),G()}),[t,G,C]),Q=B((function(){O(A(),[n.absX+n.width/2,n.absY])}),[O,A,n]),Z=B((function(){G()}),[G]);return c(H.g,{transform:f,children:[d(H.rect,{width:E(m,(function(e){return Math.max(e,0)})),height:E(u,(function(e){return Math.max(e,0)})),rx:p,ry:p,fill:null!=(a=t.fill)?a:o,strokeWidth:x,stroke:l,focusable:I,tabIndex:I?0:void 0,"aria-label":T?T(t):void 0,"aria-labelledby":R?R(t):void 0,"aria-describedby":P?P(t):void 0,onMouseEnter:k?N:void 0,onMouseMove:k?q:void 0,onMouseLeave:k?J:void 0,onClick:k?j:void 0,onFocus:k&&I?Q:void 0,onBlur:k&&I?Z:void 0}),S&&d(H.text,{x:g,y:v,textAnchor:"middle",dominantBaseline:"central",fillOpacity:h,style:z({},F.labels.text,{pointerEvents:"none",fill:s}),children:y})]})},$=["color","label"],_={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(e){var a=e.color,i=e.label,t=K(e,$);return d(Y,{id:i,value:t.formattedValue,enableChip:!0,color:a})},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[]},ee=z({},_,{layers:["grid","axes","bars","markers","legends","annotations"],barComponent:Z,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),ae=z({},_,{layers:["grid","axes","bars","legends","annotations"],pixelRatio:"undefined"!=typeof window&&null!=(N=window.devicePixelRatio)?N:1}),ie=function(e,a,i,t,n,r){return G(t,{all:e.map(a),min:0,max:0},n,r).padding(i)},te=function(e,a){return e.map((function(e){return z({},a.reduce((function(e,a){return e[a]=null,e}),{}),e)}))},ne=function(e){return Object.keys(e).reduce((function(a,i){return e[i]&&(a[i]=e[i]),a}),{})},re=function(e){return[e,Number(e)]},le=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],oe=function(e,a){return e>a},de=function(e,a){return e<a},ue=function(e,a){return Array.from(" ".repeat(a-e),(function(a,i){return e+i}))},ce=function(e){return oe(e,0)?0:e},se=function(e,a,i,t){var n=e.data,r=e.formatValue,l=e.getColor,o=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,c=void 0===u?0:u,s=e.keys,h=e.xScale,b=e.yScale,g=e.margin,v=i?de:oe,f=n.map(ne),m=[];return s.forEach((function(e,i){return ue(0,h.domain().length).forEach((function(u){var s,p,x,y=re(n[u][e]),S=y[0],k=y[1],w=o(n[u]),L=(null!=(s=h(w))?s:0)+a*i+c*i,C=v(p=k,0)?null!=(x=b(p))?x:0:t,V=function(e,a){var i;return v(e,0)?t-a:(null!=(i=b(e))?i:0)-t}(k,C),W={id:e,value:null===S?S:k,formattedValue:r(k),hidden:!1,index:u,indexValue:w,data:f[u]};m.push({key:e+"."+W.indexValue,index:m.length,data:W,x:L,y:C,absX:g.left+L,absY:g.top+C,width:a,height:V,color:l(W),label:d(W)})}))})),m},he=function(e,a,i,t){var n=e.data,r=e.formatValue,l=e.getIndex,o=e.getColor,d=e.getTooltipLabel,u=e.keys,c=e.innerPadding,s=void 0===c?0:c,h=e.xScale,b=e.yScale,g=e.margin,v=i?de:oe,f=n.map(ne),m=[];return u.forEach((function(e,i){return ue(0,b.domain().length).forEach((function(u){var c,p,x,y=re(n[u][e]),S=y[0],k=y[1],w=l(n[u]),L=v(p=k,0)?t:null!=(x=h(p))?x:0,C=(null!=(c=b(w))?c:0)+a*i+s*i,V=function(e,a){var i;return v(e,0)?(null!=(i=h(e))?i:0)-t:t-a}(k,L),W={id:e,value:null===S?S:k,formattedValue:r(k),hidden:!1,index:u,indexValue:w,data:f[u]};m.push({key:e+"."+W.indexValue,index:m.length,data:W,x:L,y:C,absX:g.left+L,absY:g.top+C,width:V,height:a,color:o(W),label:d(W)})}))})),m},be=function(e){var a,i,t=e.layout,n=e.minValue,r=e.maxValue,l=e.reverse,o=e.width,d=e.height,u=e.padding,c=void 0===u?0:u,s=e.innerPadding,h=void 0===s?0:s,b=e.valueScale,g=e.indexScale,v=e.hiddenIds,f=void 0===v?[]:v,m=K(e,le),p=m.keys.filter((function(e){return!f.includes(e)})),x=te(m.data,p),y="vertical"===t?["y","x",o]:["x","y",d],S=y[0],k=y[1],w=y[2],L=ie(x,m.getIndex,c,g,w,k),C=z({max:r,min:n,reverse:l},b),V="auto"===C.min?ce:function(e){return e},W=x.reduce((function(e,a){return[].concat(e,p.map((function(e){return a[e]})))}),[]).filter(Boolean),B=V(Math.min.apply(Math,W)),M=(i=Math.max.apply(Math,W),isFinite(i)?i:0),I=G(C,{all:W,min:B,max:M},"x"===S?o:d,S),T="vertical"===t?[L,I]:[I,L],R=T[0],P=T[1],H=(L.bandwidth()-h*(p.length-1))/p.length,E=[z({},m,{data:x,keys:p,innerPadding:h,xScale:R,yScale:P}),H,C.reverse,null!=(a=I(0))?a:0];return{xScale:R,yScale:P,bars:H>0?"vertical"===t?se.apply(void 0,E):he.apply(void 0,E):[]}},ge=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],ve=function e(a){var i;return a.some(Array.isArray)?e((i=[]).concat.apply(i,a)):a},fe=function(e,a,i){var t=e.formatValue,n=e.getColor,r=e.getIndex,l=e.getTooltipLabel,o=e.innerPadding,d=e.stackedData,u=e.xScale,c=e.yScale,s=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,b){var g,v,f=e[b],m=null!=(g=u(r(f.data)))?g:0,p=(null!=(v=function(e){return c(e[i?0:1])}(f))?v:0)+.5*o,x=function(e,a){var t;return(null!=(t=c(e[i?1:0]))?t:0)-a}(f,p)-o,y=re(f.data[e.key]),S=y[0],k=y[1],w={id:e.key,value:null===S?S:k,formattedValue:t(k),hidden:!1,index:b,indexValue:d,data:ne(f.data)};h.push({key:e.key+"."+d,index:h.length,data:w,x:m,y:p,absX:s.left+m,absY:s.top+p,width:a,height:x,color:n(w),label:l(w)})}))})),h},me=function(e,a,i){var t=e.formatValue,n=e.getColor,r=e.getIndex,l=e.getTooltipLabel,o=e.innerPadding,d=e.stackedData,u=e.xScale,c=e.yScale,s=e.margin,h=[];return d.forEach((function(e){return c.domain().forEach((function(d,b){var g,v,f=e[b],m=null!=(g=c(r(f.data)))?g:0,p=(null!=(v=function(e){return u(e[i?1:0])}(f))?v:0)+.5*o,x=function(e,a){var t;return(null!=(t=u(e[i?0:1]))?t:0)-a}(f,p)-o,y=re(f.data[e.key]),S=y[0],k=y[1],w={id:e.key,value:null===S?S:k,formattedValue:t(k),hidden:!1,index:b,indexValue:d,data:ne(f.data)};h.push({key:e.key+"."+d,index:h.length,data:w,x:p,y:m,absX:s.left+p,absY:s.top+m,width:x,height:a,color:n(w),label:l(w)})}))})),h},pe=function(e){var a,i=e.data,t=e.layout,n=e.minValue,r=e.maxValue,l=e.reverse,o=e.width,d=e.height,u=e.padding,c=void 0===u?0:u,s=e.valueScale,h=e.indexScale,b=e.hiddenIds,g=void 0===b?[]:b,v=K(e,ge),f=v.keys.filter((function(e){return!g.includes(e)})),m=A().keys(f).offset(j)(te(i,f)),p="vertical"===t?["y","x",o]:["x","y",d],x=p[0],y=p[1],S=p[2],k=ie(i,v.getIndex,c,h,S,y),w=z({max:r,min:n,reverse:l},s),L=(a=ve(m),"log"===s.type?a.filter((function(e){return 0!==e})):a),C=Math.min.apply(Math,L),V=Math.max.apply(Math,L),W=G(w,{all:L,min:C,max:V},"x"===x?o:d,x),B="vertical"===t?[k,W]:[W,k],M=B[0],I=B[1],T=v.innerPadding>0?v.innerPadding:0,R=k.bandwidth(),P=[z({},v,{innerPadding:T,stackedData:m,xScale:M,yScale:I}),R,w.reverse];return{xScale:M,yScale:I,bars:R>0?"vertical"===t?fe.apply(void 0,P):me.apply(void 0,P):[]}},xe=function(e){var a=e.bars,i=e.direction,t=e.from,n=e.groupMode,r=e.layout,l=e.legendLabel,o=e.reverse,d=g(null!=l?l:"indexes"===t?"indexValue":"id");return"indexes"===t?function(e,a,i){var t=q(e.map((function(e){var a,t;return{id:null!=(a=e.data.indexValue)?a:"",label:i(e.data),hidden:e.data.hidden,color:null!=(t=e.color)?t:"#000"}})),(function(e){return e.id}));return"horizontal"===a&&t.reverse(),t}(a,r,d):function(e,a,i,t,n,r){var l=q(e.map((function(e){var a;return{id:e.data.id,label:r(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return("vertical"===a&&"stacked"===t&&"column"===i&&!0!==n||"horizontal"===a&&"stacked"===t&&!0===n)&&l.reverse(),l}(a,r,i,n,o,d)},ye=function(e){var a=e.indexBy,i=void 0===a?_.indexBy:a,t=e.keys,n=void 0===t?_.keys:t,r=e.label,l=void 0===r?_.label:r,o=e.tooltipLabel,d=void 0===o?_.tooltipLabel:o,u=e.valueFormat,c=e.colors,s=void 0===c?_.colors:c,h=e.colorBy,g=void 0===h?_.colorBy:h,m=e.borderColor,p=void 0===m?_.borderColor:m,x=e.labelTextColor,y=void 0===x?_.labelTextColor:x,S=e.groupMode,k=void 0===S?_.groupMode:S,w=e.layout,L=void 0===w?_.layout:w,C=e.reverse,W=void 0===C?_.reverse:C,I=e.data,T=e.minValue,R=void 0===T?_.minValue:T,P=e.maxValue,H=void 0===P?_.maxValue:P,E=e.margin,F=e.width,X=e.height,Y=e.padding,G=void 0===Y?_.padding:Y,A=e.innerPadding,j=void 0===A?_.innerPadding:A,q=e.valueScale,K=void 0===q?_.valueScale:q,N=e.indexScale,J=void 0===N?_.indexScale:N,Q=e.initialHiddenIds,U=void 0===Q?_.initialHiddenIds:Q,Z=e.enableLabel,$=void 0===Z?_.enableLabel:Z,ee=e.labelSkipWidth,ae=void 0===ee?_.labelSkipWidth:ee,ie=e.labelSkipHeight,te=void 0===ie?_.labelSkipHeight:ie,ne=e.legends,re=void 0===ne?_.legends:ne,le=e.legendLabel,oe=M(null!=U?U:[]),de=oe[0],ue=oe[1],ce=B((function(e){ue((function(a){return a.indexOf(e)>-1?a.filter((function(a){return a!==e})):[].concat(a,[e])}))}),[]),se=v(i),he=v(l),ge=v(d),ve=f(u),fe=b(),me=D(s,g),ye=O(p,fe),Se=O(y,fe),ke=("grouped"===k?be:pe)({layout:L,reverse:W,data:I,getIndex:se,keys:n,minValue:R,maxValue:H,width:F,height:X,getColor:me,padding:G,innerPadding:j,valueScale:K,indexScale:J,hiddenIds:de,formatValue:ve,getTooltipLabel:ge,margin:E}),we=ke.bars,Le=ke.xScale,Ce=ke.yScale,Ve=V((function(){return we.filter((function(e){return null!==e.data.value})).map((function(e,a){return z({},e,{index:a})}))}),[we]),We=B((function(e){var a=e.width,i=e.height;return!!$&&(!(ae>0&&a<ae)&&!(te>0&&i<te))}),[$,ae,te]),Be=V((function(){return n.map((function(e){var a=we.find((function(a){return a.data.id===e}));return z({},a,{data:z({id:e},null==a?void 0:a.data,{hidden:de.includes(e)})})}))}),[de,n,we]),Me=V((function(){return re.map((function(e){return[e,xe({bars:"keys"===e.dataFrom?Be:we,direction:e.direction,from:e.dataFrom,groupMode:k,layout:L,legendLabel:le,reverse:W})]}))}),[re,Be,we,k,L,le,W]);return{bars:we,barsWithValue:Ve,xScale:Le,yScale:Ce,getIndex:se,getLabel:he,getTooltipLabel:ge,formatValue:ve,getColor:me,getBorderColor:ye,getLabelColor:Se,shouldRenderBarLabel:We,hiddenIds:de,toggleSerie:ce,legendsWithData:Me}},Se=["isInteractive","animate","motionConfig","theme","renderWrapper"],ke=function(i){var t=i.data,n=i.indexBy,r=i.keys,l=i.margin,o=i.width,u=i.height,c=i.groupMode,s=i.layout,h=i.reverse,b=i.minValue,g=i.maxValue,v=i.valueScale,f=i.indexScale,m=i.padding,w=i.innerPadding,L=i.axisTop,C=i.axisRight,B=i.axisBottom,M=void 0===B?ee.axisBottom:B,T=i.axisLeft,R=void 0===T?ee.axisLeft:T,P=i.enableGridX,H=void 0===P?ee.enableGridX:P,E=i.enableGridY,X=void 0===E?ee.enableGridY:E,Y=i.gridXValues,D=i.gridYValues,O=i.layers,G=void 0===O?ee.layers:O,A=i.barComponent,j=void 0===A?ee.barComponent:A,q=i.enableLabel,K=i.label,N=i.labelSkipWidth,U=i.labelSkipHeight,Z=i.labelTextColor,$=i.markers,_=void 0===$?ee.markers:$,ae=i.colorBy,ie=i.colors,te=i.defs,ne=void 0===te?ee.defs:te,re=i.fill,le=void 0===re?ee.fill:re,oe=i.borderRadius,de=void 0===oe?ee.borderRadius:oe,ue=i.borderWidth,ce=void 0===ue?ee.borderWidth:ue,se=i.borderColor,he=i.annotations,be=void 0===he?ee.annotations:he,ge=i.legendLabel,ve=i.tooltipLabel,fe=i.valueFormat,me=i.isInteractive,pe=void 0===me?ee.isInteractive:me,xe=i.tooltip,Se=void 0===xe?ee.tooltip:xe,ke=i.onClick,we=i.onMouseEnter,Le=i.onMouseLeave,Ce=i.legends,Ve=i.role,We=void 0===Ve?ee.role:Ve,Be=i.ariaLabel,Me=i.ariaLabelledBy,Ie=i.ariaDescribedBy,Te=i.isFocusable,Re=void 0===Te?ee.isFocusable:Te,Pe=i.barAriaLabel,He=i.barAriaLabelledBy,Ee=i.barAriaDescribedBy,Fe=i.initialHiddenIds,Xe=p(),Ye=Xe.animate,De=Xe.config,Oe=x(o,u,l),Ge=Oe.outerWidth,Ae=Oe.outerHeight,je=Oe.margin,qe=Oe.innerWidth,ze=Oe.innerHeight,Ke=ye({indexBy:n,label:K,tooltipLabel:ve,valueFormat:fe,colors:ie,colorBy:ae,borderColor:se,labelTextColor:Z,groupMode:c,layout:s,reverse:h,data:t,keys:r,minValue:b,maxValue:g,margin:je,width:qe,height:ze,padding:m,innerPadding:w,valueScale:v,indexScale:f,enableLabel:q,labelSkipWidth:N,labelSkipHeight:U,legends:Ce,legendLabel:ge,initialHiddenIds:Fe}),Ne=Ke.bars,Je=Ke.barsWithValue,Qe=Ke.xScale,Ue=Ke.yScale,Ze=Ke.getLabel,$e=Ke.getTooltipLabel,_e=Ke.getBorderColor,ea=Ke.getLabelColor,aa=Ke.shouldRenderBarLabel,ia=Ke.toggleSerie,ta=Ke.legendsWithData,na=F(Je,{keys:function(e){return e.key},from:function(e){return z({borderColor:_e(e),color:e.color,height:0,labelColor:ea(e),labelOpacity:0,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===s?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return{borderColor:_e(e),color:e.color,height:e.height,labelColor:ea(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},update:function(e){return{borderColor:_e(e),color:e.color,height:e.height,labelColor:ea(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},leave:function(e){return z({borderColor:_e(e),color:e.color,height:0,labelColor:ea(e),labelOpacity:0,labelX:e.width/2,labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===s?{}:{labelX:0,labelY:e.height/2,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},config:De,immediate:!Ye,initial:Ye?void 0:null}),ra=V((function(){return{borderRadius:de,borderWidth:ce,enableLabel:q,isInteractive:pe,labelSkipWidth:N,labelSkipHeight:U,onClick:ke,onMouseEnter:we,onMouseLeave:Le,getTooltipLabel:$e,tooltip:Se,isFocusable:Re,ariaLabel:Pe,ariaLabelledBy:He,ariaDescribedBy:Ee}}),[de,ce,q,$e,pe,U,N,ke,we,Le,Se,Re,Pe,He,Ee]),la=y(ne,Ne,le,{dataKey:"data",targetKey:"data.fill"}),oa={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null};G.includes("annotations")&&(oa.annotations=d(J,{bars:Ne,annotations:be},"annotations")),G.includes("axes")&&(oa.axes=d(e,{xScale:Qe,yScale:Ue,width:qe,height:ze,top:L,right:C,bottom:M,left:R},"axes")),G.includes("bars")&&(oa.bars=d(I,{children:na((function(e,a){return W(j,z({},ra,{bar:a,style:e,shouldRenderLabel:aa(a),label:Ze(a.data)}))}))},"bars")),G.includes("grid")&&(oa.grid=d(a,{width:qe,height:ze,xScale:H?Qe:null,yScale:X?Ue:null,xValues:Y,yValues:D},"grid")),G.includes("legends")&&(oa.legends=d(Q,{width:qe,height:ze,legends:ta,toggleSerie:ia},"legends")),G.includes("markers")&&(oa.markers=d(S,{markers:_,width:qe,height:ze,xScale:Qe,yScale:Ue},"markers"));var da=V((function(){return z({},ra,{margin:je,innerWidth:qe,innerHeight:ze,width:o,height:u,bars:Ne,xScale:Qe,yScale:Ue})}),[ra,je,qe,ze,o,u,Ne,Qe,Ue]);return d(k,{width:Ge,height:Ae,margin:je,defs:la,role:We,ariaLabel:Be,ariaLabelledBy:Me,ariaDescribedBy:Ie,isFocusable:Re,children:G.map((function(e,a){var i;return"function"==typeof e?d(I,{children:W(e,da)},a):null!=(i=null==oa?void 0:oa[e])?i:null}))})},we=function(e){var a=e.isInteractive,i=void 0===a?ee.isInteractive:a,t=e.animate,n=void 0===t?ee.animate:t,r=e.motionConfig,l=void 0===r?ee.motionConfig:r,o=e.theme,u=e.renderWrapper,c=K(e,Se);return d(m,{animate:n,isInteractive:i,motionConfig:l,renderWrapper:u,theme:o,children:d(ke,z({isInteractive:i},c))})},Le=["isInteractive","renderWrapper","theme"],Ce=function(e,a,i,t){return e.find((function(e){return L(e.x+a.left,e.y+a.top,e.width,e.height,i,t)}))},Ve=function(e){var a=e.data,r=e.indexBy,u=e.keys,c=e.margin,s=e.width,g=e.height,v=e.groupMode,f=e.layout,m=e.reverse,p=e.minValue,y=e.maxValue,S=e.valueScale,k=e.indexScale,L=e.padding,C=e.innerPadding,M=e.axisTop,I=e.axisRight,T=e.axisBottom,H=void 0===T?ae.axisBottom:T,E=e.axisLeft,F=void 0===E?ae.axisLeft:E,Y=e.enableGridX,D=void 0===Y?ae.enableGridX:Y,O=e.enableGridY,G=void 0===O?ae.enableGridY:O,A=e.gridXValues,j=e.gridYValues,q=e.layers,K=void 0===q?ae.layers:q,N=e.renderBar,J=void 0===N?function(e,a){var i=a.bar,t=i.color,n=i.height,r=i.width,l=i.x,o=i.y,d=a.borderColor,u=a.borderRadius,c=a.borderWidth,s=a.label,h=a.labelColor,b=a.shouldRenderLabel;if(e.fillStyle=t,c>0&&(e.strokeStyle=d,e.lineWidth=c),e.beginPath(),u>0){var g=Math.min(u,n);e.moveTo(l+g,o),e.lineTo(l+r-g,o),e.quadraticCurveTo(l+r,o,l+r,o+g),e.lineTo(l+r,o+n-g),e.quadraticCurveTo(l+r,o+n,l+r-g,o+n),e.lineTo(l+g,o+n),e.quadraticCurveTo(l,o+n,l,o+n-g),e.lineTo(l,o+g),e.quadraticCurveTo(l,o,l+g,o),e.closePath()}else e.rect(l,o,r,n);e.fill(),c>0&&e.stroke(),b&&(e.textBaseline="middle",e.textAlign="center",e.fillStyle=h,e.fillText(s,l+r/2,o+n/2))}:N,Q=e.enableLabel,U=e.label,Z=e.labelSkipWidth,$=e.labelSkipHeight,_=e.labelTextColor,ee=e.colorBy,ie=e.colors,te=e.borderRadius,ne=void 0===te?ae.borderRadius:te,re=e.borderWidth,le=void 0===re?ae.borderWidth:re,oe=e.borderColor,de=e.annotations,ue=void 0===de?ae.annotations:de,ce=e.legendLabel,se=e.tooltipLabel,he=e.valueFormat,be=e.isInteractive,ge=void 0===be?ae.isInteractive:be,ve=e.tooltip,fe=void 0===ve?ae.tooltip:ve,me=e.onClick,pe=e.onMouseEnter,xe=e.onMouseLeave,Se=e.legends,ke=e.pixelRatio,we=void 0===ke?ae.pixelRatio:ke,Le=e.canvasRef,Ve=R(null),We=b(),Be=x(s,g,c),Me=Be.margin,Ie=Be.innerWidth,Te=Be.innerHeight,Re=Be.outerWidth,Pe=Be.outerHeight,He=ye({indexBy:r,label:U,tooltipLabel:se,valueFormat:he,colors:ie,colorBy:ee,borderColor:oe,labelTextColor:_,groupMode:v,layout:f,reverse:m,data:a,keys:u,minValue:p,maxValue:y,margin:Me,width:Ie,height:Te,padding:L,innerPadding:C,valueScale:S,indexScale:k,enableLabel:Q,labelSkipWidth:Z,labelSkipHeight:$,legends:Se,legendLabel:ce}),Ee=He.bars,Fe=He.barsWithValue,Xe=He.xScale,Ye=He.yScale,De=He.getLabel,Oe=He.getTooltipLabel,Ge=He.getBorderColor,Ae=He.getLabelColor,je=He.shouldRenderBarLabel,qe=He.legendsWithData,ze=X(),Ke=ze.showTooltipFromEvent,Ne=ze.hideTooltip,Je=l({annotations:n({data:Ee,annotations:ue,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var a=e.width,i=e.height;return{width:a,height:i,size:Math.max(a,i)}}})}),Qe=V((function(){return{borderRadius:ne,borderWidth:le,enableLabel:Q,isInteractive:ge,labelSkipWidth:Z,labelSkipHeight:$,onClick:me,onMouseEnter:pe,onMouseLeave:xe,getTooltipLabel:Oe,tooltip:fe,margin:Me,innerWidth:Ie,innerHeight:Te,width:s,height:g,bars:Ee,xScale:Xe,yScale:Ye}}),[ne,le,Q,Oe,g,Te,Ie,ge,$,Z,Me,me,pe,xe,Ee,Xe,Ye,fe,s]);P((function(){var e,a=null==(e=Ve.current)?void 0:e.getContext("2d");Ve.current&&a&&(Ve.current.width=Re*we,Ve.current.height=Pe*we,a.scale(we,we),a.fillStyle=We.background,a.fillRect(0,0,Re,Pe),a.translate(Me.left,Me.top),K.forEach((function(e){"grid"===e?"number"==typeof We.grid.line.strokeWidth&&We.grid.line.strokeWidth>0&&(a.lineWidth=We.grid.line.strokeWidth,a.strokeStyle=We.grid.line.stroke,D&&i(a,{width:s,height:g,scale:Xe,axis:"x",values:A}),G&&i(a,{width:s,height:g,scale:Ye,axis:"y",values:j})):"axes"===e?t(a,{xScale:Xe,yScale:Ye,width:Ie,height:Te,top:M,right:I,bottom:H,left:F,theme:We}):"bars"===e?Fe.forEach((function(e){J(a,{bar:e,borderColor:Ge(e),borderRadius:ne,borderWidth:le,label:De(e.data),labelColor:Ae(e),shouldRenderLabel:je(e)})})):"legends"===e?qe.forEach((function(e){var i=e[0],t=e[1];h(a,z({},i,{data:t,containerWidth:Ie,containerHeight:Te,theme:We}))})):"annotations"===e?o(a,{annotations:Je,theme:We}):"function"==typeof e&&e(a,Qe)})),a.save())}),[H,F,I,M,Fe,ne,le,Je,D,G,Ge,De,Ae,A,j,v,g,Te,Ie,Qe,K,f,qe,Me.left,Me.top,Pe,Re,we,J,Xe,Ye,m,je,We,s]);var Ue=B((function(e){if(Ee&&Ve.current){var a=w(Ve.current,e),i=a[0],t=a[1],n=Ce(Ee,Me,i,t);void 0!==n?(Ke(W(fe,z({},n.data,{color:n.color,label:n.label,value:Number(n.data.value)})),e),"mouseenter"===e.type&&(null==pe||pe(n.data,e))):Ne()}}),[Ne,Me,pe,Ee,Ke,fe]),Ze=B((function(e){if(Ee&&Ve.current){Ne();var a=w(Ve.current,e),i=a[0],t=a[1],n=Ce(Ee,Me,i,t);n&&(null==xe||xe(n.data,e))}}),[Ne,Me,xe,Ee]),$e=B((function(e){if(Ee&&Ve.current){var a=w(Ve.current,e),i=a[0],t=a[1],n=Ce(Ee,Me,i,t);void 0!==n&&(null==me||me(z({},n.data,{color:n.color}),e))}}),[Me,me,Ee]);return d("canvas",{ref:function(e){Ve.current=e,Le&&"current"in Le&&(Le.current=e)},width:Re*we,height:Pe*we,style:{width:Re,height:Pe,cursor:ge?"auto":"normal"},onMouseEnter:ge?Ue:void 0,onMouseMove:ge?Ue:void 0,onMouseLeave:ge?Ze:void 0,onClick:ge?$e:void 0})},We=T((function(e,a){var i=e.isInteractive,t=e.renderWrapper,n=e.theme,r=K(e,Le);return d(m,{isInteractive:i,renderWrapper:t,theme:n,animate:!1,children:d(Ve,z({},r,{canvasRef:a}))})})),Be=function(e){return d(C,{children:function(a){var i=a.width,t=a.height;return d(we,z({width:i,height:t},e))}})},Me=T((function(e,a){return d(C,{children:function(i){var t=i.width,n=i.height;return d(We,z({width:t,height:n},e,{ref:a}))}})}));export{we as Bar,We as BarCanvas,Z as BarItem,Be as ResponsiveBar,Me as ResponsiveBarCanvas,ae as canvasDefaultProps,_ as defaultProps,ee as svgDefaultProps}; | ||
//# sourceMappingURL=nivo-bar.es.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("@nivo/axes"),require("@nivo/annotations"),require("react/jsx-dev-runtime"),require("@nivo/legends"),require("@nivo/core"),require("react"),require("@react-spring/web"),require("@nivo/tooltip"),require("@nivo/colors"),require("@nivo/scales"),require("d3-shape"),require("lodash/uniqBy")):"function"==typeof define&&define.amd?define(["exports","@nivo/axes","@nivo/annotations","react/jsx-dev-runtime","@nivo/legends","@nivo/core","react","@react-spring/web","@nivo/tooltip","@nivo/colors","@nivo/scales","d3-shape","lodash/uniqBy"],a):a((e="undefined"!=typeof globalThis?globalThis:e||self).nivo=e.nivo||{},e.nivo,e.nivo,e["react/jsx-dev-runtime"],e.nivo,e.nivo,e.React,e["@react-spring/web"],e.nivo,e.nivo,e.nivo,e.d3,e["lodash/uniqBy"])}(this,(function(e,a,i,n,r,t,o,l,d,u,s,c,h){"use strict";function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=b(h);function m(){return m=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},m.apply(this,arguments)}function g(e,a){if(null==e)return{};var i,n,r={},t=Object.keys(e);for(n=0;n<t.length;n++)i=t[n],a.indexOf(i)>=0||(r[i]=e[i]);return r}var f,p=function(e){var a=e.bars,r=e.annotations,t=i.useAnnotations({data:a,annotations:r,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var a=e.height,i=e.width;return{width:i,height:a,size:Math.max(i,a)}}});return n.jsxDEV(n.Fragment,{children:t.map((function(e,a){return n.jsxDEV(i.Annotation,m({},e),a,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarAnnotations.tsx",lineNumber:22,columnNumber:17},undefined)}))},void 0,!1)},x=function(e){var a=e.width,i=e.height,t=e.legends,o=e.toggleSerie;return n.jsxDEV(n.Fragment,{children:t.map((function(e,t){var l,d=e[0],u=e[1];return n.jsxDEV(r.BoxLegendSvg,m({},d,{containerWidth:a,containerHeight:i,data:null!=(l=d.data)?l:u,toggleSerie:d.toggleSerie&&"keys"===d.dataFrom?o:void 0}),t,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarLegends.tsx",lineNumber:14,columnNumber:13},undefined)}))},void 0,!1)},y=["data"],k="/home/oleksandr/code/atlas/nivo/packages/bar/src/BarItem.tsx",S=void 0,C=function(e){var a,i=e.bar,r=i.data,u=g(i,y),s=e.style,c=s.borderColor,h=s.color,b=s.height,v=s.labelColor,f=s.labelOpacity,p=s.labelX,x=s.labelY,C=s.transform,V=s.width,L=e.borderRadius,w=e.borderWidth,N=e.label,B=e.shouldRenderLabel,E=e.isInteractive,M=e.onClick,T=e.onMouseEnter,W=e.onMouseLeave,D=e.tooltip,I=e.isFocusable,R=e.ariaLabel,j=e.ariaLabelledBy,P=e.ariaDescribedBy,F=t.useTheme(),H=d.useTooltip(),A=H.showTooltipFromEvent,q=H.showTooltipAt,X=H.hideTooltip,Y=o.useMemo((function(){return function(){return o.createElement(D,m({},u,r))}}),[D,u,r]),O=o.useCallback((function(e){null==M||M(m({color:u.color},r),e)}),[u,r,M]),G=o.useCallback((function(e){return A(Y(),e)}),[A,Y]),z=o.useCallback((function(e){null==T||T(r,e),A(Y(),e)}),[r,T,A,Y]),K=o.useCallback((function(e){null==W||W(r,e),X()}),[r,X,W]),_=o.useCallback((function(){q(Y(),[u.absX+u.width/2,u.absY])}),[q,Y,u]),J=o.useCallback((function(){X()}),[X]);return n.jsxDEV(l.animated.g,{transform:C,children:[n.jsxDEV(l.animated.rect,{width:l.to(V,(function(e){return Math.max(e,0)})),height:l.to(b,(function(e){return Math.max(e,0)})),rx:L,ry:L,fill:null!=(a=r.fill)?a:h,strokeWidth:w,stroke:c,focusable:I,tabIndex:I?0:void 0,"aria-label":R?R(r):void 0,"aria-labelledby":j?j(r):void 0,"aria-describedby":P?P(r):void 0,onMouseEnter:E?z:void 0,onMouseMove:E?G:void 0,onMouseLeave:E?K:void 0,onClick:E?O:void 0,onFocus:E&&I?_:void 0,onBlur:E&&I?J:void 0},void 0,!1,{fileName:k,lineNumber:83,columnNumber:13},S),B&&n.jsxDEV(l.animated.text,{x:p,y:x,textAnchor:"middle",dominantBaseline:"central",fillOpacity:f,style:m({},F.labels.text,{pointerEvents:"none",fill:v}),children:N},void 0,!1,{fileName:k,lineNumber:104,columnNumber:17},S)]},void 0,!0,{fileName:k,lineNumber:82,columnNumber:9},S)},V=["color","label"],L={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(e){var a=e.color,i=e.label,r=g(e,V);return n.jsxDEV(d.BasicTooltip,{id:i,value:r.formattedValue,enableChip:!0,color:a},void 0,!1,{fileName:"/home/oleksandr/code/atlas/nivo/packages/bar/src/BarTooltip.tsx",lineNumber:5,columnNumber:12},undefined)},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[]},w=m({},L,{layers:["grid","axes","bars","markers","legends","annotations"],barComponent:C,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),N=m({},L,{layers:["grid","axes","bars","legends","annotations"],pixelRatio:"undefined"!=typeof window&&null!=(f=window.devicePixelRatio)?f:1}),B=function(e,a,i,n,r,t){return s.computeScale(n,{all:e.map(a),min:0,max:0},r,t).padding(i)},E=function(e,a){return e.map((function(e){return m({},a.reduce((function(e,a){return e[a]=null,e}),{}),e)}))},M=function(e){return Object.keys(e).reduce((function(a,i){return e[i]&&(a[i]=e[i]),a}),{})},T=function(e){return[e,Number(e)]},W=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],D=function(e,a){return e>a},I=function(e,a){return e<a},R=function(e,a){return Array.from(" ".repeat(a-e),(function(a,i){return e+i}))},j=function(e){return D(e,0)?0:e},P=function(e,a,i,n){var r=e.data,t=e.formatValue,o=e.getColor,l=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,s=void 0===u?0:u,c=e.keys,h=e.xScale,b=e.yScale,v=e.margin,m=i?I:D,g=r.map(M),f=[];return c.forEach((function(e,i){return R(0,h.domain().length).forEach((function(u){var c,p,x,y=T(r[u][e]),k=y[0],S=y[1],C=l(r[u]),V=(null!=(c=h(C))?c:0)+a*i+s*i,L=m(p=S,0)?null!=(x=b(p))?x:0:n,w=function(e,a){var i;return m(e,0)?n-a:(null!=(i=b(e))?i:0)-n}(S,L),N={id:e,value:null===k?k:S,formattedValue:t(S),hidden:!1,index:u,indexValue:C,data:g[u]};f.push({key:e+"."+N.indexValue,index:f.length,data:N,x:V,y:L,absX:v.left+V,absY:v.top+L,width:a,height:w,color:o(N),label:d(N)})}))})),f},F=function(e,a,i,n){var r=e.data,t=e.formatValue,o=e.getIndex,l=e.getColor,d=e.getTooltipLabel,u=e.keys,s=e.innerPadding,c=void 0===s?0:s,h=e.xScale,b=e.yScale,v=e.margin,m=i?I:D,g=r.map(M),f=[];return u.forEach((function(e,i){return R(0,b.domain().length).forEach((function(u){var s,p,x,y=T(r[u][e]),k=y[0],S=y[1],C=o(r[u]),V=m(p=S,0)?n:null!=(x=h(p))?x:0,L=(null!=(s=b(C))?s:0)+a*i+c*i,w=function(e,a){var i;return m(e,0)?(null!=(i=h(e))?i:0)-n:n-a}(S,V),N={id:e,value:null===k?k:S,formattedValue:t(S),hidden:!1,index:u,indexValue:C,data:g[u]};f.push({key:e+"."+N.indexValue,index:f.length,data:N,x:V,y:L,absX:v.left+V,absY:v.top+L,width:w,height:a,color:l(N),label:d(N)})}))})),f},H=function(e){var a,i,n=e.layout,r=e.minValue,t=e.maxValue,o=e.reverse,l=e.width,d=e.height,u=e.padding,c=void 0===u?0:u,h=e.innerPadding,b=void 0===h?0:h,v=e.valueScale,f=e.indexScale,p=e.hiddenIds,x=void 0===p?[]:p,y=g(e,W),k=y.keys.filter((function(e){return!x.includes(e)})),S=E(y.data,k),C="vertical"===n?["y","x",l]:["x","y",d],V=C[0],L=C[1],w=C[2],N=B(S,y.getIndex,c,f,w,L),M=m({max:t,min:r,reverse:o},v),T="auto"===M.min?j:function(e){return e},D=S.reduce((function(e,a){return[].concat(e,k.map((function(e){return a[e]})))}),[]).filter(Boolean),I=T(Math.min.apply(Math,D)),R=(i=Math.max.apply(Math,D),isFinite(i)?i:0),H=s.computeScale(M,{all:D,min:I,max:R},"x"===V?l:d,V),A="vertical"===n?[N,H]:[H,N],q=A[0],X=A[1],Y=(N.bandwidth()-b*(k.length-1))/k.length,O=[m({},y,{data:S,keys:k,innerPadding:b,xScale:q,yScale:X}),Y,M.reverse,null!=(a=H(0))?a:0];return{xScale:q,yScale:X,bars:Y>0?"vertical"===n?P.apply(void 0,O):F.apply(void 0,O):[]}},A=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],q=function e(a){var i;return a.some(Array.isArray)?e((i=[]).concat.apply(i,a)):a},X=function(e,a,i){var n=e.formatValue,r=e.getColor,t=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,b){var v,m,g=e[b],f=null!=(v=u(t(g.data)))?v:0,p=(null!=(m=function(e){return s(e[i?0:1])}(g))?m:0)+.5*l,x=function(e,a){var n;return(null!=(n=s(e[i?1:0]))?n:0)-a}(g,p)-l,y=T(g.data[e.key]),k=y[0],S=y[1],C={id:e.key,value:null===k?k:S,formattedValue:n(S),hidden:!1,index:b,indexValue:d,data:M(g.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:f,y:p,absX:c.left+f,absY:c.top+p,width:a,height:x,color:r(C),label:o(C)})}))})),h},Y=function(e,a,i){var n=e.formatValue,r=e.getColor,t=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return s.domain().forEach((function(d,b){var v,m,g=e[b],f=null!=(v=s(t(g.data)))?v:0,p=(null!=(m=function(e){return u(e[i?1:0])}(g))?m:0)+.5*l,x=function(e,a){var n;return(null!=(n=u(e[i?0:1]))?n:0)-a}(g,p)-l,y=T(g.data[e.key]),k=y[0],S=y[1],C={id:e.key,value:null===k?k:S,formattedValue:n(S),hidden:!1,index:b,indexValue:d,data:M(g.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:p,y:f,absX:c.left+p,absY:c.top+f,width:x,height:a,color:r(C),label:o(C)})}))})),h},O=function(e){var a,i=e.data,n=e.layout,r=e.minValue,t=e.maxValue,o=e.reverse,l=e.width,d=e.height,u=e.padding,h=void 0===u?0:u,b=e.valueScale,v=e.indexScale,f=e.hiddenIds,p=void 0===f?[]:f,x=g(e,A),y=x.keys.filter((function(e){return!p.includes(e)})),k=c.stack().keys(y).offset(c.stackOffsetDiverging)(E(i,y)),S="vertical"===n?["y","x",l]:["x","y",d],C=S[0],V=S[1],L=S[2],w=B(i,x.getIndex,h,v,L,V),N=m({max:t,min:r,reverse:o},b),M=(a=q(k),"log"===b.type?a.filter((function(e){return 0!==e})):a),T=Math.min.apply(Math,M),W=Math.max.apply(Math,M),D=s.computeScale(N,{all:M,min:T,max:W},"x"===C?l:d,C),I="vertical"===n?[w,D]:[D,w],R=I[0],j=I[1],P=x.innerPadding>0?x.innerPadding:0,F=w.bandwidth(),H=[m({},x,{innerPadding:P,stackedData:k,xScale:R,yScale:j}),F,N.reverse];return{xScale:R,yScale:j,bars:F>0?"vertical"===n?X.apply(void 0,H):Y.apply(void 0,H):[]}},G=function(e){var a=e.bars,i=e.direction,n=e.from,r=e.groupMode,o=e.layout,l=e.legendLabel,d=e.reverse,u=t.getPropertyAccessor(null!=l?l:"indexes"===n?"indexValue":"id");return"indexes"===n?function(e,a,i){var n=v.default(e.map((function(e){var a,n;return{id:null!=(a=e.data.indexValue)?a:"",label:i(e.data),hidden:e.data.hidden,color:null!=(n=e.color)?n:"#000"}})),(function(e){return e.id}));return"horizontal"===a&&n.reverse(),n}(a,o,u):function(e,a,i,n,r,t){var o=v.default(e.map((function(e){var a;return{id:e.data.id,label:t(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return("vertical"===a&&"stacked"===n&&"column"===i&&!0!==r||"horizontal"===a&&"stacked"===n&&!0===r)&&o.reverse(),o}(a,o,i,r,d,u)},z=function(e){var a=e.indexBy,i=void 0===a?L.indexBy:a,n=e.keys,r=void 0===n?L.keys:n,l=e.label,d=void 0===l?L.label:l,s=e.tooltipLabel,c=void 0===s?L.tooltipLabel:s,h=e.valueFormat,b=e.colors,v=void 0===b?L.colors:b,g=e.colorBy,f=void 0===g?L.colorBy:g,p=e.borderColor,x=void 0===p?L.borderColor:p,y=e.labelTextColor,k=void 0===y?L.labelTextColor:y,S=e.groupMode,C=void 0===S?L.groupMode:S,V=e.layout,w=void 0===V?L.layout:V,N=e.reverse,B=void 0===N?L.reverse:N,E=e.data,M=e.minValue,T=void 0===M?L.minValue:M,W=e.maxValue,D=void 0===W?L.maxValue:W,I=e.margin,R=e.width,j=e.height,P=e.padding,F=void 0===P?L.padding:P,A=e.innerPadding,q=void 0===A?L.innerPadding:A,X=e.valueScale,Y=void 0===X?L.valueScale:X,z=e.indexScale,K=void 0===z?L.indexScale:z,_=e.initialHiddenIds,J=void 0===_?L.initialHiddenIds:_,Q=e.enableLabel,U=void 0===Q?L.enableLabel:Q,Z=e.labelSkipWidth,$=void 0===Z?L.labelSkipWidth:Z,ee=e.labelSkipHeight,ae=void 0===ee?L.labelSkipHeight:ee,ie=e.legends,ne=void 0===ie?L.legends:ie,re=e.legendLabel,te=o.useState(null!=J?J:[]),oe=te[0],le=te[1],de=o.useCallback((function(e){le((function(a){return a.indexOf(e)>-1?a.filter((function(a){return a!==e})):[].concat(a,[e])}))}),[]),ue=t.usePropertyAccessor(i),se=t.usePropertyAccessor(d),ce=t.usePropertyAccessor(c),he=t.useValueFormatter(h),be=t.useTheme(),ve=u.useOrdinalColorScale(v,f),me=u.useInheritedColor(x,be),ge=u.useInheritedColor(k,be),fe=("grouped"===C?H:O)({layout:w,reverse:B,data:E,getIndex:ue,keys:r,minValue:T,maxValue:D,width:R,height:j,getColor:ve,padding:F,innerPadding:q,valueScale:Y,indexScale:K,hiddenIds:oe,formatValue:he,getTooltipLabel:ce,margin:I}),pe=fe.bars,xe=fe.xScale,ye=fe.yScale,ke=o.useMemo((function(){return pe.filter((function(e){return null!==e.data.value})).map((function(e,a){return m({},e,{index:a})}))}),[pe]),Se=o.useCallback((function(e){var a=e.width,i=e.height;return!!U&&(!($>0&&a<$)&&!(ae>0&&i<ae))}),[U,$,ae]),Ce=o.useMemo((function(){return r.map((function(e){var a=pe.find((function(a){return a.data.id===e}));return m({},a,{data:m({id:e},null==a?void 0:a.data,{hidden:oe.includes(e)})})}))}),[oe,r,pe]),Ve=o.useMemo((function(){return ne.map((function(e){return[e,G({bars:"keys"===e.dataFrom?Ce:pe,direction:e.direction,from:e.dataFrom,groupMode:C,layout:w,legendLabel:re,reverse:B})]}))}),[ne,Ce,pe,C,w,re,B]);return{bars:pe,barsWithValue:ke,xScale:xe,yScale:ye,getIndex:ue,getLabel:se,getTooltipLabel:ce,formatValue:he,getColor:ve,getBorderColor:me,getLabelColor:ge,shouldRenderBarLabel:Se,hiddenIds:oe,toggleSerie:de,legendsWithData:Ve}},K=["isInteractive","animate","motionConfig","theme","renderWrapper"],_="/home/oleksandr/code/atlas/nivo/packages/bar/src/Bar.tsx",J=void 0,Q=function(e){var i=e.data,r=e.indexBy,d=e.keys,u=e.margin,s=e.width,c=e.height,h=e.groupMode,b=e.layout,v=e.reverse,g=e.minValue,f=e.maxValue,y=e.valueScale,k=e.indexScale,S=e.padding,C=e.innerPadding,V=e.axisTop,L=e.axisRight,N=e.axisBottom,B=void 0===N?w.axisBottom:N,E=e.axisLeft,M=void 0===E?w.axisLeft:E,T=e.enableGridX,W=void 0===T?w.enableGridX:T,D=e.enableGridY,I=void 0===D?w.enableGridY:D,R=e.gridXValues,j=e.gridYValues,P=e.layers,F=void 0===P?w.layers:P,H=e.barComponent,A=void 0===H?w.barComponent:H,q=e.enableLabel,X=e.label,Y=e.labelSkipWidth,O=e.labelSkipHeight,G=e.labelTextColor,K=e.markers,Q=void 0===K?w.markers:K,U=e.colorBy,Z=e.colors,$=e.defs,ee=void 0===$?w.defs:$,ae=e.fill,ie=void 0===ae?w.fill:ae,ne=e.borderRadius,re=void 0===ne?w.borderRadius:ne,te=e.borderWidth,oe=void 0===te?w.borderWidth:te,le=e.borderColor,de=e.annotations,ue=void 0===de?w.annotations:de,se=e.legendLabel,ce=e.tooltipLabel,he=e.valueFormat,be=e.isInteractive,ve=void 0===be?w.isInteractive:be,me=e.tooltip,ge=void 0===me?w.tooltip:me,fe=e.onClick,pe=e.onMouseEnter,xe=e.onMouseLeave,ye=e.legends,ke=e.role,Se=void 0===ke?w.role:ke,Ce=e.ariaLabel,Ve=e.ariaLabelledBy,Le=e.ariaDescribedBy,we=e.isFocusable,Ne=void 0===we?w.isFocusable:we,Be=e.barAriaLabel,Ee=e.barAriaLabelledBy,Me=e.barAriaDescribedBy,Te=e.initialHiddenIds,We=t.useMotionConfig(),De=We.animate,Ie=We.config,Re=t.useDimensions(s,c,u),je=Re.outerWidth,Pe=Re.outerHeight,Fe=Re.margin,He=Re.innerWidth,Ae=Re.innerHeight,qe=z({indexBy:r,label:X,tooltipLabel:ce,valueFormat:he,colors:Z,colorBy:U,borderColor:le,labelTextColor:G,groupMode:h,layout:b,reverse:v,data:i,keys:d,minValue:g,maxValue:f,margin:Fe,width:He,height:Ae,padding:S,innerPadding:C,valueScale:y,indexScale:k,enableLabel:q,labelSkipWidth:Y,labelSkipHeight:O,legends:ye,legendLabel:se,initialHiddenIds:Te}),Xe=qe.bars,Ye=qe.barsWithValue,Oe=qe.xScale,Ge=qe.yScale,ze=qe.getLabel,Ke=qe.getTooltipLabel,_e=qe.getBorderColor,Je=qe.getLabelColor,Qe=qe.shouldRenderBarLabel,Ue=qe.toggleSerie,Ze=qe.legendsWithData,$e=l.useTransition(Ye,{keys:function(e){return e.key},from:function(e){return m({borderColor:_e(e),color:e.color,height:0,labelColor:Je(e),labelOpacity:0,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===b?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return{borderColor:_e(e),color:e.color,height:e.height,labelColor:Je(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},update:function(e){return{borderColor:_e(e),color:e.color,height:e.height,labelColor:Je(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},leave:function(e){return m({borderColor:_e(e),color:e.color,height:0,labelColor:Je(e),labelOpacity:0,labelX:e.width/2,labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===b?{}:{labelX:0,labelY:e.height/2,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},config:Ie,immediate:!De,initial:De?void 0:null}),ea=o.useMemo((function(){return{borderRadius:re,borderWidth:oe,enableLabel:q,isInteractive:ve,labelSkipWidth:Y,labelSkipHeight:O,onClick:fe,onMouseEnter:pe,onMouseLeave:xe,getTooltipLabel:Ke,tooltip:ge,isFocusable:Ne,ariaLabel:Be,ariaLabelledBy:Ee,ariaDescribedBy:Me}}),[re,oe,q,Ke,ve,O,Y,fe,pe,xe,ge,Ne,Be,Ee,Me]),aa=t.bindDefs(ee,Xe,ie,{dataKey:"data",targetKey:"data.fill"}),ia={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null};F.includes("annotations")&&(ia.annotations=n.jsxDEV(p,{bars:Xe,annotations:ue},"annotations",!1,{fileName:_,lineNumber:283,columnNumber:13},J)),F.includes("axes")&&(ia.axes=n.jsxDEV(a.Axes,{xScale:Oe,yScale:Ge,width:He,height:Ae,top:V,right:L,bottom:B,left:M},"axes",!1,{fileName:_,lineNumber:289,columnNumber:13},J)),F.includes("bars")&&(ia.bars=n.jsxDEV(o.Fragment,{children:$e((function(e,a){return o.createElement(A,m({},ea,{bar:a,style:e,shouldRenderLabel:Qe(a),label:ze(a.data)}))}))},"bars",!1,{fileName:_,lineNumber:305,columnNumber:13},J)),F.includes("grid")&&(ia.grid=n.jsxDEV(a.Grid,{width:He,height:Ae,xScale:W?Oe:null,yScale:I?Ge:null,xValues:R,yValues:j},"grid",!1,{fileName:_,lineNumber:321,columnNumber:13},J)),F.includes("legends")&&(ia.legends=n.jsxDEV(x,{width:He,height:Ae,legends:Ze,toggleSerie:Ue},"legends",!1,{fileName:_,lineNumber:335,columnNumber:13},J)),F.includes("markers")&&(ia.markers=n.jsxDEV(t.CartesianMarkers,{markers:Q,width:He,height:Ae,xScale:Oe,yScale:Ge},"markers",!1,{fileName:_,lineNumber:347,columnNumber:13},J));var na=o.useMemo((function(){return m({},ea,{margin:Fe,innerWidth:He,innerHeight:Ae,width:s,height:c,bars:Xe,xScale:Oe,yScale:Ge})}),[ea,Fe,He,Ae,s,c,Xe,Oe,Ge]);return n.jsxDEV(t.SvgWrapper,{width:je,height:Pe,margin:Fe,defs:aa,role:Se,ariaLabel:Ce,ariaLabelledBy:Ve,ariaDescribedBy:Le,isFocusable:Ne,children:F.map((function(e,a){var i;return"function"==typeof e?n.jsxDEV(o.Fragment,{children:o.createElement(e,na)},a,!1,{fileName:_,lineNumber:388,columnNumber:28},J):null!=(i=null==ia?void 0:ia[e])?i:null}))},void 0,!1,{fileName:_,lineNumber:375,columnNumber:9},J)},U=function(e){var a=e.isInteractive,i=void 0===a?w.isInteractive:a,r=e.animate,o=void 0===r?w.animate:r,l=e.motionConfig,d=void 0===l?w.motionConfig:l,u=e.theme,s=e.renderWrapper,c=g(e,K);return n.jsxDEV(t.Container,{animate:o,isInteractive:i,motionConfig:d,renderWrapper:s,theme:u,children:n.jsxDEV(Q,m({isInteractive:i},c),void 0,!1,{fileName:_,lineNumber:414,columnNumber:9},J)},void 0,!1,{fileName:_,lineNumber:405,columnNumber:5},J)},Z=["isInteractive","renderWrapper","theme"],$="/home/oleksandr/code/atlas/nivo/packages/bar/src/BarCanvas.tsx",ee=void 0,ae=function(e,a,i,n){return e.find((function(e){return t.isCursorInRect(e.x+a.left,e.y+a.top,e.width,e.height,i,n)}))},ie=function(e){var l=e.data,u=e.indexBy,s=e.keys,c=e.margin,h=e.width,b=e.height,v=e.groupMode,g=e.layout,f=e.reverse,p=e.minValue,x=e.maxValue,y=e.valueScale,k=e.indexScale,S=e.padding,C=e.innerPadding,V=e.axisTop,L=e.axisRight,w=e.axisBottom,B=void 0===w?N.axisBottom:w,E=e.axisLeft,M=void 0===E?N.axisLeft:E,T=e.enableGridX,W=void 0===T?N.enableGridX:T,D=e.enableGridY,I=void 0===D?N.enableGridY:D,R=e.gridXValues,j=e.gridYValues,P=e.layers,F=void 0===P?N.layers:P,H=e.renderBar,A=void 0===H?function(e,a){var i=a.bar,n=i.color,r=i.height,t=i.width,o=i.x,l=i.y,d=a.borderColor,u=a.borderRadius,s=a.borderWidth,c=a.label,h=a.labelColor,b=a.shouldRenderLabel;if(e.fillStyle=n,s>0&&(e.strokeStyle=d,e.lineWidth=s),e.beginPath(),u>0){var v=Math.min(u,r);e.moveTo(o+v,l),e.lineTo(o+t-v,l),e.quadraticCurveTo(o+t,l,o+t,l+v),e.lineTo(o+t,l+r-v),e.quadraticCurveTo(o+t,l+r,o+t-v,l+r),e.lineTo(o+v,l+r),e.quadraticCurveTo(o,l+r,o,l+r-v),e.lineTo(o,l+v),e.quadraticCurveTo(o,l,o+v,l),e.closePath()}else e.rect(o,l,t,r);e.fill(),s>0&&e.stroke(),b&&(e.textBaseline="middle",e.textAlign="center",e.fillStyle=h,e.fillText(c,o+t/2,l+r/2))}:H,q=e.enableLabel,X=e.label,Y=e.labelSkipWidth,O=e.labelSkipHeight,G=e.labelTextColor,K=e.colorBy,_=e.colors,J=e.borderRadius,Q=void 0===J?N.borderRadius:J,U=e.borderWidth,Z=void 0===U?N.borderWidth:U,ie=e.borderColor,ne=e.annotations,re=void 0===ne?N.annotations:ne,te=e.legendLabel,oe=e.tooltipLabel,le=e.valueFormat,de=e.isInteractive,ue=void 0===de?N.isInteractive:de,se=e.tooltip,ce=void 0===se?N.tooltip:se,he=e.onClick,be=e.onMouseEnter,ve=e.onMouseLeave,me=e.legends,ge=e.pixelRatio,fe=void 0===ge?N.pixelRatio:ge,pe=e.canvasRef,xe=o.useRef(null),ye=t.useTheme(),ke=t.useDimensions(h,b,c),Se=ke.margin,Ce=ke.innerWidth,Ve=ke.innerHeight,Le=ke.outerWidth,we=ke.outerHeight,Ne=z({indexBy:u,label:X,tooltipLabel:oe,valueFormat:le,colors:_,colorBy:K,borderColor:ie,labelTextColor:G,groupMode:v,layout:g,reverse:f,data:l,keys:s,minValue:p,maxValue:x,margin:Se,width:Ce,height:Ve,padding:S,innerPadding:C,valueScale:y,indexScale:k,enableLabel:q,labelSkipWidth:Y,labelSkipHeight:O,legends:me,legendLabel:te}),Be=Ne.bars,Ee=Ne.barsWithValue,Me=Ne.xScale,Te=Ne.yScale,We=Ne.getLabel,De=Ne.getTooltipLabel,Ie=Ne.getBorderColor,Re=Ne.getLabelColor,je=Ne.shouldRenderBarLabel,Pe=Ne.legendsWithData,Fe=d.useTooltip(),He=Fe.showTooltipFromEvent,Ae=Fe.hideTooltip,qe=i.useComputedAnnotations({annotations:i.useAnnotations({data:Be,annotations:re,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var a=e.width,i=e.height;return{width:a,height:i,size:Math.max(a,i)}}})}),Xe=o.useMemo((function(){return{borderRadius:Q,borderWidth:Z,enableLabel:q,isInteractive:ue,labelSkipWidth:Y,labelSkipHeight:O,onClick:he,onMouseEnter:be,onMouseLeave:ve,getTooltipLabel:De,tooltip:ce,margin:Se,innerWidth:Ce,innerHeight:Ve,width:h,height:b,bars:Be,xScale:Me,yScale:Te}}),[Q,Z,q,De,b,Ve,Ce,ue,O,Y,Se,he,be,ve,Be,Me,Te,ce,h]);o.useEffect((function(){var e,n=null==(e=xe.current)?void 0:e.getContext("2d");xe.current&&n&&(xe.current.width=Le*fe,xe.current.height=we*fe,n.scale(fe,fe),n.fillStyle=ye.background,n.fillRect(0,0,Le,we),n.translate(Se.left,Se.top),F.forEach((function(e){"grid"===e?"number"==typeof ye.grid.line.strokeWidth&&ye.grid.line.strokeWidth>0&&(n.lineWidth=ye.grid.line.strokeWidth,n.strokeStyle=ye.grid.line.stroke,W&&a.renderGridLinesToCanvas(n,{width:h,height:b,scale:Me,axis:"x",values:R}),I&&a.renderGridLinesToCanvas(n,{width:h,height:b,scale:Te,axis:"y",values:j})):"axes"===e?a.renderAxesToCanvas(n,{xScale:Me,yScale:Te,width:Ce,height:Ve,top:V,right:L,bottom:B,left:M,theme:ye}):"bars"===e?Ee.forEach((function(e){A(n,{bar:e,borderColor:Ie(e),borderRadius:Q,borderWidth:Z,label:We(e.data),labelColor:Re(e),shouldRenderLabel:je(e)})})):"legends"===e?Pe.forEach((function(e){var a=e[0],i=e[1];r.renderLegendToCanvas(n,m({},a,{data:i,containerWidth:Ce,containerHeight:Ve,theme:ye}))})):"annotations"===e?i.renderAnnotationsToCanvas(n,{annotations:qe,theme:ye}):"function"==typeof e&&e(n,Xe)})),n.save())}),[B,M,L,V,Ee,Q,Z,qe,W,I,Ie,We,Re,R,j,v,b,Ve,Ce,Xe,F,g,Pe,Se.left,Se.top,we,Le,fe,A,Me,Te,f,je,ye,h]);var Ye=o.useCallback((function(e){if(Be&&xe.current){var a=t.getRelativeCursor(xe.current,e),i=a[0],n=a[1],r=ae(Be,Se,i,n);void 0!==r?(He(o.createElement(ce,m({},r.data,{color:r.color,label:r.label,value:Number(r.data.value)})),e),"mouseenter"===e.type&&(null==be||be(r.data,e))):Ae()}}),[Ae,Se,be,Be,He,ce]),Oe=o.useCallback((function(e){if(Be&&xe.current){Ae();var a=t.getRelativeCursor(xe.current,e),i=a[0],n=a[1],r=ae(Be,Se,i,n);r&&(null==ve||ve(r.data,e))}}),[Ae,Se,ve,Be]),Ge=o.useCallback((function(e){if(Be&&xe.current){var a=t.getRelativeCursor(xe.current,e),i=a[0],n=a[1],r=ae(Be,Se,i,n);void 0!==r&&(null==he||he(m({},r.data,{color:r.color}),e))}}),[Se,he,Be]);return n.jsxDEV("canvas",{ref:function(e){xe.current=e,pe&&"current"in pe&&(pe.current=e)},width:Le*fe,height:we*fe,style:{width:Le,height:we,cursor:ue?"auto":"normal"},onMouseEnter:ue?Ye:void 0,onMouseMove:ue?Ye:void 0,onMouseLeave:ue?Oe:void 0,onClick:ue?Ge:void 0},void 0,!1,{fileName:$,lineNumber:462,columnNumber:9},ee)},ne=o.forwardRef((function(e,a){var i=e.isInteractive,r=e.renderWrapper,o=e.theme,l=g(e,Z);return n.jsxDEV(t.Container,{isInteractive:i,renderWrapper:r,theme:o,animate:!1,children:n.jsxDEV(ie,m({},l,{canvasRef:a}),void 0,!1,{fileName:$,lineNumber:488,columnNumber:13},ee)},void 0,!1,{fileName:$,lineNumber:487,columnNumber:9},ee)})),re="/home/oleksandr/code/atlas/nivo/packages/bar/src/ResponsiveBar.tsx",te=void 0,oe="/home/oleksandr/code/atlas/nivo/packages/bar/src/ResponsiveBarCanvas.tsx",le=o.forwardRef((function(e,a){var i=this;return n.jsxDEV(t.ResponsiveWrapper,{children:function(r){var t=r.width,o=r.height;return n.jsxDEV(ne,m({width:t,height:o},e,{ref:a}),void 0,!1,{fileName:oe,lineNumber:12,columnNumber:17},i)}},void 0,!1,{fileName:oe,lineNumber:10,columnNumber:9},this)}));e.Bar=U,e.BarCanvas=ne,e.BarItem=C,e.ResponsiveBar=function(e){return n.jsxDEV(t.ResponsiveWrapper,{children:function(a){var i=a.width,r=a.height;return n.jsxDEV(U,m({width:i,height:r},e),void 0,!1,{fileName:re,lineNumber:9,columnNumber:33},te)}},void 0,!1,{fileName:re,lineNumber:8,columnNumber:5},te)},e.ResponsiveBarCanvas=le,e.canvasDefaultProps=N,e.defaultProps=L,e.svgDefaultProps=w,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("@nivo/axes"),require("@nivo/annotations"),require("react/jsx-runtime"),require("@nivo/legends"),require("@nivo/core"),require("react"),require("@react-spring/web"),require("@nivo/tooltip"),require("@nivo/colors"),require("@nivo/scales"),require("d3-shape"),require("lodash/uniqBy")):"function"==typeof define&&define.amd?define(["exports","@nivo/axes","@nivo/annotations","react/jsx-runtime","@nivo/legends","@nivo/core","react","@react-spring/web","@nivo/tooltip","@nivo/colors","@nivo/scales","d3-shape","lodash/uniqBy"],a):a((e="undefined"!=typeof globalThis?globalThis:e||self).nivo=e.nivo||{},e.nivo,e.nivo,e["react/jsx-runtime"],e.nivo,e.nivo,e.React,e["@react-spring/web"],e.nivo,e.nivo,e.nivo,e.d3,e["lodash/uniqBy"])}(this,(function(e,a,t,i,n,r,o,l,d,u,s,c,h){"use strict";function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=v(h);function g(){return g=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},g.apply(this,arguments)}function f(e,a){if(null==e)return{};var t,i,n={},r=Object.keys(e);for(i=0;i<r.length;i++)t=r[i],a.indexOf(t)>=0||(n[t]=e[t]);return n}var m,p=function(e){var a=e.bars,n=e.annotations,r=t.useAnnotations({data:a,annotations:n,getPosition:function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},getDimensions:function(e){var a=e.height,t=e.width;return{width:t,height:a,size:Math.max(t,a)}}});return i.jsx(i.Fragment,{children:r.map((function(e,a){return i.jsx(t.Annotation,g({},e),a)}))})},x=function(e){var a=e.width,t=e.height,r=e.legends,o=e.toggleSerie;return i.jsx(i.Fragment,{children:r.map((function(e,r){var l,d=e[0],u=e[1];return i.jsx(n.BoxLegendSvg,g({},d,{containerWidth:a,containerHeight:t,data:null!=(l=d.data)?l:u,toggleSerie:d.toggleSerie&&"keys"===d.dataFrom?o:void 0}),r)}))})},y=["data"],S=function(e){var a,t=e.bar,n=t.data,u=f(t,y),s=e.style,c=s.borderColor,h=s.color,v=s.height,b=s.labelColor,m=s.labelOpacity,p=s.labelX,x=s.labelY,S=s.transform,k=s.width,C=e.borderRadius,w=e.borderWidth,L=e.label,V=e.shouldRenderLabel,B=e.isInteractive,M=e.onClick,T=e.onMouseEnter,W=e.onMouseLeave,I=e.tooltip,R=e.isFocusable,j=e.ariaLabel,P=e.ariaLabelledBy,E=e.ariaDescribedBy,F=r.useTheme(),H=d.useTooltip(),A=H.showTooltipFromEvent,q=H.showTooltipAt,D=H.hideTooltip,X=o.useMemo((function(){return function(){return o.createElement(I,g({},u,n))}}),[I,u,n]),Y=o.useCallback((function(e){null==M||M(g({color:u.color},n),e)}),[u,n,M]),O=o.useCallback((function(e){return A(X(),e)}),[A,X]),G=o.useCallback((function(e){null==T||T(n,e),A(X(),e)}),[n,T,A,X]),z=o.useCallback((function(e){null==W||W(n,e),D()}),[n,D,W]),K=o.useCallback((function(){q(X(),[u.absX+u.width/2,u.absY])}),[q,X,u]),N=o.useCallback((function(){D()}),[D]);return i.jsxs(l.animated.g,{transform:S,children:[i.jsx(l.animated.rect,{width:l.to(k,(function(e){return Math.max(e,0)})),height:l.to(v,(function(e){return Math.max(e,0)})),rx:C,ry:C,fill:null!=(a=n.fill)?a:h,strokeWidth:w,stroke:c,focusable:R,tabIndex:R?0:void 0,"aria-label":j?j(n):void 0,"aria-labelledby":P?P(n):void 0,"aria-describedby":E?E(n):void 0,onMouseEnter:B?G:void 0,onMouseMove:B?O:void 0,onMouseLeave:B?z:void 0,onClick:B?Y:void 0,onFocus:B&&R?K:void 0,onBlur:B&&R?N:void 0}),V&&i.jsx(l.animated.text,{x:p,y:x,textAnchor:"middle",dominantBaseline:"central",fillOpacity:m,style:g({},F.labels.text,{pointerEvents:"none",fill:b}),children:L})]})},k=["color","label"],C={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:function(e){var a=e.color,t=e.label,n=f(e,k);return i.jsx(d.BasicTooltip,{id:t,value:n.formattedValue,enableChip:!0,color:a})},tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[]},w=g({},C,{layers:["grid","axes","bars","markers","legends","annotations"],barComponent:S,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),L=g({},C,{layers:["grid","axes","bars","legends","annotations"],pixelRatio:"undefined"!=typeof window&&null!=(m=window.devicePixelRatio)?m:1}),V=function(e,a,t,i,n,r){return s.computeScale(i,{all:e.map(a),min:0,max:0},n,r).padding(t)},B=function(e,a){return e.map((function(e){return g({},a.reduce((function(e,a){return e[a]=null,e}),{}),e)}))},M=function(e){return Object.keys(e).reduce((function(a,t){return e[t]&&(a[t]=e[t]),a}),{})},T=function(e){return[e,Number(e)]},W=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],I=function(e,a){return e>a},R=function(e,a){return e<a},j=function(e,a){return Array.from(" ".repeat(a-e),(function(a,t){return e+t}))},P=function(e){return I(e,0)?0:e},E=function(e,a,t,i){var n=e.data,r=e.formatValue,o=e.getColor,l=e.getIndex,d=e.getTooltipLabel,u=e.innerPadding,s=void 0===u?0:u,c=e.keys,h=e.xScale,v=e.yScale,b=e.margin,g=t?R:I,f=n.map(M),m=[];return c.forEach((function(e,t){return j(0,h.domain().length).forEach((function(u){var c,p,x,y=T(n[u][e]),S=y[0],k=y[1],C=l(n[u]),w=(null!=(c=h(C))?c:0)+a*t+s*t,L=g(p=k,0)?null!=(x=v(p))?x:0:i,V=function(e,a){var t;return g(e,0)?i-a:(null!=(t=v(e))?t:0)-i}(k,L),B={id:e,value:null===S?S:k,formattedValue:r(k),hidden:!1,index:u,indexValue:C,data:f[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:w,y:L,absX:b.left+w,absY:b.top+L,width:a,height:V,color:o(B),label:d(B)})}))})),m},F=function(e,a,t,i){var n=e.data,r=e.formatValue,o=e.getIndex,l=e.getColor,d=e.getTooltipLabel,u=e.keys,s=e.innerPadding,c=void 0===s?0:s,h=e.xScale,v=e.yScale,b=e.margin,g=t?R:I,f=n.map(M),m=[];return u.forEach((function(e,t){return j(0,v.domain().length).forEach((function(u){var s,p,x,y=T(n[u][e]),S=y[0],k=y[1],C=o(n[u]),w=g(p=k,0)?i:null!=(x=h(p))?x:0,L=(null!=(s=v(C))?s:0)+a*t+c*t,V=function(e,a){var t;return g(e,0)?(null!=(t=h(e))?t:0)-i:i-a}(k,w),B={id:e,value:null===S?S:k,formattedValue:r(k),hidden:!1,index:u,indexValue:C,data:f[u]};m.push({key:e+"."+B.indexValue,index:m.length,data:B,x:w,y:L,absX:b.left+w,absY:b.top+L,width:V,height:a,color:l(B),label:d(B)})}))})),m},H=function(e){var a,t,i=e.layout,n=e.minValue,r=e.maxValue,o=e.reverse,l=e.width,d=e.height,u=e.padding,c=void 0===u?0:u,h=e.innerPadding,v=void 0===h?0:h,b=e.valueScale,m=e.indexScale,p=e.hiddenIds,x=void 0===p?[]:p,y=f(e,W),S=y.keys.filter((function(e){return!x.includes(e)})),k=B(y.data,S),C="vertical"===i?["y","x",l]:["x","y",d],w=C[0],L=C[1],M=C[2],T=V(k,y.getIndex,c,m,M,L),I=g({max:r,min:n,reverse:o},b),R="auto"===I.min?P:function(e){return e},j=k.reduce((function(e,a){return[].concat(e,S.map((function(e){return a[e]})))}),[]).filter(Boolean),H=R(Math.min.apply(Math,j)),A=(t=Math.max.apply(Math,j),isFinite(t)?t:0),q=s.computeScale(I,{all:j,min:H,max:A},"x"===w?l:d,w),D="vertical"===i?[T,q]:[q,T],X=D[0],Y=D[1],O=(T.bandwidth()-v*(S.length-1))/S.length,G=[g({},y,{data:k,keys:S,innerPadding:v,xScale:X,yScale:Y}),O,I.reverse,null!=(a=q(0))?a:0];return{xScale:X,yScale:Y,bars:O>0?"vertical"===i?E.apply(void 0,G):F.apply(void 0,G):[]}},A=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],q=function e(a){var t;return a.some(Array.isArray)?e((t=[]).concat.apply(t,a)):a},D=function(e,a,t){var i=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return u.domain().forEach((function(d,v){var b,g,f=e[v],m=null!=(b=u(r(f.data)))?b:0,p=(null!=(g=function(e){return s(e[t?0:1])}(f))?g:0)+.5*l,x=function(e,a){var i;return(null!=(i=s(e[t?1:0]))?i:0)-a}(f,p)-l,y=T(f.data[e.key]),S=y[0],k=y[1],C={id:e.key,value:null===S?S:k,formattedValue:i(k),hidden:!1,index:v,indexValue:d,data:M(f.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:m,y:p,absX:c.left+m,absY:c.top+p,width:a,height:x,color:n(C),label:o(C)})}))})),h},X=function(e,a,t){var i=e.formatValue,n=e.getColor,r=e.getIndex,o=e.getTooltipLabel,l=e.innerPadding,d=e.stackedData,u=e.xScale,s=e.yScale,c=e.margin,h=[];return d.forEach((function(e){return s.domain().forEach((function(d,v){var b,g,f=e[v],m=null!=(b=s(r(f.data)))?b:0,p=(null!=(g=function(e){return u(e[t?1:0])}(f))?g:0)+.5*l,x=function(e,a){var i;return(null!=(i=u(e[t?0:1]))?i:0)-a}(f,p)-l,y=T(f.data[e.key]),S=y[0],k=y[1],C={id:e.key,value:null===S?S:k,formattedValue:i(k),hidden:!1,index:v,indexValue:d,data:M(f.data)};h.push({key:e.key+"."+d,index:h.length,data:C,x:p,y:m,absX:c.left+p,absY:c.top+m,width:x,height:a,color:n(C),label:o(C)})}))})),h},Y=function(e){var a,t=e.data,i=e.layout,n=e.minValue,r=e.maxValue,o=e.reverse,l=e.width,d=e.height,u=e.padding,h=void 0===u?0:u,v=e.valueScale,b=e.indexScale,m=e.hiddenIds,p=void 0===m?[]:m,x=f(e,A),y=x.keys.filter((function(e){return!p.includes(e)})),S=c.stack().keys(y).offset(c.stackOffsetDiverging)(B(t,y)),k="vertical"===i?["y","x",l]:["x","y",d],C=k[0],w=k[1],L=k[2],M=V(t,x.getIndex,h,b,L,w),T=g({max:r,min:n,reverse:o},v),W=(a=q(S),"log"===v.type?a.filter((function(e){return 0!==e})):a),I=Math.min.apply(Math,W),R=Math.max.apply(Math,W),j=s.computeScale(T,{all:W,min:I,max:R},"x"===C?l:d,C),P="vertical"===i?[M,j]:[j,M],E=P[0],F=P[1],H=x.innerPadding>0?x.innerPadding:0,Y=M.bandwidth(),O=[g({},x,{innerPadding:H,stackedData:S,xScale:E,yScale:F}),Y,T.reverse];return{xScale:E,yScale:F,bars:Y>0?"vertical"===i?D.apply(void 0,O):X.apply(void 0,O):[]}},O=function(e){var a=e.bars,t=e.direction,i=e.from,n=e.groupMode,o=e.layout,l=e.legendLabel,d=e.reverse,u=r.getPropertyAccessor(null!=l?l:"indexes"===i?"indexValue":"id");return"indexes"===i?function(e,a,t){var i=b.default(e.map((function(e){var a,i;return{id:null!=(a=e.data.indexValue)?a:"",label:t(e.data),hidden:e.data.hidden,color:null!=(i=e.color)?i:"#000"}})),(function(e){return e.id}));return"horizontal"===a&&i.reverse(),i}(a,o,u):function(e,a,t,i,n,r){var o=b.default(e.map((function(e){var a;return{id:e.data.id,label:r(e.data),hidden:e.data.hidden,color:null!=(a=e.color)?a:"#000"}})),(function(e){return e.id}));return("vertical"===a&&"stacked"===i&&"column"===t&&!0!==n||"horizontal"===a&&"stacked"===i&&!0===n)&&o.reverse(),o}(a,o,t,n,d,u)},G=function(e){var a=e.indexBy,t=void 0===a?C.indexBy:a,i=e.keys,n=void 0===i?C.keys:i,l=e.label,d=void 0===l?C.label:l,s=e.tooltipLabel,c=void 0===s?C.tooltipLabel:s,h=e.valueFormat,v=e.colors,b=void 0===v?C.colors:v,f=e.colorBy,m=void 0===f?C.colorBy:f,p=e.borderColor,x=void 0===p?C.borderColor:p,y=e.labelTextColor,S=void 0===y?C.labelTextColor:y,k=e.groupMode,w=void 0===k?C.groupMode:k,L=e.layout,V=void 0===L?C.layout:L,B=e.reverse,M=void 0===B?C.reverse:B,T=e.data,W=e.minValue,I=void 0===W?C.minValue:W,R=e.maxValue,j=void 0===R?C.maxValue:R,P=e.margin,E=e.width,F=e.height,A=e.padding,q=void 0===A?C.padding:A,D=e.innerPadding,X=void 0===D?C.innerPadding:D,G=e.valueScale,z=void 0===G?C.valueScale:G,K=e.indexScale,N=void 0===K?C.indexScale:K,_=e.initialHiddenIds,J=void 0===_?C.initialHiddenIds:_,Q=e.enableLabel,U=void 0===Q?C.enableLabel:Q,Z=e.labelSkipWidth,$=void 0===Z?C.labelSkipWidth:Z,ee=e.labelSkipHeight,ae=void 0===ee?C.labelSkipHeight:ee,te=e.legends,ie=void 0===te?C.legends:te,ne=e.legendLabel,re=o.useState(null!=J?J:[]),oe=re[0],le=re[1],de=o.useCallback((function(e){le((function(a){return a.indexOf(e)>-1?a.filter((function(a){return a!==e})):[].concat(a,[e])}))}),[]),ue=r.usePropertyAccessor(t),se=r.usePropertyAccessor(d),ce=r.usePropertyAccessor(c),he=r.useValueFormatter(h),ve=r.useTheme(),be=u.useOrdinalColorScale(b,m),ge=u.useInheritedColor(x,ve),fe=u.useInheritedColor(S,ve),me=("grouped"===w?H:Y)({layout:V,reverse:M,data:T,getIndex:ue,keys:n,minValue:I,maxValue:j,width:E,height:F,getColor:be,padding:q,innerPadding:X,valueScale:z,indexScale:N,hiddenIds:oe,formatValue:he,getTooltipLabel:ce,margin:P}),pe=me.bars,xe=me.xScale,ye=me.yScale,Se=o.useMemo((function(){return pe.filter((function(e){return null!==e.data.value})).map((function(e,a){return g({},e,{index:a})}))}),[pe]),ke=o.useCallback((function(e){var a=e.width,t=e.height;return!!U&&(!($>0&&a<$)&&!(ae>0&&t<ae))}),[U,$,ae]),Ce=o.useMemo((function(){return n.map((function(e){var a=pe.find((function(a){return a.data.id===e}));return g({},a,{data:g({id:e},null==a?void 0:a.data,{hidden:oe.includes(e)})})}))}),[oe,n,pe]),we=o.useMemo((function(){return ie.map((function(e){return[e,O({bars:"keys"===e.dataFrom?Ce:pe,direction:e.direction,from:e.dataFrom,groupMode:w,layout:V,legendLabel:ne,reverse:M})]}))}),[ie,Ce,pe,w,V,ne,M]);return{bars:pe,barsWithValue:Se,xScale:xe,yScale:ye,getIndex:ue,getLabel:se,getTooltipLabel:ce,formatValue:he,getColor:be,getBorderColor:ge,getLabelColor:fe,shouldRenderBarLabel:ke,hiddenIds:oe,toggleSerie:de,legendsWithData:we}},z=["isInteractive","animate","motionConfig","theme","renderWrapper"],K=function(e){var t=e.data,n=e.indexBy,d=e.keys,u=e.margin,s=e.width,c=e.height,h=e.groupMode,v=e.layout,b=e.reverse,f=e.minValue,m=e.maxValue,y=e.valueScale,S=e.indexScale,k=e.padding,C=e.innerPadding,L=e.axisTop,V=e.axisRight,B=e.axisBottom,M=void 0===B?w.axisBottom:B,T=e.axisLeft,W=void 0===T?w.axisLeft:T,I=e.enableGridX,R=void 0===I?w.enableGridX:I,j=e.enableGridY,P=void 0===j?w.enableGridY:j,E=e.gridXValues,F=e.gridYValues,H=e.layers,A=void 0===H?w.layers:H,q=e.barComponent,D=void 0===q?w.barComponent:q,X=e.enableLabel,Y=e.label,O=e.labelSkipWidth,z=e.labelSkipHeight,K=e.labelTextColor,N=e.markers,_=void 0===N?w.markers:N,J=e.colorBy,Q=e.colors,U=e.defs,Z=void 0===U?w.defs:U,$=e.fill,ee=void 0===$?w.fill:$,ae=e.borderRadius,te=void 0===ae?w.borderRadius:ae,ie=e.borderWidth,ne=void 0===ie?w.borderWidth:ie,re=e.borderColor,oe=e.annotations,le=void 0===oe?w.annotations:oe,de=e.legendLabel,ue=e.tooltipLabel,se=e.valueFormat,ce=e.isInteractive,he=void 0===ce?w.isInteractive:ce,ve=e.tooltip,be=void 0===ve?w.tooltip:ve,ge=e.onClick,fe=e.onMouseEnter,me=e.onMouseLeave,pe=e.legends,xe=e.role,ye=void 0===xe?w.role:xe,Se=e.ariaLabel,ke=e.ariaLabelledBy,Ce=e.ariaDescribedBy,we=e.isFocusable,Le=void 0===we?w.isFocusable:we,Ve=e.barAriaLabel,Be=e.barAriaLabelledBy,Me=e.barAriaDescribedBy,Te=e.initialHiddenIds,We=r.useMotionConfig(),Ie=We.animate,Re=We.config,je=r.useDimensions(s,c,u),Pe=je.outerWidth,Ee=je.outerHeight,Fe=je.margin,He=je.innerWidth,Ae=je.innerHeight,qe=G({indexBy:n,label:Y,tooltipLabel:ue,valueFormat:se,colors:Q,colorBy:J,borderColor:re,labelTextColor:K,groupMode:h,layout:v,reverse:b,data:t,keys:d,minValue:f,maxValue:m,margin:Fe,width:He,height:Ae,padding:k,innerPadding:C,valueScale:y,indexScale:S,enableLabel:X,labelSkipWidth:O,labelSkipHeight:z,legends:pe,legendLabel:de,initialHiddenIds:Te}),De=qe.bars,Xe=qe.barsWithValue,Ye=qe.xScale,Oe=qe.yScale,Ge=qe.getLabel,ze=qe.getTooltipLabel,Ke=qe.getBorderColor,Ne=qe.getLabelColor,_e=qe.shouldRenderBarLabel,Je=qe.toggleSerie,Qe=qe.legendsWithData,Ue=l.useTransition(Xe,{keys:function(e){return e.key},from:function(e){return g({borderColor:Ke(e),color:e.color,height:0,labelColor:Ne(e),labelOpacity:0,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===v?{}:{height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},enter:function(e){return{borderColor:Ke(e),color:e.color,height:e.height,labelColor:Ne(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},update:function(e){return{borderColor:Ke(e),color:e.color,height:e.height,labelColor:Ne(e),labelOpacity:1,labelX:e.width/2,labelY:e.height/2,transform:"translate("+e.x+", "+e.y+")",width:e.width}},leave:function(e){return g({borderColor:Ke(e),color:e.color,height:0,labelColor:Ne(e),labelOpacity:0,labelX:e.width/2,labelY:0,transform:"translate("+e.x+", "+(e.y+e.height)+")",width:e.width},"vertical"===v?{}:{labelX:0,labelY:e.height/2,height:e.height,transform:"translate("+e.x+", "+e.y+")",width:0})},config:Re,immediate:!Ie,initial:Ie?void 0:null}),Ze=o.useMemo((function(){return{borderRadius:te,borderWidth:ne,enableLabel:X,isInteractive:he,labelSkipWidth:O,labelSkipHeight:z,onClick:ge,onMouseEnter:fe,onMouseLeave:me,getTooltipLabel:ze,tooltip:be,isFocusable:Le,ariaLabel:Ve,ariaLabelledBy:Be,ariaDescribedBy:Me}}),[te,ne,X,ze,he,z,O,ge,fe,me,be,Le,Ve,Be,Me]),$e=r.bindDefs(Z,De,ee,{dataKey:"data",targetKey:"data.fill"}),ea={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null};A.includes("annotations")&&(ea.annotations=i.jsx(p,{bars:De,annotations:le},"annotations")),A.includes("axes")&&(ea.axes=i.jsx(a.Axes,{xScale:Ye,yScale:Oe,width:He,height:Ae,top:L,right:V,bottom:M,left:W},"axes")),A.includes("bars")&&(ea.bars=i.jsx(o.Fragment,{children:Ue((function(e,a){return o.createElement(D,g({},Ze,{bar:a,style:e,shouldRenderLabel:_e(a),label:Ge(a.data)}))}))},"bars")),A.includes("grid")&&(ea.grid=i.jsx(a.Grid,{width:He,height:Ae,xScale:R?Ye:null,yScale:P?Oe:null,xValues:E,yValues:F},"grid")),A.includes("legends")&&(ea.legends=i.jsx(x,{width:He,height:Ae,legends:Qe,toggleSerie:Je},"legends")),A.includes("markers")&&(ea.markers=i.jsx(r.CartesianMarkers,{markers:_,width:He,height:Ae,xScale:Ye,yScale:Oe},"markers"));var aa=o.useMemo((function(){return g({},Ze,{margin:Fe,innerWidth:He,innerHeight:Ae,width:s,height:c,bars:De,xScale:Ye,yScale:Oe})}),[Ze,Fe,He,Ae,s,c,De,Ye,Oe]);return i.jsx(r.SvgWrapper,{width:Pe,height:Ee,margin:Fe,defs:$e,role:ye,ariaLabel:Se,ariaLabelledBy:ke,ariaDescribedBy:Ce,isFocusable:Le,children:A.map((function(e,a){var t;return"function"==typeof e?i.jsx(o.Fragment,{children:o.createElement(e,aa)},a):null!=(t=null==ea?void 0:ea[e])?t:null}))})},N=function(e){var a=e.isInteractive,t=void 0===a?w.isInteractive:a,n=e.animate,o=void 0===n?w.animate:n,l=e.motionConfig,d=void 0===l?w.motionConfig:l,u=e.theme,s=e.renderWrapper,c=f(e,z);return i.jsx(r.Container,{animate:o,isInteractive:t,motionConfig:d,renderWrapper:s,theme:u,children:i.jsx(K,g({isInteractive:t},c))})},_=["isInteractive","renderWrapper","theme"],J=function(e,a,t,i){return e.find((function(e){return r.isCursorInRect(e.x+a.left,e.y+a.top,e.width,e.height,t,i)}))},Q=function(e){var l=e.data,u=e.indexBy,s=e.keys,c=e.margin,h=e.width,v=e.height,b=e.groupMode,f=e.layout,m=e.reverse,p=e.minValue,x=e.maxValue,y=e.valueScale,S=e.indexScale,k=e.padding,C=e.innerPadding,w=e.axisTop,V=e.axisRight,B=e.axisBottom,M=void 0===B?L.axisBottom:B,T=e.axisLeft,W=void 0===T?L.axisLeft:T,I=e.enableGridX,R=void 0===I?L.enableGridX:I,j=e.enableGridY,P=void 0===j?L.enableGridY:j,E=e.gridXValues,F=e.gridYValues,H=e.layers,A=void 0===H?L.layers:H,q=e.renderBar,D=void 0===q?function(e,a){var t=a.bar,i=t.color,n=t.height,r=t.width,o=t.x,l=t.y,d=a.borderColor,u=a.borderRadius,s=a.borderWidth,c=a.label,h=a.labelColor,v=a.shouldRenderLabel;if(e.fillStyle=i,s>0&&(e.strokeStyle=d,e.lineWidth=s),e.beginPath(),u>0){var b=Math.min(u,n);e.moveTo(o+b,l),e.lineTo(o+r-b,l),e.quadraticCurveTo(o+r,l,o+r,l+b),e.lineTo(o+r,l+n-b),e.quadraticCurveTo(o+r,l+n,o+r-b,l+n),e.lineTo(o+b,l+n),e.quadraticCurveTo(o,l+n,o,l+n-b),e.lineTo(o,l+b),e.quadraticCurveTo(o,l,o+b,l),e.closePath()}else e.rect(o,l,r,n);e.fill(),s>0&&e.stroke(),v&&(e.textBaseline="middle",e.textAlign="center",e.fillStyle=h,e.fillText(c,o+r/2,l+n/2))}:q,X=e.enableLabel,Y=e.label,O=e.labelSkipWidth,z=e.labelSkipHeight,K=e.labelTextColor,N=e.colorBy,_=e.colors,Q=e.borderRadius,U=void 0===Q?L.borderRadius:Q,Z=e.borderWidth,$=void 0===Z?L.borderWidth:Z,ee=e.borderColor,ae=e.annotations,te=void 0===ae?L.annotations:ae,ie=e.legendLabel,ne=e.tooltipLabel,re=e.valueFormat,oe=e.isInteractive,le=void 0===oe?L.isInteractive:oe,de=e.tooltip,ue=void 0===de?L.tooltip:de,se=e.onClick,ce=e.onMouseEnter,he=e.onMouseLeave,ve=e.legends,be=e.pixelRatio,ge=void 0===be?L.pixelRatio:be,fe=e.canvasRef,me=o.useRef(null),pe=r.useTheme(),xe=r.useDimensions(h,v,c),ye=xe.margin,Se=xe.innerWidth,ke=xe.innerHeight,Ce=xe.outerWidth,we=xe.outerHeight,Le=G({indexBy:u,label:Y,tooltipLabel:ne,valueFormat:re,colors:_,colorBy:N,borderColor:ee,labelTextColor:K,groupMode:b,layout:f,reverse:m,data:l,keys:s,minValue:p,maxValue:x,margin:ye,width:Se,height:ke,padding:k,innerPadding:C,valueScale:y,indexScale:S,enableLabel:X,labelSkipWidth:O,labelSkipHeight:z,legends:ve,legendLabel:ie}),Ve=Le.bars,Be=Le.barsWithValue,Me=Le.xScale,Te=Le.yScale,We=Le.getLabel,Ie=Le.getTooltipLabel,Re=Le.getBorderColor,je=Le.getLabelColor,Pe=Le.shouldRenderBarLabel,Ee=Le.legendsWithData,Fe=d.useTooltip(),He=Fe.showTooltipFromEvent,Ae=Fe.hideTooltip,qe=t.useComputedAnnotations({annotations:t.useAnnotations({data:Ve,annotations:te,getPosition:function(e){return{x:e.x,y:e.y}},getDimensions:function(e){var a=e.width,t=e.height;return{width:a,height:t,size:Math.max(a,t)}}})}),De=o.useMemo((function(){return{borderRadius:U,borderWidth:$,enableLabel:X,isInteractive:le,labelSkipWidth:O,labelSkipHeight:z,onClick:se,onMouseEnter:ce,onMouseLeave:he,getTooltipLabel:Ie,tooltip:ue,margin:ye,innerWidth:Se,innerHeight:ke,width:h,height:v,bars:Ve,xScale:Me,yScale:Te}}),[U,$,X,Ie,v,ke,Se,le,z,O,ye,se,ce,he,Ve,Me,Te,ue,h]);o.useEffect((function(){var e,i=null==(e=me.current)?void 0:e.getContext("2d");me.current&&i&&(me.current.width=Ce*ge,me.current.height=we*ge,i.scale(ge,ge),i.fillStyle=pe.background,i.fillRect(0,0,Ce,we),i.translate(ye.left,ye.top),A.forEach((function(e){"grid"===e?"number"==typeof pe.grid.line.strokeWidth&&pe.grid.line.strokeWidth>0&&(i.lineWidth=pe.grid.line.strokeWidth,i.strokeStyle=pe.grid.line.stroke,R&&a.renderGridLinesToCanvas(i,{width:h,height:v,scale:Me,axis:"x",values:E}),P&&a.renderGridLinesToCanvas(i,{width:h,height:v,scale:Te,axis:"y",values:F})):"axes"===e?a.renderAxesToCanvas(i,{xScale:Me,yScale:Te,width:Se,height:ke,top:w,right:V,bottom:M,left:W,theme:pe}):"bars"===e?Be.forEach((function(e){D(i,{bar:e,borderColor:Re(e),borderRadius:U,borderWidth:$,label:We(e.data),labelColor:je(e),shouldRenderLabel:Pe(e)})})):"legends"===e?Ee.forEach((function(e){var a=e[0],t=e[1];n.renderLegendToCanvas(i,g({},a,{data:t,containerWidth:Se,containerHeight:ke,theme:pe}))})):"annotations"===e?t.renderAnnotationsToCanvas(i,{annotations:qe,theme:pe}):"function"==typeof e&&e(i,De)})),i.save())}),[M,W,V,w,Be,U,$,qe,R,P,Re,We,je,E,F,b,v,ke,Se,De,A,f,Ee,ye.left,ye.top,we,Ce,ge,D,Me,Te,m,Pe,pe,h]);var Xe=o.useCallback((function(e){if(Ve&&me.current){var a=r.getRelativeCursor(me.current,e),t=a[0],i=a[1],n=J(Ve,ye,t,i);void 0!==n?(He(o.createElement(ue,g({},n.data,{color:n.color,label:n.label,value:Number(n.data.value)})),e),"mouseenter"===e.type&&(null==ce||ce(n.data,e))):Ae()}}),[Ae,ye,ce,Ve,He,ue]),Ye=o.useCallback((function(e){if(Ve&&me.current){Ae();var a=r.getRelativeCursor(me.current,e),t=a[0],i=a[1],n=J(Ve,ye,t,i);n&&(null==he||he(n.data,e))}}),[Ae,ye,he,Ve]),Oe=o.useCallback((function(e){if(Ve&&me.current){var a=r.getRelativeCursor(me.current,e),t=a[0],i=a[1],n=J(Ve,ye,t,i);void 0!==n&&(null==se||se(g({},n.data,{color:n.color}),e))}}),[ye,se,Ve]);return i.jsx("canvas",{ref:function(e){me.current=e,fe&&"current"in fe&&(fe.current=e)},width:Ce*ge,height:we*ge,style:{width:Ce,height:we,cursor:le?"auto":"normal"},onMouseEnter:le?Xe:void 0,onMouseMove:le?Xe:void 0,onMouseLeave:le?Ye:void 0,onClick:le?Oe:void 0})},U=o.forwardRef((function(e,a){var t=e.isInteractive,n=e.renderWrapper,o=e.theme,l=f(e,_);return i.jsx(r.Container,{isInteractive:t,renderWrapper:n,theme:o,animate:!1,children:i.jsx(Q,g({},l,{canvasRef:a}))})})),Z=o.forwardRef((function(e,a){return i.jsx(r.ResponsiveWrapper,{children:function(t){var n=t.width,r=t.height;return i.jsx(U,g({width:n,height:r},e,{ref:a}))}})}));e.Bar=N,e.BarCanvas=U,e.BarItem=S,e.ResponsiveBar=function(e){return i.jsx(r.ResponsiveWrapper,{children:function(a){var t=a.width,n=a.height;return i.jsx(N,g({width:t,height:n},e))}})},e.ResponsiveBarCanvas=Z,e.canvasDefaultProps=L,e.defaultProps=C,e.svgDefaultProps=w,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=nivo-bar.umd.js.map |
{ | ||
"name": "@atlasinc/nivo-bar-ssr", | ||
"version": "0.79.2", | ||
"version": "0.79.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
379915
790