cool-globe 0.1.1 → 0.1.3
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/README.md +10 -5
- package/dist/cool-globe.cjs +16 -4
- package/dist/cool-globe.js +717 -1791
- package/dist/lib/dashboardGlobe.utils.d.ts +7 -0
- package/package.json +21 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`cool-globe` is an interactive React globe library for country and region analytics, drill-down exploration, and metric-based geospatial dashboards.
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
@@ -19,16 +19,21 @@
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npm install cool-globe
|
|
22
|
+
npm install cool-globe react-globe.gl three
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
> `react`, `react-dom`, `react-globe.gl` and `three` are **peer dependencies** — they must be installed by the consuming app. This guarantees a single shared `three.js` instance in the page (multiple `three` copies break WebGL state, materials and shaders).
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### Peer dependency versions
|
|
28
28
|
|
|
29
29
|
- `react` (`^18 || ^19`)
|
|
30
30
|
- `react-dom` (`^18 || ^19`)
|
|
31
|
-
- `react-globe.gl` (`^2`)
|
|
31
|
+
- `react-globe.gl` (`^2.37.1`)
|
|
32
|
+
- `three` (`^0.180.0`)
|
|
33
|
+
|
|
34
|
+
### Requirements
|
|
35
|
+
|
|
36
|
+
- Node.js `>= 18`
|
|
32
37
|
|
|
33
38
|
## Basic usage
|
|
34
39
|
|
package/dist/cool-globe.cjs
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("react/jsx-runtime"),C=require("react"),vt=require("react-globe.gl");function Et(t){return t}function Nt(t){if(t==null)return Et;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(a,c){c||(e=n=0);var u=2,f=a.length,l=new Array(f);for(l[0]=(e+=a[0])*r+o,l[1]=(n+=a[1])*i+s;u<f;)l[u]=a[u],++u;return l}}function At(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n}function St(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return Ue(t,n)})}:Ue(t,e)}function Ue(t,e){var n=e.id,r=e.bbox,i=e.properties==null?{}:e.properties,o=Rt(t,e);return n==null&&r==null?{type:"Feature",properties:i,geometry:o}:r==null?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function Rt(t,e){var n=Nt(t.transform),r=t.arcs;function i(f,l){l.length&&l.pop();for(var g=r[f<0?~f:f],w=0,y=g.length;w<y;++w)l.push(n(g[w],w));f<0&&At(l,y)}function o(f){return n(f)}function s(f){for(var l=[],g=0,w=f.length;g<w;++g)i(f[g],l);return l.length<2&&l.push(l[0]),l}function a(f){for(var l=s(f);l.length<4;)l.push(l[0]);return l}function c(f){return f.map(a)}function u(f){var l=f.type,g;switch(l){case"GeometryCollection":return{type:l,geometries:f.geometries.map(u)};case"Point":g=o(f.coordinates);break;case"MultiPoint":g=f.coordinates.map(o);break;case"LineString":g=s(f.arcs);break;case"MultiLineString":g=f.arcs.map(s);break;case"Polygon":g=c(f.arcs);break;case"MultiPolygon":g=f.arcs.map(c);break;default:return null}return{type:l,coordinates:g}}return u(e)}const gt="180",_t="",$="srgb",Ve="srgb-linear",Ze="linear",Ee="srgb";function ne(t,e,n){return Math.max(e,Math.min(n,t))}function Lt(t,e){return(t%e+e)%e}function Ne(t,e,n){return(1-n)*t+n*e}class ae{constructor(e,n,r,i,o,s,a,c,u){ae.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,o,s,a,c,u)}set(e,n,r,i,o,s,a,c,u){const f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=n,f[4]=o,f[5]=c,f[6]=r,f[7]=s,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,o=this.elements,s=r[0],a=r[3],c=r[6],u=r[1],f=r[4],l=r[7],g=r[2],w=r[5],y=r[8],F=i[0],_=i[3],R=i[6],O=i[1],T=i[4],E=i[7],G=i[2],k=i[5],I=i[8];return o[0]=s*F+a*O+c*G,o[3]=s*_+a*T+c*k,o[6]=s*R+a*E+c*I,o[1]=u*F+f*O+l*G,o[4]=u*_+f*T+l*k,o[7]=u*R+f*E+l*I,o[2]=g*F+w*O+y*G,o[5]=g*_+w*T+y*k,o[8]=g*R+w*E+y*I,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],f=e[8];return n*s*f-n*a*u-r*o*f+r*a*c+i*o*u-i*s*c}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],f=e[8],l=f*s-a*u,g=a*c-f*o,w=u*o-s*c,y=n*l+r*g+i*w;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const F=1/y;return e[0]=l*F,e[1]=(i*u-f*r)*F,e[2]=(a*r-i*s)*F,e[3]=g*F,e[4]=(f*n-i*c)*F,e[5]=(i*o-a*n)*F,e[6]=w*F,e[7]=(r*c-u*n)*F,e[8]=(s*n-r*o)*F,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,o,s,a){const c=Math.cos(o),u=Math.sin(o);return this.set(r*c,r*u,-r*(c*s+u*a)+s+e,-i*u,i*c,-i*(-u*s+c*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(Ae.makeScale(e,n)),this}rotate(e){return this.premultiply(Ae.makeRotation(-e)),this}translate(e,n){return this.premultiply(Ae.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Ae=new ae,Ye={};function Xe(t){t in Ye||(Ye[t]=!0,console.warn(t))}const We=new ae().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Je=new ae().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Bt(){const t={enabled:!0,workingColorSpace:Ve,spaces:{},convert:function(i,o,s){return this.enabled===!1||o===s||!o||!s||(this.spaces[o].transfer===Ee&&(i.r=W(i.r),i.g=W(i.g),i.b=W(i.b)),this.spaces[o].primaries!==this.spaces[s].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===Ee&&(i.r=J(i.r),i.g=J(i.g),i.b=J(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===_t?Ze:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,s){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return Xe("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return Xe("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[Ve]:{primaries:e,whitePoint:r,transfer:Ze,toXYZ:We,fromXYZ:Je,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:$},outputColorSpaceConfig:{drawingBufferColorSpace:$}},[$]:{primaries:e,whitePoint:r,transfer:Ee,toXYZ:We,fromXYZ:Je,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:$}}}),t}const B=Bt();function W(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function J(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const dt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},q={h:0,s:0,l:0},ge={h:0,s:0,l:0};function Se(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let re=class{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=$){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,B.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=B.workingColorSpace){return this.r=e,this.g=n,this.b=r,B.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=B.workingColorSpace){if(e=Lt(e,1),n=ne(n,0,1),r=ne(r,0,1),n===0)this.r=this.g=this.b=r;else{const o=r<=.5?r*(1+n):r+n-r*n,s=2*r-o;this.r=Se(s,o,e+1/3),this.g=Se(s,o,e),this.b=Se(s,o,e-1/3)}return B.colorSpaceToWorking(this,i),this}setStyle(e,n=$){function r(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,n);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,n);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],s=o.length;if(s===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,n);if(s===6)return this.setHex(parseInt(o,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=$){const r=dt[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=W(e.r),this.g=W(e.g),this.b=W(e.b),this}copyLinearToSRGB(e){return this.r=J(e.r),this.g=J(e.g),this.b=J(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=$){return B.workingToColorSpace(v.copy(this),e),Math.round(ne(v.r*255,0,255))*65536+Math.round(ne(v.g*255,0,255))*256+Math.round(ne(v.b*255,0,255))}getHexString(e=$){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=B.workingColorSpace){B.workingToColorSpace(v.copy(this),n);const r=v.r,i=v.g,o=v.b,s=Math.max(r,i,o),a=Math.min(r,i,o);let c,u;const f=(a+s)/2;if(a===s)c=0,u=0;else{const l=s-a;switch(u=f<=.5?l/(s+a):l/(2-s-a),s){case r:c=(i-o)/l+(i<o?6:0);break;case i:c=(o-r)/l+2;break;case o:c=(r-i)/l+4;break}c/=6}return e.h=c,e.s=u,e.l=f,e}getRGB(e,n=B.workingColorSpace){return B.workingToColorSpace(v.copy(this),n),e.r=v.r,e.g=v.g,e.b=v.b,e}getStyle(e=$){B.workingToColorSpace(v.copy(this),e);const n=v.r,r=v.g,i=v.b;return e!==$?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(q),this.setHSL(q.h+e,q.s+n,q.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(q),e.getHSL(ge);const r=Ne(q.h,ge.h,n),i=Ne(q.s,ge.s,n),o=Ne(q.l,ge.l,n);return this.setHSL(r,i,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,o=e.elements;return this.r=o[0]*n+o[3]*r+o[6]*i,this.g=o[1]*n+o[4]*r+o[7]*i,this.b=o[2]*n+o[5]*r+o[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const v=new re;re.NAMES=dt;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:gt}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=gt);const $t="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson",Dt="https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json",Tt="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson",It="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'><rect width='4' height='4' fill='%23f5f5f5'/></svg>",Ht={minColor:"#f8fafc",maxColor:"#e5e7eb"};function He(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function mt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ue(){}var ie=.7,be=1/ie,Q="\\s*([+-]?\\d+)\\s*",oe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",j="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jt=/^#([0-9a-f]{3,8})$/,Ot=new RegExp(`^rgb\\(${Q},${Q},${Q}\\)$`),Pt=new RegExp(`^rgb\\(${j},${j},${j}\\)$`),Gt=new RegExp(`^rgba\\(${Q},${Q},${Q},${oe}\\)$`),qt=new RegExp(`^rgba\\(${j},${j},${j},${oe}\\)$`),zt=new RegExp(`^hsl\\(${oe},${j},${j}\\)$`),Ut=new RegExp(`^hsla\\(${oe},${j},${j},${oe}\\)$`),Qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};He(ue,se,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ke,formatHex:Ke,formatHex8:Vt,formatHsl:Zt,formatRgb:et,toString:et});function Ke(){return this.rgb().formatHex()}function Vt(){return this.rgb().formatHex8()}function Zt(){return xt(this).formatHsl()}function et(){return this.rgb().formatRgb()}function se(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=jt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?tt(e):n===3?new S(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?de(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?de(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ot.exec(t))?new S(e[1],e[2],e[3],1):(e=Pt.exec(t))?new S(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Gt.exec(t))?de(e[1],e[2],e[3],e[4]):(e=qt.exec(t))?de(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=zt.exec(t))?it(e[1],e[2]/100,e[3]/100,1):(e=Ut.exec(t))?it(e[1],e[2]/100,e[3]/100,e[4]):Qe.hasOwnProperty(t)?tt(Qe[t]):t==="transparent"?new S(NaN,NaN,NaN,0):null}function tt(t){return new S(t>>16&255,t>>8&255,t&255,1)}function de(t,e,n,r){return r<=0&&(t=e=n=NaN),new S(t,e,n,r)}function Yt(t){return t instanceof ue||(t=se(t)),t?(t=t.rgb(),new S(t.r,t.g,t.b,t.opacity)):new S}function Be(t,e,n,r){return arguments.length===1?Yt(t):new S(t,e,n,r??1)}function S(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}He(S,Be,mt(ue,{brighter(t){return t=t==null?be:Math.pow(be,t),new S(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ie:Math.pow(ie,t),new S(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new S(Z(this.r),Z(this.g),Z(this.b),we(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nt,formatHex:nt,formatHex8:Xt,formatRgb:rt,toString:rt}));function nt(){return`#${V(this.r)}${V(this.g)}${V(this.b)}`}function Xt(){return`#${V(this.r)}${V(this.g)}${V(this.b)}${V((isNaN(this.opacity)?1:this.opacity)*255)}`}function rt(){const t=we(this.opacity);return`${t===1?"rgb(":"rgba("}${Z(this.r)}, ${Z(this.g)}, ${Z(this.b)}${t===1?")":`, ${t})`}`}function we(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Z(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function V(t){return t=Z(t),(t<16?"0":"")+t.toString(16)}function it(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new D(t,e,n,r)}function xt(t){if(t instanceof D)return new D(t.h,t.s,t.l,t.opacity);if(t instanceof ue||(t=se(t)),!t)return new D;if(t instanceof D)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(e===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new D(s,a,c,t.opacity)}function Wt(t,e,n,r){return arguments.length===1?xt(t):new D(t,e,n,r??1)}function D(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}He(D,Wt,mt(ue,{brighter(t){return t=t==null?be:Math.pow(be,t),new D(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ie:Math.pow(ie,t),new D(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new S(Re(t>=240?t-240:t+120,i,r),Re(t,i,r),Re(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new D(ot(this.h),me(this.s),me(this.l),we(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=we(this.opacity);return`${t===1?"hsl(":"hsla("}${ot(this.h)}, ${me(this.s)*100}%, ${me(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ot(t){return t=(t||0)%360,t<0?t+360:t}function me(t){return Math.max(0,Math.min(1,t||0))}function Re(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const je=t=>()=>t;function Jt(t,e){return function(n){return t+n*e}}function Qt(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Kt(t){return(t=+t)==1?pt:function(e,n){return n-e?Qt(e,n,t):je(isNaN(e)?n:e)}}function pt(t,e){var n=e-t;return n?Jt(t,n):je(isNaN(t)?e:t)}const $e=(function t(e){var n=Kt(e);function r(i,o){var s=n((i=Be(i)).r,(o=Be(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),u=pt(i.opacity,o.opacity);return function(f){return i.r=s(f),i.g=a(f),i.b=c(f),i.opacity=u(f),i+""}}return r.gamma=t,r})(1);function en(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=t[i]*(1-o)+e[i]*o;return r}}function tn(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function nn(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Oe(t[s],e[s]);for(;s<n;++s)o[s]=e[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function rn(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function ye(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function on(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Oe(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var De=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_e=new RegExp(De.source,"g");function sn(t){return function(){return t}}function an(t){return function(e){return t(e)+""}}function un(t,e){var n=De.lastIndex=_e.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=De.exec(t))&&(i=_e.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:ye(r,i)})),n=_e.lastIndex;return n<e.length&&(o=e.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?an(c[0].x):sn(e):(e=c.length,function(u){for(var f=0,l;f<e;++f)a[(l=c[f]).i]=l.x(u);return a.join("")})}function Oe(t,e){var n=typeof e,r;return e==null||n==="boolean"?je(e):(n==="number"?ye:n==="string"?(r=se(e))?(e=r,$e):un:e instanceof se?$e:e instanceof Date?rn:tn(e)?en:Array.isArray(e)?nn:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?on:ye)(t,e)}function cn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function pe(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function fn(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function bt(t){let e,n,r;t.length!==2?(e=pe,n=(a,c)=>pe(t(a),c),r=(a,c)=>t(a)-c):(e=t===pe||t===fn?t:ln,n=t,r=t);function i(a,c,u=0,f=a.length){if(u<f){if(e(c,c)!==0)return f;do{const l=u+f>>>1;n(a[l],c)<0?u=l+1:f=l}while(u<f)}return u}function o(a,c,u=0,f=a.length){if(u<f){if(e(c,c)!==0)return f;do{const l=u+f>>>1;n(a[l],c)<=0?u=l+1:f=l}while(u<f)}return u}function s(a,c,u=0,f=a.length){const l=i(a,c,u,f-1);return l>u&&r(a[l-1],c)>-r(a[l],c)?l-1:l}return{left:i,center:s,right:o}}function ln(){return 0}function hn(t){return t===null?NaN:+t}const gn=bt(pe),dn=gn.right;bt(hn).center;const mn=Math.sqrt(50),xn=Math.sqrt(10),pn=Math.sqrt(2);function Fe(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=mn?10:o>=xn?5:o>=pn?2:1;let a,c,u;return i<0?(u=Math.pow(10,-i)/s,a=Math.round(t*u),c=Math.round(e*u),a/u<t&&++a,c/u>e&&--c,u=-u):(u=Math.pow(10,i)*s,a=Math.round(t/u),c=Math.round(e/u),a*u<t&&++a,c*u>e&&--c),c<a&&.5<=n&&n<2?Fe(t,e,n*2):[a,c,u]}function bn(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,o,s]=r?Fe(e,t,n):Fe(t,e,n);if(!(o>=i))return[];const a=o-i+1,c=new Array(a);if(r)if(s<0)for(let u=0;u<a;++u)c[u]=(o-u)/-s;else for(let u=0;u<a;++u)c[u]=(o-u)*s;else if(s<0)for(let u=0;u<a;++u)c[u]=(i+u)/-s;else for(let u=0;u<a;++u)c[u]=(i+u)*s;return c}function Te(t,e,n){return e=+e,t=+t,n=+n,Fe(t,e,n)[2]}function wn(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?Te(e,t,n):Te(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function yn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Fn(t){return function(){return t}}function Cn(t){return+t}var st=[0,1];function X(t){return t}function Ie(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Fn(isNaN(e)?NaN:.5)}function Mn(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function kn(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i<r?(r=Ie(i,r),o=n(s,o)):(r=Ie(r,i),o=n(o,s)),function(a){return o(r(a))}}function vn(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=Ie(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(a){var c=dn(t,a,1,r)-1;return o[c](i[c](a))}}function En(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Nn(){var t=st,e=st,n=Oe,r,i,o,s=X,a,c,u;function f(){var g=Math.min(t.length,e.length);return s!==X&&(s=Mn(t[0],t[g-1])),a=g>2?vn:kn,c=u=null,l}function l(g){return g==null||isNaN(g=+g)?o:(c||(c=a(t.map(r),e,n)))(r(s(g)))}return l.invert=function(g){return s(i((u||(u=a(e,t.map(r),ye)))(g)))},l.domain=function(g){return arguments.length?(t=Array.from(g,Cn),f()):t.slice()},l.range=function(g){return arguments.length?(e=Array.from(g),f()):e.slice()},l.rangeRound=function(g){return e=Array.from(g),n=cn,f()},l.clamp=function(g){return arguments.length?(s=g?!0:X,f()):s!==X},l.interpolate=function(g){return arguments.length?(n=g,f()):n},l.unknown=function(g){return arguments.length?(o=g,l):o},function(g,w){return r=g,i=w,f()}}function An(){return Nn()(X,X)}function Sn(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ce(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function K(t){return t=Ce(Math.abs(t)),t?t[1]:NaN}function Rn(t,e){return function(n,r){for(var i=n.length,o=[],s=0,a=t[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=t[s=(s+1)%t.length];return o.reverse().join(e)}}function _n(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Ln=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Me(t){if(!(e=Ln.exec(t)))throw new Error("invalid format: "+t);var e;return new Pe({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Me.prototype=Pe.prototype;function Pe(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Pe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Bn(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var ke;function $n(t,e){var n=Ce(t,e);if(!n)return ke=void 0,t.toPrecision(e);var r=n[0],i=n[1],o=i-(ke=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Ce(t,Math.max(0,e+o-1))[0]}function at(t,e){var n=Ce(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const ut={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Sn,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>at(t*100,e),r:at,s:$n,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ct(t){return t}var ft=Array.prototype.map,lt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Dn(t){var e=t.grouping===void 0||t.thousands===void 0?ct:Rn(ft.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?ct:_n(ft.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(l,g){l=Me(l);var w=l.fill,y=l.align,F=l.sign,_=l.symbol,R=l.zero,O=l.width,T=l.comma,E=l.precision,G=l.trim,k=l.type;k==="n"?(T=!0,k="g"):ut[k]||(E===void 0&&(E=12),G=!0,k="g"),(R||w==="0"&&y==="=")&&(R=!0,w="0",y="=");var I=(g&&g.prefix!==void 0?g.prefix:"")+(_==="$"?n:_==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),ce=(_==="$"?r:/[%p]/.test(k)?s:"")+(g&&g.suffix!==void 0?g.suffix:""),fe=ut[k],le=/[defgprs%]/.test(k);E=E===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,E)):Math.max(0,Math.min(20,E));function ee(p){var P=I,N=ce,H,te,Y;if(k==="c")N=fe(p)+N,p="";else{p=+p;var z=p<0||1/p<0;if(p=isNaN(p)?c:fe(Math.abs(p),E),G&&(p=Bn(p)),z&&+p==0&&F!=="+"&&(z=!1),P=(z?F==="("?F:a:F==="-"||F==="("?"":F)+P,N=(k==="s"&&!isNaN(p)&&ke!==void 0?lt[8+ke/3]:"")+N+(z&&F==="("?")":""),le){for(H=-1,te=p.length;++H<te;)if(Y=p.charCodeAt(H),48>Y||Y>57){N=(Y===46?i+p.slice(H+1):p.slice(H))+N,p=p.slice(0,H);break}}}T&&!R&&(p=e(p,1/0));var U=P.length+p.length+N.length,L=U<O?new Array(O-U+1).join(w):"";switch(T&&R&&(p=e(L+p,L.length?O-N.length:1/0),L=""),y){case"<":p=P+p+N+L;break;case"=":p=P+L+p+N;break;case"^":p=L.slice(0,U=L.length>>1)+P+p+N+L.slice(U);break;default:p=L+P+p+N;break}return o(p)}return ee.toString=function(){return l+""},ee}function f(l,g){var w=Math.max(-8,Math.min(8,Math.floor(K(g)/3)))*3,y=Math.pow(10,-w),F=u((l=Me(l),l.type="f",l),{suffix:lt[8+w/3]});return function(_){return F(y*_)}}return{format:u,formatPrefix:f}}var xe,wt,yt;Tn({thousands:",",grouping:[3],currency:["$",""]});function Tn(t){return xe=Dn(t),wt=xe.format,yt=xe.formatPrefix,xe}function In(t){return Math.max(0,-K(Math.abs(t)))}function Hn(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(K(e)/3)))*3-K(Math.abs(t)))}function jn(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,K(e)-K(t))+1}function On(t,e,n,r){var i=wn(t,e,n),o;switch(r=Me(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=Hn(i,s))&&(r.precision=o),yt(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=jn(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=In(i))&&(r.precision=o-(r.type==="%")*2);break}}return wt(r)}function Pn(t){var e=t.domain;return t.ticks=function(n){var r=e();return bn(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return On(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],a=r[o],c,u,f=10;for(a<s&&(u=s,s=a,a=u,u=i,i=o,o=u);f-- >0;){if(u=Te(s,a,n),u===c)return r[i]=s,r[o]=a,e(r);if(u>0)s=Math.floor(s/u)*u,a=Math.ceil(a/u)*u;else if(u<0)s=Math.ceil(s*u)/u,a=Math.floor(a*u)/u;else break;c=u}return t},t}function Ft(){var t=An();return t.copy=function(){return En(t,Ft())},yn.apply(t,arguments),Pn(t)}const Le=(t,e)=>{const n=t?.[e];return typeof n=="number"?n:0},ht=(t,e)=>{if(!t.length)return()=>e.minColor;const n=Math.min(...t),r=Math.max(...t);if(n===r)return()=>e.maxColor;const i=Ft().domain([n,r]).range([0,1]),o=$e(e.minColor,e.maxColor);return s=>o(i(s))},Gn=t=>t<=1.35?2:t<=2.1?1:0,qn=t=>new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(t),zn=({statisticsData:t,resetSignal:e,countryNumericToIsoMap:n={},countryNameToIsoMap:r={},primaryMetric:i="visits",colorScale:o=Ht})=>{const s=C.useRef(null),a=C.useRef(null),c=C.useRef(void 0),u=C.useRef({}),f=C.useRef(null),l=C.useRef(e),[g,w]=C.useState(0),[y,F]=C.useState(),[_,R]=C.useState(),[O,T]=C.useState(null),[E,G]=C.useState([]),[k,I]=C.useState([]),[ce,fe]=C.useState({width:900,height:760}),le=C.useMemo(()=>Object.values(t.countries).map(h=>Le(h,i)),[i,t.countries]),ee=C.useMemo(()=>y?Object.values(t.regions[y]??{}).map(h=>Le(h,i)):[],[y,i,t.regions]),p=C.useMemo(()=>ht(le,o),[le,o]),P=C.useMemo(()=>ht(ee,o),[ee,o]);C.useEffect(()=>{(async()=>{let d=[];try{d=(await(await fetch($t)).json()).features}catch{const m=await(await fetch(Dt)).json(),M=m.objects.countries,A=St(m,M);d=A.type==="FeatureCollection"?A.features:[A]}const b=d.map(x=>{const m=String(x.id??""),M=x.properties??{},A=String(M.name??M.NAME??M.name_en??M.ADMIN??"").trim()||`Country ${m}`,ve=A.toLowerCase(),he=String(M.iso_a2??M.ISO_A2??M.iso_a2_eh??"").trim().toUpperCase(),qe=n[m]??r[ve]??(he&&he!=="-99"?he:void 0)??(m.length===2?m.toUpperCase():m);return{...x,properties:{...M,__isoA2:qe,name:A||qe||`Country ${m}`}}});G(b)})()},[]),C.useEffect(()=>{if(!a.current)return;const h=new ResizeObserver(d=>{const b=d[0];b&&fe({width:Math.max(360,Math.floor(b.contentRect.width)),height:Math.max(520,Math.floor(b.contentRect.height))})});return h.observe(a.current),()=>h.disconnect()},[]),C.useEffect(()=>{if(!y){I([]);return}const h=u.current[y];if(h){I(h);return}(async()=>{if(!f.current){const M=await(await fetch(Tt)).json();f.current=M.features}const x=(f.current??[]).filter(m=>(m.properties??{}).iso_a2===y).map(m=>{const M=m.properties??{},A=String(M.name??"").trim();return{...m,properties:{...M,__countryCode:y,__regionName:A,name:A}}});u.current[y]=x,I(x)})()},[y]),C.useEffect(()=>{if(_&&g<2)return void w(2);y&&g<1&&w(1)},[y,_,g]),C.useEffect(()=>{const h=s.current?.controls?.();if(!h)return;h.autoRotate=!0,h.autoRotateSpeed=.45,h.enablePan=!1,h.enableZoom=!0;const d=s.current?.renderer?.();d&&d.setPixelRatio(Math.min(window.devicePixelRatio,1.5))},[]),C.useEffect(()=>{const h=s.current?.controls?.();h&&(h.autoRotate=!y&&g===0)},[y,g]),C.useEffect(()=>{if(e===l.current)return;l.current=e,w(0),F(void 0),R(void 0),T(null),I([]);const h=s.current?.controls?.();h&&(h.autoRotate=!0),s.current?.pointOfView({lat:20,lng:15,altitude:2.6},650)},[e]);const N=()=>{const h=s.current?.globeMaterial?.();h&&(h.map=null,h.color=new re("#f5f5f5"),h.emissive=new re("#ffffff"),h.emissiveIntensity=.35,h.specular=new re("#d4d4d8"),h.shininess=3,h.needsUpdate=!0)},H=(h,d,b)=>{s.current?.pointOfView({lat:h,lng:d,altitude:b},650)},te=()=>{const h=s.current?.controls?.();h&&(h.autoRotate=!1)},Y=h=>{if(typeof h!="object"||h===null||!("coordinates"in h))return[];const d=h.coordinates,b=[],x=m=>{if(Array.isArray(m)){if(m.length>=2&&typeof m[0]=="number"&&typeof m[1]=="number"){b.push([m[0],m[1]]);return}m.forEach(x)}};return x(d),b},z=h=>{const d=Y(h.geometry);if(!d.length)return;const b=d.reduce((x,[m,M])=>({minLat:Math.min(x.minLat,M),maxLat:Math.max(x.maxLat,M),minLng:Math.min(x.minLng,m),maxLng:Math.max(x.maxLng,m)}),{minLat:Number.POSITIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY,minLng:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY});if(!(!Number.isFinite(b.minLat)||!Number.isFinite(b.minLng)))return b},U=h=>{const d=Math.max(.1,h.maxLat-h.minLat),b=Math.max(.1,h.maxLng-h.minLng),m=Math.max(d,b)/112;return Math.min(.9,Math.max(.14,m))},L=()=>{c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{const h=s.current?.pointOfView?.().altitude??2.4,d=Gn(h);w(d),d<=0&&R(void 0)},120)},Ct=h=>{const d=h.properties??{};if(g===0){const b=r[String(d.name??"").toLowerCase()],x=d.__isoA2??(typeof d.iso_a2=="string"?d.iso_a2.toUpperCase():void 0)??b;if(!x)return;te(),w(1),F(x),R(void 0);const m=z(h);if(m){H((m.minLat+m.maxLat)/2,(m.minLng+m.maxLng)/2,U(m));return}return}if(g>=1){const b=d.__regionName;if(!b)return;te(),w(2),R(b);const x=z(h);if(x){H((x.minLat+x.maxLat)/2,(x.minLng+x.maxLng)/2,Math.max(.2,U(x)*.52));return}}},Mt=g===0?E:k.length?[...E,...k]:E,Ge=(h,d)=>{if(d&&h)return t.regions[h]?.[d];if(h)return t.countries[h]},kt=h=>{if(!h)return"<div>No data</div>";const d=Object.entries(h).filter(([,b])=>typeof b=="number"&&Number.isFinite(b));return d.length?(d.sort(([b],[x])=>b===i?-1:x===i?1:b.localeCompare(x)),d.map(([b,x])=>`<div>${b}: ${qn(x)}</div>`).join("")):"<div>No data</div>"};return ze.jsx("div",{ref:a,style:{position:"relative",height:"100%",overflow:"hidden",background:"white"},children:ze.jsx(vt,{ref:s,globeImageUrl:It,backgroundColor:"#ffffff",polygonsData:Mt,polygonAltitude:.01,polygonsTransitionDuration:180,polygonCapColor:h=>{const d=h.properties??{},b=!!d.__regionName;if(g>0&&!b)return"rgba(148,163,184,0.027)";const x=g===0?d.__isoA2:d.__countryCode,m=d.__regionName,M=Ge(x,m),A=Le(M,i),ve=g===0?p(A):P(A);return O===h?"#60a5fa":ve},polygonSideColor:h=>{const d=h.properties??{};return g>0&&!d.__regionName?"rgba(148,163,184,0.027)":d.__regionName?"rgba(148,163,184,0.22)":"rgba(226,232,240,0.45)"},polygonStrokeColor:h=>{const d=h.properties??{};return g>0&&!d.__regionName?"rgba(100,116,139,0.067)":d.__regionName?"rgba(51,65,85,0.98)":"rgba(156,163,175,0.95)"},polygonLabel:h=>{const d=h.properties??{},b=g===0?d.__isoA2:d.__countryCode,x=d.__regionName,m=x??d.name??"Unknown",M=Ge(b,x),A=kt(M);return`<div style="padding:6px 8px; font-size:12px; background:#111827; color:#f9fafb; border-radius:6px;">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("react/jsx-runtime"),w=require("react"),sn=require("react-globe.gl"),xe=require("three");function fn(e){return e}function un(e){if(e==null)return fn;var n,t,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(s,l){l||(n=t=0);var f=2,h=s.length,c=new Array(h);for(c[0]=(n+=s[0])*r+a,c[1]=(t+=s[1])*i+o;f<h;)c[f]=s[f],++f;return c}}function cn(e,n){for(var t,r=e.length,i=r-n;i<--r;)t=e[i],e[i++]=e[r],e[r]=t}function ln(e,n){return typeof n=="string"&&(n=e.objects[n]),n.type==="GeometryCollection"?{type:"FeatureCollection",features:n.geometries.map(function(t){return Ie(e,t)})}:Ie(e,n)}function Ie(e,n){var t=n.id,r=n.bbox,i=n.properties==null?{}:n.properties,a=dn(e,n);return t==null&&r==null?{type:"Feature",properties:i,geometry:a}:r==null?{type:"Feature",id:t,properties:i,geometry:a}:{type:"Feature",id:t,bbox:r,properties:i,geometry:a}}function dn(e,n){var t=un(e.transform),r=e.arcs;function i(h,c){c.length&&c.pop();for(var d=r[h<0?~h:h],v=0,M=d.length;v<M;++v)c.push(t(d[v],v));h<0&&cn(c,M)}function a(h){return t(h)}function o(h){for(var c=[],d=0,v=h.length;d<v;++d)i(h[d],c);return c.length<2&&c.push(c[0]),c}function s(h){for(var c=o(h);c.length<4;)c.push(c[0]);return c}function l(h){return h.map(s)}function f(h){var c=h.type,d;switch(c){case"GeometryCollection":return{type:c,geometries:h.geometries.map(f)};case"Point":d=a(h.coordinates);break;case"MultiPoint":d=h.coordinates.map(a);break;case"LineString":d=o(h.arcs);break;case"MultiLineString":d=h.arcs.map(o);break;case"Polygon":d=l(h.arcs);break;case"MultiPolygon":d=h.arcs.map(l);break;default:return null}return{type:c,coordinates:d}}return f(n)}const hn="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson",mn="https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json",gn="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson",pn="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'><rect width='4' height='4' fill='%23f5f5f5'/></svg>",xn={minColor:"#f8fafc",maxColor:"#e5e7eb"};function Ce(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function Ke(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function ee(){}var X=.7,ue=1/X,B="\\s*([+-]?\\d+)\\s*",W="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",E="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bn=/^#([0-9a-f]{3,8})$/,yn=new RegExp(`^rgb\\(${B},${B},${B}\\)$`),wn=new RegExp(`^rgb\\(${E},${E},${E}\\)$`),vn=new RegExp(`^rgba\\(${B},${B},${B},${W}\\)$`),Mn=new RegExp(`^rgba\\(${E},${E},${E},${W}\\)$`),Nn=new RegExp(`^hsl\\(${W},${E},${E}\\)$`),_n=new RegExp(`^hsla\\(${W},${E},${E},${W}\\)$`),je={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ce(ee,Q,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fe,formatHex:Fe,formatHex8:Rn,formatHsl:$n,formatRgb:Pe,toString:Pe});function Fe(){return this.rgb().formatHex()}function Rn(){return this.rgb().formatHex8()}function $n(){return Xe(this).formatHsl()}function Pe(){return this.rgb().formatRgb()}function Q(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=bn.exec(e))?(t=n[1].length,n=parseInt(n[1],16),t===6?Oe(n):t===3?new $(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):t===8?oe(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):t===4?oe(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=yn.exec(e))?new $(n[1],n[2],n[3],1):(n=wn.exec(e))?new $(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=vn.exec(e))?oe(n[1],n[2],n[3],n[4]):(n=Mn.exec(e))?oe(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Nn.exec(e))?He(n[1],n[2]/100,n[3]/100,1):(n=_n.exec(e))?He(n[1],n[2]/100,n[3]/100,n[4]):je.hasOwnProperty(e)?Oe(je[e]):e==="transparent"?new $(NaN,NaN,NaN,0):null}function Oe(e){return new $(e>>16&255,e>>8&255,e&255,1)}function oe(e,n,t,r){return r<=0&&(e=n=t=NaN),new $(e,n,t,r)}function Cn(e){return e instanceof ee||(e=Q(e)),e?(e=e.rgb(),new $(e.r,e.g,e.b,e.opacity)):new $}function Me(e,n,t,r){return arguments.length===1?Cn(e):new $(e,n,t,r??1)}function $(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}Ce($,Me,Ke(ee,{brighter(e){return e=e==null?ue:Math.pow(ue,e),new $(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?X:Math.pow(X,e),new $(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $(G(this.r),G(this.g),G(this.b),ce(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ze,formatHex:ze,formatHex8:kn,formatRgb:Te,toString:Te}));function ze(){return`#${H(this.r)}${H(this.g)}${H(this.b)}`}function kn(){return`#${H(this.r)}${H(this.g)}${H(this.b)}${H((isNaN(this.opacity)?1:this.opacity)*255)}`}function Te(){const e=ce(this.opacity);return`${e===1?"rgb(":"rgba("}${G(this.r)}, ${G(this.g)}, ${G(this.b)}${e===1?")":`, ${e})`}`}function ce(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function G(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function H(e){return e=G(e),(e<16?"0":"")+e.toString(16)}function He(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new A(e,n,t,r)}function Xe(e){if(e instanceof A)return new A(e.h,e.s,e.l,e.opacity);if(e instanceof ee||(e=Q(e)),!e)return new A;if(e instanceof A)return e;e=e.rgb();var n=e.r/255,t=e.g/255,r=e.b/255,i=Math.min(n,t,r),a=Math.max(n,t,r),o=NaN,s=a-i,l=(a+i)/2;return s?(n===a?o=(t-r)/s+(t<r)*6:t===a?o=(r-n)/s+2:o=(n-t)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new A(o,s,l,e.opacity)}function Ln(e,n,t,r){return arguments.length===1?Xe(e):new A(e,n,t,r??1)}function A(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}Ce(A,Ln,Ke(ee,{brighter(e){return e=e==null?ue:Math.pow(ue,e),new A(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?X:Math.pow(X,e),new A(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,i=2*t-r;return new $(be(e>=240?e-240:e+120,i,r),be(e,i,r),be(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new A(Ge(this.h),ae(this.s),ae(this.l),ce(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ce(this.opacity);return`${e===1?"hsl(":"hsla("}${Ge(this.h)}, ${ae(this.s)*100}%, ${ae(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ge(e){return e=(e||0)%360,e<0?e+360:e}function ae(e){return Math.max(0,Math.min(1,e||0))}function be(e,n,t){return(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)*255}const ke=e=>()=>e;function An(e,n){return function(t){return e+t*n}}function Sn(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}function En(e){return(e=+e)==1?We:function(n,t){return t-n?Sn(n,t,e):ke(isNaN(n)?t:n)}}function We(e,n){var t=n-e;return t?An(e,t):ke(isNaN(e)?n:e)}const Ne=(function e(n){var t=En(n);function r(i,a){var o=t((i=Me(i)).r,(a=Me(a)).r),s=t(i.g,a.g),l=t(i.b,a.b),f=We(i.opacity,a.opacity);return function(h){return i.r=o(h),i.g=s(h),i.b=l(h),i.opacity=f(h),i+""}}return r.gamma=e,r})(1);function In(e,n){n||(n=[]);var t=e?Math.min(n.length,e.length):0,r=n.slice(),i;return function(a){for(i=0;i<t;++i)r[i]=e[i]*(1-a)+n[i]*a;return r}}function jn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Fn(e,n){var t=n?n.length:0,r=e?Math.min(t,e.length):0,i=new Array(r),a=new Array(t),o;for(o=0;o<r;++o)i[o]=Le(e[o],n[o]);for(;o<t;++o)a[o]=n[o];return function(s){for(o=0;o<r;++o)a[o]=i[o](s);return a}}function Pn(e,n){var t=new Date;return e=+e,n=+n,function(r){return t.setTime(e*(1-r)+n*r),t}}function le(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}function On(e,n){var t={},r={},i;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(i in n)i in e?t[i]=Le(e[i],n[i]):r[i]=n[i];return function(a){for(i in t)r[i]=t[i](a);return r}}var _e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ye=new RegExp(_e.source,"g");function zn(e){return function(){return e}}function Tn(e){return function(n){return e(n)+""}}function Hn(e,n){var t=_e.lastIndex=ye.lastIndex=0,r,i,a,o=-1,s=[],l=[];for(e=e+"",n=n+"";(r=_e.exec(e))&&(i=ye.exec(n));)(a=i.index)>t&&(a=n.slice(t,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,l.push({i:o,x:le(r,i)})),t=ye.lastIndex;return t<n.length&&(a=n.slice(t),s[o]?s[o]+=a:s[++o]=a),s.length<2?l[0]?Tn(l[0].x):zn(n):(n=l.length,function(f){for(var h=0,c;h<n;++h)s[(c=l[h]).i]=c.x(f);return s.join("")})}function Le(e,n){var t=typeof n,r;return n==null||t==="boolean"?ke(n):(t==="number"?le:t==="string"?(r=Q(n))?(n=r,Ne):Hn:n instanceof Q?Ne:n instanceof Date?Pn:jn(n)?In:Array.isArray(n)?Fn:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?On:le)(e,n)}function Gn(e,n){return e=+e,n=+n,function(t){return Math.round(e*(1-t)+n*t)}}function fe(e,n){return e==null||n==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function Un(e,n){return e==null||n==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function Qe(e){let n,t,r;e.length!==2?(n=fe,t=(s,l)=>fe(e(s),l),r=(s,l)=>e(s)-l):(n=e===fe||e===Un?e:qn,t=e,r=e);function i(s,l,f=0,h=s.length){if(f<h){if(n(l,l)!==0)return h;do{const c=f+h>>>1;t(s[c],l)<0?f=c+1:h=c}while(f<h)}return f}function a(s,l,f=0,h=s.length){if(f<h){if(n(l,l)!==0)return h;do{const c=f+h>>>1;t(s[c],l)<=0?f=c+1:h=c}while(f<h)}return f}function o(s,l,f=0,h=s.length){const c=i(s,l,f,h-1);return c>f&&r(s[c-1],l)>-r(s[c],l)?c-1:c}return{left:i,center:o,right:a}}function qn(){return 0}function Dn(e){return e===null?NaN:+e}const Vn=Qe(fe),Bn=Vn.right;Qe(Dn).center;const Zn=Math.sqrt(50),Jn=Math.sqrt(10),Yn=Math.sqrt(2);function de(e,n,t){const r=(n-e)/Math.max(0,t),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=Zn?10:a>=Jn?5:a>=Yn?2:1;let s,l,f;return i<0?(f=Math.pow(10,-i)/o,s=Math.round(e*f),l=Math.round(n*f),s/f<e&&++s,l/f>n&&--l,f=-f):(f=Math.pow(10,i)*o,s=Math.round(e/f),l=Math.round(n/f),s*f<e&&++s,l*f>n&&--l),l<s&&.5<=t&&t<2?de(e,n,t*2):[s,l,f]}function Kn(e,n,t){if(n=+n,e=+e,t=+t,!(t>0))return[];if(e===n)return[e];const r=n<e,[i,a,o]=r?de(n,e,t):de(e,n,t);if(!(a>=i))return[];const s=a-i+1,l=new Array(s);if(r)if(o<0)for(let f=0;f<s;++f)l[f]=(a-f)/-o;else for(let f=0;f<s;++f)l[f]=(a-f)*o;else if(o<0)for(let f=0;f<s;++f)l[f]=(i+f)/-o;else for(let f=0;f<s;++f)l[f]=(i+f)*o;return l}function Re(e,n,t){return n=+n,e=+e,t=+t,de(e,n,t)[2]}function Xn(e,n,t){n=+n,e=+e,t=+t;const r=n<e,i=r?Re(n,e,t):Re(e,n,t);return(r?-1:1)*(i<0?1/-i:i)}function Wn(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}function Qn(e){return function(){return e}}function et(e){return+e}var Ue=[0,1];function V(e){return e}function $e(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:Qn(isNaN(n)?NaN:.5)}function nt(e,n){var t;return e>n&&(t=e,e=n,n=t),function(r){return Math.max(e,Math.min(n,r))}}function tt(e,n,t){var r=e[0],i=e[1],a=n[0],o=n[1];return i<r?(r=$e(i,r),a=t(o,a)):(r=$e(r,i),a=t(a,o)),function(s){return a(r(s))}}function rt(e,n,t){var r=Math.min(e.length,n.length)-1,i=new Array(r),a=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),n=n.slice().reverse());++o<r;)i[o]=$e(e[o],e[o+1]),a[o]=t(n[o],n[o+1]);return function(s){var l=Bn(e,s,1,r)-1;return a[l](i[l](s))}}function it(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ot(){var e=Ue,n=Ue,t=Le,r,i,a,o=V,s,l,f;function h(){var d=Math.min(e.length,n.length);return o!==V&&(o=nt(e[0],e[d-1])),s=d>2?rt:tt,l=f=null,c}function c(d){return d==null||isNaN(d=+d)?a:(l||(l=s(e.map(r),n,t)))(r(o(d)))}return c.invert=function(d){return o(i((f||(f=s(n,e.map(r),le)))(d)))},c.domain=function(d){return arguments.length?(e=Array.from(d,et),h()):e.slice()},c.range=function(d){return arguments.length?(n=Array.from(d),h()):n.slice()},c.rangeRound=function(d){return n=Array.from(d),t=Gn,h()},c.clamp=function(d){return arguments.length?(o=d?!0:V,h()):o!==V},c.interpolate=function(d){return arguments.length?(t=d,h()):t},c.unknown=function(d){return arguments.length?(a=d,c):a},function(d,v){return r=d,i=v,h()}}function at(){return ot()(V,V)}function st(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function he(e,n){if(!isFinite(e)||e===0)return null;var t=(e=n?e.toExponential(n-1):e.toExponential()).indexOf("e"),r=e.slice(0,t);return[r.length>1?r[0]+r.slice(2):r,+e.slice(t+1)]}function Z(e){return e=he(Math.abs(e)),e?e[1]:NaN}function ft(e,n){return function(t,r){for(var i=t.length,a=[],o=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(n)}}function ut(e){return function(n){return n.replace(/[0-9]/g,function(t){return e[+t]})}}var ct=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function me(e){if(!(n=ct.exec(e)))throw new Error("invalid format: "+e);var n;return new Ae({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}me.prototype=Ae.prototype;function Ae(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Ae.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function lt(e){e:for(var n=e.length,t=1,r=-1,i;t<n;++t)switch(e[t]){case".":r=i=t;break;case"0":r===0&&(r=t),i=t;break;default:if(!+e[t])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var ge;function dt(e,n){var t=he(e,n);if(!t)return ge=void 0,e.toPrecision(n);var r=t[0],i=t[1],a=i-(ge=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+he(e,Math.max(0,n+a-1))[0]}function qe(e,n){var t=he(e,n);if(!t)return e+"";var r=t[0],i=t[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const De={"%":(e,n)=>(e*100).toFixed(n),b:e=>Math.round(e).toString(2),c:e=>e+"",d:st,e:(e,n)=>e.toExponential(n),f:(e,n)=>e.toFixed(n),g:(e,n)=>e.toPrecision(n),o:e=>Math.round(e).toString(8),p:(e,n)=>qe(e*100,n),r:qe,s:dt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Ve(e){return e}var Be=Array.prototype.map,Ze=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ht(e){var n=e.grouping===void 0||e.thousands===void 0?Ve:ft(Be.call(e.grouping,Number),e.thousands+""),t=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Ve:ut(Be.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function f(c,d){c=me(c);var v=c.fill,M=c.align,C=c.sign,F=c.symbol,I=c.zero,J=c.width,U=c.comma,k=c.precision,ne=c.trim,_=c.type;_==="n"?(U=!0,_="g"):De[_]||(k===void 0&&(k=12),ne=!0,_="g"),(I||v==="0"&&M==="=")&&(I=!0,v="0",M="=");var q=(d&&d.prefix!==void 0?d.prefix:"")+(F==="$"?t:F==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():""),te=(F==="$"?r:/[%p]/.test(_)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),re=De[_],ie=/[defgprs%]/.test(_);k=k===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function Y(p){var j=q,R=te,S,K,D;if(_==="c")R=re(p)+R,p="";else{p=+p;var O=p<0||1/p<0;if(p=isNaN(p)?l:re(Math.abs(p),k),ne&&(p=lt(p)),O&&+p==0&&C!=="+"&&(O=!1),j=(O?C==="("?C:s:C==="-"||C==="("?"":C)+j,R=(_==="s"&&!isNaN(p)&&ge!==void 0?Ze[8+ge/3]:"")+R+(O&&C==="("?")":""),ie){for(S=-1,K=p.length;++S<K;)if(D=p.charCodeAt(S),48>D||D>57){R=(D===46?i+p.slice(S+1):p.slice(S))+R,p=p.slice(0,S);break}}}U&&!I&&(p=n(p,1/0));var z=j.length+p.length+R.length,L=z<J?new Array(J-z+1).join(v):"";switch(U&&I&&(p=n(L+p,L.length?J-R.length:1/0),L=""),M){case"<":p=j+p+R+L;break;case"=":p=j+L+p+R;break;case"^":p=L.slice(0,z=L.length>>1)+j+p+R+L.slice(z);break;default:p=L+j+p+R;break}return a(p)}return Y.toString=function(){return c+""},Y}function h(c,d){var v=Math.max(-8,Math.min(8,Math.floor(Z(d)/3)))*3,M=Math.pow(10,-v),C=f((c=me(c),c.type="f",c),{suffix:Ze[8+v/3]});return function(F){return C(M*F)}}return{format:f,formatPrefix:h}}var se,en,nn;mt({thousands:",",grouping:[3],currency:["$",""]});function mt(e){return se=ht(e),en=se.format,nn=se.formatPrefix,se}function gt(e){return Math.max(0,-Z(Math.abs(e)))}function pt(e,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Z(n)/3)))*3-Z(Math.abs(e)))}function xt(e,n){return e=Math.abs(e),n=Math.abs(n)-e,Math.max(0,Z(n)-Z(e))+1}function bt(e,n,t,r){var i=Xn(e,n,t),a;switch(r=me(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(n));return r.precision==null&&!isNaN(a=pt(i,o))&&(r.precision=a),nn(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=xt(i,Math.max(Math.abs(e),Math.abs(n))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=gt(i))&&(r.precision=a-(r.type==="%")*2);break}}return en(r)}function yt(e){var n=e.domain;return e.ticks=function(t){var r=n();return Kn(r[0],r[r.length-1],t??10)},e.tickFormat=function(t,r){var i=n();return bt(i[0],i[i.length-1],t??10,r)},e.nice=function(t){t==null&&(t=10);var r=n(),i=0,a=r.length-1,o=r[i],s=r[a],l,f,h=10;for(s<o&&(f=o,o=s,s=f,f=i,i=a,a=f);h-- >0;){if(f=Re(o,s,t),f===l)return r[i]=o,r[a]=s,n(r);if(f>0)o=Math.floor(o/f)*f,s=Math.ceil(s/f)*f;else if(f<0)o=Math.ceil(o*f)/f,s=Math.floor(s*f)/f;else break;l=f}return e},e}function tn(){var e=at();return e.copy=function(){return it(e,tn())},Wn.apply(e,arguments),yt(e)}const we=(e,n)=>{const t=e?.[n];return typeof t=="number"?t:0},Je=(e,n)=>{if(!e.length)return()=>n.minColor;const t=Math.min(...e),r=Math.max(...e);if(t===r)return()=>n.maxColor;const i=tn().domain([t,r]).range([0,1]),a=Ne(n.minColor,n.maxColor);return o=>a(i(o))},wt=e=>e<=1.35?2:e<=2.1?1:0,vt=e=>new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e),ve=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Mt=(e,n)=>{let t=e.trim();if(!t)return t;const r=n?.trim().toUpperCase();return r&&/^[A-Z]{2}$/.test(r)&&(t=t.replace(new RegExp(`\\s*\\(${r}\\)`,"gi"),"").replace(new RegExp(`\\s*\\[${r}\\]`,"gi"),"").replace(new RegExp(`\\s*[-–—]\\s*${r}\\s*$`,"i"),"").replace(new RegExp(`\\s+${r}\\s*$`,"i"),"")),t.trim()||e.trim()},Nt=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),_t=new Set(["countrycode","country_code","iso_a2","iso","adm0_a3","iso_3166_1"]),Rt=e=>_t.has(e.toLowerCase()),$t=(e,n)=>e.toLowerCase()==="revenue"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:"compact",maximumFractionDigits:1}).format(n):vt(n),Ye="cool-globe-float-tooltip-override",Ct=()=>{if(typeof document>"u"||document.getElementById(Ye))return;const e=document.createElement("style");e.id=Ye,e.textContent=`
|
|
2
|
+
.cool-globe-host .float-tooltip-kap {
|
|
3
|
+
background: transparent !important;
|
|
4
|
+
background-color: transparent !important;
|
|
5
|
+
padding: 0 !important;
|
|
6
|
+
border-radius: 0 !important;
|
|
7
|
+
box-shadow: none !important;
|
|
8
|
+
max-width: none !important;
|
|
9
|
+
font-size: inherit !important;
|
|
10
|
+
font-family: inherit !important;
|
|
11
|
+
color: transparent !important;
|
|
12
|
+
}
|
|
13
|
+
`,document.head.appendChild(e)},kt=({statisticsData:e,resetSignal:n,countryNumericToIsoMap:t={},countryNameToIsoMap:r={},primaryMetric:i="visits",colorScale:a=xn})=>{const o=w.useRef(null),s=w.useRef(null),l=w.useRef(void 0),f=w.useRef({}),h=w.useRef(null),c=w.useRef(n),[d,v]=w.useState(0),[M,C]=w.useState(),[F,I]=w.useState(),[J,U]=w.useState(null),[k,ne]=w.useState([]),[_,q]=w.useState([]),[te,re]=w.useState({width:900,height:760});w.useEffect(()=>{Ct()},[]);const ie=w.useMemo(()=>Object.values(e.countries).map(u=>we(u,i)),[i,e.countries]),Y=w.useMemo(()=>M?Object.values(e.regions[M]??{}).map(u=>we(u,i)):[],[M,i,e.regions]),p=w.useMemo(()=>Je(ie,a),[ie,a]),j=w.useMemo(()=>Je(Y,a),[Y,a]);w.useEffect(()=>{(async()=>{let m=[];try{m=(await(await fetch(hn)).json()).features}catch{const g=await(await fetch(mn)).json(),b=g.objects.countries,N=ln(g,b);m=N.type==="FeatureCollection"?N.features:[N]}const y=m.map(x=>{const g=String(x.id??""),b=x.properties??{},N=String(b.name??b.NAME??b.name_en??b.ADMIN??"").trim()||`Country ${g}`,T=N.toLowerCase(),P=String(b.iso_a2??b.ISO_A2??b.iso_a2_eh??"").trim().toUpperCase(),pe=t[g]??r[T]??(P&&P!=="-99"?P:void 0)??(g.length===2?g.toUpperCase():g);return{...x,properties:{...b,__isoA2:pe,name:N||pe||`Country ${g}`}}});ne(y)})()},[]),w.useEffect(()=>{if(!s.current)return;const u=new ResizeObserver(m=>{const y=m[0];y&&re({width:Math.max(360,Math.floor(y.contentRect.width)),height:Math.max(520,Math.floor(y.contentRect.height))})});return u.observe(s.current),()=>u.disconnect()},[]),w.useEffect(()=>{if(!M){q([]);return}const u=f.current[M];if(u){q(u);return}(async()=>{if(!h.current){const b=await(await fetch(gn)).json();h.current=b.features}const x=(h.current??[]).filter(g=>(g.properties??{}).iso_a2===M).map(g=>{const b=g.properties??{},N=String(b.name??"").trim();return{...g,properties:{...b,__countryCode:M,__regionName:N,name:N}}});f.current[M]=x,q(x)})()},[M]),w.useEffect(()=>{if(F&&d<2)return void v(2);M&&d<1&&v(1)},[M,F,d]),w.useEffect(()=>{const u=o.current?.controls?.();if(!u)return;u.autoRotate=!0,u.autoRotateSpeed=.45,u.enablePan=!1,u.enableZoom=!0;const m=o.current?.renderer?.();m&&m.setPixelRatio(Math.min(window.devicePixelRatio,1.5))},[]),w.useEffect(()=>{const u=o.current?.controls?.();u&&(u.autoRotate=!M&&d===0)},[M,d]),w.useEffect(()=>{if(n===c.current)return;c.current=n,v(0),C(void 0),I(void 0),U(null),q([]);const u=o.current?.controls?.();u&&(u.autoRotate=!0),o.current?.pointOfView({lat:20,lng:15,altitude:2.6},650)},[n]);const R=()=>{const u=o.current?.globeMaterial?.();u&&(u.map=null,u.color=new xe.Color("#f5f5f5"),u.emissive=new xe.Color("#ffffff"),u.emissiveIntensity=.35,u.specular=new xe.Color("#d4d4d8"),u.shininess=3,u.needsUpdate=!0)},S=(u,m,y)=>{o.current?.pointOfView({lat:u,lng:m,altitude:y},650)},K=()=>{const u=o.current?.controls?.();u&&(u.autoRotate=!1)},D=u=>{if(typeof u!="object"||u===null||!("coordinates"in u))return[];const m=u.coordinates,y=[],x=g=>{if(Array.isArray(g)){if(g.length>=2&&typeof g[0]=="number"&&typeof g[1]=="number"){y.push([g[0],g[1]]);return}g.forEach(x)}};return x(m),y},O=u=>{const m=D(u.geometry);if(!m.length)return;const y=m.reduce((x,[g,b])=>({minLat:Math.min(x.minLat,b),maxLat:Math.max(x.maxLat,b),minLng:Math.min(x.minLng,g),maxLng:Math.max(x.maxLng,g)}),{minLat:Number.POSITIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY,minLng:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY});if(!(!Number.isFinite(y.minLat)||!Number.isFinite(y.minLng)))return y},z=u=>{const m=Math.max(.1,u.maxLat-u.minLat),y=Math.max(.1,u.maxLng-u.minLng),g=Math.max(m,y)/112;return Math.min(.9,Math.max(.14,g))},L=()=>{l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{const u=o.current?.pointOfView?.().altitude??2.4,m=wt(u);v(m),m<=0&&I(void 0)},120)},rn=u=>{const m=u.properties??{};if(d===0){const y=r[String(m.name??"").toLowerCase()],x=m.__isoA2??(typeof m.iso_a2=="string"?m.iso_a2.toUpperCase():void 0)??y;if(!x)return;K(),v(1),C(x),I(void 0);const g=O(u);if(g){S((g.minLat+g.maxLat)/2,(g.minLng+g.maxLng)/2,z(g));return}return}if(d>=1){const y=m.__regionName;if(!y)return;K(),v(2),I(y);const x=O(u);if(x){S((x.minLat+x.maxLat)/2,(x.minLng+x.maxLng)/2,Math.max(.2,z(x)*.52));return}}},on=d===0?k:_.length?[...k,..._]:k,Se=(u,m)=>{if(m&&u)return e.regions[u]?.[m];if(u)return e.countries[u]},an=u=>{if(!u)return'<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';const m=Object.entries(u).filter(([b,N])=>!Rt(b)&&typeof N=="number"&&Number.isFinite(N));if(!m.length)return'<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';m.sort(([b],[N])=>b===i?-1:N===i?1:b.localeCompare(N));const y="display:flex;justify-content:space-between;align-items:center;gap:24px;padding:6px 0;",x="font-weight:500;color:#697386;font-size:15px;",g="font-weight:600;color:#1A1F36;font-size:15px;font-variant-numeric:tabular-nums;white-space:nowrap;";return m.map(([b,N])=>{const T=ve(Nt(b)),P=ve($t(b,N));return`<div style="${y}"><span style="${x}">${T}</span><span style="${g}">${P}</span></div>`}).join("")};return Ee.jsx("div",{ref:s,className:"cool-globe-host",style:{position:"relative",height:"100%",overflow:"hidden",background:"white"},children:Ee.jsx(sn,{ref:o,globeImageUrl:pn,backgroundColor:"#ffffff",polygonsData:on,polygonAltitude:.01,polygonsTransitionDuration:180,polygonCapColor:u=>{const m=u.properties??{},y=!!m.__regionName;if(d>0&&!y)return"rgba(148,163,184,0.027)";const x=d===0?m.__isoA2:m.__countryCode,g=m.__regionName,b=Se(x,g),N=we(b,i),T=d===0?p(N):j(N);return J===u?"#60a5fa":T},polygonSideColor:u=>{const m=u.properties??{};return d>0&&!m.__regionName?"rgba(148,163,184,0.027)":m.__regionName?"rgba(148,163,184,0.22)":"rgba(226,232,240,0.45)"},polygonStrokeColor:u=>{const m=u.properties??{};return d>0&&!m.__regionName?"rgba(100,116,139,0.067)":m.__regionName?"rgba(51,65,85,0.98)":"rgba(156,163,175,0.95)"},polygonLabel:u=>{const m=u.properties??{};if(d>0&&!m.__regionName)return"";const y=d===0?m.__isoA2:m.__countryCode,x=m.__regionName,g=x??m.name??"Unknown",b=d===0?m.__isoA2:m.__countryCode??m.__isoA2,N=Mt(String(g),b),T=Se(y,x),P=an(T);return`<div style="font-family:system-ui,-apple-system,'Segoe UI',Roboto,Inter,sans-serif;min-width:272px;max-width:320px;padding:20px;background:#ffffff;color:#1A1F36;border-radius:14px;box-shadow:0 8px 24px rgba(15,23,42,0.12);">
|
|
14
|
+
<div style="font-size:17px;font-weight:600;color:#1A1F36;line-height:1.25;margin-bottom:4px;">${ve(N)}</div>
|
|
15
|
+
<div style="margin-top:8px;">${P}</div>
|
|
16
|
+
</div>`},onPolygonHover:u=>{U(u??null)},onPolygonClick:u=>rn(u),onZoom:L,onGlobeReady:()=>{R(),S(20,15,2.6)},onGlobeClick:()=>{const u=o.current?.controls?.();u&&(u.autoRotate=!1)},lineHoverPrecision:0,width:te.width,height:te.height,showAtmosphere:!1})})};exports.CoolGlobe=kt;
|