@sckyzo/cosmos-charts 0.2.0 → 0.3.1
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/CHANGELOG.md +98 -0
- package/README.md +107 -22
- package/THIRD_PARTY_NOTICES.md +81 -0
- package/dist/BarChart.cjs +137 -0
- package/dist/BarChart.cjs.map +1 -0
- package/dist/BarChart.js +135 -0
- package/dist/BarChart.js.map +1 -0
- package/dist/BoxPlotChart.cjs +214 -0
- package/dist/BoxPlotChart.cjs.map +1 -0
- package/dist/BoxPlotChart.js +212 -0
- package/dist/BoxPlotChart.js.map +1 -0
- package/dist/BumpChart.cjs +328 -0
- package/dist/BumpChart.cjs.map +1 -0
- package/dist/BumpChart.js +326 -0
- package/dist/BumpChart.js.map +1 -0
- package/dist/CalendarChart.cjs +218 -0
- package/dist/CalendarChart.cjs.map +1 -0
- package/dist/CalendarChart.js +216 -0
- package/dist/CalendarChart.js.map +1 -0
- package/dist/DonutChart.cjs +122 -0
- package/dist/DonutChart.cjs.map +1 -0
- package/dist/DonutChart.js +120 -0
- package/dist/DonutChart.js.map +1 -0
- package/dist/FunnelChart.cjs +424 -0
- package/dist/FunnelChart.cjs.map +1 -0
- package/dist/FunnelChart.js +422 -0
- package/dist/FunnelChart.js.map +1 -0
- package/dist/GradientRadial.cjs +51 -0
- package/dist/GradientRadial.cjs.map +1 -0
- package/dist/GradientRadial.js +49 -0
- package/dist/GradientRadial.js.map +1 -0
- package/dist/HeatmapChart.cjs +148 -0
- package/dist/HeatmapChart.cjs.map +1 -0
- package/dist/HeatmapChart.js +146 -0
- package/dist/HeatmapChart.js.map +1 -0
- package/dist/LineAreaChart.cjs +98 -0
- package/dist/LineAreaChart.cjs.map +1 -0
- package/dist/LineAreaChart.js +96 -0
- package/dist/LineAreaChart.js.map +1 -0
- package/dist/MixedChart.cjs +195 -0
- package/dist/MixedChart.cjs.map +1 -0
- package/dist/MixedChart.js +193 -0
- package/dist/MixedChart.js.map +1 -0
- package/dist/RadarChart.cjs +109 -0
- package/dist/RadarChart.cjs.map +1 -0
- package/dist/RadarChart.js +107 -0
- package/dist/RadarChart.js.map +1 -0
- package/dist/RadialBarChart.cjs +99 -0
- package/dist/RadialBarChart.cjs.map +1 -0
- package/dist/RadialBarChart.js +97 -0
- package/dist/RadialBarChart.js.map +1 -0
- package/dist/RangeBarChart.cjs +218 -0
- package/dist/RangeBarChart.cjs.map +1 -0
- package/dist/RangeBarChart.js +216 -0
- package/dist/RangeBarChart.js.map +1 -0
- package/dist/RealtimeChart.cjs +173 -0
- package/dist/RealtimeChart.cjs.map +1 -0
- package/dist/RealtimeChart.js +171 -0
- package/dist/RealtimeChart.js.map +1 -0
- package/dist/ScatterChart.cjs +134 -0
- package/dist/ScatterChart.cjs.map +1 -0
- package/dist/ScatterChart.js +131 -0
- package/dist/ScatterChart.js.map +1 -0
- package/dist/SemiCircleGauge.cjs +142 -0
- package/dist/SemiCircleGauge.cjs.map +1 -0
- package/dist/SemiCircleGauge.js +140 -0
- package/dist/SemiCircleGauge.js.map +1 -0
- package/dist/Sparkline.cjs +117 -0
- package/dist/Sparkline.cjs.map +1 -0
- package/dist/Sparkline.js +115 -0
- package/dist/Sparkline.js.map +1 -0
- package/dist/StrokedGauge.cjs +94 -0
- package/dist/StrokedGauge.cjs.map +1 -0
- package/dist/StrokedGauge.js +92 -0
- package/dist/StrokedGauge.js.map +1 -0
- package/dist/TreemapChart.cjs +263 -0
- package/dist/TreemapChart.cjs.map +1 -0
- package/dist/TreemapChart.js +261 -0
- package/dist/TreemapChart.js.map +1 -0
- package/dist/WaterfallChart.cjs +235 -0
- package/dist/WaterfallChart.cjs.map +1 -0
- package/dist/WaterfallChart.js +233 -0
- package/dist/WaterfallChart.js.map +1 -0
- package/dist/WorldMap.cjs +2088 -0
- package/dist/WorldMap.cjs.map +1 -0
- package/dist/WorldMap.js +603 -0
- package/dist/WorldMap.js.map +1 -0
- package/dist/chunk-4AKHZNWP.js +127 -0
- package/dist/chunk-4AKHZNWP.js.map +1 -0
- package/dist/chunk-56WD3OHA.js +62 -0
- package/dist/chunk-56WD3OHA.js.map +1 -0
- package/dist/chunk-5C2RLJYZ.js +11 -0
- package/dist/chunk-5C2RLJYZ.js.map +1 -0
- package/dist/chunk-6FGJZBTC.js +61 -0
- package/dist/chunk-6FGJZBTC.js.map +1 -0
- package/dist/chunk-AAYHG7YK.cjs +30 -0
- package/dist/chunk-AAYHG7YK.cjs.map +1 -0
- package/dist/chunk-AOSO5QHL.js +19 -0
- package/dist/chunk-AOSO5QHL.js.map +1 -0
- package/dist/chunk-BFEDLXVW.js +12 -0
- package/dist/chunk-BFEDLXVW.js.map +1 -0
- package/dist/chunk-CMBNNLIV.cjs +63 -0
- package/dist/chunk-CMBNNLIV.cjs.map +1 -0
- package/dist/chunk-DBZQI4HM.cjs +14 -0
- package/dist/chunk-DBZQI4HM.cjs.map +1 -0
- package/dist/chunk-DI2FBGKM.js +44 -0
- package/dist/chunk-DI2FBGKM.js.map +1 -0
- package/dist/chunk-ESVGCUJN.js +58 -0
- package/dist/chunk-ESVGCUJN.js.map +1 -0
- package/dist/chunk-F2PMFYJ5.cjs +40 -0
- package/dist/chunk-F2PMFYJ5.cjs.map +1 -0
- package/dist/chunk-FUZW3H5X.js +38 -0
- package/dist/chunk-FUZW3H5X.js.map +1 -0
- package/dist/chunk-G4WOPX4D.cjs +51 -0
- package/dist/chunk-G4WOPX4D.cjs.map +1 -0
- package/dist/chunk-GDZLYYL2.js +27 -0
- package/dist/chunk-GDZLYYL2.js.map +1 -0
- package/dist/chunk-GVTMZYOM.cjs +30 -0
- package/dist/chunk-GVTMZYOM.cjs.map +1 -0
- package/dist/chunk-IW6EWB26.cjs +21 -0
- package/dist/chunk-IW6EWB26.cjs.map +1 -0
- package/dist/chunk-K3R7JGOW.cjs +18 -0
- package/dist/chunk-K3R7JGOW.cjs.map +1 -0
- package/dist/chunk-LT3UC65O.cjs +68 -0
- package/dist/chunk-LT3UC65O.cjs.map +1 -0
- package/dist/chunk-OCD6JIIX.js +23 -0
- package/dist/chunk-OCD6JIIX.js.map +1 -0
- package/dist/chunk-RCDTBZC2.cjs +131 -0
- package/dist/chunk-RCDTBZC2.cjs.map +1 -0
- package/dist/chunk-SR2ESX3R.cjs +66 -0
- package/dist/chunk-SR2ESX3R.cjs.map +1 -0
- package/dist/chunk-T3K6Q34U.cjs +82 -0
- package/dist/chunk-T3K6Q34U.cjs.map +1 -0
- package/dist/chunk-TYQWZR3S.cjs +13 -0
- package/dist/chunk-TYQWZR3S.cjs.map +1 -0
- package/dist/chunk-UATB2IRY.js +51 -0
- package/dist/chunk-UATB2IRY.js.map +1 -0
- package/dist/chunk-UJIV5PVI.js +13 -0
- package/dist/chunk-UJIV5PVI.js.map +1 -0
- package/dist/chunk-UL3SNXQR.js +280 -0
- package/dist/chunk-UL3SNXQR.js.map +1 -0
- package/dist/chunk-URNXLVSK.js +44 -0
- package/dist/chunk-URNXLVSK.js.map +1 -0
- package/dist/chunk-VIOSQN4Z.js +79 -0
- package/dist/chunk-VIOSQN4Z.js.map +1 -0
- package/dist/chunk-X3YZP5WF.cjs +46 -0
- package/dist/chunk-X3YZP5WF.cjs.map +1 -0
- package/dist/chunk-XMFBVMW7.cjs +30 -0
- package/dist/chunk-XMFBVMW7.cjs.map +1 -0
- package/dist/chunk-XUGQ6VXO.cjs +60 -0
- package/dist/chunk-XUGQ6VXO.cjs.map +1 -0
- package/dist/chunk-YMRNTIOK.js +27 -0
- package/dist/chunk-YMRNTIOK.js.map +1 -0
- package/dist/chunk-ZWHCUYIN.cjs +282 -0
- package/dist/chunk-ZWHCUYIN.cjs.map +1 -0
- package/dist/index.cjs +154 -1166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +470 -80
- package/dist/index.d.ts +470 -80
- package/dist/index.js +23 -1144
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +88 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.js +84 -0
- package/dist/theme.js.map +1 -0
- package/package.json +23 -12
|
@@ -0,0 +1,2088 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkT3K6Q34U_cjs = require('./chunk-T3K6Q34U.cjs');
|
|
5
|
+
var chunkLT3UC65O_cjs = require('./chunk-LT3UC65O.cjs');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var topojsonClient = require('topojson-client');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
// ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/fsum.js
|
|
11
|
+
var Adder = class {
|
|
12
|
+
constructor() {
|
|
13
|
+
this._partials = new Float64Array(32);
|
|
14
|
+
this._n = 0;
|
|
15
|
+
}
|
|
16
|
+
add(x) {
|
|
17
|
+
const p = this._partials;
|
|
18
|
+
let i = 0;
|
|
19
|
+
for (let j = 0; j < this._n && j < 32; j++) {
|
|
20
|
+
const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
|
|
21
|
+
if (lo) p[i++] = lo;
|
|
22
|
+
x = hi;
|
|
23
|
+
}
|
|
24
|
+
p[i] = x;
|
|
25
|
+
this._n = i + 1;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
valueOf() {
|
|
29
|
+
const p = this._partials;
|
|
30
|
+
let n = this._n, x, y, lo, hi = 0;
|
|
31
|
+
if (n > 0) {
|
|
32
|
+
hi = p[--n];
|
|
33
|
+
while (n > 0) {
|
|
34
|
+
x = hi;
|
|
35
|
+
y = p[--n];
|
|
36
|
+
hi = x + y;
|
|
37
|
+
lo = y - (hi - x);
|
|
38
|
+
if (lo) break;
|
|
39
|
+
}
|
|
40
|
+
if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) {
|
|
41
|
+
y = lo * 2;
|
|
42
|
+
x = hi + y;
|
|
43
|
+
if (y == x - hi) hi = x;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return hi;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/merge.js
|
|
51
|
+
function* flatten(arrays) {
|
|
52
|
+
for (const array of arrays) {
|
|
53
|
+
yield* array;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function merge(arrays) {
|
|
57
|
+
return Array.from(flatten(arrays));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/math.js
|
|
61
|
+
var epsilon = 1e-6;
|
|
62
|
+
var pi = Math.PI;
|
|
63
|
+
var halfPi = pi / 2;
|
|
64
|
+
var quarterPi = pi / 4;
|
|
65
|
+
var tau = pi * 2;
|
|
66
|
+
var degrees = 180 / pi;
|
|
67
|
+
var radians = pi / 180;
|
|
68
|
+
var abs = Math.abs;
|
|
69
|
+
var atan = Math.atan;
|
|
70
|
+
var atan2 = Math.atan2;
|
|
71
|
+
var cos = Math.cos;
|
|
72
|
+
var sin = Math.sin;
|
|
73
|
+
var sign = Math.sign || function(x) {
|
|
74
|
+
return x > 0 ? 1 : x < 0 ? -1 : 0;
|
|
75
|
+
};
|
|
76
|
+
var sqrt = Math.sqrt;
|
|
77
|
+
function acos(x) {
|
|
78
|
+
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
|
79
|
+
}
|
|
80
|
+
function asin(x) {
|
|
81
|
+
return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/noop.js
|
|
85
|
+
function noop() {
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/stream.js
|
|
89
|
+
function streamGeometry(geometry, stream) {
|
|
90
|
+
if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
|
|
91
|
+
streamGeometryType[geometry.type](geometry, stream);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
var streamObjectType = {
|
|
95
|
+
Feature: function(object, stream) {
|
|
96
|
+
streamGeometry(object.geometry, stream);
|
|
97
|
+
},
|
|
98
|
+
FeatureCollection: function(object, stream) {
|
|
99
|
+
var features = object.features, i = -1, n = features.length;
|
|
100
|
+
while (++i < n) streamGeometry(features[i].geometry, stream);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var streamGeometryType = {
|
|
104
|
+
Sphere: function(object, stream) {
|
|
105
|
+
stream.sphere();
|
|
106
|
+
},
|
|
107
|
+
Point: function(object, stream) {
|
|
108
|
+
object = object.coordinates;
|
|
109
|
+
stream.point(object[0], object[1], object[2]);
|
|
110
|
+
},
|
|
111
|
+
MultiPoint: function(object, stream) {
|
|
112
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
113
|
+
while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);
|
|
114
|
+
},
|
|
115
|
+
LineString: function(object, stream) {
|
|
116
|
+
streamLine(object.coordinates, stream, 0);
|
|
117
|
+
},
|
|
118
|
+
MultiLineString: function(object, stream) {
|
|
119
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
120
|
+
while (++i < n) streamLine(coordinates[i], stream, 0);
|
|
121
|
+
},
|
|
122
|
+
Polygon: function(object, stream) {
|
|
123
|
+
streamPolygon(object.coordinates, stream);
|
|
124
|
+
},
|
|
125
|
+
MultiPolygon: function(object, stream) {
|
|
126
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
127
|
+
while (++i < n) streamPolygon(coordinates[i], stream);
|
|
128
|
+
},
|
|
129
|
+
GeometryCollection: function(object, stream) {
|
|
130
|
+
var geometries = object.geometries, i = -1, n = geometries.length;
|
|
131
|
+
while (++i < n) streamGeometry(geometries[i], stream);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
function streamLine(coordinates, stream, closed) {
|
|
135
|
+
var i = -1, n = coordinates.length - closed, coordinate;
|
|
136
|
+
stream.lineStart();
|
|
137
|
+
while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);
|
|
138
|
+
stream.lineEnd();
|
|
139
|
+
}
|
|
140
|
+
function streamPolygon(coordinates, stream) {
|
|
141
|
+
var i = -1, n = coordinates.length;
|
|
142
|
+
stream.polygonStart();
|
|
143
|
+
while (++i < n) streamLine(coordinates[i], stream, 1);
|
|
144
|
+
stream.polygonEnd();
|
|
145
|
+
}
|
|
146
|
+
function stream_default(object, stream) {
|
|
147
|
+
if (object && streamObjectType.hasOwnProperty(object.type)) {
|
|
148
|
+
streamObjectType[object.type](object, stream);
|
|
149
|
+
} else {
|
|
150
|
+
streamGeometry(object, stream);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/cartesian.js
|
|
155
|
+
function spherical(cartesian2) {
|
|
156
|
+
return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
|
|
157
|
+
}
|
|
158
|
+
function cartesian(spherical2) {
|
|
159
|
+
var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
|
|
160
|
+
return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
|
|
161
|
+
}
|
|
162
|
+
function cartesianDot(a, b) {
|
|
163
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
164
|
+
}
|
|
165
|
+
function cartesianCross(a, b) {
|
|
166
|
+
return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
167
|
+
}
|
|
168
|
+
function cartesianAddInPlace(a, b) {
|
|
169
|
+
a[0] += b[0], a[1] += b[1], a[2] += b[2];
|
|
170
|
+
}
|
|
171
|
+
function cartesianScale(vector, k) {
|
|
172
|
+
return [vector[0] * k, vector[1] * k, vector[2] * k];
|
|
173
|
+
}
|
|
174
|
+
function cartesianNormalizeInPlace(d) {
|
|
175
|
+
var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
|
|
176
|
+
d[0] /= l, d[1] /= l, d[2] /= l;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/compose.js
|
|
180
|
+
function compose_default(a, b) {
|
|
181
|
+
function compose(x, y) {
|
|
182
|
+
return x = a(x, y), b(x[0], x[1]);
|
|
183
|
+
}
|
|
184
|
+
if (a.invert && b.invert) compose.invert = function(x, y) {
|
|
185
|
+
return x = b.invert(x, y), x && a.invert(x[0], x[1]);
|
|
186
|
+
};
|
|
187
|
+
return compose;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/rotation.js
|
|
191
|
+
function rotationIdentity(lambda, phi) {
|
|
192
|
+
if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
|
|
193
|
+
return [lambda, phi];
|
|
194
|
+
}
|
|
195
|
+
rotationIdentity.invert = rotationIdentity;
|
|
196
|
+
function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
|
|
197
|
+
return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
|
|
198
|
+
}
|
|
199
|
+
function forwardRotationLambda(deltaLambda) {
|
|
200
|
+
return function(lambda, phi) {
|
|
201
|
+
lambda += deltaLambda;
|
|
202
|
+
if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
|
|
203
|
+
return [lambda, phi];
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function rotationLambda(deltaLambda) {
|
|
207
|
+
var rotation = forwardRotationLambda(deltaLambda);
|
|
208
|
+
rotation.invert = forwardRotationLambda(-deltaLambda);
|
|
209
|
+
return rotation;
|
|
210
|
+
}
|
|
211
|
+
function rotationPhiGamma(deltaPhi, deltaGamma) {
|
|
212
|
+
var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
|
|
213
|
+
function rotation(lambda, phi) {
|
|
214
|
+
var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
|
|
215
|
+
return [
|
|
216
|
+
atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
|
|
217
|
+
asin(k * cosDeltaGamma + y * sinDeltaGamma)
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
rotation.invert = function(lambda, phi) {
|
|
221
|
+
var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
|
|
222
|
+
return [
|
|
223
|
+
atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
|
|
224
|
+
asin(k * cosDeltaPhi - x * sinDeltaPhi)
|
|
225
|
+
];
|
|
226
|
+
};
|
|
227
|
+
return rotation;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/circle.js
|
|
231
|
+
function circleStream(stream, radius, delta, direction, t0, t1) {
|
|
232
|
+
if (!delta) return;
|
|
233
|
+
var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
|
|
234
|
+
if (t0 == null) {
|
|
235
|
+
t0 = radius + direction * tau;
|
|
236
|
+
t1 = radius - step / 2;
|
|
237
|
+
} else {
|
|
238
|
+
t0 = circleRadius(cosRadius, t0);
|
|
239
|
+
t1 = circleRadius(cosRadius, t1);
|
|
240
|
+
if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;
|
|
241
|
+
}
|
|
242
|
+
for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
|
|
243
|
+
point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
|
|
244
|
+
stream.point(point[0], point[1]);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function circleRadius(cosRadius, point) {
|
|
248
|
+
point = cartesian(point), point[0] -= cosRadius;
|
|
249
|
+
cartesianNormalizeInPlace(point);
|
|
250
|
+
var radius = acos(-point[1]);
|
|
251
|
+
return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/buffer.js
|
|
255
|
+
function buffer_default() {
|
|
256
|
+
var lines = [], line;
|
|
257
|
+
return {
|
|
258
|
+
point: function(x, y, m) {
|
|
259
|
+
line.push([x, y, m]);
|
|
260
|
+
},
|
|
261
|
+
lineStart: function() {
|
|
262
|
+
lines.push(line = []);
|
|
263
|
+
},
|
|
264
|
+
lineEnd: noop,
|
|
265
|
+
rejoin: function() {
|
|
266
|
+
if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
|
|
267
|
+
},
|
|
268
|
+
result: function() {
|
|
269
|
+
var result = lines;
|
|
270
|
+
lines = [];
|
|
271
|
+
line = null;
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/pointEqual.js
|
|
278
|
+
function pointEqual_default(a, b) {
|
|
279
|
+
return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/rejoin.js
|
|
283
|
+
function Intersection(point, points, other, entry) {
|
|
284
|
+
this.x = point;
|
|
285
|
+
this.z = points;
|
|
286
|
+
this.o = other;
|
|
287
|
+
this.e = entry;
|
|
288
|
+
this.v = false;
|
|
289
|
+
this.n = this.p = null;
|
|
290
|
+
}
|
|
291
|
+
function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
|
|
292
|
+
var subject = [], clip = [], i, n;
|
|
293
|
+
segments.forEach(function(segment) {
|
|
294
|
+
if ((n2 = segment.length - 1) <= 0) return;
|
|
295
|
+
var n2, p0 = segment[0], p1 = segment[n2], x;
|
|
296
|
+
if (pointEqual_default(p0, p1)) {
|
|
297
|
+
if (!p0[2] && !p1[2]) {
|
|
298
|
+
stream.lineStart();
|
|
299
|
+
for (i = 0; i < n2; ++i) stream.point((p0 = segment[i])[0], p0[1]);
|
|
300
|
+
stream.lineEnd();
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
p1[0] += 2 * epsilon;
|
|
304
|
+
}
|
|
305
|
+
subject.push(x = new Intersection(p0, segment, null, true));
|
|
306
|
+
clip.push(x.o = new Intersection(p0, null, x, false));
|
|
307
|
+
subject.push(x = new Intersection(p1, segment, null, false));
|
|
308
|
+
clip.push(x.o = new Intersection(p1, null, x, true));
|
|
309
|
+
});
|
|
310
|
+
if (!subject.length) return;
|
|
311
|
+
clip.sort(compareIntersection2);
|
|
312
|
+
link(subject);
|
|
313
|
+
link(clip);
|
|
314
|
+
for (i = 0, n = clip.length; i < n; ++i) {
|
|
315
|
+
clip[i].e = startInside = !startInside;
|
|
316
|
+
}
|
|
317
|
+
var start = subject[0], points, point;
|
|
318
|
+
while (1) {
|
|
319
|
+
var current = start, isSubject = true;
|
|
320
|
+
while (current.v) if ((current = current.n) === start) return;
|
|
321
|
+
points = current.z;
|
|
322
|
+
stream.lineStart();
|
|
323
|
+
do {
|
|
324
|
+
current.v = current.o.v = true;
|
|
325
|
+
if (current.e) {
|
|
326
|
+
if (isSubject) {
|
|
327
|
+
for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);
|
|
328
|
+
} else {
|
|
329
|
+
interpolate(current.x, current.n.x, 1, stream);
|
|
330
|
+
}
|
|
331
|
+
current = current.n;
|
|
332
|
+
} else {
|
|
333
|
+
if (isSubject) {
|
|
334
|
+
points = current.p.z;
|
|
335
|
+
for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);
|
|
336
|
+
} else {
|
|
337
|
+
interpolate(current.x, current.p.x, -1, stream);
|
|
338
|
+
}
|
|
339
|
+
current = current.p;
|
|
340
|
+
}
|
|
341
|
+
current = current.o;
|
|
342
|
+
points = current.z;
|
|
343
|
+
isSubject = !isSubject;
|
|
344
|
+
} while (!current.v);
|
|
345
|
+
stream.lineEnd();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function link(array) {
|
|
349
|
+
if (!(n = array.length)) return;
|
|
350
|
+
var n, i = 0, a = array[0], b;
|
|
351
|
+
while (++i < n) {
|
|
352
|
+
a.n = b = array[i];
|
|
353
|
+
b.p = a;
|
|
354
|
+
a = b;
|
|
355
|
+
}
|
|
356
|
+
a.n = b = array[0];
|
|
357
|
+
b.p = a;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/polygonContains.js
|
|
361
|
+
function longitude(point) {
|
|
362
|
+
return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
|
|
363
|
+
}
|
|
364
|
+
function polygonContains_default(polygon, point) {
|
|
365
|
+
var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle = 0, winding = 0;
|
|
366
|
+
var sum = new Adder();
|
|
367
|
+
if (sinPhi === 1) phi = halfPi + epsilon;
|
|
368
|
+
else if (sinPhi === -1) phi = -halfPi - epsilon;
|
|
369
|
+
for (var i = 0, n = polygon.length; i < n; ++i) {
|
|
370
|
+
if (!(m = (ring = polygon[i]).length)) continue;
|
|
371
|
+
var ring, m, point0 = ring[m - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + quarterPi, sinPhi0 = sin(phi0), cosPhi0 = cos(phi0);
|
|
372
|
+
for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
|
|
373
|
+
var point1 = ring[j], lambda1 = longitude(point1), phi1 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi1), cosPhi1 = cos(phi1), delta = lambda1 - lambda0, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k = sinPhi0 * sinPhi1;
|
|
374
|
+
sum.add(atan2(k * sign2 * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));
|
|
375
|
+
angle += antimeridian ? delta + sign2 * tau : delta;
|
|
376
|
+
if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
|
|
377
|
+
var arc = cartesianCross(cartesian(point0), cartesian(point1));
|
|
378
|
+
cartesianNormalizeInPlace(arc);
|
|
379
|
+
var intersection = cartesianCross(normal, arc);
|
|
380
|
+
cartesianNormalizeInPlace(intersection);
|
|
381
|
+
var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
|
|
382
|
+
if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
|
|
383
|
+
winding += antimeridian ^ delta >= 0 ? 1 : -1;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return (angle < -epsilon || angle < epsilon && sum < -1e-12) ^ winding & 1;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/index.js
|
|
392
|
+
function clip_default(pointVisible, clipLine, interpolate, start) {
|
|
393
|
+
return function(sink) {
|
|
394
|
+
var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon, segments, ring;
|
|
395
|
+
var clip = {
|
|
396
|
+
point,
|
|
397
|
+
lineStart,
|
|
398
|
+
lineEnd,
|
|
399
|
+
polygonStart: function() {
|
|
400
|
+
clip.point = pointRing;
|
|
401
|
+
clip.lineStart = ringStart;
|
|
402
|
+
clip.lineEnd = ringEnd;
|
|
403
|
+
segments = [];
|
|
404
|
+
polygon = [];
|
|
405
|
+
},
|
|
406
|
+
polygonEnd: function() {
|
|
407
|
+
clip.point = point;
|
|
408
|
+
clip.lineStart = lineStart;
|
|
409
|
+
clip.lineEnd = lineEnd;
|
|
410
|
+
segments = merge(segments);
|
|
411
|
+
var startInside = polygonContains_default(polygon, start);
|
|
412
|
+
if (segments.length) {
|
|
413
|
+
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
414
|
+
rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
|
|
415
|
+
} else if (startInside) {
|
|
416
|
+
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
417
|
+
sink.lineStart();
|
|
418
|
+
interpolate(null, null, 1, sink);
|
|
419
|
+
sink.lineEnd();
|
|
420
|
+
}
|
|
421
|
+
if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
|
|
422
|
+
segments = polygon = null;
|
|
423
|
+
},
|
|
424
|
+
sphere: function() {
|
|
425
|
+
sink.polygonStart();
|
|
426
|
+
sink.lineStart();
|
|
427
|
+
interpolate(null, null, 1, sink);
|
|
428
|
+
sink.lineEnd();
|
|
429
|
+
sink.polygonEnd();
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
function point(lambda, phi) {
|
|
433
|
+
if (pointVisible(lambda, phi)) sink.point(lambda, phi);
|
|
434
|
+
}
|
|
435
|
+
function pointLine(lambda, phi) {
|
|
436
|
+
line.point(lambda, phi);
|
|
437
|
+
}
|
|
438
|
+
function lineStart() {
|
|
439
|
+
clip.point = pointLine;
|
|
440
|
+
line.lineStart();
|
|
441
|
+
}
|
|
442
|
+
function lineEnd() {
|
|
443
|
+
clip.point = point;
|
|
444
|
+
line.lineEnd();
|
|
445
|
+
}
|
|
446
|
+
function pointRing(lambda, phi) {
|
|
447
|
+
ring.push([lambda, phi]);
|
|
448
|
+
ringSink.point(lambda, phi);
|
|
449
|
+
}
|
|
450
|
+
function ringStart() {
|
|
451
|
+
ringSink.lineStart();
|
|
452
|
+
ring = [];
|
|
453
|
+
}
|
|
454
|
+
function ringEnd() {
|
|
455
|
+
pointRing(ring[0][0], ring[0][1]);
|
|
456
|
+
ringSink.lineEnd();
|
|
457
|
+
var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point2;
|
|
458
|
+
ring.pop();
|
|
459
|
+
polygon.push(ring);
|
|
460
|
+
ring = null;
|
|
461
|
+
if (!n) return;
|
|
462
|
+
if (clean & 1) {
|
|
463
|
+
segment = ringSegments[0];
|
|
464
|
+
if ((m = segment.length - 1) > 0) {
|
|
465
|
+
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
|
|
466
|
+
sink.lineStart();
|
|
467
|
+
for (i = 0; i < m; ++i) sink.point((point2 = segment[i])[0], point2[1]);
|
|
468
|
+
sink.lineEnd();
|
|
469
|
+
}
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
|
|
473
|
+
segments.push(ringSegments.filter(validSegment));
|
|
474
|
+
}
|
|
475
|
+
return clip;
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function validSegment(segment) {
|
|
479
|
+
return segment.length > 1;
|
|
480
|
+
}
|
|
481
|
+
function compareIntersection(a, b) {
|
|
482
|
+
return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/antimeridian.js
|
|
486
|
+
var antimeridian_default = clip_default(
|
|
487
|
+
function() {
|
|
488
|
+
return true;
|
|
489
|
+
},
|
|
490
|
+
clipAntimeridianLine,
|
|
491
|
+
clipAntimeridianInterpolate,
|
|
492
|
+
[-pi, -halfPi]
|
|
493
|
+
);
|
|
494
|
+
function clipAntimeridianLine(stream) {
|
|
495
|
+
var lambda0 = NaN, phi0 = NaN, sign0 = NaN, clean;
|
|
496
|
+
return {
|
|
497
|
+
lineStart: function() {
|
|
498
|
+
stream.lineStart();
|
|
499
|
+
clean = 1;
|
|
500
|
+
},
|
|
501
|
+
point: function(lambda1, phi1) {
|
|
502
|
+
var sign1 = lambda1 > 0 ? pi : -pi, delta = abs(lambda1 - lambda0);
|
|
503
|
+
if (abs(delta - pi) < epsilon) {
|
|
504
|
+
stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);
|
|
505
|
+
stream.point(sign0, phi0);
|
|
506
|
+
stream.lineEnd();
|
|
507
|
+
stream.lineStart();
|
|
508
|
+
stream.point(sign1, phi0);
|
|
509
|
+
stream.point(lambda1, phi0);
|
|
510
|
+
clean = 0;
|
|
511
|
+
} else if (sign0 !== sign1 && delta >= pi) {
|
|
512
|
+
if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon;
|
|
513
|
+
if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon;
|
|
514
|
+
phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
|
|
515
|
+
stream.point(sign0, phi0);
|
|
516
|
+
stream.lineEnd();
|
|
517
|
+
stream.lineStart();
|
|
518
|
+
stream.point(sign1, phi0);
|
|
519
|
+
clean = 0;
|
|
520
|
+
}
|
|
521
|
+
stream.point(lambda0 = lambda1, phi0 = phi1);
|
|
522
|
+
sign0 = sign1;
|
|
523
|
+
},
|
|
524
|
+
lineEnd: function() {
|
|
525
|
+
stream.lineEnd();
|
|
526
|
+
lambda0 = phi0 = NaN;
|
|
527
|
+
},
|
|
528
|
+
clean: function() {
|
|
529
|
+
return 2 - clean;
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
|
|
534
|
+
var cosPhi0, cosPhi1, sinLambda0Lambda1 = sin(lambda0 - lambda1);
|
|
535
|
+
return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;
|
|
536
|
+
}
|
|
537
|
+
function clipAntimeridianInterpolate(from, to, direction, stream) {
|
|
538
|
+
var phi;
|
|
539
|
+
if (from == null) {
|
|
540
|
+
phi = direction * halfPi;
|
|
541
|
+
stream.point(-pi, phi);
|
|
542
|
+
stream.point(0, phi);
|
|
543
|
+
stream.point(pi, phi);
|
|
544
|
+
stream.point(pi, 0);
|
|
545
|
+
stream.point(pi, -phi);
|
|
546
|
+
stream.point(0, -phi);
|
|
547
|
+
stream.point(-pi, -phi);
|
|
548
|
+
stream.point(-pi, 0);
|
|
549
|
+
stream.point(-pi, phi);
|
|
550
|
+
} else if (abs(from[0] - to[0]) > epsilon) {
|
|
551
|
+
var lambda = from[0] < to[0] ? pi : -pi;
|
|
552
|
+
phi = direction * lambda / 2;
|
|
553
|
+
stream.point(-lambda, phi);
|
|
554
|
+
stream.point(0, phi);
|
|
555
|
+
stream.point(lambda, phi);
|
|
556
|
+
} else {
|
|
557
|
+
stream.point(to[0], to[1]);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/circle.js
|
|
562
|
+
function circle_default(radius) {
|
|
563
|
+
var cr = cos(radius), delta = 2 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
|
|
564
|
+
function interpolate(from, to, direction, stream) {
|
|
565
|
+
circleStream(stream, radius, delta, direction, from, to);
|
|
566
|
+
}
|
|
567
|
+
function visible(lambda, phi) {
|
|
568
|
+
return cos(lambda) * cos(phi) > cr;
|
|
569
|
+
}
|
|
570
|
+
function clipLine(stream) {
|
|
571
|
+
var point0, c0, v0, v00, clean;
|
|
572
|
+
return {
|
|
573
|
+
lineStart: function() {
|
|
574
|
+
v00 = v0 = false;
|
|
575
|
+
clean = 1;
|
|
576
|
+
},
|
|
577
|
+
point: function(lambda, phi) {
|
|
578
|
+
var point1 = [lambda, phi], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
|
|
579
|
+
if (!point0 && (v00 = v0 = v)) stream.lineStart();
|
|
580
|
+
if (v !== v0) {
|
|
581
|
+
point2 = intersect(point0, point1);
|
|
582
|
+
if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
|
|
583
|
+
point1[2] = 1;
|
|
584
|
+
}
|
|
585
|
+
if (v !== v0) {
|
|
586
|
+
clean = 0;
|
|
587
|
+
if (v) {
|
|
588
|
+
stream.lineStart();
|
|
589
|
+
point2 = intersect(point1, point0);
|
|
590
|
+
stream.point(point2[0], point2[1]);
|
|
591
|
+
} else {
|
|
592
|
+
point2 = intersect(point0, point1);
|
|
593
|
+
stream.point(point2[0], point2[1], 2);
|
|
594
|
+
stream.lineEnd();
|
|
595
|
+
}
|
|
596
|
+
point0 = point2;
|
|
597
|
+
} else if (notHemisphere && point0 && smallRadius ^ v) {
|
|
598
|
+
var t;
|
|
599
|
+
if (!(c & c0) && (t = intersect(point1, point0, true))) {
|
|
600
|
+
clean = 0;
|
|
601
|
+
if (smallRadius) {
|
|
602
|
+
stream.lineStart();
|
|
603
|
+
stream.point(t[0][0], t[0][1]);
|
|
604
|
+
stream.point(t[1][0], t[1][1]);
|
|
605
|
+
stream.lineEnd();
|
|
606
|
+
} else {
|
|
607
|
+
stream.point(t[1][0], t[1][1]);
|
|
608
|
+
stream.lineEnd();
|
|
609
|
+
stream.lineStart();
|
|
610
|
+
stream.point(t[0][0], t[0][1], 3);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (v && (!point0 || !pointEqual_default(point0, point1))) {
|
|
615
|
+
stream.point(point1[0], point1[1]);
|
|
616
|
+
}
|
|
617
|
+
point0 = point1, v0 = v, c0 = c;
|
|
618
|
+
},
|
|
619
|
+
lineEnd: function() {
|
|
620
|
+
if (v0) stream.lineEnd();
|
|
621
|
+
point0 = null;
|
|
622
|
+
},
|
|
623
|
+
// Rejoin first and last segments if there were intersections and the first
|
|
624
|
+
// and last points were visible.
|
|
625
|
+
clean: function() {
|
|
626
|
+
return clean | (v00 && v0) << 1;
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
function intersect(a, b, two) {
|
|
631
|
+
var pa = cartesian(a), pb = cartesian(b);
|
|
632
|
+
var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
|
|
633
|
+
if (!determinant) return !two && a;
|
|
634
|
+
var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1), B = cartesianScale(n2, c2);
|
|
635
|
+
cartesianAddInPlace(A, B);
|
|
636
|
+
var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1);
|
|
637
|
+
if (t2 < 0) return;
|
|
638
|
+
var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu);
|
|
639
|
+
cartesianAddInPlace(q, A);
|
|
640
|
+
q = spherical(q);
|
|
641
|
+
if (!two) return q;
|
|
642
|
+
var lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1], z;
|
|
643
|
+
if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;
|
|
644
|
+
var delta2 = lambda1 - lambda0, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
|
|
645
|
+
if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;
|
|
646
|
+
if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta2 > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
|
|
647
|
+
var q1 = cartesianScale(u, (-w + t) / uu);
|
|
648
|
+
cartesianAddInPlace(q1, A);
|
|
649
|
+
return [q, spherical(q1)];
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function code(lambda, phi) {
|
|
653
|
+
var r = smallRadius ? radius : pi - radius, code2 = 0;
|
|
654
|
+
if (lambda < -r) code2 |= 1;
|
|
655
|
+
else if (lambda > r) code2 |= 2;
|
|
656
|
+
if (phi < -r) code2 |= 4;
|
|
657
|
+
else if (phi > r) code2 |= 8;
|
|
658
|
+
return code2;
|
|
659
|
+
}
|
|
660
|
+
return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/line.js
|
|
664
|
+
function line_default(a, b, x05, y05, x12, y12) {
|
|
665
|
+
var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
|
|
666
|
+
r = x05 - ax;
|
|
667
|
+
if (!dx && r > 0) return;
|
|
668
|
+
r /= dx;
|
|
669
|
+
if (dx < 0) {
|
|
670
|
+
if (r < t0) return;
|
|
671
|
+
if (r < t1) t1 = r;
|
|
672
|
+
} else if (dx > 0) {
|
|
673
|
+
if (r > t1) return;
|
|
674
|
+
if (r > t0) t0 = r;
|
|
675
|
+
}
|
|
676
|
+
r = x12 - ax;
|
|
677
|
+
if (!dx && r < 0) return;
|
|
678
|
+
r /= dx;
|
|
679
|
+
if (dx < 0) {
|
|
680
|
+
if (r > t1) return;
|
|
681
|
+
if (r > t0) t0 = r;
|
|
682
|
+
} else if (dx > 0) {
|
|
683
|
+
if (r < t0) return;
|
|
684
|
+
if (r < t1) t1 = r;
|
|
685
|
+
}
|
|
686
|
+
r = y05 - ay;
|
|
687
|
+
if (!dy && r > 0) return;
|
|
688
|
+
r /= dy;
|
|
689
|
+
if (dy < 0) {
|
|
690
|
+
if (r < t0) return;
|
|
691
|
+
if (r < t1) t1 = r;
|
|
692
|
+
} else if (dy > 0) {
|
|
693
|
+
if (r > t1) return;
|
|
694
|
+
if (r > t0) t0 = r;
|
|
695
|
+
}
|
|
696
|
+
r = y12 - ay;
|
|
697
|
+
if (!dy && r < 0) return;
|
|
698
|
+
r /= dy;
|
|
699
|
+
if (dy < 0) {
|
|
700
|
+
if (r > t1) return;
|
|
701
|
+
if (r > t0) t0 = r;
|
|
702
|
+
} else if (dy > 0) {
|
|
703
|
+
if (r < t0) return;
|
|
704
|
+
if (r < t1) t1 = r;
|
|
705
|
+
}
|
|
706
|
+
if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
|
|
707
|
+
if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
|
|
708
|
+
return true;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/clip/rectangle.js
|
|
712
|
+
var clipMax = 1e9;
|
|
713
|
+
var clipMin = -clipMax;
|
|
714
|
+
function clipRectangle(x05, y05, x12, y12) {
|
|
715
|
+
function visible(x, y) {
|
|
716
|
+
return x05 <= x && x <= x12 && y05 <= y && y <= y12;
|
|
717
|
+
}
|
|
718
|
+
function interpolate(from, to, direction, stream) {
|
|
719
|
+
var a = 0, a1 = 0;
|
|
720
|
+
if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
|
|
721
|
+
do
|
|
722
|
+
stream.point(a === 0 || a === 3 ? x05 : x12, a > 1 ? y12 : y05);
|
|
723
|
+
while ((a = (a + direction + 4) % 4) !== a1);
|
|
724
|
+
} else {
|
|
725
|
+
stream.point(to[0], to[1]);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
function corner(p, direction) {
|
|
729
|
+
return abs(p[0] - x05) < epsilon ? direction > 0 ? 0 : 3 : abs(p[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p[1] - y05) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
|
|
730
|
+
}
|
|
731
|
+
function compareIntersection2(a, b) {
|
|
732
|
+
return comparePoint(a.x, b.x);
|
|
733
|
+
}
|
|
734
|
+
function comparePoint(a, b) {
|
|
735
|
+
var ca = corner(a, 1), cb = corner(b, 1);
|
|
736
|
+
return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
|
|
737
|
+
}
|
|
738
|
+
return function(stream) {
|
|
739
|
+
var activeStream = stream, bufferStream = buffer_default(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean;
|
|
740
|
+
var clipStream = {
|
|
741
|
+
point,
|
|
742
|
+
lineStart,
|
|
743
|
+
lineEnd,
|
|
744
|
+
polygonStart,
|
|
745
|
+
polygonEnd
|
|
746
|
+
};
|
|
747
|
+
function point(x, y) {
|
|
748
|
+
if (visible(x, y)) activeStream.point(x, y);
|
|
749
|
+
}
|
|
750
|
+
function polygonInside() {
|
|
751
|
+
var winding = 0;
|
|
752
|
+
for (var i = 0, n = polygon.length; i < n; ++i) {
|
|
753
|
+
for (var ring2 = polygon[i], j = 1, m = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j < m; ++j) {
|
|
754
|
+
a0 = b0, a1 = b1, point2 = ring2[j], b0 = point2[0], b1 = point2[1];
|
|
755
|
+
if (a1 <= y12) {
|
|
756
|
+
if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0)) ++winding;
|
|
757
|
+
} else {
|
|
758
|
+
if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0)) --winding;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return winding;
|
|
763
|
+
}
|
|
764
|
+
function polygonStart() {
|
|
765
|
+
activeStream = bufferStream, segments = [], polygon = [], clean = true;
|
|
766
|
+
}
|
|
767
|
+
function polygonEnd() {
|
|
768
|
+
var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments = merge(segments)).length;
|
|
769
|
+
if (cleanInside || visible2) {
|
|
770
|
+
stream.polygonStart();
|
|
771
|
+
if (cleanInside) {
|
|
772
|
+
stream.lineStart();
|
|
773
|
+
interpolate(null, null, 1, stream);
|
|
774
|
+
stream.lineEnd();
|
|
775
|
+
}
|
|
776
|
+
if (visible2) {
|
|
777
|
+
rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
|
|
778
|
+
}
|
|
779
|
+
stream.polygonEnd();
|
|
780
|
+
}
|
|
781
|
+
activeStream = stream, segments = polygon = ring = null;
|
|
782
|
+
}
|
|
783
|
+
function lineStart() {
|
|
784
|
+
clipStream.point = linePoint;
|
|
785
|
+
if (polygon) polygon.push(ring = []);
|
|
786
|
+
first = true;
|
|
787
|
+
v_ = false;
|
|
788
|
+
x_ = y_ = NaN;
|
|
789
|
+
}
|
|
790
|
+
function lineEnd() {
|
|
791
|
+
if (segments) {
|
|
792
|
+
linePoint(x__, y__);
|
|
793
|
+
if (v__ && v_) bufferStream.rejoin();
|
|
794
|
+
segments.push(bufferStream.result());
|
|
795
|
+
}
|
|
796
|
+
clipStream.point = point;
|
|
797
|
+
if (v_) activeStream.lineEnd();
|
|
798
|
+
}
|
|
799
|
+
function linePoint(x, y) {
|
|
800
|
+
var v = visible(x, y);
|
|
801
|
+
if (polygon) ring.push([x, y]);
|
|
802
|
+
if (first) {
|
|
803
|
+
x__ = x, y__ = y, v__ = v;
|
|
804
|
+
first = false;
|
|
805
|
+
if (v) {
|
|
806
|
+
activeStream.lineStart();
|
|
807
|
+
activeStream.point(x, y);
|
|
808
|
+
}
|
|
809
|
+
} else {
|
|
810
|
+
if (v && v_) activeStream.point(x, y);
|
|
811
|
+
else {
|
|
812
|
+
var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];
|
|
813
|
+
if (line_default(a, b, x05, y05, x12, y12)) {
|
|
814
|
+
if (!v_) {
|
|
815
|
+
activeStream.lineStart();
|
|
816
|
+
activeStream.point(a[0], a[1]);
|
|
817
|
+
}
|
|
818
|
+
activeStream.point(b[0], b[1]);
|
|
819
|
+
if (!v) activeStream.lineEnd();
|
|
820
|
+
clean = false;
|
|
821
|
+
} else if (v) {
|
|
822
|
+
activeStream.lineStart();
|
|
823
|
+
activeStream.point(x, y);
|
|
824
|
+
clean = false;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
x_ = x, y_ = y, v_ = v;
|
|
829
|
+
}
|
|
830
|
+
return clipStream;
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/identity.js
|
|
835
|
+
var identity_default = (x) => x;
|
|
836
|
+
|
|
837
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/area.js
|
|
838
|
+
var areaSum = new Adder();
|
|
839
|
+
var areaRingSum = new Adder();
|
|
840
|
+
var x00;
|
|
841
|
+
var y00;
|
|
842
|
+
var x0;
|
|
843
|
+
var y0;
|
|
844
|
+
var areaStream = {
|
|
845
|
+
point: noop,
|
|
846
|
+
lineStart: noop,
|
|
847
|
+
lineEnd: noop,
|
|
848
|
+
polygonStart: function() {
|
|
849
|
+
areaStream.lineStart = areaRingStart;
|
|
850
|
+
areaStream.lineEnd = areaRingEnd;
|
|
851
|
+
},
|
|
852
|
+
polygonEnd: function() {
|
|
853
|
+
areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;
|
|
854
|
+
areaSum.add(abs(areaRingSum));
|
|
855
|
+
areaRingSum = new Adder();
|
|
856
|
+
},
|
|
857
|
+
result: function() {
|
|
858
|
+
var area = areaSum / 2;
|
|
859
|
+
areaSum = new Adder();
|
|
860
|
+
return area;
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
function areaRingStart() {
|
|
864
|
+
areaStream.point = areaPointFirst;
|
|
865
|
+
}
|
|
866
|
+
function areaPointFirst(x, y) {
|
|
867
|
+
areaStream.point = areaPoint;
|
|
868
|
+
x00 = x0 = x, y00 = y0 = y;
|
|
869
|
+
}
|
|
870
|
+
function areaPoint(x, y) {
|
|
871
|
+
areaRingSum.add(y0 * x - x0 * y);
|
|
872
|
+
x0 = x, y0 = y;
|
|
873
|
+
}
|
|
874
|
+
function areaRingEnd() {
|
|
875
|
+
areaPoint(x00, y00);
|
|
876
|
+
}
|
|
877
|
+
var area_default = areaStream;
|
|
878
|
+
|
|
879
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/bounds.js
|
|
880
|
+
var x02 = Infinity;
|
|
881
|
+
var y02 = x02;
|
|
882
|
+
var x1 = -x02;
|
|
883
|
+
var y1 = x1;
|
|
884
|
+
var boundsStream = {
|
|
885
|
+
point: boundsPoint,
|
|
886
|
+
lineStart: noop,
|
|
887
|
+
lineEnd: noop,
|
|
888
|
+
polygonStart: noop,
|
|
889
|
+
polygonEnd: noop,
|
|
890
|
+
result: function() {
|
|
891
|
+
var bounds = [[x02, y02], [x1, y1]];
|
|
892
|
+
x1 = y1 = -(y02 = x02 = Infinity);
|
|
893
|
+
return bounds;
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
function boundsPoint(x, y) {
|
|
897
|
+
if (x < x02) x02 = x;
|
|
898
|
+
if (x > x1) x1 = x;
|
|
899
|
+
if (y < y02) y02 = y;
|
|
900
|
+
if (y > y1) y1 = y;
|
|
901
|
+
}
|
|
902
|
+
var bounds_default = boundsStream;
|
|
903
|
+
|
|
904
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/centroid.js
|
|
905
|
+
var X0 = 0;
|
|
906
|
+
var Y0 = 0;
|
|
907
|
+
var Z0 = 0;
|
|
908
|
+
var X1 = 0;
|
|
909
|
+
var Y1 = 0;
|
|
910
|
+
var Z1 = 0;
|
|
911
|
+
var X2 = 0;
|
|
912
|
+
var Y2 = 0;
|
|
913
|
+
var Z2 = 0;
|
|
914
|
+
var x002;
|
|
915
|
+
var y002;
|
|
916
|
+
var x03;
|
|
917
|
+
var y03;
|
|
918
|
+
var centroidStream = {
|
|
919
|
+
point: centroidPoint,
|
|
920
|
+
lineStart: centroidLineStart,
|
|
921
|
+
lineEnd: centroidLineEnd,
|
|
922
|
+
polygonStart: function() {
|
|
923
|
+
centroidStream.lineStart = centroidRingStart;
|
|
924
|
+
centroidStream.lineEnd = centroidRingEnd;
|
|
925
|
+
},
|
|
926
|
+
polygonEnd: function() {
|
|
927
|
+
centroidStream.point = centroidPoint;
|
|
928
|
+
centroidStream.lineStart = centroidLineStart;
|
|
929
|
+
centroidStream.lineEnd = centroidLineEnd;
|
|
930
|
+
},
|
|
931
|
+
result: function() {
|
|
932
|
+
var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
|
|
933
|
+
X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
|
|
934
|
+
return centroid;
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
function centroidPoint(x, y) {
|
|
938
|
+
X0 += x;
|
|
939
|
+
Y0 += y;
|
|
940
|
+
++Z0;
|
|
941
|
+
}
|
|
942
|
+
function centroidLineStart() {
|
|
943
|
+
centroidStream.point = centroidPointFirstLine;
|
|
944
|
+
}
|
|
945
|
+
function centroidPointFirstLine(x, y) {
|
|
946
|
+
centroidStream.point = centroidPointLine;
|
|
947
|
+
centroidPoint(x03 = x, y03 = y);
|
|
948
|
+
}
|
|
949
|
+
function centroidPointLine(x, y) {
|
|
950
|
+
var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
|
|
951
|
+
X1 += z * (x03 + x) / 2;
|
|
952
|
+
Y1 += z * (y03 + y) / 2;
|
|
953
|
+
Z1 += z;
|
|
954
|
+
centroidPoint(x03 = x, y03 = y);
|
|
955
|
+
}
|
|
956
|
+
function centroidLineEnd() {
|
|
957
|
+
centroidStream.point = centroidPoint;
|
|
958
|
+
}
|
|
959
|
+
function centroidRingStart() {
|
|
960
|
+
centroidStream.point = centroidPointFirstRing;
|
|
961
|
+
}
|
|
962
|
+
function centroidRingEnd() {
|
|
963
|
+
centroidPointRing(x002, y002);
|
|
964
|
+
}
|
|
965
|
+
function centroidPointFirstRing(x, y) {
|
|
966
|
+
centroidStream.point = centroidPointRing;
|
|
967
|
+
centroidPoint(x002 = x03 = x, y002 = y03 = y);
|
|
968
|
+
}
|
|
969
|
+
function centroidPointRing(x, y) {
|
|
970
|
+
var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
|
|
971
|
+
X1 += z * (x03 + x) / 2;
|
|
972
|
+
Y1 += z * (y03 + y) / 2;
|
|
973
|
+
Z1 += z;
|
|
974
|
+
z = y03 * x - x03 * y;
|
|
975
|
+
X2 += z * (x03 + x);
|
|
976
|
+
Y2 += z * (y03 + y);
|
|
977
|
+
Z2 += z * 3;
|
|
978
|
+
centroidPoint(x03 = x, y03 = y);
|
|
979
|
+
}
|
|
980
|
+
var centroid_default = centroidStream;
|
|
981
|
+
|
|
982
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/context.js
|
|
983
|
+
function PathContext(context) {
|
|
984
|
+
this._context = context;
|
|
985
|
+
}
|
|
986
|
+
PathContext.prototype = {
|
|
987
|
+
_radius: 4.5,
|
|
988
|
+
pointRadius: function(_) {
|
|
989
|
+
return this._radius = _, this;
|
|
990
|
+
},
|
|
991
|
+
polygonStart: function() {
|
|
992
|
+
this._line = 0;
|
|
993
|
+
},
|
|
994
|
+
polygonEnd: function() {
|
|
995
|
+
this._line = NaN;
|
|
996
|
+
},
|
|
997
|
+
lineStart: function() {
|
|
998
|
+
this._point = 0;
|
|
999
|
+
},
|
|
1000
|
+
lineEnd: function() {
|
|
1001
|
+
if (this._line === 0) this._context.closePath();
|
|
1002
|
+
this._point = NaN;
|
|
1003
|
+
},
|
|
1004
|
+
point: function(x, y) {
|
|
1005
|
+
switch (this._point) {
|
|
1006
|
+
case 0: {
|
|
1007
|
+
this._context.moveTo(x, y);
|
|
1008
|
+
this._point = 1;
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
case 1: {
|
|
1012
|
+
this._context.lineTo(x, y);
|
|
1013
|
+
break;
|
|
1014
|
+
}
|
|
1015
|
+
default: {
|
|
1016
|
+
this._context.moveTo(x + this._radius, y);
|
|
1017
|
+
this._context.arc(x, y, this._radius, 0, tau);
|
|
1018
|
+
break;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
result: noop
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/measure.js
|
|
1026
|
+
var lengthSum = new Adder();
|
|
1027
|
+
var lengthRing;
|
|
1028
|
+
var x003;
|
|
1029
|
+
var y003;
|
|
1030
|
+
var x04;
|
|
1031
|
+
var y04;
|
|
1032
|
+
var lengthStream = {
|
|
1033
|
+
point: noop,
|
|
1034
|
+
lineStart: function() {
|
|
1035
|
+
lengthStream.point = lengthPointFirst;
|
|
1036
|
+
},
|
|
1037
|
+
lineEnd: function() {
|
|
1038
|
+
if (lengthRing) lengthPoint(x003, y003);
|
|
1039
|
+
lengthStream.point = noop;
|
|
1040
|
+
},
|
|
1041
|
+
polygonStart: function() {
|
|
1042
|
+
lengthRing = true;
|
|
1043
|
+
},
|
|
1044
|
+
polygonEnd: function() {
|
|
1045
|
+
lengthRing = null;
|
|
1046
|
+
},
|
|
1047
|
+
result: function() {
|
|
1048
|
+
var length = +lengthSum;
|
|
1049
|
+
lengthSum = new Adder();
|
|
1050
|
+
return length;
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
function lengthPointFirst(x, y) {
|
|
1054
|
+
lengthStream.point = lengthPoint;
|
|
1055
|
+
x003 = x04 = x, y003 = y04 = y;
|
|
1056
|
+
}
|
|
1057
|
+
function lengthPoint(x, y) {
|
|
1058
|
+
x04 -= x, y04 -= y;
|
|
1059
|
+
lengthSum.add(sqrt(x04 * x04 + y04 * y04));
|
|
1060
|
+
x04 = x, y04 = y;
|
|
1061
|
+
}
|
|
1062
|
+
var measure_default = lengthStream;
|
|
1063
|
+
|
|
1064
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/string.js
|
|
1065
|
+
var cacheDigits;
|
|
1066
|
+
var cacheAppend;
|
|
1067
|
+
var cacheRadius;
|
|
1068
|
+
var cacheCircle;
|
|
1069
|
+
var PathString = class {
|
|
1070
|
+
constructor(digits) {
|
|
1071
|
+
this._append = digits == null ? append : appendRound(digits);
|
|
1072
|
+
this._radius = 4.5;
|
|
1073
|
+
this._ = "";
|
|
1074
|
+
}
|
|
1075
|
+
pointRadius(_) {
|
|
1076
|
+
this._radius = +_;
|
|
1077
|
+
return this;
|
|
1078
|
+
}
|
|
1079
|
+
polygonStart() {
|
|
1080
|
+
this._line = 0;
|
|
1081
|
+
}
|
|
1082
|
+
polygonEnd() {
|
|
1083
|
+
this._line = NaN;
|
|
1084
|
+
}
|
|
1085
|
+
lineStart() {
|
|
1086
|
+
this._point = 0;
|
|
1087
|
+
}
|
|
1088
|
+
lineEnd() {
|
|
1089
|
+
if (this._line === 0) this._ += "Z";
|
|
1090
|
+
this._point = NaN;
|
|
1091
|
+
}
|
|
1092
|
+
point(x, y) {
|
|
1093
|
+
switch (this._point) {
|
|
1094
|
+
case 0: {
|
|
1095
|
+
this._append`M${x},${y}`;
|
|
1096
|
+
this._point = 1;
|
|
1097
|
+
break;
|
|
1098
|
+
}
|
|
1099
|
+
case 1: {
|
|
1100
|
+
this._append`L${x},${y}`;
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
1103
|
+
default: {
|
|
1104
|
+
this._append`M${x},${y}`;
|
|
1105
|
+
if (this._radius !== cacheRadius || this._append !== cacheAppend) {
|
|
1106
|
+
const r = this._radius;
|
|
1107
|
+
const s = this._;
|
|
1108
|
+
this._ = "";
|
|
1109
|
+
this._append`m0,${r}a${r},${r} 0 1,1 0,${ -2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
|
|
1110
|
+
cacheRadius = r;
|
|
1111
|
+
cacheAppend = this._append;
|
|
1112
|
+
cacheCircle = this._;
|
|
1113
|
+
this._ = s;
|
|
1114
|
+
}
|
|
1115
|
+
this._ += cacheCircle;
|
|
1116
|
+
break;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
result() {
|
|
1121
|
+
const result = this._;
|
|
1122
|
+
this._ = "";
|
|
1123
|
+
return result.length ? result : null;
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
function append(strings) {
|
|
1127
|
+
let i = 1;
|
|
1128
|
+
this._ += strings[0];
|
|
1129
|
+
for (const j = strings.length; i < j; ++i) {
|
|
1130
|
+
this._ += arguments[i] + strings[i];
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
function appendRound(digits) {
|
|
1134
|
+
const d = Math.floor(digits);
|
|
1135
|
+
if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);
|
|
1136
|
+
if (d > 15) return append;
|
|
1137
|
+
if (d !== cacheDigits) {
|
|
1138
|
+
const k = 10 ** d;
|
|
1139
|
+
cacheDigits = d;
|
|
1140
|
+
cacheAppend = function append2(strings) {
|
|
1141
|
+
let i = 1;
|
|
1142
|
+
this._ += strings[0];
|
|
1143
|
+
for (const j = strings.length; i < j; ++i) {
|
|
1144
|
+
this._ += Math.round(arguments[i] * k) / k + strings[i];
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
return cacheAppend;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/path/index.js
|
|
1152
|
+
function path_default(projection2, context) {
|
|
1153
|
+
let digits = 3, pointRadius = 4.5, projectionStream, contextStream;
|
|
1154
|
+
function path(object) {
|
|
1155
|
+
if (object) {
|
|
1156
|
+
if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
|
|
1157
|
+
stream_default(object, projectionStream(contextStream));
|
|
1158
|
+
}
|
|
1159
|
+
return contextStream.result();
|
|
1160
|
+
}
|
|
1161
|
+
path.area = function(object) {
|
|
1162
|
+
stream_default(object, projectionStream(area_default));
|
|
1163
|
+
return area_default.result();
|
|
1164
|
+
};
|
|
1165
|
+
path.measure = function(object) {
|
|
1166
|
+
stream_default(object, projectionStream(measure_default));
|
|
1167
|
+
return measure_default.result();
|
|
1168
|
+
};
|
|
1169
|
+
path.bounds = function(object) {
|
|
1170
|
+
stream_default(object, projectionStream(bounds_default));
|
|
1171
|
+
return bounds_default.result();
|
|
1172
|
+
};
|
|
1173
|
+
path.centroid = function(object) {
|
|
1174
|
+
stream_default(object, projectionStream(centroid_default));
|
|
1175
|
+
return centroid_default.result();
|
|
1176
|
+
};
|
|
1177
|
+
path.projection = function(_) {
|
|
1178
|
+
if (!arguments.length) return projection2;
|
|
1179
|
+
projectionStream = _ == null ? (projection2 = null, identity_default) : (projection2 = _).stream;
|
|
1180
|
+
return path;
|
|
1181
|
+
};
|
|
1182
|
+
path.context = function(_) {
|
|
1183
|
+
if (!arguments.length) return context;
|
|
1184
|
+
contextStream = _ == null ? (context = null, new PathString(digits)) : new PathContext(context = _);
|
|
1185
|
+
if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
|
|
1186
|
+
return path;
|
|
1187
|
+
};
|
|
1188
|
+
path.pointRadius = function(_) {
|
|
1189
|
+
if (!arguments.length) return pointRadius;
|
|
1190
|
+
pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
|
|
1191
|
+
return path;
|
|
1192
|
+
};
|
|
1193
|
+
path.digits = function(_) {
|
|
1194
|
+
if (!arguments.length) return digits;
|
|
1195
|
+
if (_ == null) digits = null;
|
|
1196
|
+
else {
|
|
1197
|
+
const d = Math.floor(_);
|
|
1198
|
+
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|
1199
|
+
digits = d;
|
|
1200
|
+
}
|
|
1201
|
+
if (context === null) contextStream = new PathString(digits);
|
|
1202
|
+
return path;
|
|
1203
|
+
};
|
|
1204
|
+
return path.projection(projection2).digits(digits).context(context);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/transform.js
|
|
1208
|
+
function transformer(methods) {
|
|
1209
|
+
return function(stream) {
|
|
1210
|
+
var s = new TransformStream();
|
|
1211
|
+
for (var key in methods) s[key] = methods[key];
|
|
1212
|
+
s.stream = stream;
|
|
1213
|
+
return s;
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
function TransformStream() {
|
|
1217
|
+
}
|
|
1218
|
+
TransformStream.prototype = {
|
|
1219
|
+
constructor: TransformStream,
|
|
1220
|
+
point: function(x, y) {
|
|
1221
|
+
this.stream.point(x, y);
|
|
1222
|
+
},
|
|
1223
|
+
sphere: function() {
|
|
1224
|
+
this.stream.sphere();
|
|
1225
|
+
},
|
|
1226
|
+
lineStart: function() {
|
|
1227
|
+
this.stream.lineStart();
|
|
1228
|
+
},
|
|
1229
|
+
lineEnd: function() {
|
|
1230
|
+
this.stream.lineEnd();
|
|
1231
|
+
},
|
|
1232
|
+
polygonStart: function() {
|
|
1233
|
+
this.stream.polygonStart();
|
|
1234
|
+
},
|
|
1235
|
+
polygonEnd: function() {
|
|
1236
|
+
this.stream.polygonEnd();
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/fit.js
|
|
1241
|
+
function fit(projection2, fitBounds, object) {
|
|
1242
|
+
var clip = projection2.clipExtent && projection2.clipExtent();
|
|
1243
|
+
projection2.scale(150).translate([0, 0]);
|
|
1244
|
+
if (clip != null) projection2.clipExtent(null);
|
|
1245
|
+
stream_default(object, projection2.stream(bounds_default));
|
|
1246
|
+
fitBounds(bounds_default.result());
|
|
1247
|
+
if (clip != null) projection2.clipExtent(clip);
|
|
1248
|
+
return projection2;
|
|
1249
|
+
}
|
|
1250
|
+
function fitExtent(projection2, extent, object) {
|
|
1251
|
+
return fit(projection2, function(b) {
|
|
1252
|
+
var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
|
|
1253
|
+
projection2.scale(150 * k).translate([x, y]);
|
|
1254
|
+
}, object);
|
|
1255
|
+
}
|
|
1256
|
+
function fitSize(projection2, size, object) {
|
|
1257
|
+
return fitExtent(projection2, [[0, 0], size], object);
|
|
1258
|
+
}
|
|
1259
|
+
function fitWidth(projection2, width, object) {
|
|
1260
|
+
return fit(projection2, function(b) {
|
|
1261
|
+
var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1];
|
|
1262
|
+
projection2.scale(150 * k).translate([x, y]);
|
|
1263
|
+
}, object);
|
|
1264
|
+
}
|
|
1265
|
+
function fitHeight(projection2, height, object) {
|
|
1266
|
+
return fit(projection2, function(b) {
|
|
1267
|
+
var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2;
|
|
1268
|
+
projection2.scale(150 * k).translate([x, y]);
|
|
1269
|
+
}, object);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/resample.js
|
|
1273
|
+
var maxDepth = 16;
|
|
1274
|
+
var cosMinDistance = cos(30 * radians);
|
|
1275
|
+
function resample_default(project, delta2) {
|
|
1276
|
+
return +delta2 ? resample(project, delta2) : resampleNone(project);
|
|
1277
|
+
}
|
|
1278
|
+
function resampleNone(project) {
|
|
1279
|
+
return transformer({
|
|
1280
|
+
point: function(x, y) {
|
|
1281
|
+
x = project(x, y);
|
|
1282
|
+
this.stream.point(x[0], x[1]);
|
|
1283
|
+
}
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
function resample(project, delta2) {
|
|
1287
|
+
function resampleLineTo(x05, y05, lambda0, a0, b0, c0, x12, y12, lambda1, a1, b1, c1, depth, stream) {
|
|
1288
|
+
var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
|
|
1289
|
+
if (d2 > 4 * delta2 && depth--) {
|
|
1290
|
+
var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
|
|
1291
|
+
if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
|
|
1292
|
+
resampleLineTo(x05, y05, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);
|
|
1293
|
+
stream.point(x2, y2);
|
|
1294
|
+
resampleLineTo(x2, y2, lambda2, a, b, c, x12, y12, lambda1, a1, b1, c1, depth, stream);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
return function(stream) {
|
|
1299
|
+
var lambda00, x004, y004, a00, b00, c00, lambda0, x05, y05, a0, b0, c0;
|
|
1300
|
+
var resampleStream = {
|
|
1301
|
+
point,
|
|
1302
|
+
lineStart,
|
|
1303
|
+
lineEnd,
|
|
1304
|
+
polygonStart: function() {
|
|
1305
|
+
stream.polygonStart();
|
|
1306
|
+
resampleStream.lineStart = ringStart;
|
|
1307
|
+
},
|
|
1308
|
+
polygonEnd: function() {
|
|
1309
|
+
stream.polygonEnd();
|
|
1310
|
+
resampleStream.lineStart = lineStart;
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
function point(x, y) {
|
|
1314
|
+
x = project(x, y);
|
|
1315
|
+
stream.point(x[0], x[1]);
|
|
1316
|
+
}
|
|
1317
|
+
function lineStart() {
|
|
1318
|
+
x05 = NaN;
|
|
1319
|
+
resampleStream.point = linePoint;
|
|
1320
|
+
stream.lineStart();
|
|
1321
|
+
}
|
|
1322
|
+
function linePoint(lambda, phi) {
|
|
1323
|
+
var c = cartesian([lambda, phi]), p = project(lambda, phi);
|
|
1324
|
+
resampleLineTo(x05, y05, lambda0, a0, b0, c0, x05 = p[0], y05 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
|
|
1325
|
+
stream.point(x05, y05);
|
|
1326
|
+
}
|
|
1327
|
+
function lineEnd() {
|
|
1328
|
+
resampleStream.point = point;
|
|
1329
|
+
stream.lineEnd();
|
|
1330
|
+
}
|
|
1331
|
+
function ringStart() {
|
|
1332
|
+
lineStart();
|
|
1333
|
+
resampleStream.point = ringPoint;
|
|
1334
|
+
resampleStream.lineEnd = ringEnd;
|
|
1335
|
+
}
|
|
1336
|
+
function ringPoint(lambda, phi) {
|
|
1337
|
+
linePoint(lambda00 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
|
|
1338
|
+
resampleStream.point = linePoint;
|
|
1339
|
+
}
|
|
1340
|
+
function ringEnd() {
|
|
1341
|
+
resampleLineTo(x05, y05, lambda0, a0, b0, c0, x004, y004, lambda00, a00, b00, c00, maxDepth, stream);
|
|
1342
|
+
resampleStream.lineEnd = lineEnd;
|
|
1343
|
+
lineEnd();
|
|
1344
|
+
}
|
|
1345
|
+
return resampleStream;
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/index.js
|
|
1350
|
+
var transformRadians = transformer({
|
|
1351
|
+
point: function(x, y) {
|
|
1352
|
+
this.stream.point(x * radians, y * radians);
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
function transformRotate(rotate) {
|
|
1356
|
+
return transformer({
|
|
1357
|
+
point: function(x, y) {
|
|
1358
|
+
var r = rotate(x, y);
|
|
1359
|
+
return this.stream.point(r[0], r[1]);
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
function scaleTranslate(k, dx, dy, sx, sy) {
|
|
1364
|
+
function transform(x, y) {
|
|
1365
|
+
x *= sx;
|
|
1366
|
+
y *= sy;
|
|
1367
|
+
return [dx + k * x, dy - k * y];
|
|
1368
|
+
}
|
|
1369
|
+
transform.invert = function(x, y) {
|
|
1370
|
+
return [(x - dx) / k * sx, (dy - y) / k * sy];
|
|
1371
|
+
};
|
|
1372
|
+
return transform;
|
|
1373
|
+
}
|
|
1374
|
+
function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
|
|
1375
|
+
if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);
|
|
1376
|
+
var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k;
|
|
1377
|
+
function transform(x, y) {
|
|
1378
|
+
x *= sx;
|
|
1379
|
+
y *= sy;
|
|
1380
|
+
return [a * x - b * y + dx, dy - b * x - a * y];
|
|
1381
|
+
}
|
|
1382
|
+
transform.invert = function(x, y) {
|
|
1383
|
+
return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
|
|
1384
|
+
};
|
|
1385
|
+
return transform;
|
|
1386
|
+
}
|
|
1387
|
+
function projection(project) {
|
|
1388
|
+
return projectionMutator(function() {
|
|
1389
|
+
return project;
|
|
1390
|
+
})();
|
|
1391
|
+
}
|
|
1392
|
+
function projectionMutator(projectAt) {
|
|
1393
|
+
var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = antimeridian_default, x05 = null, y05, x12, y12, postclip = identity_default, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
|
|
1394
|
+
function projection2(point) {
|
|
1395
|
+
return projectRotateTransform(point[0] * radians, point[1] * radians);
|
|
1396
|
+
}
|
|
1397
|
+
function invert(point) {
|
|
1398
|
+
point = projectRotateTransform.invert(point[0], point[1]);
|
|
1399
|
+
return point && [point[0] * degrees, point[1] * degrees];
|
|
1400
|
+
}
|
|
1401
|
+
projection2.stream = function(stream) {
|
|
1402
|
+
return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
|
|
1403
|
+
};
|
|
1404
|
+
projection2.preclip = function(_) {
|
|
1405
|
+
return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;
|
|
1406
|
+
};
|
|
1407
|
+
projection2.postclip = function(_) {
|
|
1408
|
+
return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
|
|
1409
|
+
};
|
|
1410
|
+
projection2.clipAngle = function(_) {
|
|
1411
|
+
return arguments.length ? (preclip = +_ ? circle_default(theta = _ * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
|
|
1412
|
+
};
|
|
1413
|
+
projection2.clipExtent = function(_) {
|
|
1414
|
+
return arguments.length ? (postclip = _ == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
|
|
1415
|
+
};
|
|
1416
|
+
projection2.scale = function(_) {
|
|
1417
|
+
return arguments.length ? (k = +_, recenter()) : k;
|
|
1418
|
+
};
|
|
1419
|
+
projection2.translate = function(_) {
|
|
1420
|
+
return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
|
|
1421
|
+
};
|
|
1422
|
+
projection2.center = function(_) {
|
|
1423
|
+
return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
|
|
1424
|
+
};
|
|
1425
|
+
projection2.rotate = function(_) {
|
|
1426
|
+
return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
|
|
1427
|
+
};
|
|
1428
|
+
projection2.angle = function(_) {
|
|
1429
|
+
return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;
|
|
1430
|
+
};
|
|
1431
|
+
projection2.reflectX = function(_) {
|
|
1432
|
+
return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
|
|
1433
|
+
};
|
|
1434
|
+
projection2.reflectY = function(_) {
|
|
1435
|
+
return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
|
|
1436
|
+
};
|
|
1437
|
+
projection2.precision = function(_) {
|
|
1438
|
+
return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
|
|
1439
|
+
};
|
|
1440
|
+
projection2.fitExtent = function(extent, object) {
|
|
1441
|
+
return fitExtent(projection2, extent, object);
|
|
1442
|
+
};
|
|
1443
|
+
projection2.fitSize = function(size, object) {
|
|
1444
|
+
return fitSize(projection2, size, object);
|
|
1445
|
+
};
|
|
1446
|
+
projection2.fitWidth = function(width, object) {
|
|
1447
|
+
return fitWidth(projection2, width, object);
|
|
1448
|
+
};
|
|
1449
|
+
projection2.fitHeight = function(height, object) {
|
|
1450
|
+
return fitHeight(projection2, height, object);
|
|
1451
|
+
};
|
|
1452
|
+
function recenter() {
|
|
1453
|
+
var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);
|
|
1454
|
+
rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
|
|
1455
|
+
projectTransform = compose_default(project, transform);
|
|
1456
|
+
projectRotateTransform = compose_default(rotate, projectTransform);
|
|
1457
|
+
projectResample = resample_default(projectTransform, delta2);
|
|
1458
|
+
return reset();
|
|
1459
|
+
}
|
|
1460
|
+
function reset() {
|
|
1461
|
+
cache = cacheStream = null;
|
|
1462
|
+
return projection2;
|
|
1463
|
+
}
|
|
1464
|
+
return function() {
|
|
1465
|
+
project = projectAt.apply(this, arguments);
|
|
1466
|
+
projection2.invert = project.invert && invert;
|
|
1467
|
+
return recenter();
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
// ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/projection/naturalEarth1.js
|
|
1472
|
+
function naturalEarth1Raw(lambda, phi) {
|
|
1473
|
+
var phi2 = phi * phi, phi4 = phi2 * phi2;
|
|
1474
|
+
return [
|
|
1475
|
+
lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi2 - 1529e-6 * phi4))),
|
|
1476
|
+
phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 5916e-6 * phi4)))
|
|
1477
|
+
];
|
|
1478
|
+
}
|
|
1479
|
+
naturalEarth1Raw.invert = function(x, y) {
|
|
1480
|
+
var phi = y, i = 25, delta;
|
|
1481
|
+
do {
|
|
1482
|
+
var phi2 = phi * phi, phi4 = phi2 * phi2;
|
|
1483
|
+
phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 5916e-6 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 5916e-6 * 11 * phi4)));
|
|
1484
|
+
} while (abs(delta) > epsilon && --i > 0);
|
|
1485
|
+
return [
|
|
1486
|
+
x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (3971e-6 - 1529e-6 * phi2)))),
|
|
1487
|
+
phi
|
|
1488
|
+
];
|
|
1489
|
+
};
|
|
1490
|
+
function naturalEarth1_default() {
|
|
1491
|
+
return projection(naturalEarth1Raw).scale(175.295);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// src/world-map-codes.ts
|
|
1495
|
+
var NUMERIC_TO_ALPHA2 = {
|
|
1496
|
+
"004": "AF",
|
|
1497
|
+
"008": "AL",
|
|
1498
|
+
"010": "AQ",
|
|
1499
|
+
"012": "DZ",
|
|
1500
|
+
"016": "AS",
|
|
1501
|
+
"020": "AD",
|
|
1502
|
+
"024": "AO",
|
|
1503
|
+
"028": "AG",
|
|
1504
|
+
"031": "AZ",
|
|
1505
|
+
"032": "AR",
|
|
1506
|
+
"036": "AU",
|
|
1507
|
+
"040": "AT",
|
|
1508
|
+
"044": "BS",
|
|
1509
|
+
"048": "BH",
|
|
1510
|
+
"050": "BD",
|
|
1511
|
+
"051": "AM",
|
|
1512
|
+
"052": "BB",
|
|
1513
|
+
"056": "BE",
|
|
1514
|
+
"060": "BM",
|
|
1515
|
+
"064": "BT",
|
|
1516
|
+
"068": "BO",
|
|
1517
|
+
"070": "BA",
|
|
1518
|
+
"072": "BW",
|
|
1519
|
+
"074": "BV",
|
|
1520
|
+
"076": "BR",
|
|
1521
|
+
"084": "BZ",
|
|
1522
|
+
"086": "IO",
|
|
1523
|
+
"090": "SB",
|
|
1524
|
+
"092": "VG",
|
|
1525
|
+
"096": "BN",
|
|
1526
|
+
"100": "BG",
|
|
1527
|
+
"104": "MM",
|
|
1528
|
+
"108": "BI",
|
|
1529
|
+
"112": "BY",
|
|
1530
|
+
"116": "KH",
|
|
1531
|
+
"120": "CM",
|
|
1532
|
+
"124": "CA",
|
|
1533
|
+
"132": "CV",
|
|
1534
|
+
"136": "KY",
|
|
1535
|
+
"140": "CF",
|
|
1536
|
+
"144": "LK",
|
|
1537
|
+
"148": "TD",
|
|
1538
|
+
"152": "CL",
|
|
1539
|
+
"156": "CN",
|
|
1540
|
+
"158": "TW",
|
|
1541
|
+
"162": "CX",
|
|
1542
|
+
"166": "CC",
|
|
1543
|
+
"170": "CO",
|
|
1544
|
+
"174": "KM",
|
|
1545
|
+
"175": "YT",
|
|
1546
|
+
"178": "CG",
|
|
1547
|
+
"180": "CD",
|
|
1548
|
+
"184": "CK",
|
|
1549
|
+
"188": "CR",
|
|
1550
|
+
"191": "HR",
|
|
1551
|
+
"192": "CU",
|
|
1552
|
+
"196": "CY",
|
|
1553
|
+
"203": "CZ",
|
|
1554
|
+
"204": "BJ",
|
|
1555
|
+
"208": "DK",
|
|
1556
|
+
"212": "DM",
|
|
1557
|
+
"214": "DO",
|
|
1558
|
+
"218": "EC",
|
|
1559
|
+
"222": "SV",
|
|
1560
|
+
"226": "GQ",
|
|
1561
|
+
"231": "ET",
|
|
1562
|
+
"232": "ER",
|
|
1563
|
+
"233": "EE",
|
|
1564
|
+
"234": "FO",
|
|
1565
|
+
"238": "FK",
|
|
1566
|
+
"239": "GS",
|
|
1567
|
+
"242": "FJ",
|
|
1568
|
+
"246": "FI",
|
|
1569
|
+
"248": "AX",
|
|
1570
|
+
"250": "FR",
|
|
1571
|
+
"254": "GF",
|
|
1572
|
+
"258": "PF",
|
|
1573
|
+
"260": "TF",
|
|
1574
|
+
"262": "DJ",
|
|
1575
|
+
"266": "GA",
|
|
1576
|
+
"268": "GE",
|
|
1577
|
+
"270": "GM",
|
|
1578
|
+
"275": "PS",
|
|
1579
|
+
"276": "DE",
|
|
1580
|
+
"288": "GH",
|
|
1581
|
+
"292": "GI",
|
|
1582
|
+
"296": "KI",
|
|
1583
|
+
"300": "GR",
|
|
1584
|
+
"304": "GL",
|
|
1585
|
+
"308": "GD",
|
|
1586
|
+
"312": "GP",
|
|
1587
|
+
"316": "GU",
|
|
1588
|
+
"320": "GT",
|
|
1589
|
+
"324": "GN",
|
|
1590
|
+
"328": "GY",
|
|
1591
|
+
"332": "HT",
|
|
1592
|
+
"334": "HM",
|
|
1593
|
+
"336": "VA",
|
|
1594
|
+
"340": "HN",
|
|
1595
|
+
"344": "HK",
|
|
1596
|
+
"348": "HU",
|
|
1597
|
+
"352": "IS",
|
|
1598
|
+
"356": "IN",
|
|
1599
|
+
"360": "ID",
|
|
1600
|
+
"364": "IR",
|
|
1601
|
+
"368": "IQ",
|
|
1602
|
+
"372": "IE",
|
|
1603
|
+
"376": "IL",
|
|
1604
|
+
"380": "IT",
|
|
1605
|
+
"384": "CI",
|
|
1606
|
+
"388": "JM",
|
|
1607
|
+
"392": "JP",
|
|
1608
|
+
"398": "KZ",
|
|
1609
|
+
"400": "JO",
|
|
1610
|
+
"404": "KE",
|
|
1611
|
+
"408": "KP",
|
|
1612
|
+
"410": "KR",
|
|
1613
|
+
"414": "KW",
|
|
1614
|
+
"417": "KG",
|
|
1615
|
+
"418": "LA",
|
|
1616
|
+
"422": "LB",
|
|
1617
|
+
"426": "LS",
|
|
1618
|
+
"428": "LV",
|
|
1619
|
+
"430": "LR",
|
|
1620
|
+
"434": "LY",
|
|
1621
|
+
"438": "LI",
|
|
1622
|
+
"440": "LT",
|
|
1623
|
+
"442": "LU",
|
|
1624
|
+
"446": "MO",
|
|
1625
|
+
"450": "MG",
|
|
1626
|
+
"454": "MW",
|
|
1627
|
+
"458": "MY",
|
|
1628
|
+
"462": "MV",
|
|
1629
|
+
"466": "ML",
|
|
1630
|
+
"470": "MT",
|
|
1631
|
+
"474": "MQ",
|
|
1632
|
+
"478": "MR",
|
|
1633
|
+
"480": "MU",
|
|
1634
|
+
"484": "MX",
|
|
1635
|
+
"492": "MC",
|
|
1636
|
+
"496": "MN",
|
|
1637
|
+
"498": "MD",
|
|
1638
|
+
"499": "ME",
|
|
1639
|
+
"500": "MS",
|
|
1640
|
+
"504": "MA",
|
|
1641
|
+
"508": "MZ",
|
|
1642
|
+
"512": "OM",
|
|
1643
|
+
"516": "NA",
|
|
1644
|
+
"520": "NR",
|
|
1645
|
+
"524": "NP",
|
|
1646
|
+
"528": "NL",
|
|
1647
|
+
"531": "CW",
|
|
1648
|
+
"533": "AW",
|
|
1649
|
+
"534": "SX",
|
|
1650
|
+
"535": "BQ",
|
|
1651
|
+
"540": "NC",
|
|
1652
|
+
"548": "VU",
|
|
1653
|
+
"554": "NZ",
|
|
1654
|
+
"558": "NI",
|
|
1655
|
+
"562": "NE",
|
|
1656
|
+
"566": "NG",
|
|
1657
|
+
"570": "NU",
|
|
1658
|
+
"574": "NF",
|
|
1659
|
+
"578": "NO",
|
|
1660
|
+
"580": "MP",
|
|
1661
|
+
"581": "UM",
|
|
1662
|
+
"583": "FM",
|
|
1663
|
+
"584": "MH",
|
|
1664
|
+
"585": "PW",
|
|
1665
|
+
"586": "PK",
|
|
1666
|
+
"591": "PA",
|
|
1667
|
+
"598": "PG",
|
|
1668
|
+
"600": "PY",
|
|
1669
|
+
"604": "PE",
|
|
1670
|
+
"608": "PH",
|
|
1671
|
+
"612": "PN",
|
|
1672
|
+
"616": "PL",
|
|
1673
|
+
"620": "PT",
|
|
1674
|
+
"624": "GW",
|
|
1675
|
+
"626": "TL",
|
|
1676
|
+
"630": "PR",
|
|
1677
|
+
"634": "QA",
|
|
1678
|
+
"638": "RE",
|
|
1679
|
+
"642": "RO",
|
|
1680
|
+
"643": "RU",
|
|
1681
|
+
"646": "RW",
|
|
1682
|
+
"652": "BL",
|
|
1683
|
+
"654": "SH",
|
|
1684
|
+
"659": "KN",
|
|
1685
|
+
"660": "AI",
|
|
1686
|
+
"662": "LC",
|
|
1687
|
+
"663": "MF",
|
|
1688
|
+
"666": "PM",
|
|
1689
|
+
"670": "VC",
|
|
1690
|
+
"674": "SM",
|
|
1691
|
+
"678": "ST",
|
|
1692
|
+
"682": "SA",
|
|
1693
|
+
"686": "SN",
|
|
1694
|
+
"688": "RS",
|
|
1695
|
+
"690": "SC",
|
|
1696
|
+
"694": "SL",
|
|
1697
|
+
"702": "SG",
|
|
1698
|
+
"703": "SK",
|
|
1699
|
+
"704": "VN",
|
|
1700
|
+
"705": "SI",
|
|
1701
|
+
"706": "SO",
|
|
1702
|
+
"710": "ZA",
|
|
1703
|
+
"716": "ZW",
|
|
1704
|
+
"724": "ES",
|
|
1705
|
+
"728": "SS",
|
|
1706
|
+
"729": "SD",
|
|
1707
|
+
"732": "EH",
|
|
1708
|
+
"740": "SR",
|
|
1709
|
+
"744": "SJ",
|
|
1710
|
+
"748": "SZ",
|
|
1711
|
+
"752": "SE",
|
|
1712
|
+
"756": "CH",
|
|
1713
|
+
"760": "SY",
|
|
1714
|
+
"762": "TJ",
|
|
1715
|
+
"764": "TH",
|
|
1716
|
+
"768": "TG",
|
|
1717
|
+
"772": "TK",
|
|
1718
|
+
"776": "TO",
|
|
1719
|
+
"780": "TT",
|
|
1720
|
+
"784": "AE",
|
|
1721
|
+
"788": "TN",
|
|
1722
|
+
"792": "TR",
|
|
1723
|
+
"795": "TM",
|
|
1724
|
+
"796": "TC",
|
|
1725
|
+
"798": "TV",
|
|
1726
|
+
"800": "UG",
|
|
1727
|
+
"804": "UA",
|
|
1728
|
+
"807": "MK",
|
|
1729
|
+
"818": "EG",
|
|
1730
|
+
"826": "GB",
|
|
1731
|
+
"831": "GG",
|
|
1732
|
+
"832": "JE",
|
|
1733
|
+
"833": "IM",
|
|
1734
|
+
"834": "TZ",
|
|
1735
|
+
"840": "US",
|
|
1736
|
+
"850": "VI",
|
|
1737
|
+
"854": "BF",
|
|
1738
|
+
"858": "UY",
|
|
1739
|
+
"860": "UZ",
|
|
1740
|
+
"862": "VE",
|
|
1741
|
+
"876": "WF",
|
|
1742
|
+
"882": "WS",
|
|
1743
|
+
"887": "YE",
|
|
1744
|
+
"894": "ZM"
|
|
1745
|
+
};
|
|
1746
|
+
|
|
1747
|
+
// src/world-map.ts
|
|
1748
|
+
var STEPS = 5;
|
|
1749
|
+
var clamp = (value, min, max) => Math.min(Math.max(value, min ?? -Infinity), max ?? Infinity);
|
|
1750
|
+
var scaleOf = (values, min, max) => {
|
|
1751
|
+
const [low, high] = min !== void 0 && max !== void 0 && min > max ? [max, min] : [min, max];
|
|
1752
|
+
const sorted = values.filter(Number.isFinite).map((value) => clamp(value, low, high)).sort((a, b) => a - b);
|
|
1753
|
+
if (sorted.length === 0) return void 0;
|
|
1754
|
+
const thresholds = [1, 2, 3, 4].map((q) => sorted[Math.floor(sorted.length * q / STEPS)]);
|
|
1755
|
+
return { thresholds, bounds: [low ?? sorted[0], ...thresholds], min: low, max: high };
|
|
1756
|
+
};
|
|
1757
|
+
var stepOf = (value, scale) => {
|
|
1758
|
+
const clamped = clamp(value, scale.min, scale.max);
|
|
1759
|
+
return scale.thresholds.filter((threshold) => clamped >= threshold).length;
|
|
1760
|
+
};
|
|
1761
|
+
var ranked = (countries) => countries.filter((country) => country.value !== void 0).sort((a, b) => b.value - a.value || a.name.localeCompare(b.name));
|
|
1762
|
+
var walk = (order, current, delta) => {
|
|
1763
|
+
const index = order.findIndex((country) => country.code === current);
|
|
1764
|
+
if (index < 0) return order[0];
|
|
1765
|
+
return order[Math.min(Math.max(index + delta, 0), order.length - 1)];
|
|
1766
|
+
};
|
|
1767
|
+
var VIEW_WIDTH = 960;
|
|
1768
|
+
var MARGIN = 2;
|
|
1769
|
+
var ANTARCTICA = "010";
|
|
1770
|
+
var TIP_GAP = 6;
|
|
1771
|
+
var POINTER_GAP = 14;
|
|
1772
|
+
var HIDDEN = {
|
|
1773
|
+
position: "absolute",
|
|
1774
|
+
width: 1,
|
|
1775
|
+
height: 1,
|
|
1776
|
+
margin: -1,
|
|
1777
|
+
padding: 0,
|
|
1778
|
+
overflow: "hidden",
|
|
1779
|
+
clipPath: "inset(50%)",
|
|
1780
|
+
whiteSpace: "nowrap",
|
|
1781
|
+
border: 0
|
|
1782
|
+
};
|
|
1783
|
+
var shapesOf = (geography) => {
|
|
1784
|
+
const countries = geography.objects.countries;
|
|
1785
|
+
if (!countries) {
|
|
1786
|
+
throw new Error("WorldMap: `geography` has no `countries` object");
|
|
1787
|
+
}
|
|
1788
|
+
const collection = topojsonClient.feature(geography, countries);
|
|
1789
|
+
const features = (collection.type === "FeatureCollection" ? collection.features : [collection]).filter((item) => String(item.id).padStart(3, "0") !== ANTARCTICA);
|
|
1790
|
+
const world = { type: "FeatureCollection", features };
|
|
1791
|
+
const projection2 = naturalEarth1_default().fitWidth(VIEW_WIDTH - 2 * MARGIN, world);
|
|
1792
|
+
const [x, y] = projection2.translate();
|
|
1793
|
+
projection2.translate([x + MARGIN, y + MARGIN]);
|
|
1794
|
+
const path = path_default(projection2);
|
|
1795
|
+
const [, [, bottom]] = path.bounds(world);
|
|
1796
|
+
const shapes = features.flatMap((item) => {
|
|
1797
|
+
const d = path(item);
|
|
1798
|
+
if (!d) return [];
|
|
1799
|
+
const name = item.properties?.name;
|
|
1800
|
+
return [
|
|
1801
|
+
{
|
|
1802
|
+
code: item.id === void 0 ? void 0 : NUMERIC_TO_ALPHA2[String(item.id).padStart(3, "0")],
|
|
1803
|
+
name: typeof name === "string" ? name : "",
|
|
1804
|
+
d
|
|
1805
|
+
}
|
|
1806
|
+
];
|
|
1807
|
+
});
|
|
1808
|
+
return { shapes, viewHeight: Math.ceil(bottom) + MARGIN };
|
|
1809
|
+
};
|
|
1810
|
+
var WorldMap = ({
|
|
1811
|
+
data,
|
|
1812
|
+
geography,
|
|
1813
|
+
formatValue = String,
|
|
1814
|
+
label,
|
|
1815
|
+
min,
|
|
1816
|
+
max,
|
|
1817
|
+
showLegend = true,
|
|
1818
|
+
onSelect,
|
|
1819
|
+
ariaLabel,
|
|
1820
|
+
height,
|
|
1821
|
+
width
|
|
1822
|
+
}) => {
|
|
1823
|
+
const frame = react.useRef(null);
|
|
1824
|
+
const { shapes, viewHeight } = react.useMemo(() => shapesOf(geography), [geography]);
|
|
1825
|
+
const [hover, setHover] = react.useState();
|
|
1826
|
+
const [focus, setFocus] = react.useState();
|
|
1827
|
+
const [lastKey, setLastKey] = react.useState();
|
|
1828
|
+
const valued = shapes.map((shape) => {
|
|
1829
|
+
const value = shape.code === void 0 ? void 0 : data[shape.code];
|
|
1830
|
+
return { ...shape, value: Number.isFinite(value) ? value : void 0 };
|
|
1831
|
+
});
|
|
1832
|
+
const order = ranked(
|
|
1833
|
+
valued.filter((country) => country.code !== void 0)
|
|
1834
|
+
);
|
|
1835
|
+
const scale = scaleOf(
|
|
1836
|
+
order.map((country) => country.value),
|
|
1837
|
+
min,
|
|
1838
|
+
max
|
|
1839
|
+
);
|
|
1840
|
+
const countries = valued.map((country) => ({
|
|
1841
|
+
...country,
|
|
1842
|
+
step: scale && country.value !== void 0 ? stepOf(country.value, scale) : void 0
|
|
1843
|
+
}));
|
|
1844
|
+
const byCode = new Map(
|
|
1845
|
+
countries.flatMap((country) => country.code ? [[country.code, country]] : [])
|
|
1846
|
+
);
|
|
1847
|
+
const interactive = order.length > 0;
|
|
1848
|
+
const stepColor = (step) => step === void 0 ? chunkLT3UC65O_cjs.TRACK : chunkLT3UC65O_cjs.SEQUENTIAL[step];
|
|
1849
|
+
const name = ariaLabel ?? (interactive ? `World map, ${label ?? "value"} by country, from ${formatValue(order[order.length - 1].value)} to ${formatValue(order[0].value)}` : "World map");
|
|
1850
|
+
const tip = hover ?? focus;
|
|
1851
|
+
const tipCountry = tip && byCode.get(tip.code);
|
|
1852
|
+
const anchor = (code, x, top, bottom, gap) => {
|
|
1853
|
+
const host = frame.current.getBoundingClientRect();
|
|
1854
|
+
const middle = x - host.left;
|
|
1855
|
+
const align = middle < host.width / 3 ? "start" : middle > 2 * host.width / 3 ? "end" : "center";
|
|
1856
|
+
return {
|
|
1857
|
+
code,
|
|
1858
|
+
x: middle,
|
|
1859
|
+
top: top - host.top - gap,
|
|
1860
|
+
bottom: bottom - host.top + gap,
|
|
1861
|
+
align,
|
|
1862
|
+
// Not enough room above for the card: it goes under.
|
|
1863
|
+
below: top - host.top < 90
|
|
1864
|
+
};
|
|
1865
|
+
};
|
|
1866
|
+
const tipAtPointer = (code, event) => anchor(code, event.clientX, event.clientY, event.clientY, POINTER_GAP - TIP_GAP);
|
|
1867
|
+
const tipAtCountry = (code) => {
|
|
1868
|
+
const element = frame.current?.querySelector(`[data-code="${code}"]`);
|
|
1869
|
+
if (!element) return void 0;
|
|
1870
|
+
const box = element.getBoundingClientRect();
|
|
1871
|
+
const middle = box.top + box.height / 2;
|
|
1872
|
+
return anchor(code, box.left + box.width / 2, middle, middle, 0);
|
|
1873
|
+
};
|
|
1874
|
+
const goTo = (country) => {
|
|
1875
|
+
if (!country) return;
|
|
1876
|
+
setLastKey(country.code);
|
|
1877
|
+
setFocus(tipAtCountry(country.code));
|
|
1878
|
+
};
|
|
1879
|
+
const keyDown = (event) => {
|
|
1880
|
+
const current = focus?.code ?? lastKey;
|
|
1881
|
+
const targets = {
|
|
1882
|
+
ArrowRight: () => walk(order, current, 1),
|
|
1883
|
+
ArrowDown: () => walk(order, current, 1),
|
|
1884
|
+
ArrowLeft: () => walk(order, current, -1),
|
|
1885
|
+
ArrowUp: () => walk(order, current, -1),
|
|
1886
|
+
Home: () => order[0],
|
|
1887
|
+
End: () => order[order.length - 1]
|
|
1888
|
+
};
|
|
1889
|
+
if (targets[event.key]) {
|
|
1890
|
+
event.preventDefault();
|
|
1891
|
+
goTo(targets[event.key]());
|
|
1892
|
+
} else if (onSelect && (event.key === "Enter" || event.key === " ") && focus) {
|
|
1893
|
+
event.preventDefault();
|
|
1894
|
+
onSelect(focus.code);
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
const focusIn = (event) => {
|
|
1898
|
+
if (event.target === event.currentTarget && event.currentTarget.matches(":focus-visible")) {
|
|
1899
|
+
goTo(order.find((country) => country.code === lastKey) ?? order[0]);
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
1902
|
+
const focusOut = (event) => {
|
|
1903
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setFocus(void 0);
|
|
1904
|
+
};
|
|
1905
|
+
const tipStyle = tip && {
|
|
1906
|
+
position: "absolute",
|
|
1907
|
+
left: tip.x,
|
|
1908
|
+
top: tip.below ? tip.bottom : tip.top,
|
|
1909
|
+
transform: `translate(${{ start: "0", center: "-50%", end: "-100%" }[tip.align]}, ${tip.below ? "0" : "-100%"})`,
|
|
1910
|
+
zIndex: 10,
|
|
1911
|
+
pointerEvents: "none"
|
|
1912
|
+
};
|
|
1913
|
+
const active = tipCountry?.value === void 0 ? void 0 : tipCountry;
|
|
1914
|
+
const legend = showLegend && scale && /* @__PURE__ */ jsxRuntime.jsx(Legend, { scale, format: formatValue });
|
|
1915
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1916
|
+
"div",
|
|
1917
|
+
{
|
|
1918
|
+
"data-world-map": "",
|
|
1919
|
+
style: {
|
|
1920
|
+
position: "relative",
|
|
1921
|
+
display: "flex",
|
|
1922
|
+
flexDirection: "column",
|
|
1923
|
+
gap: "0.75rem",
|
|
1924
|
+
width: width ?? "100%",
|
|
1925
|
+
height,
|
|
1926
|
+
maxWidth: "100%",
|
|
1927
|
+
minWidth: 0
|
|
1928
|
+
},
|
|
1929
|
+
children: [
|
|
1930
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1931
|
+
"div",
|
|
1932
|
+
{
|
|
1933
|
+
ref: frame,
|
|
1934
|
+
role: interactive ? "application" : void 0,
|
|
1935
|
+
"aria-label": interactive ? name : void 0,
|
|
1936
|
+
tabIndex: interactive ? 0 : void 0,
|
|
1937
|
+
onKeyDown: interactive ? keyDown : void 0,
|
|
1938
|
+
onFocus: interactive ? focusIn : void 0,
|
|
1939
|
+
onBlur: interactive ? focusOut : void 0,
|
|
1940
|
+
style: {
|
|
1941
|
+
position: "relative",
|
|
1942
|
+
flex: height === void 0 ? void 0 : "1 1 0",
|
|
1943
|
+
minHeight: 0,
|
|
1944
|
+
// The country outline and the tooltip show where the keyboard is.
|
|
1945
|
+
outline: "none"
|
|
1946
|
+
},
|
|
1947
|
+
children: [
|
|
1948
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1949
|
+
"svg",
|
|
1950
|
+
{
|
|
1951
|
+
role: "img",
|
|
1952
|
+
"aria-label": name,
|
|
1953
|
+
viewBox: `0 0 ${VIEW_WIDTH} ${viewHeight}`,
|
|
1954
|
+
style: {
|
|
1955
|
+
display: "block",
|
|
1956
|
+
width: "100%",
|
|
1957
|
+
height: height === void 0 ? "auto" : "100%"
|
|
1958
|
+
},
|
|
1959
|
+
children: [
|
|
1960
|
+
countries.map((country, i) => {
|
|
1961
|
+
const code = country.code;
|
|
1962
|
+
const has = code !== void 0 && country.value !== void 0;
|
|
1963
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1964
|
+
"path",
|
|
1965
|
+
{
|
|
1966
|
+
d: country.d,
|
|
1967
|
+
"data-code": has ? code : void 0,
|
|
1968
|
+
"data-step": country.step,
|
|
1969
|
+
fill: stepColor(country.step),
|
|
1970
|
+
stroke: chunkLT3UC65O_cjs.PANEL,
|
|
1971
|
+
strokeWidth: 0.5,
|
|
1972
|
+
strokeLinejoin: "round",
|
|
1973
|
+
style: has && onSelect ? { cursor: "pointer" } : void 0,
|
|
1974
|
+
onMouseEnter: has ? (event) => setHover(tipAtPointer(code, event)) : void 0,
|
|
1975
|
+
onMouseMove: has ? (event) => setHover(tipAtPointer(code, event)) : void 0,
|
|
1976
|
+
onMouseLeave: has ? () => setHover(void 0) : void 0,
|
|
1977
|
+
onClick: has && onSelect ? () => onSelect(code) : void 0
|
|
1978
|
+
},
|
|
1979
|
+
i
|
|
1980
|
+
);
|
|
1981
|
+
}),
|
|
1982
|
+
active && // The same outline for the pointer and the keyboard, in the text color:
|
|
1983
|
+
// an accent one would vanish on the darkest steps. Drawn last to sit
|
|
1984
|
+
// above the neighbors' borders.
|
|
1985
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1986
|
+
"path",
|
|
1987
|
+
{
|
|
1988
|
+
d: active.d,
|
|
1989
|
+
"data-world-active": "",
|
|
1990
|
+
fill: "none",
|
|
1991
|
+
stroke: chunkLT3UC65O_cjs.TEXT,
|
|
1992
|
+
strokeWidth: 1.6,
|
|
1993
|
+
strokeLinejoin: "round",
|
|
1994
|
+
pointerEvents: "none"
|
|
1995
|
+
}
|
|
1996
|
+
)
|
|
1997
|
+
]
|
|
1998
|
+
}
|
|
1999
|
+
),
|
|
2000
|
+
tip && tipCountry && tipCountry.value !== void 0 && tipStyle && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-world-tooltip": "", "aria-hidden": true, style: tipStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2001
|
+
chunkT3K6Q34U_cjs.TooltipCard,
|
|
2002
|
+
{
|
|
2003
|
+
title: tipCountry.name,
|
|
2004
|
+
rows: [
|
|
2005
|
+
{
|
|
2006
|
+
name: label ?? "Value",
|
|
2007
|
+
value: formatValue(tipCountry.value),
|
|
2008
|
+
color: stepColor(tipCountry.step)
|
|
2009
|
+
}
|
|
2010
|
+
]
|
|
2011
|
+
}
|
|
2012
|
+
) }),
|
|
2013
|
+
interactive && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-world-status": "", role: "status", "aria-live": "polite", style: HIDDEN, children: focus && tipCountry && tipCountry.value !== void 0 ? `${tipCountry.name}, ${label ?? "Value"}: ${formatValue(tipCountry.value)}` : "" })
|
|
2014
|
+
]
|
|
2015
|
+
}
|
|
2016
|
+
),
|
|
2017
|
+
interactive && /* @__PURE__ */ jsxRuntime.jsx("div", { style: HIDDEN, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { "data-world-table": "", children: [
|
|
2018
|
+
/* @__PURE__ */ jsxRuntime.jsx("caption", { children: name }),
|
|
2019
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2020
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", children: "Country" }),
|
|
2021
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", children: label ?? "Value" })
|
|
2022
|
+
] }) }),
|
|
2023
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: order.map((country) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2024
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "row", children: country.name }),
|
|
2025
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { children: formatValue(country.value) })
|
|
2026
|
+
] }, country.code)) })
|
|
2027
|
+
] }) }),
|
|
2028
|
+
legend
|
|
2029
|
+
]
|
|
2030
|
+
}
|
|
2031
|
+
);
|
|
2032
|
+
};
|
|
2033
|
+
var Legend = ({ scale, format }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2034
|
+
"ul",
|
|
2035
|
+
{
|
|
2036
|
+
"data-world-legend": "",
|
|
2037
|
+
style: {
|
|
2038
|
+
display: "flex",
|
|
2039
|
+
flexWrap: "wrap",
|
|
2040
|
+
alignItems: "flex-end",
|
|
2041
|
+
columnGap: 2,
|
|
2042
|
+
rowGap: "0.5rem",
|
|
2043
|
+
margin: 0,
|
|
2044
|
+
padding: 0,
|
|
2045
|
+
listStyle: "none",
|
|
2046
|
+
fontSize: "var(--text-2xs, 0.6875rem)",
|
|
2047
|
+
color: chunkLT3UC65O_cjs.MUTED
|
|
2048
|
+
},
|
|
2049
|
+
children: [
|
|
2050
|
+
chunkLT3UC65O_cjs.SEQUENTIAL.map((color, i) => /* @__PURE__ */ jsxRuntime.jsxs("li", { style: { display: "flex", flexDirection: "column", gap: 4, minWidth: "2.75rem" }, children: [
|
|
2051
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2052
|
+
"span",
|
|
2053
|
+
{
|
|
2054
|
+
"aria-hidden": true,
|
|
2055
|
+
"data-world-swatch": "",
|
|
2056
|
+
style: { height: 10, borderRadius: 2, background: color }
|
|
2057
|
+
}
|
|
2058
|
+
),
|
|
2059
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap" }, children: [
|
|
2060
|
+
format(scale.bounds[i]),
|
|
2061
|
+
"+"
|
|
2062
|
+
] })
|
|
2063
|
+
] }, i)),
|
|
2064
|
+
/* @__PURE__ */ jsxRuntime.jsxs("li", { style: { display: "flex", flexDirection: "column", gap: 4, marginLeft: "0.75rem" }, children: [
|
|
2065
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2066
|
+
"span",
|
|
2067
|
+
{
|
|
2068
|
+
"aria-hidden": true,
|
|
2069
|
+
"data-world-swatch": "",
|
|
2070
|
+
style: {
|
|
2071
|
+
width: "1.75rem",
|
|
2072
|
+
height: 10,
|
|
2073
|
+
borderRadius: 2,
|
|
2074
|
+
background: chunkLT3UC65O_cjs.TRACK,
|
|
2075
|
+
border: `1px solid ${chunkLT3UC65O_cjs.BORDER}`,
|
|
2076
|
+
boxSizing: "border-box"
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
),
|
|
2080
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { whiteSpace: "nowrap" }, children: "No data" })
|
|
2081
|
+
] })
|
|
2082
|
+
]
|
|
2083
|
+
}
|
|
2084
|
+
);
|
|
2085
|
+
|
|
2086
|
+
exports.WorldMap = WorldMap;
|
|
2087
|
+
//# sourceMappingURL=WorldMap.cjs.map
|
|
2088
|
+
//# sourceMappingURL=WorldMap.cjs.map
|