chunk-7ANULLBZ.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. import {
  2. __commonJS
  3. } from "./chunk-S5KM4IGW.js";
  4. // node_modules/earcut/src/earcut.js
  5. var require_earcut = __commonJS({
  6. "node_modules/earcut/src/earcut.js"(exports, module) {
  7. "use strict";
  8. module.exports = earcut;
  9. module.exports.default = earcut;
  10. function earcut(data, holeIndices, dim) {
  11. dim = dim || 2;
  12. var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = [];
  13. if (!outerNode || outerNode.next === outerNode.prev)
  14. return triangles;
  15. var minX, minY, maxX, maxY, x, y, invSize;
  16. if (hasHoles)
  17. outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
  18. if (data.length > 80 * dim) {
  19. minX = maxX = data[0];
  20. minY = maxY = data[1];
  21. for (var i = dim; i < outerLen; i += dim) {
  22. x = data[i];
  23. y = data[i + 1];
  24. if (x < minX)
  25. minX = x;
  26. if (y < minY)
  27. minY = y;
  28. if (x > maxX)
  29. maxX = x;
  30. if (y > maxY)
  31. maxY = y;
  32. }
  33. invSize = Math.max(maxX - minX, maxY - minY);
  34. invSize = invSize !== 0 ? 32767 / invSize : 0;
  35. }
  36. earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
  37. return triangles;
  38. }
  39. function linkedList(data, start, end, dim, clockwise) {
  40. var i, last;
  41. if (clockwise === signedArea(data, start, end, dim) > 0) {
  42. for (i = start; i < end; i += dim)
  43. last = insertNode(i, data[i], data[i + 1], last);
  44. } else {
  45. for (i = end - dim; i >= start; i -= dim)
  46. last = insertNode(i, data[i], data[i + 1], last);
  47. }
  48. if (last && equals(last, last.next)) {
  49. removeNode(last);
  50. last = last.next;
  51. }
  52. return last;
  53. }
  54. function filterPoints(start, end) {
  55. if (!start)
  56. return start;
  57. if (!end)
  58. end = start;
  59. var p = start, again;
  60. do {
  61. again = false;
  62. if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
  63. removeNode(p);
  64. p = end = p.prev;
  65. if (p === p.next)
  66. break;
  67. again = true;
  68. } else {
  69. p = p.next;
  70. }
  71. } while (again || p !== end);
  72. return end;
  73. }
  74. function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
  75. if (!ear)
  76. return;
  77. if (!pass && invSize)
  78. indexCurve(ear, minX, minY, invSize);
  79. var stop = ear, prev, next;
  80. while (ear.prev !== ear.next) {
  81. prev = ear.prev;
  82. next = ear.next;
  83. if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
  84. triangles.push(prev.i / dim | 0);
  85. triangles.push(ear.i / dim | 0);
  86. triangles.push(next.i / dim | 0);
  87. removeNode(ear);
  88. ear = next.next;
  89. stop = next.next;
  90. continue;
  91. }
  92. ear = next;
  93. if (ear === stop) {
  94. if (!pass) {
  95. earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
  96. } else if (pass === 1) {
  97. ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
  98. earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
  99. } else if (pass === 2) {
  100. splitEarcut(ear, triangles, dim, minX, minY, invSize);
  101. }
  102. break;
  103. }
  104. }
  105. }
  106. function isEar(ear) {
  107. var a = ear.prev, b = ear, c = ear.next;
  108. if (area(a, b, c) >= 0)
  109. return false;
  110. var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
  111. var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
  112. var p = c.next;
  113. while (p !== a) {
  114. if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0)
  115. return false;
  116. p = p.next;
  117. }
  118. return true;
  119. }
  120. function isEarHashed(ear, minX, minY, invSize) {
  121. var a = ear.prev, b = ear, c = ear.next;
  122. if (area(a, b, c) >= 0)
  123. return false;
  124. var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
  125. var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
  126. var minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
  127. var p = ear.prevZ, n = ear.nextZ;
  128. while (p && p.z >= minZ && n && n.z <= maxZ) {
  129. if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0)
  130. return false;
  131. p = p.prevZ;
  132. if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0)
  133. return false;
  134. n = n.nextZ;
  135. }
  136. while (p && p.z >= minZ) {
  137. if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0)
  138. return false;
  139. p = p.prevZ;
  140. }
  141. while (n && n.z <= maxZ) {
  142. if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0)
  143. return false;
  144. n = n.nextZ;
  145. }
  146. return true;
  147. }
  148. function cureLocalIntersections(start, triangles, dim) {
  149. var p = start;
  150. do {
  151. var a = p.prev, b = p.next.next;
  152. if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
  153. triangles.push(a.i / dim | 0);
  154. triangles.push(p.i / dim | 0);
  155. triangles.push(b.i / dim | 0);
  156. removeNode(p);
  157. removeNode(p.next);
  158. p = start = b;
  159. }
  160. p = p.next;
  161. } while (p !== start);
  162. return filterPoints(p);
  163. }
  164. function splitEarcut(start, triangles, dim, minX, minY, invSize) {
  165. var a = start;
  166. do {
  167. var b = a.next.next;
  168. while (b !== a.prev) {
  169. if (a.i !== b.i && isValidDiagonal(a, b)) {
  170. var c = splitPolygon(a, b);
  171. a = filterPoints(a, a.next);
  172. c = filterPoints(c, c.next);
  173. earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
  174. earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
  175. return;
  176. }
  177. b = b.next;
  178. }
  179. a = a.next;
  180. } while (a !== start);
  181. }
  182. function eliminateHoles(data, holeIndices, outerNode, dim) {
  183. var queue = [], i, len, start, end, list;
  184. for (i = 0, len = holeIndices.length; i < len; i++) {
  185. start = holeIndices[i] * dim;
  186. end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
  187. list = linkedList(data, start, end, dim, false);
  188. if (list === list.next)
  189. list.steiner = true;
  190. queue.push(getLeftmost(list));
  191. }
  192. queue.sort(compareX);
  193. for (i = 0; i < queue.length; i++) {
  194. outerNode = eliminateHole(queue[i], outerNode);
  195. }
  196. return outerNode;
  197. }
  198. function compareX(a, b) {
  199. return a.x - b.x;
  200. }
  201. function eliminateHole(hole, outerNode) {
  202. var bridge = findHoleBridge(hole, outerNode);
  203. if (!bridge) {
  204. return outerNode;
  205. }
  206. var bridgeReverse = splitPolygon(bridge, hole);
  207. filterPoints(bridgeReverse, bridgeReverse.next);
  208. return filterPoints(bridge, bridge.next);
  209. }
  210. function findHoleBridge(hole, outerNode) {
  211. var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;
  212. do {
  213. if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
  214. var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
  215. if (x <= hx && x > qx) {
  216. qx = x;
  217. m = p.x < p.next.x ? p : p.next;
  218. if (x === hx)
  219. return m;
  220. }
  221. }
  222. p = p.next;
  223. } while (p !== outerNode);
  224. if (!m)
  225. return null;
  226. var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan;
  227. p = m;
  228. do {
  229. if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
  230. tan = Math.abs(hy - p.y) / (hx - p.x);
  231. if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
  232. m = p;
  233. tanMin = tan;
  234. }
  235. }
  236. p = p.next;
  237. } while (p !== stop);
  238. return m;
  239. }
  240. function sectorContainsSector(m, p) {
  241. return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
  242. }
  243. function indexCurve(start, minX, minY, invSize) {
  244. var p = start;
  245. do {
  246. if (p.z === 0)
  247. p.z = zOrder(p.x, p.y, minX, minY, invSize);
  248. p.prevZ = p.prev;
  249. p.nextZ = p.next;
  250. p = p.next;
  251. } while (p !== start);
  252. p.prevZ.nextZ = null;
  253. p.prevZ = null;
  254. sortLinked(p);
  255. }
  256. function sortLinked(list) {
  257. var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;
  258. do {
  259. p = list;
  260. list = null;
  261. tail = null;
  262. numMerges = 0;
  263. while (p) {
  264. numMerges++;
  265. q = p;
  266. pSize = 0;
  267. for (i = 0; i < inSize; i++) {
  268. pSize++;
  269. q = q.nextZ;
  270. if (!q)
  271. break;
  272. }
  273. qSize = inSize;
  274. while (pSize > 0 || qSize > 0 && q) {
  275. if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
  276. e = p;
  277. p = p.nextZ;
  278. pSize--;
  279. } else {
  280. e = q;
  281. q = q.nextZ;
  282. qSize--;
  283. }
  284. if (tail)
  285. tail.nextZ = e;
  286. else
  287. list = e;
  288. e.prevZ = tail;
  289. tail = e;
  290. }
  291. p = q;
  292. }
  293. tail.nextZ = null;
  294. inSize *= 2;
  295. } while (numMerges > 1);
  296. return list;
  297. }
  298. function zOrder(x, y, minX, minY, invSize) {
  299. x = (x - minX) * invSize | 0;
  300. y = (y - minY) * invSize | 0;
  301. x = (x | x << 8) & 16711935;
  302. x = (x | x << 4) & 252645135;
  303. x = (x | x << 2) & 858993459;
  304. x = (x | x << 1) & 1431655765;
  305. y = (y | y << 8) & 16711935;
  306. y = (y | y << 4) & 252645135;
  307. y = (y | y << 2) & 858993459;
  308. y = (y | y << 1) & 1431655765;
  309. return x | y << 1;
  310. }
  311. function getLeftmost(start) {
  312. var p = start, leftmost = start;
  313. do {
  314. if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y)
  315. leftmost = p;
  316. p = p.next;
  317. } while (p !== start);
  318. return leftmost;
  319. }
  320. function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
  321. return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
  322. }
  323. function isValidDiagonal(a, b) {
  324. return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
  325. }
  326. function area(p, q, r) {
  327. return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
  328. }
  329. function equals(p1, p2) {
  330. return p1.x === p2.x && p1.y === p2.y;
  331. }
  332. function intersects(p1, q1, p2, q2) {
  333. var o1 = sign(area(p1, q1, p2));
  334. var o2 = sign(area(p1, q1, q2));
  335. var o3 = sign(area(p2, q2, p1));
  336. var o4 = sign(area(p2, q2, q1));
  337. if (o1 !== o2 && o3 !== o4)
  338. return true;
  339. if (o1 === 0 && onSegment(p1, p2, q1))
  340. return true;
  341. if (o2 === 0 && onSegment(p1, q2, q1))
  342. return true;
  343. if (o3 === 0 && onSegment(p2, p1, q2))
  344. return true;
  345. if (o4 === 0 && onSegment(p2, q1, q2))
  346. return true;
  347. return false;
  348. }
  349. function onSegment(p, q, r) {
  350. return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
  351. }
  352. function sign(num) {
  353. return num > 0 ? 1 : num < 0 ? -1 : 0;
  354. }
  355. function intersectsPolygon(a, b) {
  356. var p = a;
  357. do {
  358. if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b))
  359. return true;
  360. p = p.next;
  361. } while (p !== a);
  362. return false;
  363. }
  364. function locallyInside(a, b) {
  365. return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
  366. }
  367. function middleInside(a, b) {
  368. var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;
  369. do {
  370. if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
  371. inside = !inside;
  372. p = p.next;
  373. } while (p !== a);
  374. return inside;
  375. }
  376. function splitPolygon(a, b) {
  377. var a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev;
  378. a.next = b;
  379. b.prev = a;
  380. a2.next = an;
  381. an.prev = a2;
  382. b2.next = a2;
  383. a2.prev = b2;
  384. bp.next = b2;
  385. b2.prev = bp;
  386. return b2;
  387. }
  388. function insertNode(i, x, y, last) {
  389. var p = new Node(i, x, y);
  390. if (!last) {
  391. p.prev = p;
  392. p.next = p;
  393. } else {
  394. p.next = last.next;
  395. p.prev = last;
  396. last.next.prev = p;
  397. last.next = p;
  398. }
  399. return p;
  400. }
  401. function removeNode(p) {
  402. p.next.prev = p.prev;
  403. p.prev.next = p.next;
  404. if (p.prevZ)
  405. p.prevZ.nextZ = p.nextZ;
  406. if (p.nextZ)
  407. p.nextZ.prevZ = p.prevZ;
  408. }
  409. function Node(i, x, y) {
  410. this.i = i;
  411. this.x = x;
  412. this.y = y;
  413. this.prev = null;
  414. this.next = null;
  415. this.z = 0;
  416. this.prevZ = null;
  417. this.nextZ = null;
  418. this.steiner = false;
  419. }
  420. earcut.deviation = function(data, holeIndices, dim, triangles) {
  421. var hasHoles = holeIndices && holeIndices.length;
  422. var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
  423. var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
  424. if (hasHoles) {
  425. for (var i = 0, len = holeIndices.length; i < len; i++) {
  426. var start = holeIndices[i] * dim;
  427. var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
  428. polygonArea -= Math.abs(signedArea(data, start, end, dim));
  429. }
  430. }
  431. var trianglesArea = 0;
  432. for (i = 0; i < triangles.length; i += 3) {
  433. var a = triangles[i] * dim;
  434. var b = triangles[i + 1] * dim;
  435. var c = triangles[i + 2] * dim;
  436. trianglesArea += Math.abs(
  437. (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1])
  438. );
  439. }
  440. return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
  441. };
  442. function signedArea(data, start, end, dim) {
  443. var sum = 0;
  444. for (var i = start, j = end - dim; i < end; i += dim) {
  445. sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
  446. j = i;
  447. }
  448. return sum;
  449. }
  450. earcut.flatten = function(data) {
  451. var dim = data[0][0].length, result = { vertices: [], holes: [], dimensions: dim }, holeIndex = 0;
  452. for (var i = 0; i < data.length; i++) {
  453. for (var j = 0; j < data[i].length; j++) {
  454. for (var d = 0; d < dim; d++)
  455. result.vertices.push(data[i][j][d]);
  456. }
  457. if (i > 0) {
  458. holeIndex += data[i - 1].length;
  459. result.holes.push(holeIndex);
  460. }
  461. }
  462. return result;
  463. };
  464. }
  465. });
  466. // node_modules/topojson-client/src/reverse.js
  467. function reverse_default(array, n) {
  468. var t, j = array.length, i = j - n;
  469. while (i < --j)
  470. t = array[i], array[i++] = array[j], array[j] = t;
  471. }
  472. // node_modules/topojson-client/src/identity.js
  473. function identity_default(x) {
  474. return x;
  475. }
  476. // node_modules/topojson-client/src/transform.js
  477. function transform_default(transform) {
  478. if (transform == null)
  479. return identity_default;
  480. var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1];
  481. return function(input, i) {
  482. if (!i)
  483. x0 = y0 = 0;
  484. var j = 2, n = input.length, output = new Array(n);
  485. output[0] = (x0 += input[0]) * kx + dx;
  486. output[1] = (y0 += input[1]) * ky + dy;
  487. while (j < n)
  488. output[j] = input[j], ++j;
  489. return output;
  490. };
  491. }
  492. // node_modules/topojson-client/src/feature.js
  493. function feature_default(topology, o) {
  494. if (typeof o === "string")
  495. o = topology.objects[o];
  496. return o.type === "GeometryCollection" ? { type: "FeatureCollection", features: o.geometries.map(function(o2) {
  497. return feature(topology, o2);
  498. }) } : feature(topology, o);
  499. }
  500. function feature(topology, o) {
  501. var id = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o);
  502. return id == null && bbox == null ? { type: "Feature", properties, geometry } : bbox == null ? { type: "Feature", id, properties, geometry } : { type: "Feature", id, bbox, properties, geometry };
  503. }
  504. function object(topology, o) {
  505. var transformPoint = transform_default(topology.transform), arcs = topology.arcs;
  506. function arc(i, points) {
  507. if (points.length)
  508. points.pop();
  509. for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) {
  510. points.push(transformPoint(a[k], k));
  511. }
  512. if (i < 0)
  513. reverse_default(points, n);
  514. }
  515. function point(p) {
  516. return transformPoint(p);
  517. }
  518. function line(arcs2) {
  519. var points = [];
  520. for (var i = 0, n = arcs2.length; i < n; ++i)
  521. arc(arcs2[i], points);
  522. if (points.length < 2)
  523. points.push(points[0]);
  524. return points;
  525. }
  526. function ring(arcs2) {
  527. var points = line(arcs2);
  528. while (points.length < 4)
  529. points.push(points[0]);
  530. return points;
  531. }
  532. function polygon(arcs2) {
  533. return arcs2.map(ring);
  534. }
  535. function geometry(o2) {
  536. var type = o2.type, coordinates;
  537. switch (type) {
  538. case "GeometryCollection":
  539. return { type, geometries: o2.geometries.map(geometry) };
  540. case "Point":
  541. coordinates = point(o2.coordinates);
  542. break;
  543. case "MultiPoint":
  544. coordinates = o2.coordinates.map(point);
  545. break;
  546. case "LineString":
  547. coordinates = line(o2.arcs);
  548. break;
  549. case "MultiLineString":
  550. coordinates = o2.arcs.map(line);
  551. break;
  552. case "Polygon":
  553. coordinates = polygon(o2.arcs);
  554. break;
  555. case "MultiPolygon":
  556. coordinates = o2.arcs.map(polygon);
  557. break;
  558. default:
  559. return null;
  560. }
  561. return { type, coordinates };
  562. }
  563. return geometry(o);
  564. }
  565. // node_modules/topojson-client/src/stitch.js
  566. function stitch_default(topology, arcs) {
  567. var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1;
  568. arcs.forEach(function(i, j) {
  569. var arc = topology.arcs[i < 0 ? ~i : i], t;
  570. if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {
  571. t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;
  572. }
  573. });
  574. arcs.forEach(function(i) {
  575. var e = ends(i), start = e[0], end = e[1], f, g;
  576. if (f = fragmentByEnd[start]) {
  577. delete fragmentByEnd[f.end];
  578. f.push(i);
  579. f.end = end;
  580. if (g = fragmentByStart[end]) {
  581. delete fragmentByStart[g.start];
  582. var fg = g === f ? f : f.concat(g);
  583. fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;
  584. } else {
  585. fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
  586. }
  587. } else if (f = fragmentByStart[end]) {
  588. delete fragmentByStart[f.start];
  589. f.unshift(i);
  590. f.start = start;
  591. if (g = fragmentByEnd[start]) {
  592. delete fragmentByEnd[g.end];
  593. var gf = g === f ? f : g.concat(f);
  594. fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;
  595. } else {
  596. fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
  597. }
  598. } else {
  599. f = [i];
  600. fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;
  601. }
  602. });
  603. function ends(i) {
  604. var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;
  605. if (topology.transform)
  606. p1 = [0, 0], arc.forEach(function(dp) {
  607. p1[0] += dp[0], p1[1] += dp[1];
  608. });
  609. else
  610. p1 = arc[arc.length - 1];
  611. return i < 0 ? [p1, p0] : [p0, p1];
  612. }
  613. function flush(fragmentByEnd2, fragmentByStart2) {
  614. for (var k in fragmentByEnd2) {
  615. var f = fragmentByEnd2[k];
  616. delete fragmentByStart2[f.start];
  617. delete f.start;
  618. delete f.end;
  619. f.forEach(function(i) {
  620. stitchedArcs[i < 0 ? ~i : i] = 1;
  621. });
  622. fragments.push(f);
  623. }
  624. }
  625. flush(fragmentByEnd, fragmentByStart);
  626. flush(fragmentByStart, fragmentByEnd);
  627. arcs.forEach(function(i) {
  628. if (!stitchedArcs[i < 0 ? ~i : i])
  629. fragments.push([i]);
  630. });
  631. return fragments;
  632. }
  633. // node_modules/topojson-client/src/merge.js
  634. function planarRingArea(ring) {
  635. var i = -1, n = ring.length, a, b = ring[n - 1], area = 0;
  636. while (++i < n)
  637. a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0];
  638. return Math.abs(area);
  639. }
  640. function merge_default(topology) {
  641. return object(topology, mergeArcs.apply(this, arguments));
  642. }
  643. function mergeArcs(topology, objects) {
  644. var polygonsByArc = {}, polygons = [], groups = [];
  645. objects.forEach(geometry);
  646. function geometry(o) {
  647. switch (o.type) {
  648. case "GeometryCollection":
  649. o.geometries.forEach(geometry);
  650. break;
  651. case "Polygon":
  652. extract(o.arcs);
  653. break;
  654. case "MultiPolygon":
  655. o.arcs.forEach(extract);
  656. break;
  657. }
  658. }
  659. function extract(polygon) {
  660. polygon.forEach(function(ring) {
  661. ring.forEach(function(arc) {
  662. (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);
  663. });
  664. });
  665. polygons.push(polygon);
  666. }
  667. function area(ring) {
  668. return planarRingArea(object(topology, { type: "Polygon", arcs: [ring] }).coordinates[0]);
  669. }
  670. polygons.forEach(function(polygon) {
  671. if (!polygon._) {
  672. var group = [], neighbors = [polygon];
  673. polygon._ = 1;
  674. groups.push(group);
  675. while (polygon = neighbors.pop()) {
  676. group.push(polygon);
  677. polygon.forEach(function(ring) {
  678. ring.forEach(function(arc) {
  679. polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon2) {
  680. if (!polygon2._) {
  681. polygon2._ = 1;
  682. neighbors.push(polygon2);
  683. }
  684. });
  685. });
  686. });
  687. }
  688. }
  689. });
  690. polygons.forEach(function(polygon) {
  691. delete polygon._;
  692. });
  693. return {
  694. type: "MultiPolygon",
  695. arcs: groups.map(function(polygons2) {
  696. var arcs = [], n;
  697. polygons2.forEach(function(polygon) {
  698. polygon.forEach(function(ring) {
  699. ring.forEach(function(arc) {
  700. if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {
  701. arcs.push(arc);
  702. }
  703. });
  704. });
  705. });
  706. arcs = stitch_default(topology, arcs);
  707. if ((n = arcs.length) > 1) {
  708. for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) {
  709. if ((ki = area(arcs[i])) > k) {
  710. t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki;
  711. }
  712. }
  713. }
  714. return arcs;
  715. }).filter(function(arcs) {
  716. return arcs.length > 0;
  717. })
  718. };
  719. }
  720. export {
  721. feature_default,
  722. merge_default,
  723. require_earcut
  724. };
  725. //# sourceMappingURL=chunk-7ANULLBZ.js.map