@undp/data-viz 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.js +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.js +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.js +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +92 -92
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.js +1 -1
- package/dist/{GraphEl-C2Fgg8PA.cjs → GraphEl-BixTEyKW.cjs} +2 -2
- package/dist/{GraphEl-C2Fgg8PA.cjs.map → GraphEl-BixTEyKW.cjs.map} +1 -1
- package/dist/{GraphEl-oZwZiTHI.js → GraphEl-Dyu_EIQb.js} +2 -2
- package/dist/{GraphEl-oZwZiTHI.js.map → GraphEl-Dyu_EIQb.js.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.js +2 -2
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.js +1 -1
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +2 -2
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.js +1 -1
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.js +2 -2
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
- package/dist/Spinner-CQZcjzwd.cjs +2 -0
- package/dist/Spinner-CQZcjzwd.cjs.map +1 -0
- package/dist/{Spinner-D7rnnwnA.js → Spinner-DVBnY6Vg.js} +5 -5
- package/dist/Spinner-DVBnY6Vg.js.map +1 -0
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.js +1 -1
- package/dist/{index-D1RrKgK6.js → index-R1gTfap5.js} +2 -2
- package/dist/{index-D1RrKgK6.js.map → index-R1gTfap5.js.map} +1 -1
- package/dist/{index-Blvf-Q3U.cjs → index-WML2dCZ0.cjs} +2 -2
- package/dist/{index-Blvf-Q3U.cjs.map → index-WML2dCZ0.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/Spinner-D7rnnwnA.js.map +0 -1
- package/dist/Spinner-DRMBUsX7.cjs +0 -2
- package/dist/Spinner-DRMBUsX7.cjs.map +0 -1
package/dist/BeeSwarmChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-CHPV5EwG-CTPQjnHt.cjs"),p=require("react"),Pe=require("./index-DQA8q5sC.cjs"),Xe=require("./index-Cno4Q0YE.cjs"),Ye=require("./Spinner-DRMBUsX7.cjs"),it=require("./Typography-DX7PlgQU.cjs"),He=require("./numberFormattingFunction-02t-wJta.cjs"),ze=require("./Tooltip-uUdw6wJL.cjs"),v=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),We=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),ve=require("./Colors.cjs"),Ze=require("./Axis-DxRV2yMi.cjs"),Je=require("./ReferenceLine-BH0qdf4R.cjs"),nt=require("./YTicksAndGridLines-4pxTRlRK.cjs"),st=require("./XTicksAndGridLines-B6CELS7q.cjs"),Ke=require("./DetailsModal-BN0HDFlV.cjs"),Qe=require("./pow-DgrUorRi.cjs"),_e=require("./linear-BwPAspcq.cjs"),se=require("./y-QcCbqrzx.cjs"),Be=require("./uniqBy-O05lp2S5.cjs"),rt=require("./GraphHeader.cjs"),Ge=require("./GraphContainer-d8A46BK2.cjs"),lt=require("./EmptyState-gLDRXBHm.cjs"),at=require("./ColorLegendWithMouseOver.cjs"),ct=require("./GraphFooter.cjs");function ut(t){const e=n.compilerRuntimeExports.c(28),{data:o,circleColors:j,showTicks:he,width:S,height:w,colorDomain:X,topMargin:C,bottomMargin:ee,leftMargin:te,rightMargin:re,suffix:h,prefix:T,showLabels:A,tooltip:Y,onSeriesMouseOver:le,refValues:D,selectedColor:g,startFromZero:$,radius:x,maxRadiusValue:H,maxValue:z,minValue:W,highlightedDataPoints:ge,onSeriesMouseClick:xe,resetSelectionOnDoubleClick:Z,detailsOnClick:V,styles:R,classNames:c,noOfTicks:y,dimmedOpacity:ae,precision:ce,customLayers:fe}=t,ue=C===void 0?25:C,I=ee===void 0?10:ee,oe=te===void 0?100:te,ie=re===void 0?40:re,pe=p.useRef(null),[de,F]=p.useState(void 0),[U,B]=p.useState(void 0),[me,u]=p.useState(null),[a,J]=p.useState(void 0),[K,Q]=p.useState(void 0);let L;e[0]!==I||e[1]!==oe||e[2]!==ie||e[3]!==ue?(L={top:ue,bottom:I,left:oe,right:ie},e[0]=I,e[1]=oe,e[2]=ie,e[3]=ue,e[4]=L):L=e[4];const d=L,m=S-d.left-d.right,ne=w-d.top-d.bottom,q=o.filter(Lt).length===0?o:Xe.orderBy(o.filter($t),"radius","desc");let _;e[5]!==o||e[6]!==z||e[7]!==$?(_=v.checkIfNullOrUndefined(z)?Math.max(...o.filter(Dt).map(wt))<0&&!$?0:Math.max(...o.filter(St).map(Nt)):z,e[5]=o,e[6]=z,e[7]=$,e[8]=_):_=e[8];const G=_;let P;e[9]!==o||e[10]!==W||e[11]!==$?(P=v.checkIfNullOrUndefined(W)?Math.min(...o.filter(Ct).map(kt))>=0&&!$?0:Math.min(...o.filter(Ot).map(Rt)):W,e[9]=o,e[10]=W,e[11]=$,e[12]=P):P=e[12];const f=P,r=o.filter(Et).length!==o.length?Qe.sqrt().domain([0,v.checkIfNullOrUndefined(H)?Math.max(...o.map(Mt).filter(bt)):H]).range([.25,x]).nice():void 0,l=_e.linear().domain([f,G]).range([ne,0]).nice(),b=l.ticks(y);p.useEffect(()=>{const s=q.map(jt).filter(yt);se.forceSimulation(s).force("y",se.forceY(i=>l(i.position)).strength(5)).force("x",se.forceX(i=>m/2).strength(1)).force("collide",se.forceCollide(i=>r?r(i.radius||0)+1:x+1)).force("charge",se.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{u(s)}).on("end",()=>{u(s)})},[o,x,ne,m,f,G,q,l,r]);const M=me?n.jsxRuntimeExports.jsx("svg",{width:`${S}px`,height:`${w}px`,viewBox:`0 0 ${S} ${w}`,direction:"ltr",ref:pe,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[he?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Ze.Axis,{y1:l(f<0?0:f),y2:l(f<0?0:f),x1:0-d.left,x2:m+d.right,label:He.numberFormattingFunction(f<0?0:f,"NA",ce,T,h),labelPos:{x:0-d.left,y:l(f<0?0:f),dx:0,dy:G<0?"1em":-5},classNames:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels},styles:{axis:R?.xAxis?.axis,label:R?.yAxis?.labels}}),n.jsxRuntimeExports.jsx(nt.YTicksAndGridLines,{values:b.filter(vt),y:b.filter(gt).map(s=>l(s)),x1:0-d.left,x2:m+d.right,styles:{gridLines:R?.yAxis?.gridLines,labels:R?.yAxis?.labels},classNames:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},suffix:h,prefix:T,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:ce})]}):null,fe.filter(ht).map(pt),me.map(s=>n.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${s.x},${s.y})`,opacity:g?s.color&&j[X.indexOf(s.color)]===g?1:ae:ge.length!==0?ge.indexOf(s.label)!==-1?.85:ae:.85,onMouseEnter:i=>{F(s),Q(i.clientY),J(i.clientX),le?.(s)},onMouseMove:i=>{F(s),Q(i.clientY),J(i.clientX)},onClick:()=>{(xe||V)&&(Pe.isEqual(U,s)&&Z?(B(void 0),xe?.(void 0)):(B(s),xe?.(s)))},onMouseLeave:()=>{F(void 0),J(void 0),Q(void 0),le?.(void 0)},children:[n.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:r?r(s.radius||0):x,fill:o.filter(ft).length===0?j[0]:s.color?j[X.indexOf(s.color)]:ve.Colors.gray}),(r?r(s.radius||0):x)>10&&A?n.jsxRuntimeExports.jsx("g",{children:n.jsxRuntimeExports.jsx("foreignObject",{y:0-(r?r(s.radius||0):x),x:0-(r?r(s.radius||0):x),width:2*(r?r(s.radius||0):x),height:2*(r?r(s.radius||0):x),children:n.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit py-0 px-1.5",children:A?n.jsxRuntimeExports.jsx("p",{className:n.mo("text-center leading-none m-0",c?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((r?r(s.radius||0):x)/4),10),Math.max(Math.round((r?r(s.radius||0):x)*12/`${s.label}`.length),10),20)}px`,hyphens:"auto",color:We.getTextColorBasedOnBgColor(o.filter(xt).length===0?j[0]:s.color?j[X.indexOf(s.color)]:ve.Colors.gray),...R?.graphObjectValues||{}},children:s.label}):null})})}):null]},s.label)),D?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:D.map((s,i)=>n.jsxRuntimeExports.jsx(Je.RefLineY,{text:s.text,color:s.color,y:l(s.value),x1:0-d.left,x2:m+d.right,classNames:s.classNames,styles:s.styles,isInView:!0},i))}):null,fe.filter(mt).map(dt)]})}):n.jsxRuntimeExports.jsx("div",{style:{width:`${S}px`,height:`${w}px`},children:n.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:n.jsxRuntimeExports.jsx(Ye.w,{})})});let N;e[13]!==c?.tooltip||e[14]!==a||e[15]!==K||e[16]!==de||e[17]!==R?.tooltip||e[18]!==Y?(N=de&&Y&&a&&K?n.jsxRuntimeExports.jsx(ze.Tooltip,{data:de,body:Y,xPos:a,yPos:K,backgroundStyle:R?.tooltip,className:c?.tooltip}):null,e[13]=c?.tooltip,e[14]=a,e[15]=K,e[16]=de,e[17]=R?.tooltip,e[18]=Y,e[19]=N):N=e[19];let O;e[20]!==c?.modal||e[21]!==V||e[22]!==U?(O=V&&U!==void 0?n.jsxRuntimeExports.jsx(Ke.DetailsModal,{body:V,data:U,setData:B,className:c?.modal}):null,e[20]=c?.modal,e[21]=V,e[22]=U,e[23]=O):O=e[23];let k;return e[24]!==M||e[25]!==N||e[26]!==O?(k=n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[M,N,O]}),e[24]=M,e[25]=N,e[26]=O,e[27]=k):k=e[27],k}function dt(t){return t.layer}function mt(t){return t.position==="after"}function xt(t){return t.color}function ft(t){return t.color}function pt(t){return t.layer}function ht(t){return t.position==="before"}function gt(t){return t!==0}function vt(t){return t!==0}function yt(t){return t.position}function jt(t){return{...t,...t.data&&{data:{...t.data}}}}function bt(t){return t!=null}function Mt(t){return t.radius}function Et(t){return t.radius===void 0||t.radius===null}function Rt(t){return t.position}function Ot(t){return!v.checkIfNullOrUndefined(t.position)}function kt(t){return t.position}function Ct(t){return!v.checkIfNullOrUndefined(t.position)}function Nt(t){return t.position}function St(t){return!v.checkIfNullOrUndefined(t.position)}function wt(t){return t.position}function Dt(t){return!v.checkIfNullOrUndefined(t.position)}function $t(t){return!v.checkIfNullOrUndefined(t.radius)}function Lt(t){return!v.checkIfNullOrUndefined(t.radius)}function qt(t){const e=n.compilerRuntimeExports.c(28),{data:o,circleColors:j,showTicks:he,width:S,height:w,colorDomain:X,topMargin:C,bottomMargin:ee,leftMargin:te,rightMargin:re,showLabels:h,tooltip:T,onSeriesMouseOver:A,refValues:Y,selectedColor:le,startFromZero:D,radius:g,maxRadiusValue:$,maxValue:x,minValue:H,highlightedDataPoints:z,onSeriesMouseClick:W,rtl:ge,resetSelectionOnDoubleClick:xe,detailsOnClick:Z,suffix:V,prefix:R,styles:c,classNames:y,noOfTicks:ae,dimmedOpacity:ce,precision:fe,customLayers:ue}=t,I=C===void 0?25:C,oe=ee===void 0?10:ee,ie=te===void 0?10:te,pe=re===void 0?10:re,de=p.useRef(null),[F,U]=p.useState(void 0),[B,me]=p.useState(void 0),[u,a]=p.useState(null),[J,K]=p.useState(void 0),[Q,L]=p.useState(void 0);let d;e[0]!==oe||e[1]!==ie||e[2]!==pe||e[3]!==I?(d={top:I,bottom:oe,left:ie,right:pe},e[0]=oe,e[1]=ie,e[2]=pe,e[3]=I,e[4]=d):d=e[4];const m=d,ne=S-m.left-m.right,q=w-m.top-m.bottom,_=o.filter(io).length===0?o:Xe.orderBy(o.filter(oo),"radius","desc");let G;e[5]!==o||e[6]!==x||e[7]!==D?(G=v.checkIfNullOrUndefined(x)?Math.max(...o.filter(to).map(eo))<0&&!D?0:Math.max(...o.filter(_t).map(Qt)):x,e[5]=o,e[6]=x,e[7]=D,e[8]=G):G=e[8];const P=G;let f;e[9]!==o||e[10]!==H||e[11]!==D?(f=v.checkIfNullOrUndefined(H)?Math.min(...o.filter(Kt).map(Jt))>=0&&!D?0:Math.min(...o.filter(Zt).map(Wt)):H,e[9]=o,e[10]=H,e[11]=D,e[12]=f):f=e[12];const r=f,l=o.filter(zt).length!==o.length?Qe.sqrt().domain([0,v.checkIfNullOrUndefined($)?Math.max(...o.map(Ht).filter(Yt)):$]).range([.25,g]).nice():void 0,b=_e.linear().domain([r,P]).range([0,ne]).nice(),M=b.ticks(ae);p.useEffect(()=>{const i=_.map(Xt).filter(Pt);se.forceSimulation(i).force("x",se.forceX(E=>b(E.position)).strength(5)).force("y",se.forceY(E=>q/2).strength(1)).force("collide",se.forceCollide(E=>l?l(E.radius||0)+1:g+1)).force("charge",se.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{a(i)}).on("end",()=>{a(i)})},[o,g,q,ne,r,P,_,b,l]);const N=u?n.jsxRuntimeExports.jsx("svg",{width:`${S}px`,height:`${w}px`,viewBox:`0 0 ${S} ${w}`,direction:"ltr",ref:de,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${m.left},${m.top})`,children:[he?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Ze.Axis,{x1:b(r<0?0:r),x2:b(r<0?0:r),y1:0-m.top,y2:q+m.bottom,label:He.numberFormattingFunction(r<0?0:r,"NA",fe,R,V),labelPos:{x:b(r<0?0:r),y:0-I,dy:"0.75em",dx:3},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),n.jsxRuntimeExports.jsx(st.XTicksAndGridLines,{values:M.filter(Gt),x:M.filter(Bt).map(i=>b(i)),y1:0-I,y2:q+m.bottom,styles:{gridLines:c?.xAxis?.gridLines,labels:c?.xAxis?.labels},classNames:{gridLines:y?.xAxis?.gridLines,labels:y?.xAxis?.labels},suffix:V,prefix:R,labelType:"secondary",showGridLines:!0,precision:fe})]}):null,ue.filter(Ut).map(Ft),u.map(i=>n.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${i.x},${i.y})`,opacity:le?i.color&&j[X.indexOf(i.color)]===le?1:ce:z.length!==0?z.indexOf(i.label)!==-1?.85:ce:.85,onMouseEnter:E=>{U(i),L(E.clientY),K(E.clientX),A?.(i)},onMouseMove:E=>{U(i),L(E.clientY),K(E.clientX)},onClick:()=>{(W||Z)&&(Pe.isEqual(B,i)&&xe?(me(void 0),W?.(void 0)):(me(i),W?.(i)))},onMouseLeave:()=>{U(void 0),K(void 0),L(void 0),A?.(void 0)},children:[n.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,fill:o.filter(It).length===0?j[0]:i.color?j[X.indexOf(i.color)]:ve.Colors.gray,radius:l?l(i.radius||0):g}),(l?l(i.radius||0):g)>10&&h?n.jsxRuntimeExports.jsx("g",{children:n.jsxRuntimeExports.jsx("foreignObject",{y:0-(l?l(i.radius||0):g),x:0-(l?l(i.radius||0):g),width:2*(l?l(i.radius||0):g),height:2*(l?l(i.radius||0):g),children:n.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5",children:h?n.jsxRuntimeExports.jsx(it.j,{className:n.mo("text-center leading-none m-0",y?.graphObjectValues),marginBottom:"none",style:{fontSize:`${Math.min(Math.max(Math.round((l?l(i.radius||0):g)/4),10),Math.max(Math.round((l?l(i.radius||0):g)*12/`${i.label}`.length),10),20)}px`,color:We.getTextColorBasedOnBgColor(o.filter(Vt).length===0?j[0]:i.color?j[X.indexOf(i.color)]:ve.Colors.gray),hyphens:"auto",...c?.graphObjectValues||{}},children:i.label}):null})})}):null]},i.label)),Y?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:Y.map((i,E)=>n.jsxRuntimeExports.jsx(Je.RefLineX,{text:i.text,color:i.color,x:b(i.value),y1:0-m.top,y2:q+m.bottom,textSide:b(i.value)>ne*.75||ge?"left":"right",classNames:i.classNames,styles:i.styles,isInView:!0},E))}):null,ue.filter(At).map(Tt)]})}):n.jsxRuntimeExports.jsx("div",{style:{width:`${S}px`,height:`${w}px`},children:n.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:n.jsxRuntimeExports.jsx(Ye.w,{})})});let O;e[13]!==y?.tooltip||e[14]!==J||e[15]!==Q||e[16]!==F||e[17]!==c?.tooltip||e[18]!==T?(O=F&&T&&J&&Q?n.jsxRuntimeExports.jsx(ze.Tooltip,{data:F,body:T,xPos:J,yPos:Q,backgroundStyle:c?.tooltip,className:y?.tooltip}):null,e[13]=y?.tooltip,e[14]=J,e[15]=Q,e[16]=F,e[17]=c?.tooltip,e[18]=T,e[19]=O):O=e[19];let k;e[20]!==y?.modal||e[21]!==Z||e[22]!==B?(k=Z&&B!==void 0?n.jsxRuntimeExports.jsx(Ke.DetailsModal,{body:Z,data:B,setData:me,className:y?.modal}):null,e[20]=y?.modal,e[21]=Z,e[22]=B,e[23]=k):k=e[23];let s;return e[24]!==N||e[25]!==O||e[26]!==k?(s=n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[N,O,k]}),e[24]=N,e[25]=O,e[26]=k,e[27]=s):s=e[27],s}function Tt(t){return t.layer}function At(t){return t.position==="after"}function Vt(t){return t.color}function It(t){return t.color}function Ft(t){return t.layer}function Ut(t){return t.position==="before"}function Bt(t){return t!==0}function Gt(t){return t!==0}function Pt(t){return t.position}function Xt(t){return{...t,...t.data&&{data:{...t.data}}}}function Yt(t){return t!=null}function Ht(t){return t.radius}function zt(t){return t.radius===void 0||t.radius===null}function Wt(t){return t.position}function Zt(t){return!v.checkIfNullOrUndefined(t.position)}function Jt(t){return t.position}function Kt(t){return!v.checkIfNullOrUndefined(t.position)}function Qt(t){return t.position}function _t(t){return!v.checkIfNullOrUndefined(t.position)}function eo(t){return t.position}function to(t){return!v.checkIfNullOrUndefined(t.position)}function oo(t){return!v.checkIfNullOrUndefined(t.radius)}function io(t){return!v.checkIfNullOrUndefined(t.radius)}function no(t){const e=n.compilerRuntimeExports.c(91),{data:o,graphTitle:j,topMargin:he,bottomMargin:S,leftMargin:w,rightMargin:X,colors:C,sources:ee,graphDescription:te,height:re,width:h,footNote:T,colorDomain:A,colorLegendTitle:Y,padding:le,relativeHeight:D,tooltip:g,onSeriesMouseOver:$,refValues:x,showColorScale:H,graphID:z,radius:W,showLabels:ge,showTicks:xe,maxRadiusValue:Z,maxValue:V,minValue:R,highlightedDataPoints:c,onSeriesMouseClick:y,ariaLabel:ae,backgroundColor:ce,graphDownload:fe,dataDownload:ue,language:I,showNAColor:oe,minHeight:ie,theme:pe,resetSelectionOnDoubleClick:de,detailsOnClick:F,orientation:U,suffix:B,prefix:me,styles:u,classNames:a,noOfTicks:J,dimmedOpacity:K,precision:Q,customLayers:L}=t,d=W===void 0?5:W,m=ge===void 0?!0:ge,ne=xe===void 0?!0:xe;let q;e[0]!==c?(q=c===void 0?[]:c,e[0]=c,e[1]=q):q=e[1];const _=q,G=ce===void 0?!1:ce,P=fe===void 0?!1:fe,f=ue===void 0?!1:ue,r=I===void 0?"en":I,l=oe===void 0?!0:oe,b=ie===void 0?0:ie,M=pe===void 0?"light":pe,N=de===void 0?!0:de,O=U===void 0?"vertical":U,k=B===void 0?"":B,s=me===void 0?"":me,i=J===void 0?5:J,E=K===void 0?.3:K,De=Q===void 0?2:Q;let Oe;e[2]!==L?(Oe=L===void 0?[]:L,e[2]=L,e[3]=Oe):Oe=e[3];const $e=Oe,[ke,et]=p.useState(0),[Ce,tt]=p.useState(0),[Le,ot]=p.useState(void 0),qe=p.useRef(null),Ie=p.useRef(null),Te=O==="horizontal"?qt:ut;let Ne,Se;e[4]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>{const Fe=new ResizeObserver(Ue=>{et(Ue[0].target.clientWidth||620),tt(Ue[0].target.clientHeight||480)});return qe.current&&Fe.observe(qe.current),()=>Fe.disconnect()},Se=[],e[4]=Ne,e[5]=Se):(Ne=e[4],Se=e[5]),p.useEffect(Ne,Se);const Ae=a?.graphContainer,Ve=u?.graphContainer;let ye;e[6]!==a?.description||e[7]!==a?.title||e[8]!==o||e[9]!==f||e[10]!==te||e[11]!==P||e[12]!==j||e[13]!==u?.description||e[14]!==u?.title||e[15]!==h?(ye=j||te||P||f?n.jsxRuntimeExports.jsx(rt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:a?.title,description:a?.description},graphTitle:j,graphDescription:te,width:h,graphDownload:P?Ie:void 0,dataDownload:f?o.map(xo).filter(mo).length>0?o.map(uo).filter(co):o.filter(ao):null}):null,e[6]=a?.description,e[7]=a?.title,e[8]=o,e[9]=f,e[10]=te,e[11]=P,e[12]=j,e[13]=u?.description,e[14]=u?.title,e[15]=h,e[16]=ye):ye=e[16];let je;e[17]!==a?.colorLegend||e[18]!==A||e[19]!==Y||e[20]!==C||e[21]!==o||e[22]!==H||e[23]!==l||e[24]!==M||e[25]!==h?(je=H!==!1&&o.filter(lo).length!==0&&o.length>0?n.jsxRuntimeExports.jsx(at.ColorLegendWithMouseOver,{width:h,colorLegendTitle:Y,colors:C||ve.Colors[M].categoricalColors.colors,colorDomain:A||Be.uniqBy(o,"color",!0),setSelectedColor:ot,showNAColor:l,className:a?.colorLegend}):null,e[17]=a?.colorLegend,e[18]=A,e[19]=Y,e[20]=C,e[21]=o,e[22]=H,e[23]=l,e[24]=M,e[25]=h,e[26]=je):je=e[26];let be;e[27]!==o.length?(be=o.length===0&&n.jsxRuntimeExports.jsx(lt.EmptyState,{}),e[27]=o.length,e[28]=be):be=e[28];let Me;e[29]!==Te||e[30]!==S||e[31]!==a||e[32]!==A||e[33]!==C||e[34]!==$e||e[35]!==o||e[36]!==F||e[37]!==E||e[38]!==_||e[39]!==w||e[40]!==Z||e[41]!==V||e[42]!==R||e[43]!==i||e[44]!==y||e[45]!==$||e[46]!==De||e[47]!==s||e[48]!==d||e[49]!==x||e[50]!==N||e[51]!==X||e[52]!==Le||e[53]!==m||e[54]!==ne||e[55]!==u||e[56]!==k||e[57]!==Ce||e[58]!==ke||e[59]!==M||e[60]!==g||e[61]!==he?(Me=ke&&Ce&&o.length>0?n.jsxRuntimeExports.jsx(Te,{data:o,circleColors:o.filter(ro).length===0?C?[C]:[ve.Colors.primaryColors["blue-600"]]:C||ve.Colors[M].categoricalColors.colors,colorDomain:o.filter(so).length===0?[]:A||Be.uniqBy(o,"color",!0),width:ke,selectedColor:Le,height:Ce,showTicks:ne,leftMargin:w,rightMargin:X,topMargin:he,bottomMargin:S,showLabels:m,tooltip:g,onSeriesMouseOver:$,refValues:x,startFromZero:!1,radius:d,maxRadiusValue:Z,maxValue:V,minValue:R,highlightedDataPoints:_,onSeriesMouseClick:y,resetSelectionOnDoubleClick:N,detailsOnClick:F,styles:u,classNames:a,suffix:k,prefix:s,noOfTicks:i||5,dimmedOpacity:E,precision:De,customLayers:$e}):null,e[29]=Te,e[30]=S,e[31]=a,e[32]=A,e[33]=C,e[34]=$e,e[35]=o,e[36]=F,e[37]=E,e[38]=_,e[39]=w,e[40]=Z,e[41]=V,e[42]=R,e[43]=i,e[44]=y,e[45]=$,e[46]=De,e[47]=s,e[48]=d,e[49]=x,e[50]=N,e[51]=X,e[52]=Le,e[53]=m,e[54]=ne,e[55]=u,e[56]=k,e[57]=Ce,e[58]=ke,e[59]=M,e[60]=g,e[61]=he,e[62]=Me):Me=e[62];let Ee;e[63]!==be||e[64]!==Me?(Ee=n.jsxRuntimeExports.jsxs(Ge.GraphArea,{ref:qe,children:[be,Me]}),e[63]=be,e[64]=Me,e[65]=Ee):Ee=e[65];let Re;e[66]!==a?.footnote||e[67]!==a?.source||e[68]!==T||e[69]!==ee||e[70]!==u?.footnote||e[71]!==u?.source||e[72]!==h?(Re=ee||T?n.jsxRuntimeExports.jsx(ct.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:a?.footnote,source:a?.source},sources:ee,footNote:T,width:h}):null,e[66]=a?.footnote,e[67]=a?.source,e[68]=T,e[69]=ee,e[70]=u?.footnote,e[71]=u?.source,e[72]=h,e[73]=Re):Re=e[73];let we;return e[74]!==ae||e[75]!==G||e[76]!==z||e[77]!==re||e[78]!==r||e[79]!==b||e[80]!==le||e[81]!==D||e[82]!==Ae||e[83]!==Ve||e[84]!==ye||e[85]!==je||e[86]!==Ee||e[87]!==Re||e[88]!==M||e[89]!==h?(we=n.jsxRuntimeExports.jsxs(Ge.GraphContainer,{className:Ae,style:Ve,id:z,ref:Ie,"aria-label":ae,backgroundColor:G,theme:M,language:r,minHeight:b,width:h,height:re,relativeHeight:D,padding:le,children:[ye,je,Ee,Re]}),e[74]=ae,e[75]=G,e[76]=z,e[77]=re,e[78]=r,e[79]=b,e[80]=le,e[81]=D,e[82]=Ae,e[83]=Ve,e[84]=ye,e[85]=je,e[86]=Ee,e[87]=Re,e[88]=M,e[89]=h,e[90]=we):we=e[90],we}function so(t){return t.color}function ro(t){return t.color}function lo(t){return t.color}function ao(t){return t!==void 0}function co(t){return t!==void 0}function uo(t){return t.data}function mo(t){return t!==void 0}function xo(t){return t.data}exports.BeeSwarmChart=no;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-CHPV5EwG-CTPQjnHt.cjs"),p=require("react"),Pe=require("./index-DQA8q5sC.cjs"),Xe=require("./index-Cno4Q0YE.cjs"),Ye=require("./Spinner-CQZcjzwd.cjs"),it=require("./Typography-DX7PlgQU.cjs"),He=require("./numberFormattingFunction-02t-wJta.cjs"),ze=require("./Tooltip-uUdw6wJL.cjs"),v=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),We=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),ve=require("./Colors.cjs"),Ze=require("./Axis-DxRV2yMi.cjs"),Je=require("./ReferenceLine-BH0qdf4R.cjs"),nt=require("./YTicksAndGridLines-4pxTRlRK.cjs"),st=require("./XTicksAndGridLines-B6CELS7q.cjs"),Ke=require("./DetailsModal-BN0HDFlV.cjs"),Qe=require("./pow-DgrUorRi.cjs"),_e=require("./linear-BwPAspcq.cjs"),se=require("./y-QcCbqrzx.cjs"),Be=require("./uniqBy-O05lp2S5.cjs"),rt=require("./GraphHeader.cjs"),Ge=require("./GraphContainer-d8A46BK2.cjs"),lt=require("./EmptyState-gLDRXBHm.cjs"),at=require("./ColorLegendWithMouseOver.cjs"),ct=require("./GraphFooter.cjs");function ut(t){const e=n.compilerRuntimeExports.c(28),{data:o,circleColors:j,showTicks:he,width:S,height:w,colorDomain:X,topMargin:C,bottomMargin:ee,leftMargin:te,rightMargin:re,suffix:h,prefix:T,showLabels:A,tooltip:Y,onSeriesMouseOver:le,refValues:D,selectedColor:g,startFromZero:$,radius:x,maxRadiusValue:H,maxValue:z,minValue:W,highlightedDataPoints:ge,onSeriesMouseClick:xe,resetSelectionOnDoubleClick:Z,detailsOnClick:V,styles:R,classNames:c,noOfTicks:y,dimmedOpacity:ae,precision:ce,customLayers:fe}=t,ue=C===void 0?25:C,I=ee===void 0?10:ee,oe=te===void 0?100:te,ie=re===void 0?40:re,pe=p.useRef(null),[de,F]=p.useState(void 0),[U,B]=p.useState(void 0),[me,u]=p.useState(null),[a,J]=p.useState(void 0),[K,Q]=p.useState(void 0);let L;e[0]!==I||e[1]!==oe||e[2]!==ie||e[3]!==ue?(L={top:ue,bottom:I,left:oe,right:ie},e[0]=I,e[1]=oe,e[2]=ie,e[3]=ue,e[4]=L):L=e[4];const d=L,m=S-d.left-d.right,ne=w-d.top-d.bottom,q=o.filter(Lt).length===0?o:Xe.orderBy(o.filter($t),"radius","desc");let _;e[5]!==o||e[6]!==z||e[7]!==$?(_=v.checkIfNullOrUndefined(z)?Math.max(...o.filter(Dt).map(wt))<0&&!$?0:Math.max(...o.filter(St).map(Nt)):z,e[5]=o,e[6]=z,e[7]=$,e[8]=_):_=e[8];const G=_;let P;e[9]!==o||e[10]!==W||e[11]!==$?(P=v.checkIfNullOrUndefined(W)?Math.min(...o.filter(Ct).map(kt))>=0&&!$?0:Math.min(...o.filter(Ot).map(Rt)):W,e[9]=o,e[10]=W,e[11]=$,e[12]=P):P=e[12];const f=P,r=o.filter(Et).length!==o.length?Qe.sqrt().domain([0,v.checkIfNullOrUndefined(H)?Math.max(...o.map(Mt).filter(bt)):H]).range([.25,x]).nice():void 0,l=_e.linear().domain([f,G]).range([ne,0]).nice(),b=l.ticks(y);p.useEffect(()=>{const s=q.map(jt).filter(yt);se.forceSimulation(s).force("y",se.forceY(i=>l(i.position)).strength(5)).force("x",se.forceX(i=>m/2).strength(1)).force("collide",se.forceCollide(i=>r?r(i.radius||0)+1:x+1)).force("charge",se.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{u(s)}).on("end",()=>{u(s)})},[o,x,ne,m,f,G,q,l,r]);const M=me?n.jsxRuntimeExports.jsx("svg",{width:`${S}px`,height:`${w}px`,viewBox:`0 0 ${S} ${w}`,direction:"ltr",ref:pe,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[he?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Ze.Axis,{y1:l(f<0?0:f),y2:l(f<0?0:f),x1:0-d.left,x2:m+d.right,label:He.numberFormattingFunction(f<0?0:f,"NA",ce,T,h),labelPos:{x:0-d.left,y:l(f<0?0:f),dx:0,dy:G<0?"1em":-5},classNames:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels},styles:{axis:R?.xAxis?.axis,label:R?.yAxis?.labels}}),n.jsxRuntimeExports.jsx(nt.YTicksAndGridLines,{values:b.filter(vt),y:b.filter(gt).map(s=>l(s)),x1:0-d.left,x2:m+d.right,styles:{gridLines:R?.yAxis?.gridLines,labels:R?.yAxis?.labels},classNames:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},suffix:h,prefix:T,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:ce})]}):null,fe.filter(ht).map(pt),me.map(s=>n.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${s.x},${s.y})`,opacity:g?s.color&&j[X.indexOf(s.color)]===g?1:ae:ge.length!==0?ge.indexOf(s.label)!==-1?.85:ae:.85,onMouseEnter:i=>{F(s),Q(i.clientY),J(i.clientX),le?.(s)},onMouseMove:i=>{F(s),Q(i.clientY),J(i.clientX)},onClick:()=>{(xe||V)&&(Pe.isEqual(U,s)&&Z?(B(void 0),xe?.(void 0)):(B(s),xe?.(s)))},onMouseLeave:()=>{F(void 0),J(void 0),Q(void 0),le?.(void 0)},children:[n.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:r?r(s.radius||0):x,fill:o.filter(ft).length===0?j[0]:s.color?j[X.indexOf(s.color)]:ve.Colors.gray}),(r?r(s.radius||0):x)>10&&A?n.jsxRuntimeExports.jsx("g",{children:n.jsxRuntimeExports.jsx("foreignObject",{y:0-(r?r(s.radius||0):x),x:0-(r?r(s.radius||0):x),width:2*(r?r(s.radius||0):x),height:2*(r?r(s.radius||0):x),children:n.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit py-0 px-1.5",children:A?n.jsxRuntimeExports.jsx("p",{className:n.mo("text-center leading-none m-0",c?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((r?r(s.radius||0):x)/4),10),Math.max(Math.round((r?r(s.radius||0):x)*12/`${s.label}`.length),10),20)}px`,hyphens:"auto",color:We.getTextColorBasedOnBgColor(o.filter(xt).length===0?j[0]:s.color?j[X.indexOf(s.color)]:ve.Colors.gray),...R?.graphObjectValues||{}},children:s.label}):null})})}):null]},s.label)),D?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:D.map((s,i)=>n.jsxRuntimeExports.jsx(Je.RefLineY,{text:s.text,color:s.color,y:l(s.value),x1:0-d.left,x2:m+d.right,classNames:s.classNames,styles:s.styles,isInView:!0},i))}):null,fe.filter(mt).map(dt)]})}):n.jsxRuntimeExports.jsx("div",{style:{width:`${S}px`,height:`${w}px`},children:n.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:n.jsxRuntimeExports.jsx(Ye.w,{})})});let N;e[13]!==c?.tooltip||e[14]!==a||e[15]!==K||e[16]!==de||e[17]!==R?.tooltip||e[18]!==Y?(N=de&&Y&&a&&K?n.jsxRuntimeExports.jsx(ze.Tooltip,{data:de,body:Y,xPos:a,yPos:K,backgroundStyle:R?.tooltip,className:c?.tooltip}):null,e[13]=c?.tooltip,e[14]=a,e[15]=K,e[16]=de,e[17]=R?.tooltip,e[18]=Y,e[19]=N):N=e[19];let O;e[20]!==c?.modal||e[21]!==V||e[22]!==U?(O=V&&U!==void 0?n.jsxRuntimeExports.jsx(Ke.DetailsModal,{body:V,data:U,setData:B,className:c?.modal}):null,e[20]=c?.modal,e[21]=V,e[22]=U,e[23]=O):O=e[23];let k;return e[24]!==M||e[25]!==N||e[26]!==O?(k=n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[M,N,O]}),e[24]=M,e[25]=N,e[26]=O,e[27]=k):k=e[27],k}function dt(t){return t.layer}function mt(t){return t.position==="after"}function xt(t){return t.color}function ft(t){return t.color}function pt(t){return t.layer}function ht(t){return t.position==="before"}function gt(t){return t!==0}function vt(t){return t!==0}function yt(t){return t.position}function jt(t){return{...t,...t.data&&{data:{...t.data}}}}function bt(t){return t!=null}function Mt(t){return t.radius}function Et(t){return t.radius===void 0||t.radius===null}function Rt(t){return t.position}function Ot(t){return!v.checkIfNullOrUndefined(t.position)}function kt(t){return t.position}function Ct(t){return!v.checkIfNullOrUndefined(t.position)}function Nt(t){return t.position}function St(t){return!v.checkIfNullOrUndefined(t.position)}function wt(t){return t.position}function Dt(t){return!v.checkIfNullOrUndefined(t.position)}function $t(t){return!v.checkIfNullOrUndefined(t.radius)}function Lt(t){return!v.checkIfNullOrUndefined(t.radius)}function qt(t){const e=n.compilerRuntimeExports.c(28),{data:o,circleColors:j,showTicks:he,width:S,height:w,colorDomain:X,topMargin:C,bottomMargin:ee,leftMargin:te,rightMargin:re,showLabels:h,tooltip:T,onSeriesMouseOver:A,refValues:Y,selectedColor:le,startFromZero:D,radius:g,maxRadiusValue:$,maxValue:x,minValue:H,highlightedDataPoints:z,onSeriesMouseClick:W,rtl:ge,resetSelectionOnDoubleClick:xe,detailsOnClick:Z,suffix:V,prefix:R,styles:c,classNames:y,noOfTicks:ae,dimmedOpacity:ce,precision:fe,customLayers:ue}=t,I=C===void 0?25:C,oe=ee===void 0?10:ee,ie=te===void 0?10:te,pe=re===void 0?10:re,de=p.useRef(null),[F,U]=p.useState(void 0),[B,me]=p.useState(void 0),[u,a]=p.useState(null),[J,K]=p.useState(void 0),[Q,L]=p.useState(void 0);let d;e[0]!==oe||e[1]!==ie||e[2]!==pe||e[3]!==I?(d={top:I,bottom:oe,left:ie,right:pe},e[0]=oe,e[1]=ie,e[2]=pe,e[3]=I,e[4]=d):d=e[4];const m=d,ne=S-m.left-m.right,q=w-m.top-m.bottom,_=o.filter(io).length===0?o:Xe.orderBy(o.filter(oo),"radius","desc");let G;e[5]!==o||e[6]!==x||e[7]!==D?(G=v.checkIfNullOrUndefined(x)?Math.max(...o.filter(to).map(eo))<0&&!D?0:Math.max(...o.filter(_t).map(Qt)):x,e[5]=o,e[6]=x,e[7]=D,e[8]=G):G=e[8];const P=G;let f;e[9]!==o||e[10]!==H||e[11]!==D?(f=v.checkIfNullOrUndefined(H)?Math.min(...o.filter(Kt).map(Jt))>=0&&!D?0:Math.min(...o.filter(Zt).map(Wt)):H,e[9]=o,e[10]=H,e[11]=D,e[12]=f):f=e[12];const r=f,l=o.filter(zt).length!==o.length?Qe.sqrt().domain([0,v.checkIfNullOrUndefined($)?Math.max(...o.map(Ht).filter(Yt)):$]).range([.25,g]).nice():void 0,b=_e.linear().domain([r,P]).range([0,ne]).nice(),M=b.ticks(ae);p.useEffect(()=>{const i=_.map(Xt).filter(Pt);se.forceSimulation(i).force("x",se.forceX(E=>b(E.position)).strength(5)).force("y",se.forceY(E=>q/2).strength(1)).force("collide",se.forceCollide(E=>l?l(E.radius||0)+1:g+1)).force("charge",se.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{a(i)}).on("end",()=>{a(i)})},[o,g,q,ne,r,P,_,b,l]);const N=u?n.jsxRuntimeExports.jsx("svg",{width:`${S}px`,height:`${w}px`,viewBox:`0 0 ${S} ${w}`,direction:"ltr",ref:de,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${m.left},${m.top})`,children:[he?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Ze.Axis,{x1:b(r<0?0:r),x2:b(r<0?0:r),y1:0-m.top,y2:q+m.bottom,label:He.numberFormattingFunction(r<0?0:r,"NA",fe,R,V),labelPos:{x:b(r<0?0:r),y:0-I,dy:"0.75em",dx:3},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),n.jsxRuntimeExports.jsx(st.XTicksAndGridLines,{values:M.filter(Gt),x:M.filter(Bt).map(i=>b(i)),y1:0-I,y2:q+m.bottom,styles:{gridLines:c?.xAxis?.gridLines,labels:c?.xAxis?.labels},classNames:{gridLines:y?.xAxis?.gridLines,labels:y?.xAxis?.labels},suffix:V,prefix:R,labelType:"secondary",showGridLines:!0,precision:fe})]}):null,ue.filter(Ut).map(Ft),u.map(i=>n.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${i.x},${i.y})`,opacity:le?i.color&&j[X.indexOf(i.color)]===le?1:ce:z.length!==0?z.indexOf(i.label)!==-1?.85:ce:.85,onMouseEnter:E=>{U(i),L(E.clientY),K(E.clientX),A?.(i)},onMouseMove:E=>{U(i),L(E.clientY),K(E.clientX)},onClick:()=>{(W||Z)&&(Pe.isEqual(B,i)&&xe?(me(void 0),W?.(void 0)):(me(i),W?.(i)))},onMouseLeave:()=>{U(void 0),K(void 0),L(void 0),A?.(void 0)},children:[n.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,fill:o.filter(It).length===0?j[0]:i.color?j[X.indexOf(i.color)]:ve.Colors.gray,radius:l?l(i.radius||0):g}),(l?l(i.radius||0):g)>10&&h?n.jsxRuntimeExports.jsx("g",{children:n.jsxRuntimeExports.jsx("foreignObject",{y:0-(l?l(i.radius||0):g),x:0-(l?l(i.radius||0):g),width:2*(l?l(i.radius||0):g),height:2*(l?l(i.radius||0):g),children:n.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5",children:h?n.jsxRuntimeExports.jsx(it.j,{className:n.mo("text-center leading-none m-0",y?.graphObjectValues),marginBottom:"none",style:{fontSize:`${Math.min(Math.max(Math.round((l?l(i.radius||0):g)/4),10),Math.max(Math.round((l?l(i.radius||0):g)*12/`${i.label}`.length),10),20)}px`,color:We.getTextColorBasedOnBgColor(o.filter(Vt).length===0?j[0]:i.color?j[X.indexOf(i.color)]:ve.Colors.gray),hyphens:"auto",...c?.graphObjectValues||{}},children:i.label}):null})})}):null]},i.label)),Y?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:Y.map((i,E)=>n.jsxRuntimeExports.jsx(Je.RefLineX,{text:i.text,color:i.color,x:b(i.value),y1:0-m.top,y2:q+m.bottom,textSide:b(i.value)>ne*.75||ge?"left":"right",classNames:i.classNames,styles:i.styles,isInView:!0},E))}):null,ue.filter(At).map(Tt)]})}):n.jsxRuntimeExports.jsx("div",{style:{width:`${S}px`,height:`${w}px`},children:n.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:n.jsxRuntimeExports.jsx(Ye.w,{})})});let O;e[13]!==y?.tooltip||e[14]!==J||e[15]!==Q||e[16]!==F||e[17]!==c?.tooltip||e[18]!==T?(O=F&&T&&J&&Q?n.jsxRuntimeExports.jsx(ze.Tooltip,{data:F,body:T,xPos:J,yPos:Q,backgroundStyle:c?.tooltip,className:y?.tooltip}):null,e[13]=y?.tooltip,e[14]=J,e[15]=Q,e[16]=F,e[17]=c?.tooltip,e[18]=T,e[19]=O):O=e[19];let k;e[20]!==y?.modal||e[21]!==Z||e[22]!==B?(k=Z&&B!==void 0?n.jsxRuntimeExports.jsx(Ke.DetailsModal,{body:Z,data:B,setData:me,className:y?.modal}):null,e[20]=y?.modal,e[21]=Z,e[22]=B,e[23]=k):k=e[23];let s;return e[24]!==N||e[25]!==O||e[26]!==k?(s=n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[N,O,k]}),e[24]=N,e[25]=O,e[26]=k,e[27]=s):s=e[27],s}function Tt(t){return t.layer}function At(t){return t.position==="after"}function Vt(t){return t.color}function It(t){return t.color}function Ft(t){return t.layer}function Ut(t){return t.position==="before"}function Bt(t){return t!==0}function Gt(t){return t!==0}function Pt(t){return t.position}function Xt(t){return{...t,...t.data&&{data:{...t.data}}}}function Yt(t){return t!=null}function Ht(t){return t.radius}function zt(t){return t.radius===void 0||t.radius===null}function Wt(t){return t.position}function Zt(t){return!v.checkIfNullOrUndefined(t.position)}function Jt(t){return t.position}function Kt(t){return!v.checkIfNullOrUndefined(t.position)}function Qt(t){return t.position}function _t(t){return!v.checkIfNullOrUndefined(t.position)}function eo(t){return t.position}function to(t){return!v.checkIfNullOrUndefined(t.position)}function oo(t){return!v.checkIfNullOrUndefined(t.radius)}function io(t){return!v.checkIfNullOrUndefined(t.radius)}function no(t){const e=n.compilerRuntimeExports.c(91),{data:o,graphTitle:j,topMargin:he,bottomMargin:S,leftMargin:w,rightMargin:X,colors:C,sources:ee,graphDescription:te,height:re,width:h,footNote:T,colorDomain:A,colorLegendTitle:Y,padding:le,relativeHeight:D,tooltip:g,onSeriesMouseOver:$,refValues:x,showColorScale:H,graphID:z,radius:W,showLabels:ge,showTicks:xe,maxRadiusValue:Z,maxValue:V,minValue:R,highlightedDataPoints:c,onSeriesMouseClick:y,ariaLabel:ae,backgroundColor:ce,graphDownload:fe,dataDownload:ue,language:I,showNAColor:oe,minHeight:ie,theme:pe,resetSelectionOnDoubleClick:de,detailsOnClick:F,orientation:U,suffix:B,prefix:me,styles:u,classNames:a,noOfTicks:J,dimmedOpacity:K,precision:Q,customLayers:L}=t,d=W===void 0?5:W,m=ge===void 0?!0:ge,ne=xe===void 0?!0:xe;let q;e[0]!==c?(q=c===void 0?[]:c,e[0]=c,e[1]=q):q=e[1];const _=q,G=ce===void 0?!1:ce,P=fe===void 0?!1:fe,f=ue===void 0?!1:ue,r=I===void 0?"en":I,l=oe===void 0?!0:oe,b=ie===void 0?0:ie,M=pe===void 0?"light":pe,N=de===void 0?!0:de,O=U===void 0?"vertical":U,k=B===void 0?"":B,s=me===void 0?"":me,i=J===void 0?5:J,E=K===void 0?.3:K,De=Q===void 0?2:Q;let Oe;e[2]!==L?(Oe=L===void 0?[]:L,e[2]=L,e[3]=Oe):Oe=e[3];const $e=Oe,[ke,et]=p.useState(0),[Ce,tt]=p.useState(0),[Le,ot]=p.useState(void 0),qe=p.useRef(null),Ie=p.useRef(null),Te=O==="horizontal"?qt:ut;let Ne,Se;e[4]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>{const Fe=new ResizeObserver(Ue=>{et(Ue[0].target.clientWidth||620),tt(Ue[0].target.clientHeight||480)});return qe.current&&Fe.observe(qe.current),()=>Fe.disconnect()},Se=[],e[4]=Ne,e[5]=Se):(Ne=e[4],Se=e[5]),p.useEffect(Ne,Se);const Ae=a?.graphContainer,Ve=u?.graphContainer;let ye;e[6]!==a?.description||e[7]!==a?.title||e[8]!==o||e[9]!==f||e[10]!==te||e[11]!==P||e[12]!==j||e[13]!==u?.description||e[14]!==u?.title||e[15]!==h?(ye=j||te||P||f?n.jsxRuntimeExports.jsx(rt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:a?.title,description:a?.description},graphTitle:j,graphDescription:te,width:h,graphDownload:P?Ie:void 0,dataDownload:f?o.map(xo).filter(mo).length>0?o.map(uo).filter(co):o.filter(ao):null}):null,e[6]=a?.description,e[7]=a?.title,e[8]=o,e[9]=f,e[10]=te,e[11]=P,e[12]=j,e[13]=u?.description,e[14]=u?.title,e[15]=h,e[16]=ye):ye=e[16];let je;e[17]!==a?.colorLegend||e[18]!==A||e[19]!==Y||e[20]!==C||e[21]!==o||e[22]!==H||e[23]!==l||e[24]!==M||e[25]!==h?(je=H!==!1&&o.filter(lo).length!==0&&o.length>0?n.jsxRuntimeExports.jsx(at.ColorLegendWithMouseOver,{width:h,colorLegendTitle:Y,colors:C||ve.Colors[M].categoricalColors.colors,colorDomain:A||Be.uniqBy(o,"color",!0),setSelectedColor:ot,showNAColor:l,className:a?.colorLegend}):null,e[17]=a?.colorLegend,e[18]=A,e[19]=Y,e[20]=C,e[21]=o,e[22]=H,e[23]=l,e[24]=M,e[25]=h,e[26]=je):je=e[26];let be;e[27]!==o.length?(be=o.length===0&&n.jsxRuntimeExports.jsx(lt.EmptyState,{}),e[27]=o.length,e[28]=be):be=e[28];let Me;e[29]!==Te||e[30]!==S||e[31]!==a||e[32]!==A||e[33]!==C||e[34]!==$e||e[35]!==o||e[36]!==F||e[37]!==E||e[38]!==_||e[39]!==w||e[40]!==Z||e[41]!==V||e[42]!==R||e[43]!==i||e[44]!==y||e[45]!==$||e[46]!==De||e[47]!==s||e[48]!==d||e[49]!==x||e[50]!==N||e[51]!==X||e[52]!==Le||e[53]!==m||e[54]!==ne||e[55]!==u||e[56]!==k||e[57]!==Ce||e[58]!==ke||e[59]!==M||e[60]!==g||e[61]!==he?(Me=ke&&Ce&&o.length>0?n.jsxRuntimeExports.jsx(Te,{data:o,circleColors:o.filter(ro).length===0?C?[C]:[ve.Colors.primaryColors["blue-600"]]:C||ve.Colors[M].categoricalColors.colors,colorDomain:o.filter(so).length===0?[]:A||Be.uniqBy(o,"color",!0),width:ke,selectedColor:Le,height:Ce,showTicks:ne,leftMargin:w,rightMargin:X,topMargin:he,bottomMargin:S,showLabels:m,tooltip:g,onSeriesMouseOver:$,refValues:x,startFromZero:!1,radius:d,maxRadiusValue:Z,maxValue:V,minValue:R,highlightedDataPoints:_,onSeriesMouseClick:y,resetSelectionOnDoubleClick:N,detailsOnClick:F,styles:u,classNames:a,suffix:k,prefix:s,noOfTicks:i||5,dimmedOpacity:E,precision:De,customLayers:$e}):null,e[29]=Te,e[30]=S,e[31]=a,e[32]=A,e[33]=C,e[34]=$e,e[35]=o,e[36]=F,e[37]=E,e[38]=_,e[39]=w,e[40]=Z,e[41]=V,e[42]=R,e[43]=i,e[44]=y,e[45]=$,e[46]=De,e[47]=s,e[48]=d,e[49]=x,e[50]=N,e[51]=X,e[52]=Le,e[53]=m,e[54]=ne,e[55]=u,e[56]=k,e[57]=Ce,e[58]=ke,e[59]=M,e[60]=g,e[61]=he,e[62]=Me):Me=e[62];let Ee;e[63]!==be||e[64]!==Me?(Ee=n.jsxRuntimeExports.jsxs(Ge.GraphArea,{ref:qe,children:[be,Me]}),e[63]=be,e[64]=Me,e[65]=Ee):Ee=e[65];let Re;e[66]!==a?.footnote||e[67]!==a?.source||e[68]!==T||e[69]!==ee||e[70]!==u?.footnote||e[71]!==u?.source||e[72]!==h?(Re=ee||T?n.jsxRuntimeExports.jsx(ct.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:a?.footnote,source:a?.source},sources:ee,footNote:T,width:h}):null,e[66]=a?.footnote,e[67]=a?.source,e[68]=T,e[69]=ee,e[70]=u?.footnote,e[71]=u?.source,e[72]=h,e[73]=Re):Re=e[73];let we;return e[74]!==ae||e[75]!==G||e[76]!==z||e[77]!==re||e[78]!==r||e[79]!==b||e[80]!==le||e[81]!==D||e[82]!==Ae||e[83]!==Ve||e[84]!==ye||e[85]!==je||e[86]!==Ee||e[87]!==Re||e[88]!==M||e[89]!==h?(we=n.jsxRuntimeExports.jsxs(Ge.GraphContainer,{className:Ae,style:Ve,id:z,ref:Ie,"aria-label":ae,backgroundColor:G,theme:M,language:r,minHeight:b,width:h,height:re,relativeHeight:D,padding:le,children:[ye,je,Ee,Re]}),e[74]=ae,e[75]=G,e[76]=z,e[77]=re,e[78]=r,e[79]=b,e[80]=le,e[81]=D,e[82]=Ae,e[83]=Ve,e[84]=ye,e[85]=je,e[86]=Ee,e[87]=Re,e[88]=M,e[89]=h,e[90]=we):we=e[90],we}function so(t){return t.color}function ro(t){return t.color}function lo(t){return t.color}function ao(t){return t!==void 0}function co(t){return t!==void 0}function uo(t){return t.data}function mo(t){return t!==void 0}function xo(t){return t.data}exports.BeeSwarmChart=no;
|
|
2
2
|
//# sourceMappingURL=BeeSwarmChart.cjs.map
|
package/dist/BeeSwarmChart.js
CHANGED
|
@@ -2,7 +2,7 @@ import { c as Rt, j as n, m as zt } from "./index-CHPV5EwG-Curnpaqc.js";
|
|
|
2
2
|
import { useRef as Lt, useState as T, useEffect as Xt } from "react";
|
|
3
3
|
import { i as Wt } from "./index-Bwrro8-q.js";
|
|
4
4
|
import { o as It } from "./index-BZQYSqar.js";
|
|
5
|
-
import { w as qt } from "./Spinner-
|
|
5
|
+
import { w as qt } from "./Spinner-DVBnY6Vg.js";
|
|
6
6
|
import { j as ce } from "./Typography-PxtFcnJb.js";
|
|
7
7
|
import { n as Zt } from "./numberFormattingFunction-14YCbkN2.js";
|
|
8
8
|
import { T as Ut } from "./Tooltip-Dj5eVppQ.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),p=require("react"),mt=require("./getSliderMarks-BmADcPQt.cjs"),kt=require("./Spinner-DRMBUsX7.cjs"),ut=require("./parse-hMnG_lRV.cjs"),wt=require("./index-DQA8q5sC.cjs"),Q=require("./zoom-DPw8bba-.cjs"),Ct=require("./index-DxXnJ8Ti.cjs"),pt=require("./Typography-DX7PlgQU.cjs"),ht=require("./numberFormattingFunction-02t-wJta.cjs"),Rt=require("./Tooltip-uUdw6wJL.cjs"),xt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ct=require("./index-DRXx7m-C.cjs"),St=require("./DetailsModal-BN0HDFlV.cjs"),st=require("./select-Bnfk0lJx.cjs"),gt=require("./threshold-DNsSUf8Q.cjs"),$t=require("./use-in-view-QcfiW0w3.cjs"),qe=require("./proxy-BxvUI_9l.cjs"),Dt=require("./index-DG2bgAva.cjs"),Nt=require("./GraphHeader.cjs"),Mt=require("./GraphFooter.cjs"),lt=require("./Colors.cjs"),Ot=require("./fetchAndParseData-l5HGMAEs.cjs"),yt=require("./getJenks-GYmdwBqm.cjs"),ft=require("./GraphContainer-d8A46BK2.cjs");function qt(d){const{data:e,xDomain:f,mapData:w,xColorLegendTitle:Pe,yDomain:ee,yColorLegendTitle:te,width:k,height:b,colors:E,scale:Ie,centerPoint:R,mapBorderWidth:$,mapNoDataColor:F,mapBorderColor:ge,tooltip:oe,onSeriesMouseOver:ye,zoomScaleExtend:fe,zoomTranslateExtend:ve,highlightedIds:U,onSeriesMouseClick:re,mapProperty:X,resetSelectionOnDoubleClick:Le,detailsOnClick:C,showColorScale:je,styles:ze,classNames:A,mapProjection:B,zoomInteraction:M,animate:S,dimmedOpacity:O,customLayers:ne,collapseColorScaleByDefault:be}=d,[We,Ee]=p.useState(be===void 0?!(k<680):!be),[Y,ke]=p.useState(void 0),[ae,ie]=p.useState(void 0),[T,se]=p.useState(void 0),[le,h]=p.useState(void 0),[g,J]=p.useState(void 0),V=p.useRef(null),ce=$t.useInView(V,{once:S.once,amount:S.amount}),we=p.useRef(null),G=p.useRef(null);p.useEffect(()=>{const t=st.select(we.current),i=st.select(V.current),v=r=>{if(M==="noZoom")return!1;if(M==="button")return!r.type.includes("wheel");const n=r.type==="wheel",l=r.type.startsWith("touch"),a=r.type==="mousedown"||r.type==="mousemove";return l?!0:n?M==="scroll"?!0:r.ctrlKey:a&&!r.button&&!r.ctrlKey},s=Q.zoom().scaleExtent(fe).translateExtent(ve||[[-20,-20],[k+20,b+20]]).filter(v).on("zoom",({transform:r})=>{t.attr("transform",r)});i.call(s),G.current=s},[b,k,M]);const q=Q.turf_bbox_default(w),P=Ct.turf_center_of_mass_default(w),D=q[2]-q[0],I=q[3]-q[1],de=k*190/960*360/D,Ce=b*190/678*180/I,L=Ie*Math.min(de,Ce),N=B==="mercator"?Q.geoMercator().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="equalEarth"?Q.geoEqualEarth().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="naturalEarth"?Q.geoNaturalEarth1().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="orthographic"?Q.geoOrthographic().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):Q.geoAlbersUsa().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L),Re=Array.from({length:f.length},(t,i)=>i),Se=Array.from({length:ee.length},(t,i)=>i),$e=gt.threshold().domain(f).range(Re),De=gt.threshold().domain(ee).range(Se),K=t=>{if(!V.current||!G.current)return;st.select(V.current).call(G.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(qe.motion.svg,{viewBox:`0 0 ${k} ${b}`,width:`${k}px`,height:`${b}px`,ref:V,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:we,children:[ne.filter(t=>t.position==="before").map(t=>t.layer),w.features.map((t,i)=>e.findIndex(s=>s.id===t.properties[X])!==-1?null:o.jsxRuntimeExports.jsx(qe.motion.g,{opacity:Y?O:U.length!==0?U.indexOf(t.properties[X])!==-1?1:O:1,children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((s,r)=>{let n="";return s.forEach(l=>{let a=" M";l.forEach((y,j)=>{const m=N([y[0],y[1]]);j!==l.length-1?a=`${a}${m[0]} ${m[1]}L`:a=`${a}${m[0]} ${m[1]}`}),n+=a}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ge,strokeWidth:$,fill:F}},r)}):t.geometry.coordinates.map((s,r)=>{let n="M";return s.forEach((l,a)=>{const y=N([l[0],l[1]]);a!==s.length-1?n=`${n}${y[0]} ${y[1]}L`:n=`${n}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ge,strokeWidth:$,fill:F}},r)})},i)),o.jsxRuntimeExports.jsx(Dt.AnimatePresence,{children:e.map(t=>{const i=w.features.findIndex(n=>t.id===n.properties[X]),v=xt.checkIfNullOrUndefined(t.x)?void 0:$e(t.x),s=xt.checkIfNullOrUndefined(t.y)?void 0:De(t.y),r=v!==void 0&&s!==void 0?E[s][v]:F;return o.jsxRuntimeExports.jsx(qe.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Y?Y===r?1:O:U.length!==0?U.indexOf(t.id)!==-1?1:O:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:n=>{se(t),J(n.clientY),h(n.clientX),ye?.(t)},onClick:()=>{(re||C)&&(wt.isEqual(ae,t)&&Le?(ie(void 0),re?.(void 0)):(ie(t),re?.(t)))},onMouseMove:n=>{se(t),J(n.clientY),h(n.clientX)},onMouseLeave:()=>{se(void 0),h(void 0),J(void 0),ye?.(void 0)},children:i===-1?null:w.features[i].geometry.type==="MultiPolygon"?w.features[i].geometry.coordinates.map((n,l)=>{let a="";return n.forEach(y=>{let j=" M";y.forEach((m,Ne)=>{const H=N([m[0],m[1]]);Ne!==y.length-1?j=`${j}${H[0]} ${H[1]}L`:j=`${j}${H[0]} ${H[1]}`}),a+=j}),o.jsxRuntimeExports.jsx(qe.motion.path,{variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},d:a,className:`${r===F?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)}):w.features[i].geometry.coordinates.map((n,l)=>{let a="M";return n.forEach((y,j)=>{const m=N([y[0],y[1]]);j!==n.length-1?a=`${a}${m[0]} ${m[1]}L`:a=`${a}${m[0]} ${m[1]}`}),o.jsxRuntimeExports.jsx(qe.motion.path,{d:a,variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},className:`${r===F?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)})},t.id)})}),T?w.features.filter(t=>t.properties[X]===T.id).map((t,i)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((v,s)=>{let r="";return v.forEach(n=>{let l=" M";n.forEach((a,y)=>{const j=N([a[0],a[1]]);y!==n.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),r+=l}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)}):t.geometry.coordinates.map((v,s)=>{let r="M";return v.forEach((n,l)=>{const a=N([n[0],n[1]]);l!==v.length-1?r=`${r}${a[0]} ${a[1]}L`:r=`${r}${a[0]} ${a[1]}`}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)})},i)):null,ne.filter(t=>t.position==="after").map(t=>t.layer)]})}),je===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",A?.colorLegend),children:We?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Ee(!1)},children:o.jsxRuntimeExports.jsx(ct.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:"175px"},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:o.jsxRuntimeExports.jsxs("g",{children:[E.map((t,i)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-i*25})`,children:t.map((v,s)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:s*25+1,fill:v,width:23,height:23,strokeWidth:Y===v?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{ke(v)},onMouseLeave:()=>{ke(void 0)}},s))},i)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:f.map((t,i)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(i+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:ht.numberFormattingFunction(t,"NA")},i))}),ee.map((t,i)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(f.length+1,5),4)*25+10},${100-i*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:ht.numberFormattingFunction(t,"NA")})},i))]})}),o.jsxRuntimeExports.jsx(pt.j,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:te})]}),o.jsxRuntimeExports.jsx(pt.j,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Pe})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{Ee(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>K("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>K("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),T&&oe&&le&&g?o.jsxRuntimeExports.jsx(Rt.Tooltip,{data:T,body:oe,xPos:le,yPos:g,backgroundStyle:ze?.tooltip,className:A?.tooltip}):null,C&&ae!==void 0?o.jsxRuntimeExports.jsx(St.DetailsModal,{body:C,data:ae,setData:ie,className:A?.modal}):null]})}function Pt(d){const e=o.compilerRuntimeExports.c(116),{data:f,graphTitle:w,mapData:Pe,colors:ee,sources:te,graphDescription:k,height:b,width:E,footNote:Ie,xDomain:R,yDomain:$,xColorLegendTitle:F,yColorLegendTitle:ge,tooltip:oe,scale:ye,centerPoint:fe,padding:ve,mapBorderWidth:U,mapNoDataColor:re,backgroundColor:X,mapBorderColor:Le,relativeHeight:C,onSeriesMouseOver:je,isWorldMap:ze,zoomScaleExtend:A,zoomTranslateExtend:B,graphID:M,showColorScale:S,highlightedIds:O,onSeriesMouseClick:ne,mapProperty:be,graphDownload:We,dataDownload:Ee,showAntarctica:Y,language:ke,minHeight:ae,theme:ie,ariaLabel:T,resetSelectionOnDoubleClick:se,detailsOnClick:le,styles:h,classNames:g,mapProjection:J,zoomInteraction:V,animate:ce,dimmedOpacity:we,customLayers:G,timeline:q,collapseColorScaleByDefault:P}=d,D=Pe===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":Pe,I=ee===void 0?lt.Colors.light.bivariateColors.colors05x05:ee,de=Ie===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":Ie,Ce=F===void 0?"X Color key":F,L=ge===void 0?"Y Color key":ge,N=ye===void 0?.95:ye,Re=U===void 0?.5:U,Se=re===void 0?lt.Colors.light.graphNoData:re,$e=X===void 0?!1:X,De=Le===void 0?lt.Colors.light.grays["gray-500"]:Le,K=ze===void 0?!0:ze;let t;e[0]!==A?(t=A===void 0?[.8,6]:A,e[0]=A,e[1]=t):t=e[1];const i=t,v=S===void 0?!0:S;let s;e[2]!==O?(s=O===void 0?[]:O,e[2]=O,e[3]=s):s=e[3];const r=s,n=be===void 0?"ISO3":be,l=We===void 0?!1:We,a=Ee===void 0?!1:Ee,y=Y===void 0?!1:Y,j=ke===void 0?"en":ke,m=ae===void 0?0:ae,Ne=ie===void 0?"light":ie,H=se===void 0?!0:se,Qe=V===void 0?"button":V,_e=ce===void 0?!1:ce,et=we===void 0?.3:we;let Fe;e[4]!==G?(Fe=G===void 0?[]:G,e[4]=G,e[5]=Fe):Fe=e[5];const tt=Fe;let Ae;e[6]!==q?(Ae=q===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:q,e[6]=q,e[7]=Ae):Ae=e[7];const c=Ae,[Z,vt]=p.useState(0),[Me,jt]=p.useState(0),[z,bt]=p.useState(c.autoplay);let Oe;if(e[8]!==f||e[9]!==c.dateFormat){let x;e[11]!==c.dateFormat?(x=_=>ut.parse(`${_.date}`,c.dateFormat||"yyyy",new Date).getTime(),e[11]=c.dateFormat,e[12]=x):x=e[12],Oe=[...new Set(f.filter(Vt).map(x))],Oe.sort(Tt),e[8]=f,e[9]=c.dateFormat,e[10]=Oe}else Oe=e[10];const u=Oe,[W,ot]=p.useState(c.autoplay?0:u.length-1),[me,Et]=p.useState(void 0),rt=p.useRef(null),dt=p.useRef(null);let Be,Te;e[13]===Symbol.for("react.memo_cache_sentinel")?(Be=()=>{const x=new ResizeObserver(_=>{vt(_[0].target.clientWidth||620),jt(_[0].target.clientHeight||480)});return rt.current&&x.observe(rt.current),()=>x.disconnect()},Te=[],e[13]=Be,e[14]=Te):(Be=e[13],Te=e[14]),p.useEffect(Be,Te);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=x=>{Et(x)},e[15]=Ve):Ve=e[15];const Ge=p.useEffectEvent(Ve);let He;e[16]!==D||e[17]!==Ge?(He=()=>{typeof D=="string"?Ot.fetchAndParseJSON(D).then(_=>{Ge(_)}):Ge(D)},e[16]=D,e[17]=Ge,e[18]=He):He=e[18];let Ue;e[19]!==D?(Ue=[D],e[19]=D,e[20]=Ue):Ue=e[20],p.useEffect(He,Ue);let Xe,Ye;e[21]!==z||e[22]!==c.speed||e[23]!==u?(Xe=()=>{const x=setInterval(()=>{ot(_=>_<u.length-1?_+1:0)},(c.speed||2)*1e3);return z||clearInterval(x),()=>clearInterval(x)},Ye=[u,z,c.speed],e[21]=z,e[22]=c.speed,e[23]=u,e[24]=Xe,e[25]=Ye):(Xe=e[24],Ye=e[25]),p.useEffect(Xe,Ye);const nt=c.dateFormat||"yyyy";let Je;e[26]!==W||e[27]!==nt||e[28]!==c.showOnlyActiveDate||e[29]!==u?(Je=mt.getSliderMarks(u,W,c.showOnlyActiveDate,nt),e[26]=W,e[27]=nt,e[28]=c.showOnlyActiveDate,e[29]=u,e[30]=Je):Je=e[30];const Ke=Je;if(R&&$&&(R.length!==I[0].length-1||$.length!==I.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const at=g?.graphContainer,it=h?.graphContainer;let ue;e[31]!==g?.description||e[32]!==g?.title||e[33]!==f||e[34]!==a||e[35]!==k||e[36]!==l||e[37]!==w||e[38]!==h?.description||e[39]!==h?.title||e[40]!==E?(ue=w||k||l||a?o.jsxRuntimeExports.jsx(Nt.GraphHeader,{styles:{title:h?.title,description:h?.description},classNames:{title:g?.title,description:g?.description},graphTitle:w,graphDescription:k,width:E,graphDownload:l?dt:void 0,dataDownload:a?f.map(Bt).filter(At).length>0?f.map(Ft).filter(_t):f.filter(Wt):null}):null,e[31]=g?.description,e[32]=g?.title,e[33]=f,e[34]=a,e[35]=k,e[36]=l,e[37]=w,e[38]=h?.description,e[39]=h?.title,e[40]=E,e[41]=ue):ue=e[41];let pe;e[42]!==W||e[43]!==Ke||e[44]!==z||e[45]!==c.enabled||e[46]!==u?(pe=c.enabled&&u.length>0&&Ke?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{bt(!z)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":z?"Click to pause animation":"Click to play animation",children:z?o.jsxRuntimeExports.jsx(ct.Pause,{}):o.jsxRuntimeExports.jsx(ct.Play,{})}),o.jsxRuntimeExports.jsx(mt.Nr,{min:u[0],max:u[u.length-1],marks:Ke,step:null,defaultValue:u[u.length-1],value:u[W],onChangeComplete:x=>{ot(u.indexOf(x))},onChange:x=>{ot(u.indexOf(x))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=W,e[43]=Ke,e[44]=z,e[45]=c.enabled,e[46]=u,e[47]=pe):pe=e[47];let he;e[48]!==_e||e[49]!==fe||e[50]!==g||e[51]!==P||e[52]!==I||e[53]!==tt||e[54]!==f||e[55]!==le||e[56]!==et||e[57]!==b||e[58]!==r||e[59]!==W||e[60]!==K||e[61]!==De||e[62]!==Re||e[63]!==Se||e[64]!==J||e[65]!==n||e[66]!==me||e[67]!==m||e[68]!==ne||e[69]!==je||e[70]!==C||e[71]!==H||e[72]!==N||e[73]!==y||e[74]!==v||e[75]!==h||e[76]!==Me||e[77]!==Z||e[78]!==c.dateFormat||e[79]!==c.enabled||e[80]!==oe||e[81]!==u||e[82]!==E||e[83]!==Ce||e[84]!==R||e[85]!==L||e[86]!==$||e[87]!==Qe||e[88]!==i||e[89]!==B?(he=o.jsxRuntimeExports.jsx(ft.GraphArea,{ref:rt,children:Z&&Me&&me?o.jsxRuntimeExports.jsx(qt,{data:f.filter(x=>c.enabled?x.date===ut.format(new Date(u[W]),c.dateFormat||"yyyy"):x),mapData:y?me:{...me,features:me.features.filter(zt)},xDomain:R||yt.getJenks(f.map(Lt),I[0].length),yDomain:$||yt.getJenks(f.map(It),I.length),width:Z,height:Me,scale:N,centerPoint:fe,colors:I,xColorLegendTitle:Ce,yColorLegendTitle:L,mapBorderWidth:Re,mapNoDataColor:Se,mapBorderColor:De,tooltip:oe,onSeriesMouseOver:je,isWorldMap:K,zoomScaleExtend:i,zoomTranslateExtend:B,onSeriesMouseClick:ne,mapProperty:n,highlightedIds:r,resetSelectionOnDoubleClick:H,styles:h,showColorScale:v,classNames:g,mapProjection:J||(K?"naturalEarth":"mercator"),detailsOnClick:le,zoomInteraction:Qe,animate:_e===!0?{duration:.5,once:!0,amount:.5}:_e||{duration:0,once:!0,amount:0},dimmedOpacity:et,customLayers:tt,collapseColorScaleByDefault:P}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(m,b||(C?m?(E||Z)*C>m?(E||Z)*C:m:(E||Z)*C:Me))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(kt.w,{"aria-label":"Loading graph"})})}),e[48]=_e,e[49]=fe,e[50]=g,e[51]=P,e[52]=I,e[53]=tt,e[54]=f,e[55]=le,e[56]=et,e[57]=b,e[58]=r,e[59]=W,e[60]=K,e[61]=De,e[62]=Re,e[63]=Se,e[64]=J,e[65]=n,e[66]=me,e[67]=m,e[68]=ne,e[69]=je,e[70]=C,e[71]=H,e[72]=N,e[73]=y,e[74]=v,e[75]=h,e[76]=Me,e[77]=Z,e[78]=c.dateFormat,e[79]=c.enabled,e[80]=oe,e[81]=u,e[82]=E,e[83]=Ce,e[84]=R,e[85]=L,e[86]=$,e[87]=Qe,e[88]=i,e[89]=B,e[90]=he):he=e[90];let xe;e[91]!==g?.footnote||e[92]!==g?.source||e[93]!==de||e[94]!==te||e[95]!==h?.footnote||e[96]!==h?.source||e[97]!==E?(xe=te||de?o.jsxRuntimeExports.jsx(Mt.GraphFooter,{styles:{footnote:h?.footnote,source:h?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:te,footNote:de,width:E}):null,e[91]=g?.footnote,e[92]=g?.source,e[93]=de,e[94]=te,e[95]=h?.footnote,e[96]=h?.source,e[97]=E,e[98]=xe):xe=e[98];let Ze;return e[99]!==T||e[100]!==$e||e[101]!==M||e[102]!==b||e[103]!==j||e[104]!==m||e[105]!==ve||e[106]!==C||e[107]!==at||e[108]!==it||e[109]!==ue||e[110]!==pe||e[111]!==he||e[112]!==xe||e[113]!==Ne||e[114]!==E?(Ze=o.jsxRuntimeExports.jsxs(ft.GraphContainer,{className:at,style:it,id:M,ref:dt,"aria-label":T,backgroundColor:$e,theme:Ne,language:j,minHeight:m,width:E,height:b,relativeHeight:C,padding:ve,children:[ue,pe,he,xe]}),e[99]=T,e[100]=$e,e[101]=M,e[102]=b,e[103]=j,e[104]=m,e[105]=ve,e[106]=C,e[107]=at,e[108]=it,e[109]=ue,e[110]=pe,e[111]=he,e[112]=xe,e[113]=Ne,e[114]=E,e[115]=Ze):Ze=e[115],Ze}function It(d){return d.y}function Lt(d){return d.x}function zt(d){return d.properties.NAME!=="Antarctica"}function Wt(d){return d!==void 0}function _t(d){return d!==void 0}function Ft(d){return d.data}function At(d){return d!==void 0}function Bt(d){return d.data}function Tt(d,e){return d-e}function Vt(d){return d.date}exports.BiVariateChoroplethMap=Pt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),p=require("react"),mt=require("./getSliderMarks-BmADcPQt.cjs"),kt=require("./Spinner-CQZcjzwd.cjs"),ut=require("./parse-hMnG_lRV.cjs"),wt=require("./index-DQA8q5sC.cjs"),Q=require("./zoom-DPw8bba-.cjs"),Ct=require("./index-DxXnJ8Ti.cjs"),pt=require("./Typography-DX7PlgQU.cjs"),ht=require("./numberFormattingFunction-02t-wJta.cjs"),Rt=require("./Tooltip-uUdw6wJL.cjs"),xt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ct=require("./index-DRXx7m-C.cjs"),St=require("./DetailsModal-BN0HDFlV.cjs"),st=require("./select-Bnfk0lJx.cjs"),gt=require("./threshold-DNsSUf8Q.cjs"),$t=require("./use-in-view-QcfiW0w3.cjs"),qe=require("./proxy-BxvUI_9l.cjs"),Dt=require("./index-DG2bgAva.cjs"),Nt=require("./GraphHeader.cjs"),Mt=require("./GraphFooter.cjs"),lt=require("./Colors.cjs"),Ot=require("./fetchAndParseData-l5HGMAEs.cjs"),yt=require("./getJenks-GYmdwBqm.cjs"),ft=require("./GraphContainer-d8A46BK2.cjs");function qt(d){const{data:e,xDomain:f,mapData:w,xColorLegendTitle:Pe,yDomain:ee,yColorLegendTitle:te,width:k,height:b,colors:E,scale:Ie,centerPoint:R,mapBorderWidth:$,mapNoDataColor:F,mapBorderColor:ge,tooltip:oe,onSeriesMouseOver:ye,zoomScaleExtend:fe,zoomTranslateExtend:ve,highlightedIds:U,onSeriesMouseClick:re,mapProperty:X,resetSelectionOnDoubleClick:Le,detailsOnClick:C,showColorScale:je,styles:ze,classNames:A,mapProjection:B,zoomInteraction:M,animate:S,dimmedOpacity:O,customLayers:ne,collapseColorScaleByDefault:be}=d,[We,Ee]=p.useState(be===void 0?!(k<680):!be),[Y,ke]=p.useState(void 0),[ae,ie]=p.useState(void 0),[T,se]=p.useState(void 0),[le,h]=p.useState(void 0),[g,J]=p.useState(void 0),V=p.useRef(null),ce=$t.useInView(V,{once:S.once,amount:S.amount}),we=p.useRef(null),G=p.useRef(null);p.useEffect(()=>{const t=st.select(we.current),i=st.select(V.current),v=r=>{if(M==="noZoom")return!1;if(M==="button")return!r.type.includes("wheel");const n=r.type==="wheel",l=r.type.startsWith("touch"),a=r.type==="mousedown"||r.type==="mousemove";return l?!0:n?M==="scroll"?!0:r.ctrlKey:a&&!r.button&&!r.ctrlKey},s=Q.zoom().scaleExtent(fe).translateExtent(ve||[[-20,-20],[k+20,b+20]]).filter(v).on("zoom",({transform:r})=>{t.attr("transform",r)});i.call(s),G.current=s},[b,k,M]);const q=Q.turf_bbox_default(w),P=Ct.turf_center_of_mass_default(w),D=q[2]-q[0],I=q[3]-q[1],de=k*190/960*360/D,Ce=b*190/678*180/I,L=Ie*Math.min(de,Ce),N=B==="mercator"?Q.geoMercator().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="equalEarth"?Q.geoEqualEarth().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="naturalEarth"?Q.geoNaturalEarth1().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="orthographic"?Q.geoOrthographic().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):Q.geoAlbersUsa().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L),Re=Array.from({length:f.length},(t,i)=>i),Se=Array.from({length:ee.length},(t,i)=>i),$e=gt.threshold().domain(f).range(Re),De=gt.threshold().domain(ee).range(Se),K=t=>{if(!V.current||!G.current)return;st.select(V.current).call(G.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(qe.motion.svg,{viewBox:`0 0 ${k} ${b}`,width:`${k}px`,height:`${b}px`,ref:V,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:we,children:[ne.filter(t=>t.position==="before").map(t=>t.layer),w.features.map((t,i)=>e.findIndex(s=>s.id===t.properties[X])!==-1?null:o.jsxRuntimeExports.jsx(qe.motion.g,{opacity:Y?O:U.length!==0?U.indexOf(t.properties[X])!==-1?1:O:1,children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((s,r)=>{let n="";return s.forEach(l=>{let a=" M";l.forEach((y,j)=>{const m=N([y[0],y[1]]);j!==l.length-1?a=`${a}${m[0]} ${m[1]}L`:a=`${a}${m[0]} ${m[1]}`}),n+=a}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ge,strokeWidth:$,fill:F}},r)}):t.geometry.coordinates.map((s,r)=>{let n="M";return s.forEach((l,a)=>{const y=N([l[0],l[1]]);a!==s.length-1?n=`${n}${y[0]} ${y[1]}L`:n=`${n}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ge,strokeWidth:$,fill:F}},r)})},i)),o.jsxRuntimeExports.jsx(Dt.AnimatePresence,{children:e.map(t=>{const i=w.features.findIndex(n=>t.id===n.properties[X]),v=xt.checkIfNullOrUndefined(t.x)?void 0:$e(t.x),s=xt.checkIfNullOrUndefined(t.y)?void 0:De(t.y),r=v!==void 0&&s!==void 0?E[s][v]:F;return o.jsxRuntimeExports.jsx(qe.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Y?Y===r?1:O:U.length!==0?U.indexOf(t.id)!==-1?1:O:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:n=>{se(t),J(n.clientY),h(n.clientX),ye?.(t)},onClick:()=>{(re||C)&&(wt.isEqual(ae,t)&&Le?(ie(void 0),re?.(void 0)):(ie(t),re?.(t)))},onMouseMove:n=>{se(t),J(n.clientY),h(n.clientX)},onMouseLeave:()=>{se(void 0),h(void 0),J(void 0),ye?.(void 0)},children:i===-1?null:w.features[i].geometry.type==="MultiPolygon"?w.features[i].geometry.coordinates.map((n,l)=>{let a="";return n.forEach(y=>{let j=" M";y.forEach((m,Ne)=>{const H=N([m[0],m[1]]);Ne!==y.length-1?j=`${j}${H[0]} ${H[1]}L`:j=`${j}${H[0]} ${H[1]}`}),a+=j}),o.jsxRuntimeExports.jsx(qe.motion.path,{variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},d:a,className:`${r===F?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)}):w.features[i].geometry.coordinates.map((n,l)=>{let a="M";return n.forEach((y,j)=>{const m=N([y[0],y[1]]);j!==n.length-1?a=`${a}${m[0]} ${m[1]}L`:a=`${a}${m[0]} ${m[1]}`}),o.jsxRuntimeExports.jsx(qe.motion.path,{d:a,variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},className:`${r===F?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)})},t.id)})}),T?w.features.filter(t=>t.properties[X]===T.id).map((t,i)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((v,s)=>{let r="";return v.forEach(n=>{let l=" M";n.forEach((a,y)=>{const j=N([a[0],a[1]]);y!==n.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),r+=l}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)}):t.geometry.coordinates.map((v,s)=>{let r="M";return v.forEach((n,l)=>{const a=N([n[0],n[1]]);l!==v.length-1?r=`${r}${a[0]} ${a[1]}L`:r=`${r}${a[0]} ${a[1]}`}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)})},i)):null,ne.filter(t=>t.position==="after").map(t=>t.layer)]})}),je===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",A?.colorLegend),children:We?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Ee(!1)},children:o.jsxRuntimeExports.jsx(ct.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:"175px"},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:o.jsxRuntimeExports.jsxs("g",{children:[E.map((t,i)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-i*25})`,children:t.map((v,s)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:s*25+1,fill:v,width:23,height:23,strokeWidth:Y===v?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{ke(v)},onMouseLeave:()=>{ke(void 0)}},s))},i)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:f.map((t,i)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(i+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:ht.numberFormattingFunction(t,"NA")},i))}),ee.map((t,i)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(f.length+1,5),4)*25+10},${100-i*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:ht.numberFormattingFunction(t,"NA")})},i))]})}),o.jsxRuntimeExports.jsx(pt.j,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:te})]}),o.jsxRuntimeExports.jsx(pt.j,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Pe})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{Ee(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>K("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>K("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),T&&oe&&le&&g?o.jsxRuntimeExports.jsx(Rt.Tooltip,{data:T,body:oe,xPos:le,yPos:g,backgroundStyle:ze?.tooltip,className:A?.tooltip}):null,C&&ae!==void 0?o.jsxRuntimeExports.jsx(St.DetailsModal,{body:C,data:ae,setData:ie,className:A?.modal}):null]})}function Pt(d){const e=o.compilerRuntimeExports.c(116),{data:f,graphTitle:w,mapData:Pe,colors:ee,sources:te,graphDescription:k,height:b,width:E,footNote:Ie,xDomain:R,yDomain:$,xColorLegendTitle:F,yColorLegendTitle:ge,tooltip:oe,scale:ye,centerPoint:fe,padding:ve,mapBorderWidth:U,mapNoDataColor:re,backgroundColor:X,mapBorderColor:Le,relativeHeight:C,onSeriesMouseOver:je,isWorldMap:ze,zoomScaleExtend:A,zoomTranslateExtend:B,graphID:M,showColorScale:S,highlightedIds:O,onSeriesMouseClick:ne,mapProperty:be,graphDownload:We,dataDownload:Ee,showAntarctica:Y,language:ke,minHeight:ae,theme:ie,ariaLabel:T,resetSelectionOnDoubleClick:se,detailsOnClick:le,styles:h,classNames:g,mapProjection:J,zoomInteraction:V,animate:ce,dimmedOpacity:we,customLayers:G,timeline:q,collapseColorScaleByDefault:P}=d,D=Pe===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":Pe,I=ee===void 0?lt.Colors.light.bivariateColors.colors05x05:ee,de=Ie===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":Ie,Ce=F===void 0?"X Color key":F,L=ge===void 0?"Y Color key":ge,N=ye===void 0?.95:ye,Re=U===void 0?.5:U,Se=re===void 0?lt.Colors.light.graphNoData:re,$e=X===void 0?!1:X,De=Le===void 0?lt.Colors.light.grays["gray-500"]:Le,K=ze===void 0?!0:ze;let t;e[0]!==A?(t=A===void 0?[.8,6]:A,e[0]=A,e[1]=t):t=e[1];const i=t,v=S===void 0?!0:S;let s;e[2]!==O?(s=O===void 0?[]:O,e[2]=O,e[3]=s):s=e[3];const r=s,n=be===void 0?"ISO3":be,l=We===void 0?!1:We,a=Ee===void 0?!1:Ee,y=Y===void 0?!1:Y,j=ke===void 0?"en":ke,m=ae===void 0?0:ae,Ne=ie===void 0?"light":ie,H=se===void 0?!0:se,Qe=V===void 0?"button":V,_e=ce===void 0?!1:ce,et=we===void 0?.3:we;let Fe;e[4]!==G?(Fe=G===void 0?[]:G,e[4]=G,e[5]=Fe):Fe=e[5];const tt=Fe;let Ae;e[6]!==q?(Ae=q===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:q,e[6]=q,e[7]=Ae):Ae=e[7];const c=Ae,[Z,vt]=p.useState(0),[Me,jt]=p.useState(0),[z,bt]=p.useState(c.autoplay);let Oe;if(e[8]!==f||e[9]!==c.dateFormat){let x;e[11]!==c.dateFormat?(x=_=>ut.parse(`${_.date}`,c.dateFormat||"yyyy",new Date).getTime(),e[11]=c.dateFormat,e[12]=x):x=e[12],Oe=[...new Set(f.filter(Vt).map(x))],Oe.sort(Tt),e[8]=f,e[9]=c.dateFormat,e[10]=Oe}else Oe=e[10];const u=Oe,[W,ot]=p.useState(c.autoplay?0:u.length-1),[me,Et]=p.useState(void 0),rt=p.useRef(null),dt=p.useRef(null);let Be,Te;e[13]===Symbol.for("react.memo_cache_sentinel")?(Be=()=>{const x=new ResizeObserver(_=>{vt(_[0].target.clientWidth||620),jt(_[0].target.clientHeight||480)});return rt.current&&x.observe(rt.current),()=>x.disconnect()},Te=[],e[13]=Be,e[14]=Te):(Be=e[13],Te=e[14]),p.useEffect(Be,Te);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=x=>{Et(x)},e[15]=Ve):Ve=e[15];const Ge=p.useEffectEvent(Ve);let He;e[16]!==D||e[17]!==Ge?(He=()=>{typeof D=="string"?Ot.fetchAndParseJSON(D).then(_=>{Ge(_)}):Ge(D)},e[16]=D,e[17]=Ge,e[18]=He):He=e[18];let Ue;e[19]!==D?(Ue=[D],e[19]=D,e[20]=Ue):Ue=e[20],p.useEffect(He,Ue);let Xe,Ye;e[21]!==z||e[22]!==c.speed||e[23]!==u?(Xe=()=>{const x=setInterval(()=>{ot(_=>_<u.length-1?_+1:0)},(c.speed||2)*1e3);return z||clearInterval(x),()=>clearInterval(x)},Ye=[u,z,c.speed],e[21]=z,e[22]=c.speed,e[23]=u,e[24]=Xe,e[25]=Ye):(Xe=e[24],Ye=e[25]),p.useEffect(Xe,Ye);const nt=c.dateFormat||"yyyy";let Je;e[26]!==W||e[27]!==nt||e[28]!==c.showOnlyActiveDate||e[29]!==u?(Je=mt.getSliderMarks(u,W,c.showOnlyActiveDate,nt),e[26]=W,e[27]=nt,e[28]=c.showOnlyActiveDate,e[29]=u,e[30]=Je):Je=e[30];const Ke=Je;if(R&&$&&(R.length!==I[0].length-1||$.length!==I.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const at=g?.graphContainer,it=h?.graphContainer;let ue;e[31]!==g?.description||e[32]!==g?.title||e[33]!==f||e[34]!==a||e[35]!==k||e[36]!==l||e[37]!==w||e[38]!==h?.description||e[39]!==h?.title||e[40]!==E?(ue=w||k||l||a?o.jsxRuntimeExports.jsx(Nt.GraphHeader,{styles:{title:h?.title,description:h?.description},classNames:{title:g?.title,description:g?.description},graphTitle:w,graphDescription:k,width:E,graphDownload:l?dt:void 0,dataDownload:a?f.map(Bt).filter(At).length>0?f.map(Ft).filter(_t):f.filter(Wt):null}):null,e[31]=g?.description,e[32]=g?.title,e[33]=f,e[34]=a,e[35]=k,e[36]=l,e[37]=w,e[38]=h?.description,e[39]=h?.title,e[40]=E,e[41]=ue):ue=e[41];let pe;e[42]!==W||e[43]!==Ke||e[44]!==z||e[45]!==c.enabled||e[46]!==u?(pe=c.enabled&&u.length>0&&Ke?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{bt(!z)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":z?"Click to pause animation":"Click to play animation",children:z?o.jsxRuntimeExports.jsx(ct.Pause,{}):o.jsxRuntimeExports.jsx(ct.Play,{})}),o.jsxRuntimeExports.jsx(mt.Nr,{min:u[0],max:u[u.length-1],marks:Ke,step:null,defaultValue:u[u.length-1],value:u[W],onChangeComplete:x=>{ot(u.indexOf(x))},onChange:x=>{ot(u.indexOf(x))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=W,e[43]=Ke,e[44]=z,e[45]=c.enabled,e[46]=u,e[47]=pe):pe=e[47];let he;e[48]!==_e||e[49]!==fe||e[50]!==g||e[51]!==P||e[52]!==I||e[53]!==tt||e[54]!==f||e[55]!==le||e[56]!==et||e[57]!==b||e[58]!==r||e[59]!==W||e[60]!==K||e[61]!==De||e[62]!==Re||e[63]!==Se||e[64]!==J||e[65]!==n||e[66]!==me||e[67]!==m||e[68]!==ne||e[69]!==je||e[70]!==C||e[71]!==H||e[72]!==N||e[73]!==y||e[74]!==v||e[75]!==h||e[76]!==Me||e[77]!==Z||e[78]!==c.dateFormat||e[79]!==c.enabled||e[80]!==oe||e[81]!==u||e[82]!==E||e[83]!==Ce||e[84]!==R||e[85]!==L||e[86]!==$||e[87]!==Qe||e[88]!==i||e[89]!==B?(he=o.jsxRuntimeExports.jsx(ft.GraphArea,{ref:rt,children:Z&&Me&&me?o.jsxRuntimeExports.jsx(qt,{data:f.filter(x=>c.enabled?x.date===ut.format(new Date(u[W]),c.dateFormat||"yyyy"):x),mapData:y?me:{...me,features:me.features.filter(zt)},xDomain:R||yt.getJenks(f.map(Lt),I[0].length),yDomain:$||yt.getJenks(f.map(It),I.length),width:Z,height:Me,scale:N,centerPoint:fe,colors:I,xColorLegendTitle:Ce,yColorLegendTitle:L,mapBorderWidth:Re,mapNoDataColor:Se,mapBorderColor:De,tooltip:oe,onSeriesMouseOver:je,isWorldMap:K,zoomScaleExtend:i,zoomTranslateExtend:B,onSeriesMouseClick:ne,mapProperty:n,highlightedIds:r,resetSelectionOnDoubleClick:H,styles:h,showColorScale:v,classNames:g,mapProjection:J||(K?"naturalEarth":"mercator"),detailsOnClick:le,zoomInteraction:Qe,animate:_e===!0?{duration:.5,once:!0,amount:.5}:_e||{duration:0,once:!0,amount:0},dimmedOpacity:et,customLayers:tt,collapseColorScaleByDefault:P}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(m,b||(C?m?(E||Z)*C>m?(E||Z)*C:m:(E||Z)*C:Me))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(kt.w,{"aria-label":"Loading graph"})})}),e[48]=_e,e[49]=fe,e[50]=g,e[51]=P,e[52]=I,e[53]=tt,e[54]=f,e[55]=le,e[56]=et,e[57]=b,e[58]=r,e[59]=W,e[60]=K,e[61]=De,e[62]=Re,e[63]=Se,e[64]=J,e[65]=n,e[66]=me,e[67]=m,e[68]=ne,e[69]=je,e[70]=C,e[71]=H,e[72]=N,e[73]=y,e[74]=v,e[75]=h,e[76]=Me,e[77]=Z,e[78]=c.dateFormat,e[79]=c.enabled,e[80]=oe,e[81]=u,e[82]=E,e[83]=Ce,e[84]=R,e[85]=L,e[86]=$,e[87]=Qe,e[88]=i,e[89]=B,e[90]=he):he=e[90];let xe;e[91]!==g?.footnote||e[92]!==g?.source||e[93]!==de||e[94]!==te||e[95]!==h?.footnote||e[96]!==h?.source||e[97]!==E?(xe=te||de?o.jsxRuntimeExports.jsx(Mt.GraphFooter,{styles:{footnote:h?.footnote,source:h?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:te,footNote:de,width:E}):null,e[91]=g?.footnote,e[92]=g?.source,e[93]=de,e[94]=te,e[95]=h?.footnote,e[96]=h?.source,e[97]=E,e[98]=xe):xe=e[98];let Ze;return e[99]!==T||e[100]!==$e||e[101]!==M||e[102]!==b||e[103]!==j||e[104]!==m||e[105]!==ve||e[106]!==C||e[107]!==at||e[108]!==it||e[109]!==ue||e[110]!==pe||e[111]!==he||e[112]!==xe||e[113]!==Ne||e[114]!==E?(Ze=o.jsxRuntimeExports.jsxs(ft.GraphContainer,{className:at,style:it,id:M,ref:dt,"aria-label":T,backgroundColor:$e,theme:Ne,language:j,minHeight:m,width:E,height:b,relativeHeight:C,padding:ve,children:[ue,pe,he,xe]}),e[99]=T,e[100]=$e,e[101]=M,e[102]=b,e[103]=j,e[104]=m,e[105]=ve,e[106]=C,e[107]=at,e[108]=it,e[109]=ue,e[110]=pe,e[111]=he,e[112]=xe,e[113]=Ne,e[114]=E,e[115]=Ze):Ze=e[115],Ze}function It(d){return d.y}function Lt(d){return d.x}function zt(d){return d.properties.NAME!=="Antarctica"}function Wt(d){return d!==void 0}function _t(d){return d!==void 0}function Ft(d){return d.data}function At(d){return d!==void 0}function Bt(d){return d.data}function Tt(d,e){return d-e}function Vt(d){return d.date}exports.BiVariateChoroplethMap=Pt;
|
|
2
2
|
//# sourceMappingURL=BiVariateChoroplethMap.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as o, m as be, c as ke } from "./index-CHPV5EwG-Curnpaqc.js";
|
|
2
2
|
import { useState as N, useRef as Pt, useEffect as Qt, useEffectEvent as we } from "react";
|
|
3
3
|
import { g as je, N as Ce } from "./getSliderMarks-HIDJ0_Cd.js";
|
|
4
|
-
import { w as De } from "./Spinner-
|
|
4
|
+
import { w as De } from "./Spinner-DVBnY6Vg.js";
|
|
5
5
|
import { f as $e, p as Ne } from "./parse-DlCRUFh_.js";
|
|
6
6
|
import { i as Se } from "./index-Bwrro8-q.js";
|
|
7
7
|
import { z as Me, t as Ee, g as Oe, a as Le, b as Pe, c as Ie, d as ze } from "./zoom-C9MFjAaV.js";
|
package/dist/ChoroplethMap.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-CTPQjnHt.cjs"),x=require("react"),dt=require("./getSliderMarks-BmADcPQt.cjs"),ft=require("./Spinner-DRMBUsX7.cjs"),ut=require("./parse-hMnG_lRV.cjs"),jt=require("./index-DQA8q5sC.cjs"),oe=require("./zoom-DPw8bba-.cjs"),mt=require("./Typography-DX7PlgQU.cjs"),vt=require("./index-DxXnJ8Ti.cjs"),bt=require("./numberFormattingFunction-02t-wJta.cjs"),Et=require("./Tooltip-uUdw6wJL.cjs"),kt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),lt=require("./index-DRXx7m-C.cjs"),wt=require("./DetailsModal-BN0HDFlV.cjs"),Rt=require("./ordinal-CrsysVE-.cjs"),Ct=require("./threshold-DNsSUf8Q.cjs"),it=require("./select-Bnfk0lJx.cjs"),St=require("./use-in-view-QcfiW0w3.cjs"),Je=require("./proxy-BxvUI_9l.cjs"),$t=require("./index-DG2bgAva.cjs"),Dt=require("./GraphFooter.cjs"),Nt=require("./GraphHeader.cjs"),Ke=require("./Colors.cjs"),Mt=require("./fetchAndParseData-l5HGMAEs.cjs"),Ot=require("./getUniqValue-NX8DgwND.cjs"),qt=require("./getJenks-GYmdwBqm.cjs"),pt=require("./GraphContainer-d8A46BK2.cjs");function Pt(h){const{data:e,colorDomain:l,colors:d,mapData:R,colorLegendTitle:D,categorical:B,height:E,width:j,scale:b,centerPoint:T,tooltip:re,mapBorderWidth:V,mapBorderColor:H,mapNoDataColor:ae,onSeriesMouseOver:se,showColorScale:Ee,zoomScaleExtend:Ne,zoomTranslateExtend:Me,highlightedIds:X,onSeriesMouseClick:ne,mapProperty:k,resetSelectionOnDoubleClick:ke,detailsOnClick:Y,styles:Oe,classNames:ie,mapProjection:O,zoomInteraction:q,animate:S,dimmedOpacity:P,customLayers:le,collapseColorScaleByDefault:we}=h,[N,I]=x.useState(void 0),ce=x.useRef(null),[qe,Re]=x.useState(we===void 0?!(j<680):!we),[de,J]=x.useState(void 0),[K,Z]=x.useState(void 0),[f,g]=x.useState(void 0),[ue,me]=x.useState(void 0),G=x.useRef(null),pe=St.useInView(G,{once:S.once,amount:S.amount}),Q=x.useRef(null),he=B?Rt.ordinal().domain(l).range(d):Ct.threshold().domain(l).range(d);x.useEffect(()=>{const o=it.select(Q.current),i=it.select(G.current),v=r=>{if(q==="noZoom")return!1;if(q==="button")return!r.type.includes("wheel");const n=r.type==="wheel",c=r.type.startsWith("touch"),s=r.type==="mousedown"||r.type==="mousemove";return c?!0:n?q==="scroll"?!0:r.ctrlKey:s&&!r.button&&!r.ctrlKey},a=oe.zoom().scaleExtent(Ne).translateExtent(Me||[[-20,-20],[j+20,E+20]]).filter(v).on("zoom",({transform:r})=>{o.attr("transform",r)});i.call(a),ce.current=a},[E,j,q]);const U=oe.turf_bbox_default(R),w=vt.turf_center_of_mass_default(R),xe=U[2]-U[0],L=U[3]-U[1],Ce=j*190/960*360/xe,Se=E*190/678*180/L,z=b*Math.min(Ce,Se),M=O==="mercator"?oe.geoMercator().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):O==="equalEarth"?oe.geoEqualEarth().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):O==="naturalEarth"?oe.geoNaturalEarth1().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):O==="orthographic"?oe.geoOrthographic().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):oe.geoAlbersUsa().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z),ge=o=>{if(!G.current||!ce.current)return;it.select(G.current).call(ce.current.scaleBy,o==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(Je.motion.svg,{width:`${j}px`,height:`${E}px`,viewBox:`0 0 ${j} ${E}`,ref:G,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:Q,children:[le.filter(o=>o.position==="before").map(o=>o.layer),R.features.map((o,i)=>e.findIndex(a=>a.id===o.properties[k])!==-1?null:t.jsxRuntimeExports.jsx("g",{opacity:N?P:X.length!==0?X.indexOf(o.properties[k])!==-1?1:P:1,children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((a,r)=>{let n="";return a.forEach(c=>{let s=" M";c.forEach((m,$)=>{const C=M([m[0],m[1]]);$!==c.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),n+=s}),t.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:H,strokeWidth:V,fill:ae}},r)}):o.geometry.coordinates.map((a,r)=>{let n="M";return a.forEach((c,s)=>{const m=M([c[0],c[1]]);s!==a.length-1?n=`${n}${m[0]} ${m[1]}L`:n=`${n}${m[0]} ${m[1]}`}),t.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:H,strokeWidth:V,fill:ae}},r)})},i)),t.jsxRuntimeExports.jsx($t.AnimatePresence,{children:e.map(o=>{const i=R.features.findIndex(a=>o.id===a.properties[k]),v=kt.checkIfNullOrUndefined(o.x)?ae:he(o.x);return t.jsxRuntimeExports.jsx(Je.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:N?N===v?1:P:X.length!==0?X.indexOf(o.id)!==-1?1:P:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:a=>{Z(o),me(a.clientY),g(a.clientX),se?.(o)},onMouseMove:a=>{Z(o),me(a.clientY),g(a.clientX)},onMouseLeave:()=>{Z(void 0),g(void 0),me(void 0),se?.(void 0)},onClick:()=>{(ne||Y)&&(jt.isEqual(de,o)&&ke?(J(void 0),ne?.(void 0)):(J(o),ne?.(o)))},children:i===-1?null:R.features[i].geometry.type==="MultiPolygon"?R.features[i].geometry.coordinates.map((a,r)=>{let n="";return a.forEach(c=>{let s=" M";c.forEach((m,$)=>{const C=M([m[0],m[1]]);$!==c.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),n+=s}),t.jsxRuntimeExports.jsx(Je.motion.path,{d:n,variants:{initial:{fill:v,opacity:0},whileInView:{fill:v,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:H,strokeWidth:V}},`${o.id}-${r}`)}):R.features[i].geometry.coordinates.map((a,r)=>{let n="M";return a.forEach((c,s)=>{const m=M([c[0],c[1]]);s!==a.length-1?n=`${n}${m[0]} ${m[1]}L`:n=`${n}${m[0]} ${m[1]}`}),t.jsxRuntimeExports.jsx(Je.motion.path,{d:n,variants:{initial:{fill:v,opacity:0},whileInView:{fill:v,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:H,strokeWidth:V}},`${o.id}-${r}`)})},o.id)})}),K?R.features.filter(o=>o.properties[k]===K.id).map((o,i)=>t.jsxRuntimeExports.jsx("g",{children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((v,a)=>{let r="";return v.forEach(n=>{let c=" M";n.forEach((s,m)=>{const $=M([s[0],s[1]]);m!==n.length-1?c=`${c}${$[0]} ${$[1]}L`:c=`${c}${$[0]} ${$[1]}`}),r+=c}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)}):o.geometry.coordinates.map((v,a)=>{let r="M";return v.forEach((n,c)=>{const s=M([n[0],n[1]]);c!==v.length-1?r=`${r}${s[0]} ${s[1]}L`:r=`${r}${s[0]} ${s[1]}`}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)})},i)):null,le.filter(o=>o.position==="after").map(o=>o.layer)]})}),Ee===!1?null:t.jsxRuntimeExports.jsx("div",{className:t.mo("absolute left-4 bottom-4 map-color-legend",ie?.colorLegend),children:qe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Re(!1)},children:t.jsxRuntimeExports.jsx(lt.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:B?void 0:"340px"},children:[D&&D!==""?t.jsxRuntimeExports.jsx(mt.j,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:D}):null,B?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:l.map((o,i)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{I(d[i%d.length])},onMouseLeave:()=>{I(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d[i%d.length]}}),t.jsxRuntimeExports.jsx(mt.j,{size:"sm",marginBottom:"none",leading:"none",children:o})]},i))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[l.map((o,i)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{I(d[i])},onMouseLeave:()=>{I(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:i*320/d.length+1,y:1,width:320/d.length-2,height:8,className:N===d[i]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:d[i],...N===d[i]?{}:{stroke:d[i]}}}),t.jsxRuntimeExports.jsx("text",{x:(i+1)*320/d.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:bt.numberFormattingFunction(o,"NA")})]},i)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{I(d[l.length])},onMouseLeave:()=>{I(void 0)},x:l.length*320/d.length+1,y:1,width:320/d.length-2,height:8,className:`cursor-pointer ${N===d[l.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:d[l.length],...N===d[l.length]?{}:{stroke:d[l.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start map-legend-button",onClick:()=>{Re(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>ge("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>ge("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),Y&&de!==void 0?t.jsxRuntimeExports.jsx(wt.DetailsModal,{body:Y,data:de,setData:J,className:ie?.modal}):null,K&&re&&f&&ue?t.jsxRuntimeExports.jsx(Et.Tooltip,{data:K,body:re,xPos:f,yPos:ue,backgroundStyle:Oe?.tooltip,className:ie?.tooltip}):null]})}function It(h){const e=t.compilerRuntimeExports.c(121),{data:l,mapData:d,graphTitle:R,colors:D,sources:B,graphDescription:E,height:j,width:b,footNote:T,colorDomain:re,colorLegendTitle:V,scaleType:H,scale:ae,centerPoint:se,padding:Ee,mapBorderWidth:Ne,mapNoDataColor:Me,backgroundColor:X,mapBorderColor:ne,relativeHeight:k,tooltip:ke,onSeriesMouseOver:Y,isWorldMap:Oe,showColorScale:ie,zoomScaleExtend:O,zoomTranslateExtend:q,graphID:S,highlightedIds:P,onSeriesMouseClick:le,mapProperty:we,graphDownload:N,dataDownload:I,showAntarctica:ce,language:qe,minHeight:Re,theme:de,ariaLabel:J,resetSelectionOnDoubleClick:K,detailsOnClick:Z,styles:f,classNames:g,mapProjection:ue,zoomInteraction:me,animate:G,dimmedOpacity:pe,customLayers:Q,timeline:he,collapseColorScaleByDefault:U}=h,w=d===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":d,xe=T===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":T,L=H===void 0?"threshold":H,Ce=ae===void 0?.95:ae,Se=Ne===void 0?.5:Ne,z=Me===void 0?Ke.Colors.light.graphNoData:Me,M=X===void 0?!1:X,ge=ne===void 0?Ke.Colors.light.grays["gray-500"]:ne,o=Oe===void 0?!0:Oe,i=ie===void 0?!0:ie;let v;e[0]!==O?(v=O===void 0?[.8,6]:O,e[0]=O,e[1]=v):v=e[1];const a=v;let r;e[2]!==P?(r=P===void 0?[]:P,e[2]=P,e[3]=r):r=e[3];const n=r,c=we===void 0?"ISO3":we,s=N===void 0?!1:N,m=I===void 0?!1:I,$=ce===void 0?!1:ce,C=qe===void 0?"en":qe,F=Re===void 0?0:Re,ee=de===void 0?"light":de,Ze=K===void 0?!0:K,Qe=me===void 0?"button":me,Pe=G===void 0?!1:G,et=pe===void 0?.3:pe;let Ie;e[4]!==Q?(Ie=Q===void 0?[]:Q,e[4]=Q,e[5]=Ie):Ie=e[5];const tt=Ie;let Le;e[6]!==he?(Le=he===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:he,e[6]=he,e[7]=Le):Le=e[7];const u=Le,[te,ht]=x.useState(0),[$e,xt]=x.useState(0),[W,gt]=x.useState(u.autoplay);let De;if(e[8]!==l||e[9]!==u.dateFormat){let y;e[11]!==u.dateFormat?(y=A=>ut.parse(`${A.date}`,u.dateFormat||"yyyy",new Date).getTime(),e[11]=u.dateFormat,e[12]=y):y=e[12],De=[...new Set(l.filter(Vt).map(y))],De.sort(Tt),e[8]=l,e[9]=u.dateFormat,e[10]=De}else De=e[10];const p=De,[_,ot]=x.useState(u.autoplay?0:p.length-1),[ye,yt]=x.useState(void 0),rt=x.useRef(null),ct=x.useRef(null);let ze,Fe;e[13]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{const y=new ResizeObserver(A=>{ht(A[0].target.clientWidth||620),xt(A[0].target.clientHeight||480)});return rt.current&&y.observe(rt.current),()=>y.disconnect()},Fe=[],e[13]=ze,e[14]=Fe):(ze=e[13],Fe=e[14]),x.useEffect(ze,Fe);let We;e[15]===Symbol.for("react.memo_cache_sentinel")?(We=y=>{yt(y)},e[15]=We):We=e[15];const _e=x.useEffectEvent(We);let Ae;e[16]!==w||e[17]!==_e?(Ae=()=>{typeof w=="string"?Mt.fetchAndParseJSON(w).then(A=>{_e(A)}):_e(w)},e[16]=w,e[17]=_e,e[18]=Ae):Ae=e[18];let Be;e[19]!==w?(Be=[w],e[19]=w,e[20]=Be):Be=e[20],x.useEffect(Ae,Be);let Te;e[21]!==re||e[22]!==D?.length||e[23]!==l||e[24]!==L?(Te=re||(L==="categorical"?Ot.getUniqValue(l,"x"):qt.getJenks(l.map(Bt),D?.length||4)),e[21]=re,e[22]=D?.length,e[23]=l,e[24]=L,e[25]=Te):Te=e[25];const Ve=Te;let Ge,Ue;e[26]!==W||e[27]!==u.speed||e[28]!==p?(Ge=()=>{const y=setInterval(()=>{ot(A=>A<p.length-1?A+1:0)},(u.speed||2)*1e3);return W||clearInterval(y),()=>clearInterval(y)},Ue=[p,W,u.speed],e[26]=W,e[27]=u.speed,e[28]=p,e[29]=Ge,e[30]=Ue):(Ge=e[29],Ue=e[30]),x.useEffect(Ge,Ue);const at=u.dateFormat||"yyyy";let He;e[31]!==_||e[32]!==at||e[33]!==u.showOnlyActiveDate||e[34]!==p?(He=dt.getSliderMarks(p,_,u.showOnlyActiveDate,at),e[31]=_,e[32]=at,e[33]=u.showOnlyActiveDate,e[34]=p,e[35]=He):He=e[35];const Xe=He,st=g?.graphContainer,nt=f?.graphContainer;let fe;e[36]!==g?.description||e[37]!==g?.title||e[38]!==l||e[39]!==m||e[40]!==E||e[41]!==s||e[42]!==R||e[43]!==f?.description||e[44]!==f?.title||e[45]!==b?(fe=R||E||s||m?t.jsxRuntimeExports.jsx(Nt.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:g?.title,description:g?.description},graphTitle:R,graphDescription:E,width:b,graphDownload:s?ct:void 0,dataDownload:m?l.map(At).filter(_t).length>0?l.map(Wt).filter(Ft):l.filter(zt):null}):null,e[36]=g?.description,e[37]=g?.title,e[38]=l,e[39]=m,e[40]=E,e[41]=s,e[42]=R,e[43]=f?.description,e[44]=f?.title,e[45]=b,e[46]=fe):fe=e[46];let je;e[47]!==_||e[48]!==Xe||e[49]!==W||e[50]!==u.enabled||e[51]!==p?(je=u.enabled&&p.length>0&&Xe?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{gt(!W)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":W?"Click to pause animation":"Click to play animation",children:W?t.jsxRuntimeExports.jsx(lt.Pause,{}):t.jsxRuntimeExports.jsx(lt.Play,{})}),t.jsxRuntimeExports.jsx(dt.Nr,{min:p[0],max:p[p.length-1],marks:Xe,step:null,defaultValue:p[p.length-1],value:p[_],onChangeComplete:y=>{ot(p.indexOf(y))},onChange:y=>{ot(p.indexOf(y))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[47]=_,e[48]=Xe,e[49]=W,e[50]=u.enabled,e[51]=p,e[52]=je):je=e[52];let ve;e[53]!==Pe||e[54]!==se||e[55]!==g||e[56]!==U||e[57]!==V||e[58]!==D||e[59]!==tt||e[60]!==l||e[61]!==Z||e[62]!==et||e[63]!==Ve||e[64]!==j||e[65]!==n||e[66]!==_||e[67]!==o||e[68]!==ge||e[69]!==Se||e[70]!==z||e[71]!==ue||e[72]!==c||e[73]!==ye||e[74]!==F||e[75]!==le||e[76]!==Y||e[77]!==k||e[78]!==Ze||e[79]!==Ce||e[80]!==L||e[81]!==$||e[82]!==i||e[83]!==f||e[84]!==$e||e[85]!==te||e[86]!==ee||e[87]!==u.dateFormat||e[88]!==u.enabled||e[89]!==ke||e[90]!==p||e[91]!==b||e[92]!==Qe||e[93]!==a||e[94]!==q?(ve=t.jsxRuntimeExports.jsx(pt.GraphArea,{ref:rt,children:te&&$e&&ye?t.jsxRuntimeExports.jsx(Pt,{data:l.filter(y=>u.enabled?y.date===ut.format(new Date(p[_]),u.dateFormat||"yyyy"):y),mapData:$?ye:{...ye,features:ye.features.filter(Lt)},colorDomain:Ve,width:te,height:$e,scale:Ce,centerPoint:se,colors:D||(L==="categorical"?Ke.Colors[ee].categoricalColors.colors:Ke.Colors[ee].sequentialColors[`neutralColorsx0${Ve.length+1}`]),colorLegendTitle:V,mapBorderWidth:Se,mapNoDataColor:z,categorical:L==="categorical",mapBorderColor:ge,tooltip:ke,onSeriesMouseOver:Y,isWorldMap:o,showColorScale:i,zoomScaleExtend:a,zoomTranslateExtend:q,onSeriesMouseClick:le,mapProperty:c,highlightedIds:n,resetSelectionOnDoubleClick:Ze,styles:f,classNames:g,detailsOnClick:Z,mapProjection:ue||(o?"naturalEarth":"mercator"),zoomInteraction:Qe,dimmedOpacity:et,animate:Pe===!0?{duration:.5,once:!0,amount:.5}:Pe||{duration:0,once:!0,amount:0},customLayers:tt,collapseColorScaleByDefault:U}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(F,j||(k?F?(b||te)*k>F?(b||te)*k:F:(b||te)*k:$e))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(ft.w,{"aria-label":"Loading graph"})})}),e[53]=Pe,e[54]=se,e[55]=g,e[56]=U,e[57]=V,e[58]=D,e[59]=tt,e[60]=l,e[61]=Z,e[62]=et,e[63]=Ve,e[64]=j,e[65]=n,e[66]=_,e[67]=o,e[68]=ge,e[69]=Se,e[70]=z,e[71]=ue,e[72]=c,e[73]=ye,e[74]=F,e[75]=le,e[76]=Y,e[77]=k,e[78]=Ze,e[79]=Ce,e[80]=L,e[81]=$,e[82]=i,e[83]=f,e[84]=$e,e[85]=te,e[86]=ee,e[87]=u.dateFormat,e[88]=u.enabled,e[89]=ke,e[90]=p,e[91]=b,e[92]=Qe,e[93]=a,e[94]=q,e[95]=ve):ve=e[95];let be;e[96]!==g?.footnote||e[97]!==g?.source||e[98]!==xe||e[99]!==B||e[100]!==f?.footnote||e[101]!==f?.source||e[102]!==b?(be=B||xe?t.jsxRuntimeExports.jsx(Dt.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:B,footNote:xe,width:b}):null,e[96]=g?.footnote,e[97]=g?.source,e[98]=xe,e[99]=B,e[100]=f?.footnote,e[101]=f?.source,e[102]=b,e[103]=be):be=e[103];let Ye;return e[104]!==J||e[105]!==M||e[106]!==S||e[107]!==j||e[108]!==C||e[109]!==F||e[110]!==Ee||e[111]!==k||e[112]!==st||e[113]!==nt||e[114]!==fe||e[115]!==je||e[116]!==ve||e[117]!==be||e[118]!==ee||e[119]!==b?(Ye=t.jsxRuntimeExports.jsxs(pt.GraphContainer,{className:st,style:nt,id:S,ref:ct,"aria-label":J,backgroundColor:M,theme:ee,language:C,minHeight:F,width:b,height:j,relativeHeight:k,padding:Ee,children:[fe,je,ve,be]}),e[104]=J,e[105]=M,e[106]=S,e[107]=j,e[108]=C,e[109]=F,e[110]=Ee,e[111]=k,e[112]=st,e[113]=nt,e[114]=fe,e[115]=je,e[116]=ve,e[117]=be,e[118]=ee,e[119]=b,e[120]=Ye):Ye=e[120],Ye}function Lt(h){return h.properties.NAME!=="Antarctica"}function zt(h){return h!==void 0}function Ft(h){return h!==void 0}function Wt(h){return h.data}function _t(h){return h!==void 0}function At(h){return h.data}function Bt(h){return h.x}function Tt(h,e){return h-e}function Vt(h){return h.date}exports.ChoroplethMap=It;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-CTPQjnHt.cjs"),x=require("react"),dt=require("./getSliderMarks-BmADcPQt.cjs"),ft=require("./Spinner-CQZcjzwd.cjs"),ut=require("./parse-hMnG_lRV.cjs"),jt=require("./index-DQA8q5sC.cjs"),oe=require("./zoom-DPw8bba-.cjs"),mt=require("./Typography-DX7PlgQU.cjs"),vt=require("./index-DxXnJ8Ti.cjs"),bt=require("./numberFormattingFunction-02t-wJta.cjs"),Et=require("./Tooltip-uUdw6wJL.cjs"),kt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),lt=require("./index-DRXx7m-C.cjs"),wt=require("./DetailsModal-BN0HDFlV.cjs"),Rt=require("./ordinal-CrsysVE-.cjs"),Ct=require("./threshold-DNsSUf8Q.cjs"),it=require("./select-Bnfk0lJx.cjs"),St=require("./use-in-view-QcfiW0w3.cjs"),Je=require("./proxy-BxvUI_9l.cjs"),$t=require("./index-DG2bgAva.cjs"),Dt=require("./GraphFooter.cjs"),Nt=require("./GraphHeader.cjs"),Ke=require("./Colors.cjs"),Mt=require("./fetchAndParseData-l5HGMAEs.cjs"),Ot=require("./getUniqValue-NX8DgwND.cjs"),qt=require("./getJenks-GYmdwBqm.cjs"),pt=require("./GraphContainer-d8A46BK2.cjs");function Pt(h){const{data:e,colorDomain:l,colors:d,mapData:R,colorLegendTitle:D,categorical:B,height:E,width:j,scale:b,centerPoint:T,tooltip:re,mapBorderWidth:V,mapBorderColor:H,mapNoDataColor:ae,onSeriesMouseOver:se,showColorScale:Ee,zoomScaleExtend:Ne,zoomTranslateExtend:Me,highlightedIds:X,onSeriesMouseClick:ne,mapProperty:k,resetSelectionOnDoubleClick:ke,detailsOnClick:Y,styles:Oe,classNames:ie,mapProjection:O,zoomInteraction:q,animate:S,dimmedOpacity:P,customLayers:le,collapseColorScaleByDefault:we}=h,[N,I]=x.useState(void 0),ce=x.useRef(null),[qe,Re]=x.useState(we===void 0?!(j<680):!we),[de,J]=x.useState(void 0),[K,Z]=x.useState(void 0),[f,g]=x.useState(void 0),[ue,me]=x.useState(void 0),G=x.useRef(null),pe=St.useInView(G,{once:S.once,amount:S.amount}),Q=x.useRef(null),he=B?Rt.ordinal().domain(l).range(d):Ct.threshold().domain(l).range(d);x.useEffect(()=>{const o=it.select(Q.current),i=it.select(G.current),v=r=>{if(q==="noZoom")return!1;if(q==="button")return!r.type.includes("wheel");const n=r.type==="wheel",c=r.type.startsWith("touch"),s=r.type==="mousedown"||r.type==="mousemove";return c?!0:n?q==="scroll"?!0:r.ctrlKey:s&&!r.button&&!r.ctrlKey},a=oe.zoom().scaleExtent(Ne).translateExtent(Me||[[-20,-20],[j+20,E+20]]).filter(v).on("zoom",({transform:r})=>{o.attr("transform",r)});i.call(a),ce.current=a},[E,j,q]);const U=oe.turf_bbox_default(R),w=vt.turf_center_of_mass_default(R),xe=U[2]-U[0],L=U[3]-U[1],Ce=j*190/960*360/xe,Se=E*190/678*180/L,z=b*Math.min(Ce,Se),M=O==="mercator"?oe.geoMercator().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):O==="equalEarth"?oe.geoEqualEarth().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):O==="naturalEarth"?oe.geoNaturalEarth1().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):O==="orthographic"?oe.geoOrthographic().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z):oe.geoAlbersUsa().rotate([0,0]).center(T||w.geometry.coordinates).translate([j/2,E/2]).scale(z),ge=o=>{if(!G.current||!ce.current)return;it.select(G.current).call(ce.current.scaleBy,o==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(Je.motion.svg,{width:`${j}px`,height:`${E}px`,viewBox:`0 0 ${j} ${E}`,ref:G,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:Q,children:[le.filter(o=>o.position==="before").map(o=>o.layer),R.features.map((o,i)=>e.findIndex(a=>a.id===o.properties[k])!==-1?null:t.jsxRuntimeExports.jsx("g",{opacity:N?P:X.length!==0?X.indexOf(o.properties[k])!==-1?1:P:1,children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((a,r)=>{let n="";return a.forEach(c=>{let s=" M";c.forEach((m,$)=>{const C=M([m[0],m[1]]);$!==c.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),n+=s}),t.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:H,strokeWidth:V,fill:ae}},r)}):o.geometry.coordinates.map((a,r)=>{let n="M";return a.forEach((c,s)=>{const m=M([c[0],c[1]]);s!==a.length-1?n=`${n}${m[0]} ${m[1]}L`:n=`${n}${m[0]} ${m[1]}`}),t.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:H,strokeWidth:V,fill:ae}},r)})},i)),t.jsxRuntimeExports.jsx($t.AnimatePresence,{children:e.map(o=>{const i=R.features.findIndex(a=>o.id===a.properties[k]),v=kt.checkIfNullOrUndefined(o.x)?ae:he(o.x);return t.jsxRuntimeExports.jsx(Je.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:N?N===v?1:P:X.length!==0?X.indexOf(o.id)!==-1?1:P:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:a=>{Z(o),me(a.clientY),g(a.clientX),se?.(o)},onMouseMove:a=>{Z(o),me(a.clientY),g(a.clientX)},onMouseLeave:()=>{Z(void 0),g(void 0),me(void 0),se?.(void 0)},onClick:()=>{(ne||Y)&&(jt.isEqual(de,o)&&ke?(J(void 0),ne?.(void 0)):(J(o),ne?.(o)))},children:i===-1?null:R.features[i].geometry.type==="MultiPolygon"?R.features[i].geometry.coordinates.map((a,r)=>{let n="";return a.forEach(c=>{let s=" M";c.forEach((m,$)=>{const C=M([m[0],m[1]]);$!==c.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),n+=s}),t.jsxRuntimeExports.jsx(Je.motion.path,{d:n,variants:{initial:{fill:v,opacity:0},whileInView:{fill:v,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:H,strokeWidth:V}},`${o.id}-${r}`)}):R.features[i].geometry.coordinates.map((a,r)=>{let n="M";return a.forEach((c,s)=>{const m=M([c[0],c[1]]);s!==a.length-1?n=`${n}${m[0]} ${m[1]}L`:n=`${n}${m[0]} ${m[1]}`}),t.jsxRuntimeExports.jsx(Je.motion.path,{d:n,variants:{initial:{fill:v,opacity:0},whileInView:{fill:v,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:H,strokeWidth:V}},`${o.id}-${r}`)})},o.id)})}),K?R.features.filter(o=>o.properties[k]===K.id).map((o,i)=>t.jsxRuntimeExports.jsx("g",{children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((v,a)=>{let r="";return v.forEach(n=>{let c=" M";n.forEach((s,m)=>{const $=M([s[0],s[1]]);m!==n.length-1?c=`${c}${$[0]} ${$[1]}L`:c=`${c}${$[0]} ${$[1]}`}),r+=c}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)}):o.geometry.coordinates.map((v,a)=>{let r="M";return v.forEach((n,c)=>{const s=M([n[0],n[1]]);c!==v.length-1?r=`${r}${s[0]} ${s[1]}L`:r=`${r}${s[0]} ${s[1]}`}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)})},i)):null,le.filter(o=>o.position==="after").map(o=>o.layer)]})}),Ee===!1?null:t.jsxRuntimeExports.jsx("div",{className:t.mo("absolute left-4 bottom-4 map-color-legend",ie?.colorLegend),children:qe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Re(!1)},children:t.jsxRuntimeExports.jsx(lt.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:B?void 0:"340px"},children:[D&&D!==""?t.jsxRuntimeExports.jsx(mt.j,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:D}):null,B?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:l.map((o,i)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{I(d[i%d.length])},onMouseLeave:()=>{I(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d[i%d.length]}}),t.jsxRuntimeExports.jsx(mt.j,{size:"sm",marginBottom:"none",leading:"none",children:o})]},i))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[l.map((o,i)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{I(d[i])},onMouseLeave:()=>{I(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:i*320/d.length+1,y:1,width:320/d.length-2,height:8,className:N===d[i]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:d[i],...N===d[i]?{}:{stroke:d[i]}}}),t.jsxRuntimeExports.jsx("text",{x:(i+1)*320/d.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:bt.numberFormattingFunction(o,"NA")})]},i)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{I(d[l.length])},onMouseLeave:()=>{I(void 0)},x:l.length*320/d.length+1,y:1,width:320/d.length-2,height:8,className:`cursor-pointer ${N===d[l.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:d[l.length],...N===d[l.length]?{}:{stroke:d[l.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start map-legend-button",onClick:()=>{Re(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>ge("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>ge("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),Y&&de!==void 0?t.jsxRuntimeExports.jsx(wt.DetailsModal,{body:Y,data:de,setData:J,className:ie?.modal}):null,K&&re&&f&&ue?t.jsxRuntimeExports.jsx(Et.Tooltip,{data:K,body:re,xPos:f,yPos:ue,backgroundStyle:Oe?.tooltip,className:ie?.tooltip}):null]})}function It(h){const e=t.compilerRuntimeExports.c(121),{data:l,mapData:d,graphTitle:R,colors:D,sources:B,graphDescription:E,height:j,width:b,footNote:T,colorDomain:re,colorLegendTitle:V,scaleType:H,scale:ae,centerPoint:se,padding:Ee,mapBorderWidth:Ne,mapNoDataColor:Me,backgroundColor:X,mapBorderColor:ne,relativeHeight:k,tooltip:ke,onSeriesMouseOver:Y,isWorldMap:Oe,showColorScale:ie,zoomScaleExtend:O,zoomTranslateExtend:q,graphID:S,highlightedIds:P,onSeriesMouseClick:le,mapProperty:we,graphDownload:N,dataDownload:I,showAntarctica:ce,language:qe,minHeight:Re,theme:de,ariaLabel:J,resetSelectionOnDoubleClick:K,detailsOnClick:Z,styles:f,classNames:g,mapProjection:ue,zoomInteraction:me,animate:G,dimmedOpacity:pe,customLayers:Q,timeline:he,collapseColorScaleByDefault:U}=h,w=d===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":d,xe=T===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":T,L=H===void 0?"threshold":H,Ce=ae===void 0?.95:ae,Se=Ne===void 0?.5:Ne,z=Me===void 0?Ke.Colors.light.graphNoData:Me,M=X===void 0?!1:X,ge=ne===void 0?Ke.Colors.light.grays["gray-500"]:ne,o=Oe===void 0?!0:Oe,i=ie===void 0?!0:ie;let v;e[0]!==O?(v=O===void 0?[.8,6]:O,e[0]=O,e[1]=v):v=e[1];const a=v;let r;e[2]!==P?(r=P===void 0?[]:P,e[2]=P,e[3]=r):r=e[3];const n=r,c=we===void 0?"ISO3":we,s=N===void 0?!1:N,m=I===void 0?!1:I,$=ce===void 0?!1:ce,C=qe===void 0?"en":qe,F=Re===void 0?0:Re,ee=de===void 0?"light":de,Ze=K===void 0?!0:K,Qe=me===void 0?"button":me,Pe=G===void 0?!1:G,et=pe===void 0?.3:pe;let Ie;e[4]!==Q?(Ie=Q===void 0?[]:Q,e[4]=Q,e[5]=Ie):Ie=e[5];const tt=Ie;let Le;e[6]!==he?(Le=he===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:he,e[6]=he,e[7]=Le):Le=e[7];const u=Le,[te,ht]=x.useState(0),[$e,xt]=x.useState(0),[W,gt]=x.useState(u.autoplay);let De;if(e[8]!==l||e[9]!==u.dateFormat){let y;e[11]!==u.dateFormat?(y=A=>ut.parse(`${A.date}`,u.dateFormat||"yyyy",new Date).getTime(),e[11]=u.dateFormat,e[12]=y):y=e[12],De=[...new Set(l.filter(Vt).map(y))],De.sort(Tt),e[8]=l,e[9]=u.dateFormat,e[10]=De}else De=e[10];const p=De,[_,ot]=x.useState(u.autoplay?0:p.length-1),[ye,yt]=x.useState(void 0),rt=x.useRef(null),ct=x.useRef(null);let ze,Fe;e[13]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{const y=new ResizeObserver(A=>{ht(A[0].target.clientWidth||620),xt(A[0].target.clientHeight||480)});return rt.current&&y.observe(rt.current),()=>y.disconnect()},Fe=[],e[13]=ze,e[14]=Fe):(ze=e[13],Fe=e[14]),x.useEffect(ze,Fe);let We;e[15]===Symbol.for("react.memo_cache_sentinel")?(We=y=>{yt(y)},e[15]=We):We=e[15];const _e=x.useEffectEvent(We);let Ae;e[16]!==w||e[17]!==_e?(Ae=()=>{typeof w=="string"?Mt.fetchAndParseJSON(w).then(A=>{_e(A)}):_e(w)},e[16]=w,e[17]=_e,e[18]=Ae):Ae=e[18];let Be;e[19]!==w?(Be=[w],e[19]=w,e[20]=Be):Be=e[20],x.useEffect(Ae,Be);let Te;e[21]!==re||e[22]!==D?.length||e[23]!==l||e[24]!==L?(Te=re||(L==="categorical"?Ot.getUniqValue(l,"x"):qt.getJenks(l.map(Bt),D?.length||4)),e[21]=re,e[22]=D?.length,e[23]=l,e[24]=L,e[25]=Te):Te=e[25];const Ve=Te;let Ge,Ue;e[26]!==W||e[27]!==u.speed||e[28]!==p?(Ge=()=>{const y=setInterval(()=>{ot(A=>A<p.length-1?A+1:0)},(u.speed||2)*1e3);return W||clearInterval(y),()=>clearInterval(y)},Ue=[p,W,u.speed],e[26]=W,e[27]=u.speed,e[28]=p,e[29]=Ge,e[30]=Ue):(Ge=e[29],Ue=e[30]),x.useEffect(Ge,Ue);const at=u.dateFormat||"yyyy";let He;e[31]!==_||e[32]!==at||e[33]!==u.showOnlyActiveDate||e[34]!==p?(He=dt.getSliderMarks(p,_,u.showOnlyActiveDate,at),e[31]=_,e[32]=at,e[33]=u.showOnlyActiveDate,e[34]=p,e[35]=He):He=e[35];const Xe=He,st=g?.graphContainer,nt=f?.graphContainer;let fe;e[36]!==g?.description||e[37]!==g?.title||e[38]!==l||e[39]!==m||e[40]!==E||e[41]!==s||e[42]!==R||e[43]!==f?.description||e[44]!==f?.title||e[45]!==b?(fe=R||E||s||m?t.jsxRuntimeExports.jsx(Nt.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:g?.title,description:g?.description},graphTitle:R,graphDescription:E,width:b,graphDownload:s?ct:void 0,dataDownload:m?l.map(At).filter(_t).length>0?l.map(Wt).filter(Ft):l.filter(zt):null}):null,e[36]=g?.description,e[37]=g?.title,e[38]=l,e[39]=m,e[40]=E,e[41]=s,e[42]=R,e[43]=f?.description,e[44]=f?.title,e[45]=b,e[46]=fe):fe=e[46];let je;e[47]!==_||e[48]!==Xe||e[49]!==W||e[50]!==u.enabled||e[51]!==p?(je=u.enabled&&p.length>0&&Xe?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{gt(!W)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":W?"Click to pause animation":"Click to play animation",children:W?t.jsxRuntimeExports.jsx(lt.Pause,{}):t.jsxRuntimeExports.jsx(lt.Play,{})}),t.jsxRuntimeExports.jsx(dt.Nr,{min:p[0],max:p[p.length-1],marks:Xe,step:null,defaultValue:p[p.length-1],value:p[_],onChangeComplete:y=>{ot(p.indexOf(y))},onChange:y=>{ot(p.indexOf(y))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[47]=_,e[48]=Xe,e[49]=W,e[50]=u.enabled,e[51]=p,e[52]=je):je=e[52];let ve;e[53]!==Pe||e[54]!==se||e[55]!==g||e[56]!==U||e[57]!==V||e[58]!==D||e[59]!==tt||e[60]!==l||e[61]!==Z||e[62]!==et||e[63]!==Ve||e[64]!==j||e[65]!==n||e[66]!==_||e[67]!==o||e[68]!==ge||e[69]!==Se||e[70]!==z||e[71]!==ue||e[72]!==c||e[73]!==ye||e[74]!==F||e[75]!==le||e[76]!==Y||e[77]!==k||e[78]!==Ze||e[79]!==Ce||e[80]!==L||e[81]!==$||e[82]!==i||e[83]!==f||e[84]!==$e||e[85]!==te||e[86]!==ee||e[87]!==u.dateFormat||e[88]!==u.enabled||e[89]!==ke||e[90]!==p||e[91]!==b||e[92]!==Qe||e[93]!==a||e[94]!==q?(ve=t.jsxRuntimeExports.jsx(pt.GraphArea,{ref:rt,children:te&&$e&&ye?t.jsxRuntimeExports.jsx(Pt,{data:l.filter(y=>u.enabled?y.date===ut.format(new Date(p[_]),u.dateFormat||"yyyy"):y),mapData:$?ye:{...ye,features:ye.features.filter(Lt)},colorDomain:Ve,width:te,height:$e,scale:Ce,centerPoint:se,colors:D||(L==="categorical"?Ke.Colors[ee].categoricalColors.colors:Ke.Colors[ee].sequentialColors[`neutralColorsx0${Ve.length+1}`]),colorLegendTitle:V,mapBorderWidth:Se,mapNoDataColor:z,categorical:L==="categorical",mapBorderColor:ge,tooltip:ke,onSeriesMouseOver:Y,isWorldMap:o,showColorScale:i,zoomScaleExtend:a,zoomTranslateExtend:q,onSeriesMouseClick:le,mapProperty:c,highlightedIds:n,resetSelectionOnDoubleClick:Ze,styles:f,classNames:g,detailsOnClick:Z,mapProjection:ue||(o?"naturalEarth":"mercator"),zoomInteraction:Qe,dimmedOpacity:et,animate:Pe===!0?{duration:.5,once:!0,amount:.5}:Pe||{duration:0,once:!0,amount:0},customLayers:tt,collapseColorScaleByDefault:U}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(F,j||(k?F?(b||te)*k>F?(b||te)*k:F:(b||te)*k:$e))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(ft.w,{"aria-label":"Loading graph"})})}),e[53]=Pe,e[54]=se,e[55]=g,e[56]=U,e[57]=V,e[58]=D,e[59]=tt,e[60]=l,e[61]=Z,e[62]=et,e[63]=Ve,e[64]=j,e[65]=n,e[66]=_,e[67]=o,e[68]=ge,e[69]=Se,e[70]=z,e[71]=ue,e[72]=c,e[73]=ye,e[74]=F,e[75]=le,e[76]=Y,e[77]=k,e[78]=Ze,e[79]=Ce,e[80]=L,e[81]=$,e[82]=i,e[83]=f,e[84]=$e,e[85]=te,e[86]=ee,e[87]=u.dateFormat,e[88]=u.enabled,e[89]=ke,e[90]=p,e[91]=b,e[92]=Qe,e[93]=a,e[94]=q,e[95]=ve):ve=e[95];let be;e[96]!==g?.footnote||e[97]!==g?.source||e[98]!==xe||e[99]!==B||e[100]!==f?.footnote||e[101]!==f?.source||e[102]!==b?(be=B||xe?t.jsxRuntimeExports.jsx(Dt.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:B,footNote:xe,width:b}):null,e[96]=g?.footnote,e[97]=g?.source,e[98]=xe,e[99]=B,e[100]=f?.footnote,e[101]=f?.source,e[102]=b,e[103]=be):be=e[103];let Ye;return e[104]!==J||e[105]!==M||e[106]!==S||e[107]!==j||e[108]!==C||e[109]!==F||e[110]!==Ee||e[111]!==k||e[112]!==st||e[113]!==nt||e[114]!==fe||e[115]!==je||e[116]!==ve||e[117]!==be||e[118]!==ee||e[119]!==b?(Ye=t.jsxRuntimeExports.jsxs(pt.GraphContainer,{className:st,style:nt,id:S,ref:ct,"aria-label":J,backgroundColor:M,theme:ee,language:C,minHeight:F,width:b,height:j,relativeHeight:k,padding:Ee,children:[fe,je,ve,be]}),e[104]=J,e[105]=M,e[106]=S,e[107]=j,e[108]=C,e[109]=F,e[110]=Ee,e[111]=k,e[112]=st,e[113]=nt,e[114]=fe,e[115]=je,e[116]=ve,e[117]=be,e[118]=ee,e[119]=b,e[120]=Ye):Ye=e[120],Ye}function Lt(h){return h.properties.NAME!=="Antarctica"}function zt(h){return h!==void 0}function Ft(h){return h!==void 0}function Wt(h){return h.data}function _t(h){return h!==void 0}function At(h){return h.data}function Bt(h){return h.x}function Tt(h,e){return h-e}function Vt(h){return h.date}exports.ChoroplethMap=It;
|
|
2
2
|
//# sourceMappingURL=ChoroplethMap.cjs.map
|
package/dist/ChoroplethMap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as t, m as gt, c as ft } from "./index-CHPV5EwG-Curnpaqc.js";
|
|
2
2
|
import { useState as S, useRef as Me, useEffect as Ze, useEffectEvent as yt } from "react";
|
|
3
3
|
import { g as xt, N as vt } from "./getSliderMarks-HIDJ0_Cd.js";
|
|
4
|
-
import { w as bt } from "./Spinner-
|
|
4
|
+
import { w as bt } from "./Spinner-DVBnY6Vg.js";
|
|
5
5
|
import { f as kt, p as jt } from "./parse-DlCRUFh_.js";
|
|
6
6
|
import { i as wt } from "./index-Bwrro8-q.js";
|
|
7
7
|
import { z as $t, t as Dt, g as Ct, a as Nt, b as St, c as Mt, d as Ot } from "./zoom-C9MFjAaV.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CHPV5EwG-CTPQjnHt.cjs");require("react");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CHPV5EwG-CTPQjnHt.cjs");require("react");const e=require("./index-WML2dCZ0.cjs");require("./GraphFooter.cjs");require("./GraphHeader.cjs");require("./ColorLegendWithMouseOver.cjs");require("./Colors.cjs");require("./EmptyState-gLDRXBHm.cjs");require("./uniqBy-O05lp2S5.cjs");require("./GraphContainer-d8A46BK2.cjs");exports.CirclePackingGraph=e.CirclePackingGraph;
|
|
2
2
|
//# sourceMappingURL=CirclePackingGraph.cjs.map
|
package/dist/DonutChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),O=require("react"),ot=require("./Typography-DX7PlgQU.cjs"),xt=require("./index-Cno4Q0YE.cjs"),mt=require("./Source-DYMJRrsq.cjs"),pt=require("./index-DQA8q5sC.cjs"),dt=require("./Tooltip-uUdw6wJL.cjs"),W=require("./Colors.cjs"),ct=require("./numberFormattingFunction-02t-wJta.cjs"),gt=require("./DetailsModal-BN0HDFlV.cjs"),z=require("./array-DMyR1sql.cjs"),ht=require("./use-in-view-QcfiW0w3.cjs"),ft=require("./index-DG2bgAva.cjs"),rt=require("./proxy-BxvUI_9l.cjs"),yt=require("./GraphFooter.cjs"),jt=require("./GraphHeader.cjs"),vt=require("./EmptyState-gLDRXBHm.cjs"),it=require("./GraphContainer-d8A46BK2.cjs"),bt=Math.PI,st=2*bt;function Et(l,t){return t<l?-1:t>l?1:t>=l?0:NaN}function Ct(l){return l}function Rt(){var l=Ct,t=Et,n=null,c=z.constant(0),r=z.constant(st),p=z.constant(0);function s(e){var a,f=(e=z.array(e)).length,d,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),O=require("react"),ot=require("./Typography-DX7PlgQU.cjs"),xt=require("./index-Cno4Q0YE.cjs"),mt=require("./Source-DYMJRrsq.cjs"),pt=require("./index-DQA8q5sC.cjs"),dt=require("./Tooltip-uUdw6wJL.cjs"),W=require("./Colors.cjs"),ct=require("./numberFormattingFunction-02t-wJta.cjs"),gt=require("./DetailsModal-BN0HDFlV.cjs"),z=require("./array-DMyR1sql.cjs"),ht=require("./use-in-view-QcfiW0w3.cjs"),ft=require("./index-DG2bgAva.cjs"),rt=require("./proxy-BxvUI_9l.cjs"),yt=require("./GraphFooter.cjs"),jt=require("./GraphHeader.cjs"),vt=require("./EmptyState-gLDRXBHm.cjs"),it=require("./GraphContainer-d8A46BK2.cjs"),bt=Math.PI,st=2*bt;function Et(l,t){return t<l?-1:t>l?1:t>=l?0:NaN}function Ct(l){return l}function Rt(){var l=Ct,t=Et,n=null,c=z.constant(0),r=z.constant(st),p=z.constant(0);function s(e){var a,f=(e=z.array(e)).length,d,w,x=0,g=new Array(f),v=new Array(f),y=+c.apply(this,arguments),A=Math.min(st,Math.max(-st,r.apply(this,arguments)-y)),m,P=Math.min(Math.abs(A)/f,p.apply(this,arguments)),F=P*(A<0?-1:1),h;for(a=0;a<f;++a)(h=v[g[a]=a]=+l(e[a],a,e))>0&&(x+=h);for(t!=null?g.sort(function(R,S){return t(v[R],v[S])}):n!=null&&g.sort(function(R,S){return n(e[R],e[S])}),a=0,w=x?(A-f*F)/x:0;a<f;++a,y=m)d=g[a],h=v[d],m=y+(h>0?h*w:0)+F,v[d]={data:e[d],index:a,value:h,startAngle:y,endAngle:m,padAngle:P};return v}return s.value=function(e){return arguments.length?(l=typeof e=="function"?e:z.constant(+e),s):l},s.sortValues=function(e){return arguments.length?(t=e,n=null,s):t},s.sort=function(e){return arguments.length?(n=e,t=null,s):n},s.startAngle=function(e){return arguments.length?(c=typeof e=="function"?e:z.constant(+e),s):c},s.endAngle=function(e){return arguments.length?(r=typeof e=="function"?e:z.constant(+e),s):r},s.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:z.constant(+e),s):p},s}const at=(l,t,n,c)=>({x:l+n*Math.cos(c),y:t+n*Math.sin(c)});function lt(l,t,n,c,r){const p=at(l,t,n,c),s=at(l,t,n,r===2*Math.PI?1.9999999999*Math.PI:r),e=r-c<=Math.PI?"0":"1";return["M",p.x,p.y,"A",n,n,0,e,1,s.x,s.y].join(" ")}function Mt(l){const t=o.compilerRuntimeExports.c(59),{mainText:n,data:c,radius:r,colors:p,subNote:s,strokeWidth:e,tooltip:a,onSeriesMouseOver:f,onSeriesMouseClick:d,colorDomain:w,resetSelectionOnDoubleClick:x,detailsOnClick:g,styles:v,classNames:y,precision:A,animate:m,trackColor:P}=l,F=O.useRef(null);let h;t[0]!==m.amount||t[1]!==m.once?(h={once:m.once,amount:m.amount},t[0]=m.amount,t[1]=m.once,t[2]=h):h=t[2];const R=ht.useInView(F,h),S=Rt().sort(null).startAngle(0).value(Dt),[j,X]=O.useState(void 0),[b,E]=O.useState(void 0),[G,Y]=O.useState(void 0),[T,J]=O.useState(void 0),K=rt.motion,Q=`${r*2}px`,U=`${r*2}px`,M=`0 0 ${r*2} ${r*2}`,I="ltr",et="mx-auto",$=rt.motion,Z=`translate(${r} ${r})`;let q;t[3]!==c||t[4]!==n||t[5]!==A||t[6]!==r||t[7]!==e||t[8]!==s?(q=n||s?o.jsxRuntimeExports.jsx("foreignObject",{y:0-(r-e),x:0-(r-e),width:2*(r-e),height:2*(r-e),children:o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4",children:[n?o.jsxRuntimeExports.jsx(ot.v,{marginBottom:"none",className:"donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center",children:typeof n=="string"?n:c.findIndex(u=>u.label===n.label)!==-1?ct.numberFormattingFunction(c[c.findIndex(u=>u.label===n.label)].size,"NA",A,n.prefix,n.suffix):"NA"}):null,s?o.jsxRuntimeExports.jsx(ot.j,{marginBottom:"none",size:"base",leading:"none",className:"donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:s}):typeof n=="string"||!n?null:o.jsxRuntimeExports.jsx(ot.j,{size:"base",marginBottom:"none",leading:"none",className:"donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:n.label})]})}):null,t[3]=c,t[4]=n,t[5]=A,t[6]=r,t[7]=e,t[8]=s,t[9]=q):q=t[9];const _=r-e/2;let D;t[10]!==e||t[11]!==_||t[12]!==P?(D=o.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:_,fill:"none",stroke:P,strokeWidth:e}),t[10]=e,t[11]=_,t[12]=P,t[13]=D):D=t[13];const V=ft.AnimatePresence;let N;t[14]!==m.duration||t[15]!==w||t[16]!==p||t[17]!==g||t[18]!==R||t[19]!==b||t[20]!==j||t[21]!==d||t[22]!==f||t[23]!==r||t[24]!==x||t[25]!==E||t[26]!==e?(N=(u,ut)=>o.jsxRuntimeExports.jsx(rt.motion.path,{variants:{initial:{pathLength:0,d:lt(0,0,r-e/2,u.startAngle-Math.PI/2,u.endAngle-Math.PI/2),opacity:j?j.label===u.data.label?1:.3:1},whileInView:{pathLength:1,d:lt(0,0,r-e/2,u.startAngle-Math.PI/2,u.endAngle-Math.PI/2),opacity:j?j.label===u.data.label?1:.3:1,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},style:{stroke:w.indexOf(u.data.label)!==-1?p[w.indexOf(u.data.label)%p.length]:W.Colors.gray,strokeWidth:e,fill:"none"},onMouseEnter:tt=>{X(u.data),J(tt.clientY),Y(tt.clientX),f?.(u)},onClick:()=>{(d||g)&&(pt.isEqual(b,u.data)&&x?(E(void 0),d?.(void 0)):(E(u.data),d&&d(u.data)))},onMouseMove:tt=>{X(u.data),J(tt.clientY),Y(tt.clientX)},onMouseLeave:()=>{X(void 0),Y(void 0),J(void 0),f?.(void 0)}},ut),t[14]=m.duration,t[15]=w,t[16]=p,t[17]=g,t[18]=R,t[19]=b,t[20]=j,t[21]=d,t[22]=f,t[23]=r,t[24]=x,t[25]=E,t[26]=e,t[27]=N):N=t[27];const i=S(c).map(N);let C;t[28]!==V||t[29]!==i?(C=o.jsxRuntimeExports.jsx(V,{children:i}),t[28]=V,t[29]=i,t[30]=C):C=t[30];let k;t[31]!==D||t[32]!==C||t[33]!==$.g||t[34]!==Z||t[35]!==q?(k=o.jsxRuntimeExports.jsxs($.g,{transform:Z,children:[q,D,C]}),t[31]=D,t[32]=C,t[33]=$.g,t[34]=Z,t[35]=q,t[36]=k):k=t[36];let B;t[37]!==K.svg||t[38]!==k||t[39]!==Q||t[40]!==U||t[41]!==M?(B=o.jsxRuntimeExports.jsx(K.svg,{ref:F,width:Q,height:U,viewBox:M,direction:I,className:et,children:k}),t[37]=K.svg,t[38]=k,t[39]=Q,t[40]=U,t[41]=M,t[42]=B):B=t[42];let H;t[43]!==y?.tooltip||t[44]!==G||t[45]!==T||t[46]!==j||t[47]!==v?.tooltip||t[48]!==a?(H=j&&a&&G&&T?o.jsxRuntimeExports.jsx(dt.Tooltip,{data:j,body:a,xPos:G,yPos:T,backgroundStyle:v?.tooltip,className:y?.tooltip}):null,t[43]=y?.tooltip,t[44]=G,t[45]=T,t[46]=j,t[47]=v?.tooltip,t[48]=a,t[49]=H):H=t[49];let L;t[50]!==y?.modal||t[51]!==g||t[52]!==b||t[53]!==E?(L=g&&b!==void 0?o.jsxRuntimeExports.jsx(gt.DetailsModal,{body:g,data:b,setData:E,className:y?.modal}):null,t[50]=y?.modal,t[51]=g,t[52]=b,t[53]=E,t[54]=L):L=t[54];let nt;return t[55]!==B||t[56]!==H||t[57]!==L?(nt=o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[B,H,L]}),t[55]=B,t[56]=H,t[57]=L,t[58]=nt):nt=t[58],nt}function Dt(l){return l.size}function Nt(l){const{mainText:t,graphTitle:n,colors:c=W.Colors.light.categoricalColors.colors,suffix:r="",sources:p,prefix:s="",strokeWidth:e=50,graphDescription:a,subNote:f,footNote:d,radius:w,data:x,showColorScale:g=!0,padding:v,backgroundColor:y=!1,tooltip:A,onSeriesMouseOver:m,graphID:P,onSeriesMouseClick:F,graphDownload:h=!1,dataDownload:R=!1,colorDomain:S,sortData:j,language:X="en",theme:b="light",width:E,height:G,minHeight:Y=0,relativeHeight:T,ariaLabel:J,resetSelectionOnDoubleClick:K=!0,colorScaleMaxWidth:Q,detailsOnClick:U,styles:M,classNames:I,precision:et=2,animate:$=!1,trackColor:Z=W.Colors.light.grays["gray-200"]}=l,[q,_]=O.useState(0),D=O.useRef(null),V=O.useRef(null);O.useEffect(()=>{const i=new ResizeObserver(C=>{_((Math.min(C[0].target.clientWidth||620,C[0].target.clientHeight||480)||420)/2)});return D.current&&i.observe(D.current),()=>i.disconnect()},[]);const N=j?xt.orderBy(x,["size"],[j]):x;return o.jsxRuntimeExports.jsxs(it.GraphContainer,{className:I?.graphContainer,style:M?.graphContainer,id:P,ref:V,"aria-label":J,backgroundColor:y,theme:b,language:X,minHeight:Y,width:E,height:G,relativeHeight:T,padding:v,children:[n||a||h||R?o.jsxRuntimeExports.jsx(jt.GraphHeader,{styles:{title:M?.title,description:M?.description},classNames:{title:I?.title,description:I?.description},graphTitle:n,graphDescription:a,width:E,graphDownload:h?V:void 0,dataDownload:R?x.map(i=>i.data).filter(i=>i!==void 0).length>0?x.map(i=>i.data).filter(i=>i!==void 0):x.filter(i=>i!==void 0):null}):null,g&&x.length>0?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:o.mo("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap",I?.colorLegend),style:{maxWidth:Q},"aria-label":"Color legend",children:N.map((i,C)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center pb-3",children:[o.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:(S||N.map(k=>k.label)).indexOf(i.label)!==-1?(c||W.Colors[b].categoricalColors.colors)[(S||N.map(k=>k.label)).indexOf(i.label)%(c||W.Colors[b].categoricalColors.colors).length]:W.Colors.gray}}),o.jsxRuntimeExports.jsxs(ot.j,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[i.label,":"," ",o.jsxRuntimeExports.jsx("span",{className:"font-bold",style:{fontSize:"inherit"},children:ct.numberFormattingFunction(i.size,"NA",et,s,r)})]})]},C))}),o.jsxRuntimeExports.jsx(mt.n,{size:"lg"})]}):null,o.jsxRuntimeExports.jsxs(it.GraphArea,{ref:D,children:[x.length===0&&o.jsxRuntimeExports.jsx(vt.EmptyState,{}),q&&x.length>0?o.jsxRuntimeExports.jsx(Mt,{mainText:t,data:N,colors:c,radius:w||q,subNote:f,strokeWidth:e,tooltip:A,colorDomain:S||N.map(i=>i.label),onSeriesMouseOver:m,onSeriesMouseClick:F,resetSelectionOnDoubleClick:K,styles:M,detailsOnClick:U,precision:et,animate:$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},trackColor:Z}):null]}),p||d?o.jsxRuntimeExports.jsx(yt.GraphFooter,{styles:{footnote:M?.footnote,source:M?.source},classNames:{footnote:I?.footnote,source:I?.source},sources:p,footNote:d,width:E}):null]})}exports.DonutChart=Nt;
|
|
2
2
|
//# sourceMappingURL=DonutChart.cjs.map
|