cool-globe 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cool-globe contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # cool-globe
2
+
3
+ Reusable interactive React globe component library focused on country and region drill-down.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install cool-globe
9
+ ```
10
+
11
+ ## Peer dependencies
12
+
13
+ Install these in the consuming app:
14
+
15
+ - `react` (`^18 || ^19`)
16
+ - `react-dom` (`^18 || ^19`)
17
+ - `react-globe.gl` (`^2`)
18
+
19
+ ## Basic usage
20
+
21
+ ```tsx
22
+ import { useState } from "react";
23
+ import { CoolGlobe, type StatisticsData } from "cool-globe";
24
+
25
+ const statisticsData: StatisticsData = {
26
+ countries: {
27
+ LT: { population: 2801000, visits: 85000, revenue: 1200000 },
28
+ DE: { population: 83200000, visits: 2800000, revenue: 52000000 },
29
+ },
30
+ regions: {
31
+ LT: {
32
+ Vilnius: { population: 580000, visits: 45000, revenue: 700000 },
33
+ },
34
+ DE: {
35
+ Bayern: { population: 13100000, visits: 510000, revenue: 9800000 },
36
+ },
37
+ },
38
+ };
39
+
40
+ export default function Example() {
41
+ const [resetSignal, setResetSignal] = useState(0);
42
+
43
+ return (
44
+ <div style={{ height: "100vh", width: "100vw", position: "relative" }}>
45
+ <button
46
+ type="button"
47
+ onClick={() => setResetSignal((value) => value + 1)}
48
+ style={{ position: "absolute", top: 16, left: 16, zIndex: 10 }}
49
+ >
50
+ Reset globe
51
+ </button>
52
+ <CoolGlobe statisticsData={statisticsData} resetSignal={resetSignal} />
53
+ </div>
54
+ );
55
+ }
56
+ ```
57
+
58
+ ## Props
59
+
60
+ - `statisticsData` (required): country/region metric tree.
61
+ - `resetSignal` (optional): when this value changes, globe view and selection state reset to default.
62
+ - `primaryMetric` (optional, default: `"visits"`): metric key used for color scale.
63
+ - `colorScale` (optional): `{ minColor, maxColor }`.
64
+ - `countryNumericToIsoMap` (optional): fallback mapping from numeric country ids to ISO2.
65
+ - `countryNameToIsoMap` (optional): fallback mapping from country names to ISO2.
66
+
67
+ ## Development
68
+
69
+ ```bash
70
+ npm install
71
+ npm run dev
72
+ ```
73
+
74
+ ## Build
75
+
76
+ ```bash
77
+ npm run build
78
+ ```
79
+
80
+ ## License
81
+
82
+ MIT
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Nt=require("react-globe.gl");var we={exports:{}},ce={};var Ze;function Tt(){if(Ze)return ce;Ze=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,i,o){var s=null;if(o!==void 0&&(s=""+o),i.key!==void 0&&(s=""+i.key),"key"in i){o={};for(var a in i)a!=="key"&&(o[a]=i[a])}else o=i;return i=o.ref,{$$typeof:t,type:n,key:s,ref:i!==void 0?i:null,props:o}}return ce.Fragment=e,ce.jsx=r,ce.jsxs=r,ce}var le={};var Je;function $t(){return Je||(Je=1,process.env.NODE_ENV!=="production"&&(function(){function t(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===K?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case S:return"Fragment";case H:return"Profiler";case $:return"StrictMode";case R:return"Suspense";case j:return"SuspenseList";case ne:return"Activity"}if(typeof c=="object")switch(typeof c.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),c.$$typeof){case v:return"Portal";case A:return c.displayName||"Context";case P:return(c._context.displayName||"Context")+".Consumer";case z:var w=c.render;return c=c.displayName,c||(c=w.displayName||w.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case re:return w=c.displayName||null,w!==null?w:t(c.type)||"Memo";case Z:w=c._payload,c=c._init;try{return t(c(w))}catch{}}return null}function e(c){return""+c}function r(c){try{e(c);var w=!1}catch{w=!0}if(w){w=console;var k=w.error,M=typeof Symbol=="function"&&Symbol.toStringTag&&c[Symbol.toStringTag]||c.constructor.name||"Object";return k.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",M),e(c)}}function n(c){if(c===S)return"<>";if(typeof c=="object"&&c!==null&&c.$$typeof===Z)return"<...>";try{var w=t(c);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function i(){var c=y.A;return c===null?null:c.getOwner()}function o(){return Error("react-stack-top-frame")}function s(c){if(I.call(c,"key")){var w=Object.getOwnPropertyDescriptor(c,"key").get;if(w&&w.isReactWarning)return!1}return c.key!==void 0}function a(c,w){function k(){J||(J=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}k.isReactWarning=!0,Object.defineProperty(c,"key",{get:k,configurable:!0})}function l(){var c=t(this.type);return X[c]||(X[c]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),c=this.props.ref,c!==void 0?c:null}function u(c,w,k,M,d,m){var x=k.ref;return c={$$typeof:E,type:c,key:w,props:k,_owner:M},(x!==void 0?x:null)!==null?Object.defineProperty(c,"ref",{enumerable:!1,get:l}):Object.defineProperty(c,"ref",{enumerable:!1,value:null}),c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(c,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(c,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:d}),Object.defineProperty(c,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:m}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}function f(c,w,k,M,d,m){var x=w.children;if(x!==void 0)if(M)if(N(x)){for(M=0;M<x.length;M++)h(x[M]);Object.freeze&&Object.freeze(x)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(x);if(I.call(w,"key")){x=t(c);var p=Object.keys(w).filter(function(C){return C!=="key"});M=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",D[x+M]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,M,x,p,x),D[x+M]=!0)}if(x=null,k!==void 0&&(r(k),x=""+k),s(w)&&(r(w.key),x=""+w.key),"key"in w){k={};for(var b in w)b!=="key"&&(k[b]=w[b])}else k=w;return x&&a(k,typeof c=="function"?c.displayName||c.name||"Unknown":c),u(c,x,k,i(),d,m)}function h(c){g(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===Z&&(c._payload.status==="fulfilled"?g(c._payload.value)&&c._payload.value._store&&(c._payload.value._store.validated=1):c._store&&(c._store.validated=1))}function g(c){return typeof c=="object"&&c!==null&&c.$$typeof===E}var F=_,E=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),A=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),y=F.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=Object.prototype.hasOwnProperty,N=Array.isArray,L=console.createTask?console.createTask:function(){return null};F={react_stack_bottom_frame:function(c){return c()}};var J,X={},U=F.react_stack_bottom_frame.bind(F,o)(),V=L(n(o)),D={};le.Fragment=S,le.jsx=function(c,w,k){var M=1e4>y.recentlyCreatedOwnerStacks++;return f(c,w,k,!1,M?Error("react-stack-top-frame"):U,M?L(n(c)):V)},le.jsxs=function(c,w,k){var M=1e4>y.recentlyCreatedOwnerStacks++;return f(c,w,k,!0,M?Error("react-stack-top-frame"):U,M?L(n(c)):V)}})()),le}var Qe;function Lt(){return Qe||(Qe=1,process.env.NODE_ENV==="production"?we.exports=Tt():we.exports=$t()),we.exports}var Ke=Lt();function Dt(t){return t}function Ot(t){if(t==null)return Dt;var e,r,n=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(a,l){l||(e=r=0);var u=2,f=a.length,h=new Array(f);for(h[0]=(e+=a[0])*n+o,h[1]=(r+=a[1])*i+s;u<f;)h[u]=a[u],++u;return h}}function Bt(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function Pt(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(r){return et(t,r)})}:et(t,e)}function et(t,e){var r=e.id,n=e.bbox,i=e.properties==null?{}:e.properties,o=jt(t,e);return r==null&&n==null?{type:"Feature",properties:i,geometry:o}:n==null?{type:"Feature",id:r,properties:i,geometry:o}:{type:"Feature",id:r,bbox:n,properties:i,geometry:o}}function jt(t,e){var r=Ot(t.transform),n=t.arcs;function i(f,h){h.length&&h.pop();for(var g=n[f<0?~f:f],F=0,E=g.length;F<E;++F)h.push(r(g[F],F));f<0&&Bt(h,E)}function o(f){return r(f)}function s(f){for(var h=[],g=0,F=f.length;g<F;++g)i(f[g],h);return h.length<2&&h.push(h[0]),h}function a(f){for(var h=s(f);h.length<4;)h.push(h[0]);return h}function l(f){return f.map(a)}function u(f){var h=f.type,g;switch(h){case"GeometryCollection":return{type:h,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=l(f.arcs);break;case"MultiPolygon":g=f.arcs.map(l);break;default:return null}return{type:h,coordinates:g}}return u(e)}const Et="180",It="",Y="srgb",tt="srgb-linear",rt="linear",$e="srgb";function fe(t,e,r){return Math.max(e,Math.min(r,t))}function Ht(t,e){return(t%e+e)%e}function Le(t,e,r){return(1-r)*t+r*e}class xe{constructor(e,r,n,i,o,s,a,l,u){xe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,r,n,i,o,s,a,l,u)}set(e,r,n,i,o,s,a,l,u){const f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=r,f[4]=o,f[5]=l,f[6]=n,f[7]=s,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const r=this.elements,n=e.elements;return r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],r[4]=n[4],r[5]=n[5],r[6]=n[6],r[7]=n[7],r[8]=n[8],this}extractBasis(e,r,n){return e.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const r=e.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){const n=e.elements,i=r.elements,o=this.elements,s=n[0],a=n[3],l=n[6],u=n[1],f=n[4],h=n[7],g=n[2],F=n[5],E=n[8],v=i[0],S=i[3],$=i[6],H=i[1],P=i[4],A=i[7],z=i[2],R=i[5],j=i[8];return o[0]=s*v+a*H+l*z,o[3]=s*S+a*P+l*R,o[6]=s*$+a*A+l*j,o[1]=u*v+f*H+h*z,o[4]=u*S+f*P+h*R,o[7]=u*$+f*A+h*j,o[2]=g*v+F*H+E*z,o[5]=g*S+F*P+E*R,o[8]=g*$+F*A+E*j,this}multiplyScalar(e){const r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=e,r[4]*=e,r[7]*=e,r[2]*=e,r[5]*=e,r[8]*=e,this}determinant(){const e=this.elements,r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],f=e[8];return r*s*f-r*a*u-n*o*f+n*a*l+i*o*u-i*s*l}invert(){const e=this.elements,r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],f=e[8],h=f*s-a*u,g=a*l-f*o,F=u*o-s*l,E=r*h+n*g+i*F;if(E===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/E;return e[0]=h*v,e[1]=(i*u-f*n)*v,e[2]=(a*n-i*s)*v,e[3]=g*v,e[4]=(f*r-i*l)*v,e[5]=(i*o-a*r)*v,e[6]=F*v,e[7]=(n*l-u*r)*v,e[8]=(s*r-n*o)*v,this}transpose(){let e;const r=this.elements;return e=r[1],r[1]=r[3],r[3]=e,e=r[2],r[2]=r[6],r[6]=e,e=r[5],r[5]=r[7],r[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const r=this.elements;return e[0]=r[0],e[1]=r[3],e[2]=r[6],e[3]=r[1],e[4]=r[4],e[5]=r[7],e[6]=r[2],e[7]=r[5],e[8]=r[8],this}setUvTransform(e,r,n,i,o,s,a){const l=Math.cos(o),u=Math.sin(o);return this.set(n*l,n*u,-n*(l*s+u*a)+s+e,-i*u,i*l,-i*(-u*s+l*a)+a+r,0,0,1),this}scale(e,r){return this.premultiply(De.makeScale(e,r)),this}rotate(e){return this.premultiply(De.makeRotation(-e)),this}translate(e,r){return this.premultiply(De.makeTranslation(e,r)),this}makeTranslation(e,r){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,r,0,0,1),this}makeRotation(e){const r=Math.cos(e),n=Math.sin(e);return this.set(r,-n,0,n,r,0,0,0,1),this}makeScale(e,r){return this.set(e,0,0,0,r,0,0,0,1),this}equals(e){const r=this.elements,n=e.elements;for(let i=0;i<9;i++)if(r[i]!==n[i])return!1;return!0}fromArray(e,r=0){for(let n=0;n<9;n++)this.elements[n]=e[n+r];return this}toArray(e=[],r=0){const n=this.elements;return e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3],e[r+4]=n[4],e[r+5]=n[5],e[r+6]=n[6],e[r+7]=n[7],e[r+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const De=new xe,nt={};function it(t){t in nt||(nt[t]=!0,console.warn(t))}const ot=new xe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),st=new xe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gt(){const t={enabled:!0,workingColorSpace:tt,spaces:{},convert:function(i,o,s){return this.enabled===!1||o===s||!o||!s||(this.spaces[o].transfer===$e&&(i.r=oe(i.r),i.g=oe(i.g),i.b=oe(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===$e&&(i.r=se(i.r),i.g=se(i.g),i.b=se(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===It?rt: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 it("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return it("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[tt]:{primaries:e,whitePoint:n,transfer:rt,toXYZ:ot,fromXYZ:st,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:Y},outputColorSpaceConfig:{drawingBufferColorSpace:Y}},[Y]:{primaries:e,whitePoint:n,transfer:$e,toXYZ:ot,fromXYZ:st,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:Y}}}),t}const G=Gt();function oe(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function se(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const vt={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},ye={h:0,s:0,l:0};function Oe(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*6*(2/3-r):t}let he=class{constructor(e,r,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,r,n)}set(e,r,n){if(r===void 0&&n===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,r,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,r=Y){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,G.colorSpaceToWorking(this,r),this}setRGB(e,r,n,i=G.workingColorSpace){return this.r=e,this.g=r,this.b=n,G.colorSpaceToWorking(this,i),this}setHSL(e,r,n,i=G.workingColorSpace){if(e=Ht(e,1),r=fe(r,0,1),n=fe(n,0,1),r===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+r):n+r-n*r,s=2*n-o;this.r=Oe(s,o,e+1/3),this.g=Oe(s,o,e),this.b=Oe(s,o,e-1/3)}return G.colorSpaceToWorking(this,i),this}setStyle(e,r=Y){function n(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 n(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,r);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(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,r);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 n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,r);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,r);if(s===6)return this.setHex(parseInt(o,16),r);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,r);return this}setColorName(e,r=Y){const n=vt[e.toLowerCase()];return n!==void 0?this.setHex(n,r):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=oe(e.r),this.g=oe(e.g),this.b=oe(e.b),this}copyLinearToSRGB(e){return this.r=se(e.r),this.g=se(e.g),this.b=se(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Y){return G.workingToColorSpace(T.copy(this),e),Math.round(fe(T.r*255,0,255))*65536+Math.round(fe(T.g*255,0,255))*256+Math.round(fe(T.b*255,0,255))}getHexString(e=Y){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,r=G.workingColorSpace){G.workingToColorSpace(T.copy(this),r);const n=T.r,i=T.g,o=T.b,s=Math.max(n,i,o),a=Math.min(n,i,o);let l,u;const f=(a+s)/2;if(a===s)l=0,u=0;else{const h=s-a;switch(u=f<=.5?h/(s+a):h/(2-s-a),s){case n:l=(i-o)/h+(i<o?6:0);break;case i:l=(o-n)/h+2;break;case o:l=(n-i)/h+4;break}l/=6}return e.h=l,e.s=u,e.l=f,e}getRGB(e,r=G.workingColorSpace){return G.workingToColorSpace(T.copy(this),r),e.r=T.r,e.g=T.g,e.b=T.b,e}getStyle(e=Y){G.workingToColorSpace(T.copy(this),e);const r=T.r,n=T.g,i=T.b;return e!==Y?`color(${e} ${r.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(r*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,r,n){return this.getHSL(Q),this.setHSL(Q.h+e,Q.s+r,Q.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,r){return this.r=e.r+r.r,this.g=e.g+r.g,this.b=e.b+r.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,r){return this.r+=(e.r-this.r)*r,this.g+=(e.g-this.g)*r,this.b+=(e.b-this.b)*r,this}lerpColors(e,r,n){return this.r=e.r+(r.r-e.r)*n,this.g=e.g+(r.g-e.g)*n,this.b=e.b+(r.b-e.b)*n,this}lerpHSL(e,r){this.getHSL(Q),e.getHSL(ye);const n=Le(Q.h,ye.h,r),i=Le(Q.s,ye.s,r),o=Le(Q.l,ye.l,r);return this.setHSL(n,i,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const r=this.r,n=this.g,i=this.b,o=e.elements;return this.r=o[0]*r+o[3]*n+o[6]*i,this.g=o[1]*r+o[4]*n+o[7]*i,this.b=o[2]*r+o[5]*n+o[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,r=0){return this.r=e[r],this.g=e[r+1],this.b=e[r+2],this}toArray(e=[],r=0){return e[r]=this.r,e[r+1]=this.g,e[r+2]=this.b,e}fromBufferAttribute(e,r){return this.r=e.getX(r),this.g=e.getY(r),this.b=e.getZ(r),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const T=new he;he.NAMES=vt;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Et}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Et);const Yt="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson",qt="https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json",zt="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson",Ut="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>",Vt={minColor:"#f8fafc",maxColor:"#e5e7eb"};function ze(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function kt(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function pe(){}var de=.7,Ce=1/de,ae="\\s*([+-]?\\d+)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",W="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Wt=/^#([0-9a-f]{3,8})$/,Xt=new RegExp(`^rgb\\(${ae},${ae},${ae}\\)$`),Zt=new RegExp(`^rgb\\(${W},${W},${W}\\)$`),Jt=new RegExp(`^rgba\\(${ae},${ae},${ae},${ge}\\)$`),Qt=new RegExp(`^rgba\\(${W},${W},${W},${ge}\\)$`),Kt=new RegExp(`^hsl\\(${ge},${W},${W}\\)$`),er=new RegExp(`^hsla\\(${ge},${W},${W},${ge}\\)$`),at={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};ze(pe,me,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ut,formatHex:ut,formatHex8:tr,formatHsl:rr,formatRgb:ct,toString:ct});function ut(){return this.rgb().formatHex()}function tr(){return this.rgb().formatHex8()}function rr(){return Ct(this).formatHsl()}function ct(){return this.rgb().formatRgb()}function me(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Wt.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?lt(e):r===3?new B(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Fe(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Fe(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=Xt.exec(t))?new B(e[1],e[2],e[3],1):(e=Zt.exec(t))?new B(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Jt.exec(t))?Fe(e[1],e[2],e[3],e[4]):(e=Qt.exec(t))?Fe(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Kt.exec(t))?dt(e[1],e[2]/100,e[3]/100,1):(e=er.exec(t))?dt(e[1],e[2]/100,e[3]/100,e[4]):at.hasOwnProperty(t)?lt(at[t]):t==="transparent"?new B(NaN,NaN,NaN,0):null}function lt(t){return new B(t>>16&255,t>>8&255,t&255,1)}function Fe(t,e,r,n){return n<=0&&(t=e=r=NaN),new B(t,e,r,n)}function nr(t){return t instanceof pe||(t=me(t)),t?(t=t.rgb(),new B(t.r,t.g,t.b,t.opacity)):new B}function Ie(t,e,r,n){return arguments.length===1?nr(t):new B(t,e,r,n??1)}function B(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}ze(B,Ie,kt(pe,{brighter(t){return t=t==null?Ce:Math.pow(Ce,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new B(te(this.r),te(this.g),te(this.b),_e(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:ft,formatHex:ft,formatHex8:ir,formatRgb:ht,toString:ht}));function ft(){return`#${ee(this.r)}${ee(this.g)}${ee(this.b)}`}function ir(){return`#${ee(this.r)}${ee(this.g)}${ee(this.b)}${ee((isNaN(this.opacity)?1:this.opacity)*255)}`}function ht(){const t=_e(this.opacity);return`${t===1?"rgb(":"rgba("}${te(this.r)}, ${te(this.g)}, ${te(this.b)}${t===1?")":`, ${t})`}`}function _e(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function te(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ee(t){return t=te(t),(t<16?"0":"")+t.toString(16)}function dt(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new q(t,e,r,n)}function Ct(t){if(t instanceof q)return new q(t.h,t.s,t.l,t.opacity);if(t instanceof pe||(t=me(t)),!t)return new q;if(t instanceof q)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),o=Math.max(e,r,n),s=NaN,a=o-i,l=(o+i)/2;return a?(e===o?s=(r-n)/a+(r<n)*6:r===o?s=(n-e)/a+2:s=(e-r)/a+4,a/=l<.5?o+i:2-o-i,s*=60):a=l>0&&l<1?0:s,new q(s,a,l,t.opacity)}function or(t,e,r,n){return arguments.length===1?Ct(t):new q(t,e,r,n??1)}function q(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}ze(q,or,kt(pe,{brighter(t){return t=t==null?Ce:Math.pow(Ce,t),new q(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new q(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,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new B(Be(t>=240?t-240:t+120,i,n),Be(t,i,n),Be(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new q(gt(this.h),Ee(this.s),Ee(this.l),_e(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=_e(this.opacity);return`${t===1?"hsl(":"hsla("}${gt(this.h)}, ${Ee(this.s)*100}%, ${Ee(this.l)*100}%${t===1?")":`, ${t})`}`}}));function gt(t){return t=(t||0)%360,t<0?t+360:t}function Ee(t){return Math.max(0,Math.min(1,t||0))}function Be(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const Ue=t=>()=>t;function sr(t,e){return function(r){return t+r*e}}function ar(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function ur(t){return(t=+t)==1?_t:function(e,r){return r-e?ar(e,r,t):Ue(isNaN(e)?r:e)}}function _t(t,e){var r=e-t;return r?sr(t,r):Ue(isNaN(t)?e:t)}const He=(function t(e){var r=ur(e);function n(i,o){var s=r((i=Ie(i)).r,(o=Ie(o)).r),a=r(i.g,o.g),l=r(i.b,o.b),u=_t(i.opacity,o.opacity);return function(f){return i.r=s(f),i.g=a(f),i.b=l(f),i.opacity=u(f),i+""}}return n.gamma=t,n})(1);function cr(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=t[i]*(1-o)+e[i]*o;return n}}function lr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fr(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)i[s]=Ve(t[s],e[s]);for(;s<r;++s)o[s]=e[s];return function(a){for(s=0;s<n;++s)o[s]=i[s](a);return o}}function hr(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function Re(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function dr(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=Ve(t[i],e[i]):n[i]=e[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var Ge=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Pe=new RegExp(Ge.source,"g");function gr(t){return function(){return t}}function mr(t){return function(e){return t(e)+""}}function xr(t,e){var r=Ge.lastIndex=Pe.lastIndex=0,n,i,o,s=-1,a=[],l=[];for(t=t+"",e=e+"";(n=Ge.exec(t))&&(i=Pe.exec(e));)(o=i.index)>r&&(o=e.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Re(n,i)})),r=Pe.lastIndex;return r<e.length&&(o=e.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?l[0]?mr(l[0].x):gr(e):(e=l.length,function(u){for(var f=0,h;f<e;++f)a[(h=l[f]).i]=h.x(u);return a.join("")})}function Ve(t,e){var r=typeof e,n;return e==null||r==="boolean"?Ue(e):(r==="number"?Re:r==="string"?(n=me(e))?(e=n,He):xr:e instanceof me?He:e instanceof Date?hr:lr(e)?cr:Array.isArray(e)?fr:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?dr:Re)(t,e)}function pr(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function ke(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function br(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Rt(t){let e,r,n;t.length!==2?(e=ke,r=(a,l)=>ke(t(a),l),n=(a,l)=>t(a)-l):(e=t===ke||t===br?t:wr,r=t,n=t);function i(a,l,u=0,f=a.length){if(u<f){if(e(l,l)!==0)return f;do{const h=u+f>>>1;r(a[h],l)<0?u=h+1:f=h}while(u<f)}return u}function o(a,l,u=0,f=a.length){if(u<f){if(e(l,l)!==0)return f;do{const h=u+f>>>1;r(a[h],l)<=0?u=h+1:f=h}while(u<f)}return u}function s(a,l,u=0,f=a.length){const h=i(a,l,u,f-1);return h>u&&n(a[h-1],l)>-n(a[h],l)?h-1:h}return{left:i,center:s,right:o}}function wr(){return 0}function yr(t){return t===null?NaN:+t}const Fr=Rt(ke),Er=Fr.right;Rt(yr).center;const vr=Math.sqrt(50),kr=Math.sqrt(10),Cr=Math.sqrt(2);function Me(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=vr?10:o>=kr?5:o>=Cr?2:1;let a,l,u;return i<0?(u=Math.pow(10,-i)/s,a=Math.round(t*u),l=Math.round(e*u),a/u<t&&++a,l/u>e&&--l,u=-u):(u=Math.pow(10,i)*s,a=Math.round(t/u),l=Math.round(e/u),a*u<t&&++a,l*u>e&&--l),l<a&&.5<=r&&r<2?Me(t,e,r*2):[a,l,u]}function _r(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[i,o,s]=n?Me(e,t,r):Me(t,e,r);if(!(o>=i))return[];const a=o-i+1,l=new Array(a);if(n)if(s<0)for(let u=0;u<a;++u)l[u]=(o-u)/-s;else for(let u=0;u<a;++u)l[u]=(o-u)*s;else if(s<0)for(let u=0;u<a;++u)l[u]=(i+u)/-s;else for(let u=0;u<a;++u)l[u]=(i+u)*s;return l}function Ye(t,e,r){return e=+e,t=+t,r=+r,Me(t,e,r)[2]}function Rr(t,e,r){e=+e,t=+t,r=+r;const n=e<t,i=n?Ye(e,t,r):Ye(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}function Mr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Ar(t){return function(){return t}}function Sr(t){return+t}var mt=[0,1];function ie(t){return t}function qe(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:Ar(isNaN(e)?NaN:.5)}function Nr(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function Tr(t,e,r){var n=t[0],i=t[1],o=e[0],s=e[1];return i<n?(n=qe(i,n),o=r(s,o)):(n=qe(n,i),o=r(o,s)),function(a){return o(n(a))}}function $r(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),o=new Array(n),s=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<n;)i[s]=qe(t[s],t[s+1]),o[s]=r(e[s],e[s+1]);return function(a){var l=Er(t,a,1,n)-1;return o[l](i[l](a))}}function Lr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Dr(){var t=mt,e=mt,r=Ve,n,i,o,s=ie,a,l,u;function f(){var g=Math.min(t.length,e.length);return s!==ie&&(s=Nr(t[0],t[g-1])),a=g>2?$r:Tr,l=u=null,h}function h(g){return g==null||isNaN(g=+g)?o:(l||(l=a(t.map(n),e,r)))(n(s(g)))}return h.invert=function(g){return s(i((u||(u=a(e,t.map(n),Re)))(g)))},h.domain=function(g){return arguments.length?(t=Array.from(g,Sr),f()):t.slice()},h.range=function(g){return arguments.length?(e=Array.from(g),f()):e.slice()},h.rangeRound=function(g){return e=Array.from(g),r=pr,f()},h.clamp=function(g){return arguments.length?(s=g?!0:ie,f()):s!==ie},h.interpolate=function(g){return arguments.length?(r=g,f()):r},h.unknown=function(g){return arguments.length?(o=g,h):o},function(g,F){return n=g,i=F,f()}}function Or(){return Dr()(ie,ie)}function Br(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ae(t,e){if(!isFinite(t)||t===0)return null;var r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function ue(t){return t=Ae(Math.abs(t)),t?t[1]:NaN}function Pr(t,e){return function(r,n){for(var i=r.length,o=[],s=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),o.push(r.substring(i-=a,i+a)),!((l+=a+1)>n));)a=t[s=(s+1)%t.length];return o.reverse().join(e)}}function jr(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var Ir=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Se(t){if(!(e=Ir.exec(t)))throw new Error("invalid format: "+t);var e;return new We({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]})}Se.prototype=We.prototype;function We(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+""}We.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 Hr(t){e:for(var e=t.length,r=1,n=-1,i;r<e;++r)switch(t[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var Ne;function Gr(t,e){var r=Ae(t,e);if(!r)return Ne=void 0,t.toPrecision(e);var n=r[0],i=r[1],o=i-(Ne=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Ae(t,Math.max(0,e+o-1))[0]}function xt(t,e){var r=Ae(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const pt={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Br,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)=>xt(t*100,e),r:xt,s:Gr,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function bt(t){return t}var wt=Array.prototype.map,yt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Yr(t){var e=t.grouping===void 0||t.thousands===void 0?bt:Pr(wt.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?bt:jr(wt.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(h,g){h=Se(h);var F=h.fill,E=h.align,v=h.sign,S=h.symbol,$=h.zero,H=h.width,P=h.comma,A=h.precision,z=h.trim,R=h.type;R==="n"?(P=!0,R="g"):pt[R]||(A===void 0&&(A=12),z=!0,R="g"),($||F==="0"&&E==="=")&&($=!0,F="0",E="=");var j=(g&&g.prefix!==void 0?g.prefix:"")+(S==="$"?r:S==="#"&&/[boxX]/.test(R)?"0"+R.toLowerCase():""),re=(S==="$"?n:/[%p]/.test(R)?s:"")+(g&&g.suffix!==void 0?g.suffix:""),Z=pt[R],ne=/[defgprs%]/.test(R);A=A===void 0?6:/[gprs]/.test(R)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function K(y){var I=j,N=re,L,J,X;if(R==="c")N=Z(y)+N,y="";else{y=+y;var U=y<0||1/y<0;if(y=isNaN(y)?l:Z(Math.abs(y),A),z&&(y=Hr(y)),U&&+y==0&&v!=="+"&&(U=!1),I=(U?v==="("?v:a:v==="-"||v==="("?"":v)+I,N=(R==="s"&&!isNaN(y)&&Ne!==void 0?yt[8+Ne/3]:"")+N+(U&&v==="("?")":""),ne){for(L=-1,J=y.length;++L<J;)if(X=y.charCodeAt(L),48>X||X>57){N=(X===46?i+y.slice(L+1):y.slice(L))+N,y=y.slice(0,L);break}}}P&&!$&&(y=e(y,1/0));var V=I.length+y.length+N.length,D=V<H?new Array(H-V+1).join(F):"";switch(P&&$&&(y=e(D+y,D.length?H-N.length:1/0),D=""),E){case"<":y=I+y+N+D;break;case"=":y=I+D+y+N;break;case"^":y=D.slice(0,V=D.length>>1)+I+y+N+D.slice(V);break;default:y=D+I+y+N;break}return o(y)}return K.toString=function(){return h+""},K}function f(h,g){var F=Math.max(-8,Math.min(8,Math.floor(ue(g)/3)))*3,E=Math.pow(10,-F),v=u((h=Se(h),h.type="f",h),{suffix:yt[8+F/3]});return function(S){return v(E*S)}}return{format:u,formatPrefix:f}}var ve,Mt,At;qr({thousands:",",grouping:[3],currency:["$",""]});function qr(t){return ve=Yr(t),Mt=ve.format,At=ve.formatPrefix,ve}function zr(t){return Math.max(0,-ue(Math.abs(t)))}function Ur(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ue(e)/3)))*3-ue(Math.abs(t)))}function Vr(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ue(e)-ue(t))+1}function Wr(t,e,r,n){var i=Rr(t,e,r),o;switch(n=Se(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(o=Ur(i,s))&&(n.precision=o),At(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=Vr(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=zr(i))&&(n.precision=o-(n.type==="%")*2);break}}return Mt(n)}function Xr(t){var e=t.domain;return t.ticks=function(r){var n=e();return _r(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return Wr(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,o=n.length-1,s=n[i],a=n[o],l,u,f=10;for(a<s&&(u=s,s=a,a=u,u=i,i=o,o=u);f-- >0;){if(u=Ye(s,a,r),u===l)return n[i]=s,n[o]=a,e(n);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;l=u}return t},t}function St(){var t=Or();return t.copy=function(){return Lr(t,St())},Mr.apply(t,arguments),Xr(t)}const je=(t,e)=>{const r=t?.[e];return typeof r=="number"?r:0},Ft=(t,e)=>{if(!t.length)return()=>e.minColor;const r=Math.min(...t),n=Math.max(...t);if(r===n)return()=>e.maxColor;const i=St().domain([r,n]).range([0,1]),o=He(e.minColor,e.maxColor);return s=>o(i(s))},Zr=t=>t<=1.35?2:t<=2.1?1:0,Jr=t=>new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(t),Qr=({statisticsData:t,resetSignal:e,countryNumericToIsoMap:r={},countryNameToIsoMap:n={},primaryMetric:i="visits",colorScale:o=Vt})=>{const s=_.useRef(null),a=_.useRef(null),l=_.useRef(void 0),u=_.useRef({}),f=_.useRef(null),h=_.useRef(e),[g,F]=_.useState(0),[E,v]=_.useState(),[S,$]=_.useState(),[H,P]=_.useState(null),[A,z]=_.useState([]),[R,j]=_.useState([]),[re,Z]=_.useState({width:900,height:760}),ne=_.useMemo(()=>Object.values(t.countries).map(d=>je(d,i)),[i,t.countries]),K=_.useMemo(()=>E?Object.values(t.regions[E]??{}).map(d=>je(d,i)):[],[E,i,t.regions]),y=_.useMemo(()=>Ft(ne,o),[ne,o]),I=_.useMemo(()=>Ft(K,o),[K,o]);_.useEffect(()=>{(async()=>{let m=[];try{m=(await(await fetch(Yt)).json()).features}catch{const b=await(await fetch(qt)).json(),C=b.objects.countries,O=Pt(b,C);m=O.type==="FeatureCollection"?O.features:[O]}const x=m.map(p=>{const b=String(p.id??""),C=p.properties??{},O=String(C.name??C.NAME??C.name_en??C.ADMIN??"").trim()||`Country ${b}`,Te=O.toLowerCase(),be=String(C.iso_a2??C.ISO_A2??C.iso_a2_eh??"").trim().toUpperCase(),Xe=r[b]??n[Te]??(be&&be!=="-99"?be:void 0)??(b.length===2?b.toUpperCase():b);return{...p,properties:{...C,__isoA2:Xe,name:O||Xe||`Country ${b}`}}});z(x)})()},[]),_.useEffect(()=>{if(!a.current)return;const d=new ResizeObserver(m=>{const x=m[0];x&&Z({width:Math.max(360,Math.floor(x.contentRect.width)),height:Math.max(520,Math.floor(x.contentRect.height))})});return d.observe(a.current),()=>d.disconnect()},[]),_.useEffect(()=>{if(!E){j([]);return}const d=u.current[E];if(d){j(d);return}(async()=>{if(!f.current){const C=await(await fetch(zt)).json();f.current=C.features}const p=(f.current??[]).filter(b=>(b.properties??{}).iso_a2===E).map(b=>{const C=b.properties??{},O=String(C.name??"").trim();return{...b,properties:{...C,__countryCode:E,__regionName:O,name:O}}});u.current[E]=p,j(p)})()},[E]),_.useEffect(()=>{if(S&&g<2)return void F(2);E&&g<1&&F(1)},[E,S,g]),_.useEffect(()=>{const d=s.current?.controls?.();if(!d)return;d.autoRotate=!0,d.autoRotateSpeed=.45,d.enablePan=!1,d.enableZoom=!0;const m=s.current?.renderer?.();m&&m.setPixelRatio(Math.min(window.devicePixelRatio,1.5))},[]),_.useEffect(()=>{const d=s.current?.controls?.();d&&(d.autoRotate=!E&&g===0)},[E,g]),_.useEffect(()=>{if(e===h.current)return;h.current=e,F(0),v(void 0),$(void 0),P(null),j([]);const d=s.current?.controls?.();d&&(d.autoRotate=!0),s.current?.pointOfView({lat:20,lng:15,altitude:2.6},650)},[e]);const N=()=>{const d=s.current?.globeMaterial?.();d&&(d.map=null,d.color=new he("#f5f5f5"),d.emissive=new he("#ffffff"),d.emissiveIntensity=.35,d.specular=new he("#d4d4d8"),d.shininess=3,d.needsUpdate=!0)},L=(d,m,x)=>{s.current?.pointOfView({lat:d,lng:m,altitude:x},650)},J=()=>{const d=s.current?.controls?.();d&&(d.autoRotate=!1)},X=d=>{if(typeof d!="object"||d===null||!("coordinates"in d))return[];const m=d.coordinates,x=[],p=b=>{if(Array.isArray(b)){if(b.length>=2&&typeof b[0]=="number"&&typeof b[1]=="number"){x.push([b[0],b[1]]);return}b.forEach(p)}};return p(m),x},U=d=>{const m=X(d.geometry);if(!m.length)return;const x=m.reduce((p,[b,C])=>({minLat:Math.min(p.minLat,C),maxLat:Math.max(p.maxLat,C),minLng:Math.min(p.minLng,b),maxLng:Math.max(p.maxLng,b)}),{minLat:Number.POSITIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY,minLng:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY});if(!(!Number.isFinite(x.minLat)||!Number.isFinite(x.minLng)))return x},V=d=>{const m=Math.max(.1,d.maxLat-d.minLat),x=Math.max(.1,d.maxLng-d.minLng),b=Math.max(m,x)/112;return Math.min(.9,Math.max(.14,b))},D=()=>{l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{const d=s.current?.pointOfView?.().altitude??2.4,m=Zr(d);F(m),m<=0&&$(void 0)},120)},c=d=>{const m=d.properties??{};if(g===0){const x=n[String(m.name??"").toLowerCase()],p=m.__isoA2??(typeof m.iso_a2=="string"?m.iso_a2.toUpperCase():void 0)??x;if(!p)return;J(),F(1),v(p),$(void 0);const b=U(d);if(b){L((b.minLat+b.maxLat)/2,(b.minLng+b.maxLng)/2,V(b));return}return}if(g>=1){const x=m.__regionName;if(!x)return;J(),F(2),$(x);const p=U(d);if(p){L((p.minLat+p.maxLat)/2,(p.minLng+p.maxLng)/2,Math.max(.2,V(p)*.52));return}}},w=g===0?A:R.length?[...A,...R]:A,k=(d,m)=>{if(m&&d)return t.regions[d]?.[m];if(d)return t.countries[d]},M=d=>{if(!d)return"<div>No data</div>";const m=Object.entries(d).filter(([,x])=>typeof x=="number"&&Number.isFinite(x));return m.length?(m.sort(([x],[p])=>x===i?-1:p===i?1:x.localeCompare(p)),m.map(([x,p])=>`<div>${x}: ${Jr(p)}</div>`).join("")):"<div>No data</div>"};return Ke.jsx("div",{ref:a,style:{position:"relative",height:"100%",overflow:"hidden",background:"white"},children:Ke.jsx(Nt,{ref:s,globeImageUrl:Ut,backgroundColor:"#ffffff",polygonsData:w,polygonAltitude:.01,polygonsTransitionDuration:180,polygonCapColor:d=>{const m=d.properties??{},x=!!m.__regionName;if(g>0&&!x)return"rgba(148,163,184,0.027)";const p=g===0?m.__isoA2:m.__countryCode,b=m.__regionName,C=k(p,b),O=je(C,i),Te=g===0?y(O):I(O);return H===d?"#60a5fa":Te},polygonSideColor:d=>{const m=d.properties??{};return g>0&&!m.__regionName?"rgba(148,163,184,0.027)":m.__regionName?"rgba(148,163,184,0.22)":"rgba(226,232,240,0.45)"},polygonStrokeColor:d=>{const m=d.properties??{};return g>0&&!m.__regionName?"rgba(100,116,139,0.067)":m.__regionName?"rgba(51,65,85,0.98)":"rgba(156,163,175,0.95)"},polygonLabel:d=>{const m=d.properties??{},x=g===0?m.__isoA2:m.__countryCode,p=m.__regionName,b=p??m.name??"Unknown",C=k(x,p),O=M(C);return`<div style="padding:6px 8px; font-size:12px; background:#111827; color:#f9fafb; border-radius:6px;">
7
+ <div style="font-weight:700;">${b}</div>
8
+ ${O}
9
+ </div>`},onPolygonHover:d=>{P(d??null)},onPolygonClick:d=>c(d),onZoom:D,onGlobeReady:()=>{N(),L(20,15,2.6)},onGlobeClick:()=>{const d=s.current?.controls?.();d&&(d.autoRotate=!1)},lineHoverPrecision:0,width:re.width,height:re.height,showAtmosphere:!1})})};exports.CoolGlobe=Qr;