(window.webpackJsonp=window.webpackJsonp||[]).push([[70],{4902:function(t,e,a){},5066:function(t,e,a){"use strict";a.r(e);var n=a(891),r=a(238),s=a.n(r),o=a(2),i=a.n(o),c=a(302),l=a(598),p=a(932);a(4902);const d={data:i.a.arrayOf(i.a.shape({country_id:i.a.string,metric:i.a.number})),width:i.a.number,height:i.a.number,country:i.a.string,linearColorScheme:i.a.string,mapBaseUrl:i.a.string,numberFormat:i.a.string},u={};function f(t,e){const{data:a,width:n,height:r,country:o,linearColorScheme:i,numberFormat:d}=e,f=t,g=Object(c.c)(d),h=Object(l.a)().get(i).createLinearScale(function(t,e){let a,n;if(void 0===e)for(const e of t)null!=e&&(void 0===a?e>=e&&(a=n=e):(a>e&&(a=e),n<e&&(n=e)));else{let r=-1;for(let s of t)null!=(s=e(s,++r,t))&&(void 0===a?s>=s&&(a=n=s):(a>s&&(a=s),n<s&&(n=s)))}return[a,n]}(a,t=>t.metric)),m={};a.forEach(t=>{m[t.country_id]=h(t.metric)});const y=t=>m[t.properties.ISO]||"none",b=s.a.geo.path(),v=s.a.select(f);v.classed("superset-legacy-chart-country-map",!0),v.selectAll("*").remove(),f.style.height=`${r}px`,f.style.width=`${n}px`;const x=v.append("svg:svg").attr("width",n).attr("height",r).attr("preserveAspectRatio","xMidYMid meet"),w=x.append("rect").attr("class","background").attr("width",n).attr("height",r),$=x.append("g"),k=$.append("g").classed("map-layer",!0),O=$.append("g").classed("text-layer",!0).attr("transform",`translate(${n/2}, 45)`),S=O.append("text").classed("big-text",!0),_=O.append("text").classed("result-text",!0).attr("dy","1em");let j;const A=function(t){const e=t&&j!==t;let a,s,o;const i=n/2,c=r/2;if(e){const e=b.centroid(t);[a,s]=e,o=4,j=t}else a=i,s=c,o=1,j=null;$.transition().duration(750).attr("transform",`translate(${i},${c})scale(${o})translate(${-a},${-s})`),O.style("opacity",0).attr("transform",`translate(0,0)translate(${a},${e?s-5:45})`).transition().duration(750).style("opacity",1),S.transition().duration(750).style("font-size",e?6:16),_.transition().duration(750).style("font-size",e?16:24)};w.on("click",A);const M=function(t){let e=y(t);"none"!==e&&(e=s.a.rgb(e).darker().toString()),s.a.select(this).style("fill",e),function(t){let e="";t&&t.properties&&(e=t.properties.ID_2?t.properties.NAME_2:t.properties.NAME_1),S.text(e)}(t);const n=a.filter(e=>e.country_id===t.properties.ISO);var r;(r=n).length>0&&_.text(g(r[0].metric))},C=function(){s.a.select(this).style("fill",y),S.text(""),_.text("")};function E(t){const{features:e}=t,a=s.a.geo.centroid(t),o=s.a.geo.mercator().scale(100).center(a).translate([n/2,r/2]);b.projection(o);const i=b.bounds(t),c=100*n/(i[1][0]-i[0][0]),l=100*r/(i[1][1]-i[0][1]),p=c<l?c:l;o.scale(p);const d=b.bounds(t);o.translate([n-(d[0][0]+d[1][0])/2,r-(d[0][1]+d[1][1])/2]),k.selectAll("path").data(e).enter().append("path").attr("d",b).attr("class","region").attr("vector-effect","non-scaling-stroke").style("fill",y).on("mouseenter",M).on("mouseout",C).on("click",A)}const I=u[o];if(I)E(I);else{const e=p.b[o];s.a.json(e,(e,a)=>{if(e){var n;const e=(null==(n=p.a.find(t=>t[0]===o))?void 0:n[1])||o;s.a.select(t).html(`<div class="alert alert-danger">Could not load map data for ${e}</div>`)}else u[o]=a,E(a)})}}f.displayName="CountryMap",f.propTypes=d;var g=f;e.default=Object(n.a)(g)}}]);