"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[2139],{2139:(t,e,n)=>{n.r(e),n.d(e,{default:()=>$});var r=n(7240),s=n(96453),a=n(24143),o=n.n(a),c=n(5556),i=n.n(c),l=n(61573),p=n(32142),u=n(69161),d=n(94963),h=n(59412);const y={data:i().arrayOf(i().shape({country_id:i().string,metric:i().number})),width:i().number,height:i().number,country:i().string,colorScheme:i().string,linearColorScheme:i().string,mapBaseUrl:i().string,numberFormat:i().string},g={};function m(t,e){const{data:n,width:r,height:s,country:a,linearColorScheme:c,numberFormat:i,colorScheme:y,sliceId:m}=e,f=t,x=(0,p.gV)(i),v=(0,u.A)().get(c).createLinearScale((0,l.A)(n,(t=>t.metric))),$=d.getScale(y),b={};n.forEach((t=>{b[t.country_id]=y?$(t.country_id,m):v(t.metric)}));const k=t=>b[t.properties.ISO]||"none",w=o().geo.path(),C=o().select(f);C.classed("superset-legacy-chart-country-map",!0),C.selectAll("*").remove(),f.style.height=`${s}px`,f.style.width=`${r}px`;const A=C.append("svg:svg").attr("width",r).attr("height",s).attr("preserveAspectRatio","xMidYMid meet"),N=A.append("rect").attr("class","background").attr("width",r).attr("height",s),S=A.append("g"),T=S.append("g").classed("map-layer",!0),_=S.append("g").classed("text-layer",!0).attr("transform",`translate(${r/2}, 45)`),z=_.append("text").classed("big-text",!0),M=_.append("text").classed("result-text",!0).attr("dy","1em");let I;const R=function(t){const e=t&&I!==t;let n,a,o;const c=r/2,i=s/2;if(e){const e=w.centroid(t);[n,a]=e,o=4,I=t}else n=c,a=i,o=1,I=null;S.transition().duration(750).attr("transform",`translate(${c},${i})scale(${o})translate(${-n},${-a})`),_.style("opacity",0).attr("transform",`translate(0,0)translate(${n},${e?a-5:45})`).transition().duration(750).style("opacity",1),z.transition().duration(750).style("font-size",e?6:16),M.transition().duration(750).style("font-size",e?16:24)};N.on("click",R);const U=function(t){let e=k(t);"none"!==e&&(e=o().rgb(e).darker().toString()),o().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),z.text(e)}(t);const r=n.filter((e=>e.country_id===t.properties.ISO));var s;(s=r).length>0&&M.text(x(s[0].metric))},Y=function(){o().select(this).style("fill",k),z.text(""),M.text("")};function D(t){const{features:e}=t,n=o().geo.centroid(t),a=o().geo.mercator().scale(100).center(n).translate([r/2,s/2]);w.projection(a);const c=w.bounds(t),i=100*r/(c[1][0]-c[0][0]),l=100*s/(c[1][1]-c[0][1]),p=i<l?i:l;a.scale(p);const u=w.bounds(t);a.translate([r-(u[0][0]+u[1][0])/2,s-(u[0][1]+u[1][1])/2]),T.selectAll("path").data(e).enter().append("path").attr("d",w).attr("class","region").attr("vector-effect","non-scaling-stroke").style("fill",k).on("mouseenter",U).on("mouseout",Y).on("click",R)}const E=g[a];if(E)D(E);else{const e=h.Ay[a];o().json(e,((e,n)=>{if(e){var r;const e=(null==(r=h.JK.find((t=>t[0]===a)))?void 0:r[1])||a;o().select(t).html(`<div class="alert alert-danger">Could not load map data for ${e}</div>`)}else g[a]=n,D(n)}))}}m.displayName="CountryMap",m.propTypes=y;const f=m;var x=n(2445);const v=(0,r.A)(f),$=(0,s.I4)((({className:t,...e})=>(0,x.Y)("div",{className:t,children:(0,x.Y)(v,{...e})})))`
  ${({theme:t})=>`\n    .superset-legacy-chart-country-map svg {\n      background-color: ${t.colors.grayscale.light5};\n    }\n\n    .superset-legacy-chart-country-map {\n      position: relative;\n    }\n\n    .superset-legacy-chart-country-map .background {\n      fill: ${t.colors.grayscale.light5};\n      pointer-events: all;\n    }\n\n    .superset-legacy-chart-country-map .map-layer {\n      fill: ${t.colors.grayscale.light5};\n      stroke: ${t.colors.grayscale.light1};\n    }\n\n    .superset-legacy-chart-country-map .effect-layer {\n      pointer-events: none;\n    }\n\n    .superset-legacy-chart-country-map .text-layer {\n      color: ${t.colors.grayscale.dark1};\n      text-anchor: middle;\n      pointer-events: none;\n    }\n\n    .superset-legacy-chart-country-map text.result-text {\n      font-weight: ${t.typography.weights.light};\n      font-size: ${t.typography.sizes.xl}px;\n    }\n\n    .superset-legacy-chart-country-map text.big-text {\n      font-weight: ${t.typography.weights.bold};\n      font-size: ${t.typography.sizes.l}px;\n    }\n\n    .superset-legacy-chart-country-map path.region {\n      cursor: pointer;\n      stroke: ${t.colors.grayscale.light2};\n    }\n  `}
`},7240:(t,e,n)=>{n.d(e,{A:()=>a});var r=n(96540),s=n(2445);function a(t,e){class n extends r.Component{constructor(t){super(t),this.container=void 0,this.setContainerRef=this.setContainerRef.bind(this)}componentDidMount(){this.execute()}componentDidUpdate(){this.execute()}componentWillUnmount(){this.container=void 0,null!=e&&e.componentWillUnmount&&e.componentWillUnmount.bind(this)()}setContainerRef(t){this.container=t}execute(){this.container&&t(this.container,this.props)}render(){const{id:t,className:e}=this.props;return(0,s.Y)("div",{ref:this.setContainerRef,id:t,className:e})}}const a=n;return t.displayName&&(a.displayName=t.displayName),t.propTypes&&(a.propTypes={...a.propTypes,...t.propTypes}),t.defaultProps&&(a.defaultProps=t.defaultProps),n}}}]);